Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

typing unit U6: onboarding, first-day and new-chapter start framings

garrytanfd0b1f55ada5
diff --git a/src/core/link-temporal-evidence.ts b/src/core/link-temporal-evidence.ts
index 32ec3ae42a..c1cd75fd6d 100644
--- a/src/core/link-temporal-evidence.ts
+++ b/src/core/link-temporal-evidence.ts
@@ -25,7 +25,7 @@ import {
type TransitionKind, type TransitionProducer,
} from './link-validity.ts';
import { KNOWN_LINK_TYPES } from './search/relational-intent.ts';
-import { U4_NOT_EMPLOYMENT_ROLE, U5_EXCHANGE_AFTER, U5_EXCHANGE_BEFORE, U5_LEAVE, typingUnitEnabled } from './link-typing-units.ts';
+import { U4_NOT_EMPLOYMENT_ROLE, U5_EXCHANGE_AFTER, U5_EXCHANGE_BEFORE, U5_LEAVE, U6_START, typingUnitEnabled } from './link-typing-units.ts';
export interface OwnedRow {
from_slug: string;
@@ -271,6 +271,7 @@ export function deriveTemporalEvidence(page: PageForEvidence, rows: readonly Own
else if (u5 && r.link_type === 'works_at' && U5_LEAVE.test(window)) { kind = 'end'; rule = 'unit.u5.leave'; }
else if (u5 && r.link_type === 'works_at' && U5_EXCHANGE_BEFORE.test(window) && U5_EXCHANGE_AFTER.test(line.text.slice(ref.end))) { kind = 'end'; rule = 'unit.u5.exchange'; }
else if (cues.start.test(window)) { kind = 'start'; rule = `cue.${family}.start`; }
+ else if (r.link_type === 'works_at' && typingUnitEnabled('U6') && U6_START.test(window)) { kind = 'start'; rule = 'unit.u6.start_framing'; }
else if (prevEnded.has(r.link_type) && /^\s*(?:to|for)\s*$/i.test(between)) { kind = 'start'; rule = 'cue.after_end.to_for'; }
} else if (EVENT_START[r.link_type]?.test(window)) { kind = 'start'; rule = `cue.event.${r.link_type}`; }
if (!kind) {
diff --git a/src/core/link-typing-units.ts b/src/core/link-typing-units.ts
index b7249d9da9..9f21943836 100644
--- a/src/core/link-typing-units.ts
+++ b/src/core/link-typing-units.ts
@@ -223,3 +223,11 @@ export const U5_LEAVE = new RegExp(String.raw`\b(?:${SPLIT_LEAVE}|${IDIOM_LEAVE}
/** U5: "traded [A] for [B]" ends A (the "for" then starts B). "Traded shares of [A]" is not an exchange. */
export const U5_EXCHANGE_BEFORE = /\b(?:traded|swapped|exchanged|ditched|dropped)\s*$/i;
export const U5_EXCHANGE_AFTER = /^\s+for\s+(?:\[|the\s+\[|an?\s+\[)/i;
+
+/**
+ * U6: start framings: a first day, week or month at, day one at, kicking off a role, job, position, chapter or stint
+ * at, onboarding, "began working at/for", a new chapter at. Only dates a works_at relationship the page already
+ * asserts (natural cues never create one). "First day of the [X] summit" and an event line never start a job.
+ */
+const START_ROLE = String.raw`(?:[\w&./-]+\s+){0,4}?`;
+export const U6_START = new RegExp(String.raw`\b(?:(?:(?:her|his|their|my|a|the)\s+)?(?:first\s+(?:day|week|month)|day\s+one)\s+(?:as\s+${START_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)|(?:was\s+|got\s+|been\s+)?onboarded\s+(?:at|with|to|into|by)|onboarding\s+(?:week|day|period)\s+(?:at|with)|began\s+(?:work(?:ing)?\s+)?(?:at|for)|start(?:ed|ing|s)?\s+(?:a\s+|her\s+|his\s+|their\s+|my\s+)?new\s+chapter\s+(?:at|with)|(?:a\s+)?new\s+chapter\s+(?:at|with))\s*$`, 'i');
diff --git a/test/helpers/typing-unit-examples.ts b/test/helpers/typing-unit-examples.ts
index c0985b667d..7a7dde0128 100644
--- a/test/helpers/typing-unit-examples.ts
+++ b/test/helpers/typing-unit-examples.ts
@@ -292,14 +292,49 @@ const U5: TypingExample[] = [
off: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02'] }, on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02', 'works_at end 2019-03-04'] } },
// Restart guard: a later plain mention no cue reads (an onboarding week) keeps the stint open; without the guard the
// leave would close the current job for good (the dev trace's onboarding losses).
- { id: 'u5-rejoin-restart-guard', unit: 'U5', target: ACME,
+ { id: 'u56-rejoin-restart-guard', unit: ['U5', 'U6'], target: ACME,
content: page(`Alice works at ${L(ACME)} as head of sales.`, [`**2015-01-02** | linkedin — Joined ${L(ACME)} as engineer`, `**2018-03-04** | linkedin — Parted company with ${L(ACME)}`, `**2020-08-11** | linkedin — Onboarding week at ${L(ACME)} as head of sales`]),
off: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02'], live: { type: 'works_at', at: { '2019-01-01': true, today: true } } },
- on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02'], live: { type: 'works_at', at: { '2019-01-01': true, today: true } } } },
+ on: units => !units.has('U6')
+ ? { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02'], live: { type: 'works_at', at: { '2019-01-01': true, today: true } } }
+ : { types: ['mentions', 'works_at'],
+ transitions: units.has('U5') ? ['works_at start 2015-01-02', 'works_at end 2018-03-04', 'works_at start 2020-08-11'] : ['works_at start 2015-01-02', 'works_at start 2020-08-11'],
+ live: { type: 'works_at', at: { '2019-01-01': !units.has('U5'), today: true } } } },
{ id: 'u5-leave-not-guarded-by-event-mention', unit: 'U5', target: ACME,
content: JOB([`**2019-03-04** | linkedin — Parted company with ${L(ACME)}`, `**2021-05-06** | event — Back at ${L(ACME)} for the alumni dinner`]),
off: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02'] },
on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2015-01-02', 'works_at end 2019-03-04'], live: { type: 'works_at', at: { today: false } } } },
];
-export const EXAMPLES: TypingExample[] = [...U1, ...U2, ...U3, ...U4, ...U5];
+// ─── U6: start framings (dated starts of an asserted works_at) ─────────
+const NOW_AT = (line: string) => page(`Alice works at ${L(ACME)} as designer.`, [`**2021-09-01** | ${line.replace('{X}', L(ACME))}`]);
+const U6: TypingExample[] = [
+ { id: 'u6-first-day-at', unit: 'U6', target: ACME, content: NOW_AT('linkedin — First day at {X} as designer'),
+ off: { types: ['mentions', 'works_at'], transitions: [] },
+ on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2021-09-01'], live: { type: 'works_at', at: { '2021-01-01': false, today: true } } } },
+ { id: 'u6-day-one', unit: 'U6', target: ACME, content: NOW_AT('linkedin — Day one with {X}'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2021-09-01'] } },
+ { id: 'u6-kicked-off-role', unit: 'U6', target: ACME, content: NOW_AT('linkedin — Kicked off a new role at {X}'),
+ off: { types: ['works_at'], transitions: [] }, on: { types: ['works_at'], transitions: ['works_at start 2021-09-01'] } },
+ { id: 'u6-onboarded-at', unit: 'U6', target: ACME, content: NOW_AT('linkedin — Onboarded at {X} this week'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2021-09-01'] } },
+ { id: 'u6-began-working-at', unit: 'U6', target: ACME, content: NOW_AT('linkedin — Began working at {X}'),
+ off: { types: ['works_at'], transitions: [] }, on: { types: ['works_at'], transitions: ['works_at start 2021-09-01'] } },
+ { id: 'u6-new-chapter-at', unit: 'U6', target: ACME, content: NOW_AT('linkedin — Starting a new chapter at {X} as designer'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: ['works_at start 2021-09-01'] } },
+ { id: 'u6-kickoff-without-employment-noun', unit: 'U6', target: ACME, content: NOW_AT('note — Kick-off at {X} for the new project'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: [] } },
+ { id: 'u6-first-day-of-summit', unit: 'U6', target: ACME, content: NOW_AT('event — First day of the {X} summit'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: [] } },
+ { id: 'u6-event-line-first-day', unit: 'U6', target: ACME, content: NOW_AT('event — First day at the {X} hackathon'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: [] } },
+ { id: 'u6-onboarding-call-qualified', unit: 'U6', target: ACME, content: NOW_AT("meeting — Onboarding call with the {X} alumni mentors"),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: [] } },
+ { id: 'u6-began-working-with-collaboration', unit: 'U6', target: ACME, content: NOW_AT('note — Began working with {X} on a pilot'),
+ off: { types: ['mentions', 'works_at'], transitions: [] }, on: { types: ['mentions', 'works_at'], transitions: [] } },
+ { id: 'u6-untyped-target-not-started', unit: 'U6', target: BETA,
+ content: page(`Alice works at ${L(ACME)}.`, [`**2021-09-01** | linkedin — First day at ${L(BETA)}`]),
+ off: { types: ['mentions'], transitions: [] }, on: { types: ['mentions'], transitions: [] } },
+];
+
+export const EXAMPLES: TypingExample[] = [...U1, ...U2, ...U3, ...U4, ...U5, ...U6];