Expand description
set_goal / clear_goal tools — model-driven writes to the session’s 5
fixed privileged goal slots (#2347, epic #2343 pillar 3).
Why: agent_loop::goals::GoalSlots is the storage; something must let the
PM’s own model write to it mid-conversation the same way finish_task
(tools::finish_task) lets it signal completion — a schema-validated
ToolExecutor pair, following that module’s stateless-tool pattern except
these two DO hold state: a shared Arc<Mutex<GoalSlots>> handle onto the
live session Transcript (see agent_loop::transcript::Transcript::goals_handle),
rather than an AgentRunner or config dir as delegate_to_agent
(tools::delegate) holds. Both tools write with GoalSource::Model — the
future operator-facing session.set_goal RPC (#2350) writes the same
GoalSlots with GoalSource::Operator through a different call path, not
through these tools.
What: SetGoalTool and ClearGoalTool each wrap an
Arc<Mutex<GoalSlots>>. execute parses/validates the JSON args, then
calls GoalSlots::set/GoalSlots::clear under the lock; an
out-of-range slot or a poisoned lock both become a recoverable
ToolResult::err (never a panic). Registered ONLY in the daemon-session
path’s PM tool registry (task::executor::run_and_record) — run_task’s
one-shot/bake-off path and delegated engineer registries never see these
tools, since goal slots are a session (not sub-agent) feature.
Test: tests::* — schema shape, valid set/clear round-trip through a
shared handle, out-of-range slot error handling for both tools.
Structs§
- Clear
Goal Tool ToolExecutorforclear_goal(#2347).- SetGoal
Tool ToolExecutorforset_goal(#2347).
Constants§
- CLEAR_
GOAL_ TOOL_ NAME - The
clear_goaltool’s registered/advertised name. - SET_
GOAL_ TOOL_ NAME - The
set_goaltool’s registered/advertised name.