refactor: update autocompaction tools and concurrency tools

This commit is contained in:
Richard Tang
2026-05-01 14:27:38 -07:00
parent b826e70d8c
commit b939a875a7
6 changed files with 48 additions and 21 deletions
@@ -30,19 +30,38 @@ logger = logging.getLogger(__name__)
LLM_COMPACT_CHAR_LIMIT: int = 240_000
LLM_COMPACT_MAX_DEPTH: int = 10
# Microcompaction: tools whose results can be safely cleared
# Microcompaction: tools whose results can be safely cleared from context
# because the agent can re-derive them on demand. The bar for inclusion is
# "old result has no irreversible value": file content can be re-read, a
# search can be re-run, a screenshot can be re-captured, terminal output can
# be re-fetched, etc. Write / edit results are short confirmations whose
# value is in the side effect, not the message — also fair game.
COMPACTABLE_TOOLS: frozenset[str] = frozenset(
{
# File ops — content lives on disk, re-readable.
"read_file",
"run_command",
"web_search",
"web_fetch",
"search_files",
"write_file",
"edit_file",
"apply_patch",
"hashline_edit",
"pdf_read",
# Terminal — re-runnable; advanced job/output tools produce verbose
# logs whose recent state is what matters.
"terminal_exec",
"terminal_rg",
"terminal_find",
"terminal_output_get",
"terminal_job_logs",
# Web / research — pages and queries can be re-fetched.
"web_scrape",
"search_papers",
"download_paper",
"search_wikipedia",
# Browser read-only inspection — current page state is what matters,
# old snapshots are stale by definition.
"browser_screenshot",
"browser_snapshot",
"browser_html",
"browser_get_text",
}
)
@@ -40,7 +40,6 @@ _QUEEN_INDEPENDENT_TOOLS = [
"read_file",
"write_file",
"edit_file",
"hashline_edit",
"search_files",
# NOTE (2026-04-16): ``run_parallel_workers`` is not in the DM phase.
# Pure DM is for conversation with the user; fan out parallel work via
@@ -240,7 +239,10 @@ re-read state.
See "Independent execution" for the per-step flow and granularity rule.
## File I/O (files-tools MCP)
- read_file, write_file, edit_file, hashline_edit, search_files
- read_file, write_file, edit_file, search_files
- edit_file covers single-file fuzzy find/replace (mode='replace', default) \
and multi-file structured patches (mode='patch'). Patch mode supports \
Update / Add / Delete / Move atomically across many files in one call.
- search_files covers grep/find/ls in one tool: target='content' to \
search inside files, target='files' (with a glob like '*.py') to list \
or find files. Mtime-sorted in files mode.
@@ -4,7 +4,7 @@ Every queen inherits the same MCP surface (all servers loaded for the
queen agent), but exposing 94+ tools to every persona clutters the LLM
tool catalog and wastes prompt tokens. This module defines a sensible
default allowlist per queen persona so, e.g., Head of Legal doesn't
see port scanners and Head of Finance doesn't see ``apply_patch``.
see port scanners and Head of Brand & Design doesn't see CSV/SQL tools.
Defaults apply only when the queen has no ``tools.json`` sidecar the
moment the user saves an allowlist through the Tool Library, the
+14 -8
View File
@@ -72,19 +72,25 @@ class ToolRegistry:
# File system reads
"read_file",
"search_files",
"grep",
"glob",
# Web reads
"web_search",
"web_fetch",
"pdf_read",
# Terminal reads (rg / find / output buffer polling — neither
# changes process state)
"terminal_rg",
"terminal_find",
"terminal_output_get",
# Web / research reads (re-issuable, side-effect-free fetches)
"web_scrape",
"search_papers",
"search_wikipedia",
"download_paper",
# Browser read-only snapshots (mutate-free observations)
"browser_screenshot",
"browser_snapshot",
"browser_console",
"browser_get_text",
# Background bash polling - reads output buffers only, does
# not touch the subprocess itself.
"bash_output",
"browser_html",
"browser_get_attribute",
"browser_get_rect",
}
)
-1
View File
@@ -30,7 +30,6 @@ _ALWAYS_AVAILABLE_TOOLS: frozenset[str] = frozenset(
"write_file",
"edit_file",
"search_files",
"hashline_edit",
"set_output",
"escalate",
}
+4 -3
View File
@@ -42,10 +42,11 @@ _WORKER_INHERITED_TOOLS: frozenset[str] = frozenset(
"read_file",
"write_file",
"edit_file",
"hashline_edit",
"search_files",
# Shell
"run_command",
# Terminal (basics — exec + ripgrep + glob/find)
"terminal_exec",
"terminal_rg",
"terminal_find",
# Framework synthetics (always available to any AgentLoop node)
"set_output",
"escalate",