memory-explore

A command for exploring the Forgetful knowledge graph, a connected collection of stored memories, documents, entities, and projects.

In plain words
What is it for?
Use it to search for a topic, follow related links, inspect connected records, and surface relevant findings.
Why use it?
It helps find related information that may be missed by looking at one memory or document at a time.

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/scottrbk/forgetful/memory-explore
Clone the repo
git clone --depth 1 https://github.com/ScottRBK/forgetful
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 610 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00610
Opus 5 $0.00004 $0.00305
Sonnet 5 $0.00002 $0.00122
Haiku 4.5 $0.00001 $0.00061

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

Security

Grade A, and why

memory-explore 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.

docs/opencode/commands/memory-explore.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Memory Explore

Perform deep knowledge graph traversal to find related memories, entities, and documents.

Query: $ARGUMENTS

Exploration Strategy

  • Explore DEEPLY - follow links aggressively, expand entities, traverse relationships
  • Be thorough - comprehensive exploration is valuable
  • Track visited IDs to prevent cycles
  • Surface only results relevant to the user's query in your final response
  • Filter out tangential discoveries

Phase 1: Semantic Entry

Start with a semantic search:

execute_forgetful_tool("query_memory", {
  "query": "$ARGUMENTS",
  "query_context": "Deep exploration via /memory-explore command",
  "k": 5,
  "include_links": true,
  "max_links_per_primary": 5
})

Collect all primary_memories and linked_memories.

Phase 2: Expand Memory Details

For each primary memory found, get full details:

execute_forgetful_tool("get_memory", {"memory_id": <id>})

Extract: document_ids, code_artifact_ids, project_ids, linked_memory_ids

Phase 3: Entity Discovery

For discovered project_ids, find related entities:

execute_forgetful_tool("list_entities", {"project_ids": [<ids>]})

Note: Entities can be explicitly linked to projects for organizational grouping using:

execute_forgetful_tool("link_entity_to_project", {"entity_id": <id>, "project_id": <id>})

Phase 4: Entity Relationships

For each relevant entity, get relationships:

execute_forgetful_tool("get_entity_relationships", {
  "entity_id": <id>,
  "direction": "both"
})

Phase 5: Entity-Linked Memories

For each entity, get linked memories:

execute_forgetful_tool("get_entity_memories", {"entity_id": <id>})

Fetch any new memories not already visited.


Response Format

After exploration, provide a structured summary:

Memories Found

Primary (N):

  • [Title] (importance: X) - brief content snippet...

Linked (N):

  • [Title] (importance: X) - connection type...

Entity-linked (N):

  • [Title] - discovered via [Entity Name]...

Read the full file on GitHub · 117 lines

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 · 117 lines · 8 tokens per session scan A 0569a7290aa9

Subscribe to this mod's changes

memory-explore is a command published in the GitHub repository ScottRBK/forgetful (296 stars, last pushed 7d ago), licensed MIT. It adds 8 tokens to every session and 610 once invoked, about $0.0000 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-08-30.