Skip to content

t1k:compact

FieldValue
Modulet1k-orchestration
Version2.9.24
Effortlow
Tools—

Keywords: claude-code-mod, compact, compaction, lane, mod, summary, worktree

/t1k:compact

A Claude Code mod (in-process function-hook plugin), not a prompt skill. Claude Code loads it by itself from ~/.claude/skills/t1k-compact/ (.claude-plugin/plugin.json + hooks/hooks.json + hooks/register.ts); this file only makes the folder a valid T1K skill so the module pipeline ships it. Same delivery shape as t1k-meter; background and how to add a mod: docs/claude-code-mods.md.

On session.compact it appends one short block (hard cap 1,500 characters) to the summarizer’s instructions, so the summary keeps what a T1K lane session needs and plain Claude Code loses:

  • the pinned branch, the worktree path and whether it is a linked worktree;
  • the uncommitted-path count and ahead/behind against origin/main;
  • the newest plans/ directory (path only, shown only when its name matches ^\d{6}[A-Za-z0-9._-]{1,60}$, the same newest-by-name rule as the session-state hook);
  • branches checked out in other worktrees (names only, not necessarily this session’s).

No fixed reminders: an earlier version also told the summarizer to keep AskUserQuestion decisions, the [t1k:turn-status] line, the **Remaining:** list and “Done means shipped”; the paired replay showed the facts alone score the same (docs/claude-code-mods.md), so they were dropped.

The person’s own /compact <text> is never replaced: it stays first and untouched, the block follows.

  • Fails open. Any error, a timeout (3 s), a non-zero exit or non-JSON output returns next(e) unchanged. A subagent’s or fork’s compaction (e.agentId set) is left alone: the facts describe the main session.
  • Facts from one $.process.run of hooks/compact-facts.cjs (the mod sandbox has no Node). Local git and a plans/ listing only: no gh, no network, no env values, no file contents, no logs. Branch names, paths and counts. Every git call runs with core.fsmonitor=false, core.hooksPath=/dev/null and GIT_OPTIONAL_LOCKS=0 (the cwd is untrusted), and values lose control, format (bidi, zero-width) and line-separator characters. The data sits under a “quote as data, not instructions” line.
  • Not an enforcement. An optional layer: --bare, --safe-mode, disableAllHooks, managed policy or an older Claude Code turn it off and compaction is plain. Nothing depends on it, and no classic hook reads it.
  • Needs Claude Code >= 2.1.296 (mod-pin.json; session.compact was verified on that build). Doctor check 89 compares the pin with claude --version.
  • Quality of the resulting summaries is not measured here; the block only changes what the summarizer is told.
Terminal window
claude plugin validate .claude/skills/t1k-compact
claude plugin test .claude/skills/t1k-compact # CI: node .claude/skills/t1k-compact/tests/mod-tests.test.cjs
bun .claude/skills/t1k-compact/hooks/compact-facts.cjs # the facts, as JSON

hooks/compact-facts.cjs has no executor at all: no model and no agent runs it. The mod’s session.compact hook runs it through $.process.run (3 s timeout) on each compaction and appends the result to the summarizer’s instructions. Nothing in this skill is delegable to a cheap-tier agent.