cc-compact

cc-compact is a skill for Claude Code from yeisonrestrepo/code-conductor. It costs 32 tokens per session (2,030 once invoked), scanned A, original, MIT.

A workflow step that records the current development phase and project state before a conversation's context is shortened. Context compaction means reducing the conversation carried forward while preserving key state.

In plain words
What is it for?
Use it when moving between specification, planning, implementation, or review phases and needing to preserve their state.
Why use it?
It helps a later phase recover which specification, commit, and development stage were active after earlier discussion is compressed.

Skill for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions Claude Code; installed under .agents/ (shared by several agents).

Good fit Use it when moving between specification, planning, implementation, or review phases and needing to preserve their state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yeisonrestrepo/code-conductor/cc-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 yeisonrestrepo/code-conductor --skill cc-compact
Clone the repo
git clone --depth 1 https://github.com/yeisonrestrepo/code-conductor

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/yeisonrestrepo/code-conductor/cc-compact/github.svg)](https://agentmods.dev/skills/yeisonrestrepo/code-conductor/cc-compact)
Your own site
<a href="https://agentmods.dev/skills/yeisonrestrepo/code-conductor/cc-compact"><img src="https://agentmods.dev/badge/skills/yeisonrestrepo/code-conductor/cc-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 cc-compact

Your own site · 80×15
<a href="https://agentmods.dev/skills/yeisonrestrepo/code-conductor/cc-compact"><img src="https://agentmods.dev/badge/skills/yeisonrestrepo/code-conductor/cc-compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,030 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.00032 $0.02030
Opus 5.5 $0.00013 $0.00812
Sonnet 5.5 $0.00006 $0.00406
Haiku 4.5 $0.00003 $0.00203

Measured 5d ago against content hash 559fb26e6df8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cc-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 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.

project-template/.agents/skills/cc-compact/SKILL.md · 69 lines

How it starts

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

code-conductor: this command was written for Claude Code. Where it names a Claude Code tool (Read, Grep, Glob, Edit, Write, Bash, Skill, Agent), use your closest equivalent. $ARGUMENTS and an ARGUMENTS: line mean the text the user gave with the command.

Run git rev-parse HEAD to get the current commit SHA (the full 40-char hash — NOT --short, whose abbreviation length auto-scales with repo size and is unstable across growth). Lowercase and trim it; if it does not match /^[0-9a-f]{7,40}$/, or the command exits non-zero (non-git workspace, no commits, git absent, or permission-denied), use "0000000". Wrap the call with shell timeout only when command -v timeout (or gtimeout) succeeds; otherwise run it unwrapped. This same value is sys.c and the sessions / snapshots git-hash key.

Determine sys.s: take the active specification file path from this phase's context, split on / and \, keep the last segment, strip a trailing .md extension, truncate to 200 characters. If no active spec file exists, use "none".

Collect from the current conversation context:

  • Phase (sys.ph): spec | plan | impl | rev, the phase that just completed
  • Decisions (mem.d): finalized decisions this phase, max 10 elements, each ≤300 chars (JSON-serialized length)
  • Pending (ops.n): next immediate step(s), max 3 elements, each ≤200 chars
  • Files Touched (ops.f): each entry <relpath>:C|M|D (uppercase only); replace any backslash in the path with /; if the path contains a literal :, percent-encode it as %3A before appending the suffix; max 20 elements, each ≤300 chars
  • Constraints (mem.x): hard constraints next phase must respect, max 5 elements, each ≤200 chars

For all four array fields: filter out empty/whitespace-only strings, deduplicate by exact case-sensitive string equality (first occurrence wins), then truncate each surviving element to its per-element cap (snap-build does the cut, to the cap measured as JSON-escaped length, never splitting a character; an over-cap ops.f entry keeps its :C/:M/:D suffix and loses path, and one with no such suffix is refused with SNAP_FILE_NO_ACTION), then if the array still exceeds its cap, drop from the head (oldest first) until it fits. Empty arrays are valid and must still be serialized (never omitted).

Serialize by piping a flat JSON object {ph, c, s, n, f, d, x} (no pr) on stdin to node .claude/scripts/snap-build.mjs; its stdout is the canonical single-line v1 SNAP JSON. snap-build performs all array normalization (filter/dedup/per-element cap/head-drop) and the 4096-char size trim internally — do not pre-serialize. If snap-build exits non-zero (malformed field object), report the error and stop; do not write the handoff file, do not run the DB tail, do not print the compact prompt.

Write the single JSON line, followed by exactly one trailing newline, to .claude/memory/session-snapshot.json.

If .claude/memory/session-snapshot.md exists, delete it as part of this write.

Idempotently append .claude/memory/session-snapshot.json to the project's .gitignore: read the file; if any line, after stripping leading/trailing whitespace, exactly equals .claude/memory/session-snapshot.json, skip the append. Otherwise, check whether the last byte of .gitignore is a newline; if not, prepend a newline before the appended entry. If .gitignore cannot be read or written (permission or lock error), log a non-fatal warning to stderr and continue; do not block the snapshot write.

If writing the snapshot fails (e.g., missing .claude/memory/ directory), report the error and stop. Do NOT output the compact prompt.

Once the snapshot is written successfully, output exactly:

Snapshot written. Run /compact now to clear history.


Fail-open DB tail (best-effort, synchronous)

After the handoff file is written and the compact prompt is ready — and only if the authoritative write succeeded — run this synchronous, fail-open tail. Any failure here is non-fatal: never revert the handoff file, never suppress the compact prompt.

Read the full file on GitHub · 69 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 · 69 lines · 32 tokens per session scan A 559fb26e6df8

Subscribe to this mod's changes

cc-compact is a skill published in the GitHub repository yeisonrestrepo/code-conductor (22 stars, last pushed 2d ago), licensed MIT. It adds 32 tokens to every session and 2,030 once invoked, about $0.0001 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-11-25.

Related

cc-compact compared with skills from other repositories

cc-compact next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cc-compactyeisonrestrepo/code-conductorSkill222d agoMITA32Claude Code
decision-loggerbestagentkits/agency-skillsSkill285mo agoMITA76Codex
context-enginebestagentkits/agency-skillsSkill285mo agoMITA75Codex
decidebestagentkits/agency-skillsSkill285mo agoMITA66Codex
baoyu-wechat-summarybestagentkits/agency-skillsSkill285mo agoMITB213Codex
comet-memoryrpamis/cometSkill3.3kyesterdayMITA38Claude Code, Codex
relevance-coarse-filterelvisun/newsjackSkill1.7k4d agoMITA57Claude Code