onto-mcp 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/.onto/authority/core-lexicon.yaml +11 -0
  2. package/.onto/processes/evolve/material-kind-adapter-contract.md +6 -0
  3. package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +246 -46
  4. package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +144 -0
  5. package/.onto/processes/review/binding-contract.md +8 -0
  6. package/.onto/processes/review/pre-dispatch-contracts.md +34 -13
  7. package/.onto/processes/review/productized-live-path.md +3 -1
  8. package/.onto/processes/shared/pipeline-execution-ledger-contract.md +185 -0
  9. package/.onto/processes/shared/target-material-kind-contract.md +6 -0
  10. package/AGENTS.md +3 -2
  11. package/README.md +31 -14
  12. package/dist/core-api/reconstruct-api.js +70 -0
  13. package/dist/core-api/review-api.js +622 -4
  14. package/dist/core-runtime/cli/render-review-final-output.js +9 -0
  15. package/dist/core-runtime/cli/review-invoke.js +364 -7
  16. package/dist/core-runtime/cli/run-review-prompt-execution.js +239 -90
  17. package/dist/core-runtime/pipeline-execution-ledger.js +100 -0
  18. package/dist/core-runtime/reconstruct/artifact-types.js +28 -1
  19. package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +306 -0
  20. package/dist/core-runtime/reconstruct/post-seed-validation.js +617 -0
  21. package/dist/core-runtime/reconstruct/record.js +94 -1
  22. package/dist/core-runtime/reconstruct/run.js +479 -30
  23. package/dist/core-runtime/review/continuation-plan.js +160 -0
  24. package/dist/core-runtime/review/pipeline-execution-ledger.js +250 -0
  25. package/dist/mcp/server.js +134 -23
  26. package/dist/mcp/tool-schemas.js +6 -0
  27. package/package.json +2 -2
@@ -1108,6 +1108,17 @@ terms:
1108
1108
  - "Orthogonal to medium: medium is a cross-product reference and learning frame such as excel or cli; target_material_kind is a per-run target classification."
1109
1109
  - "Orthogonal to target_input_kind: target_input_kind says how the target entered the runtime, such as single_file or git_diff; target_material_kind says what kind of material is being handled."
1110
1110
  - "Do not use review context `source_kind` for this axis. In review artifacts, source_kind identifies context-source artifacts such as materialized_input or review_target_profile."
1111
+ - term_id: "pipeline_execution_ledger"
1112
+ canonical_label: "PipelineExecutionLedger"
1113
+ korean_label: "파이프라인 실행 단위 원장"
1114
+ axis: "execution_unit"
1115
+ term_status: "active"
1116
+ definition: "Runtime-owned ledger projection that records per-unit execution status, artifact refs, hashes, trust status, and upstream/downstream boundaries across review, reconstruct, evolve, and later onto pipelines."
1117
+ notes:
1118
+ - "Primary purpose is artifact trust and provenance: which outputs are trusted, untrusted, or blocked by upstream failure."
1119
+ - "Continuation and repair flows consume this ledger, but they are not the ledger's only purpose."
1120
+ - "Semantic ledgers such as review finding-ledger.yaml and issue-ledger.yaml explain meaning; PipelineExecutionLedger explains whether the execution process that produced artifacts can be trusted."
1121
+ - "Shared process contract: .onto/processes/shared/pipeline-execution-ledger-contract.md."
1111
1122
  - term_id: "context_isolated_reasoning_unit"
1112
1123
  canonical_label: "ContextIsolatedReasoningUnit"
1113
1124
  korean_label: "맥락 격리 추론 단위"
@@ -20,6 +20,7 @@ The shared material contract is:
20
20
 
21
21
  ```text
22
22
  .onto/processes/shared/target-material-kind-contract.md
23
+ .onto/processes/shared/pipeline-execution-ledger-contract.md
23
24
  ```
24
25
 
25
26
  No `evolve` runtime or MCP tool is active in this repository. This document is
@@ -52,6 +53,7 @@ Runtime may own:
52
53
  - source and artifact refs
53
54
  - deterministic metrics and validation reports
54
55
  - unsupported or unknown material failure records
56
+ - pipeline pipeline execution ledger projection for artifact trust and provenance
55
57
 
56
58
  Host LLM and user-mediated flow own:
57
59
 
@@ -87,6 +89,7 @@ design-stage output:
87
89
  | `evolve-adapter-selection.yaml` | runtime | selected adapter id, material kind, support status, and unsupported reason |
88
90
  | `evolve-context-observations.yaml` | runtime | material-specific current-state observations without design recommendations |
89
91
  | `evolve-specification.yaml` | host LLM, user confirmed | proposed design change after inquiry and scope agreement |
92
+ | future `pipeline-execution-ledger.yaml` or status projection | runtime | trust status for target profile, adapter selection, observations, specification, validation, and final disposition units |
90
93
  | `evolve-record.yaml` | runtime assembly | artifact refs, material status, validation summaries, and final disposition refs |
91
94
 
92
95
  These names are future contract placeholders. Runtime implementation must either
@@ -111,3 +114,6 @@ When future evolve implementation starts, the first tests should prove:
111
114
  - unsupported material states produce explicit structured output
112
115
  - generated artifacts preserve `target_material_kind`
113
116
  - runtime outputs bounded observations and refs, not design decisions
117
+ - status/result surfaces expose an pipeline execution ledger projection so callers
118
+ can see which evolve artifacts are trusted, untrusted, or blocked by upstream
119
+ failure
@@ -1,6 +1,6 @@
1
1
  # Reconstruct Boundary Contract
2
2
 
3
- > Status: design contract with bounded happy-path runtime.
3
+ > Status: design contract with bounded happy-path runtime and post-Seed loop target.
4
4
  > Purpose: define how `reconstruct` should be reintroduced without reviving the
5
5
  > retired runtime ontology generator path.
6
6
 
@@ -19,10 +19,11 @@ The shared goal contract for this axis is
19
19
 
20
20
  The active full product runtime remains `review`. `reconstruct` now has a
21
21
  bounded MCP surface for source profile listing, source observation, directive
22
- validation, happy-path execution, status, and result reads. The happy path is
23
- not a general ontology generator: it requires pluggable LLM-owned directive
24
- authors and confirmation providers for Seed content, competency questions, stop
25
- decisions, and final output.
22
+ validation, post-Seed mock execution, status, and result reads. The runtime path
23
+ is not a general ontology generator: it requires pluggable LLM-owned directive
24
+ authors and confirmation providers for Seed content, claim realization,
25
+ competency questions, assessments, failure classifications, revision proposals,
26
+ stop decisions, and final output.
26
27
 
27
28
  Retired material stays retired:
28
29
 
@@ -36,8 +37,10 @@ The current design seat is:
36
37
 
37
38
  ```text
38
39
  .onto/processes/reconstruct/reconstruct-boundary-contract.md
40
+ .onto/processes/reconstruct/reconstruct-execution-ux-contract.md
39
41
  .onto/processes/reconstruct/source-profile-contract.md
40
42
  .onto/processes/reconstruct/source-profiles/
43
+ .onto/processes/shared/pipeline-execution-ledger-contract.md
41
44
  ```
42
45
 
43
46
  The planned implementation seat is:
@@ -52,15 +55,15 @@ src/mcp/server.ts
52
55
  Current runtime helpers under `src/core-runtime/reconstruct/` load source
53
56
  profiles, write preparation artifacts, validate source-observation boundaries,
54
57
  validate `SourceObservationDirective` evidence refs, validate
55
- `SeedCandidateDirective` shape plus evidence refs, compute deterministic
56
- metrics, and assemble `reconstruct-record.yaml`. The happy-path runner
57
- orchestrates these gates and delegates semantic directives to a pluggable
58
+ `SeedCandidateDirective` shape plus evidence refs, validate post-Seed artifacts,
59
+ compute deterministic metrics, and assemble `reconstruct-record.yaml`. The
60
+ runner orchestrates these gates and delegates semantic directives to a pluggable
58
61
  directive author.
59
62
 
60
63
  `src/core-api/reconstruct-api.ts` exposes these helpers as a bounded library
61
64
  facade for MCP tooling. It can prepare reconstruct artifacts, list source
62
- profiles, validate LLM-authored directive files, run the happy path, assemble
63
- records, and read status/result artifacts. It does not author semantic
65
+ profiles, validate LLM-authored directive files, run the post-Seed mock loop,
66
+ assemble records, and read status/result artifacts. It does not author semantic
64
67
  directives.
65
68
 
66
69
  Runtime implementation must not start from tool schemas alone. The ready order is:
@@ -119,6 +122,7 @@ Current concept decisions:
119
122
  | Name | Decision | Reason |
120
123
  |---|---|---|
121
124
  | `target_material_kind` | promoted shared term | Review, reconstruct, and evolve all need a target-material axis that is separate from domain, medium, target input kind, and artifact role. |
125
+ | `PipelineExecutionLedger` | promoted shared term | Review, reconstruct, evolve, and later pipelines need the same runtime-owned artifact trust/provenance projection. |
122
126
  | `source_kind` | not used for material classification | Review already uses `source_kind` for context-source artifacts. Reconstruct must not overload it to mean code/spreadsheet/document/database. |
123
127
  | `SourceProfile` | reconstruct design-local until runtime attachment | A profile guides observation for one `target_material_kind`; it is not a semantic explorer and not yet an active runtime artifact. |
124
128
  | `SourceObservation` | reconstruct design-local until runtime attachment | Runtime-produced structural observation with stable ids; not an ontology fact and not legacy `fact_type`. |
@@ -126,10 +130,15 @@ Current concept decisions:
126
130
  | `ReconstructDirective` | schema/union name | LLM-authored directive envelope, not an entity. |
127
131
  | `SeedConfirmation` | reconstruct design-local | User/host-mediated confirmation artifact for a Seed candidate; not a semantic concept by itself. |
128
132
  | `CompetencyQuestion` | reconstruct design-local | LLM-authored question artifact used to test a confirmed Seed against its declared purpose. |
133
+ | `ClaimRealization` | reconstruct design-local | Claim-level stance about whether a Seed claim is observed behavior, declared intent, contract presence, fixture-only evidence, deferred/non-goal, or unknown. |
134
+ | `CompetencyQuestionAssessment` | reconstruct design-local | LLM-authored assessment of every authoritative competency question against the confirmed Seed and evidence. |
135
+ | `FailureClassification` | reconstruct design-local | LLM-authored explanation of why a competency question or claim cannot be trusted for the declared purpose. |
136
+ | `RevisionProposal` | reconstruct design-local | LLM-authored bounded proposal to reuse, extend, rename, split, reject, or defer ontology content. |
129
137
  | `ReconstructMetrics` | reconstruct design-local | Runtime projection from existing artifacts; counts and pass rates, not a quality judgment. |
130
138
  | `StopDecision` | reconstruct design-local | LLM-authored directive that interprets metrics for the declared purpose. |
131
- | `ReconstructRunManifest` | reconstruct design-local | Runtime execution manifest for the reconstruct happy path. |
139
+ | `ReconstructRunManifest` | reconstruct design-local | Runtime execution manifest for the reconstruct mock path. |
132
140
  | `FinalOutput` | shared artifact role, reconstruct-local seat | Human-readable result text grounded in reconstruct artifacts; not an ontology draft authority. |
141
+ | `ReconstructStageId` | reconstruct design-local | Stable append-only stage identifier for progress, manifests, status reads, and implementation planning. |
133
142
  | `RuntimeGate` | design shorthand only | Runtime implementation should use specific validators, boundary policy, and failure artifacts instead of a generic public concept. |
134
143
  | `DomainContextPack` | design shorthand only | Use selected domain-document refs from invocation/binding rather than creating a new domain context entity. |
135
144
 
@@ -144,8 +153,14 @@ Current concept decisions:
144
153
  | `SourceObservation` | Runtime-produced structural fact about paths, cells, formulas, schemas, headings, symbols, or code patterns | TS runtime |
145
154
  | `ReconstructDirective` | LLM-authored structured output submitted to a runtime gate | host LLM |
146
155
  | `SeedConfirmation` | User/host-mediated decision over the Seed candidate before downstream questions and metrics | user/host mediated |
156
+ | `ClaimRealization` | Claim-level evidence stance used to separate observed runtime behavior from declared design intent, schema presence, fixture-only evidence, deferred scope, and unknowns | host LLM |
157
+ | `CompetencyQuestion` | Authoritative question set used to test the confirmed Seed for its declared purpose | host LLM |
158
+ | `CompetencyQuestionAssessment` | Answer status and evidence basis for every authoritative competency question | host LLM |
159
+ | `FailureClassification` | Cause classification for unanswered, contradicted, unsupported, or deferred questions and claims | host LLM |
160
+ | `RevisionProposal` | Bounded change proposal derived from failures and claim realization gaps | host LLM |
147
161
  | `ReconstructMetrics` | Deterministic projection from validation, confirmation, and question artifacts | TS runtime |
148
- | `ReconstructRunManifest` | Step and artifact-ref manifest for the bounded happy path | TS runtime |
162
+ | `ReconstructRunManifest` | Step and artifact-ref manifest for the bounded mock path | TS runtime |
163
+ | `PipelineExecutionLedger` | Shared trust/provenance projection over reconstruct stages, validations, outputs, and upstream/downstream boundaries | TS runtime |
149
164
  | `RuntimeGate` | Design shorthand for shape, source existence, evidence ref, and metric validation | TS runtime |
150
165
  | `DomainContextPack` | Design shorthand for domain documents selected by invocation/binding | `.onto/domains/` plus invocation binding |
151
166
 
@@ -167,7 +182,7 @@ Initial bounded tools are exposed through `src/core-api/reconstruct-api.ts`.
167
182
  | `onto.list_source_profiles` | active | list source profiles, target material kinds, scan targets, and support status | choose ontology meaning |
168
183
  | `onto.observe_source` | active | materialize target profile, inventory, source observations, and initial reconstruct record | infer entities, relations, actions, properties, or rules |
169
184
  | `onto.validate_reconstruct_directive` | active | validate LLM-authored source-observation or Seed-candidate directive shape and evidence refs | repair or rewrite the directive |
170
- | `onto.reconstruct` | active | orchestrate the bounded happy path from target refs and intent to final output, run manifest, and reconstruct record; requires explicit mock semantic/confirmation realization until live providers exist | author ontology meaning |
185
+ | `onto.reconstruct` | active | orchestrate the bounded post-Seed mock loop from target refs and intent to final output, run manifest, and reconstruct record; requires explicit mock semantic/confirmation realization until live providers exist | author ontology meaning |
171
186
  | `onto.reconstruct_status` | active | read `reconstruct-record.yaml` stage and artifact refs | infer missing semantic content |
172
187
  | `onto.reconstruct_result` | active | read record, run manifest, and final output text | rewrite or improve the result |
173
188
 
@@ -208,20 +223,159 @@ from expanding their own boundary.
208
223
  4. LLM writes SourceObservationDirective
209
224
  5. Runtime validates observation directive
210
225
  6. LLM selects domain-document context refs
211
- 7. LLM writes SeedCandidateDirective
212
- 8. Runtime validates Seed evidence and shape
213
- 9. User confirms or rejects Seed candidate
214
- 10. LLM writes competency questions
215
- 11. Runtime computes question/test metrics
216
- 12. LLM classifies failures and proposes revisions
217
- 13. Runtime validates revisions and recomputes metrics
218
- 14. LLM writes StopDecisionDirective
219
- 15. User confirms final ontology direction if needed
226
+ 7. Runtime validates domain-context selection and source snapshot refs
227
+ 8. LLM writes SeedCandidateDirective
228
+ 9. Runtime validates Seed evidence and shape
229
+ 10. LLM writes ClaimRealizationDirective
230
+ 11. Runtime validates claim realization refs and stance enums
231
+ 12. User or host confirms Seed claims at claim level
232
+ 13. Runtime validates confirmation transitions and derived claim sets
233
+ 14. LLM writes authoritative competency questions
234
+ 15. Runtime validates competency question ids, claim links, and evidence refs
235
+ 16. LLM assesses every authoritative competency question
236
+ 17. Runtime validates question assessment completeness and refs
237
+ 18. LLM classifies material failures and unresolved gaps
238
+ 19. Runtime validates failure classifications and linkage
239
+ 20. LLM proposes bounded revisions or deferrals
240
+ 21. Runtime validates revision proposal ids, targets, and actions
241
+ 22. Runtime computes deterministic metrics from artifacts
242
+ 23. LLM writes StopDecisionDirective
243
+ 24. LLM writes final decision-ready output grounded in artifact refs
244
+ 25. User confirms final ontology direction if needed
220
245
  ```
221
246
 
222
247
  This flow intentionally uses the review product pattern: LLM-authored meaning,
223
248
  runtime-owned gates, explicit artifacts, and user-facing decision points.
224
249
 
250
+ ### 7.1 Stage Registry And Evolution Rules
251
+
252
+ `ReconstructStageId` values are stable and append-only. Status, progress
253
+ presentation, run manifest steps, and future continuation logic must use these
254
+ ids rather than prose labels.
255
+
256
+ | Stage id | Required artifact boundary | Owner |
257
+ |---|---|---|
258
+ | `invocation_binding` | interpretation and binding refs | host LLM plus runtime |
259
+ | `target_material_profile` | `target-material-profile.yaml` | runtime |
260
+ | `source_inventory` | `source-inventory.yaml` | runtime |
261
+ | `source_observation` | `source-observations.yaml` | runtime |
262
+ | `observation_directive` | `source-observation-directive.yaml` | host LLM |
263
+ | `observation_directive_validation` | `source-observation-directive-validation.yaml` | runtime |
264
+ | `domain_context_selection` | `domain-context-selection.yaml` | host LLM |
265
+ | `domain_context_selection_validation` | `domain-context-selection-validation.yaml` | runtime |
266
+ | `seed_candidate` | `seed-candidate.yaml` | host LLM |
267
+ | `seed_candidate_validation` | `seed-candidate-validation.yaml` | runtime |
268
+ | `claim_realization` | `claim-realization-map.yaml` | host LLM |
269
+ | `claim_realization_validation` | `claim-realization-map-validation.yaml` | runtime |
270
+ | `seed_confirmation` | `seed-confirmation.yaml` | user/host mediated |
271
+ | `seed_confirmation_validation` | `seed-confirmation-validation.yaml` | runtime |
272
+ | `competency_questions` | `competency-questions.yaml` | host LLM |
273
+ | `competency_questions_validation` | `competency-questions-validation.yaml` | runtime |
274
+ | `competency_question_assessment` | `competency-question-assessment.yaml` | host LLM |
275
+ | `competency_question_assessment_validation` | `competency-question-assessment-validation.yaml` | runtime |
276
+ | `failure_classification` | `failure-classification.yaml` | host LLM |
277
+ | `failure_classification_validation` | `failure-classification-validation.yaml` | runtime |
278
+ | `revision_proposal` | `revision-proposal.yaml` | host LLM |
279
+ | `revision_proposal_validation` | `revision-proposal-validation.yaml` | runtime |
280
+ | `metrics` | `reconstruct-metrics.yaml` | runtime |
281
+ | `stop_decision` | `stop-decision.yaml` | host LLM |
282
+ | `final_output` | `final-output.md` | host LLM |
283
+ | `record_assembly` | `reconstruct-record.yaml` and `reconstruct-run-manifest.yaml` | runtime |
284
+
285
+ Rules:
286
+
287
+ - Existing stage ids must not be renamed after runtime exposure.
288
+ - Optional stages must be recorded as `skipped` with a reason, not omitted from
289
+ the manifest.
290
+ - Terminal halted stages must keep already-produced artifacts immutable unless a
291
+ future explicit continuation contract says otherwise.
292
+ - New stages may be appended between semantic phases only when their input and
293
+ output artifact authority is explicit.
294
+
295
+ ### 7.2 Pipeline Execution Unit Ledger
296
+
297
+ Reconstruct must map every `ReconstructStageId` into the shared
298
+ `PipelineExecutionLedger` contract. The ledger verifies artifact trust and
299
+ provenance for both runtime-owned and LLM-authored stages.
300
+
301
+ Rules:
302
+
303
+ - Runtime validation stages are trust gates for LLM-authored artifacts.
304
+ - An LLM-authored artifact may exist while its `trustStatus` remains
305
+ `untrusted` until the corresponding validation stage completes.
306
+ - A downstream stage is `blocked_by_upstream` if any required source artifact is
307
+ missing, failed validation, or belongs to an untrusted producing stage.
308
+ - `reconstruct_status` should expose the ledger, or a bounded projection of it,
309
+ so callers can see which artifacts are trustworthy and where the pipeline
310
+ halted.
311
+ - Future reconstruct continuation must derive its frontier from this ledger, not
312
+ from ad hoc file existence.
313
+
314
+ The shared contract is
315
+ `.onto/processes/shared/pipeline-execution-ledger-contract.md`.
316
+
317
+ ### 7.3 Identifier Authority
318
+
319
+ Every cross-artifact reference must point back to one authority artifact. Derived
320
+ views may expose ids, but must not become a second source of truth.
321
+
322
+ | Id family | Authority artifact |
323
+ |---|---|
324
+ | source observation ids | `source-observations.yaml` |
325
+ | selected observation ids | `source-observation-directive.yaml` |
326
+ | domain context ids and `domain_snapshot_id` | `domain-context-selection.yaml` |
327
+ | Seed claim ids | `seed-candidate.yaml` |
328
+ | claim realization ids | `claim-realization-map.yaml` |
329
+ | confirmation-derived claim sets | `seed-confirmation-validation.yaml` |
330
+ | competency question ids | `competency-questions.yaml` |
331
+ | competency question result ids | `competency-question-assessment.yaml` |
332
+ | failure ids | `failure-classification.yaml` |
333
+ | proposal ids | `revision-proposal.yaml` |
334
+
335
+ ### 7.4 Claim Realization Stances
336
+
337
+ `claim-realization-map.yaml` must classify every Seed claim with one of these
338
+ stances:
339
+
340
+ | Stance | Meaning |
341
+ |---|---|
342
+ | `observed_runtime_behavior` | The claim is supported by observed behavior in the target material. |
343
+ | `declared_design_intent` | The claim is stated as design or product intent, but runtime behavior is not directly observed. |
344
+ | `schema_or_contract_presence` | The claim is supported by a schema, type, contract, config, or interface boundary. |
345
+ | `test_or_fixture_only` | The claim is supported only by tests, fixtures, mocks, or examples. |
346
+ | `deferred_or_non_goal` | The claim belongs to deferred scope or a declared non-goal. |
347
+ | `unknown` | The available artifacts do not justify a stronger stance. |
348
+
349
+ ### 7.5 Claim Confirmation State Rules
350
+
351
+ Seed confirmation is claim-level. A single run may contain accepted, rejected,
352
+ partial, and deferred claims.
353
+
354
+ | State | Downstream rule |
355
+ |---|---|
356
+ | `accepted` | Included in the current confirmed Seed set and eligible for competency-question assessment. |
357
+ | `rejected` | Excluded from the confirmed Seed set and ineligible except for questions about rejection rationale. |
358
+ | `partial` | Excluded from the accepted claim set unless validated accepted sub-claim ids exist; unresolved count increases. |
359
+ | `deferred` | Excluded from current competency-question eligibility unless the question explicitly targets deferred scope; deferred and unresolved counts increase. |
360
+
361
+ `seed-confirmation-validation.yaml` owns the derived sets:
362
+
363
+ - `accepted_claim_ids`
364
+ - `rejected_claim_ids`
365
+ - `partial_claim_ids`
366
+ - `deferred_claim_ids`
367
+ - `cq_eligible_claim_ids`
368
+
369
+ ### 7.6 Competency Question Authority
370
+
371
+ `competency-questions.yaml` is the authoritative competency-question set for a
372
+ run. It is authored after Seed confirmation so that questions test the confirmed
373
+ Seed and declared purpose, not a discarded draft.
374
+
375
+ `competency-question-assessment.yaml` must assess every authoritative question
376
+ exactly once. Domain-provided question templates are not in-scope unless
377
+ `domain-context-selection.yaml` explicitly admits them into the run.
378
+
225
379
  ## 8. Prompt-Backed Reference Path
226
380
 
227
381
  Before runtime replacement, reconstruct needs at least one prompt-backed
@@ -241,18 +395,22 @@ Runtime implementation may replace only one deterministic boundary at a time:
241
395
  source profile loading, source observation, directive validation, metric
242
396
  calculation, then MCP exposure.
243
397
 
244
- ## 9. LLM-Owned Directives
398
+ ## 9. Meaning Directives And Runtime Gates
245
399
 
246
400
  | Directive | Purpose | Runtime gate |
247
401
  |---|---|---|
248
402
  | `SourceObservationDirective` | choose which runtime observations are evidence candidates | observation id, material kind, source ref, and location validation |
249
- | `DomainContextSelectionDirective` | choose domain documents and explain why | context existence and scope validation |
403
+ | `DomainContextSelectionDirective` | choose domain documents and explain why | context existence, scope, and `domain_snapshot_id` validation |
250
404
  | `SeedCandidateDirective` | propose purpose, non-goals, entities, relations, actions, properties, and rules | schema shape, prior observation-directive status, selected observation, and evidence ref validation |
405
+ | `ClaimRealizationDirective` | classify each Seed claim's evidence stance | claim id, stance enum, source/evidence ref, and rationale presence validation |
251
406
  | `EvidenceMapDirective` | connect claims to evidence | dangling ref and duplicate evidence checks |
252
- | `CompetencyQuestionDirective` | define execution questions and scope boundaries | duplicate and coverage metric checks |
253
- | `FailureClassificationDirective` | classify why a question cannot be answered | enum and question/result linkage checks |
254
- | `OntologyRevisionProposal` | propose reuse, extend, rename, split, or reject decisions | id collision, target, schema, and regression checks |
407
+ | `SeedConfirmationDirective` | record claim-level accepted, rejected, partial, or deferred confirmation | state transition, duplicate claim, missing claim, and derived-set validation |
408
+ | `CompetencyQuestionDirective` | define the authoritative execution question set and scope boundaries | duplicate id, closed question set, claim linkage, and evidence-ref validation |
409
+ | `CompetencyQuestionAssessmentDirective` | answer or mark every authoritative question | exactly-once question coverage, answer-state enum, claim linkage, and evidence-ref validation |
410
+ | `FailureClassificationDirective` | classify why a question or claim cannot be trusted for the declared purpose | enum, question/result linkage, claim linkage, and materiality rationale checks |
411
+ | `OntologyRevisionProposal` | propose reuse, extend, rename, split, reject, or defer decisions | proposal id, target id, action enum, schema, and regression checks |
255
412
  | `StopDecisionDirective` | decide continue, stop, or ask user based on metrics and purpose | metrics presence and enum validation |
413
+ | `FinalOutputDirective` | present decision-ready user-facing output | artifact provenance, section presence, and unresolved/deferred disclosure checks |
256
414
 
257
415
  Every semantic claim in a Seed or revision proposal needs evidence refs. A claim
258
416
  without evidence remains a hypothesis or open question.
@@ -270,46 +428,59 @@ Current and provisional artifact contract:
270
428
  | `target-material-profile.yaml` | runtime | helper implemented | selected target material kind, candidates, confidence, selected source profiles, and unsupported-material status |
271
429
  | `source-inventory.yaml` | runtime | helper implemented | selected source roots, material-specific inventory units, and scan boundaries |
272
430
  | `source-observations.yaml` | runtime | helper implemented | adapter id, material kind, location, structural data, and stable observation ids |
273
- | `source-observation-directive.yaml` | LLM | happy path implemented through pluggable author | selected observations and evidence-candidate rationale |
431
+ | `source-observation-directive.yaml` | LLM | implemented through pluggable author | selected observations and evidence-candidate rationale |
274
432
  | `source-observation-directive-validation.yaml` | runtime | helper implemented | validation status and violations for LLM-selected observation refs |
275
433
  | `domain-context-selection.yaml` | LLM | future | chosen domain context refs and rationale |
276
- | `seed-candidate.yaml` | LLM | happy path implemented through pluggable author | proposed Ontology Seed before user confirmation |
434
+ | `domain-context-selection-validation.yaml` | runtime | future | context existence, scope, and snapshot validation |
435
+ | `seed-candidate.yaml` | LLM | implemented through pluggable author | proposed Ontology Seed before user confirmation |
277
436
  | `seed-candidate-validation.yaml` | runtime | helper implemented | validation status and violations for LLM-authored Seed claim shape and observation evidence refs |
278
- | `seed-confirmation.yaml` | user/host mediated | happy path implemented through pluggable provider | confirmed, rejected, or partially confirmed Seed decisions |
279
- | `competency-questions.yaml` | LLM | happy path implemented through pluggable author | execution questions and boundaries |
280
- | `failure-classification.yaml` | LLM | future | failed question causes and recommended action |
281
- | `revision-proposal.yaml` | LLM | future | bounded ontology changes |
282
- | `reconstruct-metrics.yaml` | runtime | happy path implemented | deterministic counts and pass rates |
283
- | `stop-decision.yaml` | LLM | happy path implemented through pluggable author | continue, stop, or ask-user judgment |
284
- | `final-output.md` | LLM | happy path implemented through pluggable author | user-facing result text grounded in artifacts |
285
- | `reconstruct-run-manifest.yaml` | runtime assembly | happy path implemented | step list, owner boundary, performed-by provenance, happy-path scope, artifact refs, and execution profile |
286
- | `reconstruct-record.yaml` | runtime assembly | helper implemented, primary artifact in happy path | primary structured reconstruct artifact with material, validation, and artifact refs |
437
+ | `claim-realization-map.yaml` | LLM | mock loop implemented through pluggable author | evidence stance for every Seed claim |
438
+ | `claim-realization-map-validation.yaml` | runtime | implemented | claim id, stance enum, and evidence linkage validation |
439
+ | `seed-confirmation.yaml` | user/host mediated | mock loop implemented through pluggable provider | claim-level accepted, rejected, partial, or deferred Seed decisions |
440
+ | `seed-confirmation-validation.yaml` | runtime | implemented | confirmation transition validation and derived claim sets |
441
+ | `competency-questions.yaml` | LLM | implemented through pluggable author | authoritative execution questions and boundaries |
442
+ | `competency-questions-validation.yaml` | runtime | implemented | closed CQ set, duplicate id, claim-link, and evidence validation |
443
+ | `competency-question-assessment.yaml` | LLM | mock loop implemented through pluggable author | answer status and evidence basis for every authoritative question |
444
+ | `competency-question-assessment-validation.yaml` | runtime | implemented | exactly-once coverage, status enum, and evidence validation |
445
+ | `failure-classification.yaml` | LLM | mock loop implemented through pluggable author | failed or unsafe-to-trust question and claim causes |
446
+ | `failure-classification-validation.yaml` | runtime | implemented | failure enum, linkage, and materiality rationale validation |
447
+ | `revision-proposal.yaml` | LLM | mock loop implemented through pluggable author | bounded ontology changes, deferrals, or rejection proposals |
448
+ | `revision-proposal-validation.yaml` | runtime | implemented | proposal id, target id, action enum, and regression guard validation |
449
+ | `reconstruct-metrics.yaml` | runtime | implemented | deterministic counts and pass rates |
450
+ | `stop-decision.yaml` | LLM | implemented through pluggable author | continue, stop, or ask-user judgment |
451
+ | `final-output.md` | LLM | implemented through pluggable author and provenance-checked by runtime | user-facing result text grounded in artifacts |
452
+ | `reconstruct-run-manifest.yaml` | runtime assembly | implemented | step list, owner boundary, performed-by provenance, happy-path scope, artifact refs, and execution profile |
453
+ | `reconstruct-record.yaml` | runtime assembly | helper implemented, primary artifact in mock loop | primary structured reconstruct artifact with material, validation, and artifact refs |
287
454
 
288
455
  These artifact names are provisional but contract-owned. Runtime implementation
289
456
  must either implement this contract or update this contract before code lands.
290
457
  Runtime code must not silently fix a different schema.
291
458
 
292
- The current happy path explicitly implements:
459
+ The current mock runtime path explicitly implements:
293
460
 
294
461
  - target material profile, inventory, and source observations
295
462
  - source-observation directive plus validation
296
463
  - Seed candidate plus validation
464
+ - claim realization plus validation
297
465
  - Seed confirmation through an explicit mock confirmation provider
466
+ - Seed confirmation validation and derived claim sets
298
467
  - competency questions through an explicit mock directive author
468
+ - competency-question validation and assessment
469
+ - failure classification plus validation
470
+ - revision proposal plus validation
299
471
  - deterministic reconstruct metrics
300
- - stop decision and final output through an explicit mock directive author
472
+ - stop decision and provenance-checked final output through an explicit mock directive author
301
473
  - reconstruct run manifest and primary reconstruct record
302
474
 
303
- The current happy path explicitly defers:
475
+ The current mock runtime path explicitly defers:
304
476
 
305
477
  - `domain-context-selection.yaml`
306
- - `failure-classification.yaml`
307
- - `revision-proposal.yaml`
478
+ - `domain-context-selection-validation.yaml`
308
479
 
309
480
  These deferred artifacts require additional host/user semantic decisions and
310
- must not be implied by a completed mock happy-path run.
481
+ must not be implied by a completed mock run.
311
482
 
312
- `reconstruct-record.yaml` is the primary artifact for the happy path in the same
483
+ `reconstruct-record.yaml` is the primary artifact for the mock path in the same
313
484
  way `review-record.yaml` is primary for review.
314
485
 
315
486
  ## 11. Completion Rule
@@ -318,8 +489,12 @@ Runtime computes, but does not decide:
318
489
 
319
490
  - evidence ref count
320
491
  - Seed concept count
492
+ - claim realization stance counts
493
+ - confirmation state counts and derived claim-set counts
321
494
  - competency question count
495
+ - competency question assessment status counts
322
496
  - failed question count
497
+ - failure classification counts
323
498
  - proposed revision count
324
499
  - unresolved count
325
500
  - pass rate
@@ -333,9 +508,19 @@ writes a `StopDecisionDirective` with `continue`, `stop`, or `ask_user`.
333
508
  The user-facing result should separate:
334
509
 
335
510
  - confirmed Seed content
511
+ - claim realization summary
512
+ - competency question assessment summary
513
+ - failure classifications
514
+ - revision proposals or deferrals
336
515
  - unresolved material questions
337
516
  - unsupported or out-of-scope requests
338
517
  - proposed next actions
518
+ - artifact provenance for the claims, questions, failures, proposals, and stop
519
+ rationale it mentions
520
+
521
+ `final-output.md` is decision-ready prose, not a new truth source. Any claim it
522
+ presents as confirmed, unresolved, failed, deferred, or proposed must point back
523
+ to the artifact id family that owns that state.
339
524
 
340
525
  ## 12. Runtime Implementation Readiness
341
526
 
@@ -347,9 +532,12 @@ Runtime attachment is ready only when all of these are true:
347
532
  `.onto/processes/reconstruct/source-profiles/`.
348
533
  4. `target_material_kind` is recorded before source adapter selection.
349
534
  5. Source adapter output has stable observation ids and boundary failure rules.
350
- 6. Directive validation has schemas for every LLM-owned directive it accepts.
535
+ 6. Directive validation has schemas for every meaning directive it accepts.
351
536
  7. Metrics are defined as deterministic projections from existing artifacts.
352
537
  8. MCP schemas expose only bounded facts and artifact refs.
538
+ 9. Stage ids are stable and recorded in status, run manifest, and records.
539
+ 10. Cross-artifact id authority is explicit and validators reject dangling refs.
540
+ 11. Final output provenance is validated against artifact ids rather than prose.
353
541
 
354
542
  ## 13. Verification Target
355
543
 
@@ -358,9 +546,21 @@ When the implementation starts, use at least:
358
546
  ```bash
359
547
  npm run check:ts-core
360
548
  npx vitest run src/core-runtime/reconstruct
549
+ npx vitest run src/core-api/reconstruct-api.test.ts
361
550
  npm run test:mcp:review
362
551
  git diff --check
363
552
  ```
364
553
 
365
554
  `test:mcp:review` remains review-focused, but it protects the shared MCP server
366
555
  from regressions when reconstruct tools are introduced.
556
+
557
+ The first end-to-end fixture may use the `day1co/day1co-ai-usage-dashboard`
558
+ repository or an equivalent temporary fixture. An equivalent fixture must cover:
559
+
560
+ - multiple selected source observations
561
+ - at least five Seed claims
562
+ - at least one accepted claim and one rejected, partial, or deferred claim
563
+ - at least one competency question that is not fully answered
564
+ - at least one failure classification
565
+ - at least one revision proposal
566
+ - final output references back to the owning artifact ids
@@ -0,0 +1,144 @@
1
+ # Reconstruct Execution UX Contract
2
+
3
+ > Status: design contract.
4
+ > Purpose: define the user-visible reconstruct run experience without adding a
5
+ > separate UI implementation.
6
+
7
+ ## 1. Position
8
+
9
+ `reconstruct` can take a long time because the host LLM must read source
10
+ observations, choose evidence, propose Seed meaning, assess competency questions,
11
+ and explain unresolved gaps. The user-facing experience must therefore expose
12
+ new information as it is discovered, not only meta status such as "still
13
+ running".
14
+
15
+ The runtime owns structured facts, stage ids, artifact refs, liveness hints, and
16
+ deterministic counts. The host LLM owns the short explanation shown to the user.
17
+
18
+ No standalone HTML, web UI, or dashboard is required for this contract. MCP and
19
+ CLI hosts should render the same information from runtime status/result payloads
20
+ and reconstruct artifacts.
21
+
22
+ ## 2. Opening Brief
23
+
24
+ At run start, the host should show a compact opening brief before expensive
25
+ work begins.
26
+
27
+ The brief must include:
28
+
29
+ - environment: project root or declared source boundary, session root, and
30
+ write policy
31
+ - method: MCP/runtime path, source profile, semantic author realization, and
32
+ confirmation provider realization
33
+ - model/provider: provider family or realization label without secrets
34
+ - domain: selected domain, no-domain mode, or pending domain-context selection
35
+ - material: `target_material_kind`, target input kind, and unsupported-material
36
+ status if known
37
+ - reconstruction direction: what the reconstruct run will try to explain, and
38
+ what it will treat as out of scope
39
+ - ownership boundary: runtime observes and validates; the host LLM proposes
40
+ meaning; the user or host confirmation controls Seed acceptance
41
+
42
+ The opening brief should be declarative. It should not ask the user to approve
43
+ internal implementation details unless the target boundary, domain, or write
44
+ policy is ambiguous.
45
+
46
+ ## 3. Progress Presentation
47
+
48
+ Progress is stepwise. Each update should include the current
49
+ `ReconstructStageId`, a short label, a liveness state, and one or two newly
50
+ learned facts.
51
+
52
+ Recommended update shape:
53
+
54
+ ```text
55
+ [stage 6/26] source_observation
56
+ Status: running
57
+ Learned: 38 source observations across routes, components, and API helpers.
58
+ Next: select evidence-bearing observations for the Seed candidate.
59
+ ```
60
+
61
+ Progress updates should prefer facts such as:
62
+
63
+ - material kind and profile confidence
64
+ - scanned roots and skipped boundaries
65
+ - source inventory counts by material-specific unit
66
+ - selected observation count and evidence-candidate rationale
67
+ - domain context refs and snapshot id
68
+ - Seed claim count by entity, relation, action, property, and rule
69
+ - claim realization stance counts
70
+ - confirmation state counts
71
+ - competency question count and assessment status counts
72
+ - failure classification counts
73
+ - revision proposal action counts
74
+ - unresolved, deferred, and out-of-scope counts
75
+ - current halt reason and reusable artifact refs when halted
76
+
77
+ Progress updates should avoid pretending that intermediate semantic claims are
78
+ final. Before Seed confirmation, claims are candidates. Before competency
79
+ question assessment, quality statements are preliminary.
80
+
81
+ ## 4. Decision Points
82
+
83
+ User-facing prompts are needed only when a decision changes the product result
84
+ or the allowed boundary.
85
+
86
+ Decision points:
87
+
88
+ - target boundary is ambiguous or would require reading outside the bound root
89
+ - material kind is unsupported or mixed in a way that changes adapter behavior
90
+ - domain context selection changes the interpretation standard
91
+ - Seed claim confirmation requires accepted, rejected, partial, or deferred
92
+ state
93
+ - unresolved material questions require a final direction: continue, defer, or
94
+ accept with disclosed limits
95
+
96
+ The host should phrase choices by outcome, not internal jargon.
97
+
98
+ ## 5. Final Output
99
+
100
+ `final-output.md` must be decision-ready and artifact-tethered. It should
101
+ separate:
102
+
103
+ - confirmed Seed content
104
+ - claim realization summary
105
+ - competency question assessment summary
106
+ - material failures and unsafe-to-trust gaps
107
+ - revision proposals and action candidates
108
+ - unresolved, deferred, unsupported, or out-of-scope items
109
+ - artifact provenance: the owning ids and artifact refs behind the statements
110
+
111
+ The final output is not the authority for truth. It is a user-facing projection
112
+ of `reconstruct-record.yaml`, `reconstruct-run-manifest.yaml`, and the
113
+ stage-owned artifacts.
114
+
115
+ ## 6. Halted Or Partial Runs
116
+
117
+ If a run halts, the output should still be useful:
118
+
119
+ - show the last completed stage id
120
+ - show which artifact refs are reusable
121
+ - show which stage failed and why
122
+ - show the strongest safe statement supported by completed artifacts
123
+ - avoid summarizing missing stages as if they ran
124
+
125
+ A halted run may provide candidate Seed content only if the corresponding
126
+ artifact and validation refs exist. It may not imply Seed confirmation, CQ
127
+ assessment, failure classification, revision proposal, stop decision, or final
128
+ ontology direction unless those artifacts exist.
129
+
130
+ ## 7. Runtime Payload Expectations
131
+
132
+ Future status/result payloads should expose enough facts for the host LLM to
133
+ render this contract without scraping prose:
134
+
135
+ - current stage id and total planned stage count
136
+ - stage state: pending, running, completed, skipped, or halted
137
+ - stage artifact refs and owner
138
+ - liveness state and recommended polling interval
139
+ - deterministic count summaries from the latest completed artifacts
140
+ - unresolved/deferred/out-of-scope summaries
141
+ - opening, progress, halt, and final presentation prompts or facts
142
+
143
+ The payload may be compact. It should expose bounded facts and artifact refs,
144
+ not duplicate semantic authority.