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.
- package/ADOPTION.md +464 -0
- package/LICENSE +21 -0
- package/NON_CLAIMS.md +197 -0
- package/README.md +265 -0
- package/dist/agentic-proofkit +35 -0
- package/dist/platform/darwin-arm64/agentic-proofkit +0 -0
- package/dist/platform/darwin-x64/agentic-proofkit +0 -0
- package/dist/platform/linux-arm64/agentic-proofkit +0 -0
- package/dist/platform/linux-x64/agentic-proofkit +0 -0
- package/docs/adoption-checklist-report-design.md +138 -0
- package/docs/adoption-workflow-agent-envelope-design.md +67 -0
- package/docs/adoption-workflow-authority-routes-design.md +76 -0
- package/docs/adoption-workflow-contract-envelope-design.md +87 -0
- package/docs/adoption-workflow-plan-design.md +97 -0
- package/docs/agent-guidance-envelope-design.md +550 -0
- package/docs/binding-partition-admission-design.md +127 -0
- package/docs/bootstrap-agent-envelope-design.md +97 -0
- package/docs/bootstrap-materialization-manifest-design.md +100 -0
- package/docs/branch-authority-report-design.md +121 -0
- package/docs/changed-path-set-agent-envelope-design.md +70 -0
- package/docs/completion-criteria-report-design.md +132 -0
- package/docs/custom-rule-boundary-design.md +56 -0
- package/docs/deployment-evidence-admission-design.md +80 -0
- package/docs/document-lifecycle-boundary-design.md +62 -0
- package/docs/json-report-cli-adapter-design.md +83 -0
- package/docs/migration-parity-admission-design.md +90 -0
- package/docs/migration-plan-design.md +73 -0
- package/docs/obligation-decision-agent-envelope-design.md +105 -0
- package/docs/obligation-decision-state-design.md +100 -0
- package/docs/package-runtime-dependency-admission-design.md +80 -0
- package/docs/producer-policy-self-proof-design.md +142 -0
- package/docs/project-structure-agent-envelope-design.md +121 -0
- package/docs/project-structure-scaffold-design.md +89 -0
- package/docs/proof-obligation-algebra-design.md +108 -0
- package/docs/proof-receipt-admission-design.md +108 -0
- package/docs/proofkit-contract-map.md +55 -0
- package/docs/receipt-currentness-scope-admission-design.md +103 -0
- package/docs/receipt-producer-admission-design.md +106 -0
- package/docs/receipt-trust-class-admission-design.md +113 -0
- package/docs/rendered-artifact-freshness-design.md +55 -0
- package/docs/requirement-browser-view-design.md +229 -0
- package/docs/requirement-proof-resolver-projection-design.md +97 -0
- package/docs/requirement-proof-source-set-design.md +72 -0
- package/docs/requirement-proof-view-design.md +138 -0
- package/docs/requirement-source-admission-design.md +66 -0
- package/docs/requirement-source-transition-design.md +66 -0
- package/docs/requirement-source-view-design.md +51 -0
- package/docs/scaffold-profile-plan-design.md +72 -0
- package/docs/secret-shaped-json-scan-design.md +60 -0
- package/docs/selective-evidence-obligation-decision-design.md +139 -0
- package/docs/selective-evidence-producer-admission-design.md +106 -0
- package/docs/selective-evidence-receipt-trust-class-design.md +100 -0
- package/docs/selective-gate-evidence-agent-envelope-design.md +100 -0
- package/docs/selective-gate-plan-agent-envelope-design.md +95 -0
- package/docs/selective-planner-edge-coverage-design.md +89 -0
- package/docs/spec-overview-claim-boundary-design.md +50 -0
- package/docs/spec-proof-bundle-admission-design.md +105 -0
- package/docs/specs/proofkit-consumer-infra-retirement/overview.md +44 -0
- package/docs/specs/proofkit-consumer-infra-retirement/requirements.v1.json +175 -0
- package/docs/specs/proofkit-package-boundary/overview.md +32 -0
- package/docs/specs/proofkit-package-boundary/requirements.v1.json +121 -0
- package/docs/specs/proofkit-receipt-authority/overview.md +35 -0
- package/docs/specs/proofkit-receipt-authority/requirements.v1.json +121 -0
- package/docs/specs/proofkit-spec-proof-core/overview.md +36 -0
- package/docs/specs/proofkit-spec-proof-core/requirements.v1.json +148 -0
- package/docs/witness-scheduler-plan-design.md +57 -0
- package/docs/workspace-planning-agent-envelope-design.md +101 -0
- package/docs/workspace-registry-admission-design.md +57 -0
- package/package.json +54 -0
- package/proofkit/cli-contract.v1.json +808 -0
- package/proofkit/receipt-producer-policy.json +48 -0
- package/proofkit/requirement-bindings.json +520 -0
- package/proofkit/witness-plan.json +649 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
# Agent Guidance Envelope Design
|
|
2
|
+
|
|
3
|
+
Status: accepted; implemented for the generic envelope model and bounded
|
|
4
|
+
report-specific `--agent-envelope` projections. The v1 input contract admits
|
|
5
|
+
legacy packets that omit boundedness and receipt-boundary fields, but the
|
|
6
|
+
normalized output always emits the target envelope fields.
|
|
7
|
+
|
|
8
|
+
Owner: `proofkit`.
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Proofkit emits deterministic reports, proof slices, witness plans, rendered
|
|
13
|
+
views, and adoption guidance. The reusable improvement is a common
|
|
14
|
+
agent-facing envelope that gives coding agents the smallest safe work packet:
|
|
15
|
+
what to load, what question to answer, what command to run, what remains a
|
|
16
|
+
non-claim, and when to ask a human instead of guessing.
|
|
17
|
+
|
|
18
|
+
Formal goal:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
consumer-owned evidence + proofkit generic report
|
|
22
|
+
-> deterministic agent guidance envelope
|
|
23
|
+
-> bounded agent action
|
|
24
|
+
-> caller-owned native proof
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The envelope improves agent usability without making proofkit an agent
|
|
28
|
+
orchestrator, repository scanner, policy owner, or proof freshness authority.
|
|
29
|
+
That sentence is a boundary rule, not a capability limit. Proofkit may still be
|
|
30
|
+
the reusable "one dependency" toolkit for parsing, validation, rendering,
|
|
31
|
+
scaffolding plans, migration plans, selective proof planning, and agent
|
|
32
|
+
instructions. The forbidden part is hidden authority: proofkit must not infer
|
|
33
|
+
repository truth from ambient state, silently execute native witnesses, approve
|
|
34
|
+
edits, decide merge policy, or treat generated guidance as proof freshness.
|
|
35
|
+
|
|
36
|
+
## Architecture Fit
|
|
37
|
+
|
|
38
|
+
Agent guidance envelopes are one output mode of proofkit's reference
|
|
39
|
+
infrastructure role. Proofkit receives caller-owned structured records and
|
|
40
|
+
reports, then projects bounded work packets for agents. The consuming repository
|
|
41
|
+
still owns requirement meaning, proof bindings, command and environment policy,
|
|
42
|
+
native witness execution, receipts, and rollout decisions.
|
|
43
|
+
|
|
44
|
+
The intended flow is:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
consumer structured records
|
|
48
|
+
-> proofkit validation and reports
|
|
49
|
+
-> bounded slice
|
|
50
|
+
-> agent guidance envelope
|
|
51
|
+
-> caller-owned native proof and receipt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
A slice is the selected proof subgraph relevant to a task. An envelope is that
|
|
55
|
+
slice plus context refs, commands, blocked preconditions, fanout class,
|
|
56
|
+
non-claims, budgets, omitted counts, cost contract, escalation rule, and
|
|
57
|
+
clarification questions. The envelope must be generated on demand; it is not a routine
|
|
58
|
+
tracked repository artifact and never becomes
|
|
59
|
+
canonical proof source.
|
|
60
|
+
|
|
61
|
+
## Swiss-Army-Knife Boundary
|
|
62
|
+
|
|
63
|
+
The intended proofkit product shape is broad but still generic:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
agentic-proofkit parses caller-provided contracts
|
|
67
|
+
-> validates schemas and generic invariants
|
|
68
|
+
-> renders human views
|
|
69
|
+
-> builds selective plans and agent envelopes
|
|
70
|
+
-> emits scaffolding or migration instructions
|
|
71
|
+
-> caller materializes repository-specific files and runs native witnesses
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Proofkit may provide CLI commands that generate starter structures, templates,
|
|
75
|
+
repo-local script plans, migration plans, rendered views, and agent work
|
|
76
|
+
packets. Those commands must be deterministic, explicit-input driven, and
|
|
77
|
+
safe by default. If a future materializer writes files, it must be a separate
|
|
78
|
+
explicit mode with preview/dry-run semantics and caller-provided target paths;
|
|
79
|
+
the generated files become consumer-owned repository truth only after caller
|
|
80
|
+
review and commit.
|
|
81
|
+
|
|
82
|
+
Formal boundary:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
Proofkit may guide, validate, render, scaffold, and plan.
|
|
86
|
+
The consuming repository approves, materializes, executes, and owns truth.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Acceptance Criteria
|
|
90
|
+
|
|
91
|
+
Every proofkit improvement in this track must satisfy all criteria below.
|
|
92
|
+
|
|
93
|
+
1. Genericity: the mechanism must be reusable across consumer repositories and
|
|
94
|
+
must not encode product row ids, local paths, CI policy, deployment policy,
|
|
95
|
+
harness names, or rollout decisions.
|
|
96
|
+
2. Determinism: identical input must produce byte-stable output after stable
|
|
97
|
+
JSON serialization.
|
|
98
|
+
3. Progressive disclosure: output must prefer exact context refs and compact
|
|
99
|
+
next actions over broad prose.
|
|
100
|
+
4. Agent safety: output must distinguish actions, commands, clarification
|
|
101
|
+
questions, blockers, invalid inputs, and non-claims.
|
|
102
|
+
5. Non-authority: proofkit must never convert guidance, scaffolding, rendering,
|
|
103
|
+
or planning into native witness execution, proof freshness, product
|
|
104
|
+
approval, rollout approval, merge approval, or edit approval.
|
|
105
|
+
6. Fail-closed shape: malformed guidance input, duplicate ids, unknown phases,
|
|
106
|
+
missing owners, or unbound commands must be visible as report failures.
|
|
107
|
+
7. Token efficiency: the envelope must reference large evidence surfaces by
|
|
108
|
+
path, id, selector, hash, or rule id instead of embedding copied evidence.
|
|
109
|
+
8. Backward compatibility: existing report commands must keep their current
|
|
110
|
+
JSON shape unless a caller explicitly asks for the envelope.
|
|
111
|
+
9. Human reviewability: every generated action must answer why it exists, who
|
|
112
|
+
owns the decision, what proof can falsify it, and what is not claimed.
|
|
113
|
+
10. Runtime independence: proof and envelope commands may build reports,
|
|
114
|
+
envelopes, and plans only; they must not execute native witnesses, read
|
|
115
|
+
implicit repository state, invoke an LLM, publish artifacts, or call
|
|
116
|
+
external services. Scaffolding or materialization belongs to explicit future
|
|
117
|
+
modes with caller-provided targets and dry-run review; it must not be
|
|
118
|
+
hidden inside proof or envelope commands.
|
|
119
|
+
11. Primary payload placement: agent-facing commands must expose the envelope
|
|
120
|
+
as top-level output when requested, not hide the main work packet inside
|
|
121
|
+
diagnostics.
|
|
122
|
+
12. Boundedness: the envelope must declare fanout, item/file/token budgets,
|
|
123
|
+
omitted counts, stop reason, sufficiency basis, and an escalation rule
|
|
124
|
+
instead of silently expanding into a full proof graph.
|
|
125
|
+
13. Command identity: actions must reference declared caller-owned command ids
|
|
126
|
+
or structured command refs; raw command text is display metadata only and
|
|
127
|
+
must not be treated as command admission.
|
|
128
|
+
14. Receipt boundary: the envelope may cite receipts or receipt requirements,
|
|
129
|
+
but only admitted producers can satisfy merge proof obligations in the
|
|
130
|
+
consuming repository.
|
|
131
|
+
|
|
132
|
+
## Solution Space
|
|
133
|
+
|
|
134
|
+
| Option | Description | Strength | Failure Mode | Verdict |
|
|
135
|
+
|---|---|---|---|---|
|
|
136
|
+
| Free-form prompt text | CLI emits long prose prompts for agents. | Easy to read. | Token-heavy, hard to validate, easy to confuse with authority, hard to diff. | Reject. |
|
|
137
|
+
| Structured guidance envelope | CLI emits typed JSON fields for context refs, questions, actions, commands, blockers, and non-claims. | Deterministic, parseable, compact, safe to route through agents and CI. | Requires schema discipline and tests. | Choose. |
|
|
138
|
+
| Explicit workflow toolkit | CLI validates caller-provided inputs, renders views, emits plans, scaffolding manifests, and agent instructions. | Gives one-dependency adoption without hiding authority. | Needs strict dry-run/materialization boundaries. | Choose as the broader proofkit direction. |
|
|
139
|
+
| Implicit executable orchestrator | CLI scans repo ambiently, runs commands, asks LLM, writes specs, or approves edits. | Convenient for one repository. | Violates proofkit boundary and creates hidden authority. | Reject. |
|
|
140
|
+
|
|
141
|
+
For agent guidance, the structured envelope is the only option that satisfies
|
|
142
|
+
determinism, genericity, token efficiency, and non-authority at the same time.
|
|
143
|
+
|
|
144
|
+
## Chosen Model
|
|
145
|
+
|
|
146
|
+
Add a reusable `ProofkitAgentGuidanceEnvelope` model and an opt-in CLI output
|
|
147
|
+
mode. The model wraps an existing proofkit report or plan without changing the
|
|
148
|
+
underlying report authority. The implemented v1 model normalizes legacy v1
|
|
149
|
+
inputs into the target shape below, so downstream agents can consume one
|
|
150
|
+
bounded packet shape.
|
|
151
|
+
|
|
152
|
+
Target shape:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
interface ProofkitAgentGuidanceEnvelope {
|
|
156
|
+
readonly schemaVersion: 1;
|
|
157
|
+
readonly envelopeId: string;
|
|
158
|
+
readonly sourceReport: ProofkitAgentGuidanceSourceRef;
|
|
159
|
+
readonly bounds: ProofkitAgentGuidanceBounds;
|
|
160
|
+
readonly costContract: ProofkitAgentGuidanceCostContract;
|
|
161
|
+
readonly contextRefs: readonly ProofkitAgentContextRef[];
|
|
162
|
+
readonly routeQuestions: readonly ProofkitAgentRouteQuestion[];
|
|
163
|
+
readonly clarificationQuestions: readonly ProofkitAgentClarificationQuestion[];
|
|
164
|
+
readonly actionPlan: readonly ProofkitAgentAction[];
|
|
165
|
+
readonly commands: readonly ProofkitAgentCommandRef[];
|
|
166
|
+
readonly blockedPreconditions: readonly ProofkitAgentBlockedPrecondition[];
|
|
167
|
+
readonly omitted: readonly ProofkitAgentGuidanceOmission[];
|
|
168
|
+
readonly receiptRefs: readonly ProofkitAgentReceiptRef[];
|
|
169
|
+
readonly nonClaims: readonly string[];
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Required semantics:
|
|
174
|
+
|
|
175
|
+
- `sourceReport` binds the envelope to the report kind, report id, state, and
|
|
176
|
+
stable hash or caller-provided artifact ref. It does not prove report
|
|
177
|
+
authenticity, freshness, or native witness success.
|
|
178
|
+
- `bounds` declares `fanout`, item/file/token budgets, omitted counts, and the
|
|
179
|
+
escalation route when the selected graph cannot stay bounded.
|
|
180
|
+
- `costContract` declares the concrete cost and sufficiency boundary for the
|
|
181
|
+
emitted packet: loaded ref count, graph query count, receipt record count,
|
|
182
|
+
affected requirement count when known, omitted edge count, explicit omitted
|
|
183
|
+
edge accounting, stop reason, sufficiency basis, escalation, and non-claim.
|
|
184
|
+
The contract must not undercount emitted context or receipt refs. It may only
|
|
185
|
+
use `bounded_selection_complete` when the source report passed, fanout is
|
|
186
|
+
bounded, omitted count is zero, and no blocked precondition is present.
|
|
187
|
+
- `contextRefs` identify exact files, selectors, ids, hashes, or JSON pointers
|
|
188
|
+
an agent should load. Each ref also has a role, so agents can distinguish
|
|
189
|
+
spec sources, proof bindings, generated lookups, receipt sources, routers,
|
|
190
|
+
restore surfaces, owner surfaces, command registries, evidence, local
|
|
191
|
+
context, and supporting refs without loading every nearby file.
|
|
192
|
+
- `routeQuestions` are universal orientation questions, such as "what changed",
|
|
193
|
+
"what proves it", and "who owns it".
|
|
194
|
+
- `clarificationQuestions` are machine-readable questions for missing authority
|
|
195
|
+
or ambiguous evidence. They must include `askWhen`, `owner`, `blocking`, and
|
|
196
|
+
`nonClaim`.
|
|
197
|
+
- `actionPlan` gives deterministic route, bind, verify, candidate-change, and
|
|
198
|
+
promote routing labels. Each step must include owner, rationale, evidence
|
|
199
|
+
refs, commands, and non-claims. `candidate-change` never implies edit
|
|
200
|
+
approval or autofix safety; `promote` never implies rollout, readiness, or
|
|
201
|
+
policy approval.
|
|
202
|
+
- `commands` reference caller-owned native commands by stable command id or
|
|
203
|
+
structured command ref. Proofkit may show display command text, but command
|
|
204
|
+
text alone is never command admission.
|
|
205
|
+
- `blockedPreconditions` make missing external inputs explicit.
|
|
206
|
+
- `omitted` records intentionally omitted wide graph sections by count, reason,
|
|
207
|
+
and escalation route.
|
|
208
|
+
- `receiptRefs` may point at caller-provided receipts or required receipt
|
|
209
|
+
classes. They do not prove receipt freshness, producer admission, or merge
|
|
210
|
+
satisfaction unless the consuming repository admits the producer.
|
|
211
|
+
- `nonClaims` prevent agents from treating guidance as proof truth.
|
|
212
|
+
|
|
213
|
+
The current implementation always emits `bounds`, `costContract`, `omitted`,
|
|
214
|
+
and `receiptRefs` in normalized output. Compatibility defaults are allowed only
|
|
215
|
+
for old v1 input packets and must be conservative: they can describe item
|
|
216
|
+
counts and missing token-budget authority, but they must not claim
|
|
217
|
+
tokenizer-specific coverage, bounded sufficiency, or proof completeness.
|
|
218
|
+
|
|
219
|
+
## Related Infrastructure Contracts
|
|
220
|
+
|
|
221
|
+
The envelope design relies on these generic proofkit contracts without making
|
|
222
|
+
the envelope itself responsible for all of them.
|
|
223
|
+
|
|
224
|
+
### Deterministic Reports
|
|
225
|
+
|
|
226
|
+
Machine reports may authoritatively describe one proofkit validation or planner
|
|
227
|
+
output, but they must not own requirement meaning, proof routes, run facts, or
|
|
228
|
+
merge approval. Every machine-consumed report must have stable rule ids,
|
|
229
|
+
severity, source artifact, message, remediation or next-step hint, sorted lists
|
|
230
|
+
unless order-sensitive, and non-secret diagnostics. Timestamps belong only in
|
|
231
|
+
runtime-observation records.
|
|
232
|
+
|
|
233
|
+
### Receipt Admission
|
|
234
|
+
|
|
235
|
+
A receipt records observed proof. It is not created by an envelope. A
|
|
236
|
+
merge-satisfying receipt must bind source revision, plan, proof binding,
|
|
237
|
+
command, environment or precondition digest, witness selectors, toolchain or
|
|
238
|
+
lockfile digest, admitted producer identity, result, and artifact or log
|
|
239
|
+
hashes. Local receipts are advisory unless the consumer admits their producer
|
|
240
|
+
for the proof class.
|
|
241
|
+
|
|
242
|
+
### Witness Commands
|
|
243
|
+
|
|
244
|
+
Proofkit command guidance must prefer stable command ids and structured command
|
|
245
|
+
metadata. Prefix-only command admission is rejected because it cannot encode
|
|
246
|
+
cwd, argv shape, environment allowlist, timeout, network policy, credential
|
|
247
|
+
class, cache policy, expected artifacts, exit-code policy, or parallel group.
|
|
248
|
+
|
|
249
|
+
### Cache And Scheduler
|
|
250
|
+
|
|
251
|
+
Cache and scheduler output may accelerate proof planning, but cached witness
|
|
252
|
+
success is evidence-adjacent, not proof authority. Cache keys must be
|
|
253
|
+
engine/schema/profile/input/command/env/credential/platform sensitive. Live,
|
|
254
|
+
credentialed, attended, or production witness success must never be reused as
|
|
255
|
+
ordinary local proof. Scheduler output must be deterministic and respect
|
|
256
|
+
parallel groups and shared-resource classes.
|
|
257
|
+
|
|
258
|
+
### Consumer Profiles And Custom Rules
|
|
259
|
+
|
|
260
|
+
Consumer profiles are the adapter between proofkit and repository topology.
|
|
261
|
+
Custom rules may add deterministic findings, but they must never suppress or
|
|
262
|
+
downgrade generic proofkit failures. If a custom rule becomes the main way to
|
|
263
|
+
implement an invariant, the invariant should move into proofkit or back into
|
|
264
|
+
repository-local tooling.
|
|
265
|
+
|
|
266
|
+
### Parity Migration
|
|
267
|
+
|
|
268
|
+
When proof infrastructure is extracted into proofkit or replaced by a proofkit
|
|
269
|
+
primitive, parity is a temporary migration oracle. It proves extraction
|
|
270
|
+
equivalence, not correctness. Accepted defects need stable ids, owners, expiry
|
|
271
|
+
or review conditions, and removal tests.
|
|
272
|
+
|
|
273
|
+
## CLI Contract
|
|
274
|
+
|
|
275
|
+
Add opt-in flags instead of changing existing commands:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
agentic-proofkit <command> --input <path> --agent-envelope
|
|
279
|
+
agentic-proofkit <command> --input <path> --agent-envelope --format json
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Shipped agent-envelope commands:
|
|
283
|
+
|
|
284
|
+
- `adoption-workflow-plan`
|
|
285
|
+
- `changed-path-set`
|
|
286
|
+
- `gradual-adoption-bootstrap`
|
|
287
|
+
- `gradual-adoption-guidance`
|
|
288
|
+
- `obligation-decision`
|
|
289
|
+
- `scaffold-project-structure`
|
|
290
|
+
- `selective-gate-plan`
|
|
291
|
+
- `selective-gate-evidence`
|
|
292
|
+
- `workspace-changed-package-plan`
|
|
293
|
+
- `workspace-shard-partition`
|
|
294
|
+
|
|
295
|
+
Later workflow-helper candidates:
|
|
296
|
+
|
|
297
|
+
- `scaffold-profile-plan` to emit a caller-reviewed repository profile plan;
|
|
298
|
+
- `migration-plan` to emit parity snapshots and old-proof-owner retirement
|
|
299
|
+
steps;
|
|
300
|
+
- `requirement-source-view` and `requirement-proof-view` to emit bounded
|
|
301
|
+
presentation envelopes over already-renderable source/proof views when a
|
|
302
|
+
future use case proves that view output needs additional agent routing beyond
|
|
303
|
+
the existing JSON, Markdown, and HTML renderers.
|
|
304
|
+
|
|
305
|
+
Future envelope support should still not be added to every command by default.
|
|
306
|
+
It should follow the same admission logic as the shipped projections:
|
|
307
|
+
|
|
308
|
+
1. `gradual-adoption-guidance`, because it already owns agent action phases and
|
|
309
|
+
guidance payloads.
|
|
310
|
+
2. `selective-gate-plan`, because it already emits required commands and
|
|
311
|
+
skipped-gate reasons.
|
|
312
|
+
3. `requirement-bindings` or `proof-slice`, if a future use case proves that
|
|
313
|
+
their requirement-to-witness routing needs an agent envelope instead of the
|
|
314
|
+
existing JSON report or slice output.
|
|
315
|
+
|
|
316
|
+
`changed-path-set` is admitted only as a bounded JSON-pointer projection over
|
|
317
|
+
an existing report: it routes caller-supplied path facts, keeps commands and
|
|
318
|
+
receipt refs empty, and does not prove source freshness or completeness.
|
|
319
|
+
Commands such as `impact` and API-only helpers such as `readiness-closeout`
|
|
320
|
+
remain later candidates only after a deterministic mapping is proved.
|
|
321
|
+
`readiness-closeout` needs an additional fence because it is adjacent to product
|
|
322
|
+
readiness. If supported later, the envelope may project only caller-provided
|
|
323
|
+
rows, rules, and actions, and every readiness meaning must be marked
|
|
324
|
+
caller-owned.
|
|
325
|
+
|
|
326
|
+
Invalid input for agent-envelope mode should return deterministic JSON when it
|
|
327
|
+
can do so without hiding parse failure. Plain stderr is acceptable for ordinary
|
|
328
|
+
human CLI misuse, but machine-facing agent workflows should receive a stable
|
|
329
|
+
invalid-input envelope with exit code `1`, no native-proof implication, and a
|
|
330
|
+
non-claim.
|
|
331
|
+
|
|
332
|
+
Scaffolding and migration helpers should follow a stricter default: emit plans,
|
|
333
|
+
templates, or dry-run manifests first. Any future write mode must be explicit,
|
|
334
|
+
idempotent, target-scoped, and separate from proof or envelope commands.
|
|
335
|
+
|
|
336
|
+
## Clarification Questions
|
|
337
|
+
|
|
338
|
+
Clarification questions are useful, but they must be structured questions, not
|
|
339
|
+
free-form prompts. A safe question record answers:
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
interface ProofkitAgentClarificationQuestion {
|
|
343
|
+
readonly questionId: string;
|
|
344
|
+
readonly askWhen: string;
|
|
345
|
+
readonly owner: "consumer_repository" | string;
|
|
346
|
+
readonly blocking: boolean;
|
|
347
|
+
readonly question: string;
|
|
348
|
+
readonly expectedAnswerKind:
|
|
349
|
+
| "owner_decision"
|
|
350
|
+
| "missing_context_ref"
|
|
351
|
+
| "missing_witness"
|
|
352
|
+
| "blocked_external_input"
|
|
353
|
+
| "policy_choice";
|
|
354
|
+
readonly evidenceRefs: readonly string[];
|
|
355
|
+
readonly nonClaim: string;
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
This gives agents enough direction to ask a precise human question while
|
|
360
|
+
keeping answer authority outside proofkit.
|
|
361
|
+
|
|
362
|
+
## Spec Invariant Extraction Guidance
|
|
363
|
+
|
|
364
|
+
It is useful to add a proofkit mechanism that guides agents through invariant
|
|
365
|
+
extraction from design documents and code, but proofkit must not run the LLM,
|
|
366
|
+
read the repository, or decide the final requirements. The admissible owner is
|
|
367
|
+
a deterministic guidance/report schema, not an extraction engine with hidden
|
|
368
|
+
semantic authority.
|
|
369
|
+
|
|
370
|
+
Two modes are justified.
|
|
371
|
+
|
|
372
|
+
### Retrospective Baseline Mode
|
|
373
|
+
|
|
374
|
+
Use when a repository already has implemented code on `master` and wants to
|
|
375
|
+
construct or improve specifications after the fact.
|
|
376
|
+
|
|
377
|
+
Inputs are caller-provided:
|
|
378
|
+
|
|
379
|
+
- implemented surface refs;
|
|
380
|
+
- existing tests and proof refs;
|
|
381
|
+
- existing specs, if any;
|
|
382
|
+
- caller-provided code summaries or extracted candidate invariants;
|
|
383
|
+
- explicit non-claims and confidence class.
|
|
384
|
+
|
|
385
|
+
Output:
|
|
386
|
+
|
|
387
|
+
- candidate requirement records;
|
|
388
|
+
- evidence refs that support or contradict each candidate;
|
|
389
|
+
- missing witness obligations;
|
|
390
|
+
- clarification questions for ambiguous behavior;
|
|
391
|
+
- non-claims that prevent retrospective inference from becoming authority.
|
|
392
|
+
|
|
393
|
+
Formal constraint:
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
implemented behavior can suggest candidate requirements
|
|
397
|
+
but only caller review can promote candidates to specification authority
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Pull Request Design Mode
|
|
401
|
+
|
|
402
|
+
Use while a PR is open and the design document, implementation, and tests are
|
|
403
|
+
still current.
|
|
404
|
+
|
|
405
|
+
Inputs are caller-provided:
|
|
406
|
+
|
|
407
|
+
- design document refs;
|
|
408
|
+
- implementation plan refs;
|
|
409
|
+
- changed paths;
|
|
410
|
+
- candidate requirement ids;
|
|
411
|
+
- witness commands and receipts;
|
|
412
|
+
- open clarification answers, if any.
|
|
413
|
+
|
|
414
|
+
Output:
|
|
415
|
+
|
|
416
|
+
- proposed requirement additions or changes;
|
|
417
|
+
- proof binding obligations for the changed requirements;
|
|
418
|
+
- caller-reported possible stale-route warnings if implementation changed
|
|
419
|
+
without matching spec routes;
|
|
420
|
+
- clarification questions before merge;
|
|
421
|
+
- PR closeout guidance that says which caller-owned files may need review or
|
|
422
|
+
update.
|
|
423
|
+
|
|
424
|
+
Formal constraint:
|
|
425
|
+
|
|
426
|
+
```text
|
|
427
|
+
open PR design docs are current evidence only inside the PR review window;
|
|
428
|
+
merged stable specs become the durable authority after caller approval
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Extraction Guidance Non-Claims
|
|
432
|
+
|
|
433
|
+
Spec invariant extraction guidance must not claim:
|
|
434
|
+
|
|
435
|
+
- the extracted invariant is true;
|
|
436
|
+
- the design document is current after merge;
|
|
437
|
+
- the implementation is correct;
|
|
438
|
+
- the tests are sufficient;
|
|
439
|
+
- the candidate requirement is approved;
|
|
440
|
+
- the candidate proof binding is fresh;
|
|
441
|
+
- the repository may skip caller-owned review.
|
|
442
|
+
|
|
443
|
+
## API Boundary
|
|
444
|
+
|
|
445
|
+
The generic envelope module is:
|
|
446
|
+
|
|
447
|
+
- `internal/kernel/agentenvelope/agentenvelope.go`
|
|
448
|
+
- exported builder/admission functions from package root;
|
|
449
|
+
- Go tests that exercise agent-envelope CLI projections;
|
|
450
|
+
- CLI support behind `--agent-envelope`;
|
|
451
|
+
- README and `NON_CLAIMS.md` updates.
|
|
452
|
+
|
|
453
|
+
Public functions:
|
|
454
|
+
|
|
455
|
+
```ts
|
|
456
|
+
buildProofkitAgentGuidanceEnvelope(input)
|
|
457
|
+
admitProofkitAgentGuidanceEnvelope(input)
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
The builder should be report-family agnostic and accept caller-provided mapping
|
|
461
|
+
rules. A helper named as if a report alone can determine a complete action plan
|
|
462
|
+
is rejected: a report usually lacks enough semantic context to own route,
|
|
463
|
+
owner, or edit guidance. Report-specific projectors can be added only when a
|
|
464
|
+
repeated generic mapping is proven.
|
|
465
|
+
|
|
466
|
+
## Extension Rule
|
|
467
|
+
|
|
468
|
+
Envelope support is shipped for report families that already own enough
|
|
469
|
+
structured routing data to produce a bounded packet without inventing
|
|
470
|
+
repository policy. New report-specific envelope projectors are admitted only
|
|
471
|
+
when all of these predicates hold:
|
|
472
|
+
|
|
473
|
+
1. The source report already contains stable selectors, omitted counts, command
|
|
474
|
+
refs or explicit non-command reasons, and consumer-owned context refs.
|
|
475
|
+
2. The projector can preserve all non-claims from the source report.
|
|
476
|
+
3. The envelope stays bounded by selector references and summary counts rather
|
|
477
|
+
than embedding full graphs or rendered documents.
|
|
478
|
+
4. The output does not approve edits, satisfy merge obligations, authenticate
|
|
479
|
+
receipts, infer commands, or decide proof freshness.
|
|
480
|
+
5. A test proves the exact JSON shape, invalid-input behavior, and one
|
|
481
|
+
overclaim rejection.
|
|
482
|
+
|
|
483
|
+
## Proof Obligations
|
|
484
|
+
|
|
485
|
+
Required proof for implementation:
|
|
486
|
+
|
|
487
|
+
- stable JSON snapshot tests for envelope output;
|
|
488
|
+
- negative tests for duplicate ids, missing owners, unknown phases, and empty
|
|
489
|
+
non-claims;
|
|
490
|
+
- negative tests for invalid roles, bounds that understate emitted items,
|
|
491
|
+
omitted-count mismatches, invalid omission counts, unsafe receipt artifacts,
|
|
492
|
+
and receipt refs bound to undeclared command ids;
|
|
493
|
+
- CLI tests proving existing commands keep old output unless
|
|
494
|
+
`--agent-envelope` is used;
|
|
495
|
+
- tests proving clarification questions are emitted only as structured data;
|
|
496
|
+
- tests proving top-level agent payload placement for agent-envelope mode;
|
|
497
|
+
- tests proving invalid-input agent-envelope mode emits deterministic JSON when
|
|
498
|
+
parsing succeeds far enough to classify the failure;
|
|
499
|
+
- a guidance-mode truth table for mode, checked scope, source report state,
|
|
500
|
+
missing bindings, and blocked preconditions;
|
|
501
|
+
- command-binding tests proving action commands reference declared caller-owned
|
|
502
|
+
commands;
|
|
503
|
+
- tests proving extraction guidance emits candidates, not approved
|
|
504
|
+
requirements;
|
|
505
|
+
- package artifact test proving the new public module is included;
|
|
506
|
+
- consumer proof in one repository before declaring the envelope useful.
|
|
507
|
+
|
|
508
|
+
## Rejected Alternatives
|
|
509
|
+
|
|
510
|
+
### Put Long Prompts In CLI Output
|
|
511
|
+
|
|
512
|
+
Rejected because long prompts are hard to validate, inflate context, and blur
|
|
513
|
+
the line between guidance and authority. Structured questions and action
|
|
514
|
+
records give the same information with less ambiguity.
|
|
515
|
+
|
|
516
|
+
### Let Proofkit Inspect The Repository Implicitly
|
|
517
|
+
|
|
518
|
+
Rejected because implicit scanning would make proofkit own consumer topology and
|
|
519
|
+
proof freshness. Consumers must provide facts, profiles, paths, or explicit
|
|
520
|
+
input files; proofkit validates and projects them. Explicit parsing of
|
|
521
|
+
caller-provided files is allowed, but ambient repository discovery is not proof
|
|
522
|
+
authority.
|
|
523
|
+
|
|
524
|
+
### Let Proofkit Generate Specs Directly As Authority
|
|
525
|
+
|
|
526
|
+
Rejected for the first implementation because it would make candidate
|
|
527
|
+
requirements look authoritative. The correct first step is candidate extraction
|
|
528
|
+
guidance plus caller-owned promotion.
|
|
529
|
+
|
|
530
|
+
### Hide Scaffolding Inside Proof Commands
|
|
531
|
+
|
|
532
|
+
Rejected because a command that both validates proof and writes repository
|
|
533
|
+
files would blur planning, materialization, and authority. Scaffolding belongs
|
|
534
|
+
to explicit plan or dry-run materialization commands, with caller-owned review
|
|
535
|
+
before commit.
|
|
536
|
+
|
|
537
|
+
## Completion Definition
|
|
538
|
+
|
|
539
|
+
This design is complete when proofkit can emit one common, deterministic,
|
|
540
|
+
parseable agent guidance envelope for selected reports; when consumers can use
|
|
541
|
+
that envelope to decide what to load, ask, run, and update; and when every
|
|
542
|
+
output clearly states that proofkit guidance is not native proof execution,
|
|
543
|
+
repository policy, product approval, merge approval, edit approval, proof
|
|
544
|
+
freshness, or rollout authority.
|
|
545
|
+
|
|
546
|
+
Full architecture alignment additionally requires structured command identity,
|
|
547
|
+
deterministic report hygiene, cache/scheduler safety, monotone custom-rule
|
|
548
|
+
boundaries, and defect-aware parity migration contracts. Envelope families
|
|
549
|
+
beyond `gradual-adoption-guidance` must emit the same boundedness and
|
|
550
|
+
receipt-boundary fields before they can claim target-shape support.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Binding Partition Admission Design
|
|
2
|
+
|
|
3
|
+
## Decision
|
|
4
|
+
|
|
5
|
+
Proofkit provides a `binding-partition` primitive that validates
|
|
6
|
+
caller-provided proof-route ownership partition facts.
|
|
7
|
+
|
|
8
|
+
The primitive owns generic consistency checks only:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
declared proof routes
|
|
12
|
+
-> one canonical route owner
|
|
13
|
+
-> declared binding surface
|
|
14
|
+
-> declared selector space
|
|
15
|
+
-> exact cross-owner or cross-surface delegation when referenced externally
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
It does not infer owners from paths, globs, packages, names, or generated
|
|
19
|
+
graphs. It does not evaluate requirement meaning, proof adequacy, native witness
|
|
20
|
+
results, receipt freshness, or merge readiness.
|
|
21
|
+
|
|
22
|
+
## Problem
|
|
23
|
+
|
|
24
|
+
Spec-first proof bindings need more than route existence. They need a reviewable
|
|
25
|
+
partition:
|
|
26
|
+
|
|
27
|
+
- every proof route has exactly one canonical owner;
|
|
28
|
+
- binding surfaces own explicit selector space;
|
|
29
|
+
- cross-owner and cross-surface references are deliberate, not accidental;
|
|
30
|
+
- oversized or unrelated binding surfaces are evaluated only against
|
|
31
|
+
caller-owned thresholds.
|
|
32
|
+
|
|
33
|
+
Without this layer, a generated graph can show route refs while hiding duplicate
|
|
34
|
+
route owners, selector overlap, or cross-owner references with no admitted
|
|
35
|
+
delegation.
|
|
36
|
+
|
|
37
|
+
## Boundary
|
|
38
|
+
|
|
39
|
+
Proofkit owns:
|
|
40
|
+
|
|
41
|
+
- exact input admission for binding partition records;
|
|
42
|
+
- one-owner-per-route checks over caller-declared `proofRouteRefs`;
|
|
43
|
+
- route owner to surface owner consistency;
|
|
44
|
+
- route selector to surface selector consistency;
|
|
45
|
+
- duplicate selector ownership detection;
|
|
46
|
+
- route reference source-surface and source-owner consistency;
|
|
47
|
+
- route reference resolution to canonical route owners;
|
|
48
|
+
- exact delegation matching for cross-owner or cross-surface references;
|
|
49
|
+
- optional surface threshold checks when thresholds are caller-provided;
|
|
50
|
+
- deterministic report output, summaries, diagnostics, and failed ids.
|
|
51
|
+
|
|
52
|
+
The consuming repository owns:
|
|
53
|
+
|
|
54
|
+
- requirement meaning;
|
|
55
|
+
- which proof routes exist;
|
|
56
|
+
- surface taxonomy and owners;
|
|
57
|
+
- selector semantics;
|
|
58
|
+
- threshold values and cohesion-group meaning;
|
|
59
|
+
- delegation policy;
|
|
60
|
+
- evidence authenticity;
|
|
61
|
+
- witness execution and proof adequacy;
|
|
62
|
+
- receipt freshness;
|
|
63
|
+
- merge, release, rollout, and production readiness decisions.
|
|
64
|
+
|
|
65
|
+
## Input Model
|
|
66
|
+
|
|
67
|
+
The caller provides:
|
|
68
|
+
|
|
69
|
+
- `proofRouteRefs`: the closed universe of proof routes to admit;
|
|
70
|
+
- `bindingSurfaces`: owner and selector-space declarations;
|
|
71
|
+
- `routeOwners`: canonical owner records for proof routes;
|
|
72
|
+
- `routeReferences`: places where one owner or surface references a route;
|
|
73
|
+
- `delegations`: exact source-to-target delegation records;
|
|
74
|
+
- `surfaceThresholds`: optional caller-owned size/cohesion limits.
|
|
75
|
+
|
|
76
|
+
Proofkit does not provide default thresholds. A surface is oversized only when
|
|
77
|
+
the caller provided the corresponding threshold.
|
|
78
|
+
|
|
79
|
+
## Delegation Rule
|
|
80
|
+
|
|
81
|
+
Non-empty `delegationRefs` are not enough.
|
|
82
|
+
|
|
83
|
+
A cross-owner or cross-surface route reference is admitted only when at least
|
|
84
|
+
one referenced delegation exactly matches:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
fromOwnerId/fromSurfaceId == referrerOwnerId/referrerSurfaceId
|
|
88
|
+
toOwnerId/toSurfaceId == canonical route owner/surface
|
|
89
|
+
proofRouteRefs contains referenced proofRouteRef
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
This prevents a broad or unrelated delegation from masking route ownership
|
|
93
|
+
drift.
|
|
94
|
+
|
|
95
|
+
## Invariants
|
|
96
|
+
|
|
97
|
+
- Every declared proof route has exactly one route owner.
|
|
98
|
+
- Route owners cannot claim a surface owned by another owner.
|
|
99
|
+
- Route owner selectors must be declared by that same surface.
|
|
100
|
+
- A selector cannot be owned by multiple surfaces.
|
|
101
|
+
- Route references must start from a declared surface owned by the referrer.
|
|
102
|
+
- Route references must resolve to one canonical route owner.
|
|
103
|
+
- Cross-owner or cross-surface route references require exact delegation.
|
|
104
|
+
- Route owners and references outside `proofRouteRefs` fail closed.
|
|
105
|
+
- Threshold findings are produced only from caller-provided thresholds.
|
|
106
|
+
- Input order and host locale do not affect output order or stable JSON.
|
|
107
|
+
|
|
108
|
+
## Rejected Alternatives
|
|
109
|
+
|
|
110
|
+
| Alternative | Rejection |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Infer owners from file paths or package names | That would put repository topology policy inside Proofkit. |
|
|
113
|
+
| Treat any non-empty `delegationRefs` as sufficient | That allows unrelated delegation records to hide ownership drift. |
|
|
114
|
+
| Bake in maximum route or selector counts | Surface size is repository policy; Proofkit may only enforce caller-provided thresholds. |
|
|
115
|
+
| Merge this into `requirement-bindings` | Flat binding validation and partition authority are different review questions. |
|
|
116
|
+
| Merge this into `proof-obligation-algebra` | Algebra validates proof composition; partition admission validates proof-route ownership. |
|
|
117
|
+
|
|
118
|
+
## Proof Obligations
|
|
119
|
+
|
|
120
|
+
- Unit tests prove admitted ownership, exact delegation, threshold behavior,
|
|
121
|
+
selector ownership, closed route universe, and stable JSON.
|
|
122
|
+
- Negative tests prove missing owners, duplicate owners, undeclared routes,
|
|
123
|
+
unmatched delegations, owner/surface drift, selector overlap, unsafe evidence
|
|
124
|
+
refs, and malformed records fail closed.
|
|
125
|
+
- CLI tests prove file/stdin parity and unsupported flags.
|
|
126
|
+
- Package artifact tests prove package binary, packed files, installed-bin
|
|
127
|
+
behavior, version, and published design note.
|