• 代码修复:
    - SessionPool 的 scope 参数从未真正从 graph-engine 传到 AgentManager,导致 fan-out
      场景下同一 agent 的并发调用会撞会话键;补上生产接线(graph-engine.js/agent-manager.js)
    - advanceTree 改成 Promise.allSettled 并发推进兄弟子 run(原来只推最深的一个)
    - graph-real-chain-smoke.test.js 补齐多节点/回退边/双层熔断的真实链路覆盖
    
    真实验证:
    - 27-P3B 最后一条验收(org 层回退边指向 subgraph 节点)用隔离 worktree 真实 Claude CLI
      跑通并记录证据(§六quater)
    - 27-P3B 正文里 W5/W6/W7/W9 的"仍未验"备注核实后发现均已被此前的真跑验过,只是没回填;
      W8(重新规划组织按钮)此前确实没验过,本轮用隔离 worktree + 真实浏览器点击补验
    
    文档收口:
    - 27-P3B、27-P4 两份文档功能与验收均已完整,移入 docs/done/,更新全部交叉引用
    - T5(账户欠费门真实计费接口)按用户决定移入 docs/todo/future/,不阻塞收口
    - 订正两处过期判断:graph_edge_contracts.role 列早已落库、CONVENTIONS.md 非 spec:extract 生成物
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01JnCKUFSGvdz4SY7BvYWdMU
    yibo authored
     
    Browse Dir »

  • system/templates/ 已随 28 号改造整体并入 system/agents/,目录在磁盘和 git 里都已不存在。
    但引用还散在各处,其中几处是 agent 运行时真会照着读写的:
    
    本体提示词(读不到就静默降级,不报错)
      workgraph-planning/agent.md   system/templates/base/ ×3、模板库路径 ×1
      orggraph-planning/agent.md    同上 ×1
      orggraph-planning/tools.md    ×1
      org-innovator/agent.md        四条产出落点 system/templates/weibo-scraper/train/*
    
    skill 代码里的硬编码目标
      evolver-youtube-crawler 的 refactor.js / mock_setup.js / evolve.js 共 4 处
      innovator-hunt/collect_seed.js —— 这处是真 bug 且已发作过:
        写的是裸相对路径 'system/templates/…',相对 cwd 解析,于是在 agent 自己目录下
        造出一棵野生嵌套树 system/agents/innovator-hunt/system/templates/…
        现在改成由 __dirname 推导,不再依赖 cwd(cwd 已经是深度 3 的任务态目录)
    
    图模板契约(work-graph-templates / org-graph-templates 的 README)
      CI 防线的三条规则写的还是「在 system/templates/ 下必须有目录」「在
      system/templates/_registry.json 里必须有条目」,与实际执行的检查已经对不上
    
    DevLoop PRD(13 份 HTML + 重新生成的 52 份 _spec + build-manifest + search-index)
      写的是 system/templates/devloop-pm.md(扁平 .md)。根和形状都错:
      loop-controller.js:166 实际读的是 system/agents/{agentName}/prompt.md。
      按真实形状改,然后跑 spec:extract / extract-manifest / build-search-index 重新生成。
    
    顺带订正两处早于本次改造就已过期的内容:
    - 「避开 6 个命名冲突 id」这条约束列的 digester / evolver / hunter / innovator
      四个 id 根本不存在(早已改名),而它的理由(两个目录下各有一份、内容不同步)
      也已随合并消失。约束保留(元 agent 本来就不该进执行流),理由与清单按实际本体重写。
    - orggraph-planning/agent.md 里「真相源是 company.json.agents[]」——
      28 号起真相源是 company_agents 表,company.json.agents[] 仅作兼容保留。
    
    刻意不动的三类(改了是净损失):
      历史说明   server/ 下解释「原来指向 X、批次 1 并进了 Y」的注释、docs/done/、tasks/
      完成证明   server/tests/ 里断言该目录已不存在的守卫
      运行态记录 未跟踪的 workspace/ conversations/ 与 train/ 下的历次训练报告
    
    新增 server/tests/unit/no-stale-templates-path.test.js 守住活定义这一档:
    扫 system/ 与 fixtures/ 下被 git 跟踪的文件(跟踪=人工维护的定义,
    未跟踪=运行态产物),零例外。带「样本非空」前置断言防 git 失灵时退化成永远通过。
    改坏一处实测能精确点名到文件行号。
    
    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »

  • The 50-page PRD HTML totals ~520KB; loading it all costs Claude ~222K
    tokens just for context. This adds a token-efficient sibling layer:
    
    - scripts/extract-spec.js → npm run spec:extract / spec:check
      Walks docs/prd/newfunction/*.html and produces stripped MD into _spec/.
      Strategy varies per page (full-extract for SDD/process/data,
      shell-strip for agents to keep long system prompts intact).
      Result: 327.9KB MD (~84K tokens) — 38% of full load, saves ~138K tokens
      for every Agent invocation that reads the spec.
    
    - scripts/git-hooks/pre-commit + scripts/install-hooks.sh
      Pre-commit guard: when any docs/prd/newfunction/*.html changes, the
      hook checks the corresponding _spec/*.md is up to date; fails commit
      if stale, telling user to `npm run spec:extract`. Auto-installed via
      package.json `prepare` script on `npm install`.
    
    - docs/prd/newfunction/_spec/ (51 .md files + CONVENTIONS.md)
      Machine-readable mirror of HTML. Used by:
      - Coder/Architect/Tester agents when reading spec at runtime
      - External Claude Code sessions doing reproducibility
      - CI checks (npm run spec:check)
      NOT hand-edited; regenerated from HTML by extract-spec.js.
    
    - CLAUDE.md: 1-line note directing future agents to read _spec/*.md
      preferentially, fall back to *.html only for wireframes/SVG/full
      human-readable context.
    
    This is the user's pre-existing scaffolding that the previous commits
    hadn't pulled in yet. Now tracked + enforced by hook.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »