Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs: the identity rule uses gbrain whois
garrytan600caaaf404c
diff --git a/AGENTS.md b/AGENTS.mdindex e6b80cf8a7..2ba1f7b089 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -65,7 +65,7 @@ on `query`, `--source <id>`, `--limit`, `--json`; `gbrain backlinks <slug>` and`gbrain timeline <slug>` for links and dated events. Copyable examples:[brain-first](skills/conventions/brain-first.md#retrieval-gbrain-first).-Recall relevant saved context before answering. Resolve a person (an email sender, an attendee) only by an exact frontmatter email or an exact title match, never a search's top hit ([identity rule](skills/conventions/brain-first.md#identity-exact-match)). Save explicit requests to remember with provenance; confirm corrections against the stored record. Automatic capture requires opt-in. Withdrawal (`forget`) removes a fact from active memory; history, source material, and private backups may remain. Never promise physical erasure. Verify changes with actual GBrain calls and distinguish a local test from a new-conversation test in the harness.+Recall relevant saved context before answering. Resolve a person (an email sender, an attendee) only by an exact match (`gbrain whois <email or name>`), never a search's top hit ([identity rule](skills/conventions/brain-first.md#identity-exact-match)). Save explicit requests to remember with provenance; confirm corrections against the stored record. Automatic capture requires opt-in. Withdrawal (`forget`) removes a fact from active memory; history, source material, and private backups may remain. Never promise physical erasure. Verify changes with actual GBrain calls and distinguish a local test from a new-conversation test in the harness.Durable preferences and facts belong in shared memory when the user wants themrecalled later. Transient task state, credentials, local configuration, and harnessdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 419cbeb795..93036277d2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,7 +22,7 @@ identifiers and attribution are available in the pre-removal Git revision| A script writes files into a managed checkout | nothing said not to commit them with plain `git commit`, which made the checkout diverge and every refresh refuse `refresh_diverged` | [Scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout): commit with `gbrain git commit-push -- <paths>`, keep the checkout current with a scheduled `gbrain sources refresh <id>`, `gbrain sources set-sync <id> off` before rewriting a source's history, and decide what a `git_target_ignored` path is || An agent purges pages | the data-loss gate covered `pages purge-deleted` but not `gbrain delete --purge` | `delete --purge` needs an explicit go for that purge ("scrub the repo" is not one), runs one page at a time with each removal verified, and a stopped batch stays stopped || A write exits 10 | the meaning lived only in the exit-code table | AGENTS.md says next to exit 3 that 10 is accepted and still pending, never "not found" or "failed" |-| An agent resolves an email sender or attendee to a person page | the briefing, meeting-ingestion and executive-assistant guides took the first search hit | only an exact frontmatter email or an exact title match counts ([identity rule](skills/conventions/brain-first.md#identity-exact-match)) |+| An agent resolves an email sender or attendee to a person page | the briefing, meeting-ingestion and executive-assistant guides took the first search hit | only an exact match from `gbrain whois` counts ([identity rule](skills/conventions/brain-first.md#identity-exact-match)) || Choosing or switching the brain's Postgres | no guidance on region or on proving a switch | INSTALL puts the database in the agent host's region and lists every URL variable to change, the restart and the database-side proof || Upgrading an always-on host | no order for autopilot and running jobs | pause autopilot, wait for a quiet queue, `gbrain upgrade` (which restarts and verifies), check every process, resume; production brains follow the stable channel || OpenClaw's `openclaw doctor --fix` removes the rendered `HEARTBEAT.md` | nothing said what to do | INSTALL Step 6 explains how to restore it until the render adapts (#7470) |diff --git a/docs/guides/executive-assistant.md b/docs/guides/executive-assistant.mdindex e73e45f87a..935145668f 100644--- a/docs/guides/executive-assistant.md+++ b/docs/guides/executive-assistant.md@@ -35,10 +35,10 @@ on email_batch(emails):# the address in a person page's email frontmatter, else a person# page whose title equals the display name. A search's top hit is# NOT the sender; no exact match = unknown sender.- sender_page = gbrain list --type person --where email={email.sender_address} --source-id __all__ --json- if not sender_page:- sender_page = exact_title_match(gbrain search "{email.sender_name}" --types '["person"]' --json)- if sender_page:+ sender_page = gbrain whois "{email.sender_address}" --source-id __all__ --json+ if not sender_page.matches:+ sender_page = gbrain whois "{email.sender_name}" --source-id __all__ --json+ if len(sender_page.matches) == 1: # ambiguous or empty = unknown sendercontext = gbrain get <sender_slug># Now you know: who they are, relationship history,# what they care about, open threads@@ -73,8 +73,8 @@ on upcoming_meeting(meeting):briefing = {}for attendee in meeting.attendees:# Resolve each attendee by exact email, else exact title (as above)- results = gbrain list --type person --where email={attendee.email} --source-id __all__ --json- if results:+ results = gbrain whois "{attendee.email}" --source-id __all__ --json+ if len(results.matches) == 1:page = gbrain get <attendee_slug>briefing[attendee] = {"compiled_truth": page.compiled_truth,@@ -128,7 +128,7 @@ on schedule_request(meeting):## Tricky Spots1. **Search sender BEFORE reading the email.** This is counterintuitive but critical. Loading brain context first means you know who they are, what you're working on together, and what they care about -- before you even see the subject line. The triage is informed, not mechanical.-2. **Identity is an exact match, never a top hit.** Accept a person page for a sender or attendee only when its `email` frontmatter holds the address, or its title equals the name exactly ([identity rule](../../skills/conventions/brain-first.md#identity-exact-match)). A semantic search always returns something, so taking the first hit files strangers as known contacts and loads the wrong relationship into the reply.+2. **Identity is an exact match, never a top hit.** Accept a person page for a sender or attendee only when `gbrain whois` returns exactly one match for the address (or, with no address match, the name) ([identity rule](../../skills/conventions/brain-first.md#identity-exact-match)). A semantic search always returns something, so taking the first hit files strangers as known contacts and loads the wrong relationship into the reply.3. **Unknown senders with no brain page are almost always noise.** If no person page matches a sender exactly, they're probably not important. Classify as low priority unless the email content signals otherwise.4. **Meeting prep is the highest-leverage EA workflow.** The user walks into every meeting already briefed on each attendee: last interaction, open threads, relationship history. This is the difference between "you have a meeting at 3" and "you have a meeting at 3 with alice-example -- last time you discussed the Series B, she was concerned about burn rate."5. **Post-inbox brain updates are where the brain compounds.** Every email is signal. If you clear the inbox without updating brain pages, the information is lost. This is the step most agents skip.diff --git a/skills/briefing/SKILL.md b/skills/briefing/SKILL.mdindex a18e66b148..f20f975e8b 100644--- a/skills/briefing/SKILL.md+++ b/skills/briefing/SKILL.md@@ -136,19 +136,19 @@ Before generating any briefing, load context from gbrain systematically.### Before a meetingFor every attendee on the calendar invite:-- Find their brain page by an exact match only: their email in the page's- `email` frontmatter, or a person page whose title equals their name- ([identity rule](../conventions/brain-first.md#identity-exact-match)). A- search's top hit is not the attendee.+- Find their brain page by an exact match only: `gbrain whois <email> --json`,+ then `gbrain whois "<name>" --json` when the address has no match; exactly+ one match counts ([identity rule](../conventions/brain-first.md#identity-exact-match)).+ A search's top hit is not the attendee.- `gbrain get <slug>` -- load compiled truth, recent timeline, relationship context- If no page exists, note the gap ("No brain page for alice-example -- consider enrichment")### Before an email replyBefore drafting or triaging any email:-- Resolve the sender by exact email or exact title match- ([identity rule](../conventions/brain-first.md#identity-exact-match)); no- exact match means an unknown sender, not the nearest known contact+- Resolve the sender with `gbrain whois <address> --json` (exact email, title+ or alias; [identity rule](../conventions/brain-first.md#identity-exact-match)); no+ match, or an ambiguous one, means an unknown sender, not the nearest known contact- Read their compiled truth to understand who they are, what they care about, andyour relationship history. This turns a cold reply into an informed one.diff --git a/skills/cold-start/SKILL.md b/skills/cold-start/SKILL.mdindex cd97b656b0..69624af698 100644--- a/skills/cold-start/SKILL.md+++ b/skills/cold-start/SKILL.md@@ -317,7 +317,7 @@ brain/daily/calendar/For each event with attendees:1. Look up each attendee in the brain (they should exist from Phase 2), by- exact email or exact title match only+ exact match only (`gbrain whois <email or name> --json`)([identity rule](../conventions/brain-first.md#identity-exact-match))2. Add a timeline entry to their page: met at [event title] on [date]3. If an attendee has no brain page and appears in 3+ events, create onediff --git a/skills/conventions/brain-first.md b/skills/conventions/brain-first.mdindex dbde1ed803..c6348669cf 100644--- a/skills/conventions/brain-first.md+++ b/skills/conventions/brain-first.md@@ -49,20 +49,22 @@ gbrain list --type meeting --limit 50 # enumerate by tResolving an email sender, a calendar attendee or a contact to a person page isan identity decision, and a search's top hit is not one: ranking always returns-something, so taking it files strangers onto known contacts. Accept a page only-on one of these:--1. **An exact email match.** `gbrain list --type person --where email=<address> --source-id __all__ --json`- returns the person pages whose `email` frontmatter equals the address or- lists it. The match is case-sensitive, so pass the address as written and- lowercased (`--where [email protected],[email protected]`),- and use the field your person pages use (`email`, or `emails` for a list).-2. **An exact title match.** `gbrain search "<display name>" --types '["person"]' --json`,- then accept only a hit whose `title` equals the name exactly.--Exactly one page is the person. No page, or more than one, means unknown: treat-the sender as new or ask the user. Never take the top hit, a partial name or a-similar address, and never merge a stranger into a known contact's page.+something, so taking it files strangers onto known contacts. Use the exact+lookup:++```bash+gbrain whois [email protected] --source-id __all__ --json # an email address+gbrain whois "Alice Example" --source-id __all__ --json # a display name+```++`whois` returns the entity pages whose frontmatter email, title or declared+alias equals the query, ignoring case, accents and quotes, and never anything+fuzzy. Look up the email address first and the display name only when the+address has no match. One match is the person. `matches: []` means no exact+match: treat the sender as new or ask the user. `ambiguous: true` means+several pages match: ask, or resolve by the email address. Never fall back to+a search's top hit, a partial name or a similar address, and never merge a+stranger into a known contact's page.## Available GBrain Toolsdiff --git a/skills/meeting-ingestion/SKILL.md b/skills/meeting-ingestion/SKILL.mdindex 90d9fd18a2..6974ebc9fb 100644--- a/skills/meeting-ingestion/SKILL.md+++ b/skills/meeting-ingestion/SKILL.md@@ -349,9 +349,9 @@ five pages costs five corrections.### Phase 7: Attendee enrichment (MANDATORY)For EACH attendee:-1. Does a people page exist? Only an exact match counts: the attendee's email- in a page's `email` frontmatter, or a person page whose title equals the- name ([identity rule](../conventions/brain-first.md#identity-exact-match)).+1. Does a people page exist? Only an exact match counts: one match from+ `gbrain whois <email> --json`, else from `gbrain whois "<name>" --json`+ ([identity rule](../conventions/brain-first.md#identity-exact-match)).A search's top hit is a candidate to check, never the attendee.2. If NO → create via the enrich skill (`skills/enrich/SKILL.md`). Everyperson who was actually IN the meeting gets a page, even a thin one. Skip