src/claude/skills/compact-prepare/SKILL.md
Mid-session compact prep — force-commit the handoff, flush coord work, write continuation-framed handoff, direct to /compact.
npx skillsauth add the-agency-ai/the-agency compact-prepareInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Claude Code's /compact summarizes the conversation to free context, but a summary is lossy. The guarantee "I'll remember what I was doing after compact" holds only if a disciplined handoff is written BEFORE compact. This skill is that discipline for mid-session compaction — you commit current coord work, write a continuation-framed handoff, then run /compact.
Framework: this is the PAUSE-for-compact surface. It shells to agency/tools/session-pause --framing continuation. Paired with /compact-resume on the other side.
agency/REFERENCE/REFERENCE-HANDOFF-SPEC.md — handoff frontmatter shape, mode: enum (continuation for this skill)agency/REFERENCE/REFERENCE-SKILL-CONVENTIONS.md — primitive-composition pattern (skills shell to bash tools per agency#348)/compact-prepare
/compact-prepare "context heavy — deep investigation paused"
/compact-prepare "mid-iteration refresh before QG"
[reason] (optional): short label for telemetry + handoff frontmatter. Defaults to compact-prepare.
After this skill reports clean state + handoff written, run /compact next. The skill does not invoke /compact — you do.
/compact. If you don't, use /session-end instead.Idempotent: safe to run multiple times. Archives and re-writes each time.
./agency/tools/session-pause --framing continuation --trigger "${REASON:-compact-prepare}"
The primitive (v1.2.0+) force-commits the handoff in its own commit if the tree has non-coord framework files dirty — so the handoff is durable even when the overall PAUSE aborts on framework-code gate. Parse the emitted key=value output:
schema_version, tool_version — output contract versions.handoff_path — path to the new empty handoff you must author in Step 2.archived_previous_handoff — archive path of the prior handoff (or none).commit_sha — coord checkpoint commit (or none if tree was clean).handoff_commit_sha — force-commit SHA when the tool force-committed the handoff alone (abort path); none on the happy path.framing=continuation — confirms the tool read the flag correctly.status — ok or aborted.If status=aborted AND handoff_commit_sha is non-none, the handoff was persisted but framework code is dirty — surface error_reason (which includes the handoff SHA) and stop. Run /quality-gate + /iteration-complete on the framework code, then re-run /compact-prepare.
If status=aborted AND handoff_commit_sha=none, the PAUSE aborted before any commit — surface error_reason and stop. Do NOT author a handoff on an aborted PAUSE.
Write the handoff file at handoff_path. Use the standard handoff template with:
type: sessionagent: <org>/<principal>/<agent> (from agent-identity)date: <UTC timestamp>trigger: compact-preparebranch: <current branch>mode: continuation — REQUIRED. Tells /compact-resume this is mid-session.next-action: — the SINGLE most important thing to do immediately after /compact. Not a backlog; the very next step.pause_commit_sha: <commit_sha from Step 2> — lets /compact-resume compute dispatch drift deterministically.Body:
next-action, elaborated).Frame for continuation, not resumption. The agent keeps working after compact — doesn't start fresh.
./agency/tools/handoff read
Confirm the handoff was written correctly and next-action is clear.
Report to the user:
./agency/tools/git-safe branch --show-current./agency/tools/git-safe log --oneline -1Then the directive:
Run
/compactnow.
handoff_commit_sha) — the handoff is safe. Run /quality-gate + /iteration-complete on the framework code, then re-run /compact-prepare./compact itself./compact. It prepares; the user runs compact. Intentional — the skill must never surprise-compact.session-pause; run QG before re-trying./sync or /release.active (v2, shipped session-lifecycle-refactor Phase 3 Iteration 3.1). Paired with /compact-resume, /session-end, /session-resume.
/compact-resume — PICKUP companion (post-compact)./session-end — end-of-session PAUSE (resumption framing)./session-resume — fresh-session PICKUP.agency/tools/session-pause — primitive this skill shells to.agency/tools/handoff — handoff read/write tool.the-agency#355 — upstream tracker for handoff force-commit landing in the primitive (when that lands, Step 1 is retired per Plan HG-7).OFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!
business
Sync worktree with master — merge, copy settings, run sandbox-sync, report changes
tools
List all git worktrees with status info (branch, clean/dirty, deps)
tools
Remove a git worktree and optionally delete its branch
development
Create a new git worktree with dedicated branch and bootstrapped dev environment