Skip to content

feat(memory): wire Jev and external AI across routing, retention, grounding, conflicts, and consolidation - #357

Open
Coding-Dev-Tools wants to merge 6 commits into
mainfrom
feat/jev-llm-memory-pipeline-upgrades
Open

Coding-Dev-Tools wants to merge 6 commits into
mainfrom
feat/jev-llm-memory-pipeline-upgrades

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

  • Wires client-side support for the 3 new bounded Managed Jev memory operations (select_query_route, classify_retention, �ssess_extract_worthiness) in engraphis/backends/jev_transport.py and jev_decision.py (exact wire match with engraphis-cloud#171).
  • Unlocks Managed Jev for JevAssistedQueryPlanner (select_query_route) in actory.py and adds ENGRAPHIS_QUERY_PLANNER (�uto, jev, llm, deterministic).
  • Adds JevRetentionSupervisor with 0-call deterministic fast-paths and get_retention_supervisor(jev | auto) so retention classification uses the 250/day Jev pool instead of burning the 100/day AI LLM pool.
  • Upgrades core/grounded.py with a Jev borderline support gate (

…unding, conflicts, and consolidation

Add client-side support for select_query_route, classify_retention, and assess_extract_worthiness on Managed Jev; unlock Managed Jev for JevAssistedQueryPlanner and ENGRAPHIS_QUERY_PLANNER selection; introduce JevRetentionSupervisor with 0-call fast paths; upgrade grounded Q&A with cited_prose synthesis and Jev borderline support gating; add low-recall LLM query expansion fallback; wire advisory Jev triage, cited conflict merge proposals, call-capped consolidation LLM usage, and proactive context auto-synthesis.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T04:06:42.423074Z
We couldn’t complete this review. Comment @codex review to try again.
18ed31e 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…ync, and offline evidence

Unpack tuple returns from managed allowance checks via injected callback (removing core->llm import), resolve all 3 pyright errors, enforce trust/quarantine/secret/rationale checks on conflict review and proposals, require verified Jev entailment for cited_prose, bound borderline rescue to the verified top chunk and min_support ceiling, restore local default on consolidate(), harden Jev transport delimiter/token validation, remove unused assess_extract_worthiness helper, trim Smart MCP payload under 12 KiB, sync MCP contracts and skill manifest, and refresh offline benchmark evidence.
@Coding-Dev-Tools

Copy link
Copy Markdown
Owner Author

2-agent independent review loop completed at 2d22714:

  • Fixed: unpacked can_call() tuple across all budget gates, removed core -> llm import, fixed all 3 pyright errors, enforced strict Jev entailment for cited_prose & bounded single-chunk borderline rescue, hardened conflict_review (quarantine + cross-repo + prompt_eligible) and propose_conflict_resolution (quarantine/secret/
    ationale guards), restored local deterministic default for consolidate(), hardened select_query_route/classify_retention delimiter validation & engr_ct_ secret blocking, synced Smart MCP 12 KiB budget, TOOLS.md, MCP_CONTRACT.json, Pi extension schema test, and offline benchmark evidence.
  • Verification: 29/29 GitHub CI checks green; local pytest (149 passed on 49c12f4, 100 passed + MCP contract OK on 2d22714),
    uff & pyright 0 new errors.
  • Schema-v2 approval prepared (engraphis-357-2d22714e.json, 0 Blockers, 0 Majors). Merge after engraphis-cloud#171 and engraphis#355/feat(llm): add budget orchestrator, complexity gate, 429 circuit breaker, and prompt trimming #356.

Three blocker-class invariant violations in the Jev/LLM wiring:

* A remote Jev decision could set `jev_rescued` and flip `grounded` True
  for support below `GROUNDED_SUPPORT_FLOOR`. That broke the
  deterministic abstain contract and made `grounded_recall()` run
  `store.reinforce()` on sub-floor evidence, so an adviser could write to
  the database. Jev now only reports `would_rescue`/`would_reject` in
  `advisory_support` metadata; the abstain gate and citation admission
  are again purely deterministic.
* Secret-classified memories leaked to remote Jev/LLM endpoints.
  `_source_safety_metadata` omitted `sensitivity` entirely, so a
  confidential memory with no regex-detectable secret literal was sent
  verbatim. It is now projected (column or legacy metadata) and enforced
  fail-closed before the remote call through `_jev_remote_sources_allowed`.
* Low-recall LLM query expansion sent the raw query to a remote planner
  with no consent gate, no screening, and on the caller's thread, which
  bypassed the planner's deadline isolation. It now requires
  `allow_remote`, screens the query for credential-shaped content, and
  dispatches through `_run_planner`.

Also cap expansion at the remaining `MAX_PLANNED_QUERIES` headroom
instead of appending past the ceiling, and declare
`openWorldHint: True` on `engraphis_conflict_review`, which can reach a
remote Jev endpoint and was mislabeled as closed-world.
`tests/test_benchmark_evidence.py` hashes every `.py` under `engraphis/`
and `eval/`, so the grounded, recall, and mcp_server changes invalidated
the committed registry artifact and failed the whole Python matrix.
Export a new immutable artifact and repoint the test constants, README
prefix, BENCHMARKS.md name/sha, and the fixture-suite digest. The SVGs
and PNGs were regenerated so their embedded provenance matches.
Three follow-ups to the advisory-only change:

* `_expand_low_recall_with_llm` dispatched through `_run_planner`, which
  drives `query_planner` and refuses an advisory slot. The expansion
  planner is the separate `llm_query_planner` collaborator, so the call
  silently produced nothing. Add `_run_expansion_planner`, which keeps
  the same slot plus daemon-worker deadline but invokes the expansion
  planner, so the bounded-deadline guarantee still holds.
* Update `test_jev_llm_memory_upgrades` to the advisory-only contract:
  Jev now reports `would_rescue`/`would_reject` without flipping
  `grounded`, and the low-recall expansion requires explicit
  `allow_remote` consent (asserted with and without it).
* Regenerate `docs/MCP_CONTRACT.json` and the Pi/Prime generated clients
  for the `openWorldHint` and parameter-description changes, and refresh
  the offline evidence artifact for the recall.py edit.

This branch has not been deployed

No deployments
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.

1 participant