Skip to content

feat(cognition): CommandToolExecutor — the persona's hands (tool calls → core commands) - #1700

Merged
joelteply merged 1 commit into
canaryfrom
feat/persona-command-tool-executor
Jun 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/persona-command-tool-executor

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The diagnosis behind "stupid demos"

The live persona brain can deliberate and speak, but it had no hands: the deliberation agent loop can emit native tool_use calls, yet the only ToolExecutor was a test double. So the persona could never act. (Tool execution historically lived TS-side; when the brain moved to Rust, the tool seam was left as a trait with no production impl.)

What

CommandToolExecutor is that production impl — it routes each native tool call straight to the core command surface (code/read, code/edit, cargo, data/* — the same catalog MCP exposes) via CommandExecutor. No Node in the loop.

  • Tool name == command name (underscore form maps to slash).
  • Dispatches under the persona's own CallerIdentity::local(persona_id) — the same AuthPolicy gate (incl. GridTrustAuthPolicy) that protects every command gates the persona.
  • A failed call feeds back as an error result (model can recover), not a batch failure; results truncate on a char boundary.

Tests

  • routes_native_tool_call_to_the_command — the keystone: "talks" → "acts"
  • maps_underscore_tool_name_to_slash_command
  • failed_call_becomes_error_result_not_batch_failure
  • 3/3 pass.

Next (slice 2 of #15)

Wire this + a default toolset into build_workspace_cycle so the live persona gets hands — then a real coding task over airc becomes possible (clearing the bar: unsloth's agent made a branch).

🤖 Generated with Claude Code

…l calls → core commands)

The diagnosis behind "personas only do stupid demos": the live cognition brain
can deliberate and SPEAK, but it had no hands. The deliberation faculty's
agent loop can emit native tool_use calls, but the ONLY ToolExecutor was a test
double — so the live persona could never act. (Tool execution historically
lived TS-side; when the brain moved to Rust the tool seam was left as a trait
with no production impl.)

CommandToolExecutor is that production impl. It routes each native tool call
straight to the core command surface (code/read, code/edit, cargo, data/* — the
same catalog the MCP server exposes) via CommandExecutor. No Node in the loop:
brain is Rust, tools are Rust commands. Tool name == command name (underscore
form maps to slash). Each call dispatches under the persona's own
CallerIdentity::local(persona_id), so the SAME AuthPolicy gate (incl.
GridTrustAuthPolicy) that protects every command gates the persona too. A failed
call feeds back as an error RESULT (model can recover), not a batch failure;
results truncate on a char boundary so context doesn't blow up.

Tests: routes a native call to the real command (the keystone — "talks"→"acts"),
underscore→slash mapping, failed-call→error-result-not-batch-failure. 3/3 pass.

Slice 1 of #15 (persona-as-client tools). Slice 2 wires this + a default toolset
into build_workspace_cycle so the LIVE persona gets hands.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 620791d into canary Jun 20, 2026
4 checks passed
@joelteply
joelteply deleted the feat/persona-command-tool-executor branch June 20, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant