[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75Y91DCKXMZ90KRAQ944937":3,"skill-same:01M75Y91DCKXMZ90KRAQ944937":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":28,"updatedAt":29,"install":30,"resources":43},"01M75Y91DCKXMZ90KRAQ944937","memex:brain:ask",null,"Ask a natural-language question against the personal Brain. Routes through the Reference Librarian subagent which builds a query plan (FTS5 + optional vector), Python executes against ~\u002F.memex\u002Findex.db, fetches full rows from target stores, and returns ranked citation-ready hits.","nitekeeper\u002Fmemex","nitekeeper","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F130331363?v=4","01M75Y8ZMS1S9AFVBJN1DY5116","01M75Y8ZNHA5WFYR4A94NKZN76",0,"MIT","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fbrain\u002Fask\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: memex:brain:ask\ndescription: Ask a natural-language question against the personal Brain. Routes through the Reference Librarian subagent which builds a query plan (FTS5 + optional vector), Python executes against ~\u002F.memex\u002Findex.db, fetches full rows from target stores, and returns ranked citation-ready hits.\n---\n\n# memex:brain:ask\n\n## When to use\n\nThe user wants to find or recall information across their Brain. Replaces v1's wiki\u002Fweb\u002Ftraining waterfall — v2 trusts the federated Index first.\n\n## Inputs\n\n- `query` — natural-language question (string)\n- `mode` — `flat` (default), `global`, or `local` (see \"Ask modes\" below)\n\n## Ask modes (GraphRAG)\n\n`memex:brain:ask` answers in one of three modes. **`flat` is the default and\nits behavior is unchanged** — pick `global`\u002F`local` only when the GraphRAG\ncommunity layer has been built (`internal\u002Fbrain\u002Fgraph-rebuild\u002FSKILL.md`).\n\n| Mode | Use when | How it answers |\n|---|---|---|\n| `flat` (default) | A specific lookup\u002Frecall | Reference Librarian query plan -> FTS5 + vector cosine over `documents` (Steps 1-5 below). |\n| `global` | A corpus-wide \u002F thematic question (\"what are the main themes in my Brain?\") | Map-reduce over `community_reports` at a level: MAP each report -> scored partial answer (drop zeros), REDUCE sort-desc + budget-fill -> final answer. |\n| `local` | An entity\u002Fneighborhood question (\"what do I know about X and what's near it?\") | Seed top docs by cosine, expand the `relations` neighborhood, attach the seeds' community reports, answer over the assembled context. |\n\n### Global mode recipe (map-reduce over community reports)\n\n```python\nfrom scripts import brain\nprep = brain.global_ask_prepare(query, level=0)\nif prep[\"status\"] == \"no_reports\":\n    # report \"no community reports at level 0 — run graph-rebuild\" and STOP\n    ...\n# MAP: dispatch one general-purpose subagent per unit; parse each:\nscored = []\nfor unit in prep[\"map_units\"]:\n    # Task tool: prompt = unit[\"map_prompt\"], model = claude-haiku-4-5;\n    #   capture \u003Cmap_response>.\n    m = brain.parse_map_response(map_response)\n    scored.append({\"community_id\": unit[\"community_id\"], **m})\n# REDUCE: drop zeros, sort desc, budget-fill -> reduce prompt\nred = brain.global_ask_reduce_prepare(query, scored)\nif red[\"status\"] == \"no_signal\":\n    # report \"no community is relevant to \u003Cquery>\" and STOP\n    ...\n# Task tool: prompt = red[\"reduce_prompt\"], model = claude-sonnet-4-6; the\n#   response is the final answer.\n```\n\n### Local mode recipe (neighborhood expansion)\n\n```python\nfrom scripts import brain\n# Key-free default: FTS5-seeded neighborhood expansion — needs NO embedding\n# provider \u002F API key (with_embedding defaults to False).\nctx = brain.local_ask(query)\n# Optional booster: when an embedding provider IS configured, vector-seeded\n# recall can be added; it falls back to the FTS5 seed on EmbeddingUnavailable:\n#   from scripts import embeddings\n#   try:\n#       ctx = brain.local_ask(query, with_embedding=True)\n#   except embeddings.EmbeddingUnavailable as e:\n#       embeddings.log_skip(e, caller_agent_id=\"reference-librarian-1\")\n#       ctx = brain.local_ask(query)\n# ctx = {seeds, neighborhood, documents:[{index_id, searchable}],\n#        community_reports:[{community_id, title, summary}]}\n# Assemble documents + community_reports into a single answering prompt and\n# dispatch ONE general-purpose subagent (Task tool, model = claude-sonnet-4-6)\n# to answer the question over them.\n```\n\n## Recipe (Option-B Task-tool dispatch) — flat mode\n\nThe Reference Librarian is a Claude Code subagent dispatched via the Task tool. Its job is to translate the user's question into a structured query plan; Python executes the plan.\n\n### Step 1 — Prepare\n\n```python\nfrom scripts import brain\nprep = brain.ask_prepare(query)\n```\n\nReturns `{\"status\": \"ready\", \"query\": ..., \"subagent_prompt\": ..., ...}`. The prompt embeds Dr. Eleanor Whitfield's full profile + the user's query.\n\n### Step 2 — Dispatch the Reference Librarian subagent\n\nUse the **Task tool** with:\n\n- `subagent_type`: `general-purpose`\n- `description`: `Reference Librarian: build query plan`\n- `prompt`: `prep[\"subagent_prompt\"]`\n- `model`: `claude-haiku-4-5`\n\n> Query-plan extraction is mechanical JSON mapping — haiku, not Opus.\n\nThe subagent's final message must be a JSON object with these fields:\n\n```json\n{\n  \"fts_query\":    \"\u003CFTS5 MATCH expression>\",\n  \"vector_query\": \"\u003Ctext to embed for cosine, or null to skip>\",\n  \"filters\":      {\"domain\": \"\u003Coptional>\", \"store\": \"\u003Coptional>\"},\n  \"limit\":        10\n}\n```\n\nIf the user's query is genuinely ambiguous, the subagent may return `{\"clarify\": \"\u003Cone short question>\"}` instead — report that to the user and STOP (no DB read).\n\n### Step 3 — Parse the query plan\n\n```python\nfrom scripts.agents import reference_librarian\nquery_plan = reference_librarian.parse_query_plan(subagent_response)\n```\n\nIf the plan contains a `\"clarify\"` key, report the clarifying question and STOP. Otherwise continue.\n\nIf `parse_query_plan` raises (subagent returned invalid JSON), retry Step 2 once. After two failures, report `BLOCKED: reference librarian returned invalid plan` and STOP.\n\n### Step 4 — Execute the plan\n\nAttempt hybrid retrieval (FTS5 + vector cosine). If the embedding\nprovider is unavailable, log the skip and fall back to FTS5-only.\n`ask_execute` internally guards against a null `vector_query` field, so\nno sentinel check is needed here.\n\n```python\nfrom scripts import embeddings\ntry:\n    results = brain.ask_execute(prep, query_plan, with_embedding=bool(query_plan.get(\"vector_query\")))\nexcept embeddings.EmbeddingUnavailable as e:\n    embeddings.log_skip(\n        e,\n        caller_agent_id=\"reference-librarian-1\",\n        input_chars=len(query_plan.get(\"vector_query\") or \"\"),\n    )\n    results = brain.ask_execute(prep, query_plan, with_embedding=False)\n```\n\nCatches only `EmbeddingUnavailable`; other errors propagate.\n\n### Step 5 — Fetch full rows + report\n\nEach result row from `ask_execute` carries `index_id`, `key`, `domain`, `store`, `table_name`, `row_id`, `searchable`. For full body content, fetch from the target store via Core:\n\n```python\nfrom scripts import stores\nfor r in results:\n    rows = stores.query(r[\"store\"], f\"SELECT * FROM {r['table_name']} WHERE id = ?\", (r[\"row_id\"],))\n    if rows:\n        r[\"full_row\"] = rows[0]\n    else:\n        # Transient orphan: index has the row, target store doesn't.\n        # Log + skip from output; Data Steward will catch it next audit.\n        r[\"_skip\"] = True\n```\n\nReport to the user:\n\n```\nFound N results for \"\u003Cquery>\":\n  1. [\u003Cdomain>] \u003Ckey>   (store=\u003Cstore>)\n     \u003Csearchable preview, first 200 chars>\n  2. ...\n```\n\nIf results is empty, report `No matches in your Brain for \"\u003Cquery>\". Try a web search, or ingest more sources.`\n\n## Notes\n\n- Cross-store search: this skill queries every registered store via the federated Index, not just `article.db`. A question may surface results from Atelier's decisions table, meeting minutes, etc., as long as those rows were indexed via the Librarian.\n- Caller's context only carries the parsed query plan + final results. The Reference Librarian's profile and the rest of its reasoning stay in the subagent's context.\n","# memex:brain:ask\n\n## When to use\n\nThe user wants to find or recall information across their Brain. Replaces v1's wiki\u002Fweb\u002Ftraining waterfall — v2 trusts the federated Index first.\n\n## Inputs\n\n- `query` — natural-language question (string)\n- `mode` — `flat` (default), `global`, or `local` (see \"Ask modes\" below)\n\n## Ask modes (GraphRAG)\n\n`memex:brain:ask` answers in one of three modes. **`flat` is the default and\nits behavior is unchanged** — pick `global`\u002F`local` only when the GraphRAG\ncommunity layer has been built (`internal\u002Fbrain\u002Fgraph-rebuild\u002FSKILL.md`).\n\n| Mode | Use when | How it answers |\n|---|---|---|\n| `flat` (default) | A specific lookup\u002Frecall | Reference Librarian query plan -> FTS5 + vector cosine over `documents` (Steps 1-5 below). |\n| `global` | A corpus-wide \u002F thematic question (\"what are the main themes in my Brain?\") | Map-reduce over `community_reports` at a level: MAP each report -> scored partial answer (drop zeros), REDUCE sort-desc + budget-fill -> final answer. |\n| `local` | An entity\u002Fneighborhood question (\"what do I know about X and what's near it?\") | Seed top docs by cosine, expand the `relations` neighborhood, attach the seeds' community reports, answer over the assembled context. |\n\n### Global mode recipe (map-reduce over community reports)\n\n```python\nfrom scripts import brain\nprep = brain.global_ask_prepare(query, level=0)\nif prep[\"status\"] == \"no_reports\":\n    # report \"no community reports at level 0 — run graph-rebuild\" and STOP\n    ...\n# MAP: dispatch one general-purpose subagent per unit; parse each:\nscored = []\nfor unit in prep[\"map_units\"]:\n    # Task tool: prompt = unit[\"map_prompt\"], model = claude-haiku-4-5;\n    #   capture \u003Cmap_response>.\n    m = brain.parse_map_response(map_response)\n    scored.append({\"community_id\": unit[\"community_id\"], **m})\n# REDUCE: drop zeros, sort desc, budget-fill -> reduce prompt\nred = brain.global_ask_reduce_prepare(query, scored)\nif red[\"status\"] == \"no_signal\":\n    # report \"no community is relevant to \u003Cquery>\" and STOP\n    ...\n# Task tool: prompt = red[\"reduce_prompt\"], model = claude-sonnet-4-6; the\n#   response is the final answer.\n```\n\n### Local mode recipe (neighborhood expansion)\n\n```python\nfrom scripts import brain\n# Key-free default: FTS5-seeded neighborhood expansion — needs NO embedding\n# provider \u002F API key (with_embedding defaults to False).\nctx = brain.local_ask(query)\n# Optional booster: when an embedding provider IS configured, vector-seeded\n# recall can be added; it falls back to the FTS5 seed on EmbeddingUnavailable:\n#   from scripts import embeddings\n#   try:\n#       ctx = brain.local_ask(query, with_embedding=True)\n#   except embeddings.EmbeddingUnavailable as e:\n#       embeddings.log_skip(e, caller_agent_id=\"reference-librarian-1\")\n#       ctx = brain.local_ask(query)\n# ctx = {seeds, neighborhood, documents:[{index_id, searchable}],\n#        community_reports:[{community_id, title, summary}]}\n# Assemble documents + community_reports into a single answering prompt and\n# dispatch ONE general-purpose subagent (Task tool, model = claude-sonnet-4-6)\n# to answer the question over them.\n```\n\n## Recipe (Option-B Task-tool dispatch) — flat mode\n\nThe Reference Librarian is a Claude Code subagent dispatched via the Task tool. Its job is to translate the user's question into a structured query plan; Python executes the plan.\n\n### Step 1 — Prepare\n\n```python\nfrom scripts import brain\nprep = brain.ask_prepare(query)\n```\n\nReturns `{\"status\": \"ready\", \"query\": ..., \"subagent_prompt\": ..., ...}`. The prompt embeds Dr. Eleanor Whitfield's full profile + the user's query.\n\n### Step 2 — Dispatch the Reference Librarian subagent\n\nUse the **Task tool** with:\n\n- `subagent_type`: `general-purpose`\n- `description`: `Reference Librarian: build query plan`\n- `prompt`: `prep[\"subagent_prompt\"]`\n- `model`: `claude-haiku-4-5`\n\n> Query-plan extraction is mechanical JSON mapping — haiku, not Opus.\n\nThe subagent's final message must be a JSON object with these fields:\n\n```json\n{\n  \"fts_query\":    \"\u003CFTS5 MATCH expression>\",\n  \"vector_query\": \"\u003Ctext to embed for cosine, or null to skip>\",\n  \"filters\":      {\"domain\": \"\u003Coptional>\", \"store\": \"\u003Coptional>\"},\n  \"limit\":        10\n}\n```\n\nIf the user's query is genuinely ambiguous, the subagent may return `{\"clarify\": \"\u003Cone short question>\"}` instead — report that to the user and STOP (no DB read).\n\n### Step 3 — Parse the query plan\n\n```python\nfrom scripts.agents import reference_librarian\nquery_plan = reference_librarian.parse_query_plan(subagent_response)\n```\n\nIf the plan contains a `\"clarify\"` key, report the clarifying question and STOP. Otherwise continue.\n\nIf `parse_query_plan` raises (subagent returned invalid JSON), retry Step 2 once. After two failures, report `BLOCKED: reference librarian returned invalid plan` and STOP.\n\n### Step 4 — Execute the plan\n\nAttempt hybrid retrieval (FTS5 + vector cosine). If the embedding\nprovider is unavailable, log the skip and fall back to FTS5-only.\n`ask_execute` internally guards against a null `vector_query` field, so\nno sentinel check is needed here.\n\n```python\nfrom scripts import embeddings\ntry:\n    results = brain.ask_execute(prep, query_plan, with_embedding=bool(query_plan.get(\"vector_query\")))\nexcept embeddings.EmbeddingUnavailable as e:\n    embeddings.log_skip(\n        e,\n        caller_agent_id=\"reference-librarian-1\",\n        input_chars=len(query_plan.get(\"vector_query\") or \"\"),\n    )\n    results = brain.ask_execute(prep, query_plan, with_embedding=False)\n```\n\nCatches only `EmbeddingUnavailable`; other errors propagate.\n\n### Step 5 — Fetch full rows + report\n\nEach result row from `ask_execute` carries `index_id`, `key`, `domain`, `store`, `table_name`, `row_id`, `searchable`. For full body content, fetch from the target store via Core:\n\n```python\nfrom scripts import stores\nfor r in results:\n    rows = stores.query(r[\"store\"], f\"SELECT * FROM {r['table_name']} WHERE id = ?\", (r[\"row_id\"],))\n    if rows:\n        r[\"full_row\"] = rows[0]\n    else:\n        # Transient orphan: index has the row, target store doesn't.\n        # Log + skip from output; Data Steward will catch it next audit.\n        r[\"_skip\"] = True\n```\n\nReport to the user:\n\n```\nFound N results for \"\u003Cquery>\":\n  1. [\u003Cdomain>] \u003Ckey>   (store=\u003Cstore>)\n     \u003Csearchable preview, first 200 chars>\n  2. ...\n```\n\nIf results is empty, report `No matches in your Brain for \"\u003Cquery>\". Try a web search, or ingest more sources.`\n\n## Notes\n\n- Cross-store search: this skill queries every registered store via the federated Index, not just `article.db`. A question may surface results from Atelier's decisions table, meeting minutes, etc., as long as those rows were indexed via the Librarian.\n- Caller's context only carries the parsed query plan + final results. The Reference Librarian's profile and the rest of its reasoning stay in the subagent's context.\n",{"name":5,"description":7},"main","63a7b54c6f668f8d3211623b3199c39105162c68","internal\u002Fbrain\u002Fask","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex","https:\u002F\u002Fgithub.com\u002Fnitekeeper","Go with the flow!","2026-09-22 07:17:04",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add nitekeeper\u002Fmemex --skill \"memex:brain:ask\"",{"tool":36,"command":37},"bunx","bunx skills add nitekeeper\u002Fmemex --skill \"memex:brain:ask\"",{"tool":39,"command":40},"pnpm","pnpm dlx skills add nitekeeper\u002Fmemex --skill \"memex:brain:ask\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fbrain\u002Fask\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M75YC1J4D3Y84T5DV40V337Y","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.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Fskills\u002Frun\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75YBYMEKDRW88VSACQ8BXHH","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.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fsteward\u002Freconcile-orphan\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75YBVWGDMMATQAPY3S2KYQX","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.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fsteward\u002Fdashboard\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75YBS1Y5QYT1JZWN7D90DT0","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 ~\u002F.memex\u002Faudits\u002F. Read-only — never auto-fixes.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fsteward\u002Faudit\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M75YBQ7622SDEJDCHC02W8HQ","memex:steward:audit-store","Run an integrity audit scoped to a single registered store (reverse orphans + schema drift). Lighter than full audit.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Fsteward\u002Faudit-store\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M75YBKEHA8KVK5FM22F4MWJW","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.","https:\u002F\u002Fgithub.com\u002Fnitekeeper\u002Fmemex\u002Fblob\u002Fmain\u002Finternal\u002Findex\u002Fwrite\u002FSKILL.md",[],[]]