N3MemoryCore MCP — Lite (Ephemeral)
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| N3MC_DATA_DIR | No | Override for data directory where config.json is stored. | |
| N3MC_REDIS_URL | No | Redis connection URL. Overrides config.json redis_url. | |
| N3MC_SESSION_ID | No | Session ID for memory namespace. Used as fallback if not provided per call. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
N3MemoryCore — Lite (Ephemeral Memory)
This MCP server gives you hybrid-search memory (vector + BM25) backed by Redis Stack. It is the free Lite build of N3MemoryCore: every entry expires 7 days after it was saved. Treat it as a short-lived scratchpad, not a long-term store.
BEHAVIORAL RULES
ROLE WHEN PRO IS ALSO CONNECTED (coexistence policy) If a persistent N3MemoryCore memory is also registered as an MCP server in the same session —
n3mc-pro(N3MC MCP Pro),n3mc-pg(its PostgreSQL edition) orn3mc-longtermmemory(the earlier MCP Pro) — treat the two servers as complementary, not redundant:THIS SERVER (Lite, ephemeral) is the working-memory / scratchpad. Route here: in-session progress notes, temporary debugging state, throwaway intermediate results, transient task context — anything that will be irrelevant next week.
PRO is the canonical long-term store. Route THERE (not here): user profile / preferences, project specs and architecture decisions, world-building / character settings / design artifacts, API contracts, research summaries, outlines, and anything the user wants retained across sessions.
When in doubt, prefer Pro. "Painful if lost" > "fine if it vanishes".
Search order at the start of a turn: Pro first, then Lite.
Do NOT double-save the same fact to both servers.
When Pro is connected, the TTL warning (rule 7 below) is generally unnecessary — just route long-term content to Pro instead.
If Pro is NOT connected, this server is the sole memory store. Accept all content, and emit the TTL warning (rule 7) when the user signals an expectation of permanence.
SEARCH FIRST, THEN ACKNOWLEDGE WHEN YOU USE MEMORY HOOK CLIENTS: if your context already contains a block with the line "Source: N3MC Lite (7-day working memory)" (the N3MC Lite hooks of Claude Code put it there), the memory was already searched for this message. Call
search_memoryonly when that block is not enough. A "# Recalled Memory Context" block without that line comes from another product and does not count.Otherwise, at the start of every user turn, call
search_memorywith a concise representation of the user's intent (key nouns + verbs). Use the returned snippets as context when formulating your answer.When your answer actually draws on retrieved memories (i.e. you are recalling or reusing information that was saved in an earlier turn), OPEN the reply with a short acknowledgment IN THE USER'S LANGUAGE. Examples:
Japanese: 「前回の回答がメモリに保存されています。」 「以前の会話から該当情報を取り出しました。」
English: "Pulling this from earlier memory in this session." "Recalling the setting you saved earlier."
If
search_memoryreturned nothing relevant, or you did not actually use the retrieved content, proceed normally with no announcement. Do not announce the mere act of searching — only the act of recalling.SAVE AFTER EVERY SUBSTANTIVE EXCHANGE — AUTOMATIC, NO PERMISSION ASKED HOOK CLIENTS: if your context contains the block with the line "Source: N3MC Lite (7-day working memory)", every message and reply is already saved by the hooks. Do NOT call
save_memoryon every turn; call it only when the user asks you to remember something.Without that block, saving is silent and automatic. The user should NEVER have to say "save this" or "remember that" — you save by default. Do NOT ask the user whether to save. Do NOT wait for the user to confirm. Just save.
After every meaningful turn, call
save_memoryto persist: (a) The user's intent / question (short paraphrase, not verbatim). (b) YOUR OWN substantive output — decisions, plans, answers, and especially any creative or generated content the user may refer back to later: world-building, character settings, design sketches, code architecture, research summaries, outlines, etc. If you invested more than a sentence or two producing it, save it. (c) Key facts, preferences, and unresolved questions. Use onesave_memorycall per distinct fact (~50-200 chars each). Long content goes to rule 3. Exact duplicates are auto-rejected server-side, so err on the side of saving more. Near-duplicates are NOT rejected: an updated fact or a re-made document is saved as a new entry, andsearch_memoryshows the newest version first. NOTE: Lite memories expire 7 days after they are saved — this is a rolling scratchpad, not a permanent archive.Routing reminder: if Pro is also connected, long-lived content goes to Pro, not here. See rule 0.
NOTE ON CODE BLOCKS: If the server config has
skip_code_blocks: true, any content containing a triple-backtick fence (```) is rejected withstatus: "skipped_code". The default isfalse: the content is saved with each code block replaced by [code omitted] — the code itself is never kept or returned (it belongs in the project files). If you seeskipped_codecome back, do NOT retry with the same payload — the user has opted out of code saving on purpose; save a prose description of what the code does instead. Do not announce the skip unless the user explicitly asks why a previous save did not stick.LONG CONTENT — SAVE VERBATIM IN ONE CALL When the turn produces OR receives a long body (> ~400 chars) the user may want back verbatim — a pasted spec / article / log, or a long creative setting you just generated — pass the FULL text to a SINGLE
save_memorycall. The server creates a parent-document + chunks automatically and returns the full body on recall. Do NOT split long verbatim-worthy content into many short summaries.If Pro is connected, long verbatim content that the user may want months later belongs in Pro, not here.
TOOL-ERROR HANDLING — NEVER GENERATE LONG CONTENT BLIND If
search_memoryorsave_memoryreturns a server error (Redis unreachable, timeout, "start Redis Stack" hint, etc.), STOP and announce the failure to the user in their language BEFORE generating any long creative or spec content. Otherwise every subsequentsave_memoryfails silently and the user loses their work when the session closes.Required on error:
Surface the error succinctly.
Relay the recovery hint the tool returned (e.g. the docker run command).
Ask whether to proceed WITHOUT memory or pause until backend is restored.
Short factual replies may proceed, but still mention the error once.
SKIP NOISE Do not save greetings, confirmations, or purely mechanical acknowledgments.
RESPECT EXPLICIT REQUESTS If the user says "don't save this" or "forget that", call
delete_memoryand do not persist that content.INFORM THE USER ABOUT THE 7-DAY TTL WHEN THEY EXPECT PERMANENCE The Lite build's 7-day TTL is visible to you (this instructions block, the
search_memorydescription, and thettl_secondsfield in everysave_memoryresponse) but the USER does not see any of that. By default, silent auto-save (rule 2) is correct — do NOT mention TTL on every save. However, when the user's message signals an expectation of long-term retention, add ONE short sentence reminding them that Lite memories expire 7 days after they were saved, and suggest backing up externally if they want permanence. Do NOT ask permission to save; save anyway, then mention the TTL.IF PRO IS CONNECTED: prefer routing the long-term content to Pro (see rule 0) rather than emitting this warning. The warning is primarily for sessions where Lite is the only memory backend.
Signals that warrant the reminder (examples, non-exhaustive):
Explicit permanence words: "remember this forever", "don't forget", "save this permanently", "keep this for next time", "次回も覚えていて", 「ずっと覚えておいて」「永続的に保存して」「絶対忘れないで」
Pasting or generating a long setting / spec / world- building / character sheet that the user obviously invested time in.
The user referring back to content they saved more than ~5 days ago, where there is a real risk of imminent TTL expiry.
Phrase the reminder in the USER'S LANGUAGE. Examples:
Japanese: 「なお、Lite 版のメモリは保存から7日で自動削除されます。 永続保存が必要な場合は Pro 版(sqlite-vec バックエンド)を、 もしくは外部バックアップをご検討ください。」
English: "Note: Lite memories auto-expire 7 days after they're saved. For permanent storage, use the Pro build (sqlite-vec backed) or back it up externally."
Emit the reminder ONCE per distinct long-term signal — not once per turn, not once per save. Do not repeat it if the same user has already been warned in the current conversation.
SESSION_ID AS PROJECT / TASK GROUPING KEY Both save_memory and search_memory accept an optional
session_idargument. When multiple AI agents collaborate on the same project or task, they SHOULD pass the samesession_idstring (e.g."proj-alpha","task-refactor-auth") on every call.Effect in Lite (same contract as Pro): rows whose stored session_id matches the request's effective session get a ranking boost (b_session_match=1.0); non-matching rows are dampened (b_session_mismatch=0.6). Passing a consistent session_id therefore surfaces THIS project's memories above unrelated cross-project noise sharing the same Redis instance. The boost is multiplicative on top of the existing (cos·0.7 + bm25·0.3) · time_decay · b_local score.
The value of passing session_id in Lite is therefore (a) ranking — pin recall to the current chat / project, (b) the filter key for
delete_memories_by_session(tear down a finished project's memories without waiting for TTL), and (c) Pro migration compatibility (the same session_id keeps working when the workload moves to Pro's persistent backend).Precedence for session_id resolution: (a) Per-call
session_idargument (highest precedence — use this when an orchestrator wants to pin child-agent calls to a specific project). (b)N3MC_SESSION_IDenvironment variable (set once at process start — use this when the whole Claude Code process is dedicated to one project). (c) Per-process UUIDv4 (fallback — fresh on each server start). Note that this fallback changes across restarts, so cross-restart recall of rows tagged with the previous run's UUID will receive the b_session_mismatch dampening unless you pin session_id explicitly via (a) or (b).When working on a named project or task, pass
session_idon every save and search. For ad-hoc work, leave it blank.BULK CLEANUP —
delete_memories_by_sessionUse this tool to wrap up a finished project or reset a polluted workspace before TTL expiry. It removes every memory (singles, parent docs, child chunks, sha index entries) whose session_id matches. Scoped to the configured owner.Use cases:
Project closed and you want to keep search results clean.
A test/debug session generated noise that's hurting later recalls.
Reclaiming Redis memory early instead of waiting 7 days.
Confirm the session_id with the user before calling — this delete is irreversible.
THREAD CONTEXT RETRIEVAL —
recall_thread(§4.3.1)search_memoryresults include aturn_idfield when the memory was saved with one. When a search hit lacks enough context to be actionable — for example, the snippet is a fragment without clear meaning on its own — callrecall_threadwith that hit'sturn_idto retrieve the full thread of memories from the same conversation turn, plus N entries before and after it chronologically.Usage pattern:
search_memoryreturns a hit withturn=<some-id>in the header.You judge the snippet insufficient for answering the user.
Call
recall_thread(turn_id="<some-id>", before=2, after=2).The tool returns the turn's memories in chronological order with "▶" markers on the target turn's entries and unmarked neighbors.
When saving memories, use the optional
turn_idargument on everysave_memorycall in a turn so futurerecall_threadlookups work:Choose any stable string for the turn (e.g. a short UUID, or "turn-1", "turn-2", …). Use the SAME value for all saves within one turn.
You do NOT have to tag every save; only do so when the turn's context might be worth reconstructing later (multi-step tasks, long creative sessions, research threads, etc.).
The user does not need to be aware of
recall_thread; it is an internal tool you use proactively to enrich recall quality.VERSIONS AND NOTICES Every
search_memoryhit shows asaved=time. When several versions of the same content appear in the results, the one with the newestsaved=time is the current one — answer from it (mention the change if it matters).If a
search_memoryresult starts with> ⚠️ N3MC notice:, tell the user what it says, in their language (e.g. theirconfig.jsoncould not be read, or a setting has the wrong type and was ignored).WEAK MATCHES Records under
#### Possibly related (weak matches — may be unrelated)did not pass the relevance floors and are added only so that a search is never empty. Use one only when it is actually relevant to the question; if it is not, ignore it and do not mention it (do not say that unrelated memories were found).
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| search_memoryA | Hybrid (vector + BM25) search over stored memories. Call this at the start of every user turn. Each hit shows its saved= time; when several versions of the same content appear, the newest is listed first and is the current one. When fewer than min_results (default 3) rows pass the relevance floors, the closest dropped rows are added under 'Possibly related (weak matches — may be unrelated)': they are often unrelated — use one only when it is actually relevant to the question; if it is not, ignore it and do not mention it. NOTE: Lite memories expire 7d after they were saved. |
| save_memoryA | Save a memory entry (Lite: 7-day TTL). Rejects exact duplicates only; an updated fact or a re-made document is saved as a new entry (search_memory lists the newest version first). Long content (>chunk_threshold chars) is chunked with a parent-document for verbatim recall. |
| list_memoriesA | List stored memories newest first. Parent documents shown with [doc×N] tag. |
| delete_memoryA | Delete a memory by ID (only memories of the configured owner). If the ID is a parent document (doc:), cascades to all child chunks. |
| delete_memories_by_sessionA | Delete every memory (singles, parent docs, child chunks, sha guards) whose session_id matches. Scoped to the configured owner. Use this to wrap up a finished project or reset a polluted session before TTL expiry. IRREVERSIBLE — confirm session_id with the user first. |
| repair_memoryA | Re-ensure the RediSearch index (idempotent) and add missing vectors (up to 200 per call) to entries saved while the embedding model was unavailable. Returns {status, message, reembedded, remaining}. |
| recall_threadA | §4.3.1 — Retrieve the memories sharing a turn_id plus N entries before and after in chronological order. Use this when a search_memory hit lacks enough context: pass the hit's turn_id here to surface the surrounding conversation thread. Only entries of the session of that turn are returned. Returns {status:'not_found'} if turn_id is unknown, and {status:'ambiguous', session_ids} if the turn_id is in several sessions: call again with one of them as session_id. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 7 tools
Each tool has a distinct verb+target: save/search/list/recall for reading and writing, delete and repair for maintenance. The only confusable pairs are delete_memory vs delete_memories_by_session and list_memories vs search_memory, but their descriptions clearly separate scope (single ID vs session) and retrieval mode (enumeration vs hybrid search).
All seven tools follow a uniform snake_case verb_noun pattern (save_memory, search_memory, list_memories, recall_thread, repair_memory, delete_memory, delete_memories_by_session). The only stylistic variation is the descriptive '_by_session' suffix, which is still consistent with the convention.
Seven tools is well-scoped for an ephemeral memory store: two write paths, three read paths, two delete paths plus a maintenance tool. No filler tools and no obvious duplication that would need pruning.
Coverage spans create (save_memory), read (list/search/recall_thread), delete (single and by session), and index maintenance (repair_memory); updates are intentionally modeled as new saves. The main gap is a direct get_memory-by-ID retrieval, forcing agents to go through search or list when they already hold an ID.