diff --git a/README.md b/README.md index cee914d0..bbc3efc4 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,46 @@ The goal is not to prove a new frontier architecture in a weekend. The goal is t - `protocol/controller-actions.md`: allowed actions and write rules - `notes/fresh-workspace-handoff.md`: concise summary for a fresh workspace - `notes/codex-epiphany-mode-plan.md`: concrete patch plan for vendored Codex +- `notes/codex-repository-algorithmic-map.md`: current machine map of vendored Codex +- `notes/epiphany-core-harness-surfaces.md`: where Epiphany should patch into that machine - `notes/architecture-rationale.md`: why the map/scratch/evidence architecture exists - `tools/epiphany_state.py`: tiny CLI for inspecting and updating branch/evidence state - `eval-plan.md`: how to compare this protocol against plain prompting +## Current Direction + +This repo is no longer pretending the solution is "just prompt harder." + +The working design now is: + +- patch Epiphany into Codex's core harness, not into a chat transcript costume +- treat typed thread state as the primary artifact and the UI as a reflection/steering layer +- keep the machine map as two linked graphs: architecture and dataflow +- preserve rich natural-language explanations alongside code refs, because language is still the model's least embarrassing organ +- use specialist agents with shared typed state and private scratch, not one heroic context trying to cosplay a whole team +- add repo-local hybrid retrieval instead of making every role rediscover the repo with `rg` and raw stubbornness +- treat compaction as a role-specific state transition with safe points and explicit checkpoints, not hidden brain damage + +## Current Repository State + +- `vendor/codex` is the real target and is tracked as a gitlink/submodule-style nested repo +- third-party OpenCodex forks were audited and removed +- the Codex machine map and Epiphany harness spec have both been written and iterated enough to stop hand-waving +- the next concrete step is the internal/dev-usable Phase 1 slice in vendored Codex + +## Phase 1 + +Phase 1 is intentionally small and dull: + +- add minimal Epiphany protocol types +- store Epiphany state in Codex `SessionState` +- persist one Epiphany rollout snapshot per real user turn +- restore it through rollout reconstruction +- patch exhaustive `RolloutItem` matches +- add persistence/replay compatibility tests + +No GUI yet. No prompt integration yet. No specialist scheduling yet. First the engine learns how to remember what it thinks without dropping pieces on the floor. + ## Basic Loop 1. Observe the task, repo state, and current verifier outputs. diff --git a/notes/epiphany-core-harness-surfaces.md b/notes/epiphany-core-harness-surfaces.md index 979b2d2c..57c495c7 100644 --- a/notes/epiphany-core-harness-surfaces.md +++ b/notes/epiphany-core-harness-surfaces.md @@ -944,6 +944,59 @@ Suggested default triggers: This keeps the mapper responsive to repo change without making it inhale the worker's whole thought process. +#### Agent-specific compaction policy + +Compaction should not be invisible housekeeping. + +It is a harness-level state transition, and each role should compact differently. + +The rules should be: + +- compaction should prefer safe points rather than arbitrary interruption +- if pressure arrives mid-pass, mark compaction pending and defer until the role reaches a boundary +- every compaction should emit an explicit checkpoint or resume packet +- resume should say what survived, what was discarded, and what the role should do first + +Suggested defaults: + +- `Worker` + - compact aggressively + - preferred boundary: after each implementation pass or bounded write batch + - preserve active objective slice, edit intent, touched files, diff summary, pending checks, and unresolved blockers + - discard most exploratory scratch and raw shell exhaust once distilled + +- `Mapper` + - compact conservatively + - preferred boundary: after each graph checkpoint or subsystem pass + - preserve the graph frontier, open mechanism questions, open gaps, evidence refs, stale claims, and code refs + - discard local probing chatter once it has been distilled into observations, graph updates, or checkpoints + +- `Verifier` + - compact after each evidence batch or completed verification pass + - preserve pending checks, recent results, failure signatures, promoted evidence, and confidence notes + - discard raw command noise once promoted or explicitly rejected + +- `Coordinator` + - compact at decision boundaries rather than on every twitch + - preserve objectives, subgoal assignments, blockers, ownership state, and pending approvals + - discard transient orchestration chatter that has no durable consequence + +- `ChurnMonitor` + - can compact aggressively because it should mostly consume typed state, diffs, and progress summaries rather than long transcript context + +This suggests two useful compaction modes: + +- `SoftCompaction` + - trim scratch and local transcript bulk + - keep the current frontier and role context mostly live + - expected to be cheap and frequent + +- `HardCompaction` + - rebuild from durable state plus a role-specific resume packet + - expected to happen less often for coordinator/mapper and more often for worker/verifier + +The important thing is honesty. The system should admit that compaction happened instead of pretending the role has perfect continuity after being hit on the head. + #### `churn` Health signals about whether the work is getting sloppy. @@ -1172,14 +1225,18 @@ Behavior: - persist the latest Epiphany snapshot before the turn fully settles - persist or refresh the graph checkpoint before any compaction finalizes +- treat compaction as a role-aware state transition, not hidden transcript trimming +- compact at safe points where possible; otherwise mark compaction pending and defer until the active role reaches a boundary - preserve the graph spine and frontier metadata across compaction - preserve retrieval freshness summaries and dirty-shard metadata across compaction - preserve open mechanism questions, open gaps, and shard completion state across compaction +- preserve role-specific resume packets so worker, mapper, verifier, and coordinator can re-enter differently - clear or rotate scratch as needed - keep evidence append-only - distinguish `PassComplete` from `DoneCriteriaMet` in mapping work - do not mark a mapping subgoal done while required mechanism questions remain open or unresolved as gaps - preserve enough structure that compaction does not erase the machine's understanding or lose the next re-entry point +- emit explicit compaction telemetry describing the role, reason, boundary reached, retained state, discarded state, and checkpoint revision If compaction wipes the map, we have built a goldfish with a dashboard. @@ -1580,6 +1637,7 @@ This is where Epiphany graduates from "better instructions" to an actual harness - add the agent registry and role ownership model - add role-scoped private scratch - add subscription-driven wakeups for mapper, worker, verifier, and coordinator +- add role-specific compaction policies, safe points, and resume packets - keep the shared state plane authoritative while keeping role prompts narrow This is where Epiphany stops being one careful mind and becomes a coordinated pack. diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 041e209f..56e3afff 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -24,3 +24,5 @@ {"ts": "2026-04-23T20:33:19+00:00", "type": "decision", "status": "ok", "note": "Revised notes/codex-repository-algorithmic-map.md so the Codex machine map reflects both the main turn loop and the surrounding side channels/limitations. Added watcher and memory actors, extended the top-level flow with compaction and watcher/diff side channels, documented that tool outputs are still mostly transcript-shaped, and added explicit sections for file watching, textual diff tracking, message/config-based subagent coordination, startup memory summarization, and compaction as real dataflow. Conclusion: Codex has useful substrate around the loop, but still lacks a canonical typed repo-understanding layer above it."} {"ts": "2026-04-23T20:38:04+00:00", "type": "decision", "status": "ok", "note": "Patched epiphany-core-harness-surfaces.md with explicit GUI-first implications. The spec now states that structured thread state, not the transcript, is the primary artifact; chat is one client of that state; GUI steering should use typed updates; resume must restore a working scene; and long-running retrieval/remap/verification/specialist work should surface as typed jobs with progress. Added EpiphanyJobState to the thread model plus EpiphanyJobsUpdated protocol/app-server events, and expanded UI responsibilities and phase notes accordingly. Synced state/map.yaml with the same GUI-first design correction."} {"ts": "2026-04-23T20:56:56+00:00", "type": "decision", "status": "ok", "note": "Replaced notes/codex-epiphany-mode-plan.md with the actionable Phase 1 implementation plan. The repo now records an internal/dev-usable first slice focused on minimal Epiphany protocol types, SessionState storage, one Epiphany rollout snapshot per real user turn, replay through rollout reconstruction, exhaustive RolloutItem compatibility updates, and persistence/replay tests before prompt integration, presets, protocol notifications, or GUI work. Synced state/map.yaml so the next action is implementation rather than more design passes."} +{"ts": "2026-04-23T21:32:00+01:00", "type": "decision", "status": "ok", "note": "Patched notes/epiphany-core-harness-surfaces.md to make compaction role-specific instead of arbitrary hidden trimming. Added the design rule that compaction is a harness-level state transition with safe points, explicit checkpoints, and role-specific resume packets; documented default policies for worker, mapper, verifier, coordinator, and churn monitor; and added soft versus hard compaction language plus explicit compaction telemetry requirements. Confirmed this does not change the Phase 1 implementation slice, and synced state/map.yaml with the new accepted design."} +{"ts": "2026-04-23T21:36:00+01:00", "type": "decision", "status": "ok", "note": "Updated README.md to reflect the current EpiphanyAgent direction before Phase 1 implementation. Documented the actual target surface (vendored Codex core harness), the two-graph map model, GUI-first typed thread state, specialist-agent plus retrieval direction, role-specific compaction policy, and the intentionally narrow Phase 1 slice focused on durable core state rather than UI or prompt integration."} diff --git a/state/map.yaml b/state/map.yaml index eacf2b04..b1b93a48 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -67,6 +67,7 @@ accepted_design: - treat Codex's existing file watcher, subagent lifecycle, memory pipeline, and diff stream as reusable substrate, but add the missing semantic layer above them: typed repo understanding, freshness invalidation, structured tool-output distillation, and shared state across specialist agents - insert a structured observation layer between raw tool output and durable Epiphany state so evidence, invalidation, and graph updates are promoted from typed distillation rather than transcript osmosis - design Epiphany as GUI-first rather than transcript-first: the primary artifact is typed thread state, chat is one client of that state, user steering should go through typed updates, and long-running retrieval/remap/verification work should surface as explicit observable jobs + - treat compaction as a role-specific state transition with safe points, explicit checkpoints, and resume packets; workers may compact aggressively between implementation passes, while mapper, verifier, and coordinator preserve different state at different boundaries - preserve handoff context in repo-local AGENTS and notes files - keep a durable repository-level algorithmic map of vendored Codex so GUI and Epiphany changes hook into the existing app-server/core boundary instead of reimplementing the turn loop - keep the Codex algorithmic map honest about auxiliary side channels and limitations: file watching, unified diffs, compaction, subagent messaging, and memory summarization are real substrate, but they do not by themselves amount to semantic repo understanding