agentleFS
valsecchi75valsecchi75/project-scaffolder/skills/context-manager/SKILL.md

context-manager

Skill9 starsChanged 3 months agoMITView on GitHub

Use at the end of every task in a scaffolded project and whenever the session context grows heavy. Enforces the context threshold, generates the continuation prompt for the next chat, and applies context minimalism rules. Triggers on "context check", "continuation prompt", "handoff", or context warnings.

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Update wiki/handoff.md (≤80 lines): done, in progress, next, files to read.

    line 23
  2. Very specific:

    Update wiki/priorities.md (≤100 lines): checkbox states current.

    line 24

“Common” is measured: kept by at least 6 in 10 of the 10 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

Context Manager

Overview

Keeps sessions inside a healthy context window. The wiki is long-term memory; the chat is working memory that must be renewed BEFORE quality degrades (context rot).

Core principle: hand off proactively at the threshold, never reactively at the limit.

Threshold Check (after every completed task)

  • Threshold: 300k tokens by default — configurable via the "Context threshold" line in the project CLAUDE.md.
  • Estimate consumption from: system context warnings, number/size of files read this session, conversation length. When in doubt, assume you are CLOSER to the threshold than you think.
  • Below threshold → continue normally.
  • Above threshold → no new activities. Finish the current activity if nearly done, then run the Handoff Procedure.

Handoff Procedure

  1. Update wiki/handoff.md (≤80 lines): done, in progress, next, files to read.
  2. Update wiki/priorities.md (≤100 lines): checkbox states current.
  3. Generate the Continuation Prompt (template below, ≤40 lines) and print it as the final message so the user can paste it into a fresh chat.
  4. Update daily-log/YYYY-MM-DD.md.

Continuation Prompt Template

# Continue: {project} — Phase {N}

Read in order (nothing else):
1. CLAUDE.md
2. wiki/handoff.md
3. docs/phases/PHASE-{N}-execution.md

State: activities {list} DONE; activity {n} IN PROGRESS at {exact point}.
Next: activity {n} — {description}. VERIFY: {criterion}.
Mode: {Normal/Autopilot/Autonomous}. Context threshold: {X}k.
Do NOT re-read: {stable files already processed}.

Context Minimalism Rules

Injected into every generated CLAUDE.md:

  1. Wrong path → /rewind + re-prompt with the lesson learned. Never pile inline corrections on a polluted context.
  2. Between large tasks → /clear + written brief (the Execution Doc activity is the brief).
  3. /compact always with a hint ("keep decisions and current activity state").
  4. Inject the minimum: link wiki pages instead of pasting them; excerpts over full files.

Anti-Patterns

Don'tDo instead
Push through the threshold "to finish the phase"Hand off — the next chat finishes with fresh quality
Write a continuation prompt >40 linesThe wiki holds the detail; the prompt only points
Correct a derailed session inline for the third time/rewind, add the lesson to the prompt, go again

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.