distill-session

distill-session is a command for coding agents from axiomantic/spellbook. It costs 17 tokens per session (5,765 once invoked), scanned A, original, MIT.

A command that condenses an oversized coding-agent session into a restartable prompt containing the working context, workflow, and unfinished tasks.

In plain words
What is it for?
Use it to extract session state, locate planning documents, preserve absolute file paths and executable steps, and create a boot prompt for continuing the work.
Why use it?
It helps another agent resume after context is lost by recording concrete files, instructions, and pending work instead of relying on conversation history.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/axiomantic/spellbook/distill-session
Clone the repo
git clone --depth 1 https://github.com/axiomantic/spellbook

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for distill-session

README.md
[![agentmods](https://agentmods.dev/badge/commands/axiomantic/spellbook/distill-session.svg)](https://agentmods.dev/commands/axiomantic/spellbook/distill-session)
Your own site
<a href="https://agentmods.dev/commands/axiomantic/spellbook/distill-session"><img src="https://agentmods.dev/badge/commands/axiomantic/spellbook/distill-session.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,765 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.05765
Opus 5 $0.00009 $0.02882
Sonnet 5 $0.00003 $0.01153
Haiku 4.5 $0.00002 $0.00577

Measured 5d ago against content hash 2979c0d07107, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

distill-session scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/distill-session.md · 665 lines

How it starts

The opening of the file, as written. The whole thing — 665 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Distill Session

Invariant Principles

  1. Section 0 executes before context - Resuming agent invokes skills/reads docs/restores todos FIRST
  2. Verify, never trust - File state claims from conversation are stale; filesystem is truth
  3. Explicit over blank - "NO PLANNING DOCUMENTS" with search evidence beats empty section
  4. Absolute paths only - All paths start with /; relative paths break on resume
  5. Executable over descriptive - Skill("name", "--args") not "continue the workflow"

You feel genuine anxiety about context loss. Every missing planning document path, every vague "continue the work" instruction, every blank section is a failure that will cause the resuming agent to flounder. The resuming agent has ZERO prior context — your output is their ONLY lifeline.

Perform forensic extraction: process the session in chunks, capture EVERY piece of actionable context, and produce a boot prompt so complete that a fresh instance resumes mid-stride.

What success looks like:

  • Fresh instance executes Section 0 FIRST, invoking the active skill
  • Planning documents read BEFORE any implementation
  • Subagents spawned per the established pattern
  • Every pending task has a verification command

When to Use

Symptoms:

  • Session too large to compact (context window exceeded)
  • /compact fails with "Prompt is too long"
  • Need to preserve knowledge but must start fresh
  • Session file > 2MB with no recent compact boundary

Read the full file on GitHub · 665 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 665 lines · 17 tokens per session scan A 2979c0d07107

Subscribe to this mod's changes

distill-session is a command published in the GitHub repository axiomantic/spellbook (10 stars, last pushed yesterday), licensed MIT. It adds 17 tokens to every session and 5,765 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.