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.
npx agentmods add instructions/turbommgt/ccsave/claude-mdgit clone --depth 1 https://github.com/turbommgt/ccsaveWrote 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.
[](https://agentmods.dev/instructions/turbommgt/ccsave/claude-md)<a href="https://agentmods.dev/instructions/turbommgt/ccsave/claude-md"><img src="https://agentmods.dev/badge/instructions/turbommgt/ccsave/claude-md.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01346 | $0.01346 |
| Opus 5 | $0.00673 | $0.00673 |
| Sonnet 5 | $0.00269 | $0.00269 |
| Haiku 4.5 | $0.00135 | $0.00135 |
Grade B, and why
ccsave CLAUDE.md scanned grade B 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 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
- **`src/core/projectDetector.ts`**: Detect project via SHA256 hash of path; find session JSONL files in ~/.claude/projects/<hash>/; fallback to most-recent dir. How it starts
The opening of the file, as written. The whole thing — 49 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Session Snapshot — Restored Apr 7, 2026, 12:49
Current Task
Build ccsave, a TypeScript/Node.js CLI tool that prevents Claude Code session context loss by saving structured snapshots to CLAUDE.md. Session started with full spec review; proceeded through build steps 1-15 to implement all core functionality (config, session parsing, summarization, snapshot management, watcher). Most recently diagnosed and fixed a cost explosion in API summarization and fixed a file-writing bug.
Key Decisions Made
- Model choice: Switched from claude-opus-4-6 to claude-haiku-4-5 (25x cheaper per token, sufficient for summarization).
- Message windowing: Truncate session to first 20 + last 40 messages before sending to API (~97% input reduction). Rationale: most critical context at session start (setup) and end (current work).
- Token estimation: 1 byte ≈ 0.25 tokens; warn at 150k, critical at 180k. Combined with usage logging from Anthropic response.
- Project identification: SHA256 hash of project path with fallback to most-recently-modified directory.
- CLAUDE.md format: HTML comment delimiters (
[CCSAVE:START removed]/[CCSAVE:END removed]) with safe replacement logic usinglastIndexOfto handle corrupt state recovery. - Snapshot storage:
~/.ccsave/snapshots/with ISO-slug naming; metadata + structured content sections. - File operation tracking: Separate
FileOperationtype extracted from tool calls (write, read, edit, delete, bash).
Files Modified This Session
package.json: Dependencies (commander, chalk, ora, chokidar, @anthropic-ai/sdk), npm scripts (build, dev), bin entry.tsconfig.json: ES2020 target, CommonJS module, strict mode, src→dist mapping.src/types/index.ts: All interface definitions (CCSaveConfig, Snapshot, SessionMessage, ParsedSession, ProjectInfo, WatcherOptions, FileOperation, etc.).src/utils/config.ts: Load/save ~/.ccsave/config.json with typed defaults for all thresholds, intervals, API key.src/core/sessionReader.ts: Parse JSONL (user, assistant, tool_use, tool_result messages); extract user input, assistant text, tool calls with file paths, bash commands, tool result success/failure.src/core/projectDetector.ts: Detect project via SHA256 hash of path; find session JSONL files in ~/.claude/projects//; fallback to most-recent dir.src/core/tokenEstimator.ts: Estimate tokens (1 byte = 0.25 tokens); warn/critical thresholds; return estimate + byte count.src/core/summarizer.ts: Call Anthropic API with message window (first 20 + last 40 messages), claude-haiku-4-5 model, max_tokens 1500. Output token usage logging (input, output, cost estimate). Sanitize AI output to remove[CCSAVE:END removed]marker before returning.src/core/snapshotter.ts: Orchestrate session parse → tokenization → (optional) summarization → snapshot creation. Handle summarizer return type change (usage stats).src/core/claudeMdWriter.ts: Read/write CLAUDE.md with block insertion/replacement. FixedreplaceBlockto uselastIndexOf(BLOCK_END)instead ofindexOfto recover from corrupt state where markers appear mid-file.src/commands/save.ts: Manual snapshot command; surface cost line before spinner closes.src/commands/list.ts,watch.ts,restore.ts,config.ts: Implemented all four command handlers.src/index.ts: CLI entry point with commander; routes to commands.dist/: Compiled output (gitignore assumed).
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.
- 4d ago First seen · 49 lines · 1,346 tokens per session scan B 1652c88c7265
ccsave CLAUDE.md is an instructions file published in the GitHub repository turbommgt/ccsave (2 stars, last pushed 4mo ago), licensed MIT. It adds 1,346 tokens to every session, about $0.0067 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
aeon CLAUDE.md
Instructions for aeonfun/aeon, covering aeon, how aeon works, strategy, voice and soul file hierarchy (read in this order).
cognirepo CLAUDE.md
Claude Code instructions for ashlesh-t/cognirepo, covering claude.md, key rules, session start sequence (run in this order), behavioral confirmation rule and personas (cognirepo-402, cognirepo-403).
wayland-core copilot-instructions.md
Copilot instructions for FerroxLabs/wayland-core, covering ijfw rules, output discipline, memory routing, context discipline and cross-audit.
mcp-structured-memory CLAUDE.md
Claude Code instructions for nmeierpolys/mcp-structured-memory, a project described as: Structured Memory MCP Server.
inkwell-memory CLAUDE.md
Instructions for veronchenko/inkwell-memory, covering claude.md — inkwellmemory, layout, multi-tenant mode (inkwellmultitenant=1), conventions and testing.
RNR-Enhanced-Cognee AGENTS.md
AGENTS.md instructions for vincentspereira/RNR-Enhanced-Cognee, covering rnr enhanced cognee implementation for codex, critical requirements, 1. ascii-only output (no unicode encoding), 2. dynamic categories (no hardcoded categories) and 3. standard memory mcp interface.