Add projected retrieval requirements
This commit is contained in:
parent
21fd6febcd
commit
c377f19f79
14 changed files with 572 additions and 72 deletions
|
|
@ -47,6 +47,8 @@ The context contains:
|
|||
- active inner pressures rendered as ordinary language
|
||||
- relationship read and known biases
|
||||
- tensions
|
||||
- runtime retrieval requirements
|
||||
- latent pressure requirements
|
||||
- action affordances
|
||||
- projection controls
|
||||
- voice surface
|
||||
|
|
@ -54,6 +56,34 @@ The context contains:
|
|||
- do-not-invent boundaries
|
||||
- rendered prompt text
|
||||
|
||||
## Retrieval And Latent Pressure
|
||||
|
||||
The projector now emits two explicit requirement lists before the responder
|
||||
packet is built.
|
||||
|
||||
`runtime_retrieval_requirements` are compact lore facts the runtime should
|
||||
include when their trigger is scene-relevant. They are not a license for a
|
||||
responder to browse the lore archive. They are coordinator or retriever outputs
|
||||
with source refs and a prompt role. In the Cold Wake sanctuary scene, the active
|
||||
requirements cover heat-debt timing, Navigator rescue ledgers, Aya sanctuary
|
||||
capacity politics, and Ganymede/Lightsail route obligations.
|
||||
|
||||
`latent_pressure_requirements` are character-local history or emotional pressure
|
||||
that must remain visible to the responder because it can shape behavior. They
|
||||
are not dialogue requirements. Sella's memory of a sanctuary overpromising
|
||||
safety should bias her toward capacity suspicion, condition-setting, and hard
|
||||
triage boundaries. It should not make her announce the memory in the middle of
|
||||
a mission-critical exchange unless the scene genuinely asks for that.
|
||||
|
||||
The rendered prompt includes these as:
|
||||
|
||||
- `Retrieved Lore To Keep In View`
|
||||
- `Latent Pressure Handling`
|
||||
|
||||
The responder packet also copies source-excerpt retrieval requirements into its
|
||||
`source_excerpts`, so packet-only tests can evaluate the same bounded context a
|
||||
runtime responder would receive.
|
||||
|
||||
## Runtime Boundary
|
||||
|
||||
The character model receives local operating context, not omniscient truth. If
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ A packet contains:
|
|||
- `local_context_prompt`: the projected character-local context
|
||||
- `observed_event`: what the character can see or hear from the prior action
|
||||
- `allowed_action_labels`: concrete action labels, including speech and non-speech moves
|
||||
- `source_excerpts`: short source-backed facts the responder may use
|
||||
- `source_excerpts`: short source-backed facts the responder may use, copied
|
||||
from active runtime retrieval requirements plus local packet invariants
|
||||
- `output_contract`: the required JSON response shape and rules
|
||||
- `hidden_context_audit`: refs and inference classes deliberately omitted
|
||||
- `isolation_requirements`: how the worker/model must be run
|
||||
|
|
@ -145,3 +146,10 @@ Aya sanctuary capacity politics. Follow-up review clarified that Sella's
|
|||
packet-visible sanctuary-collapse scar does not need to be spoken aloud, but it
|
||||
does need to remain visible to the responder as behavioral pressure. Both lanes
|
||||
are useful; neither should impersonate the other.
|
||||
|
||||
The current packet builder consumes `runtime_retrieval_requirements` from the
|
||||
projected local context. For the Sella sanctuary packet, that means packet-only
|
||||
source excerpts now come from the same retrieval/projector seam that would feed
|
||||
runtime context: Cold Wake heat-debt pressure, Navigator rescue ledgers, Aya
|
||||
sanctuary capacity, and Ganymede/Lightsail route obligations. The static lore
|
||||
sandwich is dead. We thank it for its service, then bury it shallow.
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -130,6 +130,9 @@ Ghostlight now has the persistence spine plus the first architecture payload:
|
|||
- `tools/validate_projected_contexts.py`
|
||||
- includes an embodiment/interface section so Navigator action is projected
|
||||
from checked Aetheria lore instead of default human body assumptions;
|
||||
- now includes `runtime_retrieval_requirements` and
|
||||
`latent_pressure_requirements` so compact lore facts and character-local
|
||||
scars survive projection without becoming mandatory confession prose;
|
||||
current source supports fluid architecture, acoustic signaling, communal
|
||||
orientation chambers, mixed-species translation/coexistence, and specialized
|
||||
cetacean environments; AetheriaLore has now been patched with mixed
|
||||
|
|
@ -199,6 +202,11 @@ access.
|
|||
The v1 Sella packet removes responder-visible references to absent coordinator
|
||||
knowledge and adds curated AetheriaLore excerpts for Cold Wake, the Ganymede
|
||||
Route Compact, Navigator rescue ledgers, and Lightsail reliability.
|
||||
The packet builder now gets those source excerpts from projected
|
||||
`runtime_retrieval_requirements` rather than from a static hand-written list.
|
||||
For the current Sella packet, that pulls Cold Wake heat-debt, Navigator rescue
|
||||
ledger, Aya sanctuary-capacity, and Ganymede/Lightsail route-obligation facts
|
||||
into packet-only context.
|
||||
The packet-only Sella capture has now been materialized into a reviewed mutation
|
||||
receipt and mutated fixture:
|
||||
`examples/agent-state.cold-wake-story-lab.after-sella-conditions.json`. The
|
||||
|
|
@ -243,13 +251,11 @@ narrow elaboration before treating the detail as available to Ghostlight.
|
|||
|
||||
## Current Next Action
|
||||
|
||||
Use the corrected lane-comparison lessons for the next fresh generation pass:
|
||||
update the runtime retrieval/projector plan so packet-only contexts can pull
|
||||
compact lore facts for heat-debt timing, Navigator rescue ledgers, Aya sanctuary
|
||||
capacity politics, and Lightsail/Ganymede route obligations when scene-relevant,
|
||||
while explicitly preserving character-local scars such as Sella's
|
||||
sanctuary-collapse backstory as available behavioral pressure. Do not call Qwen
|
||||
for gold responder data yet.
|
||||
Use the corrected packet surface for the next fresh generation pass: run a
|
||||
sandboxed responder against the regenerated Sella packet, then review whether
|
||||
the output uses institutional lore and latent pressure without prompt parroting,
|
||||
omniscience, or mission-critical trauma-dumping. Do not call Qwen for gold
|
||||
responder data yet.
|
||||
|
||||
Cat/Oz remains useful as an Elysium procedural mechanics fixture, but
|
||||
single-history grounding should start from authored historical lore rather than
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ state and re-entry discipline.
|
|||
- `docs/architecture/projected-local-context.md`
|
||||
- contract for the projector seam that turns canonical state into
|
||||
character-local operating context before a response model sees it,
|
||||
including source-checked embodiment and interface affordances
|
||||
including source-checked embodiment and interface affordances, runtime
|
||||
retrieval requirements, and latent pressure handling
|
||||
- `docs/architecture/soft-model-training-artifacts.md`
|
||||
- doctrine for treating every non-deterministic judgment as reviewed
|
||||
training material for future specialized models, including
|
||||
|
|
@ -116,7 +117,9 @@ state and re-entry discipline.
|
|||
- v0 contract for grounding historical fixtures in source-backed cultural and
|
||||
factional pressure fields
|
||||
- `schemas/projected-local-context.schema.json`
|
||||
- v0 contract for projected character-local operating context artifacts
|
||||
- v0 contract for projected character-local operating context artifacts,
|
||||
including structured runtime retrieval requirements and latent pressure
|
||||
requirements
|
||||
- `schemas/coordinator-artifact.schema.json`
|
||||
- v0 contract for coordinator/story-runtime receipts: scene setup,
|
||||
next-beat choice, acting-agent choice, machinery invocations, sandboxed
|
||||
|
|
@ -299,7 +302,8 @@ state and re-entry discipline.
|
|||
relationships, memories, projection controls, and optional observed event
|
||||
into character-local operating prose; for cetacean Navigators it projects
|
||||
source-checked habitat affordances from AetheriaLore instead of generic
|
||||
human body defaults
|
||||
human body defaults; now emits scene-triggered compact lore retrieval
|
||||
requirements and latent character-history pressure requirements
|
||||
- `tools/validate_projected_contexts.py`
|
||||
- validates projected context artifacts and rejects prompt text that leaks raw
|
||||
canonical state internals
|
||||
|
|
@ -309,7 +313,8 @@ state and re-entry discipline.
|
|||
hooks, and review status
|
||||
- `tools/build_responder_packet.py`
|
||||
- builds the first packet-only responder handoff from a coordinator artifact
|
||||
and projected local context
|
||||
and projected local context; source excerpts now come from active projected
|
||||
runtime retrieval requirements instead of a static lore list
|
||||
- `tools/validate_responder_packets.py`
|
||||
- validates responder packets and rejects prompt surfaces that leak raw state
|
||||
internals or hidden coordinator context markers
|
||||
|
|
@ -388,6 +393,12 @@ institutional lore should not crowd out character-local backstory from the
|
|||
responder's visible pressure set, but the responder should not be rewarded for
|
||||
surfacing that backstory aloud when the mission-critical exchange does not call
|
||||
for it.
|
||||
The runtime retrieval/projector correction is now concrete: projected contexts
|
||||
carry source-backed retrieval requirements and latent pressure requirements,
|
||||
and the responder packet builder copies active retrieval requirements into
|
||||
packet source excerpts. The first Sella packet now receives Cold Wake heat-debt,
|
||||
Navigator rescue-ledger, Aya sanctuary-capacity, and Ganymede/Lightsail route
|
||||
obligation facts through that seam.
|
||||
The concrete training plan now enumerates
|
||||
eleven trainable stages and their likely model
|
||||
families: generative decoder LLMs for coordinator, responder, and structured
|
||||
|
|
|
|||
|
|
@ -120,11 +120,16 @@
|
|||
- Projector prototype: `tools/project_local_context.py` now turns canonical
|
||||
variables, memory, relationship stance, culture, and scene pressure into
|
||||
compact character-local operating context and action affordances.
|
||||
- Projected-context artifacts use
|
||||
`ghostlight.projected_local_context.v0` and validate through
|
||||
`tools/validate_projected_contexts.py`; rendered prompt text must not leak
|
||||
raw state internals such as `current_activation`, `plasticity`, means, or
|
||||
decimal state values.
|
||||
- Projected-context artifacts use
|
||||
`ghostlight.projected_local_context.v0` and validate through
|
||||
`tools/validate_projected_contexts.py`; rendered prompt text must not leak
|
||||
raw state internals such as `current_activation`, `plasticity`, means, or
|
||||
decimal state values.
|
||||
- Runtime retrieval/projector correction: projected contexts now carry
|
||||
`runtime_retrieval_requirements` and `latent_pressure_requirements`.
|
||||
Retrieval requirements render compact lore facts for scene-relevant
|
||||
pressures; latent pressure requirements keep character history visible as
|
||||
behavior-shaping context without forcing it into speech.
|
||||
- Embodiment correction: projected local context now includes a first-class
|
||||
embodiment/interface section. Aetheria faction affordances must be checked
|
||||
against lore before projection. Current Navigator source supports fluid
|
||||
|
|
@ -362,9 +367,15 @@
|
|||
around heat-debt timing, rescue ledgers, dockfall burden, and sanctuary
|
||||
capacity politics, but can crowd out character-local backstory if the
|
||||
projector does not protect that pressure.
|
||||
- Next prototype: turn the comparison lessons into retrieval/projector
|
||||
requirements so packet-only runtime contexts can pull compact lore facts
|
||||
when those pressures are scene-relevant.
|
||||
- Retrieval/projector requirements are now wired into the projected-context
|
||||
seam and responder packet builder. The Sella packet gets Cold Wake
|
||||
heat-debt, Navigator rescue ledgers, Aya sanctuary capacity, and
|
||||
Ganymede/Lightsail route obligations from projected runtime requirements
|
||||
instead of a static hand-written excerpt list.
|
||||
- Next prototype: use this corrected packet surface for a fresh sandboxed
|
||||
responder pass, then review whether the response uses institutional lore
|
||||
and latent pressure without prompt parroting or mission-critical
|
||||
trauma-dumping.
|
||||
|
||||
7. Build the first drama-scaffolding loop.
|
||||
- memory updates
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@
|
|||
"active_inner_pressures",
|
||||
"relationship_read",
|
||||
"tensions",
|
||||
"runtime_retrieval_requirements",
|
||||
"latent_pressure_requirements",
|
||||
"retrieved_lore_prompt_blocks",
|
||||
"latent_pressure_prompt_blocks",
|
||||
"action_affordances",
|
||||
"projection_controls",
|
||||
"voice_surface",
|
||||
|
|
@ -128,6 +132,32 @@
|
|||
"$ref": "#/$defs/text_block"
|
||||
}
|
||||
},
|
||||
"runtime_retrieval_requirements": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/retrieval_requirement"
|
||||
}
|
||||
},
|
||||
"latent_pressure_requirements": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/latent_pressure_requirement"
|
||||
}
|
||||
},
|
||||
"retrieved_lore_prompt_blocks": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/$defs/text_block"
|
||||
}
|
||||
},
|
||||
"latent_pressure_prompt_blocks": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/$defs/text_block"
|
||||
}
|
||||
},
|
||||
"action_affordances": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
|
|
@ -230,6 +260,84 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"retrieval_requirement": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"requirement_id",
|
||||
"trigger",
|
||||
"compact_fact",
|
||||
"source_refs",
|
||||
"prompt_role"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"requirement_id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"trigger": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"compact_fact": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"source_refs": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"prompt_role": {
|
||||
"enum": [
|
||||
"source_excerpt",
|
||||
"setting_constraint",
|
||||
"action_affordance",
|
||||
"do_not_invent"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"latent_pressure_requirement": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"pressure_id",
|
||||
"text",
|
||||
"source_refs",
|
||||
"projection_rule",
|
||||
"review_rule"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"pressure_id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"source_refs": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"projection_rule": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"review_rule": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,3 +66,4 @@
|
|||
{"ts": "2026-05-02T09:50:08+00:00", "type": "implementation", "status": "ok", "note": "Completed both responder lanes for the Sella sanctuary beat. Materialized the packet-only Sella capture into a reviewed mutation receipt and mutated fixture, then generated a research_augmented Sella capture with scoped AetheriaLore refs and a lane comparison showing packet-only proves runtime parity while research_augmented adds heat-debt, rescue-ledger, dockfall, and Aya sanctuary capacity texture for retrieval/projector requirements."}
|
||||
{"ts": "2026-05-02T09:59:37+00:00", "type": "design", "status": "accepted", "note": "Corrected responder lane terminology: the prior research_augmented Sella capture was coordinator-retrieved lore, not autonomous responder research, so the lane is now retrieval_augmented with lore_access.mode coordinator_scoped_retrieval. The comparison now records that retrieval improved institutional texture but underused Sella Ren's packet-visible sanctuary-collapse scar; future projector/retrieval review must preserve character-local scars as well as lore grounding."}
|
||||
{"ts": "2026-05-02T10:02:28+00:00", "type": "design", "status": "accepted", "note": "Refined character-pressure retention doctrine: packet-visible backstory such as Sella Ren's sanctuary-collapse scar should be available to shape responder behavior, but review must not reward unnecessary trauma-dumping or require the scar to surface in mission-critical speech."}
|
||||
{"ts": "2026-05-02T10:08:14+00:00", "type": "implementation", "status": "ok", "note": "Implemented runtime retrieval/projector requirements. Projected local contexts now emit source-backed runtime_retrieval_requirements and latent_pressure_requirements; prompt text renders retrieved lore and latent pressure handling; responder packets copy active retrieval requirements into source_excerpts so packet-only contexts receive compact Cold Wake heat-debt, Navigator rescue-ledger, Aya sanctuary-capacity, and Ganymede/Lightsail route-obligation facts without granting repo access or forcing character backstory into speech."}
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ accepted_design:
|
|||
- Responder data has two explicit lanes: `packet_only` for runtime parity with curated source excerpts, and `retrieval_augmented` for coordinator- or retriever-selected scoped AetheriaLore refs that bake worldbuilding into final outputs while preserving consulted refs. This is not autonomous responder research unless the responder actually receives scoped repo access.
|
||||
- First lane-comparison correction: retrieval-augmented output improved institutional texture, and follow-up review clarified that Sella Ren's packet-visible sanctuary-collapse scar does not need to surface in speech but must remain available to the responder as latent behavioral pressure.
|
||||
- The first responder lane comparison shows packet-only output proves bounded runtime competence, while retrieval-augmented output adds heat-debt timing, rescue-ledger burden, dockfall responsibility, and Aya sanctuary capacity politics that should become retrieval/projector requirements.
|
||||
- Runtime retrieval/projector requirements are now first-class projected-context fields: compact source-backed lore facts flow into packet source excerpts when scene-relevant, and latent character-history pressure remains visible without becoming required spoken disclosure.
|
||||
- The concrete training plan enumerates the trainable stages and their model families: generative decoder LLMs for coordinator/responder/soft structured outputs, classifiers or cross-encoders for appraisal/evaluation/relationship movement, retrieval models for memory and lore selection, and deterministic code for gates.
|
||||
- Training-plan sample counts are pilot schema-shakedown gates, not robust corpus targets; pilot data may be invalidated by schema fixes, while review-assistant and runtime targets are expected to be roughly an order of magnitude larger with held-out evaluation and failure audits.
|
||||
- The timeline training plan now requires future-branch Elysium examples so the responder, coordinator, appraiser, and decision models learn post-Rupture concepts such as Aether, pseudospace, temporal nonlinearity, spirits, necrotech, mutable bodies, altered substrates, and weird institutions under branch-lineage labels.
|
||||
|
|
@ -169,4 +170,4 @@ accepted_design:
|
|||
|
||||
current_status:
|
||||
summary: Ghostlight now has the Epiphany-style persistence spine, the first architecture payload, the v0 canonical agent-state schema seam, prompt projection docs, immediate schema fixes from evaluation, first reviewed Cat/Oz projection examples, a revised Aetheria lore-grounding architecture, a lore grounding digest schema, the first coordinator artifact schema seam, the first responder packet seam, the first sandboxed responder output seam, explicit packet-only versus retrieval-augmented responder lanes, the first responder lane comparison, the first draft Cold Wake historical grounding digest, a Cold Wake story-lab fixture, projection controls, validated Qwen capture receipts, a complete Cold Wake short story assembled from accepted projection outputs, a hand-authored Ink-backed Cold Wake branching scene, the first Qwen-generated Ink draft materialized from local awareness with reviewed training annotations, the first reviewed sequential branch mutation that updates both Maer and Sella after a sanctuary intake beat, a v2 sequential Qwen capture proving the symmetrical turn shape produces better action behavior, a v5 sequential Qwen capture proving local thinking-plus-tools invocation works for the scene runner, the first projected-local-context seam that routes sequential prompts through character-local operating prose instead of raw state variables, tightened receipt handling for projector-routed Qwen failures, a default no-thinking policy for strict sequential tool calls, a v10 no-thinking projector-routed capture accepted as draft, the first materialized projector-routed sequential Ink scene with reviewed mutation training data, a source-checked embodiment/interface projection surface for Navigator scenes, a formal source-first Aetheria generation doctrine, v11-v17 source-checked retry receipts showing improved Maer embodiment plus remaining Sella response/prompt-leak blockers, a soft-model training artifact doctrine, a concrete training plan with pilot schema-shakedown gates separated from robust corpus targets, sandboxed responder-data requirements, an explicit future-branch lane, Elysium branch event constraints, and a technology/item manifest plan for turning nebulous named tech into blueprint-grade components, assemblies, faction tech bases, supply chains, upgrade paths, gameplay hooks, provenance-hunting player fantasy, and content-refinery outputs mapped onto Aetheria-Economy's CultCache blueprint and instance model.
|
||||
next_action: Use the corrected lane-comparison lessons for the next fresh generation pass: update the runtime retrieval/projector plan so packet-only contexts can pull compact lore facts for heat-debt timing, Navigator rescue ledgers, Aya sanctuary capacity politics, and Lightsail/Ganymede route obligations when scene-relevant, while preserving character-local scars such as Sella's sanctuary-collapse backstory as available behavioral pressure rather than forced speech. Do not call Qwen for gold responder data yet.
|
||||
next_action: Use the corrected packet surface for the next fresh generation pass: run a sandboxed responder against the regenerated Sella packet, then review whether the output uses institutional lore and latent pressure without prompt parroting, omniscience, or mission-critical trauma-dumping. Do not call Qwen for gold responder data yet.
|
||||
|
|
|
|||
|
|
@ -89,6 +89,38 @@ def render_packet_prompt(packet: dict[str, Any]) -> str:
|
|||
return "\n".join(lines).strip()
|
||||
|
||||
|
||||
def build_source_excerpts(projected: dict[str, Any]) -> list[dict[str, str]]:
|
||||
context = projected["context"]
|
||||
excerpts = [
|
||||
{
|
||||
"ref_id": "local_stakes.capacity",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.current_stakes",
|
||||
"text": "Sanctuary beds and repair capacity are nearly exhausted.",
|
||||
},
|
||||
{
|
||||
"ref_id": "local_rule.care_capacity",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.active_inner_pressures",
|
||||
"text": "Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them.",
|
||||
},
|
||||
{
|
||||
"ref_id": "local_boundary.packet_unresolved",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.do_not_invent",
|
||||
"text": "Do not resolve whether the corrupted packet contains a person.",
|
||||
},
|
||||
]
|
||||
for item in context.get("runtime_retrieval_requirements", []):
|
||||
if item.get("prompt_role") != "source_excerpt":
|
||||
continue
|
||||
excerpts.append(
|
||||
{
|
||||
"ref_id": item["requirement_id"],
|
||||
"source_ref": "; ".join(item["source_refs"]),
|
||||
"text": item["compact_fact"],
|
||||
}
|
||||
)
|
||||
return excerpts
|
||||
|
||||
|
||||
def build_packet(coordinator: dict[str, Any], projected: dict[str, Any], out_ref: str) -> dict[str, Any]:
|
||||
responder_agent_id = projected["input"]["local_agent_id"]
|
||||
packet = {
|
||||
|
|
@ -125,43 +157,7 @@ def build_packet(coordinator: dict[str, Any], projected: dict[str, Any], out_ref
|
|||
],
|
||||
},
|
||||
"allowed_action_labels": ALLOWED_ACTION_LABELS,
|
||||
"source_excerpts": [
|
||||
{
|
||||
"ref_id": "local_stakes.capacity",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.current_stakes",
|
||||
"text": "Sanctuary beds and repair capacity are nearly exhausted.",
|
||||
},
|
||||
{
|
||||
"ref_id": "local_rule.care_capacity",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.active_inner_pressures",
|
||||
"text": "Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them.",
|
||||
},
|
||||
{
|
||||
"ref_id": "local_boundary.packet_unresolved",
|
||||
"source_ref": "examples/projected-contexts/scene-02-sanctuary-intake.sella_ren.projected-context.json#context.do_not_invent",
|
||||
"text": "Do not resolve whether the corrupted packet contains a person.",
|
||||
},
|
||||
{
|
||||
"ref_id": "lore.cold_wake_panic",
|
||||
"source_ref": "AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Timeline/Events/Cold Wake Panic.md",
|
||||
"text": "Cold Wake Panic was a late-Sol corridor crisis around thermal stealth, ghost tracks, delayed heat dumps, misclassified quiet-running vessels, insurer categories, certified quiet-running envelopes, and heat-debt tolerances.",
|
||||
},
|
||||
{
|
||||
"ref_id": "lore.ganymede_route_compact",
|
||||
"source_ref": "AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Timeline/Events/Ganymede Route Compact.md",
|
||||
"text": "The Ganymede Route Compact established rescue obligations, shared hazard ledgers, route-steward representation, and legal status for Navigator councils in convoy arbitration.",
|
||||
},
|
||||
{
|
||||
"ref_id": "lore.navigator_rescue_ledgers",
|
||||
"source_ref": "AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Factions/Powers/Major/Cetacean Navigators.md#Rescue Ledgers",
|
||||
"text": "Navigator rescue ledgers record who answered distress calls, held formation in lethal weather, and kept sanctuary promises when a paying client wanted otherwise; those records shape credit, escort priority, arbitration, and kinship ties.",
|
||||
},
|
||||
{
|
||||
"ref_id": "lore.lightsail_reliability",
|
||||
"source_ref": "AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Factions/Powers/Minor/Lightsail Express.md",
|
||||
"text": "Lightsail Express is associated with the Cetacean Navigators as a bulk-carrier and convoy-management arm whose corridor reputation depends on being the boring answer that still arrives when trust is scarce.",
|
||||
},
|
||||
],
|
||||
"source_excerpts": build_source_excerpts(projected),
|
||||
},
|
||||
"output_contract": {
|
||||
"response_schema": "Return one JSON object. Do not wrap it in Markdown. The object describes this responder's next visible action and optional speech, plus private interpretation clearly labeled as interpretation.",
|
||||
|
|
|
|||
|
|
@ -113,6 +113,16 @@ def memory_lookup(agent: dict[str, Any]) -> dict[str, dict[str, Any]]:
|
|||
return memories
|
||||
|
||||
|
||||
def memory_category_lookup(agent: dict[str, Any]) -> dict[str, str]:
|
||||
categories: dict[str, str] = {}
|
||||
for category, group in agent["memories"].items():
|
||||
if not isinstance(group, list):
|
||||
continue
|
||||
for memory in group:
|
||||
categories[memory["memory_id"]] = category
|
||||
return categories
|
||||
|
||||
|
||||
def text_block(text: str, source_refs: list[str]) -> dict[str, Any]:
|
||||
return {"text": text, "source_refs": source_refs}
|
||||
|
||||
|
|
@ -181,6 +191,26 @@ def memory_blocks(agent: dict[str, Any], memory_ids: list[str], source_prefix: s
|
|||
return blocks
|
||||
|
||||
|
||||
def latent_pressure_requirements(agent: dict[str, Any], memory_ids: list[str], source_prefix: str) -> list[dict[str, Any]]:
|
||||
memories = memory_lookup(agent)
|
||||
categories = memory_category_lookup(agent)
|
||||
requirements = []
|
||||
for memory_id in memory_ids:
|
||||
memory = memories.get(memory_id)
|
||||
if not memory or categories.get(memory_id) != "episodic":
|
||||
continue
|
||||
requirements.append(
|
||||
{
|
||||
"pressure_id": f"latent.{memory_id}",
|
||||
"text": memory["summary"],
|
||||
"source_refs": [f"{source_prefix}.memories.{memory_id}"],
|
||||
"projection_rule": "Keep this visible as latent behavioral pressure that can shape posture, risk tolerance, refusal, condition-setting, or attention.",
|
||||
"review_rule": "Do not require this pressure to surface in spoken text; reject only if the behavior contradicts the pressure or if the model performs unnecessary mission-critical trauma-dumping.",
|
||||
}
|
||||
)
|
||||
return requirements
|
||||
|
||||
|
||||
def relationship_context(
|
||||
fixture: dict[str, Any],
|
||||
speaker_id: str,
|
||||
|
|
@ -265,6 +295,78 @@ def scene_stakes(scene: dict[str, Any], speaker_id: str, scene_prefix: str) -> l
|
|||
return blocks
|
||||
|
||||
|
||||
def runtime_retrieval_requirements(
|
||||
fixture: dict[str, Any],
|
||||
scene: dict[str, Any],
|
||||
agent: dict[str, Any],
|
||||
listener_ids: list[str],
|
||||
) -> list[dict[str, Any]]:
|
||||
identity_text = " ".join(
|
||||
[
|
||||
agent["identity"].get("origin", ""),
|
||||
" ".join(agent["identity"].get("roles", [])),
|
||||
*[
|
||||
" ".join(find_agent(fixture, listener_id)["identity"].get("roles", []))
|
||||
for listener_id in listener_ids
|
||||
],
|
||||
]
|
||||
).lower()
|
||||
setting_text = f"{fixture['world']['setting']} {fixture['world']['time']['label']} {scene['location']}".lower()
|
||||
requirements: list[dict[str, Any]] = []
|
||||
|
||||
if "cold wake" in setting_text:
|
||||
requirements.append(
|
||||
{
|
||||
"requirement_id": "lore.cold_wake_heat_debt",
|
||||
"trigger": "Use when the scene turns on quiet-running vessels, delayed rescue, thermal stealth, ambiguous distress, or intake timing.",
|
||||
"compact_fact": "Cold Wake pressure involves thermal stealth, ghost tracks, delayed heat dumps, misclassified quiet-running vessels, insurer categories, certified quiet-running envelopes, and heat-debt tolerances.",
|
||||
"source_refs": [
|
||||
"AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Timeline/Events/Cold Wake Panic.md"
|
||||
],
|
||||
"prompt_role": "source_excerpt",
|
||||
}
|
||||
)
|
||||
if "navigator" in identity_text or "rescue" in " ".join(scene.get("public_stakes", [])).lower():
|
||||
requirements.append(
|
||||
{
|
||||
"requirement_id": "lore.navigator_rescue_ledgers",
|
||||
"trigger": "Use when a Navigator invokes rescue legitimacy, obligation, escort priority, arbitration, or sanctuary promises.",
|
||||
"compact_fact": "Navigator rescue ledgers record who answered distress calls, held formation in lethal weather, and kept sanctuary promises when a paying client wanted otherwise; those records shape credit, escort priority, arbitration, and kinship ties.",
|
||||
"source_refs": [
|
||||
"AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Factions/Powers/Major/Cetacean Navigators.md#Rescue Ledgers"
|
||||
],
|
||||
"prompt_role": "source_excerpt",
|
||||
}
|
||||
)
|
||||
if "aya" in identity_text or "sanctuary" in setting_text:
|
||||
requirements.append(
|
||||
{
|
||||
"requirement_id": "lore.aya_sanctuary_capacity",
|
||||
"trigger": "Use when sanctuary care, intake, triage authority, or capacity politics determines what a character can ethically do.",
|
||||
"compact_fact": "Aya-aligned sanctuary care is practical capacity politics as much as compassion: beds, air, food, consent, repair, decontamination, staff attention, and follow-through decide what care can honestly promise.",
|
||||
"source_refs": [
|
||||
"AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Factions/Powers/Major/Aya Collective.md",
|
||||
"agents.sella_ren.memories.memory-care-is-capacity",
|
||||
],
|
||||
"prompt_role": "source_excerpt",
|
||||
}
|
||||
)
|
||||
if "ganymede" in setting_text or "lightsail" in identity_text or "route" in identity_text:
|
||||
requirements.append(
|
||||
{
|
||||
"requirement_id": "lore.ganymede_lightsail_route_obligations",
|
||||
"trigger": "Use when Ganymede corridor logistics, convoy stewardship, Lightsail reliability, or route obligation affects the available choices.",
|
||||
"compact_fact": "The Ganymede Route Compact ties rescue obligations, shared hazard ledgers, route-steward representation, and Navigator arbitration to corridor legitimacy; Lightsail reliability depends on being the boring answer that still arrives when trust is scarce.",
|
||||
"source_refs": [
|
||||
"AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Timeline/Events/Ganymede Route Compact.md",
|
||||
"AetheriaLore:Aetheria/Worldbuilding/Pre-Elysium/Factions/Powers/Minor/Lightsail Express.md",
|
||||
],
|
||||
"prompt_role": "source_excerpt",
|
||||
}
|
||||
)
|
||||
return requirements
|
||||
|
||||
|
||||
def projection_control_blocks(annotation: dict[str, Any]) -> dict[str, Any]:
|
||||
return annotation["projection_controls"]
|
||||
|
||||
|
|
@ -430,6 +532,8 @@ def render_prompt_text(context: dict[str, Any]) -> str:
|
|||
("Active Inner Pressures", "active_inner_pressures"),
|
||||
("Relationship Read", "relationship_read"),
|
||||
("Tensions", "tensions"),
|
||||
("Retrieved Lore To Keep In View", "retrieved_lore_prompt_blocks"),
|
||||
("Latent Pressure Handling", "latent_pressure_prompt_blocks"),
|
||||
("Action Affordances", "action_affordances"),
|
||||
]:
|
||||
lines.extend(render_section(title, context[key]))
|
||||
|
|
@ -484,12 +588,36 @@ def build_projected_context(
|
|||
"active_inner_pressures": active_inner_pressures,
|
||||
"relationship_read": relationship_context(fixture, local_agent_id, listener_ids) + perceived_overlay_context(agent, listener_ids, source_prefix),
|
||||
"tensions": tension_blocks(agent, pack, annotation, source_prefix),
|
||||
"runtime_retrieval_requirements": runtime_retrieval_requirements(fixture, scene, agent, listener_ids),
|
||||
"latent_pressure_requirements": latent_pressure_requirements(agent, pack.get("active_memories", []), source_prefix),
|
||||
"action_affordances": action_affordances(local_agent_id, annotation),
|
||||
"projection_controls": projection_control_blocks(annotation),
|
||||
"voice_surface": voice_surface(agent, source_prefix),
|
||||
"likely_response_moves": likely_response_moves(agent, annotation, source_prefix),
|
||||
"do_not_invent": do_not_invent,
|
||||
}
|
||||
context["retrieved_lore_prompt_blocks"] = [
|
||||
text_block(item["compact_fact"], item["source_refs"])
|
||||
for item in context["runtime_retrieval_requirements"]
|
||||
if item["prompt_role"] == "source_excerpt"
|
||||
] or [
|
||||
text_block(
|
||||
"No additional lore retrieval requirements are active for this turn.",
|
||||
["tools.project_local_context.runtime_retrieval_requirements"],
|
||||
)
|
||||
]
|
||||
context["latent_pressure_prompt_blocks"] = [
|
||||
text_block(
|
||||
f"{item['text']} Use as latent behavioral pressure, not as required spoken disclosure.",
|
||||
item["source_refs"],
|
||||
)
|
||||
for item in context["latent_pressure_requirements"]
|
||||
] or [
|
||||
text_block(
|
||||
"No extra latent character-history pressure is active beyond the listed inner pressures.",
|
||||
["tools.project_local_context.latent_pressure_requirements"],
|
||||
)
|
||||
]
|
||||
if event_context:
|
||||
context["observed_event"] = event_context
|
||||
context["known_facts"].append(
|
||||
|
|
|
|||
|
|
@ -47,6 +47,34 @@ def validate_text_blocks(items: Any, path: str) -> None:
|
|||
require(isinstance(item["source_refs"], list) and item["source_refs"], f"{item_path}.source_refs must be non-empty")
|
||||
|
||||
|
||||
def validate_retrieval_requirements(items: Any, path: str) -> None:
|
||||
require(isinstance(items, list), f"{path} must be an array")
|
||||
for index, item in enumerate(items):
|
||||
item_path = f"{path}[{index}]"
|
||||
require(isinstance(item, dict), f"{item_path} must be an object")
|
||||
require_keys(item, ["requirement_id", "trigger", "compact_fact", "source_refs", "prompt_role"], item_path)
|
||||
require(isinstance(item["requirement_id"], str) and item["requirement_id"].strip(), f"{item_path}.requirement_id must be non-empty")
|
||||
require(isinstance(item["trigger"], str) and item["trigger"].strip(), f"{item_path}.trigger must be non-empty")
|
||||
require(isinstance(item["compact_fact"], str) and item["compact_fact"].strip(), f"{item_path}.compact_fact must be non-empty")
|
||||
require(isinstance(item["source_refs"], list) and item["source_refs"], f"{item_path}.source_refs must be non-empty")
|
||||
require(item["prompt_role"] in {"source_excerpt", "setting_constraint", "action_affordance", "do_not_invent"}, f"{item_path}.prompt_role is invalid")
|
||||
|
||||
|
||||
def validate_latent_pressure_requirements(items: Any, path: str) -> None:
|
||||
require(isinstance(items, list), f"{path} must be an array")
|
||||
for index, item in enumerate(items):
|
||||
item_path = f"{path}[{index}]"
|
||||
require(isinstance(item, dict), f"{item_path} must be an object")
|
||||
require_keys(item, ["pressure_id", "text", "source_refs", "projection_rule", "review_rule"], item_path)
|
||||
for key in ["pressure_id", "text", "projection_rule", "review_rule"]:
|
||||
require(isinstance(item[key], str) and item[key].strip(), f"{item_path}.{key} must be non-empty")
|
||||
require(isinstance(item["source_refs"], list) and item["source_refs"], f"{item_path}.source_refs must be non-empty")
|
||||
require(
|
||||
"speech" in item["review_rule"].lower() or "spoken" in item["review_rule"].lower(),
|
||||
f"{item_path}.review_rule must say how speech should be reviewed",
|
||||
)
|
||||
|
||||
|
||||
def validate_context(path: Path) -> None:
|
||||
data = load_json(path)
|
||||
require(isinstance(data, dict), f"{path} must be an object")
|
||||
|
|
@ -71,6 +99,10 @@ def validate_context(path: Path) -> None:
|
|||
"active_inner_pressures",
|
||||
"relationship_read",
|
||||
"tensions",
|
||||
"runtime_retrieval_requirements",
|
||||
"latent_pressure_requirements",
|
||||
"retrieved_lore_prompt_blocks",
|
||||
"latent_pressure_prompt_blocks",
|
||||
"action_affordances",
|
||||
"projection_controls",
|
||||
"voice_surface",
|
||||
|
|
@ -87,6 +119,8 @@ def validate_context(path: Path) -> None:
|
|||
"embodiment_and_interface",
|
||||
"active_inner_pressures",
|
||||
"tensions",
|
||||
"retrieved_lore_prompt_blocks",
|
||||
"latent_pressure_prompt_blocks",
|
||||
"action_affordances",
|
||||
"voice_surface",
|
||||
"likely_response_moves",
|
||||
|
|
@ -96,6 +130,8 @@ def validate_context(path: Path) -> None:
|
|||
require(isinstance(context["relationship_read"], list), f"{path}.context.relationship_read must be an array")
|
||||
for index, item in enumerate(context["relationship_read"]):
|
||||
validate_text_blocks([item], f"{path}.context.relationship_read[{index}]")
|
||||
validate_retrieval_requirements(context["runtime_retrieval_requirements"], f"{path}.context.runtime_retrieval_requirements")
|
||||
validate_latent_pressure_requirements(context["latent_pressure_requirements"], f"{path}.context.latent_pressure_requirements")
|
||||
|
||||
prompt_text = context["prompt_text"]
|
||||
require(isinstance(prompt_text, str) and prompt_text.strip(), f"{path}.context.prompt_text must be non-empty")
|
||||
|
|
|
|||
Loading…
Reference in a new issue