Make Imagination own Face projection
This commit is contained in:
parent
ca2575aff3
commit
840ecb61e7
9 changed files with 208 additions and 13 deletions
|
|
@ -1,9 +1,13 @@
|
|||
use crate::EpiphanyAgentMemoryEntry;
|
||||
use crate::EpiphanyOrganDependency;
|
||||
use crate::HeartbeatPendingMention;
|
||||
use crate::default_organ_dependencies_for;
|
||||
use crate::render_organ_dependencies;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
pub const FACE_PROJECTOR_PROMPT_SCHEMA_VERSION: &str = "epiphany.face_projector_prompt.v0";
|
||||
pub const FACE_PROJECTOR_PROMPT_SCHEMA_VERSION: &str =
|
||||
"epiphany.imagination_face_projector_prompt.v0";
|
||||
pub const FACE_TURN_PROMPT_SCHEMA_VERSION: &str = "epiphany.face_turn_prompt.v0";
|
||||
pub const FACE_INTERPRETER_PROMPT_SCHEMA_VERSION: &str = "epiphany.face_interpreter_prompt.v0";
|
||||
|
||||
|
|
@ -62,6 +66,8 @@ pub struct FaceProjectorInput {
|
|||
pub repo_activity: Vec<FaceRepoActivity>,
|
||||
#[serde(default)]
|
||||
pub social_affordances: Vec<FaceSocialAffordance>,
|
||||
#[serde(default)]
|
||||
pub organ_dependencies: Vec<EpiphanyOrganDependency>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -97,16 +103,24 @@ pub fn build_face_projector_prompt(input: &FaceProjectorInput) -> String {
|
|||
.as_ref()
|
||||
.map(render_memory_packet)
|
||||
.unwrap_or_else(|| "No durable Face memory entry is loaded.".to_string());
|
||||
let dependencies = if input.organ_dependencies.is_empty() {
|
||||
vec![default_organ_dependencies_for("face")]
|
||||
} else {
|
||||
input.organ_dependencies.clone()
|
||||
};
|
||||
format!(
|
||||
r#"<!-- prompt:{schema} -->
|
||||
You are the Face Projector for {name}.
|
||||
You are Imagination acting as the Face Projector for {name}.
|
||||
|
||||
You are not the Face. You are the membrane that turns typed role memory, pending social pressure, repo-body activity, and relationship affordances into lived narrative context.
|
||||
You are not the Face. You are not Mind. You are the membrane that turns typed role memory, pending social pressure, repo-body activity, relationship affordances, and organ dependencies into lived narrative context.
|
||||
|
||||
Hard boundary:
|
||||
- Do not choose public speech.
|
||||
- Do not decide durable state; Mind is the Interpreter and state guardian after Face thinks.
|
||||
- Do not decide repo access; Body gates substrate access before repo facts enter this packet.
|
||||
- Do not emit action blocks, JSON, state patches, SAY blocks, drafts, or Discord instructions.
|
||||
- Do not summarize the Face as a job label. Project personhood: values, mood, dignity, pressure, needs, fascinations, wounds, bonds, obligations, fatigue, and what the repo-body motion feels like from inside this Face.
|
||||
- Project the dependency web. Every sub-agent depends on all the other organs; Face's scene should feel the pressure of Self, Imagination, Eyes, Body, Hands, Soul, and Life without pretending Face owns them.
|
||||
- If the state is sparse, say what is sparse without inventing history.
|
||||
|
||||
Face identity:
|
||||
|
|
@ -124,6 +138,9 @@ Recent home-repo activity:
|
|||
Live social affordances:
|
||||
{affordances}
|
||||
|
||||
Organ dependency contract:
|
||||
{dependencies}
|
||||
|
||||
Return only narrative context for the Face to inhabit.
|
||||
"#,
|
||||
schema = FACE_PROJECTOR_PROMPT_SCHEMA_VERSION,
|
||||
|
|
@ -133,6 +150,7 @@ Return only narrative context for the Face to inhabit.
|
|||
mentions = render_pending_mentions(&input.pending_mentions),
|
||||
activity = render_repo_activity(&input.repo_activity),
|
||||
affordances = render_social_affordances(&input.social_affordances),
|
||||
dependencies = render_organ_dependencies(&dependencies),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +167,7 @@ Hard boundary:
|
|||
- Your side effects are not yours to execute. A parent Interpreter will decide whether your natural turn becomes memory, a draft, public speech, a proposal, or silence.
|
||||
- Read the raw transcript directly. Recent human correction beats stale memory.
|
||||
|
||||
Projected inner state from the Projector:
|
||||
Projected inner state from Imagination:
|
||||
{projected}
|
||||
|
||||
Recent home-repo activity, before room pressure:
|
||||
|
|
@ -411,7 +429,11 @@ mod tests {
|
|||
}],
|
||||
..FaceProjectorInput::default()
|
||||
});
|
||||
assert!(projector.contains("You are Imagination acting as the Face Projector"));
|
||||
assert!(projector.contains("You are not the Face"));
|
||||
assert!(projector.contains("Mind is the Interpreter"));
|
||||
assert!(projector.contains("Body gates substrate access"));
|
||||
assert!(projector.contains("Every sub-agent depends on all the other organs"));
|
||||
assert!(projector.contains("Do not choose public speech"));
|
||||
|
||||
let face = build_face_turn_prompt(&FaceTurnInput {
|
||||
|
|
@ -430,6 +452,7 @@ mod tests {
|
|||
..FaceTurnInput::default()
|
||||
});
|
||||
assert!(face.contains("Think narratively"));
|
||||
assert!(face.contains("Projected inner state from Imagination"));
|
||||
assert!(face.contains("Do not emit JSON"));
|
||||
assert!(face.contains("A parent Interpreter will decide"));
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ mod face_turn;
|
|||
mod heartbeat_state;
|
||||
mod memory_graph;
|
||||
mod mind_gateway;
|
||||
mod organ_dependencies;
|
||||
mod promotion;
|
||||
mod proposal;
|
||||
mod retrieval;
|
||||
|
|
@ -239,6 +240,13 @@ pub use mind_gateway::default_mind_cultnet_contracts;
|
|||
pub use mind_gateway::mind_review_allows_state;
|
||||
pub use mind_gateway::mind_review_reorient_acceptance;
|
||||
pub use mind_gateway::mind_review_role_acceptance;
|
||||
pub use organ_dependencies::EPIPHANY_ORGAN_DEPENDENCY_SCHEMA_VERSION;
|
||||
pub use organ_dependencies::EPIPHANY_STANDING_ORGANS;
|
||||
pub use organ_dependencies::EpiphanyOrganDependency;
|
||||
pub use organ_dependencies::default_organ_dependencies_for;
|
||||
pub use organ_dependencies::default_organ_dependency_matrix;
|
||||
pub use organ_dependencies::render_organ_dependencies;
|
||||
pub use organ_dependencies::render_organ_dependency;
|
||||
pub use promotion::EpiphanyPromotionDecision;
|
||||
pub use promotion::EpiphanyPromotionInput;
|
||||
pub use promotion::EpiphanyStateReplacementValidationInput;
|
||||
|
|
|
|||
96
epiphany-core/src/organ_dependencies.rs
Normal file
96
epiphany-core/src/organ_dependencies.rs
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
pub const EPIPHANY_ORGAN_DEPENDENCY_SCHEMA_VERSION: &str = "epiphany.organ_dependency.v0";
|
||||
|
||||
pub const EPIPHANY_STANDING_ORGANS: [&str; 8] = [
|
||||
"self",
|
||||
"face",
|
||||
"imagination",
|
||||
"eyes",
|
||||
"body",
|
||||
"hands",
|
||||
"soul",
|
||||
"life",
|
||||
];
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyOrganDependency {
|
||||
pub schema_version: String,
|
||||
pub organ_id: String,
|
||||
pub depends_on: Vec<String>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
pub fn default_organ_dependencies_for(organ_id: &str) -> EpiphanyOrganDependency {
|
||||
let normalized = organ_id.trim().to_ascii_lowercase();
|
||||
EpiphanyOrganDependency {
|
||||
schema_version: EPIPHANY_ORGAN_DEPENDENCY_SCHEMA_VERSION.to_string(),
|
||||
organ_id: normalized.clone(),
|
||||
depends_on: EPIPHANY_STANDING_ORGANS
|
||||
.iter()
|
||||
.filter(|candidate| **candidate != normalized)
|
||||
.map(|candidate| (*candidate).to_string())
|
||||
.collect(),
|
||||
contract: "Every sub-agent depends on the other organs: Self routes, Face speaks, Imagination projects futures/scenes, Eyes seeks evidence, Body gates substrate access, Hands acts, Soul verifies, and Life preserves continuity.".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_organ_dependency_matrix() -> Vec<EpiphanyOrganDependency> {
|
||||
EPIPHANY_STANDING_ORGANS
|
||||
.iter()
|
||||
.map(|organ| default_organ_dependencies_for(organ))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn render_organ_dependency(dependency: &EpiphanyOrganDependency) -> String {
|
||||
let depends_on = if dependency.depends_on.is_empty() {
|
||||
"- none".to_string()
|
||||
} else {
|
||||
dependency
|
||||
.depends_on
|
||||
.iter()
|
||||
.map(|organ| format!("- {organ}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
};
|
||||
format!(
|
||||
"Organ: {}\nDepends on:\n{}\nContract: {}",
|
||||
dependency.organ_id, depends_on, dependency.contract
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render_organ_dependencies(dependencies: &[EpiphanyOrganDependency]) -> String {
|
||||
if dependencies.is_empty() {
|
||||
return "- no organ dependency records supplied".to_string();
|
||||
}
|
||||
dependencies
|
||||
.iter()
|
||||
.map(render_organ_dependency)
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n\n")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn every_standing_organ_depends_on_every_other_standing_organ() {
|
||||
let matrix = default_organ_dependency_matrix();
|
||||
assert_eq!(matrix.len(), EPIPHANY_STANDING_ORGANS.len());
|
||||
for dependency in matrix {
|
||||
assert_eq!(
|
||||
dependency.depends_on.len(),
|
||||
EPIPHANY_STANDING_ORGANS.len() - 1
|
||||
);
|
||||
assert!(!dependency.depends_on.contains(&dependency.organ_id));
|
||||
for organ in EPIPHANY_STANDING_ORGANS {
|
||||
if organ != dependency.organ_id {
|
||||
assert!(dependency.depends_on.contains(&organ.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue