Add projection example seam

This commit is contained in:
Meta Vens 2026-05-01 21:02:57 +01:00
commit 5d4b52e421
10 changed files with 538 additions and 14 deletions

View file

@ -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.

File diff suppressed because one or more lines are too long

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -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"
}
}

View file

@ -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"
}
}
}
}
}
}
}

View file

@ -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."}

View file

@ -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.

View file

@ -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())