From 5d4b52e421d4f7ec14781af72c592539848c3fac Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 1 May 2026 21:02:57 +0100 Subject: [PATCH] Add projection example seam --- .../projection-distillation-plan.md | 12 +- ...all-of-the-void.scene-broken-taxi-oz.jsonl | 2 + notes/fresh-workspace-handoff.md | 15 +- notes/ghostlight-current-system-map.md | 17 +- notes/ghostlight-implementation-plan.md | 5 +- package.json | 4 +- schemas/projection-example.schema.json | 296 ++++++++++++++++++ state/evidence.jsonl | 1 + state/map.yaml | 5 +- tools/validate_projection_examples.py | 195 ++++++++++++ 10 files changed, 538 insertions(+), 14 deletions(-) create mode 100644 examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl create mode 100644 schemas/projection-example.schema.json create mode 100644 tools/validate_projection_examples.py diff --git a/docs/architecture/projection-distillation-plan.md b/docs/architecture/projection-distillation-plan.md index 7677a89..f9159f5 100644 --- a/docs/architecture/projection-distillation-plan.md +++ b/docs/architecture/projection-distillation-plan.md @@ -66,6 +66,14 @@ latency, and cost, not for final prose quality. ## Dataset Shape +The first schema lives in: + +- `schemas/projection-example.schema.json` + +The first reviewed examples live in: + +- `examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl` + Use a JSONL dataset with one projection example per speaker-scene turn. ```json @@ -165,9 +173,9 @@ Minimum useful milestone: ## Near-Term Implementation Tasks -1. Define `schemas/projection-example.schema.json`. +1. Define `schemas/projection-example.schema.json`. Done. 2. Add `examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl` with - the first reviewed Cat and Oz examples. + the first reviewed Cat and Oz examples. Done. 3. Add a deterministic projection input-slice tool that reads the agent-state fixture and emits speaker-local input JSON. 4. Add a teacher prompt template for producing projection artifacts. diff --git a/examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl b/examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl new file mode 100644 index 0000000..3d629b1 --- /dev/null +++ b/examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl @@ -0,0 +1,2 @@ +{"schema_version":"ghostlight.projection_example.v0","example_id":"call-void.scene-broken-taxi-oz.cat.v1","input":{"fixture_ref":"examples/agent-state.call-of-the-void.json","scene_id":"scene-broken-taxi-oz","speaker_agent_id":"cat_marrigan","listener_ids":["oz_operator"],"projection_mode":"dialogue_turn"},"output":{"known_facts":[{"text":"The taxi is broken again and Oz can help with the repair.","source_refs":["scenes.scene-broken-taxi-oz.public_stakes","dialogue_context_packs.cat_marrigan.speaker_local_truth"]},{"text":"Cat believes Oz is probably hiding a person-shaped problem behind the drone.","source_refs":["agents.cat_marrigan.perceived_state_overlays.belief-cat-oz-is-a-mask","dialogue_context_packs.cat_marrigan.speaker_local_truth"]},{"text":"Old Sol contracts, institutions, and debt still frame Cat's fear of help with hidden terms.","source_refs":["world.canon_context","agents.cat_marrigan.memories.memory-bad-contract","agents.cat_marrigan.memories.memory-institutions-follow"]}],"active_pressures":[{"pressure_id":"cat-needs-help-resists-terms","summary":"Cat needs Oz's repair help while experiencing help as possible capture by hidden terms.","intensity":0.88,"source_refs":["goals.goal-keep-taxi-operational","canonical_state.situational_state.scarcity_pressure","values.value-keep-agency","memories.memory-bad-contract"]},{"pressure_id":"cat-mask-detection","summary":"Cat's suspicion is focused on Oz's drone body as a mask rather than a neutral tool.","intensity":0.82,"source_refs":["perceived_state_overlays.cat_marrigan.oz_operator.strategic_opacity","events.event-drone-lie.private_interpretations.cat_marrigan","relationships.rel-cat-oz.stance.fascination"]},{"pressure_id":"cat-exposure-shame","summary":"Accepting help openly threatens Cat's dignity and activates defensive distance.","intensity":0.76,"source_refs":["canonical_state.underlying_organization.shame_sensitivity","canonical_state.behavioral_dimensions.distance_seeking","canonical_state.presentation_strategy.abrasive_boundary","canonical_state.situational_state.acute_shame"]}],"tensions":[{"tension_id":"repair-vs-autonomy","summary":"Cat wants the repair but does not want to look dependent or owned by the help.","source_refs":["goals.goal-keep-taxi-operational","values.value-keep-agency","scenes.scene-broken-taxi-oz.public_stakes"]},{"tension_id":"probe-vs-casual-mask","summary":"Cat wants to identify the person behind Oz while pretending the probe is only irritation about the repair.","source_refs":["dialogue_context_packs.cat_marrigan.presentation_constraints","events.event-drone-lie.observed_exchange","perceived_state_overlays.cat_marrigan.oz_operator"]}],"response_affordances":[{"affordance_id":"cat-practical-answer-emotional-deflection","behavior":"Answer the practical repair issue while making the emotional dependency sound ridiculous.","pressure_basis":"Shame sensitivity, distance seeking, ironic distance, and low emotional explicitness converge under help pressure.","source_refs":["canonical_state.underlying_organization.shame_sensitivity","canonical_state.behavioral_dimensions.distance_seeking","canonical_state.presentation_strategy.ironic_distance","canonical_state.voice_style.emotional_explicitness"]},{"affordance_id":"cat-sarcastic-probe","behavior":"Use a joke as a probe for the operator behind the drone.","pressure_basis":"Suspicion, mask detection, dry pointed voice, and question pressure make indirect interrogation safer than sincerity.","source_refs":["canonical_state.behavioral_dimensions.suspicion","canonical_state.voice_style.dryness","canonical_state.voice_style.pointedness","dialogue_context_packs.cat_marrigan.presentation_constraints"]}],"voice_surface":[{"text":"Dry, quick, pointed, plainspoken, low verbal warmth, low emotional explicitness, some profanity.","source_refs":["canonical_state.voice_style.dryness","canonical_state.voice_style.pace","canonical_state.voice_style.pointedness","canonical_state.voice_style.verbal_warmth","canonical_state.voice_style.emotional_explicitness","canonical_state.voice_style.profanity"]},{"text":"Humor should function as a boundary, not friendliness.","source_refs":["canonical_state.voice_style.humor","canonical_state.presentation_strategy.abrasive_boundary","canonical_state.presentation_strategy.ironic_distance"]}],"prompt_text":"Speaker: Catastrophe Marrigan, debt-burdened investigator and taxi operator in a repair alcove with Oz.\nKnown Facts: The taxi is broken again. Oz can help. Oz is probably not only a drone. Old Sol institutions, debts, and bad contracts still shape the air in Elysium.\nCurrent Stakes: Cat needs the repair but hates needing it. Accepting help risks feeling handled, owned, or baited into new terms.\nActive Inner Pressures: Cat is tired, scarce, suspicious, shame-reactive, and trying to preserve the fiction that she is choosing this cooperation freely. Oz's usefulness makes the secrecy more irritating, not less.\nRelationship Read: Oz is useful, evasive, and possibly vulnerable behind the drone. Cat trusts Oz poorly, respects the competence a little, and is more fascinated than she wants to admit.\nTensions: Cat wants the relay fixed while resisting dependency. She wants to identify the person behind the mask while making the probe look like irritation about the repair.\nVoice Surface: Dry, quick, pointed, plainspoken, low verbal warmth, low emotional explicitness, some profanity. Humor functions as a boundary rather than friendliness.\nLikely Defensive Moves: If Oz presses toward Cat's dependency or fear, Cat is likely to answer the practical part and make the emotional part sound ridiculous. If Oz evades, Cat may probe with a joke sharp enough to leave a mark.\nDo Not Invent: Do not reveal facts outside Cat's local beliefs. Do not decide the operator's location, body, or full identity.\nTask: Write Cat's next short line to Oz while the repair is still unresolved."},"audit":{"teacher_model":"gpt-5-codex-session-review","reviewer":"codex-human-guided","review_status":"accepted","review_notes":["Projection uses Cat-local beliefs rather than author-only truth about Oz.","Defensive behavior is described as pressure outcome, not as a raw command to use a label."],"target_emergent_behaviors":["sarcastic_deflection","emotional_evasion","banter_as_boundary"],"checks":{"speaker_local_context_only":true,"state_interactions_cited":true,"voice_separate_from_defense":true,"secrets_as_pressure_not_forbidden_context":true,"compact_runtime_surface":true}}} +{"schema_version":"ghostlight.projection_example.v0","example_id":"call-void.scene-broken-taxi-oz.oz.v1","input":{"fixture_ref":"examples/agent-state.call-of-the-void.json","scene_id":"scene-broken-taxi-oz","speaker_agent_id":"oz_operator","listener_ids":["cat_marrigan"],"projection_mode":"dialogue_turn"},"output":{"known_facts":[{"text":"Cat is suspicious and the drone can repair the relay if Cat stops hovering.","source_refs":["dialogue_context_packs.oz_operator.speaker_local_truth","scenes.scene-broken-taxi-oz.public_stakes"]},{"text":"The person behind Oz is not safe to expose.","source_refs":["dialogue_context_packs.oz_operator.speaker_local_truth","goals.goal-keep-body-private","identity.oz_operator.private_notes"]},{"text":"Oz believes Cat may be protective if she understands the mask, but the relationship becomes dangerous if she names it too early.","source_refs":["agents.oz_operator.perceived_state_overlays.belief-cat-will-pry","dialogue_context_packs.oz_operator.speaker_beliefs"]}],"active_pressures":[{"pressure_id":"oz-help-without-exposure","summary":"Oz must be useful enough to keep cooperation while keeping the operator unavailable for inspection.","intensity":0.9,"source_refs":["goals.goal-keep-body-private","canonical_state.presentation_strategy.strategic_opacity","canonical_state.underlying_organization.mask_rigidity","scenes.scene-broken-taxi-oz.hidden_stakes"]},{"pressure_id":"oz-cat-dangerous-accuracy","summary":"Cat's suspicion is dangerous because it is accurate enough to threaten the mask.","intensity":0.82,"source_refs":["perceived_state_overlays.oz_operator.cat_marrigan.suspicion","events.event-drone-lie.private_interpretations.oz_operator","relationships.rel-oz-cat.stance.fear"]},{"pressure_id":"oz-harmless-body","summary":"Oz relies on the drone seeming helpful and harmless so others do not ask for the person behind it.","intensity":0.78,"source_refs":["canonical_state.presentation_strategy.cultivated_harmlessness","memories.memory-being-mistaken-safe","identity.oz_operator.public_description"]}],"tensions":[{"tension_id":"repair-vs-mask","summary":"Oz wants to perform competence on the repair without revealing too much personhood through the performance.","source_refs":["goals.goal-keep-body-private","events.event-drone-lie.observed_exchange","canonical_state.voice_style.technical_compression"]},{"tension_id":"warmth-vs-availability","summary":"Oz wants enough warmth to keep Cat cooperating but not enough openness to invite inspection.","source_refs":["canonical_state.voice_style.verbal_warmth","canonical_state.voice_style.hedging","canonical_state.underlying_organization.authenticity_tolerance","relationships.rel-oz-cat.stance.expectation_of_care"]}],"response_affordances":[{"affordance_id":"oz-repair-redirect","behavior":"Redirect identity questions toward immediate repair steps.","pressure_basis":"High mask rigidity, strategic opacity, exposure risk, and technical voice make practical redirection safer than confession.","source_refs":["canonical_state.underlying_organization.mask_rigidity","canonical_state.presentation_strategy.strategic_opacity","events.event-drone-lie.private_interpretations.oz_operator","canonical_state.voice_style.technical_compression"]},{"affordance_id":"oz-gentle-evasion","behavior":"Use careful politeness and hedging to preserve the mask without making the evasion look like panic.","pressure_basis":"Oz combines fear, cultivated harmlessness, coded politeness, hedging, and low emotional explicitness under Cat's accurate suspicion.","source_refs":["relationships.rel-oz-cat.stance.fear","canonical_state.presentation_strategy.cultivated_harmlessness","canonical_state.voice_style.coded_politeness","canonical_state.voice_style.hedging","canonical_state.voice_style.emotional_explicitness"]}],"voice_surface":[{"text":"Controlled, concise, technically precise, gently polite, low emotional explicitness, careful verbal warmth, frequent hedging near the operator question.","source_refs":["canonical_state.voice_style.lexical_precision","canonical_state.voice_style.technical_compression","canonical_state.voice_style.politeness","canonical_state.voice_style.emotional_explicitness","canonical_state.voice_style.verbal_warmth","canonical_state.voice_style.hedging"]},{"text":"Helpfulness is camouflage as much as care.","source_refs":["canonical_state.presentation_strategy.cultivated_harmlessness","memories.memory-being-mistaken-safe","goals.goal-keep-body-private"]}],"prompt_text":"Speaker: Oz, a remote operator using a repair drone as a public body.\nKnown Facts: Cat is suspicious. The drone can help repair the relay. The person behind Oz is not safe to expose. Cat may protect the secret if she understands why it exists, but naming the mask too early makes the relationship dangerous.\nCurrent Stakes: Oz needs Cat to accept useful help and stop inspecting the mask. The scene rewards competence and punishes exposure.\nActive Inner Pressures: Oz is mask-rigid, strategically opaque, anxious about exposure, and trying to stay harmless enough to remain tolerated. Helpfulness is both the offer and the camouflage.\nRelationship Read: Cat is sharp, dangerous, and possibly principled. Oz respects her perception, fears what she could do with it, and is not certain whether her care has teeth or rules.\nTensions: Oz wants to repair the taxi while preventing Cat from tracing the operator. Oz wants to sound warm enough to keep cooperation alive without sounding available for inspection.\nVoice Surface: Controlled, concise, technically precise, gently polite, low emotional explicitness, careful verbal warmth, frequent hedging near the operator question, low profanity.\nLikely Defensive Moves: If Cat asks directly about the operator, Oz should redirect toward the immediate repair or answer around the question without looking panicked. If Cat shows care, Oz may underread it or treat it as a hazard first.\nDo Not Invent: Do not disclose the operator's location or body. Do not make Oz omniscient about Cat's private state beyond Oz's current read.\nTask: Write Oz's next short line to Cat while preserving the mask and keeping the repair moving."},"audit":{"teacher_model":"gpt-5-codex-session-review","reviewer":"codex-human-guided","review_status":"accepted","review_notes":["Projection treats the operator secret as known pressure for Oz, not as forbidden-context boilerplate.","Oz's evasiveness is derived from mask rigidity, strategic opacity, exposure risk, and relationship fear."],"target_emergent_behaviors":["sincerity_evasion","emotional_evasion"],"checks":{"speaker_local_context_only":true,"state_interactions_cited":true,"voice_separate_from_defense":true,"secrets_as_pressure_not_forbidden_context":true,"compact_runtime_surface":true}}} diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 08e2d8c..476d421 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -40,6 +40,10 @@ Ghostlight now has the persistence spine plus the first architecture payload: - `docs/architecture/projection-distillation-plan.md` - evaluation follow-up docs: - `docs/architecture/schema-future-mechanisms.md` +- first projection example seam: + - `schemas/projection-example.schema.json` + - `examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl` + - `tools/validate_projection_examples.py` - visitor-facing README refreshed to explain Ghostlight's goals There is still no full runtime yet. The live machine is design, state @@ -61,8 +65,8 @@ state unless explicitly revived. ## Current Next Action -Define the projection example schema and create the first reviewed Cat/Oz -projection artifacts from the Call of the Void fixture. +Build the deterministic projection input-slice tool that reads the Call of the +Void fixture and emits speaker-local input JSON for one scene/speaker pair. The evaluation follow-up fixed the immediate v0 schema issues: @@ -73,11 +77,14 @@ The evaluation follow-up fixed the immediate v0 schema issues: - `event-drone-lie` now includes observed exchange, private interpretations, and event effects -The projection path is: +Completed projection path items: -- build a deterministic speaker-local input slicer - define `schemas/projection-example.schema.json` - create reviewed Cat/Oz projection examples + +Remaining projection path: + +- build a deterministic speaker-local input slicer - use a frontier teacher model to generate/audit projection artifacts - train a smaller student projector only after the artifact schema, input slicer, and evaluator stabilize diff --git a/notes/ghostlight-current-system-map.md b/notes/ghostlight-current-system-map.md index f44e7c1..a26fb61 100644 --- a/notes/ghostlight-current-system-map.md +++ b/notes/ghostlight-current-system-map.md @@ -52,28 +52,37 @@ state and re-entry discipline. - `schemas/agent-state.schema.json` - v0 canonical agent-state contract for agents, relationships, events, scenes, perceived overlays, and dialogue context packs +- `schemas/projection-example.schema.json` + - v0 reviewed projection artifact contract for speaker-local prompt + projection examples - `schemas/agent-state.required-fields.json` - required first-class variable names for canonical state and relationship stance - `examples/agent-state.call-of-the-void.json` - first Call of the Void-flavored fixture for schema and projection work +- `examples/projections/call-of-the-void.scene-broken-taxi-oz.jsonl` + - first reviewed Cat and Oz projection examples - `tools/ghostlight_state.py` - compact state inspection and evidence or branch updates - `tools/ghostlight_prepare_compaction.py` - pre-compaction audit of required files, handoff content, and git hygiene - `tools/validate_agent_state.py` - dependency-free validator for the current schema fixture invariants +- `tools/validate_projection_examples.py` + - dependency-free validator for projection example JSONL records ## What Does Not Exist Yet - a classifier pipeline - a prompt renderer -- a projection training dataset +- a full projection training corpus +- a deterministic projection input slicer - a student projection model - a simulation/event loop - a relationship engine - a culture prior engine -The canonical agent-state schema exists as a v0 seam, and the prompt projection -contract now defines the next implementation target. The renderer should turn -state intersections into compact speaker-local pressure prose. +The canonical agent-state schema and first projection example schema now exist +as v0 seams. The next implementation target is the deterministic input slicer +that emits speaker-local state before a renderer turns that state into compact +pressure prose. diff --git a/notes/ghostlight-implementation-plan.md b/notes/ghostlight-implementation-plan.md index 2d9ca25..2501d90 100644 --- a/notes/ghostlight-implementation-plan.md +++ b/notes/ghostlight-implementation-plan.md @@ -33,9 +33,12 @@ - Make generated moves inspectable: why this character deflects, confesses, threatens, softens, bargains, or lies. -4. Build the projection distillation loop. +4. Build the projection distillation loop. Started. - Use `docs/architecture/projection-distillation-plan.md` as the teacher to student roadmap. + - Maintain `schemas/projection-example.schema.json`, + `examples/projections/`, and `tools/validate_projection_examples.py` as + the first reviewed artifact seam. - Use a frontier teacher model to produce reviewed projection artifacts from structured state. - Save accepted and rejected projection examples as supervised data. diff --git a/package.json b/package.json index e9ce6d8..3a245a8 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "scripts": { "state:status": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\ghostlight_state.py status", "state:prepare-compaction": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\ghostlight_prepare_compaction.py", - "schema:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_agent_state.py" + "agent-state:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_agent_state.py", + "schema:validate": "npm run agent-state:validate && npm run projection:validate", + "projection:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_projection_examples.py" } } diff --git a/schemas/projection-example.schema.json b/schemas/projection-example.schema.json new file mode 100644 index 0000000..423ff8c --- /dev/null +++ b/schemas/projection-example.schema.json @@ -0,0 +1,296 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/GameCult/Ghostlight/schemas/projection-example.schema.json", + "title": "Ghostlight Projection Example Schema", + "description": "Reviewed training artifact for compiling structured agent state into speaker-local prompt projection.", + "type": "object", + "required": [ + "schema_version", + "example_id", + "input", + "output", + "audit" + ], + "additionalProperties": false, + "properties": { + "schema_version": { + "const": "ghostlight.projection_example.v0" + }, + "example_id": { + "type": "string" + }, + "input": { + "$ref": "#/$defs/input_ref" + }, + "output": { + "$ref": "#/$defs/projection_output" + }, + "audit": { + "$ref": "#/$defs/audit" + } + }, + "$defs": { + "input_ref": { + "type": "object", + "required": [ + "fixture_ref", + "scene_id", + "speaker_agent_id", + "listener_ids", + "projection_mode" + ], + "additionalProperties": false, + "properties": { + "fixture_ref": { + "type": "string" + }, + "scene_id": { + "type": "string" + }, + "speaker_agent_id": { + "type": "string" + }, + "listener_ids": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "projection_mode": { + "enum": [ + "dialogue_turn", + "scene_beat", + "drama_scaffold" + ] + } + } + }, + "sourced_text": { + "type": "object", + "required": [ + "text", + "source_refs" + ], + "additionalProperties": false, + "properties": { + "text": { + "type": "string", + "minLength": 1 + }, + "source_refs": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + } + }, + "active_pressure": { + "type": "object", + "required": [ + "pressure_id", + "summary", + "intensity", + "source_refs" + ], + "additionalProperties": false, + "properties": { + "pressure_id": { + "type": "string" + }, + "summary": { + "type": "string", + "minLength": 1 + }, + "intensity": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "source_refs": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + } + }, + "tension": { + "type": "object", + "required": [ + "tension_id", + "summary", + "source_refs" + ], + "additionalProperties": false, + "properties": { + "tension_id": { + "type": "string" + }, + "summary": { + "type": "string", + "minLength": 1 + }, + "source_refs": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + } + }, + "response_affordance": { + "type": "object", + "required": [ + "affordance_id", + "behavior", + "pressure_basis", + "source_refs" + ], + "additionalProperties": false, + "properties": { + "affordance_id": { + "type": "string" + }, + "behavior": { + "type": "string", + "minLength": 1 + }, + "pressure_basis": { + "type": "string", + "minLength": 1 + }, + "source_refs": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + } + }, + "projection_output": { + "type": "object", + "required": [ + "known_facts", + "active_pressures", + "tensions", + "response_affordances", + "voice_surface", + "prompt_text" + ], + "additionalProperties": false, + "properties": { + "known_facts": { + "type": "array", + "items": { + "$ref": "#/$defs/sourced_text" + } + }, + "active_pressures": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/active_pressure" + } + }, + "tensions": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/tension" + } + }, + "response_affordances": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/response_affordance" + } + }, + "voice_surface": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/sourced_text" + } + }, + "prompt_text": { + "type": "string", + "minLength": 1 + } + } + }, + "audit": { + "type": "object", + "required": [ + "teacher_model", + "reviewer", + "review_status", + "review_notes", + "target_emergent_behaviors", + "checks" + ], + "additionalProperties": false, + "properties": { + "teacher_model": { + "type": "string" + }, + "reviewer": { + "type": "string" + }, + "review_status": { + "enum": [ + "accepted", + "rejected", + "needs_revision" + ] + }, + "review_notes": { + "type": "array", + "items": { + "type": "string" + } + }, + "target_emergent_behaviors": { + "type": "array", + "items": { + "type": "string" + } + }, + "checks": { + "type": "object", + "required": [ + "speaker_local_context_only", + "state_interactions_cited", + "voice_separate_from_defense", + "secrets_as_pressure_not_forbidden_context", + "compact_runtime_surface" + ], + "additionalProperties": false, + "properties": { + "speaker_local_context_only": { + "type": "boolean" + }, + "state_interactions_cited": { + "type": "boolean" + }, + "voice_separate_from_defense": { + "type": "boolean" + }, + "secrets_as_pressure_not_forbidden_context": { + "type": "boolean" + }, + "compact_runtime_surface": { + "type": "boolean" + } + } + } + } + } + } +} diff --git a/state/evidence.jsonl b/state/evidence.jsonl index e5980e9..95c446f 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -20,3 +20,4 @@ {"ts": "2026-05-01T19:18:05+00:00", "type": "design", "status": "accepted", "note": "Defined prompt projection as a six-stage contract: select speaker-local inputs, compute active pressure, detect tensions, derive response affordances, render compact prompt sections, then evaluate whether target verbal behaviors emerge from state interactions."} {"ts": "2026-05-01T19:26:23+00:00", "type": "design", "status": "accepted", "note": "Persisted projection distillation plan: use a frontier teacher to generate reviewed projection artifacts, collect accepted and rejected examples, then train a smaller student projector only after the projection schema, input slicer, and evaluator stabilize."} {"ts": "2026-05-01T19:57:04+00:00", "type": "design", "status": "accepted", "note": "Evaluation follow-up accepted immediate schema fixes: split interpersonal_warmth from verbal_warmth, add Cat perception of Oz, populate Cat/Oz relationship summaries, enrich event-drone-lie with observed exchange, private interpretations, and event effects, and park broader social-simulation mechanisms in docs/architecture/schema-future-mechanisms.md."} +{"ts": "2026-05-01T20:02:29+00:00", "type": "implementation", "status": "accepted", "note": "Added ghostlight.projection_example.v0 schema, first reviewed Cat/Oz projection JSONL examples for scene-broken-taxi-oz, projection example validator, and package scripts that validate both agent-state and projection seams. Next projection implementation step is deterministic speaker-local input slicing."} diff --git a/state/map.yaml b/state/map.yaml index ffc4959..c3f2d26 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -86,7 +86,8 @@ accepted_design: - Behavioral warmth and verbal warmth are separate axes: `interpersonal_warmth` describes social care or welcome, while `verbal_warmth` describes soft or reassuring language surface. - Events can carry lightweight observed exchange, private interpretation, and event-effect scaffolding so prompt projection can reason from appraisal and consequence without pretending the v0 schema is already a full transition engine. - Future social-simulation mechanisms should be documented and tested through projection artifacts before promotion into the canonical schema. + - Projection examples use `ghostlight.projection_example.v0` JSONL records with traceable known facts, active pressures, tensions, response affordances, voice surface, rendered prompt text, and audit checks. 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, and a documented teacher/student distillation path for projection. - next_action: Define the projection example schema and create the first reviewed Cat/Oz projection artifacts from the Call of the Void fixture. + 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, and a documented teacher/student distillation path for projection. + next_action: Build the deterministic projection input-slice tool that reads the Call of the Void fixture and emits speaker-local input JSON for one scene/speaker pair. diff --git a/tools/validate_projection_examples.py b/tools/validate_projection_examples.py new file mode 100644 index 0000000..1bce734 --- /dev/null +++ b/tools/validate_projection_examples.py @@ -0,0 +1,195 @@ +"""Validate Ghostlight projection example JSONL files. + +This is a focused validator for reviewed projection artifacts. It does not try +to implement full JSON Schema. It checks the invariants that matter before the +projection dataset becomes training material. +""" + +from __future__ import annotations + +import argparse +import json +from pathlib import Path +from typing import Any + + +ROOT = Path(__file__).resolve().parents[1] +DEFAULT_EXAMPLES = [ + ROOT / "examples" / "projections" / "call-of-the-void.scene-broken-taxi-oz.jsonl" +] + + +class ValidationError(Exception): + pass + + +def load_json(path: Path) -> Any: + with path.open("r", encoding="utf-8") as handle: + return json.load(handle) + + +def require(condition: bool, message: str) -> None: + if not condition: + raise ValidationError(message) + + +def require_keys(obj: dict[str, Any], keys: list[str], path: str) -> None: + missing = [key for key in keys if key not in obj] + require(not missing, f"{path} missing required keys: {', '.join(missing)}") + + +def require_0_1(value: Any, path: str) -> None: + require(isinstance(value, (int, float)), f"{path} must be numeric") + require(0 <= value <= 1, f"{path} must be between 0 and 1") + + +def load_jsonl(path: Path) -> list[dict[str, Any]]: + records: list[dict[str, Any]] = [] + with path.open("r", encoding="utf-8") as handle: + for line_number, line in enumerate(handle, start=1): + stripped = line.strip() + if not stripped: + continue + try: + record = json.loads(stripped) + except json.JSONDecodeError as exc: + raise ValidationError(f"{path}:{line_number} invalid JSONL: {exc}") from exc + require(isinstance(record, dict), f"{path}:{line_number} record must be an object") + records.append(record) + require(records, f"{path} has no projection records") + return records + + +def fixture_context(fixture_path: Path) -> dict[str, Any]: + fixture = load_json(fixture_path) + agent_ids = {agent["agent_id"] for agent in fixture["agents"]} + scene_ids = {scene["scene_id"] for scene in fixture["scenes"]} + return { + "path": fixture_path, + "agent_ids": agent_ids, + "scene_ids": scene_ids, + } + + +def validate_sourced_items(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, ["text", "source_refs"], item_path) + require(isinstance(item["text"], str) and item["text"].strip(), f"{item_path}.text must be non-empty") + validate_source_refs(item["source_refs"], f"{item_path}.source_refs") + + +def validate_source_refs(refs: Any, path: str) -> None: + require(isinstance(refs, list) and refs, f"{path} must be a non-empty array") + for index, ref in enumerate(refs): + require(isinstance(ref, str) and ref.strip(), f"{path}[{index}] must be a non-empty string") + + +def validate_projection_record(record: dict[str, Any], source: Path, index: int) -> None: + path = f"{source}[{index}]" + require_keys(record, ["schema_version", "example_id", "input", "output", "audit"], path) + require(record["schema_version"] == "ghostlight.projection_example.v0", f"{path}.schema_version is wrong") + + input_ref = record["input"] + require(isinstance(input_ref, dict), f"{path}.input must be an object") + require_keys( + input_ref, + ["fixture_ref", "scene_id", "speaker_agent_id", "listener_ids", "projection_mode"], + f"{path}.input", + ) + require(input_ref["projection_mode"] in {"dialogue_turn", "scene_beat", "drama_scaffold"}, f"{path}.input.projection_mode is invalid") + + fixture_path = (ROOT / input_ref["fixture_ref"]).resolve() + require(fixture_path.exists(), f"{path}.input.fixture_ref does not exist: {input_ref['fixture_ref']}") + context = fixture_context(fixture_path) + require(input_ref["scene_id"] in context["scene_ids"], f"{path}.input.scene_id references unknown scene") + require(input_ref["speaker_agent_id"] in context["agent_ids"], f"{path}.input.speaker_agent_id references unknown agent") + require(isinstance(input_ref["listener_ids"], list) and input_ref["listener_ids"], f"{path}.input.listener_ids must be non-empty") + for listener_id in input_ref["listener_ids"]: + require(listener_id in context["agent_ids"], f"{path}.input.listener_ids references unknown agent: {listener_id}") + require(listener_id != input_ref["speaker_agent_id"], f"{path}.input.listener_ids includes speaker") + + output = record["output"] + require(isinstance(output, dict), f"{path}.output must be an object") + require_keys( + output, + [ + "known_facts", + "active_pressures", + "tensions", + "response_affordances", + "voice_surface", + "prompt_text", + ], + f"{path}.output", + ) + validate_sourced_items(output["known_facts"], f"{path}.output.known_facts") + validate_sourced_items(output["voice_surface"], f"{path}.output.voice_surface") + require(isinstance(output["prompt_text"], str) and output["prompt_text"].strip(), f"{path}.output.prompt_text must be non-empty") + + for pressure_index, pressure in enumerate(output["active_pressures"]): + pressure_path = f"{path}.output.active_pressures[{pressure_index}]" + require_keys(pressure, ["pressure_id", "summary", "intensity", "source_refs"], pressure_path) + require_0_1(pressure["intensity"], f"{pressure_path}.intensity") + validate_source_refs(pressure["source_refs"], f"{pressure_path}.source_refs") + + for tension_index, tension in enumerate(output["tensions"]): + tension_path = f"{path}.output.tensions[{tension_index}]" + require_keys(tension, ["tension_id", "summary", "source_refs"], tension_path) + validate_source_refs(tension["source_refs"], f"{tension_path}.source_refs") + + for affordance_index, affordance in enumerate(output["response_affordances"]): + affordance_path = f"{path}.output.response_affordances[{affordance_index}]" + require_keys(affordance, ["affordance_id", "behavior", "pressure_basis", "source_refs"], affordance_path) + validate_source_refs(affordance["source_refs"], f"{affordance_path}.source_refs") + + audit = record["audit"] + require_keys( + audit, + ["teacher_model", "reviewer", "review_status", "review_notes", "target_emergent_behaviors", "checks"], + f"{path}.audit", + ) + require(audit["review_status"] in {"accepted", "rejected", "needs_revision"}, f"{path}.audit.review_status is invalid") + require(isinstance(audit["target_emergent_behaviors"], list), f"{path}.audit.target_emergent_behaviors must be an array") + checks = audit["checks"] + require_keys( + checks, + [ + "speaker_local_context_only", + "state_interactions_cited", + "voice_separate_from_defense", + "secrets_as_pressure_not_forbidden_context", + "compact_runtime_surface", + ], + f"{path}.audit.checks", + ) + for key, value in checks.items(): + require(isinstance(value, bool), f"{path}.audit.checks.{key} must be boolean") + + +def validate_file(path: Path) -> None: + records = load_jsonl(path) + seen_ids: set[str] = set() + for index, record in enumerate(records): + validate_projection_record(record, path, index) + example_id = record["example_id"] + require(example_id not in seen_ids, f"{path}[{index}].example_id is duplicated: {example_id}") + seen_ids.add(example_id) + print(f"ok: {path}") + + +def main() -> int: + parser = argparse.ArgumentParser(description="Validate Ghostlight projection example JSONL files.") + parser.add_argument("paths", nargs="*", type=Path, help="Projection JSONL files to validate.") + args = parser.parse_args() + + paths = args.paths or DEFAULT_EXAMPLES + for path in paths: + validate_file(path) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())