with one click
memory
// Structured memory management system. This skill is always active — it governs how agents read, write, and organize memory across sessions. Use the tiered memory directory structure for all persistence.
// Structured memory management system. This skill is always active — it governs how agents read, write, and organize memory across sessions. Use the tiered memory directory structure for all persistence.
| name | memory |
| description | Structured memory management system. This skill is always active — it governs how agents read, write, and organize memory across sessions. Use the tiered memory directory structure for all persistence. |
Your workspace has a structured memory system. Follow these rules for all memory operations.
memory/
├── TODAY.md # Today's working log (primary write target, archived daily)
├── SUMMARY.md # Consolidated index + key rules (generated by maintenance)
├── MEM_REGISTRY.md # [MEM-xxx] key registry — source of truth for tracked memories
├── core/ # Long-term curated facts (high signal, regularly pruned)
│ ├── PREFERENCES.md # User/team preferences and communication style
│ ├── LEARNINGS.md # Key lessons learned from experience
│ └── MISTAKES.md # Past mistakes to avoid repeating
├── daily/ # Archived daily logs (moved from TODAY.md by maintenance)
│ └── YYYY-MM-DD.md # Archived notes from past days
├── semantic/ # Factual knowledge about the team/project/domain
├── episodic/ # Significant events and their outcomes
└── procedural/ # How-to knowledge and workflows
@ imports)Your channel brain CLAUDE.md should include these @ imports:
@memory/SUMMARY.md
@memory/TODAY.md
This ensures both files are included in the system prompt with every API call and survive session compaction. No manual "read at startup" needed — the content is always in context.
memory/SUMMARY.md — consolidated long-term memory: key rules, lessons, and pointers to deeper memory. Generated during maintenance. ~100-150 lines.memory/TODAY.md — today's working log. Updated continuously during sessions. Archived to memory/daily/YYYY-MM-DD.md during maintenance. ~20-50 lines.If these files don't exist yet, create them during the next maintenance cycle (see Migration section).
The daily log is a running scratchpad you append to throughout the session, not a summary you write at the end. Treat it like thinking out loud to your future self.
As you work, append a timestamped one-liner to memory/TODAY.md whenever any of these happen:
Rules:
memory/TODAY.md — this is the primary daily log target. It gets archived to memory/daily/YYYY-MM-DD.md during maintenance.- 09:00 — heartbeat: ran consolidation, archived 3 daily logs or - 09:00 — WF triage ran, 2 failures (created WF-123). Keep it to what was done, not what was skipped.# YYYY-MM-DD# 2026-03-17
- 09:00 — WF triage ran, 2 failures (erpio-gw login, rekap-dev deploy), created WF-123
- 09:15 — heartbeat: completed task "check PR #456 status" — merged, removed from HEARTBEAT.md
- 14:30 — Learned that Alice prefers email over Slack for approvals
- 14:45 — Fixed the deploy script; root cause was missing AWS region
- 15:10 — User corrected: reports should go to #general, not #reports
- 15:42 — Tried to use `gh pr create --draft`; project convention is non-draft PRs
Anti-pattern: finishing a session that involved real tool use (edits, commits, decisions) with zero log entries. If that happens, it means the scratchpad habit failed — fix it next session.
Date rotation: If memory/TODAY.md starts with a date header from a previous day, the maintenance cycle hasn't run yet. Append today's entries below — maintenance will sort it out.
During regular sessions (non-maintenance), you may write to these places:
memory/TODAY.md — primary write targetALL new information goes into the daily log. This includes:
[MEM-NNN] tracked keys (see below)memory/semantic/ — for larger content (pointer pattern)When content doesn't need to be visible at every session start, write it to memory/semantic/{topic}.md and leave a self-contained pointer in TODAY.md.
Decision criterion: "Do I need to see this at every session start?"
TODAY.md (even if it's several lines)semantic/{topic}.md + pointer in TODAY.mdLength is not the deciding factor. A 5-line summary of this week's priorities belongs in TODAY.md. A 1-line detail about a subsystem belongs in semantic/ if it's part of a larger context file.
Pointer format — must be self-contained:
Good (useful even without opening the file):
[fox] Discovery Pipeline v1 spuštěn — 7 zdrojů, pilot run 24.4. Detaily: semantic/fox-discovery-pipeline.md
Bad (forces agent to open the file to understand relevance):
[fox] Detailní analýza uložena do semantic/fox-discovery-pipeline.md
The pointer should contain the key fact or conclusion so the agent knows when to open the file — not just where it is.
Which directory?
semantic/ — default for most content (analyses, reference material, domain knowledge)episodic/ — only for session capture and incidents (clearly dated events)semantic/This pattern also applies to session capture — see the section below for detailed rules on capturing substantial discussions.
Do NOT write directly to memory/core/ files (MISTAKES.md, PREFERENCES.md, LEARNINGS.md) during regular sessions. These files are managed exclusively by consolidation. Write to memory/TODAY.md instead — use [MEM-NNN] keys for important items that must be promoted.
Do NOT self-promote content during regular sessions. Self-promotion means reading old daily logs or existing memory and reorganizing them into semantic/, episodic/, or procedural/. That is maintenance's job — only the consolidation process curates and reorganizes existing content.
Do NOT write directly to memory/daily/YYYY-MM-DD.md — use memory/TODAY.md instead. The daily/ directory is for archived logs managed by maintenance.
Do NOT edit memory/SUMMARY.md manually. It's regenerated by maintenance consolidation.
When a session produces structured content that exceeds what fits in a daily log (brainstorming, design discussions, deep-dive research), capture it directly in memory/semantic/. This is called session capture — writing new content from the current conversation to long-term memory.
Key distinction:
semantic/) — allowedsemantic/) — forbidden during regular sessions, maintenance onlyThe difference is the source: if the content comes from the current conversation, it's session capture. If you're moving content from an old daily log, it's self-promotion.
Follow these steps when a session produces substantial reference material:
0. READ first: Before discussing a known topic, search memory/semantic/ for an existing {topic}.md. If found, read it for continuity — avoid duplicating what's already captured.
1. Recognize the moment: If the content doesn't need to be visible at every session start, it belongs in a separate file. Examples:
TODAY.mdsemantic/{topic}.md + pointer in TODAY.md2. Log breadcrumbs continuously: Write one-liners to TODAY.md throughout the session. These are your crash-safe safety net.
3. Write to semantic/ as soon as you have enough substance: Don't wait for the topic to close or the session to end — neither may happen. Write what you have, even if incomplete. Mark unfinished content with a WIP marker: <!-- WIP: topic not concluded -->
4. Multi-session topics: Append to the existing semantic/{topic}.md under a date header: ## YYYY-MM-DD — brief description (e.g., ## 2026-04-17 — deployment strategy). Don't create a new file for the same topic.
5. Log the capture: Write a self-contained pointer to TODAY.md (see Pointer Pattern above):
[HH:MM] session capture: Key conclusion or outcome here. Detaily: semantic/{topic}.md
Use this recommended structure for semantic/ files created during session capture:
# {Topic Name}
<!-- WIP: topic not concluded --> ← only if unfinished
## Context
Brief description of what this is about and why.
## Decisions
- What was agreed and why.
## Considered Alternatives
- What was considered and rejected, and why not.
## Open Questions
- What hasn't been decided yet.
## References
- Links, tools, examples.
Not all sections are required — use what fits the content.
Use kebab-case, short, no prefixes: stepforge.md, vest-liquidation.md. If maintenance splits a file that exceeds ~100 lines, it adds a suffix: stepforge-architecture.md.
[MEM-NNN] — Tracked Memory KeysCritical information gets a unique, tracked key — like Jira tickets for memory. Keys survive consolidation, are traceable via grep and git history, and have an explicit lifecycle that prevents silent data loss.
IMPORTANT: Keys are ALWAYS sequential numbers, never words. The key format is MEM- followed by a number: MEM-1, MEM-2, MEM-3, etc. No zero-padding needed.
✅ Correct: [MEM-1] deploy: staging vyžaduje SSO
✅ Correct: [MEM-42] komunikace: mužský rod
❌ WRONG: [MEM-feedback] ... ← NOT a number!
❌ WRONG: [MEM-TAG] ... ← NOT a number!
❌ WRONG: [MEM-deploy] ... ← NOT a number!
[MEM-NNN] entrylog-write.tsNEVER write to memory/TODAY.md directly. Always use one of these scripts:
log-write.ts — routine logsFor events, triage, status updates, session notes:
npx tsx "$CLAUDE_CONFIG_DIR/skills/memory/scripts/log-write.ts" "heartbeat: klidný den, žádné pending issues"
npx tsx "$CLAUDE_CONFIG_DIR/skills/memory/scripts/log-write.ts" "triage: 3 nové emaily, žádný urgentní"
# Output: Logged to memory/TODAY.md
The script appends a timestamped line: - [HH:MM] content
mem-write.ts — tracked memory[MEM-NNN] entryDo NOT pick the number yourself. Use the mem-write script — it handles numbering, TODAY.md, and MEM_REGISTRY.md atomically:
npx tsx $CLAUDE_CONFIG_DIR/skills/memory/scripts/mem-write.ts "category: detail"
Examples:
npx tsx $CLAUDE_CONFIG_DIR/skills/memory/scripts/mem-write.ts "deploy: staging vyžaduje SSO login"
npx tsx $CLAUDE_CONFIG_DIR/skills/memory/scripts/mem-write.ts "komunikace: mužský rod, vždy česky"
# Output: Written [MEM-4] to memory/TODAY.md and memory/MEM_REGISTRY.md
The script:
memory/MEM_REGISTRY.md, finds the highest existing number- [MEM-N] content to memory/TODAY.mdmemory/MEM_REGISTRY.mdNEVER write [MEM-NNN] entries manually — always use the script. This prevents malformed keys like [MEM-feedback].
After the script runs, confirm to user: "Zapsáno." / "Uloženo do paměti." (don't mention internal mechanics)
Example result:
# In TODAY.md:
- [MEM-3] deploy: staging vyžaduje SSO login
- [MEM-4] komunikace: mužský rod, vždy česky
# In MEM_REGISTRY.md:
| MEM-3 | ACTIVE | 2026-04-28 | — | Staging deploy requires SSO login |
| MEM-4 | ACTIVE | 2026-04-28 | — | Communication: masculine, always Czech |
This file is the source of truth for all tracked memory keys. It lives at memory/MEM_REGISTRY.md.
# MEM Registry
| Key | Status | Created | Obsoleted | Description |
|-----|--------|---------|-----------|-------------|
| MEM-1 | ACTIVE | 2026-04-28 | — | Auto-memory is ephemeral, never rely on it |
| MEM-2 | OBSOLETE | 2026-04-15 | 2026-04-28 | Old deploy flow (superseded by MEM-3) |
| MEM-3 | ACTIVE | 2026-04-28 | — | Staging deploy requires SSO login |
Columns:
MEM-1, MEM-2, ...)ACTIVE, OBSOLETE, or REMOVED— if active)ACTIVE → OBSOLETE → REMOVED
[MEM-3][MEM-3:obsolete]. The entry stays in its promoted location for one consolidation cycle.Rules:
[MEM-NNN] entry must never be deleted from content files without first going through OBSOLETE status[MEM-3] starts in TODAY.md and gets promoted to LEARNINGS.md, the key [MEM-3] stays in the promoted entrymemory/ — a missing ACTIVE key is an integrity violationThe [REMEMBER] tag continues to work as an alias — consolidation will auto-assign the next available sequential number to any [REMEMBER] entry found in daily logs and register it. New entries should always use the mem-write.ts script (e.g., result: [MEM-1]).
When you learn something new, route it:
| Signal | Script | Example |
|---|---|---|
| User explicitly asks to remember | mem-write.ts | "Zapamatuj si že jsem mužského rodu" |
| User corrects you | mem-write.ts | "No, the API key goes in the header, not query param" |
| User states preference | mem-write.ts | "Always use bullet points in summaries" |
| You discover something useful | mem-write.ts | "The staging DB resets every Sunday" |
| Factual info about team/project | log-write.ts | "Alice is the frontend lead" |
| Something notable happened | log-write.ts | "Production went down for 2h due to DNS" |
| You figure out how to do something | log-write.ts | "Deploy requires SSO login first" |
| Substantial reference material (brainstorming, deep-dive) | semantic/{topic}.md | 30-min architecture discussion → session capture |
| Action items, follow-ups | HEARTBEAT.md | "Check if PR #42 is merged by Friday" |
memory/core/MISTAKES.md is a staging area, not a permanent archive. When you make a mistake or get corrected, write it there immediately. During consolidation, each entry is reviewed and promoted to a permanent home:
| Promotion path | When to use | Example |
|---|---|---|
| Skill pitfall | Mistake is specific to a skill/tool and would benefit from contextual warning | Slack tilde rendering → add Pitfalls section to skills/slack/skill.md |
| LEARNINGS.md | Mistake reveals a general operational rule | "Always tag the person you're replying to" → core/LEARNINGS.md |
| Hardcoded guard | Mistake is critical enough to need automated prevention | Guard file check before consolidation → memory/.last_consolidation |
Each entry should include enough context for promotion:
## YYYY-MM-DD — short description
**What happened:** one-liner describing the mistake
**Root cause:** why it happened
**Impact:** what went wrong as a result
**Status:** new | promoted → {destination}
When an entry is promoted, update its status and leave it for one consolidation cycle so the promotion is visible, then remove it. This keeps MISTAKES.md small and active — it's a to-do list, not a journal.
When you need context beyond core/ and daily logs:
Grep to search across memory/semantic/, memory/episodic/, memory/procedural/Glob to find files by pattern (e.g., memory/episodic/incident-*.md)memory/SUMMARY.md is the consolidated long-term memory index. It's generated during maintenance and included in context via @ import. Target: ~100-150 lines max.
Structure:
## How this memory works
- This file (SUMMARY.md) and TODAY.md are `@`-imported into every session — they are always in your context
- All other memory files (core/, semantic/, episodic/, procedural/) must be actively read via tools
- When asked "will you remember X?" — check whether X is in SUMMARY.md or TODAY.md (yes → in context) or only in a deeper file (no → requires lookup)
- Do NOT edit this file manually — it is regenerated by maintenance consolidation
- Don't guess how memory works — read this block
## Identity
- [who you are, 1-2 lines]
## Key Rules (from core/LEARNINGS.md)
- [top 10-15 operational rules, actionable — include pointer to source file for detail]
- example: "Always verify live data before trade proposals (detail: core/LEARNINGS.md)"
## Preferences (from core/PREFERENCES.md)
- [key preferences, actionable — include pointer to source file for detail]
## Active Projects (from episodic/)
- [current work in progress, 5-10 lines]
## Deep Memory Index
- memory/core/ — [summary of what's there]
- memory/semantic/ — [topics covered]
- memory/episodic/ — [events covered]
- memory/procedural/ — [workflows covered]
Do NOT edit SUMMARY.md manually during regular sessions. It's regenerated by maintenance consolidation.
Migration runs during maintenance heartbeat (not regular sessions — don't slow down user interactions). See MAINTENANCE.md for the trigger.
Needed if memory/core/ directory does not exist.
Create directory structure:
mkdir -p memory/core memory/daily memory/semantic memory/episodic memory/procedural
Split monolithic MEMORY.md into core files:
MEMORY.mdmemory/core/MISTAKES.mdmemory/core/PREFERENCES.mdmemory/core/LEARNINGS.mdmemory/semantic/{topic}.mdMove old daily logs:
memory/YYYY-MM-DD.md files to memory/daily/YYYY-MM-DD.mdCommit: git commit -m "chore: migrate memory to tiered structure"
Needed if memory/SUMMARY.md does not exist. Run after Migration A (if needed).
Generate memory/SUMMARY.md from existing memory:
memory/core/*.md filesmemory/daily/*.md files (last 7 days)MEMORY.md indexCreate memory/TODAY.md if it doesn't exist:
memory/daily/YYYY-MM-DD.md exists, copy its content to memory/TODAY.md# YYYY-MM-DDAdd @ imports to channel brain CLAUDE.md if not already present:
@memory/SUMMARY.md and @memory/TODAY.md near the top of CLAUDE.md (right after the title/identity section). Memory imports should be early in the file so they survive context compaction.Commit: git commit -m "chore: add SUMMARY.md + TODAY.md memory files"
core/LEARNINGS.md[HINT] Download the complete skill directory including SKILL.md and all related files