Land Epiphany Phase 4 hybrid retrieval slice
This commit is contained in:
parent
d45ab10267
commit
360dfea6e4
39 changed files with 10378 additions and 62 deletions
|
|
@ -38,3 +38,18 @@
|
|||
{"ts": "2026-04-24T00:44:53+01:00", "type": "decision", "status": "ok", "note": "Patched the Epiphany spec and handoff workflow to make compaction pressure-aware instead of purely reactive. Added the rule that the harness should detect rising context pressure before the hard limit, checkpoint at the next safe point when pressure is high, and persist immediately when pressure is critical rather than waiting for forced compaction to erase live reasoning."}
|
||||
{"ts": "2026-04-24T00:47:37+01:00", "type": "decision", "status": "ok", "note": "Updated the repo-local AGENTS.md to carry the operational bootstrap and re-entry protocol explicitly. Fresh sessions and post-compaction resumes should reread the persisted state files, run tools/epiphany_state.py status immediately, restate the persisted next action before edits, and treat rising context pressure as a cue to checkpoint before forced compaction."}
|
||||
{"ts": "2026-04-24T00:50:33+01:00", "type": "decision", "status": "ok", "note": "Added a dedicated current-state Epiphany algorithmic delta map in notes/epiphany-current-algorithmic-map.md. The note documents only the currently landed divergence from plain Codex: durable Epiphany state in protocol/rollout, replay-aware restoration, prompt injection through build_initial_context, and typed app-server Thread.epiphanyState hydration, while explicitly calling out what has not diverged yet."}
|
||||
{"ts": "2026-04-24T00:03:39+00:00", "type": "research", "status": "ok", "note": "Recovered from source that existing exact/path lookup substrate already exists through codex_file_search in vendored Codex, currently used by app-server fuzzy search in vendor/codex/codex-rs/app-server/src/fuzzy_file_search.rs."}
|
||||
{"ts": "2026-04-24T00:03:39+00:00", "type": "research", "status": "ok", "note": "Recovered from source that codex-core already depends on bm25 and uses it in vendor/codex/codex-rs/core/src/tools/handlers/tool_search.rs, so a bounded local BM25 retrieval backend can reuse in-tree library precedent instead of inventing a new search dependency."}
|
||||
{"ts": "2026-04-24T00:03:39+00:00", "type": "research", "status": "ok", "note": "Preflighted the tracked Phase 4 source corpus using git-tracked files rather than raw working-tree disk usage. At vendor/codex HEAD d45ab10, tracked vendor/codex/codex-rs source is 3642 files / 31.09 MB; raw working-tree size is polluted by build artifacts and should not drive retrieval design."}
|
||||
{"ts": "2026-04-24T00:03:39+00:00", "type": "decision", "status": "ok", "note": "Chose the first bounded Phase 4 retrieval backend as a query-time hybrid retriever: reuse codex_file_search for exact/path-ish lookup, use workspace-local BM25 chunk search as the initial semantic backend, keep the slice loaded-thread-first and read-only, and defer embeddings, vector stores, persistent indexing, and watcher-driven invalidation."}
|
||||
{"ts": "2026-04-24T00:03:39+00:00", "type": "implementation", "status": "in_progress", "note": "The current working tree contains an unverified protocol scaffold for Phase 4 in vendor/codex/codex-rs/protocol/src/protocol.rs. It adds EpiphanyThreadState.retrieval plus EpiphanyRetrievalState, EpiphanyRetrievalStatus, and EpiphanyRetrievalShardSummary, but core/app-server wiring and test verification are still pending."}
|
||||
{"ts": "2026-04-24T00:22:05+00:00", "type": "decision", "status": "ok", "note": "Live hydrated thread epiphanyState now backfills a lightweight retrieval summary when the thread already has Epiphany state but no persisted retrieval metadata yet; this keeps the first slice loaded-thread-first and read-only without inventing a write path."}
|
||||
{"ts": "2026-04-24T00:22:05+00:00", "type": "implementation", "status": "in_progress", "note": "Phase 4 working tree now wires query-time hybrid retrieval across core and app-server: new core epiphany_retrieval module, CodexThread retrieval entry points, experimental app-server protocol method thread/epiphany/retrieve, and app-server request handling/mapping are all present but not formatted or verified yet."}
|
||||
{"ts": "2026-04-24T00:22:05+00:00", "type": "verification", "status": "pending", "note": "Phase 4 retrieval wiring still needs cargo fmt and targeted Windows-safe Rust verification for codex-core, codex-app-server-protocol, and codex-app-server; no tests have been run on the current wider diff yet."}
|
||||
{"ts": "2026-04-24T02:07:46+01:00", "type": "implementation", "status": "ok", "note": "Finished the first bounded Phase 4 query-time hybrid retrieval slice in the working tree. Fixed the live-thread mapping fallout in codex_message_processor.rs, added retrieval: None to the prompt fixture Epiphany state, tightened the exact-hit retrieval test fixture to a genuinely matchable path, and kept the retrieval surface additive and read-only with live retrieval-summary backfill rather than inventing a write path."}
|
||||
{"ts": "2026-04-24T02:07:46+01:00", "type": "verification", "status": "ok", "note": "Verified the Phase 4 slice with the Windows CARGO_TARGET_DIR workaround. cargo fmt --all passed; cargo test -p codex-core -p codex-app-server-protocol -p codex-app-server --lib --no-run passed; targeted tests passed for codex-core retrieve_workspace_*, codex-app-server-protocol thread_epiphany_retrieve*, and codex-app-server map_epiphany_retrieve_response_preserves_summary_and_results; full cargo test -p codex-app-server-protocol passed after stable schema regeneration."}
|
||||
{"ts": "2026-04-24T02:07:46+01:00", "type": "decision", "status": "ok", "note": "Stable app-server protocol schema fixtures are the only safe checked-in schema state for the Phase 4 slice. Running write_schema_fixtures with --experimental rewrites the same schema tree, causes stable protocol tests to fail if left in place, and therefore must be followed by stable fixture regeneration before the repo is left in a landed state."}
|
||||
{"ts": "2026-04-24T02:07:46+01:00", "type": "decision", "status": "ok", "note": "Kept EpiphanyThreadState sparse at the protocol/export boundary. The protocol export test now explicitly exempts EpiphanyThreadState from the optional-nullable params rule because durable thread state intentionally uses optional fields, and flattening it into a fake params-shaped object would be the worse lie."}
|
||||
{"ts": "2026-04-24T02:11:38+01:00", "type": "decision", "status": "ok", "note": "Deferred durable retrieval-summary persistence beyond the verified Phase 4 slice. EpiphanyState snapshots are still persisted on real user-turn boundaries, so teaching thread/epiphany/retrieve to append durable state now would require a new out-of-band rollout semantic or a fake turn boundary; keep the current slice as the landing zone instead of widening the machine casually."}
|
||||
{"ts": "2026-04-24T02:11:38+01:00", "type": "decision", "status": "ok", "note": "Adopted Qdrant as the intended first persistent semantic retrieval backend after the verified BM25 baseline. The rationale is practical rather than fashionable: the user is already moving away from a blob-thrashing Postgres/JSON embedding store in adjacent infrastructure, so Epiphany should target a real vector DB for persistent semantic indexing while keeping exact/path search first-class and retaining BM25 as bootstrap/fallback/control rather than going vector-only."}
|
||||
{"ts": "2026-04-24T02:43:41+01:00", "type": "decision", "status": "ok", "note": "Resolved the remaining backend policy fork before shipping Phase 4 slice 1: Qdrant is the preferred later persistent semantic backend, but not a hard runtime requirement for basic Epiphany use. The verified BM25 retriever remains the no-hassle bootstrap/fallback/control path for users who do not want Qdrant or when Qdrant is unavailable."}
|
||||
|
|
|
|||
|
|
@ -45,10 +45,9 @@ data_flow:
|
|||
- commit or backtrack
|
||||
|
||||
active_subgoals:
|
||||
- Define the Phase 4 repo-local hybrid retrieval slice now that the minimal Phase 3 typed client exposure is landed and verified.
|
||||
- Use the tiny CLI and typed state files on a small real task.
|
||||
- Decide whether the next executable artifact should be a patch runner or a verifier helper.
|
||||
- Run the protocol on a small real task.
|
||||
- Clean up and ship the verified Phase 4 repo-local hybrid retrieval slice without widening scope.
|
||||
- Keep the canonical map, handoff note, evidence log, and checked-in stable schema state aligned with the verified landing zone.
|
||||
- Preserve BM25 as the no-hassle fallback while treating Qdrant as the preferred later persistent semantic backend.
|
||||
|
||||
accepted_design:
|
||||
- external typed state files
|
||||
|
|
@ -79,6 +78,8 @@ accepted_design:
|
|||
- Epiphany should be an opinionated software development agent: pre-compaction and pre-handoff persistence of map, evidence, and next action are part of the workflow, not optional operator folklore
|
||||
- compaction handling should be pressure-aware rather than reactive: when context pressure rises, Epiphany should narrow the active move and persist checkpoints before forced compaction actually hits
|
||||
- repo-local AGENTS instructions should carry the session bootstrap and re-entry protocol explicitly, including running epiphany_state.py status on fresh load and after compaction
|
||||
- implement the first Phase 4 retrieval slice as a query-time hybrid retriever: reuse existing codex_file_search substrate for exact/path lookup and use workspace-local BM25 chunk search as the first semantic backend so the retrieval seam is proven before adding persistence
|
||||
- for the first persistent semantic retrieval store after the verified BM25 baseline, prefer a real vector database such as Qdrant over JSON/blob/postgres-thrash designs; treat Qdrant as the preferred persistent semantic backend rather than a hard requirement, keep exact/path lookup as a first-class organ, and keep BM25 available as a bootstrap/fallback/control path when Qdrant is unavailable or not configured instead of turning retrieval into vector-only soup
|
||||
|
||||
rejected_paths:
|
||||
- name: pinned_map_only
|
||||
|
|
@ -95,5 +96,5 @@ rejected_paths:
|
|||
reason: audited candidates were either terminal-only, stale/aspirational, or incoherent wrappers; the comparison clones were removed from vendor to avoid building on untrusted drift
|
||||
|
||||
current_status:
|
||||
summary: Workspace initialized with protocol files, typed state, a tiny CLI, a git repo, fresh-workspace handoff notes, architecture rationale, a Codex algorithmic map note, an Epiphany core-harness surface spec, and a rolling implementation plan against vendored Codex. Phase 1 durable Epiphany state, Phase 2 prompt integration, and a minimal Phase 3 typed client read surface are all implemented and verified with a real Rust/MSVC toolchain; vendored Codex is tracked directly in the parent repo; app-server Thread payloads can now carry typed Epiphany state without scraping prompt text; and pre-compaction persistence is now an explicit part of the intended Epiphany workflow.
|
||||
next_action: Write and then implement the first bounded Phase 4 repo-local hybrid retrieval slice so Epiphany can query repo knowledge through typed state and additive query surfaces instead of repeated file-by-file shell archaeology.
|
||||
summary: Workspace initialized with protocol files, typed state, a tiny CLI, a git repo, fresh-workspace handoff notes, architecture rationale, a Codex algorithmic map note, an Epiphany core-harness surface spec, and a rolling implementation plan against vendored Codex. Phase 1 durable Epiphany state, Phase 2 prompt integration, and a minimal Phase 3 typed client read surface are all implemented and verified with a real Rust/MSVC toolchain; vendored Codex is tracked directly in the parent repo; app-server Thread payloads can now carry typed Epiphany state without scraping prompt text; pre-compaction persistence is now an explicit part of the intended Epiphany workflow; and the first bounded Phase 4 repo-local hybrid retrieval slice is now wired and verified in the working tree across protocol, core, app-server protocol, and app-server, including stable schema fixture regeneration and the Windows `CARGO_TARGET_DIR` verification path.
|
||||
next_action: Clean up and push the current verified query-time hybrid retriever as the Phase 4 slice 1 landing zone. Do not bolt durable EpiphanyState writes onto `thread/epiphany/retrieve` without a clean out-of-band rollout semantic; after the push and reboot, the next persistent semantic retrieval slice should target a Qdrant-backed store with explicit freshness/indexing semantics as the preferred semantic backend while BM25 remains the fallback when Qdrant is unavailable.
|
||||
|
|
|
|||
|
|
@ -4,23 +4,66 @@ This file is intentionally disposable.
|
|||
|
||||
## Current Subgoal
|
||||
|
||||
- Confirm the scaffold is coherent enough to use.
|
||||
- Decide whether to patch vendored Codex with the lightweight Epiphany preset now.
|
||||
- Decide whether the next executable artifact should be a patch runner or a verifier helper.
|
||||
- Clean up, persist, and ship the verified first bounded Phase 4 repo-local hybrid retrieval slice in vendored Codex.
|
||||
|
||||
## Working Notes
|
||||
|
||||
- The protocol should be usable by any capable model because most of the structure lives outside the model.
|
||||
- The first test should be small enough to run repeatedly without becoming its own research program.
|
||||
- If the protocol becomes too ceremonial, it will lose to plain prompting for the most boring reason imaginable: friction.
|
||||
- The current CLI is intentionally small. It exists to keep state honest, not to impersonate a full agent runtime.
|
||||
- The Codex repo already has a cleaner-than-expected collaboration-mode preset seam, so a preset-backed Epiphany mode is a tractable first implementation.
|
||||
- The old lone-diff situation is gone. The current in-flight Phase 4 wiring now spans:
|
||||
- `vendor/codex/codex-rs/protocol/src/protocol.rs`
|
||||
- `vendor/codex/codex-rs/core/src/epiphany_retrieval.rs`
|
||||
- `vendor/codex/codex-rs/core/src/codex_thread.rs`
|
||||
- `vendor/codex/codex-rs/core/src/lib.rs`
|
||||
- `vendor/codex/codex-rs/core/Cargo.toml`
|
||||
- `vendor/codex/codex-rs/core/src/session/tests.rs`
|
||||
- `vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs`
|
||||
- `vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs`
|
||||
- `vendor/codex/codex-rs/app-server-protocol/src/export.rs`
|
||||
- `vendor/codex/codex-rs/app-server/src/codex_message_processor.rs`
|
||||
- `vendor/codex/codex-rs/app-server/README.md`
|
||||
- regenerated stable fixtures under `vendor/codex/codex-rs/app-server-protocol/schema/`
|
||||
- The current implementation shape is the bounded one we wanted:
|
||||
- exact/path-ish lookup via `codex_file_search`
|
||||
- semantic lookup via query-time BM25 chunk search in the new core retrieval module
|
||||
- additive experimental app-server method `thread/epiphany/retrieve`
|
||||
- lightweight retrieval-summary backfill for live `thread.epiphanyState` when the thread already has Epiphany state but no persisted retrieval summary yet
|
||||
- `codex-core` now depends on both `bm25` and `codex-file-search`; `ignore` is used to walk a gitignore-respecting local corpus for semantic chunking.
|
||||
- The semantic side is intentionally small:
|
||||
- text-only files
|
||||
- size cap per file
|
||||
- fixed line-window chunking with overlap
|
||||
- no embeddings, no persistent blob, no watcher invalidation
|
||||
- Corpus preflight for the tracked `vendor/codex/codex-rs` source at `vendor/codex` HEAD `d45ab10`: `3642` tracked files, `31.09 MB`.
|
||||
- Do not use raw working-tree size as the retrieval denominator here; build artifacts and other debris inflate it badly and will lie to the design.
|
||||
- Verification is no longer theoretical:
|
||||
- `cargo fmt --all` passed
|
||||
- `cargo test -p codex-core -p codex-app-server-protocol -p codex-app-server --lib --no-run` passed with `CARGO_TARGET_DIR=C:\Users\Meta\.cargo-target-codex`
|
||||
- targeted Phase 4 tests passed in core, app-server protocol, and app-server
|
||||
- full `cargo test -p codex-app-server-protocol` passed after regenerating stable schema fixtures
|
||||
- Small fallout that had to be patched:
|
||||
- `codex_message_processor.rs` had an unnecessary `live_thread.as_ref()`
|
||||
- `core/src/session/tests.rs` needed `retrieval: None` in the prompt fixture Epiphany state
|
||||
- the exact-hit retrieval test fixture needed an actually matchable path (`session_checkpoint.rs`)
|
||||
- `EpiphanyThreadState` needed an explicit exemption in the protocol export test because it is a sparse durable state object, not a params bag
|
||||
- Important schema footgun:
|
||||
- `cargo run -p codex-app-server-protocol --bin write_schema_fixtures -- --experimental` rewrites the same checked-in stable schema tree
|
||||
- leaving the repo in that state makes stable protocol tests fail
|
||||
- the checked-in repo state must stay on the stable fixture generation path
|
||||
- despite the giant `git status` scream wall, the real schema content diff is small and expected:
|
||||
- `git diff --numstat` shows actual content changes in `15` generated schema files
|
||||
- plus the new untracked Epiphany TypeScript schema files
|
||||
- the broader wall is mostly line-ending/worktree noise, not extra logical surface area
|
||||
- After inspecting the live code path, do not widen `thread/epiphany/retrieve` into a durable Epiphany-state write right now:
|
||||
- durable `EpiphanyState` snapshots are currently persisted on real user-turn boundaries
|
||||
- making retrieval calls append durable snapshots would require a new out-of-band rollout semantic or a fake turn boundary
|
||||
- that is a bigger machine than this slice deserves
|
||||
- New infrastructure direction:
|
||||
- for the first persistent semantic backend after this verified BM25 slice, use Qdrant instead of inventing another monolithic JSON/blob/postgres-embedding store
|
||||
- Qdrant should be the preferred persistent semantic backend later, not a hard runtime requirement for basic Epiphany use
|
||||
- exact/path lookup stays first-class
|
||||
- BM25 should stay available as a bootstrap/fallback/control path for users who do not want Qdrant or when Qdrant is unavailable
|
||||
|
||||
## Open Questions
|
||||
|
||||
- What is the smallest useful verifier stack?
|
||||
- Which coding task will expose drift quickly?
|
||||
- How much branch management is enough before it turns into paperwork?
|
||||
- Should the first in-Codex implementation be instructions-only, or should it also add a tiny state helper tool?
|
||||
- When retrieval freshness/persistence semantics come later, should they ride a dedicated Epiphany update path instead of piggybacking on a read/query method?
|
||||
|
||||
Do not promote anything from here into the map unless it survives verification or repeated reuse without contradiction.
|
||||
|
|
|
|||
Reference in a new issue