Add semantic recall to repo Persona intake
This commit is contained in:
parent
77604f4668
commit
2455c4d4a9
5 changed files with 108 additions and 1 deletions
|
|
@ -309,6 +309,8 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
require_eq(&publish, &["status"], "publication-receipts-recorded")?;
|
||||
require_eq(&sync, &["status"], "upstream-main-synced")?;
|
||||
require_eq(&export, &["status"], "public-proof-exported")?;
|
||||
require_non_empty(&intake, &["memoryRecallStatus"])?;
|
||||
require_non_empty(&intake, &["memoryRecallCacheStatus"])?;
|
||||
require_non_empty(&intake, &["weksaLoweringReceiptId"])?;
|
||||
require_bool(&intake, &["privateStateExposed"], false)?;
|
||||
require_bool(&overview, &["privateStateExposed"], false)?;
|
||||
|
|
@ -337,6 +339,9 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
"initStatus": init["status"],
|
||||
"onlineStatus": online["status"],
|
||||
"personaIntakeStatus": intake["status"],
|
||||
"personaMemoryRecallStatus": intake["memoryRecallStatus"],
|
||||
"personaMemoryRecallCacheStatus": intake["memoryRecallCacheStatus"],
|
||||
"personaMemoryRecallHitCount": intake["memoryRecallHitCount"],
|
||||
"weksaLoweringReceiptId": intake["weksaLoweringReceiptId"],
|
||||
"planStatus": plan["status"],
|
||||
"preRunOverviewGate": pre_run_overview["gate"],
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use epiphany_core::HandsActionIntent;
|
|||
use epiphany_core::MIND_GATEWAY_REVIEW_SCHEMA_VERSION;
|
||||
use epiphany_core::MindGatewayDecision;
|
||||
use epiphany_core::MindGatewayReview;
|
||||
use epiphany_core::PersonaMemoryCacheConfig;
|
||||
use epiphany_core::RuntimeSpineInitOptions;
|
||||
use epiphany_core::SOUL_VERDICT_RECEIPT_SCHEMA_VERSION;
|
||||
use epiphany_core::SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_SCHEMA_VERSION;
|
||||
|
|
@ -41,6 +42,7 @@ use epiphany_core::hands_commit_receipt_for_review;
|
|||
use epiphany_core::hands_patch_receipt_for_review;
|
||||
use epiphany_core::hands_pr_receipt_for_review;
|
||||
use epiphany_core::initialize_runtime_spine;
|
||||
use epiphany_core::load_agent_memory_entry_for_role;
|
||||
use epiphany_core::load_epiphany_cultmesh_idunn_aftercare_audit_receipt;
|
||||
use epiphany_core::load_epiphany_cultmesh_idunn_deployment_receipt;
|
||||
use epiphany_core::load_epiphany_cultmesh_repo_work_overviews;
|
||||
|
|
@ -50,7 +52,9 @@ use epiphany_core::load_latest_epiphany_cultmesh_bifrost_github_publication_rece
|
|||
use epiphany_core::load_latest_epiphany_cultmesh_idunn_aftercare_audit_receipt;
|
||||
use epiphany_core::load_latest_epiphany_cultmesh_idunn_deployment_receipt;
|
||||
use epiphany_core::load_latest_epiphany_cultmesh_repo_work_overview;
|
||||
use epiphany_core::memory_graph_from_agent_memories;
|
||||
use epiphany_core::mind_state_commit_receipt;
|
||||
use epiphany_core::plan_memory_graph_context_cut;
|
||||
use epiphany_core::put_hands_action_intent;
|
||||
use epiphany_core::put_hands_action_review;
|
||||
use epiphany_core::put_hands_command_receipt;
|
||||
|
|
@ -62,6 +66,7 @@ use epiphany_core::put_mind_state_commit_receipt;
|
|||
use epiphany_core::put_soul_verdict_receipt;
|
||||
use epiphany_core::put_substrate_gate_repo_access_grant_receipt;
|
||||
use epiphany_core::record_weksa_target_lowering_receipt;
|
||||
use epiphany_core::render_persona_memory_recall_with_cache;
|
||||
use epiphany_core::runtime_hands_action_intent;
|
||||
use epiphany_core::runtime_hands_action_review;
|
||||
use epiphany_core::runtime_hands_commit_receipt;
|
||||
|
|
@ -72,6 +77,8 @@ use epiphany_core::write_epiphany_cultmesh_repo_work_public_proof;
|
|||
use epiphany_core::write_epiphany_cultmesh_repo_work_readiness;
|
||||
use epiphany_core::write_epiphany_cultmesh_repo_work_readiness_review;
|
||||
use epiphany_core::write_epiphany_cultmesh_weksa_lowering_receipt;
|
||||
use epiphany_state_model::EpiphanyMemoryContextQuery;
|
||||
use epiphany_state_model::EpiphanyMemoryProfile;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
|
@ -1799,6 +1806,9 @@ fn run_persona_intake(args: PersonaIntakeArgs) -> Result<Value> {
|
|||
path_from_json(&online_receipt, &["localVerseStore"])
|
||||
.unwrap_or_else(|| workspace.join(".epiphany").join("local-verse.ccmp"))
|
||||
});
|
||||
let state_dir = path_from_json(&online_receipt, &["stateDir"])
|
||||
.unwrap_or_else(|| workspace.join(".epiphany").join("state"));
|
||||
let agent_store = state_dir.join("agents.msgpack");
|
||||
let runtime_id = args.runtime_id.clone().unwrap_or_else(|| {
|
||||
string_from_json(&online_receipt, &["runtimeId"])
|
||||
.unwrap_or_else(|| "repo-swarm-local".to_string())
|
||||
|
|
@ -1846,6 +1856,8 @@ fn run_persona_intake(args: PersonaIntakeArgs) -> Result<Value> {
|
|||
.clone()
|
||||
.unwrap_or_else(|| format!("repo-persona-intake-{item_slug}"));
|
||||
let summary = compact_text(&args.message, 480);
|
||||
let memory_recall =
|
||||
record_repo_persona_intake_memory_recall(&agent_store, &item_slug, &args.message);
|
||||
let public_ref = format!("eve://epiphany/persona#repo-intake/{item_slug}/{audit_id}");
|
||||
let candidate_ref = format!("candidate-action://{runtime_id}/{item_slug}/{audit_id}");
|
||||
let weksa = record_repo_persona_intake_weksa(
|
||||
|
|
@ -1888,6 +1900,7 @@ fn run_persona_intake(args: PersonaIntakeArgs) -> Result<Value> {
|
|||
"contentFingerprint": content_fingerprint,
|
||||
"publicDiscussionRef": public_ref,
|
||||
"candidateActionRef": candidate_ref,
|
||||
"memoryRecall": memory_recall,
|
||||
"weksa": weksa
|
||||
},
|
||||
"accept": accept,
|
||||
|
|
@ -1915,6 +1928,9 @@ fn run_persona_intake(args: PersonaIntakeArgs) -> Result<Value> {
|
|||
"receiptPath": receipt_path,
|
||||
"item": receipt["item"],
|
||||
"speechAuditId": audit_id,
|
||||
"memoryRecallStatus": receipt["persona"]["memoryRecall"]["status"],
|
||||
"memoryRecallCacheStatus": receipt["persona"]["memoryRecall"]["cacheStatus"],
|
||||
"memoryRecallHitCount": receipt["persona"]["memoryRecall"]["hitCount"],
|
||||
"weksaLoweringReceiptId": receipt["persona"]["weksa"]["receiptId"],
|
||||
"bubblePath": receipt["persona"]["bubblePath"],
|
||||
"acceptReceiptPath": accept["receiptPath"],
|
||||
|
|
@ -1925,6 +1941,86 @@ fn run_persona_intake(args: PersonaIntakeArgs) -> Result<Value> {
|
|||
}))
|
||||
}
|
||||
|
||||
fn record_repo_persona_intake_memory_recall(
|
||||
agent_store: &Path,
|
||||
item_slug: &str,
|
||||
message: &str,
|
||||
) -> Value {
|
||||
let entry = match load_agent_memory_entry_for_role(agent_store, "Persona") {
|
||||
Ok(Some(entry)) => entry,
|
||||
Ok(None) => {
|
||||
return json!({
|
||||
"schemaVersion": "epiphany.persona_memory_cache.v0",
|
||||
"status": "unavailable",
|
||||
"cacheStatus": "persona-memory-missing",
|
||||
"identityId": "epiphany.Persona",
|
||||
"roleId": "Persona",
|
||||
"chunkCount": 0,
|
||||
"hitCount": 0,
|
||||
"renderedRecall": "- semantic Persona memory recall unavailable: Persona memory entry is missing",
|
||||
"warnings": ["Persona memory entry is missing"],
|
||||
"privateStateExposed": false,
|
||||
});
|
||||
}
|
||||
Err(error) => {
|
||||
return json!({
|
||||
"schemaVersion": "epiphany.persona_memory_cache.v0",
|
||||
"status": "unavailable",
|
||||
"cacheStatus": "persona-memory-load-failed",
|
||||
"identityId": "epiphany.Persona",
|
||||
"roleId": "Persona",
|
||||
"chunkCount": 0,
|
||||
"hitCount": 0,
|
||||
"renderedRecall": format!("- semantic Persona memory recall unavailable: {}", compact_text(&format!("{error:#}"), 320)),
|
||||
"warnings": [format!("Persona memory load failed: {}", compact_text(&format!("{error:#}"), 240))],
|
||||
"privateStateExposed": false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let query = format!("Repo Persona intake {item_slug}\n{message}");
|
||||
let graph = memory_graph_from_agent_memories(
|
||||
"repo-persona-intake-memory",
|
||||
std::slice::from_ref(&entry),
|
||||
);
|
||||
let fallback = plan_memory_graph_context_cut(
|
||||
&graph,
|
||||
&EpiphanyMemoryContextQuery {
|
||||
id: format!("repo-persona-intake-{item_slug}"),
|
||||
profile: Some(EpiphanyMemoryProfile::RoleSelf),
|
||||
domain_ids: Vec::new(),
|
||||
node_ids: Vec::new(),
|
||||
edge_ids: Vec::new(),
|
||||
text: Some(query.clone()),
|
||||
budget: Some(8),
|
||||
},
|
||||
);
|
||||
let mut config = PersonaMemoryCacheConfig::from_env();
|
||||
config.qdrant_timeout_ms = config.qdrant_timeout_ms.min(1_000);
|
||||
config.ollama_timeout_ms = config.ollama_timeout_ms.min(1_000);
|
||||
let recall = render_persona_memory_recall_with_cache(
|
||||
&entry,
|
||||
format!("{}#Persona", agent_store.display()),
|
||||
&query,
|
||||
8,
|
||||
Some(&fallback),
|
||||
&config,
|
||||
);
|
||||
|
||||
json!({
|
||||
"schemaVersion": recall.schema_version,
|
||||
"status": recall.status,
|
||||
"cacheStatus": recall.cache_status,
|
||||
"identityId": recall.identity_id,
|
||||
"roleId": recall.role_id,
|
||||
"chunkCount": recall.chunk_count,
|
||||
"hitCount": recall.hit_count,
|
||||
"renderedRecall": recall.rendered_recall,
|
||||
"warnings": recall.warnings,
|
||||
"privateStateExposed": recall.private_state_exposed,
|
||||
})
|
||||
}
|
||||
|
||||
fn record_repo_persona_intake_weksa(
|
||||
local_verse_store: &Path,
|
||||
runtime_id: &str,
|
||||
|
|
|
|||
|
|
@ -1532,6 +1532,12 @@ target-language lowering request, lowering receipt, and local Verse
|
|||
`epiphany.cultmesh.weksa_lowering_receipt.v0` mirror before any mouth transport
|
||||
publication. The receipt-directory row is Weksa-owned sight only; Bifrost or the
|
||||
configured mouth edge still owns publication, and Mind still owns durable state.
|
||||
Repo Persona intake also carries semantic Persona memory recall now. It loads
|
||||
repo-local `agents.msgpack`, tries the bounded Qdrant/Ollama Persona-memory
|
||||
cache, falls back to a typed RoleSelf memory-graph context cut, and records
|
||||
sealed recall status in the intake receipt before routing public pressure to
|
||||
Imagination. Qdrant is a rebuildable semantic cache; typed memory remains the
|
||||
owner.
|
||||
`notes/organ-dependency-contracts.md` is the standing dependency map: every
|
||||
sub-agent depends on all the other standing sub-agents. Dependency does not collapse
|
||||
ownership; it makes each turn whole-organism-aware while Substrate Gate still gates repo
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -649,5 +649,5 @@ current_status:
|
|||
- `tools/epiphany_local_run.ps1 -Mode swarm-online-runbook` now emits an explicit Idunn preflight summary before the operator elevation boundary. Its JSON and one-line summary report `preflightStatus`, child artifact present/hash-verified/mismatch/missing counts, aggregate service execution failed/missing check counts, child preflight rows with expected/actual SHA-256s, and private-state exposure. Live proof `local-20260619-025627-410-9724e2f6` generated the non-mutating parent artifact with `preflightStatus=ready-for-elevated-operator`, two child runbooks present, two hashes verified, zero mismatches, zero missing artifacts, eleven failed sealed service checks, zero missing checks, explicit aftercare audits, and `privateStateExposed=false`. The remaining scar is still explicit elevated operator execution followed by complete Idunn audits, not missing parent/child artifact readiness.
|
||||
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
|
||||
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
|
||||
last_completed_repo_swarm_cut: Repo Persona intake now routes public Persona SAY through Weksa interlingua/lowering cargo on the normal product path, not only through the isolated Weksa smoke. `epiphany-work persona-intake` builds a Weksa interlingua packet, target-language lowering request, lowering receipt, and local Verse `epiphany.cultmesh.weksa_lowering_receipt.v0` mirror while denying publication, durable-state, Hands, merge, deployment, service lifecycle, and private-state authority. Direct proof on disposable fresh-repo fixture `.epiphany-smoke\fresh-repo-mvp-20260621-164107\repo-body` returned `weksaLoweringReceiptId=weksa-lowering-repo-intake-fresh-repo-mvp-persona-speech-audit-7863b4c6`; receipt-directory readback reported `OK | Weksa | weksa-lowering | lowered:en | route=eve://epiphany/persona | privateStateExposed=false`. The fresh-repo MVP smoke now asserts Persona intake returns a non-empty Weksa lowering receipt id.
|
||||
last_completed_repo_swarm_cut: Repo Persona intake now carries semantic Persona memory recall on the product path before public pressure becomes Imagination work. `epiphany-work persona-intake` loads repo-local `agents.msgpack`, builds a RoleSelf memory-graph fallback context, gives the Qdrant/Ollama Persona-memory cache a bounded chance to retrieve typed Persona memories, and records sealed recall status/cache status/hit count in the intake output plus full internal receipt. Direct proof on disposable fresh-repo fixture `.epiphany-smoke\fresh-repo-mvp-20260621-164107\repo-body` returned `memoryRecallStatus=fallback`, `memoryRecallCacheStatus=qdrant-unavailable`, `memoryRecallHitCount=0`, `privateStateExposed=false`, and the stored receipt contained typed memory-graph recall without the deliberately sealed private note. Focused proof `epiphany-persona-memory-recall-smoke` still shows the Qdrant bridge, heartbeat recall, and Projector/Persona/Interpreter prompt slots are wired with `privateStateExposed=false`; unit tests `persona_memory_recall_bridge_*` prove both mocked Qdrant-hit and fallback paths. Fresh-repo MVP smoke now asserts Persona intake returns memory recall status/cache status as well as the Weksa lowering receipt id.
|
||||
next_action: Continue repo-swarm MVP work from `notes/epiphany-repo-swarm-mvp-contract.md`. The aggregate MVP gate is now sealed: `tools/epiphany_local_run.ps1 -Mode repo-swarm-mvp-gate` reports `demoReady=true`, `mvpReady=false`, thirteen green proof gates, one Idunn elevated-service warning gate, zero blockers, and `privateStateExposed=false`. Useful next cuts are live-fire testing on a disposable or low-stakes repo Body, explicit elevated/operator Idunn execution proof only when the human grants that authority, or another repo-owned safe action family only if it materially improves the MVP story. Persona-to-Imagination consensus readback, Mind-owned interpreter brief cargo, safe-family planning depth and closure, Gjallar closure/readiness/readiness-review rows, receipt-directory readiness-review indexing, Bifrost ledger accounting rows including readiness-review closure plus artifact/metrics final receipt closure, readiness wrapper mouth, repo deployment handoff/readback wrappers, readiness deployment-aftercare closure, readiness Idunn/tool-directory receipt validation, readiness Bifrost/GitHub publication-chain validation, readiness upstream-main sync validation, readiness review/adoption receipt validation, aggregate fresh-repo/readiness/Bifrost/deployment-handoff/daemon-survival MVP gate reporting, and bounded Idunn daemon survival rehearsal are sealed; preserve Idunn service lifecycle ownership, Bifrost publication/upstream-main ownership, Mind durable-state admission, and existing CultMesh/Odin/Eve tool directories. Windows service install/start/deployment execution still requires explicit elevated operator authority.
|
||||
|
|
|
|||
Reference in a new issue