t1k:compact
| Field | Value |
|---|---|
| Module | t1k-orchestration |
| Version | 2.9.24 |
| Effort | low |
| Tools | — |
Keywords: claude-code-mod, compact, compaction, lane, mod, summary, worktree
How to invoke
Section titled “How to invoke”/t1k:compactt1k-compact — compaction steward mod
Section titled “t1k-compact — compaction steward mod”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.
What it does
Section titled “What it does”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.
Contract
Section titled “Contract”- 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.agentIdset) is left alone: the facts describe the main session. - Facts from one
$.process.runofhooks/compact-facts.cjs(the mod sandbox has no Node). Local git and aplans/listing only: nogh, no network, no env values, no file contents, no logs. Branch names, paths and counts. Every git call runs withcore.fsmonitor=false,core.hooksPath=/dev/nullandGIT_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.compactwas verified on that build). Doctor check 89 compares the pin withclaude --version. - Quality of the resulting summaries is not measured here; the block only changes what the summarizer is told.
Check it
Section titled “Check it”claude plugin validate .claude/skills/t1k-compactclaude plugin test .claude/skills/t1k-compact # CI: node .claude/skills/t1k-compact/tests/mod-tests.test.cjsbun .claude/skills/t1k-compact/hooks/compact-facts.cjs # the facts, as JSONExecuted by
Section titled “Executed by”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.