Architecture
Design Principles
- Markdown-first — all configuration is human-readable markdown or YAML
- Vendor-neutral — no tool is the source of truth; the root files are
- Zero dependencies — no runtime, no package manager, no build step
- Non-destructive — installers never overwrite, adapters never conflict
- Progressive complexity — start with
AGENTS.md, add orchestrator later - Safety-first — all write operations require explicit developer approval
Layer Architecture
┌──────────────────────────────────────┐
│ Human Layer │
│ README.md CONTRIBUTING.md docs/ │
├──────────────────────────────────────┤
│ Layer 1: Source of Truth │
│ AGENTS.md MEMORY.md TASKS.md │
│ RUNBOOK.md │
├──────────────────────────────────────┤
│ Layer 2: AI Operating Layer │
│ .ai/config.yaml │
│ .ai/agents/ .ai/context/ │
│ .ai/prompts/ .ai/skills/ │
│ .ai/checks/ .ai/templates/ │
│ .ai/models/ .ai/schema/ │
├──────────────────────────────────────┤
│ Layer 3: Adapter Layer │
│ adapters/codex/ │
│ adapters/antigravity/ │
│ adapters/cursor/ │
│ adapters/claude/ │
│ adapters/gemini/ │
│ adapters/vscode/ │
├──────────────────────────────────────┤
│ Layer 4: Intelligence Layer │
│ .ai/intelligence/ (memory, handoff)│
│ .ai/registries/ (workflows, │
│ capabilities, tools, sources, │
│ trusted-keys) │
│ .ai/registry-cache/ (cached remote) │
│ .ai/proposals/ (improvements) │
│ .ai/policies/ (safety, registry│
│ governance gates) │
├──────────────────────────────────────┤
│ Layer 5: CLI Dashboard & Plugins │
│ dashboard / ui (TUI Command Center) │
│ plugin list/show/validate/install │
│ catalog list/show/recommend/install │
│ registry list/add/sync/status/verify│
│ /keygen/lock/trust │
│ onboard / adapter sync │
└──────────────────────────────────────┘Data Flow
- User edits root markdown files (
AGENTS.md, etc.) - Adapters read from root files and translate to tool-native format
- AI agents read their adapter file + root files
- Agents write results back to
TASKS.md,MEMORY.md, and session logs - Orchestrator coordinates multi-agent workflows via session logs
- Memory engine indexes codebase state into hash-compressed summaries
- Feedback loop captures developer corrections and compiles learning rules
- Proposal engine drafts improvements, validates safety gates, and applies approved changes
- Handoff compiler generates token-compressed session context for agent transfers
v4.2 Gateway Foundation Layer
v4.2.0 adds a gateway foundation under src/gateway/:
- protocol and provider adapter contracts
- runtime-readable provider/model registries
- deterministic dry-run route planning
- resilience planning and simulation
- localhost mock gateway runtime
- preview-only client configuration plans
- bounded local in-memory observability
The executable runtime remains mock-only. External providers are metadata-only, provider credentials are not loaded, live retry/fallback is not active, and Skill OS permissions are not enforced at runtime.
Skill OS remains the control plane. The gateway foundation is a mock-only runtime and routing foundation, with real provider execution deferred until explicit future security and release work.
Governed Execution Supervisor & MCP Control Plane (R5A / R5B)
MultiModel Dev OS provides a deterministic execution supervisor and control plane for AI coding agents:
- Deterministic Governance Policy: The
SupervisorPolicyEngine(src/supervisor/policy-engine.js) evaluates execution requests without model interpretation, producing 4 discrete decision outcomes:ALLOW,REQUIRE_APPROVAL,DENY, andUNKNOWN(fails closed). - Security Boundaries: Strictly prohibits destructive operations (
push,publish,deploy,delete_repository), guards protected paths (.env,.git/,.ai/registry-signing-key), enforces file modification budgets, and prevents directory traversal. Zero model-generated claims can bypass deterministic policy. - Isolated Worktree Preparation:
WorktreeManager(src/supervisor/worktree-manager.js) andSupervisorManager(src/supervisor/supervisor-manager.js) plan and prepare disposable Git worktrees usinggit worktree add --detach <dest> <sha>. - Primary Workspace Preservation: Existing uncommitted, staged, and untracked user files in the primary workspace remain untouched. Worktrees are created at sibling or temporary paths, never inside
.git/worktrees. In addition, task completion in continuity is decoupled from worktree step outcomes. - Run Manifests & Diagnostics: Prepared runs are recorded with immutable manifests in
.local-ai/state/supervisor/runs/<runId>/manifest.jsonand logged to append-only.local-ai/state/supervisor/runs.jsonl. If preparation fails, full diagnostics are preserved without corrupting the primary workspace. - Step Execution Engine (R5B):
StepExecutor(src/supervisor/step-executor.js) executes bounded, auditable steps (READ_FILES,INSPECT_GIT,VALIDATE_PATCH,APPLY_PATCH,METADATA_CHECK,INSPECT_STEP) strictly inside the isolated worktree. Model strings are never executed in a shell. Running repository build/test scripts without container sandbox fails closed (DENIED_SANDBOX_REQUIRED). - Cryptographic Approval Authority (R5B):
ApprovalManager(src/supervisor/approval-manager.js) requires explicit operator approval for mutating steps. Approval tokens bind torun_id,step_id, worktree fingerprint, expiry, and the canonical SHA-256 digest of input parameters (computeInputDigest). Approvals are single-use; parameter modifications invalidate them. - Durable Step Ledger & Crash Resumption (R5B): Step transitions are logged to append-only
steps.jsonland individual step manifests with SHA-256 receipts. Resuming an interrupted run gracefully reconcilesRUNNINGsteps toINTERRUPTED. - Modern MCP Conformance (R4E): Supports the modern MCP 2026-07-28 stateless protocol lifecycle with
resultType: 'complete', server identity in_meta["io.modelcontextprotocol/serverInfo"],-32022unsupported version errors, and genuine legacyinitializebackward compatibility. - Container Sandbox & Trust Boundary Closure (R5C Freeze):
DockerSandboxBackendandPodmanSandboxBackend(src/supervisor/sandbox-backend.js) implementing bounded, zero-shell container execution.- Mandatory supervisor-issued run manifests on disk; strict rejection of substitute manifests (
[UNTRUSTED_WORKTREE]). - Worktree registration verification (.git pointer to
/.git/worktrees/, common directory match against supervisor workspace root, commit match, non-primary branch enforcement). - Primary workspace auto-discovery and protection (
[PRIMARY_WORKSPACE_PROTECTION]). - Immutable execution plan deep freezing and HMAC-SHA256 signature verification (
[UNTRUSTED_EXECUTION_PLAN]). - Pinned image requirement with strict cryptographic SHA-256 digest (
IMAGE_DIGEST_REGEX);--pull=neverenforcement. - Daemon locality enforcement (
_checkDaemonLocality): rejection of remoteDOCKER_HOST,CONTAINER_HOST,DOCKER_CONTEXT, and remote SSH keys ([REMOTE_DAEMON_DENIED]). - Bounded output streaming with byte-counted limits, preventing buffer overflow attacks.
- Container cleanup ownership checks (
^mmdo-[a-zA-Z0-9_-]+-[a-zA-Z0-9_-]+-[a-f0-9]+$). - Per-run persisted authority keys (
.authority.key) and cross-process consumption records (.consumed-authorities.json). - Clear truth separation in execution receipts:
isolation_verified: falseandisolation_status: 'SIMULATED_NOT_VERIFIED'/'EXECUTION_SUCCEEDED_UNVERIFIED_ISOLATION', with exit code 0 never derived as proof of kernel isolation.
File Ownership
| File | Owner | Who Reads | Who Writes |
|---|---|---|---|
AGENTS.md | Human | All agents | Human |
MEMORY.md | Shared | All agents | Human + agents |
TASKS.md | Shared | All agents | Human + agents |
RUNBOOK.md | Human | All agents | Human |
.ai/config.yaml | Human | System | Human |
.ai/session-logs/*.md | Agents | Next agent | Current agent |
.ai/intelligence/memory.* | System | All agents | CLI (memory build) |
.ai/intelligence/handoff.md | System | Next agent | CLI (handoff build) |
.ai/intelligence/feedback-log.jsonl | System | CLI | CLI (feedback add) |
.ai/proposals/*.md | System | Human + CLI | CLI (improve propose) |
.ai/registries/*.yaml | System | CLI | CLI (init / registry add) |
.ai/policies/*.yaml | Human | CLI | Human |
.ai/registry-cache/ | System | CLI | CLI (registry sync) |
adapters/*/ | Community | Specific tool | Maintainers |
Security Considerations
- Never store secrets in any multimodel-dev-os file
- Handoff logs may contain sensitive context — gitignored by default
- Adapter config files should not contain API keys or tokens
- Use
.envfiles (gitignored) for secrets, referenced inRUNBOOK.md - Memory indexes, feedback logs, and proposals are gitignored by default
- The proposal
applycommand enforces 12 safety gates including path boundary checks
