Skip to content

feat(memory): reviewed consolidation candidates and cited evidence (Refs #40) - #57

Merged
entelecheia merged 2 commits into
mainfrom
feat/40-consolidate-evidence
Oct 24, 2026
Merged

entelecheia merged 2 commits into
mainfrom
feat/40-consolidate-evidence

Conversation

@entelecheia

@entelecheia entelecheia commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Refs #40 (F18, F19; task #426).

Consolidation now queues deterministic project-local proposals for person review, and agents can fetch a byte-capped cited evidence bundle without an amem model call.

  • F18: FTS overlap, shared paths and current supersession-chain metadata produce at most 32 proposals from 256 rows. Only verified synced sources can be copied; legacy local-long originals, unknown or mixed placement refuse. Acceptance rechecks exact source revisions, placement/scope and the effective policy revision. Merge/replacement supersedes sources; recurring-failure summaries preserve the original failures and decisions. Source task links are retained.
  • Optional model pass: library callback only, absent by default and explicitly person-enabled. Maximum two batches per invocation, eight sources and 8192 input bytes per batch, 4096 returned-text bytes, 3000 marked characters and a 10 s abort deadline. Durable machine-local daily reservations charge failed attempts too (four calls / 32768 input bytes). A non-answer is never saved. Model answers are marked machine-local candidates that cannot be accepted; the refusal points to amem note add. No built-in provider/network client, hook call or model MCP tool.
  • F19: amem_evidence ranks live project-curated rows using the existing FTS/BM25 and tier/recency rule. Complete JSON, including question/header/provenance, fits 256..8192 bytes. Citations are exact mem:<id> references. Capture, repo-only rows, pending/model candidates, foreign shared notes and invalid lifecycle entries cannot fill the item cap. Existing PII, policy/source drift and emitted-only telemetry guards apply. A printed citation never increments cited/delivered.
  • Compatibility: curated shared-v1 schema, ops, hashes and paths stay unchanged. Older machine-local candidate readers do not understand the two new payload kinds and must be upgraded before sharing that candidate home.
  • Explicit ceilings: v1 multi-source appends are not atomic. An interrupted acceptance reports the accepted note, confirmed supersessions and uncertain remaining ids, stays accepting and does not auto-replay. A host callback must cooperate with AbortSignal to stop its own work; late results cannot be persisted.

Spec-driven existing-test changes authorized by the planner: test/mcp.test.ts (three counts/title), test/mcp-cli.test.ts, test/candidate-tools.test.ts and scripts/measure-mcp-budget.ts change 11 to 12 and retain complete by-name assertions including amem_evidence. No authority/input assertions or resource limits were weakened. R3 additionally renders one evidence bundle in the unchanged corpus and reports evidenceReads.

Three deliberate mutants went red in their named regressions: unbounded refresh before placement proof; disabled final policy revision check; and omitted pre-provider source screening.

Validation:

  • Exact head: 0fc264b6f1c565c41d0455c19ba402ee3a74f8ca, rebased onto released main 484816013456a377aed32b77d3f35a03804bbac5; only 26 own files differ.
  • Bun 1.4.2, frozen install, TypeScript clean; boundary: OK (84 source files); Linux full suite 1536 pass / 5 skip / 0 fail (1541 tests, 154 files, 224.77 s); npm pack --dry-run: 92 files.
  • Linux R3: idle 33.25 MB / peak 130.5 MB; native macOS R3: idle 46.27 MB / peak 168.88 MB. Both render six evidence rows and six brief rows; EOF child is reaped. Existing 100/200 MB caps and 30 s watchdog unchanged.
  • Native macOS R2: max group p95 66.1 ms / peak 78.61 MB, zero stalled attempts and no retained owned processes; 150 ms / 100 MB limits unchanged.
  • Installed tarball smoke passes on Linux with unchanged private HOME, seeded MCP search and a matching fresh durable hook capture.
  • Original Linux R2 gate failure retained: the composite gate stopped at plain-1 with RSS >=100 MB. No RSS retry or resource-limit change was made. The following reviewer-requested diagnostic measurements do not erase that failure.

Same-DGX R2 comparison

Unchanged budget script, Bun 1.4.2, host dgx-h100-2, three independent runs per revision. Main is 484816013456a377aed32b77d3f35a03804bbac5; head is 0fc264b6f1c565c41d0455c19ba402ee3a74f8ca. Additional runs were serial and alternated main/head after the other owner's slot release.

Revision Run Peak RSS MB Max group p95 ms Outcome
main 1 98.00 79.17 pass
main 2 99.75 96.07 pass
main 3 >=100 unavailable fail at plain-1
head 1 >=100 unavailable original gate fail at plain-1
head 2 82.25 80.89 pass
head 3 80.50 78.23 pass

The failed script reports only that its strict 100 MB guard fired; >=100 is a lower bound, not a fabricated exact peak. All passing runs had zero stalled attempts and no retained owned processes. Both revisions show mixed outcomes, and head is not consistently higher. Under the reviewer's stated classification rule, this is recorded as the inherited-high-water noise tracked by #48/task #434; the original failed gate remains visible. A conservative static plus literal-dynamic dependency walk from src/hooks.ts covered 43 files and found no CLI, consolidation/model module or CandidateStore import. There is no speculative import change.

Hosted Ubuntu and macOS checks must still be green before merge. CI is not polled by the implementer.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-24T18:49:53.792553Z 0fc264b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@entelecheia
entelecheia merged commit 216af90 into main Oct 24, 2026
2 checks passed
@entelecheia
entelecheia deleted the feat/40-consolidate-evidence branch October 24, 2026 19:22
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.

2 participants