Skip to content

maintain --collection observations and vitals' edges query still read the generic collection on SQLite/JSON #143

Open

Description

@idapixl

Follow-up to #142 (typed observation reads, #122/#123).

What is still split

  • fozikio memory maintain --collection observations (src/bin/maintain-cmd.ts:285, :352) reads observations with store.query('observations', …) and writes fixes with store.update('observations', id, …). On SQLite and JSON both calls hit generic_docs / data.generic, where typed observations do not live. So the command finds nothing to fix. That includes the salience normalisation from 1.7.1, whose observation repair was done by hand in SQL for exactly this reason. Fixing it needs a typed updateObservation(id, updates) on CortexStore (all stores, scoped store, Firestore txn proxy). queryObservations already covers the read.
  • fozikio vitals (src/bin/vitals-cmd.ts:487) reads store.query('edges', [created_at >= windowStart]). Edges live in the typed edges table on SQLite and in data.edges on JSON, so the edge-growth signal is always 0 there. The fix needs a typed time-window edge read (for example getEdges({ since, limit })); the existing getEdgesFrom / getEdgesForMemories require ids.

How to see it

On a SQLite store with observations: fozikio memory maintain --collection observations --dry-run reports 0 documents, and fozikio vitals logs 0 edges even when edges were created inside the window.

Since #142, date range filters in the generic query work. So once these calls move to typed reads, nothing else stands between them and correct results.

Activity

  1. idapixl commented on Oct 25, 2026

    @idapixl
    CollaboratorAuthor

    Another one in the same class: refine's edge revalidation (engines/cognition.ts, after a refinement is written) downweights an invalidated edge with store.update('edges', edge.id, …). On SQLite/JSON, edges live in the typed table, so the generic update throws "Document not found" and dreamFailure('refine:edge-revalidate') swallows it. An edge invalidated by a refinement is therefore never downweighted on the local stores. The fix needs a typed updateEdge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions