/scrolls-skills:scrolls-compactfrom scrolls-skills
Compacts old history in docs/.scrolls/ project-memory files (SPEC, PLAN, HANDOFF, GAP_ANALYSIS, GAP_CONTEXT) by condensing git-blame-older content while preserving open tickets and threads. Saves a git checkpoint and generates compaction reports.
Ships in scrolls-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
/scrolls-setup, /scrolls-update, /scrolls-hide/-unhide and /scrolls-remove/-restore manage where the scrolls are. This skill works on when: it condenses the history that has piled up in the scrolls, and keeps the full older text in git at a checkpoint. The checkpoint is the commit just before the compaction. Nothing is copied into a file. COMPACT.md and the compacted/ reports are only an index that leads back to git.
Rule: compaction removes history, never live state. Open [ ] tickets, every GAP_ANALYSIS.md line, and HANDOFF's "Known issues / open threads" stay word for word, whatever their age. WISDOM.md and STARTER.md are never compacted.
Run this only when the user asks for it. Show the plan before changing anything, unless they passed -y/--yes.
Everything is relative to the current working directory unless -t/--reporoot says otherwise, not relative to this skill's own location.
All of the logic is in one stdlib-only Python file, scripts/compact.py. compact.sh (bash: macOS, Linux, or Windows with Git Bash/WSL) and compact.ps1 (PowerShell 7+) are thin launchers that find Python 3.9+ and pass every flag through unchanged. Pick by what's available: try bash --version, and if that succeeds use .sh. Otherwise use .ps1 via pwsh (preferred), or powershell.exe only if pwsh isn't installed.
/scrolls-compact [--before=YYYYMMDD] [--base=COMMIT]
[--keep-days=N] [--keep-commits=N] [--trunk=BRANCH]
[--include=FILE[,FILE]] [--exclude=FILE[,FILE]]
[-p PATH | -t | -l] [-r] [-n] [-y] [--no-commit] [--no-tag]
/scrolls-compact --list
/scrolls-compact --show <ID> [FILE]
/scrolls-compact --extract <ID> FILE [-o OUT]
Read these from the invocation text, in any order.
When: the compaction base. A line is old when the commit that last changed it (from git blame -w -M) is the base commit or one of its ancestors.
--before/--base (the default). Two rules each give a candidate base:
--keep-days=N (default 7): the newest trunk commit older than N days.--keep-commits=N (default 20): the trunk commit just past the newest N, counted on the first-parent line (one merged PR is one commit).--before=YYYYMMDD (or YYYY-MM-DD): the newest trunk commit before 00:00 local time on that date.--base=COMMIT: that commit. It must be an ancestor of HEAD.--before or --base replaces the default rules. With both, the newer one wins.--trunk=BRANCH: the branch the rules walk. The default is origin/HEAD, then main, then master.Where: the scrolls folder. These are the same flags /scrolls-update uses.
-p <path> / --path=<path>: a project folder, a docs folder, or the scrolls folder itself.-t / --reporoot: look under the git repository's top level.-l / --local: look in the current directory. This is the default anyway.-r / --recurse: search recursively if the exact spot has no scrolls folder. If more than one turns up, the script lists them and stops. Ask the user which one, then pass it with -p. One run compacts one folder.What: the files in scope. The default five are SPEC.md, PLAN.md, HANDOFF.md, GAP_ANALYSIS.md and GAP_CONTEXT.md.
--include=FILE: also compact a project-specific scroll that STARTER.md lists. STARTER.md, WISDOM.md and COMPACT.md are refused. Don't include an append-only log whose own rule says never to edit it.--exclude=FILE: leave one of the default five alone this run.Other
-n / --dry-run: show the plan and stop.-y / --yes: skip the confirmation step.--no-commit: stage everything, but leave the commit to the user. The script prints the git commit -F … command, and the tag command to run after it.--no-tag: don't tag the checkpoint (see step 4).-p, -t and -l are mutually exclusive.
The plan splits each file into units: a ## section in SPEC.md (and in an --included file with ## headings), and a top-level list item with its indented lines everywhere else. A unit is old only if every line in it is old. One fresh edit keeps the whole unit as it is. Lines written on an unmerged branch are never old.
| File | An old unit | Condense it to |
|---|---|---|
SPEC.md | A shipped-feature section | One line under ## Compacted features: **Name** — what it does for a user (#PR, sha). Keep every feature listed; drop only the detail. |
PLAN.md | A done [x] ticket | Remove it. The report lists it. |
HANDOFF.md | A stale "Current state" or "What just happened" bullet | Remove it, or fold several into one short line. |
GAP_CONTEXT.md | The reasoning for a gap | Tighten it to the decision and its reason. Keep the entry: the file stays in lockstep with GAP_ANALYSIS.md. |
--include file | A section or item | Follow the convention STARTER.md gives for that file. |
The plan marks the units that must not change: live units (old, but live state: open tickets, all of GAP_ANALYSIS.md, HANDOFF's open threads) and new units. It also checks the text outside the units, such as headings and intros. Keep all of these word for word.
Every file you change gets exactly one marker line, the one the plan prints, placed where the condensed text starts. Put a one-line > note under it, for example > Older detail was compacted on 2026-11-15. See COMPACT.md to reach the full text. On a later compaction, replace the old marker and its > note. Don't stack them.
Run the script with the user's flags. It is read-only:
bash <skill-dir>/scripts/compact.sh [flags...]
pwsh <skill-dir>/scripts/compact.ps1 [flags...]
It prints the checkpoint, the base and the rule that chose it, the report path, the marker line, and one line per unit: old, live or new, its line range, and when it last changed. It saves the plan in the git directory for step 4.
If it exits with an error, report it and stop:
--keep-days, --keep-commits, --before or --base if the user wants a deeper cut.-p with -t, a bad date, --include=WISDOM.md, more than one folder under -r, or not a git repository.--base isn't an ancestor of HEAD. Report the reason as printed. Don't work around it by committing, stashing or deleting the user's files yourself; let the user choose.Show the user the plan: the base and why it was chosen, and the old units per file. Ask before going on. Skip this only if they passed -y/--yes. If they passed -n/--dry-run, stop here.
Edit the in-scope files in the working tree yourself, following the table above:
old units. Leave live and new units, and the text around them, exactly as they are.> note to every file you change.Don't edit any other file in the scrolls folder or anywhere else, and don't commit.
bash <skill-dir>/scripts/compact.sh --finalize [--no-commit] [--no-tag]
pwsh <skill-dir>/scripts/compact.ps1 --finalize [--no-commit] [--no-tag]
It checks the edits against the saved plan first:
live and new unit, and the text around the units, is still there word for word.GAP_CONTEXT.md kept all its entries.If a check fails, it exits 3, names the unit or line, and leaves your edits in place. Fix them and run --finalize again. Exit 1 means no file changed. Exit 2 means there is no plan: run step 1 again.
When every check passes, it:
compacted/scrolls_compact_<yyyymmdd>_<githash>.md. The hash is the checkpoint, and the date is the day of the run. It has one marker section per compacted file: the file's blob id at the checkpoint, lines before and after, the units condensed, and the git show command for the full text.COMPACT.md, newest first, creating the file on the first run.COMPACT.md entry to STARTER.md's reading list and "When to update" list, once.maint(memory): scrolls-compacted
- checkpoint: #<full SHA of HEAD before the compaction>
- base: #<full base SHA> (2026-11-08; rule: 20 commits)
Notes:
- compacted: docs/.scrolls/SPEC.md (3 units condensed, 23 → 14 lines)
- compacted: docs/.scrolls/PLAN.md (5 units condensed, 13 → 10 lines)
- unchanged: docs/.scrolls/GAP_ANALYSIS.md
- report: docs/.scrolls/compacted/scrolls_compact_20261115_904e593.md
- checkpoint tag: scrolls-compact/20261115-904e593
- STARTER.md: added the COMPACT.md entry
Scrolls-Action: compact
Scrolls-Checkpoint: <full sha>
Scrolls-Compact-Base: <full sha>
Scrolls-Compact-Rule: newer-of days=7 commits=20 -> commits
Scrolls-Previous-Compaction: <full sha of the last compaction commit, or none>
Scrolls-Folder: docs/.scrolls
Scrolls-Compacted: docs/.scrolls/SPEC.md
Scrolls-Compacted: docs/.scrolls/PLAN.md
Scrolls-Report: docs/.scrolls/compacted/scrolls_compact_20261115_904e593.md
Scrolls-Previous-Compaction chains each compaction to the one before it. Never hand-edit or reword this message.
scrolls-compact/<yyyymmdd>-<githash>, unless --no-tag. The tag keeps the checkpoint commit alive if the branch is later squash-merged and deleted.If git commit fails (exit 4, usually a hook), the compaction stays staged. Report the hook's output and the git commit -F <git-dir>/SCROLLS_COMPACT_MSG command to finish with. Never retry with --no-verify.
This skill never pushes, not even the tag.
Give:
git push origin <tag> to share it (needed if the branch will be squash-merged)git revert --no-edit <new-sha>, or /scrolls-restore <checkpoint> -f to bring back the whole folder as it wasThese are read-only. They make no commit, so skip the confirmation step.
--list: every compaction in COMPACT.md, newest first, and whether its checkpoint commit is still in this clone.--show <ID> [FILE]: the diff of what that compaction condensed, for the whole folder or one file.--extract <ID> FILE [-o OUT]: the file as it was at the checkpoint.<ID> is a row number (1 or #1), a checkpoint hash prefix, or a report file name. These commands read COMPACT.md and the reports, not commit messages, so they still work after a squash merge rewrote the message, and after /scrolls-hide or /scrolls-unhide moved the folder. Exit 1 means the ID isn't in COMPACT.md, or the checkpoint isn't in this clone. Suggest fetching the scrolls-compact/* tags.
An agent that can't run this skill can use the plain git commands that COMPACT.md lists. That is why they are written there.
## sections and no top-level list items has no units, so nothing in it is ever old.maint isn't a standard Conventional Commits type, so a strict commitlint hook may reject the commit (exit 4).There are 23 worked examples, covering every flag, refusal and exit code, all run on one small demo repository. Each has a premise, caveats, the prompt, and its real output: a test replays every one, so the outputs are exactly what the script prints.
assets/EXAMPLES.md is the index: how to read the examples, the demo repository, and a table with one row per example and its file.assets/examples/example_NNN.md holds one example each (example_001.md to example_023.md).assets/example-viewer.html shows the same files on one page for people. Don't read it; read the Markdown files. To show the examples to the user, point them to it.Read them only when you need them: for example, when a request does not map clearly to the flags above, or when the user asks for an example. Read the index first, then only the example file you need. If that example starts from another example's state, its Starts from: line links to it.
See meta/MAINTAINERS.md for the layout, running the tests/ suite, and versioning notes, and meta/DESIGN.md for why it works this way. Don't read or act on meta/ or tests/ while carrying out a user's /scrolls-compact request.
CHANGELOG.md (opens in a new tab)README.md (opens in a new tab)agents/openai.yaml (opens in a new tab)assets/EXAMPLES.md (opens in a new tab)assets/example-viewer.html (opens in a new tab)assets/examples/example_001.md (opens in a new tab)assets/examples/example_002.md (opens in a new tab)assets/examples/example_003.md (opens in a new tab)assets/examples/example_004.md (opens in a new tab)assets/examples/example_005.md (opens in a new tab)assets/examples/example_006.md (opens in a new tab)assets/examples/example_007.md (opens in a new tab)assets/examples/example_008.md (opens in a new tab)assets/examples/example_009.md (opens in a new tab)assets/examples/example_010.md (opens in a new tab)assets/examples/example_011.md (opens in a new tab)assets/examples/example_012.md (opens in a new tab)assets/examples/example_013.md (opens in a new tab)assets/examples/example_014.md (opens in a new tab)assets/examples/example_015.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (sugatoray/aiskills) — no native marketplace selected
npx claudepluginhub p/sugatoray-scrolls-skills-skills-scrolls9 skills in this plugin
/scrolls-explainerShows, copies or rebuilds scrolls-explainer.html: an interactive, offline page that explains how the scrolls skill family works (/scrolls-setup, /scrolls-update, /scrolls-hide, /scrolls-unhide, /scrolls-remove, /scrolls-restore, /scrolls-help) — one tab per command that animates, step by step, what the command does to docs/.scrolls/, SCROLLS.md, CLAUDE.md, AGENTS.md and git, with a callout explaining each step, a tab for how a new agent session reads the memory, and full keyboard navigation (arrows step, [ ] or digits switch tabs, Space pauses, ? lists shortcuts). Use this whenever the user runs /scrolls-explainer, or asks for a visual, diagram, animation, walkthrough, explainer or interactive page of how the scrolls commands or the scrolls memory work, or wants something to show a team. By default (same as --show) it opens the bundled page in place and copies nothing; -o/--output copies it to a file or folder (-o . for ./scrolls-explainer.html), -f/--force overwrites with -o, --open opens the copy, and --build to regenerate the bundled page from the scrolls-* skills as they are now (their tabs, lockstep version, and a review check when a SKILL.md changed). Works on macOS, Linux, and Windows (bash or PowerShell)./scrolls-helpShows a crisp, example-driven reference for the whole scrolls skill family (/scrolls-setup, /scrolls-update, /scrolls-hide, /scrolls-unhide, /scrolls-remove, /scrolls-restore, /scrolls-compact, and the /scrolls-explainer page) — what each command does, their shared -p/-t/-l/-r/-u/-x/--onto/--before/--base flags, and common usage examples (new project, monorepo, running from a subdirectory, toggling hidden/visible, removing and restoring scrolls, compacting old history). Use this whenever the user runs /scrolls-help, or asks what the scrolls commands do, how to use them, what flags they take, which one they need, or seems unsure about docs/.scrolls setup — even if they only name one of the seven commands rather than 'scrolls' generally. Supports -e/--online to render it as a styled page served on an OS-assigned localhost port instead of chat text, with light/dark and colorize/plain toggles. Works on macOS, Linux, and Windows (bash or PowerShell)./scrolls-hideConverts an already-set-up docs/scrolls/ working-memory folder from visible (scrolls) to dotfile-hidden (.scrolls), renaming the folder and rewriting the path references inside it and in SCROLLS.md so nothing breaks. Use this whenever the user runs /scrolls-hide, or asks to hide, dot, or re-hide the scrolls folder, go back to hiding project memory / docs/.scrolls, or rename scrolls to .scrolls. This is the retrofit path for a project that was set up visible and now wants it hidden — for a brand-new project, /scrolls-setup's default (no -u/--unhide flag) already creates it hidden and this skill isn't needed. By default checks one exact location (docs/scrolls under the current directory); supports -r/--recurse to sweep an entire directory tree instead (e.g. every package in a monorepo in one run), repeatable -p/--path to target specific locations, -t/--reporoot to target the git repository's top level regardless of which subdirectory you're in, -l/--local to target the current directory explicitly, and the DEFAULT_SCROLLS_RELPATH environment variable to change the default location. Works on macOS, Linux, and Windows (bash or PowerShell). The opposite of /scrolls-unhide./scrolls-removeRemoves a docs/.scrolls/ (or docs/scrolls/) project-memory system from a git repository — the exact opposite of /scrolls-setup. Deletes the scrolls folder, deletes SCROLLS.md, strips the scrolls pointer stub out of CLAUDE.md (and the dangling pointer out of AGENTS.md), deleting either file outright only when nothing else is left in it, and records the whole removal as ONE git commit whose message names the commit just before the removal, so it can always be undone. Use this whenever the user runs /scrolls-remove, or asks to remove, delete, uninstall, tear down, or get rid of the scrolls / project memory / docs/.scrolls. Supports -p/--path (repeatable), -t/--reporoot, -l/--local, -r/--recurse to find and remove every scrolls folder under a directory in one commit, -x/--purge [CLAUDE.md|AGENTS.md|SCROLLS.md|<other file>|all] to delete pointer files outright even when they hold other content, -n/--dry-run, -y/--yes to skip the confirmation, and --no-commit. Refuses to run when anything it would remove has uncommitted changes, since those could not be restored. Works on macOS, Linux, and Windows (bash or PowerShell)./scrolls-restoreRestores a docs/.scrolls/ (or docs/scrolls/) project-memory system from git history — the counterpart to /scrolls-remove. By default finds the newest /scrolls-remove checkpoint in HEAD's history and brings back exactly what it removed; or takes any COMMIT (a removal commit, or an ordinary commit containing a scrolls folder). Restores ONLY the agentic memory — the scrolls folders plus the SCROLLS.md/CLAUDE.md/AGENTS.md pointer stubs, re-inserted into those files as they are today — never rolling back anything else in the repository, and records it as one git commit. --onto REF mounts the memory onto another branch (or, with -b, a new branch at any commit) through a temporary worktree, without touching the current checkout. Use this whenever the user runs /scrolls-restore, or asks to restore, bring back, recover, undo the removal of, or re-mount the scrolls / project memory / docs/.scrolls. Supports -p/--path (repeatable), -t/--reporoot, -l/--local, -r/--recurse, --onto, -b/--branch, --full, -f/--force, --list [--all], -n/--dry-run, -y/--yes, and --no-commit. Works on macOS, Linux, and Windows (bash or PowerShell)./scrolls-setupSets up a minimal docs/.scrolls/ working-memory system for a project — a small set of cross-session memory files (STARTER.md, SPEC.md, HANDOFF.md, GAP_ANALYSIS.md, GAP_CONTEXT.md, PLAN.md, WISDOM.md) plus a SCROLLS.md file that points future sessions at STARTER.md, a short CLAUDE.md pointer to SCROLLS.md, and a matching AGENTS.md pointer to CLAUDE.md for other agent harnesses. Use this whenever the user runs /scrolls-setup, or asks to set up 'scrolls', a project-memory system, session handoff notes, a docs/.scrolls folder, or a CLAUDE.md/AGENTS.md/SCROLLS.md that points new sessions at persistent project docs. Trigger even if the project has no docs/ folder, no CLAUDE.md, no AGENTS.md, or no SCROLLS.md yet — creating them is part of the job. Supports -p/--path for a custom docs location, -t/--reporoot to pin everything to the git repository's top level regardless of which subdirectory you're in, -l/--local to pin it explicitly to the current directory, -r/--recurse to scan recursively for an existing scrolls folder before creating a new one (avoiding accidental duplicates), and -u/--unhide to name the folder scrolls instead of .scrolls. Defaults to the current directory, but warns first if that differs from the repo root so a subdirectory invocation doesn't silently create a second, disconnected scrolls system. Works on macOS, Linux, and Windows (bash or PowerShell).