ccsave CLAUDE.md

ccsave CLAUDE.md is an instructions file for coding agents from turbommgt/ccsave. It costs 1,346 tokens per session, scanned B, original, MIT.

A session snapshot for ccsave, a TypeScript and Node.js command-line tool that saves Claude Code session context into CLAUDE.md files. It records the current implementation status, design decisions, and recently fixed issues.

In plain words
What is it for?
Use it when continuing work on ccsave’s configuration, session parsing, summarisation, snapshot handling, context watching, or API-cost controls.
Why use it?
It helps an agent resume development without losing the earlier task context or repeating completed investigation.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/turbommgt/ccsave/claude-md.svg)](https://agentmods.dev/instructions/turbommgt/ccsave/claude-md)
Your own site
<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>
Per session 1,346 This file is loaded in full into every session.
When invoked 1,346 The same file — it is already loaded in full.
Security scan B 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.01346 $0.01346
Opus 5 $0.00673 $0.00673
Sonnet 5 $0.00269 $0.00269
Haiku 4.5 $0.00135 $0.00135

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

Security

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.
CLAUDE.md · 49 lines

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

  1. Model choice: Switched from claude-opus-4-6 to claude-haiku-4-5 (25x cheaper per token, sufficient for summarization).
  2. 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).
  3. Token estimation: 1 byte ≈ 0.25 tokens; warn at 150k, critical at 180k. Combined with usage logging from Anthropic response.
  4. Project identification: SHA256 hash of project path with fallback to most-recently-modified directory.
  5. CLAUDE.md format: HTML comment delimiters ([CCSAVE:START removed] / [CCSAVE:END removed]) with safe replacement logic using lastIndexOf to handle corrupt state recovery.
  6. Snapshot storage: ~/.ccsave/snapshots/ with ISO-slug naming; metadata + structured content sections.
  7. File operation tracking: Separate FileOperation type 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. Fixed replaceBlock to use lastIndexOf(BLOCK_END) instead of indexOf to 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).

Read the full file on GitHub · 49 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. 4d ago First seen · 49 lines · 1,346 tokens per session scan B 1652c88c7265

Subscribe to this mod's changes

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.