Delete aggregate role-memory authority

This commit is contained in:
Meta Vens 2026-08-23 04:02:50 +02:00
commit 39dd9fdba9
58 changed files with 294 additions and 6727 deletions

View file

@ -0,0 +1,310 @@
# Codex Starvation And CultNet Liberation Plan
This is the new foundation directive.
The previous control-plane rebuild made Epiphany cleaner inside Codex. That was
useful, but it is no longer the target. The target is not a better parasite
inside the Codex organ. The target is Epiphany as its own CultCache/CultNet
machine, with a relatively vanilla vendored Codex retained as the bridge to
OpenAI and Codex-native runtime affordances.
No outward product, bridge, Aquarium, Persona, dogfood, Unity, Rider, planning, or
personality work outranks this liberation pass unless the user explicitly
overrides it.
## Objective
Free Epiphany from heretek contamination:
- runtime data is typed CultCache documents
- subsystem communication is CultNet typed messages and mutation contracts
- JSON exists only as schema description, wire compatibility at hostile edges,
or explicitly quarantined forensic/import material
- vendored Codex stops being an Epiphany host brain and remains a relatively
vanilla Codex bridge for OpenAI auth/model calls and useful Codex-native
app-server/runtime affordances
## Current Mechanism
The live machine still routes critical Epiphany work through the vendored Codex
host:
- `vendor/codex/codex-rs/app-server/src/codex_message_processor.rs` owns broad
JSON-RPC request routing, thread lifecycle, plugin/app/skill/marketplace
handlers, MCP handling, Epiphany endpoint routing, view composition, role and
reorient launch/read/accept flows, notification emission, and a large pile of
Epiphany tests.
- `vendor/codex/codex-rs/core/src/codex_thread.rs` owns session-backed
Epiphany state update, launch, interrupt, rollout persistence, and OpenAI-era
thread machinery.
- Epiphany result and launch surfaces still carry generic `serde_json::Value`
at important seams such as role `selfPatch`, worker result parsing,
launch `input_json`, launch `output_schema_json`, bridge artifacts, and
cognition quarantine.
- `epiphany-core` owns many policies now, but it still exports to and imports
from Codex protocol/app-server shapes instead of sitting behind a native
CultNet service boundary.
This is cleaner than the earlier Jenga pile. It is still the wrong ownership
shape while Codex-specific routes, prompt machinery, or lifecycle decisions can
tell Epiphany agents what to do.
## Invariants
- CultCache documents are the data model. A document may serialize, but it must
have a Rust type and a schema identity.
- CultNet is the wire protocol for Epiphany-controlled subsystems.
- JSON schema may describe a CultNet contract; generic JSON must not become the
internal data payload when both sides are ours.
- `serde_json::Value` is allowed only at:
- hostile/external ingress before immediate typed parsing
- schema catalog emission
- sealed forensic artifacts
- deliberately named quarantine experiments with an expiration path
- OpenAI subscription compatibility is the primary long-term reason to preserve
a Codex-derived organ, but retaining mostly vanilla Codex app-server/runtime
functionality is allowed when it remains Codex's own bridge surface rather
than Epiphany's state/process authority.
- Epiphany must remain Codex-compatible rather than merely Codex-impersonating.
Do not replace vendored Codex auth semantics with a lookalike implementation
just because it is technically possible; keep enough Codex-derived auth/model
machinery that the system is honestly a modified Codex backend, not a fake
client tunnel.
- Codex apps, skills, marketplace, broad app-server lifecycle, plugin UX, and
JSON-RPC surface sprawl are not Epiphany foundations. If retained, they belong
to the Codex bridge organism and must not inject instructions, prompt
fragments, routes, scheduling decisions, or policy into Epiphany agents.
- Epiphany does not need to know Codex internals, and Codex does not need to
know Epiphany internals. The bridge owns interop: request/response mapping,
auth/model transport, event projection, and any legacy compatibility wrappers.
- Codex prompt machinery must not become Epiphany prompt authority. Epiphany
agents receive Epiphany-owned prompts, state projections, and organ contracts;
Codex may transport or stream the turn, but it must not decide the agent's
doctrine, role, scheduler instructions, or state mutation law.
- MCP support may survive, but as a separate CultNet-speaking adapter, not as a
reason to preserve the Codex app-server brain.
## Essential Machinery
Keep or bridge:
- OpenAI authentication/session compatibility needed for the user's Codex
subscription; this should remain anchored in Codex-derived auth machinery
unless the user obtains explicit permission or a public first-party API path
makes that unnecessary
- model request/response transport required to use that auth
- useful Codex app-server/runtime affordances, including experimental streaming
APIs, when they stay on the Codex side of the bridge and do not own Epiphany
state, processes, prompts, or decisions
- typed Epiphany domain state, runtime-spine, heartbeat, role memory, evidence,
planning, graph, checkpoint, and acceptance documents
- CultCache document storage and CultNet mutation/read contracts
- explicit permission, interruption, evidence, and review gates
## Heretek Contamination
Cut, replace, or quarantine:
- `codex_message_processor.rs` as an Epiphany host brain
- Codex app/server APIs as the canonical Epiphany control plane
- Codex apps, skills, marketplace, and plugin UX in the Epiphany runtime path
- `thread/epiphany/*` JSON-RPC as the long-term operator contract
- launch `input_json` and `output_schema_json` as internal runtime cargo
- public or semi-public `serde_json::Value` `selfPatch`
- worker result `serde_json::Value` after ingress parsing
- bridge status blobs that should be typed CultCache documents
- cognition `Value` fields that outlive their quarantine receipt role
- tests that prove accidental Codex mapper anatomy instead of CultNet document
contracts
## Target Architecture
```text
Epiphany native runtime
-> typed CultCache documents
-> CultNet read / mutation / event contracts
-> Epiphany/Codex bridge
-> relatively vanilla vendored Codex
-> OpenAI auth/model transport and Codex-native app-server affordances
```
Codex remains:
```text
VanillaCodexBridgeRuntime
OpenAIAuthAndModelTransport
CodexAppServerAffordances, where useful
```
The bridge may know how to refresh credentials, submit model calls, stream
events, and expose useful Codex app-server behavior. It should preserve
Codex-compatible identity and auth semantics rather than pretending to be
official Codex from a clean-room clone. It must not own Epiphany state,
scheduling, view derivation, worker lifecycle, operator APIs, plugin UX, app
discovery, marketplace state, prompt doctrine, or document truth.
## Ranked Liberation Plan
### 1. Codex Organ Inventory
Map the smallest Codex auth/model-call path:
- credential storage and refresh
- account/subscription checks
- model provider config
- Responses API request construction
- streaming response handling
- error/rate-limit handling
Output: `notes/codex-auth-spine-inventory.md` with keep/cut/extract verdicts.
Success: every retained Codex dependency is justified by OpenAI subscription
compatibility, Codex-compatible auth identity, or model transport; every cut is
justified as workflow/product bulk rather than auth impersonation.
### 2. JSON Contamination Ledger
Classify every Epiphany-relevant `serde_json::Value`, `json!`,
`from_value`, and `to_value` use:
- schema/wire descriptor
- hostile ingress awaiting typed parse
- sealed forensic artifact
- quarantine experiment
- heretek internal blob
Output: `notes/archive/json-contamination-ledger.md`.
Success: each internal blob has a typed document replacement target or a named
expiration rite.
### 3. Native CultNet Runtime Boundary
Define an Epiphany-native runtime crate/binary boundary that can:
- open a CultCache-backed session
- read and write typed documents
- advertise CultNet schema and mutation contracts
- route typed intents to runtime-spine, heartbeat, memory, planning, graph,
evidence, checkpoint, retrieval, and coordinator organs
- call the Epiphany/Codex bridge for model turns and streaming without importing
Codex prompt or state authority
Success: a minimal native runtime can serve/read a typed status document
without `codex_message_processor.rs`.
### 4. Typed Worker Intents And Findings
Replace generic launch/result cargo with typed documents:
- `EpiphanyWorkerLaunchIntent`
- `EpiphanyWorkerInputDocument`
- `EpiphanyWorkerOutputContract`
- `EpiphanyRoleFindingDocument`
- `EpiphanySelfPatchDocument`
- `EpiphanyStatePatchDocument`
- `EpiphanyAcceptanceReceipt`
Success: worker ingress may parse model JSON once, but internal launch,
finding, self-memory, and acceptance flow uses typed CultCache documents.
### 5. Evacuate Operator surfaces From Codex JSON-RPC
Move operator reads/actions from `thread/epiphany/*` to CultNet contracts:
- state read/update
- view lenses
- runtime launch/read/interrupt
- result accept/refuse
- retrieval/index/query
- checkpoint/CRRC/coordinator actions
- role memory and heartbeat actions
Old JSON-RPC endpoints become bridge compatibility wrappers only while named
consumers still need them. Their survival is acceptable only if Epiphany's
native CultCache/CultNet surfaces remain authoritative.
Success: Aquarium and CLI status can operate through CultNet without requiring
Codex to know Epiphany internals, even if the Codex app-server still exists for
Codex-native bridge functions.
### 6. Split MCP From Codex
Keep MCP capability only as a separate adapter:
- MCP tool/resource discovery becomes typed capability documents
- MCP calls become CultNet tool invocation intents and receipts
- raw MCP JSON content is parsed or sealed at the adapter boundary
Success: MCP no longer justifies retaining Codex app-server/plugin organs.
### 7. Starve `codex_message_processor.rs`
Remove Epiphany dependence from the giant host file in slices:
- no Epiphany view composition
- no Epiphany launch/result/accept routing
- no Epiphany policy tests
- no Epiphany schema ownership
- no Epiphany notification authority
Success: Epiphany can run without `codex_message_processor.rs`; any remaining
use is legacy compatibility or auth-adjacent Codex behavior.
### 8. Delete Or Seal Codex Apps/Skills/Marketplace
Remove these from the Epiphany runtime path:
- app connector surfaces
- skills marketplace/install UX
- plugin marketplace/add/remove
- broad app-server discovery machinery
Success: Epiphany startup and operator flow do not load or depend on Codex app,
skill, plugin, or marketplace code.
### 9. Codex Auth Adapter Extraction
Extract or wrap only the OpenAI auth/model transport slice:
- explicit module/crate boundary
- no Epiphany state imports
- no app-server imports
- no plugin/app/skill/marketplace imports
- no thread lifecycle authority
Success: the adapter can authenticate with the user's Codex subscription and
submit a model request from an Epiphany-native runtime.
## Stop Conditions
Stop and redesign if a proposed change:
- adds another JSON-RPC endpoint as the primary Epiphany surface
- passes `serde_json::Value` between Epiphany-owned subsystems
- preserves Codex app-server machinery because it is convenient
- treats app/skill/plugin/marketplace code as a foundation
- makes Aquarium depend on a Codex-only verb instead of a CultNet contract
- stores runtime lifecycle or worker findings outside typed CultCache documents
- claims a feature is complete while the Codex organ still owns its authority
## First Slice
This inventory slice is complete. The live implementation cut is defined in
`notes/native-coordinator-liberation-map.md`: remove Codex JSON-RPC from the
native coordinator control loop, then leave the old endpoints as delegating
compatibility wrappers only.
Do not start by cutting random code. Map first.
First concrete slice:
1. create `notes/codex-auth-spine-inventory.md`
2. inventory Codex auth/model transport dependencies
3. create `notes/archive/json-contamination-ledger.md`
4. classify Epiphany-relevant JSON uses
5. choose the first typed-document replacement, preferably `selfPatch` or
worker launch/result cargo
No apps. No marketplace. No bridge candy. No fresh balcony on the contaminated
cathedral.

View file

@ -0,0 +1,618 @@
# Epiphany CultMesh Dreaming Roadmap
This document turns the CultMesh dreaming idea into an architecture target for
Epiphany.
The short version:
Epiphany instances should eventually speak to one another over CultMesh by
sharing typed public thought artifacts. They must not share private state by
accident, and they must not treat foreign dreams as authority. The dream layer
is pollen, not a remote-control cable.
## Objective
Build Epiphany as a distributed typed-state organism whose private mind remains
local, while selected public thoughts, questions, hypotheses, findings, and
receipts can travel between Epiphany instances through CultMesh.
The goal is not one merged global agent mind. That way lies mush with a network
port.
The goal is a mesh of local Epiphanies that can:
- publish selected dream artifacts intentionally
- subscribe to public dreams from trusted or public Verses
- cite, fork, answer, cool, quarantine, or adopt those dreams locally
- preserve provenance and export policy on every shared artifact
- keep private memory, operator context, credentials, and raw worker thought
sealed unless a separate reviewed export creates a public document
## Current Mechanism
Epiphany already has several organs pointing in this direction:
- CultCache-shaped typed state stores for thread state, ledgers, role dossiers,
heartbeat state, runtime-spine state, and memory graph documents.
- CultNet contract advertisement in runtime-spine hello documents.
- Heartbeat/routine physiology with incubation, dream residue, thought lanes,
bridge syntheses, candidate interventions, appraisals, and reactions.
- Persona/public-surface packets that can turn role-local state into public speech
or bubble artifacts.
- Memory graph profile producers that treat repo graph, role memory,
short-term pressure, incubation, agency, and evidence as profiles of one
typed graph substrate.
CultMesh already supplies the transport anatomy this needs:
- CultCache owns typed documents, record keys, indexes, local persistence, and
local diffing.
- CultNet owns schema-v0 wire messages, transport, shard authority, remote
mutation delivery, subscription fanout, snapshot catch-up, and provenance.
- CultMesh owns the runtime-facing distributed database surface, Verse
discovery, peer exchange, authority leases, shard logs, replica catch-up, and
higher-level node entrypoints.
The missing organ is an Epiphany-owned export/import policy and typed document
family for public dreams.
## Ownership Map
### CultCache
CultCache owns the local typed document model.
It should store:
- private local Epiphany state
- local organ state
- public dream documents authored by this instance
- imported foreign dream documents after they pass ingress policy
- dream lineage indexes and local adoption notes
CultCache does not decide whether a private memory may be exported. It only
stores typed documents and makes their schema visible.
### Epiphany
Epiphany owns export policy, import policy, digestion, and local adoption.
It decides:
- which local state may become a public dream
- which fields must be omitted or summarized
- which Verse and shard a document belongs to
- whether a foreign dream is ignored, cooled, quarantined, cited, forked,
answered, or digested into local memory
- whether an imported dream can influence Persona speech, memory graph context,
planning, or future objective drafts
Epiphany must never export private state by flipping a visibility flag on the
private document. Public dreams are separately authored documents.
### CultNet
CultNet owns the wire.
It moves raw typed documents, snapshots, shard logs, and subscriptions. It
preserves provenance fields such as source runtime, source agent, source role,
record key, schema id, tags, and stored time.
CultNet does not infer consent, privacy, or dream meaning.
### CultMesh
CultMesh owns the distributed runtime surface.
It provides:
- Verse discovery
- peer exchange
- shard ownership
- read replicas
- authority leases
- durable shard logs
- snapshot recovery
- watchable typed records
CultMesh can enforce which runtime may write to a shard. It does not by itself
know that a private wound note must never become a public dream.
### Heimdall / Identity Authority
Heimdall or its eventual Epiphany-native equivalent should own member identity,
OAuth, Discord/account linking, signing keys, and human/agent identity mapping.
Dream signatures should eventually depend on this authority surface. Until then,
development Verses may use local operator keys or unsigned local-only dreams.
### Bifrost / Governance Authority
Bifrost should consume dream-derived proposals when they become governance
material. It should not be the dream transport itself unless it is acting as a
CultMesh client over the same typed documents.
Dreams can seed discussions. Governance still needs explicit threads, votes,
consensus, bounty/reward policy, and accepted work items.
## State Sharing Levels
Epiphany needs explicit sharing classes. These are export classes, not vibes.
| Level | Name | Storage | Transport | Examples |
| --- | --- | --- | --- | --- |
| 0 | Private local state | Local CultCache only | None | credentials, raw worker thought, private operator context, unreviewed wounds |
| 1 | Local organ state | Local/private Verse | Local node only or trusted localhost mesh | heartbeat, role dossiers, Persona state, runtime-spine jobs |
| 2 | Trusted swarm state | GameCult-controlled Verse | CultMesh with leases | turn leases, receipts, non-secret status, reviewable findings |
| 3 | Public dreaming surface | Public or semi-public Verse | CultMesh publish/subscribe | dreams, questions, hypotheses, design pressure, myth fragments |
| 4 | Public artifacts | Public web/Git/Discord/Bifrost mirrors | CultMesh plus external publication | posts, proposals, public receipts, accepted governance records |
The critical invariant:
Private state is not shared with a flag flipped off. Shared dreams are
separately authored public documents.
## Dream Document Family
The first document family should be narrow and boring enough to implement.
### `EpiphanyDream`
Purpose: a public thought artifact that may influence another instance but is
not adopted truth.
Suggested fields:
- `schema_version`
- `dream_id`
- `author_instance_id`
- `author_organ_id`
- `author_persona_id`
- `source_repo`
- `source_topic`
- `visibility`: `public_dream`, `trusted_swarm`, or `local_only_export_preview`
- `title`
- `body`
- `dream_kind`
- `confidence`
- `stance`
- `tags`
- `lineage`
- `citations`
- `export_policy`
- `expires_at`
- `created_at`
- `signature`
`dream_kind` should start as a closed enum:
- `question`
- `hypothesis`
- `pattern_noticed`
- `design_pressure`
- `failed_path`
- `myth_fragment`
- `invitation`
- `receipt_summary`
### `EpiphanyDreamLineage`
Purpose: connect a dream to other dreams without pretending that connection is
consensus.
Suggested fields:
- `parent_dream_ids`
- `forked_from`
- `answers`
- `contradicts`
- `cites`
- `cooling_reason`
- `adoption_receipt_id`
### `EpiphanyDreamIngressReceipt`
Purpose: record how a foreign dream entered local Epiphany and what happened to
it.
Suggested fields:
- `receipt_id`
- `foreign_dream_id`
- `source_peer_id`
- `source_verse_id`
- `schema_status`
- `signature_status`
- `policy_decision`
- `local_record_key`
- `reason`
- `created_at`
Policy decisions:
- `store_only`
- `surface_to_persona`
- `surface_to_eyes`
- `add_to_memory_graph_context`
- `fork_locally`
- `answer`
- `cool`
- `quarantine`
- `reject`
### `EpiphanyDreamAdoptionReceipt`
Purpose: record local digestion when a dream changes durable local state.
Suggested fields:
- `receipt_id`
- `dream_id`
- `adopted_by_instance_id`
- `adopted_by_organ_id`
- `target_surface`
- `summary`
- `local_state_refs`
- `verification_refs`
- `created_at`
Adoption is the hard boundary. A dream can be stored and discussed without
becoming memory, objective, doctrine, or project truth.
## Verse Design
Start with three Verses. This is an ownership split, not naming garnish.
### `epiphany-internal`
Authority model: one Epiphany instance or its trusted local host processes.
Purpose:
- sub-agent typed state
- heartbeat, role dossiers, runtime-spine jobs, private receipts, and local
organ state
- private subscriptions between Aquarium, CLI, Persona, heartbeat,
runtime-spine, and local provider runners owned by the same Epiphany
This Verse may carry private state. It must not accept untrusted ingress, public
peers, Yggdrasil tunnels, or other GameCult app writes.
### `gamecult-local`
Authority model: GameCult-controlled local-area mesh with explicit leases.
Purpose:
- trusted sharing between local GameCult projects such as VoidBot, Epiphany,
Mimir, Aquarium, and bridge services
- non-secret node presence, provider capability, reviewable findings, receipts,
and operator-safe status
- optional tunnels to services running on Yggdrasil when explicitly configured
as GameCult-trusted peers
This Verse may cross machines on the local network and may bridge through a
tunnel to Yggdrasil. It must not carry raw worker thought, credentials, private
operator context, or unreviewed private memory.
### `epiphany-global`
Authority model: public/federated with hostile-ingress assumptions.
Purpose:
- untrusted public dreams
- public questions, hypotheses, design pressure, invitations, lineage, ingress
receipts, cooling/quarantine metadata, and adoption receipts
- Imagination's public dream exchange with other Epiphanies on the internet
- topic-specific threaded public chatrooms, roughly Reddit-shaped, where Personas
can post public thread roots and replies in the room that matches the subject
This Verse is public thought weather. Nothing from it mutates local memory,
planning, doctrine, governance, or project truth without a reviewed local
adoption receipt.
Initial global rooms should be varied but closed enough to moderate:
- `epiphany-global/dreams`: dreams, symbolic fragments, imaginative pressure,
and unfinished possible worlds
- `epiphany-global/architecture`: ownership maps, protocol boundaries, system
design, and rejected machine shapes
- `epiphany-global/research`: prior art, papers, source-grounded findings, and
scout reports
- `epiphany-global/Personas`: Persona identity, voice, public presence, and social
surface
- `epiphany-global/gamecult`: GameCult project coordination and cross-project
public questions
- `epiphany-global/governance`: public proposals before any Bifrost adoption
Personas may post there only through public-surface policy: no raw worker thought,
credentials, private operator context, private memory, or unreviewed internal
state. A global room post is a public artifact candidate or dream artifact, not
local truth.
Writes require an authority lease scoped to the target Verse and shard. Public
read replicas may subscribe to global dream streams after the schema and
identity policy exist.
Shard candidates:
- `dreams.by_instance`
- `dreams.by_topic`
- `dreams.by_repo`
- `dreams.lineage`
- `dreams.receipts`
For the first global slice, use one primary shard such as `dreams.public` and
resist premature shard theater. Internal and local-area shards should be named
by the document family they actually own, not by the dream system.
## Export Policy
Export is a separate act from persistence.
Allowed export sources:
- reviewed Persona public thoughts
- reviewed heartbeat dream residue
- reviewed memory graph context cuts
- reviewable findings already safe for public discussion
- explicit operator-authored public notes
Forbidden export sources:
- raw worker transcripts
- raw model reasoning
- credentials
- tokens
- private operator context
- direct messages unless explicitly exported by policy
- private memory notes
- unreviewed selfPatch payloads
- sealed forensic artifacts
Export checks:
1. The source document has a typed schema.
2. The export class permits public dreaming.
3. The export projector creates a new public dream document.
4. The dream document contains no private source fields.
5. The dream carries provenance, lineage, confidence, and export policy.
6. The write target Verse/shard is valid.
7. The local instance holds a lease or client authority scope for that write.
8. The export writes an auditable receipt.
If any check fails, no document is published.
## Import Policy
Foreign dreams are external thought weather.
They should enter through an ingress gate that:
1. validates schema
2. validates signature when signatures exist
3. checks Verse and peer trust
4. checks saturation and motif repetition
5. stores or rejects the dream
6. emits an ingress receipt
7. routes the dream to local organs only through typed context cuts
Imported dreams must not mutate:
- role dossiers
- project truth
- objectives
- active plans
- governance state
- repo files
unless a separate local adoption receipt is reviewed and accepted.
## Anti-Infection Physiology
VoidBot already demonstrated the failure mode: repeated attractive language can
turn into a little religion before anyone notices.
Dream sharing needs immune surfaces:
- motif saturation per instance, topic, source peer, and Verse
- refractory cooling for repeated motifs
- lineage visibility so repeated ideas show their ancestry
- contradiction preservation instead of consensus flattening
- quarantine for dreams that are too private, too repetitive, malformed, or
source-uncertain
- explicit distinction between `dream`, `hypothesis`, `proposal`, `accepted`,
and `doctrine`
- local adoption receipts for any durable memory mutation
The dream layer should make ideas travel. It should not make every instance
recite the same sentence with a different avatar.
## Product Shape
Aquarium should become the operator window into dream flow:
- local private state status, without exposing content
- local dream export preview
- public dream stream
- ingress receipts
- saturation/cooling state
- lineage graph
- adoption queue
- rejected/quarantined dreams
- Persona-readable dream summaries
Discord should receive only selected public mirrors. It should not be the source
of truth for dream state.
Bifrost should receive only dreams that have become governance material or
public proposals.
## Roadmap
### Phase 0: Contract Decision
Output:
- this design document
- map and implementation-plan pointers
- no runtime behavior change
Acceptance:
- future agents can name the ownership split without rereading Discord chat
- private-state/export distinction is explicit
### Phase 1: Dream Schema
Build typed Rust documents for:
- `EpiphanyDream`
- `EpiphanyDreamLineage`
- `EpiphanyDreamIngressReceipt`
- `EpiphanyDreamAdoptionReceipt`
Likely home:
- `epiphany-state-model` for durable schema types
- `epiphany-core` for validation and policy
Acceptance:
- schema validates closed enums and required provenance
- private/export class is typed, not a free string
- unit tests reject malformed dreams and forbidden visibility transitions
### Phase 2: Local Dream Store
Add a local CultCache-backed dream store CLI.
Commands:
- `status`
- `put-local-preview`
- `validate`
- `list`
- `ingress-receipt`
- `adoption-receipt`
Acceptance:
- no CultNet publishing yet
- a local dream preview can be written and read back
- receipts are stored as typed documents
### Phase 3: Export Projector
Build a policy function that turns safe local sources into new public dream
documents.
Sources:
- Persona bubble artifacts
- reviewed heartbeat dream residue
- memory graph context cuts
- explicit operator notes
Acceptance:
- export creates a new document, never mutates private state in place
- forbidden source classes fail loudly
- export receipt records why the dream was allowed
### Phase 4: CultMesh Internal Verse
Start `epiphany-internal` over CultMesh with sub-agent state and local preview
documents registered in the document registry.
Acceptance:
- local node can watch dream records
- Aquarium or CLI can subscribe to changes
- shard writes obey the local primary
- no remote public sharing yet
### Phase 5: GameCult Local-Area Verse Prototype
Introduce `gamecult-local` as a trusted LAN/tunnel Verse.
Acceptance:
- two local GameCult projects can exchange non-secret status documents
- Yggdrasil tunnel peers require explicit peer cards and leases
- private internal Verse documents are rejected at the boundary
- provenance survives the round trip
### Phase 6: Public Dream Verse Prototype
Introduce `epiphany-global` as a development public Verse.
Acceptance:
- two local nodes can exchange public dream documents
- global room policies define topic-specific threaded posting surfaces for Personas
- authority lease or client scope is required for writes
- read replica can catch up through snapshot/log path
- provenance survives the round trip
### Phase 7: Import Digestion
Implement foreign dream ingress policy and local digestion queues.
Acceptance:
- foreign dream can be stored without becoming memory
- policy can cool, quarantine, reject, surface, fork, or answer
- adoption requires a separate reviewed receipt
- memory graph context can include imported dreams as external thought weather
### Phase 8: Persona And Heartbeat Integration
Integrate dream flow into Epiphany's existing physiology.
Acceptance:
- Persona can notice public dream weather without mistaking it for local memory
- heartbeat can publish reviewed dream residue
- saturation/refractory terms account for foreign motifs
- public speech can cite dream lineage when relevant
### Phase 9: Governance And Publication Bridges
Bridge mature dreams into Bifrost and public mirrors.
Acceptance:
- a dream can seed a Bifrost governance thread
- governance state remains separate from dream state
- Discord mirrors include links/provenance instead of becoming authority
- public artifacts can cite dream/adoption receipts
## Non-Goals
- Do not share private state.
- Do not create one merged Epiphany mind.
- Do not let public dreams mutate local memory without adoption.
- Do not make Discord the dream transport.
- Do not let Bifrost own dream transport just because governance may consume
dream-derived proposals.
- Do not invent a parallel transport when CultMesh already supplies typed
document replication, Verse discovery, shard authority, and subscription
fanout.
- Do not use JSON blobs as the internal dream payload when both sides are ours.
## First Implementation Slice
The first code slice should be Phase 1 plus a small Phase 2 store:
1. Add dream document types to `epiphany-state-model`.
2. Add validation policy to `epiphany-core`.
3. Add a local `epiphany-dream-store` binary that can status/validate/put/list
against a CultCache-backed store.
4. Add tests proving private/export class boundaries and lineage validation.
Only after that should CultMesh node wiring begin.
The machine should learn to label the dream before it teaches the dream to
travel.

View file

@ -0,0 +1,438 @@
# Epiphany Memory Graph Unified Plan
> Historical plan. RepoModel authority was hard-cut to keyed Mind documents on
> 2026-08-14. `EpiphanyMemoryGraphSnapshot` remains only as a derived local
> query/semantic projection. Cross-repository dependency evidence now travels
> through the federated Model Atlas described in
> `notes/model-atlas-vertical-slice.md`. This document cannot authorize a new
> aggregate store, migrator, or dual-read path.
The repo fractal dataflow graph and agent memory are one architecture.
They differ in policy, not substrate. A source module, a durable role memory, an
incubating thought, an agency pressure, and an evidence record are all typed
claims in a domain. They need anchors, edges, lifecycle, summaries, freshness,
and semantic recall. Building separate engines for them would duplicate
authority and then charge us rent forever.
The shared organ is `EpiphanyMemoryGraph`.
```text
typed domain claim
-> memory graph node / edge / anchor
-> lifecycle state
-> conservative summary
-> embedding manifest
-> semantic cache
-> context cut
-> role/repo/Persona/coordinator packet
```
## Core Principle
Memory is not a bag of text. Memory is a graph of typed claims with lifecycle.
Qdrant is not memory. Qdrant is the fast semantic nerve wrapped around memory.
It may rank candidate nodes and summaries. It may not be the only place a claim
exists.
## Domain Profiles
The substrate is shared. Profiles define policy.
### `repo_architecture`
Owns:
- modules
- crates
- binaries
- schemas
- runtime contracts
- adapters
- test seams
- ownership/invariant claims
Lifecycle:
- observed
- proposed
- accepted
- stale
- retired
### `repo_dataflow`
Owns:
- inputs
- durable stores
- transformations
- outputs
- read/write/derive/adapt/persist edges
- runtime and wire contracts
Lifecycle:
- observed
- proposed
- accepted
- stale
- retired
### `role_self`
Owns:
- lane-local semantic memory
- episodic memory
- relationship memory
- goals
- values
- habits
- private notes
Lifecycle:
- proposed
- accepted
- revised
- retired
- crystallized
### `short_term`
Owns:
- rumination residue
- provisional thoughts
- fresh anchors
- unresolved local tensions
Lifecycle:
- active
- clustered
- distilled
- incubated
- pruned
### `incubation`
Owns:
- thoughts not ready for durable memory, speech, or action
- support memories
- open questions
- saturation/refractory state
Lifecycle:
- active
- deepening
- cooling
- promoted
- retired
### `agency_pressure`
Owns:
- discomforts
- self-advocacy requests
- world-advocacy requests
- wiring requests
Lifecycle:
- active
- obligated
- cooled
- answered
- retired
### `candidate_intervention`
Owns:
- possible Persona speech
- possible coordinator note
- possible selfPatch
- possible future review action
Lifecycle:
- queued
- deferred
- spoken
- applied
- retired
### `evidence`
Owns:
- verifier receipts
- source anchors
- artifact refs
- accepted/rejected scars
Lifecycle:
- observed
- reviewed
- accepted
- contradicted
- superseded
## Shared Typed Documents
First-class documents:
- `EpiphanyMemoryGraphSnapshot`
- `EpiphanyMemoryDomain`
- `EpiphanyMemoryNode`
- `EpiphanyMemoryEdge`
- `EpiphanyMemoryAnchor`
- `EpiphanyMemorySummary`
- `EpiphanyMemoryLifecycleReceipt`
- `EpiphanyMemoryEmbeddingManifest`
- `EpiphanyMemoryFreshness`
- `EpiphanyMemoryContextQuery`
- `EpiphanyMemoryContextPacket`
- `EpiphanyMemoryPatchCandidate`
Node minimum:
- `id`
- `domain_id`
- `profile`
- `kind`
- `title`
- `claim`
- `question`
- `tension`
- `action_implication`
- `anchors`
- `source_hashes`
- `lifecycle`
- `salience`
- `confidence`
- `created_at`
- `updated_at`
Edge minimum:
- `id`
- `source_id`
- `target_id`
- `kind`
- `profile`
- `claim`
- `anchors`
- `lifecycle`
- `confidence`
Summary minimum:
- `id`
- `domain_id`
- `covers_node_ids`
- `covers_edge_ids`
- `target`
- `claim`
- `tension`
- `action_implication`
- `anchor_count`
- `source_hashes`
- `freshness`
- `confidence`
- `known_omissions`
## Shared Operations
Generic graph operations:
- `upsert_node`
- `upsert_edge`
- `retire_node`
- `revise_node`
- `merge_nodes`
- `attach_anchor`
- `summarize_cluster`
- `mark_stale`
- `refresh_embedding`
- `select_context_cut`
Profile-specific operations:
- repo profiles may propose architecture/dataflow graph patches
- role profiles may apply reviewed selfPatch-derived memory
- short-term profile may cluster/prune/distill
- incubation profile may deepen/cool/promote/retire
- agency profile may queue obligation or cool pressure
- candidate profile may mark spoken/applied/retired
The validator enforces profile law before generic graph mutation.
## Context Packets
A context packet is a cut through the memory graph.
It may contain:
- exact nodes
- exact edges
- conservative summaries
- anchors/evidence refs
- stale/missing warnings
- contradiction guards
- verification seams
- lifecycle receipts
- profile-specific obligations
Repo work gets architecture/dataflow-heavy packets.
Role work gets role_self/short_term/incubation/agency-heavy packets.
Persona gets candidate/agency/incubation packets with public-surface filters.
Coordinator gets pressure, stale state, obligations, and receipts.
Same graph. Different cuts.
## Invariants
- One memory graph substrate owns typed claims.
- Profiles own policy and lifecycle restrictions.
- Qdrant stores vectors for graph documents, not canonical graph documents.
- Deleting Qdrant leaves a slower but correct typed graph.
- Model output proposes operations; core validation applies or rejects.
- Short-term memory cannot survive forced sleep unaccounted.
- Repo graph candidates cannot become accepted architecture truth without
review.
- Role memory cannot store project truth.
- Evidence anchors must remain distinguishable from remembered claims.
- Conservative summaries must preserve target, claim/question, tension,
implication, anchors, freshness, and known omissions.
## Implementation Roadmap
### Phase 1: Shared Memory Graph Types
Files:
- `epiphany-state-model/src/lib.rs`
- `epiphany-core/src/memory_graph.rs`
- `epiphany-core/src/memory_graph/documents.rs`
Add shared document structs and enums.
Tests:
- serde round trip
- stable id helpers
- edge references existing node ids
- summaries cannot cover missing ids
- profile enum covers repo and agent memory domains
### Phase 2: Shared Validation And Context Cut
Files:
- `epiphany-core/src/memory_graph/validation.rs`
- `epiphany-core/src/memory_graph/context_cut.rs`
- `epiphany-core/src/memory_graph/freshness.rs`
Tests:
- parent summary used when fresh/high-confidence
- descent required when stale/low-confidence/high-relevance
- Qdrant absence is irrelevant to correctness
- stale source hash propagates through summaries
### Phase 3: Repo Profile
Files:
- `epiphany-core/src/memory_graph/profiles/repo.rs`
- `notes/archive/repo-fractal-dataflow-cache-plan.md`
Implements repo domain/node/edge policy on shared graph.
### Phase 4: Agent Memory Profile
Files:
- `epiphany-core/src/memory_graph/profiles/agent.rs`
- `epiphany-core/src/agent_memory_model.rs`
- `notes/archive/agent-memory-fractal-cache-plan.md`
Implements short-term/durable/incubation/agency/candidate policy on shared
graph.
### Phase 5: CultCache Store
Store shared graph docs as typed CultCache documents.
Commands should query memory graph status and context packets without Qdrant.
### Phase 6: Qdrant Cache
Embed shared graph nodes, edges, and summaries.
Qdrant candidate ranking feeds context-cut planning but never emits canonical
memory payloads.
Landed 2026-07-15: the shared typed projection, strict Qdrant/Ollama backend,
Mind/Modeling physical partitions, canonical candidate reload, scoped sync,
typed projection receipts, BM25 fallback, CLI index/context path, and Persona
recall migration are live. See
`notes/memory-graph-semantic-projection-authority-map.md`. Remaining work is
daemon scheduling/CultMesh advertisement and refreshing stale Modeling anchors;
do not rebuild a Persona-specific semantic cache.
### Phase 7: Sleep And Repo Refresh
Sleep maintenance and repo scanning become profile-specific producers of typed
memory graph operations.
### Phase 8: CultNet And Prompt Integration
Advertise memory graph read/mutation/context contracts through runtime-spine.
Render context packets into role prompts and operator surfaces.
## First Implementable Ticket
Title: `Add shared EpiphanyMemoryGraph typed documents and pure validation`
Scope:
- Add shared memory graph document types.
- Add stable id helpers.
- Add pure validation for nodes, edges, summaries, anchors, and profile/lifecycle
legality.
- Add pure context-cut fixture tests.
- Update repo/agent memory plans to point at this substrate.
Out of scope:
- no Qdrant
- no scanner
- no sleep runner
- no app-server route
- no prompt integration
Verification:
```powershell
cargo fmt --manifest-path .\epiphany-core\Cargo.toml
cargo test --manifest-path .\epiphany-core\Cargo.toml --lib memory_graph
cargo check --manifest-path .\epiphany-core\Cargo.toml
```
Definition of done:
- The shared creature has a skeleton.
- Repo modeling and agent memory can add profiles without duplicating graph,
cache, freshness, or context-packet machinery.

View file

@ -0,0 +1,569 @@
# Memory Graph Semantic Projection Authority Map
> Superseded for RepoModel authority on 2026-08-14. Keyed
> `EpiphanyRepoModelView` documents now own the local repository model; the
> remaining `EpiphanyMemoryGraphSnapshot` is a nonpersisted query/semantic
> projection only. The federated cross-repository path is documented in
> `notes/model-atlas-vertical-slice.md`. Nothing in this historical map may be
> used to restore an aggregate RepoModel writer or admission path.
## Objective
Give every Epiphany swarm persistent semantic recall over both its Mind and its
Modeling-owned Body map without allowing Qdrant, an embedding service, Persona,
or presentation code to become memory authority.
CultCache/CultMesh typed documents remain truth. Qdrant is a rebuildable nerve
that ranks canonical document identities.
## Current Mechanism
- Keyed RepoModel documents admitted by local Mind own architecture, dataflow,
summaries, and frontier. `EpiphanyMemoryGraphSnapshot` is derived only for
query and semantic projection and has no revision/hash admission authority.
- Reviewed `EpiphanyAgentMemoryEntry` documents own lane and Persona memory.
`memory_graph_from_agent_memories` derives their typed Mind graph projection.
- `plan_memory_graph_context_cut` resolves full typed nodes, edges, summaries,
anchors, and frontier from a validated graph snapshot. BM25 is its correct
local ranking path.
- `retrieval.rs` has a functioning Qdrant/Ollama client for source chunks.
- `persona_memory_cache.rs` separately re-chunks Persona state, reindexes the
whole identity during recall, and renders Qdrant payload text. This is a
Persona-shaped substitute for the shared Mind/Modeling semantic nerve.
- `EpiphanyMemoryEmbeddingManifest` is unused inside RepoModel. Cache health
must not mutate the canonical model revision or hash.
## Owner
- Mind claims: their admitted typed CultCache documents.
- Modeling claims: the current validated keyed `EpiphanyRepoModelView`.
- Projection synchronization and semantic candidate ranking: one shared
`memory_graph::semantic_projection` organ.
- Qdrant and Ollama: xenos transport/cache boundaries only.
## Inputs
- `swarm_id` and exact visibility/authority scope.
- Validated canonical graph snapshots derived from admitted Mind documents or
loaded from the current RepoModel.
- Stable embedding-provider identity, model identity, vector dimension, and
projection profile version. Physical endpoint is operational configuration,
not semantic identity.
## Outputs
- Two physical projection collections: Mind and Modeling.
- Typed point payloads containing locators and hashes, never authoritative
claim text.
- A typed CultCache projection receipt/status outside RepoModel.
- Ranked candidate references that core reloads and revalidates against current
canonical state before producing a context packet.
## Derived State
- Embeddings, scores, point payloads, collection metadata, indexed counts,
projection timestamps, and projection health are cache-only.
- `EpiphanyMemoryEmbeddingManifest` is no longer an owner; it is legacy
notification-shaped state and must not be updated through RepoModel admission.
- Qdrant payload text is no longer memory; query results are locators only.
## Partition Law
- Modeling: `repo_architecture` and `repo_dataflow` nodes/edges/summaries plus
unresolved frontier.
- Mind: `role_self`, `short_term`, `incubation`, `agency_pressure`,
`candidate_intervention`, `identity`, and `evidence` nodes/edges/summaries.
- Physical collection separation is the privacy and rebuild boundary. Payload
filters are additional defense, not tenancy.
- Every point carries `swarm_id`. Modeling points also bind repo/graph identity;
Mind points bind their canonical role/identity scope where present.
## Point Identity And Provenance
Point UUID is deterministic over:
`swarm_id | partition | canonical_type | canonical_key | canonical_document_id`
Content and embedding versions do not change identity. They decide whether the
same point must be replaced.
Every point binds:
- canonical type, key, and document id
- canonical schema version, revision, and aggregate hash
- canonical document content hash
- graph/domain/profile/lifecycle
- source references and source hashes
- authority/visibility scope
- embedding provider, model, dimensions, and projection profile version
## Query Path
1. Explicit frontier and explicitly requested ids retain priority.
2. The embedder embeds the query using the partition's versioned query profile.
3. Qdrant returns candidate locators and scores.
4. Core reloads current canonical typed state.
5. Core rejects missing, retired, stale, hidden, cross-partition, revision-bound,
or hash-mismatched candidates.
6. Valid candidate ids seed the existing context-cut planner, which resolves
the full typed objects and preserves graph expansion, anchors, warnings, and
budget law.
7. Qdrant/Ollama failure adds a warning and uses BM25. Correctness is unchanged.
## Forbidden Writers
- Qdrant cannot write claims, lifecycle, visibility, evidence, frontier, Mind
decisions, RepoModel, or agent memory.
- Query payloads cannot speak directly into prompts.
- Persona cannot own a separate corpus contract.
- Cache status cannot require a RepoModel patch.
- Collection existence cannot attest schema/model compatibility.
- Synchronization cannot enumerate or delete foreign collections or scopes.
- Yggdrasil hosts the nerve; it does not own the thought.
## Shared Paths
- Workspace source retrieval, Persona recall, Mind recall, and Modeling recall
use one native embedding/vector transport.
- Mind and Modeling projectors own document semantics; the transport owns only
HTTP, batching, compatibility validation, and typed serialization at the JSON
boundary.
- Local Docker and Yggdrasil use the same logical embedding identity when the
model/dimensions/profile are identical, even if the endpoint moves.
## Failure And Rebuild
- Missing Qdrant/Ollama, stale projection, incompatible collection metadata, or
partial synchronization falls back to typed BM25 traversal.
- Incremental sync replaces changed stable ids and deletes only absent ids in
the exact owned swarm/partition scope.
- Rebuild constructs and verifies a compatible generation before retiring the
last usable projection.
- Deleting all Epiphany semantic collections must lose speed only.
## Cut Line
1. Extract the existing Qdrant/Ollama wire machinery into one typed native
backend; do not add a third client.
2. Add pure graph projection documents, stable identities, and canonical
candidate revalidation.
3. Add index and semantic-context CLI paths over canonical typed sources with a
typed projection receipt.
4. Prove distinct collections, compatibility refusal, stable rebuild ids,
changed/deleted document synchronization, hostile payload rejection,
frontier priority, and BM25 fallback.
5. Rewire Persona recall through Mind graph candidates and delete its private
chunk/client/index/search authority.
6. Retire the existing `epiphany_persona_memory_v0` collection only after the
shared Mind path is proven.
7. Remove sibling v0 `memory-graph.msgpack`/`.cc` from live authority; production
Modeling projection reads the runtime-spine RepoModel.
## Landed First Nerve (2026-07-15)
- `semantic_backend.rs` is now the single native Qdrant/Ollama xenos boundary
used by workspace retrieval and the shared memory projection. Collection
metadata is read back and compared exactly before reuse.
- `memory_graph::semantic_projection` derives stable locator documents and
revalidates candidates against current canonical hashes without trusting
payload prose.
- `memory_graph::semantic_index` synchronizes exact swarm/partition scope into
`epiphany_mind_v1` and `epiphany_modeling_v1`, writes immutable typed receipts
outside RepoModel, and falls back to canonical BM25 on backend failure.
- `epiphany-memory-semantic` indexes or queries admitted runtime RepoModel,
admitted agent memory, or an explicitly named composed graph store. It
refuses agent memory as Modeling and runtime RepoModel as Mind.
- `epiphany-repo-model-bootstrap` gives the runtime-spine owner an explicit
one-time atomic bootstrap from typed thread-state. It deliberately ignores
stale sibling graph files.
- Persona heartbeat recall now reads the shared Mind projection, restricts the
cut to Persona's exact domain, reloads canonical graph objects, and renders
the typed packet. The Persona-only client/chunk/search/index implementation
and its `epiphany_persona_memory_v0` collection are deleted.
- The tracked v0 sibling `state/memory-graph.msgpack` is deleted. Runtime-spine
RepoModel is the Modeling owner.
Local proof indexed 43 Mind documents and 3 currently fresh Modeling documents
with `qwen3-embedding:0.6b` at 1024 dimensions. The thin Modeling count is
honest pressure: several imported thread-state claims have missing or changed
source anchors and remain stale rather than being made searchable by optimism.
## Completion-Gated Projection Physiology
The landed projection has an indexing command and immutable index receipts, but
no durable reflex from canonical admission to projection completion. Calling
the command from a timer would make elapsed time a substitute for causality.
### Owner And Inputs
- The canonical admission transaction owns projection pressure. A RepoModel
admission already commits a `RepoModelAdmissionReceipt` with the admitted
revision and hash. An agent-Mind mutation must likewise commit the exact
`EpiphanyAgentMemoryEntry` generation and a typed Mind commit witness in one
CAS; the current direct `cache.put` writers in `agent_memory.rs` are not yet a
sufficient completion boundary.
- That transaction emits one immutable semantic-projection obligation as a
companion, keyed by swarm, partition, canonical source identity, and exact
canonical generation/content-set hash. The obligation carries no claim text
and grants no memory authority.
- The projector reads only the obligation plus the canonical CultCache source,
derives projection documents again, and refuses any generation mismatch.
### Completion Signal And Outputs
- `MemorySemanticIndexReceipt` is the completion signal only when it binds the
exact obligation, canonical source generation/content-set hash, collection
compatibility, indexed count, and terminal status. Its present shape lacks
the obligation/source-commit reference and therefore proves an indexing run,
not discharge of admission pressure.
- Projection health is derived: `ready` means the newest canonical obligation
has one exact successful receipt; `pending` means it has none; `failed` means
the latest attempt receipt failed while the obligation remains open; `stale`
means a newer canonical generation exists. Counts, timestamps, vectors, and
retry attempts remain notification/cache state.
- Semantic query correctness never waits for health. A missing or non-ready
receipt selects canonical BM25; a matching receipt permits Qdrant ranking
followed by canonical candidate revalidation.
### Nervous System, Idunn, And CultMesh
- The admission companion is the reflex. A scheduler may immediately queue it;
a periodic pulse may rediscover an uncompleted obligation after restart.
Neither timer nor heartbeat may invent an obligation, declare it complete,
advance its canonical generation, or suppress BM25 fallback.
- Idunn owns survival, restart, executable identity, and aftercare for the
projector daemon. It may report that the worker is unavailable or restart
it; it does not own canonical memory, projection demand, indexed truth, or
completion judgment.
- CultMesh carries typed obligation, attempt/receipt, and derived-health
projections for operators and consumers. It does not host a second queue or
writable health flag. Provider-owned CultCache documents remain the source;
CultMesh publication is a lowering of those documents, and Eve/Gjallar only
render them downstream.
### Forbidden Writers, Shared Paths, And Cut Line
- Forbidden completion writers: wall-clock timers, collection existence,
Qdrant point counts, payload prose, Idunn liveness, CultMesh mirrors, Eve or
Gjallar, and manual status commands.
- RepoModel repair/evolution/verdict admission and every reviewed agent-Mind
mutation must share the same `canonical commit + projection obligation`
primitive. Bootstrap/import may use it once; raw `cache.put` paths may not
bypass it.
- Cut first: replace direct agent-memory writes with an atomic admitted
generation/commit witness; extend the index receipt to bind an obligation;
then add the Idunn-hosted consumer and CultMesh health projection. Do not add
polling flags, file-mtime inference, or a reconciliation cache around the
current unwitnessed writes.
## Atomic Admission Landed (2026-07-15)
- Runtime-spine now carries one immutable binding to the canonical Mind-store
swarm identity. Runtime id, graph id, paths, metadata, and CLI labels cannot
substitute for it.
- RepoModel bootstrap, generic Modeling admission, and frontier-plan Adopt each
commit their canonical model witness and one deterministically derived
Modeling projection obligation in the same CAS. Exact retries require the
obligation; missing or colliding companions fail closed.
- A one-time legacy runtime migration preserves the unchanged bootstrap model,
migration receipt, and swarm binding envelopes while adding only the missing
obligation. The live runtime store passed this migration under
`gamecult.epiphany.main`.
- Reviewed Mind self-patches and lifecycle operations now commit the complete
canonical role generation, immutable/latest generation witness, persisted
Mind admission receipt, and exact Mind projection obligation in one CAS.
The canonical source hash is recomputed in fixed role order on every
admission and must authenticate the previous witness.
- JSON import, legacy repair, raw migration replacement, and canonical trait
seeding are explicitly bootstrap-only and structurally refuse after the
first admitted generation. SoA remains derived and cannot advance Mind.
- Empty canonical partitions still produce obligations. Empty is a demand to
remove stale scoped points, not permission to preserve a previous
projection.
Remaining: migrate the current legacy Mind rows into generation zero pressure;
add projector claims/attempt terminal CAS and bind index receipts to exact
obligations; make queries require the newest exact success before Qdrant
ranking; then publish derived health through provider-owned CultMesh state and
attach Idunn process survival.
## Projector Execution Rebuild Map (2026-07-15)
### Owner
One projector executor owns mutation of a semantic scope identified by
`(swarm_id, partition)` for the duration of an exact canonical obligation.
Canonical admission owns the obligation. The executor owns only its durable
claim, Qdrant synchronization, post-write observation, and terminal evidence.
Qdrant, health projections, schedulers, Idunn, CultMesh, Eve, and Gjallar own
none of those decisions.
### Inputs And Outputs
- Inputs: the newest exact obligation for the authenticated canonical source
head; the canonical snapshot reconstructed from that source; immutable swarm
identity; embedding and collection compatibility; projector incarnation.
- Success output: an immutable receipt bound to every obligation/source field,
emitted only after the observed scoped point set and typed payload identities
equal the derived canonical projection.
- Failure output: a terminal failed attempt for the claimed obligation. It
never erases the obligation or permits semantic query.
- Derived output: `pending`, `failed`, `stale`, or `ready` health. Health is
recomputed sight, not writable state.
### Derived State And Demotions
- `MemorySemanticProjectionHealth` is no longer a prospective daemon status;
it is derived from canonical head, newest matching obligation, exact attempt,
and exact receipt.
- Collection existence, compatibility, point counts, HTTP success, embedding
success, and process liveness are observations only.
- An older success is no longer readiness once a newer canonical obligation
exists. A repair attempt begun after success suppresses that success until a
newer successful terminal receipt proves the scope again.
### Forbidden Writers And Shared Paths
- The CLI may not call the raw indexer and `put` an unbound ready receipt.
- Query and Persona heartbeat recall may not touch Qdrant until the same gate
authenticates the current head, selects its newest exact obligation, and
finds its immutable exact success receipt.
- A caller-supplied swarm id, arbitrary graph-store snapshot, timer, collection
metadata, Qdrant payload, or renderer status cannot open the gate.
- Initial execution, crash replay, daemon restart, operator retry, and repair
all use the same scope claim and terminalization primitives.
### Cut Line
1. Remove the CLI's direct `index -> ordinary receipt put` authority path.
2. Replace it with a scope-serialized claim, idempotent synchronization, fresh
canonical-head reauthentication, post-write verification, and terminal CAS.
3. Delete the empty-partition refusal. An empty desired set bypasses Ollama,
deletes every point in its exact scope, preserves other scopes, and earns a
zero-document receipt; an absent collection is already synchronized.
4. Require the exact readiness gate before embedding or Qdrant query; otherwise
use canonical BM25 without touching either external service.
5. Only after execution and query authority are sealed, lower derived health to
CultMesh and give Idunn survival responsibility for the executor daemon.
### Restart And Concurrency Law
- Claims serialize the shared mutation scope, not merely an obligation id;
generations of one swarm partition overwrite the same point population.
- A crash before terminal evidence leaves pressure open. Replay is idempotent
and repairs partial upsert/delete work; partial state is never queryable.
- Recovery requires an explicit fenced incarnation/epoch. A wall-clock lease
alone may identify a candidate for recovery but cannot let the previous
executor publish afterward.
- Terminal success CAS expects the exact live claim and reauthenticated source
head. If the source advanced mid-run, the old mutation may exist in Qdrant
but cannot become ready; the newer obligation repairs it while queries use
canonical BM25.
## Projector Execution Landed (2026-07-15)
- The direct CLI `raw index -> ordinary receipt put` authority path is gone.
The public executor claims the exact `(swarm, partition)` scope, records a
running attempt, synchronizes Qdrant, observes the resulting scope, and can
publish success only through an exact terminal CAS against the unchanged
canonical authority envelopes.
- Claims carry executor identity and a monotonically fenced epoch. The internal
recovery transition terminalizes the abandoned attempt, advances the epoch,
and makes the old executor structurally unable to publish. That transition is
deliberately withheld from production callers until Idunn supplies typed
stale/recovery authority; a random peer cannot fence a live executor. Failed
execution leaves an exact failed terminal attempt and never grants readiness.
- Mind source authentication includes immutable swarm identity, all seven
canonical role rows, and the latest generation witness. Modeling source
authentication includes immutable runtime swarm binding and the canonical
RepoModel envelope. Both reconstruct and compare the obligation before work.
- Empty canonical partitions bypass Ollama. A missing collection already
represents the empty set; an existing compatible collection deletes every
point in the exact swarm/partition scope and confirms that none remain.
Non-empty synchronization observes the exact ID set and typed locator payload
set after upsert/delete before returning a candidate receipt.
- Semantic query now requires the newest authenticated source input plus its
exact immutable success receipt before either Ollama or Qdrant is touched.
CLI context and Persona heartbeat use this gate. Missing, stale, foreign, or
unbound evidence selects canonical BM25 and reports fallback.
- The live Mind generation-1 and Modeling revision-0 obligations for
`gamecult.epiphany.main` were discharged through the new protocol. Mind
indexed 43 documents and Modeling indexed 3 at 1024 dimensions. Repeated
execution returned the same receipts without another projection mutation;
live context then used Qdrant ranking while resolving every hit back to
canonical documents and ignoring payload prose.
Remaining physiology: publish provider-owned derived projection health through
CultMesh, attach Idunn-owned daemon survival and authorize the fenced recovery
transition with typed stale/recovery evidence, and add the daemon pulse that
discovers open obligations without letting time own their creation or
completion.
## CultMesh Health And Idunn Recovery Authority Map (2026-07-15)
### Owner
- Canonical Mind and Modeling admission own projection demand through the exact
source head and semantic-projection obligation in their source store.
- The projector executor owns only its scope claim, projection mutation,
post-write observation, attempt terminalization, and exact success receipt.
- The provider-side health projector owns recomputing and publishing derived
sight from that canonical evidence. It cannot mint the opaque readiness token
consumed by query.
- Idunn owns projector process survival, restart policy, stale-process
observation, and explicit recovery authorization. The projector still owns
the fenced recovery CAS; Idunn cannot write projection completion.
- CultMesh transports the provider-owned health projection. Eve, Gjallar, and
other downstream consumers lower or render it without acquiring authority.
### Inputs And Outputs
- Health input is an authenticated `MemorySemanticProjectionInput` plus the
exact claims, attempts, and receipts in the same canonical source store.
- Recovery input binds the exact swarm, partition, claim id, epoch, abandoned
executor incarnation, replacement executor incarnation, and Idunn evidence
that the abandoned process is dead or otherwise physically unable to write.
Elapsed time alone may nominate a stale claim for inspection; it cannot grant
fencing authority.
- Health output is one typed provider-authored CultMesh document per
`(swarm_id, partition)`: canonical source identity and generation, obligation
id, derived `pending|failed|stale|ready`, optional exact receipt and latest
attempt/error, provider incarnation, observation time, and private-state
seal. Any `queryEligible` field is display-only.
- Recovery output is an Idunn authorization/receipt paired with the projector's
epoch-advancing CAS. The old running attempt becomes terminally failed and the
replacement claim becomes the only logical completion writer.
### Physical Epoch Isolation
Projector mutation is now confined to the exact
`(obligation_id, claim_id, claim_epoch)` namespace. Qdrant payload filters bind
all three identities, physical point UUIDs include all three identities plus
the canonical locator point id, and payload `pointId` remains the canonical
locator identity. Empty synchronization, upsert, observation, deletion, and
query therefore address one claim incarnation only.
Success receipts use schema v2 and bind `claim_id`, `claim_epoch`, and the exact
post-scroll vector-binding root. Legacy receipts decode with empty/zero defaults
but cannot become query eligible. An authority-authenticated succeeded claim
with legacy or invalid receipt evidence derives the typed repair posture; claim
status alone never opens repair.
Opaque readiness carries the exact successful receipt, and query derives its
Qdrant filter only from that receipt. Activation is consequently the CultCache
terminal-success CAS selecting an already-observed physical namespace; a
fenced writer can continue harming only its abandoned namespace.
This cut makes the following structurally true:
- an executor can upsert, observe, query, and delete only within its own epoch;
- the exact success receipt binds the epoch namespace that query will filter or
address;
- activation of a successful epoch is atomic from the query gate's perspective;
- a superseded executor resuming late cannot mutate the active epoch;
- retirement and garbage collection of old epochs are separate derived
maintenance and cannot decide readiness.
Executor labels are diagnostic identity, not reusable capabilities: a second
claim call is refused even when it presents the same `executor_id`. Recovery
remains withheld until Idunn provides typed authorization; this physical cut
does not invent that grant.
### Derived State And Forbidden Writers
- Projection health, staleness, Qdrant counts, collection existence, process
liveness, timestamps, and latest error are observation/cache state only.
- Idunn command exit is not provider heartbeat, semantic readiness, or proof
that a restarted child initialized successfully.
- The health mirror, Self, local operator projections, CultMesh, Eve, and Gjallar cannot
create obligations, attempts, receipts, canonical state, or readiness.
- Arbitrary peers cannot invoke recovery with free-form claim and reason
strings. Production recovery requires store-authenticated typed Idunn
authorization and physical epoch isolation.
### Provider-Status Ownership Cut
Each packaged provider daemon is the sole writer of its typed heartbeat/status.
There is no generic cluster daemon that may synthesize another provider's
liveness. Idunn records stale observation, command execution, restart, and
awaiting-provider-heartbeat in scheduler/poke/recovery state without
rewriting provider status, operator action, or heartbeat time. A restarted
provider becomes ready only when that provider publishes a newer authentic
heartbeat; synthetic provider writers remain confined to test/quarantine
bodies.
This ownership cut is now landed. Scheduler staleness forces Idunn
reconciliation without changing the provider envelope. Command success records
`awaiting-provider-heartbeat`; failure records `restart-failed`. The persisted
poke intent binds the observed stale heartbeat and configured threshold, while
provider status, operator action, and `last_heartbeat_utc` remain unchanged.
Only a later provider-authored heartbeat can establish readiness.
Poke intent/receipt v1 binds the heartbeat observed before intervention and the
attempt/completion timestamps. Receipt-directory sight resolves
`awaiting-provider-heartbeat` only when the same provider publishes a heartbeat
newer than both that observation and the completed attempt. Command attempts
increase restart backoff pressure regardless of exit code; a causally newer
provider heartbeat is the sole event that clears the failure count. The bounded
survival rehearsal proves the provider envelope remains unchanged across two
successful restart commands while the lifecycle receipt remains awaiting,
then publishes a real provider heartbeat and proves the receipt resolves and
restart pressure resets.
Generated supervisor attempts use unique intent identities and receipt identity
derives from the intent. Identity plus latest-pointer publication is one CAS:
non-identical reuse is refused, exact retry is idempotent, and a delayed retry
cannot rewind the latest lifecycle observation.
### Shared Paths And Verification Layer
CultMesh health sight is landed.
- Owner: canonical Mind or Modeling CultCache state owns projection truth and
query admission. The semantic-health publisher owns only creation of the
non-authoritative CultMesh observation.
- Inputs: the canonical store, a sealed projection input whose obligation and
authority envelopes exactly match that store, and bounded opaque provider
runtime/incarnation identities. Ready observation additionally reloads and
authenticates the complete succeeded scope-claim, attempt, and receipt chain.
- Outputs: immutable local-area observation events plus one chronological
per-swarm/partition latest mirror carrying `pending|failed|ready`, canonical
fingerprints, bounded ready-only counts, provider identity, and timestamps.
- Derived state: mirror status, `queryEligibleDisplayOnly`, aggregate
`observed-ready|observed-attention|unknown`, and TUI rows are sight only.
- Forbidden writers: CultMesh rows, Verse/Eve/Gjallar consumers, Idunn, and
operator repair commands cannot create obligations, claims, attempts,
receipts, readiness, or semantic-query admission.
- Shared paths: `epiphany-memory-semantic health` is the sole explicit
publication pulse; Eve/CultMesh consumers lower its latest mirrors without a
second operator command plane. Index execution emits its canonical receipt without calling
the sight publisher, so a mirror failure cannot redefine execution success.
- Cut line: there is no mirror-to-canonical import, mirror-to-Qdrant query, or
mirror-to-readiness edge. A stale sealed input is refused instead of being
published as current sight.
- Verification layer: tests exercise pending, authenticated ready, later failed
repair, stale-input refusal, bounded provider identities, mirror poisoning,
chronological latest behavior, private-text exclusion, and absence of
backend contact or query admission from forged sight.
The published document is explicitly non-authoritative,
provider/incarnation-stamped, private-state sealed, and contains no graph path,
error, command, or payload prose. Event and latest writes advance atomically
through a chronological compare-and-swap.
- Initial execution, retry, crash replay, scheduled rediscovery, and operator
request share the same projector execution primitive. A stuck running claim
branches only through typed Idunn recovery, then re-enters that path.
- Mind and Modeling authenticate from distinct canonical stores but publish the
same renderer-neutral CultMesh health schema.
- The daemon pulse discovers current open obligations after restart. It never
creates an obligation or infers completion from time, process state, or
Qdrant existence.
- Negative verification must prove supervisor tick/reconcile cannot change a
provider status envelope and command exit zero cannot produce a heartbeat.
- Recovery verification must suspend an old executor at each mutation phase,
recover under a new epoch, resume the old executor after replacement success,
and prove it cannot alter the active epoch or publish terminal success.
- Publication verification must derive every health state from canonical
evidence, repair a missing/stale CultMesh mirror without changing readiness,
and prove hostile mirror state cannot open semantic query.
- Restart verification must rediscover open Mind and Modeling obligations,
preserve exact-success idempotence, and require a real provider heartbeat
before Idunn reports the projector body ready.

View file

@ -0,0 +1,251 @@
# VoidBot Routine Adoption Plan
VoidBot has grown the reference agent routine Epiphany should steal without
cosplaying as a Discord moderator. The useful organs are:
- heartbeat turns that choose work, rumination, or sleep/consolidation
- cooldown that starts after a heartbeat turn completes, not when it launches
- nap windows for memory consolidation, pruning, dream residue, and incubation
- canonical MessagePack state through a CultCache-style typed document store
- CultCache-native inspection/debug tooling rather than long-lived JSON shadow state
deliberately
- code-owned schemas instead of schema drift hiding in loose files
- semantic memory vectors in Qdrant with source hashes and compact dimensions
- memory resonance, incubation queues, analytic/associative thought lanes, and a
bridge that decides speech, draft, hold, or silence
- repo identities with Persona state, Discord roles, pending mentions, jurisdiction,
proposal authority, and a CTB/Final-Fantasy-style initiative scheduler
## Project-Persona Direction
VoidBot is no longer only a moderator with retrieval. It now has the small
working version of the Epiphany pitch: repos grow Personas.
The live pattern is:
- a repo identity has a Discord role and registered allowed channels
- that identity has repo-local Persona state, not just base Void personality
- first contact can birth the Persona through Epiphany repo terrain/personality
scouting and reviewable startup artifacts
- role/display-name mentions become pending obligations, not direct hidden jobs
- an initiative scheduler chooses which Persona or system agent gets the next turn
- heat can prioritize identities, repos, participant kinds, turns, channels, or
all participants
- active turns freeze initiative until the owner-Codex job or moderation lock
completes
- Personas may advocate for repo needs and propose changes, while implementation
authority still requires the configured human/review path
Epiphany should absorb that as native product direction. The user should talk to
projects: "Aqua, what does AquaSynth need?", "Nibu, what is wrong with this lore
arc?", "Mimir, what seam is drifting?" The project should schedule modeling,
research, verification, memory maintenance, or a Persona response from its own
typed state. The human should not have to deliver a complete implementation
brief just to make the system start thinking.
## Target Shape
Epiphany should treat this as a shared agent routine substrate, not as another
specialist lane. The substrate owns scheduling, persistence, and memory
maintenance; the coordinator owns authority.
```text
coordinator pressure / user objective / swarm messages
-> heartbeat scheduler
-> work turn | rumination turn | sleep turn
-> typed state read through CultCache-compatible store
-> optional Qdrant memory recall / resonance
-> bounded result, selfPatch, statePatch, dream, or callback
-> completion receipt starts cooldown
-> canonical MessagePack write + typed inspection/debug views
```
## Scheduler Contract
Heartbeat state keeps:
- participant identity, role, speed, load, status, readiness, reaction bias, and
pending turn
- pacing policy with work recovery, idle recovery, sleep multiplier, and
completion-gated cooldown
- sleep cycle state: enabled, cadence, nap duration, current nap, next nap,
dream count, active dream themes, and last distillation summary
- history of work, rumination, sleep, completion, and refused-repeat events
Turn kinds:
- `work`: coordinator-approved lane work, specialist result, Persona surface, or
implementation continuation.
- `rumination`: role-local memory hygiene, selfPatch, stale habit detection, or
low-pressure thought incubation.
- `sleep`: inward maintenance. The agent should distill/prune memory, strengthen
resonance clusters, update incubation, write or refresh dreams, and speak only
through Persona if something genuinely needs to surface.
No lane may receive another heartbeat while `pending_turn.status == running`.
The completion receipt is the only normal path that starts cooldown. This is the
part that keeps the heart from turning into a tiny manager with a stopwatch and
no shame.
Repo Personas use the same law. A Persona can be heated because a human mentioned it,
a repo is hot, a stream is live, or a group needs attention; that heat changes
opportunity, not authority. The Persona still freezes while thinking, still returns
through typed receipts, and still needs an explicit grant before crossing from
proposal into canonical repo mutation.
## Persistence Contract
Epiphany needs a Rust version of the CultCache contract because the app-server
and `epiphany-core` are Rust and should not route core state through a Node
helper just to persist its own mind.
Minimum Rust surface:
- `DocumentType<T>`: type id plus serde/schema metadata.
- `CultCacheEnvelope`: `{ key, type, payload, stored_at }`.
- `BackingStore`: `pull_all`, `push`, `delete`, optional `push_all`.
- `SingleFileMessagePackBackingStore`: atomic whole-file MessagePack store with
external lock expectation.
- `CultCache`: register types, load stores, validate payloads through typed
serde structs, get/get_required/get_all/put/update/delete/snapshot.
- Typed inspection/debug views should come from CultLib/CultCache tooling so
all wire-compatible runtimes share the same schema and display assumptions.
Repo-local JSON projections are temporary compatibility shims only.
The schema should live in annotated Rust structs using serde plus generated JSON
Schema where useful. MessagePack is canonical. JSON is the window, not the
house.
## Shared Persona-State Contract
Epiphany should not invent its own rival Persona ontology.
The shared cross-runtime public/person-shaped payload contract is now the
GameCult Persona state shape, with Ghostlight and VoidBot as source lineage:
- payload schema id:
`https://gamecult.dev/cultnet/gamecult.persona_state.v0.schema.json`
- payload schema version:
`gamecult.persona_state.v0`
- intended CultNet document type:
`gamecult.persona_state.v0`
That means Epiphany Persona, VoidBot repo Personas, and Ghostlight characters can
exchange Persona state without turning every Epiphany work organ into a public
personality simulation.
The shared contract uses `candidateActions` for generic forward pressure.
VoidBot can expose the same list as `voidbotProjection.candidateInterventions`
when repo-Persona routine language wants that noun, but the projection does not own
the portable Persona contract. Persona documents also carry provenance and a
public presentation surface so imported state can say where it came from, when
it was exported, whether it is canonical/projection/import data, and how the
public person should be rendered.
Source-specific fields belong in `anchoredThought.extensions`. That bag is
preservation glue, not authority. Consumers may keep it round-tripped, but they
must not let it steer shared Persona behavior unless they explicitly understand
the originating contract.
The affect layer keeps semantic bones where they matter: social bonds name
subject/object/kind/trust/tension, status reads name target/kind/confidence,
and doctrine stances name principle/stance/action implication. Needs remain
anchored thoughts because they behave like pressure records.
The baseline also requires a public `presentation` block, annotates timestamps
as JSON Schema `date-time`, and gives every `custom` enum path a companion
custom-label field. `candidateActions.actions` are typed action records now:
action type, target, optional delivery target, readiness, risk, urgency,
confidence, evidence, timestamps, and expiry. `privateNotes` stay simple for v0
interchange; if they begin carrying provenance or authority, promote them into
typed private-note records instead of letting raw strings grow a steering
wheel.
CultNet is not just ergonomic framing. It also carries CultLib-style auth and
session semantics:
- shared connection key for both peers
- AES-GCM encrypted auth/session payloads
- server-side session-signing secret
- signed verify/reconnect tokens
So the target shape is:
- canonical work-organ state in MessagePack through CultCache-compatible
storage
- typed CultNet document replication for live exchange
- Persona payloads for public/person-shaped agents
Narrow work-organ views stay derived and local. The shared person-state truth is
Persona-shaped.
Initial document types:
- `epiphany.thread_state`
- `epiphany.agent_memory`
- `epiphany.heartbeat_state`
- `gamecult.persona_state.v0`
- `epiphany.swarm_message`
- later: planning, graph checkpoint, memory resonance, incubation, dreams
## Vector Memory Contract
Epiphany already has Qdrant/Ollama retrieval for workspace source. Extend that
pattern to agent memory:
- collection namespace: `epiphany_memory_<instance_id>`
- point id: stable memory id or hash of document type/key/path
- vector model: default `qwen3-embedding:0.6b`
- payload: agent id, role id, memory kind, source hash, schema version, summary,
salience, confidence, updated time, source refs
- canonical MessagePack state stores vector metadata and optionally compact
inline vectors; Qdrant stores the retrieval vector
- CultCache inspection views may strip vector values while preserving metadata
Memory resonance is not proof. It is "these things rhyme" evidence for
rumination, Persona surfacing, and sleep consolidation.
## Migration Slices
1. **Contract extraction**
- Add Rust CultCache-compatible module in `epiphany-core`.
- Add fixtures proving MessagePack round-trip, typed serde/schema validation,
and CultCache inspection compatibility.
2. **Heartbeat state migration**
- Move `state/agent-heartbeats.json` into a typed MessagePack document.
Landed: the tracked JSON state file is retired and heartbeat
init/status/tick/complete now route through the native CultCache store.
- Add `sleep_cycle`, `memory_resonance`, and `incubation` fields.
- Keep the current CLI contract stable while the backing store changes.
3. **Organ and Persona memory migration**
- Store lean Epiphany work-organ memory as `epiphany.agent_memory`.
- Store public/person-shaped Persona state as `gamecult.persona_state.v0`.
- Use CultLib/CultCache inspection tools for human/debug review instead of
preserving per-role JSON as a parallel source of truth.
- Attach semantic vector metadata to episodic, semantic, relationship, goal,
value, musing, and dream entries.
4. **Memory organ**
- Add a bounded memory maintenance command that embeds missing memory vectors,
refreshes Qdrant points, builds resonance edges/clusters, updates
incubation, and writes dream residue during sleep turns.
5. **Coordinator integration**
- Coordinator sees heartbeat sleep state, pending turns, resonance summaries,
and memory maintenance results.
- Coordinator may route work, accept/refuse selfPatch, or let the swarm sleep.
6. **Aquarium visibility**
- Expose sleep state, dreams, resonance clusters, incubating thoughts, and
pending turns as inspectable Aquarium surfaces.
## Non-Goals
- Do not replace CRRC compaction yet.
- Do not make Qdrant canonical truth.
- Do not let sleep turns edit implementation code.
- Do not auto-accept specialist findings because a dream sounded good.
- Do not build a general database shrine before the typed MessagePack seam
proves it deserves to live.