memory-graph

A browser command that opens a visual graph of the current project's stored memories.

In plain words
What is it for?
Use it to explore the memory graph in a browser when the project's memory service is running on port 7337.
Why use it?
It makes relationships between memories easier to inspect than reading them as a flat list, while checking that the local server belongs to this project.

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/d2a8k3u/claude-code-memory/memory-graph
Clone the repo
git clone --depth 1 https://github.com/d2a8k3u/claude-code-memory
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 496 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 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.00008 $0.00496
Opus 5 $0.00004 $0.00248
Sonnet 5 $0.00002 $0.00099
Haiku 4.5 $0.00001 $0.00050

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

Security

Grade A, and why

memory-graph scanned grade A 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 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

const { exec } = require('child_process');
commands/memory-graph.md · 57 lines

What it actually says

Run this Bash. It checks that the server on port 7337 belongs to the current project before opening the browser, and prints a helpful error otherwise.

node <<'EOF'
const http = require('http');
const { exec } = require('child_process');
const path = require('path');

const URL = 'http://localhost:7337';
const cwd = path.resolve(process.cwd());

const req = http.get(URL + '/api/identity', { timeout: 2000 }, (r) => {
  let body = '';
  r.on('data', (d) => (body += d));
  r.on('end', () => {
    let identity;
    try {
      identity = JSON.parse(body);
    } catch {
      console.error(`Invalid response from ${URL}. Something else may be running on port 7337.`);
      process.exit(1);
    }
    if (identity.service !== 'claude-memory') {
      console.error('Port 7337 is held by another application, not claude-memory. Free port 7337 and try again.');
      process.exit(1);
    }
    const serverCwd = path.resolve(identity.cwd || '');
    if (serverCwd !== cwd) {
      console.error(`Port 7337 is held by another claude-memory project: ${serverCwd}`);
      console.error('Close that Claude Code session (or run /memory-graph from that project) and try again.');
      process.exit(1);
    }
    const cmd =
      process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
    exec(`${cmd} ${URL}`, () => {});
    console.log(`Memory graph open at ${URL}`);
  });
});

req.on('error', () => {
  console.error(`Memory graph server not reachable at ${URL}. Restart Claude Code and try again.`);
  process.exit(1);
});
req.on('timeout', () => {
  req.destroy();
  console.error(`Timeout reaching ${URL}. The server is unresponsive — restart Claude Code.`);
  process.exit(1);
});
EOF

Then briefly tell the user what was reported. On success, mention they can search nodes, filter by memory type (semantic, episodic, pattern, procedural, working), and drag nodes to explore relations.

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. 2d ago First seen · 57 lines · 8 tokens per session scan A e8bad7041bed

Subscribe to this mod's changes

memory-graph is a command published in the GitHub repository d2a8k3u/claude-code-memory (7 stars, last pushed 2mo ago), licensed MIT. It adds 8 tokens to every session and 496 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.