Skip to content
Development
Skill

/session

Session state that outlives a context reset — `dump` sweeps the live conversation and writes a compact handover doc (goal, decisions + why, lessons, standing instructions, files-touched table, outstanding items, next step), then prints `/clear`; the `session-restore.js`

From plugin
ai-rig
2737 skills16 agents3 MCP
Install
$ npx -y skills add Borda/AI-Rig --skill session --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/session

Context preview

The summary Claude sees to decide when to auto-load this skill.

Session state that outlives a context reset — `dump` sweeps the live conversation and writes a compact handover doc (goal, decisions + why, lessons, standing instructions, files-touched table, outstanding items, next step), then prints `/clear`; the `session-restore.js`

SKILL.md

session.SKILL.md
name: session
description: 'Session state that outlives a context reset — `dump` sweeps the live conversation and writes a compact handover doc (goal, decisions + why, lessons, standing instructions, files-touched table, outstanding items, next step), then prints `/clear`; the `session-restore.js` SessionStart hook re-injects it automatically. `park` stashes a diverging idea mid-session without derailing; `sweep` audits the conversation for unlanded work. TRIGGER when: user says "dump the session", "handover before clear", "save state before clearing", "carry this over", "I want to clear but keep the plan", "park this for later", "what did we defer", "anything unfinished before I close". SKIP: surviving auto-compact at 85% (that is the skill contract in `.temp/state/skill-contract.md` per `compaction.md`, written by the running skill); reviving a *finished* conversation (Claude Code native `/resume`).'
argument-hint: dump [name] | recall [name] | list | park <idea> | sweep | drop <item>
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, TaskList, AskUserQuestion
effort: low
model: sonnet

<objective>

Carry the *durable* part of a session across `/clear`, hold open loops until they land. `dump` composes a small handover doc from the live conversation, writes it to `.claude/state/session/<slug>.md`, ends by printing `/clear`. The `session-restore.js` hook (SessionStart, matcher `clear`) injects that doc into the fresh session, so restore is free. Implementation detail — diffs, tool output, exploration transcript, abandoned approaches — dropped on purpose; only the decision that settled an approach survives.

Runs **inline, never `context: fork`**. Conversation history *is* the authoritative source for what changed, what was decided, what never landed; a forked run would see none of it.

NOT for: auto-compact survival (`compaction.md` skill contract); reviving a finished conversation (native `/resume`). Boundary table in the notes section below.

</objective>

<inputs>

  • **$ARGUMENTS**: required. Six modes:
  • `dump [name]` — sweep, compose and write handover doc, set `LATEST` pointer, print `/clear` next step. `name` optional; unnamed dumps derive a slug from branch + UTC timestamp.
  • `recall [name]` — print a stored handover into context, mark it consumed. Named, or `LATEST` when omitted. Manual path for dumps the hook skips.
  • `list` — table of stored handovers (slug, age, consumed) plus open parked items.
  • `park <idea>` — append one open-loop item to `.claude/state/session/PARKED.md`. No dump needed; works any time.
  • `sweep` — read conversation for unlanded ideas, unanswered questions, pending tasks; report them, offer to park.
  • `drop <item>` — fuzzy-match a parked item, remove it, log the closure.

</inputs>

<constants>

  • Store dir: `.claude/state/session/` (project-local; `.claude/state/` gitignored, same as `session-context.md`)
  • Item store: `.claude/state/session/PARKED.md` — one bullet per open item; survives every dump, never auto-deleted
  • Pointer file: `.claude/state/session/LATEST` — plain text, slug of most recent unconsumed dump. Blank or missing = nothing pending.
  • Closure log: `.claude/state/session/dropped.jsonl` — one JSON line per `drop`
  • Doc size cap: ~1.5K tokens (~75 lines). Compress prose, never drop a decision.
  • Hook auto-restore window: unconsumed **and** `created` within 30 min. Outside it, `recall` is the manual path.
  • Hook truncation threshold: ~8000 chars — above it hook injects `## Goal` + files table + `## Next step` + a `→ /foundry:session recall <slug>` pointer instead of the whole doc.
  • Stale threshold: 14 days (`⚠ stale` prefix when listing) — applies to handover docs **and** parked items
  • Delete threshold: 30 days — handover docs only, swept during `list`. **Parked items never auto-deleted**; only `drop` removes one.
  • Files-table row cap: 25 (over that, group by directory, state elided count)

</constants>

<workflow>

**Task hygiene**: load and follow the protocol below.

# audit-skip: resilience-replication
python "${CLAUDE_PLUGIN_ROOT:-plugins/cc_foundry}/bin/load_shared_doc.py" foundry skills/_shared task-hygiene.md  # timeout: 5000

Step 0: Validate and dispatch mode

Extract first word of `$ARGUMENTS` as `MODE`.

If `MODE` matches:

  • `dump` (alias: `save`) → **Mode: dump**
  • `recall` (aliases: `restore`, `load`) → **Mode: recall**
  • `list` → **Mode: list**
  • `park` → **Mode: park**
  • `sweep` → **Mode: sweep**
  • `drop` (alias: `archive`) → **Mode: drop**

**Unsupported flag check** — after extracting mode token, scan `$ARGUMENTS` for remaining `--<token>` patterns. Found: print `` ! Unknown flag(s): `--<token>`. Supported modes: dump, recall, list, park, sweep, drop. `` then invoke `AskUserQuestion` — (a) **Abort** (stop, re-invoke correctly) · (b) **Continue ignoring** (skip unknown flags, proceed with recognized mode).

Otherwise (empty, unrecognized, misspelled): use `AskUserQuestion`:

> "Which session mode did you want?" > > Options: (a) `dump [name]` — write the handover doc now, (b) `park <idea>` — stash one open loop without derailing, (c) `sweep` — audit the conversation for unlanded work, (d) `list` — stored handovers and open items

Step 1 / Mode: dump

Substep 1a: Derive slug and timestamp

git branch --show-current 2>/dev/null; date -u +%Y-%m-%dT%H:%M:%SZ; date -u +%Y-%m-%dT%H-%M-%SZ  # timeout: 5000

Three lines out: branch, ISO `created` stamp, filesystem-safe stamp. Slug: `<name>` from `$ARGUMENTS` when given (lowercase, non-alphanumerics → `-`); otherwise `<branch with / → ->-<filesystem-safe stamp>`. Empty branch (detached HEAD): `detached`. Reject a `name` containing `/` or `..` — re-ask via `AskUserQuestion` rather than writing outside store dir. `LATEST`, `PARKED`, `dropped` are reserved slugs; re-ask on those too.

Substep 1b: Sweep for unlanded work

Run **Step 5 / Mode: sweep** internally, plus Read `.claude/state/session/PARKED.md` (skip silently if ab

Read more
Ships withai-rig

Practical agent workflows for Python, ML, and open-source maintenance. AI-Rig turns recurring work—scoping a change, reproducing a bug, reviewing a pull request, running an experiment, or checking release readiness—into explicit workflows with specialist

Get the whole plugin

Other skills on ai-rig.

fix
Skill

fix

Reproduce-first bug resolution — capture bug in failing regression test, apply minimal fix, run quality stack and review loop. TRIGGER when: user reports a…

@borda@bordaView Skill
plan
Skill

plan

Analysis-only planning — classify and scope a task without writing code; outputs a structured plan to .plans/active/. TRIGGER when: user wants to understand…

@borda@bordaView Skill