subcog CLAUDE.md

subcog CLAUDE.md is an instructions file for coding agents from zircote/subcog. It costs 501 tokens per session, scanned A, original, MIT.

Project instructions for Subcog, a Rust-based memory system for AI coding assistants. It stores useful decisions and context from coding sessions and can find relevant information later.

In plain words
What is it for?
Use them when building, testing, formatting, linting, documenting, or checking dependencies in the Subcog codebase.
Why use it?
They explain the project’s architecture and required development checks so changes can be made without breaking its storage, search, or assistant integrations.

Instructions file

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 instructions/zircote/subcog/claude-md
Clone the repo
git clone --depth 1 https://github.com/zircote/subcog

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 subcog CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zircote/subcog/claude-md.svg)](https://agentmods.dev/instructions/zircote/subcog/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/zircote/subcog/claude-md"><img src="https://agentmods.dev/badge/instructions/zircote/subcog/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 501 This file is loaded in full into every session.
When invoked 501 The same file — it is already loaded in full.
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.00501 $0.00501
Opus 5 $0.00251 $0.00251
Sonnet 5 $0.00100 $0.00100
Haiku 4.5 $0.00050 $0.00050

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

Security

Grade A, and why

subcog CLAUDE.md 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 4d 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.

CLAUDE.md · 53 lines

What it actually says

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Subcog is a persistent memory system for AI coding assistants, written in Rust. It captures decisions, learnings, and context from coding sessions and surfaces them when relevant.

Key Capabilities

  • Single-binary distribution (<100MB, <10ms cold start)
  • Three-layer storage architecture: Persistence (SQLite), Index (FTS5), Vector (usearch HNSW)
  • MCP server integration for AI agent interoperability
  • Claude Code hooks for seamless IDE integration
  • Semantic search with hybrid vector + BM25 ranking (RRF fusion)

Build Commands

Use the Makefile for all common operations. Run make help for the full list.

# Primary development workflow
make ci              # Run ALL CI gates before committing (format, lint, test, doc, deny, msrv, bench)
make dev             # Full check + install to ~/.cargo/bin
make quick           # Build + install (skip tests)

Code Style

  • Edition: 2024
  • MSRV: 1.88
  • Line length: 100 characters
  • Linting: clippy with pedantic + nursery lints

Strict Requirements

  1. No panics in library code: Use Result types. unwrap, expect, panic! are denied by clippy.
  2. Use thiserror for custom error types with #[error(...)] attributes.
  3. Prefer const fn where possible (clippy enforces this for simple methods).
  4. Prefer borrowing over ownership: &str over String, &[T] over Vec<T>.
  5. Document public items with /// including # Errors and # Examples sections.

Mnemonic

This project uses mnemonic for persistent memory.

  • Search before implementing: rg -i "{topic}" ~/.claude/mnemonic/ ./.claude/mnemonic/ --glob "*.memory.md"
  • Capture decisions, learnings, patterns via /mnemonic:capture {namespace}
  • See ~/.claude/CLAUDE.md for full protocol
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. 4d ago First seen · 53 lines · 501 tokens per session scan A d71b00ee9e0c

Subscribe to this mod's changes

subcog CLAUDE.md is an instructions file published in the GitHub repository zircote/subcog (28 stars, last pushed 1mo ago), licensed MIT. It adds 501 tokens to every session, about $0.0025 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-30.