Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

train K: regenerate brain-ops plugin copies and skills.lock history after the merges

garrytan3f7954c24c11
diff --git a/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md b/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md
index ad98da1d90..d7cb4d3196 100644
--- a/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md
+++ b/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md
@@ -39,68 +39,6 @@ suppresses writes for that turn, including when standing capture is enabled.
> **Convention:** See `skills/conventions/brain-first.md` for the lookup chain and copyable retrieval filters.
> **Convention:** See `skills/conventions/quality.md` for citation and back-link rules.
-> **Memory verbs (MEMORY_VERBS v1, gbrain ≥ 0.43).** Over MCP, prefer the five
-> core memory verbs for the read/write cycle: **`remember(fact, provenance,
-> ttl?)`** to save a single durable fact (mandatory provenance; dedupes +
-> supersedes), **`recall(query | entity, budget_tokens)`** to read it back
-> budget-packed, **`entity(name)`** for a zero-LLM card, **`synthesize(question)`**
-> for the expensive cross-page answer, **`forget(id)`** to withdraw active memory
-> (history, source material, and backups may remain). `context_pack` and `delta`
-> complete the seven-verb surface. Use
-> `remember` instead of `extract_facts` when you already have ONE formed fact;
-> `put_page` / `add_link` / `add_timeline_entry` stay the page/graph write path.
-> Fall back to the classic ops when the verbs aren't on the surface. Contract:
-> `docs/protocol/MEMORY_VERBS_v1.md`.
->
-> **Tight-budget page questions:** explicitly use
-> `recall({query: "zebra telescope", budget_tokens: 75, budget_policy: "query_first"})`
-> so ranked page evidence packs before recent facts. CLI:
-> `gbrain recall --query 'zebra telescope' --budget-tokens 75 --budget-policy query_first --json`.
-> Keep entity-first, event/session-filtered and fact-focused questions on their
-> existing facts-first route; do not change `context_pack`. Costs are character-based
-> estimates, and an oversized first item is dropped without skipping or truncation.
-> Read `budget_packing` before interpreting an empty result as missing memory.
-> See `skills/query/SKILL.md` for the MCP request and caller example. Guidance is
-> not native-harness activation: adoption remains unverified until a fresh
-> conversation is observed making the opted-in call.
->
-> **Choose a readback path that can see the intended visibility.** Trusted local
-> CLI callers can recall and withdraw private facts. Every MCP caller, including
-> stdio, and a thin CLI connected to MCP currently have world-only fact recall
-> and withdrawal. A
-> request to remember does not authorize making real private information
-> world-visible. Use a trusted local write/readback path for private memory
-> when available. If only remote access is available, a successful private
-> write receipt confirms storage, but private recall remains unverified; explain
-> that limit and the trusted local path needed for private readback or withdrawal.
-> Do not widen visibility
-> or request broader OAuth scopes merely to make verification pass. For an MCP
-> connection test, use only a harmless synthetic `visibility: "world"` fixture
-> with the user's test authorization, retain its ID, and withdraw it afterward.
->
-> **`<REDACTED:pattern>` in a result** (for example `<REDACTED:url_credentials>`
-> or `<REDACTED:high_entropy_assignment>`) means the brain holds a
-> credential-shaped value there and withheld it from this response; the stored
-> page is unchanged. Tell the user which kind of value was withheld and that it
-> is readable on the brain host. Do not retry other operations to recover it,
-> and do not echo a guess. A credential the user asked you to `remember` is
-> withheld from remote recall by design: every MCP caller, including stdio, and
-> a thin CLI connected to MCP is remote, so only `gbrain recall` run on the
-> brain host shows it as written. Docs:
-> `docs/guides/write-refusals.md#secret-scan-refusals-and-redaction`.
->
-> **Keyless brains:** when `extract_facts` returns `skipped:
-> extraction_unavailable`, YOU are the extractor — pull the facts from the turn
-> yourself and write each one via `remember` with `kind` set (event | preference
-> | commitment | belief | fact — those five are the frozen protocol enum; the
-> `idea` kind the extractor and DB carry is NOT one of them) and the
-> visibility the envelope's `agent_action` names
-> (default private — pin it; `remember` defaults to world), or author a
-> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope
-> (server-side extractor errored on this turn; `reason` names why) invites the
-> same manual `remember` fallback for that turn — automatic extraction stays
-> on for future writes.
-
## Contract
This skill guarantees:
@@ -112,175 +50,115 @@ This skill guarantees:
- User's direct statements are highest-authority data
- Back-links maintained on every brain write (Iron Law)
-## Iron Law: Back-Linking (MANDATORY)
-
-Every mention of a person or company with a brain page MUST create a back-link
-FROM that entity's page TO the page mentioning them. An unlinked mention is a
-broken brain. See `skills/conventions/quality.md` for format.
-
-## Phases
-
-### Phase 1: Brain-First Lookup (MANDATORY)
-
-Before using ANY external API to research a person, company, or topic:
-
-1. `gbrain entity "<name>"` (v0.43+) — ONE known person/company/project → full card (description, aliases, open threads, recent events, edges, backlink/fact counts). Zero LLM calls, sub-100ms. This one call replaces steps 2–6 for known-entity lookups; near-misses return suggestions.
-2. `gbrain search "name"` — exact-token lookup for existing pages (cheap hybrid, no expansion)
-3. `gbrain query "natural question about name"` — concept/landscape 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)
-4. `gbrain get <slug>` — if you know the slug, read the full page
-5. Check backlinks: who references this entity?
-6. Check timeline: recent events involving this entity
-
-The brain almost always has something. External APIs fill gaps, not start from scratch.
-Search gbrain before reading, grepping or querying brain files directly; filters
-(`--types`, `--match keyword`, `query --since/--until`, `--source`, `--json`) are
-in the brain-first convention's "Retrieval: gbrain first" block.
-
-**⚠️ NEVER scope/count 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/YYYY/MM/` layer. A non-recursive `ls dir/*.md` sees only one and undercounts massively. Real example: a shallow `ls` of one source's `meetings/` counted 132 files, almost all the user's, and concluded that WAS the corpus — missing thousands of transcripts nested under `meetings/YYYY/MM/`. To count/scope a brain corpus:
- - **Best:** `gbrain sources list` (shows per-source indexed page counts) + `gbrain query`. gbrain indexes ALL federated sources correctly; trust its index, not the filesystem.
- - **If you must hit the FS:** `find <dir> -name '*.md' | wc -l`, never `ls *.md`. Then map the layout: `find <dir> -name '*.md' | sed -E 's#(.*/)[^/]+$#\1#' | sort | uniq -c`.
- - 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.
-
-### Phase 1.5: Analytical Queries (gbrain think)
-
-For questions that need synthesis, temporal grounding, or analytical answers —
-not just "find the page" but "answer the question":
-
-1. Use `gbrain think "<question>"` — multi-hop synthesis across pages + takes +
- the graph. Temporal questions route through trajectory analysis; everything
- else gets an LLM-synthesized, cited answer with conflict + gap analysis.
- Returns a grounded answer, not just a list of matching pages.
-2. Best for: "when did acme-example last raise", "what was the ARR in March",
- "what changed since Q1", "who is alice-example's cofounder and what are they
- working on", "summarize our relationship with acme-example".
-3. Falls back gracefully to standard retrieval when no timeline facts match.
-4. Cost: LLM calls per question — this is the expensive path. Use `query` for
- simple page lookups where you just need the slug or a quick context check.
-
-### Phase 2: Authorized Capture (READ → WRITE)
-
-For an explicit save request, or a message within the user's opted-in capture
-scope that has no chat-only restriction:
-
-1. **Detect entities** — people, companies, deals mentioned
-2. **Load brain pages** — read existing pages for context before responding
-3. **Identify new information** — what does this signal tell us that the page doesn't know?
-4. **Write it back** — update the brain page with new info + timeline entry + source citation
-5. **Create if missing** — if notable, save supplied information with provenance;
- invoke enrichment only when separately authorized
-
-Attribute the user's direct statements with `[Source: User, YYYY-MM-DD]`.
-Without capture authorization, use the information in the current conversation
-without persisting it. Explicit remembering does not enable ongoing capture.
-
-### Phase 2.5: Structured Graph Updates (auto-link)
-
-"Auto-link" reconciliation extracts entity references from a page and writes
-them to the graph (`links` table) with inferred relationship types; stale
-links (refs no longer in the page text) are removed. WHO runs it depends on
-the write path:
-
-- **Trusted local writes** (`gbrain put`, `gbrain capture`,
- `gbrain call put_page`) auto-link inline and return
- `auto_links: { created, removed, errors }`.
-- **MCP callers (stdio AND HTTP)** return `auto_links: { skipped: "remote", hint }`
- and `auto_timeline: { skipped: "remote" }`. Body wikilinks are saved as text.
- A post-commit effect then adds plain `mentions` edges to pages that already
- exist in the same source (`auto_links.mention_links: "queued"`;
- `gbrain config set mcp.remote_auto_links off` turns it off). Typed,
- frontmatter and timeline edges are not part of it: a stdio `gbrain serve`
- reconciles those asynchronously with its maintenance sweep (startup +
- 10-minute idle ticks).
- `gbrain serve --http` does not self-sweep — reconcile on demand with
- `gbrain sweep --once` (delegates to the live serve over IPC) or
- `gbrain extract links --source db`.
- Use `add_link` for relationships you need immediately, except meeting
- attendance, which auto-link derives from the meeting page. Untrusted body text can plant
- ranking-boosting edges, which is why the inline path is local-only.
-- Inferred link types: `attended`, `works_at`, `invested_in`, `founded`,
- `advises`, `source` (frontmatter), `mentions` (default). Where the active
- schema pack does not override attendance (gbrain-base-v2, which `gbrain init`
- sets), `attended` comes only from a meeting page's explicit attendee list
- (its `Attendees:` line or `attendees:` frontmatter) and points
- `person -> meeting`; a pack that overrides it, such as the older
- `gbrain-base`, sets its own rule and direction.
-- To disable: `gbrain config set auto_link false`. Default is on.
-- Timeline entries with specific dates still need explicit `gbrain timeline-add`
- (or batch via `gbrain extract timeline --source db`).
-
-### Phase 3: On Every Outbound Response (READ → PULL → RESPOND)
-
-Before answering any question about a person, company, or topic:
-
-1. **Check the brain** — read relevant pages
-2. **Pull context** — use compiled truth + recent timeline
-3. **Respond with context** — the brain makes every answer better
-
-Don't answer from general knowledge when a brain page exists.
-
-### Phase 4: Optional Enrichment
-
-Enrichment is an additional user choice. Neither a mentioned entity, a shared
-link, nor capture opt-in authorizes external research, paid calls, or delegation
-by itself. Follow an explicit ingestion/enrichment request or the user's stored
-scope and spending policy. Without that authority, recall existing context and
-save only the supplied information that the user authorized retaining.
-
-Use background agents only when delegation is authorized and supported by the
-harness. Report observed results without claiming a generated routine ran.
+**Iron Law:** every mention of a person or company with a brain page gets a
+back-link FROM that entity's page TO the page mentioning them.
+
+## Read
+
+Before any external lookup of a person, company or topic:
+
+1. `gbrain entity "<name>"` — one call for a known entity: description,
+ aliases, open threads, recent events, edges. Near-misses return suggestions.
+2. `gbrain search "name"` for exact tokens; `gbrain query "question"` for
+ concepts (a nonzero `search` count is not proof of completeness).
+3. `gbrain get <slug>`, `gbrain backlinks <slug>`, `gbrain timeline <slug>`.
+4. `gbrain think "<question>"` only for paid multi-page synthesis ("what
+ changed since Q1"); `query` is enough to find a page.
+
+External APIs fill gaps; they never start the lookup. Answer from the brain
+page when one exists, and cite it.
+
+**Count with gbrain, not `ls`.** Corpora nest (`meetings/YYYY/MM/` beside a
+flat layer), so a shallow `ls dir/*.md` undercounts. Use `gbrain sources list`,
+`gbrain list --type <t>`, or `find <dir> -name '*.md' | wc -l`.
+
+## Write (only when authorized)
+
+Write for an explicit save request, or a message inside the user's opted-in
+capture scope with no chat-only restriction. Otherwise use the information in
+this conversation without persisting it; explicit remembering does not enable
+ongoing capture.
+
+1. Detect entities; read their pages first. Before creating a page, check for
+ it (`gbrain entity`, then `query` with name variants) — never duplicate.
+2. Write only what is new, with `[Source: User, YYYY-MM-DD]` (or the real
+ source) on each fact, plus a timeline entry
+ (`gbrain timeline-add <slug> <date> "<text>"`) on every entity involved.
+3. Never overwrite the user's direct statements with lower-authority sources.
+4. Confirm a write only after reading it back.
+
+**Memory verbs (MEMORY_VERBS v1).** `remember(fact, provenance)` saves one formed
+fact (CLI: `gbrain remember "<fact>" --entity <slug> --provenance "<who, date>"`);
+`recall`, `entity`, `synthesize`, `context_pack` and `delta` read.
+`forget(id)` (`gbrain forget <fact-id>`) withdraws a fact from active memory;
+history, source material and backups may remain, so never promise erasure.
+`put_page` / `add_link` / `add_timeline_entry` stay the page and graph path.
+Contract: `docs/protocol/MEMORY_VERBS_v1.md`.
+
+**Keyless brains:** when `extract_facts` returns `skipped: extraction_unavailable`
+(or `extraction_failed` for one turn), you are the extractor: write each fact
+with `remember`, setting `kind` (event | preference | commitment | belief |
+fact) and the visibility the envelope's `agent_action` names (default private;
+`remember` defaults to world).
+
+**Visibility.** Every MCP caller (stdio included) and a thin CLI recall and
+withdraw world-visible facts only; private recall needs the trusted local CLI.
+Never widen visibility or request broader OAuth scopes to make a check pass.
+An MCP connection test uses only a harmless synthetic `visibility: "world"`
+fact, withdrawn afterward.
+
+**`<REDACTED:pattern>`** in a result means the brain withheld a credential-shaped
+value; the page is unchanged and `gbrain recall` on the brain host shows it.
+Say which kind was withheld; never retry to recover it or guess it.
+
+**Tight-budget page questions:**
+`gbrain recall --query '<q>' --budget-tokens 75 --budget-policy query_first --json`
+packs page evidence before recent facts (`skills/query/SKILL.md`). Read
+`budget_packing` before calling an empty result missing memory.
+
+### Auto-link
+
+Trusted local writes (`gbrain put`, `gbrain capture`, `gbrain call put_page`)
+auto-link inline and return `auto_links: { created, removed, errors }`. MCP
+writes (stdio and HTTP) return `auto_links: { skipped: "remote" }`: body
+wikilinks are saved as text and a post-commit effect queues plain `mentions`
+edges to existing pages (`gbrain config set mcp.remote_auto_links off` turns it
+off). Typed, frontmatter and timeline edges wait for a sweep: stdio
+`gbrain serve` runs one at startup and when idle; `gbrain serve --http` does not self-sweep, so run
+`gbrain sweep --once` or `gbrain extract links --source db`. Use `add_link` for
+a relationship you need now, except meeting attendance, which comes from the
+meeting page's attendee list. Dated events still need `gbrain timeline-add`.
+`gbrain config set auto_link false` disables auto-link.
+
+## Enrichment
+
+External research, paid calls and delegation need their own authority: an
+explicit enrichment request or the user's stored scope and spending policy. A
+mentioned entity, a shared link or capture opt-in is not that authority. Never
+block the response on enrichment.
## Output Format
-Use retrieved context in the response and cite it. Confirm authorized writes
-only after readback; if no write was requested or opted in, do not persist the
-conversation merely to produce a memory update.
-
-## Cross-source citation format (v0.18.0+)
-
-When a brain has multiple sources (wiki, gstack, yc-media, etc.), every
-citation MUST include the source id: `[source-id:slug]`. Example:
-
-> You told me about the retry budget approach — see
-> [wiki:topics/resilience] and [gstack:plans/retry-policy] for where
-> this came from.
-
-Rules:
-- The key is `sources.id` (immutable), never `sources.name` (mutable display).
-- Single-source brains still write `[default:slug]` OR may omit the prefix
- for backward compat.
-- Every page payload returned by `search`, `query`, `get_page`, `list_pages`
- carries `source_id` — always use it when citing, never guess.
-
-If a search result has `source_id: "gstack"` and `slug: "plans/foo"`,
-the citation is `[gstack:plans/foo]`. That's the whole rule.
+Answer with the retrieved context and cite it. With several sources, cite
+`[source-id:slug]` using the `source_id` every page payload carries (never the
+source's display name); a single-source brain may write `[default:slug]` or the
+bare slug. Confirm authorized writes only after readback; if no write was
+requested or opted in, do not persist the conversation to produce a memory update.
## When it fails
Follow the [agent operator protocol](../conventions/agent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:
-- `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 <request_id>`) before claiming the write landed.
-- `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 <id>`; 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](../conventions/agent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).
-- 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/guides/write-refusals.md`).
-- `recall` / `search` returns nothing with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.
-- `insufficient_scope` / `scope_denied` over MCP: the connection lacks that scope. Tell the user; never ask for a broader token just to make a write pass.
+- `revision_conflict`: re-read, merge your change into the new text, save with the new revision. `write_pending` (exit 10): poll `gbrain write-request <request_id>` before claiming the write landed.
+- `owner_unavailable` with `detail: unbound_source` (classic Postgres brain): write the file in the source's checkout, commit, and run `gbrain sync --source <id>`; if you are remote, give the user those steps. Never claim the source or switch modes (see the [agent operator protocol](../conventions/agent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).
+- `permission_denied` from the secret scan or a slug fence: do not strip or rename to dodge it; tell the user what was refused and why (`docs/guides/write-refusals.md`).
+- Empty `recall` / `search` with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.
+- `insufficient_scope` / `scope_denied` over MCP: tell the user; never ask for a broader token to make a write pass.
## Anti-Patterns
-- Answering questions about people/companies without checking the brain first
-- Using external APIs before checking the brain
-- Writing facts without inline `[Source: ...]` citations
-- Blocking the response to do enrichment
-- Overwriting user's direct statements with lower-authority sources
-- Creating brain pages for non-notable entities
-- Creating duplicate pages for the same entity — always check first before creating: `gbrain entity "<name>"` (catches aliases + near-misses), then `query` with name variants
-
-## Tools Used
-
-- `search` — cheap hybrid search (vector + keyword, no expansion)
-- `query` — hybrid search for concept/landscape questions (`--expand` adds LLM multi-query expansion)
-- `get_page` — read a brain page
-- `put_page` — create/update brain pages
-- `add_link` — cross-reference entities
-- `add_timeline_entry` — record events
-- `get_backlinks` — check who references an entity
-- `sync_brain` — sync changes to the index
+- Answering about people or companies from general knowledge, or calling external APIs, before checking the brain
+- Writing facts without `[Source: ...]`, or without the back-links and timeline entries
+- Creating a duplicate page, or a page for a non-notable entity
+- Writing to the brain without a save request or capture opt-in
+- Promising that `forget` erases a fact everywhere
diff --git a/plugin/skills/brain-ops/SKILL.md b/plugin/skills/brain-ops/SKILL.md
index ad98da1d90..d7cb4d3196 100644
--- a/plugin/skills/brain-ops/SKILL.md
+++ b/plugin/skills/brain-ops/SKILL.md
@@ -39,68 +39,6 @@ suppresses writes for that turn, including when standing capture is enabled.
> **Convention:** See `skills/conventions/brain-first.md` for the lookup chain and copyable retrieval filters.
> **Convention:** See `skills/conventions/quality.md` for citation and back-link rules.
-> **Memory verbs (MEMORY_VERBS v1, gbrain ≥ 0.43).** Over MCP, prefer the five
-> core memory verbs for the read/write cycle: **`remember(fact, provenance,
-> ttl?)`** to save a single durable fact (mandatory provenance; dedupes +
-> supersedes), **`recall(query | entity, budget_tokens)`** to read it back
-> budget-packed, **`entity(name)`** for a zero-LLM card, **`synthesize(question)`**
-> for the expensive cross-page answer, **`forget(id)`** to withdraw active memory
-> (history, source material, and backups may remain). `context_pack` and `delta`
-> complete the seven-verb surface. Use
-> `remember` instead of `extract_facts` when you already have ONE formed fact;
-> `put_page` / `add_link` / `add_timeline_entry` stay the page/graph write path.
-> Fall back to the classic ops when the verbs aren't on the surface. Contract:
-> `docs/protocol/MEMORY_VERBS_v1.md`.
->
-> **Tight-budget page questions:** explicitly use
-> `recall({query: "zebra telescope", budget_tokens: 75, budget_policy: "query_first"})`
-> so ranked page evidence packs before recent facts. CLI:
-> `gbrain recall --query 'zebra telescope' --budget-tokens 75 --budget-policy query_first --json`.
-> Keep entity-first, event/session-filtered and fact-focused questions on their
-> existing facts-first route; do not change `context_pack`. Costs are character-based
-> estimates, and an oversized first item is dropped without skipping or truncation.
-> Read `budget_packing` before interpreting an empty result as missing memory.
-> See `skills/query/SKILL.md` for the MCP request and caller example. Guidance is
-> not native-harness activation: adoption remains unverified until a fresh
-> conversation is observed making the opted-in call.
->
-> **Choose a readback path that can see the intended visibility.** Trusted local
-> CLI callers can recall and withdraw private facts. Every MCP caller, including
-> stdio, and a thin CLI connected to MCP currently have world-only fact recall
-> and withdrawal. A
-> request to remember does not authorize making real private information
-> world-visible. Use a trusted local write/readback path for private memory
-> when available. If only remote access is available, a successful private
-> write receipt confirms storage, but private recall remains unverified; explain
-> that limit and the trusted local path needed for private readback or withdrawal.
-> Do not widen visibility
-> or request broader OAuth scopes merely to make verification pass. For an MCP
-> connection test, use only a harmless synthetic `visibility: "world"` fixture
-> with the user's test authorization, retain its ID, and withdraw it afterward.
->
-> **`<REDACTED:pattern>` in a result** (for example `<REDACTED:url_credentials>`
-> or `<REDACTED:high_entropy_assignment>`) means the brain holds a
-> credential-shaped value there and withheld it from this response; the stored
-> page is unchanged. Tell the user which kind of value was withheld and that it
-> is readable on the brain host. Do not retry other operations to recover it,
-> and do not echo a guess. A credential the user asked you to `remember` is
-> withheld from remote recall by design: every MCP caller, including stdio, and
-> a thin CLI connected to MCP is remote, so only `gbrain recall` run on the
-> brain host shows it as written. Docs:
-> `docs/guides/write-refusals.md#secret-scan-refusals-and-redaction`.
->
-> **Keyless brains:** when `extract_facts` returns `skipped:
-> extraction_unavailable`, YOU are the extractor — pull the facts from the turn
-> yourself and write each one via `remember` with `kind` set (event | preference
-> | commitment | belief | fact — those five are the frozen protocol enum; the
-> `idea` kind the extractor and DB carry is NOT one of them) and the
-> visibility the envelope's `agent_action` names
-> (default private — pin it; `remember` defaults to world), or author a
-> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope
-> (server-side extractor errored on this turn; `reason` names why) invites the
-> same manual `remember` fallback for that turn — automatic extraction stays
-> on for future writes.
-
## Contract
This skill guarantees:
@@ -112,175 +50,115 @@ This skill guarantees:
- User's direct statements are highest-authority data
- Back-links maintained on every brain write (Iron Law)
-## Iron Law: Back-Linking (MANDATORY)
-
-Every mention of a person or company with a brain page MUST create a back-link
-FROM that entity's page TO the page mentioning them. An unlinked mention is a
-broken brain. See `skills/conventions/quality.md` for format.
-
-## Phases
-
-### Phase 1: Brain-First Lookup (MANDATORY)
-
-Before using ANY external API to research a person, company, or topic:
-
-1. `gbrain entity "<name>"` (v0.43+) — ONE known person/company/project → full card (description, aliases, open threads, recent events, edges, backlink/fact counts). Zero LLM calls, sub-100ms. This one call replaces steps 2–6 for known-entity lookups; near-misses return suggestions.
-2. `gbrain search "name"` — exact-token lookup for existing pages (cheap hybrid, no expansion)
-3. `gbrain query "natural question about name"` — concept/landscape 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)
-4. `gbrain get <slug>` — if you know the slug, read the full page
-5. Check backlinks: who references this entity?
-6. Check timeline: recent events involving this entity
-
-The brain almost always has something. External APIs fill gaps, not start from scratch.
-Search gbrain before reading, grepping or querying brain files directly; filters
-(`--types`, `--match keyword`, `query --since/--until`, `--source`, `--json`) are
-in the brain-first convention's "Retrieval: gbrain first" block.
-
-**⚠️ NEVER scope/count 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/YYYY/MM/` layer. A non-recursive `ls dir/*.md` sees only one and undercounts massively. Real example: a shallow `ls` of one source's `meetings/` counted 132 files, almost all the user's, and concluded that WAS the corpus — missing thousands of transcripts nested under `meetings/YYYY/MM/`. To count/scope a brain corpus:
- - **Best:** `gbrain sources list` (shows per-source indexed page counts) + `gbrain query`. gbrain indexes ALL federated sources correctly; trust its index, not the filesystem.
- - **If you must hit the FS:** `find <dir> -name '*.md' | wc -l`, never `ls *.md`. Then map the layout: `find <dir> -name '*.md' | sed -E 's#(.*/)[^/]+$#\1#' | sort | uniq -c`.
- - 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.
-
-### Phase 1.5: Analytical Queries (gbrain think)
-
-For questions that need synthesis, temporal grounding, or analytical answers —
-not just "find the page" but "answer the question":
-
-1. Use `gbrain think "<question>"` — multi-hop synthesis across pages + takes +
- the graph. Temporal questions route through trajectory analysis; everything
- else gets an LLM-synthesized, cited answer with conflict + gap analysis.
- Returns a grounded answer, not just a list of matching pages.
-2. Best for: "when did acme-example last raise", "what was the ARR in March",
- "what changed since Q1", "who is alice-example's cofounder and what are they
- working on", "summarize our relationship with acme-example".
-3. Falls back gracefully to standard retrieval when no timeline facts match.
-4. Cost: LLM calls per question — this is the expensive path. Use `query` for
- simple page lookups where you just need the slug or a quick context check.
-
-### Phase 2: Authorized Capture (READ → WRITE)
-
-For an explicit save request, or a message within the user's opted-in capture
-scope that has no chat-only restriction:
-
-1. **Detect entities** — people, companies, deals mentioned
-2. **Load brain pages** — read existing pages for context before responding
-3. **Identify new information** — what does this signal tell us that the page doesn't know?
-4. **Write it back** — update the brain page with new info + timeline entry + source citation
-5. **Create if missing** — if notable, save supplied information with provenance;
- invoke enrichment only when separately authorized
-
-Attribute the user's direct statements with `[Source: User, YYYY-MM-DD]`.
-Without capture authorization, use the information in the current conversation
-without persisting it. Explicit remembering does not enable ongoing capture.
-
-### Phase 2.5: Structured Graph Updates (auto-link)
-
-"Auto-link" reconciliation extracts entity references from a page and writes
-them to the graph (`links` table) with inferred relationship types; stale
-links (refs no longer in the page text) are removed. WHO runs it depends on
-the write path:
-
-- **Trusted local writes** (`gbrain put`, `gbrain capture`,
- `gbrain call put_page`) auto-link inline and return
- `auto_links: { created, removed, errors }`.
-- **MCP callers (stdio AND HTTP)** return `auto_links: { skipped: "remote", hint }`
- and `auto_timeline: { skipped: "remote" }`. Body wikilinks are saved as text.
- A post-commit effect then adds plain `mentions` edges to pages that already
- exist in the same source (`auto_links.mention_links: "queued"`;
- `gbrain config set mcp.remote_auto_links off` turns it off). Typed,
- frontmatter and timeline edges are not part of it: a stdio `gbrain serve`
- reconciles those asynchronously with its maintenance sweep (startup +
- 10-minute idle ticks).
- `gbrain serve --http` does not self-sweep — reconcile on demand with
- `gbrain sweep --once` (delegates to the live serve over IPC) or
- `gbrain extract links --source db`.
- Use `add_link` for relationships you need immediately, except meeting
- attendance, which auto-link derives from the meeting page. Untrusted body text can plant
- ranking-boosting edges, which is why the inline path is local-only.
-- Inferred link types: `attended`, `works_at`, `invested_in`, `founded`,
- `advises`, `source` (frontmatter), `mentions` (default). Where the active
- schema pack does not override attendance (gbrain-base-v2, which `gbrain init`
- sets), `attended` comes only from a meeting page's explicit attendee list
- (its `Attendees:` line or `attendees:` frontmatter) and points
- `person -> meeting`; a pack that overrides it, such as the older
- `gbrain-base`, sets its own rule and direction.
-- To disable: `gbrain config set auto_link false`. Default is on.
-- Timeline entries with specific dates still need explicit `gbrain timeline-add`
- (or batch via `gbrain extract timeline --source db`).
-
-### Phase 3: On Every Outbound Response (READ → PULL → RESPOND)
-
-Before answering any question about a person, company, or topic:
-
-1. **Check the brain** — read relevant pages
-2. **Pull context** — use compiled truth + recent timeline
-3. **Respond with context** — the brain makes every answer better
-
-Don't answer from general knowledge when a brain page exists.
-
-### Phase 4: Optional Enrichment
-
-Enrichment is an additional user choice. Neither a mentioned entity, a shared
-link, nor capture opt-in authorizes external research, paid calls, or delegation
-by itself. Follow an explicit ingestion/enrichment request or the user's stored
-scope and spending policy. Without that authority, recall existing context and
-save only the supplied information that the user authorized retaining.
-
-Use background agents only when delegation is authorized and supported by the
-harness. Report observed results without claiming a generated routine ran.
+**Iron Law:** every mention of a person or company with a brain page gets a
+back-link FROM that entity's page TO the page mentioning them.
+
+## Read
+
+Before any external lookup of a person, company or topic:
+
+1. `gbrain entity "<name>"` — one call for a known entity: description,
+ aliases, open threads, recent events, edges. Near-misses return suggestions.
+2. `gbrain search "name"` for exact tokens; `gbrain query "question"` for
+ concepts (a nonzero `search` count is not proof of completeness).
+3. `gbrain get <slug>`, `gbrain backlinks <slug>`, `gbrain timeline <slug>`.
+4. `gbrain think "<question>"` only for paid multi-page synthesis ("what
+ changed since Q1"); `query` is enough to find a page.
+
+External APIs fill gaps; they never start the lookup. Answer from the brain
+page when one exists, and cite it.
+
+**Count with gbrain, not `ls`.** Corpora nest (`meetings/YYYY/MM/` beside a
+flat layer), so a shallow `ls dir/*.md` undercounts. Use `gbrain sources list`,
+`gbrain list --type <t>`, or `find <dir> -name '*.md' | wc -l`.
+
+## Write (only when authorized)
+
+Write for an explicit save request, or a message inside the user's opted-in
+capture scope with no chat-only restriction. Otherwise use the information in
+this conversation without persisting it; explicit remembering does not enable
+ongoing capture.
+
+1. Detect entities; read their pages first. Before creating a page, check for
+ it (`gbrain entity`, then `query` with name variants) — never duplicate.
+2. Write only what is new, with `[Source: User, YYYY-MM-DD]` (or the real
+ source) on each fact, plus a timeline entry
+ (`gbrain timeline-add <slug> <date> "<text>"`) on every entity involved.
+3. Never overwrite the user's direct statements with lower-authority sources.
+4. Confirm a write only after reading it back.
+
+**Memory verbs (MEMORY_VERBS v1).** `remember(fact, provenance)` saves one formed
+fact (CLI: `gbrain remember "<fact>" --entity <slug> --provenance "<who, date>"`);
+`recall`, `entity`, `synthesize`, `context_pack` and `delta` read.
+`forget(id)` (`gbrain forget <fact-id>`) withdraws a fact from active memory;
+history, source material and backups may remain, so never promise erasure.
+`put_page` / `add_link` / `add_timeline_entry` stay the page and graph path.
+Contract: `docs/protocol/MEMORY_VERBS_v1.md`.
+
+**Keyless brains:** when `extract_facts` returns `skipped: extraction_unavailable`
+(or `extraction_failed` for one turn), you are the extractor: write each fact
+with `remember`, setting `kind` (event | preference | commitment | belief |
+fact) and the visibility the envelope's `agent_action` names (default private;
+`remember` defaults to world).
+
+**Visibility.** Every MCP caller (stdio included) and a thin CLI recall and
+withdraw world-visible facts only; private recall needs the trusted local CLI.
+Never widen visibility or request broader OAuth scopes to make a check pass.
+An MCP connection test uses only a harmless synthetic `visibility: "world"`
+fact, withdrawn afterward.
+
+**`<REDACTED:pattern>`** in a result means the brain withheld a credential-shaped
+value; the page is unchanged and `gbrain recall` on the brain host shows it.
+Say which kind was withheld; never retry to recover it or guess it.
+
+**Tight-budget page questions:**
+`gbrain recall --query '<q>' --budget-tokens 75 --budget-policy query_first --json`
+packs page evidence before recent facts (`skills/query/SKILL.md`). Read
+`budget_packing` before calling an empty result missing memory.
+
+### Auto-link
+
+Trusted local writes (`gbrain put`, `gbrain capture`, `gbrain call put_page`)
+auto-link inline and return `auto_links: { created, removed, errors }`. MCP
+writes (stdio and HTTP) return `auto_links: { skipped: "remote" }`: body
+wikilinks are saved as text and a post-commit effect queues plain `mentions`
+edges to existing pages (`gbrain config set mcp.remote_auto_links off` turns it
+off). Typed, frontmatter and timeline edges wait for a sweep: stdio
+`gbrain serve` runs one at startup and when idle; `gbrain serve --http` does not self-sweep, so run
+`gbrain sweep --once` or `gbrain extract links --source db`. Use `add_link` for
+a relationship you need now, except meeting attendance, which comes from the
+meeting page's attendee list. Dated events still need `gbrain timeline-add`.
+`gbrain config set auto_link false` disables auto-link.
+
+## Enrichment
+
+External research, paid calls and delegation need their own authority: an
+explicit enrichment request or the user's stored scope and spending policy. A
+mentioned entity, a shared link or capture opt-in is not that authority. Never
+block the response on enrichment.
## Output Format
-Use retrieved context in the response and cite it. Confirm authorized writes
-only after readback; if no write was requested or opted in, do not persist the
-conversation merely to produce a memory update.
-
-## Cross-source citation format (v0.18.0+)
-
-When a brain has multiple sources (wiki, gstack, yc-media, etc.), every
-citation MUST include the source id: `[source-id:slug]`. Example:
-
-> You told me about the retry budget approach — see
-> [wiki:topics/resilience] and [gstack:plans/retry-policy] for where
-> this came from.
-
-Rules:
-- The key is `sources.id` (immutable), never `sources.name` (mutable display).
-- Single-source brains still write `[default:slug]` OR may omit the prefix
- for backward compat.
-- Every page payload returned by `search`, `query`, `get_page`, `list_pages`
- carries `source_id` — always use it when citing, never guess.
-
-If a search result has `source_id: "gstack"` and `slug: "plans/foo"`,
-the citation is `[gstack:plans/foo]`. That's the whole rule.
+Answer with the retrieved context and cite it. With several sources, cite
+`[source-id:slug]` using the `source_id` every page payload carries (never the
+source's display name); a single-source brain may write `[default:slug]` or the
+bare slug. Confirm authorized writes only after readback; if no write was
+requested or opted in, do not persist the conversation to produce a memory update.
## When it fails
Follow the [agent operator protocol](../conventions/agent-operator-protocol.md) for any gbrain error `code`, exit code, `[AGENT]` block or notice block. Specific to this skill:
-- `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 <request_id>`) before claiming the write landed.
-- `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 <id>`; 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](../conventions/agent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).
-- 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/guides/write-refusals.md`).
-- `recall` / `search` returns nothing with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.
-- `insufficient_scope` / `scope_denied` over MCP: the connection lacks that scope. Tell the user; never ask for a broader token just to make a write pass.
+- `revision_conflict`: re-read, merge your change into the new text, save with the new revision. `write_pending` (exit 10): poll `gbrain write-request <request_id>` before claiming the write landed.
+- `owner_unavailable` with `detail: unbound_source` (classic Postgres brain): write the file in the source's checkout, commit, and run `gbrain sync --source <id>`; if you are remote, give the user those steps. Never claim the source or switch modes (see the [agent operator protocol](../conventions/agent-operator-protocol.md#a-write-refused-owner_unavailable-with-detail-unbound_source)).
+- `permission_denied` from the secret scan or a slug fence: do not strip or rename to dodge it; tell the user what was refused and why (`docs/guides/write-refusals.md`).
+- Empty `recall` / `search` with a degraded notice or `search_degraded`: say the brain is searching keywords only right now, not that nothing is saved.
+- `insufficient_scope` / `scope_denied` over MCP: tell the user; never ask for a broader token to make a write pass.
## Anti-Patterns
-- Answering questions about people/companies without checking the brain first
-- Using external APIs before checking the brain
-- Writing facts without inline `[Source: ...]` citations
-- Blocking the response to do enrichment
-- Overwriting user's direct statements with lower-authority sources
-- Creating brain pages for non-notable entities
-- Creating duplicate pages for the same entity — always check first before creating: `gbrain entity "<name>"` (catches aliases + near-misses), then `query` with name variants
-
-## Tools Used
-
-- `search` — cheap hybrid search (vector + keyword, no expansion)
-- `query` — hybrid search for concept/landscape questions (`--expand` adds LLM multi-query expansion)
-- `get_page` — read a brain page
-- `put_page` — create/update brain pages
-- `add_link` — cross-reference entities
-- `add_timeline_entry` — record events
-- `get_backlinks` — check who references an entity
-- `sync_brain` — sync changes to the index
+- Answering about people or companies from general knowledge, or calling external APIs, before checking the brain
+- Writing facts without `[Source: ...]`, or without the back-links and timeline entries
+- Creating a duplicate page, or a page for a non-notable entity
+- Writing to the brain without a save request or capture opt-in
+- Promising that `forget` erases a fact everywhere
diff --git a/skills/skills.lock.history.json b/skills/skills.lock.history.json
index 3d71faa88c..f6c81064ee 100644
--- a/skills/skills.lock.history.json
+++ b/skills/skills.lock.history.json
@@ -261,6 +261,7 @@
"2ef1e6ec2cdacfd6d666bf93b5f06c6d0d8bb7112a5cde49cc83ff43ff6b7a9a",
"4331a4ec8d3d58c54a1dd0c50f1b15e4e1d1fdf3273849ac1694df61d6bc0f2b",
"57b71aac90727684d3f66ed9d252c2fe357f6bb469549e3eb4480b0bf31cdd45",
+ "86ed21dfdd5e4b34cb7d5eb88532966c4e64a07d0401123421a9b33bd643c0a2",
"a6ce48d76cd13080a5f0414d3cf03506e7e3d64fbc25fa3e97cb2492b6dfb7aa",
"abc15628a2f357af5e689a418ed1f15fa009939425b971da0a2fbce31f6aeb73",
"b42b19223aa9dffbe783ce7c5c681d762377c740f3c609cbc555b9a60a035235",
@@ -461,7 +462,8 @@
"706202b2000e239d20894f52e81a416a8b5d216cca18ed1bb5153e75d1f287d1",
"9d341bc1e02aa09528718e020b092102490d3de06701b18e319d31fb72e6d4d2",
"a0112906c2dd7f021faa913da864fa11a25fc416962d992347a3b9c3236dbd60",
- "a20fed7da1aecc38818f2b649df0ac3c8a218a742efbe2a774d3cea34a728e7d"
+ "a20fed7da1aecc38818f2b649df0ac3c8a218a742efbe2a774d3cea34a728e7d",
+ "a64ab4281d3a7d05b596b9c56e5c63c9c45c229e4a43f4270850682335402af6"
],
"frontmatter-guard/routing-eval.jsonl": [
"243c28b04b557bac5360318c0f47bb6f1dd56d2f720aad3763b93fc0b2ea081e"
@@ -529,6 +531,7 @@
"59da3f0227a2b41ed9c3beb334322f1ef1dbd80af733a587c0a4687a707b9815",
"5fb4c010230fc8f1d58e0bd5a76033f960829f9dd1895ba6de9b728931c55063",
"619762cf3bc4553d1d73dbcf7fa9629dd335ed61012057df2587f15cf9672fde",
+ "6faf40cb944a0deb7d032e41f44b66f05fe0ebe8178bd84d3cf05e2f766f6127",
"74244af50a4faf3d3b2f16250cae0d01c2911fa50d2fca1a02f936f9dc2a21d6",
"74e1249bac87b7ae6492bd3dbfd6a4d1ef630b199d3747f438f8e161f56e9b76",
"762e20ce7e064709a31a843704600679fd39e6734c9f14a67a98fb8c081b7513",
@@ -1077,6 +1080,7 @@
"c0a55ee371bb7a797c76d58cf211407a667930673e34e945e09047470cdfd2f4"
],
"skillpack-check/SKILL.md": [
+ "0d2d2d201ed72e19b47d7e3743b5bbdfb5c2655d1f34d29447c601fca3908f9e",
"3f347ec8b498530a662be212d05f4cd06b205bce5795c2231b6a4cecef149ea0",
"69ca2fecdbc60330569fa5d6eea794cd4a9d351155f8dad5588d992dea3a6dae",
"bcb96d0d231827c9fcd47865f63aaef70c9b9f7a7402464594f24f5fe1eeff8c",
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 18716cdd4c..8c83db9b49 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -225,7 +225,7 @@
"skillpack-check/SKILL.md": "0d2d2d201ed72e19b47d7e3743b5bbdfb5c2655d1f34d29447c601fca3908f9e",
"skillpack-harvest/SKILL.md": "0f86314b58d25b5511809f567c04aedc3fba6fe35ed642ac52d8216ae365b6eb",
"skillpack-harvest/routing-eval.jsonl": "cb4783288e95af3132b32ecb40a54cffc095f57b36240f96a25c2d2adf5e68c6",
- "skills.lock.history.json": "683ada41e02bed5814a71e8c4286ce9f2fd22e59ae6ca9177c8c920df9c06d2e",
+ "skills.lock.history.json": "315f5b23934d4496ead4edead49df7b90dd3e1de6f2b85e9c5c8b2b4e6effbb7",
"smoke-test/SKILL.md": "f5099e1d2ab9dc6827096249e68414f7ae357c29b39fb069a54bb7fb74f414a5",
"soul-audit/SKILL.md": "7a48e180849f7502d332878c443397f90a3756f45caa94f76bcfcc7c997469c8",
"strategic-reading/SKILL.md": "ab2cd3adc79289374cfbc5cb3d5ee17f962fd8f7f3c997a1da708da0ed67797c",