capture-memory

capture-memory is a command for Claude Code from tslateman/duet. It costs 10 tokens per session (572 once invoked), scanned C, original, MIT.

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 for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md.

Part of the duet plugin — 27 skills, 6 commands, 1 agent shipped together

Good fit Use it after a task to capture patterns, gotchas, and techniques in the appropriate project-memory section.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/tslateman/duet/capture-memory
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.

Clone the repo
git clone --depth 1 https://github.com/tslateman/duet

Made for: Claude Code.

Or install duet, the plugin that ships this one along with the rest of its 27 skills, 6 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for capture-memory

README.md
[![agentmods](https://agentmods.dev/badge/commands/tslateman/duet/capture-memory/github.svg)](https://agentmods.dev/commands/tslateman/duet/capture-memory)
Your own site
<a href="https://agentmods.dev/commands/tslateman/duet/capture-memory"><img src="https://agentmods.dev/badge/commands/tslateman/duet/capture-memory/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for capture-memory

Your own site · 80×15
<a href="https://agentmods.dev/commands/tslateman/duet/capture-memory"><img src="https://agentmods.dev/badge/commands/tslateman/duet/capture-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00010 $0.00572
Opus 5.5 $0.00004 $0.00229
Sonnet 5.5 $0.00002 $0.00114
Haiku 4.5 $0.00001 $0.00057

Measured 1mo ago against content hash 4f862956fbef, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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 1mo ago), licensed MIT. It adds 10 tokens to every session and 572 once invoked, about $0.0000 per session on Opus 5.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.