capsule-compact

capsule-compact is a skill for Claude Code from wrg32786/aigent-os. It costs 42 tokens per session (464 once invoked), scanned A, original, MIT.

A manual tool for shortening a long chain of stored session capsules by combining its oldest entries into a summary capsule. Capsules are saved records of session context and decisions.

In plain words
What is it for?
Use it to compact long capsule chains, preserve active threads and decisions, and make later session reopening faster.
Why use it?
It reduces the amount of older context that must be followed while keeping the original records for reference.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: agent in frontmatter.

Good fit Use it to compact long capsule chains, preserve active threads and decisions, and make later session reopening faster.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wrg32786/aigent-os/capsule-compact
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.

Any agent
npx skills add wrg32786/aigent-os --skill capsule-compact
Clone the repo
git clone --depth 1 https://github.com/wrg32786/aigent-os

Made for: Claude Code.

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 capsule-compact

README.md
[![agentmods](https://agentmods.dev/badge/skills/wrg32786/aigent-os/capsule-compact/github.svg)](https://agentmods.dev/skills/wrg32786/aigent-os/capsule-compact)
Your own site
<a href="https://agentmods.dev/skills/wrg32786/aigent-os/capsule-compact"><img src="https://agentmods.dev/badge/skills/wrg32786/aigent-os/capsule-compact/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for capsule-compact

Your own site · 80×15
<a href="https://agentmods.dev/skills/wrg32786/aigent-os/capsule-compact"><img src="https://agentmods.dev/badge/skills/wrg32786/aigent-os/capsule-compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 464 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00042 $0.00464
Opus 5.5 $0.00017 $0.00186
Sonnet 5.5 $0.00008 $0.00093
Haiku 4.5 $0.00004 $0.00046

Measured 1mo ago against content hash c92730d0c625, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

capsule-compact 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 1mo 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.

skills/capsule-compact/SKILL.md · 50 lines

What it actually says

/capsule-compact

Run python3 daemons/capsule-compact.py <head_capsule_id> from the vault root.

The script:

  1. Walks parent_capsule_id chain backward from the head
  2. If chain length >= 5, summarizes the oldest 3 capsules into a single chain-summary-<head>-<date>.md capsule
  3. Updates pointers: boundary capsule's parent → summary; summary's parent → original chain root's parent
  4. Marks each compacted capsule with compacted_into: <summary_id> (they stay on disk for archeology)

When to run

  • /close Step 0.5 PART E (v0.4.5) emits [CADDY:context] CHAIN — capsule chain length N when threshold hit
  • Manually before a session-heavy week to keep /open Step 2.5 fast
  • After narrative-reconstruction archeology when the chain has grown unwieldy

Defaults

  • Threshold: 5 capsules
  • Summarize-count: 3 oldest

Override via --threshold N and --summarize-count N flags.

What it does NOT do

  • Does not auto-compact at /close. Hints, you decide.
  • Does not delete compacted capsules. Each gets compacted_into: marker.
  • Does not LLM-summarize. Concatenates structured fields (objective, open_threads still live, held decisions).
  • Does not walk forks. parent_capsule_id is strictly linear.
  • [[concepts/Somatic v0.4.5 Chain Compaction]] — spec
  • [[concepts/context-capsule]] — base capsule schema
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. 1mo ago First seen · 50 lines · 42 tokens per session scan A c92730d0c625

Subscribe to this mod's changes

capsule-compact is a skill published in the GitHub repository wrg32786/aigent-os (23 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 464 once invoked, about $0.0002 per session on Opus 5.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-09-01.

Related

Other skills, from other repositories

setup-brain

Set up or upgrade an AI-powered Obsidian vault. Interviews you, builds your vault structure (or works with what you already have), creates your CLAUDE.md memory file, installs tools, and gets you journaling — all in one conversation. Also has a repair/upgrade path for existing users.

mycelium-hq/ai-brain-starter · 66 tokens

second-brain-mapping

Use when the user wants to map or remap their second brain, refresh the vault's queryable metadata index, extract structured frontmatter from typed notes (books, meetings, people, journals, goals), fill wikilink gaps, or surface cross-type insights and patterns no single file shows. Triggers: /second-brain-mapping…

mycelium-hq/ai-brain-starter · 116 tokens

evolve

Use when many related hardened instincts (high-confidence feedback/discovery memories) have piled up in one domain, when the user runs /evolve or asks to promote, cluster, graduate, or consolidate accumulated instincts into a Command, Skill, or Agent, or when files in Instinct Proposals need review. Part of the…

mycelium-hq/ai-brain-starter · 100 tokens

vault-system

Use when maintaining the vault ITSELF as a system, not its content: knowledge-graph build/rebuild/query (graphify), second-brain mapping, vault diagnose/audit/hygiene, drift detection, extract rules from vault, backfill journals, setup vault types, consolidate memory (index over cap), Obsidian tooling…

mycelium-hq/ai-brain-starter · 112 tokens

diagnose

Use when an AI Brain vault needs a health check or something feels off: Claude ignores CLAUDE.md, journal entries missing from /weekly, hooks not firing, something broke after a git pull, a friend's install misbehaves, Obsidian crashes or pegs the CPU, a .claude/worktrees folder appeared, Granola/WhatsApp/Slack/Gmail…

mycelium-hq/ai-brain-starter · 110 tokens

nav-compact

Clear conversation context while preserving knowledge via context marker. Use when user says "clear context", "start fresh", "done with this task", or when approaching token limits.

qf-studio/navigator · 38 tokens