# DS4 Context Engine 0.5.2

## Changes

- Fix rebase tool validation to use the exact compaction-aware Pi context serialized into the checkpoint. Reuse that captured context for validation, privacy classification and handoff construction.
- Preserve incomplete tool exchanges already excluded by Pi compaction in the unchanged canonical archive without transferring them into the handoff or blocking rebase.
- Keep active incomplete calls/results blocked before journal or target creation, including results whose matching call exists only in archived history.
- Add content-free `toolExchangeDiagnostics` with `activeIssueCount` and `historicalIssueCount`. No tool IDs, arguments, results or message bodies are returned by these diagnostics.
- Add six synthetic regressions covering archived calls/results, active calls/results, compaction-crossing result binding and repeated IDs. Archived cases verify successful activation, unchanged source bytes and absence of archived tool payloads from the checkpoint.
- Clarify ADR 074 and the history/rebase contract. Correct the guide's stale enabled-default description; runtime defaults are unchanged.

## Scope and limitations

The shared atomic validator and archive/header/hash/ancestry/lineage/memory checks remain unchanged. There is no source rewrite, tool-result fabrication, validation bypass, schema migration, budget increase or extra provider request. Rebase remains unavailable if the transferred active context really contains incomplete tool exchanges. This patch does not repair source history damaged by another extension or change FTS rebuild costs.

Windows-host execution and live BPE/auto-tuning verification are not established by these synthetic checks.

## Validation

Before the fix, the new regression file reproduced four failures, including archived exchanges incorrectly blocking rebase and an active orphan result incorrectly accepted when its call existed only in archived history. After the fix, acquired `node-typecheck`, `node-test` and `git-diff-check` passed on the source change.

On final coordinated 0.5.2 source after the required policy reload:

- `npm ci` completed on supported Node 22.23.1.
- `jev_verify all` passed `node-typecheck`, `node-test` and `git-diff-check` after installation.
- `npm run pack:check` passed in a clean consumer: core 275 files, reference adapter 7 files, Pi extension 137 files.
- `npm run quality:compare` completed successfully.
- `npm run schema:context-persistence` passed: 1,266 bytes / 317 estimated tokens.
- `npm audit --omit=dev` reported zero production vulnerabilities. The dev-inclusive installation audit reported five vulnerabilities: three moderate and two high.

Package/consumer checks used Node 22.23.1. Windows and the additional Node CI matrix were not executed locally. Publication-record edits are documentation-only; source results are reused only while code, tests, dependencies and configuration remain unchanged.

## Publication and registry verification

Published manually to npm on 2026-10-05 by `alucard_24`, in dependency order:

1. `ds4-context-core@0.5.2`
2. `ds4-context-reference-adapter@0.5.2`
3. `ds4-context-engine@0.5.2`

All publication commands succeeded. Initial fresh-cache registry checks returned `ETARGET` for core while metadata was not yet consistent across the three packages. A subsequent fresh-cache `npm run registry:check -- 0.5.2` verified all three exact artifacts on Node 22.23.1. `npm dist-tag ls` confirmed `latest: 0.5.2` for every package.

The annotated `v0.5.2` tag was created at release-preparation commit `e1b3a43` and pushed after registry verification. [GitHub Release v0.5.2](https://github.com/Alucard24/ds4-context-engine/releases/tag/v0.5.2) was created from that verified tag. CI remains validation-only with no publishing credentials.
