Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(graph): ordinary job roles stay works_at; idiomatic leaves and first-day starts date employment

garrytan583a851ee38e
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsv
index 6f0084cf12..99944dc6ab 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 re
src/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 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_at
+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/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 verify
src/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 refresh
src/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 read
diff --git a/src/core/link-extraction.ts b/src/core/link-extraction.ts
index 531913f37e..4d32624186 100644
--- a/src/core/link-extraction.ts
+++ b/src/core/link-extraction.ts
@@ -1175,6 +1175,11 @@ 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
@@ -1202,7 +1207,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|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|(?: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;
// Chinese link type patterns for CJK entity mentions.
// NOTE: These patterns are Chinese-only (zh). Japanese and Korean link
@@ -1243,7 +1248,7 @@ const EMPLOYEE_ROLE_RE = /\b(?:is an? (?:senior|staff|principal|lead|backend|fro
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'],
+ [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'],
[ZH_FOUNDED_RE, 'founded'], [ZH_INVESTED_RE, 'invested_in'], [ZH_ADVISES_RE, 'advises'], [ZH_WORKS_AT_RE, 'works_at'], [ZH_CITED_RE, 'cited'],
];
diff --git a/src/core/link-temporal-evidence.ts b/src/core/link-temporal-evidence.ts
index 1461eed7db..09a55a9927 100644
--- a/src/core/link-temporal-evidence.ts
+++ b/src/core/link-temporal-evidence.ts
@@ -71,13 +71,17 @@ const OWNED = String.raw`(?:(?:her|his|their|my|the)\s+)?(?:time|stint|tenure|ro
/** 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)\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)\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|${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'),
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'),
};
diff --git a/test/link-temporal-evidence.test.ts b/test/link-temporal-evidence.test.ts
index d8cb4f779c..3331116760 100644
--- a/test/link-temporal-evidence.test.ts
+++ b/test/link-temporal-evidence.test.ts
@@ -77,6 +77,22 @@ describe('dated timeline cues', () => {
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']);
diff --git a/test/link-type-attachment.test.ts b/test/link-type-attachment.test.ts
index fc16337ab3..6ee24ddd98 100644
--- a/test/link-type-attachment.test.ts
+++ b/test/link-type-attachment.test.ts
@@ -80,3 +80,25 @@ describe('advisory, board, investor and observer roles are never employment', ()
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');
+ });
+});