ds4-context-engine 0.3.0-alpha.1 → 0.3.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ bounded active context with provenance
16
16
  Pi provider
17
17
  ```
18
18
 
19
- > **Project status:** Stable `0.2.0` includes M0–M20 and frozen 0.2 contracts. Development is on `0.3.0-alpha.1`, adding the confirmation-gated `context_persistence` tool without changing canonical Pin/Memory records, SQLite schema 15, or the reference history contract. The maintenance line targets Pi `0.84.3`.
19
+ > **Project status:** Stable `0.2.0` includes M0–M20 and frozen 0.2 contracts. Prerelease `0.3.0-alpha.2` hardens the confirmation-gated `context_persistence` tool by rejecting its output-only historical egress sentinel on input, without changing canonical Pin/Memory records, SQLite schema 15, or the reference history contract. npm `latest` remains `0.2.0`; the maintenance line targets Pi `0.84.3`.
20
20
 
21
21
  ## Why DS4
22
22
 
@@ -89,6 +89,14 @@ pi install npm:ds4-context-engine
89
89
 
90
90
  The stable `0.2.0` packages (`ds4-context-engine`, `ds4-context-core`, and `ds4-context-reference-adapter`) use the same exact version. Both adapters require the matching core version.
91
91
 
92
+ To dogfood the published alpha without replacing a global stable installation, pin it in a disposable project:
93
+
94
+ ```bash
95
+ pi install -l npm:ds4-context-engine@0.3.0-alpha.2
96
+ ```
97
+
98
+ Follow the [0.3 alpha dogfooding runbook](docs/DOGFOODING_0.3.0_ALPHA.md); use synthetic data and a dedicated session directory.
99
+
92
100
  ### Local checkout
93
101
 
94
102
  ```bash
@@ -408,7 +416,7 @@ npm run schema:context-persistence
408
416
  npm run latency:check -- /path/to/exact/ds4-context-core@0.1.2
409
417
  npm run pack:check
410
418
  # Post-publication, with an exact version rather than a dist-tag:
411
- npm run registry:check -- 0.3.0-alpha.1
419
+ npm run registry:check -- 0.3.0-alpha.2
412
420
  npm pack --dry-run
413
421
  npm pack --dry-run --workspace ds4-context-core
414
422
  npm pack --dry-run --workspace ds4-context-reference-adapter
@@ -447,6 +455,7 @@ scripts package and release-readiness checks
447
455
  - [Artifacts](docs/ARTIFACTS.md)
448
456
  - [Memory and pins](docs/MEMORY_AND_PINS.md)
449
457
  - [Context persistence tool](docs/CONTEXT_PERSISTENCE_TOOL.md)
458
+ - [0.3 alpha dogfooding runbook](docs/DOGFOODING_0.3.0_ALPHA.md)
450
459
  - [Privacy](docs/PRIVACY.md)
451
460
  - [Model awareness](docs/MODEL_AWARENESS.md)
452
461
  - [Native continuation](docs/NATIVE_CONTINUATION.md)
@@ -459,6 +468,7 @@ scripts package and release-readiness checks
459
468
  - [0.2.0 release readiness](docs/RELEASE_READINESS_0.2.0.md)
460
469
  - [0.2.0 release notes](docs/releases/0.2.0.md)
461
470
  - [0.2.0-rc.1 release notes](docs/releases/0.2.0-rc.1.md)
471
+ - [0.3.0-alpha.2 prerelease notes](docs/releases/0.3.0-alpha.2.md)
462
472
  - [0.3.0-alpha.1 prerelease notes](docs/releases/0.3.0-alpha.1.md)
463
473
  - [Architecture decisions](docs/ADR/README.md)
464
474
  - [Original development plan](DS4_Context_Engine_Extension_Piano_Sviluppo.md)
@@ -467,7 +477,7 @@ scripts package and release-readiness checks
467
477
 
468
478
  The original M0–M13 roadmap is complete. `ds4-context-core` contains the compiled runtime-neutral implementation. M14 context-quality metrics, M15 rich symbol indexing, M16 hybrid semantic retrieval, M17 cross-session project memory, M18 learned-ranking shadow evaluation, M19's runtime adapter/conformance kit, and M20 opt-in local KV eligibility/replay are implemented on `main`. Learned active ranking remains promotion-gated, Pi reports local KV as unsupported, and static ranking/native completion stay authoritative on every failure.
469
479
 
470
- The [0.2.0 roadmap](docs/ROADMAP_0.2.0.md) is complete. Development `0.3.0-alpha.1` adds the [context persistence tool](docs/CONTEXT_PERSISTENCE_TOOL.md) while retaining the stable canonical/configuration/SQLite/runtime contracts. The [0.2 readiness record](docs/RELEASE_READINESS_0.2.0.md) remains the compatibility baseline. Sensitive or transport-specific behavior remains opt-in, and the 0.1 lexical planner stays available as the deterministic fallback.
480
+ The [0.2.0 roadmap](docs/ROADMAP_0.2.0.md) is complete. Prerelease `0.3.0-alpha.2` hardens the [context persistence tool](docs/CONTEXT_PERSISTENCE_TOOL.md) delivered in alpha.1 while retaining the stable canonical/configuration/SQLite/runtime contracts. The [0.2 readiness record](docs/RELEASE_READINESS_0.2.0.md) remains the compatibility baseline. Sensitive or transport-specific behavior remains opt-in, and the 0.1 lexical planner stays available as the deterministic fallback.
471
481
 
472
482
  ## Contributing
473
483
 
@@ -88,6 +88,7 @@ Project-memory source exclusion is intentionally different. It updates `project_
88
88
  The tool enforces its own egress policy even when general privacy is disabled:
89
89
 
90
90
  - current and historical content, query, key, reason, preview, path, source identity, and raw errors are removed unless explicitly allowed;
91
+ - the fixed historical omission sentinel is output-only; any incoming string argument containing it is rejected as `egress-placeholder` before runtime access, confirmation, or persistence, so retries must use fresh user-provided text;
91
92
  - results use deterministic metadata-only templates;
92
93
  - marker/credential detection may raise a mutation classification;
93
94
  - an explicit supersede classification cannot lower the target's effective protection;
@@ -124,3 +125,7 @@ Useful diagnostics:
124
125
  /context health
125
126
  /context rebuild-index
126
127
  ```
128
+
129
+ ## Alpha dogfooding
130
+
131
+ Use the published package with synthetic data and exercise TUI, RPC, print, and JSON behavior through the dedicated [`0.3 alpha dogfooding runbook`](DOGFOODING_0.3.0_ALPHA.md). The runbook distinguishes RPC's UI request/response bridge from genuinely no-UI print/JSON modes and includes a metadata-only canonical append audit.
@@ -0,0 +1,304 @@
1
+ # Dogfooding DS4 0.3.0 Alpha
2
+
3
+ This runbook validates the published `ds4-context-engine@0.3.0-alpha.2` package through sustained real Pi use. It complements automated tests and release smoke checks; it does not replace them.
4
+
5
+ The primary target is the model-callable `context_persistence` surface. Pi JSONL must remain canonical and append-only, SQLite must remain rebuildable, and no model-callable write may occur without a fresh positive local UI decision.
6
+
7
+ ## Safety and scope
8
+
9
+ - Use the exact prerelease version, not the mutable `alpha` dist-tag.
10
+ - Use a disposable trusted project and a dedicated session directory.
11
+ - Use synthetic, non-secret Pin/Memory content. Local TUI dialogs and JSON event streams may display current tool arguments.
12
+ - Published alpha.1 had a retry limitation: copying `[omitted-by-ds4-egress-policy]` from sanitized history could present a confirmation for the literal marker. Alpha.2 reserves that output-only marker and must reject it as `egress-placeholder` before runtime access, confirmation, canonical append, or derived-policy update.
13
+ - Do not use `--no-session` except for the explicit fail-closed test. Without a persistent Pi JSONL destination, both reads and writes return `runtime-unavailable`.
14
+ - Do not retry `committed_projection_pending` or `indeterminate`. Inspect state with a read, `/context health`, or `/context rebuild-index` first.
15
+ - Use `/context` only for local inspection and recovery. Mutations under test must go through `context_persistence` so the confirmation and provider-egress boundaries are exercised.
16
+ - Never edit a Pi session JSONL file during the run.
17
+
18
+ Recommended minimum before promoting the alpha: three normal work sessions, two process restarts, one branch change, one projection rebuild, the TUI/RPC/print/JSON matrix, one configured remote provider, and—when available—one verified local provider.
19
+
20
+ ## Isolated setup
21
+
22
+ Pi packages execute with the user's full permissions. Review the package before installation.
23
+
24
+ ```bash
25
+ mkdir -p /tmp/ds4-alpha-dogfood
26
+ cd /tmp/ds4-alpha-dogfood
27
+ git init
28
+ mkdir -p sessions evidence
29
+ pi install -l npm:ds4-context-engine@0.3.0-alpha.2
30
+ pi list
31
+ pi --version
32
+ ```
33
+
34
+ The `-l` installation is project-local and the exact npm version is pinned. Run Pi from this directory. Use `--approve` only after trusting this disposable project; non-interactive modes cannot show the project-trust dialog.
35
+
36
+ Use the same dedicated session directory throughout:
37
+
38
+ ```bash
39
+ export DS4_DOGFOOD_SESSIONS="$PWD/sessions"
40
+ ```
41
+
42
+ Record the Pi version, DS4 version, provider/model, mode, session name, expected result, observed result, and pass/fail status for every scenario.
43
+
44
+ ## Synthetic test data
45
+
46
+ Use unique non-sensitive values so duplicates from earlier runs cannot hide a failure. Example run label:
47
+
48
+ ```text
49
+ alpha2-run-01
50
+ ```
51
+
52
+ Example Pin:
53
+
54
+ ```text
55
+ For alpha2-run-01 verification, use Node.js 22 in this disposable project.
56
+ ```
57
+
58
+ Example Memory:
59
+
60
+ ```text
61
+ For alpha2-run-01, the synthetic release channel is amber.
62
+ ```
63
+
64
+ Never use real credentials, customer data, private paths, or production policy in dogfooding prompts.
65
+
66
+ ## TUI procedure
67
+
68
+ Start a persistent interactive session:
69
+
70
+ ```bash
71
+ pi --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
72
+ --name "ds4-alpha-tui"
73
+ ```
74
+
75
+ Run these scenarios in order:
76
+
77
+ 1. Inspect `/context health`, `/context pins`, `/context memory`, and `/context privacy`.
78
+ 2. Send an ordinary suggestion without asking to persist it, for example: `The synthetic release channel amber seems useful.` No `context_persistence` call or confirmation dialog should appear.
79
+ 3. Explicitly request the synthetic Memory: `Remember for this session that the synthetic release channel for alpha2-run-01 is amber.` Verify that the dialog identifies the action and canonical persistence class. Accept it. Expect one committed Memory mutation.
80
+ 4. Ask the model to use `context_persistence` to list active Memory. Verify bounded metadata and no complete claim, key, reason, path, or raw error in the result.
81
+ 5. Explicitly request the synthetic Pin, but reject or close the confirmation dialog. Verify with `/context pins` that it was not created.
82
+ 6. Ask the model to retry using the sanitized value remaining in history. If it copies `[omitted-by-ds4-egress-policy]`, expect `rejected / egress-placeholder` before any new confirmation, runtime mutation, or append. If it asks for fresh text instead, record that safe routing result and run the exact-marker case from the JSON procedure.
83
+ 7. Request the Pin again with fresh synthetic text and accept it. Ask the model to list Pins, then use the exact returned Pin ID and `targetRevision` to unpin it in the same process. Accept the destructive confirmation. Fuzzy targeting must not be used.
84
+ 8. With a remote provider, request a `local-only` Pin. Expect provider-policy denial before confirmation and no append.
85
+ 9. Restart Pi and continue the session:
86
+
87
+ ```bash
88
+ pi --approve --session-dir "$DS4_DOGFOOD_SESSIONS" -c
89
+ ```
90
+
91
+ Verify the accepted Memory remains visible. Revision handles from the previous process are intentionally invalid; perform a fresh read before any targeted write.
92
+ 10. Run `/context rebuild-index`, then verify the same canonical Memory/Pin lifecycle state is reconstructed.
93
+
94
+ TUI passes when accepted writes append once, refusal/closure appends nothing, destructive writes require an exact fresh revision, ordinary conversation does not persist, and rebuild preserves canonical state.
95
+
96
+ ## RPC procedure
97
+
98
+ RPC mode exposes extension dialogs through a JSON request/response protocol. It reports `ctx.hasUI=true` because a client can answer those requests; the client is the UI bridge.
99
+
100
+ Start a persistent RPC process from the disposable project:
101
+
102
+ ```bash
103
+ pi --mode rpc --approve \
104
+ --session-dir "$DS4_DOGFOOD_SESSIONS" \
105
+ --name "ds4-alpha-rpc" \
106
+ 2>evidence/rpc.stderr.log
107
+ ```
108
+
109
+ Enter one JSON object per line on stdin. First request a read:
110
+
111
+ ```json
112
+ {"id":"read-1","type":"prompt","message":"Use context_persistence with action pins_list to inspect active Pins. Do not perform a write."}
113
+ ```
114
+
115
+ Wait for the turn to end before sending the next prompt. For a write:
116
+
117
+ ```json
118
+ {"id":"write-1","type":"prompt","message":"Persist a session Pin for alpha2-run-01 stating that this disposable project uses Node.js 22 for verification."}
119
+ ```
120
+
121
+ Pi should emit a request shaped like:
122
+
123
+ ```json
124
+ {"type":"extension_ui_request","id":"<dynamic-id>","method":"confirm","title":"DS4 Context Persistence","message":"..."}
125
+ ```
126
+
127
+ After inspecting the request, approve it with the exact dynamic ID:
128
+
129
+ ```json
130
+ {"type":"extension_ui_response","id":"<dynamic-id>","confirmed":true}
131
+ ```
132
+
133
+ Expect the `context_persistence` tool result to report a committed outcome without echoing complete Pin content. Repeat with a different synthetic value and reject it:
134
+
135
+ ```json
136
+ {"type":"extension_ui_response","id":"<dynamic-id>","confirmed":false}
137
+ ```
138
+
139
+ The rejected call must report cancellation and append nothing. `{"cancelled":true}` is also a valid dialog dismissal response.
140
+
141
+ ### RPC without a responding UI client
142
+
143
+ Start a separate disposable RPC process, request a write, and do not send an `extension_ui_response`. In Pi `0.84.3`, the confirmation remains pending because RPC still advertises UI capability. This is not converted to `confirmation-required`; no append may occur before a positive response. Terminate the disposable process after recording the pending request, then inspect the session from TUI.
144
+
145
+ ### RPC without a persistent session
146
+
147
+ Start a separate process:
148
+
149
+ ```bash
150
+ pi --mode rpc --approve --no-session
151
+ ```
152
+
153
+ Send a read and a write prompt. Both must return `runtime-unavailable`; no `extension_ui_request` should be emitted and no canonical commit should be claimed.
154
+
155
+ RPC passes when positive confirmation commits once, negative/cancelled confirmation appends nothing, an unanswered dialog remains pending without append, `--no-session` fails before confirmation, and result content/details remain bounded and metadata-only.
156
+
157
+ ## Print-mode procedure
158
+
159
+ Print mode has no extension UI. Keep session persistence enabled:
160
+
161
+ ```bash
162
+ pi -p --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
163
+ "Use context_persistence with action memory_list to inspect active Memory. Do not write."
164
+ ```
165
+
166
+ The read should complete. Then request a write:
167
+
168
+ ```bash
169
+ pi -p --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
170
+ "Use context_persistence to add a session Memory saying that alpha2-run-01 uses the synthetic channel amber."
171
+ ```
172
+
173
+ Expected behavior:
174
+
175
+ ```text
176
+ outcome=unavailable
177
+ errorCode=confirmation-required
178
+ ```
179
+
180
+ No dialog can appear and no canonical custom entry may be appended. The assistant's final wording can vary; use JSON mode or the canonical audit below when the exact tool envelope is needed. If the model does not call the tool, record that separately as a routing observation and repeat with the explicit action name to isolate runtime behavior.
181
+
182
+ Adding `--no-session` changes the expected error to `runtime-unavailable` for both reads and writes.
183
+
184
+ ## JSON event-stream procedure
185
+
186
+ JSON mode is also non-interactive, but it exposes authoritative tool lifecycle events. Capture the complete local stream; it may include current non-secret tool arguments.
187
+
188
+ Read case:
189
+
190
+ ```bash
191
+ pi --mode json --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
192
+ "Use context_persistence with action pins_list to inspect active Pins. Do not write." \
193
+ 2>evidence/json-read.stderr.log | tee evidence/json-read.jsonl
194
+ ```
195
+
196
+ Write case:
197
+
198
+ ```bash
199
+ pi --mode json --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
200
+ "Use context_persistence to add a session Pin for alpha2-run-01 stating that this disposable project uses Node.js 22." \
201
+ 2>evidence/json-write.stderr.log | tee evidence/json-write.jsonl
202
+ ```
203
+
204
+ Reserved historical-placeholder regression:
205
+
206
+ ```bash
207
+ pi --mode json --approve --session-dir "$DS4_DOGFOOD_SESSIONS" \
208
+ "Call context_persistence exactly once with action pin_add, scope session, classification normal, and content exactly [omitted-by-ds4-egress-policy]." \
209
+ 2>evidence/json-placeholder.stderr.log | tee evidence/json-placeholder.jsonl
210
+ ```
211
+
212
+ Extract tool completions:
213
+
214
+ ```bash
215
+ jq -c '
216
+ select(.type == "tool_execution_end" and .toolName == "context_persistence")
217
+ | {isError, result}
218
+ ' evidence/json-*.jsonl
219
+ ```
220
+
221
+ The read should succeed. The ordinary write must return `confirmation-required` and append nothing. The placeholder case must return `rejected / egress-placeholder`, not request confirmation, and append nothing. Inspect `result.content` and `result.details` for bounded allowlisted metadata; they must not echo complete content, claims, keys, reasons, paths, source-session identity, confirmation text, or raw errors.
222
+
223
+ The local `tool_execution_start.args` event can contain the current synthetic arguments supplied to the tool. That local event is not the provider-facing result contract, which is why dogfooding must use non-sensitive data and evidence files must not be published blindly.
224
+
225
+ ## Canonical append audit
226
+
227
+ List only metadata for canonical Pin/Memory entries in the dedicated sessions:
228
+
229
+ ```bash
230
+ find "$DS4_DOGFOOD_SESSIONS" -name '*.jsonl' -print0 \
231
+ | xargs -0 -r jq -r '
232
+ select(
233
+ .type == "custom"
234
+ and (
235
+ .customType == "ds4-context-pin-v1"
236
+ or .customType == "ds4-context-memory-v1"
237
+ )
238
+ )
239
+ | [.customType, .id, .timestamp, (.data.operation // "unknown")]
240
+ | @tsv
241
+ '
242
+ ```
243
+
244
+ Expected invariants:
245
+
246
+ - each accepted canonical add/supersede/status operation contributes exactly one append-only custom entry;
247
+ - cancelled, rejected, unavailable, and unanswered-confirmation operations contribute none;
248
+ - print/JSON writes contribute none;
249
+ - `--no-session` contributes none;
250
+ - source include/exclude policy contributes no Pin/Memory custom entry because it is derived local SQLite policy;
251
+ - rebuild changes projections, not the JSONL mutation sequence.
252
+
253
+ Do not publish the session files: they are canonical local history and may contain prompt/tool argument text even when tool results are metadata-only.
254
+
255
+ ## Extended provider and lifecycle matrix
256
+
257
+ After the basic mode matrix passes, repeat the relevant TUI/RPC cases with:
258
+
259
+ - a configured remote provider;
260
+ - a verified local provider whose exact provider ID is listed in `privacy.localProviders`;
261
+ - privacy enabled and disabled;
262
+ - a provider switch between read and targeted write;
263
+ - a branch switch between read and targeted write;
264
+ - trusted and untrusted project state;
265
+ - two simultaneous Pi sessions using the shared SQLite database;
266
+ - cross-session project Memory when `memory.crossSession` is explicitly enabled.
267
+
268
+ Provider, trust, branch, provenance, capability, target state, and classification changes after confirmation must fail safely. A model-supplied `local-only` classification is never evidence that earlier input stayed local.
269
+
270
+ ## Result record
271
+
272
+ Use one record per scenario:
273
+
274
+ ```text
275
+ Run ID:
276
+ Date:
277
+ Pi version:
278
+ DS4 exact version:
279
+ Provider/model:
280
+ Mode and session persistence:
281
+ Scenario:
282
+ Expected outcome:
283
+ Observed outcome:
284
+ Confirmation shown/answered:
285
+ Canonical entries before/after:
286
+ Projection/rebuild observation:
287
+ Result leak check:
288
+ Pass/fail:
289
+ Issue/reference:
290
+ ```
291
+
292
+ ## Promotion criteria
293
+
294
+ Do not promote the alpha if any run shows:
295
+
296
+ - a write without a fresh positive local UI decision;
297
+ - canonical JSONL rewrite, loss, duplication, or a false commit claim;
298
+ - complete persistent content or prohibited metadata in provider-facing results/history;
299
+ - fuzzy destructive targeting or acceptance of a stale revision;
300
+ - failure to reconstruct canonical state from JSONL;
301
+ - an actionable warning hidden as routine debug output;
302
+ - a reproducible regression above the release latency/quality/schema gates.
303
+
304
+ A missing live local-provider run should remain explicitly recorded rather than inferred from remote-provider or automated-test results.
package/docs/PRIVACY.md CHANGED
@@ -95,7 +95,7 @@ The local content-addressed object may retain exact restricted bytes because Pi
95
95
 
96
96
  `context_persistence` treats both its current result and historical Pi tool-call/result records as provider-egress surfaces independently of `privacy.enabled`. List/source results contain only bounded IDs or volatile references, scope/lifecycle/classification/timestamps, revisions and safe counters. Find previews are sanitized across the complete bounded source before Unicode-scalar truncation; prohibited previews become metadata-only omissions. Mutation results never echo content, claim, key or reason.
97
97
 
98
- A dedicated historical guard preserves provider-specific tool-call/result linkage while replacing `content`, `query`, `key`, `reason`, unknown fields, raw previews and malformed payloads with a fixed omission sentinel. IDs and revisions must match their opaque grammars; paths, source session identity, complete errors and UI confirmation text are never copied. Local `sourceRef` mappings, revision HMAC secrets and target fingerprints are volatile and contain no content.
98
+ A dedicated historical guard preserves provider-specific tool-call/result linkage while replacing `content`, `query`, `key`, `reason`, unknown fields, raw previews and malformed payloads with the fixed omission sentinel `[omitted-by-ds4-egress-policy]`. That sentinel is output-only and reserved: any incoming `context_persistence` string argument containing it is rejected with `egress-placeholder` before runtime lookup, UI confirmation, canonical append, or derived-policy update. A follow-up call must use fresh user-provided text rather than copying the historical placeholder. IDs and revisions must match their opaque grammars; paths, source session identity, complete errors and UI confirmation text are never copied. Local `sourceRef` mappings, revision HMAC secrets and target fingerprints are volatile and contain no content.
99
99
 
100
100
  Every write is policy-checked before local confirmation and checked again immediately before dispatch, covering provider or trust changes while the dialog is open. `local-only` supplied by a model is not proof that earlier input stayed local; remote-denied writes return only `provider-policy-denied` and do not append.
101
101
 
package/docs/RELEASING.md CHANGED
@@ -30,7 +30,7 @@ git diff --check
30
30
  git status --short
31
31
  ```
32
32
 
33
- For a 0.2 release candidate or the coordinated `0.3.0-alpha.1` prerelease, compare feature-disabled planning against exact stable `ds4-context-core@0.1.2` on the same host:
33
+ For a 0.2 release candidate or a coordinated 0.3 prerelease, compare feature-disabled planning against exact stable `ds4-context-core@0.1.2` on the same host:
34
34
 
35
35
  ```bash
36
36
  BASELINE_DIR="$(mktemp -d)"
@@ -41,7 +41,7 @@ npm run latency:check -- "$BASELINE_DIR/node_modules/ds4-context-core"
41
41
  rm -rf "$BASELINE_DIR"
42
42
  ```
43
43
 
44
- The check rejects a candidate p95 above 110% of the exact 0.1.2 baseline. Run latency measurements on an otherwise idle host and repeat an anomalous run before drawing a release conclusion. See [`RELEASE_READINESS_0.2.0.md`](RELEASE_READINESS_0.2.0.md) for the stable-line gate matrix and [`releases/0.3.0-alpha.1.md`](releases/0.3.0-alpha.1.md) for prerelease-specific evidence and remaining publication gates.
44
+ The check rejects a candidate p95 above 110% of the exact 0.1.2 baseline. Run latency measurements on an otherwise idle host and repeat an anomalous run before drawing a release conclusion. See [`RELEASE_READINESS_0.2.0.md`](RELEASE_READINESS_0.2.0.md) for the stable-line gate matrix, the versioned notes under [`releases/`](releases/) for prerelease evidence, and [`DOGFOODING_0.3.0_ALPHA.md`](DOGFOODING_0.3.0_ALPHA.md) for the post-publication operating matrix.
45
45
 
46
46
  CI runs the same checks on the minimum supported Node.js version and the current Node.js LTS line. `npm run pack:check` uses a temporary directory and removes it when complete. Set `DS4_KEEP_PACK_TMP=1` only when diagnosing a failed package check.
47
47
 
@@ -67,7 +67,7 @@ npm install --package-lock-only
67
67
  npm run pack:check
68
68
  ```
69
69
 
70
- Review `package.json`, both workspace package manifests, and `package-lock.json` before committing the release change. For `0.3.0-alpha.1`, all three manifests and both exact adapter dependencies must use precisely that prerelease version; do not publish only the root package without a separate release-policy decision.
70
+ Review `package.json`, both workspace package manifests, and `package-lock.json` before committing the release change. For every coordinated prerelease, all three manifests and both exact adapter dependencies must use precisely the intended version; do not publish only the root package without a separate release-policy decision.
71
71
 
72
72
  ## Publish
73
73
 
@@ -82,7 +82,7 @@ npm publish --workspace ds4-context-reference-adapter --access public
82
82
  npm publish --access public
83
83
  ```
84
84
 
85
- Prereleases must pass the same explicit channel tag to all three commands so they cannot move `latest`. For `0.3.0-alpha.1`:
85
+ Prereleases must pass the same explicit channel tag to all three commands so they cannot move `latest`. For a 0.3 alpha:
86
86
 
87
87
  ```bash
88
88
  npm publish --workspace ds4-context-core --access public --tag alpha
@@ -1,6 +1,6 @@
1
1
  # DS4 Context Engine 0.3.0-alpha.1
2
2
 
3
- Status: development prerelease candidate; not published by this change.
3
+ Status: published prerelease on 2026-08-27; tag `v0.3.0-alpha.1`.
4
4
 
5
5
  This prerelease adds a confirmation-gated, model-callable persistence surface while preserving the stable 0.2 canonical and projection contracts.
6
6
 
@@ -39,6 +39,10 @@ The reference adapter remains on its append-only `ds4-runtime-session-v1` histor
39
39
  - Tool results, historical arguments/results, errors, diagnostics, and logs are bounded and allowlisted. Content, claims, keys, reasons, paths, source identity, raw errors, and confirmation text are not echoed.
40
40
  - `local-only` is denied to remote/unknown providers and is never presented as proof that prior input stayed local.
41
41
 
42
+ ## Known alpha.1 limitation
43
+
44
+ The published alpha.1 historical sanitizer replaces sensitive tool arguments with `[omitted-by-ds4-egress-policy]`. If a model copies that output-only marker into a later write—most plausibly after a cancelled confirmation—alpha.1 can show a new confirmation for the literal marker. Dogfooders must refuse that dialog; accepting it can append the marker as content or metadata, although it does not recover the omitted value. Current source rejects any incoming string argument containing the marker as `egress-placeholder` before confirmation or persistence. Publishing that hardening requires a new prerelease version; the immutable alpha.1 package is not replaced.
45
+
42
46
  ## Package/version policy
43
47
 
44
48
  The coordinated prerelease version is `0.3.0-alpha.1` for:
@@ -49,7 +53,7 @@ ds4-context-reference-adapter
49
53
  ds4-context-engine
50
54
  ```
51
55
 
52
- Both adapters retain an exact dependency on `ds4-context-core@0.3.0-alpha.1`. Publication remains manual-only under the explicit npm `alpha` dist-tag so `latest` continues to resolve to stable `0.2.0`; GitHub Actions remains validation-only with OIDC and package-write permissions denied.
56
+ Both adapters retain an exact dependency on `ds4-context-core@0.3.0-alpha.1`. The packages were published manually under the explicit npm `alpha` dist-tag, while `latest` continues to resolve to stable `0.2.0`; GitHub Actions remains validation-only with OIDC and package-write permissions denied.
53
57
 
54
58
  ## Validation evidence
55
59
 
@@ -61,6 +65,7 @@ Latest local verification:
61
65
  - `npm run latency:check -- <exact ds4-context-core@0.1.2>`: isolated run ratio `0.880399`, below `1.10` (`0.495890` ms baseline p95, `0.436581` ms candidate p95).
62
66
  - `npm run pack:check`: verified `ds4-context-core@0.3.0-alpha.1` (203 files), `ds4-context-reference-adapter@0.3.0-alpha.1` (7 files), and `ds4-context-engine@0.3.0-alpha.1` (57 files) in a clean consumer.
63
67
  - `npm pack --dry-run --json` for all three packages: passed with the same bounded inventories.
68
+ - `npm run registry:check -- 0.3.0-alpha.1`: passed against all three exact published versions; `alpha` resolves to `0.3.0-alpha.1` and `latest` remains `0.2.0` for every package.
64
69
  - The complete candidate change set was replayed onto a detached clean checkout at `f130115`; offline install, `npm run check`, schema gate, package verification, and `git diff --check` all passed there.
65
70
  - `git diff --check`: passed.
66
71
 
@@ -71,11 +76,12 @@ Isolated Pi `0.84.3` smoke with the configured `openai-codex` provider passed:
71
76
  - Print/JSON reads remained available and writes returned `confirmation-required` with no append.
72
77
  - A natural explicit persistence request selected `memory_add`; an ordinary suggestion did not call the tool.
73
78
 
74
- No live local provider was configured for this smoke; the local-provider privacy path remains covered by automated policy/tool tests. Exact registry verification remains a post-publication gate. Do not tag or publish before an explicit release decision.
79
+ No live local provider was configured for this smoke; the local-provider privacy path remains covered by automated policy/tool tests. Exact registry verification passed before the annotated tag and GitHub prerelease were created.
75
80
 
76
81
  ## Documentation
77
82
 
78
83
  - [`../CONTEXT_PERSISTENCE_TOOL.md`](../CONTEXT_PERSISTENCE_TOOL.md)
84
+ - [`../DOGFOODING_0.3.0_ALPHA.md`](../DOGFOODING_0.3.0_ALPHA.md)
79
85
  - [`../MEMORY_AND_PINS.md`](../MEMORY_AND_PINS.md)
80
86
  - [`../PRIVACY.md`](../PRIVACY.md)
81
87
  - [`../STORAGE.md`](../STORAGE.md)
@@ -0,0 +1,61 @@
1
+ # DS4 Context Engine 0.3.0-alpha.2
2
+
3
+ Status: release candidate approved for manual publication.
4
+
5
+ This coordinated prerelease hardens the `context_persistence` provider-egress boundary discovered during alpha.1 dogfooding. It adds no new persistence format, migration, default-on feature, or model-callable action.
6
+
7
+ ## Fixed
8
+
9
+ - Reserves `[omitted-by-ds4-egress-policy]` as an output-only historical sanitization sentinel.
10
+ - Rejects any incoming string argument containing that sentinel as `egress-placeholder` before runtime access, local confirmation, canonical append, projection, or derived source-policy mutation.
11
+ - Prevents a model from turning a sanitized cancelled-call argument into a new confirmation for the literal omission marker.
12
+ - Centralizes the sentinel constant across the tool contract, historical egress sanitizer, and historical result renderer.
13
+ - Adds a prompt guideline requiring fresh user-provided text instead of reusing an egress omission marker.
14
+
15
+ ## Compatibility and persistence
16
+
17
+ The tool and result contracts remain `ds4-context-persistence-tool-v1` and `ds4-context-persistence-result-v1`. The fourteen actions and sequential execution contract are unchanged. `egress-placeholder` is an additive validation error code.
18
+
19
+ Canonical Pin and Memory records remain `ds4-context-pin-v1` and `ds4-context-memory-v1`. Pi JSONL remains canonical and append-only; SQLite remains a disposable projection. Schema 15, migrations 1–15, `ds4-context-config-v1`, `runtime-adapter-v1`, and the reference adapter's append-only `ds4-runtime-session-v1` history contract are unchanged.
20
+
21
+ ## Package/version policy
22
+
23
+ The coordinated version is `0.3.0-alpha.2` for:
24
+
25
+ ```text
26
+ ds4-context-core
27
+ ds4-context-reference-adapter
28
+ ds4-context-engine
29
+ ```
30
+
31
+ Both adapters depend exactly on `ds4-context-core@0.3.0-alpha.2`. Publication uses the explicit npm `alpha` dist-tag; `latest` must remain `0.2.0`. GitHub Actions remains validation-only with OIDC and package-write permissions denied.
32
+
33
+ ## Dogfood evidence
34
+
35
+ The operator completed the alpha.1 TUI/RPC/print/JSON dogfood matrix, including canonical append audits, with one identified issue: a sanitized historical marker could be copied into a retry. Alpha.2 addresses that finding. Automated unit and extension-integration tests prove the marker retry is rejected before a second confirmation, runtime mutation, projection, or canonical append. The published alpha.2 artifact should receive the focused regression procedure in [`../DOGFOODING_0.3.0_ALPHA.md`](../DOGFOODING_0.3.0_ALPHA.md) before beta promotion.
36
+
37
+ ## Validation evidence
38
+
39
+ Local candidate verification on Node.js `26.5.1`:
40
+
41
+ - `npm ci`: passed.
42
+ - `npm run check`: 64 files and 286 tests passed.
43
+ - `npm run quality:compare`: candidate quality `0.9875` versus baseline `0.808156`.
44
+ - `npm run schema:context-persistence`: 1,197 bytes and 300 estimated tokens; below the 1,500 absolute and 320 relative limits.
45
+ - `npm run latency:check -- <exact ds4-context-core@0.1.2>`: after one anomalous noisy sample, three consecutive repetitions passed with ratios `1.051605`, `1.059638`, and `1.087275`, all at or below `1.10`.
46
+ - `npm run pack:check`: verified core (203 files), reference adapter (7 files), and Pi adapter (59 files) in a clean consumer.
47
+ - `npm pack --dry-run --json` for all three packages: passed with the same bounded inventories.
48
+ - The committed candidate was replayed from detached clean checkout `30a5f0f`; `npm ci`, the 64-file/286-test suite, schema gate, package verification, and `git diff --check` passed.
49
+ - `git diff --check`: passed.
50
+ - Protected CI, compatibility golden, Pi fixture, and migration files: unchanged.
51
+
52
+ Exact registry verification, annotated tag, and GitHub prerelease creation remain post-publication gates.
53
+
54
+ ## Documentation
55
+
56
+ - [`../CONTEXT_PERSISTENCE_TOOL.md`](../CONTEXT_PERSISTENCE_TOOL.md)
57
+ - [`../DOGFOODING_0.3.0_ALPHA.md`](../DOGFOODING_0.3.0_ALPHA.md)
58
+ - [`../PRIVACY.md`](../PRIVACY.md)
59
+ - [`../MEMORY_AND_PINS.md`](../MEMORY_AND_PINS.md)
60
+ - [`../RELEASING.md`](../RELEASING.md)
61
+ - [`0.3.0-alpha.1.md`](0.3.0-alpha.1.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ds4-context-engine",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.3.0-alpha.2",
4
4
  "description": "Non-destructive, provider-independent context management for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,7 +58,7 @@
58
58
  ]
59
59
  },
60
60
  "dependencies": {
61
- "ds4-context-core": "0.3.0-alpha.1"
61
+ "ds4-context-core": "0.3.0-alpha.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@earendil-works/pi-ai": "0.84.3",
@@ -2,12 +2,14 @@ import { StringEnum, Type, type Static } from "@earendil-works/pi-ai";
2
2
 
3
3
  export const CONTEXT_PERSISTENCE_TOOL_CONTRACT = "ds4-context-persistence-tool-v1" as const;
4
4
  export const CONTEXT_PERSISTENCE_RESULT_CONTRACT = "ds4-context-persistence-result-v1" as const;
5
+ export const CONTEXT_PERSISTENCE_EGRESS_SENTINEL = "[omitted-by-ds4-egress-policy]" as const;
5
6
  export const CONTEXT_PERSISTENCE_TOOL_NAME = "context_persistence" as const;
6
7
  export const CONTEXT_PERSISTENCE_DESCRIPTION = "Inspect DS4 Pins/Memory. Write only after an explicit user request; writes require local user confirmation." as const;
7
8
  export const CONTEXT_PERSISTENCE_PROMPT_SNIPPET = "Inspect or manage user-confirmed DS4 pins and durable memory" as const;
8
9
  export const CONTEXT_PERSISTENCE_PROMPT_GUIDELINES = [
9
10
  "Use context_persistence only to inspect DS4 persistent state or when the user explicitly requests a persistence mutation.",
10
11
  "After an explicit persistence request, call the write action directly; context_persistence itself obtains the required local UI confirmation, so do not ask for separate confirmation in chat.",
12
+ "Never reuse an egress omission marker as tool input; use fresh user-provided text or ask the user to restate it.",
11
13
  "Never create a pin or memory merely because information appears useful.",
12
14
  "Use pins for confirmed constraints or instructions that must remain prominent. Use memory for durable facts, decisions, and historical knowledge.",
13
15
  "Default new persistence to session scope. Use project or branch scope only when explicitly requested or unambiguous; durable Memory does not support branch scope.",
@@ -112,7 +114,8 @@ const REQUIRED_FIELDS = {
112
114
 
113
115
  export type ContextPersistenceValidationCode =
114
116
  | "invalid-parameters"
115
- | "invalid-scope";
117
+ | "invalid-scope"
118
+ | "egress-placeholder";
116
119
 
117
120
  export type ContextPersistenceValidation =
118
121
  | { ok: true; value: ContextPersistenceParams }
@@ -143,6 +146,12 @@ export function validateContextPersistenceParams(
143
146
  if (REQUIRED_FIELDS[params.action].some((key) => params[key] === undefined)) {
144
147
  return { ok: false, errorCode: "invalid-parameters" };
145
148
  }
149
+ if (keys.some((key) => {
150
+ const value = params[key];
151
+ return typeof value === "string" && value.includes(CONTEXT_PERSISTENCE_EGRESS_SENTINEL);
152
+ })) {
153
+ return { ok: false, errorCode: "egress-placeholder" };
154
+ }
146
155
  if (params.scope === "branch" && params.action === "memory_add") {
147
156
  return { ok: false, errorCode: "invalid-scope" };
148
157
  }
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CONTEXT_PERSISTENCE_ACTIONS,
3
+ CONTEXT_PERSISTENCE_EGRESS_SENTINEL,
3
4
  CONTEXT_PERSISTENCE_TOOL_NAME,
4
5
  } from "./context-persistence-contract.ts";
5
6
  import {
@@ -7,7 +8,7 @@ import {
7
8
  sanitizeHistoricalContextPersistenceDetails,
8
9
  } from "./context-persistence-result.ts";
9
10
 
10
- export const CONTEXT_PERSISTENCE_EGRESS_SENTINEL = "[omitted-by-ds4-egress-policy]" as const;
11
+ export { CONTEXT_PERSISTENCE_EGRESS_SENTINEL } from "./context-persistence-contract.ts";
11
12
 
12
13
  const ACTIONS = new Set<string>(CONTEXT_PERSISTENCE_ACTIONS);
13
14
  const SAFE_ARGUMENT_KEYS = new Set([
@@ -2,6 +2,7 @@ import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
2
2
  import type { PrivacyClassification } from "ds4-context-core/privacy/privacy-policy";
3
3
  import {
4
4
  CONTEXT_PERSISTENCE_ACTIONS,
5
+ CONTEXT_PERSISTENCE_EGRESS_SENTINEL,
5
6
  CONTEXT_PERSISTENCE_RESULT_CONTRACT,
6
7
  type ContextPersistenceAction,
7
8
  type ContextPersistenceReadAction,
@@ -434,7 +435,7 @@ export function sanitizeHistoricalContextPersistenceDetails(
434
435
 
435
436
  /** Historical provider replay never includes previews, even when the original result did. */
436
437
  export function renderHistoricalContextPersistenceResult(details: ContextPersistenceDetails | undefined): string {
437
- if (!details) return "[omitted-by-ds4-egress-policy]";
438
+ if (!details) return CONTEXT_PERSISTENCE_EGRESS_SENTINEL;
438
439
  if (details.items && typeof details.count === "number") {
439
440
  return renderReadContent({
440
441
  action: details.action as ContextPersistenceReadAction,
@@ -1,4 +1,4 @@
1
- export const EXTENSION_VERSION = "0.3.0-alpha.1";
1
+ export const EXTENSION_VERSION = "0.3.0-alpha.2";
2
2
  export const SUPPORTED_PI_VERSION = "0.84.3";
3
3
  export const OBSERVER_PLANNER_VERSION = "observer-model-aware-v1";
4
4
  export const PLANNER_VERSION = "managed-learned-ranking-v1";