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 skills/latestaiagents/agent-skills/memory-toolnpx skills add latestaiagents/agent-skills --skill memory-toolgit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote 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/skills/latestaiagents/agent-skills/memory-tool)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/memory-tool"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/memory-tool.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.1 | $0.00104 | $0.01635 |
| Opus 5 | $0.00052 | $0.00817 |
| Sonnet 5 | $0.00021 | $0.00327 |
| Haiku 4.5 | $0.00010 | $0.00163 |
Grade A, and why
memory-tool 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Memory Tool
The Memory tool lets Claude read and write files in a client-managed directory, giving agents persistent state across sessions without RAG infrastructure.
When to Use
- Agents that need to remember user preferences, project context, or past decisions
- Coding agents that accumulate knowledge about a codebase over sessions
- Support/assistant agents that build up a history per user
- Replacing "dump everything into system prompt" with structured persistent state
Core Concept
The Memory tool is a server-side tool (provided by Anthropic) that Claude can call to read, write, and list files in a directory you manage. The API gives the tool calls; your app executes them against real storage (local fs, S3, DB-backed fs).
const response = await client.beta.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 4096,
tools: [{ type: "memory_20250818", name: "memory" }],
messages: [...],
});
Implementing the Memory Backend
When Claude calls the memory tool, your app handles the file operations. Minimal implementation:
import fs from "fs/promises";
import path from "path";
const MEMORY_ROOT = "/var/app/memory";
async function handleMemoryCall(input: any, userId: string) {
const userRoot = path.join(MEMORY_ROOT, userId);
const safe = (p: string) => {
const resolved = path.resolve(userRoot, p.replace(/^\//, ""));
if (!resolved.startsWith(userRoot + path.sep)) throw new Error("Path escapes root");
return resolved;
};
switch (input.command) {
case "view": {
const target = safe(input.path);
const stat = await fs.stat(target).catch(() => null);
if (!stat) return { error: "not found" };
if (stat.isDirectory()) {
const entries = await fs.readdir(target);
return { content: entries.join("\n") };
}
return { content: await fs.readFile(target, "utf-8") };
}
case "create": {
await fs.mkdir(path.dirname(safe(input.path)), { recursive: true });
await fs.writeFile(safe(input.path), input.file_text);
return { content: "created" };
}
case "str_replace": {
const f = safe(input.path);
const text = await fs.readFile(f, "utf-8");
if (!text.includes(input.old_str)) return { error: "old_str not found" };
await fs.writeFile(f, text.replace(input.old_str, input.new_str));
return { content: "replaced" };
}
case "insert": {
const f = safe(input.path);
const lines = (await fs.readFile(f, "utf-8")).split("\n");
lines.splice(input.insert_line, 0, input.insert_text);
await fs.writeFile(f, lines.join("\n"));
return { content: "inserted" };
}
case "delete": {
await fs.rm(safe(input.path), { recursive: true, force: true });
return { content: "deleted" };
}
case "rename": {
await fs.rename(safe(input.old_path), safe(input.new_path));
return { content: "renamed" };
}
}
}
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.
- 2d ago First seen · 194 lines · 104 tokens per session scan A 45d2f8df337b
memory-tool is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 104 tokens to every session and 1,635 once invoked, about $0.0005 per session on Opus 5. 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-09-03.
Other skills, from other repositories
external-memory-plugin
Develop, adapt, review, test, and troubleshoot Nexent external memory provider plugins, including plugin.yaml manifests, searchable and ingestible provider protocols, error mapping, network-isolated unit tests, deployment configuration, and Mem0-based examples. Use when adding a new external memory vendor, changing an…
agent-memory-coordinator
Agent skill for memory-coordinator - invoke with $agent-memory-coordinator.
agent-collective-intelligence-coordinator
Agent skill for collective-intelligence-coordinator - invoke with $agent-collective-intelligence-coordinator.
knowledge-graph-management
Capture, validate, query, and sync architectural patterns and design decisions in the knowledge graph.
langchain-memory
LangChain memory integration including ConversationBufferMemory, ConversationSummaryMemory, and vector-based memory.
memory-summarization
Conversation summarization for memory compression and context management.