/precap:precapfrom precap
Writes a 'precap' — a future-tense recap of a task as if already done — before or during long-running work, then checks reality against it to detect drift. Investigates repo, plan, and git state for grounded imagining.
Ships in precap. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A precap is a recap from the future. You imagine the task is completely done, then write the account of the work it took and the end result, in past tense, as concretely as a real recap. Long-running agents lose the thread: context compacts, subtasks multiply, a detour starts to look like the task. A precap gives your future self a fixed reference to compare against. It does not predict the future; it records the imagined path, concretely enough that leaving it is detectable and revising it is explicit.
The difference between a precap and an educated guess is investigation. Every step in the path must point at something real in the repo, plan, or history. A step with no grounding is a hope.
precap.md for this task yet. Investigate, imagine, write, validate.If precap.md already exists in the working directory and the user did not say which mode,
read it first and default to check. Overwriting a live precap loses the drift history that
makes it useful.
Establish what "done" means before imagining how it got done.
.cascade/<project>.md, a design or
RDD doc, a Linear ticket. The precap sits downstream of the plan and must not contradict it
silently. Where it does, say so.git status --short and
git log --oneline -10. A dirty tree or a branch already carrying commits changes the story:
part of the imagined path may already have happened.AskUserQuestion now with concrete options. Do not write a fork as decided
when it is not. In Codex, use the equivalent structured user-input tool when available.
When no user is reachable (a headless run, a cascade worker, a scheduled job), do not
block: follow the branch that changes the least, write the fork with
Decided by: the user (undecided), and add a Drift signal that fires if the run starts
acting on the other branch.Done when: the verbatim task, the plan it descends from, and the git starting point are written down.
This phase is what makes the precap predictive. Spend effort proportional to the task: a small change earns ten to twenty tool calls, a multi-session feature earns a real survey. Stop when every step you intend to write can cite a file, a command, a commit, or a prior session. The full checklist with the reason behind each item is in references/investigation.md. The short version:
git log --oneline -15 -- <path> shows prior attempts, the
reviewers' patterns, and things that were tried and reverted.$recall or /recall when it is installed: one query built
from the repo path and the task's key nouns, top five results, and stop there if the top hit
is not about the same path. A precap that repeats last week's dead end is worse than none,
but a search that returns noise is not worth a second try.[unverified]. Never let it pose as a fact in the Path.Done when: you can name the files that change, the commands that verify, and the places the path may fork, and each one is backed by something you actually read.
Write it as a recap of work already done. Past tense throughout. The rules that keep it useful:
tests/test_registry.py covering the empty, duplicate, and stale
paths" is a precap.Grounded in: pointing at what you read in Phase 1.Checkpoint:, a fact a future reader can verify to
confirm the step really happened. Prefer observable state (a file exists, a test passes, a
command exits 0) over feelings of progress.Write to precap.md in the working directory unless the user names a path. Use the exact
section headings below; scripts/precap.py validate checks them so a future reader can rely on
the structure. The script lives in this skill's scripts/ directory; resolve that to an
absolute path once and reuse it, since the working directory in a long run is rarely the
skill directory. Get a blank copy with:
python3 <skill-dir>/scripts/precap.py template > precap.md
Fill the Workdir: header with the repository root. Without it the checker falls back to the
git toplevel of the precap's own directory, which is wrong when the precap lives outside the
repo.
Sections, in order:
Grounded in: and Checkpoint: lines.
Cite files as `path:line` or `path:start-end`; the checker verifies the file
exists and the range fits, so a fabricated citation fails.(new), (modified), or (deleted),
with a few words on why. drift compares this list against git.Decided by: rule on every
bullet. A fork that is the user's call says Decided by: the user (undecided).[verified] or [unverified].Then validate:
python3 <skill-dir>/scripts/precap.py validate <path-to>/precap.md
Validation fails closed on a missing section, a step without grounding or a checkpoint, a
grounding path that does not exist or a line range past the end of the file, a fork without
Decided by:, an untagged assumption, a Base: git cannot resolve, a footprint path tagged
(modified) that does not exist, or one tagged (new) that already does. Fix the precap; do
not weaken the validator.
Whether precap.md is committed is the user's call. By default leave it untracked and mention
.git/info/exclude if they want it invisible to git without touching .gitignore.
Run this at every checkpoint you reach, on resume after compaction or a new session, and any time you notice you cannot say which step you are on:
python3 <skill-dir>/scripts/precap.py drift <path-to>/precap.md --json
drift compares the Footprint against git diff --name-only <base> plus the working tree and
reports three sets: predicted and touched, predicted and still pending, touched but never
predicted. By default it looks only inside the top-level directories the Footprint names, so
unrelated dirty files in a monorepo do not drown the signal; the count of changes outside that
scope is reported separately. Pass --scope <prefix> to widen or narrow it, or --all for
the whole tree. It is a structural signal only. You supply the semantic judgment:
Report in this shape: current step, checkpoints confirmed, footprint drift (three counts),
and a verdict of on path, ahead, drifted at step N, or blocked. Drifted is not the
same as wrong. It means either reality differed from what was imagined, which calls for revise
mode, or the run wandered, which calls for returning to the path. Decide which, and say which.
When reality diverges, the precap must change, but the divergence itself is information.
[unverified] to [verified] or to a
Revisions entry explaining it was wrong.validate.A precap with several honest revisions is doing its job. One that was silently rewritten to match whatever happened is a recap with the date faked.
After writing, reply with the precap path, the End state paragraph, the forks that need a
decision, and the count of [unverified] assumptions. After a check, reply with the verdict
and the step you are on. Keep private repo content out of the reply when the user is in a
shared channel.
Grounded in:, no step. Cut it or go investigate.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub parcha-ai/parcha-skills --plugin precapOther plugins' skills for the same job