Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat: add support for Claude plan review permission dialogs by updating rejection regex and footer detection

0xken154f7be695160e
diff --git a/cli/src/lib/__fixtures__/permission-claude-plan.txt b/cli/src/lib/__fixtures__/permission-claude-plan.txt
new file mode 100644
index 000000000..e55921bd8
--- /dev/null
+++ b/cli/src/lib/__fixtures__/permission-claude-plan.txt
@@ -0,0 +1,19 @@
+──────────────────────────────────────────────────────────────────────────────
+ Ready to code?
+
+ Here is Claude's plan:
+╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
+ Plan: desktop-ui-test
+
+ Run pwd once and report the directory.
+╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
+
+──────────────────────────────────────────────────────────────────────────────
+ Claude has written up a plan and is ready to execute. Would you like to proceed?
+
+ ❯ 1. Yes, and use auto mode
+ 2. Yes, manually approve edits
+ 3. Tell Claude what to change
+ shift+tab to approve with this feedback
+
+ ctrl+g to edit in VS Code · ~/.claude/plans/desktop-ui-test.md
diff --git a/cli/src/lib/askQuestion.spec.ts b/cli/src/lib/askQuestion.spec.ts
index c2ee3b515..59d1a5e2b 100644
--- a/cli/src/lib/askQuestion.spec.ts
+++ b/cli/src/lib/askQuestion.spec.ts
@@ -437,6 +437,11 @@ describe('permission prompts, per engine', () => {
question: 'Approve Edit file: README.md',
rows: ['Yes', 'Yes, allow all edits during this session (shift+tab)', 'No'],
},
+ {
+ engine: 'claude', fixture: 'claude-plan',
+ question: 'Approve Claude has written up a plan and is ready to execute. Would you like to proceed?',
+ rows: ['Yes, and use auto mode', 'Yes, manually approve edits', 'Tell Claude what to change'],
+ },
{
engine: 'commandcode', fixture: 'commandcode',
question: 'Approve Execute Shell Command: Command Code needs to execute curl -s https://api.coingecko.com/api/v3/simple/price?ids=bitcoin.',
@@ -502,7 +507,7 @@ describe('permission prompts, per engine', () => {
// ways to approve and none to decline cannot answer the prompt at all. The word varies more than
// it looks — cursor says "Skip", hermes says "Deny" — which is why the shared REJECT_RE lists all
// of them rather than assuming "no".
- expect(view().rows.some((row) => /^(no|reject|deny|skip|cancel)\b/i.test(row.label))).toBe(true)
+ expect(view().rows.some((row) => /^(no|reject|deny|skip|cancel)\b|^tell\b.*\bwhat to change\b/i.test(row.label))).toBe(true)
})
it('is single-select with nothing to type into', () => {
diff --git a/cli/src/lib/askQuestion.ts b/cli/src/lib/askQuestion.ts
index 5da2d91c7..c81cb587a 100644
--- a/cli/src/lib/askQuestion.ts
+++ b/cli/src/lib/askQuestion.ts
@@ -335,11 +335,16 @@ const APPROVE_RE = /^(yes|allow|approve|accept|proceed|run|continue)\b/i
// `skip` is here because cursor's decline row is "Skip & tell the agent what to do instead" — an engine
// whose only way to refuse says neither "no" nor "reject" would otherwise fail the yes/no guard and its
// whole prompt would go unread.
-const REJECT_RE = /^(no|reject|deny|decline|cancel|skip|don'?t|stop)\b/i
+// Claude's plan review does not use a negative verb at all: its only refusal
+// row is "Tell Claude what to change". Keep `tell ... what to change` narrow so
+// an ordinary numbered list beginning with "Tell" cannot become an approval.
+const REJECT_RE = /^(no|reject|deny|decline|cancel|skip|don'?t|stop)\b|^tell\b.*\bwhat to change\b/i
/** The key hints a permission dialog prints under its rows: claude `Esc to cancel \u00b7 Tab to amend`,
* Command Code `\u2191/\u2193 navigate \u00b7 enter select \u00b7 ctrl+e explain`. Proximity to the rows is what makes this
* a guard and not a search \u2014 it must sit within a few lines UNDER them. */
-const PERMISSION_FOOTER_RE = /\besc\b|enter\s+select|ctrl\+e/i
+// Claude's plan review footer changed from Esc/Tab hints to
+// "shift+tab to approve with this feedback" plus ctrl+g.
+const PERMISSION_FOOTER_RE = /\besc\b|enter\s+select|ctrl\+e|shift\+tab\s+to\s+approve/i
/** The solid rule that opens the frame. Deliberately NOT the dashed one (`\u254c`) that brackets an edit diff,
* which sits BELOW the header and would cost the title. */
const FRAME_RULE_RE = /^\s*[\u2500\u2501\u2550]{6,}\s*$/