Skip to content

fix(salience): exclude briefings/* from their own Brain Pulse#1202

Open
rwbaker wants to merge 1 commit into
garrytan:masterfrom
rwbaker:fix/tim-37-briefing-self-reference
Open

fix(salience): exclude briefings/* from their own Brain Pulse#1202
rwbaker wants to merge 1 commit into
garrytan:masterfrom
rwbaker:fix/tim-37-briefing-self-reference

Conversation

@rwbaker
Copy link
Copy Markdown

@rwbaker rwbaker commented May 19, 2026

Summary

getRecentSalience (the engine behind gbrain salience and the get_recent_salience MCP tool) was ranking the daily-briefing page #1 in its own Brain Pulse the day after the cron wrote it.

Repro from a real run:

  • 90_Briefings/2026-05-19.md is generated by a cron wrapper that calls gbrain salience --days 7 --limit 10 and writes the result to the vault under 90_Briefings/<date>.md. The next sync cron re-ingests it as briefings/2026-05-19.
  • Tomorrow's gbrain briefing run then sees briefings/2026-05-19 at the top with score 0.9956 (emotional_weight 0, take_count 0, but freshly updated). Every other page sits at 0.587. The briefing visually dominates its own pulse without being signal.

Fix

Filter p.slug LIKE 'briefings/%' out of getRecentSalience in both engines (Postgres + PGLite). Suppression is the default. Callers can still ask for briefings explicitly via slugPrefix: 'briefings/' (or --kind briefings/ from the CLI), which short-circuits the exclusion. search and list_pages are unaffected — briefings remain queryable.

Test plan

  • Added regression cases in test/e2e/salience-pglite.test.ts:
    • default query hides briefings/*
    • explicit slugPrefix: 'briefings/' still returns them
  • bun test test/salience.test.ts test/e2e/salience-pglite.test.ts → 9 pass
  • Live smoke against a real vault: pre-fix the briefing-of-yesterday topped the result at score 0.9956; post-fix the top 10 are real project pages and --kind briefings/ still surfaces the briefing at 0.981.

Filed from a TimelyCare-internal ticket (TIM-37) chasing the self-reference observed during a supervised gbrain run.

The cron daily briefing writes 90_Briefings/<date>.md, which gets
re-ingested on the next sync and then dominates tomorrow's
getRecentSalience output as pure self-reference (observed: top
result score 0.9956, everyone else clustered at 0.587).

Filter `p.slug LIKE 'briefings/%'` out of getRecentSalience in both
the PG and PGLite engines. Suppressed by default; callers can still
opt in by passing `slugPrefix: 'briefings/'` (or `--kind briefings/`
from the CLI). search and list_pages are unaffected.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant