capture-memory

A command that records concise technical lessons from completed work in a project’s MEMORY.md file, while checking CLAUDE.md for duplicates.

In plain words
What is it for?
Use it after a task to capture patterns, gotchas, and techniques in the appropriate project-memory section.
Why use it?
It preserves useful discoveries for future sessions without repeatedly storing the same guidance.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/tslateman/duet/capture-memory
Clone the repo
git clone --depth 1 https://github.com/tslateman/duet
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 572 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.00572
Opus 5 $0.00005 $0.00286
Sonnet 5 $0.00002 $0.00114
Haiku 4.5 $0.00001 $0.00057

Measured yesterday against content hash 4f862956fbef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

capture-memory scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- Memory files hold lessons. CLAUDE.md holds instructions. | MEMORY.md | CLAUDE.md | | -------------------------------------------- | -------------------------------------------- | | "We learned X breaks" | "Use Y ins
commands/capture-memory.md · 82 lines

How it starts

The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Reflect on the work just completed, then persist learnings for future sessions.

Step 1: Reflect

Identify 2-4 concrete technical insights:

  • Patterns discovered or reinforced
  • Gotchas or surprises encountered
  • Techniques that worked well (or didn't)

Focus on insights, not actions taken. Be specific -- name files, functions, concepts.

Step 2: Dedup Guard

Read the project's CLAUDE.md (if it exists). For each insight from Step 1, check whether CLAUDE.md already covers it. If so, drop it and note "already in CLAUDE.md" in the Step 4 output. Memory captures lessons CLAUDE.md does not.

Step 3: Write to Memory

Read the existing MEMORY.md in the project's memory directory. Find the right section for each insight. Add to an existing section when one fits. Create a new section only when no existing section applies.

Format for entries:

## [Topic Name]

- **[Bold insight]**: explanation with specific file/function references

If MEMORY.md doesn't exist, create it with a # [Project] Project Memory header first.

Keep entries concise -- this file loads into every session's context.

Routing check

If an insight references a different project by name (e.g., mentions "duet" while working in "lore"), note it in the Step 4 output: "Consider: this insight may belong in [other project]'s memory, not [current project]'s."

Size check

After writing, count lines in MEMORY.md. If over 50 lines, warn: "MEMORY.md is [N] lines. Consider running /memory-audit to identify content that can be pruned or moved."

Read the full file on GitHub · 82 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 82 lines · 10 tokens per session scan C 4f862956fbef

Subscribe to this mod's changes

capture-memory is a command published in the GitHub repository tslateman/duet (1 stars, last pushed 5d ago), licensed MIT. It adds 10 tokens to every session and 572 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.