Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
revert(graph): remove post-freeze typing and temporal-lexicon widening (set H failed); wanted_pages.remote on by default (H8 passed)
garrytan780a4fc50154
diff --git a/docs/eval/decisions/p5-delta-2026-10-05/verdicts.md b/docs/eval/decisions/p5-delta-2026-10-05/verdicts.mdindex 29d9f27b11..2b79e08f4b 100644--- a/docs/eval/decisions/p5-delta-2026-10-05/verdicts.md+++ b/docs/eval/decisions/p5-delta-2026-10-05/verdicts.md@@ -1,12 +1,33 @@# P5 delta: held-out verdicts-Delta build `970c3088b`, run by the custodian (P0). Each verdict sets the default the preregistration names.+Each verdict sets the default the preregistration names. Runs by the custodian (P0) and, for sets G and H, the second+custodian.-| Hypothesis | Verdict | Result | Default |-|---|---|---|---|-| H7, validity ranges on typed relation lines | PASS | as-of accuracy on range pages 0.228 → 1.000, 95% CI of the difference [+0.695, +0.846]; prose pages unchanged | `line_grammar.effective_ranges` on |-| H9, link typing changes | PASS on both corpora (relation-line-variants world, temporal-edges held-out set) | noninferior to the frozen extractor | typing changes kept |-| N4 resolver guardrail | PASS | no new wrong merge; resolver outcomes noninferior | — |+| Hypothesis | Build | Verdict | Result | Outcome |+|---|---|---|---|---|+| H7, validity ranges on typed relation lines | `970c3088b` | PASS | as-of accuracy on range pages 0.228 → 1.000, 95% CI of the difference [+0.695, +0.846]; prose pages unchanged | `line_grammar.effective_ranges` on by default |+| H8, wanted rows from remote writes | sweep coordinator fix `9d6b789f5` | PASS | HTTP-arm withheld-entity recall 1.000, local arm 1.000 | `wanted_pages.remote` on by default |+| H9, link typing changes (verb at the link's own position, coordinated links share a verb, a verb before a preposition and the next link belongs to that link) | `970c3088b` | PASS on both corpora | noninferior to the frozen extractor | kept, as at `011bd0b6a` |+| N4 resolver guardrail | `970c3088b` | PASS | no new wrong merge; resolver outcomes noninferior | — |+| H10/H11 on set G (cycle 1) | `970c3088b` | FAIL | guard: 0 extra employment starts, 0 wrong closures (11 and 6 without it); current-employer recall 0.650 → 0.594 and live-edge recall 0.606 → 0.545 against master; H11 traps 104/113 | cycle 2 |+| H10/H11 on set H (cycle 2) | `583a851ee` | FAIL | guard: 0 extra starts, 0 wrong closures (24 and 12 without it), as-of equal to no-guard; live-edge recall 0.748 → 0.670 against master, CI [−0.141, −0.015]; H11 traps 85/122 = 0.697 (investment 33/39, alumni 39/47, advisor 13/36 on every build) | removed (amendment 3) |-Pending: H8 (blocked on the first run by `writer_coordinator_required` from the sweep's raw timeline insert on a-managed brain; fixed in `9d6b789f5`, rerun by the custodian), and the set G runs of H10 and H11 (second custodian).+## Removal under amendment 3++Amendment 3, item 3: "If set H fails either H10 or H11, the post-freeze link-typing and temporal-lexicon changes are+removed before landing and the edge-validity plan's master behavior stands." The amendment does not keep the+`NOT_EMPLOYMENT_ROLE` guard, so it is removed with the rest. Removed: the board/advisory/investor/observer typing+rework, the ordinary-role typing (`ROLE_AT_RE`), and every temporal-lexicon change (the guard, onboarding, split-object+and idiomatic leaves, exchange moves, first-day starts). Link typing is as at `011bd0b6a` (the H9 changes) and+`src/core/link-temporal-evidence.ts` matches master.++## Follow-ups++- Adviser wording in set H is not typed `advises` on any build, master and the pre-edge-validity baseline included.+- Role-carrying employment phrasings still typed `mentions` ("<role> for [X]", "started something new at [X]",+ "moved to [X] (role)") and idiomatic leave phrases the cue lexicon does not read. A future change needs its own+ preregistration and held-out set.++## Pending++First-run verdicts H3 (junk audit), H5b (agent loop duplicates) and H6 (typed lines help answers).diff --git a/docs/guides/line-grammar.md b/docs/guides/line-grammar.mdindex f32a468836..153be06bf0 100644--- a/docs/guides/line-grammar.md+++ b/docs/guides/line-grammar.md@@ -75,7 +75,7 @@ pages link to it, most-referenced first. A bare-name link like`[[Dave Example]]` whose name matches an existing page in another directoryshows that page in `existing_matches`, so the link can be rewritten by slug.Remote callers never see targets that only private pages reference. Writes from remote agents record their missing-mention targets too when `wanted_pages.remote` is on (off by default).+mention targets too (`wanted_pages.remote`, on by default).**Say to your agent:** *"Which people and companies do my notes link to that don't have pages yet?"*diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 38bc1a9b12..5375f74aac 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -31,7 +31,7 @@ src/core/minions/handlers/subagent.ts 1918 ratchet merged: master v131 settle resrc/commands/bootstrap.ts 2134 ratchet grandfathered at merge (grew past the 1500 cap on master); raised for #4066 HOME_WORKSPACE_GUARD_EXEMPT (status/uninstall/harness); +5 for the harnessDetect test seam (bulk lives in core/bootstrap/harness.ts); +23 for the contract subcommand dispatcher glue (#4105 absorb — bulk lives in core/bootstrap/contract.ts); +codex hooks-consent gate + mcp+hooks receipt registration + uninstall arm; +42 ambient-writeback WP8: interview-time SURFACE_MULTIUSER audience apply (pre-init ordering) + applyDeclaredAudienceFromInterview; +3 #4897 harness usage clause documenting --source ID semantics; +5 #5878: --refresh-skills dispatch and usage lines (logic in core/bootstrap/harness-skills.ts); +11 #5488: SUBCOMMAND_HELP harness entry (gate on --help / -h / help) — CLI help line, cannot move; +11 #4618 seat: --seat/--no-seat help lines and the runHooks parse (parse + notes live in core/bootstrap/hooks.ts parseSeatFlags)src/core/minions/worker.ts 1774 ratchet grandfathered at merge (grew past the 1500 cap on master, #4170); grown v0.46.11.0 five-issue wave; security: durable queued authority and confined filesystem dispatch; typed readiness, configuration-blocked lifecycle and bounded release; post-validation readiness publication and confirmed isolated-execution stop evidence; latch typed lock-renewal faults before generic retry; +9 Lane D: JobDeferredError routing (deferJob helper); +1 spend authorization: runWithJobSpend import (both handler seams call it in place of the bare handler)src/commands/sources.ts 2042 ratchet +5 #5988: sources status/retry-held help rows describe Git holds (help lines cannot move); +2 #5988: sources status <id> filter and Git held files (view in persistence/connector-status.ts); +5 F0: sources refresh dispatch and help rows (command body in sources-refresh.ts, protocol in persistence/worktree-refresh.ts); +6 fix wave 5 #5409: mirror-readonly/mirror-writable dispatch, help rows and the list --json mirror_read_only field (body in sources-mirror.ts); grown v0.46.22.0 phone wave: github source kind (#4104); +129 v0.47 gmail-loops: google source-kind flags + vault preflight + duplicate-account warn + access-mode validation; +8 set-path dispatch + help rows (#4739 — command body peeled to sources-set-path.ts); +29 #4698 adoption: --calendar-id flag + duplicate-account warn scoped to overlapping services; #5105: trusted writer administration route; company handlers and receipt status wiring; parsing stays in dedicated modules; canonical reconciliation: +5 engine-free sibling-command dispatch and help row, implementation remains in source-reconcile.ts; +4 fix wave 3 lane A: sources status connector recovery state and run counts (view lives in persistence/connector-status.ts); +3 fix wave 4 lane B: sources retry-held dispatch and help row (command body in sources-retry-held.ts) and the connector first-sync note on add; bodies in source-delete.ts and sources-set-path.ts); +4 #5984: sources status shows the managed sync backlog (logic in persistence/sync-drain.ts); v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (2031 measured); +11 W-B4: sources shared-skills dispatch, its --help guard and help rows, and the shared_skills field/lines in sources status (body in sources-shared-skills.ts, view in shared-skills/source-opt-out.ts)-src/core/link-extraction.ts 2216 ratchet grown v0.46.26.0 megawave: link-aware timeline split + delimiter-outside-links (#3957 #4062 #3737); +37 wave-k #3908 reimpl: isCrossSourceLinksEnabled config ladder; +10 wave #4277: parseTimelineEntries skips generated backlink receipts; +17 #4855: latin-fold in normalizeBasename + dir-hint step tries both slug grammars; +17: #4855 Latin stroke-letter fold; +5: #4873 ./-relative markdown links kept as live references; +34 wave review: `../y.md` sibling links resolve on the DB path + folded bare-wikilink grammar (#4873 class); +62 #4977: role-prior suppression in machine-list sections (rolePriorSuppressedRanges, EntityRef.index); +3 composed with #4985 (variation-selector strip) in the same wave; +4 #4995: markdown-link anchor strip + lowercase-candidate rationale comments; +6 pre-landing review: #4977 suppression on code-stripped content + truthful watermark/section-list comments; T2: source-qualified inference and atomic origin-scoped derived links; canonical attendance evidence, source-qualified orientation, strict attendee resolution, and relocated filesystem link scanner (command export preserved); +4: pack-owned fallback and ambiguous attendee guards Display-label attendance exclusion, indexed evidence membership, and bounded strict resolver caching; attendance-boundary review.; complete attendance resolution and fence-safe evidence traversal; frontmatter discovery, canonical basename admission and code-aware attendance comment masking; exclude inline HTML comment spans from admitted attendance ranges; +17 write-path wave: same-name rule for entity fuzzy matches + rename-alias fallback in makeResolver; +1 #5567: materialized marker ends bullet detail; +30 #5749: unique global-basename step before fuzzy and live keyword resolution (ResolveOptions, watermark note); #5765: bold **Attendees:** label accepted + LINK_EXTRACTOR_VERSION_TS bump note; +10 eval-wave N9-2/N9-3/N12-7: pack frontmatter mappings inherit FRONTMATTER_LINK_MAP direction, page-type-bound pack attended follows canonical attendance, LINK_EXTRACTOR_VERSION_TS bump note; +1 #5623: normalizeBasename collapses hyphen runs like slugifySegment (extractor watermark note); +11 #5562: parseTimelineEntries accepts dated ### headings (FS-extractor parity); +3 eval-wave N12-6: Participants accepted as attendance evidence + LINK_EXTRACTOR_VERSION_TS bump note; +22 P5 wanted pages: AuthoredRef on body link candidates; -33 lowered: P5 moved machine-section ranges to core/machine-sections.ts and stated relation types to core/line-grammar.ts; +7 P5: ExtractPageLinksOptions interface + wikilinkAuthoredRef helper (keeps extractPageLinks under the function-size limit); +32 P5: per-edge verb attachment (attachedVerb, VERB_RULES) + joined-as works_at + extractor watermark note; P5 x temporal-edges merge: verb attachment reads the verb at the link's own position in the window (excerptAnchor) and the within-page dedup (now dedupeCandidates) drops a mention of a target the page also links with a typed edge; links joined only by commas/conjunctions share the verb before the first (coordinated); board roles (BOARD_RE, BOARD_AFTER_RE) resolve to invested_in for an investor page and advises otherwise, never works_at; ordinary job roles (EMPLOYMENT_ROLE / ROLE_AT_RE: "senior designer at", "led engineering at", "joined [X] as CTO") stay works_at+src/core/link-extraction.ts 2211 ratchet grown v0.46.26.0 megawave: link-aware timeline split + delimiter-outside-links (#3957 #4062 #3737); +37 wave-k #3908 reimpl: isCrossSourceLinksEnabled config ladder; +10 wave #4277: parseTimelineEntries skips generated backlink receipts; +17 #4855: latin-fold in normalizeBasename + dir-hint step tries both slug grammars; +17: #4855 Latin stroke-letter fold; +5: #4873 ./-relative markdown links kept as live references; +34 wave review: `../y.md` sibling links resolve on the DB path + folded bare-wikilink grammar (#4873 class); +62 #4977: role-prior suppression in machine-list sections (rolePriorSuppressedRanges, EntityRef.index); +3 composed with #4985 (variation-selector strip) in the same wave; +4 #4995: markdown-link anchor strip + lowercase-candidate rationale comments; +6 pre-landing review: #4977 suppression on code-stripped content + truthful watermark/section-list comments; T2: source-qualified inference and atomic origin-scoped derived links; canonical attendance evidence, source-qualified orientation, strict attendee resolution, and relocated filesystem link scanner (command export preserved); +4: pack-owned fallback and ambiguous attendee guards Display-label attendance exclusion, indexed evidence membership, and bounded strict resolver caching; attendance-boundary review.; complete attendance resolution and fence-safe evidence traversal; frontmatter discovery, canonical basename admission and code-aware attendance comment masking; exclude inline HTML comment spans from admitted attendance ranges; +17 write-path wave: same-name rule for entity fuzzy matches + rename-alias fallback in makeResolver; +1 #5567: materialized marker ends bullet detail; +30 #5749: unique global-basename step before fuzzy and live keyword resolution (ResolveOptions, watermark note); #5765: bold **Attendees:** label accepted + LINK_EXTRACTOR_VERSION_TS bump note; +10 eval-wave N9-2/N9-3/N12-7: pack frontmatter mappings inherit FRONTMATTER_LINK_MAP direction, page-type-bound pack attended follows canonical attendance, LINK_EXTRACTOR_VERSION_TS bump note; +1 #5623: normalizeBasename collapses hyphen runs like slugifySegment (extractor watermark note); +11 #5562: parseTimelineEntries accepts dated ### headings (FS-extractor parity); +3 eval-wave N12-6: Participants accepted as attendance evidence + LINK_EXTRACTOR_VERSION_TS bump note; +22 P5 wanted pages: AuthoredRef on body link candidates; -33 lowered: P5 moved machine-section ranges to core/machine-sections.ts and stated relation types to core/line-grammar.ts; +7 P5: ExtractPageLinksOptions interface + wikilinkAuthoredRef helper (keeps extractPageLinks under the function-size limit); +32 P5: per-edge verb attachment (attachedVerb, VERB_RULES) + joined-as works_at + extractor watermark note; P5 x temporal-edges merge: verb attachment reads the verb at the link's own position in the window (excerptAnchor) and the within-page dedup (now dedupeCandidates) drops a mention of a target the page also links with a typed edge; links joined only by commas/conjunctions share the verb before the first (coordinated); board roles (BOARD_RE, BOARD_AFTER_RE) resolve to invested_in for an investor page and advises otherwise, never works_atsrc/core/embedding-migration.ts 1569 ratchet new row: crossed 1500 in v0.46.25.0 fix waves (#4305 #4306 chunk-model truth helpers); retired provider integration removed; safety wave: canonical projection readiness and fact-aware completion; file configuration publication retains lease-row locks; +8 transactional retained-vector rebuildability checks before destructive migration boundaries; archived eligibility: source-locked reconciliation and live/current smoke revalidation; +2 #5680: authorization_generation field and its carry-forward on same-target re-apply (settle idempotency); +10 #5226: plan carries chunks_to_restamp beside chunks_to_embed; +9 #5088: schema transition defers HNSW builds into the marker (deferred_ann_indexes), carry-forward on re-apply, verify blocks on pending/INVALID ANN indexes (build phase in embedding-ann-build.ts); +10 #5088: dim-pinned tables (query_cache, facts, and any later entry of TEXT_EMBEDDING_DIM_PINNED_TABLES) defer their HNSW through the same worklist (DEFERRED_ANN_TABLES, recordDeferredAnnIndexes); +25 wave 8 lane D1 #5885: takes in the dim-pinned column list, plan (takes_to_embed), status (takes_pending) and completion verifysrc/core/github-source.ts 1530 ratchet new row: crossed the 1500 unlisted cap in v0.46.23.0 review fix wave (scope-state gating, client hardening, symlink containment); merged reliability/shared-skills source integration; managed sweep lease wrapper; fix wave 3 lane A: config parser peeled to github-source-config.ts (-47), +account pin wiring and pinned-installation refreshsrc/commands/hook.ts 1903 ratchet cathedral-5 heartbeat extraction offsets part of the BrainBench-seam growth; grown v0.46.26.0 megawave hooks-ipc (#4245); +108 monthly backup check: banner + gated session-start note + detached spawn (backup/status-file readers); +28 ship-review egress hardening: per-harness capture dispatch (capture-spec), memorable gate + receipt + relay block, fail-closed unscanned/newest-guess skips; +79 ambient-writeback WP4: hookStop bank step (gate -> bankWritebackTurn -> IPC flush; gate/bank logic live in core/facts + corpus-segments); +41 adversarial fix wave: wide-tail retry when the 128KB window misses the user turn, by-design heartbeat outcome classes, source-in-name banking; +11 #5413 session-end skips claude-cli self-transcripts; +11 #5701: hook lanes pass allowOversize so a long session reaches the bounded tail readdiff --git a/src/core/config.ts b/src/core/config.tsindex 36a2e04800..b88df19e11 100644--- a/src/core/config.ts+++ b/src/core/config.ts@@ -1595,7 +1595,7 @@ export const KNOWN_CONFIG_KEYS: readonly string[] = [// when the target appears (src/core/wanted-links.ts). On by default; the// off switch is `gbrain config set wanted_pages.enabled false`.'wanted_pages.enabled',- // Remote writes (the persistence `links` effect) record missing mention targets too. Off until its held-out verdict.+ // Remote writes (the persistence `links` effect) record missing mention targets too. On by default (held-out verdict H8).'wanted_pages.remote',// Line grammar (src/core/line-grammar.ts): typed relation lines on by default;// undeclared relation types fall back to inference unless allowed.diff --git a/src/core/link-extraction.ts b/src/core/link-extraction.tsindex 4d32624186..7ad71f6629 100644--- a/src/core/link-extraction.ts+++ b/src/core/link-extraction.ts@@ -733,7 +733,7 @@ export async function extractPageLinks(}const suppressPrior = idx !== undefined && idx >= 0 && inSuppressedRange(suppressedRanges, idx);const legacy = inferLinkType(pageType, ctx, suppressPrior ? undefined : content, targetSlug,- opts.targetType ? targetType ?? null : undefined, bodyReference && idx !== undefined && idx >= 0 ? excerptAnchor(content, idx, 240) : undefined, content);+ opts.targetType ? targetType ?? null : undefined, bodyReference && idx !== undefined && idx >= 0 ? excerptAnchor(content, idx, 240) : undefined);if (pack?.link_types.some(lt => lt.name === legacy && (lt.inference?.page_type || lt.inference?.target_type))) return { linkType: 'mentions' };return { linkType: legacy };};@@ -1175,11 +1175,6 @@ function excerpt(s: string, idx: number, width: number): string {// - Possessive time: "his time at", "her time at", "their time at", "my time at".// - Role noun forms: "role at", "tenure as", "stint as", "position at".// - Promoted/staff-engineer forms: "promoted to (staff|senior|principal) engineer at".-const EMPLOYMENT_ROLE = String.raw`(?:(?:senior|staff|principal|lead|junior|associate|founding|chief|executive|managing|general|deputy|interim|acting) )*(?:software engineer|engineer|developer|designer|programmer|architect|scientist|researcher|analyst|product manager|engineering manager|program manager|project manager|manager|director|officer|counsel|marketer|recruiter|strategist|editor|producer|accountant|controller|specialist|coordinator|administrator|technician|intern|president|chief of staff|cto|ceo|coo|cfo|cmo|cro|cpo|vp|svp|evp|vice president of [a-z]+|head of [a-z]+(?: [a-z]+)?|(?:product|design|engineering|tech|team|growth|sales|marketing|data|research) lead)`;-const EMPLOYMENT_AREA = String.raw`(?:engineering|product|design|sales|marketing|growth|operations|ops|finance|people|hr|recruiting|platform|infrastructure|infra|data|security|research|partnerships|business development|customer success|support|legal|strategy|the [a-z]+ team)`;-// Ordinary job titles and functions: "senior designer at [X]", "led engineering at [X]", "joined [X] as CTO",-// "moved to [X] as head of sales". Board, advisory, investor and observer roles are not in these lists.-const ROLE_AT_RE = new RegExp(String.raw`\b(?:${EMPLOYMENT_ROLE} at|(?:led|leads|leading|ran|runs|running|managed|manages|managing|headed|heads|heading|oversaw|oversees|overseeing|owned|owns) ${EMPLOYMENT_AREA} at|(?:re-?joined|joined|joins|moved (?:over )?to|moves to|switched to|returned to|came back to|went to|hired (?:by|at|on at)|signed on (?:with|at))\b[^.\n]{0,80}?\bas (?:an? |the |its |their )?${EMPLOYMENT_ROLE})\b`, 'i');const WORKS_AT_RE = /\b(?:joined\b[^.\n]{0,80}?\bas (?:an? |the )?(?:senior |staff |principal |lead |founding |chief )?(?:engineer|developer|designer|product manager|engineering manager|manager|director|head of [a-z]+|scientist|researcher|analyst|employee|operator|cto|ceo|coo|cfo|cmo|vp)|CEO of|CTO of|COO of|CFO of|CMO of|CRO of|VP at|VP of|VPs? Engineering|VPs? Product|works at|worked at|working at|employed by|employed at|joined as|joined the team|engineer at|engineer for|director at|director of|head of|heads up .{0,20} at|leads engineering|leads product|leads the .{0,20} (?:team|org) at|manages engineering at|manages product at|running (?:engineering|product|design) at|currently at|previously at|previously worked at|spent .* (?:years|months) at|stint at|stint as|tenure at|tenure as|role at|position at|(?:senior|staff|principal|lead|backend|frontend|full-?stack|ML|data|security) engineer at|promoted to (?:senior|staff|principal|lead) .{0,20} at|(?:his|her|their|my) time at)\b/i;// Investment context. Order patterns from most-specific to least to keep@@ -1187,7 +1182,7 @@ const WORKS_AT_RE = /\b(?:joined\b[^.\n]{0,80}?\bas (?:an? |the )?(?:senior |sta// Series A"), narrative verbs ("invests in", "investing in"), historical// ("early investor in", "first check"), and portfolio framing ("portfolio// company", "portfolio includes").-const INVESTED_RE = /\b(?:invested in|invests in|investing in|invest in|investment in|investments in|backed by|funding from|funded by|raised from|led the (?:seed|Series|round|investment|round)|led .{0,30}(?:Series [A-Z]|seed|round|investment)|participated in (?:the )?(?:seed|Series|round)|wrote (?:a |the )?check|first check|early investor|portfolio (?:company|includes)|board seat (?:at|in|on)|term sheet for|as an? (?:angel |early |lead )?investor|(?:board )?observer (?:at|to|of|on|with|seat)|as an? (?:board )?observer)\b/i;+const INVESTED_RE = /\b(?:invested in|invests in|investing in|invest in|investment in|investments in|backed by|funding from|funded by|raised from|led the (?:seed|Series|round|investment|round)|led .{0,30}(?:Series [A-Z]|seed|round|investment)|participated in (?:the )?(?:seed|Series|round)|wrote (?:a |the )?check|first check|early investor|portfolio (?:company|includes)|board seat (?:at|in|on)|term sheet for)\b/i;// Founded patterns. Includes the noun-form "founder of" / "founders include"// because that's how real prose identifies founders ("Carol Wilson is the@@ -1207,7 +1202,7 @@ const FOUNDED_RE = /\b(?:founded|co-?founded|started the company|incorporated|fo// narratives where the direct "advises" verb isn't used.// - Advisor-qualified: "strategic advisor to|at", "technical advisor to|at",// "security advisor to|at", "product advisor to|at", "industry advisor".-const ADVISES_RE = /\b(?:advises|advised|(?:started|began|begun|now|currently|is|was|been) advising|advisor (?:to|at|for|of)|advisory (?:board|role|position|capacity|engagement|partnership|contract|relationship|work)|board advisor|on .{0,20} advisory board|joined .{0,20} advisory board|in an? advisory (?:capacity|role|position)|as an? (?:advisor|security advisor|technical advisor|strategic advisor|industry advisor|product advisor|board advisor|senior advisor)|(?:strategic|technical|security|product|industry|senior|board) advisor (?:to|at|for|of)|consults for|consulting role (?:at|with))\b/i;+const ADVISES_RE = /\b(?:advises|advised|advisor (?:to|at|for|of)|advisory (?:board|role|position|capacity|engagement|partnership|contract|relationship|work)|board advisor|on .{0,20} advisory board|joined .{0,20} advisory board|in an? advisory (?:capacity|role|position)|as an? (?:advisor|security advisor|technical advisor|strategic advisor|industry advisor|product advisor|board advisor|senior advisor)|(?:strategic|technical|security|product|industry|senior|board) advisor (?:to|at|for|of)|consults for|consulting role (?:at|with))\b/i;// Chinese link type patterns for CJK entity mentions.// NOTE: These patterns are Chinese-only (zh). Japanese and Korean link@@ -1243,12 +1238,8 @@ const ADVISOR_ROLE_RE = /\b(?:full-time advisor|professional advisor|advises (?:const EMPLOYEE_ROLE_RE = /\b(?:is an? (?:senior|staff|principal|lead|backend|frontend|full-?stack|ML|data|security|DevOps|platform)? ?engineer at|is an? (?:senior|staff|principal|lead)? ?(?:developer|designer|product manager|engineering manager|director|VP) (?:at|of)|holds? the (?:CTO|CEO|CFO|COO|CMO|CRO|VP) (?:role|position|seat|title) at|is the (?:CTO|CEO|CFO|COO|CMO|CRO) of|employee at|on the team at|works on .{0,30} at)\b/i;-// Board roles ("joined the board of [X]", "board member at [X]", "[X]'s board") are never employment.-// An investor's board seat is the investment; anyone else's is advisory (resolved in inferLinkType).-const BOARD_RE = /\b(?:board (?:member|director|role|position) (?:of|at|for|with)|(?:join(?:s|ed|ing)?|serves? on|sits? on|named to|appointed to|elected to|seats? on) (?:the )?boards? (?:of|at)|board of directors (?:of|at)|(?:non-executive|independent) director (?:of|at)|chair(?:man|woman|person)? of the board (?:of|at)|as an? (?:board member|board director|independent director|non-executive director))\b/i;-const BOARD_AFTER_RE = /(?:'s|’s) (?:advisory )?board\b/i;const VERB_RULES: ReadonlyArray<readonly [RegExp, string]> = [- [FOUNDED_RE, 'founded'], [INVESTED_RE, 'invested_in'], [ADVISES_RE, 'advises'], [BOARD_RE, 'board'], [BOARD_AFTER_RE, 'board'], [WORKS_AT_RE, 'works_at'], [ROLE_AT_RE, 'works_at'],+ [FOUNDED_RE, 'founded'], [INVESTED_RE, 'invested_in'], [ADVISES_RE, 'advises'], [WORKS_AT_RE, 'works_at'],[ZH_FOUNDED_RE, 'founded'], [ZH_INVESTED_RE, 'invested_in'], [ZH_ADVISES_RE, 'advises'], [ZH_WORKS_AT_RE, 'works_at'], [ZH_CITED_RE, 'cited'],];@@ -1305,7 +1296,7 @@ function attachedVerb(context: string, targetSlug?: string, anchor?: number): st* lists portfolio companies without repeating the investment verb each time* ("Her current board seats reflect her portfolio: [Co A], [Co B], [Co C]").*/-export function inferLinkType(pageType: PageType, context: string, globalContext?: string, targetSlug?: string, targetType?: string | null, anchor?: number, pageText?: string): string {+export function inferLinkType(pageType: PageType, context: string, globalContext?: string, targetSlug?: string, targetType?: string | null, anchor?: number): string {if (pageType === 'media') {return 'mentions';}@@ -1321,12 +1312,9 @@ export function inferLinkType(pageType: PageType, context: string, globalContext// Per-edge verb rules, precedence founded > invested_in > advises > works_at// (then the Chinese rules), over the verbs that belong to this link: in// "works at [A] and also advises [B]", A is works_at and B advises.- // The role prior's timeline suppression does not apply here: whose board seat this is depends on the whole page.- const roleText = pageText ?? globalContext;- const board = () => (pageType === 'person' && roleText && PARTNER_ROLE_RE.test(roleText) ? 'invested_in' : 'advises');const attached = attachedVerb(context, targetSlug, anchor);- if (attached) return attached === 'board' ? board() : attached;- if (attached === undefined) for (const [re, verb] of VERB_RULES) if (re.test(context)) return verb === 'board' ? board() : verb;+ if (attached) return attached;+ if (attached === undefined) for (const [re, verb] of VERB_RULES) if (re.test(context)) return verb;// Page-role prior: only fires for person -> company links. Concept pages// about VC topics naturally contain "venture capital" in their text, but// their company refs are mentions, not investments. Partner pages mentioningdiff --git a/src/core/link-temporal-evidence.ts b/src/core/link-temporal-evidence.tsindex 09a55a9927..4029bd42d4 100644--- a/src/core/link-temporal-evidence.ts+++ b/src/core/link-temporal-evidence.ts@@ -65,23 +65,11 @@ const ROLE = String.raw`(?:[\w&./-]+\s+){0,4}?`;const NOT_PAST_ROLE = String.raw`(?!(?:promoted|hired|named|appointed|made|elected|brought|recently|just|newly|now|still|currently)\b)`;/** Present perfect ("has worked at", "have spent years at") describes a job that is still going. */const NOT_PERFECT = String.raw`(?<!\b(?:has|have|'s|’s)\s+(?:\w+\s+)?)`;-/** Advisory, board and investor roles ("took an advisory role with", "became an advisor at") are not jobs. */-const NOT_EMPLOYMENT_ROLE = String.raw`(?!(?:\w+\s+){0,2}?(?:advis\w*|board|investor|investing|investment|angel|observer)\b)`;const OWNED = String.raw`(?:(?:her|his|their|my|the)\s+)?(?:time|stint|tenure|role|job|run)\s+`;-/** A leave phrase whose object splits the phrasal verb: "wrapped their time up at", "handed their notice in at", "handed in her resignation at". */-const LEAVE_OBJECT = String.raw`(?:(?:her|his|their|my|a|the)\s+)?(?:time|stint|tenure|role|job|run|things|it|notice|resignation)\s+`;-const SPLIT_LEAVE = String.raw`(?:wrapped|wound|finished)\s+${LEAVE_OBJECT}up\s+(?:at|with)|(?:handed|turned|put)\s+(?:in\s+${LEAVE_OBJECT}|${LEAVE_OBJECT}in\s+)(?:at|to|with)|(?:gave|submitted|tendered)\s+${LEAVE_OBJECT}(?:at|to)`;-/** Quitting idioms: "packed it in at", "called time on", "bowed out of", "walked out of", "threw in the towel at", "handed in her badge at". */-const IDIOM_LEAVE = String.raw`packed\s+(?:it|things)\s+in\s+(?:at|with)|call(?:ed|s|ing)?\s+(?:it\s+)?time\s+(?:on|at)|bow(?:ed|s|ing)?\s+out\s+(?:of|from|at)|walk(?:ed|s|ing)?\s+out\s+(?:of|on)|thr(?:ew|ows|owing)\s+in\s+the\s+towel\s+(?:at|with)|hand(?:ed|s|ing)?\s+in\s+(?:(?:her|his|their|my)\s+)?(?:badge|keys|laptop)\s+(?:at|to)|clear(?:ed|s|ing)?\s+out\s+(?:(?:her|his|their|my)\s+)?desk\s+at|gave\s+up\s+(?:(?:her|his|their|my)\s+)?(?:job|role|post|position|seat)\s+at|left\s+(?:(?:her|his|their|my)\s+)?(?:job|role|post|position)\s+at`;-/** Starts framed as a first day or kick-off: "first day at [X]", "day one at", "first week at", "kicked off a new role at", "kick-off at". */-const FIRST_DAY_START = String.raw`(?:(?:her|his|their|my|a|the)\s+)?(?:first\s+(?:day|week|month)|day\s+one)\s+(?:as\s+${ROLE})?(?:at|with)|kick(?:ed|s|ing)?[\s-]?off\s+(?:(?:a|her|his|their|my)\s+)?(?:new\s+)?(?:role|job|position|chapter|stint)\s+(?:at|with)|kick-?off\s+(?:day\s+)?(?:at|with)|(?:new\s+)?(?:role|job|chapter)\s+(?:starts|started|began|begins)\s+at|started\s+(?:a\s+|her\s+|his\s+|their\s+|my\s+)?new\s+chapter\s+at`;-/** "traded [A] for [B]": the exchange ends A; the "for" then starts B (see the natural-cue loop). */-const EXCHANGE_BEFORE = /\b(?:traded|swapped|exchanged|ditched|dropped)\s*$/i;-const EXCHANGE_AFTER = /^\s+for\s+(?:\[|the\s+\[|an?\s+\[)/i;const EMPLOYMENT = {- end: new RegExp(String.raw`\b(?:left|leaving|departed(?:\s+from)?|quit|resigned(?:\s+as\s+${ROLE})?(?:\s+from|\s+at)?|stepped\s+down(?:\s+as\s+${ROLE})?(?:\s+from|\s+at)?|stepped\s+away\s+from|moved\s+on\s+from|(?:moved|switched|transitioned|jumped)\s+(?:over\s+|out\s+)?from|(?:was\s+)?laid\s+off\s+(?:from|by|at)|(?:was\s+)?let\s+go\s+(?:from|by)|(?:was\s+)?fired\s+(?:from|by)|no\s+longer\s+(?:at|with|works\s+at|working\s+at)|exited|parted\s+ways\s+with|retired\s+from|(?:wrapped\s+up|finished|ended|concluded)\s+(?:${OWNED})?(?:at|with)|last\s+day\s+at|departure\s+from|${SPLIT_LEAVE}|step(?:ped|s|ping)?\s+back\s+from|walked\s+away\s+from|parted\s+company\s+with|called\s+it\s+quits\s+(?:at|with)|said\s+(?:(?:her|his|their|my)\s+)?goodbyes?\s+to|bid(?:\s+a)?\s+farewell\s+to|${IDIOM_LEAVE})\s*$`, 'i'),- start: new RegExp(String.raw`\b(?:(?:re-?)?join(?:ed|s|ing)?(?:\s+${ROLE}(?:at|as))?|(?:was\s+)?hired\s+(?:by|at|as\s+${ROLE}at)|started\s+(?:at|with|working\s+(?:at|for)|(?:a\s+)?new\s+(?:role|job|position)\s+at)|became\s+${NOT_EMPLOYMENT_ROLE}${ROLE}(?:at|of)|promoted\s+to\s+${ROLE}(?:at|of)|signed\s+on\s+(?:at|with)|named\s+${ROLE}(?:at|of)|accepted\s+(?:an?\s+)?(?:offer|role|position|job)\s+(?:at|with|from)|took\s+(?:an?\s+|the\s+)?${NOT_EMPLOYMENT_ROLE}(?:\w+\s+){0,2}?(?:role|job|position)\s+(?:at|with)|came\s+(?:on\s+board|aboard)(?:\s+(?:at|with))?|got\s+on\s+board\s+(?:at|with)|(?:was\s+|got\s+|been\s+)?onboarded\s+(?:at|with|to|into|by)|hired\s+on\s+(?:at|with|by)|(?:was\s+)?brought\s+on(?:\s+board)?\s+(?:at|by|with)|joined\s+up\s+with|signed\s+up\s+(?:at|with)|began\s+(?:work(?:ing)?\s+)?(?:at|with|for)|went\s+to\s+(?:work\s+)?(?:at|for)|took\s+up\s+(?:an?\s+|the\s+)?${NOT_EMPLOYMENT_ROLE}(?:\w+\s+){0,2}?(?:role|job|post|position)\s+(?:at|with)|returned\s+to|${FIRST_DAY_START})\s*$`, 'i'),+ end: new RegExp(String.raw`\b(?:left|leaving|departed(?:\s+from)?|quit|resigned(?:\s+as\s+${ROLE})?(?:\s+from|\s+at)?|stepped\s+down(?:\s+as\s+${ROLE})?(?:\s+from|\s+at)?|stepped\s+away\s+from|moved\s+on\s+from|(?:moved|switched|transitioned|jumped)\s+(?:over\s+|out\s+)?from|(?:was\s+)?laid\s+off\s+(?:from|by|at)|(?:was\s+)?let\s+go\s+(?:from|by)|(?:was\s+)?fired\s+(?:from|by)|no\s+longer\s+(?:at|with|works\s+at|working\s+at)|exited|parted\s+ways\s+with|retired\s+from|(?:wrapped\s+up|finished|ended|concluded)\s+(?:${OWNED})?(?:at|with)|last\s+day\s+at|departure\s+from)\s*$`, 'i'),+ start: new RegExp(String.raw`\b(?:(?:re-?)?join(?:ed|s|ing)?(?:\s+${ROLE}(?:at|as))?|(?:was\s+)?hired\s+(?:by|at|as\s+${ROLE}at)|started\s+(?:at|with|working\s+(?:at|for)|(?:a\s+)?new\s+(?:role|job|position)\s+at)|became\s+${ROLE}(?:at|of)|promoted\s+to\s+${ROLE}(?:at|of)|signed\s+on\s+(?:at|with)|named\s+${ROLE}(?:at|of)|accepted\s+(?:an?\s+)?(?:offer|role|position|job)\s+(?:at|with|from)|took\s+(?:an?\s+|the\s+)?(?:\w+\s+){0,2}?(?:role|job|position)\s+(?:at|with)|came\s+(?:on\s+board|aboard)\s+(?:at|with)|went\s+to\s+work\s+(?:at|for)|returned\s+to)\s*$`, 'i'),past: new RegExp(String.raw`\b(?:previously(?:\s+worked)?\s+(?:at|with|for)|formerly(?:\s+${ROLE})?\s*(?:at|of|with)|former\s+${ROLE}(?:at|of|with)|ex-[\w-]+\s+(?:at|of)|used\s+to\s+work\s+(?:at|for)|${NOT_PERFECT}worked\s+(?:at|for|with)|${NOT_PERFECT}spent\s+(?:[\w-]+\s+){1,4}?(?:at|with)|(?:his|her|their|my)\s+(?:time|stint|tenure)\s+at|stint\s+at|was\s+${NOT_PAST_ROLE}${ROLE}(?:at|of)|alum(?:nus|na|ni)?\s+of)\s*$`, 'i'),};@@ -260,7 +248,7 @@ export function deriveTemporalEvidence(page: PageForEvidence, rows: readonly Ownif (r.link_type !== 'advises' || !ADVISORY_BOARD_AFTER.test(line.text.slice(ref.end))) continue;kind = /\b(?:left|stepped\s+(?:down|off|away)\s+from|resigned\s+from)\s*$/i.test(window) ? 'end': /\b(?:(?:re-?)?joined|was\s+(?:added|named|appointed)\s+to)\s*$/i.test(window) ? 'start' : null;- } else kind = cues.end.test(window) || (EXCHANGE_BEFORE.test(window) && EXCHANGE_AFTER.test(line.text.slice(ref.end))) ? 'end'+ } else kind = cues.end.test(window) ? 'end': cues.start.test(window) || (prevEnded.has(r.link_type) && /^\s*(?:to|for)\s*$/i.test(between)) ? 'start' : null;} else if (EVENT_START[r.link_type]?.test(window)) kind = 'start';if (!kind) continue;diff --git a/src/core/wanted-links.ts b/src/core/wanted-links.tsindex 705ad36ed7..3f7cfd1c6b 100644--- a/src/core/wanted-links.ts+++ b/src/core/wanted-links.ts@@ -86,8 +86,8 @@ export async function isWantedPagesEnabled(engine: Pick<BrainEngine, 'getConfig'return value == null || !['false', '0', 'no', 'off'].includes(value.trim().toLowerCase());}-/** `wanted_pages.remote` (default off; needs `wanted_pages.enabled`): the remote `links` effect records missing mention targets. */+/** `wanted_pages.remote` (default on; needs `wanted_pages.enabled`): the remote `links` effect records missing mention targets. */export async function isRemoteWantedPagesEnabled(engine: Pick<BrainEngine, 'getConfig'>): Promise<boolean> {const value = await engine.getConfig('wanted_pages.remote').catch(() => null);- return value != null && ['true', '1', 'yes', 'on'].includes(value.trim().toLowerCase()) && await isWantedPagesEnabled(engine);+ return (value == null || !['false', '0', 'no', 'off'].includes(value.trim().toLowerCase())) && await isWantedPagesEnabled(engine);}diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex 25a9703860..d1dd5e2c80 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -4824,7 +4824,7 @@"kind": "function","name": "inferLinkType","signature": [- "(pageType: PageType, context: string, globalContext?: string, targetSlug?: string, targetType?: string | null, anchor?: number, pageText?: string) => string"+ "(pageType: PageType, context: string, globalContext?: string, targetSlug?: string, targetType?: string | null, anchor?: number) => string"]},{diff --git a/test/helpers/remote-links-contract.ts b/test/helpers/remote-links-contract.tsindex a9f67caab4..b6d37f0f98 100644--- a/test/helpers/remote-links-contract.ts+++ b/test/helpers/remote-links-contract.ts@@ -104,10 +104,11 @@ export async function exerciseRemoteLinks(engine: BrainEngine, scenario: RemoteLif (scenario === 'wanted') {const wanted = () => engine.executeRaw<{ target_ref: string; producer: string; link_type: string }>(`SELECT w.target_ref,w.producer,w.link_typeFROM wanted_links w JOIN pages p ON p.id=w.origin_page_id WHERE p.source_id=$1 AND p.slug='notes/example' ORDER BY w.target_ref`, [sourceId]);+ await engine.setConfig('wanted_pages.remote', 'false');await write(MENTIONS(sourceId));await runLinks();- expect(await wanted()).toEqual([]); // wanted_pages.remote is off by default- await engine.setConfig('wanted_pages.remote', 'true');+ expect(await wanted()).toEqual([]); // turned off: nothing recorded+ await engine.executeRaw("DELETE FROM config WHERE key='wanted_pages.remote'"); // default ontry {await write(`${MENTIONS(sourceId)}\nAnother paragraph.\n`);await runLinks();diff --git a/test/link-extraction.test.ts b/test/link-extraction.test.tsindex 5122d6e5d9..4f1dd078a6 100644--- a/test/link-extraction.test.ts+++ b/test/link-extraction.test.ts@@ -764,13 +764,12 @@ describe('inferLinkType', () => {expect(inferLinkType('person', 'Emily advises Acme on go-to-market.')).toBe('advises');});- test('a board role is never employment: an investor\'s board seat is invested_in, anyone else\'s is advises', () => {- // v0.10.4 kept generic board language at mentions because partner bios- // ("She sits on the boards of [portfolio company]") read as advises. The- // page's investor role now decides instead, so a board line can never- // fall through to works_at (a board role is not a job).- expect(inferLinkType('person', 'Jane is a board member at Beta Health.')).toBe('advises');- expect(inferLinkType('person', 'She sits on the boards of Beta Health.', 'Jane is a partner at a venture fund.')).toBe('invested_in');+ test('"board member" alone is too ambiguous (investors also hold board seats) -> mentions', () => {+ // Tightened in v0.10.4 after BrainBench rich-prose surfaced that partner+ // bios ("She sits on the boards of [portfolio company]") were classified+ // as advises. Generic board language now requires explicit advisor/advise+ // rooting to count.+ expect(inferLinkType('person', 'Jane is a board member at Beta Health.')).toBe('mentions');});test('explicit advisor language -> advises', () => {@@ -890,11 +889,14 @@ describe('inferLinkType', () => {// ─── Regression guards: v0.10.5 expansions must not break tightened rules ───- test('v0.10.5 regression: a partner bio\'s board seats stay investments, never advises', () => {- // The v0.10.4 false positive: partner bios must not read as advisory.- const bio = 'Jane is a partner at a venture fund. She sits on the board of Acme.';- expect(inferLinkType('person', 'She sits on the board of Acme.', bio)).toBe('invested_in');- expect(inferLinkType('person', 'Jane is a board member at Beta Health.', bio)).toBe('invested_in');+ test('v0.10.5 regression: generic "board member" still resolves to mentions', () => {+ // This was the v0.10.4 tightening. The expanded ADVISES_RE must not+ // re-introduce the false-positive on partner bios.+ expect(inferLinkType('person', 'Jane is a board member at Beta Health.')).toBe('mentions');+ });++ test('v0.10.5 regression: "sits on the board" still mentions (not advises)', () => {+ expect(inferLinkType('person', 'She sits on the board of Acme.')).toBe('mentions');});test('v0.10.5 regression: "backs companies" still resolves to invested_in via partner prior', () => {diff --git a/test/link-temporal-evidence.test.ts b/test/link-temporal-evidence.test.tsindex 3331116760..2d91b33d95 100644--- a/test/link-temporal-evidence.test.ts+++ b/test/link-temporal-evidence.test.ts@@ -34,75 +34,6 @@ describe('dated timeline cues', () => {expect(brief(ev.transitions)).toEqual(['acme-example:advises:end:2024-06-01:timeline']);});- test('an advisory, board or investor role is not an employment start (one long stint stays one stint)', () => {- const rows = [row('companies/acme-example', 'works_at'), row('companies/acme-example', 'advises')];- const timeline = [- '- **2015-01-05** | linkedin — Joined [Acme](companies/acme-example)',- '- **2023-09-01** | linkedin — Took an advisory role with [Acme](companies/acme-example)',- '- **2024-02-01** | note — took a board observer role at [Acme](companies/acme-example)',- '- **2024-05-01** | note — took an investor role with [Acme](companies/acme-example)',- ].join('\n');- expect(brief(derive('Alice works at [Acme](companies/acme-example).', timeline, rows).transitions).filter(t => t.includes(':works_at:')))- .toEqual(['acme-example:works_at:start:2015-01-05:timeline']);- });-- test('becoming an advisor or board member is not an employment start; becoming CTO is', () => {- const rows = [row('companies/acme-example', 'works_at'), row('companies/acme-example', 'advises')];- const works = (timeline: string) => brief(derive('Alice works at [Acme](companies/acme-example).', timeline, rows).transitions).filter(t => t.includes(':works_at:'));- expect(works('- **2023-09-01** | linkedin — Became an advisor at [Acme](companies/acme-example)')).toEqual([]);- expect(works('- **2023-09-01** | note — became a senior advisor at [Acme](companies/acme-example)')).toEqual([]);- expect(works('- **2023-09-01** | note — became a board member of [Acme](companies/acme-example)')).toEqual([]);- expect(works('- **2023-09-01** | linkedin — Became CTO at [Acme](companies/acme-example)')).toEqual(['acme-example:works_at:start:2023-09-01:timeline']);- });-- test('taking an ordinary role is still an employment start', () => {- const ev = derive('', '- **2024-06-01** | note — took the CTO role at [Acme](companies/acme-example)', [row('companies/acme-example', 'works_at')]);- expect(brief(ev.transitions)).toEqual(['acme-example:works_at:start:2024-06-01:timeline']);- });-- const works = (line: string) => brief(derive('', `- **2024-05-01** | note — ${line}`,- [row('companies/acme-example', 'works_at'), row('companies/widget-co', 'works_at')]).transitions);- const A = '[Acme](companies/acme-example)', B = '[Widget](companies/widget-co)';-- test('onboarding-style join verbs start employment', () => {- for (const line of [`was onboarded at ${A}`, `got onboarded with ${A}`, `came aboard ${A}`, `hired on at ${A}`, `was brought on at ${A}`,- `joined up with ${A}`, `began working at ${A}`, `took up a new post at ${A}`])- expect(works(line)).toEqual(['acme-example:works_at:start:2024-05-01:timeline']);- expect(works(`took up an advisory post at ${A}`)).toEqual([]);- });-- test('leave phrases, including ones whose object splits the verb, end employment', () => {- for (const line of [`wrapped their time up at ${A}`, `wound things up at ${A}`, `handed in their notice at ${A}`, `handed their notice in at ${A}`,- `gave notice at ${A}`, `stepped back from ${A}`, `walked away from ${A}`, `said goodbye to ${A}`, `called it quits at ${A}`])- expect(works(line)).toEqual(['acme-example:works_at:end:2024-05-01:timeline']);- });-- test('quitting idioms with a particle or object in the middle end employment', () => {- for (const line of [`left ${A} behind`, `moved on from ${A}`, `packed it in at ${A}`, `called time on ${A}`, `bowed out of ${A}`, `walked out of ${A}`,- `threw in the towel at ${A}`, `handed in her badge at ${A}`, `gave up her role at ${A}`])- expect(works(line)).toEqual(['acme-example:works_at:end:2024-05-01:timeline']);- });-- test('a first day or kick-off at [X] starts employment', () => {- for (const line of [`first day at ${A}`, `her first week at ${A}`, `day one at ${A}`, `first day as CTO at ${A}`, `kicked off a new role at ${A}`, `kick-off at ${A}`])- expect(works(line)).toEqual(['acme-example:works_at:start:2024-05-01:timeline']);- });-- test('idiom look-alikes about events are not moves', () => {- for (const line of [`first day at the ${A} conference`, `bowed out of the ${A} panel`, `called time on the ${A} deal`, `walked out of a ${A} meeting`])- expect(works(line)).toEqual([]);- });-- test('"traded [A] for [B]" ends A and starts B', () => {- for (const verb of ['traded', 'swapped', 'exchanged'])- expect(works(`${verb} ${A} for ${B}`)).toEqual(['acme-example:works_at:end:2024-05-01:timeline', 'widget-co:works_at:start:2024-05-01:timeline']);- });-- test('look-alikes are not moves: traded shares, swapped notes, a stock, a board', () => {- for (const line of [`traded shares of ${A}`, `swapped notes with ${A}`, `traded ${A} stock`, `stepped back from the ${A} board`])- expect(works(line)).toEqual([]);- });-test('a meeting with a former employer is not a start', () => {const ev = derive('', '- **2026-01-10** | cal — Coffee with the [Acme](companies/acme-example) team', [row('companies/acme-example', 'works_at')]);expect(ev.transitions).toEqual([]);diff --git a/test/link-type-attachment.test.ts b/test/link-type-attachment.test.tsindex 6ee24ddd98..802c3526a4 100644--- a/test/link-type-attachment.test.ts+++ b/test/link-type-attachment.test.ts@@ -3,7 +3,7 @@* another link in the same context window does not type this link, and* "joined [X] as <role>" reads as works_at. Pure, no engine.*/-import { describe, expect, test } from 'bun:test';+import { expect, test } from 'bun:test';import { extractPageLinks, inferLinkType, type SlugResolver } from '../src/core/link-extraction.ts';const nullResolver: SlugResolver = { resolve: async () => null };@@ -57,48 +57,3 @@ test('a verb right before a preposition and the next link belongs to that link:const r = await extractPageLinks('people/alice-example', content, {}, 'person', { resolve: async () => null } as SlugResolver, {});expect(r.candidates.map(c => [c.targetSlug, c.linkType])).toEqual([['companies/beta-example', 'works_at'], ['companies/acme-example', 'advises']]);});--describe('advisory, board, investor and observer roles are never employment', () => {- const typeOf = async (line: string, prose = '') => {- const r = await extractPageLinks('people/alice-example', `${prose}\n\n## Timeline\n\n- **2023-09-01** | note — ${line}`, {}, 'person', { resolve: async () => null } as SlugResolver, {});- return r.candidates.filter(c => c.targetSlug === 'companies/acme-example').map(c => c.linkType);- };- const advisory = ['Took an advisory role with [Acme](companies/acme-example)', 'Became a board member of [Acme](companies/acme-example)',- "Joined [Acme](companies/acme-example)'s board", 'Joined the board of [Acme](companies/acme-example)', 'Board director at [Acme](companies/acme-example)',- 'Took on a board role at [Acme](companies/acme-example)', 'Joined [Acme](companies/acme-example) as an independent director', 'Started advising [Acme](companies/acme-example)'];- test('a board or advisory role types advises, even on a page whose prose names a job elsewhere', async () => {- for (const line of advisory) {- expect(await typeOf(line)).toEqual(['advises']);- expect(await typeOf(line, 'Alice is the CTO of [Beta](companies/beta-example).')).toEqual(['advises']);- }- });- test('an observer or investor role types invested_in', async () => {- for (const line of ['Board observer at [Acme](companies/acme-example)', 'Became an observer at [Acme](companies/acme-example)', 'Joined [Acme](companies/acme-example) as an angel investor'])- expect(await typeOf(line)).toEqual(['invested_in']);- });- test("an investor's board seat is the investment", async () => {- expect(await typeOf('Joined the board of [Acme](companies/acme-example)', 'Alice is a general partner at a venture fund.')).toEqual(['invested_in']);- });-});--describe('ordinary job roles type works_at (must not regress against master)', () => {- const types = async (body: string) => {- const r = await extractPageLinks('people/alice-example', `Alice.\n\n${body}`, {}, 'person', { resolve: async () => null } as SlugResolver, {});- return r.candidates.map(c => `${c.targetSlug.split('/')[1]}:${c.linkType}`);- };- const A = '[Acme](companies/acme-example)', B = '[Widget](companies/widget-co)';- test('a role before "at" and a join or move ending "as <role>" stay works_at, in prose and on timeline lines', async () => {- for (const line of [`Led engineering at ${A}`, `Senior designer at ${A}`, `Product lead at ${A}`, `Runs marketing at ${A}`, `Joined ${A} as CTO`,- `Joined ${A} as chief of staff`, `Moved to ${A} as head of sales`, `Switched to ${A} as product lead`, `Rejoined ${A} as COO`, `Returned to ${A} as general counsel`]) {- expect(await types(line)).toEqual(['acme-example:works_at']);- expect(await types(`## Timeline\n\n- **2024-02-01** | linkedin — ${line}`)).toEqual(['acme-example:works_at']);- }- });- test('a role-before-"at" job keeps works_at when the next line\'s verb belongs to another company', async () => {- expect(await types(`## Timeline\n\n- **2019-01-01** | note — Senior designer at ${B}\n- **2023-06-01** | note — Moved to ${A} as head of sales`))- .toEqual(['widget-co:works_at', 'acme-example:works_at']);- });- test('advising work inside a job is not an advisory relationship', async () => {- expect(await types(`Solutions engineer advising customers at ${A}`)).not.toContain('acme-example:advises');- });-});