agentleFS
hishamashraf585hishamashraf585/compact-handoff-skill/skills/compact-handoff/SKILL.md

compact-handoff

Skill0 starsChanged 3 months agoMITView on GitHub

Build a complete, copy-paste `/compact <instructions>` handoff that preserves the ENTIRE working state of the current session so NOTHING is lost when the conversation is compacted. Use whenever the user asks to "compact", "compact prompt", "compact the prompt", "make/give me the compact command", "the command to write after /compact", "prepare a compaction handoff", "summarize the session for /compact", "handoff before compacting", "don't lose anything before we compact", "save the session so we don't lose it", or any request to produce the text to feed the `/compact` command. Also updates the project KB / long-term memory first (when one exists) so the durable record is complete too.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. AidALL/ghost-alice★ 15same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If no such store exists, just note that in the block.

    line 30
  2. Very specific:

    Write the EXACT same block (verbatim, starting with /compact ) to ~/compact-handoffs/compact-prompt.txt — plain .txt so the browser renders …

    line 42
  3. Very specific:

    If a server for THIS directory is already up, reuse its port instead of spawning a duplicate: check ss -ltnp | grep :<PORT> then readlink …

    line 60
  4. Very specific:

    Access & credentials: Every host/IP/URL, SSH user + password/key, API tokens, DB names + creds, app logins, master/admin passwords, and the …

    line 76
  5. Distinctive:

    Key gotchas / traps: Every hard-won lesson, version quirk, tool limitation, and "don't relearn this" fact discovered this session.

    line 88
  6. Very specific:

    One /compact ... block, fenced: Not prose, not multiple blocks.

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Compaction Handoff Builder

/compact condenses the in-context conversation and can silently drop concrete details (credentials, IDs, file paths, decisions, half-finished threads). This skill produces a single, dense, copy-paste /compact <instructions> block that re-injects the full working state so the fresh post-compaction context can continue seamlessly with nothing lost.

The user will paste your block as their /compact command (or type /compact and paste it as the argument). Your job is to make that argument a perfect handoff.

Procedure

  1. Save durable memory FIRST (do this before emitting the block). Compaction only affects the chat window — the real long-term memory is on disk. If this session did any substantive work AND a project KB / memory file / MEMORY.md / CLAUDE.md-linked memory exists (or the user has an agentmemory/KB system), append the session's latest work there now so the durable record is complete regardless of compaction. Then have the /compact block point back to it. If no such store exists, just note that in the block.
  2. Reconstruct the session EXHAUSTIVELY. Re-read back over the WHOLE conversation — do not summarize from fuzzy memory, and do not paraphrase loosely. Extract every concrete fact across the categories below. Compaction's whole failure mode is losing specifics, so the handoff must be built from a careful re-read.
  3. Emit ONE fenced code block that starts with /compact followed by the organized instructions. It must be copy-paste-ready as a single command.
  4. Also serve it as a URL (recommended — especially on a headless/remote box). The block is long and terminal-copying is lossy, so hand the user a URL too whenever you can:
    • Write the EXACT same block (verbatim, starting with /compact ) to ~/compact-handoffs/compact-prompt.txt — plain .txt so the browser renders raw text that Ctrl+A / Ctrl+C copies cleanly with no markup. Overwrite it each time (it's the "latest handoff"). Optionally also keep a dated copy compact-prompt-YYYY-MM-DD-HHMM.txt in the same dir for history.
    • Serve that directory over HTTP bound to all interfaces, detached (exit-144 rule — a .sh + setsid, never inline backgrounding):
      cat > ~/compact-handoffs/serve.sh << 'EOF'
      #!/bin/bash
      cd ~/compact-handoffs && nohup python3 -m http.server <PORT> --bind 0.0.0.0 >/tmp/serve-<PORT>.log 2>&1
      EOF
      chmod +x ~/compact-handoffs/serve.sh
      setsid ~/compact-handoffs/serve.sh >/dev/null 2>&1 </dev/null & disown
    • Pick a genuinely FREE port — many are already taken by old servers on this box, and a busy port fails silently with "Address already in use" while the OLD server keeps answering (you'll get a 404 from the wrong directory, not an error). Find one first: for p in $(seq 8900 8950); do ss -ltn 2>/dev/null | grep -q ":$p " || { echo "FREE:$p"; break; }; done If a server for THIS directory is already up, reuse its port instead of spawning a duplicate: check ss -ltnp | grep :<PORT> then readlink /proc/<pid>/cwd.
    • Verify before handing it over (in a separate call): curl -s -o /dev/null -w '%{http_code}' http://localhost:<PORT>/compact-prompt.txt must be 200 with a non-trivial byte count, and the first bytes must start with /compact . Also confirm the public URL answers 200.
    • Give the public-IP URL as a primary way to get the block: http://<YOUR_PUBLIC_IP>:<PORT>/compact-prompt.txt — never a bare /home/... path alone.
  5. Tell the user the block is ready — present BOTH the inline fenced block AND the URL — that they can paste it after /compact, and that the durable memory/KB (if any) also holds it, so even a bare /compact wouldn't lose the on-disk record.

The handoff MUST include every category below that applies (be exhaustive — skip one only if truly N/A)

  • Pointer to the source of truth. Exact path(s) of any KB / memory / notes file that holds the full record, and an instruction to reload it if context is missing. Put this FIRST.
  • Access & credentials. Every host/IP/URL, SSH user + password/key, API tokens, DB names + creds, app logins, master/admin passwords, and the EXACT command pattern to reach each system (including any fallback channel or proxy hop). Include working values — losing a credential breaks continuation. If an MCP/tool is broken or was reconfigured this session, say so and give the workaround.
  • Infrastructure / environment. Servers, containers, ports (and where they're bound), file paths, services, config locations + their backups, versions, resource limits, network/firewall state, and any ID maps or naming conventions in play.
  • Work done this session. Each substantive change with SPECIFICS: what, where, exact names/IDs, modules/files created or edited, migrations/data changes + row counts, and how it was verified. Enough that a fresh agent could describe or undo any of it.
  • Open items / next-session TODO. Everything unfinished, blocked, deferred, or awaiting a user decision — each concrete and actionable (include the exact fix/command where known).
  • Key gotchas / traps. Every hard-won lesson, version quirk, tool limitation, and "don't relearn this" fact discovered this session.
  • File paths, backups, IDs, exact commands. Backup file locations, important record IDs, reusable command snippets, deploy methods, lock/coordination patterns.
  • Decisions & assumptions. Choices made and WHY, plus any assumption that a change relied on (so it can be revisited).

Rules

  • Completeness beats brevity. This is the one place verbosity is correct. Never drop a credential, path, ID, or open thread to save space.
  • Exact values only. Real IPs, passwords, tokens, DB names, account codes, record IDs, filenames — not "the server" / "the password" / "some account."
  • Include secrets the session used. This is the user's own continuation of their own environment; omitting a token/password would break the next session. (Do not invent any; only carry forward what actually appeared.)
  • One /compact ... block, fenced. Not prose, not multiple blocks. Organized with clear === SECTION === headers so the summarizer preserves structure.
  • Point to durable memory at the top and bottom so nothing depends solely on the summary.
  • Adapt the sections to the session's actual domain (coding, ops, research, writing, trading, etc.) — the template is a scaffold, not a fixed schema.

Format template (adapt sections to the session)

/compact FULL SESSION HANDOFF — <one-line topic>. AUTHORITATIVE SOURCE = <KB/memory/notes path(s)>; reload if any detail is missing. Preserve EVERYTHING below verbatim.
=== ACCESS / CREDENTIALS === <hosts, users, passwords, tokens, DB creds, logins, exact reach commands, broken-tool workarounds>
=== INFRASTRUCTURE / ENVIRONMENT === <servers, containers, ports+binding, paths, configs+backups, versions, limits, ID maps>
=== WORK DONE THIS SESSION === <each change with exact names/IDs/files + how verified>
=== OPEN ITEMS / NEXT-SESSION TODO === <each unfinished/blocked/decision-pending item, concrete>
=== KEY GOTCHAS === <every trap/quirk/limitation learned>
=== FILE PATHS / BACKUPS / IDs / COMMANDS === <backup locations, record IDs, reusable commands, deploy method>
=== DECISIONS & ASSUMPTIONS === <choices + why, assumptions to revisit>

Anti-patterns (do NOT do these)

  • Vague summaries ("we did some Odoo work") — always name the exact modules/records/commands.
  • Dropping credentials/tokens/paths "for brevity" or safety — they are required to continue.
  • Emitting multiple blocks, or prose the user must reassemble — emit ONE ready-to-paste block.
  • Building it from memory instead of re-reading the conversation for exact values.

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.