4 min read · For developers building on the Claude API, the Agent SDK or Claude Code
memory_20250818) is client-side: Claude asks to read or write files under /memories, and your code does it. That makes the handler a security boundary. ThumbGate ships one: paths cannot leave /memories, secrets are redacted before anything is written, sizes are capped, and your thumbs-down rules appear read-only at /memories/thumbgate-rules.md. Copy the loop below, or run npx thumbgate init --memory-tool for Claude Code.Anthropic's memory tool docs name the risks you own when you implement it: path traversal out of the memory folder, sensitive data written into memory, and files that grow without bound. A memory file outlives the conversation. An API key Claude read in a tool result and then wrote into a note stays on disk, and comes back into every later session that views it.
ThumbGate's handler checks each command before it touches disk:
/memories (.., %2e%2e, backslashes), any path through a symlink, and deleting or renaming /memories itself.[REDACTED:<kind>] before writing, and says so in the result so Claude knows.view at 40,000, so Claude pages with view_range./memories/thumbgate-rules.md, built from the rules this project learned from your thumbs-down. It is read-only.memory-tool-log.jsonl.npm install thumbgate @anthropic-ai/sdk, set ANTHROPIC_API_KEY, then:
const Anthropic = require('@anthropic-ai/sdk');
const { createMemoryTool } = require('thumbgate/adapters/claude-agent-sdk/memory-tool.js');
const memory = createMemoryTool({ root: './agent-memory' });
const client = new Anthropic();
const messages = [{ role: 'user', content: 'Pick up where we left off on the release checklist.' }];
async function main() {
for (;;) {
const res = await client.messages.create({ model: 'claude-opus-5-5', max_tokens: 4096, tools: [memory.definition], messages });
messages.push({ role: 'assistant', content: res.content });
const uses = res.content.filter((b) => b.type === 'tool_use' && b.name === 'memory');
if (!uses.length) return res;
messages.push({ role: 'user', content: uses.map((b) => {
const r = memory.execute(b.input);
return { type: 'tool_result', tool_use_id: b.id, content: r.content, is_error: r.isError };
}) });
}
}
main().then((res) => console.log(res.content.filter((b) => b.type === 'text').map((b) => b.text).join('\n')));
memory.definition is { type: 'memory_20250818', name: 'memory' }. Results use the wording the memory tool docs give, and errors come back with is_error: true. ThumbGate's test suite runs this exact snippet from the README against a stand-in client on every change.
npx thumbgate init --memory-tool, or answer yes when npx thumbgate init asks.claude_memory tool, stored in .thumbgate/memories in the project you selected.Or set it by hand on the ThumbGate server in .mcp.json: "env": {"THUMBGATE_MEMORY_TOOL": "1"}. ThumbGate's own repository runs with it on.
/mcp endpoint never lists or runs it.sdk or mcp, never a path or text) so we can count adoption. THUMBGATE_NO_TELEMETRY=1 turns it off.ThumbGate is an independent project and is not made by or affiliated with Anthropic.
Pre-action gates built from your own thumbs-down, and a memory tool that cannot leak a key into a note.