rainman CLAUDE.md

rainman CLAUDE.md is an instructions file for Claude Code from yan-yanko/rainman. It costs 4,973 tokens per session, scanned A, original, MIT.

Repository instructions for Rainman, a local developer-memory tool that connects to AI coding workflows and recalls useful project knowledge.

In plain words
What is it for?
They guide work on the Python memory engine, its local integrations, knowledge retrieval, and unit tests.
Why use it?
They explain the architecture, data model, scoring approach, and test commands so changes fit the project’s memory and retrieval system.

Instructions file for Claude Code

Written for Claude Code: SessionStart hook event. Also seen: mentions Claude Code; built for aider.

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/yan-yanko/rainman/claude-md
Clone the repo
git clone --depth 1 https://github.com/yan-yanko/rainman

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yan-yanko/rainman/claude-md.svg)](https://agentmods.dev/instructions/yan-yanko/rainman/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/yan-yanko/rainman/claude-md"><img src="https://agentmods.dev/badge/instructions/yan-yanko/rainman/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,973 This file is loaded in full into every session.
When invoked 4,973 The same file — it is already loaded in full.
Security scan A 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.1 $0.04973 $0.04973
Opus 5 $0.02486 $0.02486
Sonnet 5 $0.00995 $0.00995
Haiku 4.5 $0.00497 $0.00497

Measured 5d ago against content hash a47ed6557b8b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

rainman CLAUDE.md scanned grade A 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 5d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

client.py SyncClient — push/pull project memories to a sync server (stdlib urllib)
CLAUDE.md · 276 lines

How it starts

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

Rainman — Project Instructions

Read this before doing anything.

What This Project Is

Rainman is a standalone developer memory tool that plugs into AI coding workflows via MCP and Claude Code hooks. It remembers what you've built, what failed, what works — and surfaces relevant knowledge when the AI needs it, without being asked.

Zero LLM calls. Runs locally. Zero external dependencies (stdlib only). Storing and ranking memory spends zero tokens; recalled memories are injected as normal context, so they cost input tokens only when actually surfaced to the model.

Built by extracting the scoring engine from CogniTrait (Pygmalion's personality-shaped memory), stripping Big Five personality dependencies, and adapting it for project knowledge retrieval.

Repo: C:\Users\yanko\My Apps\rainman Stack: Python 3.10+ (stdlib only) Tests: pip install -e . && pytest tests/ -m unit — 350 tests, stdlib only. (The team sync server and its tests live in the separate rainman-server repo.)

Architecture

rainman/
  core/
    models.py       Memory (+ author, .trust property) + RecallResult dataclasses
    scoring.py      IDF-weighted (stemmed) keyword, temporal decay, importance, associative scoring + trust amplifier denial + quality prior
    text.py         Tokenization: stem + stopword filter + IDF index (shared by scorer)
    porter.py       Vendored public-domain Porter stemmer (stdlib, zero-dep)
    sentiment.py    Keyword-based sentiment classifier (zero LLM)
    trust.py        Trust levels (user>hook>ingest) derived from source; quality prior
    identity.py     current_actor() — local OS user / RAINMAN_AUTHOR
    engine.py       Core: add (w/ dedup+supersession), recall (task-conditioned), context, links, forget, persist, retention, _visible()
    store.py        JSON backend (default): layered persistence, file locking, fsync, schema_version
    sqlite_store.py SQLite backend (opt-in): WAL, per-layer DB, no 2000-cap, indexed
    storage.py      StorageBackend Protocol + make_store() backend factory
    redact.py       Secret redaction + path denylist (+ org-policy extras) for auto-learn safety
    salience.py     Write-side curation: score how worth-remembering an auto-learned memory is (gate hook spam)
    consolidate.py  Offline "sleep" pass: episodic->semantic generalization (extract common elements across recurring events) + functional forgetting (Ebbinghaus adaptive decay of un-recalled orphan noise). Zero-LLM. Wired via engine.consolidate() / `rainman consolidate`.
    gaps.py         Skill-gap report: cluster recurring failures, rank by frequency/recency/unresolved -> "which skill or permanent fix to write next" (`rainman gaps`)
    working.py      Working-memory buffer: capacity-limited (7±2) TTL'd LRU of the memories in focus this session (Miller/Baddeley). Persisted to .rainman/working.json; recall() touches it; engine.working_set() / `rainman working`.
    audit.py        Append-only JSONL audit log (opt-in, batched) — store/recall/forget/retention
    config.py       Policy control plane (org.enforce > project > user > org.defaults > builtin)
    log.py          Structured stdlib logging (RAINMAN_LOG_LEVEL)
    fusion.py       Reciprocal Rank Fusion (combines lexical + dense rankings)
  eval/
    metrics.py      IR metrics: recall@k, precision@k, MRR, nDCG@k (stdlib)
    harness.py      Gold-set retrieval eval -> EvalReport (the IR gate runner)
    agent_harness.py  memory-on vs memory-off lift plumbing (SWE-bench)
  mcp/
    server.py       MCP stdio server (JSON-RPC 2.0, 5 tools)
  cli/
    commands.py     CLI command implementations (init, add, recall, status, setup, doctor)
  integration/
    core.py         HOST-AGNOSTIC behaviours (auto_pull, session_start_context, compaction_context, learn_from_tool, capture_learnings, learn_from_commit). The hooks are thin adapters over this; other hosts (git, aider, MCP) reuse it. Zero host coupling.
    hosts.py        Registry of MCP-capable hosts (Cursor/VS Code/Windsurf/Cline/Zed/Continue/Claude) + config shapes; powers `mcp-config` / `setup --host`
  hooks/             (Claude Code ADAPTERS — parse Claude's stdin/transcript, delegate to integration/core)
    session_start.py   Load project context at session start (also handles post-compaction re-injection)
    post_compact.py    Legacy compaction hook (logging only; re-injection moved to session_start)
    post_tool_use.py   Auto-learn from file reads, edits, test runs (salience-gated; Bash outcomes -> typed-causal experience cards w/ failure->fix pairing)
    session_end.py     Capture key decisions from conversation transcripts
  sync/
    client.py       SyncClient — push/pull project memories to a sync server (stdlib urllib)
  semantic/
    __init__.py     OPTIONAL semantic lane SEAM: provider protocol + cosine + loader (None unless rainman[semantic] installed)
  ingest/
    git.py          Parse git log into memories
    files.py        Scan project file tree into memories
  __main__.py       CLI entry point (argparse)

The self-hosted TEAM SYNC SERVER now lives in a SEPARATE REPO:
  https://github.com/yan-yanko/rainman-server  (BSL 1.1, source-available)
It holds the server (RBAC, OIDC SSO, audit, encryption-at-rest, admin console)
plus its SOC2-readiness doc and the client<->server integration tests. This
repo (the client) stays MIT + stdlib-only. `rainman/sync/client.py` is the
client half that talks to it via `rainman remote` / `rainman sync`.
tests/                  (350 tests total, all marked `unit`)
  test_scoring.py     scoring components + weighted sum
  test_engine.py      add / recall / context / links / forget
  test_sentiment.py   sentiment classifier
  test_hooks.py       session_start, post_compact, post_tool_use, session_end
  test_mcp_server.py  MCP JSON-RPC protocol + tools (incl. error sanitization)
  test_cli_smoke.py   CLI smoke
  test_integration.py end-to-end layering
  test_concurrency.py locking, corruption quarantine, fsync, schema version
  test_regressions.py regression guards
  test_trust.py       trust levels, amplifier denial, quality prior, floors (Ph1a)
  test_audit.py       append-only audit log (Ph1b)
  test_config.py      policy precedence + wired knobs (Ph1c)
  test_retention.py   TTL prune + global-layer save safety (Ph1d)
  test_review.py      quarantine review queue: approve/reject (Ph2c)
  test_salience.py    write-side salience scoring + threshold (M6)
  test_experience.py  typed-causal cards: record/find/resolve failure->fix pairing (M1)
  test_consolidation.py  dedup/merge near-duplicates + supersession (M5)
  test_assoc_graph.py  real linking (stemmed/windowless/typed edges) + 2-hop spreading activation (M3/M4)
  test_semantic.py  optional semantic lane seam: RRF fusion + stub-provider synonym recall (M7)
  test_eval.py      IR metrics + gold-set harness + memory-lift on/off plumbing
  test_gaps.py      skill-gap report: failure clustering, ranking, known-fix surfacing
  test_sqlite_backend.py  SQLite backend parity, selection, migrate (Ph2a)
  test_sync_client.py client-side sync: config/token-safety, push/pull apply (mocked HTTP)
  test_retrieval_quality.py  IR gate: recall@5/MRR on paraphrased queries + relevance floor

(Server-side + client<->server integration tests live in the rainman-server repo.)

Read the full file on GitHub · 276 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. 5d ago First seen · 276 lines · 4,973 tokens per session scan A a47ed6557b8b

Subscribe to this mod's changes

rainman CLAUDE.md is an instructions file published in the GitHub repository yan-yanko/rainman (21 stars, last pushed 13d ago), licensed MIT. It adds 4,973 tokens to every session, about $0.0249 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.