feat(linkedin-studio): RE-R2b — dated morning-brief artifact + session-start surfacing [skip-docs]

The visible layer of R2. Pure brief.ts: rankForBrief (pillar-overlap -> recency over
the store; publishedAt ?? capturedAt freshness, 7d window; total-order sort), renderBrief
(dated Markdown + hook-surfaceable summary frontmatter), briefSummary (one summary source),
defaultBriefDir (derived from defaultStorePath). CLI `brief` writes
<data>/trends/morning-brief/YYYY-MM-DD.md; session-start surfaces the latest zero-tsx
(latestMorningBrief). Wired into trend-spotter Step 4.6 (scan->capture->brief->surfaced).
No store-schema/scoring change; no scheduler (R3).

25 new trends tests (21 brief.test + 4 cli brief, RED-first) + 3 hook tests (morning-brief
surfacing). trends 104/104 (floor 104), hook-suite 139/139, gate FAIL=0 (ASSERT floor 94,
Section 16i: cli brief-handler + trend-spotter brief-pointer + session-start surfacing
greps), tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmHCQjJHUyWwxGAVVjNLgp
This commit is contained in:
Kjell Tore Guttormsen 2026-06-24 13:12:54 +02:00
commit fa7551070e
9 changed files with 712 additions and 10 deletions

View file

@ -304,6 +304,23 @@ automatically and stays distinct from it). One `capture` call folds the whole ba
run. Skip this step silently if the store has no deps installed (an adopter without the trends
store) — the digest still compiles, just without persistence.
**Step 4.6: Write the dated morning brief (surfacing)**
After capturing, render today's dated morning brief over the store so the **next session surfaces
it automatically** (the SessionStart hook reads the latest one). Pass the user's content pillars —
the same ones you scored against in Step 2 — and the brief ranks the store by pillar-overlap, then
recency, into a dated Markdown file:
```bash
cd "${CLAUDE_PLUGIN_ROOT}/scripts/trends" && \
node --import tsx src/cli.ts brief --pillars "<pillar1>,<pillar2>,<pillar3>"
```
`--pillars` is the user's pillar list (comma-separated, from their profile/config); the brief is
written to `<data-dir>/trends/morning-brief/YYYY-MM-DD.md` and ranks only on persisted fields
(pillar overlap + `publishedAt`/`capturedAt` freshness, default 7-day window — tune with
`--fresh-days N`). Skip silently if the store has no deps installed — same escape hatch as Step 4.5.
**Step 5: Compile digest**
- Format using output template below