agentleFS
catcatcatstudiocatcatcatstudio/cat-skills/.cursor/skills/memento/SKILL.md

memento

Skill3 starsChanged 3 months agoMITView on GitHub

Context handoff for fresh sessions. Saves unsaved session knowledge to notebook, then produces a short orientation block to paste into a new chat. Use when user says '/memento', 'hand off context', 'prepare for fresh chat', 'save and brief', or before clearing context. NOT for: recovering context (use /notebook recover) or saving a single note.

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

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

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 2

    Distinctive

    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. Distinctive:

    Before generating the handoff, assess whether this session has unsaved knowledge.

    line 48
  2. Distinctive:

    Read available context to ground the orientation:

    line 70
  3. Very specific:

    Add .memento-handoff to your global gitignore (~/.gitignore_global) — it's a temp file that gets cleaned up after injection.

    line 165

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

Memento

Save what matters, then produce a handoff for the next chat.

Commands

CommandAction
/mementoNotebook triage + generate handoff
/memento autoShow whether auto-compaction safety net is on or off
/memento auto onEnable auto mode (preserves context across compaction)
/memento auto offDisable auto mode

/memento auto

The auto-compaction safety net is controlled by a flag file at ~/.claude/.memento-auto.

  • /memento auto — check if ~/.claude/.memento-auto exists. Report: Memento auto: on or Memento auto: off. One line, nothing else.
  • /memento auto on — create ~/.claude/.memento-auto (touch). Report: Memento auto: on. If hooks aren't configured yet, show the setup block from the Auto-Compaction section below.
  • /memento auto off — remove ~/.claude/.memento-auto. Report: Memento auto: off.

What this does

Two things, in order:

  1. Persist — scan the conversation for unsaved decisions, learnings, constraints, or failures. Save each one via /notebook save. This is the durable part — it survives regardless of whether the user pastes anything.
  2. Orient — produce a short text block that gives a blank chat enough context to pick up where this one left off. This is the ephemeral part — it captures working state that's too in-the-moment for a notebook note.

Execution

Phase 1: Notebook Triage

Before generating the handoff, assess whether this session has unsaved knowledge.

Check signals:

  • Have any /notebook save calls happened this session? How recently?
  • Have decisions been made, constraints discovered, bugs hit, or approaches changed since the last save (or since session start if no saves)?
  • Is there a _notebook/ at all? If not, the entire session is unsaved.

Decision:

  • Session is well-persisted (recent notebook saves cover the important stuff) → skip to Phase 2. Say: Notebook is current — skipping to handoff.
  • Session has unsaved knowledge → save each unsaved decision, constraint, learning, or failure via /notebook save (delegate fully — follow notebook's save protocol for type inference, note format, index and lessons updates). If no notebook exists yet, initialize it first.
  • Session was trivial (no meaningful decisions or learnings, just exploration or small edits) → skip saves. Don't manufacture notes.

Report what you saved:

Saved 3 notes before handoff:
- 0008 decision: switched from REST to WebSocket for live updates
- 0009 constraint: Supabase RLS doesn't support cross-schema joins
- 0010 learning: canvas XOR needs globalAlpha:1 on offscreen canvas

Phase 2: Generate Orientation

Read available context to ground the orientation:

  • _notebook/_index.md (if exists)
  • PROJECT_STATE.md (if exists)
  • Recent git log (git log --oneline -5)
  • git diff --stat and git status for uncommitted work
  • Your own knowledge of what's happening in this conversation

Then produce a short orientation block. This is a baton pass, not a recap — it briefs the next session on the work that remains, not the work that's done. The record of what happened is the notebook's job, and Phase 1 just put it there.

The selection test for every line: would deleting it change what the next session does? If not, it doesn't go in.

The block should be:

  • Short — 10-20 lines. The next chat has a full context window; don't waste it on briefing.
  • Forward-facing — done work gets one positioning clause in the opening line, then appears only where it's a dependency or constraint on the remaining work.
  • Actionable — end with the goal and the next step.
  • Honest — if something is uncertain or incomplete, say so.

Format — bracketed sections that are empty are omitted, never padded:

---

We're working on [what] in [location], currently at [position in the work].

[Working tree dirty? Say what the diff is FOR and its state — half-finished,
done-but-unverified, or discard-worthy. The next session sees the file list in
`git status`; the intent behind it is the part only you can hand over.]

[Dead ends: approaches tried and abandoned this session that a fresh agent would
plausibly retry. One line each: "Don't retry X — fails because Y (note NNNN)."]

[Decisions waiting on the user. If the session ended blocked on one, lead with it.]

Next: [the goal, then the immediate step toward it — enough intent that the next
session can re-derive the plan if the literal step turns out moot.]

For full context: read `_notebook/_index.md` and `_notebook/lessons.md`, or run `/notebook recover`.

---

That's it. Don't add headers, tiers, or ceremony. Just a clean block of text.

Output

Print the orientation block directly. Then one line — dry, brief, Memento-flavored. Examples:

  • Don't trust your memory. Paste this.
  • You won't remember any of this. Copy it.
  • The next you starts from zero. This is what you left yourself.

Pick one or riff on the tone. No explanation, no instructions beyond the line.

Auto-Compaction Safety Net

Memento includes hook scripts that automatically preserve context when auto-compaction fires — no manual /memento needed.

How it works:

  1. PreCompact → scripts/pre-compact.sh reads the transcript, extracts last 5 user messages + last assistant response, writes to .memento-handoff
  2. Compaction runs (most context lost)
  3. SessionStart(compact) → scripts/post-compact.sh reads .memento-handoff, injects it into the post-compaction context with a recovery directive

Setup — add to ~/.claude/settings.json:

{
  "hooks": {
    "PreCompact": [
      {
        "matcher": "auto",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/memento/scripts/pre-compact.sh"
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "compact",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/memento/scripts/post-compact.sh"
          }
        ]
      }
    ]
  }
}

Toggle with /memento auto on and /memento auto off. The hooks stay in settings permanently — the flag file controls whether they do anything.

Add .memento-handoff to your global gitignore (~/.gitignore_global) — it's a temp file that gets cleaned up after injection.

Rules

  1. Notebook save is the real work. The orientation block is a nice-to-have. Even if the user never pastes it, the notebook saves ensure nothing is lost.
  2. The orientation is a baton pass, not a recap. The notebook holds what happened; the orientation holds only what changes what the next session does. Don't duplicate notebook content — the next session can /notebook recover.
  3. Don't repeat CLAUDE.md. Project conventions load automatically. Don't waste orientation space on them.
  4. Be concrete. File paths, function names, error messages > vague descriptions.
  5. For uncommitted work, hand over the intent, not the inventory. git status already shows the files. What it can't show is what the diff is trying to do and whether it can be trusted — that's the part the handoff carries.

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.