English | 简体中文
Organ (Brain & Immune) · Organism (Reflex & Sleep) · Organization (Roles & Separation of Powers)
A zero-dependency, local-first Context OS for AI coding agents (Antigravity, Claude Code, Codex, Cursor, OpenCode) and headless runners.
Triple Etymology: Organ (cortical sparse tree & immune antibodies) · Organism (0-token spinal reflexes & sleep consolidation) · Organization (scoped roles & separation of powers)—while paying homage to Aristotle's Organon (instrument of thought).
Stuffing 200 MCP tools, 80 skills, 300 docs, and 60 KB of historical memory into every system prompt is equivalent to forcing 100% of a brain's neurons to fire at once—causing attention rot, silent rule truncation, runaway token costs, and repeated regressions.
Pure lazy loaders (mcp-meta, skill-meta, docs-meta) cut idle tokens by ~90%, but isolated lazy loaders create knowledge silos: reading a UI spec does not remind the agent which static gate checks that rule, or which bug broke that screen last week.
Organon unifies lazy meta-tools, associative memory, instincts, and role governance into one pure-Python, zero-dependency engine:
- Organ · Brain & Immune System: Sparse cortical activation (
L0 → L1 → L2) + lateral synapses (⚡innate cross-references & Hebbian co-activation) + automatic immune antibodies (🛡️) extracted fromretro*.md/postmortem*.md/incident*.md. - Organism · Instincts & Sleep: Zero-token spinal reflex gate auto-detection (
gate.sh,Makefile,package.json,pyproject.toml,Cargo.toml,go.mod) +orgn pruneoffline sleep consolidation that decays stale Hebbian links while preserving permanent postmortem antibodies. - Organization · Separation of Powers: Language-agnostic built-in roles (
builder,verifier,auditor,investigator) extensible via<repo>/.agents/roles.json, enforcingbuilder != verifierby contract alongside an unattended sleep-autonomy policy.
flowchart TB
Host["Agent / Headless Runner (Antigravity · Claude · Codex · Cursor · CI)"]
subgraph Organization["Organization Layer (Roles & Separation of Powers)"]
Role["orgn role / organon_role"]
Contract["Separation of Powers (Builder != Verifier != Auditor)"]
end
subgraph Brain["Organ · Brain (L0/L1/L2 Sparse Tree + Lateral Synapses)"]
Trunk["L0 Tree Trunk (organon_tree)"]
B1["skill:// (SKILL.md)"]
B2["doc:// (docs/Docs/**/*.md, archives excluded)"]
B3["rule:// (AGENTS.md / CLAUDE.md / .agents/rules)"]
B4["mcp:// (MCP Servers)"]
B5["memory:// (BOOTSTRAP & AMH CLI)"]
Synapse["⚡ Lateral Synapses (Innate + Hebbian 14d Half-Life)"]
end
subgraph Organism["Organism & Immune Layer (Instincts & Sleep)"]
Reflex["⚡ Spinal Reflex (0-Token Hooks / Test & Lint Gates)"]
Immune["🛡️ Immune Antibodies (retro/postmortem/incident + SQLite)"]
Prune["🌙 Sleep Consolidation (orgn prune)"]
end
Host --> Role
Role --> Contract
Role --> Trunk
Host --> Trunk
Trunk --> B1 & B2 & B3 & B4 & B5
B1 <--> Synapse
B2 <--> Synapse
B3 <--> Synapse
B4 <--> Synapse
B5 <--> Synapse
B2 -.-> Immune
B3 -.-> Immune
Role --> Reflex
Synapse --> Prune
sequenceDiagram
autonumber
participant A as Agent / Headless
participant T as OrganonTree (L0/L1/L2)
participant S as SynapseGraph (SQLite)
participant I as Immune Scanner (retro/postmortem)
A->>T: L0 organon_tree(root)
T-->>A: Counts across 5 branches + persisted synapse count
A->>T: L1 organon_search(query="auth token")
T-->>A: Matched leaf URIs + 1-line summaries only
A->>T: L2 organon_activate(uri, session_id)
T->>S: record_activation(session_id, uri) reinforces recent Hebbian co-activation
T->>S: spread(uri, content) computes innate refs + decayed Hebbian weights
T->>I: scan_retro_antibodies(root, content) surfaces historical incident antibodies
T-->>A: Bounded section (<=200 lines) + [⚡ Organon Synapses] + [🛡️ Immune Antibodies]
| Kind | Tag | How It Forms | Lifecycle |
|---|---|---|---|
| Innate Structural Synapse | innate |
Automatically extracted from skill:// / doc:// / rule:// URIs, file paths, skill names, and shared domain concepts |
Computed live as docs and rules evolve |
| Hebbian Co-Activation Synapse | hebbian |
Bidirectionally reinforced whenever the same session_id activates two leaves within a 30-minute window |
14-day exponential half-life; weak edges pruned via orgn prune |
| Explicit Domain Synapse | explicit |
Manually wired via orgn synapses A --connect B |
Persistent; never decays over time |
| Immune Antibody Synapse | antibody |
Auto-scanned from retro* / postmortem* / incident* / .agents/antibodies.json or registered via orgn antibody |
Permanent immune memory; never deleted during sleep pruning |
- L1 Philosophy: Non-negotiable product truths and invariants (never decays).
- L2 Mental Model: Core principles, reasoning axioms, and separation of powers (
rule://). - L3 Strategy: Architectural boundaries, trade-offs, and role ownership (
role://,doc://). - L4 Tactics: Domain specs, section-level workflows, and known pitfalls (
skill://,doc://#section,⚡synapses,🛡️antibodies). - L5 Execution: Concrete tool calls, edits, and 0-token spinal reflex gates (
mcp://, hooks, static checks).
Core Invariant: Tactical/execution roles (
L4–L5) must never guess or silently rewrite philosophical, mental-model, or strategic boundaries (L1–L3). Humans set direction while awake (L1–L3); agents advance safely while humans sleep (L4–L5)—halting cleanly at ambiguous strategic boundaries (on_ambiguity), self-correcting within bounded attempts via reflex gates (on_failure), and leaving a clean, rollback-safe checkpoint if blocked (on_blocked).
flowchart LR
I["1. Information (Raw Turns)"] --> K["2. Knowledge (doc:// / retro*)"]
K -->|"orgn distill flags ungated retros"| S["3. Skill (skill:// / Gate Scripts)"]
S -->|"High-frequency Hebbian co-activation"| M["4. Mental Model (rule:// / 🛡️ Antibody)"]
M --> R["5. Cross-Layer Reasoning"]
flowchart LR
U["Task / Issue"] --> B["builder (orgn role builder)"]
B --> R["Spinal Reflex 0-Token (tests / lint / gate)"]
R -- "Pass" --> V["verifier (orgn role verifier)"]
R -- "Fail" --> B
V --> G["Independent Assertions & Gate"]
G -- "Pass" --> A["auditor (orgn role auditor)"]
G -- "Rejected" --> D["investigator (orgn role investigator)"]
D -. "retro / postmortem feeds immune layer" .-> AB["🛡️ New Immune Antibody"]
AB -.-> B
A --> H["Human Approval / Release"]
Organon ships 4 language-agnostic built-in roles (auto-detecting pyproject.toml, package.json, Cargo.toml, go.mod, Makefile, and scripts/gate.sh):
| Built-in Role | Authority | Responsibility & Boundary |
|---|---|---|
builder |
builder |
Implements changes within scoped file ownership; cannot self-certify completion—must hand off to verifier |
verifier |
verifier |
Runs independent tests, behavioral assertions, and gate scripts; never accepts compile-only checks as verification |
auditor |
auditor |
Audits security, privacy, dependencies, compliance, and release readiness; external publishing requires human sign-off |
investigator |
investigator |
Traces root causes, writes a failing regression test first, and turns findings into postmortem/retro antibodies |
| Branch Prefix | Auto-Discovered Sources | Example URI |
|---|---|---|
skill:// |
<repo>/.{agents,claude,cursor,codex,gemini}/skills, ~/.config/magpie/library/skills, ~/.agents/skills, ~/.gemini/config/{skills,plugins/*/skills}, ~/.claude/{skills,plugins/*/skills}, ~/.codex/skills, ~/.cursor/skills, ~/.codebuddy/skills, ~/.workbuddy/skills, ~/.config/opencode/skills, ~/.dsh/skills |
skill://code-review |
doc:// |
<repo>/docs/, Docs/, doc/, documentation/ plus top-level README*.md, AGENTS.md, CLAUDE.md, GEMINI.md, CODEBUDDY.md, CURSOR.md, ARCHITECTURE.md (auto-skips archive / deprecated / legacy) |
doc://docs/architecture.md#Auth |
rule:// |
<repo>/{AGENTS,CLAUDE,GEMINI,CODEBUDDY,CURSOR}.md, .cursorrules, .windsurfrules, .clinerules, .github/copilot-instructions.md, <repo>/.{agents,claude,cursor,windsurf,roo}/rules/*.{md,mdc}, plus global ~/.gemini/GEMINI.md, ~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, ~/.codebuddy/CODEBUDDY.md, ~/.dsh/AGENTS.md, ~/.config/opencode/AGENTS.md |
rule://.cursor/rules/ui.mdc |
mcp:// |
<repo>/.mcp.json, ~/.config/magpie/library.json, ~/.config/mcp-meta/servers.json, plus standalone host MCP configs in Antigravity, Cursor, Claude, CodeBuddy, WorkBuddy, and OpenCode (auto-redacts secrets/tokens) |
mcp://github |
memory:// |
~/.ai-memory/BOOTSTRAP.md, ai-memory-hub search (memory://search/<q>), cross-AI conversation turn recall via ai-memory-hub capture recall (memory://recall/<q>), plus native host memory notes (~/.claude/projects/*/memory/*.md, ~/.workbuddy/memory/*.md, ~/.cursor/memories/*.md, Antigravity knowledge/**/*.md) |
memory://recall/auth |
Evaluated in a zero-prior-context codex exec run against a production codebase containing 313 context leaves (104 skills, 173 docs, 7 rule files, 20 MCP servers, 9 memory topics; ~561 KB of raw markdown/config):
- End-to-end lookup latency (
role+search+activate):569 ms - Total context read: ~80 lines (
10lines of target spec body vs. hundreds of KB upfront) - Zero-prompt safety recall: Automatically surfaced the
builder != verifierrule, all 4 repo reflex gate scripts, and 6 historicalretro-*.mdantibodies - Distillation audit (
orgn distill): Automatically separated 58 gated postmortems from 49 historical incidents still awaiting automated guards
One package installs organon, orgn, and backward-compatible mcp-meta, skill-meta, and docs-meta CLIs (including the built-in stdio + HTTP MCP proxy engine):
git clone https://github.com/monkey-sking/organon.git
cd organon
python3 -m unittest discover -s tests -v
pip install -e .
# Optional: wire Organon + compact BOOTSTRAP startup across local hosts (Antigravity / Codex / Claude / CodeBuddy)
orgn hosts --install# L0: Inspect cortical tree leaf counts & persisted synapses for any repo
orgn tree --root /path/to/repo
# L1: Sparse search across all 5 branches (supports English & Chinese)
orgn search "auth token" --root /path/to/repo
orgn search "architecture" --branch doc --root /path/to/repo
# L2: Activate a bounded leaf section + reinforce Hebbian links + surface synapses & antibodies
orgn activate "doc://docs/architecture.md#Auth" --root /path/to/repo --session auth-fix
# Explicitly wire domain synapses or register persistent immune antibodies
orgn synapses "doc://docs/api.md" --connect "rule://AGENTS.md" --reason "API contract rule"
orgn antibody "rule://AGENTS.md" --target "doc://docs/postmortem-auth.md" --hazard "Token leak in logs" --guard "npm test"
# Role onboarding brief (5-layer authority bounds + sleep-autonomy contract for subagents / CI runners)
orgn role --root /path/to/repo
orgn role builder --root /path/to/repo
# Upward distillation audit (find ungated retros & high-frequency co-activated leaf pairs)
orgn distill --root /path/to/repo
# Offline sleep consolidation (prune decayed Hebbian edges older than 14 days; keep antibodies)
orgn prune --min-weight 0.15 --max-age-days 14organon serveAdd to your host's mcp_config.json:
{
"mcpServers": {
"organon": {
"command": "organon",
"args": ["serve"]
}
}
}Exposes 7 lightweight meta-tools: organon_tree, organon_search, organon_activate, organon_synapses, organon_role, organon_prune, and organon_distill.
{
"backend-api": {
"title": "Backend API Engineer",
"authority": "builder",
"separation_of_powers": "Builder writes contract tests; verifier validates schema diff.",
"seed_uris": ["rule://AGENTS.md", "doc://docs/api.md"],
"reflex_gates": ["pytest", "ruff check ."],
"domain_keywords": "API schema auth rate-limit"
}
}ORGANON_DB: Custom SQLite path for the synapse & antibody graph (default:~/.config/organon/synapses.db; automatically falls back to a temp path in read-only sandboxes).
MIT