jackin❯ Context Engine
Embed a native token-optimization context engine in jackin — write-time observation compression, bounded retrieval, output/prompt policy, fleet routing economics, and honest measurement — synthesizing the validated mechanisms from caveman, headroom, RTK, lean-ctx, sem, fff, codedb, and mq without their delivery tax.
Status: Partially implemented — design spec and evidence base drafted; crates/jackin-context implementation remains open.
Objective
Make every jackin❯ capsule token-optimized out of the box by embedding one Rust engine (crates/jackin-context) that owns six layers: measurement (ledger, cache-bust detection, thinking estimation, validation harness), observation compression at the tool boundary (shims + deterministic filters + reversible archive), bounded retrieval (embedded fff/sem/mq + codedb-shaped query verbs), output/prompt policy (register pack, guard lines, subagent report contracts), routing and fleet economics (effort tiers, model pins, advisor, spawn choreography, batch lane, quota metering), and a single reversible memory/state layer.
Why jackin, not a stack of third-party tools
The research corpus concluded every external tool pays most of its complexity for not owning the runtime (installers, self-healing hooks, permission mediation, proxy plumbing) and none can prove its savings honestly (GPT tokenizers, per-payload marketing numbers, no net-of-injection accounting). jackin❯ composes capsule config at launch, supervises every tool boundary, and already parses per-session usage — so it can ship the mechanisms without the delivery tax and measure them properly.
Canonical documents
- Design spec (source of truth): jackin❯ Context Engine — architecture, cache-safety invariants, per-layer specs, reuse decision matrix, rollout phases.
- Evidence base: token-optimization dossier (incl. 25 — sem and mq) and token-optimization tools hub (incl. 13 — reuse surfaces and deltas). Refreshed 2026-07-05: 17 — pxpipe, 18 — latest-versions refresh, and 28 — drift delta.
- Related pilot: Code-intelligence tooling for the-architect role — the third-party stack the engine is designed to subsume, which becomes its external comparison arms.
Remaining work
Phases P0–P6 per the spec's rollout page: measurement-only foundation first (ledger, attribution, CI token-budget gate), then the negative-cost config set, then shims/filters, retrieval, output pack, routing, memory — each gated by the harness acceptance bar (≥20% tokens-per-solved-task at quality parity, net of the engine's own overhead). Requires one versioned jackin.role.toml schema bump for the [context] table.