From b5e96d04ee6b6a5f30c333d0e1027105169b0c64 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 2 May 2026 11:12:31 +0100 Subject: [PATCH] Require lore grounding for research responders --- .../sandboxed-responder-packets.md | 30 +++++++++++++++---- notes/fresh-workspace-handoff.md | 11 +++++++ notes/ghostlight-current-system-map.md | 11 +++++-- notes/ghostlight-implementation-plan.md | 10 ++++++- schemas/responder-output.schema.json | 3 +- schemas/responder-packet.schema.json | 4 +++ state/evidence.jsonl | 1 + state/map.yaml | 3 +- tools/build_responder_packet.py | 22 +++++++++++++- tools/validate_responder_outputs.py | 8 +++++ tools/validate_responder_packets.py | 16 ++++++++++ 11 files changed, 108 insertions(+), 11 deletions(-) diff --git a/docs/architecture/sandboxed-responder-packets.md b/docs/architecture/sandboxed-responder-packets.md index d42c9db..73ae7f4 100644 --- a/docs/architecture/sandboxed-responder-packets.md +++ b/docs/architecture/sandboxed-responder-packets.md @@ -28,6 +28,24 @@ responses and to bake setting assumptions, faction pressures, species affordances, and tone into later fine-tuning data without pretending the character model did autonomous scholarship in the walls. +There are two retrieval-augmented modes: + +- `coordinator_scoped_retrieval`: the coordinator or retriever consults lore, + then hands the responder a bounded packet. The responder has no repo access. +- `responder_scoped_repository_search`: the responder itself is explicitly + allowed to inspect the declared lore scope before answering. This is the + research-enabled lane. The packet must include a `Required Lore Research` + section, `allowed_scope`, and `research_instructions`. + +In `responder_scoped_repository_search`, the responder must consult the scoped +docs before answering. It should use retrieved lore to constrain behavior, +affordances, institutions, vocabulary, material stakes, and local assumptions. +It must not use research access to infer hidden state, author-only answers, +future branches, or private motives outside the packet. The output capture must +preserve consulted refs and a brief research summary. No consulted refs means +the research-enabled response failed at the first hurdle, tragic but at least +easy to grade. + Do not mix these silently. Retrieval-augmented output can be excellent training material for an Aetheria-tuned responder, but it does not prove packet-only runtime competence. Packet-only failures are also useful because they reveal @@ -62,7 +80,8 @@ paint. A packet contains: - `generation_lane`: `packet_only` or `retrieval_augmented` -- `lore_access`: curated excerpts only or coordinator-scoped retrieval +- `lore_access`: curated excerpts, coordinator-scoped retrieval, or + responder-scoped repository search - `local_context_prompt`: the projected character-local context - `observed_event`: what the character can see or hear from the prior action - `allowed_action_labels`: concrete action labels, including speech and non-speech moves @@ -104,10 +123,11 @@ be preserved as a coordinator intervention. Repaired prose is useful training data for the coordinator, but it is not raw responder behavior. Retrieval-augmented responder data requires scoped lore access before the -responder acts. The coordinator or retrieval worker may search only the declared -source scope, and the output capture must list consulted refs. The responder -itself should not receive repo access unless the artifact is explicitly labeled -as autonomous-research data. +responder acts. The coordinator, retrieval worker, or explicitly research-enabled +responder may search only the declared source scope, and the output capture must +list consulted refs. The responder itself should not receive repo access unless +the artifact uses `responder_scoped_repository_search`, sets `no_repo_access` to +false, and includes visible research instructions in the prompt. Retrieval can also make the packet worse if it floods the scene with faction or event context and starves the character's own scars. The Sella v0 comparison is diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index cac701b..018e4e7 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -199,6 +199,13 @@ responder a bounded packet. Do not use retrieval-augmented examples as proof that the packet-only runtime prompt has enough context, and do not describe them as autonomous responder research unless the responder actually had repo access. +There is now an explicit research-enabled mode: +`responder_scoped_repository_search`. Use it only when the responder is allowed +to inspect the declared lore scope. The packet must include `Required Lore +Research`, `allowed_scope`, and `research_instructions`; the output capture must +include consulted refs and a research summary. A research-enabled responder that +answers without consulting lore has failed the assignment, bless its little +unexamined heart. The v1 Sella packet removes responder-visible references to absent coordinator knowledge and adds curated AetheriaLore excerpts for Cold Wake, the Ganymede Route Compact, Navigator rescue ledgers, and Lightsail reliability. @@ -256,6 +263,10 @@ sandboxed responder against the regenerated Sella packet, then review whether the output uses institutional lore and latent pressure without prompt parroting, omniscience, or mission-critical trauma-dumping. Do not call Qwen for gold responder data yet. +If this next pass is meant to test a research-enabled responder rather than +packet-only runtime parity, build or hand off it as +`responder_scoped_repository_search` and require it to consult the scoped +AetheriaLore docs before answering. Cat/Oz remains useful as an Elysium procedural mechanics fixture, but single-history grounding should start from authored historical lore rather than diff --git a/notes/ghostlight-current-system-map.md b/notes/ghostlight-current-system-map.md index 6482556..03f0352 100644 --- a/notes/ghostlight-current-system-map.md +++ b/notes/ghostlight-current-system-map.md @@ -128,12 +128,14 @@ state and re-entry discipline. - `schemas/responder-packet.schema.json` - v0 contract for the exact input a sandboxed character responder may see, now lane-labeled as `packet_only` or `retrieval_augmented` with explicit - lore-access policy + lore-access policy; research-enabled packets can require + responder-scoped repository search with visible research instructions - `schemas/responder-output.schema.json` - v0 contract for reviewed captures from sandboxed responder workers, preserving raw output, parsed output, isolation method, leakage audit, and coordinator review; output captures also preserve generation lane and - consulted lore refs + consulted lore refs, and research-enabled captures can preserve a research + summary - `schemas/agent-state.required-fields.json` - required first-class variable names for canonical state and relationship stance @@ -385,6 +387,11 @@ curated source excerpts, and `retrieval_augmented` for coordinator- or retriever-selected scoped AetheriaLore refs that can bake setting priors into final responses while preserving consulted refs. This is not autonomous responder research unless the responder actually receives scoped repo access. +That explicit repo-access path is now named +`responder_scoped_repository_search`: the packet must tell the responder to +consult the declared lore docs before answering, show the allowed scope, and +give behavior-grounding research instructions. The capture must record consulted +refs and a research summary. The first lane comparison is now captured: packet-only produced a clean conditional repair-bay decision, while retrieval-augmented added heat-debt, rescue-ledger, dockfall, and Aya sanctuary politics that should inform future diff --git a/notes/ghostlight-implementation-plan.md b/notes/ghostlight-implementation-plan.md index 2e2eae1..a888fc9 100644 --- a/notes/ghostlight-implementation-plan.md +++ b/notes/ghostlight-implementation-plan.md @@ -345,6 +345,12 @@ and is for baking lore and tone into final responder outputs rather than proving runtime prompt sufficiency. It is not autonomous responder research unless the artifact explicitly says the responder had repo access. + - Research-enabled responder correction: `retrieval_augmented` now has an + explicit `responder_scoped_repository_search` mode. Those packets must + surface a `Required Lore Research` section, declared `allowed_scope`, and + `research_instructions`; output captures must preserve consulted refs and + a research summary. If the responder does not consult scoped lore before + answering, the capture should fail review. - The v1 Sella packet removes responder-visible warnings about absent hidden context and adds curated AetheriaLore excerpts for Cold Wake, the Ganymede Route Compact, Navigator rescue ledgers, and Lightsail reliability. @@ -375,7 +381,9 @@ - Next prototype: use this corrected packet surface for a fresh sandboxed responder pass, then review whether the response uses institutional lore and latent pressure without prompt parroting or mission-critical - trauma-dumping. + trauma-dumping. If the pass is research-enabled, use + `responder_scoped_repository_search` and require consulted refs before the + responder answers. 7. Build the first drama-scaffolding loop. - memory updates diff --git a/schemas/responder-output.schema.json b/schemas/responder-output.schema.json index 8f87083..bc22299 100644 --- a/schemas/responder-output.schema.json +++ b/schemas/responder-output.schema.json @@ -38,7 +38,8 @@ "additionalProperties": false, "properties": { "mode": { "enum": ["curated_excerpts_only", "coordinator_scoped_retrieval", "responder_scoped_repository_search"] }, - "consulted_refs": { "type": "array", "items": { "type": "string", "minLength": 1 } } + "consulted_refs": { "type": "array", "items": { "type": "string", "minLength": 1 } }, + "research_summary": { "type": "string" } } }, "isolation": { diff --git a/schemas/responder-packet.schema.json b/schemas/responder-packet.schema.json index 3d264b9..0bd383a 100644 --- a/schemas/responder-packet.schema.json +++ b/schemas/responder-packet.schema.json @@ -40,6 +40,10 @@ "properties": { "mode": { "enum": ["curated_excerpts_only", "coordinator_scoped_retrieval", "responder_scoped_repository_search"] }, "allowed_scope": { "type": "array", "items": { "type": "string", "minLength": 1 } }, + "research_instructions": { + "type": "array", + "items": { "type": "string", "minLength": 1 } + }, "required_provenance": { "type": "boolean", "const": true } } }, diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 427b701..e347b86 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -67,3 +67,4 @@ {"ts": "2026-05-02T09:59:37+00:00", "type": "design", "status": "accepted", "note": "Corrected responder lane terminology: the prior research_augmented Sella capture was coordinator-retrieved lore, not autonomous responder research, so the lane is now retrieval_augmented with lore_access.mode coordinator_scoped_retrieval. The comparison now records that retrieval improved institutional texture but underused Sella Ren's packet-visible sanctuary-collapse scar; future projector/retrieval review must preserve character-local scars as well as lore grounding."} {"ts": "2026-05-02T10:02:28+00:00", "type": "design", "status": "accepted", "note": "Refined character-pressure retention doctrine: packet-visible backstory such as Sella Ren's sanctuary-collapse scar should be available to shape responder behavior, but review must not reward unnecessary trauma-dumping or require the scar to surface in mission-critical speech."} {"ts": "2026-05-02T10:08:14+00:00", "type": "implementation", "status": "ok", "note": "Implemented runtime retrieval/projector requirements. Projected local contexts now emit source-backed runtime_retrieval_requirements and latent_pressure_requirements; prompt text renders retrieved lore and latent pressure handling; responder packets copy active retrieval requirements into source_excerpts so packet-only contexts receive compact Cold Wake heat-debt, Navigator rescue-ledger, Aya sanctuary-capacity, and Ganymede/Lightsail route-obligation facts without granting repo access or forcing character backstory into speech."} +{"ts": "2026-05-02T10:11:38+00:00", "type": "design", "status": "accepted", "note": "Added explicit research-enabled responder instructions. `responder_scoped_repository_search` now means the responder may inspect only the declared lore scope, must consult it before answering, and must ground behavior in retrieved lore docs; packet validation requires visible research instructions and output validation requires consulted refs plus a research summary."} diff --git a/state/map.yaml b/state/map.yaml index f3adc80..62c429d 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -157,6 +157,7 @@ accepted_design: - First lane-comparison correction: retrieval-augmented output improved institutional texture, and follow-up review clarified that Sella Ren's packet-visible sanctuary-collapse scar does not need to surface in speech but must remain available to the responder as latent behavioral pressure. - The first responder lane comparison shows packet-only output proves bounded runtime competence, while retrieval-augmented output adds heat-debt timing, rescue-ledger burden, dockfall responsibility, and Aya sanctuary capacity politics that should become retrieval/projector requirements. - Runtime retrieval/projector requirements are now first-class projected-context fields: compact source-backed lore facts flow into packet source excerpts when scene-relevant, and latent character-history pressure remains visible without becoming required spoken disclosure. + - Research-enabled responder mode is now explicit: `responder_scoped_repository_search` packets must surface required lore research instructions and allowed scope, and captures must preserve consulted refs plus a research summary so ignored research access is reviewable. - The concrete training plan enumerates the trainable stages and their model families: generative decoder LLMs for coordinator/responder/soft structured outputs, classifiers or cross-encoders for appraisal/evaluation/relationship movement, retrieval models for memory and lore selection, and deterministic code for gates. - Training-plan sample counts are pilot schema-shakedown gates, not robust corpus targets; pilot data may be invalidated by schema fixes, while review-assistant and runtime targets are expected to be roughly an order of magnitude larger with held-out evaluation and failure audits. - The timeline training plan now requires future-branch Elysium examples so the responder, coordinator, appraiser, and decision models learn post-Rupture concepts such as Aether, pseudospace, temporal nonlinearity, spirits, necrotech, mutable bodies, altered substrates, and weird institutions under branch-lineage labels. @@ -170,4 +171,4 @@ accepted_design: current_status: summary: Ghostlight now has the Epiphany-style persistence spine, the first architecture payload, the v0 canonical agent-state schema seam, prompt projection docs, immediate schema fixes from evaluation, first reviewed Cat/Oz projection examples, a revised Aetheria lore-grounding architecture, a lore grounding digest schema, the first coordinator artifact schema seam, the first responder packet seam, the first sandboxed responder output seam, explicit packet-only versus retrieval-augmented responder lanes, the first responder lane comparison, the first draft Cold Wake historical grounding digest, a Cold Wake story-lab fixture, projection controls, validated Qwen capture receipts, a complete Cold Wake short story assembled from accepted projection outputs, a hand-authored Ink-backed Cold Wake branching scene, the first Qwen-generated Ink draft materialized from local awareness with reviewed training annotations, the first reviewed sequential branch mutation that updates both Maer and Sella after a sanctuary intake beat, a v2 sequential Qwen capture proving the symmetrical turn shape produces better action behavior, a v5 sequential Qwen capture proving local thinking-plus-tools invocation works for the scene runner, the first projected-local-context seam that routes sequential prompts through character-local operating prose instead of raw state variables, tightened receipt handling for projector-routed Qwen failures, a default no-thinking policy for strict sequential tool calls, a v10 no-thinking projector-routed capture accepted as draft, the first materialized projector-routed sequential Ink scene with reviewed mutation training data, a source-checked embodiment/interface projection surface for Navigator scenes, a formal source-first Aetheria generation doctrine, v11-v17 source-checked retry receipts showing improved Maer embodiment plus remaining Sella response/prompt-leak blockers, a soft-model training artifact doctrine, a concrete training plan with pilot schema-shakedown gates separated from robust corpus targets, sandboxed responder-data requirements, an explicit future-branch lane, Elysium branch event constraints, and a technology/item manifest plan for turning nebulous named tech into blueprint-grade components, assemblies, faction tech bases, supply chains, upgrade paths, gameplay hooks, provenance-hunting player fantasy, and content-refinery outputs mapped onto Aetheria-Economy's CultCache blueprint and instance model. - next_action: Use the corrected packet surface for the next fresh generation pass: run a sandboxed responder against the regenerated Sella packet, then review whether the output uses institutional lore and latent pressure without prompt parroting, omniscience, or mission-critical trauma-dumping. Do not call Qwen for gold responder data yet. + next_action: Use the corrected packet surface for the next fresh generation pass. If testing runtime parity, run a packet-only sandboxed responder against the regenerated Sella packet. If testing research-enabled behavior, build the handoff as `responder_scoped_repository_search` and require scoped AetheriaLore consultation before answering. Review for institutional lore use, latent pressure, prompt parroting, omniscience, and mission-critical trauma-dumping. Do not call Qwen for gold responder data yet. diff --git a/tools/build_responder_packet.py b/tools/build_responder_packet.py index 46d89d6..ebc58eb 100644 --- a/tools/build_responder_packet.py +++ b/tools/build_responder_packet.py @@ -48,6 +48,7 @@ def render_packet_prompt(packet: dict[str, Any]) -> str: context = packet["visible_context"] event = context["observed_event"] contract = packet["output_contract"] + lore_access = packet["lore_access"] lines = [ "# Ghostlight Sandboxed Responder Packet", "", @@ -55,6 +56,25 @@ def render_packet_prompt(packet: dict[str, Any]) -> str: "Do not treat guesses about another character's intent as fact.", "If you need to guess intent, mark it as this character's interpretation, not truth.", "", + ] + if lore_access["mode"] == "responder_scoped_repository_search": + lines.extend([ + "## Required Lore Research", + "Before answering, inspect the declared lore scope and ground your action in what those sources make true or likely.", + "Use lore to constrain behavior, affordances, institutions, vocabulary, and material stakes. Do not use it to gain hidden character state, author-only answers, or future branch knowledge.", + "If a scoped source contradicts the packet, follow the packet for character-local knowledge and flag the contradiction in unresolved hooks.", + "Your output capture must list consulted refs and a brief research summary; an answer with no consulted refs is a failed research-enabled response.", + "", + "Allowed research scope:", + ]) + for scope in lore_access["allowed_scope"]: + lines.append(f"- {scope}") + if lore_access.get("research_instructions"): + lines.extend(["", "Research instructions:"]) + for instruction in lore_access["research_instructions"]: + lines.append(f"- {instruction}") + lines.append("") + lines.extend([ "## Local Operating Context", context["local_context_prompt"], "", @@ -63,7 +83,7 @@ def render_packet_prompt(packet: dict[str, Any]) -> str: f"- Actor: {event['actor_agent_id']}", f"- Observable action: {event['observable_action']}", f"- Spoken text: {event['spoken_text']}", - ] + ]) for note in event["visibility_notes"]: lines.append(f"- Visibility note: {note}") lines.extend([ diff --git a/tools/validate_responder_outputs.py b/tools/validate_responder_outputs.py index 690abad..a91ae1c 100644 --- a/tools/validate_responder_outputs.py +++ b/tools/validate_responder_outputs.py @@ -163,6 +163,9 @@ def validate_capture(document: dict[str, Any], source: Path) -> None: in {"coordinator_scoped_retrieval", "responder_scoped_repository_search"}, f"{base}.retrieval_augmented must use scoped retrieval lore access", ) + if lore_access["mode"] == "responder_scoped_repository_search": + require_string_array(lore_access["consulted_refs"], f"{base}.lore_access.consulted_refs", nonempty=True) + require_string(lore_access.get("research_summary"), f"{base}.lore_access.research_summary") isolation = document["isolation"] require_keys(isolation, ["isolation_method", "fork_context", "visible_input_ref", "hidden_context_refs", "worker_model_family"], f"{base}.isolation") @@ -171,6 +174,11 @@ def validate_capture(document: dict[str, Any], source: Path) -> None: require_string(isolation["visible_input_ref"], f"{base}.isolation.visible_input_ref") require_string(isolation["worker_model_family"], f"{base}.isolation.worker_model_family") require_string_array(isolation["hidden_context_refs"], f"{base}.isolation.hidden_context_refs") + if lore_access["mode"] == "responder_scoped_repository_search": + require( + "repo" in isolation["visible_input_ref"].lower() or "lore" in isolation["visible_input_ref"].lower(), + f"{base}.isolation.visible_input_ref should describe scoped lore access", + ) raw_output = document["raw_output"] parsed_raw = json.loads(raw_output) diff --git a/tools/validate_responder_packets.py b/tools/validate_responder_packets.py index d18d371..6aed1d1 100644 --- a/tools/validate_responder_packets.py +++ b/tools/validate_responder_packets.py @@ -111,6 +111,8 @@ def validate_packet(document: dict[str, Any], source: Path) -> None: ) require_string_array(lore_access["allowed_scope"], f"{base}.lore_access.allowed_scope") require(lore_access["required_provenance"] is True, f"{base}.lore_access.required_provenance must be true") + if "research_instructions" in lore_access: + require_string_array(lore_access["research_instructions"], f"{base}.lore_access.research_instructions", nonempty=True) if document["generation_lane"] == "packet_only": require(lore_access["mode"] == "curated_excerpts_only", f"{base}.packet_only must use curated_excerpts_only lore access") if document["generation_lane"] == "retrieval_augmented": @@ -119,6 +121,12 @@ def validate_packet(document: dict[str, Any], source: Path) -> None: in {"coordinator_scoped_retrieval", "responder_scoped_repository_search"}, f"{base}.retrieval_augmented must use scoped retrieval lore access", ) + if lore_access["mode"] == "responder_scoped_repository_search": + require(lore_access["allowed_scope"], f"{base}.responder_scoped_repository_search requires allowed_scope") + require( + lore_access.get("research_instructions"), + f"{base}.responder_scoped_repository_search requires lore_access.research_instructions", + ) visible = document["visible_context"] require_keys(visible, ["local_context_prompt", "observed_event", "allowed_action_labels", "source_excerpts"], f"{base}.visible_context") @@ -158,12 +166,20 @@ def validate_packet(document: dict[str, Any], source: Path) -> None: for key in ["packet_only", "no_conversation_context", "no_hidden_state_refs"]: require(isolation[key] is True, f"{base}.isolation_requirements.{key} must be true") require(isinstance(isolation["no_repo_access"], bool), f"{base}.isolation_requirements.no_repo_access must be boolean") + if lore_access["mode"] == "responder_scoped_repository_search": + require(isolation["no_repo_access"] is False, f"{base}.responder_scoped_repository_search must set no_repo_access false") + else: + require(isolation["no_repo_access"] is True, f"{base}.{lore_access['mode']} must keep no_repo_access true") prompt_text = document["packet_prompt_text"] reject_markers(prompt_text, RAW_STATE_MARKERS, f"{base}.packet_prompt_text") reject_markers(prompt_text, HIDDEN_LEAK_MARKERS, f"{base}.packet_prompt_text") require(document["visible_context"]["local_context_prompt"] in prompt_text, f"{base}.packet_prompt_text must contain local context prompt") require(event["observable_action"] in prompt_text, f"{base}.packet_prompt_text must contain observed event") + if lore_access["mode"] == "responder_scoped_repository_search": + require("## Required Lore Research" in prompt_text, f"{base}.packet_prompt_text must include required lore research instructions") + for scope in lore_access["allowed_scope"]: + require(scope in prompt_text, f"{base}.packet_prompt_text must include allowed research scope: {scope}") review = document["review"] require_keys(review, ["reviewer", "review_notes", "accepted_for_sandbox_use", "failure_labels"], f"{base}.review")