Capture the current session as atomic Zettelkasten notes in the memento vault.
-
Scan the current session for distinct ideas: decisions made, things discovered, patterns identified, bugs fixed, tools built or configured.
-
Search existing notes in the vault's notes/ directory for related topics. Use Glob and Grep to check what's already there. Do not create duplicates — if a note already covers the same idea, update the Related section with a link instead.
-
Create atomic notes in the vault's notes/ directory. One idea per file. Each note must have:
---
title: Short descriptive title
type: decision | discovery | pattern | bugfix | tool
tags: [relevant, tags, here]
source: manual
certainty: 1-5
validity-context: what makes this true or false
supersedes: "[[note-name]]" or omit
project: /full/path/to/working/directory
branch: branch-name-if-applicable
date: YYYY-MM-DDTHH:MM
session_id: current-session-id
---
Certainty scale: 1 = speculative (untested idea), 2 = observed once (single session), 3 = confirmed in code (read it, verified), 4 = tested/shipped (PR merged), 5 = established pattern (seen across multiple tickets).
validity-context: a short phrase describing what this note depends on. Examples: "while on feature branch X", "requires lib >= 2.0", "only in local dev". Omit if the note is unconditionally true.
supersedes: if this note replaces an older one, link it. The older note stays in the vault but search should prefer the newer one.
Body: the insight in 2-5 sentences. Context for why it matters. A ## Related section at the bottom with [[wikilinks]] to related existing notes.
File naming: slugified concept title. redis-cache-requires-explicit-ttl.md, not 2026-03-05-session.md.
-
Sanitize before writing. Before writing any note to disk, scan the body and frontmatter for sensitive data and replace it with a generic descriptor. Strip:
- AWS account IDs (12-digit numbers in AWS contexts) →
[AWS account]
- API keys / tokens / secrets (long alphanumeric strings,
sk-*, xoxb-*, bearer tokens) → [redacted]
- Kennitala (Icelandic national IDs, 10-digit
DDMMYY-XXXX) → [kennitala]
- Email addresses in note bodies (keep only if the email is the subject of the note, e.g., a contact flow design) →
[email]
- Internal hostnames / IPs (RFC 1918 addresses,
*.internal, *.local) → [internal-host]
- IAM usernames / ARNs → describe the role generically (e.g., "personal IAM user")
- Database connection strings →
[connection-string]
Keep domain names that are public (e.g., vicvalenzuela.com, fundid.is) — those are fine. The goal is to prevent credential and identity leaks if the vault is ever shared, synced, or indexed. When in doubt, strip it — the session transcript has the original values if needed later.
-
Update the project index in the vault's projects/ directory. Detect the project from the working directory and branch. Add [[note-name]] links under ## Notes and a session line under ## Sessions. Create the project index if it doesn't exist, using this template:
---
title: Project Name
project: /full/path/to/working/directory
branch: branch-name
---
## Notes
## Sessions
-
Run post-capture extensions. Check if ~/.claude/skills/memento-post/SKILL.md exists. If it does, read it and follow its instructions. This is the extension point for project-specific workflows (e.g., promoting notes to a team vault, tagging with domain-specific labels, notifying external systems). Skip this step if the file doesn't exist.
-
Commit to vault repo. After all writes are done, run:
~/.claude/hooks/vault-commit.sh "memento: [short description of what was captured]"
-
Sync to remote vault. If ~/.claude/memento-remote.env exists, sync each note you created to the remote vault:
(set -a; . ~/.claude/memento-remote.env; set +a; python3 ~/.claude/hooks/memento-remote-sync.py <note-paths>)
Replace <note-paths> with the paths of notes you just created. The script is a no-op if MEMENTO_VAULT_URL is not set. Skip this step entirely if ~/.claude/memento-remote.env does not exist.
-
Trigger Inception check. Manual captures bypass SessionEnd triage, so Inception's threshold check doesn't fire automatically. Run it explicitly:
python3 ~/.claude/hooks/memento-inception.py --verbose 2>&1 | tail -5
This is a no-op if Inception is disabled, if there aren't enough new notes, or if another instance is already running. It runs in the foreground but returns quickly (~20ms) if the threshold isn't met.
-
Confirm to the user what was captured: list the notes created and links added. Include any output from post-capture extensions.