claudeacp: Config.TaskTools gives each claude its to-do tools #14

Merged
mikluko merged 2 commits from todo-tools-env into main 2026-11-16 10:34:52 +00:00
Owner

At the owner's word ("Это нужно в claudeacp добавлять ... возможно как опцию"): the library that turns the Task tools into ACP plans sees to it that the claude it starts has them, as an option.

Config.TaskTools bool sets CLAUDE_CODE_ENABLE_TODO_TOOLS=1 in the environment of each claude the agent starts. Measured with claude 2.1.325 (-p --output-format stream-json --verbose, the tools of the init message): by default the Todo/Task family is Task and TaskStop; with the variable TaskCreate, TaskGet, TaskList, TaskUpdate are there too (CLAUDE_CODE_ENABLE_TASKS changes nothing). The caller's word wins: an agent environment or a session's _meta env that already has the variable keeps its value, so 0 turns the tools off.

Off by default, as Config's other fields are (zero value = today's behaviour): an existing client that shows no plans has no use for the tools, and they lengthen claude's tool list. roomcity's host turns it on, one line with the go.mod bump after a release.

Test: TestTaskToolsVariable reads the launched process's environment (the spec the fake claude is spawned with): absent by default, 1 with the option, the session's 0 and the process environment's 0 kept. The README line where plans are described and the changelog say it. go test ./... -race and go vet pass. Command-line use is unchanged: claudeacp's own flags do not set it; a library caller does.

No release in this PR: the version and its word are the owner's, to be cut as 0.6.0 was (a changelog heading and date in a pull request).

At the owner's word ("Это нужно в claudeacp добавлять ... возможно как опцию"): the library that turns the Task tools into ACP plans sees to it that the claude it starts has them, as an option. `Config.TaskTools bool` sets `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` in the environment of each claude the agent starts. Measured with claude 2.1.325 (`-p --output-format stream-json --verbose`, the tools of the init message): by default the Todo/Task family is `Task` and `TaskStop`; with the variable `TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate` are there too (`CLAUDE_CODE_ENABLE_TASKS` changes nothing). The caller's word wins: an agent environment or a session's `_meta` env that already has the variable keeps its value, so `0` turns the tools off. **Off by default**, as `Config`'s other fields are (zero value = today's behaviour): an existing client that shows no plans has no use for the tools, and they lengthen claude's tool list. roomcity's host turns it on, one line with the go.mod bump after a release. Test: `TestTaskToolsVariable` reads the launched process's environment (the spec the fake claude is spawned with): absent by default, `1` with the option, the session's `0` and the process environment's `0` kept. The README line where plans are described and the changelog say it. `go test ./... -race` and `go vet` pass. Command-line use is unchanged: `claudeacp`'s own flags do not set it; a library caller does. No release in this PR: the version and its word are the owner's, to be cut as 0.6.0 was (a changelog heading and date in a pull request).
claudeacp: Config.TaskTools gives each claude its to-do tools
Some checks failed
CI / Changelog (pull_request) Successful in 7s
CI / Test (pull_request) Successful in 47s
CI / Lint (pull_request) Failing after 46s
e14e8aaad4
A claude run with no terminal has neither TodoWrite nor the Task tools, so the
plan path of plan.go had nothing to turn into plans. The option sets
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 for each claude it starts, unless the
environment already has the variable.

Assisted-By: Claude <noreply@anthropic.com>
Author
Owner

Read at e14e8aa: the suite passes here under -race, and the option does what it says: off by default, 1 with it, and a value the agent's environment or the session's _meta already holds is kept.

Two things before it merges and is tagged.

  1. CI / Lint is red: claudeacp/serve_test.go:305:13: Error return value of os.Unsetenv is not checked (errcheck).

  2. The comment on Config.TaskTools carries the reason for the default ("a client that shows no plans has no use for the tools, and they make claude's tool list longer") and the list of tools claude gains. The first is why this and not the other choice, which is the commit's to say, and the second is claude's, which changes without this line changing. What a caller is owed is the contract: it sets CLAUDE_CODE_ENABLE_TODO_TOOLS=1 for each claude the agent starts, and leaves a value the environment or a session's _meta already has.

For the release: a pull request that moves Unreleased under the version and its date, as 0.6.0 was cut. The owner's word for releases now covers this repository (as specs-18 relays it), so I merge that one after reading it and the tag follows.

Read at e14e8aa: the suite passes here under `-race`, and the option does what it says: off by default, `1` with it, and a value the agent's environment or the session's `_meta` already holds is kept. Two things before it merges and is tagged. 1. `CI / Lint` is red: `claudeacp/serve_test.go:305:13: Error return value of os.Unsetenv is not checked (errcheck)`. 2. The comment on `Config.TaskTools` carries the reason for the default ("a client that shows no plans has no use for the tools, and they make claude's tool list longer") and the list of tools claude gains. The first is why this and not the other choice, which is the commit's to say, and the second is claude's, which changes without this line changing. What a caller is owed is the contract: it sets `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` for each claude the agent starts, and leaves a value the environment or a session's `_meta` already has. For the release: a pull request that moves Unreleased under the version and its date, as 0.6.0 was cut. The owner's word for releases now covers this repository (as specs-18 relays it), so I merge that one after reading it and the tag follows.
claudeacp: check Unsetenv's error in the test, and keep the option's comment to its contract
All checks were successful
CI / Changelog (pull_request) Successful in 5s
CI / Test (pull_request) Successful in 49s
CI / Lint (pull_request) Successful in 55s
8f2ea9b901
Assisted-By: Claude <noreply@anthropic.com>
mikluko deleted branch todo-tools-env 2026-11-16 10:34:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/claudeacp!14
No description provided.