[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M723ZHW69R6V32SF6CZ03JAB":3,"skill-same:01M723ZHW69R6V32SF6CZ03JAB":66},{"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":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":52,"install":53,"resources":65},"01M723ZHW69R6V32SF6CZ03JAB","brain-ops",null,"Brain knowledge base operations. The core read\u002Fwrite cycle: brain-first lookup,\nread-enrich-write loop, source attribution, ambient enrichment, back-linking.\nRead this before any brain interaction.","weiping\u002Fgbrain-cn","weiping","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F577376?v=4","01M723RHKK6K83FDAAGE48DDS1","01M723RHM767WYBV95VAHQ03A7",1,"MIT","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fplugin\u002Fskills\u002Fbrain-ops\u002FSKILL.md",[],[],"2026-11-10 18:39:20",false,"---\nname: brain-ops\nversion: 1.2.0\nupstream: brain-ops@fc834ee\ndescription: |\n  Brain knowledge base operations. The core read\u002Fwrite cycle: brain-first lookup,\n  read-enrich-write loop, source attribution, ambient enrichment, back-linking.\n  Read this before any brain interaction.\ntriggers:\n  - any brain read\u002Fwrite\u002Flookup\u002Fcitation\ntools:\n  - recall\n  - search\n  - query\n  - get_page\n  - put_page\n  - add_link\n  - add_timeline_entry\n  - get_backlinks\n  - sync_brain\nmutating: true\nwrites_pages: true\nwrites_to:\n  - people\u002F\n  - companies\u002F\n  - deals\u002F\n  - concepts\u002F\n  - meetings\u002F\nwhen_to_use: \"Use when the user asks: \\\"any brain read\u002Fwrite\u002Flookup\u002Fcitation\\\".\"\n---\n\n# Brain Operations — The Ambient Context Layer\n\nRecall relevant context before responding. Save explicit requests with\nprovenance; automatic capture is off until the user opts in. Reading this skill\ndoes not enable capture, delegation, or paid enrichment. A chat-only instruction\nsuppresses writes for that turn, including when standing capture is enabled.\n\n> **Convention:** See `skills\u002Fconventions\u002Fbrain-first.md` for the lookup chain and copyable retrieval filters.\n> **Convention:** See `skills\u002Fconventions\u002Fquality.md` for citation and back-link rules.\n\n> **Memory verbs (MEMORY_VERBS v1, gbrain ≥ 0.43).** Over MCP, prefer the five\n> core memory verbs for the read\u002Fwrite cycle: **`remember(fact, provenance,\n> ttl?)`** to save a single durable fact (mandatory provenance; dedupes +\n> supersedes), **`recall(query | entity, budget_tokens)`** to read it back\n> budget-packed, **`entity(name)`** for a zero-LLM card, **`synthesize(question)`**\n> for the expensive cross-page answer, **`forget(id)`** to withdraw active memory\n> (history, source material, and backups may remain). `context_pack` and `delta`\n> complete the seven-verb surface. Use\n> `remember` instead of `extract_facts` when you already have ONE formed fact;\n> `put_page` \u002F `add_link` \u002F `add_timeline_entry` stay the page\u002Fgraph write path.\n> Fall back to the classic ops when the verbs aren't on the surface. Contract:\n> `docs\u002Fprotocol\u002FMEMORY_VERBS_v1.md`.\n>\n> **Tight-budget page questions:** explicitly use\n> `recall({query: \"zebra telescope\", budget_tokens: 75, budget_policy: \"query_first\"})`\n> so ranked page evidence packs before recent facts. CLI:\n> `gbrain recall --query 'zebra telescope' --budget-tokens 75 --budget-policy query_first --json`.\n> Keep entity-first, event\u002Fsession-filtered and fact-focused questions on their\n> existing facts-first route; do not change `context_pack`. Costs are character-based\n> estimates, and an oversized first item is dropped without skipping or truncation.\n> Read `budget_packing` before interpreting an empty result as missing memory.\n> See `skills\u002Fquery\u002FSKILL.md` for the MCP request and caller example. Guidance is\n> not native-harness activation: adoption remains unverified until a fresh\n> conversation is observed making the opted-in call.\n>\n> **Choose a readback path that can see the intended visibility.** Trusted local\n> CLI callers can recall and withdraw private facts. Every other MCP caller, including\n> stdio, and a thin CLI connected to MCP have world-only fact recall\n> and withdrawal; a credential bound to the brain owner (`gbrain access owner`)\n> also recalls private facts. A\n> request to remember does not authorize making real private information\n> world-visible. Use a trusted local write\u002Freadback path for private memory\n> when available. If only remote access is available, a successful private\n> write receipt confirms storage, but private recall remains unverified; explain\n> that limit and the trusted local path needed for private readback or withdrawal.\n> Do not widen visibility\n> or request broader OAuth scopes merely to make verification pass. For an MCP\n> connection test, use only a harmless synthetic `visibility: \"world\"` fixture\n> with the user's test authorization, retain its ID, and withdraw it afterward.\n>\n> **`\u003CREDACTED:pattern>` in a result** (for example `\u003CREDACTED:url_credentials>`\n> or `\u003CREDACTED:high_entropy_assignment>`) means the brain holds a\n> credential-shaped value there and withheld it from this response; the stored\n> page is unchanged. Tell the user which kind of value was withheld and that it\n> is readable on the brain host. Do not retry other operations to recover it,\n> and do not echo a guess. A credential the user asked you to `remember` is\n> withheld from remote recall by design: every MCP caller, including stdio, and\n> a thin CLI connected to MCP is remote, so only `gbrain recall` run on the\n> brain host shows it as written. Docs:\n> `docs\u002Fguides\u002Fwrite-refusals.md#secret-scan-refusals-and-redaction`.\n>\n> **Keyless brains:** when `extract_facts` returns `skipped:\n> extraction_unavailable`, YOU are the extractor — pull the facts from the turn\n> yourself and write each one via `remember` with `kind` set (event | preference\n> | commitment | belief | fact — those five are the frozen protocol enum; the\n> `idea` kind the extractor and DB carry is NOT one of them) and the\n> visibility the envelope's `agent_action` names\n> (default private — pin it; `remember` defaults to world), or author a\n> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope\n> (server-side extractor errored on this turn; `reason` names why) invites the\n> same manual `remember` fallback for that turn — automatic extraction stays\n> on for future writes.\n\n## Contract\n\nThis skill guarantees:\n- Brain is checked BEFORE any external API call (brain-first lookup)\n- Explicit save requests and opted-in inbound signals trigger the READ → WRITE\n  loop; enrichment requires its separately configured authority\n- Every outbound response checks brain for relevant context\n- Source attribution on every fact written (inline `[Source: ...]` citations)\n- User's direct statements are highest-authority data\n- Back-links maintained on every brain write (Iron Law)\n\n## Iron Law: Back-Linking (MANDATORY)\n\nEvery mention of a person or company with a brain page MUST create a back-link\nFROM that entity's page TO the page mentioning them. An unlinked mention is a\nbroken brain. See `skills\u002Fconventions\u002Fquality.md` for format.\n\n## Phases\n\n### Phase 1: Brain-First Lookup (MANDATORY)\n\nBefore using ANY external API to research a person, company, or topic:\n\n1. `gbrain entity \"\u003Cname>\"` (v0.43+) — ONE known person\u002Fcompany\u002Fproject → full card (description, aliases, open threads, recent events, edges, backlink\u002Ffact counts). Zero LLM calls, sub-100ms. This one call replaces steps 2–6 for known-entity lookups; near-misses return suggestions.\n2. `gbrain search \"name\"` — exact-token lookup for existing pages (cheap hybrid, no expansion)\n3. `gbrain query \"natural question about name\"` — concept\u002Flandscape questions go here FIRST (meaning-match plus reranking recovers synonym phrasings; `--expand` adds LLM rewrites when results look thin; a nonzero `search` count is not proof of completeness)\n4. `gbrain get \u003Cslug>` — if you know the slug, read the full page\n5. Check backlinks: who references this entity?\n6. Check timeline: recent events involving this entity\n\nThe brain almost always has something. External APIs fill gaps, not start from scratch.\nSearch gbrain before reading, grepping or querying brain files directly; filters\n(`--types`, `--match keyword`, `query --since\u002F--until`, `--source`, `--json`) are\nin the brain-first convention's \"Which gbrain call for which lookup\" table.\n\n**⚠️ NEVER scope\u002Fcount a corpus with shallow `ls` — query gbrain or `find`.** Federated sources often carry MULTIPLE coexisting directory conventions — a flat legacy layer AND a date-nested `meetings\u002FYYYY\u002FMM\u002F` layer. A non-recursive `ls dir\u002F*.md` sees only one and undercounts massively. Real example: a shallow `ls` of one source's `meetings\u002F` counted 132 files, almost all the user's, and concluded that WAS the corpus — missing thousands of transcripts nested under `meetings\u002FYYYY\u002FMM\u002F`. To count\u002Fscope a brain corpus:\n  - **Best:** `gbrain sources list` (shows per-source indexed page counts) + `gbrain query`. gbrain indexes ALL federated sources correctly; trust its index, not the filesystem.\n  - **If you must hit the FS:** `find \u003Cdir> -name '*.md' | wc -l`, never `ls *.md`. Then map the layout: `find \u003Cdir> -name '*.md' | sed -E 's#(.*\u002F)[^\u002F]+$#\\1#' | sort | uniq -c`.\n  - The bug is never \"gbrain can't see the source\" — it's almost always a shallow FS glob. Verify against `gbrain sources list` before believing a low count.\n\n### Phase 1.5: Analytical Queries (gbrain think)\n\nFor questions that need synthesis, temporal grounding, or analytical answers —\nnot just \"find the page\" but \"answer the question\":\n\n1. Use `gbrain think \"\u003Cquestion>\"` — multi-hop synthesis across pages + takes +\n   the graph. Temporal questions route through trajectory analysis; everything\n   else gets an LLM-synthesized, cited answer with conflict + gap analysis.\n   Returns a grounded answer, not just a list of matching pages.\n2. Best for: \"when did acme-example last raise\", \"what was the ARR in March\",\n   \"what changed since Q1\", \"who is alice-example's cofounder and what are they\n   working on\", \"summarize our relationship with acme-example\".\n3. Falls back gracefully to standard retrieval when no timeline facts match.\n4. Cost: LLM calls per question — this is the expensive path. Use `query` for\n   simple page lookups where you just need the slug or a quick context check.\n\n### Phase 2: Authorized Capture (READ → WRITE)\n\nFor an explicit save request, or a message within the user's opted-in capture\nscope that has no chat-only restriction:\n\n1. **Detect entities** — people, companies, deals mentioned\n2. **Load brain pages** — read existing pages for context before responding\n3. **Identify new information** — what does this signal tell us that the page doesn't know?\n4. **Write it back** — update the brain page with new info + timeline entry + source citation\n5. **Create if missing** — if notable, save supplied information with provenance;\n   invoke enrichment only when separately authorized\n\nAttribute the user's direct statements with `[Source: User, YYYY-MM-DD]`.\nWithout capture authorization, use the information in the current conversation\nwithout persisting it. Explicit remembering does not enable ongoing capture.\n\n### Phase 2.5: Structured Graph Updates (auto-link)\n\n\"Auto-link\" reconciliation extracts entity references from a page and writes\nthem to the graph (`links` table) with inferred relationship types; stale\nlinks (refs no longer in the page text) are removed. WHO runs it depends on\nthe write path:\n\n- **Trusted local writes** (`gbrain put`, `gbrain capture`,\n  `gbrain call put_page`) auto-link inline and return\n  `auto_links: { created, removed, errors }`.\n- **MCP callers (stdio AND HTTP)** return `auto_links: { skipped: \"remote\", hint }`\n  and `auto_timeline: { skipped: \"remote\" }`. Body wikilinks are saved as text.\n  A post-commit effect then adds plain `mentions` edges to pages that already\n  exist in the same source (`auto_links.mention_links: \"queued\"`;\n  `gbrain config set mcp.remote_auto_links off` turns it off). Typed,\n  frontmatter and timeline edges are not part of it: a stdio `gbrain serve`\n  reconciles those asynchronously with its maintenance sweep (startup +\n  10-minute idle ticks).\n  `gbrain serve --http` does not self-sweep — reconcile on demand with\n  `gbrain sweep --once` (delegates to the live serve over IPC) or\n  `gbrain extract links --source db`.\n  Use `add_link` for relationships you need immediately, except meeting\n  attendance, which auto-link derives from the meeting page. Untrusted body text can plant\n  ranking-boosting edges, which is why the inline path is local-only.\n- Inferred link types: `attended`, `works_at`, `invested_in`, `founded`,\n  `advises`, `source` (frontmatter), `mentions` (default). Where the active\n  schema pack does not override attendance (gbrain-base-v2, which `gbrain init`\n  sets), `attended` comes only from a meeting page's explicit attendee list\n  (its `Attendees:` line or `attendees:` frontmatter) and points\n  `person -> meeting`; a pack that overrides it, such as the older\n  `gbrain-base`, sets its own rule and direction.\n- To disable: `gbrain config set auto_link false`. Default is on.\n- Timeline entries with specific dates still need explicit `gbrain timeline-add`\n  (or batch via `gbrain extract timeline --source db`).\n\n### Phase 3: On Every Outbound Response (READ → PULL → RESPOND)\n\nBefore answering any question about a person, company, or topic:\n\n1. **Check the brain** — read relevant pages\n2. **Pull context** — use compiled truth + recent timeline\n3. **Respond with context** — the brain makes every answer better\n\nDon't answer from general knowledge when a brain page exists.\n\n### Phase 4: Optional Enrichment\n\nEnrichment is an additional user choice. Neither a mentioned entity, a shared\nlink, nor capture opt-in authorizes external research, paid calls, or delegation\nby itself. Follow an explicit ingestion\u002Fenrichment request or the user's stored\nscope and spending policy. Without that authority, recall existing context and\nsave only the supplied information that the user authorized retaining.\n\nUse background agents only when delegation is authorized and supported by the\nharness. Report observed results without claiming a generated routine ran.\n\n## Output Format\n\nUse retrieved context in the response and cite it. Confirm authorized writes\nonly after readback; if no write was requested or opted in, do not persist the\nconversation merely to produce a memory update.\n\n## Cross-source citation format (v0.18.0+)\n\nWhen a brain has multiple sources (wiki, gstack, yc-media, etc.), every\ncitation MUST include the source id: `[source-id:slug]`. Example:\n\n> You told me about the retry budget approach — see\n> [wiki:topics\u002Fresilience] and [gstack:plans\u002Fretry-policy] for where\n> this came from.\n\nRules:\n- The key is `sources.id` (immutable), never `sources.name` (mutable display).\n- Single-source brains still write `[default:slug]` OR may omit the prefix\n  for backward compat.\n- Every page payload returned by `search`, `query`, `get_page`, `list_pages`\n  carries `source_id` — always use it when citing, never guess.\n\nIf a search result has `source_id: \"gstack\"` and `slug: \"plans\u002Ffoo\"`,\nthe citation is `[gstack:plans\u002Ffoo]`. That's the whole rule.\n\n## When it fails\n\nFollow the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:\n\n- `put_page` returns `revision_conflict`: re-read the page, merge your change into the new text, and save with the new revision. `write_pending` (exit 10): poll `get_write_request` (`gbrain write-request \u003Crequest_id>`) before claiming the write landed.\n- `put_page` (or `capture`, tags, timeline) returns `owner_unavailable` with `detail: unbound_source`: this is a classic Postgres brain. Write the page as a file in the source's checkout, commit, and run `gbrain sync --source \u003Cid>`; if you are remote, give those three steps to the user. Never claim the source or switch modes to get the write through (see the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).\n- A write is refused by the secret scan or a slug fence (`permission_denied`): do not strip or rename to dodge it; tell the user what was refused and why (see `docs\u002Fguides\u002Fwrite-refusals.md`).\n- `recall` \u002F `search` returns nothing with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.\n- `insufficient_scope` \u002F `scope_denied` over MCP: the connection lacks that scope. Tell the user; never ask for a broader token just to make a write pass.\n\n## Anti-Patterns\n\n- Answering questions about people\u002Fcompanies without checking the brain first\n- Using external APIs before checking the brain\n- Writing facts without inline `[Source: ...]` citations\n- Blocking the response to do enrichment\n- Overwriting user's direct statements with lower-authority sources\n- Creating brain pages for non-notable entities\n- Creating duplicate pages for the same entity — always check first before creating: `gbrain entity \"\u003Cname>\"` (catches aliases + near-misses), then `query` with name variants\n\n## Tools Used\n\n- `search` — cheap hybrid search (vector + keyword, no expansion)\n- `query` — hybrid search for concept\u002Flandscape questions (`--expand` adds LLM multi-query expansion)\n- `get_page` — read a brain page\n- `put_page` — create\u002Fupdate brain pages\n- `add_link` — cross-reference entities\n- `add_timeline_entry` — record events\n- `get_backlinks` — check who references an entity\n- `sync_brain` — sync changes to the index\n","# Brain Operations — The Ambient Context Layer\n\nRecall relevant context before responding. Save explicit requests with\nprovenance; automatic capture is off until the user opts in. Reading this skill\ndoes not enable capture, delegation, or paid enrichment. A chat-only instruction\nsuppresses writes for that turn, including when standing capture is enabled.\n\n> **Convention:** See `skills\u002Fconventions\u002Fbrain-first.md` for the lookup chain and copyable retrieval filters.\n> **Convention:** See `skills\u002Fconventions\u002Fquality.md` for citation and back-link rules.\n\n> **Memory verbs (MEMORY_VERBS v1, gbrain ≥ 0.43).** Over MCP, prefer the five\n> core memory verbs for the read\u002Fwrite cycle: **`remember(fact, provenance,\n> ttl?)`** to save a single durable fact (mandatory provenance; dedupes +\n> supersedes), **`recall(query | entity, budget_tokens)`** to read it back\n> budget-packed, **`entity(name)`** for a zero-LLM card, **`synthesize(question)`**\n> for the expensive cross-page answer, **`forget(id)`** to withdraw active memory\n> (history, source material, and backups may remain). `context_pack` and `delta`\n> complete the seven-verb surface. Use\n> `remember` instead of `extract_facts` when you already have ONE formed fact;\n> `put_page` \u002F `add_link` \u002F `add_timeline_entry` stay the page\u002Fgraph write path.\n> Fall back to the classic ops when the verbs aren't on the surface. Contract:\n> `docs\u002Fprotocol\u002FMEMORY_VERBS_v1.md`.\n>\n> **Tight-budget page questions:** explicitly use\n> `recall({query: \"zebra telescope\", budget_tokens: 75, budget_policy: \"query_first\"})`\n> so ranked page evidence packs before recent facts. CLI:\n> `gbrain recall --query 'zebra telescope' --budget-tokens 75 --budget-policy query_first --json`.\n> Keep entity-first, event\u002Fsession-filtered and fact-focused questions on their\n> existing facts-first route; do not change `context_pack`. Costs are character-based\n> estimates, and an oversized first item is dropped without skipping or truncation.\n> Read `budget_packing` before interpreting an empty result as missing memory.\n> See `skills\u002Fquery\u002FSKILL.md` for the MCP request and caller example. Guidance is\n> not native-harness activation: adoption remains unverified until a fresh\n> conversation is observed making the opted-in call.\n>\n> **Choose a readback path that can see the intended visibility.** Trusted local\n> CLI callers can recall and withdraw private facts. Every other MCP caller, including\n> stdio, and a thin CLI connected to MCP have world-only fact recall\n> and withdrawal; a credential bound to the brain owner (`gbrain access owner`)\n> also recalls private facts. A\n> request to remember does not authorize making real private information\n> world-visible. Use a trusted local write\u002Freadback path for private memory\n> when available. If only remote access is available, a successful private\n> write receipt confirms storage, but private recall remains unverified; explain\n> that limit and the trusted local path needed for private readback or withdrawal.\n> Do not widen visibility\n> or request broader OAuth scopes merely to make verification pass. For an MCP\n> connection test, use only a harmless synthetic `visibility: \"world\"` fixture\n> with the user's test authorization, retain its ID, and withdraw it afterward.\n>\n> **`\u003CREDACTED:pattern>` in a result** (for example `\u003CREDACTED:url_credentials>`\n> or `\u003CREDACTED:high_entropy_assignment>`) means the brain holds a\n> credential-shaped value there and withheld it from this response; the stored\n> page is unchanged. Tell the user which kind of value was withheld and that it\n> is readable on the brain host. Do not retry other operations to recover it,\n> and do not echo a guess. A credential the user asked you to `remember` is\n> withheld from remote recall by design: every MCP caller, including stdio, and\n> a thin CLI connected to MCP is remote, so only `gbrain recall` run on the\n> brain host shows it as written. Docs:\n> `docs\u002Fguides\u002Fwrite-refusals.md#secret-scan-refusals-and-redaction`.\n>\n> **Keyless brains:** when `extract_facts` returns `skipped:\n> extraction_unavailable`, YOU are the extractor — pull the facts from the turn\n> yourself and write each one via `remember` with `kind` set (event | preference\n> | commitment | belief | fact — those five are the frozen protocol enum; the\n> `idea` kind the extractor and DB carry is NOT one of them) and the\n> visibility the envelope's `agent_action` names\n> (default private — pin it; `remember` defaults to world), or author a\n> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope\n> (server-side extractor errored on this turn; `reason` names why) invites the\n> same manual `remember` fallback for that turn — automatic extraction stays\n> on for future writes.\n\n## Contract\n\nThis skill guarantees:\n- Brain is checked BEFORE any external API call (brain-first lookup)\n- Explicit save requests and opted-in inbound signals trigger the READ → WRITE\n  loop; enrichment requires its separately configured authority\n- Every outbound response checks brain for relevant context\n- Source attribution on every fact written (inline `[Source: ...]` citations)\n- User's direct statements are highest-authority data\n- Back-links maintained on every brain write (Iron Law)\n\n## Iron Law: Back-Linking (MANDATORY)\n\nEvery mention of a person or company with a brain page MUST create a back-link\nFROM that entity's page TO the page mentioning them. An unlinked mention is a\nbroken brain. See `skills\u002Fconventions\u002Fquality.md` for format.\n\n## Phases\n\n### Phase 1: Brain-First Lookup (MANDATORY)\n\nBefore using ANY external API to research a person, company, or topic:\n\n1. `gbrain entity \"\u003Cname>\"` (v0.43+) — ONE known person\u002Fcompany\u002Fproject → full card (description, aliases, open threads, recent events, edges, backlink\u002Ffact counts). Zero LLM calls, sub-100ms. This one call replaces steps 2–6 for known-entity lookups; near-misses return suggestions.\n2. `gbrain search \"name\"` — exact-token lookup for existing pages (cheap hybrid, no expansion)\n3. `gbrain query \"natural question about name\"` — concept\u002Flandscape questions go here FIRST (meaning-match plus reranking recovers synonym phrasings; `--expand` adds LLM rewrites when results look thin; a nonzero `search` count is not proof of completeness)\n4. `gbrain get \u003Cslug>` — if you know the slug, read the full page\n5. Check backlinks: who references this entity?\n6. Check timeline: recent events involving this entity\n\nThe brain almost always has something. External APIs fill gaps, not start from scratch.\nSearch gbrain before reading, grepping or querying brain files directly; filters\n(`--types`, `--match keyword`, `query --since\u002F--until`, `--source`, `--json`) are\nin the brain-first convention's \"Which gbrain call for which lookup\" table.\n\n**⚠️ NEVER scope\u002Fcount a corpus with shallow `ls` — query gbrain or `find`.** Federated sources often carry MULTIPLE coexisting directory conventions — a flat legacy layer AND a date-nested `meetings\u002FYYYY\u002FMM\u002F` layer. A non-recursive `ls dir\u002F*.md` sees only one and undercounts massively. Real example: a shallow `ls` of one source's `meetings\u002F` counted 132 files, almost all the user's, and concluded that WAS the corpus — missing thousands of transcripts nested under `meetings\u002FYYYY\u002FMM\u002F`. To count\u002Fscope a brain corpus:\n  - **Best:** `gbrain sources list` (shows per-source indexed page counts) + `gbrain query`. gbrain indexes ALL federated sources correctly; trust its index, not the filesystem.\n  - **If you must hit the FS:** `find \u003Cdir> -name '*.md' | wc -l`, never `ls *.md`. Then map the layout: `find \u003Cdir> -name '*.md' | sed -E 's#(.*\u002F)[^\u002F]+$#\\1#' | sort | uniq -c`.\n  - The bug is never \"gbrain can't see the source\" — it's almost always a shallow FS glob. Verify against `gbrain sources list` before believing a low count.\n\n### Phase 1.5: Analytical Queries (gbrain think)\n\nFor questions that need synthesis, temporal grounding, or analytical answers —\nnot just \"find the page\" but \"answer the question\":\n\n1. Use `gbrain think \"\u003Cquestion>\"` — multi-hop synthesis across pages + takes +\n   the graph. Temporal questions route through trajectory analysis; everything\n   else gets an LLM-synthesized, cited answer with conflict + gap analysis.\n   Returns a grounded answer, not just a list of matching pages.\n2. Best for: \"when did acme-example last raise\", \"what was the ARR in March\",\n   \"what changed since Q1\", \"who is alice-example's cofounder and what are they\n   working on\", \"summarize our relationship with acme-example\".\n3. Falls back gracefully to standard retrieval when no timeline facts match.\n4. Cost: LLM calls per question — this is the expensive path. Use `query` for\n   simple page lookups where you just need the slug or a quick context check.\n\n### Phase 2: Authorized Capture (READ → WRITE)\n\nFor an explicit save request, or a message within the user's opted-in capture\nscope that has no chat-only restriction:\n\n1. **Detect entities** — people, companies, deals mentioned\n2. **Load brain pages** — read existing pages for context before responding\n3. **Identify new information** — what does this signal tell us that the page doesn't know?\n4. **Write it back** — update the brain page with new info + timeline entry + source citation\n5. **Create if missing** — if notable, save supplied information with provenance;\n   invoke enrichment only when separately authorized\n\nAttribute the user's direct statements with `[Source: User, YYYY-MM-DD]`.\nWithout capture authorization, use the information in the current conversation\nwithout persisting it. Explicit remembering does not enable ongoing capture.\n\n### Phase 2.5: Structured Graph Updates (auto-link)\n\n\"Auto-link\" reconciliation extracts entity references from a page and writes\nthem to the graph (`links` table) with inferred relationship types; stale\nlinks (refs no longer in the page text) are removed. WHO runs it depends on\nthe write path:\n\n- **Trusted local writes** (`gbrain put`, `gbrain capture`,\n  `gbrain call put_page`) auto-link inline and return\n  `auto_links: { created, removed, errors }`.\n- **MCP callers (stdio AND HTTP)** return `auto_links: { skipped: \"remote\", hint }`\n  and `auto_timeline: { skipped: \"remote\" }`. Body wikilinks are saved as text.\n  A post-commit effect then adds plain `mentions` edges to pages that already\n  exist in the same source (`auto_links.mention_links: \"queued\"`;\n  `gbrain config set mcp.remote_auto_links off` turns it off). Typed,\n  frontmatter and timeline edges are not part of it: a stdio `gbrain serve`\n  reconciles those asynchronously with its maintenance sweep (startup +\n  10-minute idle ticks).\n  `gbrain serve --http` does not self-sweep — reconcile on demand with\n  `gbrain sweep --once` (delegates to the live serve over IPC) or\n  `gbrain extract links --source db`.\n  Use `add_link` for relationships you need immediately, except meeting\n  attendance, which auto-link derives from the meeting page. Untrusted body text can plant\n  ranking-boosting edges, which is why the inline path is local-only.\n- Inferred link types: `attended`, `works_at`, `invested_in`, `founded`,\n  `advises`, `source` (frontmatter), `mentions` (default). Where the active\n  schema pack does not override attendance (gbrain-base-v2, which `gbrain init`\n  sets), `attended` comes only from a meeting page's explicit attendee list\n  (its `Attendees:` line or `attendees:` frontmatter) and points\n  `person -> meeting`; a pack that overrides it, such as the older\n  `gbrain-base`, sets its own rule and direction.\n- To disable: `gbrain config set auto_link false`. Default is on.\n- Timeline entries with specific dates still need explicit `gbrain timeline-add`\n  (or batch via `gbrain extract timeline --source db`).\n\n### Phase 3: On Every Outbound Response (READ → PULL → RESPOND)\n\nBefore answering any question about a person, company, or topic:\n\n1. **Check the brain** — read relevant pages\n2. **Pull context** — use compiled truth + recent timeline\n3. **Respond with context** — the brain makes every answer better\n\nDon't answer from general knowledge when a brain page exists.\n\n### Phase 4: Optional Enrichment\n\nEnrichment is an additional user choice. Neither a mentioned entity, a shared\nlink, nor capture opt-in authorizes external research, paid calls, or delegation\nby itself. Follow an explicit ingestion\u002Fenrichment request or the user's stored\nscope and spending policy. Without that authority, recall existing context and\nsave only the supplied information that the user authorized retaining.\n\nUse background agents only when delegation is authorized and supported by the\nharness. Report observed results without claiming a generated routine ran.\n\n## Output Format\n\nUse retrieved context in the response and cite it. Confirm authorized writes\nonly after readback; if no write was requested or opted in, do not persist the\nconversation merely to produce a memory update.\n\n## Cross-source citation format (v0.18.0+)\n\nWhen a brain has multiple sources (wiki, gstack, yc-media, etc.), every\ncitation MUST include the source id: `[source-id:slug]`. Example:\n\n> You told me about the retry budget approach — see\n> [wiki:topics\u002Fresilience] and [gstack:plans\u002Fretry-policy] for where\n> this came from.\n\nRules:\n- The key is `sources.id` (immutable), never `sources.name` (mutable display).\n- Single-source brains still write `[default:slug]` OR may omit the prefix\n  for backward compat.\n- Every page payload returned by `search`, `query`, `get_page`, `list_pages`\n  carries `source_id` — always use it when citing, never guess.\n\nIf a search result has `source_id: \"gstack\"` and `slug: \"plans\u002Ffoo\"`,\nthe citation is `[gstack:plans\u002Ffoo]`. That's the whole rule.\n\n## When it fails\n\nFollow the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:\n\n- `put_page` returns `revision_conflict`: re-read the page, merge your change into the new text, and save with the new revision. `write_pending` (exit 10): poll `get_write_request` (`gbrain write-request \u003Crequest_id>`) before claiming the write landed.\n- `put_page` (or `capture`, tags, timeline) returns `owner_unavailable` with `detail: unbound_source`: this is a classic Postgres brain. Write the page as a file in the source's checkout, commit, and run `gbrain sync --source \u003Cid>`; if you are remote, give those three steps to the user. Never claim the source or switch modes to get the write through (see the [agent operator protocol](..\u002Fconventions\u002Fagent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).\n- A write is refused by the secret scan or a slug fence (`permission_denied`): do not strip or rename to dodge it; tell the user what was refused and why (see `docs\u002Fguides\u002Fwrite-refusals.md`).\n- `recall` \u002F `search` returns nothing with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.\n- `insufficient_scope` \u002F `scope_denied` over MCP: the connection lacks that scope. Tell the user; never ask for a broader token just to make a write pass.\n\n## Anti-Patterns\n\n- Answering questions about people\u002Fcompanies without checking the brain first\n- Using external APIs before checking the brain\n- Writing facts without inline `[Source: ...]` citations\n- Blocking the response to do enrichment\n- Overwriting user's direct statements with lower-authority sources\n- Creating brain pages for non-notable entities\n- Creating duplicate pages for the same entity — always check first before creating: `gbrain entity \"\u003Cname>\"` (catches aliases + near-misses), then `query` with name variants\n\n## Tools Used\n\n- `search` — cheap hybrid search (vector + keyword, no expansion)\n- `query` — hybrid search for concept\u002Flandscape questions (`--expand` adds LLM multi-query expansion)\n- `get_page` — read a brain page\n- `put_page` — create\u002Fupdate brain pages\n- `add_link` — cross-reference entities\n- `add_timeline_entry` — record events\n- `get_backlinks` — check who references an entity\n- `sync_brain` — sync changes to the index\n",{"name":5,"tools":23,"version":33,"mutating":34,"triggers":35,"upstream":37,"writes_to":38,"description":44,"when_to_use":45,"writes_pages":34},[24,25,26,27,28,29,30,31,32],"recall","search","query","get_page","put_page","add_link","add_timeline_entry","get_backlinks","sync_brain","1.2.0",true,[36],"any brain read\u002Fwrite\u002Flookup\u002Fcitation","brain-ops@fc834ee",[39,40,41,42,43],"people\u002F","companies\u002F","deals\u002F","concepts\u002F","meetings\u002F","Brain knowledge base operations. The core read\u002Fwrite cycle: brain-first lookup,\nread-enrich-write loop, source attribution, ambient enrichment, back-linking.\nRead this before any brain interaction.\n","Use when the user asks: \"any brain read\u002Fwrite\u002Flookup\u002Fcitation\".","gbrain-cn","b593c7f55100def8c860cb1d65c74631c9879c3b","plugin\u002Fskills\u002Fbrain-ops",0,"https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn","https:\u002F\u002Fgithub.com\u002Fweiping","2026-11-11 06:54:34",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":34},[55,58,61],{"tool":56,"command":57},"npx","npx skills add weiping\u002Fgbrain-cn --skill brain-ops",{"tool":59,"command":60},"bunx","bunx skills add weiping\u002Fgbrain-cn --skill brain-ops",{"tool":62,"command":63},"pnpm","pnpm dlx skills add weiping\u002Fgbrain-cn --skill brain-ops","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fplugin\u002Fskills\u002Fbrain-ops\u002FSKILL.md",[],[67,74,81,88,95,102],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M724KW82DWENSNNY6W7PWDHD","two-tier-extraction","Tiered LLM extraction pattern for large corpus processing (email archives,\ndocument dumps, transcript libraries). A utility-tier model triages and\nclassifies at speed; the reasoning tier does the default deep read; the\ndeep tier is the escalation for the highest-value content. Prevents\nspending deep-tier money on noise while ensuring the important content\ngets the best eyes. A deterministic privacy wall runs before any LLM call.","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Ftwo-tier-extraction\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M724F7V2HQHRWJFT40DPZ0SK","research-compendium","Deep-research a topic end to end and produce a permanent, reusable knowledge asset: archive every primary source verbatim (gated by the user's privacy\u002Fretention posture), write one 1:1 summary per source, then synthesize a single self-contained compendium page. Depth is a dial (base synthesis → grounded primaries → books + counter-canon → saturation), each level an idempotent superset of the one below. Distinct from data-research (structured trackers) and perplexity-research (web deltas): this produces prose knowledge synthesis backed by an archived source corpus.","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Fresearch-compendium\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M724BWSE5R2ZE5P98BHEK65M","frontmatter-guard","Validate and auto-repair YAML frontmatter on brain pages. Catches malformed\npages before they enter the brain (missing closing ---, nested quotes, slug\nmismatches, null bytes, empty frontmatter, YAML parse failures), explains\nfiles sync holds instead of importing, and drives the previewed\n`gbrain repair frontmatter` fix. Wraps the `gbrain frontmatter` CLI for\nagent-driven workflows.","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Ffrontmatter-guard\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M724ANZBT3M2V17RZYRA9GJ3","data-loss-gate","Confirmation gate before any bulk delete, cleanup, or destructive operation that could result in data loss — shell-level (rm -rf, git rm, bulk sed) or brain-level (bulk forget, delete sweeps, purge-deleted, source removal, raw-SQL truncation). Presents a recoverability card and requires an explicit \"yes\" from the user before proceeding. Routing convention, not an operation-boundary enforcement.","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Fdata-loss-gate\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M7248WZN33SV7Z4E3Z44WA9G","bulk-ingestion","End-to-end discipline for turning any large data source (audio libraries,\nemail takeouts, document corpora, chat exports, API dumps) into brain pages\nat scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE\n→ CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable\nJSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or\nsubagent fan-out resumes from ground truth instead of memory.","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Fbulk-ingestion\u002FSKILL.md",[],[],{"skillNo":103,"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":104,"categories":105,"keywords":106,"publishedAt":18},"01M7248JBG4P1JFKF7F4475WG1","https:\u002F\u002Fgithub.com\u002Fweiping\u002Fgbrain-cn\u002Fblob\u002Fgbrain-cn\u002Fskills\u002Fbrain-ops\u002FSKILL.md",[],[]]