Skip to content

P0-G: Salience Engine (BLOCKS: hotpath promotion in ingest and Daydreamer) #18

@github-actions

Description

@github-actions

Why: The SalienceEngine is the decision-making layer for hotpath admission. It is needed by ingest (new page admission), query (hit-count update), and Daydreamer (post-LTP/LTD sweeps). Implementing it before ingest ensures promotion logic is correct from the first page written.

  • P0-G1: Implement core/SalienceEngine.ts

    • computeNodeSalience(pageId: Hash, metadataStore: MetadataStore): Promise<number> — fetch PageActivity and incident Hebbian edges; apply σ formula via HotpathPolicy
    • batchComputeSalience(pageIds: Hash[], metadataStore: MetadataStore): Promise<Map<Hash, number>> — efficient batch version
    • shouldPromote(candidateSalience: number, weakestResidentSalience: number, capacityRemaining: number): boolean — admission gating
    • selectEvictionTarget(tier: HotpathEntry['tier'], communityId: string | undefined, metadataStore: MetadataStore): Promise<Hash | undefined> — find weakest resident in tier/community bucket
  • P0-G2: Implement promotion/eviction lifecycle helpers in core/SalienceEngine.ts

    • bootstrapHotpath(metadataStore: MetadataStore, policy: HotpathPolicy): Promise<void> — fill hotpath greedily by salience while resident count < H(t)
    • runPromotionSweep(candidateIds: Hash[], metadataStore: MetadataStore, policy: HotpathPolicy): Promise<void> — steady-state: promote if salience > weakest in same tier/community bucket; evict weakest on promotion
  • P0-G3: Add SalienceEngine test coverage (tests/SalienceEngine.test.ts)

    • Bootstrap fills hotpath to exactly H(t) given enough candidates
    • Steady-state promotes only when candidate beats the weakest resident
    • Steady-state evicts exactly the weakest resident (not a random entry)
    • Community quotas prevent a single community from consuming all page-tier slots
    • Tier quotas prevent one hierarchy level from dominating
    • Eviction is deterministic under the same state

Exit Criteria: SalienceEngine module passes all tests; promotion/eviction lifecycle is correct and deterministic.

Metadata

Metadata

Labels

P0: criticalCritical path — blocks all dependent worklayer: daydreamerBackground consolidation (LTP/LTD, recalc)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions