Initial EpiphanyAgent scaffold and planning docs

This commit is contained in:
Meta Vens 2026-04-23 22:01:17 +01:00
commit e64eee951f
17 changed files with 3093 additions and 0 deletions

15
state/branches.json Normal file
View file

@ -0,0 +1,15 @@
{
"branches": [
{
"id": "main",
"hypothesis": "External typed state will reduce drift relative to plain prompting on iterative coding tasks.",
"status": "active",
"artifacts": [
"state/map.yaml",
"state/scratch.md",
"state/evidence.jsonl"
],
"notes": "Initial scaffold plus tiny CLI. No evaluated task yet."
}
]
}

26
state/evidence.jsonl Normal file
View file

@ -0,0 +1,26 @@
{"ts":"2026-04-23","type":"scaffold","status":"ok","note":"Initialized EpiphanyAgent workspace with typed state files, controller action rules, and an initial experiment map."}
{"ts": "2026-04-23T03:42:27+00:00", "type": "bootstrap", "status": "ok", "note": "Initialized repo, added typed-state scaffold, and verified the tiny CLI runs with bundled Python."}
{"ts": "2026-04-23T03:48:53+00:00", "type": "research", "status": "ok", "note": "Cloned openai/codex, identified collaboration-mode presets as the clean insertion point, and wrote a concrete patch plan note for preset-backed versus enum-backed Epiphany mode."}
{"ts": "2026-04-23T15:28:33+00:00", "type": "handoff", "status": "ok", "note": "Added root AGENTS.md and notes/fresh-workspace-handoff.md so a fresh workspace can continue from repo-local context."}
{"ts": "2026-04-23T15:29:25+00:00", "type": "handoff", "status": "ok", "note": "Added architecture-rationale.md with the typed-state architecture, cheap prototype strategy, eval shape, and DeepSeek research context."}
{"ts": "2026-04-23T15:47:17+00:00", "type": "research", "status": "ok", "note": "Orientation confirmed the preset-backed Codex insertion point and recorded that Phase 1 TUI selection/labeling must compare preset identity, not only ModeKind, because Epiphany rides on Default."}
{"ts": "2026-04-23T15:48:11+00:00", "type": "research", "status": "ok", "note": "App-server collaboration mode list preserves preset name but drops developer_instructions; turn-start fallback currently matches only ModeKind, so duplicate Default-backed presets need explicit preset identity or explicit instructions in non-TUI flows."}
{"ts": "2026-04-23T15:55:06+00:00", "type": "research", "status": "ok", "note": "Cloned stellarlinkco/codex to vendor/opencodex and ymichael/open-codex to vendor/open-codex-cli. The exact-name open-codex fork is terminal-only; vendor/opencodex is the GUI-relevant Rust/Web UI fork served by codex serve."}
{"ts": "2026-04-23T16:17:47+00:00", "type": "research", "status": "ok", "note": "Checked OpenCodex Anthropic/Claude GUI claims. web README and MODEL_OPTIONS mention claude/sonnet/opus, but AgentSelector only exposes codex and serve backend rejects any spawned agent other than codex; Anthropic support appears limited to model_provider config, not GUI agent selection."}
{"ts": "2026-04-23T16:26:11+00:00", "type": "research", "status": "rejected", "note": "Audited imdigitalashish/OpenCodex: it is a Tauri desktop wrapper around vendored opencode, not a Codex fork; the core coding-agent path depends on an external opencode binary and non-interactive CLI mode."}
{"ts": "2026-04-23T16:26:11+00:00", "type": "verification", "status": "partial", "note": "Frontend npm ci and npm run build succeeded for imdigitalashish/OpenCodex; npm audit reports 3 high-severity advisories. Go and Cargo toolchains are not on PATH, so opencode and Tauri backend were not compiled."}
{"ts": "2026-04-23T16:26:11+00:00", "type": "research", "status": "rejected", "note": "imdigitalashish/OpenCodex GUI model IDs are inconsistent with vendored opencode SupportedModels: the GUI advertises/writes Anthropic API IDs like claude-sonnet-4-5-20250929 while opencode accepts symbolic IDs such as claude-4-sonnet."}
{"ts": "2026-04-23T16:31:48+00:00", "type": "decision", "status": "ok", "note": "Removed third-party OpenCodex comparison clones from vendor/opencodex, vendor/open-codex-cli, and vendor/opencodex-imdigitalashish. Decision: build a dedicated GUI wrapper around customized vendored Codex instead of trusting unaudited forks."}
{"ts": "2026-04-23T18:02:11+01:00", "type": "research", "status": "ok", "note": "Mapped vendored Codex end-to-end dataflow in notes/codex-repository-algorithmic-map.md: CLI/TUI choose a surface, app-server is the transport seam, core/session owns prompt assembly and tool execution, and rollouts plus SQLite provide durable thread history and metadata."}
{"ts": "2026-04-23T18:16:47+01:00", "type": "design", "status": "ok", "note": "Defined Epiphany as core-owned structured thread state in notes/epiphany-core-harness-surfaces.md. The spec anchors on existing TurnContextItem and PlanUpdate/TurnDiff patterns: persist Epiphany baselines in rollouts, stream typed updates through app-server, and let the GUI render graphs, invariants, evidence, intent, and churn without becoming the source of truth."}
{"ts": "2026-04-23T18:24:36+01:00", "type": "design", "status": "ok", "note": "Refined the Epiphany harness spec so the machine map is two linked graphs rather than one: an ArchitectureGraph and a DataflowGraph, joined by explicit cross-links and grounded by line-anchored code refs. Replaced the vague node description field with purpose, mechanism, and metaphor so the internal representation carries richer language for both model alignment and human inspection."}
{"ts": "2026-04-23T18:36:52+01:00", "type": "design", "status": "ok", "note": "Updated the Epiphany harness spec to handle repeated compactions during large repo mapping. Added an explicit spine/frontier/scratch model, graph checkpoints as re-entry breadcrumbs, dataflow sharding for large repositories, coverage/provenance status on graph elements, and more resilient code refs with symbol and last-seen revision metadata so resume/compaction does not collapse the map back into prose mush."}
{"ts": "2026-04-23T19:41:43+00:00", "type": "research", "status": "ok", "note": "Inspected Codex session 019db84b-7edd-7843-abc9-76ad2c402bb4 rollout. Failure mode was repeated premature closure on mapping work: assistant repeatedly framed local pass completion as done while user had to restate bar (missing leaves, control flow not file map, hand-waved mechanisms). Four context compactions preserved replacement_history but likely weakened the persistent evaluation bar. Quality improved only when user asked a concrete mechanism question (planetary gravity to visible nebula terrain), which forced an honest admission of a missing seam. Implication for Epiphany: mapping tasks need explicit done criteria based on answering concrete transformation questions, plus durable coverage/frontier/gap state across compactions."}
{"ts": "2026-04-23T19:54:42+00:00", "type": "decision", "status": "ok", "note": "Patched epiphany-core-harness-surfaces.md to make mapping done-criteria explicit. Added durable MechanismQuestion and MechanismGap concepts, separate MappingCompletionState from coverage, preserved active questions/gaps through frontier and checkpoint, and required concrete transformation-question answerability before marking mapping work done. Updated state/map.yaml to carry the same rule into accepted design and next action."}
{"ts": "2026-04-23T20:01:26+00:00", "type": "decision", "status": "ok", "note": "Documented a multi-agent Epiphany harness model in epiphany-core-harness-surfaces.md. Added supervising-harness plus specialist-agent framing, agent registry and role metadata, ownership boundaries for mapper/worker/verifier/coordinator, private-by-default role scratch, subscription-triggered wakeups, protocol/UI surfaces for agent status, and phased specialist-agent scheduling. Updated state/map.yaml to record the shared-state-plane plus role-ownership design and to defer the patch-slice plan until after this broader design pass."}
{"ts": "2026-04-23T20:08:53+00:00", "type": "decision", "status": "ok", "note": "Extended epiphany-core-harness-surfaces.md with a first-class repository retrieval subsystem. Added hybrid retrieval principle (exact path/symbol/lexical plus semantic chunk and graph-linked lookup), repo-local sharded index summaries, diff-driven freshness/invalidation, role-scoped retrieval policies, retrieval lifecycle hooks, protocol/app-server update events, typed retrieval query surface guidance, UI retrieval view, and phased rollout positioning before GUI reflection and specialist-agent scheduling. Updated state/map.yaml to treat retrieval as a core design decision and to keep the next action on broader harness design before a Phase 1 patch-slice plan."}
{"ts": "2026-04-23T20:13:55+00:00", "type": "research", "status": "ok", "note": "Scanned vendored Codex for additional harness blind spots before patch planning. Findings: repo retrieval is still fuzzy-file/CLI-centric; file watchers are wired mainly to skills cache invalidation and fs notifications, not repo-understanding freshness; subagents inherit config and tools but do not share a typed collaboration state plane; the startup memories pipeline explicitly excludes sub-agent sessions; most tool outputs still persist into history as text payloads; and turn diff tracking exposes aggregated unified diff, not impacted symbols/subsystems or semantic invalidation. Implication: Epiphany should reuse watcher/diff/subagent substrate but add typed distillation, freshness tracking, and shared repo knowledge above it."}
{"ts": "2026-04-23T20:23:25+00:00", "type": "decision", "status": "ok", "note": "Patched notes/epiphany-core-harness-surfaces.md after the Codex blind-spot scan. The spec now explicitly reuses existing Codex substrate (watchers, diff stream, subagent lifecycle, memory pipeline) while naming the missing semantic layer above it: code-intelligence-aware hybrid retrieval, semantic invalidation over repo changes, a structured observation/distillation layer between raw tool output and durable state, and a shared knowledge plane for specialist agents that is not replacement_history or prompt osmosis. Synced state/map.yaml with the same observation-layer design."}
{"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."}

90
state/map.yaml Normal file
View file

@ -0,0 +1,90 @@
experiment:
name: EpiphanyAgent
status: scaffolded
phase: manual_external_typed_state
premise: >
Test whether separating map, scratch, and output reduces architectural drift
for coding tasks when using a strong general model.
objective:
primary: >
Build a model-agnostic protocol that Codex can use in this workspace and that
can later be evaluated on open models without requiring frontier-scale
training.
immediate:
- Finish the initial workspace scaffold.
- Keep controller actions and write rules explicit.
- Ground the Codex epiphany-mode idea against the real open-source codebase.
- Use the first minimal runner or manual operating loop on a small real task.
- Try the protocol on a small real task.
constraints:
- No frontier-scale training budget.
- Start with external state and prompting.
- Keep the protocol light enough to use during normal work.
- Prefer evidence over vibes.
invariants:
- The map is canonical and slow-changing.
- Scratch is temporary and allowed to be wrong.
- Output must not silently redefine the map.
- Accepted changes should have recorded evidence.
- Rejected paths stay recorded.
data_flow:
observe:
- task request
- repository state
- verifier results
process:
- update map only with stable understanding
- think about one subgoal at a time
- propose one bounded change
- verify against task goals and invariants
- record evidence
- commit or backtrack
active_subgoals:
- Implement the Phase 1 internal/dev-usable Epiphany core state slice in vendored Codex: protocol types, SessionState storage, rollout persistence, replay, and compatibility tests.
- 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.
accepted_design:
- external typed state files
- bounded controller actions
- verifier-guided acceptance
- manual first, automation later
- patch Codex via collaboration-mode presets before touching protocol enums
- make Phase 1 preset selection, labeling, and instruction lookup preset-name-aware where needed because Epiphany initially rides on ModeKind::Default
- for a GUI-centered experiment, build a dedicated wrapper around customized vendored Codex instead of adopting third-party OpenCodex forks
- treat Epiphany as core-owned structured thread state in Codex, with the GUI as a reflection and steering layer rather than the source of truth
- represent the Epiphany machine map as two linked graphs (architecture and dataflow) with rich natural-language node fields such as purpose, mechanism, and metaphor, plus line-anchored code references
- make the graph model compaction-aware: preserve a durable spine, checkpoint and reselect a frontier, and allow scratch to be rewritten or discarded
- for mapping work, distinguish a completed pass from actual understanding: require representative concrete transformation questions, record unresolved mechanism gaps durably, and carry those gates across compaction
- treat Epiphany as a supervising harness over specialist agents sharing a typed state plane, with private role-scoped scratch by default and explicit ownership for map, evidence, and code-change domains
- add a repo-local hybrid retrieval subsystem to Epiphany: combine exact path/symbol/lexical search with semantic chunk retrieval and graph-linked lookup, shard it by repo/subsystem, and track freshness from diffs
- 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
- 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
rejected_paths:
- name: pinned_map_only
reason: still one token stream with no typed write semantics
- name: train_new_base_model_first
reason: too expensive for a first falsifiable experiment
- name: exact_name_open_codex_cli_as_gui_surface
reason: ymichael/open-codex is terminal-focused and has no Web UI or desktop surface
- name: read_opencodex_web_readme_claude_models_as_current_gui_support
reason: the Web UI has stale/aspirational Claude/Gemini model definitions, but the new-session selector only exposes Codex and the serve backend rejects non-Codex agents
- name: imdigitalashish_opencodex_as_primary_gui_surface
reason: the repo is a Tauri wrapper around an archived/vendored opencode CLI, has mismatched GUI/API model IDs versus the CLI model registry, runs the non-interactive tool path with broad auto-approval, and commits generated/binary/local-state artifacts
- name: third_party_opencodex_forks_as_gui_base
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 an actionable Phase 1 implementation plan against vendored Codex. Third-party OpenCodex comparison clones were audited and removed.
next_action: Implement the Phase 1 internal/dev-usable Epiphany core state slice: add the minimal protocol types, store Epiphany state in SessionState, persist one rollout snapshot per real user turn, rehydrate it through rollout reconstruction, patch exhaustive RolloutItem matches, and add persistence/replay compatibility tests before touching prompts, presets, or GUI surfaces.

26
state/scratch.md Normal file
View file

@ -0,0 +1,26 @@
# Scratch
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.
## 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.
## 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?
Do not promote anything from here into the map unless it survives verification or repeated reuse without contradiction.