JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2523
  • Score
    100M100P100Q109012F
  • License MIT

Monobrain - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (monobrain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    🧠 Monobrain v1.0: Multi-Agent AI Orchestration Platform

    npm version Downloads Stars License: MIT Node TypeScript


    Multi-agent AI orchestration for Claude Code

    Deploy 100+ specialized agents in coordinated swarms with self-learning capabilities, fault-tolerant consensus, and enterprise-grade security.

    Why Monobrain? Claude Code is powerful β€” but it thinks alone. Monobrain gives it a brain trust: a coordinated swarm of 100+ specialized agents that share memory, reach consensus, learn from every task, and route work to the right specialist automatically. Built on a WASM-powered intelligence layer, it gets smarter every session.

    How Monobrain Works

    User β†’ Monobrain (CLI/MCP) β†’ Router β†’ Swarm β†’ Agents β†’ Memory β†’ LLM Providers
                               ↑                          ↓
                               └──── Learning Loop β†β”€β”€β”€β”€β”€β”€β”˜
    πŸ“ Expanded Architecture β€” Full system diagram with RuVector intelligence
    flowchart TB
        subgraph USER["πŸ‘€ User Layer"]
            U[User]
            CC[Claude Code]
        end
    
        subgraph ENTRY["πŸšͺ Entry Layer"]
            CLI[CLI / MCP Server]
            AID[AIDefence Security]
        end
    
        subgraph ROUTING["🧭 Routing Layer"]
            KW[Keyword Pre-Filter]
            SEM[Semantic Router]
            LLM_FB[LLM Fallback Β· Haiku]
            TRIG[MicroAgent Triggers]
            HK[17 Hooks Β· Event Bus]
        end
    
        subgraph SWARM["🐝 Swarm Coordination"]
            TOPO[Topologies<br/>hierarchical/mesh/adaptive]
            CONS[Consensus<br/>Raft/BFT/Gossip/CRDT]
            CLM[Claims<br/>Trust Tiers]
            GOV[Guidance<br/>Policy Gates]
        end
    
        subgraph AGENTS["πŸ€– 100+ Agents"]
            AG1[coder]
            AG2[tester Β· reviewer]
            AG3[architect Β· planner]
            AG4[security-auditor]
            AG5[devops Β· sre]
            AG6[60+ more...]
        end
    
        subgraph RESOURCES["πŸ“¦ Resources"]
            MEM[(AgentDB Β· HNSW Β· SQLite)]
            PROV[Providers<br/>Claude/GPT/Gemini/Ollama]
            WORK[12 Workers<br/>ultralearn/audit/optimize]
        end
    
        subgraph RUVECTOR["🧠 RuVector Intelligence"]
            direction TB
            SONA[SONA<br/>Self-Optimize<br/>&lt;0.05ms]
            EWC[EWC++<br/>Anti-Forgetting]
            FLASH[Flash Attention<br/>2.49–7.47x]
            HNSW_I[HNSW<br/>150x–12500x]
            RB[ReasoningBank<br/>RETRIEVE→JUDGE→DISTILL]
            LORA[LoRA/MicroLoRA<br/>128x compress]
        end
    
        subgraph LEARNING["πŸ”„ Learning Loop"]
            L1[RETRIEVE] --> L2[JUDGE] --> L3[DISTILL] --> L4[CONSOLIDATE] --> L5[ROUTE]
        end
    
        U --> CC --> CLI --> AID
        AID --> KW & SEM & LLM_FB & TRIG & HK
        KW & SEM & LLM_FB & TRIG --> TOPO & CONS & CLM & GOV
        TOPO & CONS --> AG1 & AG2 & AG3 & AG4 & AG5 & AG6
        AG1 & AG2 & AG3 & AG4 & AG5 & AG6 --> MEM & PROV & WORK
        MEM --> SONA & EWC & FLASH & HNSW_I & RB & LORA
        LORA --> L1
        L5 -.->|loop| SEM

    RuVector Intelligence Components:

    Component Purpose Performance
    SONA Self-Optimizing Neural Architecture β€” learns optimal routing <0.05ms adaptation
    EWC++ Elastic Weight Consolidation β€” prevents catastrophic forgetting Preserves all learned patterns
    Flash Attention Optimized attention computation 2.49–7.47Γ— speedup
    HNSW Hierarchical Navigable Small World vector search 150×–12,500Γ— faster
    ReasoningBank Pattern storage with RETRIEVE→JUDGE→DISTILL pipeline Sub-ms recall
    Hyperbolic PoincarΓ© ball embeddings for hierarchical data Better code relationship mapping
    LoRA / MicroLoRA Low-Rank Adaptation weight compression 128Γ— compression ratio
    Int8 Quantization Memory-efficient weight storage ~4Γ— memory reduction
    9 RL Algorithms Q-Learning, SARSA, A2C, PPO, DQN, A3C, TD3, SAC, HER Task-specific policy learning

    Get Started Fast

    Option 1 β€” npx (recommended):

    npx monobrain@latest init --wizard
    claude mcp add monobrain -- npx -y monobrain@latest mcp start
    npx monobrain@latest daemon start
    npx monobrain@latest doctor --fix

    Option 2 β€” Clone from GitHub:

    git clone https://github.com/nokhodian/monobrain.git
    cd monobrain
    npm install
    node packages/@monobrain/cli/bin/cli.js init --wizard
    
    # Wire up the MCP server in Claude Code
    claude mcp add monobrain -- node "$PWD/packages/@monobrain/cli/bin/cli.js" mcp start

    New to Monobrain? You don't need to learn 310+ MCP tools or 26 CLI commands up front. After running init, just use Claude Code normally β€” the hooks system automatically routes tasks to the right agents, learns from successful patterns, and coordinates multi-agent work in the background.


    Key Capabilities

    πŸ€– 100+ Specialized Agents β€” Ready-to-use AI agents for every engineering domain: coding, review, testing, security, DevOps, mobile, ML, blockchain, SRE, and more. Each optimized for its specific role.

    🐝 Coordinated Agent Swarms β€” Agents organize into teams using hierarchical (queen/workers) or mesh (peer-to-peer) topologies. They share context, divide work, and reach consensus β€” even when agents fail.

    🧠 Learns From Every Session β€” Successful patterns are stored in HNSW-indexed vector memory and reused. Similar tasks route to the best-performing agents automatically. Gets smarter over time without retraining.

    ⚑ 3-Tier Cost Routing β€” Simple transforms run in WASM at <1ms and $0. Medium tasks use Haiku. Complex reasoning uses Sonnet/Opus. Smart routing cuts API costs by 30–50%.

    πŸ”Œ Deep Claude Code Integration β€” 310+ MCP tools expose the full platform directly inside Claude Code sessions. The hooks system fires on every file edit, command, task start/end, and session event.

    πŸ”’ Production-Grade Security β€” CVE-hardened AIDefence layer blocks prompt injection, path traversal, command injection, and credential leakage. Per-agent WASM/Docker sandboxing with cryptographic audit proofs.

    🧩 Extensible Plugin System β€” Add custom capabilities with the plugin SDK. Distribute via the IPFS-based decentralized marketplace. 20 plugins available today across core, integration, optimization, and domain categories.

    πŸ›οΈ Runtime Governance β€” @monobrain/guidance compiles your CLAUDE.md into enforced policy gates: destructive-op blocking, tool allowlists, diff size limits, secret detection, trust tiers, and HMAC-chained proof envelopes.


    Claude Code: With vs Without Monobrain

    Capability Claude Code Alone Claude Code + Monobrain
    Agent Collaboration One agent, isolated context Swarms with shared memory and consensus
    Hive Mind β›” Not available Queen-led hierarchical swarms with 3+ queen types
    Consensus β›” No multi-agent decisions Byzantine fault-tolerant (f < n/3), Raft, Gossip, CRDT
    Memory Session-only, ephemeral HNSW vector memory + knowledge graph, persistent cross-session
    Self-Learning Static, starts fresh every time SONA self-optimization, EWC++ anti-forgetting, pattern reuse
    Task Routing Manual agent selection Intelligent 3-layer routing (keyword β†’ semantic β†’ LLM), 89% accuracy
    Simple Transforms Full LLM call every time Agent Booster (WASM): <1ms, $0 cost
    Background Work Nothing runs automatically 12 workers auto-dispatch on hooks events
    LLM Providers Anthropic only Claude, GPT, Gemini, Cohere, Ollama with failover and cost routing
    Security Standard Claude sandboxing CVE-hardened, WASM/Docker sandbox per agent, cryptographic proofs
    Governance CLAUDE.md is advisory Runtime-enforced policy gates with HMAC audit trail
    Cost Full LLM cost every task 30–50% reduction via WASM, caching, smart routing

    Architecture Deep Dives

    🧭 Intelligent Task Routing β€” 3-layer pipeline that routes every request

    Every request passes through a 3-layer pipeline before any agent sees it:

    Request
      β”‚
      β”œβ”€β–Ί [Layer 1] Keyword pre-filter     β†’ instant match, zero LLM cost
      β”‚
      β”œβ”€β–Ί [Layer 2] Semantic routing       β†’ embedding similarity vs. agent catalog
      β”‚
      └─► [Layer 3] LLM fallback (Haiku)  β†’ Haiku-powered classification for ambiguous tasks

    Once classified, the task hits the 3-tier cost model:

    Tier Handler Latency Cost Used for
    1 Agent Booster (WASM) <1ms $0 Simple transforms (var→const, add types, logging)
    2 Haiku ~500ms ~$0.0002 Moderate tasks, summaries, Q&A
    3 Sonnet / Opus 2–5s $0.003–$0.015 Architecture, security, complex reasoning

    Hook signals β€” what the system emits to guide routing:

    # Agent Booster can handle it β€” skip LLM entirely
    [AGENT_BOOSTER_AVAILABLE] Intent: var-to-const
    β†’ Use Edit tool directly, <1ms, $0
    
    # Model recommendation for Task tool
    [TASK_MODEL_RECOMMENDATION] Use model="haiku" (complexity=22)
    β†’ Pass model="haiku" to Task tool for cost savings

    Microagent trigger scanner β€” 10 specialist agents with keyword frontmatter triggers:

    Domain Trigger keywords Agent
    Security auth, injection, CVE, secret security-architect
    DevOps deploy, CI/CD, pipeline, k8s devops-automator
    Database query, schema, migration, index database-optimizer
    Frontend React, CSS, component, SSR frontend-dev
    Solidity contract, ERC, Solidity, DeFi solidity-engineer
    🐝 Swarm Coordination β€” How agents organize and reach consensus

    Agents organize into swarms with configurable topologies and consensus algorithms:

    Topology Best for Consensus
    Hierarchical Coding tasks, feature work (default) Raft (leader-based)
    Mesh Distributed exploration, research Gossip / CRDT
    Adaptive Auto-switches based on load Byzantine (BFT)

    Consensus algorithms:

    Algorithm Fault tolerance Use case
    Raft f < n/2 Authoritative state, coding swarms
    Byzantine (BFT) f < n/3 Untrusted environments
    Gossip Eventual consistency Large swarms (100+ agents)
    CRDT No coordination overhead Conflict-free concurrent writes

    Anti-drift swarm configuration (recommended for all coding tasks):

    npx monobrain@latest swarm init \
      --topology hierarchical \
      --max-agents 8 \
      --strategy specialized \
      --consensus raft
    Setting Why it prevents drift
    hierarchical Coordinator validates every output against the goal
    max-agents 6–8 Smaller team = less coordination overhead
    specialized Clear roles, no task overlap
    raft Single leader maintains authoritative state

    Task β†’ agent routing:

    Task Agents
    Bug fix coordinator Β· researcher Β· coder Β· tester
    New feature coordinator Β· architect Β· coder Β· tester Β· reviewer
    Refactor coordinator Β· architect Β· coder Β· reviewer
    Performance coordinator Β· perf-engineer Β· coder
    Security audit coordinator Β· security-architect Β· auditor
    🧠 Self-Learning Intelligence β€” How Monobrain gets smarter every session

    Every task feeds the 4-step RETRIEVE-JUDGE-DISTILL-CONSOLIDATE pipeline:

    RETRIEVE  ──►  JUDGE  ──►  DISTILL  ──►  CONSOLIDATE
       β”‚               β”‚            β”‚               β”‚
    HNSW search   success/fail   LoRA extract   EWC++ preserve
    150x faster    verdicts       128x compress  anti-forgetting

    Memory architecture:

    Feature Details
    Episodic memory Full task histories with timestamps and outcomes
    Entity extraction Automatic extraction of code entities into structured records
    Procedural memory Learned skills from .monobrain/skills.jsonl
    Vector search 384-dim embeddings, sub-ms retrieval via HNSW
    Knowledge graph PageRank + community detection for structural insights
    Agent isolation Per-agent memory scopes prevent cross-contamination
    Hybrid backend SQLite + AgentDB, zero native binary dependencies

    Specialization scorer β€” per-agent, per-task-type success/failure tracking with time-decay. Feeds routing quality over time. Persists to .monobrain/scores.jsonl.

    ⚑ Agent Booster (WASM) β€” Skip the LLM for simple code transforms

    Agent Booster uses WebAssembly to handle deterministic code transforms without any LLM call:

    Intent Example vs LLM
    var-to-const var x = 1 β†’ const x = 1 352Γ— faster
    add-types Add TypeScript annotations 420Γ— faster
    add-error-handling Wrap in try/catch 380Γ— faster
    async-await .then() β†’ async/await 290Γ— faster
    add-logging Insert structured debug logs 352Γ— faster
    remove-console Strip all console.* calls 352Γ— faster
    format-string Modernize to template literals 400Γ— faster
    null-check Add ?. / ?? operators 310Γ— faster

    When hooks emit [AGENT_BOOSTER_AVAILABLE], Claude Code intercepts and uses the Edit tool directly β€” zero LLM round-trip.

    πŸ’° Token Optimizer β€” 30–50% API cost reduction

    Smart caching and routing stack multiplicatively to reduce API costs:

    Optimization Savings Mechanism
    ReasoningBank retrieval –32% Fetches relevant patterns, not full context
    Agent Booster transforms –15% Simple edits skip LLM entirely
    Pattern cache (95% hit rate) –10% Reuses embeddings and routing decisions
    Optimal batch size –20% Groups related operations
    Combined 30–50% Multiplicative stacking
    πŸ›οΈ Governance β€” Runtime policy enforcement from CLAUDE.md

    @monobrain/guidance compiles CLAUDE.md into a 7-phase runtime enforcement pipeline:

    CLAUDE.md ──► Compile ──► Retrieve ──► Enforce ──► Trust ──► Prove ──► Defend ──► Evolve
    Phase Enforces
    Enforce Destructive ops, tool allowlist, diff size limits, secret detection
    Trust Per-agent trust accumulation with privilege tiers
    Prove HMAC-SHA256 hash-chained audit envelopes
    Defend Prompt injection, memory poisoning, collusion detection
    Evolve Policy drift detection, auto-update proposals

    1,331 tests Β· 27 subpath exports Β· WASM security kernel


    Quick Start

    Prerequisites

    • Node.js 20+ (required)
    • Claude Code β€” npm install -g @anthropic-ai/claude-code

    Installation

    One-line (recommended):

    curl -fsSL https://cdn.jsdelivr.net/gh/nokhodian/monobrain@main/scripts/install.sh | bash

    Via npx:

    npx monobrain@latest init --wizard

    Manual:

    # Register MCP server with Claude Code
    claude mcp add monobrain -- npx -y monobrain@latest mcp start
    
    # Start background worker daemon
    npx monobrain@latest daemon start
    
    # Health check
    npx monobrain@latest doctor --fix

    First Commands

    # Spawn an agent
    npx monobrain@latest agent spawn -t coder --name my-coder
    
    # Launch a full swarm
    npx monobrain@latest hive-mind spawn "Refactor auth module to use OAuth2"
    
    # Search learned patterns
    npx monobrain@latest memory search -q "authentication patterns"
    
    # Dual Claude + Codex workflow
    npx monobrain-codex dual run feature --task "Add rate limiting middleware"

    ⚑ Slash Commands

    Type these directly in Claude Code. No setup beyond npx monobrain init.


    πŸ€– Agent Intelligence

    Command What it does
    /specialagent Scores all 60+ agents against your task and picks the best one (or recommends a full swarm config). Prevents wasting a generic coder on a job that needs a Database Optimizer or tdd-london-swarm.
    /use-agent [slug] Instantly activates a non-dev specialist agent β€” Sales Coach, TikTok Strategist, Legal Compliance Checker, UX Researcher, etc. Without a slug, auto-picks from conversation context.
    /list-agents [category] Lists all available specialist agents, optionally filtered by category (marketing, sales, design, academic, product, project-management, support).

    🌐 Browser & UI Automation

    Command What it does
    /ui-test <url> Full UI test run: opens the URL, snapshots interactive elements, walks golden-path flows, tests edge cases, reports pass/fail/warn. Powered by agent-browser.
    /browse <url> Navigates to a URL and walks through it step by step β€” narrating what's on screen, proposing actions, and helping you accomplish tasks via the browser.
    /crawl <url> Crawls a website β€” extracts links, text, structured data, or anything you specify. Great for scraping, auditing, or data extraction tasks.
    /browser Raw agent-browser session: opens an interactive browser automation context with snapshot, click, fill, and screenshot tools. Use when you need fine-grained control.

    πŸ›οΈ SPARC Methodology

    Command What it does
    /sparc Runs the full SPARC orchestrator β€” breaks down your objective, delegates to the right modes, and coordinates the full development lifecycle.
    /sparc spec-pseudocode Captures requirements, edge cases, and constraints, then translates them into structured pseudocode ready for implementation.
    /sparc code Auto-coder mode β€” writes clean, efficient, modular code from pseudocode or a spec.
    /sparc debug Debugger mode β€” traces runtime bugs, logic errors, and integration failures systematically.
    /sparc security-review Security reviewer β€” static and dynamic audit, flags secrets, poor module boundaries, and injection risks.
    /sparc devops DevOps mode β€” CI/CD, Docker, deployment automation.
    /sparc docs-writer Writes clear, modular Markdown documentation: READMEs, API references, usage guides.
    /sparc refinement-optimization-mode Refactors, modularizes, and improves system performance. Enforces file size limits and dependency hygiene.
    /sparc integration System integrator β€” merges outputs of all modes into a working, tested, production-ready system.

    🐝 Swarm & Memory

    Command What it does
    /monobrain-swarm Coordinates a multi-agent swarm for complex tasks β€” spawns agents, distributes work, waits for results, synthesizes output.
    /monobrain-memory Interacts with the AgentDB memory system β€” store, search, retrieve, and inspect patterns across sessions.
    /monobrain-help Shows all Monobrain CLI commands and usage reference inline.

    Pro tip β€” automatic activation: You don't need to type slash commands for most flows. The UserPromptSubmit hook reads every prompt and automatically suggests the right slash command (or activates it) based on what you wrote. /specialagent activates when you ask "which agent", /ui-test activates when you say "test the UI", /browse activates when you say "go to the website", etc.


    Agents

    100+ specialized agents across every engineering domain:

    πŸ”§ Core Development
    Agent Specialization
    coder Clean, efficient implementation across any language
    reviewer Code review β€” correctness, security, maintainability
    tester TDD, integration, E2E, coverage analysis
    planner Task decomposition, sprint planning, roadmap
    researcher Deep research, information gathering
    architect System design, DDD, architectural patterns
    analyst Code quality analysis and improvement
    πŸ”’ Security
    Agent Specialization
    security-architect Threat modeling, secure design, vulnerability assessment
    security-auditor Smart contract audits, CVE analysis
    security-engineer Application security, OWASP, secure code review
    threat-detection SIEM rules, MITRE ATT&CK, detection engineering
    compliance-auditor SOC 2, ISO 27001, HIPAA, PCI-DSS
    🐝 Swarm & Consensus
    Agent Specialization
    hierarchical-coordinator Queen-led coordination with specialized worker delegation
    mesh-coordinator P2P mesh, distributed decision-making, fault tolerance
    adaptive-coordinator Dynamic topology switching, self-organizing
    byzantine-coordinator BFT consensus, malicious actor detection
    raft-manager Raft protocol, leader election, log replication
    gossip-coordinator Gossip-based eventual consistency
    crdt-synchronizer Conflict-free replication
    consensus-coordinator Sublinear solvers, fast agreement
    πŸš€ DevOps & Infrastructure
    Agent Specialization
    devops-automator CI/CD pipelines, infrastructure automation
    cicd-engineer GitHub Actions, pipeline creation
    sre SLOs, error budgets, chaos engineering
    incident-response Production incident management, post-mortems
    database-optimizer Schema design, query optimization, PostgreSQL/MySQL
    data-engineer Data pipelines, lakehouse, dbt, Spark, streaming
    🌐 Frontend, Mobile & Specialized
    Agent Specialization
    frontend-dev React/Vue/Angular, UI, performance optimization
    mobile-dev React Native iOS/Android, cross-platform
    accessibility WCAG, screen readers, inclusive design
    solidity-engineer EVM smart contracts, gas optimization, DeFi, L2
    ml-engineer ML model development, training, deployment
    embedded-firmware ESP32, STM32, FreeRTOS, Zephyr, bare-metal
    backend-architect Scalable systems, microservices, API design
    technical-writer Developer docs, API references, tutorials
    πŸ”€ GitHub Workflow Automation
    Agent Specialization
    pr-manager PR lifecycle, review coordination, merge management
    code-review-swarm Parallel multi-agent code review
    release-manager Automated release coordination, changelog
    repo-architect Repository structure, multi-repo management
    issue-tracker Issue management, project coordination
    workflow-automation GitHub Actions creation and optimization
    πŸ”¬ SPARC Methodology
    Agent Specialization
    sparc-coord SPARC orchestrator across all 5 phases
    specification Requirements analysis and decomposition
    pseudocode Algorithm design, logic planning
    architecture System design from spec
    refinement Iterative improvement
    sparc-coder TDD-driven implementation from specs

    View all: npx monobrain@latest agent list


    Live Statusline

    Monobrain adds a real-time six-row dashboard to Claude Code:

    β–Š Monobrain v1.0.0  β—‹ IDLE  nokhodian  β”‚  βŽ‡ main  +1  ~9921 mod  ↑5  β”‚  πŸ€– Sonnet 4.6
    ──────────────────────────────────────────────────────────────────────────────────────
    πŸ’‘  INTEL    β–±β–±β–±β–±β–±β–± 3%   β”‚   πŸ“š 190 chunks   β”‚   76 patterns
    ──────────────────────────────────────────────────────────────────────────────────────
    🐝  SWARM    0/15 agents   ⚑ 14/14 hooks   β”‚   🎯 3 triggers Β· 24 agents   β”‚   β†’ ROUTED  πŸ‘€ Coder  81%
    ──────────────────────────────────────────────────────────────────────────────────────
    🧩  ARCH     82/82 ADRs   β”‚   DDD β–°β–°β–±β–±β–± 40%   β”‚   πŸ›‘οΈ βœ– NONE   β”‚   CVE not scanned
    ──────────────────────────────────────────────────────────────────────────────────────
    πŸ—„οΈ  MEMORY   0 vectors   β”‚   2.0 MB   β”‚   πŸ§ͺ 66 test files   β”‚   MCP 1/1  DB βœ”
    ──────────────────────────────────────────────────────────────────────────────────────
    πŸ“‹  CONTEXT  πŸ“„ SI 80% budget (1201/1500 chars)   β”‚   πŸ— β–°β–°β–±β–±β–± 2/5 domains   β”‚   πŸ’Ύ 47 MB RAM
    Row Shows
    Header Version, session state, git user, branch, uncommitted changes
    INTEL Intelligence score, knowledge chunks indexed, learned patterns
    SWARM Active agents, hook count, microagent triggers, last routing result
    ARCH ADR compliance, DDD domain coverage, security gates, CVE status
    MEMORY Vector count, DB size, test file count, MCP/DB health
    CONTEXT Shared instructions budget, domain coverage, RAM usage

    Toggle compact ↔ full: /ts β€” Full reference: tagline.md


    Dual-Mode Collaboration

    Run Claude Code and OpenAI Codex workers in parallel with shared memory:

    # Pre-built templates
    npx monobrain-codex dual run feature --task "Add OAuth authentication"
    npx monobrain-codex dual run security --target "./src"
    npx monobrain-codex dual run bugfix --task "Fix race condition in session handler"
    
    # Custom pipeline
    npx monobrain-codex dual run \
      --worker "claude:architect:Design the API contract" \
      --worker "codex:coder:Implement the endpoints" \
      --worker "claude:tester:Write integration tests" \
      --worker "codex:optimizer:Reduce allocations"

    Worker dependency order: Architect (L0) β†’ Coder + Tester (L1) β†’ Reviewer (L2) β†’ Optimizer (L3)

    Template Workers Pipeline
    feature Architect β†’ Coder β†’ Tester β†’ Reviewer Full feature development
    security Analyst β†’ Scanner β†’ Reporter Security audit
    refactor Architect β†’ Refactorer β†’ Tester Code modernization
    bugfix Researcher β†’ Coder β†’ Tester Bug investigation and fix

    Packages

    todo: write about packages of this app

    Plugins

    todo: write about plugins of this app 20 plugins via the IPFS-distributed registry:

    npx monobrain@latest plugins list
    npx monobrain@latest plugins install @monobrain/plugin-name
    npx monobrain@latest plugins create my-plugin

    Contributing

    git clone https://github.com/nokhodian/monobrain.git
    cd monobrain/packages
    pnpm install
    pnpm test

    Support

    Documentation github.com/nokhodian/monobrain
    Issues github.com/nokhodian/monobrain/issues
    Enterprise monoes.me

    MIT β€” nokhodian


    Acknowledgements

    Monobrain builds on ideas, patterns, and research from the following projects:

    Repository What we took
    ruvnet/ruflo Original skeleton β€” swarm coordination, hooks system, and SPARC methodology
    msitarzewski/agency-agents Agent architecture patterns and multi-agent md files
    microsoft/autogen Human oversight interrupt gates, AutoBuild ephemeral agents, procedural skill learning from executions, and tool-retry patterns
    crewAIInc/crewAI Multi-tier memory (short/long/entity/contextual), role/goal/backstory agent registry, task context chaining, and output schema patterns
    langchain-ai/langgraph Graph checkpointing + resume, StateGraph workflow DSL (fan-out/fan-in, conditional, loops), and entity extraction from conversation state
    All-Hands-AI/OpenHands Per-agent Docker/WASM sandboxing, semantic versioned agent registry (AgentHub), and EventStream session replay
    agno-agi/agno AgentMemory knowledge base architecture and team-level agent coordination class
    huggingface/smolagents Explicit planning step before execution and ManagedAgent delegation wrapper
    pydantic/pydantic-ai Typed Agent[Deps, Result] I/O schemas, auto-retry on validation failure, TestModel for deterministic CI, and dynamic system prompt functions
    BAAI/AgentSwarm (Agency Swarm) Declared directed communication flows between agents and shared instruction propagation
    BerriAI/atomic-agents BaseIOSchema typed agent contracts and SystemPromptContextProvider composition
    stanfordnlp/dspy BootstrapFewShot + MIPRO automatic prompt optimization pipeline
    aurelio-labs/semantic-router Utterance-based RouteLayer replacing static routing codes, dynamic routes, and hybrid routing mode
    langfuse/langfuse Unified trace/span/generation observability hierarchy, per-agent cost attribution, latency views, and prompt version management
    karpathy/autoresearch Experiment loop protocol (BASELINE/KEEP/DISCARD results.tsv), fixed time-budget per run, and Best-Fit Decreasing bin packing for API chunking β€” wired into @monoes/graph pipeline
    safishamsi/graphify Knowledge graph construction approach, AST-based node/edge extraction, community detection with Louvain, and GRAPH_REPORT.md report format β€” foundation for @monoes/graph
    google/gvisor (paper) gVisor runsc OCI-compatible runtime β€” reduces Docker container syscall surface from 350+ to ~50 interceptions; wired into SandboxConfig.use_gvisor and buildDockerArgs()
    Indirect Injection research (follow-up) Prompt injection via external tool content β€” validateExternalContent() in @monobrain/security applies pattern + optional aidefence semantic scan to all externally-sourced content
    FOREVER Forgetting Curve Exponential importance-weighted forgetting curve (importanceScore Γ— e^(βˆ’Ξ»t)) replacing linear decay β€” implemented in LearningBridge.decayConfidences() and MemoryEntry.importanceScore
    Awesome RLVR Reinforcement Learning with Verifiable Rewards β€” hooksModelOutcome now accepts verifier_type (tsc/vitest/eslint/llm_judge) and exit_code to derive grounded binary reward signals
    ERL β€” Experiential Reflective Learning Structured {condition, action, confidence} heuristics extracted at hooks_post-task and injected as ranked hints into hooks_pre-task suggestions via the heuristics memory namespace
    A-MEM β€” Agentic Memory Zettelkasten-style automatic note linking β€” after every bridgeStoreEntry, top-3 HNSW neighbors above 0.7 similarity receive a similar causal edge via bridgeRecordCausalEdge
    DSPy Bayesian exploration option (bayesian: true) added to PromptOptimizer.optimize() β€” shuffles trace scores with U(0,0.1) noise before selectExamples to escape local optima
    Collaborative Memory Promotion Auto-promote memory access_level from private β†’ team when 3+ distinct agents read an entry within 24 h β€” implemented via agent_reads table in SQLiteBackend and checkAndPromoteEntry()
    Zep / Graphiti β€” Bi-Temporal Knowledge Graph (repo) Separates event time T from ingestion time T' β€” MemoryEntry.eventAt nullable field + event_at SQLite column for temporal filtering without index rebuilds; 94.8% on Deep Memory Retrieval at 90% lower latency than MemGPT
    HippoRAG 2 β€” PPR Graph Retrieval Personalized PageRank over the memory reference graph β€” MemoryGraph.pprRerank() expands HNSW candidates one hop via MemoryEntry.references, boosting associative recall by up to 20% on multi-hop QA
    RAPTOR β€” Recursive Abstractive Tree Indexing Cluster episodic entries β†’ summarize each cluster β†’ store as contextual-tier entry β€” implemented in the consolidate background worker (runConsolidateWorker), creating RAPTOR's tree within existing stores
    Multi-Agent Reflexion (MAR) Heterogeneous Diagnoser β†’ CriticΓ—2 β†’ Aggregator reflection loop β€” hooks_post-task now returns marReflection when a task fails, specifying the four agent roles and spawn order
    TextGrad β€” Automatic Differentiation via Text (Nature) LLM textual gradients flow backward through the pipeline β€” on hooks_post-task failure a textual_gradient critique is stored to the gradients memory namespace for next-prompt injection; +20% on LeetCode-Hard
    CP-WBFT β€” Confidence-Probe Weighted BFT Confidence-weighted voting replaces one-node-one-vote β€” weightedTally() in consensus/vote-signer.ts scales each agent's vote by its confidence score, tolerating 85.7% fault rate (AAAI 2026)
    GraphRAG + Practical GraphRAG (Practical) Community-level global query answering β€” MemoryGraph.getCommunitySummaries() returns top-k community descriptors (nodeCount, avgPageRank) for prepending to semantic search results; enables thematic reasoning over the entire knowledge base
    MemPalace Spatially-organized verbatim memory with Wing→Room→Hall hierarchy, Okapi BM25 + closet-topic hybrid retrieval, score-based L1 promotion, and temporal knowledge graph — implemented in .claude/helpers/memory-palace.cjs; injects L0 identity + L1 essential story on every session start via SessionStart hook; achieves 96.6% LongMemEval recall without summarization