agentleFS
ksdischksdisch/claude-config/skills/pre-compact/SKILL.md

pre-compact

Skill0 starsChanged 27 days agoMITView on GitHub

Checkpoint a long session before /compact so nothing settled lives only in the conversation, then give an honest "safe to compact" or "not yet, because X". Use when "/compact" arrives as a plain message mid-turn, or Kyle says "about to compact", "am I good to compact?", "checkpoint" or "save state" about this session, "I'm near 150k", or types /pre-compact — even without naming the skill. Writes settled decisions, open items, deferrals, and a "Next step" line into the active skill's existing durable home (wayfinder ticket file, CONTEXT.md/ADRs, spec, issue files, branch) or a short .scratch checkpoint, commits and pushes the feature branch, and replies with SHA, settled list, what's left, and a git-checked verdict. Never runs /compact, pushes to main, merges, touches PRs, resolves a ticket awaiting confirmation, or continues the work. NOT for moving to a fresh session (/handoff-session writes a paste-able prompt and stops); this keeps the same session alive across compaction.

  • Commits and pushes

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 13 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the home the active skill already owns.

    line 23
  2. Very specific:

    If the home has nowhere natural for open items and the next step (CONTEXT.md, for example), put those in .scratch/<slug>/checkpoint.md next …

    line 39
  3. Distinctive:

    When two skills are active at once (grill-with-docs inside a wayfinder ticket, say), write each piece to its natural home, terms to …

    line 44
  4. Distinctive:

    If it needs one (the terms were agreed but their meaning never was), list it as open instead.

    line 52
  5. Distinctive:

    Write it for an agent reading cold after compaction:

    line 55
  6. Distinctive:

    Don't edit the receiving item.

    line 61
  7. Distinctive:

    Commit only onto the branch this session has been working on (one it created, or the feature branch Kyle started it on).

    line 72
  8. Very specific:

    Write a descriptive message (e.g.

    line 80
  9. Distinctive:

    If the folder isn't a git repo, write the checkpoint file and stop there.

    line 85
  10. Very specific:

    Run git status --porcelain and git rev-list --count @{u}..HEAD (skip both outside a git repo).

    line 91
  11. Distinctive:

    Safe to compact: only when none of this session's files show as modified or untracked, the ahead count is 0, and nothing said in …

    line 94
  12. Distinctive:

    Saved to disk, not pushed: when there's nothing to push to: the folder isn't a git repo, or the repo has no remote.

    line 100
  13. Distinctive:

    If you mention context size, point to the status line.

    line 111
  14. Distinctive:

    When the verdict is not yet, the first line becomes "Not yet": what would be lost (cite the local SHA if there is one) and the one step …

    line 141
  15. Distinctive:

    When the verdict is saved to disk, not pushed, the first line says so: "Saved to disk, not pushed: <not a git repo | committed locally …

    line 145
  16. Distinctive:

    Leave out the line about other sessions' files unless their state changed.

    line 156

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

pre-compact — save what's settled, then say whether compacting is safe

Compaction is lossy. Anything agreed in conversation but not written to disk can come back garbled or not at all. This skill is a checkpoint only: write the state down, push it, and give a verdict. Don't advance the work, tidy files, or "improve" anything along the way, because the session continues after compaction and the next turn picks up from what you saved.

1. If "/compact" arrived as a message, say so in one line

/compact is a built-in that only runs when Kyle types it at an idle prompt; sent mid-turn, it reaches you as plain text. Before any tool call, say in one line that it didn't run because it arrived mid-turn, and that you're saving the session first. The final reply repeats it once, with "type it again now". Never try to run it.

2. Find the durable home

Use the home the active skill already owns. Don't invent a new document type when one of these fits:

Active workHome for what's settled
wayfinder ticketThat ticket's file under .scratch/<effort>/issues/ — a ### Checkpoint — working notes, not the answer entry under ## Comments, with the date
grill-with-docs / domain-modelingCONTEXT.md (terms) and docs/adr/ (decisions), matching the existing files' format
to-specThe spec file, once it's published; before that, the draft goes in .scratch/<slug>/checkpoint.md
to-ticketsThe issue files plus tickets.md, once Kyle approved the breakdown and it's published; before that, the draft breakdown goes in .scratch/<slug>/checkpoint.md
implement / implement-specCommitted work on the branch; progress notes as a comment on the ticket being built
none of the aboveA short .scratch/<slug>/checkpoint.md

Writing a spec or ticket file publishes it as ready-for-agent, where /implement or /implement-spec can pick it up. So before Kyle has approved it, don't write any issue file, spec file, or tickets.md; the draft stays in the checkpoint note.

If the home has nowhere natural for open items and the next step (CONTEXT.md, for example), put those in .scratch/<slug>/checkpoint.md next to it. On a repeat checkpoint in the same session, update your earlier entry in place, with a fresh date stamp marked "(updated)", rather than stacking a second one.

When two skills are active at once (grill-with-docs inside a wayfinder ticket, say), write each piece to its natural home, terms to CONTEXT.md and decisions to ADRs, and make the ticket's checkpoint comment the one index that points to each of them.

3. Write the state down

An edit Kyle already approved but you haven't made yet (terms agreed for CONTEXT.md, for example) is settled work: make it now if you can write it without a new decision. If it needs one (the terms were agreed but their meaning never was), list it as open instead.

Write it for an agent reading cold after compaction:

  • Settled. Each decision with Kyle's actual choice: whether Kyle took your recommendation or picked something else, and what it was.
  • Open. Questions still being worked in this item.
  • Deferred. Each item pushed elsewhere, with the item it went to, named by its title. Don't edit the receiving item. If it doesn't already state the question, say so under what's left.
  • Files touched this session.
  • Next step. One line a post-compaction agent can act on without rereading anything.

A grilling ticket isn't resolved until Kyle confirms shared understanding. Leave its Status:, claim, and open state alone, and don't write the formal Answer or touch the map's Decisions-so-far.

4. Commit and push the feature branch

  • Commit only onto the branch this session has been working on (one it created, or the feature branch Kyle started it on). If HEAD is on the default branch, or on a branch this session hasn't been working on, don't switch branches or commit. Other sessions may share this checkout, and moving HEAD moves it for them too. Write the files, and give the not yet verdict asking Kyle which branch to use.
  • Stage only files this session touched, by path. Other sessions' dirty or untracked files stay exactly as they are.
  • Make one checkpoint commit. Don't amend it or follow it with a polish pass. Write a descriptive message (e.g. docs(<effort>): checkpoint <item> before compaction) and end it with the attribution lines the session's system reminder gives.
  • git push -u origin <branch>. Never push to the default branch, merge, open or close a PR, or close a ticket. Those wait for Kyle. If the push fails, don't touch remote or upstream config; report it and hand the fix to Kyle.
  • If the folder isn't a git repo, write the checkpoint file and stop there; never run git init. If the repo has no remote at all (git remote prints nothing), commit onto this session's branch and stop; never add one. Both get the on-disk verdict in step 5.

5. Check readiness against git, not memory

Run git status --porcelain and git rev-list --count @{u}..HEAD (skip both outside a git repo). Then the verdict is:

  • Safe to compact only when none of this session's files show as modified or untracked, the ahead count is 0, and nothing said in conversation is missing from what you wrote. Reread the last few exchanges for any choice or caveat you skipped. "No upstream configured" counts as not pushed. Pushed is the bar because it puts the notes off this machine and in reach of other sessions.
  • Saved to disk, not pushed when there's nothing to push to: the folder isn't a git repo, or the repo has no remote. Everything is written (and committed, if it's a repo), so compacting is safe for this session, but nothing is off this machine. Say exactly that. A remote that exists but rejected the push is not yet, not this.
  • Not yet otherwise, naming exactly what would be lost (e.g. "the push failed: no upstream", "your last answer, on rest days, isn't in the ticket yet", "nothing is committed: HEAD is on main, which branch should it go on?").

Other sessions' dirty files don't affect the verdict. Mention them in one line as left untouched.

If you mention context size, point to the status line. Never state a token count.

6. Reply in this shape

Name every ticket, decision, or finding by its title, or gloss any ID on first use (ticket 03 (how rest days pass)). Number settled items by the active skill's own question numbers (Q1, Q4, ...) when it numbered them; otherwise 1 to N.

Everything from this <session kind> is saved: commit <sha>, pushed to <branch>. <If
/compact arrived mid-turn: "Your /compact didn't run because it arrived while I was
mid-turn. Type it again now and it will." Otherwise: the verdict sentence.>

Where it stands. <N> questions are settled, and <you took my recommendation on each |
you took it on all but #k, where you chose …>:
<1. or Q1.> <Plain-language gist of a settled decision>
...

<Open items in this <ticket | item>, including a next question not yet asked, or
"Nothing on this ticket is left to ask."> <Each deferral:
"X goes to "<other item's title>".">

<One thing I need from you: … — e.g. confirm the summary above is our shared
understanding, after compacting or right away. Once you do, I'll: <the resolve steps
the active skill takes next>.> (Omit if nothing is needed.)

The full notes are in <the home>:
code "<absolute path>"

When the verdict is not yet, the first line becomes "Not yet": what would be lost (cite the local SHA if there is one) and the one step that fixes it. Keep the rest of the shape, and don't tell Kyle to type /compact.

When the verdict is saved to disk, not pushed, the first line says so: "Saved to disk, not pushed: <not a git repo | committed locally (<sha>), no remote>. Safe to compact this session; nothing is off this machine." Keep the rest of the shape.

Follow-up: "So I'm good to compact now?"

Answer only that question. Rerun step 5, and recheck any edit the checkpoint listed as open: is it still open, or written since? If it's clean, reply in one or two lines: yes, <sha> is on origin/<branch>, and nothing since the checkpoint exists only in conversation. If something new was settled after the checkpoint, save it (steps 3–4) and answer "Yes, now", naming what you just saved in a few words, with the new SHA. Leave out the line about other sessions' files unless their state changed. Don't repeat the full summary.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.