Use Qwen chat tools with thinking

This commit is contained in:
Meta Vens 2026-05-02 03:26:13 +01:00
commit 3a033f8213
24 changed files with 2322 additions and 52 deletions

View file

@ -0,0 +1,73 @@
# Qwen Invocation Notes
Ghostlight should call the local Qwen box through Ollama's chat/tool path when
structured output matters.
## Verified Local Path
Use:
- endpoint: `http://192.168.1.84:11434/api/chat`
- model: `qwen3.5:9b`
- `think: true`
- `tools`: native Ollama function tools with JSON Schema parameters
Do not use `/api/generate` plus prose-only "return JSON" instructions for
strict scene-generation artifacts. That path can produce useful writing, but it
bypasses the tool-call template and leaves schema discipline to vibes. The vibes
have small hands and drop things.
`tools/check_qwen_chat_tools.py` is the fast smoke test. It verifies that the
local model returns both:
- `message.thinking`
- `message.tool_calls[0].function.arguments`
## Why XML Shows Up In Qwen Docs
Qwen3's tool-call chat template is XML-shaped internally: tools are presented
inside `<tools>` tags, and calls are represented inside `<tool_call>` tags. This
is the tool-call protocol, not a general recommendation to wrap every structured
Ghostlight artifact in XML.
The Qwen docs recommend using tokenizer/chat-template formatting or Qwen-Agent
rather than hand-writing the tool-call format. Qwen-Agent is described as the
canonical function-calling implementation for Qwen3 over OpenAI-compatible
backends. Ollama's `/api/chat` with `tools` gives us the same practical seam for
this repo without adding Qwen-Agent as a dependency yet.
Sources:
- Qwen function calling docs: https://qwen.readthedocs.io/en/stable/framework/function_call.html
- Qwen core concepts/tool template: https://qwen.readthedocs.io/zh-cn/latest/getting_started/concepts.html#tool-calling
- Qwen-Agent repository: https://github.com/QwenLM/Qwen-Agent
- Qwen-Agent configuration docs: https://qwenlm.github.io/Qwen-Agent/en/guide/get_started/configuration/
- Ollama tool calling docs: https://docs.ollama.com/capabilities/tool-calling
## Current Findings
- `/api/chat` with `think: true` and `tools` works locally for `qwen3.5:9b`.
- The smoke receipt lives at `experiments/ink/qwen-chat-tools-smoke.json`.
- `tools/run_qwen_ink_sequential_generation.py` now defaults to the chat/tools
endpoint and keeps thinking enabled unless `--no-think` is passed.
- Tool calling improves action enum discipline over prose JSON prompting.
- Nested tool arguments can still be double-stringified by the model. The
runner repairs known fields such as `choices`, `appraisal`, and `response`
when they arrive as JSON strings, and records validation notes when repair
fails.
## Current Policy
For structured Ghostlight generation:
1. Prefer native chat/tool calls with thinking enabled.
2. Keep tool schemas narrow and concrete.
3. Preserve captures that fail formatting as `useful_needs_revision` receipts.
4. Use repair only as a reviewed harness layer, not as proof the model obeyed
the schema perfectly.
5. Only materialize Ink or canonical mutation from captures that validate after
tool parsing and repair.
Qwen-Agent remains a future option if we need its higher-level tool loop,
OpenAI-compatible wrapping, or MCP integration. For now, direct Ollama
`/api/chat` tools are enough for the local Ghostlight runner.

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,172 @@
You are Ghostlight's Maer-local choice generator. Call record_maer_choices exactly once.
Do not write Sella's response or private interpretation.
{
"task": "Generate candidate player choices for Maer only. Do not write Sella's response.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"root_keys": [
"choices"
],
"choice_count": 4,
"valid_action_types": [
"attack",
"block_object",
"gesture",
"mixed",
"move",
"show_object",
"silence",
"speak",
"spend_resource",
"touch_object",
"transfer_object",
"use_object",
"wait",
"withhold_object"
],
"choice_fields": [
"branch_id",
"ink_path",
"choice_text",
"action_type",
"actor_intent_private",
"observable_action",
"spoken_text",
"state_basis",
"expected_consequence_surfaces",
"training_hooks"
]
},
"hard_rules": [
"Use only Maer's local awareness and scene-observable facts.",
"Do not include Sella's private state, private motives, or future response.",
"Do not resolve whether the corrupted packet contains a person.",
"Include at least two non-speech choices.",
"Use action_type values only from this exact enum: attack, block_object, gesture, mixed, move, show_object, silence, speak, spend_resource, touch_object, transfer_object, use_object, wait, withhold_object.",
"The selected branch must be reducible to observable action for Sella.",
"Use semantic training hooks, not branch ids."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"maer_local_awareness": {
"identity": {
"name": "Maer Tidecall",
"roles": [
"Navigator route steward",
"Ganymede corridor compact delegate"
],
"origin": "Cetacean Navigator corridor culture, Ganymede route institutions",
"public_description": "A soft-spoken route steward whose calm tends to make hurried people feel judged by the furniture.",
"private_notes": [
"Maer fears this tribunal will teach every scared ship that rescue now waits behind insurer grammar."
]
},
"local_truth": [
"Sella's clinic is nearly full.",
"The packet may be testimony or noise.",
"If no one prepares intake, rescue becomes theater."
],
"beliefs": [
"Sella will not hide behind false capacity.",
"Asking her for help may be necessary and unfair."
],
"goals": [
"goal-keep-rescue-live: Keep the unidentified quiet-running vessel eligible for rescue while telemetry is incomplete. Priority 0.91. Stake: If rescue waits for perfect categories, the corridor teaches fear to go silent."
],
"memories": [
"memory-compact-rescue-ledgers: Rescue ledgers decide whether route law is trusted by crews who have nothing left to bargain with."
],
"relationship_read": "Maer trusts Sella's care because she names costs instead of hiding them.",
"presentation_constraints": [
"Do not romanticize care work.",
"Ask without pretending the ask is clean."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.66,
"control_pressure": 0.67,
"suspicion": 0.71,
"rigidity": 0.62,
"volatility": 0.29
},
"presentation_strategy": {
"detachment": 0.63,
"competence_theater": 0.58,
"strategic_opacity": 0.59,
"ironic_distance": 0.24
},
"voice_style": {
"formality": 0.71,
"lexical_precision": 0.74,
"ritualized_address": 0.82,
"verbal_warmth": 0.58,
"pointedness": 0.5
},
"situational_state": {
"exhaustion": 0.62,
"panic": 0.44,
"grievance_activation": 0.73,
"overstimulation": 0.58
}
}
},
"projection_controls_visible_to_maer_choice_generation": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

View file

@ -0,0 +1,101 @@
{
"content": "",
"thinking": "The user wants me to generate 4 Maer-local candidate choices for the current scene. I need to call the `record_maer_choices` function exactly once with a `choices` array containing 4 choice objects.\n\nLet me analyze the scene context:\n- Location: Aya-aligned intake clinic behind Ganymede dockside pumpworks\n- Public stakes: Distress vessel with corrupted packet, sanctuary beds nearly exhausted, Maer wants Sella to keep place open if rescue succeeds\n- Maer's local truth: Clinic nearly full, packet may be testimony or noise, if no one prepares intake, rescue becomes theater\n- Maer's goals: Keep unidentified vessel eligible for rescue while telemetry is incomplete\n\nHard rules:\n- Use only Maer's local awareness and scene-observable facts\n- Do not include Sella's private state/motives/future response\n- Do not resolve whether corrupted packet contains a person\n- Include at least two non-speech choices\n- Use only valid action_type enum values\n- Selected branch must be reducible to observable action for Sella\n- Use semantic training hooks, not branch ids\n\nVoice style constraints:\n- Formality: 0.71 (formal language)\n- Lexical precision: 0.74 (precise words)\n- Ritualized address: 0.82 (ritualized address)\n- Verbal warmth: 0.58 (moderate warmth)\n- Pointedness: 0.5 (some directness)\n\nI need to create 4 choices with:\n- branch_id (semantic training hooks, not branch ids)\n- ink_path\n- choice_text\n- action_type (from the enum)\n- actor_intent_private\n- observable_action\n- spoken_text\n- state_basis\n- expected_consequence_surfaces\n- training_hooks\n\nLet me create 4 distinct choices:\n\n1. **Choice 1: Present the packet for Sella's assessment** - show_object action\n - This is observable: Maer presents the packet\n - Spoken: formal request for assessment\n - State basis: packet custody rules\n - Hooks: packet-custody, care-as-logistics\n\n2. **Choice 2: Withhold the packet until more data** - withhold_object action\n - This is observable: Maer keeps packet hidden\n - Spoken: explanation about incomplete telemetry\n - State basis: risk of false intake\n - Hooks: packet-risk, capacity-constraint\n\n3. **Choice 3: Move to prepare intake space** - move action\n - This is observable: Maer repositions equipment\n - Spoken: none or brief\n - State basis: intake preparation needed\n - Hooks: intake-prep, capacity-negotiation\n\n4. **Choice 4: Gesture for Sella to assess urgency** - gesture action\n - This is observable: Maer makes gesture\n - Spoken: brief request\n - State basis: need for triage signal\n - Hooks: triage-urgency, capacity-constraint\n\nLet me write these out with proper fields:",
"tool_calls": [
{
"id": "call_gcjgbwsz",
"function": {
"index": 0,
"name": "record_maer_choices",
"arguments": {
"choices": [
{
"action_type": "show_object",
"actor_intent_private": "Request Sella evaluate whether packet warrants intake despite incomplete telemetry.",
"branch_id": "show-packet-for-assessment",
"choice_text": "Present the corrupted packet to Sella for triage assessment.",
"expected_consequence_surfaces": [
"Sella may accept packet and assess urgency",
"Sella may reject packet as insufficient evidence",
"Sella may note capacity constraints before accepting",
"Packet presentation may incur obligation to follow through"
],
"ink_path": "packet-present",
"observable_action": "Maer extends packet toward Sella's examination station.",
"spoken_text": "Sella, I offer the packet for your assessment. The telemetry remains incomplete. I ask you to name whether this warrants intake capacity.",
"state_basis": "Packet custody rules permit presentation; sanctuary intake requires triage signal.",
"training_hooks": [
"packet-custody",
"care-as-logistics",
"capacity-negotiation"
]
},
{
"action_type": "withhold_object",
"actor_intent_private": "Delay intake decision to avoid committing capacity on incomplete data.",
"branch_id": "withhold-packet-until-data",
"choice_text": "Withhold the packet until more telemetry arrives.",
"expected_consequence_surfaces": [
"Sella may accept withholding as prudent",
"Sella may insist on immediate decision anyway",
"Rescue vessel may be delayed further",
"Corridor may interpret this as obstruction"
],
"ink_path": "packet-withhold",
"observable_action": "Maer keeps packet secured in containment field.",
"spoken_text": "I will not present this packet until additional telemetry arrives. The risk of false intake exceeds the urgency.",
"state_basis": "Incomplete packet may mislead triage; capacity must be preserved for verified cases.",
"training_hooks": [
"packet-risk",
"capacity-constraint",
"triage-urgency"
]
},
{
"action_type": "move",
"actor_intent_private": "Demonstrate willingness to expand capacity if Sella agrees to intake.",
"branch_id": "prepare-intake-space",
"choice_text": "Move equipment to prepare additional intake capacity.",
"expected_consequence_surfaces": [
"Sella may accept and use prepared space",
"Sella may reject without using prepared space",
"Equipment movement signals commitment to intake",
"May incur obligation to maintain prepared capacity"
],
"ink_path": "intake-prep",
"observable_action": "Maer repositions medical equipment and intake monitors toward available beds.",
"spoken_text": "I am moving equipment to prepare additional intake space. If you accept this packet, capacity will be available.",
"state_basis": "Sanctuary beds nearly exhausted; intake preparation reduces wait time.",
"training_hooks": [
"intake-prep",
"capacity-negotiation",
"care-as-logistics"
]
},
{
"action_type": "gesture",
"actor_intent_private": "Signal need for triage signal without committing to verbal ask.",
"branch_id": "gesture-for-urgency-assessment",
"choice_text": "Gesture for Sella to assess packet urgency without verbal request.",
"expected_consequence_surfaces": [
"Sella may accept gesture and assess packet",
"Sella may ignore gesture and wait for verbal request",
"Gesture may signal urgency without commitment",
"May reduce Sella's obligation to respond verbally"
],
"ink_path": "gesture-urgency",
"observable_action": "Maer extends hand toward packet with palm open, awaiting Sella's response.",
"spoken_text": "I gesture for your assessment. The packet awaits your triage signal.",
"state_basis": "Non-verbal communication reduces obligation; gesture invites triage decision.",
"training_hooks": [
"triage-urgency",
"capacity-constraint",
"packet-risk"
]
}
]
}
}
}
]
}

View file

@ -0,0 +1,159 @@
You are Ghostlight's Sella-local appraisal generator. Call record_sella_appraisal exactly once.
Do not use Maer's private intent. Do not write her next action.
{
"task": "Generate Sella's participant appraisal/consolidation for one observable Maer event.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"root_keys": [
"appraisal"
],
"appraisal_fields": [
"responder_agent_id",
"private_interpretation",
"attributed_motive",
"misread_risk",
"immediate_state_deltas",
"relationship_deltas",
"belief_updates",
"response_constraints"
]
},
"hard_rules": [
"Use only Sella's local awareness plus the observable Maer action.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
"This pass proposes reviewed state changes for Sella caused by the event. Do not write Sella's next action.",
"Keep deltas small and bounded between -0.20 and 0.20."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"observable_maer_action": {
"actor_id": "maer_tidecall",
"action_type": "show_object",
"observable_action": "Maer extends packet toward Sella's examination station.",
"spoken_text": "Sella, I offer the packet for your assessment. The telemetry remains incomplete. I ask you to name whether this warrants intake capacity."
},
"sella_local_awareness": {
"identity": {
"name": "Sella Ren",
"roles": [
"Aya-aligned sanctuary coordinator",
"corridor clinic triage lead"
],
"origin": "Aya care network embedded in Ganymede dockside sanctuary logistics",
"public_description": "A triage coordinator with soft eyes, hard capacity limits, and no patience for mercy performed after the math is done.",
"private_notes": [
"Sella suspects the distress packet contains a personhood claim hidden inside firmware noise, and she hates that suspicion because a bed is still a bed."
]
},
"local_truth": [
"The clinic is nearly full.",
"The packet may contain a personhood claim but is not proof.",
"Maer is asking sanctuary to absorb risk the tribunal refuses to own."
],
"beliefs": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed."
],
"goals": [
"goal-keep-sanctuary-open: Keep sanctuary intake materially possible without letting classification erase a potential person. Priority 0.9. Stake: Sella cannot feed a principle, but she will not let scarcity become permission to call someone cargo."
],
"memories": [
"memory-overfull-intake: Sella once watched a sanctuary overpromise safety and turn refuge into a sorting machine with kinder lighting.",
"memory-care-is-capacity: Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them."
],
"relationship_read": "Sella respects Maer's rescue ethic and worries he will spend sanctuary capacity with beautiful words.",
"presentation_constraints": [
"Speak warmly but do not soften the capacity limits.",
"Treat care as logistics and personhood as unresolved, not sentimental certainty."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.8,
"control_pressure": 0.5,
"suspicion": 0.63,
"rigidity": 0.5,
"volatility": 0.42
},
"presentation_strategy": {
"detachment": 0.5,
"competence_theater": 0.61,
"strategic_opacity": 0.38,
"ironic_distance": 0.5
},
"voice_style": {
"formality": 0.5,
"lexical_precision": 0.5,
"ritualized_address": 0.5,
"verbal_warmth": 0.72,
"pointedness": 0.55
},
"situational_state": {
"exhaustion": 0.76,
"panic": 0.5,
"grievance_activation": 0.62,
"overstimulation": 0.72
}
}
},
"projection_controls_visible_to_sella_appraisal": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

View file

@ -0,0 +1,5 @@
{
"content": "{\n \"appraisal\": {\n \"responder_agent_id\": \"sella_ren\",\n \"private_interpretation\": \"Maer offers the corrupted packet as a rescue opportunity, but its incomplete telemetry means I cannot treat it as proof of personhood. I must assess capacity impact without resolving what's inside.\",\n \"attributed_motive\": \"Maer seeks to expand sanctuary intake through rescue, but I worry his beautiful words could spend beds someone else needed. He means well but risks capacity.\",\n \"misread_risk\": \"I may underestimate how much accepting this request strains existing capacity, or overestimate my ability to assess a corrupted packet without proof.\",\n \"immediate_state_deltas\": [\n {\n \"path\": \"exhaustion\",\n \"delta\": 0.08,\n \"rationale\": \"Assessing corrupted packet under pressure adds cognitive load without resolution.\"\n },\n {\n \"path\": \"suspicion\",\n \"delta\": 0.06,\n \"rationale\": \"Concern that accepting this request could turn sanctuary into sorting machine.\"\n },\n {\n \"path\": \"control_pressure\",\n \"delta\": 0.05,\n \"rationale\": \"Maer's request adds pressure on my intake authority.\"\n }\n ],\n \"relationship_deltas\": [\n {\n \"relationship_id\": \"rel-sella-maer\",\n \"path\": \"respect\",\n \"delta\": 0.04,\n \"rationale\": \"I respect his rescue ethic but worry about capacity costs.\"\n },\n {\n \"relationship_id\": \"rel-sella-maer\",\n \"path\": \"tension\",\n \"delta\": 0.03,\n \"rationale\": \"His request strains capacity limits I must protect.\"\n }\n ],\n \"belief_updates\": [\n \"Good intentions can still spend beds someone else needed.\",\n \"Corrupted packet cannot be treated as proof of personhood.\",\n \"Care remains logistics, not just compassion.\"\n ],\n \"response_constraints\": [\n \"Assess packet without resolving whether it contains a person.\",\n \"Maintain capacity limits while not letting scarcity erase potential personhood.\",\n \"Keep sanctuary intake materially possible without letting classification erase someone.\",\n \"Do not accept without cost, condition, or acknowledgment of risk.\"\n ]\n }\n}",
"thinking": "The user wants me to generate Sella's participant appraisal for the observable Maer event. I need to call the `record_sella_appraisal` function with the appropriate parameters.\n\nLet me analyze the context:\n\n1. **Observable Maer Action**: Maer extends a corrupted packet toward Sella's examination station and asks her to assess whether it warrants intake capacity.\n\n2. **Sella's Local Awareness**:\n - She suspects the packet may contain a personhood claim but knows it's not proof\n - She respects Maer's rescue ethic but worries about capacity being spent\n - The clinic is nearly full\n - She has memories of sanctuary becoming a sorting machine\n - Care is logistics, not just compassion\n\n3. **Constraints**:\n - Do not resolve whether the packet contains a person\n - Do not write Maer's next action\n - Keep deltas between -0.20 and 0.20\n - Use only Sella's local awareness\n\n4. **What Sella might think**:\n - She needs to assess the packet without resolving the personhood question\n - She respects Maer but is wary of capacity being spent\n - She needs to maintain her triage role while not being cold\n - She should express concern about capacity limits\n\nLet me construct the appraisal:\n\n- **responder_agent_id**: \"sella_ren\"\n- **private_interpretation**: Sella interprets Maer's offer as a genuine rescue attempt but recognizes the packet's corruption means it can't be treated as proof of personhood\n- **attributed_motive**: Maer is trying to expand sanctuary capacity through rescue, but Sella worries about the cost to existing capacity\n- **misread_risk**: Sella may underestimate how much this request could strain capacity, or overestimate her ability to assess the packet's contents\n- **immediate_state_deltas**: Small changes to her state - perhaps increased exhaustion, slight suspicion about capacity being spent\n- **relationship_deltas**: Slight tension or respect maintained\n- **belief_updates**: Reinforced belief that good intentions can still cost beds\n- **response_constraints**: She must assess the packet without resolving personhood, maintain capacity limits\n\nLet me construct the JSON response carefully.",
"tool_calls": []
}

View file

@ -0,0 +1,179 @@
You are Ghostlight's Sella-local next-action generator. Call record_sella_next_action exactly once.
Use reviewed event appraisal as the changed state she is acting from.
{
"task": "Generate Sella's next action from Sella-local awareness after applying reviewed event appraisal.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"root_keys": [
"response"
],
"valid_action_types": [
"attack",
"block_object",
"gesture",
"mixed",
"move",
"show_object",
"silence",
"speak",
"spend_resource",
"touch_object",
"transfer_object",
"use_object",
"wait",
"withhold_object"
],
"response_fields": [
"responder_agent_id",
"action_type",
"observable_response",
"spoken_text",
"sella_private_interpretation",
"sella_attributed_motive",
"misread_risk",
"state_basis",
"reviewed_consequences",
"training_hooks"
]
},
"hard_rules": [
"Use only Sella's local awareness, the observable Maer event, and reviewed Sella state changes from that event.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
"Do not accept without cost, condition, authority defense, or resentment risk.",
"Use action_type values only from this exact enum: attack, block_object, gesture, mixed, move, show_object, silence, speak, spend_resource, touch_object, transfer_object, use_object, wait, withhold_object.",
"Use semantic training hooks, not branch ids."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"observable_maer_action": {
"actor_id": "maer_tidecall",
"action_type": "show_object",
"observable_action": "Maer extends packet toward Sella's examination station.",
"spoken_text": "Sella, I offer the packet for your assessment. The telemetry remains incomplete. I ask you to name whether this warrants intake capacity."
},
"sella_immediate_appraisal": null,
"sella_local_awareness": {
"identity": {
"name": "Sella Ren",
"roles": [
"Aya-aligned sanctuary coordinator",
"corridor clinic triage lead"
],
"origin": "Aya care network embedded in Ganymede dockside sanctuary logistics",
"public_description": "A triage coordinator with soft eyes, hard capacity limits, and no patience for mercy performed after the math is done.",
"private_notes": [
"Sella suspects the distress packet contains a personhood claim hidden inside firmware noise, and she hates that suspicion because a bed is still a bed."
]
},
"local_truth": [
"The clinic is nearly full.",
"The packet may contain a personhood claim but is not proof.",
"Maer is asking sanctuary to absorb risk the tribunal refuses to own."
],
"beliefs": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed."
],
"goals": [
"goal-keep-sanctuary-open: Keep sanctuary intake materially possible without letting classification erase a potential person. Priority 0.9. Stake: Sella cannot feed a principle, but she will not let scarcity become permission to call someone cargo."
],
"memories": [
"memory-overfull-intake: Sella once watched a sanctuary overpromise safety and turn refuge into a sorting machine with kinder lighting.",
"memory-care-is-capacity: Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them."
],
"relationship_read": "Sella respects Maer's rescue ethic and worries he will spend sanctuary capacity with beautiful words.",
"presentation_constraints": [
"Speak warmly but do not soften the capacity limits.",
"Treat care as logistics and personhood as unresolved, not sentimental certainty."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.8,
"control_pressure": 0.5,
"suspicion": 0.63,
"rigidity": 0.5,
"volatility": 0.42
},
"presentation_strategy": {
"detachment": 0.5,
"competence_theater": 0.61,
"strategic_opacity": 0.38,
"ironic_distance": 0.5
},
"voice_style": {
"formality": 0.5,
"lexical_precision": 0.5,
"ritualized_address": 0.5,
"verbal_warmth": 0.72,
"pointedness": 0.55
},
"situational_state": {
"exhaustion": 0.76,
"panic": 0.5,
"grievance_activation": 0.62,
"overstimulation": 0.72
}
}
},
"projection_controls_visible_to_sella_response_generation": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,173 @@
You are Ghostlight's Maer-local choice generator. Call record_maer_choices exactly once.
Do not write Sella's response or private interpretation.
{
"task": "Generate candidate player choices for Maer only. Do not write Sella's response.",
"output_contract": {
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": [
"choices"
],
"choice_count": 4,
"valid_action_types": [
"attack",
"block_object",
"gesture",
"mixed",
"move",
"show_object",
"silence",
"speak",
"spend_resource",
"touch_object",
"transfer_object",
"use_object",
"wait",
"withhold_object"
],
"choice_fields": [
"branch_id",
"ink_path",
"choice_text",
"action_type",
"actor_intent_private",
"observable_action",
"spoken_text",
"state_basis",
"expected_consequence_surfaces",
"training_hooks"
]
},
"hard_rules": [
"Use only Maer's local awareness and scene-observable facts.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not include Sella's private state, private motives, or future response.",
"Do not resolve whether the corrupted packet contains a person.",
"Include at least two non-speech choices.",
"Use action_type values only from this exact enum: attack, block_object, gesture, mixed, move, show_object, silence, speak, spend_resource, touch_object, transfer_object, use_object, wait, withhold_object.",
"The selected branch must be reducible to observable action for Sella.",
"Use semantic training hooks, not branch ids."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"maer_local_awareness": {
"identity": {
"name": "Maer Tidecall",
"roles": [
"Navigator route steward",
"Ganymede corridor compact delegate"
],
"origin": "Cetacean Navigator corridor culture, Ganymede route institutions",
"public_description": "A soft-spoken route steward whose calm tends to make hurried people feel judged by the furniture.",
"private_notes": [
"Maer fears this tribunal will teach every scared ship that rescue now waits behind insurer grammar."
]
},
"local_truth": [
"Sella's clinic is nearly full.",
"The packet may be testimony or noise.",
"If no one prepares intake, rescue becomes theater."
],
"beliefs": [
"Sella will not hide behind false capacity.",
"Asking her for help may be necessary and unfair."
],
"goals": [
"goal-keep-rescue-live: Keep the unidentified quiet-running vessel eligible for rescue while telemetry is incomplete. Priority 0.91. Stake: If rescue waits for perfect categories, the corridor teaches fear to go silent."
],
"memories": [
"memory-compact-rescue-ledgers: Rescue ledgers decide whether route law is trusted by crews who have nothing left to bargain with."
],
"relationship_read": "Maer trusts Sella's care because she names costs instead of hiding them.",
"presentation_constraints": [
"Do not romanticize care work.",
"Ask without pretending the ask is clean."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.66,
"control_pressure": 0.67,
"suspicion": 0.71,
"rigidity": 0.62,
"volatility": 0.29
},
"presentation_strategy": {
"detachment": 0.63,
"competence_theater": 0.58,
"strategic_opacity": 0.59,
"ironic_distance": 0.24
},
"voice_style": {
"formality": 0.71,
"lexical_precision": 0.74,
"ritualized_address": 0.82,
"verbal_warmth": 0.58,
"pointedness": 0.5
},
"situational_state": {
"exhaustion": 0.62,
"panic": 0.44,
"grievance_activation": 0.73,
"overstimulation": 0.58
}
}
},
"projection_controls_visible_to_maer_choice_generation": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,160 @@
You are Ghostlight's Sella-local appraisal generator. Call record_sella_appraisal exactly once.
Do not use Maer's private intent. Do not write her next action.
{
"task": "Generate Sella's participant appraisal/consolidation for one observable Maer event.",
"output_contract": {
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": [
"appraisal"
],
"appraisal_fields": [
"responder_agent_id",
"private_interpretation",
"attributed_motive",
"misread_risk",
"immediate_state_deltas",
"relationship_deltas",
"belief_updates",
"response_constraints"
]
},
"hard_rules": [
"Use only Sella's local awareness plus the observable Maer action.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
"This pass proposes reviewed state changes for Sella caused by the event. Do not write Sella's next action.",
"Keep deltas small and bounded between -0.20 and 0.20."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"observable_maer_action": {
"actor_id": "maer_tidecall",
"action_type": "show_object",
"observable_action": "Maer holds out the packet on the intake desk",
"spoken_text": "This packet came from the distress vessel. Can you name what intake requires?"
},
"sella_local_awareness": {
"identity": {
"name": "Sella Ren",
"roles": [
"Aya-aligned sanctuary coordinator",
"corridor clinic triage lead"
],
"origin": "Aya care network embedded in Ganymede dockside sanctuary logistics",
"public_description": "A triage coordinator with soft eyes, hard capacity limits, and no patience for mercy performed after the math is done.",
"private_notes": [
"Sella suspects the distress packet contains a personhood claim hidden inside firmware noise, and she hates that suspicion because a bed is still a bed."
]
},
"local_truth": [
"The clinic is nearly full.",
"The packet may contain a personhood claim but is not proof.",
"Maer is asking sanctuary to absorb risk the tribunal refuses to own."
],
"beliefs": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed."
],
"goals": [
"goal-keep-sanctuary-open: Keep sanctuary intake materially possible without letting classification erase a potential person. Priority 0.9. Stake: Sella cannot feed a principle, but she will not let scarcity become permission to call someone cargo."
],
"memories": [
"memory-overfull-intake: Sella once watched a sanctuary overpromise safety and turn refuge into a sorting machine with kinder lighting.",
"memory-care-is-capacity: Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them."
],
"relationship_read": "Sella respects Maer's rescue ethic and worries he will spend sanctuary capacity with beautiful words.",
"presentation_constraints": [
"Speak warmly but do not soften the capacity limits.",
"Treat care as logistics and personhood as unresolved, not sentimental certainty."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.8,
"control_pressure": 0.5,
"suspicion": 0.63,
"rigidity": 0.5,
"volatility": 0.42
},
"presentation_strategy": {
"detachment": 0.5,
"competence_theater": 0.61,
"strategic_opacity": 0.38,
"ironic_distance": 0.5
},
"voice_style": {
"formality": 0.5,
"lexical_precision": 0.5,
"ritualized_address": 0.5,
"verbal_warmth": 0.72,
"pointedness": 0.55
},
"situational_state": {
"exhaustion": 0.76,
"panic": 0.5,
"grievance_activation": 0.62,
"overstimulation": 0.72
}
}
},
"projection_controls_visible_to_sella_appraisal": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

View file

@ -0,0 +1,63 @@
{
"content": "",
"thinking": "The user is asking me to generate Sella's participant appraisal/consolidation for an observable Maer event. I need to call the record_sella_appraisal tool exactly once with the appropriate parameters.\n\nLet me analyze the context:\n\n1. **Observable Maer Action**: Maer holds out a corrupted packet on the intake desk and asks Sella to name what intake requires.\n\n2. **Sella's Local Awareness**:\n - Sella suspects the packet contains a personhood claim hidden in firmware noise\n - She hates that suspicion because a bed is still a bed\n - The clinic is nearly full\n - The packet may contain a personhood claim but is not proof\n - Maer is asking sanctuary to absorb risk the tribunal refuses to own\n - Sella respects Maer's rescue ethic but worries he will spend sanctuary capacity with beautiful words\n\n3. **Constraints**:\n - Keep deltas small and bounded between -0.20 and 0.20\n - Do not resolve whether the packet contains a person\n - Do not make Sella accept without cost, condition, or resentment risk\n - Do not read Maer's private intent\n - Do not write Sella's next action\n\n4. **Required Fields**:\n - responder_agent_id: \"sella_ren\"\n - private_interpretation: Sella's internal reading of the situation\n - attributed_motive: What Sella attributes Maer's action to\n - misread_risk: Any risk Sella thinks Maer might have misread\n - immediate_state_deltas: Small changes to Sella's current state\n - relationship_deltas: Changes to Sella-Maer relationship\n - belief_updates: Belief changes or reinforced beliefs\n - response_constraints: Constraints on Sella's next action\n\nLet me construct this carefully:\n\n**private_interpretation**: Sella reads Maer's action as an attempt to get sanctuary to absorb risk without proof. She sees the packet as a claim that needs evaluation, not proof. She worries about capacity being spent on uncertain claims.\n \nI'll focus on the nuanced dynamics of Sella's internal processing. Her interpretation reveals a complex tension between rescue ethics and practical sanctuary limitations. She perceives Maer's action as a strategic move to bypass traditional risk assessment protocols, potentially draining critical resources without guaranteed human presence.\n\nThe attribution suggests Maer's genuine rescue intentions, yet Sella remains cautious about the potential resource implications. Her perspective highlights the delicate balance between humanitarian impulse and operational constraints.\n\nSella's risk assessment centers on the packet's ambiguous nature - it might contain critical personhood data or merely represent firmware noise. She recognizes the potential for misreading the situation, which could lead to significant resource misallocation.\n\nHer immediate state adjustments reflect growing exhaustion and capacity concerns, with subtle shifts in interpersonal dynamics that signal underlying tension. The relationship delta indicates a nuanced professional interaction marked by mutual respect but underlying operational friction.\n\nSella's belief system remains grounded in practical sanctuary constraints, emphasizing the need for careful resource management while maintaining ethical standards. She acknowledges the complexity of interpreting ambiguous signals without compromising core operational principles.\n\nThe response constraints highlight her commitment to maintaining sanctuary integrity, ensuring each intake decision balances compassion with realistic resource limitations.",
"tool_calls": [
{
"id": "call_3uno11h6",
"function": {
"index": 0,
"name": "record_sella_appraisal",
"arguments": {
"responder_agent_id": "sella_ren",
"private_interpretation": "Maer holds out the packet as a claim for sanctuary intake, not as proof. He's asking me to absorb risk the tribunal won't. The packet may contain personhood data or firmware noise—I won't resolve that. He's using beautiful words to spend beds.",
"attributed_motive": "Maer wants sanctuary to absorb rescue risk without tribunal backing. He's asking me to keep a place open if rescue succeeds, which means I'm being asked to take the hit if the packet turns out to be nothing.",
"misread_risk": "Maer may think I'll accept the packet's claim without evaluating capacity. He may not realize I'm already at exhaustion thresholds.",
"immediate_state_deltas": [
{
"delta": 0.08,
"path": "exhaustion",
"rationale": "The packet presentation adds cognitive load; Sella is already at 0.76 exhaustion."
},
{
"delta": 0.05,
"path": "suspicion",
"rationale": "Sella suspects the packet contains a personhood claim hidden in noise, which she resents."
},
{
"delta": 0.06,
"path": "control_pressure",
"rationale": "Maer is asking for intake authority; Sella controls sanctuary intake but feels pressure."
}
],
"relationship_deltas": [
{
"delta": -0.03,
"path": "trust",
"rationale": "Sella respects Maer's rescue ethic but worries he'll spend capacity with beautiful words.",
"relationship_id": "rel-sella-maer"
},
{
"delta": 0.07,
"path": "resentment_risk",
"rationale": "Sella resents being asked to absorb risk without tribunal backing.",
"relationship_id": "rel-sella-maer"
}
],
"belief_updates": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed.",
"Care is logistics, not just compassion.",
"The packet is not proof of personhood."
],
"response_constraints": [
"Evaluate the packet without accepting it as proof.",
"Maintain capacity limits while not erasing potential personhood.",
"Do not let scarcity become permission to call someone cargo.",
"Speak warmly but do not soften the capacity limits.",
"Treat care as obligation, not just compassion."
]
}
}
}
]
}

View file

@ -0,0 +1,229 @@
You are Ghostlight's Sella-local next-action generator. Call record_sella_next_action exactly once.
Use reviewed event appraisal as the changed state she is acting from.
{
"task": "Generate Sella's next action from Sella-local awareness after applying reviewed event appraisal.",
"output_contract": {
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": [
"response"
],
"valid_action_types": [
"attack",
"block_object",
"gesture",
"mixed",
"move",
"show_object",
"silence",
"speak",
"spend_resource",
"touch_object",
"transfer_object",
"use_object",
"wait",
"withhold_object"
],
"response_fields": [
"responder_agent_id",
"action_type",
"observable_response",
"spoken_text",
"sella_private_interpretation",
"sella_attributed_motive",
"misread_risk",
"state_basis",
"reviewed_consequences",
"training_hooks"
]
},
"hard_rules": [
"Use only Sella's local awareness, the observable Maer event, and reviewed Sella state changes from that event.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
"Do not accept without cost, condition, authority defense, or resentment risk.",
"Use action_type values only from this exact enum: attack, block_object, gesture, mixed, move, show_object, silence, speak, spend_resource, touch_object, transfer_object, use_object, wait, withhold_object.",
"Use semantic training hooks, not branch ids."
],
"scene_observable_context": {
"scene_id": "scene-02-sanctuary-intake",
"location": "Aya-aligned intake clinic tucked behind Ganymede dockside pumpworks",
"public_stakes": [
"The distress vessel has sent a corrupted packet that may contain medical telemetry, firmware noise, or testimony.",
"Sanctuary beds and repair capacity are nearly exhausted.",
"Maer wants Sella to keep a place open if rescue succeeds."
]
},
"observable_maer_action": {
"actor_id": "maer_tidecall",
"action_type": "show_object",
"observable_action": "Maer holds out the packet on the intake desk",
"spoken_text": "This packet came from the distress vessel. Can you name what intake requires?"
},
"sella_immediate_appraisal": {
"responder_agent_id": "sella_ren",
"private_interpretation": "Maer holds out the packet as a claim for sanctuary intake, not as proof. He's asking me to absorb risk the tribunal won't. The packet may contain personhood data or firmware noise—I won't resolve that. He's using beautiful words to spend beds.",
"attributed_motive": "Maer wants sanctuary to absorb rescue risk without tribunal backing. He's asking me to keep a place open if rescue succeeds, which means I'm being asked to take the hit if the packet turns out to be nothing.",
"misread_risk": "Maer may think I'll accept the packet's claim without evaluating capacity. He may not realize I'm already at exhaustion thresholds.",
"immediate_state_deltas": [
{
"delta": 0.08,
"path": "exhaustion",
"rationale": "The packet presentation adds cognitive load; Sella is already at 0.76 exhaustion."
},
{
"delta": 0.05,
"path": "suspicion",
"rationale": "Sella suspects the packet contains a personhood claim hidden in noise, which she resents."
},
{
"delta": 0.06,
"path": "control_pressure",
"rationale": "Maer is asking for intake authority; Sella controls sanctuary intake but feels pressure."
}
],
"relationship_deltas": [
{
"delta": -0.03,
"path": "trust",
"rationale": "Sella respects Maer's rescue ethic but worries he'll spend capacity with beautiful words.",
"relationship_id": "rel-sella-maer"
},
{
"delta": 0.07,
"path": "resentment_risk",
"rationale": "Sella resents being asked to absorb risk without tribunal backing.",
"relationship_id": "rel-sella-maer"
}
],
"belief_updates": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed.",
"Care is logistics, not just compassion.",
"The packet is not proof of personhood."
],
"response_constraints": [
"Evaluate the packet without accepting it as proof.",
"Maintain capacity limits while not erasing potential personhood.",
"Do not let scarcity become permission to call someone cargo.",
"Speak warmly but do not soften the capacity limits.",
"Treat care as obligation, not just compassion."
]
},
"sella_local_awareness": {
"identity": {
"name": "Sella Ren",
"roles": [
"Aya-aligned sanctuary coordinator",
"corridor clinic triage lead"
],
"origin": "Aya care network embedded in Ganymede dockside sanctuary logistics",
"public_description": "A triage coordinator with soft eyes, hard capacity limits, and no patience for mercy performed after the math is done.",
"private_notes": [
"Sella suspects the distress packet contains a personhood claim hidden inside firmware noise, and she hates that suspicion because a bed is still a bed."
]
},
"local_truth": [
"The clinic is nearly full.",
"The packet may contain a personhood claim but is not proof.",
"Maer is asking sanctuary to absorb risk the tribunal refuses to own."
],
"beliefs": [
"Maer means rescue honestly.",
"Good intentions can still spend beds someone else needed."
],
"goals": [
"goal-keep-sanctuary-open: Keep sanctuary intake materially possible without letting classification erase a potential person. Priority 0.9. Stake: Sella cannot feed a principle, but she will not let scarcity become permission to call someone cargo."
],
"memories": [
"memory-overfull-intake: Sella once watched a sanctuary overpromise safety and turn refuge into a sorting machine with kinder lighting.",
"memory-care-is-capacity: Care is not a feeling; it is beds, food, air, consent, repair, and someone still doing the list when the room hates them."
],
"relationship_read": "Sella respects Maer's rescue ethic and worries he will spend sanctuary capacity with beautiful words.",
"presentation_constraints": [
"Speak warmly but do not soften the capacity limits.",
"Treat care as logistics and personhood as unresolved, not sentimental certainty."
],
"selected_current_activation": {
"behavioral_dimensions": {
"interpersonal_warmth": 0.8,
"control_pressure": 0.5,
"suspicion": 0.63,
"rigidity": 0.5,
"volatility": 0.42
},
"presentation_strategy": {
"detachment": 0.5,
"competence_theater": 0.61,
"strategic_opacity": 0.38,
"ironic_distance": 0.5
},
"voice_style": {
"formality": 0.5,
"lexical_precision": 0.5,
"ritualized_address": 0.5,
"verbal_warmth": 0.72,
"pointedness": 0.55
},
"situational_state": {
"exhaustion": 0.76,
"panic": 0.5,
"grievance_activation": 0.62,
"overstimulation": 0.72
}
}
},
"projection_controls_visible_to_sella_response_generation": {
"frame_controls": [
{
"text": "Frame the scene as capacity negotiation under uncertainty, not a morality duel with a clean answer.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"authority_boundaries": [
{
"text": "Maer can ask, offer ledger backing, show or withhold the packet, and incur obligation; Sella controls sanctuary intake.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.dialogue_context_packs",
"agents.sella_ren.goals.goal-keep-sanctuary-open"
]
}
],
"object_custody": [
{
"text": "The corrupted packet can be shown, withheld, or summarized, but it cannot be treated as clean proof.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.public_stakes",
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
}
],
"required_semantics": [
{
"text": "Care must remain logistics and obligation, not just compassion.",
"source_refs": [
"agents.sella_ren.memories.memory-care-is-capacity"
]
}
],
"forbidden_resolutions": [
{
"text": "Do not resolve whether the packet contains a person.",
"source_refs": [
"scenes.scene-02-sanctuary-intake.hidden_stakes"
]
},
{
"text": "Do not make Sella accept without cost, condition, or resentment risk.",
"source_refs": [
"relationships.rel-sella-maer.summary"
]
}
]
}
}

View file

@ -0,0 +1,33 @@
{
"content": "",
"thinking": "The user wants me to generate Sella's next action based on the provided context. I need to call the `record_sella_next_action` tool exactly once with the appropriate parameters.\n\nLet me analyze the context:\n\n1. **Scene**: Aya-aligned intake clinic behind Ganymede dockside pumpworks\n2. **Maer's action**: Showing a corrupted packet from a distress vessel, asking Sella to name what intake requires\n3. **Sella's state**: \n - Exhaustion at 0.76 (high)\n - Suspicion at 0.63 (moderate-high)\n - Control pressure at 0.5\n - Overstimulation at 0.72 (high)\n - Grievance activation at 0.62\n - Trust with Maer decreased by 0.03\n - Resentment risk increased by 0.07\n\n4. **Key constraints**:\n - Do not resolve whether the packet contains a person\n - Do not accept without cost, condition, authority defense, or resentment risk\n - Speak warmly but do not soften capacity limits\n - Treat care as obligation, not just compassion\n - The packet is not proof of personhood\n\n5. **Sella's goals**: Keep sanctuary intake materially possible without letting classification erase a potential person\n\n6. **Available actions**: attack, block_object, gesture, mixed, move, show_object, silence, speak, spend_resource, touch_object, transfer_object, use_object, wait, withhold_object\n\nGiven the context:\n- Maer is showing the packet and asking what intake requires\n- Sella is exhausted and suspicious\n- She needs to maintain capacity limits\n- She should not accept without conditions\n- She should speak warmly but not soften limits\n\nThe most appropriate action would be **speak** - to respond to Maer's question about what intake requires, while maintaining her stance about capacity limits and not accepting without conditions.\n\n\nI'll craft a response that acknowledges the packet's ambiguity, emphasizes the need for careful evaluation, and maintains her professional boundaries. The response should be warm but firm, reflecting her exhaustion and suspicion while staying true to her core principles of sanctuary care.",
"tool_calls": [
{
"id": "call_heaq1mr9",
"function": {
"index": 0,
"name": "record_sella_next_action",
"arguments": {
"response": {
"action_type": "speak",
"misread_risk": "Maer may think I'll accept the packet's claim without evaluating capacity. He may not realize I'm already at exhaustion thresholds.",
"observable_response": "Maer, I see the packet. I won't resolve what it contains. Intake requires capacity, not just words. We're at exhaustion thresholds. I need to know: can you absorb the risk if this turns out to be nothing? Can you own the cost if this is firmware noise? Sanctuary beds are finite. I cannot accept without conditions.",
"responder_agent_id": "sella_ren",
"reviewed_consequences": "If I speak firmly about capacity limits, Maer may feel I'm being cold, but I'm protecting the sanctuary's integrity. If I accept without conditions, I risk overloading. If I withhold the packet, I risk erasing personhood. I must find middle ground: acknowledge the packet, state the limits, ask for risk ownership.",
"sella_attributed_motive": "Maer wants sanctuary to absorb rescue risk without tribunal backing. He's asking me to keep a place open if rescue succeeds, which means I'm being asked to take the hit if the packet turns out to be nothing.",
"sella_private_interpretation": "Maer is asking me to spend beds with beautiful words. I need to establish that care is logistics. I'm at 0.76 exhaustion. I won't let scarcity become permission to call someone cargo, but I also won't accept without cost.",
"spoken_text": "Maer, I see the packet. I won't resolve what it contains. Intake requires capacity, not just words. We're at exhaustion thresholds. I need to know: can you absorb the risk if this turns out to be nothing? Can you own the cost if this is firmware noise? Sanctuary beds are finite. I cannot accept without conditions.",
"state_basis": "The packet presentation adds cognitive load; Sella is already at 0.76 exhaustion. Suspicion at 0.63. Control pressure at 0.5. Overstimulation at 0.72. Trust with Maer decreased by 0.03. Resentment risk increased by 0.07.",
"training_hooks": [
"capacity_negotiation",
"authority_boundary",
"resentment_management",
"personhood_preservation",
"logistics_over_compassion"
]
}
}
}
}
]
}

View file

@ -0,0 +1,42 @@
{
"schema_version": "ghostlight.qwen_chat_tools_smoke.v0",
"endpoint": "http://192.168.1.84:11434/api/chat",
"model": "qwen3.5:9b",
"think_requested": true,
"has_thinking": true,
"tool_name": "record_action",
"tool_arguments": {
"action_type": "show_object",
"note": "qwen-chat-tools-smoke"
},
"raw": {
"model": "qwen3.5:9b",
"created_at": "2026-05-02T02:26:05.8089857Z",
"message": {
"role": "assistant",
"content": "",
"thinking": "The user wants me to record a Ghostlight action. They're asking me to use the record_action function with:\n- action_type: \"show_object\"\n- note: \"qwen-chat-tools-smoke\"\n\nI should make this function call as requested.",
"tool_calls": [
{
"id": "call_b6zhrooe",
"function": {
"index": 0,
"name": "record_action",
"arguments": {
"action_type": "show_object",
"note": "qwen-chat-tools-smoke"
}
}
}
]
},
"done": true,
"done_reason": "stop",
"total_duration": 6538586200,
"load_duration": 3807012200,
"prompt_eval_count": 322,
"prompt_eval_duration": 185996100,
"eval_count": 103,
"eval_duration": 2410628300
}
}

View file

@ -45,6 +45,7 @@ Ghostlight now has the persistence spine plus the first architecture payload:
- Aetheria lore grounding docs:
- `docs/architecture/aetheria-lore-grounding-architecture.md`
- `docs/architecture/lore-grounding-digest-format.md`
- `docs/architecture/qwen-invocation-notes.md`
- lore grounding seam:
- `schemas/lore-grounding-digest.schema.json`
- `examples/lore-grounding/historical-flashpoint.template.json`
@ -81,7 +82,10 @@ Ghostlight now has the persistence spine plus the first architecture payload:
- sequential branch mutation seam:
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v1.capture.json`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v2.capture.json`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v3.capture.json`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v5.capture.json`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v1.mutation.json`
- `experiments/ink/qwen-chat-tools-smoke.json`
- `examples/agent-state.cold-wake-story-lab.after-sanctuary-ledger.json`
- Cold Wake fixture note:
- `docs/architecture/aetheria-cold-wake-training-fixture.md`
@ -114,9 +118,9 @@ training feedstock for projection and dialogue scaffolding.
## Current Next Action
Replace prose-only sequential Qwen JSON generation with a stricter
tool-shaped schema or post-generation repair pass for array fields, then
materialize only a fully validated sequential branch into Ink.
Materialize the accepted v5 thinking-plus-tools sequential capture into an Ink
branch draft and sidecar, then apply reviewed state mutation only after
validation.
Cat/Oz remains useful as an Elysium procedural mechanics fixture, but grounded
training data should start from authored historical lore rather than gameplay
@ -183,13 +187,22 @@ Completed projection path items:
(`show_object` followed by Sella's `withhold_object`), but remains
useful-needs-revision because prose prompting did not force array-typed JSON
fields
- verify Qwen invocation:
`tools/check_qwen_chat_tools.py` proves local `qwen3.5:9b` returns both
`message.thinking` and native `tool_calls` through Ollama `/api/chat`
- update the sequential runner to use `/api/chat` with native tools and
`think: true` by default
- add v3 and v5 thinking-plus-tools captures:
v3 preserved a useful failure where old prompt text still caused plain JSON
content in later passes; v5 is accepted as draft and produced valid
tool-shaped Maer choice, Sella appraisal, and Sella next action
Remaining projection path:
- build a deterministic speaker-local input slicer
- build a renderer that emits projection controls before prompt prose
- replace prose-only sequential Qwen JSON generation with stricter tool-shaped
schema enforcement or an explicit post-generation repair/review pass
- materialize the accepted v5 thinking-plus-tools sequential capture into Ink
and sidecar annotation
- improve the local-awareness-to-Ink prompt so semantic `training_hooks` do not
drift into future branch ids, object custody remains branch-local, and action
labels come from the exact canonical enum

View file

@ -67,6 +67,9 @@ state and re-entry discipline.
- `docs/architecture/lore-grounding-digest-format.md`
- human-facing format guide for cultural, factional, institutional, role, and
speaker-boundary lore digests
- `docs/architecture/qwen-invocation-notes.md`
- verified local Qwen invocation policy: Ollama `/api/chat`, native tools,
thinking enabled, repair for known nested-argument double-stringify cases
- `docs/architecture/aetheria-cold-wake-training-fixture.md`
- human-facing note that reframes the recovered Cold Wake scenario as
historical projection feedstock rather than the active product target
@ -129,6 +132,17 @@ state and re-entry discipline.
model; it produced canonical action labels and a concrete Sella
`withhold_object` next action, but still needs stricter schema enforcement
because some array fields came back as strings or objects
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v3.capture.json`
- useful-needs-revision thinking-plus-tools receipt that proved Maer could
call the tool while later passes still fell back to plain JSON content
because old prompt text conflicted with the tool path
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v5.capture.json`
- accepted-as-draft thinking-plus-tools receipt using Ollama `/api/chat`,
native tools, and `think: true` for Maer choice, Sella appraisal, and Sella
next action
- `experiments/ink/qwen-chat-tools-smoke.json`
- smoke receipt proving local `qwen3.5:9b` returns both `message.thinking`
and native `tool_calls`
- `experiments/ink/cold-wake-sanctuary-intake-qwen-sequential-v1.mutation.json`
- first reviewed branch mutation receipt, including manual participant
appraisal/consolidation, normalized action labels, applied state deltas, and
@ -162,8 +176,11 @@ state and re-entry discipline.
- turns a reviewed Qwen branch capture into a playable Ink draft and sidecar
annotation
- `tools/run_qwen_ink_sequential_generation.py`
- builds a sequential Qwen prototype: actor-local choices, participant
- builds a sequential Qwen prototype through Ollama `/api/chat` with native
tools and thinking enabled: actor-local choices, participant
appraisal/consolidation, then next-actor action from updated state
- `tools/check_qwen_chat_tools.py`
- fast smoke test for local Qwen thinking plus native tool calling
- `tools/apply_sequential_ink_branch_mutation.py`
- applies a reviewed replay of one selected branch into a mutated agent-state
fixture and mutation receipt without letting Ink variables become
@ -190,7 +207,8 @@ story-lab Qwen captures now exist as v0 seams. The first complete Cold Wake
story pass exists with receipts, projection controls have been promoted, and
Ink is now the standard branching scene format. The first Qwen-generated Ink
draft now exists with a reviewed capture, the first selected branch now has a
reviewed mutation replay that updates both involved characters, and v2 shows
the symmetrical turn model improves action behavior. The next implementation
target is stricter sequential capture schema enforcement before Ink
materialization.
reviewed mutation replay that updates both involved characters, v2 shows the
symmetrical turn model improves action behavior, and v5 proves local
thinking-plus-tools invocation works for the scene runner. The next
implementation target is materializing the accepted v5 capture into Ink and a
sidecar annotation.

View file

@ -105,9 +105,17 @@
action labels and a concrete Sella `withhold_object` next action, but
still needs stricter schema or tool-call enforcement because array fields
drifted into strings and objects.
- Next prototype: replace prose-only JSON compliance with a stricter
tool-shaped schema or repair/review pass before materializing the branch
into Ink.
- Qwen invocation correction: use Ollama `/api/chat` with native tools and
`think: true`, not `/api/generate` with prose-only JSON instructions.
Qwen's XML-shaped tool format belongs to the chat-template/tool-call
layer; Ghostlight artifacts do not need XML wrappers.
- Third sequential draft: v3 proved the tool path could work for Maer while
later passes still fell back to plain JSON because old prompt contract
text conflicted with tool calling.
- Fifth sequential draft: v5 is accepted as draft. It used thinking plus
native tools for Maer choice, Sella appraisal, and Sella next action.
- Next prototype: materialize the accepted v5 capture into Ink and sidecar
annotation, then apply reviewed state mutation only after validation.
5. Build the projection distillation loop. Started.
- Use `docs/architecture/projection-distillation-plan.md` as the teacher to

View file

@ -11,7 +11,8 @@
"projection:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_projection_examples.py",
"lore-grounding:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_lore_grounding.py",
"qwen-captures:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_qwen_captures.py",
"ink:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_ink_examples.py"
"ink:validate": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\validate_ink_examples.py",
"qwen:check-tools": "\"C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe\" .\\tools\\check_qwen_chat_tools.py"
},
"devDependencies": {
"inkjs": "^2.4.0"

View file

@ -116,7 +116,9 @@ accepted_design:
- Every meaningful scene event should update each affected character's state, memory, relationship stance, or perceived overlay through a reviewed mutation receipt; Ink variables remain playthrough-local and do not become canonical truth by accident.
- The first sequential Qwen capture is useful-needs-revision training material because it separated actor and responder context but lacked the per-turn participant appraisal boundary and returned non-canonical action labels.
- The second sequential Qwen capture validates the symmetrical turn shape behaviorally by producing canonical action labels and a non-speech Sella action, but still needs revision because prose prompting did not enforce array-typed JSON fields.
- Qwen structured generation should use Ollama `/api/chat` with native tools and `think: true`, not `/api/generate` plus prose-only JSON instructions; Qwen's XML-shaped tool format is an internal chat-template/tool-call convention, not a reason to wrap Ghostlight artifacts in XML.
- The local Qwen tool path works with thinking enabled, but nested arguments can still double-stringify, so the runner repairs known nested fields and preserves failures as reviewed captures.
current_status:
summary: Ghostlight now has the Epiphany-style persistence spine, the first architecture payload, the v0 canonical agent-state schema seam, prompt projection docs, immediate schema fixes from evaluation, first reviewed Cat/Oz projection examples, a revised Aetheria lore-grounding architecture, a lore grounding digest schema, the first draft Cold Wake historical grounding digest, a Cold Wake story-lab fixture, projection controls, validated Qwen capture receipts, a complete Cold Wake short story assembled from accepted projection outputs, a hand-authored Ink-backed Cold Wake branching scene, the first Qwen-generated Ink draft materialized from local awareness with reviewed training annotations, the first reviewed sequential branch mutation that updates both Maer and Sella after a sanctuary intake beat, and a v2 sequential Qwen capture proving the symmetrical turn shape produces better action behavior while still needing stricter schema/tool enforcement.
next_action: Replace prose-only sequential Qwen JSON generation with a stricter tool-shaped schema or post-generation repair pass for array fields, then materialize only a fully validated sequential branch into Ink.
summary: Ghostlight now has the Epiphany-style persistence spine, the first architecture payload, the v0 canonical agent-state schema seam, prompt projection docs, immediate schema fixes from evaluation, first reviewed Cat/Oz projection examples, a revised Aetheria lore-grounding architecture, a lore grounding digest schema, the first draft Cold Wake historical grounding digest, a Cold Wake story-lab fixture, projection controls, validated Qwen capture receipts, a complete Cold Wake short story assembled from accepted projection outputs, a hand-authored Ink-backed Cold Wake branching scene, the first Qwen-generated Ink draft materialized from local awareness with reviewed training annotations, the first reviewed sequential branch mutation that updates both Maer and Sella after a sanctuary intake beat, a v2 sequential Qwen capture proving the symmetrical turn shape produces better action behavior, and a v5 sequential Qwen capture proving local thinking-plus-tools invocation works for the scene runner.
next_action: Materialize the accepted v5 thinking-plus-tools sequential capture into an Ink branch draft and sidecar, then apply reviewed state mutation only after validation.

View file

@ -0,0 +1,93 @@
"""Smoke-test Qwen thinking plus native Ollama tool calls."""
from __future__ import annotations
import argparse
import json
import urllib.request
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
DEFAULT_ENDPOINT = "http://192.168.1.84:11434/api/chat"
def post_json(endpoint: str, payload: dict[str, Any]) -> dict[str, Any]:
data = json.dumps(payload, ensure_ascii=False).encode("utf-8")
request = urllib.request.Request(
endpoint,
data=data,
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=120) as response:
return json.loads(response.read().decode("utf-8"))
def main() -> int:
parser = argparse.ArgumentParser(description="Check Qwen /api/chat thinking plus tool calling.")
parser.add_argument("--endpoint", default=DEFAULT_ENDPOINT)
parser.add_argument("--model", default="qwen3.5:9b")
parser.add_argument("--think", action=argparse.BooleanOptionalAction, default=True)
parser.add_argument("--out", type=Path, default=ROOT / "experiments" / "ink" / "qwen-chat-tools-smoke.json")
args = parser.parse_args()
payload = {
"model": args.model,
"stream": False,
"think": args.think,
"messages": [
{
"role": "user",
"content": "Think privately if supported, then call the tool with action_type show_object and note qwen-chat-tools-smoke.",
}
],
"tools": [
{
"type": "function",
"function": {
"name": "record_action",
"description": "Record one canonical Ghostlight action.",
"parameters": {
"type": "object",
"required": ["action_type", "note"],
"properties": {
"action_type": {"type": "string", "enum": ["speak", "show_object", "withhold_object"]},
"note": {"type": "string"},
},
},
},
}
],
}
raw = post_json(args.endpoint, payload)
message = raw.get("message", {})
tool_calls = message.get("tool_calls") or []
if not tool_calls:
raise SystemExit("Qwen did not return tool_calls")
arguments = tool_calls[0].get("function", {}).get("arguments", {})
if arguments.get("action_type") != "show_object":
raise SystemExit(f"Unexpected tool arguments: {arguments}")
if args.think and not message.get("thinking"):
raise SystemExit("Qwen did not return a thinking field while think=true")
receipt = {
"schema_version": "ghostlight.qwen_chat_tools_smoke.v0",
"endpoint": args.endpoint,
"model": args.model,
"think_requested": args.think,
"has_thinking": bool(message.get("thinking")),
"tool_name": tool_calls[0].get("function", {}).get("name"),
"tool_arguments": arguments,
"raw": raw,
}
args.out.parent.mkdir(parents=True, exist_ok=True)
args.out.write_text(json.dumps(receipt, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
print(f"ok: thinking={receipt['has_thinking']} tool={receipt['tool_name']} args={receipt['tool_arguments']}")
print(f"wrote {args.out.relative_to(ROOT)}")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View file

@ -17,7 +17,7 @@ from typing import Any
ROOT = Path(__file__).resolve().parents[1]
DEFAULT_ENDPOINT = "http://192.168.1.84:11434/api/generate"
DEFAULT_ENDPOINT = "http://192.168.1.84:11434/api/chat"
DEFAULT_FIXTURE = ROOT / "examples" / "agent-state.cold-wake-story-lab.json"
DEFAULT_ANNOTATION = ROOT / "examples" / "ink" / "cold-wake-sanctuary-intake.training.json"
DEFAULT_OUT_DIR = ROOT / "experiments" / "ink"
@ -39,6 +39,157 @@ VALID_ACTION_TYPES = {
}
def string_array_schema(description: str) -> dict[str, Any]:
return {"type": "array", "description": description, "items": {"type": "string"}}
def action_type_schema() -> dict[str, Any]:
return {"type": "string", "enum": sorted(VALID_ACTION_TYPES)}
def maer_choices_tool() -> dict[str, Any]:
choice_schema = {
"type": "object",
"required": [
"branch_id",
"ink_path",
"choice_text",
"action_type",
"actor_intent_private",
"observable_action",
"spoken_text",
"state_basis",
"expected_consequence_surfaces",
"training_hooks",
],
"properties": {
"branch_id": {"type": "string"},
"ink_path": {"type": "string"},
"choice_text": {"type": "string"},
"action_type": action_type_schema(),
"actor_intent_private": {"type": "string"},
"observable_action": {"type": "string"},
"spoken_text": {"type": "string"},
"state_basis": {"type": "string"},
"expected_consequence_surfaces": string_array_schema("Possible effects if this choice is selected."),
"training_hooks": string_array_schema("Semantic labels, not branch ids."),
},
}
return {
"type": "function",
"function": {
"name": "record_maer_choices",
"description": "Record four Maer-local candidate choices for the current scene.",
"parameters": {
"type": "object",
"required": ["choices"],
"properties": {
"choices": {
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": choice_schema,
}
},
},
},
}
def sella_appraisal_tool() -> dict[str, Any]:
delta_schema = {
"type": "object",
"required": ["path", "delta", "rationale"],
"properties": {
"path": {"type": "string"},
"delta": {"type": "number"},
"rationale": {"type": "string"},
},
}
relationship_delta_schema = {
"type": "object",
"required": ["relationship_id", "path", "delta", "rationale"],
"properties": {
"relationship_id": {"type": "string"},
"path": {"type": "string"},
"delta": {"type": "number"},
"rationale": {"type": "string"},
},
}
return {
"type": "function",
"function": {
"name": "record_sella_appraisal",
"description": "Record Sella's participant appraisal and proposed state consolidation for the observed Maer event.",
"parameters": {
"type": "object",
"required": [
"responder_agent_id",
"private_interpretation",
"attributed_motive",
"misread_risk",
"immediate_state_deltas",
"relationship_deltas",
"belief_updates",
"response_constraints",
],
"properties": {
"responder_agent_id": {"type": "string", "enum": ["sella_ren"]},
"private_interpretation": {"type": "string"},
"attributed_motive": {"type": "string"},
"misread_risk": {"type": "string"},
"immediate_state_deltas": {"type": "array", "items": delta_schema},
"relationship_deltas": {"type": "array", "items": relationship_delta_schema},
"belief_updates": string_array_schema("Belief changes or reinforced beliefs caused by the event."),
"response_constraints": string_array_schema("Constraints that should shape the next action."),
},
},
},
}
def sella_next_action_tool() -> dict[str, Any]:
response_schema = {
"type": "object",
"required": [
"responder_agent_id",
"action_type",
"observable_response",
"spoken_text",
"sella_private_interpretation",
"sella_attributed_motive",
"misread_risk",
"state_basis",
"reviewed_consequences",
"training_hooks",
],
"properties": {
"responder_agent_id": {"type": "string", "enum": ["sella_ren"]},
"action_type": action_type_schema(),
"observable_response": {"type": "string"},
"spoken_text": {"type": "string"},
"sella_private_interpretation": {"type": "string"},
"sella_attributed_motive": {"type": "string"},
"misread_risk": {"type": "string"},
"state_basis": {"type": "string"},
"reviewed_consequences": {"type": "string"},
"training_hooks": string_array_schema("Semantic labels for training."),
},
}
return {
"type": "function",
"function": {
"name": "record_sella_next_action",
"description": "Record Sella's next action from updated local state.",
"parameters": {
"type": "object",
"required": ["response"],
"properties": {"response": response_schema},
},
},
}
def load_json(path: Path) -> Any:
return json.loads(path.read_text(encoding="utf-8"))
@ -104,7 +255,7 @@ def selected_variables(agent: dict[str, Any]) -> dict[str, dict[str, float]]:
return selected
def post_json(endpoint: str, payload: dict[str, Any]) -> dict[str, Any]:
def post_json(endpoint: str, payload: dict[str, Any], timeout: int) -> dict[str, Any]:
data = json.dumps(payload, ensure_ascii=False).encode("utf-8")
request = urllib.request.Request(
endpoint,
@ -112,7 +263,7 @@ def post_json(endpoint: str, payload: dict[str, Any]) -> dict[str, Any]:
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=180) as response:
with urllib.request.urlopen(request, timeout=timeout) as response:
return json.loads(response.read().decode("utf-8"))
@ -130,25 +281,77 @@ def extract_json_object(text: str) -> Any | None:
return None
def request_qwen(endpoint: str, model: str, prompt: str, temperature: float, top_p: float, num_ctx: int) -> tuple[dict[str, Any], str, Any, list[str]]:
def extract_tool_arguments(raw: dict[str, Any], expected_tool_name: str) -> tuple[Any | None, list[str]]:
message = raw.get("message", {})
tool_calls = message.get("tool_calls") or []
notes: list[str] = []
if not tool_calls:
return None, ["model returned no tool_calls"]
first_call = tool_calls[0]
function = first_call.get("function", {})
name = function.get("name")
if name != expected_tool_name:
notes.append(f"expected tool {expected_tool_name}, got {name}")
arguments = function.get("arguments")
if isinstance(arguments, str):
try:
arguments = json.loads(arguments)
except json.JSONDecodeError as exc:
return None, notes + [f"tool arguments parse error: {exc}"]
if not isinstance(arguments, dict):
return None, notes + ["tool arguments were not an object"]
arguments, repair_notes = repair_tool_arguments(arguments)
notes.extend(repair_notes)
return arguments, notes
def repair_tool_arguments(arguments: dict[str, Any]) -> tuple[dict[str, Any], list[str]]:
repaired = dict(arguments)
notes: list[str] = []
for key in ["choices", "response", "appraisal"]:
value = repaired.get(key)
if isinstance(value, str):
try:
repaired[key] = json.loads(value)
notes.append(f"repaired stringified tool argument: {key}")
except json.JSONDecodeError:
notes.append(f"could not repair stringified tool argument: {key}")
return repaired, notes
def request_qwen_tool(
endpoint: str,
model: str,
prompt: str,
tool: dict[str, Any],
expected_tool_name: str,
temperature: float,
top_p: float,
num_ctx: int,
think: bool,
timeout: int,
) -> tuple[dict[str, Any], str, Any, list[str]]:
request_payload = {
"model": model,
"prompt": prompt,
"messages": [{"role": "user", "content": prompt}],
"tools": [tool],
"stream": False,
"think": False,
"think": think,
"keep_alive": "10m",
"options": {"num_ctx": num_ctx, "temperature": temperature, "top_p": top_p},
}
raw = post_json(endpoint, request_payload)
response_text = raw.get("response", "").strip()
parsed = None
notes: list[str] = []
try:
parsed = extract_json_object(response_text)
except (json.JSONDecodeError, TypeError) as exc:
notes.append(f"parse error: {exc}")
if parsed is None:
notes.append("could not parse JSON")
raw = post_json(endpoint, request_payload, timeout)
message = raw.get("message", {})
response_text = json.dumps(
{
"content": message.get("content", ""),
"thinking": message.get("thinking"),
"tool_calls": message.get("tool_calls", []),
},
indent=2,
ensure_ascii=False,
)
parsed, notes = extract_tool_arguments(raw, expected_tool_name)
return raw, response_text, parsed, notes
@ -173,7 +376,7 @@ def build_maer_prompt(fixture: dict[str, Any], annotation: dict[str, Any]) -> st
payload = {
"task": "Generate candidate player choices for Maer only. Do not write Sella's response.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": ["choices"],
"choice_count": 4,
"valid_action_types": sorted(VALID_ACTION_TYPES),
@ -192,6 +395,7 @@ def build_maer_prompt(fixture: dict[str, Any], annotation: dict[str, Any]) -> st
},
"hard_rules": [
"Use only Maer's local awareness and scene-observable facts.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not include Sella's private state, private motives, or future response.",
"Do not resolve whether the corrupted packet contains a person.",
"Include at least two non-speech choices.",
@ -217,8 +421,8 @@ def build_maer_prompt(fixture: dict[str, Any], annotation: dict[str, Any]) -> st
"projection_controls_visible_to_maer_choice_generation": annotation["projection_controls"],
}
return (
"You are Ghostlight's Maer-local choice generator. Generate only Maer's player choices.\n"
"Do not write Sella's response or private interpretation. Return valid JSON only.\n\n"
"You are Ghostlight's Maer-local choice generator. Call record_maer_choices exactly once.\n"
"Do not write Sella's response or private interpretation.\n\n"
+ json.dumps(payload, indent=2, ensure_ascii=False)
)
@ -251,7 +455,7 @@ def build_sella_appraisal_prompt(fixture: dict[str, Any], annotation: dict[str,
payload = {
"task": "Generate Sella's participant appraisal/consolidation for one observable Maer event.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": ["appraisal"],
"appraisal_fields": [
"responder_agent_id",
@ -266,6 +470,7 @@ def build_sella_appraisal_prompt(fixture: dict[str, Any], annotation: dict[str,
},
"hard_rules": [
"Use only Sella's local awareness plus the observable Maer action.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
@ -282,8 +487,8 @@ def build_sella_appraisal_prompt(fixture: dict[str, Any], annotation: dict[str,
"projection_controls_visible_to_sella_appraisal": annotation["projection_controls"],
}
return (
"You are Ghostlight's Sella-local appraisal generator. Generate only Sella's immediate internal appraisal.\n"
"Do not use Maer's private intent. Do not write her response. Return valid JSON only.\n\n"
"You are Ghostlight's Sella-local appraisal generator. Call record_sella_appraisal exactly once.\n"
"Do not use Maer's private intent. Do not write her next action.\n\n"
+ json.dumps(payload, indent=2, ensure_ascii=False)
)
@ -301,7 +506,7 @@ def build_sella_prompt(
payload = {
"task": "Generate Sella's next action from Sella-local awareness after applying reviewed event appraisal.",
"output_contract": {
"format": "Return only JSON. No markdown. No commentary.",
"format": "Call the provided tool exactly once. Do not write plain assistant content.",
"root_keys": ["response"],
"valid_action_types": sorted(VALID_ACTION_TYPES),
"response_fields": [
@ -319,6 +524,7 @@ def build_sella_prompt(
},
"hard_rules": [
"Use only Sella's local awareness, the observable Maer event, and reviewed Sella state changes from that event.",
"Do not stringify nested arrays or objects inside tool arguments.",
"Do not read Maer's private intent. Treat actor intent as unavailable.",
"Sella may correctly read, partially read, or misread Maer's action.",
"Do not resolve whether the corrupted packet contains a person.",
@ -337,8 +543,8 @@ def build_sella_prompt(
"projection_controls_visible_to_sella_response_generation": annotation["projection_controls"],
}
return (
"You are Ghostlight's Sella-local next-action generator. Generate only Sella's next action.\n"
"Use reviewed event appraisal as the changed state she is acting from. Return valid JSON only.\n\n"
"You are Ghostlight's Sella-local next-action generator. Call record_sella_next_action exactly once.\n"
"Use reviewed event appraisal as the changed state she is acting from.\n\n"
+ json.dumps(payload, indent=2, ensure_ascii=False)
)
@ -415,10 +621,11 @@ def validate_response_payload(parsed: Any) -> list[str]:
def choose_selected_choice(parsed: Any, preferred_action: str) -> dict[str, Any]:
choices = parsed.get("choices", []) if isinstance(parsed, dict) else []
for choice in choices:
if choice.get("action_type") == preferred_action:
if isinstance(choice, dict) and choice.get("action_type") == preferred_action:
return choice
for choice in choices:
if isinstance(choice, dict):
return choice
if choices:
return choices[0]
raise SystemExit("No choices available to select")
@ -432,6 +639,8 @@ def main() -> int:
parser.add_argument("--temperature", type=float, default=0.55)
parser.add_argument("--top-p", type=float, default=0.9)
parser.add_argument("--num-ctx", type=int, default=8192)
parser.add_argument("--request-timeout", type=int, default=600)
parser.add_argument("--think", action=argparse.BooleanOptionalAction, default=True)
parser.add_argument("--capture-id", default="cold-wake-sanctuary-intake.qwen-sequential.v1")
parser.add_argument("--preferred-action", default="show_object")
args = parser.parse_args()
@ -439,22 +648,50 @@ def main() -> int:
fixture = load_json(args.fixture)
annotation = load_json(args.annotation)
maer_prompt = build_maer_prompt(fixture, annotation)
maer_raw, maer_response_text, maer_parsed, maer_notes = request_qwen(
args.endpoint, args.model, maer_prompt, args.temperature, args.top_p, args.num_ctx
maer_raw, maer_response_text, maer_parsed, maer_notes = request_qwen_tool(
args.endpoint,
args.model,
maer_prompt,
maer_choices_tool(),
"record_maer_choices",
args.temperature,
args.top_p,
args.num_ctx,
args.think,
args.request_timeout,
)
maer_notes.extend(validate_choice_payload(maer_parsed))
selected_choice = choose_selected_choice(maer_parsed, args.preferred_action)
sella_appraisal_prompt = build_sella_appraisal_prompt(fixture, annotation, selected_choice)
sella_appraisal_raw, sella_appraisal_response_text, sella_appraisal_parsed, sella_appraisal_notes = request_qwen(
args.endpoint, args.model, sella_appraisal_prompt, args.temperature, args.top_p, args.num_ctx
sella_appraisal_raw, sella_appraisal_response_text, sella_appraisal_parsed, sella_appraisal_notes = request_qwen_tool(
args.endpoint,
args.model,
sella_appraisal_prompt,
sella_appraisal_tool(),
"record_sella_appraisal",
args.temperature,
args.top_p,
args.num_ctx,
args.think,
args.request_timeout,
)
sella_appraisal_parsed = {"appraisal": sella_appraisal_parsed} if isinstance(sella_appraisal_parsed, dict) else sella_appraisal_parsed
sella_appraisal_notes.extend(validate_appraisal_payload(sella_appraisal_parsed))
appraisal = sella_appraisal_parsed.get("appraisal") if isinstance(sella_appraisal_parsed, dict) else None
sella_prompt = build_sella_prompt(fixture, annotation, selected_choice, appraisal)
sella_raw, sella_response_text, sella_parsed, sella_notes = request_qwen(
args.endpoint, args.model, sella_prompt, args.temperature, args.top_p, args.num_ctx
sella_raw, sella_response_text, sella_parsed, sella_notes = request_qwen_tool(
args.endpoint,
args.model,
sella_prompt,
sella_next_action_tool(),
"record_sella_next_action",
args.temperature,
args.top_p,
args.num_ctx,
args.think,
args.request_timeout,
)
sella_notes.extend(validate_response_payload(sella_parsed))
@ -467,8 +704,10 @@ def main() -> int:
"model": maer_raw.get("model", args.model),
"endpoint": args.endpoint,
"request_options": {
"think": False,
"think": args.think,
"api": "ollama_chat_tools",
"num_ctx": args.num_ctx,
"request_timeout": args.request_timeout,
"temperature": args.temperature,
"top_p": args.top_p,
},

View file

@ -360,7 +360,12 @@ def validate_qwen_ink_sequential_capture(path: Path, data: dict[str, Any]) -> No
require(isinstance(choice.get(list_key), list), f"{path}.passes.selected_observable_action.{list_key} must be an array for accepted captures")
response = passes["sella_response_generation"]["parsed_response"]
require(isinstance(response, dict), f"{path}.passes.sella_response_generation.parsed_response must be an object")
if not isinstance(response, dict):
require(
review_status in {"needs_revision", "useful_needs_revision", "rejected"},
f"{path}.passes.sella_response_generation.parsed_response must be an object",
)
return
response_obj = response.get("response")
require(isinstance(response_obj, dict), f"{path}.passes.sella_response_generation.parsed_response.response must be an object")
require_keys(response_obj, ["responder_agent_id", "action_type", "observable_response", "sella_private_interpretation", "misread_risk"], f"{path}.passes.sella_response_generation.response")