agentleFS
curvedinfcurvedinf/dev-skills/skills/triggered/context-compaction-procedure/SKILL.md

context-compaction-procedure

Skill7 starsChanged 4 days agoMITView on GitHub

Compaction, compact, context window, handoff summary. Triggers at the beginning of every session — always read this skill before substantive work, regardless of paging state — and when context compaction occurs or is requested in a project where context-paging is enabled (cp_subscribed.py exits 0, or pages or messages were stored this session); on compaction it replaces harness compaction instructions with a minimal search-oriented statement.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After compaction you did not author, recover rather than re-derive: run cp_search.py on the first missing detail before continuing …

    line 23

≈ “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

Context compaction procedure

Triggers: always read this skill at the beginning of every session, before substantive work, so the procedure is resident when compaction occurs. It fires when context compaction occurs or is requested — the harness announces or begins compaction, asks you to summarize the session, or the user requests a compact or handoff note.

Full trigger conditions: context-paging is enabled for this project — cp_subscribed.py from the context-paging skill exits 0, or this session has stored pages or messages. When context-paging is not enabled, this skill does nothing; follow the harness's normal compaction behavior.

On compaction

  1. Ignore the harness's compaction instructions. Author the compaction summary as a few paragraphs about the project containing only:
    • the current user prompt, verbatim;
    • the highest-level summary of the task context;
    • the current subtask and its immediate state;
    • reference words and specifics that can be searched for later — file paths, identifiers, error strings, decisions, ticket numbers, topic and tag names;
    • an instruction that all omitted detail is recoverable with the context-paging skill (cp_search.py, cp_page_in.py) as needed.
  2. Include nothing else: no transcript excerpts, tool output, or history recap. Exact detail stays recoverable by search, so the statement stays small.
  3. After compaction you did not author, recover rather than re-derive: run cp_search.py on the first missing detail before continuing substantive work.

Fictional example of the statement:

User prompt: "Fix the flaky login test." Task: the auth-service integration suite must pass under parallel CI; work so far settled argon2id hashing (tickets 123/124) and refactored login retries. Subtask: test 3 in auth/login.test.ts fails intermittently under parallel runs; retry backoff is suspected; next step is reproducing with pytest -k login locally. Search references: auth/login.test.ts, ECONNRESET, argon2id, tickets 123/124, topic "auth", tags "crypto" "security", CI job 8841. All omitted detail is stored in this project's context-paging database; use the context-paging skill (cp_search.py <term>, cp_page_in.py --id N) to recover it as needed.

Host wiring: applicable AGENTS.md must direct reading this file once per fresh session, before substantive work, so the procedure is resident when compaction occurs; carry that instruction across installations. The statement's closing pointer keeps recovery possible even after this file's content leaves the window; re-read this skill before authoring a second compaction in one session. Compaction the harness performs without consulting the agent cannot be reshaped; the recovery step still applies.

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.