DuDuClaw Architecture Overview
Architecture Overview (reviewed against v1.67.0)
Section titled “Architecture Overview (reviewed against v1.67.0)”DuDuClaw is a Multi-Runtime AI Agent Platform — supporting Claude Code / Codex / Antigravity / Grok CLI (plus OpenAI-compatible APIs) as AI backends via a unified AgentRuntime trait with auto-detection and per-agent configuration (Gemini CLI has been removed; Antigravity remains supported). DuDuClaw is not a standalone LLM product; it is the plumbing layer that turns one (or many) AI CLIs into long-running agents with channel routing, session memory, self-evolution, multi-account rotation, local LLM inference, browser automation, and IDE integration.
Key Architectural Decisions
Section titled “Key Architectural Decisions”Runtime & Transport
Section titled “Runtime & Transport”- Multi-Runtime (
AgentRuntimetrait) — 12 runtime ids inruntime_catalog.rs: eleven CLI backends (Claude, Codex, Antigravity (agy), Grok, Qwen Code, Kimi Code, GitHub Copilot CLI, Kiro, Cursor, Mistral Vibe, OpenCode) plus OpenAI-compat HTTP. Four CLIs and OpenAI-compat have their own modules; the other seven CLIs share one generic print-mode runtime.RuntimeRegistryauto-detection, per-agent config inagent.toml [runtime] provider. - Cross-runtime failover model substitution (
failover.rs): when[runtime] fallbacksends a call to a different provider, the fallback runtime no longer inherits the primary’s model id (a codex agent’sgpt-5.4used to be spawned against the Claude runtime). The model is resolved in four ordered branches — ① the firstagent.toml [model] fallbacksentry whose family confidently belongs to the fallback runtime (qualifiedprovider/modelentries are unqualified), ② keep the requested model when that runtime already serves it (this is howopenai_compat, which declares no model family, keeps proxying arbitrary ids), ③ the runtime catalog’s own first model for that backend, ④ otherwise refuse to spawn and reportno model configured for fallback runtime <P>, recorded as a failed attempt. Every substitution emits awarn!carryingagent/from_runtime/to_runtime/from_model/to_model. - MCP Server (stdio) (
duduclaw mcp-server) exposes channel, memory, agent, skill, task, shared wiki, and autopilot tools to AI Runtime via JSON-RPC 2.0 over stdin/stdout. Registered at the agent level in<agent>/.mcp.json(v1.8.5 reverted v1.8.4’s global registration because Claude CLI-p --dangerously-skip-permissionsonly reads project-level.mcp.json). Gateway startup auto-creates/repairs.mcp.jsonfor all agents. - MCP Server (HTTP/SSE) (
duduclaw http-server --bind 127.0.0.1:8765, v1.9.4) — Bearer-authenticatedPOST /mcp/v1/call(single JSON-RPC tool call),GET /mcp/v1/stream(SSE long-lived event stream, Bearer /?api_key=),POST /mcp/v1/stream/call(async + SSE result push),GET /healthz(no auth). Token bucket rate limit (60 req/min).mcp_sse_store.rsmanages SSE connections with broadcast channels. Complements stdio for external HTTP clients. - ACP and A2A —
duduclaw acp(=duduclaw acp client) implements Agent Client Protocol v1 over stdio for Zed / JetBrains / Neovim agent panels.duduclaw acp server(formerlyacp-server, removed in v1.69.0) serves A2A:message/sendappends tobus_queue.jsonl,tasks/getmaps bus observations back to A2A states, and the Agent Card is at/.well-known/agent-card.json(legacy/agent.jsonalias). - Agent directories are Claude Code compatible: each contains
.claude/,.mcp.json,SOUL.md,CLAUDE.md,CONTRACT.toml,agent.toml,wiki/,SKILLS/,memory/,tasks/,state/.
Channels (11)
Section titled “Channels (11)”- Telegram (long polling) — file/photo/sticker/voice, forums/topics, mention-only, voice transcription through the OpenAI Whisper API.
- LINE (webhook) — HMAC-SHA256 signature, sticker catalog, per-chat settings.
- Discord (Gateway WebSocket) —
tokio::select!heartbeat, slash commands, auto-thread; voice channels (Songbird) only in builds with the non-defaultdiscord-voicefeature, which release binaries do not include. v1.9.2 hardened: real op 6 RESUME (persistssession_id+resume_gateway_url+ sequence), stall watchdog (break if no traffic for 2× heartbeat interval), heartbeat capacity 1→16 withtry_send, op 9 jitter 1-5s, RESUMED dispatch handling, backoff cap 60s. - Slack (Socket Mode), WhatsApp (Cloud API webhook, signature fail-closed), Feishu (Open Platform v2), Google Chat (webhook, JWT-verified), Microsoft Teams (Azure Bot / Connector v3, JWT-verified), WeCom (HMAC-SHA1 + AES-256-CBC), DingTalk (HMAC-SHA256 + time window), WebChat (
/ws/chat+ React frontend). - The generic
POST /webhook/{agent_id}endpoint was never mounted and was removed in v1.66; inbound webhooks belong to individual channels and to Odoo (POST /webhook/odoo). - Channel hot-start/stop: Dashboard
channels.add/channels.removelaunches/aborts the channel task without gateway restart. - Media pipeline: image auto-resize (max 1568px) + MIME detection + Vision integration.
Sub-Agent Orchestration
Section titled “Sub-Agent Orchestration”create_agent/spawn_agent/list_agentsMCP tools withreports_tohierarchy.- System prompt auto-injects “## Your Team” sub-agent roster.
- Structured handoff:
DelegationEnvelope(context / constraints / task_chain / expected_output) with Raw fallback. - TaskSpec workflow: multi-step task planning with dependency-aware scheduling, auto-retry (3x), replan (2x), persistence.
- Long-response splitting: Sub-agent replies wider than the channel byte budget are split via
channel_format::split_textwith📨 **agent** 的回報 (1/N)/(續 2/N)labels (Discord 1900 / Telegram 4000 / LINE 4900 / Slack 3900). - Orphan response recovery:
reconcile_orphan_responsesatomically replaysbus_queue.jsonlentries left behind by crash / Ctrl+C / hotswap.
Session Memory Stack
Section titled “Session Memory Stack”- Native multi-turn: Claude CLI
--resume <session-id>with SHA-256 deterministic session ID; auto-fallback to history-in-prompt when--resumefails (stale handle, account rotation, unknown stream-json error). - Turn trimming (>800 chars → head 300 + tail 200 +
[trimmed N chars], CJK-safe). - Direct API prompt cache (“system_and_3” breakpoint strategy; no measured hit rate is published).
- Compression summaries injected into system prompt (not conversation turns) at 50k token threshold.
- Instruction Pinning (v1.8.6 P0) — first user turn → async Haiku extraction of core task → stored in
sessions.pinned_instructions→ injected at system prompt tail (U-shaped attention). Clarification answers accumulate (≤1000 chars). - Snowball Recap (v1.8.6 P0) — every turn prepends
<task_recap>to the user message. Zero LLM cost. - P2 Key-Fact Accumulator (v1.8.6) — per substantive turn, Haiku extracts 2-4 key facts →
key_factstable with FTS5 → top-3 relevant facts injected into system prompt. ~100-150 tokens vs MemGPT’s 6,500 (−87%). - CLI lightweight path —
call_claude_cli_lightweight()with--effort medium --max-turns 1 --no-session-persistence --tools ""for metadata tasks. 25-40% cost reduction. - Stabilization flags —
--strict-mcp-config(MCP isolation) +--exclude-dynamic-system-prompt-sections(cross-turn prompt stability, 10-15% token reduction).--barewas removed in v1.8.11 (broke OS keychain credential lookup).
Evolution
Section titled “Evolution”- Prediction-driven engine: Active Inference + Dual Process Theory; by design most conversations end without an LLM call (no measured share is published). Moderate errors are stored as episodic memory; Significant errors start an AEE evolution round; Critical errors (or three Significant in a row) start an emergency round; a small exploration share of Negligible errors (ε, hard floor 5%) also starts one.
- MetaCognition: self-calibrating error thresholds every 100 predictions.
- MistakeNotebook: cross-loop error memory prevents regression; entries now carry deterministic
TrajectoryEvidence(which tool/assertion failed) so reflection consolidation stops trusting unverified self-reported diagnosis (Evolution v3). SOUL.mdis read-only for agents (Evolution v3, WP1.1 — operator/dashboard writes only). The legacy Generator→Verifier→Updater rewrite path,SOUL.mdversioning, the 24h observation window and automatic rollback were removed on 2026-09-29 (S11): with nothing able to write the file on an agent’s behalf, they guarded a path that no longer existed.- AEE (Agentic Evolution Engine, the only evolution engine): the evolution target is not
SOUL.mdbut a playbook of small, independently-retirable gene-shaped entries (category/signals/eval-case-linked), evolved through a Gate (deterministic, veto-keeping) / Measure (scored, no veto) split, a champion + matches-or-improves commit gate, and entry-level (not whole-file) observation windows. Seeevolution-engine.mdch.12 anddocs/features/38-aee-playbook-evolution.md. - Agent-as-Evaluator: independent Evaluator Agent (Haiku cost control) for adversarial verification with structured JSON verdicts.
- ConversationOutcome: zero-LLM conversation result detection (TaskType / Satisfaction / Completion) in zh-TW + en.
- External factors: user feedback, security events, channel metrics, Odoo business context, peer agent signals feed into the prediction engine and evolution rounds.
Wiki Knowledge Layer (v1.8.9)
Section titled “Wiki Knowledge Layer (v1.8.9)”- 4-layer architecture (Vault-for-LLM inspired): L0 Identity / L1 Core / L2 Context / L3 Deep.
- Trust weighting (
trust0.0-1.0 frontmatter) — search results ranked by trust-weighted score. - Auto-injection:
build_system_prompt()auto-injects L0+L1 pages into WIKI_CONTEXT across CLI / channel reply / dispatcher paths — unified across the Claude / Codex / Antigravity / Grok / OpenAI-compat runtimes. - FTS5 index (
unicode61tokenizer) — auto-syncs on every write/delete, manual rebuild viawiki_rebuild_fts. - Knowledge graph:
wiki_graphMCP tool exports BFS-limited Mermaid diagrams; node shapes by layer. - Dedup detection:
wiki_dedupdetects duplicate pages by title match + tag Jaccard similarity (≥0.8). - Reverse backlink index: scans
relatedfrontmatter + body markdown links for bidirectional mapping. - Search filters:
wiki_search(either scope) supportsmin_trust,layer,expand(1-hop backlink expansion). - Shared Wiki:
~/.duduclaw/shared/wiki/for cross-agent SOPs, policies, product specs. Visibility controlled viawiki_visible_tocapability.
Memory System
Section titled “Memory System”- Cognitive memory (optional):
SqliteMemoryEnginewith episodic/semantic separation and Generative Agents 3D-weighted retrieval (Recency × Importance × Relevance). - Memory decay daily scheduler: background task runs
duduclaw_memory::decay::run_decayevery 24h. Low-importance + 30 days old → archived. Archived + 90 days → permanent delete. - Cognitive memory MCP tools:
memory_search_by_layer(episodic/semantic filter),memory_successful_conversations,memory_episodic_pressure,memory_consolidation_status. - MemGPT 3-layer system (Core Memory, Recall Memory, Archival Bridge, Budget Manager, Consolidation Pipeline, 6 MCP tools) was removed in v1.8.1 (−1,985 LOC) — the prompt injection caused 6,500 token bloat per prompt and “lost in the middle” attention degradation.
Local Inference
Section titled “Local Inference”- Unified
InferenceBackendtrait (duduclaw-inferencecrate): OpenAI-compatible HTTP (llama-server/Ollama/vLLM/SGLang/llamafile). The in-process llama.cpp, mistral.rs and MLX backends were removed in 2026-09 — no release binary ever compiled them; run a local OpenAI-compatible server instead. - Confidence Router: three-tier LocalFast / LocalStrong / CloudAPI routing, CJK-aware token estimation.
- InferenceManager: auto-switching state machine — llamafile → Direct backend → OpenAI-compat → Cloud API.
- llamafile manager: subprocess lifecycle, health monitoring, OpenAI-compatible API on localhost.
- MCP tools:
model_list,model_load,model_unload,inference_status,hardware_info,route_query,inference_mode,llamafile_start/stop/list.
Token Compression
Section titled “Token Compression”- Reply-path budget pipeline (
gateway/prompt_compression.rs): TurnTrim → DropOldestToolEchoes → BisectAndSummarize, cost-pressure aware, CJK-safe token estimation; skipped when recent cache efficiency is above 50% and the budget overshoot is below 15%. - The earlier Meta-Token (LTSC) / LLMLingua-2 / StreamingLLM compressor and its
compress_text/decompress_texttools were removed in v1.33.
Voice Pipeline
Section titled “Voice Pipeline”- HTTP endpoints:
POST /api/stt(an OpenAI-compatible transcription API or a local command template; 501 when no STT provider is configured),POST /api/ttsover Piper (local) / Edge TTS / MiniMax T2A / OpenAI TTS. - Telegram voice: transcription through the OpenAI Whisper API and Edge TTS replies, both hardcoded; the dashboard voice settings do not reach this path.
- Not in release binaries: in-process Whisper (
whisperfeature), ONNX embedding (onnxfeature) and Discord voice (discord-voicefeature). - SenseVoice, Deepgram, Silero VAD,
symphoniadecoding and LiveKit voice rooms were listed here before; none of them has code. Seedocs/features/14-voice-pipeline.md.
Security
Section titled “Security”- Claude Code PreToolUse hooks (installed per agent by
agent_hook_installerinto<agent_dir>/.claude/settings.json):duduclaw hook agent-file-guard(Rust subcommand, matcherWrite|Edit|MultiEdit|NotebookEdit|Bash, command carries--agentand--home— agent-structure files outside the canonical tree, own-SOUL.md / own-CONTRACT.toml writes, cross-agent writes, and for an employee caller any write under the DuDuClaw home outside its own agent directory andattachments/, judged on the real path after symbolic links; plus theorg_field_guardfield-level freeze onreports_to/department/name/[capabilities]/[delegation]/[acp]and, for employee callers, every section of their ownagent.tomloutside the editable list; the Bash lane is a speed bump andReadis not covered — rules and limits in05-security-defense.md) andduduclaw hook data-file-guard(RFC-23 §14.4, matcherRead|Bash, armed only when redaction is active; aBashfilename heuristic, not a sandbox — H10 2026-09 replaced the shell script that was inert on Windows). The 2026-04 three-phase shell-script defense and its GREEN/YELLOW/RED threat-level state machine were removed inba015a48— seedocs/features/05-security-defense.md. - SOUL.md drift detection (SHA-256 fingerprint, ≤10 versioned backups in
.soul_history/). - Prompt injection scanner (
input_guard, 11 rule categories, block threshold 60, NFKC-normalized, en + zh-TW patterns, XML delimiter protection). - Secret leak scanner — 19 secret patterns (Anthropic / OpenAI / AWS / GitHub / GitLab / Slack / Stripe / Google / SendGrid / JWT / PEM keys and key or password assignments) plus a high-entropy check, used by the skill security scanner.
- CONTRACT.toml —
must_not/must_alwaysboundaries, auto-injected into system prompt;duduclaw testred-team CLI (9 built-in scenarios). - Unified multi-source audit log:
audit.unified_logmergessecurity_audit.jsonl/tool_calls.jsonl/channel_failures.jsonl/feedback.jsonlinto common envelope (timestamp / source / event_type / agent_id / severity / summary / details) with Logs page filter chips. - AES-256-GCM at rest — per-agent key isolation.
- Dashboard / WebSocket auth: JWT account login (Argon2id-hashed passwords in
users.db) or the gateway admin token. An earlier Ed25519 challenge-response path has been removed from the gateway; no configuration could ever enable it. Ed25519 is still used for licence signatures, update verification and the relay device protocol. - Container sandbox — two separate paths. The per-agent task sandbox (
agent.toml [container] sandbox_enabled) runs a delegated task’s AI CLI in a read-only, non-root, resource-limited Docker container (Docker only, needsnetwork_access = true, fails closed when it cannot run; see Task sandbox guide). The script sandbox used by PTCexecute_programand thesecauditPoC step runs on Docker (WSL2 first on Windows) with--network=none, a read-only root and only a private read-only script directory mounted; when it cannot run, PTC refuses the script unless[container.sandbox] script_when_unavailable = "run_unsandboxed", and the PoC never runs on the host. - Browser automation & computer use — two fetch tools and an optional browser server the agent chooses between, no auto-router: L1
web_fetch_cached(SSRF-gated, cached HTTP), L2web_extract(CSS selector scrape). L5 computer use runs in a container started bycomputer_use_orchestrator(imageghcr.io/zhixuli0406/duduclaw-computer-use:v<version>, never pulled automatically, actions viaxdotool) and is driven by the agent through eightcomputer_*MCP tools, which theduduclaw mcp-serverprocess forwards to gateway-owned sessions over a signed loopback route (POST /api/internal/computer-use,computer_use_sessions/; network only to the per-agentallowed_domainshosts, pinned at session start). The chat-triggered loop and thenativehost-desktop mode were removed. L3 headless is an optional per-agent Playwright/Browserbase MCP server (.mcp.json). Deny-by-default viaCapabilitiesConfig(computer_use/browser_via_bash/allowed_tools/denied_tools). The deadbrowser_router.rs5-layer router and its “L4 Sandbox Browser” tier were removed in 2026-09. - CJK-safe byte slicing:
duduclaw_core::truncate_bytes/truncate_charsreplaced 31 unsafes[..s.len().min(N)]sites (fixed v1.8.11 multi-byte codepoint panics).
Accounts & Cost
Section titled “Accounts & Cost”- Per-agent model routing (SDK-first):
agent.toml [model]—preferred(Claude SDK model),local.model,local.use_router,api_mode(cli/direct/auto),account_pool(see below). - Multi-OAuth account rotation: OAuth sessions (Claude Pro/Team/Max via
claude auth status+CLAUDE_CODE_OAUTH_TOKENforsetup-tokenaccounts) + API keys. 4 strategies (Priority/LeastCost/Failover/RoundRobin). Rate-limit cooldown (2min), billing-exhaustion cooldown (24h), budget enforcement, token expiry tracking (30d/7d warnings). - Per-agent account pool (
agent.toml [model] account_pool): restricts which rotator accounts an agent may use. Applied to the candidate set — after the provider/health/cooldown/budget filters and before the strategy runs — so all four strategies keep their exact semantics over a narrower set. Entries match an accountidor its dashboardlabel(exact, trimmed, ASCII-case-insensitive; never a substring). Fail-open: a pool matching no available account (stale ids, everything cooling down) logs awarnand falls back to the full set — a stale pool must never leave an agent with no account. Unset/empty ⇒ rotation unchanged. Entry points:AccountRotator::select_with_pool/select_for_provider_with_pool. - Dual dispatch path: both sub-agent dispatcher (
claude_runner::call_with_rotation) and user-facing channel reply (channel_reply::call_claude_cli_rotated→rotate_cli_spawn_with_pool) go through the rotator, each threading the answering agent’saccount_pool. FailureReasonclassification — RateLimited / Billing / Timeout / BinaryMissing / SpawnError / EmptyResponse / NoAccounts / Unknown — with category-specific zh-TW user messages andchannel_failures.jsonlaudit records.- Binary discovery:
which_claude()/which_claude_in_home()probe Homebrew (Intel + Apple Silicon), Bun, Volta, npm-global,.claude/bin,.local/bin, asdf shims, NVM version directories — fixes launchd-launched gateway binary discovery whenPATHis empty. - CostTelemetry: SQLite-backed token usage tracking with cache efficiency analytics (
cache_read / (input + cache_read + cache_creation)), 200K price cliff warning, adaptive routing (cache_eff <30% → local). MCP tools:cost_summary,cost_agents,cost_recent. - Per-model cost rollup (
CostTelemetry::summary_by_model):token_usagehas carried amodelcolumn since the first schema, but every rollup grouped by agent / user / day — “which model is the money going to?” was unanswerable.summary_by_model(agent_id: Option<&str>, since_unix)groups by model (costliest first; rows with no recorded model id bucket under"(unknown)", never guessed) and reportsrequests/input_tokens/output_tokens/cache_read_tokens/cache_creation_tokens/cost_millicents+cost_usd/cache_efficiency. Cost is the summed stored per-rowcost_millicents— the same single pricing path (cost_for, applied once at record time) as every sibling rollup, never re-derived;cost_usdis a pure unit conversion of it. Surfaced additively: the MCPcost_summaryandcost_agentsresponses gain aby_modelarray for the same window (cost_agents’ agent rows move under anagentskey, since a top-level JSON array cannot carry a named sibling), and the dashboard RPCcost.by_model(paramsagent_id?,days?— default 7, clamped 1–365) returns the rollup under the same admin gate as itscost.*siblings. A rollup failure insidecost_summary/cost_agentsdegrades to an emptyby_modelrather than failing the call the caller actually made. - Direct API client (
direct_api.rs): bypasses Claude CLI for pure chat,cache_control: ephemeralon system prompt (no measured hit rate is published). Singletonreqwest::Clientwith 120s timeout; used as fallback when all OAuth accounts are cooling.
Scheduling
Section titled “Scheduling”- HeartbeatScheduler: per-agent unified scheduling — bus polling + GVU silence breaker + cron,
max_concurrent_runssemaphore. - CronScheduler: reads
cron_tasks.jsonl(+cron_tasks.dbsince v1.8.12), fires tasks on cron expression.list_cron_tasksreturns all tasks (no longer filters by default_agent, v1.8.3). Schedules are created withtasks_create+schedule; the olderschedule_taskMCP tool was removed in v1.69.0. - ReminderScheduler: one-shot reminders (relative
5m/2h/1dor ISO 8601),directstatic message oragent_callbackwake-up mode.
Skill Ecosystem
Section titled “Skill Ecosystem”- 6-stage lifecycle: Activation → Compression (three-layer progressive loading) → Extraction → Distillation → Diagnosis → Gap Analysis. The former Reconstruction stage had no caller and was removed in 2026-09.
- GitHub live indexing — Search API with 24h local cache, weighted search.
- Skill auto-synthesis (Phase 3-4): gap accumulator detects repeated domain gaps → synthesizes skills from episodic memory (Voyager-inspired) → sandbox trial with TTL → cross-agent graduation; off by default (
agent.toml [evolution] skill_synthesis_enabled). MCP tools:skill_security_scan,skill_graduate,skill_synthesis_status. - Rust-native Skill security scanner (
skill_lifecycle::security_scanner) — no Python subprocess; backs the dashboard vet, the MCPskill_security_scantool, and the sandbox-trial gate.
Task & Knowledge
Section titled “Task & Knowledge”- Task Board: SQLite-backed task management with status/priority/assignment tracking + real-time Activity Feed WebSocket. Dashboard RPC
tasks.list/create/update/remove/assign,activity.list; agent MCP toolstasks_list,tasks_create,tasks_update,tasks_claim,tasks_complete,tasks_block,activity_list,activity_post. An AI employee changing a task that is not its own (not assignee, claimer or creator; for complete/block, not assignee or claimer) needs the delegation relationship with the assignee, and cannot add, remove or reorder the control tagsoutcome:…,grant:…,auto-research; on a goal tasktitle,descriptionandacceptance_criteriaare frozen for AI employees. - Shared Knowledge Base:
~/.duduclaw/shared/wiki/with Wiki target classification (agent/shared/both). MCP tools:wiki_ls/read/write/search/stats/lintwithscope="shared"(the sixshared_wiki_*spellings were removed in v1.69.0), plusshared_wiki_deleteandwiki_share. - Autopilot rule engine: automated delegation/notifications/skill execution. Triggers a new rule may use (12):
task_created,task_updated,task_status_changed,activity_new,channel_message,agent_idle,run_at_risk,os_file,os_frontmost,tick,security_event,odoo_event;cron_tickis never emitted and refused on create since v1.67.1 (23-autopilot-engine).
Integrations
Section titled “Integrations”- Odoo ERP bridge (
duduclaw-odoocrate): JSON-RPC middleware supporting CE/EE, 17 MCP tools (CRM/Sales/Inventory/Accounting), EditionGate auto-detection, event polling +POST /webhook/odoo(both off by default) feedingodoo_eventautopilot rules. Per-agent credential isolation viaOdooConnectorPool(RFC-21 §2, v1.11.0). Dashboard test-before-save:odoo.testRPC accepts inline params (v1.13.1) — credential omitted falls back to stored secret; same SSRF/HTTPS/db-name validators asodoo.configure;scrub_odoo_error()caps connector errors at 240 chars to prevent HTML / URL leakage. - Prometheus metrics:
GET /metricson gateway HTTP — failover, wiki trust, decision continuity, prompt compression, resident sensing (tick_*), goal-loop and live-fork counters. The request/token/duration/session/channel/budget series were never incremented and were removed in v1.66. - RL trajectory collector: writes per-agent trajectories to
~/.duduclaw/rl_trajectories.jsonlduring channel interactions. Theduduclaw rlCLI that exported them was removed in 2026-09. - BroadcastLayer tracing layer streams real-time logs to WebSocket subscribers.
- Dashboard WebSocket heartbeat: server Ping every 30s, close idle sockets after 60s without Pong. Client
pingapplication-level RPC every 25s (browsers can’t issue control frames).
Reliability & Governance (v1.9.4)
Section titled “Reliability & Governance (v1.9.4)”duduclaw-durabilitycrate (🗑️ Removed in commitb0639b96on 2026-07-04) — This crate contained a five-pillar durability framework (idempotency,retry,circuit_breaker,checkpoint,dlq). It was removed after determining it had zero call sites in the production codebase. The gateway’s LLM fallback chain relies on other mechanisms (seegateway/failover.rs). Historical references to checkpoint save/rewind/fork are not available in the current codebase.duduclaw-governancecrate (🗑️ removed inb0639b96) — its rate / permission / quota / lifecycle policies had no enforcer, and the dashboard Governance page and its RPCs were removed in v1.66. Rate limits, delegation policy + MCP scopes, and license quotas are enforced separately.- LLM fallback chain (
gateway/failover.rs, modulefailover::model) — layer 2 of the three-layer failover stack (account → model → runtime, all under one module tree since 2026-09-29): primary timeout / 503 / 429 / overloaded auto-switches to the lighter fallback model, never on a billing error.is_llm_fallback_error/should_attempt_model_fallbackare pure functions with unit tests;FailoverManager::model_fallback_foris the combined decision every dispatch path calls. UTF-8-safe truncation viachar_indices. - Evolution Events system (
gateway/evolution_events/) — 30+ event schema, async batch+retry emitter, query interface, reliability guarantees. HTTP endpoints exposed on gateway and surfaced in WebReliabilityPage.
Memory Evaluation (v1.9.4 / W21)
Section titled “Memory Evaluation (v1.9.4 / W21)”- LOCOMO evaluation (
python/duduclaw/memory_eval/) —retrieval_accuracy,retention_rate,locomo_integrity_check.cron_runneris a manual CLI entry point (python -m memory_eval.cron_runner smoke_test|weekly_kpis|monthly_locomo); nothing in the repo schedules it. 5-minutesmoke_testP0 verifies basic memory functions.build_golden_qa.pybuilds the gold QA set;data/golden_qa_set.jsonlcarries the first 200 entries.duduclaw-memoryengine adds batch query API for evaluation. - Python
agents/+mcp/modules —agents/capabilities/(manifest + matcher),agents/routing/(router + resolution + memory_resolver).mcp/auth/(API Key with key masking),mcp/tools/memory/(store / read / search / namespace / quota with strict scope enforcement atexecute()entry — patches a v1.9.3 auth gap where any valid API key bypassed scope limits).
Web Dashboard
Section titled “Web Dashboard”- Tech stack: React 19 + TypeScript + Tailwind CSS 4 + Base UI + the shared
mdscomponent library. - Real-time log streaming (BroadcastLayer → WebSocket).
- OrgChart (D3.js interactive agent hierarchy).
- Memory page with Key Insights tab (
key_factscards with access_count badges) + Self-Improvement tab (stagnation warnings, rejection statistics, playbook rule cards). - Logs page with source filter chips + severity dropdown + severity-colored left borders + JSON detail expansion.
- Toast notification system (module-scoped event bus, max-5 queue, warm variants).
- Skill Market 3-tab (Marketplace / Shared Skills / My Skills).
- Autopilot settings + Session Replay + WikiGraph.
- Reliability page — evolution-event query and per-agent reliability summary (
audit.evolutionQuery,audit.reliabilitySummary). - i18n: zh-TW / en / ja-JP (600+ translation keys).
- Dark/Light theme (system + manual toggle).