context-capsules-runtime
v0.6.0
Published
Local immutable context capsules with native Git persistence
Readme
Context Capsules Runtime
A local CLI for preserving task context, code checkpoints and execution notes alongside isolated Git worktrees.
Prepare an immutable packet of selected input, assign it to a run, and record checkpoints that another session can reconstruct. Pivot when requirements change, hand off a checkpoint into a fresh worktree, and archive finished runs while retaining their history. Source commits and context history stay separate.
Start with the user guide for capsules vs. runs vs. checkpoints, the public API, and a runnable example that carries real results through preparation, acknowledgment, checkpoints, a pivot and handoff.
New runs use .context/execution/ for editable operational artifacts. Existing .context-capsule runs keep their recorded paths and history; obtain the actual root from the binding. Stage prerequisite drafts outside the source/context worktrees and establish the assignment before writing canonical execution artifacts. An unmanaged folder at either supported root is refused and preserved.
Use Node 22 and native Git. Run npm ci, then npm pack; packing performs a clean build automatically. Install the resulting tarball with --ignore-scripts; no compilation is needed after installation. npm test exercises the actual installed package in disposable repositories. See releasing for exact-artifact validation and provenance.
This repository builds two independently released packages. Build the viewer with npm run viewer:build; pack it with npm pack --workspace=context-capsules-viewer. Install both exact tarballs into the same npm prefix for source mode. Export reusable JSON with capsule export-history --source /path/to/project --output /tmp/history.json, then render without Git or the runtime using capsule-view --input /tmp/history.json. See the public export contract.
Discover usage from any directory with capsule --help (or -h). Use
capsule prepare --help, capsule checkpoint --help, or any other command's
help for required fields, editable JSON examples, result identities and recovery
rules. Help is plain text and takes no additional flags; normal commands keep
JSON output. No repository is needed to read help.
The Context Capsules skill guides agents through
reading, acknowledgment, checkpoints, pivots, handoff, archive and recovery using
the installed CLI help. It ships in the repository as a separate native skill package. Copy the
skills/context-capsules directory into your agent's skills directory; for Codex,
use ${CODEX_HOME:-$HOME/.codex}/skills/context-capsules. Preserve any existing
customized copy. Invoke it with $context-capsules, for example: “Resume the
Context Capsules assignment at /absolute/project/.worktrees/task-one.” The CLI
must be installed separately and available on PATH or supplied by absolute path.
Retention and required reading are separate. Keep a recipient-specific reading
map in execution/plan.md, with required paths/selections, pinned source identities
and explicit expansion triggers for retained history. The index identifies one
canonical plan and whether the retained material is a pinned copy, verified
selection or subordinate execution notes. Every role uses assignment-specific
source inspection and expands unresolved dependencies; generic full-read rules
do not apply. Manifest-required input disclosure remains unchanged. See the skill's “Plan authority and recipient reading”
section for authoring and fallback rules, and the
bounded interface addendum when changing
this contract. The runtime preserves bytes; agents validate selection coverage.
Use capsule-view --source /path/to/project to export an interactive offline history.
The graph connects implementation commits, inputs, run states and checkpoints,
with full trees and parent diffs. See the viewer guide.
- Command reference and request examples
- S1 task contract
- S2 task contract
- S3 review boundaries
- S3-1 acknowledgment contract
- S3 execution plan
Each run binds a source worktree to an independent context branch and checkout. The start response supplies explicit reading instructions. Acknowledgment records a session receipt while preserving dirty source and unpublished execution edits. Checkpoints retain the clean source commit and exact working execution bytes with their capsule and session receipt. Pivots replace input deliberately. Handoff reconstructs pinned code, input, plan and explicitly selected inherited evidence in a new run that requires its own acknowledgment. Archive closes recorded runs while retaining both worktrees and their history. S4-3.3 supplies complete lifecycle, compatibility and fresh native-session evidence for review; agent launch orchestration and remote integration remain deferred. Passing tests establish implementation evidence for review, not acceptance of the implementation.
- Interface design packet
- Native Git probe evidence
- MVP scope
- Execution estimate
- Scope review
- Original design brief
- Historical estimate evidence
A complete workflow is: prepare → start → read/status → acknowledge → checkpoint → prepare revised input → pivot → reread/acknowledge → checkpoint → handoff → archive the recorded origin. An archived checkpoint can also seed a new active run. Each successor needs its own receipt. New handoffs default to plan only; declare additional executionPaths for current decisions or proof. Historical payloads remain retained and capsule retrieve --help explains verified one-file retrieval. If an operation is incomplete, pause dependent writes and recover only after all writers and child Git commands have stopped.
Fresh start/handoff responses describe recipient reading, plan authority, archive and recovery. Historical responses keep their original wording so retries remain exact; the current skill supersedes their blanket inherited-file reading rule. Archival retains worktrees and history; it does not clean up or release the assignment.
The existing jasonbelmonti/context-capsules repository remains the historical design project. This repository contains the runtime implementation and its design documentation.
Use worktrees under .worktrees for changes. Verify durable planning artifacts with shasum -a 256 -c docs/checksums.sha256 from the repository root. Historical files have their own retained checksums and must be interpreted at their recorded revisions.
Runtime 0.6.0 owns capsule; independently versioned context-capsules-viewer 0.1.1 owns capsule-view. Migrating from the combined 0.4.1 package requires installing both packages. Later visualization updates can replace only the viewer. Native skill and Fleet pins change only through a separate adoption; see release and native staging commands.
