repo-harness 0.13.2 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/AGENTS.md +2 -3
  2. package/CLAUDE.md +2 -3
  3. package/README.es.md +3 -3
  4. package/README.fr.md +3 -3
  5. package/README.ja.md +3 -3
  6. package/README.md +3 -3
  7. package/README.zh-CN.md +3 -3
  8. package/assets/AGENTS.md +1 -2
  9. package/assets/CLAUDE.md +1 -2
  10. package/assets/hooks/AGENTS.md +1 -2
  11. package/assets/hooks/CLAUDE.md +1 -2
  12. package/assets/partials/05-workflow.partial.md +1 -1
  13. package/assets/reference-configs/agentic-development-flow.md +1 -1
  14. package/assets/reference-configs/document-generation.md +3 -4
  15. package/assets/reference-configs/external-tooling.md +151 -0
  16. package/assets/reference-configs/harness-overview.md +1 -0
  17. package/assets/skill-commands/repo-harness-architecture/SKILL.md +3 -4
  18. package/assets/skill-version.json +2 -2
  19. package/assets/skills/repo-harness-cross-review/references/claude-mode.md +13 -7
  20. package/assets/templates/helpers/architecture-event.ts +2 -5
  21. package/assets/templates/helpers/capability-config.ts +16 -2
  22. package/assets/templates/helpers/capability-resolver.ts +510 -30
  23. package/assets/templates/helpers/check-agent-tooling.sh +103 -0
  24. package/assets/templates/helpers/check-architecture-sync.sh +68 -6
  25. package/assets/templates/helpers/check-task-workflow.sh +53 -0
  26. package/assets/templates/helpers/context-contract-sync.sh +0 -3
  27. package/assets/templates/helpers/ensure-task-workflow.sh +73 -3
  28. package/assets/templates/helpers/select-agent-context-blocks.sh +10 -3
  29. package/assets/templates/helpers/workstream-sync.sh +2 -2
  30. package/assets/workflow-contract.v1.json +1 -0
  31. package/dist/hook-entry.js +2497 -982
  32. package/package.json +4 -2
  33. package/scripts/AGENTS.md +1 -2
  34. package/scripts/CLAUDE.md +1 -2
  35. package/scripts/architecture-event.ts +2 -5
  36. package/scripts/axr5-archctx-clean-room.ts +257 -0
  37. package/scripts/axr6-stop-host-cycle.ts +332 -0
  38. package/scripts/axr7-build-flow-repair-proposal.ts +44 -0
  39. package/scripts/axr7-build-model-proposal.ts +150 -0
  40. package/scripts/axr7-build-selector-repair-proposal.ts +50 -0
  41. package/scripts/axr7-consumer-e2e.ts +324 -0
  42. package/scripts/capability-config.ts +16 -2
  43. package/scripts/capability-resolver.ts +201 -28
  44. package/scripts/check-agent-tooling.sh +103 -0
  45. package/scripts/check-architecture-sync.sh +68 -6
  46. package/scripts/check-state-boundaries.ts +8 -0
  47. package/scripts/check-task-workflow.sh +53 -0
  48. package/scripts/context-contract-sync.sh +0 -3
  49. package/scripts/ensure-task-workflow.sh +73 -3
  50. package/scripts/lib/project-init-lib.sh +21 -2
  51. package/scripts/select-agent-context-blocks.sh +10 -3
  52. package/scripts/workstream-sync.sh +2 -2
  53. package/src/cli/chatgpt-browser/engine.ts +1 -9
  54. package/src/cli/commands/architecture-projection.ts +104 -0
  55. package/src/cli/commands/capability-context.ts +29 -6
  56. package/src/cli/commands/global-runtime.ts +4 -6
  57. package/src/cli/commands/init.ts +3 -3
  58. package/src/cli/commands/mcp.ts +11 -2
  59. package/src/cli/commands/status.ts +24 -0
  60. package/src/cli/hook/handler-registry.ts +26 -0
  61. package/src/cli/hook/mutation-observed.ts +110 -22
  62. package/src/cli/hook/session-context.ts +5 -5
  63. package/src/cli/hook/stop-handler.ts +60 -4
  64. package/src/cli/index.ts +10 -0
  65. package/src/cli/installer/managed-entries.ts +1 -1
  66. package/src/cli/mcp/auth.ts +66 -41
  67. package/src/cli/mcp/server.ts +7 -6
  68. package/src/cli/mcp/setup.ts +189 -112
  69. package/src/cli/mcp/tools.ts +5 -1
  70. package/src/cli/mcp/transports/http.ts +11 -11
  71. package/src/core/adoption/gitignore-plan.ts +1 -0
  72. package/src/core/adoption/standard-plan.ts +21 -2
  73. package/src/core/architecture/projection.ts +356 -0
  74. package/src/core/capabilities/registry.ts +313 -1
  75. package/src/core/review/cross-review.ts +15 -4
  76. package/src/effects/architecture/archctx-provider.ts +303 -0
  77. package/src/effects/architecture/projection-jobs.ts +367 -0
  78. package/src/effects/architecture/projection-orchestrator.ts +230 -0
  79. package/src/effects/architecture/refresh-consumer.ts +172 -0
  80. package/src/effects/review/cross-review-runner.ts +5 -3
  81. package/src/effects/review/diff-fingerprint.ts +1 -0
  82. package/src/effects/state/resolve-effective-state.ts +150 -8
package/AGENTS.md CHANGED
@@ -7,7 +7,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
9
  - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
- - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
10
+ - `.archcontext/model/nodes/*.yaml` for the capability nodes and longest-prefix context boundaries, selected by `.ai/harness/policy.json#context.capability_source`
11
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
12
  - `tasks/lessons.md` for correction-derived rules
13
13
  - `docs/researches/` for deep repo knowledge
@@ -25,7 +25,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
25
25
  - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
26
26
  - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
27
  - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
28
- - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
28
+ - Treat `.archcontext/model/nodes/*.yaml` as the source of truth for capability prefixes under `capability_source: "archcontext"`; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
29
  - Keep architecture drift handling split: `architecture-queue.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
30
30
  - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
31
  - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
@@ -90,7 +90,6 @@ bun src/cli/index.ts init --repo . --dry-run
90
90
  - Verification: Use root required checks plus local commands recorded in this capability contract.
91
91
  - Latest snapshot: `(none yet)`
92
92
  - Semantic diagram source: `docs/architecture/modules/verification/evals-checks.md`
93
- - Latest human diagram: `(none yet)`
94
93
  - Pending architecture request: `(none)`
95
94
 
96
95
  ## Active Workstreams
package/CLAUDE.md CHANGED
@@ -7,7 +7,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
9
  - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
- - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
10
+ - `.archcontext/model/nodes/*.yaml` for the capability nodes and longest-prefix context boundaries, selected by `.ai/harness/policy.json#context.capability_source`
11
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
12
  - `tasks/lessons.md` for correction-derived rules
13
13
  - `docs/researches/` for deep repo knowledge
@@ -25,7 +25,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
25
25
  - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
26
26
  - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
27
  - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
28
- - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
28
+ - Treat `.archcontext/model/nodes/*.yaml` as the source of truth for capability prefixes under `capability_source: "archcontext"`; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
29
  - Keep architecture drift handling split: `architecture-queue.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
30
30
  - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
31
  - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
@@ -90,7 +90,6 @@ bun src/cli/index.ts init --repo . --dry-run
90
90
  - Verification: Use root required checks plus local commands recorded in this capability contract.
91
91
  - Latest snapshot: `(none yet)`
92
92
  - Semantic diagram source: `docs/architecture/modules/verification/evals-checks.md`
93
- - Latest human diagram: `(none yet)`
94
93
  - Pending architecture request: `(none)`
95
94
 
96
95
  ## Active Workstreams
package/README.es.md CHANGED
@@ -446,7 +446,7 @@ son dependencias empaquetadas ordinarias.
446
446
  | --- | --- | --- |
447
447
  | [Hylarucoder](https://x.com/hylarucoder) / Geju | El método de due diligence P1/P2/P3 y la práctica Geju que dieron forma a la disciplina de planning, tracing y decision-rationale de este workflow | Contribución metodológica y agradecimiento; no es una dependencia empaquetada |
448
448
  | Waza de [TW93](https://x.com/HiTw93), incluyendo `think`, `hunt`, `check` y `health` | Planning diario, bug hunts, verificación, health checks y sync de skill Codex-first | Instalado a través del skills CLI en los host skill roots |
449
- | `mermaid` | Diagramas de architecture y system-flow legibles por humanos cuando Mermaid no alcanza | Skill runtime-referenced, no vendored en los repos generados |
449
+ | `mermaid` | Soporte de authoring y review para bloques Mermaid fenced dentro de la documentación de arquitectura | Skill externo runtime-referenced, no vendored en los repos generados y sin generar HTML standalone |
450
450
  | CodeGraph (`@colbymchenry/codegraph`) | Navegación symbol-aware, impact tracing y readiness checks para este repo self-host | Dev dependency en este repo; los repos generados se mantienen global-MCP-first salvo que la policy haga opt-in |
451
451
  | [Oracle](https://github.com/steipete/oracle) de [Peter Steinberger](https://x.com/steipete) (`@steipete/oracle`, MIT) | Motor de consulta de navegador GPT Pro / ChatGPT Web por defecto, al que el Oracle provider `chatgpt-browser` invoca externamente (shell out) para las consultas `gptpro` | Binario resuelto externamente (`--oracle-bin`, `REPO_HARNESS_ORACLE_BIN`, `node_modules/.bin`, o `PATH`); nunca se descarga automáticamente, y un binario ausente es un fallo duro de `ORACLE_NOT_INSTALLED` |
452
452
  | OpenAI Codex | Agente de ejecución primario para implementación repo-local, verificación y GitHub contributor attribution cuando un commit incluye materialmente trabajo escrito por Codex | Un runtime de agente externo; la atribución es un trailer de commit explícito, no automatización oculta de hooks |
@@ -466,8 +466,8 @@ repositorio adopte la misma política.
466
466
 
467
467
  ## Versión actual
468
468
 
469
- - Paquete npm: `repo-harness@0.13.2`
470
- - Sello de workflow generado: `repo-harness@0.13.2+template@0.13.2`
469
+ - Paquete npm: `repo-harness@0.14.1`
470
+ - Sello de workflow generado: `repo-harness@0.14.1+template@0.14.1`
471
471
  - Repositorio de GitHub: `Ancienttwo/repo-harness`
472
472
  - Notas de versión e historial: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
473
473
 
package/README.fr.md CHANGED
@@ -441,7 +441,7 @@ pas des dépendances embarquées ordinaires.
441
441
  | --- | --- | --- |
442
442
  | [Hylarucoder](https://x.com/hylarucoder) / Geju | Méthode de due-diligence P1/P2/P3 et pratique Geju qui ont façonné la discipline de planning, de trace et de decision-rationale dans ce workflow | Contribution méthodologique et remerciement ; pas une dépendance embarquée |
443
443
  | Waza par [TW93](https://x.com/HiTw93), incluant `think`, `hunt`, `check` et `health` | Planning quotidien, bug hunts, vérification, health checks et skill sync Codex-first | Installé via le skills CLI dans les host skill roots |
444
- | `mermaid` | Diagrammes d'architecture et de system-flow lisibles par un humain quand Mermaid seul ne suffit pas | Skill référencé au runtime, non vendored dans les dépôts générés |
444
+ | `mermaid` | Support d'authoring et de review pour les blocs Mermaid fenced dans la documentation d'architecture | Skill externe référencé au runtime, non vendored dans les dépôts générés et ne générant pas de HTML standalone |
445
445
  | CodeGraph (`@colbymchenry/codegraph`) | Navigation symbol-aware, impact tracing et readiness checks pour ce dépôt self-host | Dev dependency dans ce dépôt ; les dépôts générés restent global-MCP-first sauf opt-in de la policy |
446
446
  | [Oracle](https://github.com/steipete/oracle) par [Peter Steinberger](https://x.com/steipete) (`@steipete/oracle`, MIT) | Moteur par défaut de consult navigateur GPT Pro / ChatGPT Web, que le provider Oracle `chatgpt-browser` invoque en shell out pour les consults `gptpro` | Binaire résolu en externe (`--oracle-bin`, `REPO_HARNESS_ORACLE_BIN`, `node_modules/.bin`, ou `PATH`) ; jamais téléchargé automatiquement, et un binaire manquant est une erreur franche `ORACLE_NOT_INSTALLED` |
447
447
  | OpenAI Codex | Agent d'exécution principal pour l'implémentation repo-local, la vérification, et l'attribution de contributeur GitHub quand un commit inclut matériellement du travail écrit par Codex | Agent runtime externe ; l'attribution est un commit trailer explicite, pas une automatisation cachée par hook |
@@ -461,8 +461,8 @@ adopte la même policy.
461
461
 
462
462
  ## Release actuelle
463
463
 
464
- - Package npm : `repo-harness@0.13.2`
465
- - Generated workflow stamp : `repo-harness@0.13.2+template@0.13.2`
464
+ - Package npm : `repo-harness@0.14.1`
465
+ - Generated workflow stamp : `repo-harness@0.14.1+template@0.14.1`
466
466
  - Dépôt GitHub : `Ancienttwo/repo-harness`
467
467
  - Notes et historique de release : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
468
468
 
package/README.ja.md CHANGED
@@ -449,7 +449,7 @@ agent runtime を中心に構築されています。これらは通常の bundl
449
449
  | --- | --- | --- |
450
450
  | [Hylarucoder](https://x.com/hylarucoder) / Geju | この workflow における planning、tracing、decision-rationale の規律を形作った P1/P2/P3 due-diligence method と Geju の実践 | Methodology への貢献と謝辞であり、bundled dependency ではありません |
451
451
  | Waza by [TW93](https://x.com/HiTw93)(`think`、`hunt`、`check`、`health` を含む) | 日々の planning、bug hunt、verification、health check、Codex-first な skill sync | skills CLI を通じて host の skill root にインストールされます |
452
- | `mermaid` | Mermaid だけでは足りないときの、人間が読める architecture / system-flow diagram | Runtime で参照される skill であり、生成されたリポジトリには vendor されません |
452
+ | `mermaid` | architecture 文書内の Mermaid fenced block に対する authoring / review 支援 | Runtime で参照される外部 skill であり、生成されたリポジトリには vendor されず、standalone HTML も生成しません |
453
453
  | CodeGraph(`@colbymchenry/codegraph`) | この self-host リポジトリのための symbol-aware navigation、impact tracing、readiness check | 本リポジトリでは dev dependency。生成されたリポジトリは、policy が opt-in しない限り global-MCP-first のままです |
454
454
  | [Oracle](https://github.com/steipete/oracle) by [Peter Steinberger](https://x.com/steipete)(`@steipete/oracle`、MIT) | `chatgpt-browser` の Oracle provider が `gptpro` consult のために shell out する、既定の GPT Pro / ChatGPT Web browser consult engine | 外部で解決される binary(`--oracle-bin`、`REPO_HARNESS_ORACLE_BIN`、`node_modules/.bin`、または `PATH`)。自動ダウンロードはされず、binary が見つからない場合は hard な `ORACLE_NOT_INSTALLED` failure になります |
455
455
  | OpenAI Codex | commit が実質的に Codex 作成の作業を含むときの、repo-local な実装・verification・GitHub contributor attribution を担う primary execution agent | 外部 agent runtime。attribution は隠れた hook automation ではなく、明示的な commit trailer です |
@@ -469,8 +469,8 @@ commit script や hooks に組み込まないでください。
469
469
 
470
470
  ## 現在の Release
471
471
 
472
- - npm package:`repo-harness@0.13.2`
473
- - Generated workflow stamp:`repo-harness@0.13.2+template@0.13.2`
472
+ - npm package:`repo-harness@0.14.1`
473
+ - Generated workflow stamp:`repo-harness@0.14.1+template@0.14.1`
474
474
  - GitHub repository:`Ancienttwo/repo-harness`
475
475
  - Release notes and history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
476
476
 
package/README.md CHANGED
@@ -422,7 +422,7 @@ dependencies.
422
422
  | --- | --- | --- |
423
423
  | [Hylarucoder](https://x.com/hylarucoder) / Geju | P1/P2/P3 due-diligence method and Geju practice that shaped the planning, tracing, and decision-rationale discipline in this workflow | Methodology contribution and acknowledgement; not a bundled dependency |
424
424
  | Waza by [TW93](https://x.com/HiTw93), including `think`, `hunt`, `check`, and `health` | Daily planning, bug hunts, verification, health checks, and Codex-first skill sync | Installed through the skills CLI into host skill roots |
425
- | `mermaid` | Human-readable architecture and system-flow diagrams when Mermaid is not enough | Runtime-referenced skill, not vendored into generated repos |
425
+ | `mermaid` | Authoring and readability review for Mermaid architecture and system-flow source | Runtime-referenced review skill, not vendored into generated repos and never an HTML artifact generator |
426
426
  | CodeGraph (`@colbymchenry/codegraph`) | Symbol-aware navigation, impact tracing, and readiness checks for this self-host repo | Dev dependency in this repo; generated repos stay global-MCP-first unless policy opts in |
427
427
  | [Oracle](https://github.com/steipete/oracle) by [Peter Steinberger](https://x.com/steipete) (`@steipete/oracle`, MIT) | Default GPT Pro / ChatGPT Web browser consult engine that the `chatgpt-browser` Oracle provider shells out to for `gptpro` consults | Externally-resolved binary (`--oracle-bin`, `REPO_HARNESS_ORACLE_BIN`, `node_modules/.bin`, or `PATH`); never auto-downloaded, and a missing binary is a hard `ORACLE_NOT_INSTALLED` failure |
428
428
  | OpenAI Codex | Primary execution agent for repo-local implementation, verification, and GitHub contributor attribution when a commit materially includes Codex-authored work | External agent runtime; attribution is an explicit commit trailer, not hidden hook automation |
@@ -441,8 +441,8 @@ repo-harness commit scripts or hooks unless that repo adopts the same policy.
441
441
 
442
442
  ## Current Release
443
443
 
444
- - npm package: `repo-harness@0.13.2`
445
- - Generated workflow stamp: `repo-harness@0.13.2+template@0.13.2`
444
+ - npm package: `repo-harness@0.14.1`
445
+ - Generated workflow stamp: `repo-harness@0.14.1+template@0.14.1`
446
446
  - GitHub repository: `Ancienttwo/repo-harness`
447
447
  - Release notes and history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
448
448
 
package/README.zh-CN.md CHANGED
@@ -428,7 +428,7 @@ dependency。
428
428
  | --- | --- | --- |
429
429
  | [Hylarucoder](https://x.com/hylarucoder) / Geju | P1/P2/P3 due-diligence 方法和 Geju 实践,塑造了这套 workflow 里 planning、tracing 和 decision-rationale 的纪律 | 方法论贡献和致谢;不是 bundled dependency |
430
430
  | [TW93](https://x.com/HiTw93) 的 Waza,包括 `think`、`hunt`、`check` 和 `health` | 日常 planning、bug hunt、verification、health check,以及 Codex-first 的 skill sync | 通过 skills CLI 安装进 host skill root |
431
- | `mermaid` | 当 Mermaid 不够用时,提供人类可读的 architecture 和 system-flow 图 | Runtime-referenced 的 skill,不会 vendor 进生成的仓库 |
431
+ | `mermaid` | 为架构文档中的 Mermaid fenced blocks 提供 authoring 和 review 支持 | Runtime-referenced 的外部 skill,不会 vendor 进生成的仓库,也不会生成 standalone HTML |
432
432
  | CodeGraph(`@colbymchenry/codegraph`) | 为这个 self-host 仓库提供 symbol-aware 导航、impact tracing 和 readiness check | 本仓库的 dev dependency;生成的仓库默认保持 global-MCP-first,除非 policy 显式开启 |
433
433
  | [Peter Steinberger](https://x.com/steipete) 的 [Oracle](https://github.com/steipete/oracle)(`@steipete/oracle`,MIT) | `chatgpt-browser` 的 Oracle provider 为 `gptpro` consult 默认 shell 出去调用的 GPT Pro / ChatGPT Web 浏览器 consult 引擎 | 外部解析的 binary(`--oracle-bin`、`REPO_HARNESS_ORACLE_BIN`、`node_modules/.bin` 或 `PATH`);从不自动下载,缺失 binary 会硬失败 `ORACLE_NOT_INSTALLED` |
434
434
  | OpenAI Codex | repo-local 实现和验证的主要执行 agent;commit 实质包含 Codex 产出内容时,也承担 GitHub contributor attribution | 外部 agent runtime;attribution 是显式的 commit trailer,不是隐藏的 hook automation |
@@ -448,8 +448,8 @@ policy。
448
448
 
449
449
  ## 当前 Release
450
450
 
451
- - npm package:`repo-harness@0.13.2`
452
- - Generated workflow stamp:`repo-harness@0.13.2+template@0.13.2`
451
+ - npm package:`repo-harness@0.14.1`
452
+ - Generated workflow stamp:`repo-harness@0.14.1+template@0.14.1`
453
453
  - GitHub repository:`Ancienttwo/repo-harness`
454
454
  - Release notes 和 history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
455
455
 
package/assets/AGENTS.md CHANGED
@@ -14,7 +14,7 @@ Keep this file focused on the local contract for this primary functional block.
14
14
 
15
15
  ## Positioning
16
16
 
17
- Owns the workflow-engine-contract-assets capability boundary declared in .ai/context/capabilities.json.
17
+ Owns the workflow-engine-contract-assets capability boundary declared in .archcontext/model/nodes.
18
18
 
19
19
  ## Source Map
20
20
 
@@ -50,7 +50,6 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
50
50
  - Verification: Use root required checks plus local commands recorded in this capability contract.
51
51
  - Latest snapshot: `(none yet)`
52
52
  - Semantic diagram source: `docs/architecture/modules/workflow-engine/contract-assets.md`
53
- - Latest human diagram: `(none yet)`
54
53
  - Pending architecture request: `(none)`
55
54
 
56
55
  ## Active Workstreams
package/assets/CLAUDE.md CHANGED
@@ -14,7 +14,7 @@ Keep this file focused on the local contract for this primary functional block.
14
14
 
15
15
  ## Positioning
16
16
 
17
- Owns the workflow-engine-contract-assets capability boundary declared in .ai/context/capabilities.json.
17
+ Owns the workflow-engine-contract-assets capability boundary declared in .archcontext/model/nodes.
18
18
 
19
19
  ## Source Map
20
20
 
@@ -50,7 +50,6 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
50
50
  - Verification: Use root required checks plus local commands recorded in this capability contract.
51
51
  - Latest snapshot: `(none yet)`
52
52
  - Semantic diagram source: `docs/architecture/modules/workflow-engine/contract-assets.md`
53
- - Latest human diagram: `(none yet)`
54
53
  - Pending architecture request: `(none)`
55
54
 
56
55
  ## Active Workstreams
@@ -26,7 +26,7 @@ Keep this file focused on the local contract for this primary functional block.
26
26
 
27
27
  ## Positioning
28
28
 
29
- Owns the runtime-harness-hook-adapters capability boundary declared in .ai/context/capabilities.json.
29
+ Owns the runtime-harness-hook-adapters capability boundary declared in .archcontext/model/nodes.
30
30
 
31
31
  ## Source Map
32
32
 
@@ -62,7 +62,6 @@ Owns the runtime-harness-hook-adapters capability boundary declared in .ai/conte
62
62
  - Verification: Use root required checks plus local commands recorded in this capability contract.
63
63
  - Latest snapshot: `(none yet)`
64
64
  - Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
65
- - Latest human diagram: `(none yet)`
66
65
  - Pending architecture request: `(none)`
67
66
 
68
67
  ## Active Workstreams
@@ -26,7 +26,7 @@ Keep this file focused on the local contract for this primary functional block.
26
26
 
27
27
  ## Positioning
28
28
 
29
- Owns the runtime-harness-hook-adapters capability boundary declared in .ai/context/capabilities.json.
29
+ Owns the runtime-harness-hook-adapters capability boundary declared in .archcontext/model/nodes.
30
30
 
31
31
  ## Source Map
32
32
 
@@ -62,7 +62,6 @@ Owns the runtime-harness-hook-adapters capability boundary declared in .ai/conte
62
62
  - Verification: Use root required checks plus local commands recorded in this capability contract.
63
63
  - Latest snapshot: `(none yet)`
64
64
  - Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
65
- - Latest human diagram: `(none yet)`
66
65
  - Pending architecture request: `(none)`
67
66
 
68
67
  ## Active Workstreams
@@ -40,7 +40,7 @@ PLAN_LOOP:
40
40
  - Small or medium feature plans -> Waza `/think`.
41
41
  - Bugs, regressions, crashes, errors, or failing tests -> Waza `/hunt`.
42
42
  - Implemented diffs, pre-merge checks, or release follow-through -> Waza `/check`.
43
- - Architecture diagrams or system-flow diagrams -> Markdown Mermaid first, `mermaid` for optional human HTML.
43
+ - Architecture diagrams or system-flow diagrams -> Markdown Mermaid only; use `mermaid` for authoring and review, never standalone HTML output.
44
44
  - Use P1/P2/P3 as the shared due-diligence protocol; report it explicitly for complex engineering or architecture planning, `/hunt`, risky refactors, deployments, auth/payment/data work, and shared contracts.
45
45
  - Hooks may emit advisory Waza `/check` and `/health` route hints, but must not auto-run skills or vendor skill bodies.
46
46
 
@@ -15,7 +15,7 @@ root prompt concise; this file owns the detailed routing.
15
15
  | Small or medium feature/fix plan | Waza `/think` | Concise approved plan, then implementation on request |
16
16
  | Bug, regression, error, crash, failing test | Waza `/hunt` | Root cause sentence with evidence before any fix |
17
17
  | Implemented diff, pre-merge, release follow-through | Waza `/check` | Review findings, safe fixes, verification, and shipment state |
18
- | Architecture diagram or system-flow diagram | Markdown Mermaid first, `mermaid` for human HTML | Semantic Mermaid in architecture docs plus optional rendered HTML grounded in repo context |
18
+ | Architecture diagram or system-flow diagram | Markdown Mermaid only; `mermaid` assists authoring and review | Evidence-backed Mermaid fenced blocks in architecture Markdown; no standalone HTML |
19
19
 
20
20
  ### Parent Agent Planning Ownership
21
21
 
@@ -19,7 +19,6 @@ Create these only when the agent has concrete repo evidence or the user asks:
19
19
  - `docs/decisions.md`: accepted architecture decisions with trade-offs.
20
20
  - `docs/architecture/snapshots/*.md`: current module boundaries and data flow for architecture-sensitive changes.
21
21
  - Mermaid fenced blocks in `docs/architecture/modules/**.md` or `docs/architecture/snapshots/*.md`: semantic diagram source for agents and review diffs.
22
- - `docs/architecture/diagrams/*.html`: optional human-readable `mermaid` renderings produced when a visual is clearer than prose.
23
22
  - `docs/packages.md`: package inventory for real multi-package repos.
24
23
  - `plans/prds/*.prd.md`: upper-layer PRDs generated through `repo-harness-product`'s PRD mode from `.claude/templates/prd.template.md`; keep Sprint backlogs in `plans/sprints/`.
25
24
 
@@ -33,7 +32,7 @@ Create these only when the agent has concrete repo evidence or the user asks:
33
32
  - Let capability `CLAUDE.md` and `AGENTS.md` carry local contract projections; root docs stay concise.
34
33
  - Keep complete workstream TODOs in `tasks/workstreams/<domain>/<capability>/`; contract blocks should link to them instead of becoming task logs.
35
34
  - Keep onboarding docs split by reader: agents read active source artifacts first; humans review the Human Review Card, diff, latest trace, and rollback first.
36
- - Hooks may create `docs/architecture/requests/*.md`; agents own semantic snapshots, embedded Mermaid, and optional `mermaid` HTML output.
35
+ - Hooks may create `docs/architecture/requests/*.md`; agents own semantic snapshots and embedded Mermaid source.
37
36
  - Archive handled architecture requests with `repo-harness run archive-architecture-request`; keep `docs/architecture/requests/` pending-only and preserve handled requests under `docs/architecture/requests/archive/YYYY/`. A `Resolved` request must declare its `Architecture Module` and include that exact existing module as a durable `--artifact`.
38
- - When both Mermaid and HTML exist, keep the Mermaid in Markdown as the semantic source and make the HTML link back to that Markdown source.
39
- - Treat `mermaid` as an external installed skill dependency at `~/.codex/skills/mermaid`; do not copy or inline its assets into generated repos.
37
+ - Treat Markdown Mermaid as the only architecture diagram artifact; do not generate standalone HTML.
38
+ - Treat `mermaid` as an external authoring/review skill at `~/.codex/skills/mermaid`; do not copy or inline its assets into generated repos.
@@ -687,6 +687,157 @@ managed files by hand:
687
687
  ~/.codex/agents/harness-evaluator.toml
688
688
  ```
689
689
 
690
+ ## ArchContext Capability Source
691
+
692
+ `.ai/harness/policy.json#context.capability_source` selects the single capability
693
+ authority for a repo:
694
+
695
+ | Value | Authority | Read path |
696
+ |---|---|---|
697
+ | `registry` (default) | `.ai/context/capabilities.json` | JSON capability registry |
698
+ | `archcontext` | `.archcontext/model/nodes/*.yaml` | `archcontext.node/v2` capability nodes |
699
+
700
+ Exactly one source is read. There is no dual-read, no merge, and no fallback in
701
+ either direction: under `archcontext` a missing model directory fails instead of
702
+ falling back to the JSON registry, and under `registry` a present model
703
+ directory is never consulted. Under `archcontext` the JSON registry is not
704
+ writable, so `repo-harness run capability-config add` refuses and points at the
705
+ node files.
706
+
707
+ Capability authority does not require the `archctx` CLI: node files are read
708
+ directly with Bun's native YAML parser, so selecting `capability_source` never
709
+ spawns a daemon or external process. Bun older than 1.3 has no `Bun.YAML`; that
710
+ fails closed with upgrade guidance and only when `capability_source` is
711
+ `archcontext`.
712
+
713
+ Architecture projection is a separate authority. When
714
+ `architecture.projection_provider=archctx`, repo-harness resolves the exact
715
+ version from the consumer dependency tree, executes only that package's declared
716
+ `bin.archctx`, performs a JSON capability handshake, and rejects PATH-only,
717
+ escaping, or mismatched installations. The advisory
718
+ global-tool detector below does not satisfy projection readiness; use
719
+ `repo-harness architecture-projection status --json`. The provider remains
720
+ disabled by default until the release pin is cut over.
721
+
722
+ When enabled, PostEdit writes only `change_observed` v2 journal records. Stop
723
+ coalesces all eligible records into one durable projection job, excludes
724
+ ArchContext-owned `docs/architecture/**` and declared agent-context targets,
725
+ and acknowledges the source records only after a typed projection receipt is
726
+ durable. Process, timeout, stale-snapshot, invalid-result, and refresh failures
727
+ remain pending for three attempts before an explicit dead-letter transition.
728
+ Preflight failures are jobs too. Each pending journal slot has a stable source
729
+ key while its delivery event id rotates on every coalesced edit; a dead letter
730
+ blocks aggregate jobs containing that source key, so later edits cannot reset
731
+ its attempt budget. Store transitions and queue/dead-letter read models share
732
+ one repository lock. One repository has at most one claimed provider process.
733
+ If the Stop owner disappears, its running claim remains quarantined for 150
734
+ seconds—longer than the 120-second provider bound—before recovery can start a
735
+ new attempt; an abandoned third attempt then transitions directly to dead-letter.
736
+ Before a retry is claimed, the job refreshes delivery ids for its existing
737
+ stable source keys, so edits incorporated before the new snapshot can be
738
+ acknowledged while edits arriving during projection remain pending.
739
+ `ArchitectureRefreshSignalV1` is the only major-change refresh authority; the
740
+ consumer does not infer impact from path names, diff size, or queue-helper
741
+ stdout. A typed refresh-required signal runs the canonical architecture,
742
+ context-contract, and capability-context writers even when the legacy queue
743
+ helper creates no drift card. SessionStart and
744
+ `repo-harness architecture-projection drain --json` expose queue state.
745
+ Each successful canonical refresh action is checkpointed by action key before
746
+ the next action runs, so a partial failure resumes without replaying completed
747
+ writers. Missing or stale CLI authority remains a typed refresh failure; it is
748
+ not silently skipped.
749
+
750
+ Projection delivery failures use the independent
751
+ `architecture.projection_failure_gate` (`advisory` by default); the existing
752
+ `architecture.freshness_gate` retains its merge/drift meaning. A strict
753
+ projection failure can be recovered without deleting runtime evidence via
754
+ `repo-harness architecture-projection retry-dead-letter --job-id <job> --json`.
755
+ An unreadable policy with no active projection queue remains an advisory
756
+ configuration error; it cannot silently promote the default gate to strict.
757
+ The runtime snapshot excludes `.ai/harness/**`, so concurrent harness receipts
758
+ and traces cannot invalidate a provider snapshot.
759
+
760
+ Managed host adapters give only `Stop.default` 150 seconds so the configured
761
+ 120-second provider bound has control-plane margin. Every other managed route
762
+ remains at 30 seconds, and installer refresh replaces only repo-harness-owned
763
+ entries while preserving sibling user hooks.
764
+
765
+ Before rolling back to a runtime that only understands journal v1, disable the
766
+ projection provider with the current runtime, run
767
+ `repo-harness architecture-projection drain --json`, and verify the pending
768
+ journal count reported as `sourceJournalPending` is zero. The manual drain owns
769
+ the same selective source acknowledgement as Stop. Downgrading with v2
770
+ observations still pending is not a supported rollback state.
771
+
772
+ ### `source.include` grammar
773
+
774
+ Upstream matches an include glob against the whole repo-relative path, so a
775
+ wildcard-free literal addresses one file, not a directory subtree. To keep the
776
+ two authorities from disagreeing about what a boundary covers, only two shapes
777
+ are accepted:
778
+
779
+ | Include | Capability prefix |
780
+ |---|---|
781
+ | `src/core/adoption/**` | `src/core/adoption` |
782
+ | `AGENTS.md` (wildcard-free, not an existing directory) | `AGENTS.md` |
783
+
784
+ Everything else fails closed. A wildcard-free literal that names an existing
785
+ directory is rejected as ambiguous with guidance to write `<dir>/**`.
786
+ `source.exclude` is not supported, because capability prefixes have no exclusion
787
+ form. Include order is preserved as prefix order.
788
+
789
+ ### Required node fields
790
+
791
+ | Capability field | Node source | Rule |
792
+ |---|---|---|
793
+ | `domain` / `name` | `id` segments 2 and 3 | `id` must be exactly `capability.<domain>.<name>`, with no `namespace::` prefix |
794
+ | display `name` | `name` | required non-empty node/v2 field; validated but not translated into registry identity |
795
+ | `summary` | `summary` | required non-empty node/v2 field; validated but not translated into registry semantics |
796
+ | `responsibilities` | `responsibilities` | required non-empty string array; validated but not translated into registry semantics |
797
+ | `id` | derived | `<domain>-<name>` |
798
+ | `architecture_module` | derived | `docs/architecture/modules/<domain>/<name>.md` |
799
+ | `workstream_dir` | derived | `tasks/workstreams/<domain>/<name>` |
800
+ | `prefixes` | `source.include` | include grammar above |
801
+ | `contract_files` | `extensions.contractFiles.agents` / `.claude` | declared, never derived: root-facing capabilities deliberately do not follow their prefix |
802
+ | `lsp_profile` | `extensions.lspProfile` | required |
803
+ | `verification_hints` | `extensions.verification` | required array; explicit `[]` is allowed |
804
+
805
+ Nodes whose `kind` is not `capability`, or whose `status` is not `active`, are
806
+ skipped and claim no prefixes. Required node/v2 descriptive fields are validated
807
+ even when they are not translated. Optional fields this bridge does not consume —
808
+ `source.entrypoints`, `ownership`, `interfaces`,
809
+ `criticality`, `riskDomains`, `notes`, `parent` — are ignored rather than
810
+ translated into local semantics.
811
+
812
+ ### Fail-closed conditions
813
+
814
+ Source-selection failures exit `2`:
815
+
816
+ | Condition | Behavior |
817
+ |---|---|
818
+ | unknown `capability_source` value | error naming the policy key and legal values |
819
+ | unreadable `.ai/harness/policy.json` | error naming the policy file |
820
+ | missing `.archcontext/model/nodes` under `archcontext` | error; never falls back to the JSON registry |
821
+ | subdirectory or non-`.yaml`/`.yml` entry in the model directory | error naming the entry |
822
+ | unparseable node YAML | error naming the node file |
823
+ | `Bun.YAML` unavailable | error with the Bun upgrade path |
824
+
825
+ Node-shape failures surface as `ARCHCONTEXT_*` registry diagnostics and make
826
+ `capability-resolver validate` exit `1` with no stdout; missing/empty node/v2
827
+ `name`, `summary`, or `responsibilities` is a structural error and never yields a
828
+ partial registry. Derived registries then go through the same
829
+ validation as the JSON registry, so duplicate ids, duplicate prefixes, and
830
+ invalid paths keep their existing diagnostic codes.
831
+
832
+ ### Node/v2 export round-trip
833
+
834
+ `repo-harness run capability-resolver export --format archcontext-nodes-v2`
835
+ emits complete `archcontext.node/v2` capability nodes. Existing directory
836
+ prefixes become explicit `<dir>/**` selectors, while file prefixes remain exact.
837
+ The exported `extensions.contractFiles`, `lspProfile`, and `verification` fields
838
+ round-trip through the canonical node/v2 reader without deriving missing
839
+ semantics. The retired `archcontext-boundaries-v1` format is rejected.
840
+
690
841
  ## Manual Brain Vault Export
691
842
 
692
843
  Long-lived external knowledge may be exported to a brain file vault only through
@@ -201,6 +201,7 @@ rather than inferring those values from turns, tool names, or timestamps.
201
201
  - Use `repo-harness capability-context status|request|sync` to keep paired local context files aligned with the registry. The command writes only the controlled `CAPABILITY CONTEXT` block and preserves hand-authored content plus the separate architecture contract block.
202
202
  - `.ai/context/capability-source-map.json` is the optional human-edited source-map manifest for capability positioning and source pointers. Missing entries fall back to registry/architecture/workstream metadata; `--auto-fill-positioning` writes deterministic draft entries explicitly, not from hooks.
203
203
  - `.ai/harness/capability-context/` is ignored runtime queue state. Post-edit hooks may enqueue requests, and `SessionStart` only reminds the current agent to run `repo-harness capability-context sync --pending --apply`.
204
+ - `.ai/harness/architecture-projection/` is ignored durable projection runtime state. It owns one running provider job per repository, pending jobs, typed receipts, refresh receipts, and dead letters; source observations are acknowledged only after a terminal receipt. SessionStart exposes the exact oldest dead-letter id for the explicit `architecture-projection retry-dead-letter` recovery command.
204
205
  - `SessionStart` also summarizes pending architecture request cards so a resumed agent can see drift debt before claiming finish.
205
206
 
206
207
  ## Initializer and Runtime Model
@@ -19,8 +19,7 @@ architecture documentation, drift-request, or diagram pass.
19
19
  - umbrella status in `docs/architecture/index.md`
20
20
  - module or snapshot docs under `docs/architecture/`
21
21
  - Mermaid fenced block in the relevant module or snapshot Markdown when a visual flow materially helps
22
- - optional human-readable diagram artifact under `docs/architecture/diagrams/`
23
- 5. Use Markdown Mermaid as the semantic diagram source; use `mermaid` only for optional human-readable HTML renderings grounded in observed repo files.
22
+ 5. Use Markdown Mermaid as the only architecture diagram artifact. Do not generate standalone HTML; use the external `mermaid` skill only to review layout and renderability before shipping the Markdown source.
24
23
  6. Archive handled requests with:
25
24
  - `repo-harness run archive-architecture-request --request <request> --status <resolved|superseded|rejected|no-change> --artifact <path> --note <text>`
26
25
  - For `resolved`, the live `Pending` request must declare `> **Architecture Module**:` and that exact existing module path must be supplied as an `--artifact`.
@@ -34,12 +33,12 @@ architecture documentation, drift-request, or diagram pass.
34
33
  - If no pending architecture request exists, report `no-change` and do not invent one.
35
34
  - If capability resolution is ambiguous, stop at the matching paths and ask for a narrower scope.
36
35
  - If `check-architecture-sync.sh` blocks in strict mode, resolve or archive the pending request card for the touched capability before finishing the worktree.
37
- - If diagram rendering fails, keep the Mermaid Markdown source and report the render failure.
36
+ - If diagram validation fails, fix the Mermaid Markdown source or report the validation failure; do not substitute HTML.
38
37
 
39
38
  ## Boundaries
40
39
 
41
40
  - Does not run `repo-harness init`.
42
41
  - Does not install or refresh the full harness.
43
42
  - Does not let hooks rewrite architecture prose; hooks only record drift requests.
44
- - Does not vendor `mermaid`; it remains an external installed skill for optional human-readable HTML.
43
+ - Does not vendor `mermaid`; it remains an external authoring/review skill and never owns a product artifact.
45
44
  - Keeps `docs/architecture/requests/` pending-only by archiving handled requests.
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.13.2",
3
- "templateVersion": "0.13.2",
2
+ "version": "0.14.1",
3
+ "templateVersion": "0.14.1",
4
4
  "skillName": "repo-harness",
5
5
  "contractId": "tasks-first-harness-v1",
6
6
  "compatibility": {
@@ -1,18 +1,24 @@
1
1
  # Claude provider mode
2
2
 
3
3
  Runs the Claude Code CLI (`claude -p`) as a read-only reviewer. Claude is
4
- given only `Read,Grep,Glob` (no `Bash`/`Edit`/`Write`), so it cannot edit
5
- your code; the review scope's diff text is embedded directly in the prompt
6
- since Claude has no Bash access to inspect the repo itself.
4
+ started with `--safe-mode` so host hooks, plugins, MCP servers, and repository
5
+ instructions cannot mutate or block the review process while the normal OAuth
6
+ credential remains available. It is given only `Read,Grep,Glob` (no `Bash`/`Edit`/`Write`),
7
+ so it cannot edit your code; the review scope's diff text is embedded directly
8
+ in the prompt since Claude has no Bash access to inspect the repo itself.
7
9
 
8
10
  ## Model and timeout
9
11
 
10
12
  - Pinned to the `fable` alias so the external opinion does not silently
11
13
  follow the host's default model.
12
- - If the fable route fails (nonzero exit, no output, and it was not a
13
- timeout), retries exactly once on `opus` -- one fallback step, never a
14
- loop, and never a fallback to a different provider.
15
- - Default budget: 330 seconds.
14
+ - If the fable route emits its explicit capacity-limit signal, retries exactly once on `opus`
15
+ -- one fallback step, never a loop, and never a fallback to a
16
+ different provider. Other nonzero exits remain failures even if they wrote
17
+ stdout.
18
+ - Per-attempt default budget: 330 seconds; the bounded two-attempt capacity
19
+ route therefore has a 660-second worst-case budget.
20
+ - Claude Code must support `--safe-mode`; an older CLI fails closed instead of
21
+ loading host hooks or silently dropping isolation.
16
22
 
17
23
  ## Transcript recovery
18
24
 
@@ -377,9 +377,8 @@ function renderRequiredFollowUp(event: ArchitectureEvent): string {
377
377
  "- If functional block is not `root`, read its local `AGENTS.md` / `CLAUDE.md`.",
378
378
  "- Decide whether this change affects module boundaries, entrypoints, dependency rules, runtime paths, or verification commands.",
379
379
  "- For substantial changes, write a snapshot under `docs/architecture/snapshots/`.",
380
- "- When a visual explains the boundary better than prose, add or update a Mermaid fenced block in the relevant architecture module or snapshot Markdown first; that Markdown is the semantic source for LLM readers.",
381
- "- When a human-readable rendering is useful, generate a matching `$mermaid` architecture HTML file under `docs/architecture/diagrams/` and link it back to the Markdown semantic source.",
382
- "- Treat `mermaid` as an external installed skill dependency at `~/.codex/skills/mermaid`; do not copy, vendor, or inline its templates into this repo.",
380
+ "- When a visual materially improves the explanation, add an evidence-backed Mermaid fenced block to the architecture module or snapshot Markdown.",
381
+ "- Mermaid Markdown is the only architecture diagram artifact. Do not generate standalone HTML; use the external `mermaid` skill only for authoring and review.",
383
382
  `- If this starts or advances durable execution, run \`repo-harness run workstream-sync ensure --block "${functionalBlock}" --request "${requestFile}"\`.`,
384
383
  "- After the snapshot or diagram is produced, run `repo-harness run context-contract-sync sync-latest` so the local architecture contract block links to the latest artifacts.",
385
384
  ].join("\n");
@@ -693,7 +692,6 @@ function renderContractBlock(args: Args): string {
693
692
  const workstreamDir = requireOption(args, "workstreamDir");
694
693
  const blockSlug = safeToken(functionalBlock);
695
694
  const latestSnapshot = findLatestMatchingFile("docs/architecture/snapshots", blockSlug, ".md");
696
- const latestHumanDiagram = findLatestMatchingFile("docs/architecture/diagrams", blockSlug, ".html");
697
695
  const semanticDiagramSource = latestSnapshot === "(none yet)" ? architectureModule : latestSnapshot;
698
696
  const eventTs = args.options.eventTs || "unknown";
699
697
  const filePath = args.options.filePath || "unknown";
@@ -725,7 +723,6 @@ function renderContractBlock(args: Args): string {
725
723
  "- Verification: Use root required checks plus local commands recorded in this capability contract.",
726
724
  `- Latest snapshot: \`${latestSnapshot}\``,
727
725
  `- Semantic diagram source: \`${semanticDiagramSource}\``,
728
- `- Latest human diagram: \`${latestHumanDiagram}\``,
729
726
  `- Pending architecture request: \`${requestFile}\``,
730
727
  "",
731
728
  "## Active Workstreams",
@@ -3,7 +3,13 @@ import { existsSync, mkdirSync, writeFileSync } from "fs";
3
3
  import { basename, dirname, resolve } from "path";
4
4
  import { spawnSync } from "child_process";
5
5
  import { fileURLToPath } from "url";
6
- import { readRegistry as readCapabilityRegistry, type Capability, type CapabilityRegistry } from "./capability-resolver";
6
+ import {
7
+ CapabilitySourceError,
8
+ capabilitySourceMode,
9
+ readRegistry as readCapabilityRegistry,
10
+ type Capability,
11
+ type CapabilityRegistry,
12
+ } from "./capability-resolver";
7
13
 
8
14
  type Registry = CapabilityRegistry;
9
15
 
@@ -339,6 +345,14 @@ function createWorkstream(repo: string, capability: Capability): void {
339
345
  function main(): void {
340
346
  const args = parseArgs(process.argv.slice(2));
341
347
  const repo = repoRoot(args.repo);
348
+ // The JSON registry is a projection target, not an authority, once archcontext
349
+ // owns capabilities; writing here would create a second authority.
350
+ if (capabilitySourceMode(repo) === "archcontext") {
351
+ throw new CapabilitySourceError(
352
+ `capability source is "archcontext"; ${REGISTRY_PATH} is not writable. ` +
353
+ "Declare the capability as an archcontext node under .archcontext/model/nodes instead"
354
+ );
355
+ }
342
356
  const requestedCapability = buildCapability(args, repo);
343
357
  const prefixPath = resolve(repo, requestedCapability.prefixes[0]);
344
358
  const registry = readRegistry(repo);
@@ -381,5 +395,5 @@ try {
381
395
  main();
382
396
  } catch (error) {
383
397
  console.error(`capability-config: ${(error as Error).message}`);
384
- process.exit(1);
398
+ process.exit((error as { exitCode?: number }).exitCode ?? 1);
385
399
  }