@dailephd/my-frontend-observer 0.8.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 (316) hide show
  1. package/CHANGELOG.md +397 -0
  2. package/LICENSE +21 -0
  3. package/README.md +255 -0
  4. package/dist/application/browserCaptureService.d.ts +11 -0
  5. package/dist/application/browserCaptureService.js +12 -0
  6. package/dist/application/browserCaptureService.js.map +1 -0
  7. package/dist/application/comparisonService.d.ts +56 -0
  8. package/dist/application/comparisonService.js +77 -0
  9. package/dist/application/comparisonService.js.map +1 -0
  10. package/dist/application/externalReferencePersistenceService.d.ts +75 -0
  11. package/dist/application/externalReferencePersistenceService.js +182 -0
  12. package/dist/application/externalReferencePersistenceService.js.map +1 -0
  13. package/dist/application/frontendContractEvaluationService.d.ts +49 -0
  14. package/dist/application/frontendContractEvaluationService.js +112 -0
  15. package/dist/application/frontendContractEvaluationService.js.map +1 -0
  16. package/dist/application/frontendContractPersistenceService.d.ts +56 -0
  17. package/dist/application/frontendContractPersistenceService.js +91 -0
  18. package/dist/application/frontendContractPersistenceService.js.map +1 -0
  19. package/dist/application/observationPersistence.d.ts +59 -0
  20. package/dist/application/observationPersistence.js +79 -0
  21. package/dist/application/observationPersistence.js.map +1 -0
  22. package/dist/application/projectCheckService.d.ts +3 -0
  23. package/dist/application/projectCheckService.js +169 -0
  24. package/dist/application/projectCheckService.js.map +1 -0
  25. package/dist/application/projectWorkflowService.d.ts +46 -0
  26. package/dist/application/projectWorkflowService.js +92 -0
  27. package/dist/application/projectWorkflowService.js.map +1 -0
  28. package/dist/application/referenceFidelityEvaluationService.d.ts +28 -0
  29. package/dist/application/referenceFidelityEvaluationService.js +45 -0
  30. package/dist/application/referenceFidelityEvaluationService.js.map +1 -0
  31. package/dist/artifacts/artifactReader.d.ts +19 -0
  32. package/dist/artifacts/artifactReader.js +36 -0
  33. package/dist/artifacts/artifactReader.js.map +1 -0
  34. package/dist/artifacts/artifactWriter.d.ts +25 -0
  35. package/dist/artifacts/artifactWriter.js +68 -0
  36. package/dist/artifacts/artifactWriter.js.map +1 -0
  37. package/dist/artifacts/comparisonArtifactReader.d.ts +18 -0
  38. package/dist/artifacts/comparisonArtifactReader.js +35 -0
  39. package/dist/artifacts/comparisonArtifactReader.js.map +1 -0
  40. package/dist/artifacts/comparisonArtifactWriter.d.ts +41 -0
  41. package/dist/artifacts/comparisonArtifactWriter.js +67 -0
  42. package/dist/artifacts/comparisonArtifactWriter.js.map +1 -0
  43. package/dist/artifacts/externalReferenceArtifactReader.d.ts +18 -0
  44. package/dist/artifacts/externalReferenceArtifactReader.js +35 -0
  45. package/dist/artifacts/externalReferenceArtifactReader.js.map +1 -0
  46. package/dist/artifacts/externalReferenceArtifactWriter.d.ts +44 -0
  47. package/dist/artifacts/externalReferenceArtifactWriter.js +77 -0
  48. package/dist/artifacts/externalReferenceArtifactWriter.js.map +1 -0
  49. package/dist/artifacts/frontendContractArtifactReader.d.ts +24 -0
  50. package/dist/artifacts/frontendContractArtifactReader.js +47 -0
  51. package/dist/artifacts/frontendContractArtifactReader.js.map +1 -0
  52. package/dist/artifacts/frontendContractArtifactWriter.d.ts +34 -0
  53. package/dist/artifacts/frontendContractArtifactWriter.js +70 -0
  54. package/dist/artifacts/frontendContractArtifactWriter.js.map +1 -0
  55. package/dist/artifacts/frontendContractEvaluationArtifactReader.d.ts +17 -0
  56. package/dist/artifacts/frontendContractEvaluationArtifactReader.js +34 -0
  57. package/dist/artifacts/frontendContractEvaluationArtifactReader.js.map +1 -0
  58. package/dist/artifacts/frontendContractEvaluationArtifactWriter.d.ts +32 -0
  59. package/dist/artifacts/frontendContractEvaluationArtifactWriter.js +58 -0
  60. package/dist/artifacts/frontendContractEvaluationArtifactWriter.js.map +1 -0
  61. package/dist/artifacts/types.d.ts +17 -0
  62. package/dist/artifacts/types.js +2 -0
  63. package/dist/artifacts/types.js.map +1 -0
  64. package/dist/browser/chromiumAdapter.d.ts +21 -0
  65. package/dist/browser/chromiumAdapter.js +204 -0
  66. package/dist/browser/chromiumAdapter.js.map +1 -0
  67. package/dist/browser/evidenceCapture.d.ts +62 -0
  68. package/dist/browser/evidenceCapture.js +500 -0
  69. package/dist/browser/evidenceCapture.js.map +1 -0
  70. package/dist/browser/scrollCapture.d.ts +32 -0
  71. package/dist/browser/scrollCapture.js +163 -0
  72. package/dist/browser/scrollCapture.js.map +1 -0
  73. package/dist/browser/types.d.ts +24 -0
  74. package/dist/browser/types.js +2 -0
  75. package/dist/browser/types.js.map +1 -0
  76. package/dist/cli.d.ts +8 -0
  77. package/dist/cli.js +2411 -0
  78. package/dist/cli.js.map +1 -0
  79. package/dist/domain/boundedAgentContext.d.ts +226 -0
  80. package/dist/domain/boundedAgentContext.js +355 -0
  81. package/dist/domain/boundedAgentContext.js.map +1 -0
  82. package/dist/domain/boundedAgentContextCorrelation.d.ts +74 -0
  83. package/dist/domain/boundedAgentContextCorrelation.js +441 -0
  84. package/dist/domain/boundedAgentContextCorrelation.js.map +1 -0
  85. package/dist/domain/boundedAgentContextIdentity.d.ts +26 -0
  86. package/dist/domain/boundedAgentContextIdentity.js +69 -0
  87. package/dist/domain/boundedAgentContextIdentity.js.map +1 -0
  88. package/dist/domain/boundedAgentContextProjection.d.ts +71 -0
  89. package/dist/domain/boundedAgentContextProjection.js +477 -0
  90. package/dist/domain/boundedAgentContextProjection.js.map +1 -0
  91. package/dist/domain/comparison.d.ts +220 -0
  92. package/dist/domain/comparison.js +350 -0
  93. package/dist/domain/comparison.js.map +1 -0
  94. package/dist/domain/comparisonEngine.d.ts +76 -0
  95. package/dist/domain/comparisonEngine.js +734 -0
  96. package/dist/domain/comparisonEngine.js.map +1 -0
  97. package/dist/domain/comparisonIdentity.d.ts +13 -0
  98. package/dist/domain/comparisonIdentity.js +46 -0
  99. package/dist/domain/comparisonIdentity.js.map +1 -0
  100. package/dist/domain/completion.d.ts +30 -0
  101. package/dist/domain/completion.js +22 -0
  102. package/dist/domain/completion.js.map +1 -0
  103. package/dist/domain/diagnostics.d.ts +17 -0
  104. package/dist/domain/diagnostics.js +77 -0
  105. package/dist/domain/diagnostics.js.map +1 -0
  106. package/dist/domain/evidence.d.ts +29 -0
  107. package/dist/domain/evidence.js +59 -0
  108. package/dist/domain/evidence.js.map +1 -0
  109. package/dist/domain/explicitState.d.ts +40 -0
  110. package/dist/domain/explicitState.js +54 -0
  111. package/dist/domain/explicitState.js.map +1 -0
  112. package/dist/domain/externalReference.d.ts +158 -0
  113. package/dist/domain/externalReference.js +167 -0
  114. package/dist/domain/externalReference.js.map +1 -0
  115. package/dist/domain/externalReferenceApplicability.d.ts +43 -0
  116. package/dist/domain/externalReferenceApplicability.js +52 -0
  117. package/dist/domain/externalReferenceApplicability.js.map +1 -0
  118. package/dist/domain/externalReferenceCompatibility.d.ts +40 -0
  119. package/dist/domain/externalReferenceCompatibility.js +48 -0
  120. package/dist/domain/externalReferenceCompatibility.js.map +1 -0
  121. package/dist/domain/externalReferenceFidelity.d.ts +171 -0
  122. package/dist/domain/externalReferenceFidelity.js +419 -0
  123. package/dist/domain/externalReferenceFidelity.js.map +1 -0
  124. package/dist/domain/externalReferenceIdentity.d.ts +38 -0
  125. package/dist/domain/externalReferenceIdentity.js +70 -0
  126. package/dist/domain/externalReferenceIdentity.js.map +1 -0
  127. package/dist/domain/externalReferenceImage.d.ts +35 -0
  128. package/dist/domain/externalReferenceImage.js +160 -0
  129. package/dist/domain/externalReferenceImage.js.map +1 -0
  130. package/dist/domain/externalReferenceRegionRelationships.d.ts +63 -0
  131. package/dist/domain/externalReferenceRegionRelationships.js +98 -0
  132. package/dist/domain/externalReferenceRegionRelationships.js.map +1 -0
  133. package/dist/domain/externalReferenceRegions.d.ts +65 -0
  134. package/dist/domain/externalReferenceRegions.js +105 -0
  135. package/dist/domain/externalReferenceRegions.js.map +1 -0
  136. package/dist/domain/externalReferenceRequirementIdentity.d.ts +12 -0
  137. package/dist/domain/externalReferenceRequirementIdentity.js +35 -0
  138. package/dist/domain/externalReferenceRequirementIdentity.js.map +1 -0
  139. package/dist/domain/externalReferenceRequirements.d.ts +215 -0
  140. package/dist/domain/externalReferenceRequirements.js +401 -0
  141. package/dist/domain/externalReferenceRequirements.js.map +1 -0
  142. package/dist/domain/externalReferenceRuntimeBinding.d.ts +146 -0
  143. package/dist/domain/externalReferenceRuntimeBinding.js +183 -0
  144. package/dist/domain/externalReferenceRuntimeBinding.js.map +1 -0
  145. package/dist/domain/frontendContractEvaluation.d.ts +57 -0
  146. package/dist/domain/frontendContractEvaluation.js +454 -0
  147. package/dist/domain/frontendContractEvaluation.js.map +1 -0
  148. package/dist/domain/frontendContractEvaluationArtifact.d.ts +65 -0
  149. package/dist/domain/frontendContractEvaluationArtifact.js +108 -0
  150. package/dist/domain/frontendContractEvaluationArtifact.js.map +1 -0
  151. package/dist/domain/frontendContractIdentity.d.ts +39 -0
  152. package/dist/domain/frontendContractIdentity.js +70 -0
  153. package/dist/domain/frontendContractIdentity.js.map +1 -0
  154. package/dist/domain/frontendContracts.d.ts +188 -0
  155. package/dist/domain/frontendContracts.js +260 -0
  156. package/dist/domain/frontendContracts.js.map +1 -0
  157. package/dist/domain/identity.d.ts +21 -0
  158. package/dist/domain/identity.js +47 -0
  159. package/dist/domain/identity.js.map +1 -0
  160. package/dist/domain/referenceCorrectionIdentity.d.ts +40 -0
  161. package/dist/domain/referenceCorrectionIdentity.js +77 -0
  162. package/dist/domain/referenceCorrectionIdentity.js.map +1 -0
  163. package/dist/domain/referenceCorrectionWorkflow.d.ts +160 -0
  164. package/dist/domain/referenceCorrectionWorkflow.js +165 -0
  165. package/dist/domain/referenceCorrectionWorkflow.js.map +1 -0
  166. package/dist/domain/referenceFidelityProjection.d.ts +65 -0
  167. package/dist/domain/referenceFidelityProjection.js +135 -0
  168. package/dist/domain/referenceFidelityProjection.js.map +1 -0
  169. package/dist/domain/relationships.d.ts +210 -0
  170. package/dist/domain/relationships.js +352 -0
  171. package/dist/domain/relationships.js.map +1 -0
  172. package/dist/domain/schema.d.ts +269 -0
  173. package/dist/domain/schema.js +442 -0
  174. package/dist/domain/schema.js.map +1 -0
  175. package/dist/domain/scrollEvidence.d.ts +51 -0
  176. package/dist/domain/scrollEvidence.js +134 -0
  177. package/dist/domain/scrollEvidence.js.map +1 -0
  178. package/dist/index.d.ts +114 -0
  179. package/dist/index.js +64 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/projectWorkflow/aliasCatalog.d.ts +21 -0
  182. package/dist/projectWorkflow/aliasCatalog.js +67 -0
  183. package/dist/projectWorkflow/aliasCatalog.js.map +1 -0
  184. package/dist/projectWorkflow/checkAcceptance.d.ts +25 -0
  185. package/dist/projectWorkflow/checkAcceptance.js +55 -0
  186. package/dist/projectWorkflow/checkAcceptance.js.map +1 -0
  187. package/dist/projectWorkflow/checkResult.d.ts +85 -0
  188. package/dist/projectWorkflow/checkResult.js +101 -0
  189. package/dist/projectWorkflow/checkResult.js.map +1 -0
  190. package/dist/projectWorkflow/projectConfig.d.ts +43 -0
  191. package/dist/projectWorkflow/projectConfig.js +84 -0
  192. package/dist/projectWorkflow/projectConfig.js.map +1 -0
  193. package/dist/projectWorkflow/projectDiscovery.d.ts +9 -0
  194. package/dist/projectWorkflow/projectDiscovery.js +20 -0
  195. package/dist/projectWorkflow/projectDiscovery.js.map +1 -0
  196. package/dist/projectWorkflow/projectPaths.d.ts +8 -0
  197. package/dist/projectWorkflow/projectPaths.js +23 -0
  198. package/dist/projectWorkflow/projectPaths.js.map +1 -0
  199. package/dist/request/paths.d.ts +14 -0
  200. package/dist/request/paths.js +33 -0
  201. package/dist/request/paths.js.map +1 -0
  202. package/dist/request/request.d.ts +111 -0
  203. package/dist/request/request.js +464 -0
  204. package/dist/request/request.js.map +1 -0
  205. package/dist/safety/policy.d.ts +14 -0
  206. package/dist/safety/policy.js +81 -0
  207. package/dist/safety/policy.js.map +1 -0
  208. package/dist/viewer/assets/index-CN_yb9Uf.css +1 -0
  209. package/dist/viewer/assets/index-D98S1_2d.js +9 -0
  210. package/dist/viewer/icons/icon-192.png +0 -0
  211. package/dist/viewer/icons/icon-512.png +0 -0
  212. package/dist/viewer/index.html +15 -0
  213. package/dist/viewer/manifest.webmanifest +1 -0
  214. package/dist/viewer/registerSW.js +1 -0
  215. package/dist/viewer/sw.js +1 -0
  216. package/dist/viewer/workbox-9c191d2f.js +1 -0
  217. package/dist/viewerServer/context.d.ts +48 -0
  218. package/dist/viewerServer/context.js +60 -0
  219. package/dist/viewerServer/context.js.map +1 -0
  220. package/dist/viewerServer/evidence/classify.d.ts +59 -0
  221. package/dist/viewerServer/evidence/classify.js +124 -0
  222. package/dist/viewerServer/evidence/classify.js.map +1 -0
  223. package/dist/viewerServer/evidence/comparisonView.d.ts +28 -0
  224. package/dist/viewerServer/evidence/comparisonView.js +43 -0
  225. package/dist/viewerServer/evidence/comparisonView.js.map +1 -0
  226. package/dist/viewerServer/evidence/contextSourceView.d.ts +25 -0
  227. package/dist/viewerServer/evidence/contextSourceView.js +20 -0
  228. package/dist/viewerServer/evidence/contextSourceView.js.map +1 -0
  229. package/dist/viewerServer/evidence/discovery.d.ts +31 -0
  230. package/dist/viewerServer/evidence/discovery.js +78 -0
  231. package/dist/viewerServer/evidence/discovery.js.map +1 -0
  232. package/dist/viewerServer/evidence/evaluationView.d.ts +32 -0
  233. package/dist/viewerServer/evidence/evaluationView.js +50 -0
  234. package/dist/viewerServer/evidence/evaluationView.js.map +1 -0
  235. package/dist/viewerServer/evidence/handles.d.ts +21 -0
  236. package/dist/viewerServer/evidence/handles.js +43 -0
  237. package/dist/viewerServer/evidence/handles.js.map +1 -0
  238. package/dist/viewerServer/evidence/index.d.ts +41 -0
  239. package/dist/viewerServer/evidence/index.js +82 -0
  240. package/dist/viewerServer/evidence/index.js.map +1 -0
  241. package/dist/viewerServer/evidence/limits.d.ts +27 -0
  242. package/dist/viewerServer/evidence/limits.js +28 -0
  243. package/dist/viewerServer/evidence/limits.js.map +1 -0
  244. package/dist/viewerServer/evidence/linkedEvidence.d.ts +43 -0
  245. package/dist/viewerServer/evidence/linkedEvidence.js +151 -0
  246. package/dist/viewerServer/evidence/linkedEvidence.js.map +1 -0
  247. package/dist/viewerServer/evidence/mediaResolver.d.ts +16 -0
  248. package/dist/viewerServer/evidence/mediaResolver.js +85 -0
  249. package/dist/viewerServer/evidence/mediaResolver.js.map +1 -0
  250. package/dist/viewerServer/evidence/observationView.d.ts +29 -0
  251. package/dist/viewerServer/evidence/observationView.js +46 -0
  252. package/dist/viewerServer/evidence/observationView.js.map +1 -0
  253. package/dist/viewerServer/evidence/pathSafety.d.ts +11 -0
  254. package/dist/viewerServer/evidence/pathSafety.js +31 -0
  255. package/dist/viewerServer/evidence/pathSafety.js.map +1 -0
  256. package/dist/viewerServer/evidence/projection.d.ts +55 -0
  257. package/dist/viewerServer/evidence/projection.js +152 -0
  258. package/dist/viewerServer/evidence/projection.js.map +1 -0
  259. package/dist/viewerServer/evidence/referenceView.d.ts +133 -0
  260. package/dist/viewerServer/evidence/referenceView.js +169 -0
  261. package/dist/viewerServer/evidence/referenceView.js.map +1 -0
  262. package/dist/viewerServer/httpServer.d.ts +27 -0
  263. package/dist/viewerServer/httpServer.js +381 -0
  264. package/dist/viewerServer/httpServer.js.map +1 -0
  265. package/dist/viewerServer/openBrowser.d.ts +7 -0
  266. package/dist/viewerServer/openBrowser.js +32 -0
  267. package/dist/viewerServer/openBrowser.js.map +1 -0
  268. package/dist/viewerServer/port.d.ts +16 -0
  269. package/dist/viewerServer/port.js +19 -0
  270. package/dist/viewerServer/port.js.map +1 -0
  271. package/dist/viewerServer/viewerService.d.ts +62 -0
  272. package/dist/viewerServer/viewerService.js +88 -0
  273. package/dist/viewerServer/viewerService.js.map +1 -0
  274. package/docs/ARCHITECTURE.md +1286 -0
  275. package/docs/CI_CD.md +250 -0
  276. package/docs/COMMANDS.md +972 -0
  277. package/docs/CONTRACTS.md +1856 -0
  278. package/docs/CURRENT_STATE.md +1049 -0
  279. package/docs/DEVELOPMENT.md +202 -0
  280. package/docs/DOCUMENTATION_PRESERVATION_POLICY.md +50 -0
  281. package/docs/PROJECT_DESCRIPTION.md +2221 -0
  282. package/docs/PROJECT_MILESTONES.md +2526 -0
  283. package/docs/PROJECT_OVERVIEW.md +150 -0
  284. package/docs/QUICKSTART.md +83 -0
  285. package/docs/RELEASE.md +27 -0
  286. package/docs/ROADMAP.md +641 -0
  287. package/docs/SECURITY.md +218 -0
  288. package/docs/WORKFLOWS.md +642 -0
  289. package/docs/plans/v0.8-implementation-plan.md +655 -0
  290. package/docs/plans/v0.8.1-cli-usability-patch-plan.md +505 -0
  291. package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -0
  292. package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -0
  293. package/docs/reports/v0.7-pre-release-readiness.md +337 -0
  294. package/docs/reports/v0.7-reference-binding-prompt5.md +223 -0
  295. package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -0
  296. package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -0
  297. package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -0
  298. package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -0
  299. package/docs/reports/v0.7-reference-regions-prompt2.md +195 -0
  300. package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -0
  301. package/docs/reports/v0.7-release-prep.md +423 -0
  302. package/docs/reports/v0.8-binding-fidelity-interaction-batch6.md +279 -0
  303. package/docs/reports/v0.8-bounded-context-correlation-batch7.md +233 -0
  304. package/docs/reports/v0.8-comparison-contract-inspection-batch4.md +279 -0
  305. package/docs/reports/v0.8-evidence-index-readers-batch2.md +247 -0
  306. package/docs/reports/v0.8-implementation-completeness-documentation-reconciliation.md +741 -0
  307. package/docs/reports/v0.8-integrated-viewer-acceptance-batch8.md +128 -0
  308. package/docs/reports/v0.8-observation-svg-inspection-batch3.md +223 -0
  309. package/docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md +687 -0
  310. package/docs/reports/v0.8-reference-candidate-inspection-batch5.md +232 -0
  311. package/docs/reports/v0.8-viewer-runtime-pwa-batch1.md +278 -0
  312. package/docs/reports/v0.8.1-check-orchestration-prompt2.md +69 -0
  313. package/docs/reports/v0.8.1-implementation-completeness-documentation-reconciliation.md +114 -0
  314. package/docs/reports/v0.8.1-prerelease-readiness-cross-platform-security-code-rot.md +170 -0
  315. package/docs/reports/v0.8.1-project-workflow-foundation-prompt1.md +66 -0
  316. package/package.json +58 -0
@@ -0,0 +1,195 @@
1
+ # v0.7 Prompt 2 — Explicit Reference Regions, Geometry, and Reusable Reference Relationships
2
+
3
+ ## 1. Verdict
4
+
5
+ **PASS_V0_7_REFERENCE_REGIONS_PROMPT2**
6
+
7
+ ## 2. Repository
8
+
9
+ `Z:\Users\newuser\Projects\my-frontend-observer` (`https://github.com/dailephd/my-frontend-observer.git`)
10
+
11
+ ## 3. Branch
12
+
13
+ `implementation/v0.7-reference-regions`
14
+
15
+ ## 4. Starting head
16
+
17
+ `ba61897e597451ae34f81583cbcffc8447b09738`
18
+
19
+ ## 5. Prompt 1 base head
20
+
21
+ `ba61897e597451ae34f81583cbcffc8447b09738` (same commit — the branch was created directly from Prompt 1's completed, clean state; verified as an ancestor via `git merge-base --is-ancestor`)
22
+
23
+ ## 6. Ending head
24
+
25
+ `c5c2eef66ddecb0365c2ced7d9a25f1b9e16c210`
26
+
27
+ ## 7. Git status
28
+
29
+ Clean at the ending head. The Prompt 1 speculative research-agent stash (`stray-fork-writes-preserved-for-reference: ...`) remains present, untouched, unapplied, and unmined throughout this stage — verified with `git stash list` before and after implementation.
30
+
31
+ ## 8. Resolved my-dev-kit version
32
+
33
+ `@dailephd/my-dev-kit@1.12.3` (unchanged from Prompt 1 — still the latest published version at execution start; re-checked via `npm view @dailephd/my-dev-kit version`, not assumed from memory)
34
+
35
+ ## 9. Fresh index path / ID
36
+
37
+ `.my-dev-kit/index-prompt2` — a fresh index built this stage (`my-dev-kit index --root . --src src --out .my-dev-kit/index-prompt2 --call-graph --json`), independent of Prompt 1's `.my-dev-kit/index`/`index-after` indexes (not reused as the new-behavior evidence source, per instruction). This tooling directory is gitignored and was never staged.
38
+
39
+ ## 10. Prompt 1 contract verified
40
+
41
+ Read directly from the maintained repository (not from the Prompt 1 report alone) before any change:
42
+
43
+ - `src/domain/externalReference.ts` — `ExternalReferenceArtifact` (`ImportedExternalReferenceArtifact` | `ApprovedExternalReferenceArtifact`), `isValidExternalReferenceArtifact`, `isImportedExternalReferenceArtifact`/`isApprovedExternalReferenceArtifact`, `EXTERNAL_REFERENCE_ARTIFACT_KIND`/`EXTERNAL_REFERENCE_SCHEMA_VERSION`.
44
+ - `src/domain/externalReferenceIdentity.ts` — `buildExternalReferenceRequestIdentity`/`buildExternalReferenceInstanceIdentity`.
45
+ - `src/domain/externalReferenceImage.ts` — format/dimension boundary (unchanged this stage).
46
+ - `src/artifacts/externalReferenceArtifactWriter.ts`/`Reader.ts` — atomic persistence (unchanged this stage).
47
+ - `src/application/externalReferencePersistenceService.ts` — `importExternalReference`/`approveExternalReference`.
48
+ - `src/cli.ts` — `import-reference`/`approve-reference` commands, their help text, arg parsers, and dispatch.
49
+ - `tests/unit/externalReference*.test.ts`, `cliExternalReference.test.ts` — the full Prompt 1 test suite (668 tests at the time), confirmed still green before touching anything.
50
+
51
+ The Prompt 1 report and the actual implementation matched exactly — no `BLOCKED_PROMPT1_IMPLEMENTATION_REPORT_MISMATCH` condition was encountered.
52
+
53
+ ## 11. Region model
54
+
55
+ - **Type name**: `ReferenceRegion { id: string; rectangle: ReferenceRegionRectangle }`, `ReferenceRegionRectangle { x, y, width, height }` (`src/domain/externalReferenceRegions.ts`).
56
+ - **Stable region ID semantics**: `^[A-Za-z0-9_-]{1,64}$`, unique case-insensitively within one artifact — reused verbatim from `request/request.ts`'s target-name convention (exact pattern and dedup rule).
57
+ - **Canonical coordinate representation**: only `{x, y, width, height}` is authored/canonical; everything else is derived.
58
+ - **Coordinate origin/unit**: top-left of the reference image; x rightward, y downward; unit is reference-image pixels (explicitly not CSS pixels); coordinates may be fractional.
59
+ - **Numeric rules**: `x`/`y` finite and ≥ 0; `width`/`height` finite and > 0 (zero/negative/non-finite all rejected, never clamped).
60
+ - **Image-boundary rule**: a region's derived `right`/`bottom` must not exceed the owning image's own already-validated width/height; rejected outright otherwise, exact-boundary regions accepted.
61
+ - **Region-count bound**: `MAX_REFERENCE_REGIONS = 20` — a maximum capacity only, matching `request/request.ts`'s `MAX_TARGETS` value (independently owned constant, not imported/coupled).
62
+ - **Deterministic ordering rule**: authored array order is preserved and treated as semantic (never re-sorted), mirroring `domain/identity.ts`'s treatment of configured targets — both for identity hashing and for relationship derivation.
63
+
64
+ ## 12. Derived geometry
65
+
66
+ - **Exact derived anchors**: `deriveReferenceRegionGeometry(rectangle) -> { x, y, width, height, right, bottom, centerX, centerY }` — a pure function, called fresh every time.
67
+ - **What is persisted**: only `{id, rectangle: {x, y, width, height}}` per region, inside the artifact's optional `regions` array.
68
+ - **What is computed**: `right`, `bottom`, `centerX`, `centerY` — never stored, so `x + width` can never disagree with a stored `right` (there is no stored `right`).
69
+ - **Normalized-coordinate decision**: not implemented in this stage. No normalized (`x / imageWidth`, etc.) field exists anywhere; if useful later, it would be derived on demand from the canonical rectangle plus the artifact's own image dimensions, never a second stored source of truth. This was a deliberate scope decision (request section 18 explicitly permits deferring it), not an oversight.
70
+
71
+ ## 13. Relationship precedent review
72
+
73
+ - **Exact v0.4 owners inspected**: `src/domain/relationships.ts` (full file, 440 lines before this stage) — `PAIRWISE_RELATIONSHIP_KINDS`, `EvidenceReference`/`isValidEvidenceReference`, `LayoutRelationshipGraph`, `MAX_CONFIGURED_TARGETS_FOR_RELATIONSHIPS`/`MAX_PAIRWISE_RELATIONSHIP_RECORDS`, and the six pure predicates `horizontalOrderOf`/`verticalOrderOf`/`areaOverlapOf`/`relativeWidthOf`/`geometricFitOf`/`verticalSequenceOf` plus `deriveLayoutRelationships`'s pairwise-loop structure.
74
+ - **Relationship families reused**: all six geometry-only families — horizontal order, vertical order, area overlap, relative width, geometric fit, vertical sequencing.
75
+ - **Relationship families rejected as runtime-only**: `document-width-fits-viewport`/`document-width-exceeds-viewport` (page-level, needs document/viewport evidence a static image doesn't have); DOM containment (`TargetContainment` in `schema.ts` — explicitly documented there as never a layout/relationship graph concept, and an external image exposes no DOM at all); scroll ownership, runtime visibility, browser clipping, and semantic/accessibility relationships (all require live browser evidence).
76
+ - **Shared geometry primitives extracted**: yes — the six predicate functions were changed from private to `export`ed in `relationships.ts` with **zero formula changes** (verified by diff: only the `function` keyword gained `export`, one added a doc comment). `PAIRWISE_RELATIONSHIP_KINDS`, `EvidenceReference`, and `isValidEvidenceReference` were already exported and are imported as-is.
77
+ - **Proof v0.4 semantics did not change**: `npm test` (full suite), `npm run test:browser`, and a targeted run of `tests/unit/relationships.test.ts`, `relationshipDerivation.test.ts`, `comparisonEngine.test.ts`, and `frontendContractEvaluation.test.ts` all pass with identical counts to before this stage (132 tests across those four files, unchanged). No `BLOCKED_RELATIONSHIP_REUSE_REQUIRES_SEMANTIC_CHANGE` condition was encountered.
78
+
79
+ ## 14. Reference relationship model
80
+
81
+ - **Type/function names**: `ReferenceRegionRelationship { kind: PairwiseRelationshipKind; subjectRegion: string; relatedRegion: string; evidence: EvidenceReference[] }`, `ReferenceRegionRelationshipGraph { referenceRequestId, geometryTolerancePx, regions: string[], pairwiseRelationships }`, `deriveReferenceRegionRelationships(referenceRequestId, regions, options)`, `isValidReferenceRegionRelationship`/`isValidReferenceRegionRelationshipGraph` (`src/domain/externalReferenceRegionRelationships.ts`).
82
+ - **Bounds**: `MAX_REFERENCE_REGION_PAIRS = 20*19/2 = 190`, `REFERENCE_REGION_RELATIONSHIP_FAMILY_COUNT = 6`, `MAX_REFERENCE_REGION_RELATIONSHIP_RECORDS = 1140` — the same bounding shape as `relationships.ts`'s `MAX_PAIRWISE_RELATIONSHIP_RECORDS`, over `MAX_REFERENCE_REGIONS` instead of the runtime-target limit.
83
+ - **Provenance model**: `evidence: [{ path: 'regions.<id>.rectangle' }, ...]` — never a `targetEvidence`/browser path; a relationship never claims runtime-target or DOM provenance (verified directly by test).
84
+ - **Deterministic ordering**: earlier-authored region is always `subjectRegion` for every family except `follows-vertically` (direction decided by actual geometry, matching `deriveLayoutRelationships` exactly); same input always produces the identical graph (verified by test).
85
+ - **Persistence decision**: relationships are **not persisted** on the artifact — always re-derivable on demand from the artifact's own `regions` field, eliminating any possibility of a stored relationship graph drifting from the region data.
86
+
87
+ ## 15. Schema / artifact decision
88
+
89
+ - **Prompt 1 artifact schema changed**: yes, additively — one new optional field, `regions?: ReferenceRegion[]`, on both `ImportedExternalReferenceArtifact` and `ApprovedExternalReferenceArtifact`.
90
+ - **Schema version decision**: **no bump** — `EXTERNAL_REFERENCE_SCHEMA_VERSION` remains `'1.0.0'`. Rationale: the field is genuinely optional and additive with no other coupled behavior change; bumping would force a strict-equality version check (this repository's established `isValid*Artifact` convention) to reject every Prompt 1 artifact, which directly contradicts the explicit "legacy Prompt 1 reference remains valid/readable" requirement. This differs from the observation family's historical per-batch version-bump convention; documented here as a deliberate, evidence-based departure, not an oversight.
91
+ - **Historical Prompt 1 artifacts remain readable/valid**: yes — verified directly by test (`'a legacy (Prompt 1) artifact with no regions field at all remains valid'`), and by construction (`isValidExternalReferenceArtifact` only validates `regions` when the key is present).
92
+ - **Structured regions and logical identity**: `buildExternalReferenceRequestIdentity` gained an additive, optional trailing `regions` parameter. When omitted, it is left out of the hashed semantic view entirely (not defaulted to `null`, unlike `supersedesReferenceId`) so every Prompt 1 call site — and every Prompt 2 call with no regions — produces the byte-identical hash Prompt 1 already produced. When present, region content (id, rectangle, and authored order) is fully identity-bearing.
93
+ - **Immutable approved artifacts preserved**: `approveExternalReference` carries `imported.regions` forward verbatim (a plain copy, never re-validated or re-derived) into a **new** artifact instance; the imported artifact's own manifest is never opened for writing again. No code path in this stage ever mutates an existing persisted manifest.
94
+
95
+ ## 16. Public interface
96
+
97
+ - **CLI changes**: `import-reference` gained an optional `--regions-file <json-file>` (root shape `{ "regions": [...] }`, validated by a new `loadRegionsFile` mirroring `loadTargetsFile` exactly — object root, exact allow-listed top-level field, JSON parse/read errors surfaced as `error:` lines). Both `import-reference` and `approve-reference` now print an additional `Regions: <count>` line. No existing flag, argument, or exit-code behavior changed.
98
+ - **Programmatic export changes**: `src/index.ts` additively exports the complete new region/relationship type, constant, and function surface (`ReferenceRegion`, `ReferenceRegionRectangle`, `ReferenceRegionGeometry`, `deriveReferenceRegionGeometry`, `isValidReferenceRegion(s)`, `REFERENCE_REGION_ID_PATTERN`, `MAX_REFERENCE_REGIONS`, `ReferenceRegionRelationship`, `ReferenceRegionRelationshipGraph`, `deriveReferenceRegionRelationships`, `isValidReferenceRegionRelationship(Graph)`, plus the `MAX_REFERENCE_REGION_*` bound constants), and the two Prompt 1 type guards (`isImportedExternalReferenceArtifact`/`isApprovedExternalReferenceArtifact`) that had not yet been exported. `ImportExternalReferenceOptions` gained an additive `regions?` field; both application-result types gained an additive `regionCount: number` field.
99
+ - **Exact user/config input shape**: `{ "regions": [ { "id": "current-page-card", "rectangle": { "x": 28, "y": 92, "width": 424, "height": 82 } }, ... ] }` — chosen after precedent review (matches `--targets-file`'s object-root-wrapper convention) rather than the prompt's illustrative nested YAML-style example.
100
+ - **Backward compatibility**: every Prompt 1 CLI invocation and every existing `ApplicationImportExternalReferenceResult`/`ApplicationApproveExternalReferenceResult` consumer reading the pre-existing fields continues to work unchanged — verified by the full pre-existing test suite passing unmodified, plus a dedicated test confirming a regionless import reports `regionCount: 0` and no `regions` key on the manifest.
101
+
102
+ ## 17. Files changed
103
+
104
+ Modified: `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/CURRENT_STATE.md`, `docs/WORKFLOWS.md`, `src/application/externalReferencePersistenceService.ts`, `src/cli.ts`, `src/domain/diagnostics.ts`, `src/domain/externalReference.ts`, `src/domain/externalReferenceIdentity.ts`, `src/domain/relationships.ts` (six predicates made `export`, formulas unchanged), `src/index.ts`, `tests/unit/cliExternalReference.test.ts`, `tests/unit/externalReference.test.ts`, `tests/unit/externalReferenceIdentity.test.ts`, `tests/unit/externalReferencePersistenceService.test.ts`.
105
+ New: `src/domain/externalReferenceRegions.ts`, `src/domain/externalReferenceRegionRelationships.ts`, `tests/unit/externalReferenceRegions.test.ts`, `tests/unit/externalReferenceRegionRelationships.test.ts`.
106
+
107
+ ## 18. Tests added / changed
108
+
109
+ 51 new tests across 2 new files and additions to 4 existing files (0 pre-existing test modified or removed):
110
+
111
+ - `externalReferenceRegions.test.ts` (18 tests): derived geometry correctness/non-contradiction, id pattern/length/duplicate rejection, finite/negative/zero-size rejection, multi-region acceptance, out-of-bounds rejection (with exact-boundary acceptance), region-count bound (exactly-max accepted, one-over rejected), immutability.
112
+ - `externalReferenceRegionRelationships.test.ts` (13 tests): horizontal/vertical order, overlap, relative width, geometric fit (with an explicit assertion that no DOM-containment-shaped field exists), vertical sequencing directed by geometry, determinism, evidence-path provenance (never `targetEvidence`), pair-count bound, tolerance validation, single-region no-relationships case, immutability, graph validator accept/reject.
113
+ - `externalReferenceIdentity.test.ts` (+8 tests): backward-compatible omission, same-content-same-identity, geometry-change/add/remove/rename-changes-identity, authored-order-is-semantic.
114
+ - `externalReference.test.ts` (+6 tests): legacy-no-regions-field validity, valid regions on both lifecycle variants, out-of-bounds rejection with a `"regions:"`-prefixed reason, malformed-value rejection, duplicate-id rejection.
115
+ - `externalReferencePersistenceService.test.ts` (+7 tests): import-with-regions persists them with correct count, regionless import has no `regions` key, out-of-bounds/duplicate-id import rejection (nothing persisted), approval carries regions forward (and forward "no regions" correctly), approved-artifact-manifest-never-mutated-by-later-activity.
116
+ - `cliExternalReference.test.ts` (+5 tests): end-to-end `--regions-file` import+approve, legacy no-flag invocation reports zero regions, out-of-bounds region CLI rejection, malformed-`--regions-file` rejection (bad JSON, array root, unknown top-level field).
117
+
118
+ ## 19. Validation results
119
+
120
+ All on commit `c5c2eef` on `implementation/v0.7-reference-regions`:
121
+
122
+ | Command | Result |
123
+ |---|---|
124
+ | `npm run typecheck` | PASS |
125
+ | `npm run lint` | PASS |
126
+ | `npm test` | PASS — 40 files, 719 tests (up from 38/668) |
127
+ | `npm run build` | PASS (both new modules compiled into `dist/`) |
128
+ | `npm run check:docs` | PASS (17 required files) |
129
+ | `git diff --check` | PASS |
130
+ | `npm pack --dry-run` | PASS (166 files, 304.2 kB / 1.3 MB unpacked; both new modules present in the tarball listing) |
131
+ | `npm run test:browser` | PASS — 9 files, 120 tests (unchanged count) |
132
+ | `npm run test:security` | PASS — 68 tests |
133
+
134
+ ## 20. Regression results
135
+
136
+ - **Prompt 1 tests**: all 668 pre-existing tests (including every `externalReference*`/`cliExternalReference` test) pass unmodified.
137
+ - **v0.4 relationship/comparison tests**: `relationships.test.ts`, `relationshipDerivation.test.ts`, `comparisonEngine.test.ts` — 132 combined tests (with `frontendContractEvaluation.test.ts`) pass unchanged; the six predicate functions' formulas are byte-identical to before (only their export visibility changed).
138
+ - **v0.5 dependent tests**: `frontendContractEvaluation.test.ts`, `frontendContractPersistence.test.ts`, `frontendContracts.test.ts` all pass unchanged (part of the full 719-test run).
139
+ - **v0.6 tests**: `boundedAgentContext*.test.ts` (4 files) pass unchanged.
140
+
141
+ ## 21. Boundedness
142
+
143
+ - **Region bound**: `MAX_REFERENCE_REGIONS = 20` per artifact — explicit, tested at exactly-max (accepted) and one-over (rejected, no partial acceptance).
144
+ - **Relationship/pair bound**: `MAX_REFERENCE_REGION_PAIRS = 190` pairs × 6 families = `MAX_REFERENCE_REGION_RELATIONSHIP_RECORDS = 1140` records maximum — explicit, tested at exactly-max region count.
145
+ - **One-over behavior**: both the region-collection validator and the relationship-derivation function reject a one-over-bound input outright (`{valid:false}` / `{ok:false}`) — never a silently truncated partial result.
146
+
147
+ ## 22. Identity tests
148
+
149
+ - **Path-independence**: `buildExternalReferenceRequestIdentity` takes no path argument at all (structurally impossible for an operational path to leak in); confirmed at the application level by `'produces the same referenceRequestId for byte-identical images from different output roots'` (extended in spirit by the new region tests, which exercise the same function directly).
150
+ - **Region-content identity behavior**: same content → same identity (tested); geometry change → different identity (tested); add/remove region → different identity (tested, both directions); rename → different identity (tested); authored order → part of identity (tested); omission of the parameter entirely → byte-identical to the pre-Prompt-2 hash (tested explicitly).
151
+
152
+ ## 23. Immutability
153
+
154
+ - No code path in `externalReferencePersistenceService.ts` opens an existing manifest file for writing — `writeExternalReferenceArtifact` always writes to a fresh temp directory and renames to a fresh `referenceId` directory that is verified not to already exist (Prompt 1 behavior, unchanged and re-verified this stage).
155
+ - Direct test proof: importing a reference with regions, approving it, then performing unrelated later activity in the same output directory, re-reads the approved artifact's manifest byte-for-byte identical to before that later activity (`'an approved artifact's manifest is never mutated by any later import/approve call'`).
156
+ - `approveExternalReference` reads the imported artifact's `regions` and copies the array reference into a new object literal — it never mutates the `imported` object in memory either (confirmed by TypeScript's structural typing plus the existing "never mutates" test convention carried into the new tests).
157
+
158
+ ## 24. Security / privacy impact
159
+
160
+ No new network calls, no vision/AI API calls, no OCR, no automatic segmentation. `--regions-file`'s path is never persisted or included in any identity (same convention as `--targets-file`/`--contract-file`) — only its parsed, validated `regions` content reaches the artifact. Region geometry is plain numeric data; no new file-system write boundary was introduced (regions are embedded directly in the existing `manifest.json`, never a separate file). The unsupported-top-level-field rejection on `--regions-file`'s root prevents silently ignored/misinterpreted malformed input.
161
+
162
+ ## 25. Documentation changes
163
+
164
+ Additive sections only: `docs/CONTRACTS.md` ("v0.7 Prompt 2 explicit reference regions and relationships" — the primary contract reference, with the exact type shapes and key rules), `docs/ARCHITECTURE.md` (relationship of the new region/relationship modules to the existing engine boundaries and to Prompt 1), `docs/CURRENT_STATE.md` ("v0.7 Prompt 2 status" section, plus updated "Not implemented"/"Next target"), `docs/WORKFLOWS.md` (the extended import/approve workflow diagram, the new relationship-derivation description, and a correction to the "Planned v0.7 reference-driven correction flow" first bullets marking regions/relationships as now implemented). `docs/ROADMAP.md` was **not** touched. `docs/COMMANDS.md` was **not** touched, consistent with Prompt 1's own precedent of not documenting `import-reference`/`approve-reference` there.
165
+
166
+ ## 26. Tooling incidents
167
+
168
+ None this stage. No background/subagent write occurred during Prompt 2's implementation. The Prompt 1 speculative-write incident is historical (recorded in the Prompt 1 report) and its stash was confirmed untouched at both the start and end of this stage.
169
+
170
+ ## 27. Inherited orchestrator heuristic issue
171
+
172
+ Not re-encountered as a product problem. Per instruction, `my-dev-kit-orchestrator` was not modified and no test was rewritten to satisfy its responsibility-mapping heuristic; this stage used `DIRECT_IMPLEMENTATION` and did not invoke the orchestrator's stage-context workflow at all, so the heuristic gap noted in Prompt 1 did not arise here.
173
+
174
+ ## 28. Out-of-scope confirmation
175
+
176
+ This stage did **not** implement: selected design requirements, requested/expected-dependent/protected/preserved requirement mapping, design tolerance semantics, reference-evidence adequacy or sufficiency scoring, theme/application-state identity or compatibility evaluation, reference-region↔runtime-target binding, reference-vs-candidate fidelity evaluation, style/color/typography/pixel/image-similarity comparison, bounded visual correction packets, coding-agent invocation or correction, candidate rerender orchestration, the viewer, annotation, automatic segmentation/computer vision, or screenshot-to-code/raster-to-vector reconstruction. Confirmed by direct grep of the new source files for that vocabulary (none found outside explicit "not implemented here" documentation comments).
177
+
178
+ ## 29. Known limitations
179
+
180
+ 1. Normalized (0–1 range) region coordinates are not implemented — deliberately deferred per request section 18; if needed later, they should be derived on demand from the canonical rectangle plus image dimensions, never a second stored source of truth.
181
+ 2. `--regions-file` is the only public entry point for authoring regions in this stage — there is no way to retroactively attach regions to an already-imported Prompt 1 reference without re-supplying the original image bytes and re-running `import-reference`. This was a deliberate minimal-surface choice (Option A from the architecture review, not Option B); re-supplying a local image file is cheap and the resulting artifact is a legitimately distinct logical reference, not a duplicate.
182
+ 3. No fuzz-testing of adversarial region JSON beyond the specific malformed-shape cases already covered (bad JSON, array root, unknown field, non-object entry) — consistent with Prompt 1's own documented fuzz-testing scope boundary.
183
+
184
+ ## 30. Remaining risks
185
+
186
+ - The `MAX_REFERENCE_REGIONS = 20` bound is a coincidental value-match with `request/request.ts`'s `MAX_TARGETS`, independently owned. A future change to one must not be assumed to require changing the other; this report documents that they are not structurally coupled, to prevent an accidental future assumption otherwise.
187
+ - Because relationships are never persisted, every consumer that wants them must call `deriveReferenceRegionRelationships` itself. Prompt 3+ should be aware this is a deliberate choice (avoids drift) rather than an oversight, so it is not "fixed" by prematurely adding persistence.
188
+
189
+ ## 31. Exact next action
190
+
191
+ **v0.7 Prompt 3** — selected design requirements, tolerance semantics, and reference-evidence adequacy.
192
+
193
+ ## 32. Report path
194
+
195
+ `docs/reports/v0.7-reference-regions-prompt2.md` (this file)
@@ -0,0 +1,217 @@
1
+ # v0.7 Prompt 3 — Selected Design Requirements, Tolerance Semantics, and Reference-Evidence Adequacy
2
+
3
+ ## 1. Verdict
4
+
5
+ **PASS_V0_7_REFERENCE_REQUIREMENTS_PROMPT3**
6
+
7
+ ## 2. Repository
8
+
9
+ `Z:\Users\newuser\Projects\my-frontend-observer` (`https://github.com/dailephd/my-frontend-observer.git`)
10
+
11
+ ## 3. Branch
12
+
13
+ `implementation/v0.7-reference-requirements`
14
+
15
+ ## 4. Starting head
16
+
17
+ `3a4a2e3b2968b5788e6f3b11a3cda6d83053d9cb`
18
+
19
+ ## 5. Prompt 2 base head
20
+
21
+ `3a4a2e3b2968b5788e6f3b11a3cda6d83053d9cb` (same commit — the branch was created directly from Prompt 2's completed, clean state; verified as an ancestor via `git merge-base --is-ancestor` for both `c5c2eef` and `3a4a2e3`)
22
+
23
+ ## 6. Ending head
24
+
25
+ `4d7bd610d8b3ca8ed6e228eee39e08003c21161c` (implementation commit; the report commit that follows this file's own commit will be one ahead of this)
26
+
27
+ ## 7. Git status
28
+
29
+ Clean at the ending head. The Prompt 1 speculative-write stash (`stray-fork-writes-preserved-for-reference: ...`) remains present, untouched, unapplied, unmined, verified via `git stash list` at both the start and end of this stage.
30
+
31
+ ## 8. Resolved my-dev-kit version
32
+
33
+ `@dailephd/my-dev-kit@1.12.3` (re-checked via `npm view @dailephd/my-dev-kit version` at execution start — unchanged from Prompt 1/2, still latest)
34
+
35
+ ## 9. Fresh index path / ID
36
+
37
+ `.my-dev-kit/index-prompt3` — a fresh index built this stage (`my-dev-kit index --root . --src src --out .my-dev-kit/index-prompt3 --call-graph --json`), independent of the Prompt 1/2 indexes. Gitignored, never staged.
38
+
39
+ ## 10. Previous contract verification
40
+
41
+ Read directly from the maintained repository before any change:
42
+
43
+ - `src/domain/externalReference.ts` — `ExternalReferenceArtifact` (imported/approved variants), `isValidExternalReferenceArtifact`, the `regions?` field and its validation wiring (Prompt 2).
44
+ - `src/domain/externalReferenceRegions.ts` — `ReferenceRegion`, `ReferenceRegionGeometry`, `deriveReferenceRegionGeometry`, `isValidReferenceRegions`, `MAX_REFERENCE_REGIONS`, `REFERENCE_REGION_ID_PATTERN`.
45
+ - `src/domain/externalReferenceRegionRelationships.ts` — `deriveReferenceRegionRelationships`, `ReferenceRegionRelationship`, bound constants.
46
+ - `src/domain/externalReferenceIdentity.ts` — `buildExternalReferenceRequestIdentity`'s existing `regions` backward-compatible-omission pattern (directly extended, not redesigned).
47
+ - `src/application/externalReferencePersistenceService.ts` — `importExternalReference`/`approveExternalReference`'s existing region-handling shape.
48
+ - `src/cli.ts` — `import-reference`/`approve-reference`'s existing `--regions-file` handling and `loadRegionsFile` pattern.
49
+ - The full Prompt 1/2 test suite (719 tests at the time), confirmed green before touching anything.
50
+
51
+ Prompt 1/2 reports and current source matched exactly — no `BLOCKED_PREVIOUS_PROMPT_REPORT_MISMATCH` condition was encountered.
52
+
53
+ ## 11. v0.5 precedent review
54
+
55
+ - **Exact category types inspected**: `src/domain/frontendContracts.ts` — `AUTHORED_CHANGE_SCOPE_CATEGORIES`/`AuthoredChangeScopeCategory`/`isAuthoredChangeScopeCategory` (`requested`/`expected-dependent`/`protected`/`preserved`; `'unexpected'` is a separate, derived-only `CHANGE_SCOPE_CLASSIFICATIONS` member, never authorable), `EXPECTED_DEPENDENT_MODES`/`ExpectedDependentMode`/`isValidExpectedDependentMode` (`required`/`permitted`).
56
+ - **Contract primitive witnesses**: `ContractPrimitive`'s closed vocabulary and `hasOnlyKeys` discipline (structural style precedent, not directly reused — Prompt 3's subjects are a different, reference-specific shape).
57
+ - **Tolerance witnesses**: `ContractTolerance` (`exact`/`absolute-px`/`percent`) and its bounds (`CONTRACT_TOLERANCE_ABSOLUTE_PX_MIN/MAX` = 0/100, `_PERCENT_MIN/MAX` = 0/100), and `frontendContractEvaluation.ts#toleranceToPx`'s "percent denominator is the before-value" convention.
58
+ - **Conflict semantics inspected**: `frontendContractEvaluation.ts#primitivesConflict`/`evaluateFrontendContract`'s per-clause conflict detection — confirmed this runs at **runtime evaluation time** against actual before/after `ObservationArtifact` evidence (`toClauseResult`, `EvalContext`), not at authoring time.
59
+ - **What was reused**: `AuthoredChangeScopeCategory`/`AUTHORED_CHANGE_SCOPE_CATEGORIES`/`isAuthoredChangeScopeCategory` and `ExpectedDependentMode`/`EXPECTED_DEPENDENT_MODES`/`isValidExpectedDependentMode` are imported **directly** from `frontendContracts.ts` (zero duplication) — these types carry no runtime-only coupling in their own definition, so direct reuse was safe and correct. The `CONTRACT_TOLERANCE_*` numeric bound *values* (0–100 for both absolute and percent) were mirrored as independently-owned constants.
60
+ - **What was not reused, and why**:
61
+ - `ContractTolerance` was **not** reused as a type — its `absolute-px` member is implicitly runtime/CSS pixels (compared against live `TargetGeometry`); reusing it for reference-image pixels would silently mislabel the unit, which request section 20 explicitly forbids. A new `ReferenceRequirementTolerance` type was introduced instead, with the same numeric bounds but an explicitly-named `absolute-reference-px` kind.
62
+ - `primitivesConflict`/the whole runtime conflict-detection pass was **not** reused — it operates over before/after `ObservationArtifact` evidence that does not exist at this authoring-time stage. Prompt 3 instead restricts invalid combinations directly: no two requirements in a collection may share the same structural subject, regardless of category (see section 25).
63
+
64
+ ## 12. v0.6 adequacy precedent review
65
+
66
+ - **Exact types/functions inspected**: `src/domain/boundedAgentContext.ts` — `Adequacy { state; reasons }`, `AdequacyState` (`adequate`/`partial`/`inadequate`), `ADEQUACY_REASON_CODES` (`required-runtime-target-unavailable`, `static-correlation-ambiguous`, `consumer-incompatibility`, etc.), `isValidAdequacy`.
67
+ - **Whether the `Adequacy` type was reused**: no.
68
+ - **Whether a separate reason family was introduced**: yes — `REFERENCE_REQUIREMENT_ADEQUACY_STATES` (a freshly-declared, textually-identical three-value vocabulary: `adequate`/`partial`/`inadequate`) and `REFERENCE_REQUIREMENT_ADEQUACY_REASON_CODES` (exactly two codes: `no-selected-requirements`, `missing-reference-relationship-evidence`), both owned by `externalReferenceRequirements.ts`.
69
+ - **Why**: `boundedAgentContext.ts`'s reason codes describe runtime-target availability and static-correlation ambiguity — concerns that do not exist at this stage (there is no runtime target, no candidate, no static correlation yet). Reusing that exact reason-code union would either force nonsensical codes onto reference-side adequacy or silently expand a runtime-specific vocabulary to mean something unrelated - both violate the explicit "must not mislabel reference adequacy as bounded-agent-context adequacy" requirement. The three-state *shape* (`adequate`/`partial`/`inadequate`) is coincidentally identical text but is an independently-declared constant in the reference module, following this repository's established convention of duplicating small shared vocabularies per family (e.g. `canonicalize()` duplicated five times) rather than cross-importing between otherwise-unrelated domains.
70
+
71
+ ## 13. Requirement model
72
+
73
+ - **Actual type names**: `ExternalReferenceRequirement`, `RawReferenceRequirement` (unidentified authored input), `ReferenceRequirementSubject` (`RegionPropertyRequirementSubject | RegionRelationshipRequirementSubject | RegionMeasurementRequirementSubject`), all in `src/domain/externalReferenceRequirements.ts`.
74
+ - **Requirement ID semantics**: `requirementId` is **always system-computed** via `buildReferenceRequirementIdentity(subject, category, tolerance, expectedDependentMode)` (`src/domain/externalReferenceRequirementIdentity.ts`, mirroring `frontendContractIdentity.ts#buildClauseIdentity`'s exact canonicalize+sha256 shape). Authoring a `requirementId` in raw input is a validation error (`isValidRawReferenceRequirement` rejects it) — deliberately different from v0.5's `clauseId` (which authors do supply, because clauses need a cross-document-reference id for `supersedesBaselineClauseIds`; requirements have no equivalent need yet).
75
+ - **Category semantics**: exactly v0.5's `AuthoredChangeScopeCategory`, imported directly. `expectedDependentMode` required iff category is `expected-dependent`, forbidden otherwise (identical shape to `isValidPerChangeClause`'s rule).
76
+ - **Supported subjects**: `region-property` (one region + `ReferenceRequirementRegionProperty`), `region-relationship` (two regions + `PairwiseRelationshipKind`, reused from `relationships.ts`, geometry-only families only), `region-measurement` (two regions + `ReferenceRequirementMeasurement`).
77
+ - **Supported properties**: `REFERENCE_REQUIREMENT_REGION_PROPERTIES = ['x','y','width','height','right','bottom','centerX','centerY']` — exactly `ReferenceRegionGeometry`'s own fields, nothing invented (no separate `left`/`top` aliases).
78
+ - **Relationship/measurement requirements**: relationship subjects reuse Prompt 2's `PairwiseRelationshipKind` vocabulary directly (no tolerance permitted — a categorical fact). Measurement subjects use one of six pure derived measurements: `vertical-gap`, `horizontal-gap`, `center-x-delta`, `center-y-delta`, `left-edge-delta`, `right-edge-delta` (a tolerance is required).
79
+ - **Bounds**: `MAX_REFERENCE_REQUIREMENTS = 50` per artifact — a maximum capacity, never a required minimum; no per-region sub-cap was added (the overall bound plus the duplicate-subject rule already bounds practical growth well within it).
80
+
81
+ ## 14. Tolerance model
82
+
83
+ - **Exact tolerance kinds**: `ReferenceRequirementTolerance = { kind: 'exact' } | { kind: 'absolute-reference-px'; amount } | { kind: 'percent'; amount }`.
84
+ - **Units**: `absolute-reference-px` is explicitly reference-image pixels, never silently treated as CSS/runtime pixels — no scale/compatibility mapping exists yet (deferred to Prompt 6, per request section 20).
85
+ - **Bounds**: `REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MIN/MAX = 0/100`, `_PERCENT_MIN/MAX = 0/100` — same numeric values as v0.5's `CONTRACT_TOLERANCE_*` constants, independently owned (not imported) for the unit-labeling reason above.
86
+ - **Validation**: negative, non-finite, and unsupported-kind tolerances fail closed (`isValidReferenceRequirementTolerance`); an `exact` tolerance permits no `amount` field at all.
87
+ - **Relationship vs numeric applicability**: `region-relationship` subjects must **not** carry a tolerance (categorical fact); `region-property`/`region-measurement` subjects **must** carry one — enforced explicitly, in both directions, by `validateAuthoredRequirementFields`.
88
+ - **Reuse of v0.5**: numeric bounds mirrored (see section 11); the type itself is a fresh, reference-owned type, not a v0.5 reuse (see section 11's rationale).
89
+
90
+ ## 15. Reference expectation derivation
91
+
92
+ Nothing is stored beyond `{subject, category, expectedDependentMode?, tolerance?}` per requirement — no numeric expected value (e.g. `width: 424`) and no relationship-match boolean are ever persisted. `deriveReferenceRequirementExpectation(subject, regions, options)` is a pure function computing, on demand:
93
+
94
+ - for `region-property`: the named region's `ReferenceRegionGeometry[property]`, freshly derived from its canonical rectangle every call;
95
+ - for `region-measurement`: the named pure measurement over the two regions' derived geometries;
96
+ - for `region-relationship`: whether the reference actually exhibits the claimed relationship, by deriving the region pair's relationships via `deriveReferenceRegionRelationships` and checking within the **correct relationship family** (a bug caught and fixed during test-writing — see section 20) for a match in either declared or geometry-determined order (only `follows-vertically` can differ from declared order, since it is the one family whose direction depends on actual geometry rather than input order).
97
+
98
+ This directly satisfies the "avoid redundant storage, derive from canonical geometry" instruction — there is no possibility of a stored expected value drifting from the region it describes, because none is ever stored.
99
+
100
+ ## 16. Adequacy model
101
+
102
+ - **Status vocabulary**: `REFERENCE_REQUIREMENT_ADEQUACY_STATES = ['adequate', 'partial', 'inadequate']`.
103
+ - **Reason codes**: exactly two — `no-selected-requirements`, `missing-reference-relationship-evidence`. No other reason code exists because no other condition is possible: an unknown region id, unsupported property, or malformed requirement is a **construction-time validation failure** (`isValidReferenceRequirements`) that never reaches adequacy computation at all.
104
+ - **Zero-requirement behavior**: explicitly `inadequate`, with a `no-selected-requirements` reason — a documented product decision (request section 24F): a region-rich, fully-valid reference is still not usable for a correction task until the user has actually selected what matters.
105
+ - **Missing-region behavior**: not an adequacy concern — rejected at validation time before adequacy ever runs (see section 11's "what was not reused" discussion of the D behavior choice: "authored reference requirement pointing to a nonexistent authored region should fail validation rather than become normal unavailable evidence").
106
+ - **Missing-relationship-evidence behavior**: a structurally-valid `region-relationship`/`region-measurement` requirement whose claimed evidence cannot actually be derived from the geometry (wrong relationship, or a measurement that is geometrically undefined, e.g. `vertical-gap` between overlapping regions) is reported `missing-reference-relationship-evidence`, contributing to a `partial` or `inadequate` overall status.
107
+ - **Deterministic ordering**: reasons are pushed in authored-requirement-array order, never object-key or Set-iteration order — verified by test.
108
+ - **Blocking intent for later stages**: `ReferenceRequirementAdequacy` is returned by both `importExternalReference`/`approveExternalReference` and printed by the CLI (`Adequacy: <status>`) so a later orchestration stage can enforce "inadequate reference → do not begin correction" without Prompt 3 itself running any coding-agent workflow.
109
+
110
+ ## 17. Identity
111
+
112
+ - `buildExternalReferenceRequestIdentity` gained one additional optional trailing parameter, `requirements?: readonly ExternalReferenceRequirement[]`, following the exact `regions` precedent: omitted from the hashed semantic view entirely (never defaulted to `null`) when absent, so every Prompt 1/2 call site — and every Prompt 3 call with no requirements — produces a byte-identical hash to before this parameter existed (verified by test: `'omitting requirements produces the exact same identity as before this parameter existed'`).
113
+ - Path independence: the function still takes no path argument of any kind; this holds by construction, not merely by test.
114
+ - Content participation: verified by test that changing a requirement's category, adding, or removing a requirement each changes the artifact-level `referenceRequestId`. Each requirement's own `requirementId` additionally changes with its subject/category/mode/tolerance (tested directly in `externalReferenceRequirementIdentity.test.ts`), so a change to any requirement changes both that requirement's own id and the artifact-level identity.
115
+
116
+ ## 18. Artifact / schema decision
117
+
118
+ - Requirements live as an additive, optional `requirements?: ExternalReferenceRequirement[]` field directly on `ExternalReferenceArtifactBase` (both `ImportedExternalReferenceArtifact` and `ApprovedExternalReferenceArtifact` inherit it) — the same minimal-extension shape as Prompt 2's `regions`, not a separate derived artifact family (no new persisted artifact kind was introduced).
119
+ - **No schema version bump** — `EXTERNAL_REFERENCE_SCHEMA_VERSION` remains `'1.0.0'`, for the identical reasoning already established in the Prompt 2 report: the field is genuinely optional/additive, and this repository's `isValid*Artifact` convention performs a strict version-equality check, so bumping would make every Prompt 1/2 artifact fail validation under the current reader — directly contradicting the explicit "legacy artifacts remain valid" requirement.
120
+ - **Historical artifact compatibility**: verified by test (`'U: a legacy (Prompt 1/2) artifact with no requirements field at all remains valid'`) that an artifact predating this field validates successfully.
121
+ - **Immutable approved-reference handling**: `approveExternalReference` copies `imported.requirements` into a **new** artifact object (fresh `referenceId`, same `referenceRequestId`) — it never reopens or rewrites the imported artifact's own manifest file. Verified by test that an approved artifact's manifest is byte-for-byte unchanged after later, unrelated import/approve activity in the same output directory (reusing the exact test already established in Prompt 2 for this purpose, now also covering requirements).
122
+
123
+ ## 19. Public interface
124
+
125
+ - **CLI changes**: `import-reference` gained an optional `--requirements-file <json-file>` (root shape `{ "requirements": [...] }`, validated by a new `loadRequirementsFile` mirroring `loadRegionsFile` exactly — object root, exact allow-listed top-level field). Both `import-reference` and `approve-reference` now additionally print `Requirements: <count>` and `Adequacy: <status>` lines. No existing flag, argument, help text section, or exit code changed in meaning.
126
+ - **Input file shape**: `{ "requirements": [ { "category": "requested", "subject": { "kind": "region-property", "region": "current-page-card", "property": "width" }, "tolerance": { "kind": "absolute-reference-px", "amount": 4 } } ] }` — chosen directly from the `--regions-file`/`--targets-file` object-root-wrapper precedent, not the prompt's illustrative example verbatim. No `requirementId` field is accepted in this file (system-computed).
127
+ - **Programmatic export changes**: `src/index.ts` additively exports the complete new requirement/tolerance/adequacy type, constant, and function surface (`ExternalReferenceRequirement`, `RawReferenceRequirement`, `ReferenceRequirementSubject` variants, `ReferenceRequirementTolerance`, `ReferenceRequirementAdequacy`, `deriveReferenceRequirementExpectation`, `deriveReferenceRequirementAdequacy`, `buildReferenceRequirement`, `isValidRawReferenceRequirement`, `isValidReferenceRequirements`, plus bound/vocabulary constants). `AuthoredChangeScopeCategory`/`ExpectedDependentMode` and their constants are **not** re-exported a second time from the new module (they were already exported from `frontendContracts.js` — re-exporting would have been a duplicate-name compile error, caught and fixed during implementation). `ImportExternalReferenceOptions` gained an additive `requirements?` field; both application-result types gained additive `requirementCount: number` and `adequacy: ReferenceRequirementAdequacy` fields.
128
+ - **Backward compatibility**: every Prompt 1/2 CLI invocation and every existing result-consumer reading the pre-existing fields continues to work unchanged — verified by the full pre-existing suite passing unmodified, plus dedicated tests confirming a requirements-less import reports `requirementCount: 0`, `adequacy.status: 'inadequate'`, and no `requirements` key on the manifest.
129
+
130
+ ## 20. Files changed
131
+
132
+ Modified: `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/CURRENT_STATE.md`, `docs/WORKFLOWS.md`, `src/application/externalReferencePersistenceService.ts`, `src/cli.ts`, `src/domain/diagnostics.ts`, `src/domain/externalReference.ts`, `src/domain/externalReferenceIdentity.ts`, `src/index.ts`, `tests/unit/cliExternalReference.test.ts`, `tests/unit/externalReference.test.ts`, `tests/unit/externalReferenceIdentity.test.ts`, `tests/unit/externalReferencePersistenceService.test.ts`.
133
+ New: `src/domain/externalReferenceRequirements.ts`, `src/domain/externalReferenceRequirementIdentity.ts`, `tests/unit/externalReferenceRequirements.test.ts`, `tests/unit/externalReferenceRequirementIdentity.test.ts`.
134
+
135
+ `src/domain/relationships.ts` was **not** modified this stage (its Prompt 2 additive exports were reused as-is, imported alongside three additional pre-existing family-constant exports `HORIZONTAL_ORDER_RELATIONSHIPS`/`VERTICAL_ORDER_RELATIONSHIPS`/etc. that were already exported).
136
+
137
+ ## 21. Tests added / changed
138
+
139
+ 60 new tests across 2 new files and additions to 4 existing files (0 pre-existing test modified or removed):
140
+
141
+ - `externalReferenceRequirementIdentity.test.ts` (6 tests): content-determinism, subject/category/tolerance/mode sensitivity, call-site independence.
142
+ - `externalReferenceRequirements.test.ts` (35 tests): all four categories valid, authored `unexpected` rejected, mode required/forbidden correctly, authored `requirementId` rejected, all three subject kinds valid/invalid (including unsupported property/measurement/relationship), tolerance-applicability-by-subject-kind, unknown-region-id rejection, duplicate/conflicting-subject rejection (including relationship-subject order-independence), requirement-limit exact-max/one-over, exact/absolute/percent tolerance boundaries, negative/non-finite/unsupported-kind tolerance rejection, all six measurement derivations (including overlap-undefined cases), reference-expectation derivation for all three subject kinds (including the family-lookup bug fix - see section 20), zero/all/some-unavailable adequacy states, deterministic reason ordering, no-numeric-score assertion, immutability.
143
+ - `externalReferenceIdentity.test.ts` (+5 tests): requirements-omission backward compatibility, same-content-same-identity, category-change/add/remove-changes-identity.
144
+ - `externalReference.test.ts` (+6 tests): legacy-no-requirements validity, valid requirements on both lifecycle variants, unknown-region rejection, regions-absent rejection, malformed-value rejection.
145
+ - `externalReferencePersistenceService.test.ts` (+5 tests): import-with-requirements persists them and reports adequacy, regionless/requirement-less import reports zero/inadequate, unknown-region import rejection (nothing persisted), authored-id rejection, approval carries requirements forward with matching adequacy.
146
+ - `cliExternalReference.test.ts` (+5 tests): end-to-end `--requirements-file` import+approve with adequacy reporting, legacy no-flag invocation reports zero/inadequate, unknown-region CLI rejection, malformed-`--requirements-file` rejection (bad JSON, array root, unknown field).
147
+
148
+ ## 22. Validation results
149
+
150
+ All on the ending commit (`4d7bd61`) on `implementation/v0.7-reference-requirements`:
151
+
152
+ | Command | Result |
153
+ |---|---|
154
+ | `npm run typecheck` | PASS |
155
+ | `npm run lint` | PASS (one `no-unused-vars` finding during development, fixed before commit) |
156
+ | `npm test` | PASS — 42 files, 779 tests (up from 40/719) |
157
+ | `npm run build` | PASS (both new modules compiled into `dist/`) |
158
+ | `npm run check:docs` | PASS (17 required files) |
159
+ | `git diff --check` | PASS |
160
+ | `npm pack --dry-run` | PASS (173 files, 330.5 kB / 1.4 MB unpacked; both new modules present in the tarball listing) |
161
+ | `npm run test:browser` | PASS — 9 files, 120 tests (unchanged count) |
162
+ | `npm run test:security` | PASS — 68 tests |
163
+
164
+ ## 23. Regression results
165
+
166
+ - **Prompt 1 tests**: all pre-existing `externalReference*`/`cliExternalReference` tests pass unmodified.
167
+ - **Prompt 2 tests**: `externalReferenceRegions.test.ts`, `externalReferenceRegionRelationships.test.ts` pass unmodified.
168
+ - **v0.5 dependent tests**: `frontendContracts.test.ts`, `frontendContractEvaluation.test.ts`, `frontendContractPersistence.test.ts` explicitly re-run — 207 combined tests (with `boundedAgentContext.test.ts`, `boundedAgentContextProjection.test.ts`, `relationships.test.ts`, `relationshipDerivation.test.ts`) pass unchanged. `frontendContracts.ts` itself was not modified at all (only imported from, read-only).
169
+ - **v0.6 tests**: `boundedAgentContext*.test.ts` (4 files) pass unchanged; `boundedAgentContext.ts` was not modified (only inspected for precedent, never imported from — see section 12).
170
+
171
+ ## 24. Boundedness
172
+
173
+ - **Requirement bound**: `MAX_REFERENCE_REQUIREMENTS = 50` per artifact — explicit, tested at exactly-max (accepted) and one-over (rejected, no partial acceptance).
174
+ - No separate per-region requirement cap was added; the overall bound plus the duplicate-subject rule already bounds practical per-region growth (at most one requirement per distinct property/relationship/measurement combination can exist at all, well within 50 even for the maximum 20-region case).
175
+
176
+ ## 25. Conflict handling
177
+
178
+ v0.5's `primitivesConflict`/`evaluateFrontendContract` conflict detection is a **runtime-evaluation-time** mechanism requiring before/after `ObservationArtifact` evidence that does not exist at requirement-authoring time — it was not reused, per request section 45's explicit permission to restrict invalid combinations instead when v0.5 semantics cannot be safely reused. Prompt 3's chosen rule: **no two requirements in one collection may share the same structural subject**, regardless of category (`sameSubject()` in `externalReferenceRequirements.ts`, with relationship/measurement subjects treated as the same regardless of which region is declared first). This single rule resolves both the "duplicate requirement" and "conflicting categories on the same subject" behavior-model questions with one mechanism, is fully deterministic, and is enforced at collection-validation time (`isValidReferenceRequirements`) — never silently choosing one requirement over another.
179
+
180
+ ## 26. Security / privacy impact
181
+
182
+ No new network calls, no vision/AI API calls. `--requirements-file`'s path is never persisted or included in any identity, matching `--regions-file`/`--targets-file`/`--contract-file` convention exactly. Requirement content is plain structured data (category strings, region-id references, numeric tolerances) with no new file-system write boundary — requirements are embedded directly in the existing `manifest.json`. The unsupported-top-level-field rejection on `--requirements-file`'s root prevents silently ignored/misinterpreted malformed input, matching the existing `--regions-file` convention.
183
+
184
+ ## 27. Documentation changes
185
+
186
+ Additive sections only: `docs/CONTRACTS.md` ("v0.7 Prompt 3 selected design requirements, tolerance semantics, and reference-evidence adequacy" — the primary contract reference), `docs/ARCHITECTURE.md` (relationship of the new requirement/adequacy modules to v0.5/v0.6 precedent and to Prompt 1/2), `docs/CURRENT_STATE.md` ("v0.7 Prompt 3 status" section, plus updated "Not implemented"/"Next target"), `docs/WORKFLOWS.md` (the extended import/approve workflow diagram, the new requirement/adequacy description, and a correction to the "Planned v0.7 reference-driven correction flow" marking requirements/tolerances/adequacy as now implemented). `docs/ROADMAP.md` was **not** touched. `docs/COMMANDS.md` was **not** touched, consistent with Prompt 1/2's own precedent of not documenting `import-reference`/`approve-reference` there.
187
+
188
+ ## 28. Tooling incidents
189
+
190
+ None this stage. No background/subagent write occurred during Prompt 3's implementation - all work was performed directly in the main session, per the stricter no-background-speculative-writes instruction carried forward from Prompt 2. The Prompt 1 speculative-write incident remains historical; its stash was confirmed untouched at both the start and end of this stage.
191
+
192
+ ## 29. Inherited orchestrator heuristic issue
193
+
194
+ Not encountered as a product problem this stage. `my-dev-kit-orchestrator` was not modified, no test was rewritten to satisfy its responsibility-mapping heuristic, and no fake evidence tags were added. This stage used `DIRECT_IMPLEMENTATION` without invoking the orchestrator's stage-context workflow at all, so the heuristic gap noted in Prompt 1 did not arise here (consistent with Prompt 2).
195
+
196
+ ## 30. Out-of-scope confirmation
197
+
198
+ This stage did **not** implement: theme identity evaluation, application-state compatibility, viewport compatibility evaluation, reference/candidate comparability, reference-region↔runtime-target binding, runtime target identity in requirement subjects, candidate observation lookup or geometry, reference-vs-candidate delta, fidelity PASS/FAIL, style/color/typography/pixel/image-similarity comparison, visual score, source correlation changes, bounded correction packets, v0.6 agent-context extension, coding-agent invocation, source editing, rerender orchestration, correction iteration, the viewer, annotation, automatic requirement inference, or automatic region detection. Confirmed by direct grep of the new source files for that vocabulary (none found outside explicit "not yet implemented" documentation comments) and by direct code inspection: `ReferenceRequirementSubject` and `ReferenceRequirementAdequacy` contain no runtime-target/candidate/binding field of any kind, not even as a placeholder.
199
+
200
+ ## 31. Known limitations
201
+
202
+ 1. No fuzz-testing of adversarial requirement JSON beyond the specific malformed-shape cases already covered (bad JSON, array root, unknown field, non-object entry, unsupported property/measurement/relationship) — consistent with Prompt 1/2's own documented fuzz-testing scope boundary.
203
+ 2. The `region-relationship` reference-expectation lookup can report "opposite region order" unavailability for the one family (`follows-vertically`) whose direction is decided by geometry rather than authored order; a user must author `subjectRegion`/`relatedRegion` matching the geometrically-determined direction to get a `matches: true/false` result for that specific family. This is documented behavior (see section 15), not a defect, but is a rough edge a future prompt's UI/authoring tooling should smooth over (e.g. by trying both orders automatically) rather than something Prompt 3 should paper over silently now.
204
+ 3. `MAX_REFERENCE_REQUIREMENTS = 50` has no cited external precedent value (unlike `MAX_REFERENCE_REGIONS`, which coincidentally matches `MAX_TARGETS`) — it is a reasonable, documented, but ultimately judgment-call bound.
205
+
206
+ ## 32. Remaining risks
207
+
208
+ - Because reference expectations and adequacy are never persisted, every future consumer (Prompt 4+) that needs them must call `deriveReferenceRequirementExpectation`/`deriveReferenceRequirementAdequacy` itself. This mirrors Prompt 2's relationship-derivation design deliberately (avoids drift) and should not be "fixed" by prematurely adding persistence.
209
+ - The duplicate-subject conflict rule is stricter than v0.5's category-aware conflict model (it rejects same-subject-different-category outright rather than trying to reconcile them). If a future prompt determines users genuinely need e.g. a `requested` and a `protected` requirement coexisting on the same subject for some legitimate reason, that will require a deliberate architecture revisit, not a quiet loosening of this rule.
210
+
211
+ ## 33. Exact next action
212
+
213
+ **v0.7 Prompt 4** — reference applicability/state compatibility and comparability foundation.
214
+
215
+ ## 34. Report path
216
+
217
+ `docs/reports/v0.7-reference-requirements-prompt3.md` (this file)