Repository navigation
Conversation
…t source_boosts config
Metadata-aware retrieval and persistent ranking configuration.
- search/query/list_pages accept `frontmatter_filter`: a list of
{key, op, value?} predicates (eq/exists/missing/lt/lte/gt/gte), ANDed,
validated at the operation boundary so a filtered query never silently
degrades to unfiltered. Equality is index-accelerated; date ops compare
ISO-8601 strings. New module src/core/search/frontmatter-filter.ts.
- query accepts a `types` list, validated against the active schema pack
(unknown names error with the valid set), scoping a hybrid query to a
set of page types.
- New persistent config key `search.source_boosts` (slug-prefix -> factor).
Resolution ladder: built-in defaults <- config <- GBRAIN_SOURCE_BOOST env
(env last, emergency override). One shared resolver feeds CLI and MCP.
- Query-cache correctness: the resolved boost map now participates in the
cache key (knobs_hash v12 -> v13, canonical serialization), and queries
carrying frontmatter_filter/types/since/until skip the cache entirely, so
a filtered or re-weighted lookup can never be served a stale or
differently-shaped result. One-time cache-miss spike on upgrade.
Gates: typecheck clean; 185 unit pass; 11 Postgres e2e parity pass
(searchKeyword $N::text::jsonb bind, searchVector CTE filter, listPages
sql.json path all exercised on real pg16).
Docs: new guide docs/guides/typed-personal-streams.md; RETRIEVAL.md and
KEY_FILES.md updated for the resolution ladder and filter module.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MnrzTBLJ5n18BTUHmvtcVy
|
Closing — opened against the wrong base. This work lives on dsorensen/gbrain. |
|
Antigravity (Gemini) review The PR introduces robust metadata filtering ( Full analysis1. Correctness & Architecture
2. Security
3. Performance & Caching
4. Maintainability
5. Testing
Verdict: The PR is highly robust and safely extends the retrieval surface. Ready to merge. |
|
Codex review I found one blocking correctness issue: the new Full analysisFindingP1: Filtered
|
|
Cursor review Verdict: Ready with fixes. One P1: on balanced/tokenmax, the relational RRF arm ignores Full analysisCode Review ResultsScope: PR #2979 (pr-remote, cross-repo Reviewers: correctness, testing, maintainability, project-standards, agent-native, learnings (always); security, performance, api-contract, adversarial (conditional)
Cross-model adversarial peer pass: skipped (pr-remote scope). Triage Groups
P1 -- High
P2 -- Moderate
P3 -- Low
Actionable Findings
Pre-existing IssuesNone elevated. Residual notes (not verdict-blocking): two-pass structural walk neighbor hydration historically skips some result-set filters; Learnings & Past Solutions
Agent-Native Gaps
Coverage
VerdictReady with fixes. Ship blockers for the stated contract: close #1 (relational arm must not reintroduce unfiltered pages when filters are set). Strongly fix #2 docs (+ prefer a drift test). #3/#4 are non-blocking. Security binding looks sound (params bound; key charset defense-in-depth; predicate cap 32). Cache/knobs_hash v13 and filter cache-skip are the right contamination posture. Fix order: (1) relational filter policy + test, (2) KEY_FILES truth + drift guard, (3) optional schema/description polish and cmp-cost docs, (4) test title nit. |
Summary
Metadata-aware retrieval plus persistent ranking configuration.
frontmatter_filteronsearch/query/list_pages— a list of{key, op, value?}predicates (eq,exists,missing,lt,lte,gt,gte), ANDed together, validated at the operation boundary so a filtered query never silently degrades to unfiltered. Equality is index-accelerated; date comparisons work on ISO-8601 strings. New modulesrc/core/search/frontmatter-filter.ts. Available over MCP and CLI (--frontmatter-filter '[{"key":"status","op":"eq","value":"active"}]').typesonquery— a list of page-type names validated against the active schema pack (unknown names error with the valid set), scoping a hybrid query to a set of types.search.source_boostspersistent config key (slug-prefix → ranking factor). Resolution ladder: built-in defaults ← config ←GBRAIN_SOURCE_BOOSTenv (env last, the emergency override). One shared resolver feeds both CLI and MCP.knobs_hashv12 → v13, canonical serialization), and queries carryingfrontmatter_filter/types/since/untilskip the cache entirely, so a filtered or re-weighted lookup can never be served a stale or differently-shaped cached result. (since/untilhad the same pre-existing cache hole; closed here too.) One-time cache-miss spike on upgrade.Test plan
bun run typecheck— clean.bun test(frontmatter-filter, source-boost-config, search-mode, knobs-hash-reranker, cross-modal) — 185 pass / 0 fail.DATABASE_URLset, real pg16) — 11 pass / 0 fail. Exercises the JSONB bind paths PGLite hides:searchKeyword$N::text::jsonb,searchVectorfilter inside the HNSW candidate CTE,listPagessql.jsontagged-template path.Docs
docs/guides/typed-personal-streams.md.docs/architecture/RETRIEVAL.mdandKEY_FILES.mdupdated for the resolution ladder and filter module.llms-full.txtnote theknobs_hashv13 bump.🤖 Generated with Claude Code
https://claude.ai/code/session_01MnrzTBLJ5n18BTUHmvtcVy