From sop-compact
Generate a repo-specific .claude/sop-compact.md tailored to this codebase. Run once per repo (or to refresh). Composes a prompt from the plugin's template skeleton + this repo's CLAUDE.md/memory and runs an internal `claude -p` (opus) to emit the SOP, then git-ignores the ephemeral handoff artifacts. Trigger on /init-sop-compact.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sop-compact:init-sop-compactThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Produce `.claude/sop-compact.md` for the current repo. This is the static, committed file
Produce .claude/sop-compact.md for the current repo. This is the static, committed file
the sop-compact plugin's hooks read: the PreCompact sidecar reads it to know this repo's
promotion targets and snapshot conventions; the SessionStart hook's recovery guidance comes
from it. Run once per repo, or re-run to refresh (e.g. after structure changes or to fold in
the SOP's own Feedback section).
The generation mirrors cc-session's sop subcommand: an internal claude -p (opus) reads
the template skeleton + this repo's docs and emits the filled SOP. This plugin ships its own
template/prompt rather than shelling out to cc-session.
Resolve repo facts.
REPO_ROOT="$(pwd)", REPO_NAME="$(basename "$REPO_ROOT")".${CLAUDE_PLUGIN_ROOT}/templates/sop-compact.md.tmpl. If
$CLAUDE_PLUGIN_ROOT is unset (files copied into a repo manually), fall back to
.claude/templates/sop-compact.md.tmpl.Locate this repo's context so the inner claude -p can read it:
CLAUDE.md at the repo root (if present).memory/ at the repo root and the CC per-project memory dir
~/.claude/projects/-<encoded-repo-path>/memory/ (the encoded path is the repo's
absolute path with each / replaced by -). Use ls to confirm which exist..claude/skills/ and .claude/commands/ for hints on how the repo is operated.Run the internal claude -p to generate the SOP. Build a prompt that instructs it to
read the template skeleton + the repo docs you located, then emit ONLY the filled SOP to
stdout. Use the same invocation flags as cc-session (tool use on, no session pollution):
claude -p "$PROMPT" \
--model opus \
--setting-sources "" \
--disable-slash-commands \
--strict-mcp-config \
--no-chrome \
--no-session-persistence \
--dangerously-skip-permissions \
> .claude/sop-compact.md
(Override the model via the SOP_COMPACT_MODEL env var if set.) Run mkdir -p .claude
first. The $PROMPT must tell the inner agent to:
CLAUDE.md + memory (paths from step 2), reading high-level only
(names + one-line descriptions), not drowning in content.{REPO_NAME} and {INSTANCE_DESCRIPTION} (one line from CLAUDE.md).Verify. Read the written .claude/sop-compact.md. If it is empty or the claude -p
call failed (non-zero exit / empty output), tell the user the generation failed, do NOT
leave a broken file (overwrite with a minimal stub built from the template, or remove it),
and stop.
Update .gitignore so the ephemeral artifacts stay out of git while the SOP itself
stays committed. Read the repo-root .gitignore (create if absent). If these lines are
not already present, append them under a # sop-compact (ephemeral) comment:
.claude/sop-compact/handoff-*.md
Use grep to check for existing entries before appending so re-runs don't duplicate them.
Report. Tell the user .claude/sop-compact.md was written, summarize what you
customized (which memory dirs were found, what live-state checks / channels / promotion
targets were filled in), and note that the file is committed/tunable while
handoff-*.md is git-ignored. Remind them the hooks now run automatically
on /compact — there is no /prep-compact step in this version.
CLAUDE.md and no memory dirs, still write a usable SOP — leave the
repo-specific bullets as prompts ("inspect git status...") and tell the user it's a
minimal stub they can flesh out.Provides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.
npx claudepluginhub meowkey-dev/machine-plugins --plugin sop-compact