mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
The goal tool logs its message as its own `goal` type with an `icon://flag` verb headline such as `Setting goal` that names the action without quoting argument text, and a plugin message handler renders it as an AIM badge with green accent styles distinct from the teal response family so goal activity reads like the other dedicated tool surfaces. Regression tests cover the log entry and headline. Validation: pytest plugins/_goal/tests/test_goal_tool_ui.py plugins/_goal/tests/test_goal_plugin.py
3.7 KiB
3.7 KiB
Goal Plugin DOX
Purpose
- Own the built-in chat goal strip,
/goalslash command, goal state API, and agent-facing goal tools. - Keep chat goals scoped to the active chat context and stored as user data outside tracked plugin code.
Ownership
plugin.yamlowns the always-enabled_goalplugin metadata.tools/goal.pyowns the single agent-facing goal tool, file-backed state underusr/plugins/_goal/goals/, and goal status normalization.- The tool logs its message as type
goalwith anicon://flagverb headline such asSetting goal, without quoting argument text;extensions/webui/get_message_handler/owns theAIMbadge presentation andextensions/webui/get_process_step_types/registers the type. api/goal.pyowns the WebUI JSON API for reading, editing, pausing, resuming, and deleting goals.commands/owns the/goalslash command contributed to_commands.webui/andextensions/webui/own the composer goal strip, Goal mode shortcut, and inline controls.tools/goal.pyandprompts/agent.system.tool.goal.mdown agent-facing goal inspection, creation, and status updates.tools/response.pyoverrides the core response tool so an active goal continues the current monologue.extensions/python/message_loop_prompts_after/owns injecting the active goal into agent context.
Local Contracts
- Goal status values are
active,paused,complete, andblocked. - The
goaltool reads legacy action valuesshow/statusforget,setforcreate, and directcomplete/blockedforupdatewithstatus; prompts document only canonical actions. - Active goals are injected into agent extras; paused and blocked goals remain visible in the UI, while complete goals are hidden.
- Goal records track accumulated active time with
elapsed_secondsandactive_since; pausing freezes elapsed time until resume. - User controls may pause, resume, edit, or delete a goal; destructive delete uses inline confirmation. Model tools may create goals and mark them complete or blocked.
- Saving an edit that reactivates a complete or blocked goal resends the edited objective so agent processing resumes.
/goal <objective>creates the goal and sends the objective as the user message so the agent starts working immediately.- The composer Goal mode shortcut only prefills
/goaland focuses the input; it never sends the command. /goal autofills the composer with a prompt asking the agent to create and manage its own goal instead of silently sending a message.- While a goal is active, response-tool calls are intermediate updates; only completing or blocking the goal restores normal loop termination.
- Goal UI feedback uses toast notifications and inline controls, not modal dialogs.
- Goal state changes publish a context revision through the shared state-push lifecycle; the WebUI refreshes on context or revision changes and never polls the Goal API while idle.
- Snapshot refreshes run without delaying chat rendering. Clear the previous chat's goal when refreshing a new selection; only the latest selected-chat request may apply results, and stale requests must not finish a newer load.
Work Guidance
- Keep goal state in
usr/plugins/_goal/; do not store runtime goal data in tracked files. - Keep the goal strip mounted through WebUI extension points instead of modifying core composer templates.
- Keep
_commandscompatibility in mind:/goalis a plugin-contributed command and should remain read-only in the command manager.
Verification
- Run
conda run -n a0 pytest plugins/_goal/testsafter changing_goalbackend behavior. - Run
_commandsdiscovery tests when changing the/goalcommand contribution contract.
Child DOX Index
No child DOX files.