S2 entity-scoped how-many (P54 140/180) - #171
Merged
Merged
Conversation
Count queries were enumerating sibling predicates and then using dump length as the answer, so preference junk counted as children, another person's possessions counted as pets, and every health row counted as an incident. Counts now hop only the counted predicate, keep items whose subject matches the query entity, collapse class nouns, honor as-of month bounds, and count times by the object token. Co-authored-by: aria <aria@engramhq.com>
Fixtures: preference junk is not children, another person's pets are not counted, times counts object incidents not all health, and as-of month-year keeps possessions observed through end of that month. Co-authored-by: aria <aria@engramhq.com>
Hop Values are deduped and were paired with MemoryIDs by index, so as-of bounds used the wrong session date. Bind each value to the content row that extracted it. As-of counts read historical atoms. Child counts drop kids-like preference complements stored as family members. Pet counts keep class instances and named individuals, not accessories whose lexical head is bed/toy/pad/garden. Co-authored-by: aria <aria@engramhq.com>
Family-member 'kids like nature' must not add to a child count. Dog toys owned by the same person must not add to a pet count. Co-authored-by: aria <aria@engramhq.com>
How-many used current-state (one latest slot) so child enumerations collapsed to a single role. Counts now retrieve historical atoms. As-of uses the earliest matching observation so a later mention does not date-shift an individual. Times answers prefer distinct values when evidence IDs collided from overlapping slot strings. Co-authored-by: aria <aria@engramhq.com>
Bare class labels (kids, pets) still yield when named instances exist. Quantified phrases such as "two children" are the counted set, not a duplicate label, so collapsing them to the last lexical head dropped real quantity from how-many answers. Co-authored-by: aria <aria@engramhq.com>
Cover daughter + "man and two children" as 3, and assert collapse keeps the numbered phrase while dropping bare kids/children. Co-authored-by: aria <aria@engramhq.com>
How-many Ferraris was collapsing "a new Ferrari" as a bare class noun and then counting every remaining possession. Prefer items that mention the counted noun; if none do (coupe/sedan vs cars), keep the typed set. Modified class mentions are instances, not duplicate labels. Co-authored-by: aria <aria@engramhq.com>
Ferrari counts stay 2 when studios and unlabeled sports cars are in the typed dump. Generic "a new Ferrari" labels still count as instances. Co-authored-by: aria <aria@engramhq.com>
"dog (shelter adoption)" is a class label, not a fifth pet, when named
dogs already exist. Named slots ("puppy named Toby") stay instances.
Co-authored-by: aria <aria@engramhq.com>
Co-authored-by: aria <aria@engramhq.com>
Same-store skip-ingest 180 is 140/180 (MH 20, OD 4, SH 85, temporal 31) versus P53 137/180. Unique gains: children 7→3, Sep pets 13→1, ankle 38→2. Unique losses none. Not leftover covering. Not 90%. Not a Mem0 same-pin. Co-authored-by: aria <aria@engramhq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Product
/recallhow-many answers were dumping the typed hop set (all children-adjacent rows, all pets, all times). This ships a generic S2 enumerate/count fix: hop only the counted predicate, entity-scope the count set to the queried subject, keep quantified class phrases, collapse bare class labels (including possessed-class provenance parens), and intersect a specific head only when items mention it.Same-store skip-ingest 180 is 140/180 vs P53 137/180. Unique losses: none. Named recoveries: Melanie children 7→3, Andrew Sep pets 13→1, John ankle 38→2. Andrew Dec pets is honest 4 (Scout stored as Andrew) vs gold 3 — no gold special-case.
This is not leftover covering. Not 90% (162/180 on this sample; public LoCoMo is n=1540 at 11.4%). Not a Mem0 same-pin. Do not merge leftover-covering PRs #133, #131, #143, #145.
Changes
internal/memory/planner.go: count queries hop only the first (counted) predicate.internal/memory/recall.go:filterCountItemsentity-scopes via metadatasubject; drops sibling predicates, child like-complements, owner accessories, and non-instances;MONTH YEARas-of is end of month; hop Values bind to the extracting content row; earliest matchingObservedAt; class-noun collapse keeps quantity phrases and naming referents; possessed-class labels with provenance parens stay bare; specific-head intersect only when items mention the head.internal/memory/recall_test.gofor quantified children, Ferrari vs cottage, pet paren class labels, as-of bounds.Test plan
go test ./internal/memory/green on this branch/recallholds: children=3, Ferraris=2, Sep pets=1, ankle=2; P53 self-care leftover helddiag-mh-135: 140/180, unique losses nonegofmt -l .clean on touched filesgo vet ./...go test ./...(embedded-postgres; first run slow)Linear / tracking
ENG-176 (MH), parent ENG-168.
Risk / follow-ups
devis staging. Do not fast-forwardmainfrom this PR unless explicitly asked.