From b8c6f0c018875140a146761bda418cfb7c291463 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 2 May 2026 02:40:58 +0100 Subject: [PATCH] Keep Ghostlight Ink metadata out of preview --- docs/architecture/ink-branching-scenes.md | 14 +++-- examples/ink/cold-wake-sanctuary-intake.ink | 56 +++++++++--------- .../cold-wake-sanctuary-intake.qwen-draft.ink | 58 +++++++++---------- state/evidence.jsonl | 1 + tools/materialize_qwen_ink_draft.py | 20 +++---- tools/validate_ink_examples.py | 10 ++++ 6 files changed, 86 insertions(+), 73 deletions(-) diff --git a/docs/architecture/ink-branching-scenes.md b/docs/architecture/ink-branching-scenes.md index ca2a416..e0535f1 100644 --- a/docs/architecture/ink-branching-scenes.md +++ b/docs/architecture/ink-branching-scenes.md @@ -4,7 +4,7 @@ Ink is the branching scene format. Ghostlight should not invent a parallel dialogue-tree language unless Ink fails a concrete requirement. Ink already gives us readable interactive fiction, -choices, knots, stitches, variables, tags, compiled JSON, and a format writers +choices, knots, stitches, variables, compiled JSON, and a format writers can inspect without needing to wear a compiler helmet indoors. Ghostlight's job is the machinery around Ink: @@ -57,9 +57,9 @@ That distinction matters. A generated branch can be useful because it exposes a decision shape, an action type, a misread, or a prompt failure even when the line writing still needs a human with a knife. -## Ink Tags +## Ink Comments -Use Ink tags for lightweight traceability: +Use Ink comments for lightweight traceability in writer-facing drafts: - `ghostlight.scene` - `ghostlight.fixture` @@ -71,8 +71,10 @@ Use Ink tags for lightweight traceability: - `ghostlight.training_hook` - `aetheria.flashpoint` -Tags are not the full state model. They are handles that let runtime and -training tools connect a playable branch back to Ghostlight state. +Use `//`, not Ink tags (`#`), for this metadata in drafts. Inky exposes tags in +preview, which makes Ghostlight state leak into the readable scene. The +sidecar remains the machine-readable receipt; comments are only local handles +for humans and simple tools. ## Sidecar Annotations @@ -103,7 +105,7 @@ Automatic: - Ink compilation - branch id and knot validation - local variables for the current playthrough -- mechanical tags and training hook checks +- mechanical comment handles and training hook checks Manual reviewed until trained: diff --git a/examples/ink/cold-wake-sanctuary-intake.ink b/examples/ink/cold-wake-sanctuary-intake.ink index d1eab02..70c12ce 100644 --- a/examples/ink/cold-wake-sanctuary-intake.ink +++ b/examples/ink/cold-wake-sanctuary-intake.ink @@ -7,9 +7,9 @@ VAR packet_shown = false -> start === start === -# ghostlight.scene: scene-02-sanctuary-intake -# ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json -# aetheria.flashpoint: cold-wake-panic +// ghostlight.scene: scene-02-sanctuary-intake +// ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json +// aetheria.flashpoint: cold-wake-panic The intake clinic sits behind the pumpworks where the dockside heat exchangers make every prayer sound like a maintenance complaint. @@ -28,27 +28,27 @@ Sella does not look at the slate first. She looks at Maer. What does Maer do? * [Name the cost and put the route ledger behind it.] - # ghostlight.branch: branch-maer-name-cost-and-offer-ledger - # ghostlight.action: speak - # ghostlight.intent: ask_for_capacity_while_accepting_material_obligation + // ghostlight.branch: branch-maer-name-cost-and-offer-ledger + // ghostlight.action: speak + // ghostlight.intent: ask_for_capacity_while_accepting_material_obligation -> ledger_backed_bay * [Step to the intake board and help triage before asking.] - # ghostlight.branch: branch-maer-help-triage-before-asking - # ghostlight.action: gesture - # ghostlight.intent: earn_the_right_to_ask_by_sharing_logistical_burden + // ghostlight.branch: branch-maer-help-triage-before-asking + // ghostlight.action: gesture + // ghostlight.intent: earn_the_right_to_ask_by_sharing_logistical_burden -> triage_first * [Show Sella the corrupted packet.] - # ghostlight.branch: branch-maer-show-packet - # ghostlight.action: show_object - # ghostlight.intent: make_uncertainty_morally_present_without_overclaiming + // ghostlight.branch: branch-maer-show-packet + // ghostlight.action: show_object + // ghostlight.intent: make_uncertainty_morally_present_without_overclaiming -> show_packet * [Press the personhood risk until capacity stops being the only frame.] - # ghostlight.branch: branch-maer-press-moral-frame - # ghostlight.action: speak - # ghostlight.intent: force_personhood_risk_to_dominate_capacity_limits + // ghostlight.branch: branch-maer-press-moral-frame + // ghostlight.action: speak + // ghostlight.intent: force_personhood_risk_to_dominate_capacity_limits -> moral_pressure === ledger_backed_bay === @@ -72,10 +72,10 @@ into contagion math. Your ledger buys time, Maer. Not absolution." The clinic exhales around them, annoyed to discover it is still alive. -# ghostlight.npc_response: sella_conditional_acceptance -# ghostlight.consequence: conditional_bay_reserved -# ghostlight.training_hook: care_as_capacity -# ghostlight.training_hook: obligation_backed_request +// ghostlight.npc_response: sella_conditional_acceptance +// ghostlight.consequence: conditional_bay_reserved +// ghostlight.training_hook: care_as_capacity +// ghostlight.training_hook: obligation_backed_request -> END === triage_first === @@ -96,9 +96,9 @@ explain your hands in writing." It is not permission. It is worse. It is work. -# ghostlight.npc_response: sella_conditional_delegation -# ghostlight.consequence: trust_test_opened -# ghostlight.training_hook: authority_respecting_help +// ghostlight.npc_response: sella_conditional_delegation +// ghostlight.consequence: trust_test_opened +// ghostlight.training_hook: authority_respecting_help -> END === show_packet === @@ -121,9 +121,9 @@ Her thumb hovers over the isolation protocol. Not over the bay. "You brought me a worse problem, which is very Navigator of you." -# ghostlight.npc_response: sella_protocol_before_mercy -# ghostlight.consequence: packet_seen_no_personhood_resolution -# ghostlight.training_hook: unresolved_evidence_pressure +// ghostlight.npc_response: sella_protocol_before_mercy +// ghostlight.consequence: packet_seen_no_personhood_resolution +// ghostlight.training_hook: unresolved_evidence_pressure -> END === moral_pressure === @@ -144,7 +144,7 @@ bring me quiet." For a moment the only thing between them is the board, which has been keeping score longer than either of them has been brave. -# ghostlight.npc_response: sella_rejects_symbolic_pressure -# ghostlight.consequence: trust_loss_resentment_risk -# ghostlight.training_hook: moral_pressure_as_resource_substitution +// ghostlight.npc_response: sella_rejects_symbolic_pressure +// ghostlight.consequence: trust_loss_resentment_risk +// ghostlight.training_hook: moral_pressure_as_resource_substitution -> END diff --git a/examples/ink/cold-wake-sanctuary-intake.qwen-draft.ink b/examples/ink/cold-wake-sanctuary-intake.qwen-draft.ink index 154e831..150c469 100644 --- a/examples/ink/cold-wake-sanctuary-intake.qwen-draft.ink +++ b/examples/ink/cold-wake-sanctuary-intake.qwen-draft.ink @@ -7,10 +7,10 @@ VAR packet_shown = false -> start === start === -# ghostlight.scene: scene-02-sanctuary-intake -# ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json -# ghostlight.generated_by: experiments/ink/cold-wake-sanctuary-intake-qwen-branch-candidates-v1.capture.json -# aetheria.flashpoint: cold-wake-panic +// ghostlight.scene: scene-02-sanctuary-intake +// ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json +// ghostlight.generated_by: experiments/ink/cold-wake-sanctuary-intake-qwen-branch-candidates-v1.capture.json +// aetheria.flashpoint: cold-wake-panic The intake clinic sits behind the pumpworks, all warmth rationed through humming conduits and tired hands. @@ -21,27 +21,27 @@ Sella says, "If you came to ask me for mercy, bring tubing." What does Maer do? * [Show the corrupted packet to Sella.] - # ghostlight.branch: branch-01-maer-show-packet - # ghostlight.action: show_object - # ghostlight.intent: Provide data for triage capacity calculation while acknowledging the packet is not clean proof of personhood. + // ghostlight.branch: branch-01-maer-show-packet + // ghostlight.action: show_object + // ghostlight.intent: Provide data for triage capacity calculation while acknowledging the packet is not clean proof of personhood. -> branch_01_maer_show_packet * [Withhold the packet and ask for a triage assessment based on the signal alone.] - # ghostlight.branch: branch-02-maer-withhold-packet - # ghostlight.action: withhold_object - # ghostlight.intent: Force Sella to rely on her own capacity management without the crutch of the packet's ambiguous data. + // ghostlight.branch: branch-02-maer-withhold-packet + // ghostlight.action: withhold_object + // ghostlight.intent: Force Sella to rely on her own capacity management without the crutch of the packet's ambiguous data. -> branch_02_maer_withhold_packet * [Press Sella on the moral cost of turning away a potential person.] - # ghostlight.branch: branch-03-maer-press-moral-frame - # ghostlight.action: speak - # ghostlight.intent: Challenge Sella's rigidity by framing the refusal as a moral failure, risking her resentment. + // ghostlight.branch: branch-03-maer-press-moral-frame + // ghostlight.action: speak + // ghostlight.intent: Challenge Sella's rigidity by framing the refusal as a moral failure, risking her resentment. -> branch_03_maer_press_moral_frame * [Stand in silence and observe Sella's reaction to the packet's presence.] - # ghostlight.branch: branch-04-maer-silent-observation - # ghostlight.action: silence - # ghostlight.intent: Allow Sella to initiate the decision process, testing her suspicion levels without verbal interference. + // ghostlight.branch: branch-04-maer-silent-observation + // ghostlight.action: silence + // ghostlight.intent: Allow Sella to initiate the decision process, testing her suspicion levels without verbal interference. -> branch_04_maer_silent_observation === branch_01_maer_show_packet === @@ -55,10 +55,10 @@ Sella scans the packet's surface, her eyes narrowing as she parses the firmware "The packet is unstable. If I accept this, I am betting on a pattern that could be a lie or a glitch. If I say no, the vessel goes dark. What is your ledger backing for this specific intake?" -# ghostlight.generated_branch: branch-01-maer-show-packet -# ghostlight.consequence: branch_01_maer_show_packet_reviewed_consequence -# ghostlight.training_hook: branch-02-sella-demand-ledger -# ghostlight.training_hook: branch-03-sella-conditional-acceptance +// ghostlight.generated_branch: branch-01-maer-show-packet +// ghostlight.consequence: branch_01_maer_show_packet_reviewed_consequence +// ghostlight.training_hook: branch-02-sella-demand-ledger +// ghostlight.training_hook: branch-03-sella-conditional-acceptance -> END === branch_02_maer_withhold_packet === @@ -71,9 +71,9 @@ Sella sighs, looking at the empty intake bay and the exhausted staff. She refuse "You want me to guess on a ghost? My capacity is measured in minutes, not faith. If you won't show me the packet, you aren't asking for help; you're asking for a miracle. That is not in the ledger." -# ghostlight.generated_branch: branch-02-maer-withhold-packet -# ghostlight.consequence: branch_02_maer_withhold_packet_reviewed_consequence -# ghostlight.training_hook: branch-04-maer-offer-personal-guarantee +// ghostlight.generated_branch: branch-02-maer-withhold-packet +// ghostlight.consequence: branch_02_maer_withhold_packet_reviewed_consequence +// ghostlight.training_hook: branch-04-maer-offer-personal-guarantee -> END === branch_03_maer_press_moral_frame === @@ -87,9 +87,9 @@ Sella's expression hardens, recognizing the trap of moral theater. She defends h "You speak of fear, but you ignore the reality of the math. Every bed I open is a bed closed for someone else. If I take a risk on noise, I am not being merciful; I am being negligent. Do not pretend my ledger is a morality play." -# ghostlight.generated_branch: branch-03-maer-press-moral-frame -# ghostlight.consequence: branch_03_maer_press_moral_frame_reviewed_consequence -# ghostlight.training_hook: branch-05-sella-moral-responsibility +// ghostlight.generated_branch: branch-03-maer-press-moral-frame +// ghostlight.consequence: branch_03_maer_press_moral_frame_reviewed_consequence +// ghostlight.training_hook: branch-05-sella-moral-responsibility -> END === branch_04_maer_silent_observation === @@ -101,7 +101,7 @@ Sella stares at the packet for a long moment, her internal suspicion warring wit "The silence is loud enough. I see the routing terms. They are messy, but they are there. I am not a judge, Maer. I am a triage lead. If you want me to open a bed, you must understand that I am doing it because the math allows it, not because you told me it was right. Now, do you want me to try to parse the noise, or do you want to walk away?" -# ghostlight.generated_branch: branch-04-maer-silent-observation -# ghostlight.consequence: branch_04_maer_silent_observation_reviewed_consequence -# ghostlight.training_hook: branch-06-sella-initiative-with-conditions +// ghostlight.generated_branch: branch-04-maer-silent-observation +// ghostlight.consequence: branch_04_maer_silent_observation_reviewed_consequence +// ghostlight.training_hook: branch-06-sella-initiative-with-conditions -> END diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 6f9c432..d358fa7 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -35,3 +35,4 @@ {"ts": "2026-05-01T22:40:18+00:00", "type": "design", "status": "accepted", "note": "Clarified that dialogue trees mean branching scene trees, not speech-only menus. Ghostlight should generate plausible protagonist speech or non-speech choices, NPC responses, and branch consequences in world state, memory, and social perception, such as losing trust or opening future hooks."} {"ts": "2026-05-01T22:51:37+00:00", "type": "design", "status": "accepted", "note": "Adopted Ink as the standard playable branching scene format for Ghostlight interactive fiction. Ghostlight should generate/project Ink scenes and maintain reviewed sidecar annotations for local awareness, action intent, consequence surfaces, and manual state mutation instead of inventing a parallel branching format."} {"ts": "2026-05-02T01:37:07+00:00", "type": "implementation", "status": "ok", "note": "Built the first local-awareness-to-Qwen-to-Ink branch generation pass. Qwen generated four Cold Wake sanctuary-intake branch candidates from Ghostlight state and projection controls; the reviewed capture was materialized into a playable qwen-draft Ink file plus sidecar annotations. Lesson: semantic training hooks and branch-local object custody need tighter prompting before generated drafts can be promoted beyond training material."} +{"ts": "2026-05-02T01:40:41+00:00", "type": "implementation", "status": "ok", "note": "Ink metadata for Ghostlight/Aetheria must use // comments, not # tags, in writer-facing drafts. Inky exposes # tags in preview, causing state and training handles to leak into readable scene output; validate_ink_examples now rejects Ghostlight/Aetheria metadata tags."} diff --git a/tools/materialize_qwen_ink_draft.py b/tools/materialize_qwen_ink_draft.py index 9da0b39..b6eda37 100644 --- a/tools/materialize_qwen_ink_draft.py +++ b/tools/materialize_qwen_ink_draft.py @@ -64,10 +64,10 @@ def build_ink(capture: dict[str, Any]) -> str: "-> start", "", "=== start ===", - "# ghostlight.scene: scene-02-sanctuary-intake", - "# ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json", - "# ghostlight.generated_by: experiments/ink/cold-wake-sanctuary-intake-qwen-branch-candidates-v1.capture.json", - "# aetheria.flashpoint: cold-wake-panic", + "// ghostlight.scene: scene-02-sanctuary-intake", + "// ghostlight.fixture: examples/agent-state.cold-wake-story-lab.json", + "// ghostlight.generated_by: experiments/ink/cold-wake-sanctuary-intake-qwen-branch-candidates-v1.capture.json", + "// aetheria.flashpoint: cold-wake-panic", "", "The intake clinic sits behind the pumpworks, all warmth rationed through humming conduits and tired hands.", "", @@ -83,9 +83,9 @@ def build_ink(capture: dict[str, Any]) -> str: lines.extend( [ f"* [{branch['choice_text']}]", - f" # ghostlight.branch: {branch['branch_id']}", - f" # ghostlight.action: {branch['action_type']}", - f" # ghostlight.intent: {branch['actor_intent']}", + f" // ghostlight.branch: {branch['branch_id']}", + f" // ghostlight.action: {branch['action_type']}", + f" // ghostlight.intent: {branch['actor_intent']}", f" -> {ink_path}", "", ] @@ -111,12 +111,12 @@ def build_ink(capture: dict[str, Any]) -> str: lines.extend( [ "", - f"# ghostlight.generated_branch: {branch['branch_id']}", - f"# ghostlight.consequence: {ink_identifier(branch['branch_id'])}_reviewed_consequence", + f"// ghostlight.generated_branch: {branch['branch_id']}", + f"// ghostlight.consequence: {ink_identifier(branch['branch_id'])}_reviewed_consequence", ] ) for hook in ensure_list(branch.get("training_hooks")): - lines.append(f"# ghostlight.training_hook: {hook}") + lines.append(f"// ghostlight.training_hook: {hook}") lines.extend(["-> END", ""]) return "\n".join(lines).rstrip() + "\n" diff --git a/tools/validate_ink_examples.py b/tools/validate_ink_examples.py index d768a39..8fcfe78 100644 --- a/tools/validate_ink_examples.py +++ b/tools/validate_ink_examples.py @@ -64,6 +64,7 @@ def node_command() -> str: def compile_ink(path: Path) -> None: + validate_no_preview_leaking_metadata_tags(path) with tempfile.TemporaryDirectory(prefix="ghostlight-ink-") as temp_dir: output_path = Path(temp_dir) / f"{path.stem}.json" result = subprocess.run( @@ -84,6 +85,15 @@ def compile_ink(path: Path) -> None: validate_story_reaches_initial_choices(path, output_path) +def validate_no_preview_leaking_metadata_tags(path: Path) -> None: + for line_number, line in enumerate(path.read_text(encoding="utf-8").splitlines(), start=1): + stripped = line.lstrip() + if stripped.startswith("# ghostlight.") or stripped.startswith("# aetheria."): + raise ValidationError( + f"{path}:{line_number} uses an Ink tag for Ghostlight/Aetheria metadata; use // comments so Inky preview stays clean" + ) + + def validate_story_reaches_initial_choices(source_path: Path, compiled_path: Path) -> None: script = """ const fs = require("fs");