从元工具到 Organon:给 AI 装上记忆、反射弧与分工

两周前写过一篇《用“元工具”把上下文砍掉 90%》。

那次靠 mcp-meta 和 skill-meta,把 50 多个 MCP 工具和 70 多个技能从首轮提示词里拿掉了,常驻开销降到 ~1,200 Tokens。

省钱和降噪之后,很快就遇到了下一个问题。

一、元工具省了 Token,但也割断了联想

为了继续省上下文,我又陆续补了 docs-meta、rule-meta、memory-meta。加上原来的工具和技能,一共五个入口,五个懒加载器。

表面上看很干净,实际用起来不对劲:

  1. 孤岛化:Agent 用 docs-meta 查到一条 UI 规范,但不会自动想起「旁边还有个检查脚本」或者「上周同一页刚踩过一次坑」。
  2. 规则文件越写越胖:所有红线全往 AGENTS.md 里塞,最后文件涨到 26 KB,而宿主规则文件上限只有 24,000 字节——超出的部分直接被静默截断。
  3. 自己写了自己测:同一个 Agent 写完代码,顺手跑自己改过的检查然后宣布“已完成”。很多低级问题不是模型笨,是权限和角色没有隔离。

我发现以前做的一直是“压缩包”,把文件藏起来按需解压。但真正缺的,是一套把知识、记忆、防错、分工连在一起的结构。

后来翻到自己这几年在博客里写下的几篇短笔记,发现它们其实已经把答案写了一半。


二、几篇旧笔记,其实是同一套架构

1. DNA 与记忆(2020-06)

我在《DNA、人、AI,记忆与传承》里只写了两句话:

DNA 的传承靠的是生命:生物。
人类的传承是记忆:知识。

放到 Agent 上也一样。每次开新对话,上下文都会清空。如果只靠每次重新读全量文档,就像每个生物每一代都在重新进化。

Agent 同样需要两种记忆:

  • 先天结构(⚡ 先天突触):规范和脚本之间天然存在的引用关系,不用等到踩坑才建立。
  • 后天共激活(⚡ 赫布突触):在真实工作流里反复一起用到的文档、技能、工具,越用连接越紧;长期不用的记忆随时间衰减(14 天半衰期)。

2. 信息往思维模式蒸馏(2020-08)

在《信息-知识-技能-思维模式-逻辑推理能力》里,我记过一条升级路径:

信息变成知识,知识变成技能,技能变成思维模式,思维模式变成逻辑推理能力。

平常项目里的踩坑复盘(postmortem)、临时记录,都是最低层的“信息”。如果不做提炼,它们只会在 Docs/ 里落灰。

如果把反复命中的复盘自动提取成免疫抗体(🛡️ Antibody),挂在对应文档旁边——甚至由工具扫描出「哪些复盘还没固化成自动化检查脚本」——信息就真正在往“技能”和“思维模式”走。

3. 问题的五个层级(2020-09)

在《问题的层级》那张图里,我把问题分成了五层:

  1. 哲学层(L1 Philosophy):本质与红线。什么绝对不能干,哪怕改需求也不能破。
  2. 思想层(L2 Mental Model):原则与方法。遇到复杂系统怎么判断。
  3. 战略层(L3 Strategy):方向与取舍。谁干什么,边界划在哪里。
  4. 战术层(L4 Tactics):具体规范、章节与避坑手册。
  5. 执行层(L5 Execution):命令、脚本、代码修改与本地验证。

以前 AGENTS.md 之所以膨胀到 26 KB 被截断,就是因为把五层全混在了一起:顶层产品原则和最底层的命令参数挤在同一个文件里。

分清层级之后,顶层只保留真正不会变的边界;各领域的战术手册拆出去按需触发;最底层的校验尽量变成 0-Token 脚本,不占模型脑子。

4. 角色、人性与分权(2021-11)

在《角色、人性与本能》里写的,本质上是:立场决定行为。

同一个模型,如果在一次任务里既当开发者(builder)又当验收者(verifier),它天然有偷懒和自圆其说的倾向——甚至写出把 Bug 当正常逻辑的“自嗨测试”。

工程上真正好使的办法,是直接用角色把可见范围和权限拆开:开发只看自己要改的代码和规范,验收只拿构建产物和门禁脚本去查,互不兼任。

5. AI 解决了人类的睡眠问题(2026-11)

前几天刚写了篇《AI解决了人类的睡眠问题》。里面卡住的关键只有一件事:人去睡觉以后,AI 遇到模糊条件、报错或者阻塞时怎么办?

如果提前把边界写成契约:

  • on_ambiguity:不确定的地方不许瞎猜,记录问题或停下。
  • on_failure:同一条路失败超过两次,停手回退,不准死循环硬改。
  • on_blocked:缺外部权限或真机条件时,停在安全点,留下状态等天亮。

再加一个像人睡觉一样的整理动作 orgn prune——清理过期的弱连接,只把真正重要的经验留下来。


三、把这些拼成一个东西:Organon

把上面这些原则合在一起,我把原本零散的 mcp-meta、skill-meta、docs-meta 彻底合并重写成了一个独立的、项目无关的开源工具:organon(短命令 orgn)。

现在它内建了原来三个工具的能力,并多出三层机制:

flowchart TD
    subgraph L3["组织与社会层 (Organization)"]
        Roles["角色分权: builder / verifier / auditor / investigator"]
        Layers["问题五层: L1 哲学 -> L2 思想 -> L3 战略 -> L4 战术 -> L5 执行"]
    end

    subgraph L2["生物体层 (Organism)"]
        Reflex["脊髓反射: 0-Token 静态门禁与 Hook"]
        Sleep["睡眠边界: 无人值守契约 + orgn prune 突触修剪"]
    end

    subgraph L1["器官层 (Organ)"]
        Tree["统一皮层索引: skill:// doc:// rule:// mcp:// memory://"]
        Syn["侧向联想: ⚡ 赫布突触 + 🛡️ 复盘免疫抗体"]
    end

    Roles --> Tree
    Layers --> Tree
    Tree --> Reflex
    Tree --> Syn
    Syn --> Sleep

工作方式很简单,还是 L0 → L1 → L2 渐进披露,但多了联想和分权:

  1. L0 声明角色:Agent 启动先跑一次 orgn role,只加载对应岗位的最小规范、该跑的 0-Token 门禁脚本、以及遇到歧义时的停机规则。
  2. L1 语义检索:用 orgn search "keyword" 找到带段落行号和 Token 估算的精确节点(自动跳过 Archive/ 和归档目录)。
  3. L2 精准激活:用 orgn activate "doc://..." 只读取目标章节(上限 200 行)。返回结果末尾会自动带出两条东西:
    • [⚡ Organon Synapses]:和当前章节强相关的工具、技能或联动规范。
    • [🛡️ Immune Antibodies]:过去在这个主题上踩过的坑与复盘记录。

以前分开维护的 mcp-meta、skill-meta、docs-meta 现在只是 organon 里的内置子模块,统一由一套命令和 MCP 接口暴露出来。


四、在真实大项目上的实测数字

拿手头一个包含 313 个上下文节点(104 个 Skill、173 篇文档、7 条核心规则、20 组 MCP 服务、9 份记忆)、总计约 561 KB 的 iOS 工程做了一次盲测。

用非交互模式的 codex exec 去查一个真实改动需要遵守哪些规则:

  • 全流程检索耗时:569 ms(走 orgn role → orgn search → orgn activate 三步)。
  • 实际吞进上下文的行数:全过程只读了 ~80 行(其中目标规范正文仅 10 行),不再碰那几百 KB 的无关文档。
  • 自动带出的防呆信息:精准认出 builder != verifier 分权约束、4 个必须执行的静态门禁脚本,以及 6 篇历史 retro-*.md 事故抗体。
  • 知识蒸馏扫描(orgn distill):在同一套 561 KB 文档树上直接扫出 58 篇已配门禁复盘和 49 篇尚未固化成脚本的潜在坑点,直接列出下一步该补哪些自动化门禁。

五、最后

以前我们习惯把 AI 当作一个“需要把所有资料全塞进脑子的超级计算器”,觉得塞得越多越聪明。

后来发现,真正的系统工程其实很像生物体:

重要的边界不用每次都靠大脑背诵,让脊髓反射(Hook 和静态脚本)在 0 Token 的地方直接拦住;高频配合的路径自然长成突触,踩过的坑凝成抗体;不同职责由不同角色各自守住。

工具会一直退到幕后,剩下的只是让机器学会怎么记住、怎么分工、以及在没人在旁边盯着的时候,怎么安全地往前走。

项目已开源在 GitHub(MIT):monkey-sking/organon

Two weeks ago I wrote about slashing 90% of agent context overhead with meta-tools.

By hiding 50+ MCP tools behind mcp-meta and 70+ long-tail skills behind skill-meta, idle prompt overhead dropped from ~14,500 tokens to ~1,200 tokens.

Saving tokens was only step one. A new problem showed up right away.

1. Lazy Loaders Saved Tokens, but Broke Peripheral Vision

Right after mcp-meta and skill-meta, I added docs-meta, rule-meta, and memory-meta. Five domains, five isolated lazy loaders.

On paper, everything stayed small. In real tasks, three cracks appeared:

  1. Knowledge silos: Reading a UI spec through docs-meta did not remind the agent that a static gate script checks that exact rule—or that a bug hit that same screen last week.
  2. Bloated rule files: Stuffing every team rule into one AGENTS.md pushed it past 26 KB, while the host silently truncated rules past its 24,000-byte limit.
  3. No separation of duties: The same agent wrote the patch, edited or ran its own test, and declared victory. Most bad handoffs came from missing role boundaries, not weak models.

A lazy loader only compresses a bookshelf. An agent working across a real codebase needs memory links, reflexes, and clear roles.

Looking back through five short notes on this blog from 2020 to this month, the missing pieces were already there.


2. Five Old Notes, One Architecture

DNA and Memory (2020-06)

In DNA, Humans, AI: Memory and Inheritance, I wrote two lines:

DNA carries biological inheritance.
Humans pass down memory as knowledge.

Every new agent session starts with an empty context window. Reading the whole repository every turn is like re-evolving from scratch every morning.

An agent needs two kinds of links:

  • Innate synapses (⚡): Structural connections between rules, docs, and gate scripts that exist before the first mistake.
  • Hebbian co-activation (⚡): Tracks which docs, tools, and skills repeatedly appear together in real work—strengthening frequent paths and decaying stale ones with a 14-day half-life.

Information Distilling Upward (2020-08)

In Information → Knowledge → Skill → Mental Model → Reasoning, capability grows upward layer by layer.

Postmortems and bug notes sitting in Docs/ are raw information. Unless a system turns recurring lessons into immune antibodies (🛡️) surfaced alongside active specs—and flags unautomated retros for promotion—mistakes repeat unchanged.

Five Levels of a Problem (2020-09)

In Levels of a Problem, every engineering problem splits into five layers:

  1. L1 Philosophy: Non-negotiable product truths and boundaries.
  2. L2 Mental Model: Core principles for reasoning about failures.
  3. L3 Strategy: Direction, trade-offs, and who owns what.
  4. L4 Tactics: Domain specs, workflows, and known pitfalls.
  5. L5 Execution: Commands, edits, scripts, and checks.

Cramming all five layers into one monolithic instruction file guaranteed truncation. Keeping L1–L2 tiny and fixed, routing L3 by role, loading L4 section-by-section, and pushing L5 into 0-token scripts solves the bloat permanently.

Roles and Incentives (2021-11)

In Roles, Human Nature, and Instinct, behavior follows role incentives.

Letting one agent both build and sign off its own work creates predictable corner-cutting. Splitting builder, verifier, auditor, and investigator—each with its own scoped rules and tool surface—prevents self-certification by structure rather than polite reminders.

AI Solves the Human Sleep Problem (2026-11)

In AI Solves Human Sleep, the real bottleneck is unattended execution: what should an agent do when the human is asleep and something is ambiguous or stuck?

That becomes an explicit runtime contract per role (on_ambiguity, on_failure, on_blocked) paired with orgn prune—an offline consolidation pass that decays weak links while keeping permanent postmortem antibodies intact.


3. Putting It Together in Organon

I merged mcp-meta, skill-meta, docs-meta, and the layers above into one standalone, project-agnostic package: organon (CLI: orgn).

flowchart TD
    subgraph L3["Organization Layer"]
        Roles["Role Separation: builder / verifier / auditor / investigator"]
        Layers["5 Problem Layers: L1 Philosophy -> L2 Model -> L3 Strategy -> L4 Tactics -> L5 Execution"]
    end

    subgraph L2["Organism Layer"]
        Reflex["Spinal Reflexes: 0-Token Hooks & Static Gates"]
        Sleep["Sleep Contract: Unattended Rules + orgn prune"]
    end

    subgraph L1["Organ Layer"]
        Tree["Unified Cortex URI: skill:// doc:// rule:// mcp:// memory://"]
        Syn["Lateral Links: ⚡ Hebbian Synapses + 🛡️ Antibodies"]
    end

    Roles --> Tree
    Layers --> Tree
    Tree --> Reflex
    Tree --> Syn
    Syn --> Sleep

Workflow stays strict L0 → L1 → L2:

  1. L0 (orgn role): Declare a role and load only its minimal invariant rules, 0-token gate commands, and stop-on-failure boundaries.
  2. L1 (orgn search): Query headings and line ranges across skills, docs, rules, MCP tools, and memory (skipping Archive/ folders automatically).
  3. L2 (orgn activate): Read one bounded section (up to 200 lines). Output automatically appends [⚡ Organon Synapses] (co-occurring tools/docs) and [🛡️ Immune Antibodies] (related postmortem warnings).

mcp-meta, skill-meta, and docs-meta now ship directly inside organon as built-in adapters backed by the same index and Hebbian graph.


4. Blind Benchmark on a Real Codebase

Tested on an active iOS workspace holding 313 context leaves (104 skills, 173 docs, 7 rule files, 20 MCP servers, 9 memory topics, ~561 KB total text) using non-interactive codex exec:

  • Total lookup time (role + search + activate): 569 ms.
  • Context read: ~80 lines total (10 lines of target spec body instead of hundreds of kilobytes).
  • Automatic safety recall: Caught the builder != verifier separation rule, all 4 reflex gate scripts, and 6 historical retro-*.md postmortem antibodies without manual prompting.
  • Distillation scan (orgn distill): Audited the same repo and identified 58 gated retros alongside 49 historical incidents still missing automated checks.

5. Closing

Giving an AI agent every file upfront never made it reliable—it just filled its working memory with noise.

A working agent setup looks much more like an organism: reflexes handle routine checks at zero token cost, memory connects what actually belongs together, past bugs turn into permanent antibodies, and roles keep builders honest.

Source code on GitHub (MIT): monkey-sking/organon