agentleFS
itsmuskanagarwalitsmuskanagarwal/claude-pack/skills/session-state/SKILL.md

session-state

Skill0 starsChanged 4 months agoMITView on GitHub

Maintain a state file so a task can resume correctly across sessions, compaction, or a handoff to another agent. Use for any task expected to span more than one session, before /clear on an in-progress task, when a session-hygiene check flags an upcoming compaction, or when handing work to a subagent via the Task tool. Without this, decisions and context are lost the moment the session ends.

5 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

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

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 4

    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:

    Before proposing or executing /clear.

    line 33
  2. Distinctive:

    When session-hygiene flags the context is near compaction.

    line 34
  3. Distinctive:

    When spawning a subagent to continue or take a slice of this task, pass a self-contained brief — the subagent has no memory of this session:

    line 42
  4. Very specific:

    Read docs/state/<task-slug>.md in full before touching any code.

    line 62
  5. Distinctive:

    Treat "Next step" as the literal starting instruction, not a suggestion to re-derive from scratch.

    line 63
  6. Distinctive:

    If Decisions and current code disagree (code changed since last write), say so before proceeding — don't silently trust a stale file.

    line 65

“Common” is measured: kept by at least 6 in 10 of the 5 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
<!-- owner: Muskan, added: 2026-07-16, model: claude-sonnet-5, review: quarterly -->

Session State

File location and format

One file per task: docs/state/<task-slug>.md. Four sections, always in this order, always present even if empty (write "none yet"):

# <task-slug>

## Decisions
- <date/turn> — <decision> — <one-line why>

## Files touched
- <path> — <what changed, one line>

## Next step
<the single next action, stated so a fresh session with no other context
could execute it. Not "continue the refactor" — "run
`npm test -- billing.spec.ts`, fix the 2 failing assertions listed in
Decisions, then move to the pricing module.">

## Open questions
- <question> — <who/what resolves it>

Update triggers (write to the file, don't just hold it in context)

  1. Before proposing or executing /clear.
  2. When session-hygiene flags the context is near compaction.
  3. At each natural checkpoint: a phase transition (Explore→Plan, Plan→Code), a passing test run, a merged/committed chunk of work.
  4. Immediately before spawning a subagent for a related piece of work — write the handoff artifact (below) referencing this file.
  5. On session end for any task not fully closed out.

Handoff artifact (agent-to-agent, via the Task tool)

When spawning a subagent to continue or take a slice of this task, pass a self-contained brief — the subagent has no memory of this session:

## Objective
<what this subagent must accomplish, one or two sentences>

## Constraints
- Allowed paths: <explicit list, not "the codebase">
- Must not: <hard bans carried over from this task, e.g. "do not modify
  the test file", "read-only, report only">

## Prior decisions (from docs/state/<task-slug>.md)
<paste the Decisions section verbatim — don't summarize away specifics>

## Definition of done
<machine-checkable: the exact command(s) that must pass>

Resume procedure (start of a session that has a matching state file)

  1. Read docs/state/<task-slug>.md in full before touching any code.
  2. Treat "Next step" as the literal starting instruction, not a suggestion to re-derive from scratch.
  3. If Decisions and current code disagree (code changed since last write), say so before proceeding — don't silently trust a stale file.

Anti-patterns

  • Writing "Next step: continue" — if it can't be executed by a reader with zero other context, it isn't done.
  • Letting the file grow unbounded: prune resolved Open questions and superseded Decisions on each update rather than only appending.

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.