agentic-proofkit 0.1.91

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 (73) hide show
  1. package/ADOPTION.md +464 -0
  2. package/LICENSE +21 -0
  3. package/NON_CLAIMS.md +197 -0
  4. package/README.md +265 -0
  5. package/dist/agentic-proofkit +35 -0
  6. package/dist/platform/darwin-arm64/agentic-proofkit +0 -0
  7. package/dist/platform/darwin-x64/agentic-proofkit +0 -0
  8. package/dist/platform/linux-arm64/agentic-proofkit +0 -0
  9. package/dist/platform/linux-x64/agentic-proofkit +0 -0
  10. package/docs/adoption-checklist-report-design.md +138 -0
  11. package/docs/adoption-workflow-agent-envelope-design.md +67 -0
  12. package/docs/adoption-workflow-authority-routes-design.md +76 -0
  13. package/docs/adoption-workflow-contract-envelope-design.md +87 -0
  14. package/docs/adoption-workflow-plan-design.md +97 -0
  15. package/docs/agent-guidance-envelope-design.md +550 -0
  16. package/docs/binding-partition-admission-design.md +127 -0
  17. package/docs/bootstrap-agent-envelope-design.md +97 -0
  18. package/docs/bootstrap-materialization-manifest-design.md +100 -0
  19. package/docs/branch-authority-report-design.md +121 -0
  20. package/docs/changed-path-set-agent-envelope-design.md +70 -0
  21. package/docs/completion-criteria-report-design.md +132 -0
  22. package/docs/custom-rule-boundary-design.md +56 -0
  23. package/docs/deployment-evidence-admission-design.md +80 -0
  24. package/docs/document-lifecycle-boundary-design.md +62 -0
  25. package/docs/json-report-cli-adapter-design.md +83 -0
  26. package/docs/migration-parity-admission-design.md +90 -0
  27. package/docs/migration-plan-design.md +73 -0
  28. package/docs/obligation-decision-agent-envelope-design.md +105 -0
  29. package/docs/obligation-decision-state-design.md +100 -0
  30. package/docs/package-runtime-dependency-admission-design.md +80 -0
  31. package/docs/producer-policy-self-proof-design.md +142 -0
  32. package/docs/project-structure-agent-envelope-design.md +121 -0
  33. package/docs/project-structure-scaffold-design.md +89 -0
  34. package/docs/proof-obligation-algebra-design.md +108 -0
  35. package/docs/proof-receipt-admission-design.md +108 -0
  36. package/docs/proofkit-contract-map.md +55 -0
  37. package/docs/receipt-currentness-scope-admission-design.md +103 -0
  38. package/docs/receipt-producer-admission-design.md +106 -0
  39. package/docs/receipt-trust-class-admission-design.md +113 -0
  40. package/docs/rendered-artifact-freshness-design.md +55 -0
  41. package/docs/requirement-browser-view-design.md +229 -0
  42. package/docs/requirement-proof-resolver-projection-design.md +97 -0
  43. package/docs/requirement-proof-source-set-design.md +72 -0
  44. package/docs/requirement-proof-view-design.md +138 -0
  45. package/docs/requirement-source-admission-design.md +66 -0
  46. package/docs/requirement-source-transition-design.md +66 -0
  47. package/docs/requirement-source-view-design.md +51 -0
  48. package/docs/scaffold-profile-plan-design.md +72 -0
  49. package/docs/secret-shaped-json-scan-design.md +60 -0
  50. package/docs/selective-evidence-obligation-decision-design.md +139 -0
  51. package/docs/selective-evidence-producer-admission-design.md +106 -0
  52. package/docs/selective-evidence-receipt-trust-class-design.md +100 -0
  53. package/docs/selective-gate-evidence-agent-envelope-design.md +100 -0
  54. package/docs/selective-gate-plan-agent-envelope-design.md +95 -0
  55. package/docs/selective-planner-edge-coverage-design.md +89 -0
  56. package/docs/spec-overview-claim-boundary-design.md +50 -0
  57. package/docs/spec-proof-bundle-admission-design.md +105 -0
  58. package/docs/specs/proofkit-consumer-infra-retirement/overview.md +44 -0
  59. package/docs/specs/proofkit-consumer-infra-retirement/requirements.v1.json +175 -0
  60. package/docs/specs/proofkit-package-boundary/overview.md +32 -0
  61. package/docs/specs/proofkit-package-boundary/requirements.v1.json +121 -0
  62. package/docs/specs/proofkit-receipt-authority/overview.md +35 -0
  63. package/docs/specs/proofkit-receipt-authority/requirements.v1.json +121 -0
  64. package/docs/specs/proofkit-spec-proof-core/overview.md +36 -0
  65. package/docs/specs/proofkit-spec-proof-core/requirements.v1.json +148 -0
  66. package/docs/witness-scheduler-plan-design.md +57 -0
  67. package/docs/workspace-planning-agent-envelope-design.md +101 -0
  68. package/docs/workspace-registry-admission-design.md +57 -0
  69. package/package.json +54 -0
  70. package/proofkit/cli-contract.v1.json +808 -0
  71. package/proofkit/receipt-producer-policy.json +48 -0
  72. package/proofkit/requirement-bindings.json +520 -0
  73. package/proofkit/witness-plan.json +649 -0
@@ -0,0 +1,103 @@
1
+ # Receipt Currentness-Scope Admission Design
2
+
3
+ Status: accepted; implemented as a generic report primitive.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Purpose
8
+
9
+ Proof receipt shape and trust-class compatibility are not enough for proof
10
+ satisfaction. A receipt can be structurally valid and emitted by an admitted
11
+ producer while still referencing old bindings, old command digests, old
12
+ toolchains, or a scope that no longer covers the current obligation.
13
+
14
+ Formal goal:
15
+
16
+ ```text
17
+ caller-provided receipt currentness checks + caller-provided scope checks
18
+ -> proofkit currentness/scope admission report
19
+ -> caller-owned obligation decision composition
20
+ ```
21
+
22
+ ## Authority Boundary
23
+
24
+ Proofkit owns:
25
+
26
+ - exact schema admission;
27
+ - safe evidence refs, rule ids, digest grammar, and sorted unique arrays;
28
+ - deterministic comparison of recorded/current digest checks;
29
+ - deterministic projection of scope admission states;
30
+ - deterministic diagnostics with `stale_receipt`, `unknown_scope`, or
31
+ `not_applicable` candidate-state hints.
32
+
33
+ The consuming repository owns:
34
+
35
+ - computing current source, binding, command, environment, dependency,
36
+ lockfile, toolchain, and scope digests;
37
+ - changed-scope discovery;
38
+ - unknown-edge analysis;
39
+ - producer authentication;
40
+ - time-window freshness policy;
41
+ - witness execution;
42
+ - merge, release, rollout, and production policy.
43
+
44
+ Formal rule:
45
+
46
+ ```text
47
+ Proofkit may compare supplied recorded/current facts.
48
+ Proofkit must not discover or certify those facts.
49
+ ```
50
+
51
+ ## Model
52
+
53
+ The input has one row per obligation receipt:
54
+
55
+ 1. `currentnessChecks`: caller-owned digest comparisons. Any recorded/current
56
+ digest mismatch emits `stale_receipt`.
57
+ 2. `scopeChecks`: caller-owned scope admission decisions. `unknown_current_scope`
58
+ or `not_admitted_current_scope` emits `unknown_scope`; all
59
+ `not_applicable` scope checks emit `not_applicable` when there is no failure.
60
+
61
+ No finding emits `satisfied`. Satisfaction remains a later composition step in
62
+ `obligation-decision` after receipt shape, producer/trust, currentness/scope,
63
+ and caller policy facts are supplied.
64
+
65
+ ## Rejected Alternatives
66
+
67
+ | Alternative | Rejection reason |
68
+ |---|---|
69
+ | Merge this into proof receipt admission | Receipt shape and current/current-scope matching answer different questions. |
70
+ | Merge this into receipt trust-class admission | Trust compatibility does not know current repository facts or obligation applicability. |
71
+ | Read git, files, lockfiles, or clocks inside Proofkit | Current facts and time-window policy are consuming-repository authority. |
72
+ | Emit `satisfied` for current in-scope receipts | A current receipt still needs producer, trust, native-result, and merge-policy composition. |
73
+ | Add an agent envelope to this command | Obligation-decision envelopes already route unsatisfied states without duplicating presentation layers. |
74
+
75
+ ## Proof Obligations
76
+
77
+ - unit tests prove current/in-scope receipts produce no candidate-state hint;
78
+ - unit tests prove digest drift emits `stale_receipt`;
79
+ - unit tests prove unknown or unadmitted current scope emits `unknown_scope`;
80
+ - unit tests prove not-applicable scope stays separate from stale receipt
81
+ failures;
82
+ - selective evidence tests prove optional currentness/scope diagnostics compose
83
+ into obligation-decision candidate states and fail closed when unscoped or
84
+ missing;
85
+ - CLI tests prove file/stdin parity and unsupported presentation flags fail
86
+ closed;
87
+ - package artifact tests prove package binary, packed files, installed-bin
88
+ behavior, version, and published design note.
89
+
90
+ ## Non-Claims
91
+
92
+ Receipt currentness-scope admission does not claim:
93
+
94
+ - current fact discovery;
95
+ - changed-scope discovery;
96
+ - producer authentication;
97
+ - time-based receipt freshness;
98
+ - native command execution;
99
+ - command result correctness;
100
+ - proof satisfaction;
101
+ - merge approval;
102
+ - release approval;
103
+ - rollout approval.
@@ -0,0 +1,106 @@
1
+ # Receipt Producer Admission Design
2
+
3
+ Status: accepted; implemented as a generic report primitive.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Purpose
8
+
9
+ Proofkit validates many caller-provided receipts, but a receipt is useful only
10
+ when a consuming repository can distinguish an advisory local run from evidence
11
+ created by a producer admitted for a merge obligation. This design adds a
12
+ generic producer-admission contract without making proofkit authenticate CI,
13
+ read logs, execute commands, or decide merge policy.
14
+
15
+ Formal goal:
16
+
17
+ ```text
18
+ caller-owned producer policy + caller-owned receipt metadata
19
+ -> proofkit producer-admission report
20
+ -> caller-owned merge/proof decision
21
+ ```
22
+
23
+ ## Authority Boundary
24
+
25
+ Proofkit owns:
26
+
27
+ - exact schema admission;
28
+ - sorted deterministic normalization;
29
+ - producer, receipt-kind, and environment-class cross-field checks;
30
+ - advisory vs merge-satisfying producer boundary checks;
31
+ - deterministic reports and non-claims.
32
+
33
+ The consuming repository owns:
34
+
35
+ - producer trust roots;
36
+ - CI runner identity and authentication;
37
+ - receipt freshness;
38
+ - command execution truth;
39
+ - merge policy;
40
+ - rollout policy.
41
+
42
+ Formal rule:
43
+
44
+ ```text
45
+ Proofkit can validate that a receipt matches a declared producer policy.
46
+ Proofkit cannot prove that the producer actually produced the receipt.
47
+ ```
48
+
49
+ ## Model
50
+
51
+ The input has three layers:
52
+
53
+ 1. `receiptKinds` and `environmentClasses`: caller-owned vocabulary.
54
+ 2. `producers`: producer records with admission level, allowed receipt kinds,
55
+ allowed environment classes, evidence refs, owner, and non-claim.
56
+ 3. `receipts`: receipt metadata with producer id, kind, environment, status,
57
+ subject ref, evidence artifact refs, and whether the caller wants it to
58
+ satisfy a merge obligation.
59
+
60
+ Admission levels:
61
+
62
+ | Level | Meaning | Proofkit may validate | Proofkit must not claim |
63
+ |---|---|---|---|
64
+ | `advisory` | Useful for local navigation or debugging. | Receipts may reference the producer. | Merge satisfaction. |
65
+ | `merge_satisfying` | Consumer policy says this producer may satisfy merge obligations. | Merge-obligation receipts may reference the producer if status is `passed`. | CI authenticity, freshness, or merge approval. |
66
+
67
+ Receipt statuses:
68
+
69
+ - `passed`
70
+ - `failed`
71
+ - `blocked`
72
+ - `not_run`
73
+
74
+ Only a `passed` receipt from a `merge_satisfying` producer may be marked as
75
+ `satisfiesMergeObligation: true`.
76
+
77
+ ## Rejected Alternatives
78
+
79
+ | Alternative | Rejection reason |
80
+ |---|---|
81
+ | Add producer fields directly to selective-gate evidence first | It would couple producer trust policy to one report family before the generic contract is stable. |
82
+ | Let proofkit infer producer trust from GitHub Actions or local environment | It would require ambient CI reads and would make proofkit a trust-root owner. |
83
+ | Treat every passed receipt as merge-satisfying | It collapses advisory local proof and admitted CI proof. |
84
+ | Store producer policy in proofkit defaults | Producer trust is repository-specific and must stay caller-owned. |
85
+
86
+ ## Proof Obligations
87
+
88
+ - report builder tests for valid advisory and merge-satisfying producers;
89
+ - negative tests for unknown producers, disallowed receipt kinds, disallowed
90
+ environments, advisory merge claims, non-passing merge claims, duplicate ids,
91
+ unsafe paths, unsupported fields, and unsorted vocabulary;
92
+ - CLI test for `receipt-producer-admission`;
93
+ - package artifact test proving the primitive ships in the published package.
94
+
95
+ ## Non-Claims
96
+
97
+ Receipt producer admission does not claim:
98
+
99
+ - producer authentication;
100
+ - receipt freshness;
101
+ - command execution;
102
+ - command result correctness;
103
+ - CI log authority;
104
+ - merge approval;
105
+ - rollout approval;
106
+ - repository policy ownership.
@@ -0,0 +1,113 @@
1
+ # Receipt Trust-Class Admission Design
2
+
3
+ Status: accepted; implemented as a generic report primitive.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Purpose
8
+
9
+ Proof receipts can have valid shape and admitted producer metadata while still
10
+ being too weak for a specific proof obligation. A local advisory run may be
11
+ useful for navigation, but a high-risk merge obligation may require an admitted
12
+ CI-class receipt with provenance and retained artifacts. This design adds the
13
+ generic compatibility layer between caller-owned proof classes and
14
+ caller-owned receipt trust classes.
15
+
16
+ Formal goal:
17
+
18
+ ```text
19
+ caller-owned proof class + caller-owned receipt trust class + receipt facts
20
+ -> proofkit trust-class compatibility report
21
+ -> caller-owned merge/proof decision
22
+ ```
23
+
24
+ ## Authority Boundary
25
+
26
+ Proofkit owns:
27
+
28
+ - exact schema admission;
29
+ - sorted deterministic normalization;
30
+ - proof-class to minimum-trust-class compatibility checks;
31
+ - trust-rank comparison over caller-owned ranks;
32
+ - declared receipt-kind and environment-class compatibility;
33
+ - declared producer-admission-level and receipt-status compatibility;
34
+ - declared provenance and artifact-ref presence checks;
35
+ - deterministic diagnostics with obligation-decision candidate-state hints.
36
+
37
+ The consuming repository owns:
38
+
39
+ - proof-class meaning and risk taxonomy;
40
+ - trust-class definitions and rank values;
41
+ - producer authentication;
42
+ - receipt freshness;
43
+ - attestation verification;
44
+ - command execution truth;
45
+ - merge policy;
46
+ - rollout policy.
47
+
48
+ Formal rule:
49
+
50
+ ```text
51
+ Proofkit can say whether caller-provided receipt facts satisfy caller-provided
52
+ trust-class compatibility rules.
53
+ Proofkit cannot say that the producer is authentic, the receipt is fresh, or
54
+ the merge obligation is satisfied.
55
+ ```
56
+
57
+ ## Model
58
+
59
+ The input has three layers:
60
+
61
+ 1. `trustClasses`: caller-owned trust tiers with ranks, admitted producer
62
+ admission levels, admitted receipt statuses, and required provenance or
63
+ artifact refs.
64
+ 2. `proofClasses`: caller-owned proof/risk classes with a minimum trust class
65
+ and admitted receipt kind/environment vocabulary.
66
+ 3. `obligationReceipts`: caller-observed receipt facts for concrete proof
67
+ obligations.
68
+
69
+ Findings are mapped to obligation-decision candidate states:
70
+
71
+ | Finding class | Candidate state | Rationale |
72
+ |---|---|---|
73
+ | unknown proof class, unknown trust class, disallowed producer admission, or rank below minimum | `invalid_producer` | The receipt cannot satisfy the caller-owned trust requirements. |
74
+ | disallowed receipt kind/environment/status, missing provenance ref, or missing artifact refs | `invalid_receipt` | The receipt facts do not match the proof-class or trust-class evidence shape. |
75
+
76
+ The report does not emit `satisfied`; callers compose this compatibility report
77
+ with freshness, producer-authentication, current-obligation, and native-test
78
+ evidence before deciding merge satisfaction.
79
+
80
+ ## Rejected Alternatives
81
+
82
+ | Alternative | Rejection reason |
83
+ |---|---|
84
+ | Merge this into proof receipt admission | Receipt shape and proof-class compatibility answer different questions. |
85
+ | Merge this into receipt producer admission | Producer policy compatibility does not know proof-class risk requirements. |
86
+ | Let Proofkit define global trust levels | Trust taxonomy and risk meaning are repository policy. |
87
+ | Treat `passed` as enough for high-risk obligations | This collapses advisory local evidence and admitted merge evidence. |
88
+ | Emit final merge decisions | Merge satisfaction requires producer auth, freshness, current-obligation matching, and consumer policy. |
89
+
90
+ ## Proof Obligations
91
+
92
+ - unit tests prove admitted local and CI-class compatibility;
93
+ - negative tests prove insufficient trust rank, missing provenance/artifacts,
94
+ disallowed receipt kind/environment/status, disallowed producer class,
95
+ duplicate trust ranks, unknown minimum trust class, unsafe paths, and
96
+ unsupported fields fail closed;
97
+ - CLI tests prove file/stdin parity and unsupported flag rejection;
98
+ - package artifact tests prove package binary, packed files, installed-bin
99
+ behavior, version, and published design note.
100
+
101
+ ## Non-Claims
102
+
103
+ Receipt trust-class admission does not claim:
104
+
105
+ - producer authentication;
106
+ - receipt freshness;
107
+ - attestation verification;
108
+ - command execution;
109
+ - command result correctness;
110
+ - proof-class or risk-policy ownership;
111
+ - merge approval;
112
+ - release approval;
113
+ - rollout approval.
@@ -0,0 +1,55 @@
1
+ # Rendered Artifact Freshness Design
2
+
3
+ Status: implemented.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Problem
8
+
9
+ Rendered Markdown, rendered HTML, and generated lookup views are useful for
10
+ humans and agents, but they are derived products. They must not become source
11
+ truth, and a repository needs a deterministic way to prove that a tracked or
12
+ published view still matches the structured source, renderer identity, and
13
+ generation scope that produced it.
14
+
15
+ Without a freshness boundary, a stale rendered view can look authoritative even
16
+ when the underlying requirement records, proof bindings, or renderer changed.
17
+
18
+ ## Decision
19
+
20
+ Add `rendered-artifact-freshness`, a deterministic report over caller-provided
21
+ artifact freshness records.
22
+
23
+ The primitive validates:
24
+
25
+ - generated artifacts declare lookup-only authority;
26
+ - rendered artifacts declare presentation-only authority;
27
+ - source refs and current source digest are explicit;
28
+ - renderer id, renderer version, and renderer digest are explicit;
29
+ - generation scope id and recorded/current scope digests are explicit;
30
+ - recorded source, renderer, generation scope, and artifact digests match current
31
+ caller observations;
32
+ - artifact paths are unique, safe repository-relative paths;
33
+ - every artifact declares freshness check refs and non-claims.
34
+
35
+ ## Authority Boundary
36
+
37
+ Proofkit compares caller-provided digest facts and emits deterministic
38
+ diagnostics. It does not read source files, read rendered artifacts, execute
39
+ renderers, infer generation scope, decide source meaning, prove native witness
40
+ execution, publish artifacts, or approve merge.
41
+
42
+ ## Rejected Alternatives
43
+
44
+ | Alternative | Rejected Because |
45
+ |---|---|
46
+ | Read files and compute digests inside Proofkit. | That would make Proofkit a repository-state scanner instead of a pure reusable validator. |
47
+ | Fold this into `document-lifecycle-boundary`. | Lifecycle authority and digest freshness are separate proof questions. |
48
+ | Treat rendered views as canonical when hashes match. | Hash freshness proves derivation only; structured records still own meaning. |
49
+ | Require one global generated-artifact manifest. | Owner-scoped freshness sets are more reviewable and token-efficient. |
50
+
51
+ ## Follow-Up
52
+
53
+ Consumer repositories can feed this report into selective gates or documentation
54
+ freshness checks. A separate caller-owned witness can compute the digests and
55
+ provide this primitive with explicit facts.
@@ -0,0 +1,229 @@
1
+ # Requirement Browser View Design
2
+
3
+ Status: accepted; implemented as self-contained HTML rendering primitives,
4
+ navigation/table controls, and local loopback presentation server.
5
+
6
+ Owner: `proofkit`.
7
+
8
+ ## Problem
9
+
10
+ Machine-admissible requirement records and proof bindings are reliable because
11
+ they are structured. Raw structured files are poor human review surfaces,
12
+ especially when a reviewer wants to scan by owner, claim level, proof state, or
13
+ environment. Making Markdown or HTML the canonical source would improve human
14
+ reading but would weaken deterministic validation.
15
+
16
+ Formal inference:
17
+
18
+ ```text
19
+ If prose or HTML owns requirement truth, parsing and diff semantics become weak.
20
+ If structured records own truth, humans still need a readable projection.
21
+ Therefore the correct boundary is structured source plus derived browser view.
22
+ ```
23
+
24
+ ## Decision
25
+
26
+ Provide reusable browser-document rendering for requirement source and proof
27
+ views.
28
+
29
+ The browser document is:
30
+
31
+ - self-contained HTML;
32
+ - deterministic for the same view model;
33
+ - searchable in the browser;
34
+ - filterable by fields already admitted into the view model;
35
+ - able to hide or show requirement IDs without changing source data;
36
+ - able to switch between card and table presentation when table rows are
37
+ supplied by the view model;
38
+ - grouped by owner, surface, or another caller-provided module key;
39
+ - able to show a compact hierarchy of specs, owners, surfaces, and environment
40
+ classes;
41
+ - able to show scenario and witness details already present in the proof view
42
+ model without executing tests;
43
+ - presentation-only or lookup-only, matching the source view authority.
44
+
45
+ The first implementation upgrades existing `--format html` outputs for
46
+ `requirement-source-view` and `requirement-proof-view`. The second slice adds
47
+ structured navigation, module grouping, optional table mode, and collapsible
48
+ scenario/witness details. The third slice adds `requirement-browser-server`, a
49
+ loopback presentation adapter over the same admitted view models.
50
+
51
+ ## Authority Boundary
52
+
53
+ Proofkit owns:
54
+
55
+ - browser document layout;
56
+ - client-side search and filters over explicit view-model fields;
57
+ - ID visibility toggling;
58
+ - card/table presentation switching;
59
+ - group and hierarchy navigation over explicit view-model fields;
60
+ - collapsible details for already-admitted scenario, witness, command, and
61
+ environment facts;
62
+ - HTML escaping;
63
+ - shared renderer code used by source, structured proof, and compact proof
64
+ views.
65
+
66
+ Proofkit does not own:
67
+
68
+ - requirement meaning;
69
+ - proof-binding adequacy;
70
+ - witness execution;
71
+ - local environment policy beyond caller-provided compact view input;
72
+ - rendered-artifact freshness;
73
+ - merge, release, rollout, or product-readiness decisions;
74
+ - browser annotation, approval, or feedback transport.
75
+
76
+ Formal rule:
77
+
78
+ ```text
79
+ Structured records are authority.
80
+ View models are deterministic projections.
81
+ Browser HTML is presentation.
82
+ Browser state is local convenience.
83
+ ```
84
+
85
+ ## Model
86
+
87
+ `htmlProofkitBrowserViewDocument` receives:
88
+
89
+ - title;
90
+ - authority;
91
+ - summary items;
92
+ - optional hierarchy sections;
93
+ - filter fields;
94
+ - cards;
95
+ - optional table columns and rows;
96
+ - non-claims.
97
+
98
+ Each card receives:
99
+
100
+ - stable id;
101
+ - title;
102
+ - optional group id and group label;
103
+ - already-rendered escaped body HTML;
104
+ - normalized search text;
105
+ - filter values keyed by declared filter fields.
106
+
107
+ Each table row receives:
108
+
109
+ - stable id;
110
+ - cells keyed by declared table columns;
111
+ - normalized search text;
112
+ - the same filter values used by card mode.
113
+
114
+ The hierarchy receives links only to anchors that are already created from
115
+ explicit group ids. It does not infer repository topology or read files.
116
+
117
+ The document contains no external assets and no network calls. It can be piped
118
+ to a file and opened by a browser, or served later by a separate local
119
+ presentation adapter.
120
+
121
+ ## Representation Rules
122
+
123
+ The browser view uses progressive disclosure:
124
+
125
+ 1. Header and summary identify the view, authority class, counts, and local
126
+ environment policy.
127
+ 2. Hierarchy sections expose spec, owner, surface, and environment structure
128
+ without forcing a reader into every requirement.
129
+ 3. Controls allow search, field filters, card/table switching, ID visibility,
130
+ and details visibility.
131
+ 4. Card mode is the default reading mode for understanding one invariant at a
132
+ time.
133
+ 5. Table mode is the scanning mode for comparing many requirements.
134
+ 6. Scenario and witness details are collapsed by default because they are
135
+ useful for audit but too verbose for first-pass reading.
136
+
137
+ Formal inference:
138
+
139
+ ```text
140
+ If all proof detail is shown at once, the browser view becomes a wall of text.
141
+ If proof detail is hidden permanently, auditability is weakened.
142
+ Therefore proof detail must be available through local disclosure controls.
143
+ ```
144
+
145
+ ## Server Adapter
146
+
147
+ A local browser server is useful, but it is a separate adapter from static HTML
148
+ rendering. `requirement-browser-server` is implemented under these constraints:
149
+
150
+ - it serves only explicit input files or explicit generated HTML supplied by the
151
+ caller;
152
+ - it binds to loopback by default;
153
+ - it rejects non-loopback hosts;
154
+ - it does not scan the repository implicitly;
155
+ - it does not execute native witnesses;
156
+ - it does not compute proof freshness;
157
+ - it does not publish artifacts;
158
+ - it does not persist annotation feedback into source files;
159
+ - it starts only when `--serve` is explicit;
160
+ - it offers `--open` only with `--serve` as a local presentation convenience.
161
+
162
+ The server is a presentation adapter, not a proof owner. Its proof covers
163
+ loopback port binding, explicit input admission, no implicit repository state,
164
+ deterministic rendered output, route handling, and shutdown behavior.
165
+
166
+ ## Implementation Plan
167
+
168
+ 1. Extend the shared browser document model with hierarchy sections, optional
169
+ card grouping, optional table rows, and details controls.
170
+ 2. Preserve current JSON and Markdown outputs unchanged.
171
+ 3. Render source views grouped by owner, with a specification hierarchy and a
172
+ table over requirement id, owner, invariant, claim level, risk, lifecycle,
173
+ and proof-binding refs.
174
+ 4. Render structured proof views grouped by owner, with spec-path hierarchy, a
175
+ table over requirement/proof fields, and collapsible scenario/test witness
176
+ details.
177
+ 5. Render compact proof views grouped by surface, with surface/environment
178
+ hierarchy, a table over requirement/surface/invariant/proof fields, and
179
+ collapsible positive/falsification witness details.
180
+ 6. Add renderer tests for hierarchy, table mode, grouping, escaped content, and
181
+ scenario/witness detail availability.
182
+ 7. Run targeted Go view tests, package artifact tests, and the full
183
+ package check before release or consumer pin changes.
184
+ 8. Implement `requirement-browser-server` as a loopback-only presentation
185
+ adapter over the same source/proof view models.
186
+
187
+ ## Rejected Alternatives
188
+
189
+ | Alternative | Rejection reason |
190
+ |---|---|
191
+ | Make Markdown or HTML canonical | Reintroduces prose parsing ambiguity and weakens machine proof determinism. |
192
+ | Track generated browser views by default | Adds drift-prone generated artifacts and token noise. |
193
+ | Add a server before static views are stable | Server lifecycle, ports, and browser launch are a separate adapter concern and must not own rendering semantics. |
194
+ | Add annotation and approval semantics now | Annotation feedback changes workflow authority and needs its own trust boundary. |
195
+ | Filter over fields by parsing rendered text | Rendering would become accidental data authority; filters must use view-model fields. |
196
+ | Render only card mode | Good for reading one requirement but poor for scanning large graphs. |
197
+ | Render only table mode | Good for scanning but poor for understanding one invariant and its witnesses. |
198
+ | Expand all witnesses by default | Improves audit detail but recreates the wall-of-text failure mode for large repositories. |
199
+
200
+ ## Proof Obligations
201
+
202
+ - Source view HTML includes browser controls, filter metadata, and escaped
203
+ requirement text.
204
+ - Structured proof view HTML includes browser controls and proof-state filters.
205
+ - Compact proof view HTML includes browser controls and precondition filters.
206
+ - HTML views include hierarchy sections when the view model supplies hierarchy
207
+ facts.
208
+ - HTML views include table mode when the view model supplies table rows.
209
+ - Proof views expose scenario and witness details without executing native
210
+ commands.
211
+ - HTML rendering remains self-contained and deterministic.
212
+ - Existing JSON and Markdown view outputs remain unchanged in authority.
213
+ - Requirement browser server binds only to loopback hosts, serves explicit input,
214
+ exposes a health endpoint, rejects unsupported methods and unknown paths, and
215
+ shuts down cleanly.
216
+ - Package artifact tests include the reusable browser document module and this
217
+ design document.
218
+
219
+ ## Non-Claims
220
+
221
+ Requirement browser views do not claim:
222
+
223
+ - source authority;
224
+ - native witness execution;
225
+ - receipt freshness;
226
+ - generated-artifact freshness;
227
+ - annotation feedback;
228
+ - merge approval;
229
+ - rollout approval.