codebase-memory-capture

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

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 skills/sauliusdev/glyph/codebase-memory-capture
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.

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. 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.00082 $0.01350
Opus 5 $0.00041 $0.00675
Sonnet 5 $0.00016 $0.00270
Haiku 4.5 $0.00008 $0.00135

Measured yesterday against content hash c740634b8cd9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

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. yesterday 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 (2 stars, last pushed 29d ago), licensed MIT. It adds 82 tokens to every session and 1,350 once invoked, about $0.0004 per session on Opus 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.

Related

Other skills, from other repositories

docs-writer

Draft or rewrite Strands Agents documentation pages. Use when writing new doc pages, rewriting pages that failed audit, drafting sections for existing pages, or writing blog posts and release notes about Strands. Also triggers on "write a doc", "draft a page", "rewrite the quickstart", "add a tutorial for X"…

strands-agents/harness-sdk · 74 tokens

docs-reviewer

Review documentation drafts for voice consistency, structure, and terminology before PR submission. Use after completing a draft, when checking if docs are ready to ship, or automatically after docs-writer produces output. Also triggers on "review this draft", "check my docs", "is this ready to ship", "review before…

strands-agents/harness-sdk · 68 tokens

docs-planner

Identify documentation gaps and prioritize the docs backlog. Use when planning a docs improvement sprint, after signals surface repeated friction, when new SDK features ship without docs, or for periodic health assessment. Also triggers on "plan docs work", "what docs need writing", "prioritize the backlog", "docs…

strands-agents/harness-sdk · 73 tokens

self-improve-with-tinyfish

Enables Hermes to create new reusable skills for itself by researching live web sources with TinyFish Search and Fetch, analyzing source coverage, writing SKILL.md files, and installing them into Hermes memory. Use when the user asks Hermes to learn, teach itself, upgrade itself, or save a reusable capability.

tinyfish-io/tinyfish-cookbook · 68 tokens

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

CreminiAI/skillpack · 64 tokens

case-study

Craft a portfolio case study with narrative arc, process evidence, and outcomes. Use when telling a project's story to an external audience. For an internal stakeholder deck, use presentation-deck.

Owl-Listener/designer-skills · 41 tokens