phasegate 0.229.0 → 0.264.0

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 (154) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/README.ja.md +31 -1
  3. package/README.md +30 -0
  4. package/docs/ADR/031-world-model-ownership-and-corpus-lifecycle.md +155 -0
  5. package/docs/ADR/032-world-node-identity.md +198 -0
  6. package/docs/ADR/033-world-snapshot-canonicalization.md +246 -0
  7. package/docs/ADR/034-world-constraint-semantics.md +218 -0
  8. package/docs/ADR/035-world-adoption-baseline-and-waiver.md +341 -0
  9. package/docs/ADR/036-world-model-and-doc-freshness.md +169 -0
  10. package/docs/ADR/037-world-cli-and-output-contract.md +398 -0
  11. package/docs/contracts/attestation-v2.schema.json +110 -0
  12. package/docs/contracts/requirement-test-matrix.schema.json +15 -0
  13. package/docs/contracts/world-baseline.schema.json +35 -0
  14. package/docs/contracts/world-constraints.schema.json +56 -0
  15. package/docs/contracts/world-debts.schema.json +32 -0
  16. package/docs/contracts/world-obligation-report.schema.json +259 -0
  17. package/docs/contracts/world-waivers.schema.json +32 -0
  18. package/docs/guide/cli-reference.md +45 -0
  19. package/docs/guide/configuration.md +56 -0
  20. package/docs/templates/ci/aidlc-gate.yml +42 -2
  21. package/package.json +1 -1
  22. package/scripts/harness/agent-integration/application/dto/open-world-obligations-context-dto.ts +30 -0
  23. package/scripts/harness/agent-integration/application/ports/world-obligations-query-port.ts +30 -0
  24. package/scripts/harness/agent-integration/application/usecases/get-open-world-obligations-context-usecase.ts +66 -0
  25. package/scripts/harness/agent-integration/infrastructure/adapters/world-model-open-obligations-query-adapter.ts +58 -0
  26. package/scripts/harness/agent-integration/presentation/session-start-hook.ts +37 -1
  27. package/scripts/harness/agent-integration/presentation/world-obligations-session-context.ts +60 -0
  28. package/scripts/harness/attestation/application/dto/attestation-document.ts +17 -4
  29. package/scripts/harness/attestation/application/mappers/attestation-record-mapper.ts +55 -4
  30. package/scripts/harness/attestation/application/ports/sha256-capability.ts +25 -0
  31. package/scripts/harness/attestation/application/ports/world-snapshot-root-provider.ts +10 -0
  32. package/scripts/harness/attestation/application/usecases/produce-attestation-usecase.ts +33 -7
  33. package/scripts/harness/attestation/composition-root.ts +19 -4
  34. package/scripts/harness/attestation/domain/entities/attestation-record.ts +37 -2
  35. package/scripts/harness/attestation/index.ts +13 -2
  36. package/scripts/harness/attestation/infrastructure/adapters/node-crypto-content-hasher-adapter.ts +6 -6
  37. package/scripts/harness/attestation/infrastructure/adapters/node-crypto-sha256-capability.ts +19 -0
  38. package/scripts/harness/attestation/presentation/handlers/attest-handler.ts +5 -2
  39. package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts +35 -8
  40. package/scripts/harness/config-foundation/application/mappers/world-model-config-mapper.ts +15 -0
  41. package/scripts/harness/config-foundation/domain/harness-config.ts +67 -87
  42. package/scripts/harness/config-foundation/domain/services/preset-resolution-service.ts +77 -88
  43. package/scripts/harness/config-foundation/domain/value-objects/world-config.ts +198 -0
  44. package/scripts/harness/config-foundation/index.ts +14 -15
  45. package/scripts/harness/config-foundation/infrastructure/presets/minimal.json +24 -0
  46. package/scripts/harness/config-foundation/infrastructure/presets/standard.json +24 -0
  47. package/scripts/harness/config-foundation/infrastructure/presets/strict.json +24 -0
  48. package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +83 -0
  49. package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json +83 -0
  50. package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +18 -4
  51. package/scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts +4 -1
  52. package/scripts/harness/integrations/pre-commit.ts +169 -27
  53. package/scripts/harness/main.ts +276 -126
  54. package/scripts/harness/nyquist-validation/application/dto/generate-matrix-output.ts +11 -0
  55. package/scripts/harness/nyquist-validation/application/usecases/check-ac-coverage-gate-usecase.ts +6 -0
  56. package/scripts/harness/nyquist-validation/application/usecases/generate-requirement-test-matrix-usecase.ts +8 -4
  57. package/scripts/harness/nyquist-validation/domain/entities/story-mapping.ts +29 -2
  58. package/scripts/harness/nyquist-validation/domain/services/ac-coverage-gate-policy.ts +28 -0
  59. package/scripts/harness/nyquist-validation/infrastructure/adapters/markdown-requirement-source-adapter.ts +71 -4
  60. package/scripts/harness/nyquist-validation/infrastructure/schema/matrix-schema-loader.ts +4 -0
  61. package/scripts/harness/traceability-model/application/dto/changed-design-fragment-dto.ts +31 -0
  62. package/scripts/harness/traceability-model/application/dto/traceability-world-read-dto.ts +67 -0
  63. package/scripts/harness/traceability-model/application/facades/design-change-read-facade.ts +14 -0
  64. package/scripts/harness/traceability-model/application/facades/traceability-world-read-facade.ts +372 -0
  65. package/scripts/harness/traceability-model/application/ports/staged-design-change-source-port.ts +9 -0
  66. package/scripts/harness/traceability-model/application/ports/traceability-world-read-source-port.ts +61 -0
  67. package/scripts/harness/traceability-model/composition-root.ts +26 -5
  68. package/scripts/harness/traceability-model/index.ts +26 -6
  69. package/scripts/harness/traceability-model/infrastructure/adapters/file-system-traceability-world-read-adapter.ts +223 -0
  70. package/scripts/harness/traceability-model/infrastructure/adapters/git-staged-design-change-adapter.ts +155 -0
  71. package/scripts/harness/traceability-model/infrastructure/parsers/story-catalog-parser.ts +86 -8
  72. package/scripts/harness/validator-system/application/use-cases/run-l2-validators-usecase.ts +31 -0
  73. package/scripts/harness/validator-system/application/use-cases/run-l3-validators-usecase.ts +34 -0
  74. package/scripts/harness/validator-system/composition-root.ts +21 -6
  75. package/scripts/harness/validator-system/domain/ports/world-constraint-admission-policy-port.ts +28 -0
  76. package/scripts/harness/validator-system/domain/ports/world-constraint-rederivation-policy-port.ts +11 -0
  77. package/scripts/harness/validator-system/domain/services/design-change-declaration-policy.ts +75 -0
  78. package/scripts/harness/validator-system/domain/services/world-constraint-admission-service.ts +78 -0
  79. package/scripts/harness/validator-system/domain/services/world-constraint-rederivation-service.ts +76 -0
  80. package/scripts/harness/validator-system/domain/value-objects/validator-id.ts +4 -0
  81. package/scripts/harness/validator-system/infrastructure/adapters/harness-config-validator-config-adapter.ts +38 -16
  82. package/scripts/harness/validator-system/infrastructure/adapters/world-model-constraint-admission-adapter.ts +56 -0
  83. package/scripts/harness/validator-system/infrastructure/adapters/world-model-constraint-rederivation-adapter.ts +56 -0
  84. package/scripts/harness/world-model/application/dto/pinned-design-endpoint-dto.ts +19 -0
  85. package/scripts/harness/world-model/application/dto/world-inspection-dto.ts +43 -0
  86. package/scripts/harness/world-model/application/dto/world-obligation-report-dto.ts +54 -0
  87. package/scripts/harness/world-model/application/dto/world-resolved-config-input.ts +127 -0
  88. package/scripts/harness/world-model/application/dto/world-snapshot-root-dto.ts +8 -0
  89. package/scripts/harness/world-model/application/facades/pinned-design-endpoint-facade.ts +63 -0
  90. package/scripts/harness/world-model/application/facades/world-snapshot-root-facade.ts +19 -0
  91. package/scripts/harness/world-model/application/ports/obligation-report-writer-port.ts +7 -0
  92. package/scripts/harness/world-model/application/ports/world-control-declaration-repository-port.ts +57 -0
  93. package/scripts/harness/world-model/application/ports/world-fact-source-port.ts +17 -0
  94. package/scripts/harness/world-model/application/usecases/build-snapshot-use-case.ts +111 -0
  95. package/scripts/harness/world-model/application/usecases/derive-obligations-use-case.ts +155 -0
  96. package/scripts/harness/world-model/application/usecases/derive-world-obligations-use-case.ts +146 -0
  97. package/scripts/harness/world-model/application/usecases/inspect-world-use-case.ts +74 -0
  98. package/scripts/harness/world-model/application/usecases/pin-constraint-endpoint-use-case.ts +139 -0
  99. package/scripts/harness/world-model/composition-root.ts +247 -0
  100. package/scripts/harness/world-model/domain/entities/constraint-record.ts +148 -0
  101. package/scripts/harness/world-model/domain/entities/control-declarations.ts +274 -0
  102. package/scripts/harness/world-model/domain/entities/edge.ts +41 -0
  103. package/scripts/harness/world-model/domain/entities/extraction-diagnostic.ts +60 -0
  104. package/scripts/harness/world-model/domain/entities/snapshot.ts +75 -0
  105. package/scripts/harness/world-model/domain/entities/world-node.ts +210 -0
  106. package/scripts/harness/world-model/domain/ports/world-hashing-port.ts +8 -0
  107. package/scripts/harness/world-model/domain/services/canonical-json-serializer.ts +113 -0
  108. package/scripts/harness/world-model/domain/services/constraint-evaluator.ts +486 -0
  109. package/scripts/harness/world-model/domain/services/obligation-derivation-service.ts +199 -0
  110. package/scripts/harness/world-model/domain/services/policy-inputs-digest-deriver.ts +66 -0
  111. package/scripts/harness/world-model/domain/services/snapshot-root-deriver.ts +218 -0
  112. package/scripts/harness/world-model/domain/services/text-content-normalizer.ts +30 -0
  113. package/scripts/harness/world-model/domain/services/violation-fingerprint-deriver.ts +183 -0
  114. package/scripts/harness/world-model/domain/value-objects/artifact-kind.ts +58 -0
  115. package/scripts/harness/world-model/domain/value-objects/change-provenance.ts +137 -0
  116. package/scripts/harness/world-model/domain/value-objects/corpus-role.ts +57 -0
  117. package/scripts/harness/world-model/domain/value-objects/declared-key.ts +35 -0
  118. package/scripts/harness/world-model/domain/value-objects/evaluation-id.ts +41 -0
  119. package/scripts/harness/world-model/domain/value-objects/explicit-constraint-relation.ts +53 -0
  120. package/scripts/harness/world-model/domain/value-objects/explicit-node-alias.ts +30 -0
  121. package/scripts/harness/world-model/domain/value-objects/node-pin.ts +34 -0
  122. package/scripts/harness/world-model/domain/value-objects/path-key.ts +103 -0
  123. package/scripts/harness/world-model/domain/value-objects/sha256-digest.ts +39 -0
  124. package/scripts/harness/world-model/domain/value-objects/violation-fingerprint.ts +36 -0
  125. package/scripts/harness/world-model/domain/value-objects/wcr-rule-id.ts +59 -0
  126. package/scripts/harness/world-model/domain/value-objects/world-node-id.ts +222 -0
  127. package/scripts/harness/world-model/index.ts +33 -0
  128. package/scripts/harness/world-model/infrastructure/adapters/adr-fact-extractor.ts +27 -0
  129. package/scripts/harness/world-model/infrastructure/adapters/assembled-world-fact-source.ts +17 -0
  130. package/scripts/harness/world-model/infrastructure/adapters/attestation-fact-extractor.ts +323 -0
  131. package/scripts/harness/world-model/infrastructure/adapters/attestation-sha256-world-hashing-adapter.ts +15 -0
  132. package/scripts/harness/world-model/infrastructure/adapters/composite-design-fact-source.ts +23 -0
  133. package/scripts/harness/world-model/infrastructure/adapters/design-corpus-fact-extractor.ts +285 -0
  134. package/scripts/harness/world-model/infrastructure/adapters/design-fact-extraction.ts +63 -0
  135. package/scripts/harness/world-model/infrastructure/adapters/file-system-obligation-report-writer-adapter.ts +37 -0
  136. package/scripts/harness/world-model/infrastructure/adapters/file-system-world-control-repository-adapters.ts +332 -0
  137. package/scripts/harness/world-model/infrastructure/adapters/integrity-manifest-fact-extractor.ts +101 -0
  138. package/scripts/harness/world-model/infrastructure/adapters/json-fact-extractor-support.ts +151 -0
  139. package/scripts/harness/world-model/infrastructure/adapters/markdown-design-fact-extractor.ts +493 -0
  140. package/scripts/harness/world-model/infrastructure/adapters/matrix-fact-extractor.ts +283 -0
  141. package/scripts/harness/world-model/infrastructure/adapters/product-fact-extractor.ts +29 -0
  142. package/scripts/harness/world-model/infrastructure/adapters/proposal-fact-extractor.ts +29 -0
  143. package/scripts/harness/world-model/infrastructure/adapters/runtime-fact-extraction.ts +19 -0
  144. package/scripts/harness/world-model/infrastructure/adapters/source-metadata-fact-extractor.ts +22 -0
  145. package/scripts/harness/world-model/infrastructure/adapters/test-reference-source-fact-extractor.ts +22 -0
  146. package/scripts/harness/world-model/infrastructure/adapters/traceability-design-fact-adapter.ts +112 -0
  147. package/scripts/harness/world-model/infrastructure/adapters/traceability-world-read-facade-merger.ts +38 -0
  148. package/scripts/harness/world-model/infrastructure/adapters/type-script-source-fact-extractor.ts +236 -0
  149. package/scripts/harness/world-model/infrastructure/adapters/unit-fact-extractor.ts +71 -0
  150. package/scripts/harness/world-model/infrastructure/adapters/world-control-declaration-mapper.ts +383 -0
  151. package/scripts/harness/world-model/presentation/cli/world-command-support.ts +60 -0
  152. package/scripts/harness/world-model/presentation/cli/world-derive-command-handler.ts +109 -0
  153. package/scripts/harness/world-model/presentation/cli/world-inspect-command-handler.ts +194 -0
  154. package/scripts/harness/world-model/presentation/cli/world-pin-command-handler.ts +100 -0
@@ -0,0 +1,169 @@
1
+ ---
2
+ adr_id: "036"
3
+ title: "World constraints と L4-004 doc freshness の共存"
4
+ status: Proposed
5
+ date: 2026-07-16
6
+ ---
7
+
8
+ # World constraints と L4-004 doc freshness の共存
9
+
10
+ <!-- @work-item-id WI-284 -->
11
+
12
+ ## Context
13
+
14
+ World Modelのexplicit pin / reference driftとL4-004 `doc-freshness`は、どちらも「文書が現在の実装・設計に追随しているか」という利用者の懸念に関係する。しかし、検査するpredicateとevidenceは異なる。同じ文書に両findingが出たとき一方を機械的にduplicateとして消すと、時間経過のsignalか明示constraint違反のどちらかを失う。
15
+
16
+ 実コードを確認すると、L4-004は廃止済みではない。
17
+
18
+ - validator-system `buildDefaultRegistry()`は`L4-004`を`always` conditionで登録し、`ValidatorId`は`doc-freshness`へ対応付ける。
19
+ - validator-system composition-rootはphase2-extensions `CheckDocFreshnessUseCase`を`RunL4ValidatorsUseCase`へ注入する。
20
+ - RunL4はresolved design rootの`**/*.md`を対象にuse caseを実行し、non-`ok` resultを`L4-004`のwarning / errorへ写像する。
21
+ - phase2-extensions `GitLogDocumentAgeAdapter`はdocument自身の最新`git log --format=%ai`からageを計算し、取得できなければfile `mtime`へfallbackする。
22
+ - default freshness ruleはwarn 30日 / error 90日である。
23
+ - `DocumentAgeSource`には`related-source-change`が定義されるが、current production adapterが返すのは`git-log`または`file-mtime`だけである。source hash / explicit dependency / referenceを読むproduction pathはない。
24
+
25
+ self-repo `phasegate.config.json`は`layers.L4.enabled: false`である。minimal / standard presetもL4 disabled、strict presetはenabledだが、全presetのvalidator listに`doc-freshness-checker`が存在する。disabled L4はaggregate実行でskip resultになり、明示的な`validate --layer L4`は`forceLayerEnabled`により実行される。
26
+
27
+ ADR-031はvalidator-systemがgate / blocking policy、world-modelがexplicit constraint evaluationを所有すると決定した。ADR-034はWCRをexistence、ID uniqueness、explicit reference、declared dependency、digest equalityへ限定した。ADR-035はWorld `violationFingerprint` / adoption baseline / waiverをWCR findingだけに適用した。本ADRは既存L4-004を壊さず、この二つのsignalのcanonical ownerと移行条件を決める。
28
+
29
+ ## Decision
30
+
31
+ ### 1. L4-004は時間proxy、Worldは明示構造を検査する
32
+
33
+ | concern | L4-004 doc freshness | World WCR |
34
+ |---|---|---|
35
+ | predicate | document ageがconfigured warn / error days以上か | explicit endpoint、reference、dependency、pin digestが宣言どおりか |
36
+ | evidence | latest document git timestamp、fallback mtime、current date、threshold | stable World IDs、declared fact、claimant / premise pins、canonical content digest |
37
+ | identity | validator ID `L4-004` + phase2 freshness rule ID + document path | `WCR-NNN` + constraint ID + violation fingerprint |
38
+ | determinism | clock、Git history、fallback filesystem metadataに依存するoperational signal | ADR-033 rootsとexplicit policy inputsから再導出するcontent-addressed result |
39
+ | semantics | 古さをstaleness riskのproxyとして通知するheuristic | 宣言済み構造の一致 / 不一致を検証する |
40
+ | owner | phase2-extensionsがfreshness rule / age evaluation、validator-systemがregistry / gate | world-modelがWCR evaluation、validator-systemがgate |
41
+
42
+ L4-004は「古いから内容が誤っている」と断定しない。Worldはdigest / reference driftを「N日古い」と変換しない。clock、git timestamp、mtimeをWorld `corpusRoot`、constraint evaluation、violation fingerprintへ入れない。
43
+
44
+ current production L4-004はsource変更との因果やexplicit design-source relationを検査しない。将来`related-source-change` producerを追加する場合も、明示World dependency / pinで判定できる部分をL4 heuristicとして再実装しない。
45
+
46
+ ### 2. Predicateごとにcanonical rule ownerを一つにする
47
+
48
+ - **age threshold**のcanonical ownerはphase2-extensions `DocFreshnessRule` / `FreshnessCheckService`、public validator IDはvalidator-system `L4-004`。
49
+ - **explicit endpoint existence / uniqueness / reference / dependency / digest equality**のcanonical ownerはworld-model `WCR-001`〜`WCR-008`。
50
+ - **severity、blocking、fail-on-warning、layer execution、exit code**のcanonical ownerはvalidator-system。
51
+
52
+ L4-004 findingからWCR findingを生成しない。WCR findingからL4-004 ageを推定しない。rule text、message、document pathが似ていてもownerを統合しない。
53
+
54
+ 同じdocumentに両findingが出た場合、両predicateはそれぞれ正しいsignalである。ただしexplicit structural remediationについてはWCR obligationをcanonicalとし、L4-004はtemporal supporting signalとして関連付ける。
55
+
56
+ - World obligation reportの`structuralObligations`、`violationFingerprint`、adoption baseline、waiverにはWCR findingだけを入れる。
57
+ - L4-004 findingをWorld structural obligation数へ加えず、World baseline / waiverで抑止しない。
58
+ - L4-004がpassしてもWCR violationを打ち消さず、WCRがpass / adopted / waivedでもL4 age findingを打ち消さない。
59
+ - presentationで関連付ける場合はresolved Artifact / FragmentのPathKeyを使い、message substringや実行順でdeduplicateしない。
60
+ - 同じpathに両方ある場合、WCRをprimary remediation、L4-004を`supporting-temporal-signal`として表示できるが、raw validator resultsは保持する。
61
+
62
+ ### 3. L4-004を現役product capabilityとして維持する
63
+
64
+ World導入だけを理由にL4-004、`p2:check-freshness`、phase2-extensions freshness domainを削除しない。Worldのexplicit constraint coverageが増えても、宣言のない文書や「一定期間reviewされていない」という独立policyは残るためである。
65
+
66
+ 現行配置を維持する。
67
+
68
+ - phase2-extensions: `DocFreshnessRule`, threshold、age port / adapter、use case、compatibility handler
69
+ - validator-system: `L4-004` registry、RunL4 bridge、severity / aggregation
70
+ - config-foundation: preset validator listとL4 enablement
71
+
72
+ L4-004をWorld rulesetへ移動せず、World `rulesetVersion`変更の理由にしない。L4 threshold / age semantics変更はL4 capability自身のversioned product design / testsで管理する。
73
+
74
+ ### 4. Dual-run compatibility periodを設ける
75
+
76
+ compatibility periodは、WM-20でL3 authoritative World re-derivationが対象document patternに対して利用可能になった時点から開始する。終了は次の全条件を満たした後とする。
77
+
78
+ 1. WM-24 production-ready checkpointが完了している。
79
+ 2. 対象patternで少なくとも一つのconfigured L4 warn-threshold期間を経過している。default ruleでは30日。
80
+ 3. 対象patternで少なくとも2回のscheduled / explicit dual-run結果が保存reportではなく再実行から比較されている。
81
+ 4. overlap、L4-only、WCR-only findingをdocument class / rule owner別に集計し、canonical owner誤りとsilent lossがない。
82
+
83
+ 期間中はL4-004とWorld WCRを両方実行可能にし、既存validator ID / command / preset entryを削除しない。overlapはfinding数を隠すdedupではなく、presentation correlationとして扱う。
84
+
85
+ compatibility measurement自体をWorld adoption baselineへ入れず、L4-only findingを`violationFingerprint`へ変換しない。
86
+
87
+ ### 5. 維持、縮退、移行、廃止の条件を分ける
88
+
89
+ #### 維持
90
+
91
+ 次のいずれかが真なら対象patternのL4-004を維持する。
92
+
93
+ - time-since-review自体がproduct / consumer policyとして必要。
94
+ - explicit World constraintでcoveredされないdocumentがある。
95
+ - compatibility periodにactionableなL4-only findingがある。
96
+ - Git age / mtime fallbackを使うconsumer automationまたは`p2:check-freshness`互換経路がある。
97
+
98
+ #### 縮退
99
+
100
+ 対象document classについて次を全て満たす場合だけ、別WIでscan pattern、threshold policy、severityの縮退を提案できる。
101
+
102
+ - World explicit constraint inventoryが対象classをcompleteと判定している。
103
+ - compatibility periodにL4-only findingがない、または全てnon-actionableとreviewされた。
104
+ - time-only freshness policyを不要とするproduct ownerの明示判断がある。
105
+ - config / preset / compatibility commandへのimpactとmigration guideが用意される。
106
+
107
+ 縮退はpattern単位とし、repository全体のL4-004を一括disable / deleteしない。
108
+
109
+ #### Worldへ移行
110
+
111
+ L4 implementationに将来、explicit hash / reference / dependency checkが追加されてWorld WCRと同一predicateになった場合、そのsub-ruleはWorldをcanonical ownerとして移行する。dual-runで同値性を確認し、L4側duplicate sub-ruleをdeprecateする。
112
+
113
+ current git-age / mtime threshold predicateにはWCR equivalentがないため、Worldへ移行しない。
114
+
115
+ #### 廃止
116
+
117
+ `L4-004` IDまたはpublic compatibility command全体の廃止は本ADRでは決定しない。全supported preset / consumerでage policyが不要、unique L4-only valueがない、deprecation periodとregistry / config / docs / tests migrationが完了、という条件を満たした別ADR / breaking changeだけが決定できる。
118
+
119
+ ### 6. Self-repoのL4 disabledとproduct capabilityを分離する
120
+
121
+ self-repoの`layers.L4.enabled: false`はdogfood execution policyであり、capability不存在や廃止を意味しない。
122
+
123
+ - self-repoでaggregate / CI pathがL4をskipしても、L4-004 registry、composition wiring、tests、preset contractを維持する。
124
+ - operatorが明示する`validate --layer L4`はdisabled self-repoでもforce-enableしてL4-004を実行できる。
125
+ - strict presetはL4 enabledを維持し、minimal / standard presetのdisabled方針を本ADRで変更しない。
126
+ - self-repoをdefault-onへ変更するかは、World rolloutとは別のconfig / noise-budget判断とし、本ADRでは変更しない。
127
+
128
+ したがって、self-repoでL4がdisabledであることをL4-004 removalの根拠にしない。
129
+
130
+ ### 7. §10の未決事項には該当なし
131
+
132
+ `docs/inception/_cross/WI-280/delivery_plan.md` §10にADR-036固有の未決事項はない。本ADRは新しいconfig key、validator ID、file name、report pathを決定しない。それらはADR-037のscopeを維持する。
133
+
134
+ ## Consequences
135
+
136
+ ### Positive
137
+
138
+ - 時間proxyとexplicit structural proofを混同せず、それぞれのsignalを保持できる。
139
+ - WCR fingerprint / baselineへheuristic findingが混入することを防げる。
140
+ - self-repo configだけを理由に現役product capabilityを削除しない。
141
+ - pattern単位のmeasurementに基づき、維持 / 縮退 / 移行を段階判断できる。
142
+ - 将来L4へexplicit drift checkが重複実装されることを防げる。
143
+
144
+ ### Negative / Trade-off
145
+
146
+ - compatibility period中は同じdocumentに二つのfindingが表示され得る。
147
+ - L4-004はclock / Git / mtime依存であり、World snapshotと同じbyte determinismを持たない。
148
+ - correlation表示とoverlap / unique finding inventoryが必要になる。
149
+ - World coverageがcompleteでも、独立したtime policyが残ればL4-004を維持する必要がある。
150
+
151
+ ## Alternatives
152
+
153
+ - **World導入時にL4-004を即時削除する** — explicit constraintのないdocumentとtime-since-review signalを失い、現役registry / command contractを破るため不採用。
154
+ - **L4 age findingをWCR digest driftとして変換する** — ageはcontent mismatchの証拠ではなく、ADR-034のrule限界を越えるため不採用。
155
+ - **WCR findingがあればL4 findingを完全に隠す** — time policyの独立違反を失うため不採用。
156
+ - **同じpathなら一律duplicateとする** — predicate / evidenceを見ずに異なる責務を統合するため不採用。
157
+ - **self-repo L4 disabledをcapability廃止とみなす** — product preset / explicit execution / consumer contractとdogfood policyを混同するため不採用。
158
+
159
+ ## 関連要件・文書
160
+
161
+ - `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-04, §7 ADR-036, §10
162
+ - `docs/inception/_cross/WI-284/description.md`
163
+ - `docs/inception/_cross/WI-284/logical_design.md`
164
+ - ADR-031(validator-system / world-model ownership)
165
+ - ADR-033(clock / mtime exclusion、canonical roots)
166
+ - ADR-034(WCR structural rule limits)
167
+ - ADR-035(WCR fingerprint / adoption baseline / waiver)
168
+ - phase2-extensions product design(doc freshness)
169
+ - validator-system product design(L4 registry / execution)
@@ -0,0 +1,398 @@
1
+ ---
2
+ adr_id: "037"
3
+ title: "World CLI と output/persistence contract"
4
+ status: Proposed
5
+ date: 2026-07-16
6
+ ---
7
+
8
+ # World CLI と output/persistence contract
9
+
10
+ <!-- @work-item-id WI-284 -->
11
+
12
+ ## Context
13
+
14
+ World Modelはread-only inventory、constraint pin更新、obligation導出という異なる副作用境界を持つ。command名、output、exit code、control file、generated reportを先に固定しないと、CLI実装ごとに暗黙writeや別schemaが生まれ、ADR-031のartifact lifecycleとADR-035の「report手編集は判定を変えない」が崩れる。
15
+
16
+ 既存CLIは`main.ts`のtop-level `switch`と、sorted `KNOWN_HARNESS_COMMANDS`の集合一致をconformance testで強制する。capability namespaceには`phasegate:*`, `p2:*`, `ci:*`, `integrity:*`, `regression:*`があり、`p2:check-freshness`等は独立top-level commandである。validation commandは概ね0=pass、1=domain / gate failure、2=usage / config / execution failureを使い、`--json`をmachine-readable outputに使う。
17
+
18
+ 既存generated artifactの配置は二系統ある。
19
+
20
+ - `.harness/requirement-test-matrix.json`, `.harness/attestation.json`, `.harness/lesson-artifacts/**`等、machine consumer向け再生成物は`.harness/`。
21
+ - phase / regression等のhuman reportはresolved `reporting.outputDir`または`reports/`。
22
+
23
+ `.gitignore`は`.harness/`と`reports/`の両方を除外する。World obligation reportはtooling / operator向けのmachine-readable derived cacheであり、review対象のcontrol inputではないため、matrix / attestation側の慣行に合わせる。
24
+
25
+ config-foundationは`phasegate.config.json`をAJV schemaで検証し、presetとsource documentをdeep mergeしたresolved configをconsumerへ渡す。schemaはtop-level `additionalProperties: false`である。root control fileには`phasegate.config.json`, `phasegate.integrity.json`という`phasegate.<capability>.json`慣行がある。
26
+
27
+ 本ADRはADR-031〜036のcontractをCLI / persistenceへ写像し、Phase 0のWorld意思決定を完結させる。
28
+
29
+ ## Decision
30
+
31
+ ### 1. 三つの`world:*` top-level commandを固定する
32
+
33
+ 次をcanonical public commandとする。
34
+
35
+ ```text
36
+ world:inspect
37
+ world:pin
38
+ world:derive
39
+ ```
40
+
41
+ `phasegate world inspect`のようなnested subcommandや`phasegate:world:*` aliasは作らない。既存colon namespaceと同様、実際の呼び出しは`phasegate world:inspect`等になる。
42
+
43
+ 実装時は三commandを同じWIで次へ追加し、集合一致を保つ。
44
+
45
+ - `scripts/harness/main.ts` help / switch dispatch
46
+ - `scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts`
47
+ - known-command conformance / help / E2E tests
48
+
49
+ #### `world:inspect`
50
+
51
+ corpusを読み取り、World snapshot、node / edge count、corpus role / artifact kind、extraction diagnostics、`corpusRoot`を表示するread-only command。
52
+
53
+ - control declarationやreportを書かない。
54
+ - explicit constraintがなくても実行できる。
55
+ - hard extraction diagnosticがなければexit 0。
56
+ - snapshotを生成できたがduplicate ID等のhard diagnosticがあればexit 1。
57
+ - config / schema / I/O / hashing failureでsnapshotを生成できなければexit 2。
58
+
59
+ #### `world:pin`
60
+
61
+ 一意に解決したconstraint endpointのcurrent digestから、ConstraintRecord pin candidateを作るcommand。
62
+
63
+ - defaultはpreview-onlyで、candidate / diffをstdoutへ出す。
64
+ - `--apply`を明示した場合だけ`phasegate.world-constraints.json`をatomic updateする。
65
+ - missing / duplicate / ambiguous alias endpoint、malformed declarationではwriteせずexit 1。
66
+ - unknown schema、invalid config、I/O / hashing failureはexit 2。
67
+ - baseline、waiver、semantic debt、obligation reportを更新しない。
68
+ - Git add / commitやbaseline adoptionを自動実行しない。
69
+
70
+ `--apply`はreview対象external declarationへのmutationであり、`--write` report modeとは区別する。
71
+
72
+ #### `world:derive`
73
+
74
+ current snapshotとexternal declarationsからWCR evaluation、fingerprint、policy classification、obligation reportを再導出するcommand。
75
+
76
+ - defaultはpure/read-only。stdoutへ結果を出すだけでfilesystemを変更しない。
77
+ - `--write`を明示した場合だけraw obligation report JSONをpersistする。
78
+ - `--out <project-relative-path>`は`--write`と同時指定する。`--out`単独はusage error exit 2。
79
+ - default write targetは`.harness/world-obligations.json`。
80
+ - reportはtemp file + atomic renameで置換し、partial fileを残さない。
81
+ - current blocking obligation / cleanup-required policy findingがなければexit 0。
82
+ - derive成功かつblocking resultがあればexit 1。
83
+ - unknown schema、invalid config / policy input、canonicalization / hashing / I/O failureでtrustworthyなevaluationを作れなければexit 2。
84
+
85
+ adopted legacy / active waiver / declared semantic debtが存在するだけではexit 1にしない。ADR-035のblocking mappingをvalidator-system adapterが適用する。
86
+
87
+ ### 2. Human / JSON output contractを統一する
88
+
89
+ 三commandは次を受理する。
90
+
91
+ ```text
92
+ --format human|json
93
+ --json
94
+ ```
95
+
96
+ `--json`は`--format json`のalias。両方を矛盾する値で指定した場合はexit 2とする。defaultはTTY / non-TTYに依存させず`human`。
97
+
98
+ #### stdout
99
+
100
+ - primary resultだけを出す。
101
+ - human modeは固定section順・stable ID順でsummary / findings / next actionを表示する。
102
+ - JSON modeは一つのJSON documentだけを出し、progress、ANSI color、warning proseを混ぜない。
103
+ - exit 1のdomain / gate resultもstdoutへ完全なresultを出す。
104
+ - `world:derive --write`のstdoutはderive resultとwritten pathを返すが、persist fileはCLI envelopeでなくraw obligation reportとする。
105
+
106
+ JSON envelope:
107
+
108
+ ```text
109
+ {
110
+ schemaVersion: "phasegate-world-cli/v1",
111
+ command: "world:inspect" | "world:pin" | "world:derive",
112
+ ok: boolean,
113
+ exitCode: 0 | 1 | 2,
114
+ data: command-specific DTO | null,
115
+ diagnostics: sorted diagnostic DTOs
116
+ }
117
+ ```
118
+
119
+ `generatedAt`を入れない。diagnosticsはcode、stable subject ID、PathKey、line、canonical payloadでsortする。
120
+
121
+ #### stderr
122
+
123
+ - human modeのusage error、invalid flag、unknown / unsupported schema、unexpected execution failureを出す。
124
+ - optional progress / verbose logを将来追加する場合もstderrだけを使う。
125
+ - expected WCR finding、adopted debt、waiver、semantic debtをstderrへ重複出力しない。
126
+ - JSON modeのexpected errorはJSON envelopeをstdoutへ出す。stderrはJSON parserを必要としないunexpected process-level failureの一行だけに限定する。
127
+
128
+ exit code:
129
+
130
+ | code | meaning |
131
+ |---|---|
132
+ | 0 | command completed and no blocking / hard diagnostic condition |
133
+ | 1 | command completed enough to report a domain, structural, or policy failure |
134
+ | 2 | invocation、config、schema、I/O、canonicalization、hashing等によりtrustworthyなresultを作れない |
135
+
136
+ process signal等のplatform exitはこの表の外とする。
137
+
138
+ ### 3. Control declarationの正式file nameを固定する
139
+
140
+ project rootのGit-tracked external declarationとして次を採用する。
141
+
142
+ | purpose | canonical file | schemaVersion |
143
+ |---|---|---|
144
+ | constraints / pins / aliases / explicit claims | `phasegate.world-constraints.json` | `phasegate-world-constraints/v1` |
145
+ | adoption baseline | `phasegate.world-baseline.json` | `phasegate-world-adoption-baseline/v1` |
146
+ | waivers | `phasegate.world-waivers.json` | `phasegate-world-waivers/v1` |
147
+ | explicit semantic debts | `phasegate.world-debts.json` | `phasegate-world-debts/v1` |
148
+
149
+ `phasegate.<capability>.json`というroot control file慣行に従い、既存`.phasegate/baseline.json`との衝突を`world-` qualifierで避ける。
150
+
151
+ - constraints file不在はempty explicit declaration set。global ID uniqueness等のimplicit WCRは引き続き評価する。
152
+ - baseline / waiver / debt file不在はそれぞれcanonical empty policy input。
153
+ - fileが存在する場合、`schemaVersion`は必須。
154
+ - unknown / unsupported schemaVersionはemptyとして扱わずfail-closed exit 2。
155
+ - supported schema内のmalformed constraintはADR-034 `WCR-001`としてexit 1。document envelope自体を解釈できない場合はexit 2。
156
+ - duplicate record ID / fingerprintでwinnerを選ばない。
157
+ - input array orderやJSON formattingはsemantic identityに使わない。
158
+
159
+ schemaは実装WIで次へ配置する。
160
+
161
+ ```text
162
+ docs/contracts/world-constraints.schema.json
163
+ docs/contracts/world-baseline.schema.json
164
+ docs/contracts/world-waivers.schema.json
165
+ docs/contracts/world-debts.schema.json
166
+ docs/contracts/world-obligation-report.schema.json
167
+ ```
168
+
169
+ schemaはpublished packageの`docs/contracts/` contractとして扱う。ADR-037ではschema fileをまだ作成せず、constraint / policy schemaはWM-13、report schemaはWM-14、debt schemaは必要に応じてWM-17のimplementation scopeに残す。
170
+
171
+ ### 4. Obligation reportは`.harness/`へ非追跡で保存する
172
+
173
+ canonical default path:
174
+
175
+ ```text
176
+ .harness/world-obligations.json
177
+ ```
178
+
179
+ schemaVersion:
180
+
181
+ ```text
182
+ phasegate-world-obligation-report/v1
183
+ ```
184
+
185
+ 理由:
186
+
187
+ - matrix / attestation等のmachine-consumed regenerated artifactと同じlifecycle。
188
+ - repositoryの`.gitignore`が`.harness/`を既に除外する。
189
+ - `reports/`のhuman-oriented reporting outputとreview対象のroot declarationsから分離できる。
190
+ - local toolingが固定defaultで発見できる。
191
+
192
+ Git tracking policy:
193
+
194
+ - default reportをcommitしない。
195
+ - `world:derive --write`は`.gitignore`やGit indexを変更しない。
196
+ - persisted reportはcache / inspection convenienceであり、L2 / L3 / attestation / session-startが正本として信頼しない。
197
+ - L3はclean corpusとcontrol declarationsから再導出する。
198
+ - report削除・改竄は次のderive result / gateを変えない。
199
+ - humanが`reports/`へ必要なら`--write --out reports/<name>.json`を明示できるが、generated artifact semanticsと非追跡方針は変わらない。
200
+
201
+ report path、JSON whitespace、written path、mtimeを`corpusRoot`, `constraintRoot`, `evaluationId`, `violationFingerprint`へ含めない。
202
+
203
+ ### 5. `world:derive`のpure modeとwrite modeを分離する
204
+
205
+ | mode | invocation | filesystem effect | intended use |
206
+ |---|---|---|---|
207
+ | pure | `world:derive` | none | local review、L2/L3 authoritative re-derivation、CI |
208
+ | write default | `world:derive --write` | atomic write to `.harness/world-obligations.json` | local cache、non-authoritative inspection |
209
+ | write explicit | `world:derive --write --out <path>` | atomic write to explicit project-relative path | diagnostic export |
210
+
211
+ pure modeとwrite modeは同じdomain use case / canonical serializerを使う。同一inputsならraw obligation report bytesは同じでなければならない。write modeだけでfinding、classification、exit codeが変化してはならない。
212
+
213
+ report repositoryをevaluation input portへ接続せず、read-after-writeで判定しない。`--write`失敗はexit 2とし、stdout / previous complete reportを成功扱いしない。
214
+
215
+ ### 6. Top-level config keyを`world`とする
216
+
217
+ config-foundation v2 / v3 schemaへ、lower camelCaseの既存top-level慣行に合わせて`world`を追加する。`worldModel`、`world-model`、`worldConstraints` aliasは作らない。
218
+
219
+ resolved contract:
220
+
221
+ ```text
222
+ world: {
223
+ enabled: boolean
224
+ corpus: {
225
+ productRoots: string[]
226
+ inceptionRoots: string[]
227
+ adrRoots: string[]
228
+ sourceRoots: string[]
229
+ include: string[]
230
+ exclude: string[]
231
+ }
232
+ inputs: {
233
+ matrixPath: string
234
+ attestationPath: string
235
+ integrityManifestPath: string
236
+ }
237
+ declarations: {
238
+ constraintsPath: string
239
+ baselinePath: string
240
+ waiversPath: string
241
+ debtsPath: string
242
+ }
243
+ output: {
244
+ obligationReportPath: string
245
+ }
246
+ sessionStart: {
247
+ enabled: boolean
248
+ maxItems: integer
249
+ maxChars: integer
250
+ }
251
+ }
252
+ ```
253
+
254
+ 全pathはproject-relative POSIX path。absolute、backslash、`..`をrejectする。root role overlap、同一pathの複数corpus role、case-fold collisionはsilent mergeせずconfig / extraction diagnosticにする。
255
+
256
+ `world.enabled`はautomatic validator / hook integrationを制御し、Phase C rolloutのbackward compatibilityのためdefault `false`。explicit `world:*` commandはL4 explicit executionと同様、`enabled: false`でも実行する。
257
+
258
+ ### 7. Config不在時もcanonical defaultsで明示commandを実行する
259
+
260
+ `phasegate.config.json`が見つからない場合、explicit `world:*` commandは次のresolved defaultsを使う。
261
+
262
+ ```text
263
+ world.enabled = false
264
+ world.corpus.productRoots = ["docs/product"]
265
+ world.corpus.inceptionRoots = ["docs/inception"]
266
+ world.corpus.adrRoots = ["docs/ADR"]
267
+ world.corpus.sourceRoots = ["scripts/harness"]
268
+ world.corpus.include = ["**/*"]
269
+ world.corpus.exclude = []
270
+ world.inputs.matrixPath = ".harness/requirement-test-matrix.json"
271
+ world.inputs.attestationPath = ".harness/attestation.json"
272
+ world.inputs.integrityManifestPath = "phasegate.integrity.json"
273
+ world.declarations.constraintsPath = "phasegate.world-constraints.json"
274
+ world.declarations.baselinePath = "phasegate.world-baseline.json"
275
+ world.declarations.waiversPath = "phasegate.world-waivers.json"
276
+ world.declarations.debtsPath = "phasegate.world-debts.json"
277
+ world.output.obligationReportPath = ".harness/world-obligations.json"
278
+ world.sessionStart.enabled = true
279
+ world.sessionStart.maxItems = 5
280
+ world.sessionStart.maxChars = 2000
281
+ ```
282
+
283
+ defaultでarchiveやlegacy文書をsilent除外しない。extractorがsupported artifactを分類し、unsupported fileはversioned selection rule / diagnosticで扱う。
284
+
285
+ matrix / attestation / integrity manifestはoptional provider inputである。default pathにfileが存在しないことだけでconfig failureにせず、`not-present` observation / diagnosticとして保持する。存在するfileがowner schemaに反する場合はsilent omissionせずhard diagnosticとし、そのendpointを要求するconstraintはmissing / invalid evidenceとして評価する。
286
+
287
+ configが存在する場合はraw JSONを各commandが直接読むのではなく、config-foundation `LoadResolvedConfigUseCase`とWorld mapperを通す。
288
+
289
+ - `world` source sectionをpreset / defaultとmergeし、resolved DTOをWorldへ渡す。
290
+ - existing resolved `paths.inceptionDocs`を、explicit `world.corpus.inceptionRoots`がない場合のinception rootとして使う。
291
+ - existing resolved `paths.designDocs`がdefault product root外なら、explicit product design rootとして追加し、product corpus roleを保つ。
292
+ - existing resolved `layers.L3.requirementMatrixPath`を、explicit `world.inputs.matrixPath`がない場合に使う。
293
+ - output format / session limitはcorpus / constraint config digestへ混ぜず、ADR-033のscope別relevant config digestへ振り分ける。
294
+
295
+ config fileが存在するのにinvalid、unknown top-level / field、type mismatch、unsupported config schemaである場合、defaultsへfallbackしない。exit 2でfail-closedにする。
296
+
297
+ ### 8. Phase C validator IDを予約する
298
+
299
+ 現在未使用の次のID / nameを予約する。
300
+
301
+ | Phase C WI | validator ID | canonical name | responsibility |
302
+ |---|---|---|---|
303
+ | WM-19 | `L2-017` | `world-constraint-admission` | changed / new claim・pin・constraint declarationのfast-path、WCR-001、unresolved new endpointをfail-closed |
304
+ | WM-20 | `L3-008` | `world-constraint-rederivation` | clean corpus / declarationsからauthoritative deriveし、baseline / waiver policyを適用 |
305
+
306
+ `WCR-NNN`はWorld内部rule IDであり、`L2-017` / `L3-008`はvalidator-system execution identityである。一つのvalidator resultに複数WCR findingを含められる。
307
+
308
+ 本ADRではreservationだけを行う。`ValidatorId`, registry、RunL2 / RunL3、composition-root、presetへの実登録はそれぞれWM-19 / WM-20で行い、登録前の現行runtimeがこれらをrejectする挙動を変更しない。
309
+
310
+ `world.enabled: false`ではautomatic L2-017 / L3-008 integrationをskipする。explicit `world:derive`は実行できる。default enablementを変更するPhase C rolloutはconfig / preset migrationと同じWIでreviewする。
311
+
312
+ ### 9. SessionStart summaryを5件・2000文字に制限する
313
+
314
+ WM-21のWorld obligation sectionは、resolved config defaultで次のhard capを持つ。
315
+
316
+ ```text
317
+ maxItems = 5
318
+ maxChars = 2000
319
+ ```
320
+
321
+ - maxItemsは表示するobligation / policy diagnostic entry数。
322
+ - maxCharsはWorld section全体のUnicode scalar value数で、header、summary、omission lineを含む。
323
+ - blockingを先、次にcleanup-required、adopted / waivedの順とし、同順位はrule ID、constraint ID、fingerprintでsortする。
324
+ - char capを超えるentryは途中切断せずentry単位で省略する。
325
+ - 省略時は`... <N> more; run phasegate world:derive`を末尾へ入れる。このlineもmaxChars内。
326
+ - constraint prose、waiver reason、semantic debt free text、full obligation reportをpromptへ注入しない。stable ID、rule ID、PathKey、classification、countだけを使う。
327
+ - repository由来文字列を含める場合は既存untrusted-data fence / neutralizationを使う。
328
+ - summaryはcurrent World query / in-process deriveから作り、persisted obligation reportだけを読んで生成しない。cacheが存在してもcurrent deriveと独立照合できない場合は無視する。
329
+
330
+ `maxItems` / `maxChars`はconfigでより小さくできる。schema上限をそれぞれ20件 / 8000文字とし、0 / negative / over-limitはinvalid configとしてfail-closedする。session hook自体は既存どおりwarn-only / exit 0で、World summary取得失敗はsessionをblockせず短いunavailable lineを出す。authoritative blockingはL2 / L3が所有する。
331
+
332
+ ### 10. Attestation v2 contractはWM-23へ委譲する
333
+
334
+ attestation v2の`schemaVersion`, `predicateType`, v1 coexistence periodは本ADRで決めない。WM-23がattestation ownerのdomain / schema / backward compatibility testとともに決定する。
335
+
336
+ 本ADRが固定するのは、attestation input default pathと、将来top-level compositionがplain `worldSnapshotRoot`を注入するCLI / config側の境界だけである。attestation v2 schemaをWorld config / obligation reportへ複製しない。
337
+
338
+ ### 11. §10未決事項のdispositionを完結する
339
+
340
+ | §10 item | disposition |
341
+ |---|---|
342
+ | fragment ID notation | ADR-032で`@world-fragment-id`に確定 |
343
+ | legacy whole-file migration | ADR-032でmixed-mode ratchetに確定 |
344
+ | raw prose Unicode normalization | ADR-033で非適用に確定 |
345
+ | hashing capability owner | ADR-033でattestation public facadeに確定 |
346
+ | World declaration file names | 本ADR §3で確定 |
347
+ | obligation report path | 本ADR §4で`.harness/world-obligations.json`に確定 |
348
+ | world config key / validator ID | 本ADR §6 / §8で`world`, `L2-017`, `L3-008`に確定 / 予約 |
349
+ | initial structural fingerprint count | ADR-031どおりWM-17実測。推測値を置かない |
350
+ | semantic debt ID / coverage annotation | ADR-035で確定 |
351
+ | attestation v2 schema / coexistence | 本ADR §10どおりWM-23へ明示委譲 |
352
+ | session-start limit | 本ADR §9で5件 / 2000文字に確定 |
353
+
354
+ ## Consequences
355
+
356
+ ### Positive
357
+
358
+ - read-only、reviewed control mutation、generated report writeの副作用境界が明確になる。
359
+ - Git-tracked declarationsとignored derived reportを物理的に分離できる。
360
+ - JSON stdoutをCI / agentが安定してparseできる。
361
+ - config不在の明示inspectionを可能にしつつ、存在するinvalid config / schemaはfail-closedにできる。
362
+ - WCR rule IDとvalidator execution IDを混同せずPhase Cへ予約できる。
363
+ - session-startへreport全文やfree textを注入せずprompt budgetを制限できる。
364
+
365
+ ### Negative / Trade-off
366
+
367
+ - rootに4つのWorld control JSON fileが増える。
368
+ - `world:pin --apply`と`world:derive --write`で異なるmutation flagを覚える必要がある。
369
+ - persisted reportはGit管理されないため、historical comparisonはevaluation IDs / CI artifactsを別途保存する必要がある。
370
+ - `world.enabled: false`でも明示commandが動くため、automatic integrationとの違いをdocumentする必要がある。
371
+ - reserved validator IDはPhase C実装までcurrent registryではinvalidである。
372
+
373
+ ## Alternatives
374
+
375
+ - **`phasegate world <subcommand>`にする** — current canonical command registryがtop-level case集合を正本とし、他capabilityがcolon namespaceを使うため不採用。
376
+ - **`phasegate:world:*`にする** — `phasegate:*` core harness-api namespaceへWorld capabilityを二重nestするため不採用。
377
+ - **deriveをdefault writeにする** — inspection / CIで意図しないworktree mutationを起こすため不採用。
378
+ - **obligation reportを`reports/`へ出す** — human reportとmachine cacheを混在させ、matrix / attestationの`.harness/`慣行から外れるため不採用。
379
+ - **obligation reportをGit trackする** —手編集 / stale outputをcontrol inputと誤認させ、ADR-035に反するため不採用。
380
+ - **既存`.phasegate/baseline.json`をWorld file名として再利用する** — path / SHA-1 hook grandfatherとfingerprint adoptionを混同するため不採用。
381
+ - **validator IDをWCR IDと同一にする** — gate executionとindividual structural ruleのidentityを混同するため不採用。
382
+ - **session-startへ全obligationを注入する** — prompt budget、free-text injection、stale report依存を生むため不採用。
383
+
384
+ ## 関連要件・文書
385
+
386
+ - `docs/inception/_cross/WI-280/delivery_plan.md` §1, §3 WM-04, §7 ADR-037, §10
387
+ - `docs/inception/_cross/WI-284/description.md`
388
+ - `docs/inception/_cross/WI-284/logical_design.md`
389
+ - ADR-031(ownership / artifact lifecycle)
390
+ - ADR-032(identity / fragment / alias)
391
+ - ADR-033(canonical roots / relevant config)
392
+ - ADR-034(WCR semantics)
393
+ - ADR-035(obligation / baseline / waiver / semantic debt)
394
+ - ADR-036(L4-004 coexistence)
395
+ - `scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts`
396
+ - `scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json`
397
+ - `scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json`
398
+ - `docs/contracts/`