Search memory

From nowledge-co/community · View interactive version

Search memory is an AI agent skill from the GitHub repository nowledge-co/community. Search cross-tool Nowledge memories and threads for prior decisions, procedures, learnings, or exact history, with normal, deep, and progressive graph-backed retrieval. Trigger for continuation, reviews, regressions, releases, rationale, or recall language even if Codex local Memory already shows a

How to use this skill

Skill file

Find what the user already knows. Search their memories and past conversations for decisions, procedures, and context that make the current task sharper.

For continuation-style engineering work, search near the start of the task. Do not wait for the user to literally say "search memory".

Codex local Memory is useful as a hint, but it is not a substitute for this search when provenance, exact history, current cross-tool state, or prior decisions matter.

When to use

Strong signals (search when):

Contextual signals (consider searching when):

When NOT to search:

Retrieval routing

If this session already exposes the Nowledge Mem MCP server, prefer:

  1. memory_search for durable knowledge (decisions, insights, procedures).
  2. thread_search when the user is asking about a prior conversation or exact session history.
  3. thread_fetch_messages for one targeted, bounded thread read.

Otherwise:

  1. Start with nmem --json m search "query" for durable knowledge (decisions, insights, procedures).
  2. Use nmem --json t search "query" --limit 5 when the user is asking about a prior conversation or exact session history.
  3. If a result includes source_thread, inspect it once for the specific messages needed with nmem --json t show <thread_id> --limit 8 --offset 0 --content-limit 1200.

Prefer the smallest retrieval that answers the question. Do not over-fetch.

Use a limit of 5 for ordinary Memory retrieval unless the task needs more.

Intelligent retrieval routing

Treat retrieval mode and graph traversal as separate decisions. Start with the

smallest mode that can answer the user's question, then escalate only when the

result or the user's intent justifies it.

  1. Normal (default): use memory_search (or

nmem --json m search "query" --mode normal) for a bounded recall of a

concrete fact, a recent decision, or a simple "what do we know" question.

Keep the default limit at 5.

  1. Deep: use mode="deep" (or --mode deep) when the user asks about

concepts, rationale, history, relationships across topics, or why a choice

was made. Escalate after Normal when it is empty, ambiguous, weakly

supported, conflicting, or leaves an important part of the question

unanswered. Prefer the server's evidence and trust warnings over a hardcoded

score threshold; never invent a threshold the server did not return.

  1. Progressive graph search: use it when the user names an exact Memory ID

or URI, asks to start from a node, or wants related memories, neighbors,

lineage, or a trace. If no seed is supplied, run a bounded Normal/Deep

search first and select only exact IDs from its ranked results.

After a non-empty search, the default graph view is a focused graph of that

result set. A graph view does not by itself mean "search the whole graph".

Use progressive expansion only when more relational evidence is needed or the

user asks to continue.

Progressive one-hop protocol

Maintain this explicit state across expansion calls:

For each step, expand one selected frontier node by one hop:

nmem --json graph expand <memory-id> --depth 1 --limit 20

Use an equivalent graph-expansion MCP tool when the host exposes one. Keep

depth=1 per call, de-duplicate against visited, preserve edge types and

the returned order, and update frontier only with new relevant IDs. Default

limits are at most 5 hops and 20 neighbors per hop. Do not automatically

expand every neighbor or empty the whole graph in one turn. Stop when the

answer is sufficiently supported, the next frontier is empty/repeated, or the

maximum depth is reached. If the user explicitly requests a deeper walk, still

make it one hop per call and stop at depth 5 unless the server advertises a

different safe limit.

For progressive results, report the seed, hop, center node, newly discovered

IDs, remaining frontier, and the reason for stopping or continuing. This is a

retrieval trace, not hidden chain-of-thought.

Preserve the configured identity and Space. Use explicit scope arguments only

where the installed command supports them; do not infer a Space from the

current folder. The graph expansion command may rely on ambient configuration

and may not support --space. Apply the scope checks in explore-graph before

expansion; if the graph surface cannot enforce the retrieval scope, skip it.

Show what was retrieved

After every successful memory_search or equivalent CLI/KFS Memory search that

returns at least one Memory,

automatically visualize the result set. Preserve the server's ranked order and

pass all returned Memory IDs; never infer or substitute IDs.

First apply the explore-graph skill's identity and Space checks. Exact seed

IDs do not enforce authorization. For Space- or Team-restricted retrieval,

visualize only when the graph surface is confirmed to enforce the same

owner/member/Space restrictions. Otherwise skip the graph and explain why.

  1. Prefer the MCP explore_graph tool with the comma-separated IDs,

depth=1, and limit=15. Its MCP App metadata lets a capable host render

the focused graph inline in chat.

  1. If explore_graph is unavailable, use the explore-graph skill's

standalone fallback with the same exact IDs.

  1. Do not open a second standalone graph when the inline App succeeds. Do not

open a graph for an empty result set or for thread-only retrieval.

Whenever Memory results materially inform the answer, include a compact

retrieval trace with the observable query, mode, scope, filters, and

the result rank, Memory ID, title, and server-returned score when present.

Name whether MCP or the nmem CLI performed the search. If the server omits a

field, say it was unavailable instead of guessing. Do not expose or invent hidden reasoning; this trace describes tool inputs and outputs only.

Deep mode

If results are weak or the need is conceptual/historical, try deeper matching:

nmem --json m search "query" --mode deep

Knowledge tree routing

When the user needs to browse across multiple object types, inspect nearby context, or asks for a file/tree/vault-like view, use the Knowledge Filesystem instead of only flat search.

Prefer MCP mem_fs when available:

capabilities
recall "session token strategy" --in /memories -k 5
find /memories --label decisions --since 2026-01-01
grep "JWT rotation" /memories
grep -E "JWT|token" /threads
cat /memories/by-id/<id>.memory.md

Otherwise use:

nmem fs capabilities --json
nmem fs recall "session token strategy" --in /memories -k 5
nmem fs ls /wiki
nmem fs cat /wiki/topics/<topic>.topic.md

Use capabilities before assuming roots or future verbs. Use recall for fuzzy phrasing, find for metadata constraints, grep for exact strings, grep -E for explicit regex, then stat or cat the returned paths. KFS paths are Mem identifiers, not local OS files; mount and SQL/Cypher are later phases.

Filters

Add filters only when the task clearly implies them:

Summarize only the strongest matches and clearly say when nothing relevant was found.

Links

Bounded thread reads

Search memories or threads first, then choose the specific conversation and message range needed. Call thread_fetch_messages, a host thread-fetch tool, or nmem --json t show at most once per question, using a small message limit (for example 8) and a content limit of 1200 where supported. A known target range may use a nonzero offset once.

Never loop over offsets to reconstruct a conversation. Do not raise --content-limit to compensate for a slow or incomplete read. Small output limits do not guarantee cheap server-side work on every deployed backend. If a read is slow, incomplete, fails or times out, stop, report the evidence gap, and refine the search rather than retrying pages. A later explicit user request for another range is a new bounded read; a routine “continue” is not permission to drain the thread.

What Each Search Matches

exact times, people, and wording live in the source conversation. A result's

source_pointer names that thread and the message range the Memory came

from. For one bounded CLI read, use the offset and limit from

source_pointer.expand in nmem --json t show <thread_id> --offset <offset> --limit <limit>.

If the hint omits the range, use offset 0 and limit 8. Verify a result

labeled anchor_support (low confidence) there before relying on it.

names, exact words, and distinctive terms, and try a few phrasings when the

first finds nothing. A search_guidance hint lists the query terms no Memory

contained; they are good thread-search terms. A thread_evidence block holds

a few keyword-matched raw messages; treat them as leads, not conclusions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.