feat(linkedin-studio): RE-R2a — item→store capture bridge + publishedAt persistence (schema v1→v2, lossless migrate) [skip-docs]
Closes the research-engine capture loop RE-R1 deferred:
- itemToInput(item, capturedAt): pure envelope→TrendInput bridge in item.ts —
injects capturedAt, carries publishedAt verbatim; no id, no re-validate
- publishedAt persisted: TrendRecord/TrendInput gain it; addTrend conditional-spread,
first-sight kept on re-capture (no back-fill). SCHEMA_VERSION 1→2 with a lossless
forward migrate-on-load: Math.max(onDisk, current) + numeric-typeof coercion
(string/NaN/absent → current; non-array trends coercion preserved verbatim)
- `capture` CLI: stdin raw item|batch → normalize → bridge → addTrend → saveStore once;
tally {added,duplicates,merged,errors} from AddResult; content-invalid → errors[],
exit 2 only on bad stdin; --json summary
- wiring: trend-spotter.md Step 4.5 N×`add` → one normalizing `capture` batch; README
add/capture framing corrected; test-runner Section 16h (capture wiring, unconditional)
+ floors bumped (trends 62→79, ASSERT 87→90)
TDD: 17 new tests (12 genuinely-RED logic-RED + 5 regression guards), tsc clean,
gate 105/0/0. No version bump (additive, v0.5.2 dev).
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:
parent
b4e500fad4
commit
7a158030b6
10 changed files with 465 additions and 31 deletions
|
|
@ -283,22 +283,26 @@ this agent.
|
|||
|
||||
For every trend that cleared the relevance filter (Step 2) — not only the ones that make the
|
||||
final digest — fold it into the persistent trend store, so the next session reasons over it
|
||||
instead of re-discovering it. The store dedupes on normalized title+URL and unions topics, so
|
||||
re-capturing an existing trend is safe (it just enriches the tags):
|
||||
instead of re-discovering it. Build ONE raw-item batch (the same trends you just scored) and pipe
|
||||
it through `capture`: it normalizes each item, dedupes on normalized title+URL, unions topics on
|
||||
re-capture (so re-capturing an existing trend just enriches the tags), and persists the source's
|
||||
`publishedAt` for later freshness ranking — one call, not one per trend:
|
||||
|
||||
```bash
|
||||
cd "${CLAUDE_PLUGIN_ROOT}/scripts/trends" && \
|
||||
node --import tsx src/cli.ts add \
|
||||
--title "<verbatim headline>" \
|
||||
--url "<source url>" \
|
||||
--topics "<pillar-tag1,pillar-tag2,…>" \
|
||||
--source "<tavily|websearch|manual|…>" \
|
||||
--summary "<one-line what-happened>"
|
||||
echo '[
|
||||
{"source":"<tavily|websearch|manual|…>","title":"<verbatim headline>","url":"<source url>",
|
||||
"topics":["<pillar-tag1>","<pillar-tag2>"],"publishedAt":"<YYYY-MM-DD if known>",
|
||||
"summary":"<one-line what-happened>"}
|
||||
]' | node --import tsx src/cli.ts capture
|
||||
```
|
||||
|
||||
`--source` is the tool you actually fetched with (**Research Routing**). Skip this step silently
|
||||
if the store has no deps installed (an adopter without the trends store) — the digest still
|
||||
compiles, just without persistence.
|
||||
`source` is the tool you actually fetched with (**Research Routing**); `publishedAt` is the
|
||||
source's own publish date — omit the key when unknown (the store's `capturedAt` is set
|
||||
automatically and stays distinct from it). One `capture` call folds the whole batch and reports
|
||||
`{added, merged, duplicates, errors}`; content-invalid items land in `errors[]`, never failing the
|
||||
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 5: Compile digest**
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue