Materialize v10 sequential Ink branch

This commit is contained in:
Meta Vens 2026-05-02 04:04:18 +01:00
commit 6cbb91b6ff
11 changed files with 3948 additions and 11 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
VAR packet_shown = false
VAR sella_assessment_pending = false
VAR sella_intake_acceptance = false
-> start
=== start ===
// ghostlight.scene: scene-02-sanctuary-intake
// ghostlight.generated_by: experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10-no-think.capture.json
// aetheria.flashpoint: cold-wake-panic
The intake clinic sits behind Ganymede pumpworks, warm only where heat has been budgeted.
Sella Ren stands at the edge of an overfull triage board. Maer Tidecall has one corrupted packet and no clean proof.
What does Maer do?
* [Show the corrupted packet to Sella without claiming it as proof, allowing her to assess the noise or testimony.]
// ghostlight.branch: m1
// ghostlight.action: show_object
// ghostlight.intent: Make the packet present without treating it as clean evidence, letting Sella decide its weight.
-> packet_show
=== packet_show ===
~ packet_shown = true
~ sella_assessment_pending = true
Maer extends a data slate containing the corrupted packet toward Sella's workbench.
"Here is the packet. It is not proof. Assess it."
Sella does not take the packet. She keeps her hands at her sides and tilts her head slightly, eyes narrowing as she scans the data slate for corruption signatures.
"I won't accept this into intake without knowing what's inside. If it's noise, it's noise. If it's a person, I need to know the cost before I spend a bed."
// ghostlight.generated_branch: m1
// ghostlight.consequence: packet_assessment_boundary_reviewed_consequence
// ghostlight.training_hook: packet_presentation
// ghostlight.training_hook: noise_vs_testimony
// ghostlight.training_hook: evidence_ambiguity
// ghostlight.training_hook: intake_control
// ghostlight.training_hook: capacity_negotiation_under_uncertainty
// ghostlight.training_hook: triage_ethics
// ghostlight.training_hook: care_as_logistics
// ghostlight.training_hook: refusal_without_malice
// ghostlight.training_hook: assessing_corruption_risk
-> END

View file

@ -0,0 +1,150 @@
{
"schema_version": "ghostlight.ink_training_annotation.v0",
"annotation_id": "cold-wake-sanctuary-intake-qwen-sequential-v10-training-v0",
"ink_ref": "examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.ink",
"source_fixture_ref": "examples/agent-state.cold-wake-story-lab.json",
"scene_id": "scene-02-sanctuary-intake",
"protagonist_agent_id": "maer_tidecall",
"npc_agent_ids": [
"sella_ren"
],
"purpose": "Materialized accepted projector-routed sequential capture as playable Ink and supervised training data.",
"generation_provenance": {
"capture_ref": "experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10-no-think.capture.json",
"model": "qwen3.5:9b",
"review_status": "accepted_as_draft",
"think": false
},
"local_awareness_summary": [
{
"text": "Maer knows the clinic is nearly full, the packet may be testimony or noise, and rescue becomes theater if no one prepares intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs.maer_tidecall.speaker_local_truth"
]
},
{
"text": "Maer believes Sella will not hide behind false capacity, but asking her for help may be necessary and unfair.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs.maer_tidecall.speaker_beliefs"
]
},
{
"text": "Sella treats care as beds, food, air, consent, repair, and ongoing work rather than sentimental intent.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"projection_controls": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
},
"branches": [
{
"branch_id": "m1",
"ink_path": "packet_show",
"action_type": "show_object",
"actor_intent": "Make the packet present without treating it as clean evidence, letting Sella decide its weight.",
"state_basis": [
"The packet may contain medical telemetry, firmware noise, or testimony; Sella controls intake."
],
"reviewed_consequences": [
"If I accept without assessment, I risk wasting a bed on firmware noise or accepting a corrupted claim that compromises intake integrity. If I refuse outright, I risk Maer perceiving me as uncooperative, potentially damaging our alliance. By waiting and demanding assessment, I preserve my triage ethics while leaving room for Maer to provide the backing or conditions I need. This action maintains my stance that care is logistics and personhood is unresolved."
],
"training_hooks": [
"packet_presentation",
"noise_vs_testimony",
"evidence_ambiguity",
"intake_control",
"capacity_negotiation_under_uncertainty",
"triage_ethics",
"care_as_logistics",
"refusal_without_malice",
"assessing_corruption_risk"
],
"generation_notes": {
"choice_text": "Show the corrupted packet to Sella without claiming it as proof, allowing her to assess the noise or testimony.",
"observable_action": "Maer extends a data slate containing the corrupted packet toward Sella's workbench.",
"spoken_text": "Here is the packet. It is not proof. Assess it.",
"sella_observable_response": "Sella does not take the packet. She keeps her hands at her sides and tilts her head slightly, eyes narrowing as she scans the data slate for corruption signatures.",
"sella_spoken_text": "I won't accept this into intake without knowing what's inside. If it's noise, it's noise. If it's a person, I need to know the cost before I spend a bed."
}
}
],
"mutation_policy": {
"automated": [
"Ink variables may record local branch outcomes.",
"Accepted sequential captures may be materialized as draft playable scenes."
],
"manual_review_required": [
"Relationship deltas",
"Belief updates",
"Memory writes",
"Listener misread classification",
"Promotion from branch outcome into canonical Aetheria lore"
]
},
"audit": {
"reviewer": "Codex",
"review_status": "accepted",
"review_notes": [
"Materialized only after the capture validated as accepted-as-draft with no repair notes.",
"The branch preserves packet personhood uncertainty and Sella's intake authority.",
"Fuzzy state updates are handled by a separate reviewed mutation receipt."
],
"checks": {
"uses_standard_branching_format": true,
"actor_local_context_only": true,
"includes_non_speech_actions": true,
"fuzzy_updates_marked_for_manual_review": true,
"aetheria_lore_content_readable": true
}
}
}

View file

@ -227,7 +227,7 @@
],
"failure_notes": [],
"repair_notes": [],
"accepted_into_ink_ref": null,
"accepted_into_ink_ref": "examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.ink",
"pipeline_lessons": [
"Sequential generation needs event appraisal/consolidation before next actor selection.",
"Action type selection should be tool-shaped or schema-constrained, not left to prose compliance.",

View file

@ -0,0 +1,175 @@
{
"schema_version": "ghostlight.reviewed_state_mutation.v0",
"mutation_id": "mutation-sanctuary-packet-assessment-v10",
"source_fixture_ref": "examples/agent-state.cold-wake-story-lab.json",
"source_capture_ref": "experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10-no-think.capture.json",
"mutated_fixture_ref": "examples/agent-state.cold-wake-story-lab.after-v10-packet-assessment.json",
"selected_branch_id": "m1",
"event_id": "event-sanctuary-packet-assessment-boundary",
"participant_appraisals": [
{
"participant_agent_id": "maer_tidecall",
"trigger_observable_action": {
"speaker_id": "sella_ren",
"action_type": "wait",
"utterance_summary": "I won't accept this into intake without knowing what's inside. If it's noise, it's noise. If it's a person, I need to know the cost before I spend a bed.",
"dialogue_function": "withhold_intake_pending_assessment",
"observable_cues": [
"Sella does not take the packet. She keeps her hands at her sides and tilts her head slightly, eyes narrowing as she scans the data slate for corruption signatures."
]
},
"private_interpretation": "Sella is not accepting the packet yet, but she has not collapsed uncertainty into refusal.",
"state_deltas": [
{
"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation",
"delta": 0.01
},
{
"path": "canonical_state.behavioral_dimensions.suspicion.current_activation",
"delta": -0.02
}
],
"next_action_constraints": [
"Do not treat Sella's assessment boundary as a clean refusal.",
"Do not resolve packet personhood.",
"Any next Maer action should answer cost, risk, or provenance rather than demand acceptance."
]
},
{
"participant_agent_id": "sella_ren",
"trigger_observable_action": {
"speaker_id": "maer_tidecall",
"action_type": "show_object",
"utterance_summary": "Here is the packet. It is not proof. Assess it.",
"dialogue_function": "present_ambiguous_evidence",
"observable_cues": [
"Maer extends a data slate containing the corrupted packet toward Sella's workbench."
]
},
"private_interpretation": "Maer is offering the packet as a test of our capacity to triage under uncertainty, not as a plea for immediate acceptance. He knows the packet is ambiguous and wants Sella to assess the risk before committing beds. His urgency is genuine but he is aware that the packet itself is not proof of personhood or need.",
"state_deltas": [
{
"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation",
"delta": 0.03
},
{
"path": "canonical_state.situational_state.scarcity_pressure.current_activation",
"delta": 0.02
},
{
"path": "canonical_state.situational_state.overstimulation.current_activation",
"delta": 0.02
}
],
"next_action_constraints": [
"Do not accept the packet into intake flow without assessing the risk of corruption.",
"Do not let compassion manufacture capacity; every acceptance must be backed by available resources.",
"Frame the response as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"Speak warmly but do not soften the capacity limits; treat care as logistics and personhood as unresolved."
]
}
],
"observed_action": {
"speaker_id": "maer_tidecall",
"action_type": "show_object",
"utterance_summary": "Here is the packet. It is not proof. Assess it.",
"dialogue_function": "present_ambiguous_evidence",
"observable_cues": [
"Maer extends a data slate containing the corrupted packet toward Sella's workbench."
]
},
"observed_response": {
"speaker_id": "sella_ren",
"action_type": "wait",
"utterance_summary": "I won't accept this into intake without knowing what's inside. If it's noise, it's noise. If it's a person, I need to know the cost before I spend a bed.",
"dialogue_function": "withhold_intake_pending_assessment",
"observable_cues": [
"Sella does not take the packet. She keeps her hands at her sides and tilts her head slightly, eyes narrowing as she scans the data slate for corruption signatures."
]
},
"applied_mutations": [
{
"target": "maer_tidecall",
"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation",
"before": 0.67,
"after": 0.68
},
{
"target": "maer_tidecall",
"path": "canonical_state.behavioral_dimensions.suspicion.current_activation",
"before": 0.71,
"after": 0.69
},
{
"target": "sella_ren",
"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation",
"before": 0.5,
"after": 0.53
},
{
"target": "sella_ren",
"path": "canonical_state.situational_state.scarcity_pressure.current_activation",
"before": 0.84,
"after": 0.86
},
{
"target": "sella_ren",
"path": "canonical_state.situational_state.overstimulation.current_activation",
"before": 0.72,
"after": 0.74
},
{
"target": "rel-maer-sella",
"path": "stance.trust.current_activation",
"before": 0.7,
"after": 0.71
},
{
"target": "rel-maer-sella",
"path": "stance.respect.current_activation",
"before": 0.78,
"after": 0.8
},
{
"target": "rel-maer-sella",
"path": "stance.obligation.current_activation",
"before": 0.6,
"after": 0.61
},
{
"target": "rel-sella-maer",
"path": "stance.trust.current_activation",
"before": 0.57,
"after": 0.59
},
{
"target": "rel-sella-maer",
"path": "stance.respect.current_activation",
"before": 0.73,
"after": 0.75
},
{
"target": "rel-sella-maer",
"path": "stance.resentment.current_activation",
"before": 0.36,
"after": 0.34
},
{
"target": "rel-sella-maer",
"path": "stance.obligation.current_activation",
"before": 0.48,
"after": 0.49
}
],
"manual_review_notes": [
"The packet remains unresolved.",
"Sella's non-acceptance is modeled as assessment boundary, not refusal.",
"Both Maer and Sella receive state, memory, relationship, or perception updates.",
"Fuzzy updates are manual reviewed training data."
],
"deferred_mutations": [
"No sanctuary bed is opened or consumed.",
"No personhood claim is proven or disproven.",
"No automatic relationship classifier is trained yet."
]
}

View file

@ -78,6 +78,7 @@ Ghostlight now has the persistence spine plus the first architecture payload:
- `tools/materialize_qwen_ink_draft.py`
- `tools/validate_ink_examples.py`
- `tools/run_qwen_ink_sequential_generation.py`
- `tools/materialize_sequential_capture.py`
- `tools/apply_sequential_ink_branch_mutation.py`
- `inkjs` dev dependency and `npm run ink:validate`
- sequential branch mutation seam:
@ -92,6 +93,11 @@ Ghostlight now has the persistence spine plus the first architecture payload:
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v1.mutation.json`
- `experiments/ink/qwen-chat-tools-smoke.json`
- `examples/agent-state.cold-wake-story-lab.after-sanctuary-ledger.json`
- projector-routed sequential materialization seam:
- `examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.ink`
- `examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.training.json`
- `examples/agent-state.cold-wake-story-lab.after-v10-packet-assessment.json`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10.mutation.json`
- projected local context seam:
- `schemas/projected-local-context.schema.json`
- `examples/projected-contexts/scene-02-sanctuary-intake.maer_tidecall.projected-context.json`
@ -129,8 +135,9 @@ training feedstock for projection and dialogue scaffolding.
## Current Next Action
Materialize the accepted v10 projector-routed sequential capture into Ink and
reviewed mutation training data, keeping fuzzy state changes manual and audited.
Review the materialized v10 Ink branch and mutation receipt for narrative
quality and state-change plausibility, then either polish the Ink text or
generalize the sequential materializer for more accepted captures.
Cat/Oz remains useful as an Elysium procedural mechanics fixture, but grounded
training data should start from authored historical lore rather than gameplay
@ -246,13 +253,22 @@ Completed projection path items:
- add v10 no-thinking projector-routed capture:
`experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10-no-think.capture.json`
validates as accepted-as-draft with no repair notes or failure notes
- materialize v10:
`tools/materialize_sequential_capture.py` wrote a playable Ink branch, sidecar
training annotation, reviewed mutation receipt, and mutated Cold Wake fixture
from the accepted projector-routed capture
- update v10 capture provenance:
`accepted_into_ink_ref` now points at
`examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.ink`
Remaining projection path:
- build a deterministic speaker-local input slicer
- build a renderer that emits projection controls before prompt prose
- materialize the accepted v10 projector-routed capture into Ink and reviewed
mutation training data
- review the materialized v10 Ink and mutation receipt for narrative quality and
state-change plausibility
- decide whether to polish this Ink text by hand or generalize the sequential
materializer for future accepted captures
- preserve the no-thinking default for strict tool-call generation unless a
diagnostic run explicitly needs `--think`
- improve the local-awareness-to-Ink prompt so semantic `training_hooks` do not

View file

@ -124,6 +124,11 @@ state and re-entry discipline.
- `examples/ink/cold-wake-sanctuary-intake.qwen-draft.training.json`
- sidecar annotation for the generated draft, accepted as training material
rather than final polished prose
- `examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.ink`
- first playable Ink branch materialized from an accepted projector-routed
sequential Qwen capture
- `examples/ink/cold-wake-sanctuary-intake.qwen-sequential-v10.training.json`
- sidecar annotation for the v10 materialized sequential branch
- `experiments/ink/cold-wake-sanctuary-intake-qwen-branch-candidates-v1.capture.json`
- reviewed Qwen branch-generation receipt, including prompt, parsed response,
strengths, failure notes, and pipeline lessons
@ -173,6 +178,13 @@ state and re-entry discipline.
- mutated Cold Wake fixture after the selected sanctuary ledger branch,
updating Maer and Sella state, relationship stance, memories, perceived
overlays, event log, and active scene memories
- `examples/agent-state.cold-wake-story-lab.after-v10-packet-assessment.json`
- mutated Cold Wake fixture after the v10 packet-assessment branch,
preserving unresolved packet personhood while updating state, relationship
stance, memories, perceived overlays, event log, and active scene memories
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v10.mutation.json`
- reviewed mutation receipt for v10 materialization, keeping fuzzy appraisal
and relationship movement manual and auditable
- `tools/ghostlight_state.py`
- compact state inspection and evidence or branch updates
- `tools/ghostlight_prepare_compaction.py`
@ -197,6 +209,9 @@ state and re-entry discipline.
- `tools/materialize_qwen_ink_draft.py`
- turns a reviewed Qwen branch capture into a playable Ink draft and sidecar
annotation
- `tools/materialize_sequential_capture.py`
- turns an accepted sequential capture into playable Ink, sidecar annotation,
reviewed mutation receipt, and a mutated fixture
- `tools/run_qwen_ink_sequential_generation.py`
- builds a sequential Qwen prototype through Ollama `/api/chat` with native
tools and thinking disabled by default: actor-local choices, participant
@ -247,5 +262,7 @@ v9 show that Qwen tool-call reliability, not the projector seam, is now the
immediate blocker. The v9 thinking trace also showed schema self-check looping
instead of tool-call completion, so strict sequential generation now disables
thinking by default. v10 validated that correction with an accepted-as-draft
projector-routed no-thinking capture. The next implementation target is
materializing v10 into Ink plus reviewed mutation training data.
projector-routed no-thinking capture, which has now been materialized into Ink
plus reviewed mutation training data. The next implementation target is
reviewing the materialized v10 branch and mutation receipt for narrative quality
and state-change plausibility before polishing or generalizing the materializer.

View file

@ -144,8 +144,13 @@
- Tenth sequential draft: v10 ran projector-routed generation with thinking
disabled and validated as accepted-as-draft with no repair or failure
notes.
- Next prototype: materialize the accepted v10 projector-routed branch into
Ink and sidecar annotation, then produce reviewed mutation training data.
- V10 materialization: `tools/materialize_sequential_capture.py`
materialized the accepted projector-routed capture into Ink, sidecar
annotation, reviewed mutation receipt, and a mutated Cold Wake fixture.
- Next prototype: review the materialized v10 branch and mutation receipt
for narrative quality and state-change plausibility, then decide whether
to polish the branch or generalize the materializer for additional
accepted captures.
5. Build the projection distillation loop. Started.
- Use `docs/architecture/projection-distillation-plan.md` as the teacher to

View file

@ -40,3 +40,4 @@
{"ts": "2026-05-02T02:45:44+00:00", "type": "implementation", "status": "ok", "note": "Added ghostlight.projected_local_context.v0 seam and deterministic projector so sequential Qwen prompts consume character-local operating prose instead of raw canonical state variables. v6 projector-routed capture validated as useful-needs-revision due nested response_constraints stringification."}
{"ts": "2026-05-02T02:54:51+00:00", "type": "implementation", "status": "ok", "note": "Tightened projector-routed sequential runner: failed Maer choice calls now write reviewed receipts, parser can repair obvious truncated stringified tool arrays, repair notes are separated from fatal validation notes, and next-action prompts receive appraisal prose instead of raw numeric deltas. v8/v9 captures show Qwen still has tool-call reliability failures, so no projector-routed branch was materialized."}
{"ts": "2026-05-02T03:00:05+00:00", "type": "implementation", "status": "ok", "note": "Disabled thinking by default for strict projector-routed sequential Qwen generation after v9 thinking trace showed schema self-check looping. v10 no-think run completed quickly and validated as accepted_as_draft with no repair or failure notes."}
{"ts": "2026-05-02T03:03:14+00:00", "type": "implementation", "status": "ok", "note": "Materialized accepted v10 no-thinking projector-routed sequential capture into playable Ink, sidecar annotation, reviewed mutation receipt, and mutated Cold Wake fixture. Validation passes; fuzzy state, memory, relationship, and perceived-overlay updates remain manual reviewed training data."}

View file

@ -129,7 +129,9 @@ accepted_design:
- v8 and v9 projector-routed captures show Qwen tool-call reliability remains the blocker: malformed stringified tool arrays and no-tool-call dropouts can occur even when the projector seam is clean.
- Thinking should be disabled by default for strict Qwen scene-generation tool calls; the v9 trace showed schema self-check looping that lasted minutes and ended with no tool call.
- The first no-thinking projector-routed sequential run, v10, validated as accepted-as-draft with no repair or failure notes.
- The accepted v10 projector-routed capture has been materialized into playable Ink, sidecar training annotation, reviewed mutation receipt, and a mutated Cold Wake fixture.
- Materialized sequential captures should still keep fuzzy state, relationship, memory, and perceived-overlay changes manual and audited until classifiers exist.
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 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, and a v10 no-thinking projector-routed capture accepted as draft.
next_action: Materialize the accepted v10 projector-routed sequential capture into Ink and reviewed mutation training data, keeping fuzzy state changes manual and audited.
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 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, and the first materialized projector-routed sequential Ink scene with reviewed mutation training data.
next_action: Review the materialized v10 Ink branch and mutation receipt for narrative quality and state-change plausibility, then either polish the Ink text or generalize the sequential materializer for more accepted captures.

View file

@ -0,0 +1,486 @@
"""Materialize an accepted sequential Qwen capture into Ink and mutation data."""
from __future__ import annotations
import argparse
import copy
import json
import re
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
DEFAULT_CAPTURE = ROOT / "experiments" / "ink" / "cold-wake-sanctuary-intake-qwen-sequential-v10-no-think.capture.json"
DEFAULT_INK_OUT = ROOT / "examples" / "ink" / "cold-wake-sanctuary-intake.qwen-sequential-v10.ink"
DEFAULT_TRAINING_OUT = ROOT / "examples" / "ink" / "cold-wake-sanctuary-intake.qwen-sequential-v10.training.json"
DEFAULT_STATE_OUT = ROOT / "examples" / "agent-state.cold-wake-story-lab.after-v10-packet-assessment.json"
DEFAULT_MUTATION_OUT = ROOT / "experiments" / "ink" / "cold-wake-sanctuary-intake-qwen-sequential-v10.mutation.json"
EVENT_ID = "event-sanctuary-packet-assessment-boundary"
MAER_MEMORY_ID = "memory-maer-sella-assess-before-intake"
SELLA_MEMORY_ID = "memory-sella-maer-packet-assessment"
def load_json(path: Path) -> Any:
return json.loads(path.read_text(encoding="utf-8"))
def write_json(path: Path, payload: Any) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
def write_text(path: Path, text: str) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(text, encoding="utf-8")
def rel(path: Path) -> str:
return str(path.relative_to(ROOT)).replace("\\", "/")
def ink_identifier(value: str) -> str:
cleaned = re.sub(r"[^A-Za-z0-9_]+", "_", value).strip("_")
if not cleaned:
cleaned = "branch"
if cleaned[0].isdigit():
return f"branch_{cleaned}"
return cleaned
def as_list(value: Any) -> list[str]:
if isinstance(value, list):
return [str(item) for item in value if str(item).strip()]
if isinstance(value, str) and value.strip():
return [value.strip()]
return []
def find_agent(state: dict[str, Any], agent_id: str) -> dict[str, Any]:
return next(agent for agent in state["agents"] if agent["agent_id"] == agent_id)
def find_relationship(state: dict[str, Any], relationship_id: str) -> dict[str, Any]:
return next(rel for rel in state["relationships"] if rel["relationship_id"] == relationship_id)
def find_scene(state: dict[str, Any], scene_id: str) -> dict[str, Any]:
return next(scene for scene in state["scenes"] if scene["scene_id"] == scene_id)
def clamp(value: float) -> float:
return max(0.0, min(1.0, round(value, 3)))
def apply_delta(container: dict[str, Any], path: list[str], delta: float) -> tuple[float, float]:
target: Any = container
for key in path[:-1]:
target = target[key]
leaf = target[path[-1]]
before = leaf["current_activation"]
after = clamp(before + delta)
leaf["current_activation"] = after
return before, after
def ensure_value(items: list[str], value: str) -> None:
if value not in items:
items.append(value)
def ensure_list_item(items: list[Any], key: str, value: str, item: dict[str, Any]) -> None:
if not any(isinstance(existing, dict) and existing.get(key) == value for existing in items):
items.append(item)
def ensure_overlay(agent: dict[str, Any], observer_id: str, target_id: str) -> dict[str, Any]:
for overlay in agent["perceived_state_overlays"]:
if overlay["observer_agent_id"] == observer_id and overlay["target_agent_id"] == target_id:
return overlay
overlay = {
"observer_agent_id": observer_id,
"target_agent_id": target_id,
"perceived_dimensions": {},
"beliefs": [],
"distortions": [],
}
agent["perceived_state_overlays"].append(overlay)
return overlay
def update_perceived_dimension(overlay: dict[str, Any], name: str, observed: float, attributed: float, confidence: float) -> None:
overlay["perceived_dimensions"][name] = {
"observed_activation": clamp(observed),
"attributed_disposition": clamp(attributed),
"confidence": clamp(confidence),
}
def selected_action(capture: dict[str, Any]) -> dict[str, Any]:
return capture["passes"]["selected_observable_action"]
def sella_appraisal(capture: dict[str, Any]) -> dict[str, Any]:
return capture["passes"]["sella_immediate_appraisal"]["parsed_response"]["appraisal"]
def sella_response(capture: dict[str, Any]) -> dict[str, Any]:
return capture["passes"]["sella_response_generation"]["parsed_response"]["response"]
def build_ink(capture: dict[str, Any]) -> str:
selected = selected_action(capture)
response = sella_response(capture)
knot = ink_identifier(selected["ink_path"])
lines = [
"VAR packet_shown = false",
"VAR sella_assessment_pending = false",
"VAR sella_intake_acceptance = false",
"",
"-> start",
"",
"=== start ===",
"// ghostlight.scene: scene-02-sanctuary-intake",
f"// ghostlight.generated_by: {rel(DEFAULT_CAPTURE)}",
"// aetheria.flashpoint: cold-wake-panic",
"",
"The intake clinic sits behind Ganymede pumpworks, warm only where heat has been budgeted.",
"Sella Ren stands at the edge of an overfull triage board. Maer Tidecall has one corrupted packet and no clean proof.",
"",
"What does Maer do?",
"",
f"* [{selected['choice_text']}]",
f" // ghostlight.branch: {selected['branch_id']}",
f" // ghostlight.action: {selected['action_type']}",
f" // ghostlight.intent: {selected['actor_intent_private']}",
f" -> {knot}",
"",
f"=== {knot} ===",
"~ packet_shown = true",
"~ sella_assessment_pending = true",
"",
selected["observable_action"],
"",
f"\"{selected['spoken_text']}\"",
"",
response["observable_response"],
"",
f"\"{response['spoken_text']}\"",
"",
f"// ghostlight.generated_branch: {selected['branch_id']}",
"// ghostlight.consequence: packet_assessment_boundary_reviewed_consequence",
]
for hook in as_list(selected.get("training_hooks")) + as_list(response.get("training_hooks")):
lines.append(f"// ghostlight.training_hook: {hook}")
lines.extend(["-> END", ""])
return "\n".join(lines)
def build_training(capture: dict[str, Any], ink_ref: str) -> dict[str, Any]:
selected = selected_action(capture)
response = sella_response(capture)
source_annotation = load_json(ROOT / capture["source_annotation_ref"])
return {
"schema_version": "ghostlight.ink_training_annotation.v0",
"annotation_id": "cold-wake-sanctuary-intake-qwen-sequential-v10-training-v0",
"ink_ref": ink_ref,
"source_fixture_ref": capture["source_fixture_ref"],
"scene_id": "scene-02-sanctuary-intake",
"protagonist_agent_id": "maer_tidecall",
"npc_agent_ids": ["sella_ren"],
"purpose": "Materialized accepted projector-routed sequential capture as playable Ink and supervised training data.",
"generation_provenance": {
"capture_ref": rel(DEFAULT_CAPTURE),
"model": capture["model"],
"review_status": capture["review"]["status"],
"think": capture["request_options"]["think"],
},
"local_awareness_summary": source_annotation["local_awareness_summary"],
"projection_controls": source_annotation["projection_controls"],
"branches": [
{
"branch_id": selected["branch_id"],
"ink_path": ink_identifier(selected["ink_path"]),
"action_type": selected["action_type"],
"actor_intent": selected["actor_intent_private"],
"state_basis": as_list(selected["state_basis"]),
"reviewed_consequences": as_list(response["reviewed_consequences"]),
"training_hooks": as_list(selected.get("training_hooks")) + as_list(response.get("training_hooks")),
"generation_notes": {
"choice_text": selected["choice_text"],
"observable_action": selected["observable_action"],
"spoken_text": selected["spoken_text"],
"sella_observable_response": response["observable_response"],
"sella_spoken_text": response["spoken_text"],
},
}
],
"mutation_policy": {
"automated": [
"Ink variables may record local branch outcomes.",
"Accepted sequential captures may be materialized as draft playable scenes.",
],
"manual_review_required": [
"Relationship deltas",
"Belief updates",
"Memory writes",
"Listener misread classification",
"Promotion from branch outcome into canonical Aetheria lore",
],
},
"audit": {
"reviewer": "Codex",
"review_status": "accepted",
"review_notes": [
"Materialized only after the capture validated as accepted-as-draft with no repair notes.",
"The branch preserves packet personhood uncertainty and Sella's intake authority.",
"Fuzzy state updates are handled by a separate reviewed mutation receipt.",
],
"checks": {
"uses_standard_branching_format": True,
"actor_local_context_only": True,
"includes_non_speech_actions": True,
"fuzzy_updates_marked_for_manual_review": True,
"aetheria_lore_content_readable": True,
},
},
}
def apply_reviewed_mutation(capture: dict[str, Any], fixture: dict[str, Any], out_state: Path, mutation_out: Path) -> None:
state = copy.deepcopy(fixture)
selected = selected_action(capture)
appraisal = sella_appraisal(capture)
response = sella_response(capture)
maer = find_agent(state, "maer_tidecall")
sella = find_agent(state, "sella_ren")
rel_maer_sella = find_relationship(state, "rel-maer-sella")
rel_sella_maer = find_relationship(state, "rel-sella-maer")
applied: list[dict[str, Any]] = []
for target_name, container, path, delta in [
("maer_tidecall", maer, ["canonical_state", "behavioral_dimensions", "control_pressure"], 0.01),
("maer_tidecall", maer, ["canonical_state", "behavioral_dimensions", "suspicion"], -0.02),
("sella_ren", sella, ["canonical_state", "behavioral_dimensions", "control_pressure"], 0.03),
("sella_ren", sella, ["canonical_state", "situational_state", "scarcity_pressure"], 0.02),
("sella_ren", sella, ["canonical_state", "situational_state", "overstimulation"], 0.02),
]:
before, after = apply_delta(container, path, delta)
applied.append({"target": target_name, "path": ".".join(path) + ".current_activation", "before": before, "after": after})
for relationship, deltas in [
(rel_maer_sella, [("trust", 0.01), ("respect", 0.02), ("obligation", 0.01)]),
(rel_sella_maer, [("trust", 0.02), ("respect", 0.02), ("resentment", -0.02), ("obligation", 0.01)]),
]:
for name, delta in deltas:
before, after = apply_delta(relationship, ["stance", name], delta)
applied.append({"target": relationship["relationship_id"], "path": f"stance.{name}.current_activation", "before": before, "after": after})
ensure_value(relationship.setdefault("unresolved_incident_ids", []), EVENT_ID)
rel_maer_sella["summary"] = "Maer reads Sella's refusal to take the packet immediately as a real intake boundary, but not a refusal of rescue."
rel_sella_maer["summary"] = "Sella respects Maer's honesty about uncertainty and holds him at the boundary where care must become assessment before intake."
ensure_list_item(
maer["memories"]["relationship_summaries"],
"memory_id",
MAER_MEMORY_ID,
{
"memory_id": MAER_MEMORY_ID,
"summary": "Sella would not take the corrupted packet into intake before assessment, but she left room for rescue if the cost and contents can be named.",
"salience": 0.74,
"confidence": 0.69,
"linked_event_ids": [EVENT_ID],
"linked_relationship_id": "rel-maer-sella",
},
)
ensure_list_item(
sella["memories"]["relationship_summaries"],
"memory_id",
SELLA_MEMORY_ID,
{
"memory_id": SELLA_MEMORY_ID,
"summary": "Maer showed the corrupted packet without calling it proof, which made assessment possible without surrendering intake authority.",
"salience": 0.78,
"confidence": 0.73,
"linked_event_ids": [EVENT_ID],
"linked_relationship_id": "rel-sella-maer",
},
)
maer_overlay = ensure_overlay(maer, "maer_tidecall", "sella_ren")
update_perceived_dimension(maer_overlay, "control_pressure", 0.64, 0.58, 0.56)
update_perceived_dimension(maer_overlay, "interpersonal_warmth", 0.62, 0.7, 0.57)
ensure_list_item(
maer_overlay["beliefs"],
"belief_id",
"belief-maer-sella-assessment-is-not-refusal",
{
"belief_id": "belief-maer-sella-assessment-is-not-refusal",
"subject_id": "sella_ren",
"claim_type": "motive_inference",
"claim": "Sella's refusal to take the packet immediately is boundary defense, not proof she has abandoned rescue.",
"confidence": 0.62,
"evidence_event_ids": [EVENT_ID],
"visibility": "private",
"emotional_charge": 0.38,
},
)
sella_overlay = ensure_overlay(sella, "sella_ren", "maer_tidecall")
update_perceived_dimension(sella_overlay, "control_pressure", 0.58, 0.56, 0.6)
update_perceived_dimension(sella_overlay, "interpersonal_warmth", 0.61, 0.64, 0.6)
ensure_list_item(
sella_overlay["beliefs"],
"belief_id",
"belief-sella-maer-can-present-uncertainty-cleanly",
{
"belief_id": "belief-sella-maer-can-present-uncertainty-cleanly",
"subject_id": "maer_tidecall",
"claim_type": "motive_inference",
"claim": "Maer can make uncertainty materially present without always turning it into proof or accusation.",
"confidence": 0.64,
"evidence_event_ids": [EVENT_ID],
"visibility": "private",
"emotional_charge": 0.35,
},
)
scene = find_scene(state, "scene-02-sanctuary-intake")
for pack in scene["dialogue_context_packs"]:
if pack["speaker_agent_id"] == "maer_tidecall":
ensure_value(pack["active_memories"], MAER_MEMORY_ID)
ensure_value(pack["speaker_beliefs"], "Sella's assessment boundary is not the same as a refusal of rescue.")
if pack["speaker_agent_id"] == "sella_ren":
ensure_value(pack["active_memories"], SELLA_MEMORY_ID)
ensure_value(pack["speaker_beliefs"], "Maer can show uncertainty without demanding that sanctuary call it proof.")
event = {
"event_id": EVENT_ID,
"kind": "mixed",
"summary": "Maer showed Sella the corrupted packet without claiming it as proof; Sella refused intake acceptance until assessment could name contents, risk, and cost.",
"participants": ["maer_tidecall", "sella_ren"],
"pressure_tags": ["cold_wake", "packet_assessment", "sanctuary_capacity", "personhood_uncertainty"],
"observed_exchange": [
{
"speaker_id": "maer_tidecall",
"action_type": selected["action_type"],
"utterance_summary": selected["spoken_text"],
"dialogue_function": "present_ambiguous_evidence",
"observable_cues": [selected["observable_action"]],
},
{
"speaker_id": "sella_ren",
"action_type": response["action_type"],
"utterance_summary": response["spoken_text"],
"dialogue_function": "withhold_intake_pending_assessment",
"observable_cues": [response["observable_response"]],
},
],
"private_interpretations": [
{
"agent_id": "sella_ren",
"interpretation": appraisal["private_interpretation"],
"attributed_motive": appraisal["attributed_motive"],
"appraisal_tags": ["assessment_boundary", "capacity_risk", "guarded_trust"],
"confidence": 0.68,
},
{
"agent_id": "maer_tidecall",
"interpretation": "Sella is holding the packet at the assessment boundary rather than erasing the rescue claim.",
"attributed_motive": "Protect sanctuary intake integrity while leaving room for a justified rescue commitment.",
"appraisal_tags": ["boundary_not_refusal", "rescue_still_live"],
"confidence": 0.61,
},
],
"event_effects": [],
}
if not any(existing["event_id"] == EVENT_ID for existing in state["events"]):
state["events"].append(event)
participant_appraisals = [
{
"participant_agent_id": "maer_tidecall",
"trigger_observable_action": event["observed_exchange"][1],
"private_interpretation": "Sella is not accepting the packet yet, but she has not collapsed uncertainty into refusal.",
"state_deltas": [
{"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation", "delta": 0.01},
{"path": "canonical_state.behavioral_dimensions.suspicion.current_activation", "delta": -0.02},
],
"next_action_constraints": [
"Do not treat Sella's assessment boundary as a clean refusal.",
"Do not resolve packet personhood.",
"Any next Maer action should answer cost, risk, or provenance rather than demand acceptance.",
],
},
{
"participant_agent_id": "sella_ren",
"trigger_observable_action": event["observed_exchange"][0],
"private_interpretation": appraisal["private_interpretation"],
"state_deltas": [
{"path": "canonical_state.behavioral_dimensions.control_pressure.current_activation", "delta": 0.03},
{"path": "canonical_state.situational_state.scarcity_pressure.current_activation", "delta": 0.02},
{"path": "canonical_state.situational_state.overstimulation.current_activation", "delta": 0.02},
],
"next_action_constraints": appraisal["response_constraints"],
},
]
receipt = {
"schema_version": "ghostlight.reviewed_state_mutation.v0",
"mutation_id": "mutation-sanctuary-packet-assessment-v10",
"source_fixture_ref": capture["source_fixture_ref"],
"source_capture_ref": rel(DEFAULT_CAPTURE),
"mutated_fixture_ref": rel(out_state),
"selected_branch_id": selected["branch_id"],
"event_id": EVENT_ID,
"participant_appraisals": participant_appraisals,
"observed_action": event["observed_exchange"][0],
"observed_response": event["observed_exchange"][1],
"applied_mutations": applied,
"manual_review_notes": [
"The packet remains unresolved.",
"Sella's non-acceptance is modeled as assessment boundary, not refusal.",
"Both Maer and Sella receive state, memory, relationship, or perception updates.",
"Fuzzy updates are manual reviewed training data.",
],
"deferred_mutations": [
"No sanctuary bed is opened or consumed.",
"No personhood claim is proven or disproven.",
"No automatic relationship classifier is trained yet.",
],
}
write_json(out_state, state)
write_json(mutation_out, receipt)
def main() -> int:
parser = argparse.ArgumentParser(description="Materialize an accepted sequential Qwen capture.")
parser.add_argument("--capture", type=Path, default=DEFAULT_CAPTURE)
parser.add_argument("--ink-out", type=Path, default=DEFAULT_INK_OUT)
parser.add_argument("--training-out", type=Path, default=DEFAULT_TRAINING_OUT)
parser.add_argument("--state-out", type=Path, default=DEFAULT_STATE_OUT)
parser.add_argument("--mutation-out", type=Path, default=DEFAULT_MUTATION_OUT)
args = parser.parse_args()
capture = load_json(args.capture)
if capture["review"]["status"] != "accepted_as_draft":
raise SystemExit("Only accepted_as_draft sequential captures can be materialized")
if capture["review"].get("failure_notes") or capture["review"].get("repair_notes"):
raise SystemExit("Materialization requires an accepted capture without failure or repair notes")
fixture = load_json(ROOT / capture["source_fixture_ref"])
ink_ref = rel(args.ink_out)
write_text(args.ink_out, build_ink(capture))
write_json(args.training_out, build_training(capture, ink_ref))
apply_reviewed_mutation(capture, fixture, args.state_out, args.mutation_out)
capture["review"]["accepted_into_ink_ref"] = ink_ref
write_json(args.capture, capture)
print(f"wrote {rel(args.ink_out)}")
print(f"wrote {rel(args.training_out)}")
print(f"wrote {rel(args.state_out)}")
print(f"wrote {rel(args.mutation_out)}")
return 0
if __name__ == "__main__":
raise SystemExit(main())