AGENT SKILL

memex:index:search

Federated search across every registered Memex store via the Reference Librarian. Lower-level primitive that memex:brain:ask builds on — use directly when a consumer (Atelier, custom plugin) needs raw query results without Brain-specific formatting.

License 许可
MIT
所属仓库
nitekeeper/memex
最近更新
2026-09-22
Stars
★ 0
Forks
0

01 前言 Front Matter

name
memex:index:search
description
Federated search across every registered Memex store via the Reference Librarian. Lower-level primitive that memex:brain:ask builds on — use directly when a consumer (Atelier, custom plugin) needs raw query results without Brain-specific formatting.

03 SKILL.md 正文

memex:index:search

When to use

A consumer needs ranked, citation-ready hits from the federated Index without going through Brain. memex:brain:ask is a convenience wrapper around this skill that adds user-friendly reporting; use this skill when you want the raw ranked list.

Inputs

  • query — natural-language question (string)
  • (optional) caller_agent_id — defaults to "reference-librarian-1" (the Reference Librarian itself acts as the caller for audit purposes)

Recipe (Option-B Task-tool dispatch)

Step 1 — Prepare

from scripts.agents import reference_librarian
prep = reference_librarian.ask_prepare(query, caller_agent_id="reference-librarian-1")

Step 2 — Dispatch the Reference Librarian subagent

Use the Task tool:

  • subagent_type: general-purpose
  • description: Reference Librarian: build query plan
  • prompt: prep["subagent_prompt"]
  • model: claude-haiku-4-5

Mechanical query-plan extraction — haiku. (Enforced by tests/test_model_tier_dispatch.py.)

Subagent returns a JSON query plan with fts_query, vector_query, filters, limit.

Step 3 — Parse + handle clarification

query_plan = reference_librarian.parse_query_plan(subagent_response)
if "clarify" in query_plan:
    return {"status": "needs_clarification", "question": query_plan["clarify"]}

Retry once on parse failure. After two failures, return BLOCKED.

Step 4 — Execute

from scripts import embeddings
try:
    results = reference_librarian.ask_execute(prep, query_plan, with_embedding=True)
except embeddings.EmbeddingUnavailable as e:
    embeddings.log_skip(
        e,
        caller_agent_id=caller_agent_id,
        input_chars=len(query_plan["vector_query"] or ""),
    )
    results = reference_librarian.ask_execute(prep, query_plan, with_embedding=False)

Catches only EmbeddingUnavailable; other errors propagate (no silent FTS5-only fallback on real bugs).

Returns a list of dicts: [{index_id, key, domain, store, table_name, row_id, searchable, embedding}, ...]. Ordered by relevance.

Step 5 — Return raw results

This skill does NOT fetch full rows from target stores; the caller decides whether to hydrate. Just return the list from Step 4.

Notes

  • Hybrid retrieval (FTS5 + vector cosine) is attempted by default; the skill falls back to FTS5-only if embedding encoding fails (no API key, provider error, etc.).
  • Filters supported: domain (e.g., "article", "decision"), store (e.g., "article", "atelier-projectX"). The Reference Librarian decides whether to set them based on the user's question.
  • Limit defaults to 10. The subagent can raise it for broad survey queries, lower it for focused lookups.
  • Caller's context isolation: same as Librarian — the Reference Librarian's profile and reasoning stay in the subagent's context; the caller's context carries only the parsed plan + results list.

04 同仓库更多 Skills

nitekeeper
nitekeeper/memex

run

Use to invoke any Memex v2.0 operation. Routes user-facing intents (ingest, ask, capture, lint, synthesize, dashboard) and agent-facing CRUD primitives to the right internal procedure.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:reconcile-orphan

Authorized fix-up of a flagged orphan. Four actions — delete-index (remove documents row), repair (backfill row_id when target exists), reindex (re-run Librarian; deferred), note (acknowledge). Raises OrphanNotFoundError when index_id is unknown or, for repair, already linked.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:dashboard

Launch a loopback-only, read-only HTTP dashboard over Memex — per-store summary, the federated index, knowledge communities, the code-navigation graph, and the agent registry, plus keyword search, a click-to-read content overlay, and an interactive 3D knowledge-graph view.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:audit

Run a full integrity audit across the Memex Index and all registered stores. Detects orphans, broken relations, schema drift. Writes a structured audit report to ~/.memex/audits/. Read-only — never auto-fixes.

★ 0
nitekeeper
nitekeeper/memex

memex:steward:audit-store

Run an integrity audit scoped to a single registered store (reverse orphans + schema drift). Lighter than full audit.

★ 0
nitekeeper
nitekeeper/memex

memex:index:write

Direct write to the federated Index — the lower-level primitive that memex:brain:ingest and memex:brain:capture build on. Use when a consumer (Atelier, custom plugin) needs to add a document to its own store and have it indexed by the Librarian, without going through the Brain layer. Routes through Librarian subagent + Memex Core.

★ 0