claude-code

An integration that gives Claude Code, an AI coding tool, a persistent project memory loop. It uses Claude Code’s instruction file and automatic hooks to load context, record edits, and save session information.

In plain words
What is it for?
Use it to configure Claude Code, import Git history, automatically capture edited files, load context at session start, and save context when a session ends.
Why use it?
It keeps project context available across sessions without requiring the developer to manually record every change.

Agent

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 agents/rustkit-ai/aimemo/claude-code
Clone the repo
git clone --depth 1 https://github.com/rustkit-ai/aimemo
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,236 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 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 $0.00000 $0.01236
Opus 5 $0.00000 $0.00618
Sonnet 5 $0.00000 $0.00247
Haiku 4.5 $0.00000 $0.00124

Measured yesterday against content hash 0ae4d518bf4a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

claude-code 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 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.

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.

<!-- aimemo:instructions:start -->
docs/agents/claude-code.md · 183 lines

How it starts

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

aimemo × Claude Code

Claude Code reads CLAUDE.md automatically at the start of every session. aimemo setup installs three hooks and writes a context block into CLAUDE.md — the full memory loop runs with zero manual steps, ever.


Setup

Run once in your project root:

aimemo setup --claude

Then bootstrap from your git history so the agent has context from day one:

aimemo bootstrap

What gets installed

Three hooks in .claude/settings.json:

Hook Trigger What it does
PostToolUse After every Write / Edit / MultiEdit Runs aimemo capture — auto-logs the file with a code description
UserPromptSubmit At the start of each session Runs aimemo inject --claude --once — injects fresh context
Stop When you close Claude Code Runs aimemo inject --claude — saves context for next session

.claude/settings.json (excerpt):

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [{ "type": "command", "command": "aimemo capture" }]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [{ "type": "command", "command": "aimemo inject --claude --once" }]
      }
    ],
    "Stop": [
      {
        "hooks": [{ "type": "command", "command": "aimemo inject --claude" }]
      }
    ]
  }
}

CLAUDE.md (excerpt):

<!-- aimemo:instructions:start -->
## aimemo — persistent memory
- At session start: run `aimemo inject --claude` to load context from previous sessions
- After modifying any file: run `aimemo log "modified {filename}: {one-line reason}"`
- When you identify something to fix later: run `aimemo log "todo: {description}"`
- At session end: run `aimemo recap "{what was done} — next: {what comes next}"` then `aimemo inject --claude`
<!-- aimemo:instructions:end -->

<!-- aimemo:start -->
## aimemo context
last: (no entries yet)
<!-- aimemo:end -->

The session loop

Open Claude Code
      │
      ▼
UserPromptSubmit hook → aimemo inject --claude --once
      │  (injects context only if new entries exist)
      ▼
Claude reads CLAUDE.md ←── recap + recent entries + open todos
      │
      ▼
You work — Claude edits files
      │
      ▼
PostToolUse hook → aimemo capture
      │  (logs "wrote src/auth.rs: added fn handle_login"
      │   or  "edited src/db/pool.rs: added fn connect_pool"
      │   or  "edited src/auth.rs (3 changes)" if no pattern matched)
      ▼
Claude logs semantic context:
  aimemo log "modified src/auth.rs: extracted JWT validation"
  aimemo log "todo: add refresh token endpoint"
      │
      ▼
At session end:
  aimemo recap "implemented JWT auth — next: refresh token endpoint"
      │
      ▼
You close Claude Code
      │
      ▼
Stop hook → aimemo inject --claude
      │
      ▼
CLAUDE.md updated silently — ready for next session

Read the full file on GitHub · 183 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 · 183 lines · 0 tokens per session scan C 0ae4d518bf4a

Subscribe to this mod's changes

claude-code is an agent published in the GitHub repository rustkit-ai/aimemo (4 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,236 tokens. 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.