diff --git a/epiphany-core/src/bin/epiphany-state-ledger-store.rs b/epiphany-core/src/bin/epiphany-state-ledger-store.rs index ef869174..02209c3a 100644 --- a/epiphany-core/src/bin/epiphany-state-ledger-store.rs +++ b/epiphany-core/src/bin/epiphany-state-ledger-store.rs @@ -6,7 +6,6 @@ use epiphany_core::add_state_branch; use epiphany_core::append_state_evidence; use epiphany_core::close_state_branch; use epiphany_core::state_ledger_status; -use std::collections::BTreeMap; use std::env; use std::path::PathBuf; @@ -29,7 +28,6 @@ fn main() -> Result<()> { status: require_string_arg(&mut args, "--status")?, note: require_string_arg(&mut args, "--note")?, branch: optional_string_arg(&mut args, "--branch")?, - extra: BTreeMap::new(), }; print_json(&append_state_evidence(store, record)?)?; } @@ -44,7 +42,6 @@ fn main() -> Result<()> { status: "active".to_string(), artifacts, notes: note.unwrap_or_default(), - extra: BTreeMap::new(), }; print_json(&add_state_branch(store, branch)?)?; } diff --git a/epiphany-core/src/bin/epiphany-state.rs b/epiphany-core/src/bin/epiphany-state.rs index dd1bcdaa..a6a26ae9 100644 --- a/epiphany-core/src/bin/epiphany-state.rs +++ b/epiphany-core/src/bin/epiphany-state.rs @@ -6,7 +6,6 @@ use epiphany_core::add_state_branch; use epiphany_core::append_state_evidence; use epiphany_core::close_state_branch; use epiphany_core::load_state_ledger; -use std::collections::BTreeMap; use std::env; use std::fs; use std::path::Path; @@ -55,7 +54,6 @@ fn main() -> Result<()> { status: status.context("missing --status")?, note: note.context("missing --note")?, branch, - extra: BTreeMap::new(), }, )?; println!("Appended evidence record."); @@ -93,7 +91,6 @@ fn main() -> Result<()> { status: "active".to_string(), artifacts, notes: note.unwrap_or_default(), - extra: BTreeMap::new(), }, )?; println!("Added branch '{id}'."); diff --git a/epiphany-core/src/state_ledger.rs b/epiphany-core/src/state_ledger.rs index 3556e8cf..ed5c1f93 100644 --- a/epiphany-core/src/state_ledger.rs +++ b/epiphany-core/src/state_ledger.rs @@ -6,7 +6,6 @@ use cultcache_rs::SingleFileMessagePackBackingStore; use serde::Deserialize; use serde::Serialize; use serde_json::Value; -use std::collections::BTreeMap; use std::path::Path; pub const STATE_LEDGER_STORE_TYPE: &str = "epiphany.state_ledger"; @@ -22,8 +21,6 @@ pub struct EpiphanyStateLedgerEntry { pub branches: Vec, #[cultcache(key = 2)] pub evidence: Vec, - #[cultcache(key = 3, default)] - pub extra: BTreeMap, } #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] @@ -33,8 +30,6 @@ pub struct EpiphanyBranchRecord { pub status: String, pub artifacts: Vec, pub notes: String, - #[serde(flatten)] - pub extra: BTreeMap, } #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] @@ -46,8 +41,6 @@ pub struct EpiphanyLedgerEvidenceRecord { pub note: String, #[serde(default, skip_serializing_if = "Option::is_none")] pub branch: Option, - #[serde(flatten)] - pub extra: BTreeMap, } pub fn state_ledger_status(store_path: impl AsRef) -> Result { @@ -178,7 +171,6 @@ fn default_state_ledger() -> EpiphanyStateLedgerEntry { schema_version: STATE_LEDGER_SCHEMA_VERSION.to_string(), branches: Vec::new(), evidence: Vec::new(), - extra: BTreeMap::new(), } } @@ -228,7 +220,6 @@ mod tests { status: "active".to_string(), artifacts: vec!["state/map.yaml".to_string()], notes: "test".to_string(), - extra: BTreeMap::new(), }, )?; let entry = load_state_ledger(&store)?; @@ -242,7 +233,6 @@ mod tests { status: "ok".to_string(), note: "Native evidence append works.".to_string(), branch: Some("main".to_string()), - extra: BTreeMap::new(), }, )?; assert_eq!(load_state_ledger(&store)?.evidence.len(), 1); diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index a3793950..a1a2c4b8 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -39,6 +39,7 @@ remembers doctrine; the branch remembers the blade. - `epiphany-openai-runtime` worker result ingress now parses assistant output directly into typed role/reorient ingress structs selected from the durable launch document, stores nested `statePatch` and `selfPatch` as typed MessagePack in `EpiphanyRuntimeRoleWorkerResult`, and no longer passes worker result data through generic `serde_json::Value`. JSON survives there only as the OpenAI text-output edge before typed deserialization. - Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. JSON-value selfPatch functions are compatibility wrappers for CLI/artifact ingress; native callers should parse once at the edge and then call `review_agent_self_patch_document` / `apply_agent_self_patch_document`. Role-result self-persistence no longer exports a JSON-value reviewer; the live API is `review_role_self_patch_document`. - Durable Ghostlight role dossiers now store typed relationship, event, scene, and perceived-overlay documents instead of `Vec`, and the durable dossier structs no longer preserve flattened unknown `extra` maps. `AgentSelfPatch.extra` remains deliberately, but only as an ingress rejection ledger for unexpected patch fields. +- The native state ledger is closed typed state now: branch and evidence records no longer preserve flattened `extra` maps. Evidence entries are explicit `ts` / `type` / `status` / `note` / optional branch records. - `epiphany-openai-codex-spine` no longer uses Codex's Responses client, model-provider layer, `codex-api`, `codex-model-provider`, `codex-model-provider-info`, or `codex-protocol` for outbound model requests. It reaches `codex-login` only through `epiphany-openai-auth-spine` so credential loading/refresh stays Codex-compatible while request/status/event/runtime surfaces stay typed Epiphany documents. - `notes/epiphany-memory-graph-unified-plan.md` is the current memory architecture direction drawn from `Fractal Domains And The Cache That Bites` plus the VoidBot memory scar tissue. The repo semantic architecture/dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. The first native skeleton is landed: `epiphany-state-model` owns shared graph document types, `epiphany-core::memory_graph` owns stable ids, validation, freshness, context cuts, and CultCache persistence, and `epiphany-memory-graph` can status/validate/context/smoke the store without Qdrant. Qdrant is a contribution cache for typed graph documents, not truth. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans, not rival organs. - Durable Epiphany state types now live in root crate `epiphany-state-model`. `codex-protocol` re-exports them only so old rollout/API callers keep compiling; do not add new durable `Epiphany*` state structs under `vendor/codex`. The deterministic `` prompt renderer also lives beside that typed model now, with prompt text under `epiphany-state-model/src/prompts/`; `epiphany-core` only re-exports it for compatibility. `epiphany-core` imports the native model directly and no longer depends on `codex-protocol`. Pressure derives from native `EpiphanyTokenUsageSnapshot`; Codex token telemetry is mapped at the bridge. Codex rollout/event reconstruction now lives in `codex-core::epiphany_rollout`, where the Codex `RolloutItem` / `EventMsg` types belong. Exact retrieval path matching is native to `epiphany-core`, so `epiphany-core` has no direct vendored Codex crate dependency. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index bc93f186..1fc9e5b3 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 4954cb79..44d43f96 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -100,6 +100,7 @@ accepted_design: - `epiphany-openai-runtime` worker result ingress now parses assistant output directly into launch-kind-specific typed documents and stores typed nested `statePatch` / `selfPatch` payloads as MessagePack inside `EpiphanyRuntimeRoleWorkerResult`; generic `serde_json::Value` no longer mediates role/reorient worker results in that crate. JSON still exists at the OpenAI text edge because the model's output is text, but the runtime boundary after parsing is typed. - Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. The old JSON-value selfPatch functions remain only as edge compatibility wrappers for CLI/artifact ingress; `epiphany-agent-memory-store`, heartbeat rumination application, and repo initialization selfPatch processing parse once at the edge and then operate on typed documents. Role-result self-persistence no longer exports a JSON-value reviewer; native review uses `review_role_self_patch_document`. - Durable Ghostlight role dossiers are typed through their relationship/event/scene/perceived-overlay surfaces now. `EpiphanyAgentMemoryEntry` no longer stores those arrays as `serde_json::Value`, and durable Ghostlight structs no longer carry flattened unknown `extra` bags. `AgentSelfPatch.extra` remains only as an ingress guard so unknown patch keys can be rejected with reasons. + - The state ledger CultCache document is now a closed typed ledger shape. Branch and evidence records no longer carry flattened `extra` maps; evidence additions remain explicit records with `ts`, `type`, `status`, `note`, and optional branch. - Heartbeat durable document/schema types live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`; role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`; heartbeat persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`; heartbeat status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`; the root heartbeat module remains the scheduling/cognition orchestration surface until those responsibilities are split into their own tested seams. Heartbeat timing authority is now typed state: adaptive pacing, scene protocol, participant personality/mood timing, initiative heat projection, birth personality seed receipts, and pending-turn freeze/multiplier facts are named fields rather than `extra` maps. The only remaining heartbeat `extra` bag is the sealed legacy combined-state reader for old `voidRoutine` migration. - Heartbeat role/default and store seams are pinned by module-local unit tests for fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip. - Heartbeat adaptive pacing lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`; it owns pressure/concurrency derivation, running-turn count, initiative heat projection, and effective cooldown multipliers for scheduler/projection callers.