agent loop: claude drives; tool envelope (log/run/status/log)
This commit is contained in:
parent
a061f83cfa
commit
3c9d42b2a7
6 changed files with 147 additions and 47 deletions
22
CLAUDE.md
22
CLAUDE.md
|
|
@ -173,9 +173,29 @@ The turn loop in `hive-ag3nt serve` writes
|
|||
Each turn invokes:
|
||||
|
||||
```
|
||||
claude --print --mcp-config <path> --tools <builtins> --allowedTools <builtins+mcp> <prompt>
|
||||
claude --print --model haiku --mcp-config <path> --tools <builtins> --allowedTools <builtins+mcp> <prompt>
|
||||
```
|
||||
|
||||
**Loop control.** The harness pops one inbox message (the wake signal) per
|
||||
cycle and hands claude a prompt naming the agent, the sender, the body,
|
||||
and the MCP tools. Claude drives any further `recv`/`send` itself —
|
||||
harness no longer relays claude's stdout as a reply. Stdout is logged for
|
||||
debugging; the side effects (sends via MCP) are what matter.
|
||||
|
||||
**Tool envelope.** Every MCP tool handler in `hive_ag3nt::mcp::AgentServer`
|
||||
wraps its logic in `run_tool(name, args_debug, async { ... })`. The
|
||||
envelope guarantees:
|
||||
1. Pre-log of the request (tool + args).
|
||||
2. The tool's own logic runs.
|
||||
3. A status line is appended to the result body
|
||||
(`[status] N unread message(s) in inbox`) so claude always sees the
|
||||
current inbox depth without an extra tool call.
|
||||
4. Post-log of the full result.
|
||||
|
||||
`AgentRequest::Status` is the non-mutating peek that powers the status
|
||||
line (broker's `count_pending`). When adding new tools (manager surface,
|
||||
notes/state, etc.), use `run_tool` and they pick up the envelope for free.
|
||||
|
||||
**Tool whitelist** (see `ALLOWED_BUILTIN_TOOLS` in `hive-ag3nt::mcp`):
|
||||
- Allowed built-ins: `Bash`, `Edit`, `Glob`, `Grep`, `NotebookEdit`, `Read`,
|
||||
`TodoWrite`, `Write`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue