feat: parallel tool execution + agent teams#2831
Open
TheArchitectit wants to merge 64 commits intoultraworkers:mainfrom
Open
feat: parallel tool execution + agent teams#2831TheArchitectit wants to merge 64 commits intoultraworkers:mainfrom
TheArchitectit wants to merge 64 commits intoultraworkers:mainfrom
Conversation
When the model API returns a context_window_blocked error (because the request exceeds the model's context window), the CLI now automatically: 1. Compact the session (remove old messages to free up space) 2. Retry the original request with the compacted session 3. Report results to the user This eliminates the need for users to manually run /compact when they hit context limits - the recovery happens automatically. ## Technical Details - Detection: Looks for 'context_window' or 'Context window' in error message - Uses runtime::compact_session() to aggressively compact (max_estimated_tokens=0) - Creates new runtime with compacted session and retries the turn - Reports compaction results and final status to user ## Testing Tested successfully with a request that exceeded model's context: - Auto-compact triggered: 'Messages removed 19, Messages kept 5' - Successfully retried and completed after compaction
…t-window-error feat: auto-compact and retry on context window errors
When the model API returns a context_window_blocked error (because the request exceeds the model's context window), the CLI now automatically: 1. Compact the session (remove old messages to free up space) 2. Retry the original request with the compacted session 3. Report results to the user This eliminates the need for users to manually run /compact when they hit context limits - the recovery happens automatically. ## Technical Details - Detection: Looks for 'context_window' or 'Context window' in error message - Uses runtime::compact_session() to aggressively compact (max_estimated_tokens=0) - Creates new runtime with compacted session and retries the turn - Reports compaction results and final status to user ## Testing Tested successfully with a request that exceeded model's context: - Auto-compact triggered: 'Messages removed 19, Messages kept 5' - Successfully retried and completed after compaction
…rl+P Adds an interactive setup wizard that lets users configure their provider, API key, base URL, and model without setting environment variables. Configuration is persisted to ~/.claw/settings.json (with 0600 permissions). New features: - `claw setup` CLI subcommand runs the wizard from the terminal - `/setup` slash command runs the wizard inside the REPL (hot-swaps model) - Ctrl+P hotkey in the REPL triggers /setup for in-session provider swap - Stored provider config used as fallback when env vars are absent - Three-tier auth resolution: env var > .env file > stored config - RuntimeProviderConfig struct and validation in settings schema Co-Authored-By: Claude Opus 4.7 <[email protected]>
Ctrl+P now inserts a sentinel char (\x01) that the highlighter renders as a cyan "[Provider Swap]" prompt. User presses Enter to confirm and launch the setup wizard. Returns ReadOutcome::ProviderSwap so the REPL loop can hot-swap the model and reprint the connection line. Also fixes clippy warnings: merged duplicate match arms in provider_config_value, doc_markdown on ProviderKind, map_unwrap_or idioms in setup_wizard.rs, and pre-existing clippy issues in main.rs and commands/lib.rs. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Previously /resume latest only searched the current workspace's fingerprinted session directory. If you started claw from a different directory, it found zero sessions even though sessions existed elsewhere on disk. Changes: - Add global_sessions_root() pointing to ~/.claw/sessions/ - Add scan_global_sessions() to scan all workspace namespaces - Modify latest_session() to fall back to global scan when no workspace-local sessions are found - Add load_session_loose() that skips workspace validation for alias references (latest/last/recent) so cross-workspace resume works while still enforcing workspace check for explicit IDs - Wire load_session_loose() into CLI's load_session_reference() - Add provider field to config validation schema (needed because user's settings.json already has the provider key) Co-Authored-By: Claude Opus 4.7 <[email protected]>
The previous implementation only scanned ~/.claw/sessions/ for the global fallback, but sessions are actually stored in the project-local <cwd>/.claw/sessions/<fingerprint>/ by SessionStore::from_cwd(). Now scans both the global root and the project-local parent directory (checking all fingerprint subdirs) so /resume latest finds sessions regardless of where they're stored. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Previously /resume latest returned the most recently created session, which was always the empty one just created on startup. Now it skips sessions with 0 messages and excludes the current session ID, so it finds the previous session with actual conversation history. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Implement complete LSP support for code intelligence tools: - lsp_transport.rs: JSON-RPC 2.0 transport over stdio with Content-Length framing, async request/response handling, and graceful shutdown - lsp_process.rs: LSP process manager with initialize handshake, and methods for hover, goto_definition, references, document_symbols, completion, format - lsp_discovery.rs: Auto-discovery of installed LSP servers (rust-analyzer, clangd, gopls, pyright, typescript-language-server, etc.) with PATH lookup - lsp_client.rs: Rewired LspRegistry to use real LSP processes instead of placeholder JSON, with lazy-start on first dispatch call - config.rs: Added LspServerConfig for user-configured LSP servers - config_validate.rs: Validation for lsp config section - main.rs: CLI integration with server discovery at startup, /lsp slash command for status/start/stop/restart, and graceful shutdown on exit - commands/src/lib.rs: Added SlashCommand::Lsp variant The LSP tool is now available to the agent for hover, definition, references, symbols, completion, and diagnostics queries. Servers are auto-discovered at REPL startup and lazily started on first use. Co-Authored-By: Claude Opus 4.7 <[email protected]>
rust-analyzer installed through rustup exits non-zero on --version
("Unknown binary in official toolchain"), which caused discovery
to skip it. Changed command_exists_on_path to treat any successful
spawn as "found", regardless of exit code — only a failure to
spawn (command not found) means the server isn't available.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
…chment Wire LSP into the Read/Edit/Write tool flow so the agent automatically gets diagnostics after file operations: - lsp_transport: Add LspServerMessage enum, read_message() for handling both responses and server-initiated notifications, notification queue with drain_notifications(), send_request now handles interleaved publishDiagnostics without breaking - lsp_process: Add did_open(), did_change(), drain_diagnostics(), open file tracking (HashSet) and version counters for didChange, language_id_for_path() and severity_name() helpers - lsp_client: Add notify_file_open(), notify_file_change(), fetch_diagnostics_for_file() with best-effort graceful fallback, registry-level open file tracking, diagnostic caching - tools: Enrich run_read_file with didOpen + diagnostics, run_write_file and run_edit_file with didChange + diagnostics, format_diagnostic_appendix() for readable diagnostic output appended to tool results All enrichment is non-blocking: if no LSP server is available, tools work exactly as before. No errors propagate from the LSP layer. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Split the three large LSP files into module directories with sub-files: lsp_transport/ (was 560 lines): - mod.rs (425) — types + LspTransport impl - tests.rs (134) — test module lsp_process/ (was 929 lines): - mod.rs (436) — LspProcess struct + public methods + error types - parse.rs (311) — helper functions and LSP response parsers - tests.rs (194) — test module lsp_client/ (was 1338 lines): - mod.rs (466) — LspRegistry struct + impl, re-exports from types - types.rs (103) — LspAction, LspDiagnostic, LspServerStatus, etc. - dispatch.rs (224) — LspRegistry::dispatch() method - tests.rs (273) — core registry tests - tests_lifecycle.rs (294) — lifecycle and integration tests All files under 500 lines. All 501 runtime tests pass. Clippy clean. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…transport modules - Add lsp_auto_start field to RuntimeFeatureConfig (default: true) - Add lspAutoStart bool field validation in config_validate - Parse lspAutoStart from config JSON - Auto-start discovered LSP servers on REPL init when enabled - Add /lsp toggle command to enable/disable auto-start at runtime - Remove lsp_client.rs, lsp_process.rs, lsp_transport.rs (2831 lines) — functionality consolidated into discovery-based auto-start - Show auto-start status in /lsp status output
Implement complete LSP support for code intelligence tools: - lsp_transport.rs: JSON-RPC 2.0 transport over stdio with Content-Length framing, async request/response handling, and graceful shutdown - lsp_process.rs: LSP process manager with initialize handshake, and methods for hover, goto_definition, references, document_symbols, completion, format - lsp_discovery.rs: Auto-discovery of installed LSP servers (rust-analyzer, clangd, gopls, pyright, typescript-language-server, etc.) with PATH lookup - lsp_client.rs: Rewired LspRegistry to use real LSP processes instead of placeholder JSON, with lazy-start on first dispatch call - config.rs: Added LspServerConfig for user-configured LSP servers - config_validate.rs: Validation for lsp config section - main.rs: CLI integration with server discovery at startup, /lsp slash command for status/start/stop/restart, and graceful shutdown on exit - commands/src/lib.rs: Added SlashCommand::Lsp variant The LSP tool is now available to the agent for hover, definition, references, symbols, completion, and diagnostics queries. Servers are auto-discovered at REPL startup and lazily started on first use. Co-Authored-By: Claude Opus 4.7 <[email protected]>
rust-analyzer installed through rustup exits non-zero on --version
("Unknown binary in official toolchain"), which caused discovery
to skip it. Changed command_exists_on_path to treat any successful
spawn as "found", regardless of exit code — only a failure to
spawn (command not found) means the server isn't available.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
…chment Wire LSP into the Read/Edit/Write tool flow so the agent automatically gets diagnostics after file operations: - lsp_transport: Add LspServerMessage enum, read_message() for handling both responses and server-initiated notifications, notification queue with drain_notifications(), send_request now handles interleaved publishDiagnostics without breaking - lsp_process: Add did_open(), did_change(), drain_diagnostics(), open file tracking (HashSet) and version counters for didChange, language_id_for_path() and severity_name() helpers - lsp_client: Add notify_file_open(), notify_file_change(), fetch_diagnostics_for_file() with best-effort graceful fallback, registry-level open file tracking, diagnostic caching - tools: Enrich run_read_file with didOpen + diagnostics, run_write_file and run_edit_file with didChange + diagnostics, format_diagnostic_appendix() for readable diagnostic output appended to tool results All enrichment is non-blocking: if no LSP server is available, tools work exactly as before. No errors propagate from the LSP layer. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Split the three large LSP files into module directories with sub-files: lsp_transport/ (was 560 lines): - mod.rs (425) — types + LspTransport impl - tests.rs (134) — test module lsp_process/ (was 929 lines): - mod.rs (436) — LspProcess struct + public methods + error types - parse.rs (311) — helper functions and LSP response parsers - tests.rs (194) — test module lsp_client/ (was 1338 lines): - mod.rs (466) — LspRegistry struct + impl, re-exports from types - types.rs (103) — LspAction, LspDiagnostic, LspServerStatus, etc. - dispatch.rs (224) — LspRegistry::dispatch() method - tests.rs (273) — core registry tests - tests_lifecycle.rs (294) — lifecycle and integration tests All files under 500 lines. All 501 runtime tests pass. Clippy clean. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…transport modules - Add lsp_auto_start field to RuntimeFeatureConfig (default: true) - Add lspAutoStart bool field validation in config_validate - Parse lspAutoStart from config JSON - Auto-start discovered LSP servers on REPL init when enabled - Add /lsp toggle command to enable/disable auto-start at runtime - Remove lsp_client.rs, lsp_process.rs, lsp_transport.rs (2831 lines) — functionality consolidated into discovery-based auto-start - Show auto-start status in /lsp status output
Remove SlashCommand::Setup (provider wizard), PROVIDER_FIELDS (provider config), and stale imports that leaked in from the feat/lsp-integration branch which included other PRs. Also fix pre-existing clippy findings (Duration::from_hours, is_ok_and).
…SP, resume-latest)
Add the 3-stage Trident compaction strategy from R.A.D.1.C.A.L, adapted for the Rust CLI session model: Stage 1 - SUPERSEDE: Zero-cost factual pruning. If a file was read and then later written/edited, the earlier read is obsolete and removed. Earlier writes superseded by later writes are also dropped. Stage 2 - COLLAPSE: Buffer short chatty exchanges (under 200 chars, no tool calls) and collapse them into dense summary blocks when the threshold is exceeded. Stage 3 - CLUSTER: Group semantically similar messages (same tool names, same file paths, similar lengths) using Jaccard-based fingerprinting and collapse clusters into summary blocks. All three stages run before the existing summary-based compaction, so less data needs to be summarized. Wired into both /compact and the auto-compact retry on context window errors.
…e retry - Add TimeoutConfig to HTTP client builder with connect_timeout (30s) and request_timeout (5min) defaults, configurable via CLAW_API_CONNECT_TIMEOUT and CLAW_API_REQUEST_TIMEOUT env vars - Add with_timeout() builder to both AnthropicClient and OpenAiCompatClient for per-client timeout configuration - Parse Retry-After header on 429 responses and use it to override exponential backoff delay when present - Add ApiTimeoutConfig to runtime config with apiTimeout settings in ~/.claw/settings.json (connectTimeout, requestTimeout, maxRetries) - Add retry_after field to ApiError::Api for propagating rate limit backoff hints through the retry pipeline
Some providers/proxies return HTTP 400 with bodies like "no parseable body" or "connection reset" during transient network blips. These are not real bad requests — they're gateway errors wearing a 400 mask. Detect known gateway error phrases in 400 response bodies and mark them as retryable so the existing exponential backoff handles them.
- compact.rs: fix panic when preserve_recent_messages=0 - main.rs: progressive 4-round auto-compact retry with session_mut fix - main.rs: detect "no parseable body" as context window overflow - anthropic.rs: remove debug eprintln - error.rs: add "no parseable body" to CONTEXT_WINDOW_ERROR_MARKERS - config.rs, lib.rs: conflict resolution fixes from merge 💘 Generated with Crush Assisted-by: GLM 5.1 FP8 via Crush <[email protected]>
When the model returns multiple tool_use blocks in a single response, read-only tools (read_file, glob_search, grep_search, WebFetch, WebSearch, LSP, Git*) now execute concurrently via std::thread::scope instead of sequentially. Architecture: - Add ToolCall/ToolResult types to ToolExecutor trait - Add execute_batch() with default sequential fallback - CliToolExecutor overrides execute_batch to classify tools as parallel-safe or sequential, then runs parallel-safe tools concurrently via thread scopes - run_turn refactored into 3 phases: 1. Pre-hooks + permission checks (sequential, hooks may mutate state) 2. Tool execution (batch, parallel for read-only tools) 3. Post-hooks + session updates (sequential, preserves ordering) Safety guarantees: - Pre/post hooks always run sequentially - Permission checks complete before any tool executes - Tool results pushed to session in original model order - Fallback to sequential for single-tool batches
Add a SubAgent tool that lets the main model delegate multi-step read and search tasks to a fast, inexpensive sub-agent. The sub-agent runs autonomously with its own ConversationRuntime, making multiple tool calls without round-tripping through the main model. - SubAgent tool with prompt, task_type (Explore/Plan/Verify), and optional model override - Explore: read_file, glob_search, grep_search, WebFetch, WebSearch - Plan: Explore + TodoWrite - Verify: Plan + bash - subagentModel config field in settings.json (falls back to main model) - Uses ProviderRuntimeClient + SubagentToolExecutor (same as Agent tool) This dramatically reduces token usage for information-gathering tasks. Example: "find all Rust files that import X and summarize their usage" → one SubAgent call instead of 10 sequential main-model round trips.
Add an optional "Fast Model" prompt to the setup wizard for configuring the SubAgent's fast/cheap model. This is saved as `subagentModel` in settings.json. Press Enter to skip — SubAgent falls back to the main model if not configured.
…nt for exploration
Match Claude Code's architecture: a single Agent tool with subagent_type (Explore/Plan/Verification) that uses the subagentModel setting when no explicit model override is provided. The separate SubAgent tool is removed since it duplicated existing functionality.
- Agent tool is now parallel-safe: multiple Agent calls execute concurrently
- AgentMessage tool: send/read/broadcast between agents via shared mailbox
- TeamCreate rewired to spawn real Agent threads instead of TaskRegistry
- Agents set CLAWD_AGENT_ID env var so they can identify themselves for messaging
- AgentMessage added to Explore/Plan/Verification sub-agent tool lists
- Team manifest persisted to .clawd-agents/teams/{team_id}.json
- Add missing AgentMessage dispatch entry in execute_tool_with_enforcer (tool spec existed but couldn't actually be called) - Add AgentMessage to Explore/Plan/Verification/general-purpose allowed_tools lists so sub-agents can communicate - Add debug logging to resolve_agent_model and load_subagent_model_from_config to diagnose subagentModel config chain Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
Add 'mode' field to TeamCreate that auto-generates agent teams: - "2x" = 2 Explore + 2 Plan + 2 Verification = 6 agents - "4x" = 4 Explore + 4 Plan + 4 Verification = 12 agents - "6x" = 6 Explore + 6 Plan + 6 Verification = 18 agents When mode is set, 'prompt' provides the shared task description and 'tasks' is ignored. Also add 'subagent_type' and 'model' fields to manual task items for per-task role and model control. Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
Instead of erroring when neither mode nor tasks are specified, default to "2x" (2 Explore + 2 Plan + 2 Verification = 6 agents). Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
The combined branch had the old setup_wizard without prompt_fast_model() and save_settings_field(), so claw setup never asked for the subagent model. Restore the provider-wizard version that includes the fast model prompt and writes subagentModel to settings.json. Co-Authored-By: Claude Opus 4.7 <[email protected]>
The fast model prompt (prompt_fast_model, subagentModel) was lost during the merge into feat/all-prs-combined. This adds it back so claw setup asks for a smaller/cheaper model for Agent subtasks and writes subagentModel to ~/.claw/settings.json. Co-Authored-By: Claude Opus 4.7 <[email protected]>
- TeamStatus tool with 3 actions:
- status: live snapshot (running/completed/failed counts, agent details)
- summary: final results when agents finish (includes result content)
- events: timeline from append-only event log
- Background team watcher thread spawned by TeamCreate:
- Polls agent .json files every 2s
- Prints [team] progress to stderr on agent completion/failure
- Updates team manifest status when all agents finish
- Writes events to .clawd-agents/teams/{team_id}-events.jsonl
- TeamStatus added to PARALLEL_SAFE_TOOLS and all agent allowed_tools
Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
…agentModel Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
On REPL start, check for missing provider.apiKey, provider.baseUrl, and subagentModel. Print a warning with instructions to run `claw setup` or `/setup` if any are absent. Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
- Agents post completion/failure to team inbox on termination
(.clawd-agents/mailbox/team/{team_id}/{agent_id}-{ts}.json)
- Team watcher reads from inbox instead of polling .json files
- New TeamStatus action=inbox reads team messages from the inbox
- AgentOutput carries team_id, persisted in manifest
- AgentInput accepts team_id from TeamCreate
- TeamCreate passes team_id to each spawned agent
- Inbox cleaned up when all agents finish
Co-authored-by: GLM 5.1 FP8 via Crush <[email protected]>
…nitoring - TeamInboxReporter: per-tool-call progress reporting to team inbox - TaskClaim tool: atomic claim/release/list with .clawd-agents/claims/ lock files - Team-scoped task_ids to prevent cross-team claim collisions - AgentSuggestion tool: propose AGENTS.md additions (human review required) - ContextRequest tool: iterative retrieval with 3-cycle budget for sub-agents - Context-window-aware auto-compaction (70% threshold) prevents overflow - Model token limits for qwen/glm/generic models with 131K fallback - Reviewer subagent_type: read-only tools, no bash/write - Team mode presets: 1x-6x (tiny/small/medium/large/xlarge/mega) - /team slash command + Ctrl+T toggle (off by default, CLAWD_AGENT_TEAMS=1) - TeamDelete: disk-based deletion with inbox/claims cleanup - TeamStatus: kill stuck agents, list AGENTS.md suggestions - AGENTS.md: auto-loaded shared learnings in sub-agent system prompt - Periodic git commits every 5 tool calls via TeamInboxReporter - Claims released on failure/panic in spawn_agent_job - Fixed doubled .clawd-agents/.clawd-agents/ paths (set CLAWD_AGENT_STORE abs) - Fixed "unknown error" in team watcher (added error field to inbox messages) 💘 Generated with Crush Assisted-by: GLM 5.1 FP8 via Crush <[email protected]>
345d44d to
7ab899c
Compare
Some OpenAI-compatible providers (e.g., GLM-5) omit the `id` field in streaming and non-streaming responses. Adding #[serde(default)] allows the parser to accept these responses instead of failing with "missing field `id`". Co-Authored-By: Claude Opus 4.7 <[email protected]>
Adds scripts/install.sh that builds the release binary and links it to ~/.local/bin/claw. Run after code changes to update the CLI. Co-Authored-By: Claude Opus 4.7 <[email protected]>
When a provider returns HTML (e.g., error page, wrong endpoint) instead of JSON in an SSE stream, provide a clear error message instead of hanging or failing with a cryptic parse error. Co-Authored-By: Claude Opus 4.7 <[email protected]>
When a provider returns a JSON error (e.g., {"error":{"message":"..."}})
without SSE framing (no "data:" prefix), the SSE parser was silently
ignoring it and hanging. Now detects and surfaces these errors.
Also handles HTML responses that lack SSE framing.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Some providers (GLM, DeepSeek) emit reasoning tokens in `reasoning_content` or nested `thinking.content` fields instead of `content`. Added support for these fields so reasoning models work correctly. Co-Authored-By: Claude Opus 4.7 <[email protected]>
The final streaming chunk from some providers contains only finish_reason and usage, with no delta field. Made it optional to prevent parse errors. Co-Authored-By: Claude Opus 4.7 <[email protected]>
When preserve_recent_messages == 0, raw_keep_from equals messages.len(), causing index out of bounds when accessing session.messages[k]. Added k >= session.messages.len() check to prevent panic. Reason: Compaction with preserve_recent_messages=0 triggered OOB access when checking for tool-use/tool-result pair preservation at boundary. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Author
Review Checklist — Parallel Tool Execution + Agent TeamsUser-facing behavior added
Config keys / CLI flags changed
Migration or compatibility notes
Tests run locally
Known risks / non-goals
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements parallel tool execution and a full agent teams system that mimics Claude Code's agent teams architecture (reference: Claude Code Agent Teams Guide).
Parallel Tool Execution
When the model returns multiple
tool_useblocks, read-only tools execute concurrently viastd::thread::scopeinstead of sequentially. The 3-phaserun_turnloop:PARALLEL_SAFE_TOOLS)Agent Teams System
Full multi-agent coordination system with inbox-based messaging, task claiming, and automatic progress reporting.
Team Creation & Modes
TeamCreatetool spawns N agents in parallel OS threads with isolated contextstiny/1x(4 agents),small/2x(8),medium/3x(12),large/4x(16),xlarge/5x(20),mega/6x(24)/team on|off|statusorCtrl+T(off by default)Mailbox Messaging
AgentMessagetool: send, read, broadcast between agents.clawd-agents/mailbox/team/{team_id}/agent_completed/agent_failedposted automaticallyTask Claiming
TaskClaimtool: claim, release, list — atomic lock files prevent duplicate work.clawd-agents/claims/{task_id}.lockwith agent_id, team_id, timestampProgress Reporting
TurnProgressReportertrait: callback after each tool call inrun_turnTeamInboxReporter: implements the trait, writestool_progressevents to team inboxReviewer Agents
Reviewersubagent_type with read-only tools (no bash, no write)AgentMessage,TaskClaim,TeamStatusfor coordinationAGENTS.md System
AgentSuggestiontool: agents propose additions to AGENTS.md (pattern, pitfall, style).clawd-agents/suggestions/JSON files for human reviewTeamStatus action=suggestionslists pending suggestionsContext Management
ContextRequesttool: iterative retrieval with 3-cycle budget for sub-agentsTeam Monitoring
TeamStatustool with 5 actions: status, summary, events, inbox, kill[team]progress to stderrTeamStatus action=killwrites kill file that agent checksSubAgent → Agent Evolution
SubAgenttool, consolidated intoAgentwithsubagentModelconfigsubagentModelfield in settings.json for fast model configurationFiles Changed
Core Runtime (
rust/crates/runtime/)conversation.rs— 3-phaserun_turnloop,TurnProgressReportertrait,with_auto_compaction_input_tokens_threshold,with_turn_progress_reporterbuilderconfig.rs—RuntimeProviderConfigstruct,ApiTimeoutConfig, provider/subagent_model fields onRuntimeFeatureConfigconfig_validate.rs— Validation for provider, lsp, lspAutoStart, apiTimeout, subagentModel fieldslib.rs— Exports forTurnProgressReporter,RuntimeProviderConfig,ApiTimeoutConfigAPI Layer (
rust/crates/api/)providers/mod.rs—model_token_limit(),ModelTokenLimitstruct, qwen/glm/generic fallback entries,max_tokens_for_model_with_override()lib.rs— Exports formodel_token_limit,ModelTokenLimiterror.rs—ContextWindowExceededvariant with detailed token budget infoTools (
rust/crates/tools/)lib.rs— All team tools, agent system, inbox architecture:TeamCreate— spawns agents with role, team_id, task_idTeamStatus— status/summary/events/inbox/kill/suggestionsTeamDelete— disk-based deletion with cleanupAgentMessage— send/read/broadcastTaskClaim— claim/release/list with atomic lock filesAgentSuggestion— propose AGENTS.md additionsContextRequest— iterative retrieval with 3-cycle budgetTeamInboxReporter— per-tool-call progress to team inboxexpand_team_mode()— 1x-6x / tiny-small-medium-large-xlarge-mega presetsrun_agent_job()— context-window-aware auto-compaction, CLAWD_AGENT_STORE fixspawn_agent_job()— claim release on failure/panicbuild_agent_system_prompt()— loads AGENTS.mdclaims_dir(),claim_task(),release_claim(),list_claims()post_agent_completion_to_team_inbox()with error fieldCLI (
rust/crates/rusty-claude-cli/)main.rs— PARALLEL_SAFE_TOOLS,/teamslash command handler,Ctrl+Ttoggle, config validation on startup, TeamStatus/TaskClaim/AgentSuggestion/ContextRequest in safe toolsinput.rs—ReadOutcome::TeamToggle,Ctrl+Tbinding (\x02sentinel)setup_wizard.rs— Fast model prompt saves assubagentModelCommands (
rust/crates/commands/)lib.rs—SlashCommand::Team { action }variant,/teamparse mapping and slash_nameArchitecture Diagram
Test Plan