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,62 @@
1
+ # Document Lifecycle Boundary Design
2
+
3
+ Status: implemented.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Problem
8
+
9
+ Design documents and implementation plans are useful while a pull request is
10
+ open, but after merge they stop being durable behavior authority. Current
11
+ repository truth should move to requirement records, specifications, proof
12
+ bindings, routers, work ledgers, or generated lookup surfaces with explicit
13
+ freshness boundaries.
14
+
15
+ Without a lifecycle boundary, historical prose can keep routing agents as if it
16
+ were current behavior, proof, readiness, or open-work authority.
17
+
18
+ ## Decision
19
+
20
+ Add `document-lifecycle-boundary`, a deterministic report over caller-provided
21
+ document lifecycle records.
22
+
23
+ The primitive validates:
24
+
25
+ - active PR-local design and implementation-plan documents stay temporary
26
+ reasoning inputs;
27
+ - merged design and implementation-plan documents are historical evidence only;
28
+ - merged implementation plans may be deleted from the active tree when stable
29
+ design notes, code, tests, and git history preserve the useful evidence;
30
+ - merged temporary documents are not routed as current authority;
31
+ - archived documents do not keep active authority or current routing roles;
32
+ - generated views stay lookup-only and declare source and freshness refs;
33
+ - rendered views stay presentation-only and declare source and freshness refs;
34
+ - generated views are routed only as lookup projections, and rendered views are
35
+ routed only as presentation views, not owner surfaces;
36
+ - current durable documents declare freshness checks;
37
+ - primary routers use navigation authority;
38
+ - work ledgers use open-work authority;
39
+ - every document declares owner, mutation triggers, forbidden payloads, and
40
+ non-claims.
41
+
42
+ ## Authority Boundary
43
+
44
+ Proofkit validates caller-provided lifecycle metadata and emits deterministic
45
+ diagnostics. It does not read Markdown, parse document semantics, infer routes,
46
+ prove generated freshness, archive files, delete files, approve merge, or
47
+ decide product meaning.
48
+
49
+ ## Rejected Alternatives
50
+
51
+ | Alternative | Rejected Because |
52
+ |---|---|
53
+ | Parse Markdown directly in Proofkit. | Document meaning, prose style, and semantic extraction remain repository-owned. |
54
+ | Fold lifecycle checks into requirement-source admission. | Requirement records and documentation topology have different authority boundaries. |
55
+ | Treat merged plans as current owner surfaces if they contain useful detail. | That preserves stale PR-local reasoning as durable truth. |
56
+ | Track rendered views as canonical source. | Rendered views are presentation surfaces only; source records own durable meaning. |
57
+
58
+ ## Follow-Up
59
+
60
+ Consumer repositories can feed this report into selective gates or adoption
61
+ checklists. If they need semantic Markdown linting, they should provide
62
+ caller-owned facts to this primitive or implement a separate native witness.
@@ -0,0 +1,83 @@
1
+ # JSON Report CLI Adapter Design
2
+
3
+ Status: implemented reusable primitive.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Problem
8
+
9
+ Consumer repositories often maintain small JSON-report command wrappers that
10
+ repeat the same mechanics: parse explicit file flags, support `--output`, read
11
+ JSON or text input, write deterministic JSON output, and wrap direct-main
12
+ errors. Repeating that plumbing creates extra consumer code while providing no
13
+ consumer-specific policy value.
14
+
15
+ ## Decision
16
+
17
+ Proofkit provides a reusable JSON report CLI adapter:
18
+
19
+ - `parseProofkitJsonReportCli`
20
+ - `readProofkitJsonReportInput`
21
+ - `readProofkitTextReportInput`
22
+ - `writeProofkitJsonReportOutput`
23
+ - `runProofkitJsonReportCliMain`
24
+ - `formatProofkitCliError`
25
+
26
+ The adapter owns generic command-wrapper mechanics only. Callers provide the
27
+ flag vocabulary, help text, schema admission, command-specific diagnostics,
28
+ report builder, output path, and any command policy.
29
+
30
+ Formal boundary:
31
+
32
+ ```text
33
+ Proofkit owns reusable CLI plumbing.
34
+ Consumers own command meaning and proof policy.
35
+ ```
36
+
37
+ ## Invariants
38
+
39
+ 1. The parser accepts only explicitly declared flags plus `--output` and
40
+ `--help`; unknown arguments fail closed.
41
+ 2. Required flags are admitted by caller-declared flag metadata.
42
+ 3. JSON output is emitted through `proofkitStableJsonString`, so object keys are
43
+ deterministic and non-JSON values fail closed.
44
+ 4. Direct-main execution sets `process.exitCode` and writes a non-secret error
45
+ message; it does not call `process.exit` for command execution failures.
46
+ 5. `--help` exits only through an injectable hook, so command tests can prove
47
+ help behavior without terminating the test process.
48
+
49
+ ## Non-Claims
50
+
51
+ The adapter does not own:
52
+
53
+ - report semantics;
54
+ - schema vocabulary;
55
+ - proof freshness;
56
+ - repository scanning;
57
+ - command selection;
58
+ - native witness execution;
59
+ - credential or network policy;
60
+ - merge or release approval.
61
+
62
+ ## Rejected Alternatives
63
+
64
+ 1. Put the helper in `report-model`.
65
+ Rejected because `report-model` is a pure report grammar surface, while this
66
+ adapter reads files and writes process streams.
67
+ 2. Add a new `agentic-proofkit` CLI command.
68
+ Rejected because there is no single command meaning to execute; consumers
69
+ own their command-specific report builders.
70
+ 3. Keep all wrappers in every consumer repository.
71
+ Rejected because the repeated mechanics are generic, measurable
72
+ infrastructure code and can be reused without moving consumer policy into
73
+ proofkit.
74
+ 4. Add a command registry or scheduler primitive here.
75
+ Rejected because registry, scheduling, and freshness policy are separate
76
+ owner surfaces with their own proof contracts.
77
+
78
+ ## Proof
79
+
80
+ The primitive is covered by Go command tests and package artifact admission
81
+ through `npm run check` and `npm run package:artifact`. Release evidence must
82
+ still run the tag-only release workflow over the complete root package tarball
83
+ before any registry publication claim.
@@ -0,0 +1,90 @@
1
+ # Migration Parity Admission Design
2
+
3
+ ## Decision
4
+
5
+ Proofkit provides a deterministic `migration-parity-admission` primitive for
6
+ consumers that migrate local proof infrastructure to Proofkit-owned reusable
7
+ primitives. The primitive validates structured caller-provided parity evidence
8
+ between a declared source proof owner and a declared Proofkit target ref.
9
+
10
+ ## Problem
11
+
12
+ `migration-plan` can require parity evidence refs before old proof owners are
13
+ retired, but opaque refs do not prove that the evidence has a stable shape,
14
+ declared source/target closure, typed equivalence dimension, digest comparison,
15
+ or fail-closed status vocabulary.
16
+
17
+ The missing reusable step is admission of parity evidence shape before a
18
+ consumer uses that evidence as an input to migration planning or old-owner
19
+ retirement review.
20
+
21
+ ## Boundary
22
+
23
+ Proofkit owns:
24
+
25
+ - exact shape admission for caller-provided migration parity evidence;
26
+ - source-owner and target-ref cross-reference checks;
27
+ - typed parity equivalence kinds;
28
+ - caller-provided digest equality checks for `matched` parity records;
29
+ - fail-closed handling for `mismatched`, `not_comparable`, and `not_run`
30
+ records;
31
+ - deterministic non-secret diagnostics and stable JSON reports.
32
+
33
+ The consuming repository owns:
34
+
35
+ - legacy proof owner content and Proofkit target content;
36
+ - evidence production, receipt production, and producer trust;
37
+ - digest computation and freshness;
38
+ - native witness execution and command result truth;
39
+ - semantic equivalence, proof coverage adequacy, and retirement policy;
40
+ - CI admission, merge approval, release approval, rollout approval, and
41
+ production decisions.
42
+
43
+ ## Invariant
44
+
45
+ A migration parity record is admitted only when it references one declared
46
+ source proof owner and one declared target Proofkit ref, declares a supported
47
+ equivalence kind, supplies at least one safe repo-relative evidence ref, and
48
+ uses `status: "matched"` with equal caller-provided `sha256:<64 lowercase hex>`
49
+ legacy and Proofkit digests.
50
+
51
+ Unknown source or target ids, unsafe evidence paths, malformed digests,
52
+ duplicate evidence ids, empty evidence refs, unequal matched digests, equal
53
+ mismatched digests, or any non-`matched` status must produce deterministic
54
+ failure.
55
+
56
+ ## Non-Claims
57
+
58
+ Migration parity admission does not claim:
59
+
60
+ - parity authenticity;
61
+ - native command execution or command result correctness;
62
+ - digest computation, receipt currentness, or proof freshness;
63
+ - semantic correctness of the legacy proof owner or Proofkit target;
64
+ - adequacy of proof coverage;
65
+ - old-owner deletion approval;
66
+ - migration exception approval;
67
+ - merge, release, rollout, or production readiness.
68
+
69
+ ## Rejected Alternatives
70
+
71
+ | Alternative | Rejection |
72
+ |---|---|
73
+ | Keep parity as opaque evidence paths in `migration-plan` only | Opaque refs are insufficient for deterministic retirement review because they hide source/target closure, equivalence dimensions, and mismatch state. |
74
+ | Let Proofkit compute digests from paths | That would make Proofkit a repository scanner and freshness authority. Consumers own file reads and digest production. |
75
+ | Treat mismatched or not-run parity as advisory while passing | Retirement preconditions must fail closed when parity is incomplete or divergent. |
76
+ | Fold retirement approval into parity admission | Retirement depends on repository policy, rollout risk, and native proof freshness. Parity admission is only a structured evidence precondition. |
77
+ | Use generic receipt-currentness admission for parity | Receipt currentness compares receipt facts to current facts; migration parity needs source-owner to Proofkit-target equivalence metadata and parity-specific states. |
78
+
79
+ ## Proof Obligations
80
+
81
+ - Unit tests prove matched parity admission, source/target closure failures,
82
+ malformed digest/path failures, duplicate evidence id failures, empty evidence
83
+ failures, and non-`matched` status failures.
84
+ - CLI tests prove stable report output, failed report exit status, and JSON
85
+ pointer/stdin input selection.
86
+ - Package artifact tests prove package binary availability, packed CLI behavior,
87
+ and published file boundary.
88
+ - Self-hosting requirement bindings keep the primitive tied to
89
+ `REQ-PROOFKIT-RETIRE-*` coverage without making the generated binding graph a
90
+ second source of truth.
@@ -0,0 +1,73 @@
1
+ # Migration Plan Design
2
+
3
+ ## Decision
4
+
5
+ Proofkit provides a deterministic `migration-plan` primitive for consumers that
6
+ replace local proof infrastructure with Proofkit-owned reusable primitives. The
7
+ plan describes a safe caller-owned transition, not an approval to delete old
8
+ proof owners.
9
+
10
+ ## Problem
11
+
12
+ Consumers can bootstrap new proofkit inputs and scaffold repository profiles,
13
+ but existing repositories also need to retire local proof infrastructure without
14
+ losing parity evidence or creating a hidden proof authority split.
15
+
16
+ The missing reusable step is a transition plan that keeps old and new proof
17
+ owners explicit until caller-provided parity evidence and post-retirement
18
+ checks exist.
19
+
20
+ ## Boundary
21
+
22
+ Proofkit owns:
23
+
24
+ - deterministic validation of caller-provided source owner refs, target
25
+ proofkit refs, parity evidence refs, retained owners, retired candidates,
26
+ and follow-up commands;
27
+ - ordered migration phases;
28
+ - blockers that prevent premature retirement recommendations;
29
+ - non-claims that deny deletion, merge, freshness, and rollout authority.
30
+
31
+ The consuming repository owns:
32
+
33
+ - old proof owner content and target proofkit content;
34
+ - parity execution and evidence authenticity;
35
+ - native witness execution;
36
+ - file edits and deletion;
37
+ - CI freshness, merge approval, rollout, and final retirement decisions.
38
+
39
+ ## Invariant
40
+
41
+ A migration plan may list `retire-old-owner` actions only for caller-declared
42
+ retirement candidates that have at least one caller-provided parity evidence
43
+ ref against a declared target proofkit ref, at least one post-retirement
44
+ validation command, and no caller-declared retain policy. Missing parity,
45
+ unknown source or target refs, retained-owner conflicts, or missing
46
+ post-retirement validation must become deterministic blockers. A blocked plan
47
+ must not list `retire-old-owner` actions.
48
+
49
+ ## Phases
50
+
51
+ The output always uses this phase order:
52
+
53
+ 1. `baseline`
54
+ 2. `parallel-proof`
55
+ 3. `parity-check`
56
+ 4. `retire-old-owner`
57
+ 5. `post-retirement-validation`
58
+
59
+ ## Rejected Alternatives
60
+
61
+ | Alternative | Rejection |
62
+ |---|---|
63
+ | Let Proofkit decide old-owner deletion | Deletion depends on repository-specific risk, CI trust, and rollout policy. |
64
+ | Treat parity as correctness | Parity proves extraction equivalence, not correctness of either implementation. |
65
+ | Reuse bootstrap materialization | Bootstrap materialization creates starter file plans; migration planning owns old/new proof-owner transition semantics. |
66
+ | Emit shell scripts that delete old owners | This would combine planning with mutation and bypass caller-owned review. |
67
+
68
+ ## Proof Obligations
69
+
70
+ - Unit tests prove phase order, blocker creation, and retirement action
71
+ admission only with parity evidence plus post-retirement validation commands.
72
+ - CLI tests prove stable JSON and input-shape failures.
73
+ - Package artifact tests prove public API and packed-bin behavior.
@@ -0,0 +1,105 @@
1
+ # Obligation Decision Agent Envelope Design
2
+
3
+ Status: accepted; implemented as an opt-in CLI projection.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Purpose
8
+
9
+ Obligation decision reports normalize caller-provided proof facts into one
10
+ decision state per obligation. Agents need a bounded remediation packet that
11
+ routes unsatisfied obligations without loading the full report or inferring
12
+ commands that the decision layer does not own.
13
+
14
+ Formal goal:
15
+
16
+ ```text
17
+ caller-owned obligation decision report
18
+ -> bounded agent guidance envelope
19
+ -> caller-owned proof repair, rerun, policy decision, or receipt refresh
20
+ ```
21
+
22
+ ## Authority Boundary
23
+
24
+ Proofkit owns:
25
+
26
+ - deterministic envelope construction from an obligation-decision report;
27
+ - bounded requirement and proof-route context refs for actionable decisions;
28
+ - evidence context refs for caller-provided evidence refs;
29
+ - receipt refs for missing receipt classes;
30
+ - clarification questions for unknown scope, unavailable live evidence, and
31
+ admitted deferrals;
32
+ - blocked preconditions for blocked, unavailable, or unknown-scope decisions;
33
+ - omitted-count records when the decision or receipt-ref set exceeds the
34
+ envelope limit.
35
+
36
+ The consuming repository owns:
37
+
38
+ - requirement meaning;
39
+ - proof route adequacy;
40
+ - native witness execution;
41
+ - producer authentication;
42
+ - receipt freshness;
43
+ - deferral, live availability, scope, merge, release, and rollout policy.
44
+
45
+ Formal rule:
46
+
47
+ ```text
48
+ The obligation-decision report owns normalized state.
49
+ The obligation-decision envelope owns bounded remediation routing.
50
+ The consuming repository owns the facts and policy behind each state.
51
+ ```
52
+
53
+ ## Invariants
54
+
55
+ - `obligation-decision --agent-envelope` is opt-in; ordinary
56
+ `obligation-decision` JSON output remains unchanged.
57
+ - The envelope never invents command refs because obligation-decision input does
58
+ not contain command shape.
59
+ - Actionable decisions are selected from states other than `satisfied` and
60
+ `not_applicable`.
61
+ - Requirement refs and proof-route refs are emitted as context refs, not as
62
+ new requirement or proof authority.
63
+ - Missing receipt decisions emit required receipt-class refs.
64
+ - Decisions with caller-provided evidence refs emit evidence context refs, not
65
+ receipt-artifact refs, because the obligation-decision model does not type
66
+ evidence refs as receipt artifacts.
67
+ - Unknown-scope, unavailable-live, deferred, and blocked-precondition states
68
+ route to caller-owned questions or blockers instead of becoming Proofkit
69
+ policy.
70
+ - Omitted records require the caller to inspect the full decision report or run
71
+ a wider caller-owned gate.
72
+
73
+ ## Rejected Alternatives
74
+
75
+ | Alternative | Rejection reason |
76
+ |---|---|
77
+ | Add command refs to obligation-decision envelopes | The report does not own command shape; inventing command refs would create false authority. |
78
+ | Make the envelope the default `obligation-decision` output | Existing callers need the canonical deterministic report unless they opt into agent presentation. |
79
+ | Treat advisory or deferred decisions as hidden pass states | They must stay visible and caller-owned even when they do not block this generic report. |
80
+ | Resolve producer, freshness, live, or scope policy in Proofkit | Those facts depend on consumer CI, credentials, environment, and rollout policy. |
81
+
82
+ ## Proof Obligations
83
+
84
+ - CLI tests prove ordinary `obligation-decision` output remains unchanged.
85
+ - CLI tests prove `obligation-decision --agent-envelope` emits a bounded packet
86
+ with no command refs, requirement/proof-route context refs, receipt refs, and
87
+ route/verify actions.
88
+ - CLI tests prove malformed obligation-decision input in agent-envelope mode
89
+ returns deterministic invalid-input JSON.
90
+ - Package artifact tests prove the design note is shipped with the public
91
+ package.
92
+
93
+ ## Non-Claims
94
+
95
+ Obligation decision agent envelopes do not claim:
96
+
97
+ - native command execution;
98
+ - receipt freshness;
99
+ - producer authentication;
100
+ - proof adequacy;
101
+ - changed-scope completeness;
102
+ - merge approval;
103
+ - release approval;
104
+ - rollout approval;
105
+ - repository policy ownership.
@@ -0,0 +1,100 @@
1
+ # Obligation Decision State Design
2
+
3
+ ## Decision
4
+
5
+ Proofkit provides an `obligation-decision` primitive that converts
6
+ caller-provided obligation facts into one closed decision state per obligation.
7
+
8
+ The primitive owns the deterministic priority lattice and report grammar only.
9
+ It does not authenticate producers, execute commands, compute freshness, infer
10
+ scope, approve merge, or decide repository policy.
11
+
12
+ ## Problem
13
+
14
+ Proofkit already validates receipt producer admission and selective gate
15
+ evidence. Those reports expose useful diagnostics, but they do not provide one
16
+ generic closed decision vocabulary for a requirement proof obligation.
17
+
18
+ A raw receipt can have several facts at once: stale, failed, malformed, and
19
+ produced by a non-admitted runner. If each consumer, agent, or gate chooses a
20
+ different label, proof status becomes ambiguous.
21
+
22
+ The architecture therefore needs a small reusable layer:
23
+
24
+ ```text
25
+ caller-owned obligation facts -> priority lattice -> one obligation decision
26
+ ```
27
+
28
+ ## Boundary
29
+
30
+ Proofkit owns:
31
+
32
+ - the closed decision state vocabulary;
33
+ - the priority order between candidate states;
34
+ - exact input admission for obligation decision records;
35
+ - deterministic report output, counts, diagnostics, and rule statuses.
36
+
37
+ The consuming repository owns:
38
+
39
+ - requirement meaning and proof route adequacy;
40
+ - which facts apply to an obligation;
41
+ - producer admission policy and producer authentication;
42
+ - receipt freshness, scope classification, live availability, and deferral
43
+ policy;
44
+ - merge, release, rollout, and production readiness decisions.
45
+
46
+ ## State Lattice
47
+
48
+ When several candidate states apply to the same obligation, the strongest state
49
+ in this priority order wins:
50
+
51
+ ```text
52
+ invalid_producer >
53
+ invalid_receipt >
54
+ stale_receipt >
55
+ failed >
56
+ missing_receipt >
57
+ blocked_missing_precondition >
58
+ unavailable_live >
59
+ unknown_scope >
60
+ deferred_admitted >
61
+ advisory_skipped >
62
+ not_applicable >
63
+ satisfied
64
+ ```
65
+
66
+ This prevents a raw green command from hiding a stronger invalid producer,
67
+ invalid receipt, stale receipt, missing receipt, blocked-precondition, or
68
+ unknown-scope fact.
69
+
70
+ ## Invariant
71
+
72
+ Every obligation decision report must be total:
73
+
74
+ - every obligation has at least one candidate state;
75
+ - every obligation emits exactly one selected decision state;
76
+ - candidate state ordering in the input does not affect output;
77
+ - a blocking obligation only satisfies this report when its selected state is
78
+ `satisfied` or `not_applicable`;
79
+ - advisory or deferred decisions remain visible but do not become hidden merge
80
+ approval.
81
+
82
+ ## Rejected Alternatives
83
+
84
+ | Alternative | Rejection |
85
+ |---|---|
86
+ | Add the lattice only inside `selective-gate-evidence` | Too narrow; obligation decisions are generic and may be used by non-selective gates. |
87
+ | Let callers submit a final state with no candidate facts | That would not prove deterministic conflict resolution. |
88
+ | Authenticate CI producers in Proofkit | Producer trust roots and CI identity are consumer-owned. |
89
+ | Treat `deferred_admitted` as equivalent to pass | Deferral may be admissible only under consumer policy and does not satisfy a blocking proof. |
90
+ | Wire all existing reports to the new primitive in the first batch | That risks behavior drift; the first slice must be additive and bounded. |
91
+
92
+ ## Proof Obligations
93
+
94
+ - Unit tests prove priority ordering, input-order independence, per-state
95
+ report status mapping, and blocking obligation failure classification.
96
+ - CLI tests prove deterministic JSON output from file and stdin.
97
+ - Package artifact tests prove public export, installed-bin behavior, version,
98
+ and packaged design note.
99
+ - Full package checks prove the additive primitive does not regress existing
100
+ reports.
@@ -0,0 +1,80 @@
1
+ # Package Runtime Dependency Admission Design
2
+
3
+ Status: implemented.
4
+
5
+ Owner: `proofkit`.
6
+
7
+ ## Problem
8
+
9
+ Consumer repositories sometimes need to prove that a runtime dependency seam
10
+ uses an installed external package artifact instead of a sibling workspace
11
+ source checkout. The repeated mechanics are generic: compare caller-observed
12
+ package identity, dependency spec, lockfile-entry presence, and resolution
13
+ locations, then emit deterministic non-secret diagnostics.
14
+
15
+ If every consumer reimplements those mechanics, each repository keeps bespoke
16
+ path classifiers and report formatting. If Proofkit resolves packages or reads
17
+ manifests itself, it becomes a repository scanner, package-manager authority, or
18
+ consumer policy owner.
19
+
20
+ ## Decision
21
+
22
+ Add `package-runtime-dependency-admission`, a deterministic report over
23
+ caller-provided runtime dependency facts.
24
+
25
+ The primitive validates:
26
+
27
+ - exact input shape and stable report identity;
28
+ - expected package name and exact version against caller-observed resolution
29
+ facts;
30
+ - expected dependency spec against the observed dependency spec;
31
+ - caller-provided lockfile-entry presence;
32
+ - external, local-workspace, or unadmitted location classification from
33
+ caller-provided install roots;
34
+ - deterministic non-secret diagnostics and stable report output.
35
+
36
+ `external_package` is admissible only when the observed package root is the
37
+ expected package root or inside the admitted `node_modules` root, and both the
38
+ real package root and resolved entry point are inside that admitted
39
+ `node_modules` root. Any observed local workspace root participation is
40
+ classified as `local_workspace`; any other shape is `unadmitted_package`.
41
+
42
+ ## Formal Boundary
43
+
44
+ ```text
45
+ consumer package-manager facts
46
+ -> proofkit package-runtime-dependency-admission
47
+ -> deterministic report
48
+ -> consumer-owned wrapper, receipt, and merge decision
49
+ ```
50
+
51
+ Proofkit owns only reusable admission and reporting mechanics. The consuming
52
+ repository owns how facts are collected, which package is expected, which
53
+ dependency spec is correct, which roots are admitted, which lockfile entry is
54
+ fresh, and whether the report satisfies a local gate.
55
+
56
+ ## Rejected Alternatives
57
+
58
+ | Alternative | Rejected Because |
59
+ |---|---|
60
+ | Keep the classifier only in each consumer. | This preserves duplicate path-mode logic and increases drift risk across repositories. |
61
+ | Let Proofkit resolve packages, read manifests, or inspect lockfiles. | That would add ambient filesystem/package-manager authority and make Proofkit a repository scanner. |
62
+ | Accept a broad multi-dependency policy API in this slice. | The admitted consumer need is one runtime seam; batch policy can be composed by calling the primitive per seam without expanding this public contract prematurely. |
63
+ | Classify from package names alone. | Name matching cannot distinguish external installs from sibling source checkouts. |
64
+ | Echo raw paths or dependency specs in diagnostics. | Paths and specs can expose local topology or credential-shaped material; reports should publish booleans, classes, and stable rule results only. |
65
+
66
+ ## Non-Claims
67
+
68
+ The report does not resolve packages, read manifests, read lockfiles, fetch or
69
+ authenticate registries, prove package-manager behavior, execute native
70
+ witnesses, prove proof freshness, approve merge, approve release, or choose
71
+ consumer package policy.
72
+
73
+ ## Acceptance
74
+
75
+ - malformed inputs fail closed with deterministic non-secret diagnostics;
76
+ - external, local workspace, and unadmitted locations are covered by unit tests;
77
+ - CLI supports file, stdin, and JSON Pointer input like other input-based
78
+ Proofkit commands;
79
+ - the package artifact test proves the public API, CLI, and design note are
80
+ shipped in the npm package.