Wiki Find CLI — Baseline Agent Retrieval

Date: 2026-04-20 Status: approved for implementation Owner: mnemosyne

Problem

Agents currently have no fast, deterministic way to locate a wiki page by keyword. Two retrieval paths exist, both wrong for this job:

  1. mnemosyne wiki query <question> — calls Ollama (gemma), synthesizes prose. Slow (seconds to minutes), token-heavy, returns narrative not paths. Designed for "answer the question" not "locate the doc."
  2. mcp__aion__aion_wiki — MCP wrapper around the same Ollama path. Same cost profile.

Real incident captured during this brainstorm: a second session's agent spent 6+ minutes and 4k tokens running four wiki query calls to locate the Mastra framework decision doc. None succeeded — partly because the answer was synthesized away from the actual paths, partly because the source research doc was not ingested into the vault.

Baseline capability missing: "does a wiki page exist for X, and where is it?"

Goals

Operator requirements:

Non-goals:

Design

Command

mnemosyne wiki find <keyword> [<keyword>...] [--cat] [--json] [--limit N]

Match Semantics

Output — Default

Compact list, one page per line:

analyses/mastra-framework-decision-trail.md — Mastra Framework Decision Trail
hermes/hermes-mastra-changelog-analysis.md — Hermes Mastra Changelog Safety Analysis

Format: <relative-path> — <title>. Path is relative to vault root (stable across machines, operator knows the vault). Title is the page's frontmatter title field, falling back to filename stem when missing.

Flags

Exit Codes

Scope of Search

Same surface as _list_wiki_pages() in src/mcp/aion_tools.py:132:

VAULT_ROOT and CONSTELLATIONS imported from src/wiki/config.py — no hardcoded paths.

Implementation

Files

New: src/wiki/find.py

New: tests/test_wiki_find.py

Modified: src/mnemosyne.py

Modified: .claude/context/commands.md

Modified: CLAUDE.md (wiki section) — add wiki find as primary retrieval primitive; wiki query demoted to "when you need synthesis, not location"

Acceptance Criteria

  1. mnemosyne wiki find mastra returns existing matches in under 500ms on current vault (94 pages)
  2. mnemosyne wiki find nonexistent exits 1, stderr has error message, stdout empty
  3. mnemosyne wiki find mastra slack applies AND — fewer or equal results than single-keyword
  4. mnemosyne wiki find <unique-keyword> --cat dumps full matching page body
  5. mnemosyne wiki find mastra --cat (multiple matches) exits 2 with helpful stderr
  6. mnemosyne wiki find mastra --json produces valid JSON parseable by agents
  7. All existing tests still pass; new find tests >= 6 cases, all green
  8. Separately: Source research doc agent-ecosystem-report-2026-03.md (from archived mimir-agent repo) ingested into Aion vault under analyses/ with constellation owner = atlas. Verifies the real-world use case that triggered this design.

Out of Scope

Risks & Mitigations

References