Harden Epiphany map proposals
This commit is contained in:
parent
7eb449b0a9
commit
88498dd89a
7 changed files with 198 additions and 39 deletions
|
|
@ -38,16 +38,22 @@ pub fn propose_map_update(input: EpiphanyMapProposalInput) -> Result<EpiphanyMap
|
|||
let fingerprint = fingerprint(&input.state.revision, &observation_ids, &code_refs);
|
||||
let mut graphs = input.state.graphs.clone();
|
||||
let mut active_node_ids = Vec::new();
|
||||
let mut reused_nodes = 0usize;
|
||||
let mut created_nodes = 0usize;
|
||||
|
||||
for path in unique_code_ref_paths(&code_refs) {
|
||||
let node_id = graph_node_id(&path);
|
||||
active_node_ids.push(node_id.clone());
|
||||
if !graphs
|
||||
.architecture
|
||||
.nodes
|
||||
.iter()
|
||||
.any(|node| node.id == node_id)
|
||||
let path_code_refs = code_refs_for_path(&code_refs, &path);
|
||||
let candidate_node_id = graph_node_id(&path);
|
||||
if let Some(node_index) =
|
||||
find_architecture_node_for_path(&graphs, &path_code_refs, &path, &candidate_node_id)
|
||||
{
|
||||
let node = &mut graphs.architecture.nodes[node_index];
|
||||
active_node_ids.push(node.id.clone());
|
||||
merge_code_refs(&mut node.code_refs, path_code_refs);
|
||||
reused_nodes += 1;
|
||||
} else {
|
||||
let node_id = candidate_node_id;
|
||||
active_node_ids.push(node_id.clone());
|
||||
graphs.architecture.nodes.push(EpiphanyGraphNode {
|
||||
id: node_id,
|
||||
title: title_from_path(&path),
|
||||
|
|
@ -64,8 +70,9 @@ pub fn propose_map_update(input: EpiphanyMapProposalInput) -> Result<EpiphanyMap
|
|||
)),
|
||||
metaphor: None,
|
||||
status: Some("candidate".to_string()),
|
||||
code_refs: code_refs_for_path(&code_refs, &path),
|
||||
code_refs: path_code_refs,
|
||||
});
|
||||
created_nodes += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -97,15 +104,17 @@ pub fn propose_map_update(input: EpiphanyMapProposalInput) -> Result<EpiphanyMap
|
|||
status: "candidate".to_string(),
|
||||
summary: truncate_chars(
|
||||
&format!(
|
||||
"Proposed graph frontier and churn update from verified observations: {}",
|
||||
observation_ids.join(", ")
|
||||
"Proposed graph frontier and churn update from verified observations: {}; reused {reused_nodes} existing node(s), created {created_nodes} new node(s)",
|
||||
observation_ids.join(", "),
|
||||
),
|
||||
SUMMARY_LIMIT,
|
||||
),
|
||||
code_refs,
|
||||
};
|
||||
let understanding_status = proposal_understanding_status(reused_nodes, created_nodes);
|
||||
let graph_freshness = proposal_graph_freshness(reused_nodes, created_nodes);
|
||||
let churn = EpiphanyChurnState {
|
||||
understanding_status: "proposal_ready".to_string(),
|
||||
understanding_status,
|
||||
diff_pressure: input
|
||||
.state
|
||||
.churn
|
||||
|
|
@ -114,11 +123,10 @@ pub fn propose_map_update(input: EpiphanyMapProposalInput) -> Result<EpiphanyMap
|
|||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or("low")
|
||||
.to_string(),
|
||||
graph_freshness: Some("proposal".to_string()),
|
||||
warning: Some(
|
||||
"Map/churn proposal derived from verified observations; promote only after verifier acceptance."
|
||||
.to_string(),
|
||||
),
|
||||
graph_freshness: Some(graph_freshness),
|
||||
warning: Some(format!(
|
||||
"Map/churn proposal derived from verified observations; reused {reused_nodes} existing node(s), created {created_nodes} new node(s); promote only after verifier acceptance."
|
||||
)),
|
||||
unexplained_writes: input
|
||||
.state
|
||||
.churn
|
||||
|
|
@ -216,6 +224,56 @@ fn code_refs_for_path(code_refs: &[EpiphanyCodeRef], path: &Path) -> Vec<Epiphan
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn find_architecture_node_for_path(
|
||||
graphs: &EpiphanyGraphs,
|
||||
path_code_refs: &[EpiphanyCodeRef],
|
||||
path: &Path,
|
||||
candidate_node_id: &str,
|
||||
) -> Option<usize> {
|
||||
graphs
|
||||
.architecture
|
||||
.nodes
|
||||
.iter()
|
||||
.position(|node| has_exact_code_ref_overlap(&node.code_refs, path_code_refs))
|
||||
.or_else(|| {
|
||||
graphs
|
||||
.architecture
|
||||
.nodes
|
||||
.iter()
|
||||
.position(|node| node.code_refs.iter().any(|code_ref| code_ref.path == path))
|
||||
})
|
||||
.or_else(|| {
|
||||
graphs
|
||||
.architecture
|
||||
.nodes
|
||||
.iter()
|
||||
.position(|node| node.id == candidate_node_id)
|
||||
})
|
||||
}
|
||||
|
||||
fn has_exact_code_ref_overlap(
|
||||
existing_code_refs: &[EpiphanyCodeRef],
|
||||
proposed_code_refs: &[EpiphanyCodeRef],
|
||||
) -> bool {
|
||||
let existing_keys = existing_code_refs
|
||||
.iter()
|
||||
.map(code_ref_key)
|
||||
.collect::<HashSet<_>>();
|
||||
proposed_code_refs
|
||||
.iter()
|
||||
.map(code_ref_key)
|
||||
.any(|key| existing_keys.contains(&key))
|
||||
}
|
||||
|
||||
fn merge_code_refs(target: &mut Vec<EpiphanyCodeRef>, additions: Vec<EpiphanyCodeRef>) {
|
||||
let mut seen = target.iter().map(code_ref_key).collect::<HashSet<_>>();
|
||||
for addition in additions {
|
||||
if seen.insert(code_ref_key(&addition)) {
|
||||
target.push(addition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn merge_unique<T>(target: &mut Vec<T>, additions: Vec<T>)
|
||||
where
|
||||
T: Clone + Eq + std::hash::Hash,
|
||||
|
|
@ -289,6 +347,26 @@ fn truncate_chars(value: &str, limit: usize) -> String {
|
|||
truncated
|
||||
}
|
||||
|
||||
fn proposal_understanding_status(reused_nodes: usize, created_nodes: usize) -> String {
|
||||
match (reused_nodes > 0, created_nodes > 0) {
|
||||
(true, false) => "proposal_refines_map",
|
||||
(false, true) => "proposal_expands_map",
|
||||
(true, true) => "proposal_updates_map",
|
||||
(false, false) => "proposal_ready",
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn proposal_graph_freshness(reused_nodes: usize, created_nodes: usize) -> String {
|
||||
match (reused_nodes > 0, created_nodes > 0) {
|
||||
(true, false) => "proposal-refined",
|
||||
(false, true) => "proposal-expanded",
|
||||
(true, true) => "proposal-updated",
|
||||
(false, false) => "proposal",
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn is_verified_status(status: &str) -> bool {
|
||||
matches!(
|
||||
status.trim().to_ascii_lowercase().as_str(),
|
||||
|
|
@ -355,10 +433,74 @@ mod tests {
|
|||
assert_eq!(proposal.graphs.architecture.nodes.len(), 1);
|
||||
assert_eq!(proposal.graphs.architecture.nodes[0].title, "prompt.rs");
|
||||
assert_eq!(proposal.graph_frontier.active_node_ids.len(), 1);
|
||||
assert_eq!(proposal.churn.understanding_status, "proposal_ready");
|
||||
assert_eq!(proposal.churn.understanding_status, "proposal_expands_map");
|
||||
assert_eq!(proposal.churn.diff_pressure, "medium");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn propose_map_update_reuses_existing_architecture_node_for_matching_code_ref() {
|
||||
let mut state = state_with_observation("verified");
|
||||
state.graphs.architecture.nodes.push(EpiphanyGraphNode {
|
||||
id: "prompt-renderer".to_string(),
|
||||
title: "Prompt renderer".to_string(),
|
||||
purpose: "Render Epiphany state into developer context".to_string(),
|
||||
status: Some("grounded".to_string()),
|
||||
code_refs: vec![code_ref("epiphany-core/src/prompt.rs")],
|
||||
..Default::default()
|
||||
});
|
||||
state.observations[0].code_refs.push(EpiphanyCodeRef {
|
||||
path: PathBuf::from("epiphany-core/src/prompt.rs"),
|
||||
start_line: Some(30),
|
||||
end_line: Some(40),
|
||||
symbol: Some("render_epiphany_state".to_string()),
|
||||
note: Some("newly verified line span".to_string()),
|
||||
});
|
||||
|
||||
let proposal = propose_map_update(EpiphanyMapProposalInput {
|
||||
state,
|
||||
observation_ids: vec!["obs-verified".to_string()],
|
||||
})
|
||||
.expect("proposal");
|
||||
|
||||
assert_eq!(proposal.graphs.architecture.nodes.len(), 1);
|
||||
let node = &proposal.graphs.architecture.nodes[0];
|
||||
assert_eq!(node.id, "prompt-renderer");
|
||||
assert_eq!(node.status.as_deref(), Some("grounded"));
|
||||
assert_eq!(node.code_refs.len(), 2);
|
||||
assert_eq!(
|
||||
proposal.graph_frontier.active_node_ids,
|
||||
vec!["prompt-renderer".to_string()]
|
||||
);
|
||||
assert_eq!(proposal.churn.understanding_status, "proposal_refines_map");
|
||||
assert_eq!(
|
||||
proposal.churn.graph_freshness.as_deref(),
|
||||
Some("proposal-refined")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn propose_map_update_reuses_existing_deterministic_path_node_without_refs() {
|
||||
let mut state = state_with_observation("verified");
|
||||
let node_id = graph_node_id(Path::new("epiphany-core/src/prompt.rs"));
|
||||
state.graphs.architecture.nodes.push(EpiphanyGraphNode {
|
||||
id: node_id.clone(),
|
||||
title: "Prompt path".to_string(),
|
||||
purpose: "Existing path-derived proposal node".to_string(),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let proposal = propose_map_update(EpiphanyMapProposalInput {
|
||||
state,
|
||||
observation_ids: vec!["obs-verified".to_string()],
|
||||
})
|
||||
.expect("proposal");
|
||||
|
||||
assert_eq!(proposal.graphs.architecture.nodes.len(), 1);
|
||||
assert_eq!(proposal.graphs.architecture.nodes[0].id, node_id);
|
||||
assert_eq!(proposal.graphs.architecture.nodes[0].code_refs.len(), 1);
|
||||
assert_eq!(proposal.churn.understanding_status, "proposal_refines_map");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn propose_map_update_returns_promotion_acceptable_patch_parts() {
|
||||
let proposal = propose_map_update(EpiphanyMapProposalInput {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ The spine exists in nine live paths:
|
|||
- per-turn persistence: normal turn setup persists one `RolloutItem::EpiphanyState` after the `TurnContext` when state exists in [session/mod.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/session/mod.rs:2677).
|
||||
- client read hydration: app-server thread views attach live or reconstructed `thread.epiphanyState` in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4520).
|
||||
- explicit distillation proposals: app-server routes read-only `thread/epiphany/distill` through a loaded-thread handler into `epiphany-core` so one explicit observation can become a patch candidate without mutating state in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4166) and [distillation.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/distillation.rs:28).
|
||||
- explicit map/churn proposals: app-server routes read-only `thread/epiphany/propose` through a loaded-thread handler into `epiphany-core` so verified observations with code refs can become candidate graph frontier/churn patches without mutating state in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4244) and [proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:34).
|
||||
- explicit map/churn proposals: app-server routes read-only `thread/epiphany/propose` through a loaded-thread handler into `epiphany-core` so verified observations with code refs can focus or extend architecture graph nodes, update frontier/churn candidates, and still avoid mutation until promotion in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4244) and [proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:34).
|
||||
- explicit promotion gates: app-server routes `thread/epiphany/promote` through a loaded-thread handler into `epiphany-core` policy evaluation, rejects failed verifier evidence without mutation, and applies accepted candidates through the same durable update path in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4316) and [promotion.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/promotion.rs:33).
|
||||
- explicit state updates: app-server routes `thread/epiphany/update` through a loaded `CodexThread` update method that mutates live `SessionState`, bumps the revision, and persists an immediate `RolloutItem::EpiphanyState` snapshot in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4337) and [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:373).
|
||||
- retrieval/indexing: app-server routes `thread/epiphany/retrieve` and `thread/epiphany/index` through loaded `CodexThread` host methods into `epiphany-core` in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4039), [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:438), and [codex_thread.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/core/src/codex_thread.rs:456).
|
||||
|
|
@ -113,7 +113,7 @@ This is the same flow in the language Epiphany is supposed to make the model car
|
|||
| Retrieval | A loaded thread can ask a structured question of the repo through one typed retrieval surface. | A librarian brings back marked pages instead of making the agent rummage through every shelf. |
|
||||
| Indexing | Persistent semantic memory is built only through an explicit indexing path. | The librarian updates the card catalog only when asked, not while pretending to answer a question. |
|
||||
| Distillation | One explicit observation can be normalized into a typed observation/evidence patch, but not promoted automatically. | The clerk drafts a ledger entry in pencil before anyone is allowed to ink it. |
|
||||
| Proposal | Verified observations with code refs can produce a candidate graph frontier/churn patch without writing it. | The clerk sketches a blueprint revision on tracing paper before anyone touches the master copy. |
|
||||
| Proposal | Verified observations with code refs can produce a candidate graph frontier/churn patch without writing it, reusing existing map nodes before adding new ones. | The clerk overlays tracing paper on the old blueprint before drawing a new wall through the plumbing. |
|
||||
| Promotion | A verifier-backed gate can reject a proposal without mutation or send it through the durable update path. | The foreman stamps the pencil draft before the clerk reaches for the red pen. |
|
||||
| State updates | A loaded thread can accept explicit typed patches that append observations/evidence and replace bounded map/scratch/churn fields. | The clerk finally has the red pen, but still writes only on the ledger page the form allows. |
|
||||
|
||||
|
|
@ -683,7 +683,7 @@ A client sends experimental `thread/epiphany/propose` for a loaded thread with:
|
|||
|
||||
Proposal is the tracing-paper path. It starts from observations that are already in the thread's typed state, requires those observations to have verified/accepted status, requires source-grounding through code refs, and returns a candidate patch that can replace graph/frontier/churn fields only if a later promotion accepts it.
|
||||
|
||||
This is the first shipped chewing motion. It is deliberately small: no model call, no watcher invalidation, no automatic graph truth. It creates or focuses architecture nodes for the observed code paths, moves those nodes into the frontier, emits a proposal observation/evidence pair, and marks churn as `proposal_ready`. It is a candidate, not an oracle. We do not crown the goblin because it found a wrench.
|
||||
This is the first shipped chewing motion. It is deliberately small: no model call, no watcher invalidation, no automatic graph truth. It now first tries to match observed code refs against existing architecture nodes, then falls back to same-path refs and deterministic path-node ids, enriches matching nodes with any newly observed refs, creates path-derived candidate nodes only for genuinely unmapped surfaces, moves focused nodes into the frontier, emits a proposal observation/evidence pair, and marks churn according to whether the proposal refined, expanded, or mixed the map. It is a candidate, not an oracle. We do not crown the goblin because it found a wrench.
|
||||
|
||||
Protocol shape:
|
||||
|
||||
|
|
@ -723,10 +723,12 @@ The app-server handler:
|
|||
2. rejects unknown observations.
|
||||
3. rejects observations whose status is not accepting: `ok`, `accepted`, `verified`, `pass`, or `passed`.
|
||||
4. rejects proposals without code refs.
|
||||
5. clones the current graphs and appends missing architecture nodes for observed code-ref paths.
|
||||
6. merges those node ids and paths into the graph frontier.
|
||||
7. emits a proposal observation/evidence pair tied to the candidate patch.
|
||||
8. emits a churn replacement with `understanding_status: proposal_ready`.
|
||||
5. clones the current graphs and searches architecture nodes for exact code-ref overlap, same-path overlap, then the deterministic path-node id.
|
||||
6. enriches matching architecture nodes with newly observed refs, preserving their existing title/purpose/status.
|
||||
7. creates path-derived candidate architecture nodes only when no existing node matches that code path.
|
||||
8. merges focused node ids and observed paths into the graph frontier.
|
||||
9. emits a proposal observation/evidence pair tied to the candidate patch, including reused/created node counts.
|
||||
10. emits churn with `proposal_refines_map`, `proposal_expands_map`, or `proposal_updates_map` depending on whether the candidate reused existing nodes, created new nodes, or did both.
|
||||
|
||||
Code refs:
|
||||
|
||||
|
|
@ -734,11 +736,13 @@ Code refs:
|
|||
- [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4287)
|
||||
- [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4301)
|
||||
- [epiphany-core/src/proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:34)
|
||||
- [epiphany-core/src/proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:346)
|
||||
- [epiphany-core/src/proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:224)
|
||||
- [epiphany-core/src/proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:339)
|
||||
- [epiphany-core/src/proposal.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/proposal.rs:413)
|
||||
|
||||
### Output
|
||||
|
||||
The response is a promotion-ready map/churn patch. The live smoke proved `thread/epiphany/propose` does not mutate state by itself; `thread/read` stayed at revision `1` with no persisted churn after proposal, then `thread/epiphany/promote` advanced revision to `2` and persisted the graph/churn patch only after verifier evidence accepted it.
|
||||
The response is a promotion-ready map/churn patch. Existing mapped surfaces now keep their node identity and accumulate observed refs instead of being duplicated as new path nodes. The live smoke proved `thread/epiphany/propose` does not mutate state by itself; `thread/read` stayed at revision `1` with no persisted churn after proposal, then `thread/epiphany/promote` advanced revision to `2` and persisted the graph/churn patch only after verifier evidence accepted it.
|
||||
|
||||
### Invariant
|
||||
|
||||
|
|
@ -846,7 +850,7 @@ stored Epiphany state
|
|||
-> explicit update patches can revise durable map/evidence/churn state
|
||||
```
|
||||
|
||||
The current remaining missing organ is not the red pen and not the first chewing motion. Those exist. The missing organ is broader judgment: richer proposal heuristics, better observation selection, watcher/freshness inputs, and eventually role-scoped specialist ownership without silently auto-promoting anything.
|
||||
The current remaining missing organ is not the red pen and not the first chewing motion. Those exist. Proposal now has the first bit of map memory: it reuses existing architecture nodes by code-ref overlap before creating new path nodes. The missing organ is broader judgment: richer observation selection, stronger proposal heuristics than path overlap, watcher/freshness inputs, and eventually role-scoped specialist ownership without silently auto-promoting anything.
|
||||
|
||||
```text
|
||||
model/tool observations
|
||||
|
|
@ -857,7 +861,7 @@ model/tool observations
|
|||
-> durable evidence/map/churn mutation
|
||||
```
|
||||
|
||||
The typed write path exists, the first deterministic observation/evidence distillation path exists, the first deterministic map/churn proposal path exists, and the first verifier-backed promotion gate exists. The first map/churn safety layer also exists: promotion can reject state replacement patches that are not tied to explicit observations/evidence or that contain structurally broken subgoal, invariant, graph, frontier, checkpoint, or churn fields.
|
||||
The typed write path exists, the first deterministic observation/evidence distillation path exists, the first deterministic map/churn proposal path exists, the first proposal-quality hardening layer reuses existing graph nodes by observed code refs, and the first verifier-backed promotion gate exists. The first map/churn safety layer also exists: promotion can reject state replacement patches that are not tied to explicit observations/evidence or that contain structurally broken subgoal, invariant, graph, frontier, checkpoint, or churn fields.
|
||||
|
||||
In natural language: current Epiphany can preserve a map, show a map, retrieve evidence for the map, draft one explicit observation/evidence patch, derive a bounded graph/frontier/churn candidate from verified observations with code refs, reject or accept a verified candidate, apply explicit map/evidence/churn edits, and sanity-check those edits before they hit the ledger. It still does not automatically know which observations matter most, invalidate stale graph regions, or coordinate specialist ownership. Teeth are installed; chewing is supervised; the next slices are about taste, not jawbones.
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ This note tracks Epiphany as a fork of Codex with an opinionated modeling archit
|
|||
- a first typed distillation/proposal slice that adds read-only loaded-thread-only `thread/epiphany/distill`, producing deterministic observation/evidence patches for explicit promotion through `thread/epiphany/update`
|
||||
- a first richer promotion-policy slice that treats map/churn/frontier/checkpoint replacements as higher-risk state edits: accepted promotions must be tied to explicit observations and patch evidence, and structural graph/churn mistakes are rejected before the durable update path
|
||||
- a first typed map/churn proposal slice that adds read-only loaded-thread-only `thread/epiphany/propose`, producing candidate graph frontier/churn patches from verified observations with code refs for explicit promotion through `thread/epiphany/promote`
|
||||
- a first proposal-quality hardening slice that reuses existing architecture graph nodes by exact code-ref, same-path overlap, or deterministic path-node id before creating new candidate nodes, and records whether a proposal refines, expands, or updates the map in churn
|
||||
- current phase: Phase 5 semantic distillation/promotion/proposal machinery
|
||||
|
||||
The next job is no longer to prove the retriever exists, sketch the persistent follow-up in prose, invent the first red-pen path, build the first observation proposal surface, make promotion notice broken map/churn replacements, or ship the first read-only map/churn proposal surface. Those parts are landed. The next job is to keep the landing zone honest: do not casually turn `thread/epiphany/retrieve`, `thread/epiphany/distill`, or `thread/epiphany/propose` into durable Epiphany-state writers, and do not widen the explicit indexing/update paths into watcher-driven or GUI-shaped machinery before they earn it.
|
||||
The next job is no longer to prove the retriever exists, sketch the persistent follow-up in prose, invent the first red-pen path, build the first observation proposal surface, make promotion notice broken map/churn replacements, ship the first read-only map/churn proposal surface, or teach proposal to avoid duplicating already-mapped code surfaces. Those parts are landed. The next job is to keep the landing zone honest: do not casually turn `thread/epiphany/retrieve`, `thread/epiphany/distill`, or `thread/epiphany/propose` into durable Epiphany-state writers, and do not widen the explicit indexing/update paths into watcher-driven or GUI-shaped machinery before they earn it.
|
||||
|
||||
## Summary
|
||||
|
||||
|
|
@ -268,7 +269,7 @@ Add tests for:
|
|||
|
||||
## Immediate Next Step
|
||||
|
||||
Treat the current retrieval baseline and explicit indexing follow-up as landed Phase 4. Treat the explicit update path, distillation proposal path, read-only map/churn proposal path, verifier-backed promotion gate, and structural map/churn promotion validation as the active Phase 5 baseline. The next machine gap is no longer "can Epiphany retrieve code?", "can it propose one durable observation patch?", or "can it draft one bounded map/churn candidate?" It can. The next gap is "can Epiphany make better proposal choices from richer evidence without silently promoting them?"
|
||||
Treat the current retrieval baseline and explicit indexing follow-up as landed Phase 4. Treat the explicit update path, distillation proposal path, read-only map/churn proposal path, verifier-backed promotion gate, structural map/churn promotion validation, and first proposal-quality hardening as the active Phase 5 baseline. The next machine gap is no longer "can Epiphany retrieve code?", "can it propose one durable observation patch?", "can it draft one bounded map/churn candidate?", or "can it avoid duplicating an existing graph node when an observation points at already-mapped code?" It can. The next gap is "can Epiphany make better proposal choices from richer evidence without silently promoting them?"
|
||||
|
||||
1. treat the current verified-and-landed query-time hybrid retriever as the Phase 4 slice 1 baseline
|
||||
2. treat the verified and live-smoked `thread/epiphany/index` slice as the bounded persistent-semantic follow-up
|
||||
|
|
@ -276,7 +277,8 @@ Treat the current retrieval baseline and explicit indexing follow-up as landed P
|
|||
4. do not add durable retrieval-summary writes from `thread/epiphany/retrieve` without a clean out-of-band rollout/update semantic
|
||||
5. continue Phase 5 by hardening the layer above the landed distill/propose/promote/update surfaces:
|
||||
- richer typed observation distillation from tool/model outputs
|
||||
- better proposal heuristics for existing graph matching, frontier focus, and churn semantics
|
||||
- better proposal heuristics beyond the current exact-code-ref, same-path, and deterministic-id graph matching
|
||||
- better frontier focus, observation selection, and churn semantics
|
||||
- promotion policy beyond structural validation, but only when it can stay evidence-backed
|
||||
- verifier-backed acceptance/rejection evidence
|
||||
- no hidden retrieval writes
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ Current verified typed state/promotion layer:
|
|||
- experimental loaded-thread-only `thread/epiphany/update`
|
||||
- experimental loaded-thread-only `thread/epiphany/distill`
|
||||
- experimental loaded-thread-only `thread/epiphany/promote`
|
||||
- experimental loaded-thread-only `thread/epiphany/propose`
|
||||
- typed patch shape for observations, evidence, objective, subgoals, invariants, graphs, graph frontier/checkpoint, scratch, churn, and mode
|
||||
- deterministic observation/evidence proposal generation in `epiphany-core`
|
||||
- deterministic map/churn proposal generation in `epiphany-core`, now with first-pass graph-node reuse by exact code-ref, same-path overlap, or deterministic path-node id before new candidate nodes are created
|
||||
- verifier-backed promotion policy evaluation in `epiphany-core`
|
||||
- core `CodexThread.epiphany_update_state(...)` applies the patch to live `SessionState`, bumps revision, persists `RolloutItem::EpiphanyState`, and flushes rollout
|
||||
- replay helpers in both `codex-core` and `epiphany-core` accept an out-of-band Epiphany snapshot before the first real user turn so seed/update snapshots survive resume
|
||||
|
|
@ -187,10 +189,12 @@ What is wired right now:
|
|||
- app-server protocol now declares experimental `thread/epiphany/retrieve`
|
||||
- app-server protocol now also declares experimental `thread/epiphany/index`
|
||||
- app-server protocol now also declares experimental `thread/epiphany/distill`
|
||||
- app-server protocol now also declares experimental `thread/epiphany/propose`
|
||||
- app-server protocol now also declares experimental `thread/epiphany/promote`
|
||||
- app-server protocol now also declares experimental `thread/epiphany/update`
|
||||
- app-server message handling now routes those methods through the core host seam
|
||||
- `thread/epiphany/distill` is the first read-only proposal surface; it returns an `expectedRevision` plus a patch and requires explicit promotion through `thread/epiphany/update`
|
||||
- `thread/epiphany/propose` is the first read-only map/churn proposal surface; it selects verified observations with code refs, focuses existing architecture graph nodes when refs overlap, creates new candidate path nodes only for unmapped surfaces, and returns replacement graphs/frontier/churn for explicit promotion
|
||||
- `thread/epiphany/promote` is the first explicit promotion gate; it rejects failed verifier evidence without mutation and applies accepted candidates through the update path
|
||||
- `thread/epiphany/promote` now has a first richer map/churn safety layer: state replacement patches must carry explicit observations and patch evidence, and subgoal/invariant/graph/frontier/checkpoint/churn structure is validated before the durable update path is called
|
||||
- `thread/epiphany/update` is the first explicit durable Epiphany state write surface; it rejects empty patches, supports optional revision matching, appends observations/evidence, replaces bounded typed fields, increments state revision, and persists immediately
|
||||
|
|
@ -446,9 +450,9 @@ Without that, you get to learn about `symlink_dir failed: ... A required privile
|
|||
|
||||
## Recommended Next Implementation
|
||||
|
||||
Do not restart verification from superstition. Phase 4 retrieval/indexing/core-extraction is already verified, committed, and pushed. Phase 5 distill/propose/promote/update and the first structural promotion safety layer are also landed.
|
||||
Do not restart verification from superstition. Phase 4 retrieval/indexing/core-extraction is already verified, committed, and pushed. Phase 5 distill/propose/promote/update, the first structural promotion safety layer, and the first proposal-quality hardening layer are also landed.
|
||||
|
||||
The durable state seam exists, the turn loop reads it, clients can load typed Epiphany state directly, the first retrieval slice is real, the explicit persistent-semantic indexing path is landed, the distill/propose/promote/update path is live-smoked, and promotion now has a first structural map/churn safety layer. The next clean move is improving proposal quality from richer evidence, not pretending the already-shipped slices still need ceremony.
|
||||
The durable state seam exists, the turn loop reads it, clients can load typed Epiphany state directly, the first retrieval slice is real, the explicit persistent-semantic indexing path is landed, the distill/propose/promote/update path is live-smoked, promotion now has a first structural map/churn safety layer, and proposal now reuses existing architecture nodes before creating new path nodes. The next clean move is improving proposal quality from richer evidence, not pretending the already-shipped slices still need ceremony.
|
||||
|
||||
Current Phase 5 implementation move:
|
||||
|
||||
|
|
@ -457,7 +461,7 @@ Current Phase 5 implementation move:
|
|||
3. keep `thread/epiphany/retrieve`, `thread/epiphany/distill`, and `thread/epiphany/propose` read-only
|
||||
4. continue Phase 5 by hardening the next layer above the distill/propose/promote/update surfaces:
|
||||
- richer map/churn patch generation from verified observations and tool/model outputs
|
||||
- better existing-graph matching, frontier focus, and churn semantics
|
||||
- better existing-graph matching beyond exact refs/same path/deterministic ids, frontier focus, observation selection, and churn semantics
|
||||
- promotion policy beyond structural validation only when the evidence path stays explicit
|
||||
- verifier-backed acceptance/rejection evidence
|
||||
- no GUI, watcher, or specialist-agent machinery yet
|
||||
|
|
|
|||
|
|
@ -101,3 +101,7 @@
|
|||
{"ts": "2026-04-24T21:10:00+01:00", "type": "decision", "status": "ok", "note": "Kept AGENTS.md as durable operating/bootstrap policy rather than volatile status memory. Current phase, next action, and handoff details belong in state/map.yaml, state/evidence.jsonl, and notes/fresh-workspace-handoff.md; AGENTS.md should only point agents to those canonical stores and state stable discipline."}
|
||||
{"ts": "2026-04-25T02:09:29+01:00", "type": "implementation", "status": "ok", "note": "Landed the first read-only Phase 5 map/churn proposal slice in the working tree. Added epiphany-core/src/proposal.rs with deterministic propose_map_update, thin codex-core re-export, experimental loaded-thread-only thread/epiphany/propose protocol DTOs/routing/handler, and app-server mapping that returns a ThreadEpiphanyUpdatePatch with proposal observation/evidence, graph/frontier replacement, and churn replacement without mutating state."}
|
||||
{"ts": "2026-04-25T02:09:30+01:00", "type": "verification", "status": "ok", "note": "Verified thread/epiphany/propose with cargo fmt, epiphany-core proposal tests including promotion-policy compatibility, codex-core compile via CARGO_TARGET_DIR, codex-app-server-protocol thread_epiphany_ tests, codex-app-server epiphany tests, stable schema fixture regeneration, full codex-app-server-protocol tests, codex-app-server build, and two live app-server stdio smokes. First smoke proved propose returns graph/churn patch at expectedRevision 1 and thread/read remains revision 1 with no persisted churn; second smoke proved distill -> update -> propose -> promote accepts verifier evidence and persists graph/churn at revision 2."}
|
||||
{"ts": "2026-04-25T01:27:58+00:00", "type": "verification", "status": "ok", "note": "Verified proposal-quality hardening with cargo fmt --manifest-path .\\epiphany-core\\Cargo.toml, cargo test --manifest-path .\\epiphany-core\\Cargo.toml proposal, full cargo test --manifest-path .\\epiphany-core\\Cargo.toml, CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex cargo test -p codex-core --lib proposal, and CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex cargo test -p codex-app-server --lib epiphany."}
|
||||
{"ts": "2026-04-25T01:27:58+00:00", "type": "implementation", "status": "ok", "note": "Hardened read-only thread/epiphany/propose proposal quality in epiphany-core. propose_map_update now reuses existing architecture graph nodes by exact code-ref overlap or same-path overlap before creating new candidate path nodes, preserves existing node metadata, merges newly observed refs, and sets churn to proposal_refines_map, proposal_expands_map, or proposal_updates_map with reused/created node counts."}
|
||||
{"ts": "2026-04-25T01:31:16+00:00", "type": "implementation", "status": "ok", "note": "Extended proposal graph-node reuse to include deterministic path-node id fallback as well as exact code-ref and same-path overlap. This preserves old duplicate-id avoidance while still enriching matched nodes with observed refs."}
|
||||
{"ts": "2026-04-25T01:31:16+00:00", "type": "verification", "status": "ok", "note": "Reverified final proposal-quality hardening with cargo fmt, cargo test --manifest-path .\\epiphany-core\\Cargo.toml proposal, full cargo test --manifest-path .\\epiphany-core\\Cargo.toml (24 tests), CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex cargo test -p codex-core --lib proposal, and CARGO_TARGET_DIR=C:\\Users\\Meta\\.cargo-target-codex cargo test -p codex-app-server --lib epiphany."}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ active_subgoals:
|
|||
- Keep the Phase 5 distill/propose/promote/update work aligned with reality in code and repo memory.
|
||||
- Keep vendored Codex as a thin typed host seam while Epiphany-owned prompt and retrieval/indexing logic live in the repo-owned `epiphany-core` crate.
|
||||
- Preserve exact/path lookup and BM25 fallback while the Qdrant path stays explicit and bounded.
|
||||
- Harden the next layer above the landed typed distill/propose/promote/update paths: richer evidence-to-map proposal quality while keeping verifier-backed acceptance/rejection explicit.
|
||||
- Harden the next layer above the landed typed distill/propose/promote/update paths: richer evidence-to-map proposal quality beyond the first graph-node reuse slice while keeping verifier-backed acceptance/rejection explicit.
|
||||
|
||||
accepted_design:
|
||||
- external typed state files
|
||||
|
|
@ -97,6 +97,7 @@ accepted_design:
|
|||
- land Epiphany's first explicit promotion gate as `thread/epiphany/promote`: loaded-thread-only, verifier-backed, rejects failed candidates without mutation, and applies accepted candidates through the existing durable update path
|
||||
- land the first richer map/churn promotion safety layer: state replacement promotions must include explicit observations and patch evidence, and subgoal/invariant/graph/frontier/checkpoint/churn replacements get structural validation in `epiphany-core` before reaching the durable update path
|
||||
- keep Windows app-server verification explicit about stack pressure: Cargo config sets `RUST_MIN_STACK=67108864` so the test binary does not depend on shell folklore or tiny default test-thread stacks
|
||||
- harden read-only map/churn proposal quality incrementally: `thread/epiphany/propose` should reuse existing architecture graph nodes by exact code-ref, same-path overlap, or deterministic path-node id before creating new candidate nodes, preserve existing node identity/metadata, and describe whether the candidate refines, expands, or updates the map in churn
|
||||
|
||||
rejected_paths:
|
||||
- name: pinned_map_only
|
||||
|
|
@ -113,5 +114,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, handoff notes, architecture maps, and a rolling implementation plan against vendored Codex. Phase 1 durable state, Phase 2 prompt integration, the minimal Phase 3 typed read surface, and Phase 4 retrieval/indexing/core-extraction are landed on `main`. Phase 5 semantic distillation/promotion/proposal is now active: the current baseline includes explicit Qdrant indexing with BM25 fallback, typed `thread/epiphany/update`, read-only `thread/epiphany/distill`, read-only `thread/epiphany/propose`, verifier-backed `thread/epiphany/promote`, structural map/churn promotion validation in `epiphany-core`, and thin vendored Codex host seams. The Windows app-server stack-pressure regression was narrowed to test-thread stack size; repo-local Cargo config sets `RUST_MIN_STACK=67108864`, and boxed-future request-dispatch experiments were removed after config-only verification passed. The repo also has source-available/commercial licensing plus a CLA gate for external contributions.
|
||||
next_action: Continue Phase 5 by hardening the layer above `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/promote`, and `thread/epiphany/update`: richer evidence-to-map proposal quality from verified observations and tool/model outputs, while keeping retrieval/distillation/proposal read-only and avoiding watcher, GUI, or specialist-agent machinery.
|
||||
summary: Workspace initialized with protocol files, typed state, handoff notes, architecture maps, and a rolling implementation plan against vendored Codex. Phase 1 durable state, Phase 2 prompt integration, the minimal Phase 3 typed read surface, and Phase 4 retrieval/indexing/core-extraction are landed on `main`. Phase 5 semantic distillation/promotion/proposal is now active: the current baseline includes explicit Qdrant indexing with BM25 fallback, typed `thread/epiphany/update`, read-only `thread/epiphany/distill`, read-only `thread/epiphany/propose`, verifier-backed `thread/epiphany/promote`, structural map/churn promotion validation, first proposal-quality hardening via graph-node reuse in `epiphany-core`, and thin vendored Codex host seams. The Windows app-server stack-pressure regression was narrowed to test-thread stack size; repo-local Cargo config sets `RUST_MIN_STACK=67108864`, and boxed-future request-dispatch experiments were removed after config-only verification passed. The repo also has source-available/commercial licensing plus a CLA gate for external contributions.
|
||||
next_action: Continue Phase 5 by hardening the layer above `thread/epiphany/distill`, `thread/epiphany/propose`, `thread/epiphany/promote`, and `thread/epiphany/update`: richer evidence-to-map proposal quality beyond current exact-ref/same-path/deterministic-id graph matching, better observation/frontier/churn semantics, while keeping retrieval/distillation/proposal read-only and avoiding watcher, GUI, or specialist-agent machinery.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ This file is intentionally disposable.
|
|||
|
||||
## Current Subgoal
|
||||
|
||||
- Continue Phase 5 by hardening the landed read-only map/churn proposal machinery without hidden writes.
|
||||
- Continue Phase 5 proposal-quality hardening beyond the first graph-node reuse slice, without hidden writes.
|
||||
|
||||
## Working Notes
|
||||
|
||||
|
|
@ -12,7 +12,9 @@ This file is intentionally disposable.
|
|||
- First read-only `thread/epiphany/propose` slice is landed in the working tree:
|
||||
- `epiphany-core/src/proposal.rs` owns deterministic `propose_map_update`
|
||||
- selected observations must already exist in thread state, have accepting status, and carry code refs
|
||||
- proposal appends/focuses architecture graph nodes for observed code-ref paths, merges frontier focus, emits proposal observation/evidence, and marks churn `proposal_ready`
|
||||
- proposal now tries exact code-ref overlap, same-path overlap, and deterministic path-node id fallback against existing architecture graph nodes before creating new candidate path nodes
|
||||
- matching nodes are focused and enriched with newly observed refs without overwriting their existing title, purpose, or status
|
||||
- proposal merges frontier focus, emits proposal observation/evidence with reused/created node counts, and marks churn as `proposal_refines_map`, `proposal_expands_map`, or `proposal_updates_map`
|
||||
- app-server exposes experimental loaded-thread-only `thread/epiphany/propose`
|
||||
- live stdio smoke proved propose is read-only, and propose -> promote persists graph/churn only after verifier evidence
|
||||
- The Phase 4 retrieval/indexing/core-extraction anchor is `80c29e0` on `main`. The older `360dfea` commit is only the first hybrid retrieval anchor, and later `main` also includes the typed update/distill/promote surfaces, promotion safety layer, and app-server stack-pressure fix.
|
||||
|
|
|
|||
Reference in a new issue