Skip to content

Commit 03959e5

Browse files
byapparovclaude
andcommitted
refactor(session): remove the question tool and plan mode (#147)
The question tool and plan mode need a person at the keyboard. Headless runs only kept them in check through session deny rules, and the model was still offered their schemas on every step. - delete the question tool, the Question module and its rejection handling in the processor, and AICTRL_ENABLE_QUESTION_TOOL - delete the plan agent, plan_enter/plan_exit, the plan-mode reminders and plan-file helper, and AICTRL_EXPERIMENTAL_PLAN_MODE - delete two base prompts that nothing imports (copilot-gpt-5.txt, anthropic-20250930.txt) - drop the deny rules that run and the GitHub agent created for these tools - `aictrl run --agent plan` now fails with INVOCATION_INVALID_ARGUMENTS instead of falling back to the default agent, which can edit files Compatibility: the question/plan_enter/plan_exit permission keys still load as no-ops, and sessions whose history calls these tools still continue. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7bef3e0 commit 03959e5

34 files changed

Lines changed: 179 additions & 1510 deletions

‎.opencode/agent/translator.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,6 @@ AICTRL_EXPERIMENTAL_LSP_TOOL
587587
AICTRL_EXPERIMENTAL_LSP_TY
588588
AICTRL_EXPERIMENTAL_OUTPUT_TOKEN_MAX
589589
AICTRL_EXPERIMENTAL_OXFMT
590-
AICTRL_EXPERIMENTAL_PLAN_MODE
591-
AICTRL_ENABLE_QUESTION_TOOL
592590
AICTRL_FAKE_VCS
593591
AICTRL_GIT_BASH_PATH
594592
AICTRL_MODEL
@@ -717,7 +715,6 @@ zenobi-us/aictrl-skillful
717715
.aictrl/commands/
718716
.aictrl/commands/test.md
719717
.aictrl/modes/
720-
.aictrl/plans/*.md
721718
.aictrl/plugins/
722719
.aictrl/skills/<name>/SKILL.md
723720
.aictrl/skills/git-release/SKILL.md

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ and [JSON event reference](EVENTS.md).
6868

6969
### Non-Interactive Execution
7070

71-
In headless mode, Aictrl automatically rejects all interactive permission requests (like `question` or `plan_enter`), ensuring your pipelines never hang.
71+
In headless mode, Aictrl automatically rejects all interactive permission requests, ensuring your pipelines never hang.
7272

7373
`aictrl run` does not offer the `todowrite` tool: its definition adds about 2.4k tokens to
7474
every request, and a one-shot run has nobody following a todo list. To track a plan, instruct

‎packages/cli/src/acp/README.md‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ aictrl acp
4444
aictrl acp --cwd /path/to/project
4545
```
4646

47-
### Question Tool Opt-In
48-
49-
ACP excludes `QuestionTool` by default.
50-
51-
```bash
52-
AICTRL_ENABLE_QUESTION_TOOL=1 aictrl acp
53-
```
54-
55-
Enable this only for ACP clients that support interactive question prompts.
56-
5747
### Programmatic
5848

5949
```typescript

‎packages/cli/src/agent/agent.ts‎

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import PROMPT_SUMMARY from "./prompt/summary.txt"
1515
import PROMPT_TITLE from "./prompt/title.txt"
1616
import { PermissionNext } from "@/permission/next"
1717
import { mergeDeep, pipe, sortBy, values } from "remeda"
18-
import { Global } from "@/global"
1918
import path from "path"
2019
import { Plugin } from "@/plugin"
2120
import { Skill } from "../skill"
@@ -60,9 +59,6 @@ export namespace Agent {
6059
"*": "ask",
6160
...Object.fromEntries(whitelistedDirs.map((dir) => [dir, "allow"])),
6261
},
63-
question: "deny",
64-
plan_enter: "deny",
65-
plan_exit: "deny",
6662
// mirrors github.com/github/gitignore Node.gitignore pattern for .env files
6763
read: {
6864
"*": "allow",
@@ -85,37 +81,7 @@ export namespace Agent {
8581
name: "build",
8682
description: "The default agent. Executes tools based on configured permissions.",
8783
options: {},
88-
permission: PermissionNext.merge(
89-
defaults,
90-
PermissionNext.fromConfig({
91-
question: "allow",
92-
plan_enter: "allow",
93-
}),
94-
user,
95-
),
96-
mode: "primary",
97-
native: true,
98-
},
99-
plan: {
100-
name: "plan",
101-
description: "Plan mode. Disallows all edit tools.",
102-
options: {},
103-
permission: PermissionNext.merge(
104-
defaults,
105-
PermissionNext.fromConfig({
106-
question: "allow",
107-
plan_exit: "allow",
108-
external_directory: {
109-
[path.join(Global.Path.data, "plans", "*")]: "allow",
110-
},
111-
edit: {
112-
"*": "deny",
113-
[path.join(".aictrl", "plans", "*.md")]: "allow",
114-
[path.relative(Instance.worktree, path.join(Global.Path.data, path.join("plans", "*.md")))]: "allow",
115-
},
116-
}),
117-
user,
118-
),
84+
permission: PermissionNext.merge(defaults, user),
11985
mode: "primary",
12086
native: true,
12187
},

‎packages/cli/src/cli/cmd/github.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,7 @@ export const GithubRunCommand = cmd({
523523

524524
// Setup aictrl session
525525
const repoData = await fetchRepo()
526-
session = await Session.create({
527-
permission: [
528-
{
529-
permission: "question",
530-
action: "deny",
531-
pattern: "*",
532-
},
533-
],
534-
})
526+
session = await Session.create({})
535527
subscribeSessionEvents()
536528
shareId = await (async () => {
537529
if (share === false) return

‎packages/cli/src/cli/cmd/run.ts‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -496,23 +496,13 @@ export const RunCommand = cmd({
496496
await fail("--fork requires --continue or --session", "INVOCATION_INVALID_ARGUMENTS")
497497
}
498498

499-
const rules: PermissionNext.Ruleset = [
500-
{
501-
permission: "question",
502-
action: "deny",
503-
pattern: "*",
504-
},
505-
{
506-
permission: "plan_enter",
507-
action: "deny",
508-
pattern: "*",
509-
},
510-
{
511-
permission: "plan_exit",
512-
action: "deny",
513-
pattern: "*",
514-
},
515-
]
499+
// fail instead of the unknown-agent fallback: the default agent can edit files a plan run expects to stay untouched
500+
if (args.agent === "plan") {
501+
await fail(
502+
"The plan agent was removed. For a read-only run, deny edit and bash through `permission` config.",
503+
"INVOCATION_INVALID_ARGUMENTS",
504+
)
505+
}
516506

517507
function input(id?: string, body?: Record<string, unknown>) {
518508
if (!args.attach) return { ...(id ? { sessionID: id } : {}), ...body }
@@ -531,7 +521,7 @@ export const RunCommand = cmd({
531521

532522
const prompt = [...args.message, ...(args["--"] || [])].join(" ")
533523
const title = sessionTitle({ title: args.title, prompt, message, command: args.command })
534-
const result = await sdk.session.create(input(undefined, { title, permission: rules }))
524+
const result = await sdk.session.create(input(undefined, { title }))
535525
return result.data?.id
536526
}
537527

@@ -973,7 +963,7 @@ export const RunCommand = cmd({
973963
schemaVersion: SCHEMA_VERSION,
974964
model: args.model,
975965
agent: agent,
976-
permissions: PermissionNext.merge(agentInfo.permission, rules),
966+
permissions: agentInfo.permission,
977967
})
978968

979969
let aborted = false

‎packages/cli/src/config/config.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ export namespace Config {
626626
external_directory: PermissionRule.optional(),
627627
todowrite: PermissionAction.optional(),
628628
todoread: PermissionAction.optional(),
629-
question: PermissionAction.optional(),
630629
webfetch: PermissionAction.optional(),
631630
websearch: PermissionAction.optional(),
632631
codesearch: PermissionAction.optional(),
@@ -1034,15 +1033,13 @@ export namespace Config {
10341033
mode: z
10351034
.object({
10361035
build: Agent.optional(),
1037-
plan: Agent.optional(),
10381036
})
10391037
.catchall(Agent)
10401038
.optional()
10411039
.describe("@deprecated Use `agent` field instead."),
10421040
agent: z
10431041
.object({
10441042
// primary
1045-
plan: Agent.optional(),
10461043
build: Agent.optional(),
10471044
// subagent
10481045
general: Agent.optional(),

‎packages/cli/src/flag/flag.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export namespace Flag {
2121
export declare const AICTRL_DISABLE_PROJECT_CONFIG: boolean
2222
export const AICTRL_FAKE_VCS = process.env["AICTRL_FAKE_VCS"]
2323
export declare const AICTRL_CLIENT: string
24-
export const AICTRL_ENABLE_QUESTION_TOOL = truthy("AICTRL_ENABLE_QUESTION_TOOL")
2524
export declare const AICTRL_MODEL_STREAM_IDLE_TIMEOUT_MS: number
2625

2726
// Experimental
@@ -34,7 +33,6 @@ export namespace Flag {
3433
export const AICTRL_EXPERIMENTAL_LSP_TY = truthy("AICTRL_EXPERIMENTAL_LSP_TY")
3534
export const AICTRL_EXPERIMENTAL_LSP_TOOL = AICTRL_EXPERIMENTAL || truthy("AICTRL_EXPERIMENTAL_LSP_TOOL")
3635
export const AICTRL_DISABLE_FILETIME_CHECK = truthy("AICTRL_DISABLE_FILETIME_CHECK")
37-
export const AICTRL_EXPERIMENTAL_PLAN_MODE = AICTRL_EXPERIMENTAL || truthy("AICTRL_EXPERIMENTAL_PLAN_MODE")
3836
export const AICTRL_MODELS_URL = process.env["AICTRL_MODELS_URL"]
3937
export const AICTRL_MODELS_PATH = process.env["AICTRL_MODELS_PATH"]
4038

‎packages/cli/src/id/id.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export namespace Identifier {
66
session: "ses",
77
message: "msg",
88
permission: "per",
9-
question: "que",
109
user: "usr",
1110
part: "prt",
1211
pty: "pty",

‎packages/cli/src/question/index.ts‎

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)