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
commitbe73769b81b57f9a90475a45f23b2c447178ff2a (patch)
tree0ffa602318b02ab2636daddcda6b7d3d46e768de /docs/usage.md
parent4892fc63fa3a68d3e837a88b1254de849567227f (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.