# DS4 Context Engine 0.3.4

Status: published as stable on npm under `latest`; annotated tag `v0.3.4` points to validated release commit `5845a64`.

## Added since 0.3.3

Five independent opt-ins, all default-off and gated by the master `enabled` switch:

- **`editing.anchored`**: exact, inclusive `head[upto]tail` replacements, expanded under Pi's native mutation queue. Literal escaping, mixed-batch exactness, native cancellation/line endings and real result diffs are preserved. No generation-time marker forcing.
- **`editing.postEditReport`**: bounded changed-line ranges, line delta and numbered updated context derived from the actual native patch, without rereading the file. Works independently of anchored editing.
- **`reading.adaptive`**: execution-time model-aware default read windows of 120/240/500 lines. Explicit limits, images and native byte caps remain native.
- **`artifacts.adaptiveBudget`**: per-context estimated caps can only lower configured inline/excerpt limits. Privacy-prepared provider context, source provenance, non-expanding replacements and conservative artifact rebuild are covered.
- **`jobs.enabled`**: separate local `bash_job` start/status/stop/list tool with trusted-project and local UI confirmation for every start, session/branch ownership, bounded output/concurrency/timeouts and lifecycle cleanup. Jobs survive compaction with a metadata-only reminder, not session replacement/reload/shutdown.

See [anchored editing](../ANCHORED_EDITING.md), [portable agent tools](../PORTABLE_AGENT_TOOLS.md), [ADR 059](../ADR/059-optional-anchored-editing.md) and [ADR 060](../ADR/060-optional-portable-agent-tools.md).

## Safety and compatibility

Pi JSONL remains canonical and append-only; SQLite remains disposable/rebuildable with schema `15`. No live database intervention, provider/backend integration or Pi upgrade is part of this release.

Unchanged contracts: `ds4-context-config-v1`, `runtime-adapter-v1`, `ds4-context-persistence-tool-v1`, `ds4-context-persistence-result-v1`. Pi remains pinned to `0.84.3`; Node.js requirement remains `>=22.19.0`.

Local tool wrappers must not be combined with remote/sandbox replacements. `bash_job` does not inherit bash-only permission hooks or SDK shell settings; its confirmation explicitly identifies this boundary. Stop does not roll back shell side effects or guarantee ownership of escaped daemons. Linux execution tests do not establish Windows correctness. Adaptive budgets are estimates; real-provider token savings, latency and reliability have not been measured. No operational KV reuse, rewind, forced sampling or marker insertion is added.

## Update and enable

Install the exact package and fully restart Pi to load the matching compiled core:

```bash
pi install npm:ds4-context-engine@0.3.4
```

In a trusted project, enable only the features you want:

```text
/context config set editing.anchored true
/context config set editing.postEditReport true
/context config set reading.adaptive true
/context config set artifacts.adaptiveBudget true
/context config set jobs.enabled true
/reload
/context config show
```

Add `--global` to each `set` to target the agent-directory configuration instead of the project file. Trusted project settings take precedence. Configuration writes do not change the active session until reload/startup. Use `false` to disable. The DS4 master `enabled` switch must also be true.

## Package policy and validation

All three packages use `0.3.4`: `ds4-context-core`, `ds4-context-reference-adapter`, `ds4-context-engine`. Both adapters depend exactly on `ds4-context-core@0.3.4`. Publication is manual in that order using npm's stable `latest` tag. GitHub Actions remains validation-only, with OIDC and package-write permissions denied.

Candidate validation on Node.js `26.5.1`, from a sanitized release source with a fresh `npm ci`:

- `npm run check`: **78 files / 485 tests passed**, including native edit queue/matching regressions, independent opt-ins and real local bash execution/stop/timeout.
- `npm run quality:compare`: passed; frozen-corpus candidate score `0.9875` versus baseline `0.808156`.
- `npm run schema:context-persistence`: passed, `1266` bytes / `317` estimated tokens (limits `1500` / `320`).
- `npm run latency:check` against exact `ds4-context-core@0.1.2`: passed; disabled-planning p95 ratio `0.885863`, maximum `1.1`. This is not a provider latency/savings measurement.
- `npm run pack:check`: clean-consumer core **231 files**, reference adapter **7**, engine **84**, with eight real offline Pi registry scenarios.
- All three `npm pack --dry-run --json` inventories and `git diff --check` passed.
- Versions, exact core dependencies, lockfile and runtime version constants are synchronized. No dependency upgrade was performed.

Pre-existing local `allowScripts` additions and `.serena/` are excluded from release commits and public packages.

The initial CI run `33965143704` on candidate `4e665e3` passed Node `22.19.0`. Node `24.x` exceeded the default 5-second timeout in the existing disk-backed schema-v10 upgrade fixture (484 tests passed, one timeout). That individual correctness test now has a bounded 15-second timeout, with all assertions unchanged; no runtime/storage behavior changed.

Final validation-only CI run [`33965385188`](https://github.com/Alucard24/ds4-context-engine/actions/runs/33965385188) on `5845a64` passed both Node `22.19.0` and `24.x`, including the full test suite and clean-consumer package checks.

## Registry verification and release

Published manually as `alucard_24`, in dependency order, from reviewed tarballs built in a clean committed worktree:

- `ds4-context-core@0.3.4`: shasum `c1f1f6c5eec392e43f8b6a0917581e5d02141c84`;
- `ds4-context-reference-adapter@0.3.4`: shasum `61402dc240af5963f4cbbf5f69752fe9a451170d`;
- `ds4-context-engine@0.3.4`: shasum `99b9ba52c2bc628f5fb197ea5356459963994b89`.

`npm run registry:check -- 0.3.4` passed: fresh exact-version installation, matching adapter/core dependencies, public core exports, compiled reference conformance, packaged quality corpus, storage CLI usage probe and isolated offline Pi extension startup. Registry SHA-1 and integrity values match the local tarballs for all three packages.

Verified dist-tags for all three: `latest=0.3.4`, `beta=0.3.0-beta.3`, `alpha=0.3.0-alpha.5`, `rc=0.2.0-rc.1`.

Annotated tag `v0.3.4` targets `5845a64`, the tested/published source. This post-publication evidence update is documentation-only.

GitHub Release: https://github.com/Alucard24/ds4-context-engine/releases/tag/v0.3.4
