Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(extract): stop asserting works_at from bare people/->companies/ adjacency (#3466) (#3642)

Masa7e21e47c1523
diff --git a/src/commands/extract.ts b/src/commands/extract.ts
index 7c9a966b3e..a67449e34a 100644
--- a/src/commands/extract.ts
+++ b/src/commands/extract.ts
@@ -349,7 +349,13 @@ function inferTypeByDir(fromDir: string, toDir: string, frontmatter?: Record<str
const to = toDir.split('/')[0];
if (from === 'people' && to === 'companies') {
if (Array.isArray(frontmatter?.founded)) return 'founded';
- return 'works_at';
+ // #3466: bare people/ -> companies/ adjacency is not evidence of
+ // employment, so it gets the neutral 'mentions' verb instead of
+ // 'works_at'. Real works_at edges still come from the two paths that
+ // read actual evidence: the company:/companies: frontmatter fields
+ // (FRONTMATTER_LINK_MAP) and employment phrasing in prose
+ // (inferLinkType in link-extraction.ts).
+ return 'mentions';
}
if (from === 'people' && to === 'deals') return 'involved_in';
if (from === 'deals' && to === 'companies') return 'deal_for';
diff --git a/src/core/link-extraction.ts b/src/core/link-extraction.ts
index c8d5e38d1d..9e87f3da60 100644
--- a/src/core/link-extraction.ts
+++ b/src/core/link-extraction.ts
@@ -28,10 +28,11 @@ import { ensureWellFormed } from './text-safe.ts';
* OR updated_at > links_extracted_at`. It is an ISO-8601 string (NOT a number) —
* the column is TIMESTAMPTZ and the predicate binds it as `::timestamptz`.
*/
-// 2026-07-10: bumped for the #2576 --stale nullResolver fix — sweeps before it
-// stamped pages with their bare wikilinks silently dropped; the bump re-flags
-// them so the fixed sweep re-extracts.
-export const LINK_EXTRACTOR_VERSION_TS = '2026-07-10T00:00:00Z';
+// 2026-07-30: bumped for the #3466 inferTypeByDir fix — unevidenced
+// people/ -> companies/ adjacency now infers 'mentions' instead of
+// 'works_at'; the bump re-flags stamped pages so the next --stale sweep
+// re-extracts them under the corrected inference.
+export const LINK_EXTRACTOR_VERSION_TS = '2026-07-30T00:00:00Z';
// ─── Entity references ──────────────────────────────────────────
diff --git a/test/extract.test.ts b/test/extract.test.ts
index 90cf54d1fe..86dc13ecdc 100644
--- a/test/extract.test.ts
+++ b/test/extract.test.ts
@@ -97,11 +97,24 @@ describe('extractLinksFromFile', () => {
expect(links).toEqual([]);
});
- it('infers link type from directory structure', async () => {
+ it('people -> companies adjacency without evidence infers mentions, not works_at (#3466)', async () => {
+ // The content carries no employment language, so the directory pair alone
+ // must not assert a specific employment claim. Evidence-based works_at
+ // still flows through the company: frontmatter path (covered above) and
+ // prose inference in link-extraction.ts.
const content = 'See [Brex](../companies/brex.md).';
const allSlugs = new Set(['people/pedro', 'companies/brex']);
const links = await extractLinksFromFile(content, 'people/pedro.md', allSlugs);
- expect(links[0].link_type).toBe('works_at');
+ expect(links).toHaveLength(1);
+ expect(links[0].link_type).toBe('mentions');
+ });
+
+ it('people -> companies with founded frontmatter infers founded', async () => {
+ const content = '---\nfounded: [brex]\n---\nSee [Brex](../companies/brex.md).';
+ const allSlugs = new Set(['people/pedro', 'companies/brex']);
+ const links = await extractLinksFromFile(content, 'people/pedro.md', allSlugs);
+ expect(links).toHaveLength(1);
+ expect(links[0].link_type).toBe('founded');
});
it('infers deal_for type for deals -> companies', async () => {