Agent Context Crystallizer
Use the agent-crystallize CLI as the source of truth. This skill is a thin
workflow wrapper; do not reimplement the artifact format by hand unless the CLI
is unavailable.
Resolve The CLI Before Writing
Do not assume the agent harness inherited the user's interactive-shell PATH.
Resolve one working invocation in this order:
- Use a repo-provided
agent-crystallize package script when present.
- Use
agent-crystallize when command -v agent-crystallize succeeds.
- If
AGENT_CRYSTALLIZE_CLI names a readable JavaScript entry point, invoke it
with the current Node runtime: node "$AGENT_CRYSTALLIZE_CLI" ....
- Use a verified package-manager or harness-provided bundled runtime path.
Never guess a machine-specific path or copy one from another user.
- Only when no CLI is available, write a plainly labelled non-validated
emergency handoff outside the canonical
.agent-crystals/checkpoints/ and
.agent-crystals/sessions/ directories. Replace it with a CLI-generated,
validated artifact when the runtime is restored.
The emergency handoff preserves continuity; it is not a valid crystal and must
not silently enter the manifest or normal validation set.
Workflow
- Inspect the local state that matters:
AGENTS.md/CLAUDE.md if present,
git status --short, relevant changed files, recent test/build/deploy
results, and existing .agent-crystals/manifest.json when present.
- Choose the lightest useful artifact:
- checkpoint: during active work, before risky edits, before compaction, or
after a high-signal decision/finding/failure;
- session crystal: before handoff/session end, or to roll up recent
checkpoints.
- Prefer structured flags over vague prose:
--decision, --finding,
--open-loop, --test, --next-action, --evidence,
--memory-candidate, --topic, and --relation type:target.
- Add safe provenance when available:
--agent-body, --harness,
--session-id, --transcript-uri, and --source-ref. Never dump broad
environment variables or secrets.
- Use
--continuity-tail only for short recent turns where order/nuance
matters after compaction. It is raw continuity evidence, not durable truth.
- Validate important artifacts before relying on them.
Commands
Fast checkpoint:
agent-crystallize checkpoint \
--body "<current state, decision, open loop, next action>" \
--decision "<decision and authority>" \
--finding "<runtime finding>" \
--open-loop "<unfinished item>" \
--next-action "<next concrete action>"
Session crystal from recent checkpoints:
agent-crystallize now \
--from-checkpoints latest \
--body "<synthesis since the latest checkpoint and handoff state>"
Validate:
agent-crystallize validate --fail-on-warnings
Hook/continuity check:
agent-crystallize doctor --codex --claude --hooks
Guardrails
- Preserve work context, not hidden chain-of-thought.
- Raw evidence is not truth; decisions/findings should keep provenance.
- Keep generated
.agent-crystals/ local/private unless intentionally
reviewed and sanitized.
- Prefer paths, ids, commits, and source refs over copying large logs or
transcripts.
- If hooks are configured but continuity feels broken, ask the user to verify
the host
/hooks view. Codex may skip new or changed hooks until trusted.
- Never treat a hand-written emergency handoff as schema-valid merely because
it is readable Markdown.
1---2name: agent-context-crystallizer3description: Preserve high-signal work context with local checkpoints and session crystals using the agent-crystallize CLI. Use before compaction, handoff, session end, cross-agent transfer, after major decisions/findings/failures, or when the user asks to checkpoint, crystallize, preserve context, save open loops, or create a resume handoff.4---56# Agent Context Crystallizer78Use the `agent-crystallize` CLI as the source of truth. This skill is a thin9workflow wrapper; do not reimplement the artifact format by hand unless the CLI10is unavailable.1112## Resolve The CLI Before Writing1314Do not assume the agent harness inherited the user's interactive-shell `PATH`.15Resolve one working invocation in this order:16171. Use a repo-provided `agent-crystallize` package script when present.182. Use `agent-crystallize` when `command -v agent-crystallize` succeeds.193. If `AGENT_CRYSTALLIZE_CLI` names a readable JavaScript entry point, invoke it20 with the current Node runtime: `node "$AGENT_CRYSTALLIZE_CLI" ...`.214. Use a verified package-manager or harness-provided bundled runtime path.22 Never guess a machine-specific path or copy one from another user.235. Only when no CLI is available, write a plainly labelled **non-validated24 emergency handoff** outside the canonical `.agent-crystals/checkpoints/` and25 `.agent-crystals/sessions/` directories. Replace it with a CLI-generated,26 validated artifact when the runtime is restored.2728The emergency handoff preserves continuity; it is not a valid crystal and must29not silently enter the manifest or normal validation set.3031## Workflow32331. Inspect the local state that matters: `AGENTS.md`/`CLAUDE.md` if present,34 `git status --short`, relevant changed files, recent test/build/deploy35 results, and existing `.agent-crystals/manifest.json` when present.362. Choose the lightest useful artifact:37 - checkpoint: during active work, before risky edits, before compaction, or38 after a high-signal decision/finding/failure;39 - session crystal: before handoff/session end, or to roll up recent40 checkpoints.413. Prefer structured flags over vague prose: `--decision`, `--finding`,42 `--open-loop`, `--test`, `--next-action`, `--evidence`,43 `--memory-candidate`, `--topic`, and `--relation type:target`.444. Add safe provenance when available: `--agent-body`, `--harness`,45 `--session-id`, `--transcript-uri`, and `--source-ref`. Never dump broad46 environment variables or secrets.475. Use `--continuity-tail` only for short recent turns where order/nuance48 matters after compaction. It is raw continuity evidence, not durable truth.496. Validate important artifacts before relying on them.5051## Commands5253Fast checkpoint:5455```bash56agent-crystallize checkpoint \57 --body "<current state, decision, open loop, next action>" \58 --decision "<decision and authority>" \59 --finding "<runtime finding>" \60 --open-loop "<unfinished item>" \61 --next-action "<next concrete action>"62```6364Session crystal from recent checkpoints:6566```bash67agent-crystallize now \68 --from-checkpoints latest \69 --body "<synthesis since the latest checkpoint and handoff state>"70```7172Validate:7374```bash75agent-crystallize validate --fail-on-warnings76```7778Hook/continuity check:7980```bash81agent-crystallize doctor --codex --claude --hooks82```8384## Guardrails8586- Preserve work context, not hidden chain-of-thought.87- Raw evidence is not truth; decisions/findings should keep provenance.88- Keep generated `.agent-crystals/` local/private unless intentionally89 reviewed and sanitized.90- Prefer paths, ids, commits, and source refs over copying large logs or91 transcripts.92- If hooks are configured but continuity feels broken, ask the user to verify93 the host `/hooks` view. Codex may skip new or changed hooks until trusted.94- Never treat a hand-written emergency handoff as schema-valid merely because95 it is readable Markdown.