summaryrefslogtreecommitdiff
path: root/docs/usage.md
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 17:33:04 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 17:33:04 +0200
commit944838bb0f753a0920ddb2f506758c410ed7ca43 (patch)
tree12d6ae9e2de8878891159e363134a3f07686ed7a /docs/usage.md
parentc802ba5803de1a53749bb5c4ecbc0159fceb385f (diff)
Fix amp agent prompt extraction to use TUI box pattern
Amp CLI runs in TUI mode with box-drawing UI (│ text │) similar to Cursor, not shell-style (> prompt). Updated prompt pattern from `(?m)>\s*(.+)$` to `(?m)│\s*(.+?)\s*│\s*$` to correctly extract text from amp's box UI. Changes: - internal/tmuxedit/config_agent.go: Update amp promptPat to box pattern - internal/tmuxedit/config_agent_test.go: Update test to use box format - docs/usage.md: Document detection order and clear methods for all agents - docs/tmux.md: Clarify input mode handling (Vim vs Emacs/readline) - config.toml.example: Add detailed agent descriptions and patterns - prompts/tmux-edit-integration-tests.md: Add test status, mock editor best practices Integration tests verified: - Amp detection: amp/sourcegraph keywords - Prompt extraction: "hello world test" correctly captured - End-to-end workflow: text modification and sending works - Multi-line support: all lines delivered correctly - All unit tests pass (67/67) - Coverage: 80.9% (meets requirement) - Cursor and Claude implementations unchanged Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'docs/usage.md')
-rw-r--r--docs/usage.md21
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/usage.md b/docs/usage.md
index 9a6d9ed..8c2d0a6 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -159,11 +159,22 @@ This is useful when working with AI CLI agents (Claude Code, Cursor, Amp, Aider,
### Supported agents
-Built-in agent detection (auto-detected from pane content):
-- **Claude Code** -- detects "claude" or "anthropic" in pane
-- **Cursor** -- detects "cursor" in pane, strips "INSERT"/"Add a follow-up"
-- **Amp** -- detects "amp" or "sourcegraph" in pane
-- **Aider** -- detects "aider" in pane
+Built-in agent detection (auto-detected from pane content, checked in order):
+
+1. **Cursor** -- detects box-drawing UI `│ →` or footer `/ commands · @ files`
+ - Clears with: `End BSpace*200` (backspace method)
+ - Prompt pattern: Extracts from last `│...│` box
+2. **Claude Code** -- detects `❯` prompt symbol, "claude code", or "anthropic"
+ - Clears with: `Escape gg C-v G d i` (Vi/Vim style)
+ - Prompt pattern: Extracts from last section between `─────` rules
+3. **Amp** -- detects "amp" or "sourcegraph" in pane (TUI mode)
+ - Clears with: `C-u` (Emacs/readline style)
+ - Prompt pattern: Extracts from `│...│` box UI (similar to Cursor)
+4. **Aider** -- detects "aider" in pane
+ - Clears with: `C-u` (Emacs/readline style)
+ - Prompt pattern: Shell-style `> prompt`
+
+**Detection order matters**: Cursor and Claude are checked first to avoid false positives. For example, Cursor may display "Claude 4.5 Sonnet" as its model name, but Cursor's distinctive `│ →` box UI is matched first.
Additional agents can be added via `[tmux_edit.agents]` in config.toml without code changes.