codebase-memory-capture

codebase-memory-capture is a skill for Claude Code, Codex from SauliusDev/glyph. It costs 82 tokens per session (1,350 once invoked), scanned A, original, MIT.

A code-review rule for recording important lessons, deliberate choices, and correctness conditions next to the code as @agent: comments. These notes explain decisions that the code and tests may not reveal.

In plain words
What is it for?
Use it when changing non-trivial logic whose behavior depends on a subtle bug fix, rejected approach, or requirement that tests may not fully show.
Why use it?
It keeps hard-won knowledge with the relevant code so future agents do not repeat known mistakes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when changing non-trivial logic whose behavior depends on a subtle bug fix, rejected approach, or requirement that tests may not fully show.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sauliusdev/glyph/codebase-memory-capture
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.

Any agent
npx skills add SauliusDev/glyph --skill codebase-memory-capture
Clone the repo
git clone --depth 1 https://github.com/SauliusDev/glyph

Made for: Claude Code, Codex.

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 codebase-memory-capture

README.md
[![agentmods](https://agentmods.dev/badge/skills/sauliusdev/glyph/codebase-memory-capture/github.svg)](https://agentmods.dev/skills/sauliusdev/glyph/codebase-memory-capture)
Your own site
<a href="https://agentmods.dev/skills/sauliusdev/glyph/codebase-memory-capture"><img src="https://agentmods.dev/badge/skills/sauliusdev/glyph/codebase-memory-capture/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 codebase-memory-capture

Your own site · 80×15
<a href="https://agentmods.dev/skills/sauliusdev/glyph/codebase-memory-capture"><img src="https://agentmods.dev/badge/skills/sauliusdev/glyph/codebase-memory-capture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,350 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00082 $0.01350
Opus 5.5 $0.00033 $0.00540
Sonnet 5.5 $0.00016 $0.00270
Haiku 4.5 $0.00008 $0.00135

Measured 1mo ago against content hash c740634b8cd9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

codebase-memory-capture scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/codebase-memory-capture/SKILL.md · 122 lines

How it starts

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

Codebase Memory — Capture (inline @agent: notes)

Give the codebase a memory. When code carries a hard-won lesson, a deliberate decision, or a correctness invariant, record it next to the code as an @agent: comment. The next agent reads it for free while editing — no lookup, no separate file, no forgetting — and does not repeat the mistake.

This captures what git and tests cannot: the approach that was tried and abandoned, and the reason a non-obvious choice is correct.

Scope: only code-bound knowledge goes inline

Inline @agent: notes are for knowledge tied to a specific symbol or line. Project-wide memory (user corrections, project state, in-flight tasks, timeline) does not go in source comments — it lives in the project memory file (_agent/memory.md). If a note is not about the code it sits next to, it does not belong inline.

When to write one — default is SILENCE

Write a note ONLY if at least one is true:

  • It cost real time to learn (a failed attempt, a debugging session, a subtle bug).
  • It is not inferable from the code, types, or tests as they stand.
  • Breaking it silently corrupts output and no test catches it (precision, units, time zones, look-ahead bias, ordering, rounding).
  • A plausible future edit would re-introduce the exact mistake.

Do NOT write a note for:

  • Anything obvious from reading the code, or that restates what the code does.
  • Style, formatting, naming — a linter/formatter owns those.
  • Anything a type or test already enforces (write the test instead).
  • "Changed X on date Y" — git blame already answers that.
  • In-flight tasks or TODOs — use TODO: / the memory file, not @agent:.

If unsure whether a note clears the bar, it does not. Stay silent.

Tags (the whole vocabulary — do not invent more)

  • lesson — tried X, it failed because Y, do Z instead. (anti-repeat-mistake)
  • decision — chose X over Y because Z. (the "why not" the code can't show)
  • invariant— this must hold or [consequence]. (silent-corruption guardrail)
  • gotcha — counterintuitive-but-correct; do not "fix" it.

Read the full file on GitHub · 122 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 · 122 lines · 82 tokens per session scan A c740634b8cd9

Subscribe to this mod's changes

codebase-memory-capture is a skill published in the GitHub repository SauliusDev/glyph (1 stars, last pushed 2mo ago), licensed MIT. It adds 82 tokens to every session and 1,350 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.