diff --git a/docs/development/STRUCTURE.md b/docs/development/STRUCTURE.md index 57cb7e4e9b..cac2f2d875 100644 --- a/docs/development/STRUCTURE.md +++ b/docs/development/STRUCTURE.md @@ -269,7 +269,8 @@ shared/ │ ├── client.py # run_agent(), run_agent_async() │ ├── command.py # build_agent_command() for orchestrator-spawned containers │ ├── result.py # AgentResult dataclass -│ └── tool_interceptor.py # Pre-execution file write checks (Write/Edit/NotebookEdit) against role restrictions +│ ├── tool_interceptor.py # Pre-execution file write checks (Write/Edit/NotebookEdit) against role restrictions +│ └── tool_output_cap.py # Predictive PreToolUse cap for built-in CC tools (Read/Grep): denies calls likely to overflow the 1 MB SDK buffer before they run; tunable via EGG_TOOL_OUTPUT_CAP / EGG_READ_CAP_BYTES (#2876) ├── egg_anchor/ # Agent anchor mechanism for post-compaction state recovery │ ├── __init__.py # Public API exports │ ├── models.py # Pydantic models (AgentAnchor, AnchorMeta, ProgressItem, Decision, BRCState) diff --git a/docs/reference/agent-tools.md b/docs/reference/agent-tools.md index 782a8eb7d1..f2f1be4642 100644 --- a/docs/reference/agent-tools.md +++ b/docs/reference/agent-tools.md @@ -232,6 +232,15 @@ falls back to the 100 KB default. The orchestrator measures the cap against `indent=2`-serialized JSON (matching what its MCP server ships), so raising the cap toward the buffer size stays safe. +**Built-in tool cap (complementary):** The cap above covers egg-owned MCP +`@tool` payloads. Built-in Claude Code tools (`Read`, `Grep`, etc.) run +inside the CLI and can't be wrapped the same way. [#2876](https://github.com/jwbron/egg/issues/2876) +adds a PreToolUse hook that predicts overflows *before* the tool runs and +denies the call with a narrowing hint. See +[Agent Recovery → Predictive Output Cap](agent-recovery.md#predictive-output-cap-pretooluse) +for the heuristic table and the `EGG_TOOL_OUTPUT_CAP` / `EGG_READ_CAP_BYTES` +operator knobs. + ### `cli_command=None` rationale pattern (decision-13) A `ToolRegistration` declares `cli_command=None` for verbs that have