<subagent_notification>
{"agent_path":"019d851e-a7f0-7130-a1c5-c55fb3d12d1b","status":{"completed":"Technical Memo: Cross-Agent Adapters and “Universal Runtime” Patterns (Claude Code, Codex, OpenCode, Trae CLI, OpenClaw)\n\nContext (why this is hard): the “coding agent” surface is mostly CLIs, not stable SDKs. Each agent has different invocation flags, permission models, transcript formats, and session semantics. Vercel explicitly calls out the transcript-format problem and builds a multi-stage normalization pipeline to unify them. (vercel.com)\n\n## 1) Common Abstraction Layers\n\nA. Agent driver (per-provider)\n- A thin “backend” that starts the agent, streams events, and returns a final result. In Multica this is a single Go interface (Backend.Execute -> Session(Messages, Result)) with provider-specific implementations for claude, codex, opencode, trae. \n References: agent.go, codex.go\n\nB. Execution environment manager (per-run isolation)\n- Creates an isolated workdir; injects provider-native config and “skills” (instruction bundles) into each agent’s expected discovery locations. Multica’s execenv does this by writing CLAUDE.md for Claude, AGENTS.md for Codex/OpenCode/Trae, and putting skills under .claude/skills, .config/opencode/skills, per-task CODEX_HOME, or .agent_context/skills. \n References: execenv.go, context.go\n\nC. Orchestrator / task runner\n- Owns retries/timeouts, repo checkout strategy, and reporting. Vercel’s template and blog both emphasize a uniform lifecycle regardless of agent: create sandbox, install CLI, inject creds, run command, capture transcript, teardown. (vercel.com)\n\nD. Event normalization layer (the “universal transcript”)\n- Canonical event schema: text, thinking, tool_use, , , , plus common tool taxonomy (, , , etc.). Vercel describes per-agent parsers + shared enrichment to unify tool names and shapes. ()\n\n\n- HTTP APIs to start runs, stream events, and query status. is a universal that exposes OpenAPI + SSE () and normalizes TUI output into messages. () \n- OpenCode itself can run as a headless HTTP server ( / ) with optional basic auth and CORS controls. ()\n\n## 2) Process / Protocol Integration Patterns\n\n\n- Claude Code: is designed for programmatic streaming; permissions are controlled via (, , , ). () \n- OpenCode: emits “raw JSON events”; also supports resume/fork and attaching to a long-running server via . ()\n\n\n- Codex App Server is explicitly a “client-friendly, bidirectional JSON-RPC API” with an handshake and a thread/turn lifecycle with many server notifications. () \n- This is the cleanest integration path when available: stable request/notification methods, explicit IDs, and structured tool/approval flows.\n\n\n- runs an in-memory terminal emulator; it translates HTTP messages into keystrokes and diffs terminal snapshots to extract “agent messages”, stripping TUI chrome (input prompts, separators). This is robust to agents that lack structured output, but brittle around TUI changes and requires continuous tuning. ()\n\n\n- Trae CLI supports recording trajectories (), and Trae Agent documents trajectory recording as a first-class feature. () \n- Multica’s Trae adapter matches this pattern by polling a trajectory file to reconstruct tool calls/results and final output.\n\n\n- Vercel Sandbox provides ephemeral MicroVMs with hard timeouts; their coding-agent template adds “Keep Alive” to allow follow-up prompts in the same sandbox until expiry. () \n- This pattern shifts most security and isolation concerns into the sandbox boundary (still requires careful credential + network policy handling).\n\n## 3) Session / Memory / Telemetry Normalization\n\n\n- You need a runtime-level that maps to provider-native identifiers:\n - Claude: session IDs in stream JSON; plus local JSONL logs (Vercel and Multica both treat Claude transcript capture as filesystem-based). ()\n - Codex: + turn lifecycle (JSON-RPC). ()\n - OpenCode: continuation + export/import of sessions. ()\n - Trae: trajectory file is effectively the session artifact. ()\n\n\n- Multica already does the key pragmatic normalization: tool call IDs, tool/result pairing, throttled batching of text/thinking, truncation of large tool outputs before uploading, and a small set of message types.\n- Vercel’s approach is the strongest “generic” blueprint: per-agent capture -> parsing/flattening -> enrichment -> summarization. ()\n\n\n- The most reliable cross-agent telemetry is “post-hoc from transcripts/logs”, not real-time vendor APIs:\n - Vercel highlights that each agent has its own transcript format and builds parsers to extract tool usage and web-search behavior. ()\n - Multica scans local agent logs/trajectories to compute token usage by .\n\n## 4) Security Pitfalls (Adapter/Runtime Level)\n\n\n- Claude Code supports modes like and ; using them in a super-runtime can silently convert “assistive” agents into fully autonomous code executors. ()\n- ClawTeam’s config includes and notes auto-confirming trust prompts in tmux flows; that’s convenient but a sharp edge when repos are untrusted. ()\n\n\n- Any adapter that injects API keys into the agent process environment risks tool-driven exfiltration (web fetch, curl, git remote, etc.). Vercel mitigates by routing calls through AI Gateway (central logging/rate/cost) and can blank direct provider keys for some agents. ()\n\n\n- has explicit “allowed hosts” and CORS origin allowlists, but it can be configured to ; that turns a local agent controller into a remote execution surface. () \n- OpenCode’s headless server supports basic auth and CORS controls; misconfiguration can expose a powerful local agent via HTTP. ()\n\n\n- MCP is becoming the de facto tool-connection standard across products. Its openness is a win for interoperability, but it increases the attack surface (prompt injection into tools, path validation issues, argument injection). Start with a strict threat model and per-tool sandboxing/allowlists. () \n- OpenAI notes they experimented with MCP for Codex but found MCP semantics hard to maintain for IDE workflows, motivating a purpose-built JSON-RPC protocol instead. That’s a signal to avoid forcing everything through a single protocol layer. ()\n\n## 5) Strongest Ideas to Borrow for a Unified “Super-Runtime”\n\n\n- Vercel’s “agents as config objects” model (setupCommands + buildCommand) is the cleanest extensibility mechanism for adding new CLIs without refactoring the orchestrator. ()\n\n\n- Copy Vercel’s explicit tool-name canonicalization table idea and 4-stage pipeline; combine with Multica’s “small message type set + batching” mechanics for low-latency streaming. ()\n\n\n1. Prefer structured protocols (Codex JSON-RPC, JSONL event streams). () \n2. Fall back to terminal emulation/diff (AgentAPI style) for interactive-only agents (likely where OpenClaw-style tools land). () \n3. Fall back again to file-based trajectory watchers (Trae pattern). ()\n\n\n- ClawTeam’s split is a strong abstraction: it cleanly decouples “how to run” (PTY vs subprocess) from “what to run” (claude/codex/openclaw/etc.), and keeps workspace isolation (git worktrees) as a first-class concern. ()\n\n\n- Adopt sandbox timeouts as a hard ceiling (MicroVM/container), and require deterministic teardown even on hangs. Vercel’s lifecycle framing is a good reference implementation. ()\n\nIf you want, I can follow up with a decision-complete architecture sketch for a “unified super-runtime” built around (1) adapter plugins, (2) canonical event schema, (3) sandbox execution, (4) unified memory store keyed by and , and (5) protocol bridges (JSON-RPC/JSONL/MCP/SSE)."}}
</subagent_notification>
User
<subagent_notification>
{"agent_path":"019d851e-a743-7671-873c-9c87cf15ef21","status":{"completed":"Technical Memo: HKUDS/ClawTeam (read-only analysis)\n\nRepo fact baseline: I inspected HKUDS/ClawTeam at commit 997e1c01b3494ef5162fccacd77315539c5e2e92. (github.com) The Python package exposes two entrypoints: clawteam (CLI) and clawteam-mcp (FastMCP server). (github.com)\n\n## 1) Swarm/Team Protocol and Coordination Model\n\nClawTeam’s “protocol” is primarily a small set of durable primitives (team membership, tasks, mailbox messages, plan approvals, lifecycle signals) persisted to a local/shared filesystem, with optional P2P acceleration. The canonical schema is in clawteam/team/models.py: TeamConfig, TeamMember, TaskItem (statuses pending|in_progress|completed|blocked, priorities), and TeamMessage with typed events like join_request, plan_approval_request, shutdown_request, idle, etc. (github.com)\n\nCoordination is driven by agents calling CLI commands (and/or MCP tools) that mutate those primitives:\n- Team lifecycle: team spawn-team, dynamic join protocol (request-join, approve-join, reject-join). (github.com)\n- Work allocation: task create/update/list/wait with dependency edges (blocked_by, auto-unblock on completion). (github.com)\n- Communication: mailbox send/broadcast + destructive receive vs non-destructive peek/watch. (github.com)\n- Governance: plan approval flow (plan submit/approve/reject) expressed as mailbox message types plus on-disk plan files. (github.com)\n- Lifecycle: graceful shutdown request/approve/reject and idle notifications. ()\n\nUnder the hood, serializes as JSON bytes, delivers via an abstract , and additionally writes a persistent event log () that is never consumed (used for history/board). () Transport is explicitly layered:\n- : message files per inbox with atomic rename and a claim/consume mechanism plus dead-letter quarantine. ()\n- : ZeroMQ PUSH/PULL with peer discovery via and automatic fallback to when a peer is unreachable. ()\n\nThere is also a “harness” automation layer: runs a polling loop, spawns phase-specific agents, detects exits, and in the phase converts “sprint contracts” artifacts into tasks (with wave-based dependencies) via . ()\n\n## 2) Isolation / Worktree Strategy\n\nIsolation is “git-native”, not container-native. A creates one git worktree per agent, with a dedicated branch named . () Worktrees live under the ClawTeam data dir (by default , configurable via or config). ()\n\nNotable implementation details (concrete repo facts):\n- Worktree creation uses . ()\n- It maintains a per-team under to track created worktrees. ()\n- “Workspace slimming”: after worktree creation, it deletes most files and keeps a hardcoded allowlist including , , , , , , plus venv/node_modules directories; it may symlink / / from the main repo root into the worktree. ()\n- Cleanup removes the worktree () and deletes the branch. ()\n\nThis gives strong “diff isolation” (separate branches/diffs), but it is not a security sandbox: agent processes still run on the host OS, and the symlinked dependency directories explicitly trade isolation for speed.\n\n## 3) Agent Compatibility Contract\n\nClawTeam’s compatibility story is two-layered: (a) spawning and adapting many “native CLI agents”, and (b) exposing ClawTeam operations as MCP tools so any MCP-capable agent can drive it.\n\nA. Native CLI compatibility (spawn/adapters)\n- Identity/contract via env vars: when spawning, it sets , , , , plus when a workspace cwd is used. ()\n- Spawn backends: is the default interactive backend (visual monitoring), with a subprocess backend also present (tests reference both). ()\n- CLI-specific flag mapping is explicit in :\n - Claude: adds (unless running as root).\n - Codex: adds .\n - Gemini/Kimi/Qwen/OpenCode: adds .\n - OpenClaw: normalizes invocation and wires session/message flags (, / , ). ()\n- Prompt injection is runtime-specific: e.g. Codex interactive paths may require post-launch injection; Kimi/Nanobot use their own workspace and prompt flags; Claude may get an appended system prompt in some cases. ()\n\nB. Provider/model/runtime mapping (profiles/presets)\nClawTeam has a “preset -> profile” layer so you don’t hardcode provider env vars in prompts. Built-in presets include “official” Anthropic/OpenAI/Google plus various Anthropic-compatible endpoints and OpenRouter; presets produce per-client overrides (agent command, model, base_url, env mapping). ()\n\nC. MCP tool contract\n is a FastMCP server that registers a fixed set of tools by wrapping Python functions while preserving signatures. () Tool surface includes , , , , , and (diff/ownership/log/summary), which is effectively the stable “agent compatibility contract” for orchestration independent of any specific coding CLI. ()\n\n## 4) Strongest Ideas to Borrow for a Unified Super-Runtime\n\n- A small, composable coordination kernel: treat “swarm intelligence” as a constrained set of operations (task graph + mailbox + plan gate + lifecycle) that agents can call repeatedly, rather than a monolithic agent framework. ClawTeam encodes this in / schemas and CLI verbs. ()\n- Worktree-based parallelism as a first-class primitive: separate branches/worktrees per agent gives clean ownership, real diffs, and a natural merge story; the registry + cleanup/checkpoint hooks make it operable. ()\n- “Offline-first” transport with realtime upgrade: file transport is universal; P2P adds low-latency delivery but degrades gracefully to files. This is the right direction for a super-runtime that must work on laptops, CI runners, and shared servers. ()\n- CLI-adapter boundary: normalize disparate agent CLIs (workspace flags, non-interactive modes, prompt injection timing, permission bypass) behind a single spawn interface. This is exactly what you need to support Claude Code/Codex/OpenCode/OpenClaw “and whatever comes next.” ()\n- MCP as the universal control plane: exposing team/task/mailbox/workspace as MCP tools gives a vendor-agnostic way for any orchestrator to drive the runtime, including “agent-of-agents” setups. ()\n- Harness phases + contract-to-task compilation: the “contracts -> waves -> tasks” mechanism is a concrete bridge from planning artifacts to executable task graphs. ()\n\n## 5) Weaknesses / Gaps vs a Fully Automated Idea-to-Product System\n\n- Security/sandboxing is intentionally weak: compatibility relies on passing “dangerous” flags (, , ) to make CLIs run unattended. That’s the opposite of a hardened super-runtime sandbox. ()\n- Worktrees are not isolation in the OS sense: processes share host resources, and the worktree “slimming + symlink deps” design can cause cross-agent interference (shared /venv), undermining reproducibility for end-to-end product build/test pipelines. ()\n- Coordination policies are basic: contract assignment defaults to round-robin; task scheduling is not capability-aware or resource-aware, and there is no built-in “quality gate” tying task completion to automated test/benchmark acceptance. ()\n- Distributed scale and trust are underspecified: P2P peer discovery assumes a shared filesystem for and does not surface auth/encryption as a first-class concept; file-based state also becomes a bottleneck under high concurrency. ()\n- “Unified memory” is not really present: there is an event log and inbox history, but no semantic memory store, retrieval, long-term knowledge consolidation, or cross-project reasoning substrate (critical for “self-evolution” and sustained idea-to-product delivery). ()\n- Naming/config drift risk: README examples heavily use as the CLI name, but the packaged scripts are and ; the CLI reference also states a default data dir of while code defaults to . These inconsistencies matter if you’re trying to make a 100% automated system with deterministic bootstrap. ()\n\n\n"}}
</subagent_notification>
User
<subagent_notification>
{"agent_path":"019d851e-a621-72d2-a158-59fb0ba5f89a","status":{"completed":"Technical Memo: HKUDS/OpenHarness (repo-only research)\n\nRepo Fact Sheet (concrete)\n- Package: openharness-ai (Python >=3.10), CLI entrypoints: oh, openharness, and ohmo. (raw.githubusercontent.com)\n- Core subsystems are organized under src/openharness/ with explicit modules for engine/, tools/, permissions/, hooks/, sandbox/, memory/, swarm/, mcp/, plugins/, prompts/. (github.com)\n\n---\n\n## 1) Core Runtime Architecture (agent loop, tool loop, streaming)\nOpenHarness’s runtime centers on a tool-aware streaming agent loop implemented as a QueryEngine that owns:\n- Conversation history (self._messages)\n- An api_client that streams model output\n- A ToolRegistry containing tool schemas and execution implementations\n- A PermissionChecker for governance\n- A HookExecutor for lifecycle hooks\n- A CostTracker that accumulates per-turn usage (raw.githubusercontent.com)\n\nThe actual loop (run_query) is a classic:\n1. stream model response\n2. if tool calls exist, execute tools (single tool sequentially; multiple tools concurrently via asyncio.gather)\n3. append tool results as a synthetic “user” message\n4. continue until the model stops requesting tools (raw.githubusercontent.com)\n\nNotable concrete behaviors:\n- Parallel tool execution when the assistant returns multiple tool calls in one turn. (raw.githubusercontent.com)\n- (, , , , etc.) support streaming UIs and headless consumers. ()\n- Tool execution includes: input validation (Pydantic models), permission evaluation, optional interactive confirmation, hook dispatch, then tool execution. ()\n\n---\n\n## 2) Sandbox + Governance Model (execution isolation + policy enforcement)\nOpenHarness splits “safety” into two layers: and .\n\n### Governance (permissions)\nThe policy gate is with:\n- : , , . ()\n- , e.g. , , , plus OpenHarness credential stores like . This deny list is explicitly “cannot be overridden.” ()\n- User-configurable controls: , , glob-style , and patterns. ()\n- In mode, mutating tools are blocked the user confirms; in mode mutating tools are blocked; in everything is allowed (except sensitive-path hard deny). ()\n\nA concrete detail worth copying: before permission checks, the engine so path rules apply consistently whether a tool uses or , and command extraction is standardized. ()\n\n### Sandbox (process isolation)\nThere are two sandbox paths:\n\n1. :\n - writes a temporary JSON settings file with network/filesystem allow/deny lists, then runs .\n - Availability checks include: presence (install hint: ), plus platform requirements: on Linux/WSL, on macOS. ()\n\n2. :\n - Starts a long-lived per-session container named .\n - Bind-mounts the project directory at the inside the container and sets to that path.\n - Network is unless is set (then ). ()\n\nShell command execution funnels through , which:\n- Uses Docker if the Docker backend is active\n- Otherwise wraps the argv with when configured/available ()\n\n---\n\n## 3) Memory + Context Model (instructions, retrieval, compaction)\nOpenHarness’s “context engineering” is explicit and file-centric:\n\n### Instruction injection\n- Discovers from upward, plus , plus , then injects their contents into a “Project Instructions” prompt section. ()\n\n### Project memory\n- Uses a project memory directory and a index.\n- generates a “# Memory” section and embeds (up to N lines) of directly into the system prompt. ()\n- “Relevant memory” retrieval is (metadata weighted higher than body); tokenization includes ASCII tokens and Han ideographs, so it works for Chinese queries too. ()\n- Memory authoring is file-based: writes and appends a link into . ()\n\n### Compaction (critical for long sessions)\nThe core loop checks auto-compaction at the start of each turn. () \nThe compaction subsystem explicitly includes:\n- “Microcompact” (clearing old tool result content)\n- Full LLM-based summarization with structured boundary markers\n- Auto-compact thresholds and guardrails like timeouts/retries, plus “session memory” retention knobs (e.g. keep recent N, line/char caps). ()\n\nThis is one of the most “product-grade” pieces for building multi-day agent sessions.\n\n---\n\n## 4) Subagent / Swarm Support (multi-agent execution + coordination)\nOpenHarness treats multi-agent as a first-class runtime feature (“swarm”), with explicit backends:\n\n- Supported teammate execution backends include , , , . ()\n- spawns each teammate as a and communicates via stdin/stdout; messages are sent as single-line JSON payloads to distinguish structured messages. ()\n- Team lifecycle is persisted on disk as JSON under , with CRUD helpers and cleanup logic to avoid orphaning pane-based teammates; it also supports worktree cleanup. ()\n- Teammate spawn config supports per-agent model/system prompt overrides, permission lists, optional worktree isolation, and whether the teammate is allowed to prompt for permissions. ()\n\nThis is enough infrastructure to build “agent organizations” where a leader spawns specialists and manages lifecycle/state.\n\n---\n\n## 5) Supported Agent CLIs / Providers (what it can run on)\nThere are two relevant surfaces: OpenHarness as a CLI harness, and OpenHarness as a provider-agnostic client.\n\n### CLI surfaces\n- / : main harness CLI; : personal-agent app built on the harness. ()\n\n### Provider model\n- README states built-in workflows including: Anthropic-compatible API, Claude subscription bridge (reads local Claude CLI credentials), OpenAI-compatible API, Codex subscription bridge (reads local Codex CLI auth), and GitHub Copilot OAuth flow. ()\n- Provider metadata is centralized in an ordered registry with detection by model keywords, API key prefixes (e.g. OpenRouter ), and base URL keywords; it includes OpenRouter, SiliconFlow, DeepSeek, Gemini, DashScope, Moonshot, MiniMax, Zhipu/GLM, Groq, Bedrock, Vertex, Ollama, vLLM, etc. ()\n- explicitly distinguishes auth kinds: , OAuth device flow (Copilot), and “external OAuth” style bindings for Codex subscription and Claude subscription. ()\n\nAlso: OpenHarness positions itself as compatible with “skills” and “plugins” conventions (Anthropic ecosystem) and supports MCP integration. ()\n\n---\n\n## 6) Strongest Ideas To Borrow for a Unified “Super-Runtime”\nIf you want a unified runtime spanning style agents, the highest-leverage patterns in OpenHarness are:\n\n- with streaming events and concurrency support. This makes “agent brains” pluggable while keeping execution deterministic. ()\n- (resolve absolute file paths; extract commands consistently) rather than hoping each tool calls the permission checker correctly. ()\n- : policy gating (modes + rules) plus real sandboxing (/bwrap/mac sandbox-exec, or Docker). This is the right direction for a super-runtime that runs untrusted code. ()\n- (command hooks, HTTP hooks, and LLM-evaluated “prompt/agent hooks”) that can block execution. This is powerful for governance, org policies, and “review gates.” ()\n- ( discovery, index, relevant memory injection) which is simple to integrate across CLIs and works without external databases. ()\n- rather than “hope the user clears context.” This is essential for multi-day “idea to product” runs. ()\n- that supports both headless (subprocess/tasks) and “pane-based” visualization (tmux/iTerm2), while persisting team state to disk. ()\n- : adding providers is “data only” and detection/status UI derives from it. That scales to “unified super-runtime” needs. ()\n\n---\n\n## 7) Weaknesses / Gaps for a Fully Automated “Idea → Product” System\nOpenHarness is a strong , but a “100% automated idea-to-product” system needs more than a harness. Key gaps to account for:\n\n- : you still need higher-level orchestration primitives (requirements capture, UX specs, milestone gates, release checklists, “definition of done”, stakeholder feedback loops). OpenHarness provides tools/hooks; it does not provide an end-to-end product pipeline spec. ()\n- : good baseline, but for large projects you will likely need embeddings/RAG, structured project state, and durable semantic indices beyond plus keyword overlap. ()\n- :\n - Docker mounts the repo read-write by default (because it bind-mounts the working directory); that’s necessary for coding, but means your security posture depends heavily on permissions + sandbox config correctness. ()\n - depends on host tools (, ) and availability; runtime must handle “unavailable” cleanly and securely. ()\n- : while it can run shell/tests, a full “idea→product” automation needs repeatable build matrices, artifact publishing, regression suites, environment provisioning, and monitoring of flakiness. OpenHarness provides the execution substrate, not the full delivery system. ()\n- : it supports spawning, messaging, team persistence, and backends; but “collective intelligence” requires task decomposition protocols, conflict resolution, shared memory writes, and review/merge strategies that aren’t guaranteed by the runtime alone. ()\n- : OpenHarness handles many providers via registry/detection, plus subscription bridges, but a “super-runtime” will need strict abstractions for rate limits, tool-call schema differences, multimodal differences, and consistent telemetry across providers. ()\n\n---\n\n\n\n\nIf you want, I can follow up (still non-mutating) with a “borrow plan” that maps these patterns into a unified super-runtime architecture for Multica: minimal core loop + sandbox interface + policy engine + memory API + swarm + provider registry, with clear seams for plugging backends."}}
</subagent_notification>
User
<subagent_notification>
{"agent_path":"019d851e-a699-7f52-85b6-7381a7cca380","status":{"completed":"Technical Memo: HKUDS/OpenSpace (commit 79a98abda708cf1014b948be892a40d2cb70f327, version 0.1.0)\n\nThis memo is based on read-only inspection of the OpenSpace repo plus its docs. Core claim: OpenSpace is a MCP-exposed runtime that makes external agents “self-evolving” by (a) retrieving skills, (b) recording executions, (c) LLM-analyzing outcomes, and (d) evolving skills (FIX/DERIVED/CAPTURED) with persistence and optional cloud sharing.\n\n---\n\n## 1) Self-Evolving Skill Engine Architecture\n\nTop-level runtime shape (host-agnostic):\n- OpenSpace runs as an MCP server (openspace-mcp) exposing 4 tools: execute_task, search_skills, fix_skill, upload_skill. See openspace/mcp_server.py header comments. The server supports multiple transports (stdio + HTTP variants). (openspace/mcp_server.py:1-15)\n- The “engine” object is OpenSpace in openspace/tool_layer.py, assembling:\n - GroundingAgent for multi-step execution\n - SkillRegistry for discovery/selection/context injection\n - RecordingManager for per-task traces\n - SkillStore (SQLite) for quality + evolution ledger\n - ExecutionAnalyzer (LLM post-hoc) for judgments + evolution suggestions\n - SkillEvolver for applying FIX/DERIVED/CAPTURED actions\n\nConcrete init wiring: OpenSpace.initialize() creates SkillStore, syncs filesystem skills to DB, then initializes ExecutionAnalyzer and SkillEvolver (sharing the same store + registry). (openspace/tool_layer.py:244-288)\n\nExecution dataflow (important for “self-evolving”):\n1. Task runs via OpenSpace.execute().\n2. Recording is stopped and the execution outcome is persisted.\n3. Post-execution: OpenSpace runs analysis + evolution before returning, so evolved_skills can be included in the response. (openspace/tool_layer.py:595-611)\n4. Evolution trigger path:\n - ExecutionAnalyzer.analyze_execution() loads recordings, builds a prompt, runs an analysis agent loop, parses into ExecutionAnalysis, then persists via SkillStore.record_analysis(). (openspace/skill_engine/analyzer.py:153-226)\n - If analysis.candidate_for_evolution and evolver is enabled, OpenSpace calls SkillEvolver.process_analysis(...) and collects evolved records into . ()\n\n\n- explicitly supports , , , with triggers: post-analysis, tool degradation, metric monitor. ()\n- Metric-based screening is rule-driven but “relaxed”, then LLM confirmation filters false positives. (, )\n - FIX candidate if fallback rate is high\n - FIX candidate if applied rate is high but completion rate is low\n - DERIVED candidate if effective rate is moderate but applied rate indicates the skill is actually used ()\n\n\n- tracks , , , , with computed rates , , , . ( around , see rates at in the repo)\n- Updates are atomic in SQL ( updates counters with increments). (visible in update statements)\n\n---\n\n## 2) Skill Capture / Reuse / Sharing Loop\n\n\n- Skills are filesystem directories containing (with YAML frontmatter fields like , ). The system reads these for discovery/search and for cloud upload metadata. (see reading frontmatter in )\n\n\n- Skill retrieval is explicitly a pipeline: . ()\n- There is an internal tool used mid-iteration when the current approach is insufficient. It reuses the same selection pipeline and optionally enriches selection with quality data from . ()\n\n\n- CAPTURED is implemented as creation of a brand-new skill directory with a sanitized name, generated SKILL content, and a new (). It persists a new with lineage origin , generation , no parents, and stores snapshot/diff. ( CAPTURED path; naming + thresholds at )\n- A subtle but important design: can be set by the caller so CAPTURED skills land in the correct host agent’s skill folder, not just OpenSpace’s builtin skills. (, explains this in )\n\n\n- Evolved skills are “upload-ready” by writing that contains origin, parents, summary, tags. writes this metadata, and consumes it so the bot mostly only decides . ()\n- Cloud client upload flow is a 3-step protocol:\n 1. uploads files\n 2. optional diff computation (public uploads)\n 3. creates the record with origin/visibility/parents/tags ( in )\n- Download/import flow writes a sidecar and includes path traversal protection during zip extraction. ( , plus extraction checks)\n\n**“Agent-side adapters” for reuse/sharing:Primary compatibility mechanism: MCP (Model Context Protocol).Repo-provided concrete integrations:CLI entry points (packaging-level fact):**\n- , , , , plus gateway/dashboard scripts are defined in . ()\n\nPractical implication for “claudecode/codex/opencode/trae-cli/etc.”: if the runtime can act as an MCP host (stdio or HTTP), OpenSpace can be slotted in without tight coupling. OpenSpace only documents nanobot/openclaw explicitly, but the transport and tool surface is generic MCP.\n\n---\n\n## 4) Memory / Experience Mechanisms\n\nOpenSpace has (in increasing structure):\n\n1. \n - Real-time append to . ()\n - Metadata and (optionally) screenshots/video are stored alongside the trajectory directory. (same module; screenshots/video support visible around )\n\n2. \n - Stored at . (, )\n - Tracks: , lineage parents, (one per task), per-skill judgments, tool deps, tags. ()\n\n3. \n - Cloud API supports embedding search over records: . ()\n - Local hybrid search uses BM25 rough-rank + embedding cosine similarity + lexical boost. ()\n\nNotably, OpenSpace also records “skill selection decision” metadata (prompt/response/selected skills) for later debugging and analytics (visible in ).\n\n---\n\n## 5) Strongest Ideas To Borrow for a Unified Super-Runtime\n\nIf your goal is a unified super-runtime across many agent CLIs, OpenSpace has several high-leverage patterns:\n\n- : “Super-runtime” exposes a small, generic tool surface () and relies on MCP transports (stdio/HTTP). This is exactly the right shape for cross-agent compatibility. (, )\n- : instead of hardcoding integration logic into each agent runtime, ship “prompt-level adapters” (, ) that teach the host agent when/how to call runtime tools. This is a scalable compatibility tactic. ()\n- : treat skills as versioned artifacts with parent references, stored diffs/snapshots, and measurable success rates. This supports safe-ish “self-evolution” and debugging. (, , )\n- : BM25+embedding narrows, LLM does plan-then-select; quality counters can be injected into selection. This is a good default for large skill libraries. ()\n- : reduces agent mistakes in provenance/lineage, while still enforcing origin/parent constraints. ()\n- : path traversal checks when importing skills (zip extraction protections). This is essential if you want “community skills” in a real automation system. (, extraction logic)\n\n---\n\n## 6) Weaknesses / Gaps vs “Fully Automated Idea-to-Product” System\n\nOpenSpace is strongest as a , but “100% idea-to-product automation” needs more than evolving SKILL.md workflows.\n\nKey gaps (based on repo evidence):\n\n- : evolution operates on “skills” (instructions/tool guides) rather than producing a complete product lifecycle artifact set (PRDs, architecture, implementation, tests, release, monitoring). Nothing in the core loop guarantees end-to-end product readiness; it guarantees a trace + analysis + potential skill edits. ( shows loop ends at analysis/evolution + return payload)\n- : is an LLM analysis pass over recordings. There is no explicit “tests must pass” gate before promoting an evolved skill, and no CI-grade evaluation harness wired into evolution acceptance. ( + evolver’s LLM confirmation design)\n- : there is strong memory about executions and skill quality, but weaker memory about a codebase’s evolving state, architecture constraints, customer requirements, and long-horizon plans. (recordings + SQLite schema are execution/skill focused: )\n- : “experience sharing” depends on a cloud service API (, , embedding search). The server implementation is not in this repo, so robustness/SLAs/permissions cannot be assessed here. ()\n- : The repo builds a worker runtime that can be called by a host agent, but it does not define a “team of agents with roles” orchestration plan, conflict resolution, or long-running project management needed for idea-to-product at high reliability.\n- : copying host skills and setting env vars/API keys is manual. That is fine for developer workflows, but a “fully automated OPC” will likely need auto-provisioning, policy, and secrets management across environments. ()\n\n---\n\n## Sources (stable links pinned to commit)\n\n"}}
</subagent_notification>
Implemented the first backend slice of the plan without changing the web app.
The main changes are:
Runtime capability metadata is now published during daemon registration, so each provider advertises a stable capability set instead of relying on hard-coded checks. See capabilities.go, daemon.go, and daemon.go.
Task message persistence now supports canonical metadata (provider, call_id, status, level, etc.), and the daemon now forwards status and log events in addition to text/tool events. See messages.go, client.go, message_metadata.go, and migration 038_task_message_metadata.up.sql.
The exec environment now writes a task-scoped policy artifact at .agent_context/policy.json, exposes it via MULTICA_POLICY_FILE, and references it in injected runtime instructions. See policy.go, context.go, and runtime_config.go.
Minimal unified memory is now in place: completed runs store run_summary, failed runs store failure_pattern, and recent memories are included in task claims and injected into agent context. See 039_run_memory.up.sql, run_memory.sql, task.go, agent.go, and types.go.
Verification:
Ran make sqlc
Ran go test ./pkg/agent ./internal/daemon/... ./internal/service ./internal/handler
What is still not implemented from the larger plan:
light swarm/fan-out orchestration
OpenClaw adapter
stronger sandbox drivers beyond current host-policy foundation
Implemented the backend slice for swarm, stronger sandboxing, and hermes-agent, with the web app unchanged.
Swarm/fan-out now reuses the existing task queue instead of introducing a separate orchestrator. agent_task_queue now supports parent_task_id and swarm_role, claim logic allows sibling child tasks from the same parent to run in parallel, and there is a new protected issue API plus CLI command to enqueue child tasks:
Sandboxing now has a real process-launch driver abstraction for agent CLIs. The default remains host, but docker is now supported for the whole agent process, not just policy hints. The daemon passes the driver through to every provider backend, including ping runs.
Docker mode wraps the provider command with docker run, mounts the task workdir and relevant absolute env paths, and applies a tighter runtime (--cap-drop=ALL, no-new-privileges, tmpfs /tmp)
Key files: process.go, config.go, daemon.go
hermes-agent is now a first-class provider. I adapted it using Hermes’ official one-shot query mode and resume flow from the official repo/docs, and added per-task HERMES_HOME isolation so it fits the current execenv model.
User
<user_action>
User initiated a review task. Here's the full review output from reviewer model. User may select one or more comments to resolve.
review
Several parts of the new docker sandboxing, swarm fan-out, and Hermes support are not functionally complete. Docker sandboxes cannot reliably execute the required local Multica workflows, and fan-out breaks existing single-task/workdir invariants, so the patch would produce incorrect runtime behavior.
Full review comments:
[P1] Use host networking or a reachable daemon address in docker mode — /home/ubuntu/multica/server/internal/daemon/config.go:23-24
When docker sandboxing is enabled, the new default network mode is bridge, but agent repo access still goes through multica repo checkout, which posts to http://127.0.0.1:$MULTICA_DAEMON_PORT, and the daemon only listens on host loopback in listenHealth. Inside a bridged container, 127.0.0.1 is the container itself, so sandboxed build tasks cannot reach the daemon unless operators remember to override this setting.
[P1] Mount PATH directories needed by sandboxed agents — /home/ubuntu/multica/server/pkg/agent/process.go:94-95
In docker mode collectMountPaths only mounts env values that are a single absolute path, so the injected PATH=/home/ubuntu/multica/server/bin:... from daemon.go is skipped entirely. With the repo image this -e PATH=... also overwrites the image's own /app path, leaving multica unavailable in the container and causing the first required multica issue ... / multica repo checkout ... command to fail.
[P1] Preserve single-active-task invariants before swarm claims — /home/ubuntu/multica/server/pkg/db/queries/agent.sql:96-100
This condition now permits multiple active tasks for the same issue whenever they share a parent, but the rest of the stack still models "one active task per issue": syncIssueExecutionStageForTask writes a single execution stage, GetActiveTaskForIssue returns only tasks[0], and AgentLiveCard clears itself on the first task:completed. In a two-child build swarm, the first child to finish will make the issue look build_ready/idle even though its sibling is still running.
[P2] Reject same-agent siblings or isolate their workdirs — /home/ubuntu/multica/server/internal/service/task.go:213-221
Nothing prevents the same agent_id from appearing in multiple fan-out specs. Once that issue has a stored prior_work_dir, those sibling claims all reuse the same session/workdir state, so parallel children for the same agent will call on one directory while still allows them to run together. That can corrupt the checkout and session context for both runs.
Assistant
Several parts of the new docker sandboxing, swarm fan-out, and Hermes support are not functionally complete. Docker sandboxes cannot reliably execute the required local Multica workflows, and fan-out breaks existing single-task/workdir invariants, so the patch would produce incorrect runtime behavior.
Full review comments:
[P1] Use host networking or a reachable daemon address in docker mode — /home/ubuntu/multica/server/internal/daemon/config.go:23-24
When docker sandboxing is enabled, the new default network mode is bridge, but agent repo access still goes through multica repo checkout, which posts to http://127.0.0.1:$MULTICA_DAEMON_PORT, and the daemon only listens on host loopback in listenHealth. Inside a bridged container, 127.0.0.1 is the container itself, so sandboxed build tasks cannot reach the daemon unless operators remember to override this setting.
[P1] Mount PATH directories needed by sandboxed agents — /home/ubuntu/multica/server/pkg/agent/process.go:94-95
In docker mode collectMountPaths only mounts env values that are a single absolute path, so the injected PATH=/home/ubuntu/multica/server/bin:... from daemon.go is skipped entirely. With the repo image this -e PATH=... also overwrites the image's own /app path, leaving multica unavailable in the container and causing the first required multica issue ... / multica repo checkout ... command to fail.
[P1] Preserve single-active-task invariants before swarm claims — /home/ubuntu/multica/server/pkg/db/queries/agent.sql:96-100
This condition now permits multiple active tasks for the same issue whenever they share a parent, but the rest of the stack still models "one active task per issue": syncIssueExecutionStageForTask writes a single execution stage, GetActiveTaskForIssue returns only tasks[0], and AgentLiveCard clears itself on the first task:completed. In a two-child build swarm, the first child to finish will make the issue look build_ready/idle even though its sibling is still running.
[P2] Reject same-agent siblings or isolate their workdirs — /home/ubuntu/multica/server/internal/service/task.go:213-221
Nothing prevents the same agent_id from appearing in multiple fan-out specs. Once that issue has a stored prior_work_dir, those sibling claims all reuse the same (agent_id, issue_id) session/workdir state, so parallel children for the same agent will call execenv.Reuse() on one directory while still allows them to run together. That can corrupt the checkout and session context for both runs.
message: feat(server): add runtime kernel memory sandbox and fanout
当前工作树唯一剩余未提交项:
?? .AGENTS.md.swp
如果你要,我下一步可以继续做两件事之一:
清掉 .AGENTS.md.swp
继续实现 child-task 聚合结果和 Hermes session id 提取
User
<user_shell_command>
git status
Exit code: 0
Duration: 0.0235 seconds
Output:
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: AGENTS.md
no changes added to commit (use "git add" and/or "git commit -a")
Current repo state is clean except for one unstaged tracked file: AGENTS.md.
The only remaining diff removes an obsolete command reference:
delete Main checkout first setup: cp .env.example .env then make setup-main
This change is documentation-only and appears consistent with the current root instructions, which already prefer make setup / make setup-worktree.
Key Changes
Review AGENTS.md as an intentional docs correction, not generated noise.
Stage and commit that one-file change as a separate docs commit so it does not get mixed into the already-created backend/runtime commit.
Do not amend the previous commit unless explicitly requested.
Recommended commit message:
docs: remove obsolete setup-main instruction
Test Plan
No code execution changes are involved.
Minimal verification:
git diff -- AGENTS.md shows only the obsolete command removal.
git status is clean after staging and committing.
Optional sanity check: confirm the remaining setup commands in AGENTS.md match the current Makefile-backed flows (make setup, make worktree-env, make setup-worktree).
Assumptions
The AGENTS.md edit is intentional and should be preserved.
The previous runtime commit (feat(server): add runtime kernel memory sandbox and fanout) should remain unchanged.
The right final shape is two commits:
existing backend/runtime commit
one follow-up docs-only commit for AGENTS.md
</proposed_plan>
\n- OpenSpace ships two “host skills” (prompting artifacts) that teach an external agent how to use the 4 MCP tools:\n - host_skills/skill-discovery calls search_skills, then decides self-handle vs delegate. (openspace/host_skills/skill-discovery/SKILL.md)\n - host_skills/delegate-task calls execute_task, checks evolved_skills, then decides whether to upload_skill. (openspace/host_skills/delegate-task/SKILL.md)\n\n---\n\n## 3) Compatibility With External Agent Runtimes/CLIs\n\n
\n- OpenSpace can run as a stdio MCP server or as standalone HTTP endpoints (SSE and “streamable-http”) to bypass stdio timeout bottlenecks. (README.md:29, openspace/host_skills/README.md:5-14, openspace/mcp_server.py:9-13)\n\n
\n- nanobot: config uses tools.mcpServers with either stdio command or HTTP URL. (openspace/host_skills/README.md:26-90)\n- openclaw: can register via mcporter for stdio, or openclaw mcp set for HTTP transport. (openspace/host_skills/README.md:94-118)\n\n
the Hermes adapter supports resume when a prior session id is already known, but it does not yet extract fresh Hermes session ids after a new run. If you want, I can implement that next, along with parent-task aggregation/status rollup for swarm runs.
(agent_id, issue_id)
execenv.Reuse()
max_concurrent_tasks
[P2] Capture Hermes session IDs from new runs — /home/ubuntu/multica/server/pkg/agent/hermes.go:77-78
Hermes never persists a new session identifier here: sessionID starts as opts.ResumeSessionID and is written back unchanged. The first Hermes task therefore completes with an empty session_id, so later tasks on the same issue cannot resume the previous conversation even though the runtime is registered as native_resume capable.
</user_action>
max_concurrent_tasks
[P2] Capture Hermes session IDs from new runs — /home/ubuntu/multica/server/pkg/agent/hermes.go:77-78
Hermes never persists a new session identifier here: sessionID starts as opts.ResumeSessionID and is written back unchanged. The first Hermes task therefore completes with an empty session_id, so later tasks on the same issue cannot resume the previous conversation even though the runtime is registered as native_resume capable.