Skip to content

Add Jev-first context and ultra-fast semantic search - #1

Open
codejunkie99 wants to merge 2 commits into
mainfrom
feat/jev-fast-context-search
Open

codejunkie99 wants to merge 2 commits into
mainfrom
feat/jev-fast-context-search

Conversation

@codejunkie99

@codejunkie99 codejunkie99 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Project context and Command-K content search now share one Jev planner. Eligible source excerpts receive typed semantic decisions in a bounded batch; selected evidence reaches the context pack with its exact provenance.

Ultra-fast Jev search/context uses up to eight candidates and 17 questions, with a versioned read-only cache. Search displays measured app request time, logical provider-call count, cache status, and exact source previews. Standard Jev and explicit Local search remain available for their supported scopes.

Settings now supports adding or replacing the TypeSafe key later, and disconnecting it. Jev search/context choices are hidden until this host has a configured key, enablement and hosted-processing consent; saved Jev choices show unavailable if setup disappears. Local search stays usable. Implicit backend runs preserve approved source bodies when Jev is unconfigured, and automatic Local retrieval avoids scanning external chat history.

The backend also provides reviewed atomic remember/forget/update, read-only MCP planning, extractive trace compaction, complete skill loading, validated tool proposals, citation-support assessment and bounded semantic code search. Incomplete updates cannot apply; hosted input receives credential screening; stale import previews can refresh. Hosted response validation accounts for hosted probability rounding without weakening typed or authorization checks.

Validation: 570 Python tests plus four subtests; native state checks; Swift release build; actual native provider setup and missing-key state inspection; bundled-Python RPC/MCP and fast-cache checks; ZIP/DMG integrity and strict extracted-app signatures.

Live demo through the installed bundled backend: three synthetic memories, one seven-question hosted batch, correct SQLite memory selected in 392.99 ms; identical cached search in 10.05 ms with zero new provider calls. These are measured backend request timings for a small synthetic example, not a general retrieval-quality benchmark or end-to-end UI latency claim. No credentials or real user memories are included in the PR.

Note

Add Jev-first context planning and ultra-fast semantic search

  • Makes jev the default context mode. ContextPacks routes jev/jev-fast requests through a new planner (context_packs.py, jev_context.py), and WorkspaceService records ledger receipts for context packs and handoffs (service.py).
  • Adds search.context — a bounded, cached, read-only Jev search over project memory and conversations (jev_retrieval.py, jev_runtime.py) — with fast/standard limits and coverage metadata. The macOS Spotlight search UI exposes Local/Jev modes, grouped results, and Jev previews (SpotlightSearchView.swift).
  • Adds a durable memory ledger for immutable evidence, claims with revision guards, audit events, proposals, and links (memory_ledger.py). Completed Jev-mode runs capture exact output as proposed claims via jev_memory.py.
  • Adds provider setup with explicit consent, stored in a mode-0600 file, fail-closed validation, and per-call reload (jev_settings.py); the MCP bridge exposes read-only plan_context and five runtime tools (context_mcp.py).
  • Reworks the macOS app with a shared design system (Palette/StackType and reusable components in DesignSystem.swift), a new sidebar, a Jev project-memory screen, and an imported-memory migration view.
  • Behavioral Change: omitted contextOptions no longer defaults to local — new requests default to jev mode, and local is forced only when the provider is unavailable. Jev modes get a 5-second serialized timeout vs 20 for others. Local mode no longer performs conversation discovery. See docs/jev-first-context.md and docs/jev-provider-setup.md.

Macroscope summarized 31e0778.

RetriggerConfidence Score: 2/5

The PR does not appear safe to merge until Local context reliably retains available project conversations.

Fix All in CodexFindings

  1. P1 Pinned conversations disappear after restart ▶
  2. P1 Local context drops OpenCode conversations ▶
  3. P1 Topics remove conversation results ▶
Fix with agent prompt
### Issue 1
harness_manager/workspaces/context_packs.py:143
A pinned live conversation now resolves only from the in-memory chat inventory. After a service restart, that inventory is empty until someone searches or attaches a live conversation. `context.prepare` therefore reports an existing pinned conversation as unavailable and omits its evidence. Ordinary Local context runs also silently omit external conversations when no prior search has populated the inventory.

### Issue 2
harness_manager/workspaces/context_packs.py:114
When Local context builds candidates from discovered conversations, this filter accepts Codex, Claude and Cursor IDs but excludes OpenCode IDs. A relevant OpenCode conversation cannot be selected automatically, even when it is already in the chat inventory.

### Issue 3
harness_manager/workspaces/memory_sources.py:115-116
When a topic is selected, this filter removes every conversation and approved source because those rows have no `topics` field. A project conversation search can therefore return no conversation evidence even when matching conversations exist. Filter only source types with topic labels, or define how conversations and approved sources should participate.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary

The PR adds Jev-backed context planning and semantic search, reviewed memory operations, provider setup, and native search and memory views. The latest revision adds provider-aware Local defaults, tighter credential screening, and complete-update checks. Local conversation retrieval now depends on a pre-populated inventory and excludes OpenCode from automatic selection.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Run[Run or context request] --> Mode{Retrieval mode}
  Mode -->|Jev| Planner[Jev planner]
  Mode -->|Local| Cache[Cached chat inventory]
  Cache --> Selection[Bounded context selection]
  Planner --> Selection
  Selection --> Pack[Context pack]
Loading

Reviews (2) · Last reviewed commit: "Gate Jev on provider setup and validate ..."

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

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 ✅ Completed 2026-09-29T23:52:12.806284Z f1a5ac6 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.

@macroscopeapp

macroscopeapp Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

This review would cost an estimated $33.16, which exceeds your per-review limit of $10.00.

The top 3 files driving up this estimate:

File Diff Size Estimate
apps/macos/Sources/AgenticWorkspaces/JevMemoryView.swift 53.80KB $2.69
apps/macos/Sources/AgenticWorkspaces/SpotlightSearchView.swift 40.86KB $2.04
harness_manager/workspaces/jev_runtime.py 39.44KB $1.97

Tip

To get this pull request reviewed, you can:

  1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
  2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
  3. Raise your cost limit in your workspace billing settings.

Turn off this reminder going forward

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1a5ac6a06

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

rows = list(unique.values())
result['coverage'].update(candidateCount=len(rows), omittedCount=max(0, len(rows) - max_items), hasMore=has_more, candidateLimit=max_items)
bounded = []
for row in rows[:max_items]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep explicit update items inside the candidate bound

When an update request contains enough explicit targets and incoming replacements to exceed max_items—the validator permits up to 16 of each—this slice keeps the targets first and silently drops the incoming items. The resulting partial plan remains applicable, so applying a 16-target/16-replacement update can retract all 16 existing claims while remembering none of their replacements. Ensure all authorized update items are evaluated together, or make any plan that omits one of them non-applicable.

Useful? React with 👍 / 👎.

Comment thread harness_manager/workspaces/service.py Outdated
Comment on lines +115 to +116
if self.topic:
rows = [r for r in rows if self.topic in r.get('topics', [])]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Topics remove conversation results

When a topic is selected, this filter removes every conversation and approved source because those rows have no topics field. A project conversation search can therefore return no conversation evidence even when matching conversations exist. Filter only source types with topic labels, or define how conversations and approved sources should participate.

Prompt To Fix With AI
This is a comment left during a code review.
Path: harness_manager/workspaces/memory_sources.py
Line: 115-116

Comment:
**Topics remove conversation results**

When a topic is selected, this filter removes every conversation and approved source because those rows have no `topics` field. A project conversation search can therefore return no conversation evidence even when matching conversations exist. Filter only source types with topic labels, or define how conversations and approved sources should participate.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

Comment thread harness_manager/workspaces/jev_runtime.py Outdated
Comment thread apps/macos/Sources/AgenticWorkspaces/JevImportView.swift
workspace = references.store.get('workspace', wid)
path = workspace.get('projectPath')
row = next((r for r in references._live() if r['id'] == identifier and path and r.get('projectPath') == path), None)
row = next((r for r in getattr(references, '_cache', []) if r['id'] == identifier and path and r.get('projectPath') == path), None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Pinned conversations disappear after restart

A pinned live conversation now resolves only from the in-memory chat inventory. After a service restart, that inventory is empty until someone searches or attaches a live conversation. context.prepare therefore reports an existing pinned conversation as unavailable and omits its evidence. Ordinary Local context runs also silently omit external conversations when no prior search has populated the inventory.

Prompt To Fix With AI
This is a comment left during a code review.
Path: harness_manager/workspaces/context_packs.py
Line: 143

Comment:
**Pinned conversations disappear after restart**

A pinned live conversation now resolves only from the in-memory chat inventory. After a service restart, that inventory is empty until someone searches or attaches a live conversation. `context.prepare` therefore reports an existing pinned conversation as unavailable and omits its evidence. Ordinary Local context runs also silently omit external conversations when no prior search has populated the inventory.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

# must not enumerate a personal history store before it can reach the runner.
inventory = references._live() if discover else list(getattr(references, '_cache', []))
live = [r for r in inventory if path and r.get('projectPath') == path
and (discover or r['id'].startswith(('live:codex-session:', 'live:claude-session:', 'live:cursor-session:')))]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Local context drops OpenCode conversations

When Local context builds candidates from discovered conversations, this filter accepts Codex, Claude and Cursor IDs but excludes OpenCode IDs. A relevant OpenCode conversation cannot be selected automatically, even when it is already in the chat inventory.

Prompt To Fix With AI
This is a comment left during a code review.
Path: harness_manager/workspaces/context_packs.py
Line: 114

Comment:
**Local context drops OpenCode conversations**

When Local context builds candidates from discovered conversations, this filter accepts Codex, Claude and Cursor IDs but excludes OpenCode IDs. A relevant OpenCode conversation cannot be selected automatically, even when it is already in the chat inventory.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

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