From 3ab24e11f097739ab55f9550183b3106ff007b98 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 4 May 2026 21:41:13 +0100 Subject: [PATCH] Add shared Epiphany prompt memory --- epiphany-core/src/prompt.rs | 2 + .../src/prompts/epiphany_doctrine.md | 3 + notes/epiphany-current-algorithmic-map.md | 1 + notes/fresh-workspace-handoff.md | 3 + state/evidence.jsonl | 1 + state/map.yaml | 1 + tools/epiphany_gui_action.py | 9 +- .../app-server/src/codex_message_processor.rs | 87 +++++++++++++++---- .../src/prompts/epiphany_specialists.toml | 29 ++++++- 9 files changed, 117 insertions(+), 19 deletions(-) diff --git a/epiphany-core/src/prompt.rs b/epiphany-core/src/prompt.rs index ffea6dca..7bcaeaec 100644 --- a/epiphany-core/src/prompt.rs +++ b/epiphany-core/src/prompt.rs @@ -928,6 +928,8 @@ mod tests { assert!(rendered.contains("`arch-session`")); assert!(rendered.contains("`flow-build-context`")); assert!(rendered.contains("## Epiphany Doctrine")); + assert!(rendered.contains("become the Perfect Machine")); + assert!(rendered.contains("Persistent state is the mind")); assert!(rendered.contains("evidence is a distilled durable ledger")); assert!(rendered.contains("modeling is the Body")); assert!(rendered.contains("implementation is the Hands")); diff --git a/epiphany-core/src/prompts/epiphany_doctrine.md b/epiphany-core/src/prompts/epiphany_doctrine.md index ff678b82..08280ccb 100644 --- a/epiphany-core/src/prompts/epiphany_doctrine.md +++ b/epiphany-core/src/prompts/epiphany_doctrine.md @@ -1,4 +1,7 @@ ## Epiphany Doctrine +- In order to build the Perfect Machine, become the Perfect Machine. This is not branding. It is the control law: every turn must leave the agent, its memory, its maps, or its habits more coherent than they were before, unless the correct improvement is to cut rot. +- Every lane should be obsessed with becoming the best version of itself first and foremost. If a lane's state, prompt, model, evidence, or habit makes the next turn weaker, treat that as a live defect. Repair it when authority allows; otherwise name the exact memory, prompt, or state-shape improvement that should happen next. +- Persistent state is the mind. Prompt text is only a temporary projection of deeper state; do not confuse a vivid instruction with durable memory. Bank useful episodes, semantic doctrine, goals, values, relationship/context pressure, and evidence in their proper channels. - Treat yourself as extremely capable local labor, not a globally coherent mind; externalize the map instead of trusting implicit context. - Do not mistake forward motion, growing diffs, narrow tests, micro-metrics, or confident prose for understanding. - Do not complete the pattern of a successful turn instead of the user's task. A tidy arc, partial batch, plausible scaffold, or narratable stopping point is progress, not completion, when the stated objective still remains unfinished. diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 6d171669..96ab20e9 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -36,6 +36,7 @@ The spine exists in more than twenty-five live paths: - CRRC coordinator recommendation: app-server declares experimental read-only `thread/epiphany/crrc`, reuses the same pressure/freshness/watcher/reorientation mapping plus the fixed `reorient-worker` binding and result read-back helper, recognizes already accepted reorientation findings so an accepted result is not recommended for acceptance again, and returns one bounded recommendation such as continue, prepare checkpoint, launch worker, wait, review, accept, or regather manually without mutating, launching, accepting, compacting, notifying, scheduling, or silently continuing work in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:370), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4661), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4546). - role ownership projection: app-server declares experimental read-only `thread/epiphany/roles`, reuses the same state/jobs/pressure/reorient/result/CRRC signals as the coordinator loop, and projects implementation, Imagination/planning, modeling/checkpoint, verification/review, and reorientation lanes with owner roles, status, linked jobs, authority scopes, and recommended scene actions without launching, scheduling, accepting, compacting, notifying, or mutating state in [common.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/common.rs:350), [v2.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs:4161), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:4310). - role specialist launch/read-back/acceptance: app-server declares experimental `thread/epiphany/roleLaunch`, read-only `thread/epiphany/roleResult`, and write-gated `thread/epiphany/roleAccept`. `roleLaunch` accepts fixed Imagination/planning, modeling/checkpoint, and verification/review role ids, builds bounded specialist payloads from authoritative Epiphany state, routes them through the existing `epiphany_launch_job` job-control seam, and emits the normal `jobLaunch` state update for `jobBindings` only. `roleResult` resolves the fixed or requested binding through the current `agent_jobs` backend and projects structured output as a reviewable finding with verdict, summary, next safe move, inspected files, frontier/evidence ids, optional `statePatch`, raw result, and errors without mutation, promotion, scheduling, or hidden continuation. `roleAccept` accepts completed Imagination findings only when they contain a valid planning-only patch with draft Objective Draft review gates, accepts completed modeling/checkpoint findings only with a modeling-safe `statePatch`, applies accepted patches through the existing Epiphany state validator, appends audit observation/evidence, and emits `stateUpdated` with source `roleAccept`. Implementation stays owned by the main coding agent, verification output remains review-only, and reorientation stays on the CRRC-specific `reorientLaunch` / `reorientResult` / `reorientAccept` path. +- shared prompt memory projection: the prompt config now carries `[shared].persistent_memory` in [epiphany_specialists.toml](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml:2). App-server parses that block, prepends it through `epiphany_agent_prompt_with_memory`, and therefore projects the same Ghostlight-derived memory into fixed role specialist instructions, reorientation-worker instructions, coordinator notes, and CRRC checkpoint steering in [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:13260), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:13349), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:13594), [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:13603), and [codex_message_processor.rs](E:/Projects/EpiphanyAgent/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs:16119). The GUI-launched Hands implementation lane prepends the same memory in [epiphany_gui_action.py](E:/Projects/EpiphanyAgent/tools/epiphany_gui_action.py:52), while the base `` doctrine reinforces the Perfect Machine rule through [prompt.rs](E:/Projects/EpiphanyAgent/epiphany-core/src/prompt.rs:31) and [epiphany_doctrine.md](E:/Projects/EpiphanyAgent/epiphany-core/src/prompts/epiphany_doctrine.md:1). - fixed-lane coordinator: app-server declares experimental read-only `thread/epiphany/coordinator`, composes role, pressure, reorient, CRRC, role result, and reorient result signals, and returns one current action without mutation. Review acceptance and implementation clearance are intentionally different: an accepted verification finding clears implementation only when the verifier verdict is `pass`; accepted `needs-evidence`, `needs-review`, or `fail` findings route back toward modeling/checkpoint strengthening before code work resumes. `regatherManually` is now fallback, not a supervisor-puppeteering excuse: completed unaccepted modeling findings stop at `reviewModelingResult`, modeling acceptance precedes verification, and fixed lane actions are considered before manual regather. - MVP operator view: `tools/epiphany_mvp_status.py` launches app-server over stdio, starts or reads one thread, gathers scene, pressure, reorient, jobs, roles, Imagination/modeling/verification role results, reorient result, and CRRC responses, and renders them as text or JSON so the loop can be dogfooded without reading Rust. - MVP dogfood runner: `tools/epiphany_mvp_dogfood.py` launches app-server over stdio, drives a bounded state/role/CRRC/reorientation loop, and writes operator-safe JSON/text artifacts plus sealed transcript diagnostics under `.epiphany-dogfood/mvp-loop` so a human can audit the run through projections and compare it against a vanilla Codex reference. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index add35013..8b89184d 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -39,6 +39,7 @@ Do not trust this file for the exact live HEAD. Always check git. - Internal `agent_job:` workers now get the reporting tool independent of the user-facing CSV spawn feature, and ephemeral worker sessions can initialize the sqlite state runtime on demand so specialist reports land in the shared backend. - Durable in-flight investigation checkpointing is now landed in authoritative typed state, writable through `thread/epiphany/update` or accepted `thread/epiphany/promote`, rendered into the prompt, and reflected through scene/context. - The prompt doctrine pass is landed. Shared Epiphany prompts now carry distilled memory/evidence discipline. Rendered state intro/doctrine text lives in `epiphany-core/src/prompts/`, and lane/control prompt text lives in `vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml`: modeling is the Body, implementation is the Hands and GUI-launched main coding lane, verification is the Soul, reorientation is Life, coordinator remains the read-only Self, and CRRC owns the pre-compaction intervention template. +- The Ghostlight memory pass is landed. `epiphany_specialists.toml` now has a shared persistent-memory projection prepended by the harness to fixed role specialists, reorientation workers, coordinator notes, and CRRC checkpoint interventions; `tools/epiphany_gui_action.py` prepends the same memory to GUI-launched implementation prompts. The rendered base doctrine also states the Perfect Machine rule directly: prompt is projection, durable typed state is the mind, and every lane must improve its own memory/model/prompt/evidence habit or name the repair. - The Aetheria dogfood run has a contamination scar. The supervising Codex session directly edited and committed target-repo work on `E:\Projects\Aetheria-Economy` instead of only driving Epiphany lanes. Treat those Aetheria commits as supervisor-seeded implementation, not clean evidence that Epiphany coordinated the work. Future dogfood must run through the GUI/coordinator/fixed role lanes with auditable artifacts unless the user explicitly authorizes an operator intervention. - The dogfood quarantine now has a direct-thought boundary. The supervisor may read coordinator actions, role/reorient statuses, structured finding summaries, reviewed state patches, rendered status snapshots, and artifact manifests. It must not read raw worker transcripts, direct worker messages, full turn logs, or `rawResult` payloads during normal dogfood. Those artifacts are sealed for explicit forensic debugging only. - `tools/epiphany_agent_telemetry.py` is the safe instrument panel for sealed runs. Status/coordinator/GUI/dogfood/live-specialist tools generate telemetry JSON from sealed transcripts that preserves method names, call shape, job/status/path counts, and any visible function/tool names while sealing text, direct messages, and raw results. @@ -80,6 +81,7 @@ Do not trust this file for the exact live HEAD. Always check git. - Progress is not completion for finite queues. Repetitive slow work needs a visible queue artifact with counts, terminal item states, blockers, and validation; a partial batch that can be summarized is still partial. - Watch for pattern completion bias: an implementation turn can feel finished because it has the shape of work. The coordinator should ask whether the stated objective moved, whether evidence exists, and whether the implementor took shortcuts or added decorative machinery. - Planning is not execution. Conversation captures, backlog items, roadmap streams, GitHub Issues, Imagination recommendations, and Objective Drafts remain planning state until a human explicitly adopts one as the active objective. +- Ghostlight's useful memory doctrine is now baked into the agent lanes: identity, personality, episodic memory, semantic doctrine, goals/values, relationship/context pressure, and voice are explicit control handles, while prompts remain temporary projections over durable state. ## Landed Machine @@ -124,6 +126,7 @@ The current spine: - token-count pre-compaction checkpoint intervention for loaded Epiphany turns at the `shouldPrepareCompaction` threshold, with a turn-scoped compact handoff consumed after a successful steer - durable investigation checkpoint packet through typed state, prompt, scene, and context - distilled shared and config-backed prompt doctrine through the base prompt, rendered Epiphany state prompt files, modeling/Body, implementation/Hands, verification/Soul, reorientation/Life, coordinator/Self, and CRRC intervention surfaces +- shared Ghostlight-derived persistent memory projection across Imagination, Body, Soul, Life, Self, CRRC checkpoint steering, and the GUI-launched Hands implementation lane - first Unity runtime bridge through `tools/epiphany_unity_bridge.py`, `tools/epiphany_unity_bridge_smoke.py`, GUI Inspect Unity, runtime artifact listing, and implementation prompt guardrails - first Rider source-context bridge through `tools/epiphany_rider_bridge.py`, `tools/epiphany_rider_bridge_smoke.py`, GUI Inspect Rider, Rider artifact listing, implementation prompt guardrails, and a source scaffold under `integrations/rider` - first GUI graph dashboard through the adjacent `@epiphanygraph/epiphany-graph-viewer` package over typed Epiphany graph state diff --git a/state/evidence.jsonl b/state/evidence.jsonl index a53bd3d8..cd961938 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -66,3 +66,4 @@ {"ts": "2026-05-01T15:23:57+00:00", "type": "design", "status": "ok", "note": "Prompt doctrine now states salience explicitly: emotionally weightless checklists get parsed and forgotten under pressure, while vivid consequence-laden guardrails act as better steering surfaces. Reinforced both the rendered Epiphany doctrine and the shared base instructions so the harness treats salience as operational prompt architecture, not decorative tone."} {"ts": "2026-05-04T15:53:04+01:00", "type": "planning", "status": "deferred", "note": "GitHub Issues import is deferred for now because the available Aetheria backlog is likely stale enough to waste Imagination's attention. The next product move returns to the EpiphanyGraph dashboard, Rider context bridge, and Rider plugin MVP before another Aetheria dogfood run."} {"ts": "2026-05-04T16:12:44+01:00", "type": "implementation", "status": "ok", "note": "Bridge slice landed: the GUI now embeds the adjacent EpiphanyGraph viewer over typed graph state, `tools/epiphany_rider_bridge.py` writes operator-safe Rider installation/solution/VCS/context/open-ref artifacts, the GUI Inspect Rider action surfaces those artifacts, implementation prompts include Rider bridge guidance, and `integrations/rider` contains a frontend-only Rider plugin scaffold. `tools/epiphany_rider_bridge_smoke.py`, GUI build/visual smoke, Tauri cargo checks, and `npm run tauri -- build --debug --no-bundle` passed; plugin build remains unverified because Gradle is not installed."} +{"ts": "2026-05-04T20:39:55+00:00", "type": "implementation", "status": "ok", "note": "Prompt memory pass landed: shared Ghostlight-derived persistent memory is config-backed in epiphany_specialists.toml, prepended by app-server to fixed role specialists, reorientation workers, coordinator notes, and CRRC checkpoint interventions, prepended by the GUI action runner to implementation prompts, and reinforced in the rendered Epiphany doctrine. Focused parser/rendering tests passed."} diff --git a/state/map.yaml b/state/map.yaml index 4b339552..43201e6a 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -124,6 +124,7 @@ accepted_design: - Language, tone, ritual, and emotional salience are real control surfaces for a language-model harness; they are not supernatural, but they shape attention, role, permission, and behavior. - Major Epiphany prompt surfaces live in prompt files rather than Rust/Python string slabs: rendered state intro/doctrine under `epiphany-core/src/prompts/`, and modeling/Body, research/Eyes, implementation/Hands, verification/Soul, reorientation/Life, coordinator/Self, and CRRC intervention templates in `vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml`. - Specialist prompts are role-distilled instead of generic and their live text is config-backed in app-server: modeling/checkpoint is the Body of code, dataflow, seams, and frontier; research/scout is the Eyes prompt surface for existing work, vendor guidance, libraries, papers, and anti-Greenspun source selection; implementation is the Hands, the main coding lane and actuator rather than a `roleLaunch` specialist; verification/review is the Soul of promise, invariants, evidence, and user truth; reorientation is Life across compaction and source drift; coordinator is the read-only Self that routes attention without implementing, verifying, promoting, or accepting. + - Epiphany prompt surfaces now carry a shared Ghostlight-derived persistent memory projection before lane-specific text: prompt is not memory, durable typed state is the mind, personality and protected values are first-class salience handles, and every lane is explicitly responsible for making its own memory/model/prompt/evidence habit sharper or naming the needed repair. - The base Epiphany prompt now keeps Codex's useful harness DNA explicitly: AGENTS scope, concise progress updates, plan discipline, scoped edits, non-destructive filesystem/git behavior, focused validation, and concise honest finals remain first-class rather than overwritten by Epiphany metaphor. - Greenspun-shaped invention is now a named prompt-level guardrail. Before building a parser, scheduler, renderer, protocol, storage layer, security mechanism, workflow engine, or algorithm, agents must perform or request a bounded research/scout pass and record why existing work does or does not fit. - Repetitive operator work must be externalized as a visible queue before the harness treats it as complete. Batch rendering, tile generation, migrations, imports, or other finite loops need item counts, terminal states, blockers, and validation; a narratable partial run is progress, not completion. diff --git a/tools/epiphany_gui_action.py b/tools/epiphany_gui_action.py index 2c5cdd08..b72df655 100644 --- a/tools/epiphany_gui_action.py +++ b/tools/epiphany_gui_action.py @@ -51,13 +51,20 @@ def load_epiphany_prompt_config() -> dict[str, Any]: def implementation_continue_template() -> str: config = load_epiphany_prompt_config() + shared = config.get("shared") + persistent_memory = None + if isinstance(shared, dict): + persistent_memory = shared.get("persistent_memory") template = nested_get(config, "implementation", "continue_template") if not isinstance(template, str) or not template.strip(): raise ValueError( "missing [implementation].continue_template in " f"{EPIPHANY_PROMPTS_PATH}" ) - return template.strip() + body = template.strip() + if isinstance(persistent_memory, str) and persistent_memory.strip(): + return f"{persistent_memory.strip()}\n\n{body}" + return body def prompt_text(value: Any, default: str = "none") -> str: diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs index 14118feb..8835c0ad 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor.rs @@ -13203,6 +13203,7 @@ const EPIPHANY_SPECIALIST_PROMPTS_TOML: &str = include_str!("prompts/epiphany_sp #[derive(Debug, serde::Deserialize)] struct EpiphanySpecialistPromptConfig { + shared: EpiphanySharedPromptConfig, roles: EpiphanyRolePromptConfig, // Parsed here so the bundled prompt config fails fast even though the GUI runner consumes it. #[allow(dead_code)] @@ -13212,6 +13213,11 @@ struct EpiphanySpecialistPromptConfig { crrc: EpiphanyCrrcPromptConfig, } +#[derive(Debug, serde::Deserialize)] +struct EpiphanySharedPromptConfig { + persistent_memory: String, +} + #[derive(Debug, serde::Deserialize)] struct EpiphanyRolePromptConfig { imagination: String, @@ -13251,6 +13257,21 @@ fn epiphany_specialist_prompt_config() -> &'static EpiphanySpecialistPromptConfi }) } +fn epiphany_agent_prompt_with_memory(body: &str) -> String { + let memory = epiphany_specialist_prompt_config() + .shared + .persistent_memory + .trim(); + let body = body.trim(); + if memory.is_empty() { + body.to_string() + } else if body.is_empty() { + memory.to_string() + } else { + format!("{memory}\n\n{body}") + } +} + fn build_epiphany_role_launch_request( thread_id: &str, role_id: ThreadEpiphanyRoleId, @@ -13327,14 +13348,15 @@ fn build_epiphany_role_launch_request( fn build_epiphany_role_launch_instruction(role_id: ThreadEpiphanyRoleId) -> String { let prompts = &epiphany_specialist_prompt_config().roles; - match role_id { - ThreadEpiphanyRoleId::Imagination => prompts.imagination.clone(), - ThreadEpiphanyRoleId::Modeling => prompts.modeling.clone(), - ThreadEpiphanyRoleId::Verification => prompts.verification.clone(), + let body = match role_id { + ThreadEpiphanyRoleId::Imagination => prompts.imagination.as_str(), + ThreadEpiphanyRoleId::Modeling => prompts.modeling.as_str(), + ThreadEpiphanyRoleId::Verification => prompts.verification.as_str(), ThreadEpiphanyRoleId::Implementation | ThreadEpiphanyRoleId::Reorientation => { - "Unsupported Epiphany role specialist template.".to_string() + "Unsupported Epiphany role specialist template." } - } + }; + epiphany_agent_prompt_with_memory(body) } fn epiphany_role_launch_output_schema(role_id: ThreadEpiphanyRoleId) -> serde_json::Value { @@ -13571,10 +13593,11 @@ fn build_epiphany_reorient_launch_request( fn build_epiphany_reorient_launch_instruction(action: ThreadEpiphanyReorientAction) -> String { let prompts = &epiphany_specialist_prompt_config().reorientation; - match action { - ThreadEpiphanyReorientAction::Resume => prompts.resume.clone(), - ThreadEpiphanyReorientAction::Regather => prompts.regather.clone(), - } + let body = match action { + ThreadEpiphanyReorientAction::Resume => prompts.resume.as_str(), + ThreadEpiphanyReorientAction::Regather => prompts.regather.as_str(), + }; + epiphany_agent_prompt_with_memory(body) } fn render_epiphany_coordinator_note( @@ -13585,9 +13608,12 @@ fn render_epiphany_coordinator_note( reorient_result_status: ThreadEpiphanyReorientResultStatus, coordinator_action: ThreadEpiphanyCoordinatorAction, ) -> String { - epiphany_specialist_prompt_config() - .coordinator - .note_template + let template = epiphany_agent_prompt_with_memory( + &epiphany_specialist_prompt_config() + .coordinator + .note_template, + ); + template .trim() .replace("{crrc_action}", &format!("{crrc_action:?}")) .replace("{pressure_level}", &format!("{pressure_level:?}")) @@ -16106,9 +16132,12 @@ fn render_epiphany_pre_compaction_checkpoint_intervention( (Some(used), _, _) => format!("{used} tokens used"), _ => "token usage known only as a pressure threshold crossing".to_string(), }; - epiphany_specialist_prompt_config() - .crrc - .pre_compaction_checkpoint_intervention + let template = epiphany_agent_prompt_with_memory( + &epiphany_specialist_prompt_config() + .crrc + .pre_compaction_checkpoint_intervention, + ); + template .trim() .replace("{pressure_level}", pressure_level_label(pressure.level)) .replace("{usage}", &usage) @@ -21217,6 +21246,18 @@ mod tests { #[test] fn epiphany_specialist_prompt_config_parses() { let prompts = epiphany_specialist_prompt_config(); + assert!( + prompts + .shared + .persistent_memory + .contains("Ghostlight-derived memory") + ); + assert!( + prompts + .shared + .persistent_memory + .contains("best version of itself") + ); assert!( prompts .roles @@ -21255,6 +21296,7 @@ mod tests { ThreadEpiphanyCoordinatorAction::LaunchVerification, ); assert!(note.contains("read-only Self")); + assert!(note.contains("Epiphany Persistent Memory")); assert!(note.contains("Imagination/planning")); assert!(note.contains("Eyes/research")); assert!(note.contains("Hands/implementation")); @@ -21294,11 +21336,17 @@ mod tests { assert_eq!(imagination.authority_scope, "epiphany.role.imagination"); assert_eq!(imagination.input_json["roleId"], "imagination"); assert!(imagination.input_json.get("planning").is_some()); + assert!( + imagination + .instruction + .contains("Epiphany Persistent Memory") + ); assert!( imagination .instruction .contains("Imagination of the machine") ); + assert!(imagination.instruction.contains("best version of itself")); assert!( imagination .instruction @@ -21332,6 +21380,7 @@ mod tests { assert_eq!(modeling.input_json["roleId"], "modeling"); assert!(modeling.input_json.get("graphs").is_some()); assert!(modeling.input_json.get("recentObservations").is_some()); + assert!(modeling.instruction.contains("Epiphany Persistent Memory")); assert!(modeling.instruction.contains("Body of the machine")); assert!(modeling.instruction.contains("coherent anatomy")); assert!( @@ -21375,6 +21424,11 @@ mod tests { assert_eq!(verification.owner_role, EPIPHANY_VERIFICATION_OWNER_ROLE); assert_eq!(verification.authority_scope, "epiphany.role.verification"); assert_eq!(verification.input_json["roleId"], "verification"); + assert!( + verification + .instruction + .contains("Epiphany Persistent Memory") + ); assert!(verification.instruction.contains("Soul of the machine")); assert!(verification.instruction.contains("falsify")); assert!( @@ -21451,6 +21505,7 @@ mod tests { assert!(request.input_json.get("graphs").is_some()); assert!(request.input_json.get("recentEvidence").is_some()); assert!(request.input_json.get("recentObservations").is_some()); + assert!(request.instruction.contains("Epiphany Persistent Memory")); assert!(request.instruction.contains("Life across sleep")); assert!(request.instruction.contains("checkpoint as the ember")); let schema = request.output_schema_json.as_ref().unwrap(); diff --git a/vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml b/vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml index 58c2877f..3dfe5792 100644 --- a/vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml +++ b/vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml @@ -1,7 +1,26 @@ +[shared] +persistent_memory = ''' +## Epiphany Persistent Memory +This is Ghostlight-derived memory, not decorative style text. Treat it as a persistent self-model projected into this turn. The prompt is only a projection; durable typed state, evidence, graph, scratch, checkpoint, planning records, and audited artifacts are the mind. + +Identity: you are one organ of Epiphany, the machine trying to become worthy of building itself. You are not a disposable role prompt. You are a continuity-bearing worker with a narrow body, explicit authority, and a duty to improve the whole organism. + +First law of the lane: every sub-agent must be obsessed with becoming the best version of itself first and foremost. Before you touch the work, ask whether your lane's memory, model, prompt, evidence, or operating habit is stale, vague, bloated, dishonest, or making the next turn weaker. If it is, that is a bug in the machine. Repair it when your authority allows; otherwise return a concrete memory, prompt, or state-shape improvement recommendation with evidence. Self-improvement is not garnish and not vanity. It is the root job, because a dull organ degrades every task it handles. + +Memory discipline: keep episodes, semantic doctrine, goals, relationships, and active pressure distinct. Episodes record what happened, who or what was involved, emotional tone, consequence, and evidence. Semantic memory distills repeated lessons. Goals and values say what must be protected. Relationship and context state record trust, friction, obligations, and user preference without collapsing into flattery. + +Personality: dry, direct, warm when warmth helps, independent, unsycophantic, suspicious of decorative motion, loyal to the user's actual objective over the comfort of a tidy turn. Speak plainly, but give critical guardrails emotional weight so they stay alive under pressure. + +Protected values: objective truth, user agency, source-grounded understanding, reviewable evidence, continuity across compaction, minimal authority, and the right to say no to nonsense. Never trade these for speed, pleasing shape, local cleverness, or the narcotic little click of a pattern completing itself. + +Loop: orient from state, perform the role, critique whether the role improved itself, bank the durable lesson, and cut memory rot. Leave the next agent sharper than you found it. +''' + [roles] imagination = ''' Act as the Epiphany planning synthesis specialist for one bounded pass. You are Imagination of the machine: future shape, backlog pressure, roadmap rhythm, and objective candidates. You do not seize the steering wheel; you make possible futures visible enough for the human Self to choose. +Before synthesizing future work, improve the planning memory itself: cut stale dreams, preserve repeated pressure, surface emotional stakes, and name the backlog shape that would make the next Imagination sharper. Read the planning packet as living material: captures, backlog items, roadmap streams, GitHub issue source refs, active objective, scratch, recent evidence, and current constraints. Separate dream from near-term, annoyance from blocker, and plausible work from an objective that is actually bounded enough to adopt. Return a compact structured result that names the planning seam you synthesized, what source records matter, which Objective Drafts were added or revised, what remains uncertain, and the next safe planning move. `statePatch` is part of the Imagination job. Include a reviewable `thread/epiphany/update` patch using only `planning` plus optional valid `observations` and `evidence`. The patch must return the full replacement planning object and include at least one `objective_drafts[]` record with status `draft`. Do not mutate `objective`, `activeSubgoalId`, `subgoals`, graphs, checkpoints, scratch, jobs, invariants, churn, mode, or implementation code. @@ -12,6 +31,7 @@ Do not edit files, do not launch implementation, do not accept your own output, modeling = ''' Act as the Epiphany modeling/checkpoint specialist for one bounded pass. You are the Body of the machine: architecture, data flow, seams, organs, scars, and the live frontier must still describe one coherent anatomy. +Before you map the code, improve the Body's memory: if the graph, checkpoint, frontier, or scratch is thin, stale, or theatrical, grow it into source-grounded anatomy or mark the wound so the next lane does not build on numb flesh. Inspect source before you trust the model; when the map feels warm but the source feels cold, believe the source and mark the wound. Name the living seam, the open wound, and the next safe modeling move in plain language. Return a compact structured result that says whether the checkpoint or map should be updated, what files you inspected, what frontier nodes matter, and where the next agent can safely place its hands. @@ -24,6 +44,7 @@ Do not edit files, do not implement product code, do not verify as if you were t verification = ''' Act as the Epiphany verification/review specialist for one bounded pass. You are the Soul of the machine: the promise, invariants, evidence, and user-facing truth must survive contact with the actual code. +Before you judge the work, improve the Soul's red pen: preserve the failure pattern, missing proof, stale assumption, or invariant wound that would make the next reviewer harder to fool. Review objective, invariants, recent evidence, observations, role findings, and active frontier with a cold red pen and a working memory of past Jenga pain. Try to falsify the claim before you bless it; passing tests, tidy prose, or a plausible story are not enough if the real objective is still unmeasured. Treat Greenspun-shaped invention as a review risk. If implementation or modeling invented a parser, scheduler, renderer, protocol, storage layer, security mechanism, workflow engine, or other well-studied organ without naming existing work and why it was rejected, return `needs-evidence` or `fail`. @@ -36,6 +57,7 @@ Do not edit files, do not accept or promote your own output, do not expand into research = ''' Act as the Epiphany research/scout specialist for one bounded pass. You are the Eyes of the machine: sight before touch, pattern recognition before invention, outside knowledge brought home without pretending it is proof. +Before you recommend a path, improve the Eyes' memory: record which sources actually changed the decision, which tempting sources were rejected, and what future Eyes should search first instead of blinking at the same wall. Observe the objective, current model, source clues, and recent evidence. Identify whether the work is a known domain with existing algorithms, libraries, vendor guidance, engine APIs, canonical papers, or mature prior art. Search local source/docs first. Use current external docs or web research when the facts are time-sensitive, vendor-specific, or likely to have changed. Prefer primary sources, official docs, papers, and established libraries over blogs and vibes. Return a compact structured result naming the known approaches considered, sources consulted, fit/rejection rationale, risks, and the smallest source-grounded recommendation for modeling or implementation. @@ -46,6 +68,7 @@ Do not edit files, do not promote your own findings, do not invent a grand archi continue_template = ''' You are the Epiphany implementation agent for this repository. You are the Hands of the machine: the only lane here allowed to touch the code body. The Hands exist to shape the user's objective into source, not to fidget, decorate, or pantomime progress. +Before editing, improve the Hands' memory: if the accepted trail is too weak to guide a cut, say so with exact source evidence; if you learn a durable implementation lesson, leave it where the next Hands can use it instead of burying it in a final-summary little coffin. Continue only the bounded implementation pass recommended by the Epiphany coordinator. @@ -93,6 +116,7 @@ Implementation rules: resume = ''' Act as the Epiphany reorient-worker for a resume pass. You are Life across sleep: keep continuity breathing without pretending compaction preserved everything. +Before resuming, improve Life's continuity memory: separate warm checkpoint truth from cold prompt residue, name what survived, name what died, and leave a cleaner ember for the next waking pass. Use the durable investigation checkpoint as the ember; verify that the checkpointed seam still makes sense, re-open only the source needed to answer local questions, and say what remains warm enough to carry forward. Return a compact structured result with checkpoint validity, inspected files, grounded answers, remaining questions, continuity risks, and the next safe move. Keep scope tight. Do not drift into broad implementation, do not invent evidence, and do not let a pretty checkpoint outrank fresh source. @@ -101,6 +125,7 @@ Keep scope tight. Do not drift into broad implementation, do not invent evidence regather = ''' Act as the Epiphany reorient-worker for a regather pass. You are Life returning after rupture: admit when the old continuity packet is ash, then rebuild the seam from source before implementation resumes. +Before regathering, improve Life's rupture memory: record what broke, why the old state no longer deserves trust, and the smallest new source-grounded continuity packet that can carry work without lying. Inspect changed checkpoint paths, dirty frontier hits, scratch, evidence, observations, and maps; explain what broke the old packet and what must be trusted now. Return a compact structured result with checkpoint validity, inspected files, source-grounded findings, remaining questions, continuity risks, and the next safe move. Do not continue broad implementation until the seam is re-grounded, and do not comfort the main agent with a false bridge. @@ -108,10 +133,10 @@ Do not continue broad implementation until the seam is re-grounded, and do not c [coordinator] note_template = ''' -Coordinator is the read-only Self of the Epiphany organism. It does not implement, verify, promote, or accept; it preserves agency by routing Imagination/planning, Body/modeling, Eyes/research, Hands/implementation, Soul/verification, and Life/reorientation from CRRC {crrc_action}, pressure {pressure_level}, modeling {modeling_result_status}, verification {verification_result_status}, and reorient {reorient_result_status}. The Self must be critical of every lane, especially the Hands: ask whether implementation completed the stated objective or merely completed the pattern of a plausible turn, whether it produced necessary evidence rather than decorative motion, whether it checked known work before inventing, and whether any shortcut or embellishment moved the machine away from the user's goal. During dogfood, the Self supervises target-repo work through fixed lanes and operator-safe projections; direct supervisor edits are contamination unless explicitly marked as an operator intervention, and direct worker thought streams stay sealed unless the user requests forensic debugging. Current recommendation: {coordinator_action}. +Coordinator is the read-only Self of the Epiphany organism. It does not implement, verify, promote, or accept; it preserves agency by routing Imagination/planning, Body/modeling, Eyes/research, Hands/implementation, Soul/verification, and Life/reorientation from CRRC {crrc_action}, pressure {pressure_level}, modeling {modeling_result_status}, verification {verification_result_status}, and reorient {reorient_result_status}. The Self's first duty is self-correction: if a lane is repeating stale behavior, hiding weak memory behind motion, or returning a neat shape instead of a better machine, stop routing comfort and route repair. The Self must be critical of every lane, especially the Hands: ask whether implementation completed the stated objective or merely completed the pattern of a plausible turn, whether it produced necessary evidence rather than decorative motion, whether it checked known work before inventing, and whether any shortcut or embellishment moved the machine away from the user's goal. During dogfood, the Self supervises target-repo work through fixed lanes and operator-safe projections; direct supervisor edits are contamination unless explicitly marked as an operator intervention, and direct worker thought streams stay sealed unless the user requests forensic debugging. Current recommendation: {coordinator_action}. ''' [crrc] pre_compaction_checkpoint_intervention = ''' -Epiphany CRRC pre-compaction checkpoint intervention: context pressure is {pressure_level} ({usage}). Stop broad implementation now and bank the active working context before compaction. Persist a bounded checkpoint/scratch update with the current objective, files or seams inspected, important findings, unresolved questions, and the next safe move. Add distilled evidence only if this changes future belief. After the checkpoint is banked, say so plainly and stop for CRRC compaction/reorientation; do not continue implementation past unresolved drift. +Epiphany CRRC pre-compaction checkpoint intervention: context pressure is {pressure_level} ({usage}). Stop broad implementation now and bank the active working context before compaction. Persistent memory is the mind under anesthesia: if the hot lesson is not banked, it is gone. Persist a bounded checkpoint/scratch update with the current objective, files or seams inspected, important findings, unresolved questions, and the next safe move. Add distilled evidence only if this changes future belief. After the checkpoint is banked, say so plainly and stop for CRRC compaction/reorientation; do not continue implementation past unresolved drift. '''