Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(entity): names[] resolves up to 50 names, codes or aliases in one call

garrytan9bba4da40767
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1ded6f8650..ad72f72b9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ On a company brain, most records never repeat a customer's full name. They use a
| Where | What changed |
|---|---|
+| `entity` names | `names` (up to 50 names, codes or aliases) resolves a whole list in one call, one compact row per name with the page, its names, its opening lines (`lead`) and its identity siblings. Opus resolved account codes and nicknames from handoff mails one search at a time and ran out of turns; on the development world's account pages one call resolved the 43 names one such run looked up separately, in 1.4 s. |
| `entity` card | New `identity_siblings` (pages about the same subject under another title prefix, each with its own aliases, never merged), `identity_excerpt` (verbatim lines that may carry another name, with the page they came from), `aka_sources` and `alias_guidance` (what `aka` covers, which names to search). `aka` is unchanged. |
| Alias learning | Prose cues ("also known as", "goes by", "formerly", "doing business as", a quoted name after "calls it"), alias label lines and table rows ("Internal nickname: Copper Fox"), labels later in a line ("Account: Widget Co. Nickname used by the team: Copper Fox."), multi-word names, and 2-3 character codes the page declares for itself ("Also called JOF in my notes", `a.k.a.`, `known as`, `short for` or an alias label; common capitals and acronyms such as `IT`, `US`, `OK`, `AI` never count). The short-code rule comes from the Program Primary Hard root cause (gbrain-evals#109), where mails naming a customer only by its code never linked to it. A name two sibling pages share now links mentions to both instead of neither. |
| Saved facts | A fact saved by an account's name links to the account even when its sheet and CRM record share the name; the card's `recent_facts` and `recall {entity}` show facts saved under either page or the bare name, and a search naming the entity lists its newest saved facts first, then facts of an entity they point to. |
diff --git a/docs/architecture/key-files/entity-recall.md b/docs/architecture/key-files/entity-recall.md
index 32ff22bde3..93999e37cd 100644
--- a/docs/architecture/key-files/entity-recall.md
+++ b/docs/architecture/key-files/entity-recall.md
@@ -17,6 +17,7 @@ card and `get_backlinks`. Guide: [entity recall](../../guides/entity-recall.md).
- `src/core/mentions/upgrade-notice.ts` — `gbrain post-upgrade` prints an `[AGENT]` block naming `gbrain extract --stale --catch-up` with a time estimate (`MENTION_PASS_PAGES_PER_SECOND`) while index-due pages exist (`previewMentionPass`), including every page behind the binary's mention or alias version on an unchanged brain. Post-upgrade does not run the sweep; autopilot's cycle extract phase continues it on its stale-drain budget (`CYCLE_STALE_DRAIN_BUDGET_MS`).
- `src/core/ops/backlinks-paged.ts` — `get_backlinks`' `type` / `group` / `limit` / `cursor`. With none, `ops/links.ts` returns the legacy `Link[]`. `group: "page"` → `{rows, total, truncated, cursor, coverage}` (target = the first source in scope holding the slug; referrers from the read scope). Array mode filters by referrer type and cuts at `limit` with a `listing_truncated` notice naming the paged call. `limit` outside 1..500, a foreign cursor, or an unknown type (not a pack type, alias, observed referrer type or `untyped`) is `invalid_params` naming the valid values.
- `src/commands/extract-mentions-explain.ts` — `gbrain extract mentions --explain <name|slug> [--page <slug>] [--source-id <id>] [--json]` (dispatched from `extract-explain.ts`): the matched entries with origin and case flag, or one reason code (`ambiguous_first_word`, `below_min_length`, `generic_token`, `alias_collision`, `case_mismatch`, `type_not_linkable`, `linking_disabled`, `pending`, `ignored_by_page`, `ignored_by_config`, `denied_by_config`, `not_a_known_name`); only `pending` names a sweep. A slug query also lists each derived name with origin and declaring line, the rejected candidates with reasons, and the sibling decision. Tests: `test/mentions-explain.test.ts`.
+- `src/core/verbs/entity-names.ts` — `entity` with `names` (up to `ENTITY_NAMES_MAX` 50): `lookupEntityNames` resolves each name through `buildEntityCard` (no references), 8 at a time, deduped in first-seen order, into compact rows `{name, found, slug, title, type, aka, lead, siblings?}`; siblings come from `readCardIdentity`. `pageLead` is the body's opening prose from `sanitizeRemoteBody` plus secret redaction, headings, markers and table rows dropped, `ENTITY_LEAD_CHARS` 200. Tests: `test/entity-names.test.ts`.
- `src/core/verbs/entity-card-identity.ts` — the `entity` card's `aka_sources`, `identity_siblings`, `identity_excerpt` (verbatim lines of the page and its siblings from `sanitizeRemoteBody`, tiered: declarations, label lines with a name-like value, other label lines, lines with another capitalized run or code; 600 characters per page, 1,200 per card, `identity_excerpt_omitted`), `alias_guidance` (surface-aware) and the `identity_siblings_capped` notice. Tests: `test/mentions-identity-siblings.test.ts`.
- `src/core/search/alias-fanout.ts` — search and query's alias fan-out: `resolveQueryEntity` (query n-grams up to 4 tokens through `resolveAliases` and linkable exact titles, longest first, capitalized or code-shaped unless a multi-word n-gram resolves to one page, case-sensitive aliases as written, a tie only when the pages are identity siblings), the names of the entity and its siblings by origin then length, at most `search.alias_fanout_max` (4) keyword queries of 5 rows (`searchAliasRequired`: the name as a required websearch phrase, ranked by the query's other terms through `SearchOpts.rankQuery` on both engines), at most 8 spliced rows with `matched_alias`, and the `fanout` meta (`alias_fanout` notice when capped). Offset 0 only. Tests: `test/search-alias-fanout.test.ts`, `test/search-other-names.test.ts`, `test/e2e/mentions-parity.test.ts`. `wholeQueryEntityNames`: when the whole query is one entity's name or alias, `match: "keyword"` lists pages matching any of its names (one websearch OR of phrases; `match_names` in the meta and the count line; rows found by another name carry `matched_alias`). `resolveQueryEntities` returns every entity a text names.
- `src/core/search/entity-facts.ts` — `entitySavedFacts`: when a search names an entity, its newest active saved facts (`factEntitySlugs`, 5) lead the model-visible saved-facts block, then up to 3 facts each of up to 2 entities those facts name (`linked_from`), before the word-overlap matches. Same active, audit-row and visibility rules as recall. Tests: `test/memory-sibling-facts.test.ts`.
diff --git a/docs/protocol/MEMORY_VERBS_v1.md b/docs/protocol/MEMORY_VERBS_v1.md
index fc308d5800..ab5c50d5a5 100644
--- a/docs/protocol/MEMORY_VERBS_v1.md
+++ b/docs/protocol/MEMORY_VERBS_v1.md
@@ -371,6 +371,21 @@ backlink_count, active_fact_count }`.
- `summary` passes the same privacy fences as `get_page` (takes + private
facts stripped); remote callers never see private facts in the card.
+#### entity names: several lookups in one call (additive)
+
+`names` (1 to 50 strings) replaces `name` to resolve a list of names, codes or
+aliases at once; passing both, none or more than 50 is `invalid_params`. Each
+name resolves exactly as `name` does (same precedence, private pages hidden
+from remote callers), duplicates once, in first-seen order.
+
+Response: `{ protocol_version, latency_ms, results[], found, missing }`. Each
+row is `{ name, found: true, slug, title, type, aka[], lead, siblings? }` or
+`{ name, found: false, suggestions? }` (up to 3 `{slug, title}`). `lead` is the
+page's opening prose, up to 200 characters (headings, table rows, private
+fences and secrets removed); `siblings` lists the identity siblings with their
+own `slug`, `title`, `type`, `aka` and `lead`. Rows carry no references, facts
+or open threads: call `entity` with `name` for the full card.
+
#### entity references and coverage (additive)
The `entity` verb adds three optional card fields (ambient callers,
diff --git a/llms-full.txt b/llms-full.txt
index 53ebe27d62..f328acffa3 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -8539,6 +8539,21 @@ backlink_count, active_fact_count }`.
- `summary` passes the same privacy fences as `get_page` (takes + private
facts stripped); remote callers never see private facts in the card.
+#### entity names: several lookups in one call (additive)
+
+`names` (1 to 50 strings) replaces `name` to resolve a list of names, codes or
+aliases at once; passing both, none or more than 50 is `invalid_params`. Each
+name resolves exactly as `name` does (same precedence, private pages hidden
+from remote callers), duplicates once, in first-seen order.
+
+Response: `{ protocol_version, latency_ms, results[], found, missing }`. Each
+row is `{ name, found: true, slug, title, type, aka[], lead, siblings? }` or
+`{ name, found: false, suggestions? }` (up to 3 `{slug, title}`). `lead` is the
+page's opening prose, up to 200 characters (headings, table rows, private
+fences and secrets removed); `siblings` lists the identity siblings with their
+own `slug`, `title`, `type`, `aka` and `lead`. Rows carry no references, facts
+or open threads: call `entity` with `name` for the full card.
+
#### entity references and coverage (additive)
The `entity` verb adds three optional card fields (ambient callers,
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index fd61992c29..05d125777d 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -357,6 +357,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }
{ since: '0.60.116.0', text: '`search` with `match: "keyword"` on an entity\'s name or alias lists pages that use any of its names, and the count line names them; a query that is not one entity\'s name keeps its exact keywords.' },
{ since: '0.60.116.0', text: '`remember` with an entity, when the same claim is an active fact saved without one, now supersedes that copy (`status: superseded`, `superseded_fact_id`; batch receipts carry it too) instead of saving a duplicate. `forget` of a fact saved without an entity is refused with `invalid_params` and the prefix `claim_linked` while the same claim is active on entity-linked facts, which it used to withdraw as well.' },
{ since: '0.60.116.0', text: 'An entity page can now give itself a 2 or 3 character code ("Also called JOF in my notes", "Joffrey Foods, a.k.a. JOF", "Account code: JOF"): it becomes one of the entity\'s names and pages that write it exactly as written link to the entity. Lower-case words, common capitals and acronyms (`IT`, `US`, `OK`, `AI`, `CEO`, `API` ...) and codes declared in another entity\'s sentence never qualify. Every brain re-derives aliases and rescans mentions once.' },
+ { since: '0.60.116.0', text: '`entity` accepts `names` (up to 50 names, codes or aliases) instead of `name` and returns one compact row per name: the page, its names, the opening lines of its body (`lead`) and its identity siblings, without references or facts. `name` is no longer a required parameter in the tool schema; passing neither, or both, is `invalid_params`.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --git a/src/core/verbs.ts b/src/core/verbs.ts
index 3937ec3539..2f58e7823c 100644
--- a/src/core/verbs.ts
+++ b/src/core/verbs.ts
@@ -196,15 +196,27 @@ const entity: Operation = {
mutating: false,
idempotent: true,
outputRedaction: 'retrieval',
- description: 'MEMORY VERB (v1): person/company/account card, zero LLM. Previews are not evidence: fetch the page before stating status or dates. Miss: found:false with near matches and create_safety. Facts: recall.',
+ description: 'MEMORY VERB (v1): person/company/account card, zero LLM. Previews are not evidence: fetch the page before stating status or dates. Miss: found:false with near matches (create_safety). Facts: recall.',
params: {
- name: { type: 'string', required: true, description: 'Name, alias or slug (e.g. "Alice Example").' },
+ name: { type: 'string', description: 'Name, alias or slug.' },
+ names: { type: 'array', items: { type: 'string' }, description: 'Or up to 50 names/codes at once: compact rows.' },
},
scope: 'read',
verb: true,
annotations: { title: 'entity (card lookup, zero LLM)', readOnlyHint: true },
handler: async (ctx, p) => {
const { verbError } = await import('./operations.ts');
+ if (p.names !== undefined) {
+ const { ENTITY_NAMES_MAX, lookupEntityNames } = await import('./verbs/entity-names.ts');
+ const names = Array.isArray(p.names) ? p.names.filter((n): n is string => typeof n === 'string' && n.trim() !== '') : [];
+ if (p.name !== undefined || !names.length || names.length > ENTITY_NAMES_MAX) {
+ throw verbError('invalid_params', `names must be 1 to ${ENTITY_NAMES_MAX} non-empty strings, without name.`,
+ `Pass either name: "Alice Example" for one full card, or names: ["Alice Example", "WGCO"] (up to ${ENTITY_NAMES_MAX}) for compact rows.`);
+ }
+ const t0 = Date.now();
+ const out = await lookupEntityNames(ctx.engine, ctx.sourceId ?? 'default', names, { remote: ctx.remote !== false, surfaceCeiling: ctx.surfaceCeiling });
+ return { protocol_version: 1, latency_ms: Date.now() - t0, ...out };
+ }
const name = typeof p.name === 'string' ? p.name.trim() : '';
if (!name) {
throw verbError(
diff --git a/src/core/verbs/entity-names.ts b/src/core/verbs/entity-names.ts
new file mode 100644
index 0000000000..cafd6bcc47
--- /dev/null
+++ b/src/core/verbs/entity-names.ts
@@ -0,0 +1,74 @@
+/**
+ * `entity` with `names`: resolve a list of names, codes and aliases in one
+ * call, the way a reader resolves the account codes and nicknames a batch of
+ * handoff mails names. Each name resolves exactly as `entity name:` does
+ * (buildEntityCard's alias, slug, title and fuzzy arms, private pages hidden
+ * from remote callers) and returns a compact row: the page, its names, the
+ * opening lines of its body (`lead`) and its identity siblings with theirs.
+ * No references, facts or open threads: a full card per name is `entity name:`.
+ *
+ * Bounded: at most ENTITY_NAMES_MAX names, ENTITY_LEAD_CHARS per lead,
+ * duplicates resolved once.
+ */
+import type { BrainEngine } from '../engine.ts';
+import { buildEntityCard } from './entity-card.ts';
+import { readCardIdentity } from './entity-card-identity.ts';
+import { sanitizeRemoteBody } from '../remote-body.ts';
+import { redactFindings } from '../secret-scan.ts';
+
+export const ENTITY_NAMES_MAX = 50;
+export const ENTITY_LEAD_CHARS = 200;
+const CONCURRENCY = 8;
+
+export interface EntityNamePage { slug: string; title: string; type: string | null; aka: string[]; lead: string }
+export type EntityNameRow =
+ | ({ name: string; found: true } & EntityNamePage & { siblings?: EntityNamePage[] })
+ | { name: string; found: false; suggestions?: Array<{ slug: string; title: string }> };
+
+/** The opening prose of a page body: fences and secrets removed, headings, markers and table rows dropped, up to `max` characters. */
+export function pageLead(body: string | null, max = ENTITY_LEAD_CHARS): string {
+ const text = redactFindings(sanitizeRemoteBody(body ?? ''), { highEntropy: true }).text
+ .replace(/^---[\s\S]*?---\s*/m, '')
+ .split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#') && !l.startsWith('<!--') && !l.startsWith('|'))
+ .join(' ').replace(/\s+/g, ' ').trim();
+ return text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text;
+}
+
+export async function lookupEntityNames(engine: BrainEngine, sourceId: string, names: string[],
+ opts: { remote: boolean; surfaceCeiling?: 'verbs' | 'starter' | 'full' }): Promise<{ results: EntityNameRow[]; found: number; missing: number }> {
+ const unique = [...new Set(names.map(n => n.trim()).filter(Boolean))];
+ const rows = new Map<string, EntityNameRow>();
+ for (let i = 0; i < unique.length; i += CONCURRENCY) {
+ await Promise.all(unique.slice(i, i + CONCURRENCY).map(async name => rows.set(name, await lookupOne(engine, sourceId, name, opts))));
+ }
+ const results = unique.map(n => rows.get(n)!);
+ const found = results.filter(r => r.found).length;
+ return { results, found, missing: results.length - found };
+}
+
+async function lookupOne(engine: BrainEngine, sourceId: string, name: string,
+ opts: { remote: boolean; surfaceCeiling?: 'verbs' | 'starter' | 'full' }): Promise<EntityNameRow> {
+ const result = await buildEntityCard(engine, sourceId, name, { remote: opts.remote, includeReferences: false });
+ if (!result.found || !result.card) {
+ const suggestions = (result.suggestions ?? []).slice(0, 3).map(s => ({ slug: s.slug, title: s.title }));
+ return { name, found: false, ...(suggestions.length ? { suggestions } : {}) };
+ }
+ const { entity, aka } = result.card;
+ const [row] = await engine.executeRaw<{ slug: string; title: string | null; compiled_truth: string | null }>(
+ 'SELECT slug, title, compiled_truth FROM pages WHERE source_id = $1 AND slug = $2 AND deleted_at IS NULL', [sourceId, entity.slug]);
+ const { resolveExcludePrivatePages } = await import('../search/private-visibility.ts');
+ const excludePrivate = await resolveExcludePrivatePages(engine, opts.remote ? undefined : false);
+ const identity = row ? await readCardIdentity(engine, sourceId, row, { excludePrivate, surfaceCeiling: opts.surfaceCeiling, aka }).catch(() => null) : null;
+ const siblingPages = identity?.identity_siblings?.pages ?? [];
+ const bodies = new Map<string, string | null>([[entity.slug, row?.compiled_truth ?? null]]);
+ if (siblingPages.length) {
+ const sib = await engine.executeRaw<{ slug: string; compiled_truth: string | null }>(
+ 'SELECT slug, compiled_truth FROM pages WHERE source_id = $1 AND slug = ANY($2::text[]) AND deleted_at IS NULL',
+ [sourceId, siblingPages.map(p => p.slug)]).catch(() => []);
+ for (const s of sib) bodies.set(s.slug, s.compiled_truth);
+ }
+ return {
+ name, found: true, slug: entity.slug, title: entity.title, type: entity.type, aka, lead: pageLead(bodies.get(entity.slug) ?? null),
+ ...(siblingPages.length ? { siblings: siblingPages.map(p => ({ slug: p.slug, title: p.title, type: p.type, aka: p.aka, lead: pageLead(bodies.get(p.slug) ?? null) })) } : {}),
+ };
+}
diff --git a/test/entity-names.test.ts b/test/entity-names.test.ts
new file mode 100644
index 0000000000..b5bbf453cf
--- /dev/null
+++ b/test/entity-names.test.ts
@@ -0,0 +1,84 @@
+/**
+ * `entity` with `names` (Cat 40 Hard round 4): several names, codes and
+ * aliases resolved in one call, each as a compact row with the page's names,
+ * its opening lines and its identity siblings.
+ *
+ * Protects: a reader holding a list of account codes and nicknames (from
+ * handoff mails) resolved them one search at a time and ran out of turns
+ * (Opus H1: 13-45 single-name searches per cell). One call now returns every
+ * account, its code and nickname, and the lead line that carries its region
+ * and owner. Private pages stay hidden from remote callers.
+ */
+import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
+import type { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { dispatchToolCall } from '../src/mcp/dispatch.ts';
+import { ENTITY_LEAD_CHARS, ENTITY_NAMES_MAX, pageLead } from '../src/core/verbs/entity-names.ts';
+import { mentionBrain, page, resetMentionBrain, sweep } from './helpers/mention-brain.ts';
+
+let engine: PGLiteEngine;
+beforeAll(async () => { engine = await mentionBrain(); }, 120_000);
+afterAll(async () => { await engine.disconnect(); });
+beforeEach(async () => { await resetMentionBrain(engine); });
+
+async function call(args: Record<string, unknown>, remote = true) {
+ const r = await dispatchToolCall(engine, 'entity', args, { remote, sourceId: 'default' } as never);
+ return { isError: r.isError === true, body: JSON.parse(r.content[0]!.text!) as Record<string, any> };
+}
+
+async function accounts() {
+ await page(engine, 'accounts/widget-co', 'account', 'Account sheet: Widget Co', 'Account: Widget Co. Nickname used by the team: Copper Fox. Industry: automation. Region: EMEA.');
+ await page(engine, 'crm/widget-co', 'crm', 'CRM record: Widget Co', 'Account: Widget Co. Account code: WGCO.\n\nSegment: growth. Region: EMEA.\n\nAccount owner: Dana Example (as of 2025-07-05).');
+ await page(engine, 'crm/kite-co', 'crm', 'CRM record: Kite Co', 'Account: Kite Co. Account code: KTCO.\n\nRegion: LATAM.');
+ await sweep(engine);
+}
+
+describe('entity names[]', () => {
+ test('codes and nicknames resolve in one call, with names, lead lines and identity siblings', async () => {
+ await accounts();
+ const { isError, body } = await call({ names: ['WGCO', 'Copper Fox', 'KTCO', 'Nobody Example'] });
+ expect(isError).toBe(false);
+ expect(body).toMatchObject({ protocol_version: 1, found: 3, missing: 1 });
+ const [wgco, fox, ktco, nobody] = body.results;
+ expect(wgco).toMatchObject({ name: 'WGCO', found: true, slug: 'crm/widget-co', title: 'CRM record: Widget Co' });
+ expect(wgco.aka).toContain('wgco');
+ expect(wgco.lead).toContain('Account owner: Dana Example (as of 2025-07-05).');
+ expect(wgco.siblings).toEqual([expect.objectContaining({ slug: 'accounts/widget-co', aka: expect.arrayContaining(['Copper Fox']) })]);
+ expect(wgco.siblings[0].lead).toContain('Region: EMEA.');
+ expect(fox).toMatchObject({ name: 'Copper Fox', found: true, slug: 'accounts/widget-co' });
+ expect(fox.siblings.map((s: { slug: string }) => s.slug)).toEqual(['crm/widget-co']);
+ expect(ktco).toMatchObject({ found: true, slug: 'crm/kite-co', lead: 'Account: Kite Co. Account code: KTCO. Region: LATAM.' });
+ expect(nobody).toMatchObject({ name: 'Nobody Example', found: false });
+ expect(body.results.every((r: Record<string, unknown>) => !('referenced_by' in r) && !('recent_facts' in r))).toBe(true);
+ });
+
+ test('duplicates resolve once, in first-seen order', async () => {
+ await accounts();
+ const { body } = await call({ names: ['KTCO', ' KTCO ', 'WGCO', 'KTCO'] });
+ expect(body.results.map((r: { name: string }) => r.name)).toEqual(['KTCO', 'WGCO']);
+ });
+
+ test('name with names, an empty list and more than the cap are refused with the call that works', async () => {
+ for (const args of [{ name: 'WGCO', names: ['KTCO'] }, { names: [] }, { names: Array.from({ length: ENTITY_NAMES_MAX + 1 }, (_, i) => `N${i}`) }]) {
+ const { isError, body } = await call(args);
+ expect(isError).toBe(true);
+ expect(body.code ?? body.error).toBe('invalid_params');
+ expect(body.suggestion).toContain('names: [');
+ }
+ });
+
+ test('a private page is a miss for a remote caller and found locally', async () => {
+ await page(engine, 'crm/secret-co', 'crm', 'CRM record: Secret Co', 'Account code: SCRT.', { frontmatter: { visibility: 'private' } });
+ await sweep(engine);
+ expect((await call({ names: ['Secret Co'] })).body.results[0]).toMatchObject({ found: false });
+ expect((await call({ names: ['Secret Co'] }, false)).body.results[0]).toMatchObject({ found: true, slug: 'crm/secret-co' });
+ });
+
+ test('the lead drops headings and private fences, redacts secrets and is bounded', () => {
+ const body = '# Heading\n\nFirst line.\n\n## Facts\n\n<!--- gbrain:facts:begin -->\n| # | claim | kind | confidence | visibility | notability | valid_from | valid_until | source | context |\n|---|---|---|---|---|---|---|---|---|---|\n| 1 | Private note | fact | 1.0 | private | medium | 2026-01-01 | | test | |\n<!--- gbrain:facts:end -->\n\nSecond line. ' + 'x'.repeat(400);
+ const lead = pageLead(body);
+ expect(lead.startsWith('First line.')).toBe(true);
+ expect(lead).not.toContain('Private note');
+ expect(lead).not.toContain('#');
+ expect(lead.length).toBeLessThanOrEqual(ENTITY_LEAD_CHARS);
+ });
+});
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index 7843a09096..9445eb0e6b 100644
--- a/test/fixtures/goldens/cli/tools-json.json
+++ b/test/fixtures/goldens/cli/tools-json.json
@@ -2,8 +2,8 @@
"golden": {
"exitCode": 0,
"stderr": "",
- "stdoutBytes": 210022,
- "stdoutSha256": "6bccdce11b0e616d6edfa773c2f0a382f2b238c783c65fb42407f7f1d7b60784",
+ "stdoutBytes": 210193,
+ "stdoutSha256": "6543b5b532af34a3afd496641a444850b0364e78403a9483170a2a5ef2a4609b",
"toolNames": [
"remember",
"entity",
@@ -265,25 +265,31 @@
"scope": "write"
},
{
- "description": "MEMORY VERB (v1): person/company/account card, zero LLM. Previews are not evidence: fetch the page before stating status or dates. Miss: found:false with near matches and create_safety. Facts: recall.",
+ "description": "MEMORY VERB (v1): person/company/account card, zero LLM. Previews are not evidence: fetch the page before stating status or dates. Miss: found:false with near matches (create_safety). Facts: recall.",
"idempotent": true,
"local_only": false,
"mutating": false,
"name": "entity",
"parameters": {
- "name": "string"
+ "name": "string?",
+ "names": "array?"
},
"required_scopes": [],
"schema": {
"properties": {
"name": {
- "description": "Name, alias or slug (e.g. \"Alice Example\").",
+ "description": "Name, alias or slug.",
"type": "string"
+ },
+ "names": {
+ "description": "Or up to 50 names/codes at once: compact rows.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
}
},
- "required": [
- "name"
- ],
+ "required": [],
"type": "object"
},
"scope": "read"
diff --git a/test/mcp-schema-budget.test.ts b/test/mcp-schema-budget.test.ts
index be5cea4373..d5ddeda2b7 100644
--- a/test/mcp-schema-budget.test.ts
+++ b/test/mcp-schema-budget.test.ts
@@ -62,10 +62,13 @@ const PARAM_DESCRIPTION_HARD_CAP = 200;
* remember 1330 -> 1370: the additive `items` batch param (save up to 20 facts
* before compaction), measured at 1,344 after its descriptions were shortened so the
* served starter list stays under 25,000 next to #6007's put_page growth.
+ * entity 470 -> 550: the additive `names` param (resolve up to 50 names in one
+ * call, Cat 40 Hard round 4), measured at 546 with the `name` example and part
+ * of the miss sentence trimmed so the served starter list stays under 25,000.
*/
const TOOL_BUDGETS: Record<string, number> = {
add_timeline_entry: 680, cancel_job: 270, cancel_write_request: 350, capture: 1250, context_pack: 760,
- delete_skill: 810, delta: 830, edit_page: 1090, entity: 470, find_anomalies: 520, forget: 560, get_agent_job: 270,
+ delete_skill: 810, delta: 830, edit_page: 1090, entity: 550, find_anomalies: 520, forget: 560, get_agent_job: 270,
get_backlinks: 770, get_ingest_log: 280, get_page: 930, get_recent_salience: 660, get_skill: 910,
get_skill_asset: 790, get_write_request: 360, join_brain: 560, leave_brain: 540, list_brain_skillpack: 230,
list_link_sources: 220, list_pages: 1060, list_skills: 670, list_write_requests: 450, put_page: 1460,