continuity-kernel
npx machina-cli add skill cacheforge-ai/cacheforge-skills/continuity-kernel --openclawWhen to use this skill
Use this skill when the user wants to:
- Inject bounded continuity context into
llm_inputwithout manual configuration - Persist Soul Card + Mission Ticket state with deterministic runtime contracts (durable default SQLite path, zero-config)
- Keep agent behavior fail-open if continuity logic or storage has an error
- Generate reproducible runtime proof receipts for audits and reviews
- Run shadow-mode evals and append chunk-level quality snapshots
Commands
# Run full test suite
python3 -m unittest discover -s tests/continuity-kernel -p 'test_*.py'
# Generate deterministic runtime contract proof artifact
python3 skills/continuity-kernel/generate_runtime_contract_proof.py
# SC-02 core-shadow gate (trace optional, synthetic allowed for this suite)
python3 skills/continuity-kernel/run_shadow_eval.py --layer 'Soul Card' --chunk 'SC-02' --suite core-shadow --runs 100 --append artifacts/continuity-kernel/p0-evals.json
# SC-02 perturb robustness gate (trace-backed, deterministic selector + size_only)
python3 skills/continuity-kernel/run_shadow_eval.py --layer 'Soul Card' --chunk 'SC-02' --suite memoryarena-mini-perturb --perturb-profile deletion --selector-mode deterministic --compaction-policy size_only --runs 100 --trace-jsonl tests/continuity-kernel/fixtures/shadow_eval_trace_memoryarena_mini_perturb.jsonl --append artifacts/continuity-kernel/p0-evals.json
# SC-02 perturb robustness gate (trace-backed, dual-route + attention-preserving)
python3 skills/continuity-kernel/run_shadow_eval.py --layer 'Soul Card' --chunk 'SC-02' --suite memoryarena-mini-perturb --perturb-profile deletion --selector-mode dual_route_experimental --compaction-policy attention_preserving_experimental --runs 100 --trace-jsonl tests/continuity-kernel/fixtures/shadow_eval_trace_memoryarena_mini_perturb.jsonl --append artifacts/continuity-kernel/p0-evals.json
Options
run_shadow_eval.py options:
--layer TEXT— Active P0 layer name--chunk TEXT— Active chunk id/name--suite core-shadow|memoryarena-mini|memoryarena-mini-perturb— Task suite for eval scoring--perturb-profile none|deletion|noise_injection|reorder— Deterministic perturb profile formemoryarena-mini-perturb--selector-mode deterministic|dual_route_experimental— Selector mode tag for A/B eval receipts--compaction-policy size_only|attention_preserving_experimental— Compaction policy label for dropped-field A/B eval comparison--runs N— Number of evaluated shadow runs (default: 100)--trace-jsonl PATH— JSONL file containing observed shadow outcomes (repeatable)--trace-dir PATH— Directory scanned for*.jsonlobserved shadow outcomes (repeatable)--append PATH— JSON file path to append snapshot results--allow-synthetic— Permit synthetic fallback for non-core suites when traces are unavailable (forcedpass=false)--artifacts-root PATH— Directory for summary receipts (default:~/.cache/continuity-kernel/p0-evals)
Runtime persistence defaults:
ContinuityHookAdapter()uses~/.local/state/continuity-kernel/continuity.db- Override default path with
CONTINUITY_KERNEL_DB_PATH - Use
:memory:only as explicit opt-in test mode
Source
git clone https://github.com/cacheforge-ai/cacheforge-skills/blob/main/skills/continuity-kernel/SKILL.mdView on GitHub Overview
This skill injects bounded continuity context into llm_input and persists Soul Card + Mission Ticket state using deterministic runtime contracts (default SQLite). It ensures fail-open behavior on continuity or storage errors and can generate reproducible receipts for audits, plus support shadow-mode evals with chunk-level snapshots.
How This Skill Works
Technically, a ContinuityHookAdapter injects bounded continuity context into llm_input and persists Soul Card + Mission Ticket state using deterministic runtime contracts stored in SQLite. The default path is ~/.local/state/continuity-kernel/continuity.db, overrideable via CONTINUITY_KERNEL_DB_PATH, with :memory: allowed only for explicit test mode. Shadow-mode evals generate appendable runtime receipts and chunk-level quality snapshots for audits.
When to Use It
- Inject bounded continuity context into llm_input without manual configuration
- Persist Soul Card + Mission Ticket state with deterministic runtime contracts (durable default SQLite path, zero-config)
- Keep agent behavior fail-open if continuity logic or storage has an error
- Generate reproducible runtime proof receipts for audits and reviews
- Run shadow-mode evals and append chunk-level quality snapshots
Quick Start
- Step 1: Run full test suite: python3 -m unittest discover -s tests/continuity-kernel -p 'test_*.py'
- Step 2: Generate deterministic runtime contract proof: python3 skills/continuity-kernel/generate_runtime_contract_proof.py
- Step 3: Run a shadow eval: python3 skills/continuity-kernel/run_shadow_eval.py --layer 'Soul Card' --chunk 'SC-02' --suite core-shadow --runs 100 --append artifacts/continuity-kernel/p0-evals.json
Best Practices
- Limit injected continuity context to avoid bloated prompts and latency
- Rely on the default SQLite persistence or set CONTINUITY_KERNEL_DB_PATH for durable storage
- Ensure continuity logic errors are non-fatal to preserve fail-open behavior
- Run shadow-mode evaluations with run_shadow_eval to generate chunk-level receipts
- Supply trace data or enable synthetic traces only when traces are unavailable (--allow-synthetic)
Example Use Cases
- Inject bounded continuity context into an ongoing chat to maintain consistent Soul Card behavior across turns
- Persist Soul Card + Mission Ticket state across restarts using the default SQLite-backed path
- Generate reproducible runtime proof receipts for an internal audit
- Run SC-02 core-shadow eval with 100 runs and append to artifacts/p0-evals.json
- Override the DB path with CONTINUITY_KERNEL_DB_PATH to isolate environments or test modes