@weftlet/toolkit 0.2.1 → 0.4.0

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 (72) hide show
  1. package/README.md +80 -0
  2. package/dist/application/agent-context.d.ts +3 -1
  3. package/dist/application/agent-context.js +15 -6
  4. package/dist/application/application.js +7 -4
  5. package/dist/application/cache-adoption.d.ts +43 -0
  6. package/dist/application/cache-adoption.js +129 -0
  7. package/dist/application/extraction-identity.d.ts +6 -0
  8. package/dist/application/extraction-identity.js +15 -0
  9. package/dist/application/hydration-failure.d.ts +41 -0
  10. package/dist/application/hydration-failure.js +43 -0
  11. package/dist/application/hydration-plan.d.ts +54 -0
  12. package/dist/application/hydration-plan.js +71 -0
  13. package/dist/application/hydrator.d.ts +3 -5
  14. package/dist/application/hydrator.js +30 -61
  15. package/dist/application/overlay.js +10 -3
  16. package/dist/application/saved-evidence.d.ts +6 -3
  17. package/dist/application/saved-evidence.js +7 -1
  18. package/dist/application/semantic-artifact-store.d.ts +4 -0
  19. package/dist/application/semantic-artifact-store.js +7 -0
  20. package/dist/application/semantic-run.d.ts +29 -0
  21. package/dist/application/semantic-run.js +111 -0
  22. package/dist/application/semantic-scope.d.ts +13 -0
  23. package/dist/application/semantic-scope.js +12 -0
  24. package/dist/application/snapshot-checks.d.ts +2 -1
  25. package/dist/application/snapshot-checks.js +8 -1
  26. package/dist/configuration/cache.d.ts +6 -0
  27. package/dist/configuration/cache.js +18 -0
  28. package/dist/extraction/document.js +1 -1
  29. package/dist/extraction/providers.js +12 -5
  30. package/dist/extraction/repository-nodes.d.ts +2 -3
  31. package/dist/extraction/repository-nodes.js +5 -11
  32. package/dist/extraction/routing.d.ts +1 -1
  33. package/dist/extraction/routing.js +3 -6
  34. package/dist/extraction/semantic-cache.d.ts +13 -0
  35. package/dist/extraction/semantic-cache.js +66 -0
  36. package/dist/extraction/semantic-diagnostics.d.ts +9 -0
  37. package/dist/extraction/semantic-diagnostics.js +15 -0
  38. package/dist/extraction/semantic-identity.d.ts +7 -0
  39. package/dist/extraction/semantic-identity.js +29 -0
  40. package/dist/extraction/semantic-sources.d.ts +27 -0
  41. package/dist/extraction/semantic-sources.js +35 -0
  42. package/dist/extraction/semantic.d.ts +5 -1
  43. package/dist/extraction/semantic.js +47 -24
  44. package/dist/extraction/static.d.ts +13 -5
  45. package/dist/extraction/static.js +8 -15
  46. package/dist/governance/governance.js +11 -7
  47. package/dist/graph/query.js +2 -0
  48. package/dist/graph/rdf.d.ts +1 -1
  49. package/dist/graph/rdf.js +13 -28
  50. package/dist/graph/shacl-shapes.d.ts +5 -0
  51. package/dist/graph/shacl-shapes.js +27 -0
  52. package/dist/index.d.ts +4 -0
  53. package/dist/index.js +4 -0
  54. package/dist/interfaces/cli.js +86 -19
  55. package/dist/repository/git.d.ts +1 -1
  56. package/dist/repository/git.js +5 -1
  57. package/dist/storage/storage.d.ts +7 -1
  58. package/dist/storage/storage.js +15 -3
  59. package/dist/visualization/visualization.js +1 -0
  60. package/docs/ADR-016-hydration-preview.md +91 -0
  61. package/docs/ADR-017-shacl-validation-union.md +102 -0
  62. package/docs/ADR-018-operational-semantic-cache.md +100 -0
  63. package/docs/ADR-019-semantic-failure-diagnostics.md +82 -0
  64. package/docs/ADR-020-canonical-physical-file-producers.md +97 -0
  65. package/docs/PROVIDERS.md +51 -1
  66. package/docs/RELEASE-1.0-PLAN.md +148 -32
  67. package/docs/RELEASING.md +19 -6
  68. package/docs/ROADMAP.md +46 -5
  69. package/docs/VALIDATION.md +341 -3
  70. package/docs/WEFTLET-2.0-PLAN.md +9 -8
  71. package/docs/extraction-manifest.json +55 -23
  72. package/package.json +3 -2
@@ -0,0 +1,100 @@
1
+ # ADR-018: Preserve Codex artifacts across operational configuration changes
2
+
3
+ Status: accepted and implemented in development source after 0.3.0; release evidence is recorded
4
+ in [validation](VALIDATION.md). This increment does not claim a new npm publication.
5
+
6
+ ## Problem
7
+
8
+ With `storageScope: "user"`, the storage profile includes the entire configuration and checkout
9
+ path. Increasing a timeout therefore selected a different directory even though the built-in
10
+ Codex artifact key already excluded that timeout. A partially completed run could lose access
11
+ to reusable work without any source or extraction-contract change.
12
+
13
+ Custom provider modules present a different boundary: they receive the entire semantic
14
+ configuration and may use it to affect their output. Their identities must remain conservative.
15
+
16
+ ## Decision
17
+
18
+ Keep `resolveStorageRoot`, snapshot profiles, snapshot IDs and full configuration digests unchanged.
19
+ For built-in Codex with user storage, use a separate semantic-artifact partition. Its identity
20
+ includes the resolved checkout and full configuration except these five semantic controls:
21
+
22
+ | Setting | Why it can share successful Codex artifacts |
23
+ | --- | --- |
24
+ | `timeoutMs` | Bounds execution; it does not change the prompt or model arguments |
25
+ | `retries` | Limits retries of supported transient failures |
26
+ | `concurrency` | Schedules independent source extractions |
27
+ | `maxDocuments` | Bounds the selected workload |
28
+ | `maxSourceBytes` | Bounds each source; it never truncates its contents |
29
+
30
+ Document and byte limits still apply before hydration, including when every artifact is cached.
31
+ Changing a limit does not waive it. Model/reasoning settings, prompt/schema/extractor/adapter/
32
+ ontology identities, confidence/unresolved policy, authentication descriptors, source identity
33
+ and bytes continue to invalidate reuse through their existing artifact keys and/or partition.
34
+ Unknown configuration fields remain identity inputs. Credential environment values are not read
35
+ or added to the cache partition.
36
+
37
+ The new user-cache layout is `~/.cache/context-graph/semantic-artifacts-v1/<partition>/artifacts/semantic/`.
38
+ The partition uses a full SHA-256 digest. Different checkouts, repository IDs, namespaces and
39
+ non-operational configurations remain separate. Workspace storage retains its existing paths
40
+ and behavior; it already allowed built-in Codex reuse after these operational changes. Modules
41
+ retain their full semantic-config identity and their existing storage profiles. Sharing a custom
42
+ workspace storage directory remains an explicit operator choice, not a new global cache feature.
43
+
44
+ Artifact keys and output digests retain the 0.2.1/0.3.0 contract, including the repository-document
45
+ identity policy introduced in 0.2.1. No incompatible 0.2.0 artifact is reinterpreted as current.
46
+ Source approval and assertion review remain distinct; this change never approves an assertion.
47
+
48
+ ## Legacy recovery without model work
49
+
50
+ The planner and hydrator use the same store factory. It may read the exact legacy user profile
51
+ derived from the current full configuration after checking the new primary store. A corrupt or
52
+ unreadable primary entry stops reuse; a valid legacy entry does not mask it. Planning remains
53
+ read-only. Hydration can atomically retain a validated legacy artifact in the new partition, then
54
+ revalidate the retained entry to handle concurrent winners. Original files, artifact identities,
55
+ source provenance and raw provider output remain intact.
56
+
57
+ Legacy profile directories contain no reliable checkout/configuration ownership manifest, and an
58
+ interrupted run may have no snapshot. Consequently, the toolkit never scans sibling profiles for
59
+ a matching key. If settings were already changed, the old location cannot safely be inferred.
60
+
61
+ The explicit `cache adopt --from-config <previous.json>` command handles that case without
62
+ providers, authentication probes, indexing, ontology compilation, adapters or snapshot writes.
63
+ Both configurations must resolve to the same checkout and have the same non-operational
64
+ partition identity. Keep the exact old configuration in its original configuration directory.
65
+ Relocation is safe only when its original, unchanged `repositoryRoot` still resolves to the same
66
+ checkout (for example, an absolute root). Do not edit that field to compensate for relocation:
67
+ it is part of the old profile identity. Preserve the original field values and omissions.
68
+
69
+ Adoption resolves a committed ref and uses the same configured/agent selection as the hydration
70
+ preview. It looks up only expected keys in the exact old profile, checks the complete artifact
71
+ contract and output digest, and copies valid candidates atomically. `--dry-run` performs no writes.
72
+ Reports identify reused/adopted/planned/missing/corrupt/unavailable/conflicting entries, configured
73
+ budgets and scope omissions. They omit source bodies, raw provider output and configuration values.
74
+
75
+ Recovery is per artifact: valid copies can complete even if another entry is corrupt or conflicts.
76
+ The report records partial progress and exits unsuccessfully for problems or incomplete scope.
77
+ Missing artifacts are ordinary future extraction work. Corrupt complete artifacts are retained
78
+ for diagnosis; they require an explicit forced refresh or operator repair, not automatic overwrite.
79
+ Incomplete temporary files are not published artifacts and do not satisfy a cache lookup.
80
+
81
+ Concurrent writers use immutable publication. Different outputs under one key are reported as
82
+ conflicts; a matching `outputDigest` field alone is insufficient to accept malformed metadata.
83
+ Explicit forced extraction still creates a separate revision and preserves existing artifacts.
84
+
85
+ ## Freshness and limits
86
+
87
+ Semantic reuse does not reuse a snapshot's validation result, skip SCIP or SHACL, or let old
88
+ configuration evidence satisfy current validation. A timeout change still changes the snapshot's
89
+ full configuration digest and user storage profile. Saved evidence remains available under its
90
+ original configuration; this increment does not consolidate historical snapshot directories.
91
+
92
+ The current module-provider contract does not promise operational independence. Supporting that
93
+ requires a separate tested contract, not silently dropping fields from a provider's identity.
94
+ Credential rotation under an unchanged environment-variable name is not detected by this cache;
95
+ credentials are neither cache contents nor cache-identity inputs. Existing filesystem access
96
+ controls and the configured storage location remain the security boundary.
97
+
98
+ Validation uses public fixtures, deterministic Codex runners and installed TypeScript indexing.
99
+ Live semantic quality and private consumer acceptance remain separate. See the
100
+ [1.0 plan](RELEASE-1.0-PLAN.md) for timeout diagnostics and document coverage follow-ups.
@@ -0,0 +1,82 @@
1
+ # ADR-019: Safe semantic failure diagnostics and settled progress
2
+
3
+ Status: implemented in development source after 0.3.0; validation and publication are recorded
4
+ separately in [validation](VALIDATION.md). This decision does not change extraction identity.
5
+
6
+ ## Problem
7
+
8
+ A generic timeout does not identify which source failed, how much work survived, or how to
9
+ resume. Concurrent workers can also cancel each other: reporting the last error can hide the
10
+ initiating timeout, and reporting before active writes finish can undercount retained artifacts.
11
+ Arbitrary provider exceptions and abort reasons may contain private input.
12
+
13
+ ## Decision
14
+
15
+ Keep semantic-run scheduling and reporting in `application/semantic-run.ts`, separate from graph
16
+ assembly. Record the first source failure before aborting siblings, stop scheduling queued sources,
17
+ and wait for active workers to settle before constructing `SemanticHydrationError.report`.
18
+ The report has a versioned kind, safe code/category, phase, committed SHA, configuration digest,
19
+ elapsed time and scope, effective timeout and its scope, final counts, and recovery guidance.
20
+
21
+ Completion means a validated artifact was retained or successfully reused. A write already in
22
+ progress can finish after cancellation and remains a completion. A provider result returned after
23
+ abort is rejected before validation/publication. Late storage failures remain failures, not sibling
24
+ cancellations. Cancellation between sources has phase `semantic-scheduling`, no failing source ID,
25
+ and run elapsed time; it does not relabel successfully retained artifacts as cancelled.
26
+
27
+ Counts have these meanings:
28
+
29
+ - `completed = extracted + reused`.
30
+ - `total = completed + failed + cancelled + notStarted` after active workers settle.
31
+ - `remaining = total - completed`; this includes failures, cancellations and queued work. It is
32
+ not a promise about the number of model calls required by a future run.
33
+
34
+ Known provider timeouts, cancellations, unavailable infrastructure, process exits and invalid
35
+ output remain distinct. Configured unresolved-mapping and confidence rejections retain separate
36
+ `unresolved` and `low-confidence` codes and remain extraction gaps. Their acceptance criteria are
37
+ unchanged. Unknown extraction exceptions become `provider-failure`, without an
38
+ invented diagnosis. Cache read/write failures have a separate code; invalid extraction validation
39
+ is an extraction gap. Module loading/export/identity problems are unavailable infrastructure.
40
+ No raw exception, cause, provider output, prompt, credential or source path is copied into the
41
+ report. These diagnostics are not approved intent or evidence that a product rule was violated.
42
+
43
+ The CLI prints safe errors and progress on stderr, leaving stdout for successful results.
44
+ `hydrate --json --quiet` produces a JSON semantic failure report on stderr. The JSON contract
45
+ covers the semantic-source run; configuration, repository, indexing and graph validation errors
46
+ retain their existing interfaces. SIGINT listeners are removed on both success and failure.
47
+ The saved-evidence MCP interface still performs no hydration and writes only protocol messages
48
+ to stdout. Trusted module code must itself avoid logging private inputs; this is not a sandbox.
49
+
50
+ ## Source correlation and timeout meaning
51
+
52
+ A domain-separated SHA-256 of repository ID and stable semantic ID gives each source an opaque
53
+ `sourceId`. `hydrate --plan` explicitly maps that ID to its local path. The ID is stable across
54
+ retries and source edits when the stable semantic ID stays the same; renames without a declared
55
+ stable ID may change it. It is a correlation aid, not anonymization, encryption or an access
56
+ boundary. Do not publish the local preview without reviewing its paths and other metadata.
57
+ This ID never enters artifact keys, prompts, facts or snapshot configuration digests.
58
+
59
+ For source failures, elapsed time includes cache checks, authentication, provider attempts and
60
+ retries through failure. Codex's configured limit is per attempt; authentication has a separate
61
+ bounded status check. Module execution has one deadline covering import, factory and extraction.
62
+ The report distinguishes these scopes rather than presenting the limit as an end-to-end deadline.
63
+ No timeout default, retry policy, extraction contract or cache version changes here.
64
+
65
+ ## Recovery and limits
66
+
67
+ Failures do not reach graph publication. Prior snapshots and completed artifacts remain intact.
68
+ Use the same configuration, committed ref and scope in the no-model preview to inspect current
69
+ reuse before retrying without `--force-semantic`. T03 preserves compatible built-in Codex artifacts
70
+ across supported operational changes; legacy recovery requires the exact previous configuration.
71
+ Custom modules retain conservative full-configuration identity. Completed forced revisions are
72
+ retained but are not automatically adopted by an ordinary rerun or a new forced revision.
73
+
74
+ The toolkit waits for built-in subprocess termination or the module wrapper's bounded promise.
75
+ It cannot forcibly terminate arbitrary trusted in-process module code. Cancellation before source
76
+ selection and outside semantic processing uses the existing safe cancellation error without
77
+ per-source counts. Phase boundaries remain the progress signal; no synchronous SHACL heartbeat,
78
+ incremental validator or invented percentage is introduced by this milestone.
79
+
80
+ Public deterministic tests cover failures, cancellation races, durable-write completion, counts,
81
+ privacy, reuse, unchanged snapshot heads, source mapping and installed CLI behavior. They do not
82
+ claim private consumer acceptance or live-provider semantic quality.
@@ -0,0 +1,97 @@
1
+ # ADR-020: One physical-file policy for deterministic producers and adapters
2
+
3
+ Status: implemented in development source after 0.3.0; release/consumer acceptance is recorded
4
+ separately in [validation](VALIDATION.md).
5
+
6
+ ## Reported defect and ownership
7
+
8
+ The consumer's bounded replay of installed 0.3.0 extractors reported 120 conflicting file IDs:
9
+ 34 from the neutral contract extractor alone, 57 from its local framework adapter alone, and
10
+ 29 from both. Actual file/SCIP extraction classified spec/test files as `Evidence`; contract
11
+ consumers and local framework nodes could classify those same physical IDs as `Component`.
12
+ The consumer isolated a neutral file-plus-contract pair that failed strict SHACL single-kind
13
+ validation. This is an extraction identity defect, not conflicting product intent.
14
+
15
+ Upstream owns the neutral policy and producers. The consumer owns its framework call sites and
16
+ their tests. This work uses public fixtures; it does not reproduce all private IDs, modify the
17
+ consumer repository, patch installed packages or claim successful consumer hydration.
18
+
19
+ ## Public contract
20
+
21
+ Move the existing pure `repositoryFileNode(path)` implementation into `@weftlet/core` and export
22
+ it publicly. Its module imports only the `GraphNode` type; core gains no runtime package
23
+ dependencies. Keep the toolkit's internal re-export for compatibility, but adapters should use:
24
+
25
+ ```ts
26
+ import { repositoryFileNode } from '@weftlet/core';
27
+
28
+ const file = {
29
+ ...repositoryFileNode(path),
30
+ attributes: { /* adapter-specific evidence metadata */ },
31
+ };
32
+ ```
33
+
34
+ The caller supplies a repository-relative path in its canonical spelling. Existing mappings stay
35
+ unchanged: `.md`, `.mdx` and `.txt` use `document:<path>`/`Document`; `.spec.<extension>` and
36
+ `.test.<extension>` use `component:file:<path>`/`Evidence`; other physical files use that file
37
+ prefix and `Component`. Matching ignores extension case but preserves path spelling. This is not
38
+ filesystem resolution, universal test detection, proof of existence or approved intent. Do not
39
+ rewrite business concepts, contract identities or architectural modules into physical-file IDs.
40
+
41
+ The producer audit is explicit:
42
+
43
+ | Producer | Change |
44
+ | --- | --- |
45
+ | Neutral file extractor | Replace duplicated kind logic; preserve source/index attributes |
46
+ | SCIP symbols | Replace duplicated kind logic; preserve symbols, sites and citations |
47
+ | Contract consumers | Replace hard-coded Component; retain conceptual contract and evidence IDs |
48
+ | Document linker | Import the public factory; existing owner/reference behavior stays intact |
49
+ | Routing | Replace duplicated mapping; document endpoints now join document identities |
50
+ | Governance | Use the factory for dependency and membership files and query lookup; retain module/layer concepts |
51
+ | Semantic normalization | Use the shared factory for its existing document-only normalization; see the boundary below |
52
+
53
+ Facts are retained, including test files with mocked client calls, DI and decorators. We do not
54
+ suppress test evidence, rename conflicting IDs, weaken kind cardinality or change source/assertion
55
+ authority. Graphs and all working overlays require strict SHACL before publication; overlay
56
+ validation no longer depends on routing being configured.
57
+
58
+ ## Identity, saved evidence and artifacts
59
+
60
+ Contract extraction advances from 1.1.0 to 1.2.0; routing and SCIP fact extraction from 1.0.0 to
61
+ 1.1.0; governance analyzer from 2 to 3. The SCIP indexer/tool version is unchanged. Committed
62
+ assembly becomes `standalone-graph-v7`, with `graph-v7`, contract and SCIP fact identity included
63
+ in snapshot IDs. Overlay IDs/metadata also bind assembly, contract and SCIP fact identity,
64
+ so rebuilding identical captured bytes cannot replace an older overlay. Governance records its
65
+ analyzer identity in both snapshot digest inputs and metadata.
66
+
67
+ Current validation requires matching assembly, contract and SCIP fact versions, plus routing version when
68
+ configured. Missing metadata is not a pass. Final checks reject old versions without initiating
69
+ hydration. Historical saved queries still return the original facts, with extraction compatibility
70
+ reported separately from commit/configuration/working-overlay freshness in JSON, Markdown and
71
+ the viewer. Saved queries remain ineligible to validate a current diff.
72
+
73
+ The physical policy itself was already correct. Its semantic cache identity stays at version 1;
74
+ provider/prompt/artifact keys and original artifact bytes remain unchanged. The original snapshot
75
+ and any compatible semantic artifacts remain available. A fresh graph must still be assembled,
76
+ indexed and validated. Reuse does not imply that an old graph passes current validation.
77
+
78
+ ## Semantic and consumer boundary
79
+
80
+ The reported 120 conflicts were reproduced entirely by deterministic producers. This fix does
81
+ not rewrite semantic caches or force paid re-extraction to hide that defect. Existing semantic
82
+ normalization continues correcting repository document IDs/kinds only. Non-document model kinds
83
+ remain asserted, inferred and unreviewed; an incompatible model assertion still fails strict
84
+ SHACL. A broader interpretation migration would need separate provenance/OML parity tests and
85
+ an explicit cache/assembly decision. It is not silently bundled into this deterministic fix.
86
+
87
+ After upgrading both packages to the reviewed public release, the consumer must change every
88
+ physical-file node emitted by its framework adapter to the public factory and version that
89
+ adapter's extractor deliberately. Add actual adapter regressions for Prisma/DI/decorator-bearing
90
+ spec/test files composed with neutral file facts. Do not change semantic provider/prompt policy
91
+ versions merely to perform this deterministic adapter migration. Preview compatible artifact reuse,
92
+ then run full hydration and repeat acceptance against the committed adapter update.
93
+
94
+ Public upstream tests compose actual committed-source extractors, real TypeScript indexing,
95
+ document and routing links and a public adapter-shaped fixture. They assert strict SHACL,
96
+ provenance, confidence, authority, stable conceptual identities, saved-byte preservation and
97
+ version guards. They do not establish the private adapter's acceptance or semantic quality.
package/docs/PROVIDERS.md CHANGED
@@ -83,7 +83,7 @@ continue using their ChatGPT login; this change does not provision or copy accou
83
83
  ## Limits and reuse
84
84
 
85
85
  Defaults are at most 8 documents per hydration, 64 KiB per source, a 120-second timeout per
86
- request, no retries, and the configured concurrency (validated at 1–4). Source budgets are checked
86
+ Codex attempt (or module execution), no retries, and the configured concurrency (validated at 1–4). Source budgets are checked
87
87
  before any model call. `maxDocuments`, `maxSourceBytes`, `timeoutMs`, and `retries` may be configured
88
88
  within validated limits. Review scope and cost before raising them; these byte/document limits
89
89
  are not dollar or token estimates. Ask the operator before substantial paid runs.
@@ -96,6 +96,56 @@ digest/stable ID, extractor/adapter/ontology versions, confidence threshold and
96
96
  Unchanged artifacts are reused; forced revisions are separate. Failures never replace a valid
97
97
  snapshot. Progress shows phase and counts on stderr, with no document text or paths.
98
98
 
99
+ Starting with 0.4.0, T04 adds opaque source IDs, source elapsed times and structured semantic
100
+ failure reports. With that version or newer installed, retain the same committed ref and any
101
+ agent scope options as the failed run:
102
+
103
+ ```sh
104
+ pnpm exec weftlet hydrate --config /path/to/project/context-graph.config.json --ref <commit> --plan --json
105
+ pnpm exec weftlet hydrate --config /path/to/project/context-graph.config.json --ref <commit> --json --quiet
106
+ ```
107
+
108
+ The first command makes no model calls and maps each `sourceId` to its local document path. Review
109
+ that preview before sharing it. The second performs hydration: semantic failures exit nonzero,
110
+ leave stdout empty and emit JSON on stderr. Omit `--quiet` for progress; omit `--json` for a safe
111
+ human failure summary. Successful hydration still prints its result on stdout. JSON failure
112
+ reporting covers semantic processing, not every configuration/indexing/validation failure.
113
+
114
+ Reports distinguish timeout, cancellation, unavailable infrastructure, provider failure, invalid
115
+ output, unresolved mappings, low confidence and cache problems. Completed/extracted/reused counts include active writes that finished
116
+ before workers settled. `remaining` includes failed, cancelled and not-started sources; consult
117
+ preview for future extraction estimates. Cancellation between sources has no failed `sourceId`.
118
+ Source elapsed time includes cache checks and retries and may exceed the per-attempt limit;
119
+ module timeout includes import/factory/extraction. No defaults or retry rules change.
120
+
121
+ For a timeout, review `semantic.timeoutMs` and preview again before retrying without
122
+ `--force-semantic`. Completed forced revisions remain stored but are not automatically reused by
123
+ an ordinary rerun or a new forced run. Custom provider configuration changes remain conservative.
124
+ See [ADR 019](ADR-019-semantic-failure-diagnostics.md) for reporting and privacy boundaries.
125
+
126
+ Starting with 0.4.0, built-in Codex semantic artifacts are separate from user
127
+ snapshot profiles. Changing `timeoutMs`, `retries`, `concurrency`, `maxDocuments` or
128
+ `maxSourceBytes` can reuse completed artifacts; selection budgets are still enforced. Snapshot
129
+ configuration digests remain complete and saved snapshots are not accepted as current merely
130
+ because their artifacts were reused. Workspace cache paths and custom-provider identities remain
131
+ unchanged. See [ADR 018](ADR-018-operational-semantic-cache.md) for exact isolation and recovery rules.
132
+
133
+ If an older user-cache run was interrupted and its configuration has already changed, retain an
134
+ exact copy of the previous configuration in its original directory. Its original `repositoryRoot`
135
+ must still resolve to the same checkout; editing that field changes the old profile identity.
136
+ With 0.4.0 or newer installed:
137
+
138
+ ```sh
139
+ pnpm exec weftlet cache adopt --config /path/to/project/context-graph.config.json --from-config /path/to/project/previous-context-graph.config.json --ref HEAD --dry-run
140
+ pnpm exec weftlet cache adopt --config /path/to/project/context-graph.config.json --from-config /path/to/project/previous-context-graph.config.json --ref HEAD
141
+ ```
142
+
143
+ For an agent-scoped run, supply the same `--owner-doc`, `--task` or `--capability` selection used
144
+ for hydration. The JSON report shows what was retained and what still needs extraction. Adoption
145
+ makes no model calls and changes no snapshots or source files. Incompatible configurations are
146
+ refused; unrelated cache profiles are never scanned. Corrupt/conflicting artifacts are reported
147
+ and retained. This command is not present in published 0.3.0.
148
+
99
149
  For a trusted local provider module, set `provider: "module"`, `providerModule` to a local path
100
150
  (relative to the repository root) or installed package, and `providerIdentity` to its exact
101
151
  declared version. Packages resolve from the consumer repository using ESM import conditions.
@@ -1,10 +1,15 @@
1
1
  # Consumer hardening and the 1.0 release plan
2
2
 
3
- Status: maintainer-directed work, recorded on 2026-10-26 from a consumer integration report.
4
- The starting release is `@weftlet/toolkit@0.2.0`. **Ship a patch for T01 first.** The remaining
5
- items improve setup, reuse, diagnostics and document coverage; they do not block that patch
6
- or justify expanding the consumer's migration. An official 1.0 follows this work and genuine
7
- consumer acceptance, with its exact release scope reviewed when the evidence is available.
3
+ Status: maintainer-directed work; release checkpoint on 2026-10-26 after verified 0.3.0 publication.
4
+ **New adoption blocker: T08, deterministic physical-file kind conflicts.** This takes release
5
+ priority over the remaining planned increments; T04 was completed first as requested.
6
+ The report concerned `@weftlet/toolkit@0.2.0`. **T01's upstream patch shipped in 0.2.1**;
7
+ genuine consumer acceptance remains pending. T02 and T05's focused cold-validation optimization
8
+ shipped in 0.3.0. T03 and T04 are implemented in development source after that release. Broader T05
9
+ follow-ups and T06 and T07 remain open. These tasks improve setup, reuse, diagnostics and document coverage
10
+ without expanding the consumer's migration. An official 1.0
11
+ follows this work and genuine consumer acceptance, with its exact release scope reviewed when
12
+ the evidence is available.
8
13
 
9
14
  This is the near-term release task list. The [Weftlet 2.0 product plan](WEFTLET-2.0-PLAN.md)
10
15
  remains a separate future direction for generation, approvals, a companion website and hosted
@@ -31,17 +36,40 @@ integration. Consumer acceptance is reported separately from upstream determinis
31
36
 
32
37
  | ID | Task | Priority/status | Dependencies and release boundary |
33
38
  | --- | --- | --- | --- |
34
- | **T01** | Coherent repository-document identity and kind | **Adoption blocker; patch work in progress** | First isolated patch; preserve SHACL and all assertions |
35
- | **T02** | No-model hydration/setup preview | Planned usability work | Shares selection/cache identity with hydration; extend it with T07 traversal coverage |
36
- | **T03** | Artifact reuse across operational configuration changes | Planned efficiency work | Preserve T01's semantic identity separation; keep snapshot/config identity distinct from reusable artifact identity |
37
- | **T04** | Actionable, privacy-safe timeout diagnostics | Planned diagnostics work | Use stable source identifiers and run progress; document recovery with T02/T03 |
38
- | **T05** | Early identity checks and validation progress/profiling | Planned correctness/observability work | Build on T01; profile latency independently before selecting optimizations |
39
- | **T06** | Packaged release-documentation consistency | Planned release tooling work | Check the actual release archives; does not require a runtime architecture change |
39
+ | **T08** | Canonical physical-file kinds and public adapter factory | **Merged; local and hosted Ubuntu/Windows checks passed; release pending** | Neutral contract consumers conflict with test Evidence; consumer framework migration remains separately required |
40
+ | **T01** | Coherent repository-document identity and kind | **Upstream patch shipped in 0.2.1; consumer acceptance pending** | SHACL and assertions preserved; genuine consumer re-run is still required |
41
+ | **T02** | No-model hydration/setup preview | Shipped in 0.3.0 | Shared selection/cache inspection, human/JSON plans; extend with T07 traversal coverage |
42
+ | **T03** | Artifact reuse across operational configuration changes | Merged; local and hosted Ubuntu/Windows checks passed; unreleased | Built-in Codex user artifacts share five operational changes; custom providers remain conservative; exact legacy recovery without model calls |
43
+ | **T04** | Actionable, privacy-safe timeout diagnostics | Merged; local and hosted Ubuntu/Windows checks passed; unreleased | Safe source IDs, settled counts, failure classification and T02/T03 recovery; no extraction/cache identity change |
44
+ | **T05** | Early identity checks and validation progress/profiling | **Cold-validation fix shipped in 0.3.0; consumer acceptance pending** | Full validation preserved; early checks, detailed progress and validation reuse remain open |
45
+ | **T06** | Packaged release-documentation consistency | Open; README version pins removed in 0.2.1 | Automated archive/version consistency check remains to be implemented |
40
46
  | **T07** | Coverage-aware traversal from SOT/roadmap entry points | Planned bounded feature work | Use canonical identity from T01, preview from T02 and incremental reuse from T03; split selection/classification/extraction changes |
41
47
 
42
- T02–T07 can ship in independently useful increments after the blocker patch. Do not combine
43
- all seven into one diff or delay T01 for the optional platform work. Normal required release
44
- checks still apply to every shipped increment.
48
+ T02 and the focused T05 fix passed local publication checks and hosted Ubuntu/Windows checks,
49
+ then shipped in [0.3.0](https://github.com/jchewitt/weftlet/releases/tag/%40weftlet/toolkit%400.3.0).
50
+ Registry archives match the independently reviewed export; source commit, provenance and release
51
+ tags are recorded in [validation](VALIDATION.md). T03, T04, T06 and T07 remain independently
52
+ useful increments, separate from the optional platform work. A genuine consumer hydration and
53
+ repeat against the current release remain required; upstream fixtures do not establish that result.
54
+
55
+ ## T08 — Resolve deterministic physical-file kind conflicts
56
+
57
+ The consumer reports 120 IDs reproduced by actual 0.3.0 deterministic producers: 34 neutral
58
+ contract-only, 57 local-framework-only and 29 overlapping. This is separate from T01's repository
59
+ document identity defect and does not diagnose semantic-cache corruption or business-rule drift.
60
+
61
+ [ADR 020](ADR-020-canonical-physical-file-producers.md) records the public core factory, producer
62
+ audit, deterministic version changes and preserved semantic-cache boundary. The upstream fix
63
+ routes physical-file producers through one policy, preserves strict SHACL/provenance/authority,
64
+ and distinguishes historical graph versions from current validation. Public tests include real
65
+ SCIP and actual extractor composition, plus negative overlay validation without routing.
66
+
67
+ Release requires local publication checks, hosted Ubuntu/Windows checks, reviewed archives and
68
+ fresh installed-package verification. Consumer acceptance then requires the published packages
69
+ plus its own framework adapter migration and composed Prisma/DI/decorator spec/test regressions,
70
+ followed by full hydration and repeat reuse. Neither an upstream-only release nor a local-only
71
+ adapter patch closes both ownership boundaries. Do not rewrite semantic caches or force model
72
+ work to work around the proven deterministic defect.
45
73
 
46
74
  ## T01 — Resolve repository-document identity conflicts
47
75
 
@@ -66,16 +94,41 @@ Acceptance:
66
94
  the patch, then request a genuine consumer re-run against the recorded inputs; do not infer
67
95
  consumer acceptance from the upstream fixture.
68
96
 
69
- Completion evidence will link the implementation PR, tested source commit, validation record,
70
- published patch and subsequent consumer result. No patch publication or consumer pass is claimed
71
- by this task list yet.
97
+ Upstream completion evidence:
98
+
99
+ - [Fix PR #15](https://github.com/jchewitt/weftlet/pull/15) implements the policy in
100
+ [ADR 015](ADR-015-repository-document-identity.md), with public cross-document regressions and
101
+ fresh/cache-reuse coverage. [Release PR #16](https://github.com/jchewitt/weftlet/pull/16)
102
+ advances the fixed core/toolkit group to 0.2.1.
103
+ - [Release run 40382864083](https://github.com/jchewitt/weftlet/actions/runs/40382864083)
104
+ completed preparation, publication and release records on its first attempt at commit
105
+ `5d1db91bf19ed493a20849b2d0f92d3aeac35dfe`. Required checks included 227 deterministic tests,
106
+ 12 advisory architecture findings, fresh packed-consumer checks and hosted Ubuntu/Windows CI.
107
+ - Registry archives, provenance and tags match the reviewed release. A fresh public-registry
108
+ consumer passes the two-document regression, real SCIP, RDF/SHACL, queries and unchanged
109
+ snapshot identity/content on artifact reuse, without live model calls. See the detailed
110
+ [validation record](VALIDATION.md) for commits, checks and result boundaries.
111
+
112
+ The private consumer has not yet supplied a successful full hydration/repeat with the identity
113
+ patch. Use the current 0.3.0 release, which also includes the cold-validation improvement.
114
+ Upstream publication and regression success do not close that acceptance gate or diagnose the
115
+ separate full-graph validation latency observation.
72
116
 
73
117
  ## T02 — Preview scope and work without calling a model
74
118
 
75
- Add a no-model preview command, tentatively `hydrate --plan`; the CLI spelling is not implemented
76
- by this plan. Use the same source-selection and identity logic as hydration to avoid preview drift.
77
- Report selected sources and sizes, inclusion reasons, role/approval classification, expected
78
- artifact hits/misses and extraction count, plus document/byte limits and any violations.
119
+ Shipped in 0.3.0: `hydrate --plan` renders a human summary and `--json` returns
120
+ the structured plan. This feature is not in published 0.2.1. Shared source selection and identity
121
+ logic report selected documents and sizes, inclusion reasons, configured role/source approval,
122
+ unreviewed assertion status, artifact reuse/extraction estimates and document/per-source byte limits.
123
+ See [ADR 016](ADR-016-hydration-preview.md) and [validation](VALIDATION.md).
124
+
125
+ Missing or unsupported-only selectors and bounded agent omissions remain visible as warnings;
126
+ incomplete plans need review and exit 1. They do not introduce new hydration gates that would
127
+ break deletion of the last document. Budget, duplicate-ID and corrupt/unavailable cache errors
128
+ block planning checks without truncating selected sources. An explicit empty source list selects
129
+ none. Requested refs now govern agent scope; corrected snapshots use graph-v6 while valid 0.2.1
130
+ semantic artifacts remain reusable. T03's operational cache changes and T07's traversal/default
131
+ validation-document separation remain separate work.
79
132
 
80
133
  Acceptance:
81
134
 
@@ -90,6 +143,20 @@ Acceptance:
90
143
 
91
144
  ## T03 — Reuse valid artifacts after operational changes
92
145
 
146
+ Merged in [PR 22](https://github.com/jchewitt/weftlet/pull/22) after 0.3.0, with local publication
147
+ and hosted Ubuntu/Windows checks passing. This source checkpoint does not claim npm publication.
148
+ [ADR 018](ADR-018-operational-semantic-cache.md) separates built-in Codex user artifacts from
149
+ full snapshot profiles. Timeout, retry, concurrency and document/byte limits can change without
150
+ hiding completed artifacts. Model/policy/authentication descriptors and unknown fields remain
151
+ identity inputs; custom providers retain their full configuration contract. Workspace cache
152
+ paths and existing 0.2.1/0.3.0 artifact identities remain unchanged.
153
+
154
+ Planning reads the exact compatible legacy profile without writing. Hydration can retain a
155
+ validated copy atomically. Explicit `cache adopt --from-config` and its read-only `--dry-run`
156
+ recover expected committed-source keys after settings were already changed; no unrelated profiles
157
+ are scanned and no providers or snapshots are initialized. Agent scope and budget/coverage
158
+ reporting match the hydration preview. Current-diff checks still reject old-configuration snapshots.
159
+
93
160
  The consumer reported that changing only a timeout selected a different cache profile and made
94
161
  completed extractions unavailable for reuse. Investigate both storage-location selection and
95
162
  artifact key construction. Separate operational controls from semantic-output identity, while
@@ -106,10 +173,22 @@ Acceptance:
106
173
  - Preserve force-extraction semantics, concurrent-writer safety, isolation between consumers,
107
174
  credentials and private cache contents. Record reuse and reasons for a miss without secrets.
108
175
  - Test interrupted work followed by a changed timeout: valid completed artifacts are reused,
109
- incomplete/invalid ones are re-extracted, and source provenance remains correct.
176
+ missing/incomplete artifacts are extracted, and source provenance remains correct. Corrupt
177
+ complete artifacts stay intact and require explicit forced refresh or operator repair;
178
+ they are not silently overwritten or treated as misses.
110
179
 
111
180
  ## T04 — Explain timeouts and recovery
112
181
 
182
+ Merged in [PR 25](https://github.com/jchewitt/weftlet/pull/25) after 0.3.0, with local publication
183
+ and hosted Ubuntu/Windows checks passing. This development checkpoint does not claim npm publication.
184
+ [ADR 019](ADR-019-semantic-failure-diagnostics.md) records opaque source IDs and explicit local
185
+ preview mapping, final counts after active workers settle, safe typed errors and recovery.
186
+ Concurrent sibling cancellation preserves the initiating failure. Completed writes stay counted
187
+ as completed; cancellation between sources reports no failing source. The CLI supports semantic
188
+ failure JSON on stderr with `hydrate --json --quiet`, leaving protocol/success stdout untouched.
189
+ Provider loading problems and unknown provider errors are distinct. Timeout defaults, extraction
190
+ identities, cache formulas, saved queries and full graph validation remain unchanged.
191
+
113
192
  Report a privacy-safe source identifier, phase, elapsed time, configured limit and completed/
114
193
  remaining counts when extraction times out. Explain which completed artifacts can be retained
115
194
  and how to inspect the plan or adjust a bound before retrying. The documented two-minute default
@@ -126,19 +205,56 @@ Acceptance:
126
205
 
127
206
  ## T05 — Detect inexpensive conflicts early and explain validation work
128
207
 
129
- Add inexpensive graph-assembly checks for incompatible identities before expensive validation.
130
- Keep the full conformance requirement. Separately instrument and profile large RDF/SHACL
131
- validation to determine where time is spent before choosing optimizations.
208
+ The implementation uses JavaScript on Node:
209
+ `rdf-validate-shacl` validates an in-memory N3 dataset. Hydration constructs and validates the
210
+ entire assembled graph, including when semantic artifacts were reused. There is no persistent
211
+ GraphDB backend or incremental validation. Querying a saved snapshot does not rerun SHACL.
212
+
213
+ The maintainer reports that validation pushes the consumer's overall generation beyond its
214
+ 30-minute timeout, preventing snapshot publication and making adoption unusable. That report made
215
+ cold validation a release priority ahead of the remaining 1.0 work. Upstream has measured a specific
216
+ named-graph lookup cost in public synthetic fixtures, but has not measured that consumer graph or
217
+ diagnosed its complete timeout. The focused cold-validation fix shipped in 0.3.0, ahead of the
218
+ remaining 1.0 tasks. Consumer acceptance remains pending; broader T05 items stay open.
219
+
220
+ [ADR 017](ADR-017-shacl-validation-union.md) records the implemented cold-validation optimization:
221
+ build a temporary union of every SPO triple for the same validator/shapes, while keeping original
222
+ named assertion graphs canonical for queries and serialization. It removes repeated wildcard
223
+ lookups across one graph per fact. In a bounded single-run public 2,000-fact unique-node case,
224
+ the original SHACL path took 31.502 seconds; union construction took 0.153 seconds and SHACL
225
+ took 0.467 seconds. A 10,000-fact unique-node union case used about 1.3 GiB process RSS. These
226
+ are synthetic phase measurements, not a private consumer reproduction or end-to-end guarantee.
227
+
228
+ The focused change still validates the whole graph each time. It does not add Rust, GraphDB,
229
+ incremental validation or a validation-result cache. Early checks and broader observability/reuse
230
+ remain follow-ups rather than reasons to delay the cold-path fix. Native code or a database does
231
+ not by itself establish faster or correct incremental SHACL.
132
232
 
133
233
  Acceptance:
134
234
 
135
235
  - Early errors identify the conflicting identity/kinds and relevant evidence using the configured
136
236
  privacy policy. Preserve all underlying assertions for diagnosis; early checks are not a
137
237
  substitute for RDF/SHACL validation.
138
- - Report elapsed time and honest phase/heartbeat progress for long validation. Do not display a
139
- fabricated completion percentage when the validator exposes no meaningful denominator.
238
+ - Report elapsed time and honest progress for long validation. Current phase boundaries remain
239
+ the supported progress signal: the synchronous validator blocks same-thread timers. Evaluate
240
+ bounded worker execution before promising an in-phase heartbeat or cancellation; never display
241
+ a fabricated completion percentage when the validator exposes no meaningful denominator.
140
242
  - Record reproducible public-fixture sizes, fact/node counts, runtime versions, wall time and
141
- resource observations. Separate measured bottlenecks from hypotheses.
243
+ resource observations for construction and validation separately. Separate measured bottlenecks
244
+ from hypotheses; include repeated identical input and small changed-input cases.
245
+ - Demonstrate improved cold full-graph validation, because reusing a previous validation result
246
+ cannot unblock a first graph that has never completed. Keep private consumer acceptance and
247
+ the overall generation timeout separate from synthetic validator-only benchmarks.
248
+ - Evaluate reuse of a successful conformance result only when validated graph content, shapes,
249
+ validator version and applicable policy/semantics match. This reuse must not make historical
250
+ evidence satisfy current-diff freshness, scope or provenance requirements.
251
+ - Evaluate dependency-aware incremental validation with insertions, updates, deletions, renames,
252
+ affected relationships and global constraints. Revalidate the complete affected scope or fall
253
+ back to full validation when it cannot be bounded safely; changed nodes alone are insufficient.
254
+ - Benchmark a suitable native/Rust-backed validator or optional persistent graph database if
255
+ measurements justify a candidate. Compare supported SHACL behavior, positive/negative parity,
256
+ installation, licensing, portability and maintenance cost. T02 adds no backend migration, and
257
+ this evaluation does not commit the standalone toolkit to a mandatory service.
142
258
  - Any optimized validation/projection path has equivalence tests, including negative cases;
143
259
  failure must preserve the prior snapshot. Keep model-independent profiling separate from live
144
260
  extraction performance and from the reported two-fact correctness defect.
@@ -146,9 +262,9 @@ Acceptance:
146
262
  ## T06 — Keep packaged documentation consistent with the release
147
263
 
148
264
  The consumer installed 0.2.0 while its packaged README still named 0.1.2 and some archive examples
149
- used 0.1.1. Source documentation has since been updated, but immutable published archives retain
150
- their original text. Add a repeatable release-documentation check rather than relying on a
151
- post-publication source edit.
265
+ used 0.1.1. Release 0.2.1 removes the README version pins; immutable 0.2.0 archives retain their
266
+ original text. The automated release-documentation consistency check remains open. Add that
267
+ repeatable check rather than relying on manual edits alone.
152
268
 
153
269
  Acceptance:
154
270
 
@@ -194,7 +310,7 @@ Acceptance:
194
310
 
195
311
  ## Official 1.0 acceptance
196
312
 
197
- After T01's patch is available, work through T02–T07 in bounded increments and record implementation
313
+ With T01's upstream patch published, work through T02–T07 in bounded increments and record implementation
198
314
  PRs and validation evidence here or in the linked validation record. Review the exact 1.0 scope
199
315
  against completed evidence; any deferral needs an explicit maintainer decision and must remain
200
316
  visible rather than being treated as done. The companion website, hosted AI and broader 2.0