Crush Agent System Unified Evolution Roadmap (v2.0)
Version: v2.0 · Date: 2026-04-17 (updated from a full codebase audit) · Last updated: 2026-04-18
Scope: internal/agent, internal/agent/subagent, internal/agent/multiagent, internal/a2a, tool & UI coordination layers, and infrastructure modules.
This is a structured summary of a long roadmap post; original details, checklists, and Chinese documentation are preserved in the source.
Key points
- Problem: Multiple agent systems evolved in parallel — the
agenttool (session-level delegation),subagent(async task engine),multiagent(role-based teaming), anda2a(Google A2A protocol server). This caused overlapping capabilities, duplicated concurrency/timeout/cancel logic, orphaned features (Worktree isolation fully implemented but disabled;send_messagetool defined but unregistered;TokenUsage/LoopDetectionmiddleware never invoked), fragmented observability, and unbalanced test coverage. - Target architecture (three layers): 1. Execution Core —
- Key finding from the audit: all three delegation paths converge on
SessionAgent.Run(), but governance layers (concurrency, timeouts, state machines) were duplicated per path. - Stage 0: Baseline observability (PubSub 13+ brokers, PostHog session events, subagent EventMetrics).
- Stage 1: Unified delegation abstraction (
Delegator,DelegationRequest/Result,delegationstatuspackage). - Stage 2:
agenttool compatibility bridge (AgentParams = AgentToolV2Inputalias, v2 viaDelegator.DelegateSync()). - Stage 3: Subagent production hardening — 30+ items: SQLite/memory backends, idempotency, backpressure, middleware chain with failure attribution, migration registry, configurable WAL/busy_timeout.
- Stage 4: Multiagent orchestration reuse —
DelegationExecutorinterface + gray-release flag, unifiedexecuteDelegationWithSessionentry,task_statemetadata mapping. - multiagent
DelegationExecutornow truly routes through the subagent Executor (gray flag retained). - Concurrency unified: multiagent migrated from
execMu.TryLock()to the subagent WorkerPool semaphore model. TokenUsageMiddleware.RecordTokens()wired intoAgentRunner.Execute()step callbacks;LoopDetectionMiddleware.CheckState()invoked per conversation turn; subagent cost tracking viaCostTracker.- Worktree config passed from coordinator;
WorktreeManagerpersistence added. Auto-enable per task type still pending. send_messagedecision finalized;/subagentis the standard delegation entry point; unified UI display of task_id / status / results / cost; A2A routing byagentTypestandardized.internal/metricsregistered 10+ business metrics (tool call duration, active sessions, token cost, subagent task totals, delegation latency, middleware failures).- Subagent EventMetrics made persistent/reportable; PostHog extended with tool/subagent/cost events;
trace_idpropagated session → task → tool_call. HotReloaderandRecoveryManagerenabled inapp.gowith amulti_agent.enabledguard; persistence store used in the normal flow.- Tests added for multiagent Manager/CoordinatorAdapter/MessageBus/HotReloader/Recovery, PubSub brokers, middleware integration, E2E flows, and performance benchmarks (cancel storms, high concurrency).
- Cleanup: two registries merged into one; deprecated
agentv1 behind a configurable switch; store cleanup leak fixed. internal/distributed(leader election, distributed locks),internal/scaling(AutoScaler →Executor.ResizeMaxWorkers),internal/pool, andinternal/market(/marketslash command) all behind experimental env flags (CRUSH_*_EXPERIMENTAL).- PubSub extended toward persistent/cross-node operation.
- Planned: strategy-based routing (auto subagent type/model selection), QoS with priority concurrency slots and token budgets, DAG task dependencies, cross-session teaming topologies.
- Behavior drift during migration — replay benchmarks with fixed samples; diff reports on turns/tools/cost.
- Concurrency/cancellation regressions — failure-injection tests; state-machine validation alarms.
- Log inconsistency — enforced
trace_id/session_id/task_idpropagation. - Worktree leaks — TTL cleanup, startup cleanup, capacity alerts.
- Middleware dead code (audit finding) — integration call sites plus a CI middleware-coverage check.
- Observability fragmentation — unified metric dictionary; persistent EventMetrics.
- Config/runtime mismatch — enabled-flag guards; gray flags wired to real behavior differences.
- Task success rate ≥ 99%; cancel success ≥ 99.5%; delegation P95 latency no worse than baseline by more than 10%.
- Zero critical faults (hangs/state corruption).
- 100% middleware end-to-end coverage (each middleware has at least one integration test).
- ≥ 10 core metrics observable in dashboards; multiagent core test coverage ≥ 80%.
SessionAgent as the single LLM execution kernel.
2. Task Orchestration — subagent Executor as the unified delegation engine (state machine with 6 states, 5 middleware types, WorkerPool, SQLite/memory store, optional Worktree isolation).
3. Organization/Teaming — multiagent Manager (role registry with 7 roles, MessageBus with 8 message types, workspace isolation, persistence/recovery/hot-reload).
Stage progress
Stages 0–4 ✅ Complete
Stage 5: Execution Fusion & Productization ✅
Stage 6: Observability & Cleanup ✅
Stage 7: Distributed & Ecosystem 🔮 In Progress
Risks and mitigations
Acceptance criteria (highlights)
Compatibility & rollout
Old input/output fields preserved with new standard fields (task_id, status) added; behavior differences behind feature flags; rollout via canary → gray → full cutover. Milestones M1–M6 are complete; M7 (distributed/ecosystem) is underway. Evolution principle: staged, observable, rollback-safe.