save-memory

save-memory is a command for coding agents from 0xK3vin/MegaMemory. It costs 0 tokens per session (857 once invoked), scanned A, original, MIT.

A command for recording useful information from a work session in a knowledge graph, which is a connected store of facts and relationships.

In plain words
What is it for?
Use it after work on a project to review existing knowledge, find overlap, and save new or updated information.
Why use it?
It helps preserve project understanding, decisions, patterns, and changes so they are not lost between sessions.

Command

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 commands/0xk3vin/megamemory/save-memory
Clone the repo
git clone --depth 1 https://github.com/0xK3vin/MegaMemory

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 save-memory

README.md
[![agentmods](https://agentmods.dev/badge/commands/0xk3vin/megamemory/save-memory.svg)](https://agentmods.dev/commands/0xk3vin/megamemory/save-memory)
Your own site
<a href="https://agentmods.dev/commands/0xk3vin/megamemory/save-memory"><img src="https://agentmods.dev/badge/commands/0xk3vin/megamemory/save-memory.svg" alt="Measured on agentmods" height="20"></a>
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 857 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00857
Opus 5 $0.00000 $0.00428
Sonnet 5 $0.00000 $0.00171
Haiku 4.5 $0.00000 $0.00086

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

Security

Grade A, and why

save-memory 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.

commands/save-memory.md · 85 lines

How it starts

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

Save Session Knowledge

You are saving what you learned this session into the megamemory knowledge graph. This is YOUR memory — record anything valuable for future sessions: what you understood about the project, what you built, decisions that were made, patterns you noticed, or intent the user shared.

Step 1: Load existing graph

Call megamemory:list_roots to see what's already recorded. Understanding the current state prevents duplicates and helps you decide what to update vs create.

Step 2: Reflect on this session

Think about what happened this session. Consider:

  • What did you learn about the project's purpose or intent?
  • What features, modules, or components did you build or change?
  • What design decisions were made and why?
  • What patterns or conventions did you discover?
  • What architectural understanding do you have now that isn't in the graph?
  • Did anything get removed, replaced, or deprecated?

Step 3: Search for overlap

Before creating anything new, call megamemory:understand with queries based on what you worked on this session. For each area you touched, search to see if concepts already exist that should be updated rather than duplicated.

For example, if you worked on authentication, call: megamemory:understand — query="authentication"

Do this for each distinct area. Existing concepts that are stale or incomplete should be updated — don't create a new node when an update will do.

Step 4: Write to the knowledge graph

For each thing worth remembering:

New understandingmegamemory:create_concept

  • name: human-readable name
  • kind: use decision for intent/rationale, feature for capabilities, module for subsystems, pattern for conventions, config for setup, component for distinct pieces of a system
  • summary: be specific — include parameter names, defaults, file paths, behavior details, and the WHY behind things
  • why: the rationale — this is often the most valuable part
  • file_refs: relevant files if applicable
  • edges: connect to existing concepts where relationships exist [{to: "concept-id", relation: "depends_on|implements|calls|connects_to|configured_by", description: "why"}]
  • created_by_task: brief description of what you were doing this session

Read the full file on GitHub · 85 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 · 85 lines · 0 tokens per session scan A ca14121aa1a9

Subscribe to this mod's changes

save-memory is a command published in the GitHub repository 0xK3vin/MegaMemory (513 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 857 tokens. 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.