@spellkave/world-author 0.0.0-bootstrap

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +89 -0
  2. package/README.md +62 -0
  3. package/package.json +57 -0
  4. package/src/applyset-diff-types.ts +158 -0
  5. package/src/applyset.ts +82 -0
  6. package/src/authoring-harness.ts +487 -0
  7. package/src/browser.ts +114 -0
  8. package/src/compose.ts +699 -0
  9. package/src/corpus.generated.ts +279 -0
  10. package/src/corpus.ts +1180 -0
  11. package/src/damage.ts +75 -0
  12. package/src/diagnostics.ts +59 -0
  13. package/src/diff-manifest-core.ts +393 -0
  14. package/src/diff-manifest.ts +5 -0
  15. package/src/docs-index.ts +105 -0
  16. package/src/dsl.ts +10 -0
  17. package/src/evaluate.ts +100 -0
  18. package/src/explain-core.ts +219 -0
  19. package/src/explain.ts +43 -0
  20. package/src/filter-manifest-core.ts +122 -0
  21. package/src/filter-manifest.ts +41 -0
  22. package/src/grants-core.ts +38 -0
  23. package/src/grants.ts +10 -0
  24. package/src/included-manifest-metadata-core.ts +63 -0
  25. package/src/included-manifest-metadata.ts +21 -0
  26. package/src/index.ts +30 -0
  27. package/src/inspect.ts +35 -0
  28. package/src/inspection.ts +239 -0
  29. package/src/lint.ts +540 -0
  30. package/src/manifest-text.ts +21 -0
  31. package/src/manifest.ts +403 -0
  32. package/src/metadata.ts +137 -0
  33. package/src/npc-dm-authority-projection.ts +95 -0
  34. package/src/npc-dm-documents.ts +339 -0
  35. package/src/npc-dm-presentation.ts +17 -0
  36. package/src/npc-dm-srd.ts +51 -0
  37. package/src/npc-dm-types.ts +723 -0
  38. package/src/npc-kinds.ts +404 -0
  39. package/src/npc-quests.ts +319 -0
  40. package/src/observation-tokens.browser.ts +31 -0
  41. package/src/observation-tokens.ts +27 -0
  42. package/src/owner-instance-read.ts +765 -0
  43. package/src/patch.ts +47 -0
  44. package/src/ref-tags.ts +149 -0
  45. package/src/reference.ts +48 -0
  46. package/src/row-identity.ts +105 -0
  47. package/src/row-kinds-data.ts +35 -0
  48. package/src/row-kinds.ts +93 -0
  49. package/src/scenario-guidance.ts +180 -0
  50. package/src/scoped-instance-read.ts +187 -0
  51. package/src/service-only-audience.ts +14 -0
  52. package/src/session-predicates.ts +6 -0
  53. package/src/spell.ts +119 -0
  54. package/src/tag-prefix-families.ts +143 -0
  55. package/src/tooling.browser.ts +397 -0
  56. package/src/tooling.ts +38 -0
  57. package/src/validate.ts +255 -0
@@ -0,0 +1,279 @@
1
+ // GENERATED by scripts/generate-authoring-corpus.ts — DO NOT EDIT BY HAND.
2
+ // embedded-manifest: {"category":"generated_toml_corpus","rationale":"generated executable documentation corpus sourced from docs/examples files","signatures":["schema_directive","schema_shape"]}
3
+ // Source of truth: packages/spellkave-world-author/docs/** (ADR-0047 D-2, #1968).
4
+ // Regenerate: npx tsx scripts/generate-authoring-corpus.ts
5
+ // CI guard: the `authoring-corpus-drift` skgate registry gate (runs this with --check).
6
+ // `expectedDiagnostics` is a snapshot of the wasm validator over each .toml; it
7
+ // is regenerated, never hand-edited, when a validator code/message changes.
8
+ // ci-allow(embedded-manifest-schema): generated corpus, drift-gated byte-exact against the source TOML it was built from
9
+ import type { AuthoringDoc, AuthoringExample } from "./corpus";
10
+
11
+ // Content identity, independent of a checkout or an assumed server version.
12
+ export const GENERATED_CORPUS_REVISION = "sha256:9703587c304182fca73bd65b096e2447e02679d7a7155a48c4211526b3111928";
13
+
14
+ export const GENERATED_EXAMPLES: AuthoringExample[] = [
15
+ {
16
+ id: "aoe-damage-spell",
17
+ intent: "Add an area-of-effect blast that damages every co-located actor (ForEachActorInRadius + ModifyResource).",
18
+ tags: ["aoe","spell","damage","for-each-actor","modify-resource","frame-write"],
19
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/aoe-damage-spell.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author aoe-damage-spell\n#\n# Worked example: an AREA-OF-EFFECT DAMAGE spell.\n# ForEachActorInRadius (select every co-located actor) + ModifyResource\n# (per-target read-modify-write), landing in one consequence_frame_writes row.\n# Full narrative + open #266 axes:\n# packages/spellkave-world-author/docs/examples/aoe-damage-spell.md\n\n[[action_definition_tag]]\naction_id = \"aoe_blast/cast_firebloom\"\nbundle_id = \"aoe_blast\"\nsource = \"manifest\"\ntag = \"aoe_blast.spell\"\n\n[[action_definitions]]\naction_id = \"aoe_blast/cast_firebloom\"\nbundle_id = \"aoe_blast\"\ncost_time_ms = 1000\ndisplay_name = \"Cast Firebloom\"\non_failure = \"\"\non_success = \"aoe_blast/cast_firebloom/success\"\nrequired_capability = \"aoe_blast/spell/firebloom\"\nresolution_mode = \"Deterministic\"\nresolution_predicate_source = \"\"\nresumable = false\nself_eligible = false\nself_only = false\nsession_def_id = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"aoe_blast/mage\"\nbundle_id = \"aoe_blast\"\ncapability_id = \"aoe_blast/spell/firebloom\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"aoe_blast\"\nsource_args_hash = \"\"\n\n[[actor_spatial_locations]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/mage\"\nplace_node_id = \"aoe_blast/arena/center\"\nselection_path = \"manifest:aoe_blast/mage\"\n\n[[actor_spatial_locations]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/goblin_a\"\nplace_node_id = \"aoe_blast/arena/center\"\nselection_path = \"manifest:aoe_blast/goblin_a\"\n\n[[actor_spatial_locations]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/goblin_b\"\nplace_node_id = \"aoe_blast/arena/center\"\nselection_path = \"manifest:aoe_blast/goblin_b\"\n\n[[actor_spatial_locations]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/bystander\"\nplace_node_id = \"aoe_blast/arena/fringe\"\nselection_path = \"manifest:aoe_blast/bystander\"\n\n[[actors]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/mage\"\nname = \"Mage\"\n\n[[actors]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/goblin_a\"\nname = \"Goblin A\"\n\n[[actors]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/goblin_b\"\nname = \"Goblin B\"\n\n[[actors]]\nbundle_id = \"aoe_blast\"\nentity_key = \"aoe_blast/bystander\"\nname = \"Bystander\"\n\n[[affordance_templates]]\naccepts_global_storm = false\nbundle_id = \"aoe_blast\"\ncapability_id = \"aoe_blast/spell/firebloom\"\ndisplay_name = \"Cast Firebloom\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"capability:aoe_blast/spell/firebloom\"\noutcome_template_id = \"aoe_blast/cast_firebloom/outcome\"\npredicate_bool = true\npredicate_source = \"\"\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"aoe_blast/cast_firebloom/affordance\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"aoe_blast\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"A caster + a one-action blast that subtracts HP from every co-located actor via ForEachActorInRadius + ModifyResource.\"\ndisplay_name = \"AoE Damage Spell\"\nversion = \"1.0.0\"\n\n[[bundles.tag_prefixes]]\nprefix = \"aoe_blast\"\n\n[[capability_definitions]]\nactor_kind = \"entity\"\nbundle_id = \"aoe_blast\"\ncapability_id = \"aoe_blast/spell/firebloom\"\ndefault_visibility = \"Public\"\ndescription = \"A small blast that damages every co-located creature.\"\ndisplay_name = \"Cast Firebloom\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"aoe_blast/cast_firebloom/success\"\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius]\ncenter_ref = \"ActorSpatialRef\"\npredicate_source = \"d20 < 13\"\nshape_id = \"core/area/node_ball\"\nshape_params_json = '{\"ball_radius\": 0}'\n\n[[consequence_frame_writes.frame_write.ForEachActorInRadius.body]]\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius.body.ModifyResource]\nactor = \"Actor\"\ndelta_source = \"-d6\"\nresource = \"aoe_blast/hp\"\n\n[[consequence_templates]]\nbundle_id = \"aoe_blast\"\ntemplate_id = \"aoe_blast/cast_firebloom/success\"\n\n[[entities]]\nbundle_id = \"aoe_blast\"\nentity_def_id = \"\"\nentity_key = \"aoe_blast/mage\"\nkind = \"npc\"\nname = \"Mage\"\nowned_by_entity_key = \"\"\nplace_node_id = \"aoe_blast/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"aoe_blast\"\nentity_def_id = \"\"\nentity_key = \"aoe_blast/goblin_a\"\nkind = \"npc\"\nname = \"Goblin A\"\nowned_by_entity_key = \"\"\nplace_node_id = \"aoe_blast/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"aoe_blast\"\nentity_def_id = \"\"\nentity_key = \"aoe_blast/goblin_b\"\nkind = \"npc\"\nname = \"Goblin B\"\nowned_by_entity_key = \"\"\nplace_node_id = \"aoe_blast/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"aoe_blast\"\nentity_def_id = \"\"\nentity_key = \"aoe_blast/bystander\"\nkind = \"npc\"\nname = \"Bystander\"\nowned_by_entity_key = \"\"\nplace_node_id = \"aoe_blast/arena/fringe\"\nquantity = 1\n\n[metadata]\nbundle = \"aoe_blast\"\nprofile = \"aoe-damage-spell\"\n\n[[niche_definitions]]\nbundle_id = \"aoe_blast\"\ndescription = \"WA-CAP-002 (sk-0m4.69): capability:* niches require an explicit provider.\"\ndisplay_name = \"Cast Firebloom (actor-carried)\"\nniche_id = \"capability:aoe_blast/spell/firebloom\"\npredicate_source = \"\"\nprovider = \"actor\"\n\n[[outcome_templates]]\nbundle_id = \"aoe_blast\"\nconsequence_template_id = \"\"\ndisplay_name = \"Cast Firebloom\"\nmanipulation_action_id = \"aoe_blast/cast_firebloom\"\noutcome_bool = true\noutcome_template_id = \"aoe_blast/cast_firebloom/outcome\"\nsense_visibility = \"local\"\n\n[[place_graphs]]\nanchor_node_id = \"aoe_blast/arena/center\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"aoe_blast\"\ndescription = \"\"\ndisplay_name = \"Blast Arena\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"aoe_blast/arena\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"aoe_blast\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Arena Center\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"center\"\nnode_id = \"aoe_blast/arena/center\"\nplace_graph_id = \"aoe_blast/arena\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"aoe_blast\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Arena Fringe\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"fringe\"\nnode_id = \"aoe_blast/arena/fringe\"\nplace_graph_id = \"aoe_blast/arena\"\npos_present = true\npos_x = 20\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"outdoor\"\n\n[[resource_definitions]]\nbundle_id = \"aoe_blast\"\ndisplay_name = \"Hit Points\"\ninitial_value = 30\nmax_value = 30\nmin_value = 0\nrecovery_rule = \"long_rest\"\nresource_definition_id = \"aoe_blast/hp\"\nvalue_kind = \"int\"\n",
20
+ expectedDiagnostics: [],
21
+ },
22
+ {
23
+ id: "authored-dark-cave",
24
+ intent: "Seed ambient spatial state from TOML and make authored traversal and manipulation predicates read it.",
25
+ tags: ["spatial","environment-state","movement","manipulation","predicate","cave"],
26
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/authored-dark-cave.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author authored-dark-cave\n#\n# Worked example: author ambient darkness and make traversal/manipulation\n# read it. Two shapes: PRESENCE-ONLY (dark_passage, forever) and DECAYING\n# (decaying_passage, fades after 5 ticks via `<state>@updated_tick` vs\n# world.tick — ADR-0056 D-4). The kernel does NOT know 'darkness expires';\n# the decay is entirely authored DSL.\n\n[[actor_capabilities]]\nactor_entity_key = \"authored_dark_cave/scout\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/walk\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"authored_dark_cave\"\nsource_args_hash = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"authored_dark_cave/scout\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/inspect\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"authored_dark_cave\"\nsource_args_hash = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"authored_dark_cave/delver\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/walk\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"authored_dark_cave\"\nsource_args_hash = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"authored_dark_cave/delver\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/inspect\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"authored_dark_cave\"\nsource_args_hash = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"authored_dark_cave/delver\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"authored_dark_cave/counter/darkvision\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"authored_dark_cave\"\nsource_args_hash = \"\"\n\n[[actor_spatial_locations]]\nbundle_id = \"authored_dark_cave\"\nentity_key = \"authored_dark_cave/scout\"\nplace_node_id = \"authored_dark_cave/entrance\"\nselection_path = \"manifest:authored_dark_cave/scout\"\n\n[[actor_spatial_locations]]\nbundle_id = \"authored_dark_cave\"\nentity_key = \"authored_dark_cave/delver\"\nplace_node_id = \"authored_dark_cave/entrance\"\nselection_path = \"manifest:authored_dark_cave/delver\"\n\n[[actors]]\nbundle_id = \"authored_dark_cave\"\nentity_key = \"authored_dark_cave/scout\"\nname = \"Cave Scout\"\n\n[[actors]]\nbundle_id = \"authored_dark_cave\"\nentity_key = \"authored_dark_cave/delver\"\nname = \"Dark-Sighted Delver\"\n\n[[affordance_templates]]\naccepts_global_storm = false\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/walk\"\ndisplay_name = \"Traverse Dark Passage\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"core/passable_portal\"\noutcome_template_id = \"core/move_outcome\"\npredicate_bool = false\npredicate_source = 'actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && target.state(\"authored_dark_cave/ambient_darkness\") == false || actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && actor.has_capability(\"authored_dark_cave/counter/darkvision\")'\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"authored_dark_cave/affordance/traverse_dark_passage\"\n\n[[affordance_templates]]\naccepts_global_storm = false\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/inspect\"\ndisplay_name = \"Inspect Dark Passage\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"authored_dark_cave/dark_passage_focus\"\noutcome_template_id = \"core/inspect/outcome\"\npredicate_bool = false\npredicate_source = 'actor.has_capability(\"core/inspect\") && target.has_niche(\"authored_dark_cave/dark_passage_focus\") && target.state(\"authored_dark_cave/ambient_darkness\") == false || actor.has_capability(\"core/inspect\") && target.has_niche(\"authored_dark_cave/dark_passage_focus\") && actor.has_capability(\"authored_dark_cave/counter/darkvision\")'\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"authored_dark_cave/affordance/inspect_dark_passage\"\n\n[[affordance_templates]]\naccepts_global_storm = true\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"core/walk\"\ndisplay_name = \"Traverse Decaying-Dark Passage\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"core/passable_portal\"\noutcome_template_id = \"core/move_outcome\"\npredicate_bool = false\npredicate_source = 'actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && target.state(\"authored_dark_cave/decaying_darkness\") == false || actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && world.tick - target.stat(\"authored_dark_cave/decaying_darkness@updated_tick\") > 5 || actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && actor.has_capability(\"authored_dark_cave/counter/darkvision\")'\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"authored_dark_cave/affordance/traverse_decaying_passage\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"authored_dark_cave\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"A cave edge with hidden authored ambient darkness state.\"\ndisplay_name = \"Authored Dark Cave\"\ntag_prefixes = []\nversion = \"1.0.0\"\n\n[[capability_definitions]]\nactor_kind = \"entity\"\nbundle_id = \"authored_dark_cave\"\ncapability_id = \"authored_dark_cave/counter/darkvision\"\ndefault_visibility = \"Public\"\ndescription = \"Counter-capability that lets an actor traverse this authored dark passage.\"\ndisplay_name = \"Darkvision\"\n\n[[entities]]\nbundle_id = \"authored_dark_cave\"\nentity_def_id = \"\"\nentity_key = \"authored_dark_cave/scout\"\nkind = \"npc\"\nname = \"Cave Scout\"\nowned_by_entity_key = \"\"\nplace_node_id = \"authored_dark_cave/entrance\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"authored_dark_cave\"\nentity_def_id = \"\"\nentity_key = \"authored_dark_cave/delver\"\nkind = \"npc\"\nname = \"Dark-Sighted Delver\"\nowned_by_entity_key = \"\"\nplace_node_id = \"authored_dark_cave/entrance\"\nquantity = 1\n\n[metadata]\nbundle = \"authored_dark_cave\"\nprofile = \"authored_dark_cave\"\n\n[[niche_definitions]]\nbundle_id = \"authored_dark_cave\"\ndescription = \"A place-node affordance focus for inspecting the authored darkness.\"\ndisplay_name = \"Dark Passage Focus\"\nniche_id = \"authored_dark_cave/dark_passage_focus\"\npredicate_source = 'target.has_niche(\"authored_dark_cave/dark_passage_focus\")'\n\n[[place_edge_affordance]]\naffordance_template_id = \"authored_dark_cave/affordance/traverse_dark_passage\"\nbindings_json = \"\"\nedge_key = \"authored_dark_cave/edge/entrance-dark-passage\"\nmode_id = \"\"\n\n[[place_edge_affordance]]\naffordance_template_id = \"authored_dark_cave/affordance/traverse_decaying_passage\"\nbindings_json = \"\"\nedge_key = \"authored_dark_cave/edge/entrance-decaying-passage\"\nmode_id = \"\"\n\n[[place_edges]]\nbundle_id = \"authored_dark_cave\"\ncell_anchor = 0\ncell_anchor_present = false\ncell_anchor_u = 0.0\ncell_anchor_v = 0.0\nedge_key = \"authored_dark_cave/edge/entrance-dark-passage\"\nfrom_anchor_offset = 0.0\nfrom_anchor_side = \"\"\nfrom_node_id = \"authored_dark_cave/entrance\"\ninherit_movement_default = true\nplace_graph_id = \"authored_dark_cave\"\npose_dt_elevation = 0.0\npose_dt_elevation_present = false\nsubstrate_crossing = false\nto_anchor_offset = 0.0\nto_anchor_side = \"\"\nto_node_id = \"authored_dark_cave/dark_passage\"\n\n[[place_edges]]\nbundle_id = \"authored_dark_cave\"\ncell_anchor = 0\ncell_anchor_present = false\ncell_anchor_u = 0.0\ncell_anchor_v = 0.0\nedge_key = \"authored_dark_cave/edge/entrance-decaying-passage\"\nfrom_anchor_offset = 0.0\nfrom_anchor_side = \"\"\nfrom_node_id = \"authored_dark_cave/entrance\"\ninherit_movement_default = true\nplace_graph_id = \"authored_dark_cave\"\npose_dt_elevation = 0.0\npose_dt_elevation_present = false\nsubstrate_crossing = false\nto_anchor_offset = 0.0\nto_anchor_side = \"\"\nto_node_id = \"authored_dark_cave/decaying_passage\"\n\n[[place_graphs]]\nanchor_node_id = \"authored_dark_cave/entrance\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"authored_dark_cave\"\ndescription = \"\"\ndisplay_name = \"Authored Dark Cave\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"authored_dark_cave\"\nsubstrate_id = \"indoor\"\n\n[[place_nodes]]\nbundle_id = \"authored_dark_cave\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Cave Entrance\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"entrance\"\nnode_id = \"authored_dark_cave/entrance\"\nplace_graph_id = \"authored_dark_cave\"\npos_present = false\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"indoor\"\n\n[[place_nodes]]\nbundle_id = \"authored_dark_cave\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Dark Passage\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"dark_passage\"\nnode_id = \"authored_dark_cave/dark_passage\"\nplace_graph_id = \"authored_dark_cave\"\npos_present = false\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"indoor\"\n\n[[place_nodes]]\nbundle_id = \"authored_dark_cave\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Decaying-Dark Passage\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"decaying_passage\"\nnode_id = \"authored_dark_cave/decaying_passage\"\nplace_graph_id = \"authored_dark_cave\"\npos_present = false\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"indoor\"\n\n[[spatial_environment_state]]\nbundle_id = \"authored_dark_cave\"\nlocation_def_id = \"\"\nplace_edge_key = \"authored_dark_cave/edge/entrance-dark-passage\"\nplace_node_id = \"\"\nstate_id = \"authored_dark_cave/ambient_darkness\"\nupdated_tick = 0\nvalue_bool = true\nvisibility = \"hidden\"\n\n[[spatial_environment_state]]\nbundle_id = \"authored_dark_cave\"\nlocation_def_id = \"\"\nplace_edge_key = \"\"\nplace_node_id = \"authored_dark_cave/dark_passage\"\nstate_id = \"authored_dark_cave/ambient_darkness\"\nupdated_tick = 0\nvalue_bool = true\nvisibility = \"hidden\"\n\n[[spatial_environment_state]]\nbundle_id = \"authored_dark_cave\"\nlocation_def_id = \"\"\nplace_edge_key = \"authored_dark_cave/edge/entrance-decaying-passage\"\nplace_node_id = \"\"\nstate_id = \"authored_dark_cave/decaying_darkness\"\nupdated_tick = 0\nvalue_bool = true\nvisibility = \"hidden\"\n\n[[spatial_niche_attachments]]\nbundle_id = \"authored_dark_cave\"\ncondition_bool = true\necological_invariant = false\nniche_id = \"authored_dark_cave/dark_passage_focus\"\non_entry_action_id = \"\"\non_entry_target_entity_key = \"\"\nplace_node_id = \"authored_dark_cave/dark_passage\"\nvisibility = \"Public\"\n\n[[spatial_state_definitions]]\nbundle_id = \"authored_dark_cave\"\ndescription = \"Darkness authored on a cave passage.\"\nfreshness_rule = \"\"\nlod_policy = \"retain_latest\"\nmerge_rule = \"replace\"\nstate_id = \"authored_dark_cave/ambient_darkness\"\nvalue_type = \"bool\"\nwriter_policy = \"manifest\"\n\n[[spatial_state_definitions]]\nbundle_id = \"authored_dark_cave\"\ndescription = \"Magical darkness that decays 5 ticks after it was last refreshed.\"\nfreshness_rule = \"expires_after_ticks:5\"\nlod_policy = \"retain_latest\"\nmerge_rule = \"replace\"\nstate_id = \"authored_dark_cave/decaying_darkness\"\nvalue_type = \"bool\"\nwriter_policy = \"manifest\"\n",
27
+ expectedDiagnostics: ["MF-VAL-365","MF-VAL-365","MF-VAL-365","MF-VAL-365"],
28
+ },
29
+ {
30
+ id: "communicate-with-actor",
31
+ intent: "Add a co-located NPC that can be addressed with core communication.",
32
+ tags: ["communication","actor","entity-definition","affordance","npc"],
33
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/communicate-with-actor.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author communicate-with-actor\n#\n# Worked example: address a CO-LOCATED ACTOR with a speech act.\n# Full narrative (the 2 things an author must get right):\n# packages/spellkave-world-author/docs/examples/communicate-with-actor.md\n\n[[actor_capabilities]]\nactor_entity_key = \"communicate_with_actor/herald\"\nbundle_id = \"communicate_with_actor\"\ncapability_id = \"core/communicate\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"communicate_with_actor\"\nsource_args_hash = \"\"\n\n[[actor_spatial_locations]]\nbundle_id = \"communicate_with_actor\"\nentity_key = \"communicate_with_actor/herald\"\nplace_node_id = \"communicate_with_actor/green\"\nselection_path = \"manifest:communicate_with_actor/herald\"\n\n[[actors]]\nbundle_id = \"communicate_with_actor\"\nentity_key = \"communicate_with_actor/herald\"\nname = \"Village Herald\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"communicate_with_actor\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"Minimal co-located NPC the player can address with a core/assert speech act.\"\ndisplay_name = \"Communicate With Actor\"\ntag_prefixes = []\nversion = \"1.0.0\"\n\n[[entities]]\nbundle_id = \"communicate_with_actor\"\nentity_def_id = \"communicate_with_actor/herald\"\nentity_key = \"communicate_with_actor/herald\"\nkind = \"npc\"\nname = \"Village Herald\"\nowned_by_entity_key = \"\"\nplace_node_id = \"communicate_with_actor/green\"\nquantity = 1\n\n[[entity_definition_tag]]\nbundle_id = \"communicate_with_actor\"\nentity_def_id = \"communicate_with_actor/herald\"\nsource = \"manifest\"\ntag = \"actor\"\n\n[[entity_definition_tag]]\nbundle_id = \"communicate_with_actor\"\nentity_def_id = \"communicate_with_actor/herald\"\nsource = \"manifest\"\ntag = \"npc\"\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"communicate_with_actor\"\ndisplay_name = \"Village Herald\"\nentity_def_id = \"communicate_with_actor/herald\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[metadata]\nbundle = \"communicate_with_actor\"\nprofile = \"communicate_with_actor\"\n\n[[place_graphs]]\nanchor_node_id = \"communicate_with_actor/green\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"communicate_with_actor\"\ndescription = \"The green this example's herald stands on.\"\ndisplay_name = \"Village Green\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"communicate_with_actor\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"communicate_with_actor\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Village Green\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"green\"\nnode_id = \"communicate_with_actor/green\"\nplace_graph_id = \"communicate_with_actor\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = true\nsubstrate_id = \"outdoor\"\n",
34
+ expectedDiagnostics: ["MF-VAL-297","MF-VAL-297","MF-VAL-298","MF-VAL-298","MF-VAL-365"],
35
+ },
36
+ {
37
+ id: "damage-type-routing",
38
+ intent: "Route a fire spell's HP loss through target immune/resistant/vulnerable defense tags using a DSL delta_source.",
39
+ tags: ["damage","spell","routing","has-tag","modify-resource","delta-source"],
40
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/damage-type-routing.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author damage-type-routing\n#\n# Worked example: route fire damage through authored defense tags.\n# immune -> 0, resistant -> half (rounded down), vulnerable -> double,\n# untagged -> normal. The tags live on entity_definition_tag/entity_tag —\n# the carrier target.has_tag(...) reads at apply time.\n\n[[action_definition_tag]]\naction_id = \"damage_routing/cast_fire_bolt\"\nbundle_id = \"damage_routing\"\nsource = \"manifest\"\ntag = \"spell\"\n\n[[action_definition_tag]]\naction_id = \"damage_routing/cast_fire_bolt\"\nbundle_id = \"damage_routing\"\nsource = \"manifest\"\ntag = \"damage:fire\"\n\n[[action_definitions]]\naction_id = \"damage_routing/cast_fire_bolt\"\nbundle_id = \"damage_routing\"\ncost_time_ms = 1000\ndisplay_name = \"Cast Fire Bolt\"\non_failure = \"\"\non_success = \"damage_routing/cast_fire_bolt/success\"\nrequired_capability = \"damage_routing/spell/fire_bolt\"\nresolution_mode = \"Deterministic\"\nresolution_predicate_source = \"\"\nresumable = false\nself_eligible = false\nself_only = false\nsession_def_id = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"damage_routing/caster\"\nbundle_id = \"damage_routing\"\ncapability_id = \"damage_routing/spell/fire_bolt\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"damage_routing/spell/fire_bolt\"\nsource_args_hash = \"\"\n\n[[actor_spatial_locations]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/caster\"\nplace_node_id = \"damage_routing/arena/center\"\nselection_path = \"manifest:damage_routing/caster\"\n\n[[actor_spatial_locations]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/immune\"\nplace_node_id = \"damage_routing/arena/center\"\nselection_path = \"manifest:damage_routing/target/immune\"\n\n[[actor_spatial_locations]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/resist\"\nplace_node_id = \"damage_routing/arena/center\"\nselection_path = \"manifest:damage_routing/target/resist\"\n\n[[actor_spatial_locations]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/vulnerable\"\nplace_node_id = \"damage_routing/arena/center\"\nselection_path = \"manifest:damage_routing/target/vulnerable\"\n\n[[actor_spatial_locations]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/normal\"\nplace_node_id = \"damage_routing/arena/center\"\nselection_path = \"manifest:damage_routing/target/normal\"\n\n[[actors]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/caster\"\nname = \"Fire Mage\"\n\n[[actors]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/immune\"\nname = \"Fire Immune Target\"\n\n[[actors]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/resist\"\nname = \"Fire Resistant Target\"\n\n[[actors]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/vulnerable\"\nname = \"Fire Vulnerable Target\"\n\n[[actors]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/normal\"\nname = \"Normal Fire Target\"\n\n[[affordance_templates]]\naccepts_global_storm = false\nbundle_id = \"damage_routing\"\ncapability_id = \"damage_routing/spell/fire_bolt\"\ndisplay_name = \"Cast Fire Bolt\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"capability:damage_routing/spell/fire_bolt\"\noutcome_template_id = \"damage_routing/cast_fire_bolt/outcome\"\npredicate_bool = true\npredicate_source = \"\"\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"damage_routing/cast_fire_bolt/affordance\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"damage_routing\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"A fire spell whose damage amount routes through target damage_immune/resist/vulnerable tags.\"\ndisplay_name = \"Damage Type Routing\"\ntag_prefixes = []\nversion = \"1.0.0\"\n\n[[capability_definition_tag]]\nbundle_id = \"damage_routing\"\ncapability_id = \"damage_routing/spell/fire_bolt\"\nsource = \"manifest\"\ntag = \"spell\"\n\n[[capability_definition_tag]]\nbundle_id = \"damage_routing\"\ncapability_id = \"damage_routing/spell/fire_bolt\"\nsource = \"manifest\"\ntag = \"damage:fire\"\n\n[[capability_definitions]]\nactor_kind = \"entity\"\nbundle_id = \"damage_routing\"\ncapability_id = \"damage_routing/spell/fire_bolt\"\ndefault_visibility = \"Public\"\ndescription = \"A fire spell that routes damage through target defense tags.\"\ndisplay_name = \"Cast Fire Bolt\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"damage_routing/cast_fire_bolt/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\"\nresource = \"damage_routing/hp\"\n\n[[consequence_templates]]\nbundle_id = \"damage_routing\"\ntemplate_id = \"damage_routing/cast_fire_bolt/success\"\n\n[[entities]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"\"\nentity_key = \"damage_routing/caster\"\nkind = \"npc\"\nname = \"Fire Mage\"\nowned_by_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/immune\"\nentity_key = \"damage_routing/target/immune\"\nkind = \"npc\"\nname = \"Fire Immune Target\"\nowned_by_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/resist\"\nentity_key = \"damage_routing/target/resist\"\nkind = \"npc\"\nname = \"Fire Resistant Target\"\nowned_by_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/vulnerable\"\nentity_key = \"damage_routing/target/vulnerable\"\nkind = \"npc\"\nname = \"Fire Vulnerable Target\"\nowned_by_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/normal\"\nentity_key = \"damage_routing/target/normal\"\nkind = \"npc\"\nname = \"Normal Fire Target\"\nowned_by_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nquantity = 1\n\n[[entity_definition_tag]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/immune\"\nsource = \"manifest\"\ntag = \"damage_immune:fire\"\n\n[[entity_definition_tag]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/resist\"\nsource = \"manifest\"\ntag = \"damage_resist:fire\"\n\n[[entity_definition_tag]]\nbundle_id = \"damage_routing\"\nentity_def_id = \"damage_routing/target/vulnerable\"\nsource = \"manifest\"\ntag = \"damage_vulnerable:fire\"\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"damage_routing\"\ndisplay_name = \"Fire Immune Target\"\nentity_def_id = \"damage_routing/target/immune\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"damage_routing\"\ndisplay_name = \"Fire Resistant Target\"\nentity_def_id = \"damage_routing/target/resist\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"damage_routing\"\ndisplay_name = \"Fire Vulnerable Target\"\nentity_def_id = \"damage_routing/target/vulnerable\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"damage_routing\"\ndisplay_name = \"Normal Fire Target\"\nentity_def_id = \"damage_routing/target/normal\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[metadata]\nbundle = \"damage_routing\"\nprofile = \"damage-type-routing\"\n\n[[niche_definitions]]\nbundle_id = \"damage_routing\"\ndescription = \"WA-CAP-002 (sk-0m4.69): capability:* niches require an explicit provider.\"\ndisplay_name = \"Cast Fire Bolt (actor-carried)\"\nniche_id = \"capability:damage_routing/spell/fire_bolt\"\npredicate_source = \"\"\nprovider = \"actor\"\n\n[[object_state]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/immune\"\nexpires_at_tick = 0\nsource_template_id = \"damage_routing/target/immune\"\nstate_id = \"damage_routing/hp\"\nvalue_bool = true\nvalue_int = 100\n\n[[object_state]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/resist\"\nexpires_at_tick = 0\nsource_template_id = \"damage_routing/target/resist\"\nstate_id = \"damage_routing/hp\"\nvalue_bool = true\nvalue_int = 100\n\n[[object_state]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/vulnerable\"\nexpires_at_tick = 0\nsource_template_id = \"damage_routing/target/vulnerable\"\nstate_id = \"damage_routing/hp\"\nvalue_bool = true\nvalue_int = 100\n\n[[object_state]]\nbundle_id = \"damage_routing\"\nentity_key = \"damage_routing/target/normal\"\nexpires_at_tick = 0\nsource_template_id = \"damage_routing/target/normal\"\nstate_id = \"damage_routing/hp\"\nvalue_bool = true\nvalue_int = 100\n\n[[outcome_templates]]\nbundle_id = \"damage_routing\"\nconsequence_template_id = \"\"\ndisplay_name = \"Cast Fire Bolt\"\nmanipulation_action_id = \"damage_routing/cast_fire_bolt\"\noutcome_bool = true\noutcome_template_id = \"damage_routing/cast_fire_bolt/outcome\"\nsense_visibility = \"local\"\n\n[[place_graphs]]\nanchor_node_id = \"damage_routing/arena/center\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"damage_routing\"\ndescription = \"\"\ndisplay_name = \"Damage Routing Arena\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"damage_routing/arena\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"damage_routing\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Arena Center\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"center\"\nnode_id = \"damage_routing/arena/center\"\nplace_graph_id = \"damage_routing/arena\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"outdoor\"\n\n[[resource_definitions]]\nbundle_id = \"damage_routing\"\ndisplay_name = \"Hit Points\"\ninitial_value = 100\nmax_value = 100\nmin_value = 0\nrecovery_rule = \"long_rest\"\nresource_definition_id = \"damage_routing/hp\"\nvalue_kind = \"int\"\n\n[[spatial_niche_attachments]]\nbundle_id = \"damage_routing\"\ncondition_bool = true\necological_invariant = false\nniche_id = \"capability:damage_routing/spell/fire_bolt\"\non_entry_action_id = \"\"\non_entry_target_entity_key = \"\"\nplace_node_id = \"damage_routing/arena/center\"\nvisibility = \"Public\"\n",
41
+ expectedDiagnostics: ["MF-VAL-296","MF-VAL-296","MF-VAL-296","MF-VAL-296","MF-VAL-296","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-298","MF-VAL-298","MF-VAL-298","MF-VAL-298","MF-VAL-298","MF-VAL-298","MF-VAL-298"],
42
+ },
43
+ {
44
+ id: "definition-seed-statblock",
45
+ intent: "Give a creature definition its own HP and innate Multiattack so every spawned instance inherits them; also covers the definition-level containment/equipment seeds that spawn a fresh carried/equipped child instance.",
46
+ tags: ["entity-definition","object_state","capability","statblock","seed","containment","equipment"],
47
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/definition-seed-statblock.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author definition-seed-statblock\n#\n# Worked example: a creature definition that carries its own HP (state-value)\n# and innate Multiattack (capability), inherited by every placed instance.\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"Spellkave docs\"\nbundle_id = \"example_statblock\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"A creature definition that carries its own HP (state-value) and innate Multiattack (capability), inherited by every placed instance.\"\ndisplay_name = \"Example Statblock\"\ntag_prefixes = []\nversion = \"0.1.0\"\n\n[[capability_definitions]]\nactor_kind = \"npc\"\nbundle_id = \"example_statblock\"\ncapability_id = \"example_statblock/multiattack\"\ndefault_visibility = \"Public\"\ndescription = \"Makes two attacks on its turn.\"\ndisplay_name = \"Multiattack\"\n\n[[entities]]\nbundle_id = \"example_statblock\"\nentity_def_id = \"example_statblock/ghoul\"\nentity_key = \"example_statblock/ghoul-1\"\nkind = \"npc\"\nname = \"Ghoul\"\nowned_by_entity_key = \"\"\nplace_node_id = \"example_statblock/lair/cell_a\"\nquantity = 1\n\n[[entity_definition_initial_capability]]\nbundle_id = \"example_statblock\"\ncapability_id = \"example_statblock/multiattack\"\nentity_def_id = \"example_statblock/ghoul\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\n\n[[entity_definition_initial_state]]\nbundle_id = \"example_statblock\"\nentity_def_id = \"example_statblock/ghoul\"\nstate_id = \"example_statblock/hp\"\nvalue_bool = true\nvalue_int = 22\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"example_statblock\"\ndisplay_name = \"Ghoul\"\nentity_def_id = \"example_statblock/ghoul\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[metadata]\nbundle = \"example_statblock\"\nprofile = \"example_statblock\"\n\n[[object_state_definitions]]\nbundle_id = \"example_statblock\"\ndefault_visibility = \"Public\"\ndisplay_name = \"Hit Points\"\nstate_id = \"example_statblock/hp\"\ntarget_kind = \"entity\"\n\n[[place_graphs]]\nanchor_node_id = \"\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"example_statblock\"\ndescription = \"One cell to place the creature in.\"\ndisplay_name = \"Lair\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"example_statblock/lair\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"example_statblock\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Lair Floor\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"cell_a\"\nnode_id = \"example_statblock/lair/cell_a\"\nplace_graph_id = \"example_statblock/lair\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = true\nsubstrate_id = \"outdoor\"\n",
48
+ expectedDiagnostics: [],
49
+ },
50
+ {
51
+ id: "dm-oversight",
52
+ intent: "Author a game-master body that sees the Hidden rows of every body inside a bounded, authored region — without any DM type in the substrate.",
53
+ tags: ["dm","visibility","hidden","extent","place-graph","capability","oversight"],
54
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/dm-oversight.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author dm-oversight\n#\n# Worked example: define a DM who sees the Hidden state of every body inside\n# an authored region (ADR-0007 D-4 'see-as extent').\n# Full narrative: packages/spellkave-world-author/docs/examples/dm-oversight.md\n\n[[actor_capabilities]]\nactor_entity_key = \"dm_oversight/dm\"\nbundle_id = \"dm_oversight\"\ncapability_id = \"dm_oversight/oversee\"\nelevation_class = \"internal\"\nextent_kind_ref = \"place_graph\"\nextent_ref = \"dm_oversight/region\"\nsource = \"dm_oversight\"\nsource_args_hash = \"\"\n\n[[actor_capabilities]]\nactor_entity_key = \"dm_oversight/guardian\"\nbundle_id = \"dm_oversight\"\ncapability_id = \"dm_oversight/secret_trait\"\nelevation_class = \"\"\nextent_kind_ref = \"\"\nextent_ref = \"\"\nsource = \"dm_oversight\"\nsource_args_hash = \"\"\nvisibility = \"hidden\"\n\n[[actor_identities]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/dm\"\nidentity = \"00000000000000000000000000000000000000000000000000000000000000d1\"\nrole = \"dm\"\n\n[[actor_identities]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/player\"\nidentity = \"00000000000000000000000000000000000000000000000000000000000000a1\"\nrole = \"primary\"\n\n[[actor_spatial_locations]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/dm\"\nplace_node_id = \"dm_oversight/region/vault\"\nselection_path = \"manifest:dm_oversight/dm\"\n\n[[actor_spatial_locations]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/player\"\nplace_node_id = \"dm_oversight/outside/field\"\nselection_path = \"manifest:dm_oversight/player\"\n\n[[actors]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/dm\"\nname = \"Dungeon Master Actor\"\n\n[[actors]]\nbundle_id = \"dm_oversight\"\nentity_key = \"dm_oversight/player\"\nname = \"Wandering Player Actor\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"dm_oversight\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"Define a DM that sees Hidden rows within an authored region (ADR-0007 D-4).\"\ndisplay_name = \"DM Oversight\"\ntag_prefixes = []\nversion = \"1.0.0\"\n\n[[capability_definitions]]\nactor_kind = \"dm\"\nbundle_id = \"dm_oversight\"\ncapability_id = \"dm_oversight/oversee\"\ndefault_visibility = \"public\"\ndescription = \"Sees Hidden rows of every body inside the referenced region.\"\ndisplay_name = \"Region oversight\"\n\n[[capability_definitions]]\nactor_kind = \"npc\"\nbundle_id = \"dm_oversight\"\ncapability_id = \"dm_oversight/secret_trait\"\ndefault_visibility = \"hidden\"\ndescription = \"A capability a player must not see — only an overseeing DM does.\"\ndisplay_name = \"Concealed trait\"\n\n[[entities]]\nbundle_id = \"dm_oversight\"\nentity_def_id = \"\"\nentity_key = \"dm_oversight/dm\"\nkind = \"player\"\nname = \"Dungeon Master\"\nowned_by_entity_key = \"\"\nplace_node_id = \"dm_oversight/region/vault\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"dm_oversight\"\nentity_def_id = \"\"\nentity_key = \"dm_oversight/guardian\"\nkind = \"npc\"\nname = \"Vault Guardian\"\nowned_by_entity_key = \"\"\nplace_node_id = \"dm_oversight/region/vault\"\nquantity = 1\n\n[[entities]]\nbundle_id = \"dm_oversight\"\nentity_def_id = \"\"\nentity_key = \"dm_oversight/player\"\nkind = \"player\"\nname = \"Wandering Player\"\nowned_by_entity_key = \"\"\nplace_node_id = \"dm_oversight/outside/field\"\nquantity = 1\n\n[metadata]\nbundle = \"dm_oversight\"\nprofile = \"dm_oversight\"\n\n[[place_graphs]]\nanchor_node_id = \"dm_oversight/region/vault\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"dm_oversight\"\ndescription = \"\"\ndisplay_name = \"Overseen Region\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 622054109320019967\norigin_cell_res4 = 595032517308841983\norigin_cell_res7 = 608543310453145599\nparent_graph_id = \"\"\nplace_graph_id = \"dm_oversight/region\"\nsubstrate_id = \"indoor\"\n\n[[place_graphs]]\nanchor_node_id = \"dm_oversight/outside/field\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"dm_oversight\"\ndescription = \"\"\ndisplay_name = \"Outside the Region\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 622054109320019967\norigin_cell_res4 = 595032517308841983\norigin_cell_res7 = 608543310453145599\nparent_graph_id = \"\"\nplace_graph_id = \"dm_oversight/outside\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"dm_oversight\"\ncell_res10 = 622054109320019967\ncell_res4 = 595032517308841983\ncell_res7 = 608543310453145599\ndescription = \"\"\ndisplay_name = \"Sealed Vault\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"vault\"\nnode_id = \"dm_oversight/region/vault\"\nplace_graph_id = \"dm_oversight/region\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"indoor\"\n\n[[place_nodes]]\nbundle_id = \"dm_oversight\"\ncell_res10 = 622054109320019967\ncell_res4 = 595032517308841983\ncell_res7 = 608543310453145599\ndescription = \"\"\ndisplay_name = \"Open Field\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"field\"\nnode_id = \"dm_oversight/outside/field\"\nplace_graph_id = \"dm_oversight/outside\"\npos_present = true\npos_x = 1\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = false\nsubstrate_id = \"outdoor\"\n",
55
+ expectedDiagnostics: [],
56
+ },
57
+ {
58
+ id: "spatial-minimal-cell",
59
+ intent: "Add the smallest valid spatial cell with one graph and one node.",
60
+ tags: ["spatial","place_graph","place_node"],
61
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/spatial-minimal-cell.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author spatial-minimal-cell\n#\n# Worked example: the smallest possible manifest — one place graph, one\n# disconnected place node.\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"Spellkave docs\"\nbundle_id = \"example_spatial_cell\"\ndefault_extent_params_json = '{\"extent_m\":1.0,\"extent_x_m\":4.0,\"extent_y_m\":2.0,\"extent_z_m\":0.5}'\ndefault_extent_shape_id = \"core/area/cube\"\ndepends_on = [\"core\"]\ndescription = \"A minimal manifest containing one place graph and one place node.\"\ndisplay_name = \"Example Spatial Cell\"\ntag_prefixes = []\nversion = \"0.1.0\"\n\n[metadata]\nbundle = \"example_spatial_cell\"\nprofile = \"example_spatial_cell\"\n\n[[place_graphs]]\nanchor_node_id = \"\"\nbearing = 0.0\nblueprint_id = \"\"\nbundle_id = \"example_spatial_cell\"\ndescription = \"One disconnected outdoor cell.\"\ndisplay_name = \"Example Cell Graph\"\nis_ephemeral_instance = false\nmetres_per_unit = 1.0\norigin_cell_res10 = 0\norigin_cell_res4 = 0\norigin_cell_res7 = 0\nparent_graph_id = \"\"\nplace_graph_id = \"example_spatial_cell\"\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"example_spatial_cell\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Open Ground\"\nextent_params_json = \"\"\nextent_shape_id = \"\"\nis_ephemeral = false\nlocal_id = \"cell_a\"\nnode_id = \"example_spatial_cell/cell_a\"\nplace_graph_id = \"example_spatial_cell\"\npos_present = true\npos_x = 0\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = true\nsubstrate_id = \"outdoor\"\n\n[[place_nodes]]\nbundle_id = \"example_spatial_cell\"\ncell_res10 = 0\ncell_res4 = 0\ncell_res7 = 0\ndescription = \"\"\ndisplay_name = \"Oval Pond\"\nextent_params_json = '{\"radius_m\":1.0,\"radius_x_m\":6.0,\"radius_y_m\":3.0,\"radius_z_m\":0.75}'\nextent_shape_id = \"core/area/sphere\"\nis_ephemeral = false\nlocal_id = \"oval_pond\"\nnode_id = \"example_spatial_cell/oval_pond\"\nplace_graph_id = \"example_spatial_cell\"\npos_present = true\npos_x = 10\npos_y = 0\npose_elevation = 0.0\npose_elevation_present = true\nsubstrate_id = \"outdoor\"\n",
62
+ expectedDiagnostics: [],
63
+ },
64
+ {
65
+ id: "spell-identity-minimal",
66
+ intent: "Author the clean, lint-clean end-state of a spell: one identity (capability_id == entity_def_id == required_capability), one cast action with no twin, taxonomy tags on the identity only.",
67
+ tags: ["spell","identity","emit-spell","best-practice","lint","capability","render-discipline"],
68
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/spell-identity-minimal.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author spell-identity-minimal\n#\n# Worked example: the MINIMAL, single-identity spell (#835/#836 best practice).\n# Full narrative (the three discipline points, the lint rules that gate them):\n# packages/spellkave-world-author/docs/examples/spell-identity-minimal.md\n\n[[action_definitions]]\naction_id = \"spell_identity/cast_spark\"\nbundle_id = \"spell_identity\"\ncost_time_ms = 1000\ndisplay_name = \"Cast Spark\"\non_failure = \"\"\non_success = \"spell_identity/cast_spark/outcome\"\nrequired_capability = \"spell_identity/spell/spark\"\nresolution_mode = \"Deterministic\"\nresolution_predicate_source = \"\"\nresumable = false\nself_eligible = false\nself_only = false\nsession_def_id = \"\"\n\n[[affordance_templates]]\naccepts_global_storm = false\nbundle_id = \"spell_identity\"\ncapability_id = \"spell_identity/spell/spark\"\ndisplay_name = \"Cast Spark\"\nlocality_class = \"\"\nmovement_cost_expression_source = \"\"\nniche_id = \"capability:spell_identity/spell/spark\"\noutcome_template_id = \"spell_identity/cast_spark/outcome\"\npredicate_bool = true\npredicate_source = \"\"\nrange_m = 0.0\nreads_occupancy = false\nstratification_ok = true\ntemplate_id = \"spell_identity/cast_spark/affordance\"\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"docs/modding\"\nbundle_id = \"spell_identity\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"The minimal single-identity spell: capability_id == entity_def_id == required_capability, one cast action, tags on the identity. The lint-clean end-state emitSpell renders.\"\ndisplay_name = \"Spell Identity (minimal)\"\ntag_prefixes = []\nversion = \"1.0.0\"\n\n[[capability_definitions]]\nactor_kind = \"entity\"\nbundle_id = \"spell_identity\"\ncapability_id = \"spell_identity/spell/spark\"\ndefault_visibility = \"Public\"\ndescription = \"A minor evocation cantrip. Identity skeleton — no effect body.\"\ndisplay_name = \"Cast Spark\"\n\n[[entity_definition_tag]]\nbundle_id = \"spell_identity\"\nentity_def_id = \"spell_identity/spell/spark\"\nsource = \"manifest\"\ntag = \"spell\"\n\n[[entity_definition_tag]]\nbundle_id = \"spell_identity\"\nentity_def_id = \"spell_identity/spell/spark\"\nsource = \"manifest\"\ntag = \"cantrip\"\n\n[[entity_definition_tag]]\nbundle_id = \"spell_identity\"\nentity_def_id = \"spell_identity/spell/spark\"\nsource = \"manifest\"\ntag = \"school:evocation\"\n\n[[entity_definitions]]\naffordance_seed_id = \"\"\nbundle_id = \"spell_identity\"\ndisplay_name = \"Spark\"\nentity_def_id = \"spell_identity/spell/spark\"\ngrants_capability_while_equipped = \"\"\ngrants_capability_while_present_in_location = \"\"\nlineage_id = \"\"\non_consume_consequence_id = \"\"\non_destroy_consequence_id = \"\"\non_equip_consequence_id = \"\"\non_unequip_consequence_id = \"\"\nslot_compatibility_predicate = \"\"\nstackable = false\n\n[metadata]\nbundle = \"spell_identity\"\nprofile = \"spell-identity-minimal\"\n\n[[niche_definitions]]\nbundle_id = \"spell_identity\"\ndescription = \"WA-CAP-002 (sk-0m4.69): capability:* niches require an explicit provider.\"\ndisplay_name = \"Cast Spark (actor-carried)\"\nniche_id = \"capability:spell_identity/spell/spark\"\npredicate_source = \"\"\nprovider = \"actor\"\n\n[[outcome_templates]]\nbundle_id = \"spell_identity\"\nconsequence_template_id = \"\"\ndisplay_name = \"Cast Spark\"\nmanipulation_action_id = \"spell_identity/cast_spark\"\noutcome_bool = true\noutcome_template_id = \"spell_identity/cast_spark/outcome\"\nsense_visibility = \"local\"\n",
69
+ expectedDiagnostics: ["MF-VAL-296","MF-VAL-297","MF-VAL-297","MF-VAL-297","MF-VAL-298","MF-VAL-298","MF-VAL-298"],
70
+ },
71
+ {
72
+ id: "weighted-int-roll-table",
73
+ intent: "Add a weighted non-identity int roll_table for non-die DSL draws (not a smuggled dN).",
74
+ tags: ["roll_table","dsl","weighted"],
75
+ toml: "#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n\n# GENERATED by scripts/doc-examples/weighted-int-roll-table.ts -- DO NOT EDIT BY HAND.\n# Regenerate: just doc-examples-author weighted-int-roll-table\n#\n# Worked example: a weighted non-identity int roll_table (MF-VAL-317 legal).\n\n[[bundles]]\nallow_flat_tags = false\nauthor = \"Spellkave docs\"\nbundle_id = \"example_weighted\"\ndefault_extent_params_json = \"\"\ndefault_extent_shape_id = \"\"\ndepends_on = [\"core\"]\ndescription = \"A minimal manifest with one weighted non-identity int roll_table.\"\ndisplay_name = \"Example Weighted Int Table\"\ntag_prefixes = []\nversion = \"0.1.0\"\n\n[metadata]\nbundle = \"example_weighted\"\nprofile = \"example_weighted\"\n\n[[roll_table_entries]]\nauthored_order = 1\nresult_ref = \"10\"\nroll_table_entry_id = \"example_weighted/severity:1\"\nroll_table_id = \"example_weighted/severity\"\nweight = 6\n\n[[roll_table_entries]]\nauthored_order = 2\nresult_ref = \"20\"\nroll_table_entry_id = \"example_weighted/severity:2\"\nroll_table_id = \"example_weighted/severity\"\nweight = 3\n\n[[roll_table_entries]]\nauthored_order = 3\nresult_ref = \"30\"\nroll_table_entry_id = \"example_weighted/severity:3\"\nroll_table_id = \"example_weighted/severity\"\nweight = 1\n\n[[roll_tables]]\nbundle_id = \"example_weighted\"\ndescription = \"Non-uniform severity draw — not a die. Dice belong in 1dN / d20 expressions.\"\ndisplay_name = \"Encounter severity\"\nresult_kind = \"int\"\nroll_table_id = \"example_weighted/severity\"\n",
76
+ expectedDiagnostics: [],
77
+ },
78
+ ];
79
+
80
+ export const GENERATED_EXAMPLE_DOCS: AuthoringDoc[] = [
81
+ {
82
+ id: "aoe-damage-spell",
83
+ title: "Area-of-effect damage spell",
84
+ kind: "example",
85
+ summary: "Add an area-of-effect blast that damages every co-located actor (ForEachActorInRadius + ModifyResource).",
86
+ tags: ["aoe","spell","damage","for-each-actor","modify-resource","frame-write"],
87
+ body: "# Worked example — an area-of-effect damage spell\n\nCompanion to [`aoe-damage-spell.toml`](./aoe-damage-spell.toml). The TOML is a\ncomplete, self-contained bundle that validates clean\n(`spellkave validate` / `check-refs` → `0 fatal`). This note explains the two\nkernel primitives it chains and — just as importantly — what it deliberately\ndoes **not** express.\n\n## What it builds\n\nA caster (`aoe_blast/mage`) with one action, `cast_firebloom`, that subtracts\nHP from **every actor standing on the same node**. Two goblins share the\ncaster's node and are hit; a bystander one node away is not.\n\nThe whole effect is one `consequence_frame_writes` row:\n\n```toml\nframe_write = { ForEachActorInRadius = {\n center_ref = \"ActorSpatialRef\", # centre on the caster's node\n shape_id = \"core/area/node_ball\", # topological AoE shape\n shape_params_json = '{\"ball_radius\": 0}', # 0 = same node only\n predicate_source = \"d20 < 13\", # per-target DEX save DC 13\n body = [ { ModifyResource = { # run once per FAILED-save actor\n actor = \"Actor\", # the PER-ACTOR binding\n resource = \"aoe_blast/hp\",\n delta_source = \"-d6\" # roll 1d6 of damage\n } } ]\n} }\n```\n\nBoth `predicate_source` and `delta_source` are authored DSL expressions\n(ADR-0045): the predicate is a per-target **Bool** evaluated once per selected\nactor, and the delta is an **Int** expression evaluated per target. Each actor\nrolls its own `d20` save and its own `d6` damage from a distinct draw chunk.\n\n### The two primitives\n\n| Primitive | Role | Lives in |\n|---|---|---|\n| `ForEachActorInRadius` | Selects actors an authored area shape covers, then runs `body` once per actor. | `FrameWriteOp::ForEachActorInRadius` (kernel) |\n| `ModifyResource` | Per-target read-modify-write of a resource by `delta_source`, an authored DSL Int expression. | `FrameWriteOp::ModifyResource` (kernel) |\n\nBoth landed for AoE use via **CR-8 / ADR-0042** (the apply-path wiring) and the\n`MF-VAL-217` resource lint. Before that, an AoE damage row admitted but did\nnothing — the original motivation for [#266](https://github.com/b4arena/spellkave/issues/266).\n\n### The bindings that matter\n\n- **`center_ref = \"ActorSpatialRef\"`** centres the shape on the *caster's*\n node. `TargetSpatialRef` also resolves if you want to centre on a chosen\n target instead.\n- **`actor = \"Actor\"` inside the body** is *not* the caster — the selector\n rebinds `Actor` (and `ActorSpatialRef`) to each selected actor before running\n the body. That is why each goblin rolls its *own* `d6` damage independently. If\n you wrote the caster's key there, every iteration would hit the caster.\n\n### Two area shapes\n\n- **`core/area/node_ball`** (used here) is *topological*: centre node plus all\n nodes within `ball_radius` graph-edges. `ball_radius: 0` means \"same node\".\n Works on any graph, metric or not — the safe default.\n- **`core/area/sphere`** is *metric*: `{\"radius_m\": 5.0}` reads each node's\n `pos_x`/`pos_y`. Use it only when your nodes carry real positions (as in the\n SRD Acid Splash row, `world-fixtures/srd/base/spell-actions.toml`).\n\nThe full shape vocabulary (`sphere`, `cone`, `line`, `cube`, `node_ball`) is\nauthored in `world-fixtures/core/base/spatial.toml` as `area_shape_definition`\nrows.\n\n## The resource lint — why `resource_definitions` is mandatory\n\nThe `ModifyResource` body names `resource = \"aoe_blast/hp\"`. That string **must**\nmatch a `resource_definitions` row or the lint rejects the bundle\n(`MF-VAL-217 Fatal`). This is the guard that closed the worst silent-no-op class\nfrom #266: a typo'd or undefined resource no longer admits-then-does-nothing —\nit fails loudly at validate time.\n\nNote `initial_value = 30`: an un-instantiated pool seeds at `min_value` (0), so\nwithout an explicit full-HP start, every `-7` clamps to 0 on first hit.\n\n## What this does NOT express — open #266 axes\n\nThis example is honest scaffolding. The AoE *selection* and flat *application*\nwork; a faithful 5e spell still cannot be authored. Each gap below is a live\n[#266](https://github.com/b4arena/spellkave/issues/266) axis:\n\n| Axis | Status | Why |\n|---|---|---|\n| AoE selection + apply-path | ✅ **works** | CR-8 / ADR-0042 |\n| Resource-existence guard | ✅ **works** | MF-VAL-217 |\n| **Dice damage** (`1d6`) | ✅ **works** | `delta_source = \"-d6\"` rolls 1d6 (ADR-0045 D-1). Arithmetic (`+ - * /`), grouping, and `cond(..)` compose — save-for-half is `delta_source = \"cond(d20 >= 13, 0 - d6 / 2, 0 - d6)\"`. |\n| **Saving throws** | ✅ **works** | `predicate_source` is a per-target DSL Bool (ADR-0045 D-2). Here `\"d20 < 13\"` is a flat DEX save; a stat-modified save reads `actor.stat('..')` once the target carries that stat. |\n| **Damage type** | ❌ open | `resource` says \"subtract HP\", not \"as fire damage\"; no resistance/immunity routing (ADR-0045 G-3). |\n| **Target-count cap** | ❌ open | \"one or two creatures\" — the selector hits *all* in radius. |\n| **Level scaling** | ❌ open | No level-indexed dice / tier table. |\n| **Range gate (placement)** | ✅ **works** | The affordance's `range_m` (ADR-0053) lets the cast act on a distant cell/entity within metric range; `0.0` = touch. Per-caster range *modifiers* (folding a caster bonus into `range_m`) are still deferred. |\n\nSaving throws were deliberately *never* a kernel primitive — ADR-0045 made them\na **composition** of the generic DSL (`d20`/`roll`, arithmetic, comparison,\n`cond`) carried on `predicate_source`/`delta_source`, exactly as planned. The\nkernel gained one content-neutral `cond` op and no save/damage concept.\n\n## Apply it against a live node\n\n```bash\njust wipe && just seed # core baseline\njust seed world-fixtures/<copy-of-this> # layer the bundle on top\n```\n\nEach goblin that fails its `d20 < 13` save loses `1d6` HP (its own roll) when the\nmage casts; a goblin that rolls 13+ takes nothing, and the bystander one node\naway is never selected.\n",
88
+ },
89
+ {
90
+ id: "authored-dark-cave",
91
+ title: "Author a dark cave passage",
92
+ kind: "example",
93
+ summary: "Seed ambient spatial state from TOML and make authored traversal and manipulation predicates read it.",
94
+ tags: ["spatial","environment-state","movement","manipulation","predicate","cave"],
95
+ body: "# Example - author a dark cave passage\n\nHow to seed ambient state on a passage from TOML and make traversal and\nmanipulation read it through authored predicates. The complete manifest form is\n[`authored-dark-cave.toml`](./authored-dark-cave.toml).\n\nThe example declares `depends_on = [\"core\"]`: its `core/walk` and\n`core/inspect` capabilities come from the mechanics core fixture, rather than\nthe kernel bootstrap vocabulary. The generator resolves that fixture through\na local author target while keeping only the example's own rows in the output.\nFor file validation, supply the dependency explicitly:\n\n```bash\nsk validate packages/spellkave-world-author/docs/examples/authored-dark-cave.toml \\\n --dep packages/spellkave-mechanics/fixtures/core/manifest.toml\n```\n\nThis is useful for cave darkness, smoke, noise, or other environmental facts\nthat should exist as world state before any reducer writes them at runtime.\nIf a runtime action should create the same traversal-affecting state from the\nactor's current position, use an `Inscribe{spatial_environment_state}` write\nwith `location_ref = \"ActorIncidentEdges\"` as described in\n[`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md#runtime-ambient-state-on-incident-edges).\n\n## The state rows\n\nFirst define the vocabulary row. `value_type` says what kind of value the\ninstance row will carry; traversal reads the value through\n`target.state(\"...\")`.\n\n```toml\n[[spatial_state_definitions]]\nstate_id = \"authored_dark_cave/ambient_darkness\"\nbundle_id = \"authored_dark_cave\"\nvalue_type = \"bool\"\nwriter_policy = \"manifest\"\nfreshness_rule = \"\"\nmerge_rule = \"replace\"\nlod_policy = \"retain_latest\"\ndescription = \"Darkness authored on a cave passage.\"\n```\n\nThen attach instance rows to the concrete place edge and the target place node.\nUse `place_edge_key` in TOML for the edge row; manifest apply resolves it to the\nlive `place_edge_id` stored in the runtime table.\n\n```toml\n[[spatial_environment_state]]\nbundle_id = \"authored_dark_cave\"\nplace_edge_key = \"authored_dark_cave/edge/entrance-dark-passage\"\nstate_id = \"authored_dark_cave/ambient_darkness\"\nvalue_bool = true\nvisibility = \"hidden\"\nupdated_tick = 0\n\n[[spatial_environment_state]]\nbundle_id = \"authored_dark_cave\"\nplace_node_id = \"authored_dark_cave/dark_passage\"\nstate_id = \"authored_dark_cave/ambient_darkness\"\nvalue_bool = true\nvisibility = \"hidden\"\nupdated_tick = 0\n```\n\n## The traversal predicate\n\nBind the edge to a traversal affordance whose predicate reads the env-state value\nand allows traversal when the passage is not dark or the actor has the authored\ncounter-capability.\n\n```toml\n[[capability_definitions]]\ncapability_id = \"authored_dark_cave/counter/darkvision\"\nbundle_id = \"authored_dark_cave\"\nactor_kind = \"entity\"\ndisplay_name = \"Darkvision\"\ndescription = \"Counter-capability that lets an actor traverse this authored dark passage.\"\n\n[[place_edge_affordance]]\nedge_key = \"authored_dark_cave/edge/entrance-dark-passage\"\naffordance_template_id = \"authored_dark_cave/affordance/traverse_dark_passage\"\n\n[[affordance_templates]]\ntemplate_id = \"authored_dark_cave/affordance/traverse_dark_passage\"\nbundle_id = \"authored_dark_cave\"\nniche_id = \"core/passable_portal\"\ncapability_id = \"core/walk\"\ndisplay_name = \"Traverse Dark Passage\"\npredicate_source = \"actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && target.state(\\\"authored_dark_cave/ambient_darkness\\\") == false || actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && actor.has_capability(\\\"authored_dark_cave/counter/darkvision\\\")\"\noutcome_template_id = \"core/move_outcome\"\n```\n\n## The manipulation predicate\n\nThe same state value can gate a node-targeted manipulation affordance. This\nfixture anchors a custom focus niche to the dark passage and overrides the core\ninspect outcome with an authored predicate that allows inspection only when the\nactor has the counter-capability or the node's darkness reads false.\n\n```toml\n[[spatial_niche_attachments]]\nbundle_id = \"authored_dark_cave\"\nplace_node_id = \"authored_dark_cave/dark_passage\"\nniche_id = \"authored_dark_cave/dark_passage_focus\"\n\n[[affordance_templates]]\ntemplate_id = \"authored_dark_cave/affordance/inspect_dark_passage\"\nbundle_id = \"authored_dark_cave\"\nniche_id = \"authored_dark_cave/dark_passage_focus\"\ncapability_id = \"core/inspect\"\ndisplay_name = \"Inspect Dark Passage\"\npredicate_source = \"actor.has_capability(\\\"core/inspect\\\") && target.has_niche(\\\"authored_dark_cave/dark_passage_focus\\\") && target.state(\\\"authored_dark_cave/ambient_darkness\\\") == false || actor.has_capability(\\\"core/inspect\\\") && target.has_niche(\\\"authored_dark_cave/dark_passage_focus\\\") && actor.has_capability(\\\"authored_dark_cave/counter/darkvision\\\")\"\noutcome_template_id = \"core/inspect/outcome\"\n```\n\nThis example does not make darkness affect perception or fog of war. Those\nconsequences require a separate perception layer. The row authored here is the\ncontent-neutral environmental fact that traversal and later systems can read.\n\n## Decaying darkness (authored staleness)\n\nThe darkness above is presence-only: it blocks until something rewrites the row.\nA *time-bounded* effect — darkness that fades after N ticks — used to require a\nhardcoded kernel freshness rule. It is now fully authorable, because the kernel\nsurfaces each env-state's `updated_tick` as the int fact `<state_id>@updated_tick`\n(ADR-0056 D-4). The author reads it with `target.stat(...)` and compares against\n`world.tick`; the TTL and the allow/deny meaning are authored, not built in.\n\n```toml\n[[spatial_state_definitions]]\nstate_id = \"authored_dark_cave/decaying_darkness\"\nbundle_id = \"authored_dark_cave\"\nvalue_type = \"bool\"\nwriter_policy = \"manifest\"\nfreshness_rule = \"expires_after_ticks:5\"\nmerge_rule = \"replace\"\nlod_policy = \"retain_latest\"\ndescription = \"Magical darkness that decays 5 ticks after it was last refreshed.\"\n\n[[affordance_templates]]\ntemplate_id = \"authored_dark_cave/affordance/traverse_decaying_passage\"\nbundle_id = \"authored_dark_cave\"\nniche_id = \"core/passable_portal\"\ncapability_id = \"core/walk\"\ndisplay_name = \"Traverse Decaying-Dark Passage\"\n# Allow when: not dark, OR the dark has decayed (age beyond the 5-tick TTL),\n# OR the actor has darkvision. Blocks only while the dark is still fresh.\npredicate_source = \"actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && target.state(\\\"authored_dark_cave/decaying_darkness\\\") == false || actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && world.tick - target.stat(\\\"authored_dark_cave/decaying_darkness@updated_tick\\\") > 5 || actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && actor.has_capability(\\\"authored_dark_cave/counter/darkvision\\\")\"\naccepts_global_storm = true\noutcome_template_id = \"core/move_outcome\"\n```\n\nTwo things to note. `freshness_rule` is documentation of intent for the author —\nthe kernel no longer enforces it; your predicate does. And reading `world.tick`\nmakes the predicate **Global-scoped** (it must be re-evaluated as the clock\nadvances), so the validator requires `accepts_global_storm = true` as an explicit\nacknowledgement of that re-evaluation cost (`MF-VAL-202`).\n\n## Apply and inspect\n\n```bash\njust wipe && just seed\njust seed docs/modding/examples/authored-dark-cave.toml\n\n# Confirm the rows exist through the structured spatial surface.\nspellkave place-edge list --edge-key authored_dark_cave/edge/entrance-dark-passage\nspellkave place-edge inspect <edge_id_from_the_list_line>\n```\n\nIf the `env-state` row uses an unknown `state_id` or points at a missing node,\nedge, or location, `validate_mod_bundle` reports a finding instead of silently\naccepting the row.\n",
96
+ },
97
+ {
98
+ id: "communicate-with-actor",
99
+ title: "Communicate with a co-located actor",
100
+ kind: "example",
101
+ summary: "Add a co-located NPC that can be addressed with core communication.",
102
+ tags: ["communication","actor","entity-definition","affordance","npc"],
103
+ body: "# Example — communicate with a co-located actor\n\nTeaching: `sk describe entities <herald>` shows the placed actor the speech affordance targets; `sk inspect` shows this example file.\n\nHow to make the player able to **address another actor** with a speech act\n(the core `core/assert` communicate primitive). The complete manifest form is\n[`communicate-with-actor.toml`](./communicate-with-actor.toml). For the\nopposite case — a speech act with no addressee at all — see\n[\"The addressee-less case\"](#the-addressee-less-case-no-target-at-all) below.\n\nThe example declares `depends_on = [\"core\"]`: `core/communicate` comes from\nthe mechanics core fixture, rather than the kernel bootstrap vocabulary.\nThe generator resolves that fixture through a local author target while\nkeeping only the example's own rows in the output. For file validation,\nsupply the dependency explicitly:\n\n```bash\nsk validate packages/spellkave-world-author/docs/examples/communicate-with-actor.toml \\\n --dep packages/spellkave-mechanics/fixtures/core/manifest.toml\n```\n\nThis example also corrects a common misreading: people conclude\n\"actor-to-actor communicate is a substrate gap.\" It is not — the affordance\nmaterialiser already admits any co-located *grounded entity* (item **or**\nactor) as a communication target. Two authoring details decide whether it\nworks, and one query gotcha decides whether you can *see* that it worked.\n\n## The two requirements\n\n### 1. The actor needs its own `entity_definition`\n\nCandidate-target derivation (`candidate_targets` →\n`derive_entity_target_niches` in\nthe world API)\nreads the entity's **definition** to build its target niches. An entity whose\n`entity_def_id` has no matching `[[entity_definitions]]` row returns `None` and\nis **silently dropped** from the candidate set.\n\nA bare `[[entities]]` + `[[actors]]` block with no `entity_def_id` gets an\nauto-derived def id (`<bundle>:<entity_key>`) for which no definition exists —\nso the actor never becomes a target. Always pair the instance with a definition:\n\n```toml\n[[entity_definitions]]\nentity_def_id = \"communicate_with_actor/herald\"\nbundle_id = \"communicate_with_actor\"\ndisplay_name = \"Village Herald\"\n\n[[entities]]\nentity_key = \"communicate_with_actor/herald\"\nbundle_id = \"communicate_with_actor\"\nentity_def_id = \"communicate_with_actor/herald\" # ← explicit, points at the definition\nname = \"Village Herald\"\nkind = \"npc\"\nplace_node_id = \"communicate_with_actor/green\"\n```\n\n### 2. The perceiver's affordance cache must be recomputed after the actor exists\n\nAffordances are an opt-in **push cache** recomputed only for *touched* actors.\nApplying a bundle re-touches the actors it names (the new NPC) — but **not** a\nplayer who was already standing on that node. So right after seeding this\nexample the player's cache is still the pre-NPC one.\n\nAny normal game action by the player re-touches the player and its co-located\nneighbours and refreshes the cache. Standing on `communicate_with_actor/green`\n(the node this example authors) and taking any act is enough; core no longer\nships a village graph to step off and back onto.\n\n> This re-touch-on-bundle-apply asymmetry is the only real substrate nuance\n> here, and it is a cache-freshness detail, not a missing capability.\n\n## The query gotcha\n\nA materialised communicate affordance carries **`action_id = \"\"`** and is keyed\nby `interaction_descriptor` (the typed `communication_speech_act_id` wins in\n`resolve_typed_descriptor`). Querying `action_id = 'core/assert'` finds only\n*manipulate*-stamped rows (carried/equipped items) and **cannot see** a\ncommunicate-against-actor row at all — a false negative. Query the descriptor:\n\n```bash\n# WRONG — misses communicate rows\njust sql \"SELECT target_entity_id FROM affordance\n WHERE perceiver_entity_id = <player_id> AND action_id = 'core/assert'\"\n\n# RIGHT — finds co-located item AND actor communicate targets\njust sql \"SELECT target_entity_id, action_id, interaction_descriptor FROM affordance\n WHERE perceiver_entity_id = <player_id>\n AND interaction_descriptor = 'communication.speech_act=core/assert'\"\n```\n\n## End-to-end proof\n\n```bash\njust spacetime-start && just wipe\njust seed packages/spellkave-mechanics/fixtures/core\njust seed packages/spellkave-world-author/docs/examples/communicate-with-actor.toml\n\n# resolve ids (herald is the npc this example authors at communicate_with_actor/green)\njust sql \"SELECT entity_id, name, kind FROM entity WHERE name = 'Village Herald'\" # → e.g. 12, npc\n\n# Put YOUR player on communicate_with_actor/green (core no longer ships a\n# default player or village). Any act there refreshes the cache (see requirement 2).\n\n# the player now PERCEIVES a communicate affordance targeting the herald\njust sql \"SELECT target_entity_id, action_id, interaction_descriptor FROM affordance\n WHERE perceiver_entity_id = <player_id>\n AND interaction_descriptor = 'communication.speech_act=core/assert'\"\n# target_entity_id | action_id | interaction_descriptor\n# ------------------+-----------+----------------------------------------\n# 9 | \"\" | \"communication.speech_act=core/assert\" ← a co-located item\n# 12 | \"\" | \"communication.speech_act=core/assert\" ← the Village Herald (npc)\n\n# and can EXECUTE the speech act against the actor\nspellkave --url http://127.0.0.1:<port> intent manipulate <player_id> 12 core/assert\n# {\"reducer\":\"r_manipulate\",\"status\":\"ok\"}\nspellkave --url http://127.0.0.1:<port> events 3 --kind layer2\n# layer2:apply_consequence consequence_template 'core/assert/success' Applied\n# layer2:frame frame_action: action_id='core/assert' outcome=Resolved terminal=true\n```\n\nThe `r_manipulate` call resolves and applies `core/assert/success` against the\nNPC — the directed speech act lands and resolves, end to end. (`<port>` is the\nper-worktree node port printed by `just spacetime-start`; `just sql` resolves it\nautomatically, the raw `spellkave` binary needs `--url`.)\n\n## Receiver side — the addressed actor currently perceives nothing\n\nTargeting and executing the speech act works, but `core/assert/success` is a\n**no-op consequence**: `effect_refs_csv = \"\"`, `traces_json = \"[]\"`, no\n`[[consequence_frame_writes]]`. It resolves and emits an out-of-world event\n(`layer2:apply_consequence` / `layer2:frame`) but writes **nothing in-world** —\nno trace, no knowledge mutation on the target. So the Herald has no perceivable\nartifact telling it that it was addressed.\n\nGiving communication a receiver-visible effect is **authoring**, not a substrate\nchange: have the assert consequence `Inscribe` a trace (the same mechanism\n`core/pickup/success` uses for `handled_item`), then let the addressed actor\nread it through a trace-gated affordance (the shape of `core/trace/read`, which\nmaterialises only once a trace exists at the node).\n\nFor directed speech, anchor that trace at the Herald's current place\n(`location_ref = \"TargetSpatialRef\"`) and name the Herald in the PAYLOAD, via\n`carry_addressee` — see \"Trace Inscription — Payload Carriage, Anchors, And\nHow Long A Trace Stays Perceivable\" in\n[`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md).\nThe anchor says where the utterance is heard, the payload says who it was\naimed at. A shout or room-wide line still uses `ActorSpatialRef`.\n\nAn earlier version of this page suggested anchoring the trace to the Herald's\nown entity so it \"follows the Herald rather than sits at the room\". **Don't.**\nIt never made the trace addressee-only (traces carry no recipient column, only\nADR-0040/ADR-0095's co-location perception, so bystanders overheard it either\nway), and it made the trace pile up ON the Herald and travel with him: bead\nsk-oj6 caught a hero walking into a tavern and perceiving an entire earlier\nconversation, raw internal tokens included, because the NPC it had been\naddressed to was standing there. The core `core/assert` primitive ships empty\non purpose — the surface is there; the spoken content is left to authors.\n\n## The addressee-less case: no target at all\n\nEverything above assumes the speech act names *someone* — the affordance\nmaterialiser admits every co-located grounded entity as a candidate target,\nexactly like a manipulate action would. That is the right shape whenever the\nniche a communicate template authors is **entity-provided** (the default\n`niche_definitions` `provider`, or omitted entirely, as `core/assert`'s and\nthis example's own `communicate_with_actor/herald` niche both are).\n\nIt is the *wrong* shape for a plain, addressee-less shout — \"just say\nsomething to the room\" — where there is no candidate entity to target at all,\nonly the room itself. `packages/spellkave-srd-cc`'s `srd/speak-aloud` is the\nworked example (ADR-0137, amending ADR-0033 §D-2): its niche is authored\n`provider = \"actor\"` instead —\n\n```toml\n[[niche_definitions]]\nniche_id = \"capability:my_bundle/action/communicate/shout\"\nprovider = \"actor\"\n```\n\n— so the acting capability itself carries the verb (the same `provider =\n\"actor\"` shape Dodge/Short Rest/Long Rest use for self-only manipulate\nactions). An **actor-provided** communicate niche materialises **exactly one**\ncandidate: the place sentinel (`target_entity_id = 0`,\n`target_ref = \"place_node:<the speaker's own node>\"`) — never an entity row,\nregardless of who else is co-located. An **entity-provided** niche (this\npage's whole worked example) never gets that sentinel; it keeps entity\ncandidates only, exactly as documented above.\n\nChoosing between them is an authoring decision, not a substrate limitation\neither way: author `provider = \"actor\"` when the speech act has no addressee\nby design; leave the niche entity-provided (or omit `provider`) when it names\nsomeone. Query the addressee-less case the same way, just filtering on\n`target_entity_id = 0` instead of a specific entity id:\n\n```bash\njust sql \"SELECT target_entity_id, target_ref, interaction_descriptor FROM affordance\n WHERE perceiver_entity_id = <player_id>\n AND interaction_descriptor = 'communication.speech_act=my_bundle/shout'\"\n# target_entity_id | target_ref | interaction_descriptor\n# ------------------+-----------------------------------------+---------------------------------------------\n# 0 | \"place_node:my_bundle/green\" | \"communication.speech_act=my_bundle/shout\"\n```\n\n## Why this is not a substrate gap\n\nThe place-loop materialiser branches on the typed `communication_speech_act_id`\ndescriptor (ADR-0021 content-neutrality) and treats co-located items and actors\nidentically as candidate targets. The original\n[#655](https://github.com/b4arena/spellkave/issues/655) reading missed this on\nthree counts: the repro queried `action_id` (invisible to communicate rows), the\nNPC fixture lacked an `entity_definition` (dropped from candidates), and the\nplayer's cache was never recomputed after the NPC was seeded.\n",
104
+ },
105
+ {
106
+ id: "damage-type-routing",
107
+ title: "Damage-type routing",
108
+ kind: "example",
109
+ summary: "Route a fire spell's HP loss through target immune/resistant/vulnerable defense tags using a DSL delta_source.",
110
+ tags: ["damage","spell","routing","has-tag","modify-resource","delta-source"],
111
+ body: "# Worked example - damage-type routing\n\nCompanion to [`damage-type-routing.toml`](./damage-type-routing.toml). The TOML\nis a complete bundle that validates clean through the same wasm validator used\nby `spellkave-author`.\n\n## What it builds\n\nThe bundle creates a caster, one fire spell, and four targets:\n\n| Target | Tag carrier | Result |\n|---|---|---|\n| Fire Immune Target | `damage_immune:fire` | 0 damage |\n| Fire Resistant Target | `damage_resist:fire` | half damage |\n| Fire Vulnerable Target | `damage_vulnerable:fire` | double damage |\n| Normal Fire Target | no fire defense tag | full damage |\n\nThe routing lives entirely in the `ModifyResource.delta_source` expression:\n\n```toml\ndelta_source = \"let dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\"\n```\n\n`let dmg = 8d6` binds the raw roll once, so the branches do not reroll. The\nwhole `cond` result is negated because `ModifyResource` applies HP loss as a\nnegative delta.\n\n## Tag carrier\n\nDefense tags must be carried by `[[entity_definition_tag]]` or `[[entity_tag]]`.\nThose are the rows that `target.has_tag(...)` reads during apply-time\nmanipulation. Capability tags such as `damage:fire` are useful documentary\nmetadata for the spell, but they do not make a target resistant or immune.\n\n## Ladder order\n\nThe example uses this fixed order:\n\n1. `damage_immune:<type>`\n2. `damage_resist:<type>`\n3. `damage_vulnerable:<type>`\n4. normal\n\nResistance halves the positive damage magnitude before negation. Integer\ndivision rounds down, so raw `7` becomes HP delta `-3`.\n\nThe helper exported by `@spellkave/world-author` emits this same string:\n\n```ts\nrouteDamage(\"8d6\", \"fire\")\n```\n\n## Known boundary\n\nA target statically carrying both `damage_resist:fire` and\n`damage_vulnerable:fire` is out of scope for this simple authored-tag idiom. The\nfirst matching branch wins. RAW cancellation from dynamic resistance is a\nseparate condition/modifier mechanism, not part of this static defense-tag\npattern.\n",
112
+ },
113
+ {
114
+ id: "definition-seed-statblock",
115
+ title: "Statblock stats & innate capability on a definition",
116
+ kind: "example",
117
+ summary: "Give a creature definition its own HP and innate Multiattack so every spawned instance inherits them; also covers the definition-level containment/equipment seeds that spawn a fresh carried/equipped child instance.",
118
+ tags: ["entity-definition","object_state","capability","statblock","seed","containment","equipment"],
119
+ body: "# Example — statblock stats & innate capability on a definition\n\nTeaching: `sk get object_state <entity_key>::srd/hp` reads the *placed* seed copy; `sk query` reads the definition seed table.\n\nHow to give a reusable creature **definition** its own numbers — so every\nplaced instance is born with them, and you author a creature *library* once\ninstead of attaching stats per instance. The complete manifest form is\n[`definition-seed-statblock.toml`](./definition-seed-statblock.toml).\n\nThis closes the gap where a definition-bulk authoring slice (a creature library:\n`entity_definitions` + taxonomy, no placement) structurally could not carry HP,\nability scores (#729), or innate Multiattack (#728) — those only attached to a\n*placed* `[[entities]]` row.\n\n## The three seed tables\n\nEach seed row hangs off an `entity_def_id`. At admission (manifest placement) and\nat runtime spawn (`CreateWorldObject`), every placed instance of that definition\ngets the corresponding live row copied onto it:\n\n| Seed row | Copies onto the instance | For |\n|---|---|---|\n| `[[entity_definition_initial_state]]` | an `object_state` row | HP, AC-as-state, ability scores, counters (#729) |\n| `[[entity_definition_initial_capability]]` | a `capability` row | Multiattack, breath weapon, always-on traits (#728) |\n| `[[entity_definition_initial_condition]]` | a `target_condition` row | a starting condition (e.g. a torch born `burning`) |\n\nState-values use **typed carriers** — `value_int`, `value_text`, or\n`value_bool`, in that precedence. There is no `value_kind` enum column\n(ADR-0018).\n\n```toml\n[[entity_definition_initial_state]]\nentity_def_id = \"example_statblock/ghoul\"\nstate_id = \"example_statblock/hp\"\nvalue_int = 22\nbundle_id = \"example_statblock\"\n\n[[entity_definition_initial_capability]]\nentity_def_id = \"example_statblock/ghoul\"\ncapability_id = \"example_statblock/multiattack\"\nbundle_id = \"example_statblock\"\n```\n\nThe seed FK targets (`entity_def_id`, `state_id`, `capability_id`,\n`condition_definition_id`) must resolve in the same bundle or a declared\ndependency. A same-bundle typo fails loudly at validation (MF-VAL-252…255);\na legitimate cross-bundle reference (a `phandelver` creature seeding `srd/hp`)\nresolves at live admission / the merge-gate per\n[ADR-0044](../../../../specifications/adr/0044-incremental-world-aware-manifest-admission.md).\n\n## Structural seeds: containment and equipment\n\nTwo more seed tables carry **structure**, not a flat value copy — every placed\nor spawned instance of the definition is born with a **freshly spawned child\ninstance**, not merely a copied row:\n\n| Seed row | What it does | For |\n|---|---|---|\n| `[[entity_definition_initial_containment]]` | spawns a child instance and carries it (loose `entity_containment`, `slot_id = \"\"`) | a bandit born with a quiver already in its pack |\n| `[[entity_definition_initial_equipment]]` | spawns a child instance, carries it, AND inserts an `entity_equipment_slot` row into the named slot | a goblin born wielding a scimitar |\n\n```toml\n# Root -> quiver (loose carriage, quantity 1).\n[[entity_definition_initial_containment]]\nentity_def_id = \"pack/bandit\"\ncontained_entity_def_id = \"pack/quiver\"\nquantity = 1\nbundle_id = \"pack\"\n\n# Nested: quiver -> bolts (pack/bolt is stackable — ONE bolt instance, quantity 20).\n[[entity_definition_initial_containment]]\nentity_def_id = \"pack/quiver\"\ncontained_entity_def_id = \"pack/bolt\"\nquantity = 20\nbundle_id = \"pack\"\n\n# Root -> equipped scimitar, in the main_hand slot.\n[[entity_definition_initial_equipment]]\nentity_def_id = \"pack/goblin\"\nequipped_entity_def_id = \"pack/scimitar\"\nslot_id = \"core/main_hand\"\nbundle_id = \"pack\"\n```\n\n(Cribbed from the live `edi_demo` proof bundle —\n[`entity-definition-initial-items.toml`](../../../../openspec/specs/world-manifest-authoring/demos/fixtures/entity-definition-initial-items.toml)\n— with the demo's `edi_demo/*` ids renamed to the `pack/*` ids the spec\nscenarios use.)\n\n**Verb form:** `spellkave_define_entity_type` folds both tables in as satellite\narray params, symmetric with `initial_states`/`initial_capabilities`/\n`initial_conditions` — no raw `spellkave_write_rows` call needed for the common\ncase:\n\n```json\n{\n \"bundle\": \"pack\",\n \"id\": \"bandit\",\n \"display_name\": \"Bandit\",\n \"initial_containment\": [\n { \"contained_entity_def_id\": \"pack/quiver\", \"quantity\": 1 }\n ],\n \"initial_equipment\": [\n { \"equipped_entity_def_id\": \"pack/scimitar\", \"slot_id\": \"core/main_hand\" }\n ]\n}\n```\n\nThe raw `[[entity_definition_initial_containment]]`/`[[entity_definition_initial_equipment]]`\nTOML tables above remain the form for manifest-file authors (and for a\n`spellkave_write_rows` escape hatch when the verb's shape doesn't fit); the\nverb call is sugar over the exact same rows — same cycle check, same\nslot-compatibility check, same idempotent-replace-on-rerun semantics.\n\n`quantity` follows the same stack-vs-instance-count rule as `[[entities]].quantity`\n(ADR-0028 D-6): when the contained definition is `stackable = true`, ONE\ninstance is spawned carrying `quantity` as its stack count; when `false`,\n`quantity` SEPARATE instances are spawned. Equipment carries an implicit\n`quantity = 1` — one child, one slot.\n\n**Recursion:** the child's OWN `entity_definition_initial_*` seeds — including\nits own containment/equipment rows — apply to it before the parent's seeding\ncompletes. A bandit-carries-quiver-carries-bolts chain is not a special case;\nit is the same one-hop rule applied twice. This is how the worked fixture\nabove nests `pack/quiver` inside `pack/bandit` and `pack/bolt` inside\n`pack/quiver` in a single containment table.\n\n**Cycle rule:** the def-level graph formed by every\n`entity_definition_initial_containment`/`entity_definition_initial_equipment`\nrow's `entity_def_id` -> `contained_entity_def_id`/`equipped_entity_def_id`\nedge (both row kinds share one graph) MUST be acyclic. A definition that\ndirectly contains/equips itself, or a transitive cycle (A -> B -> A, or a\nmixed containment/equipment cycle across both tables), fails admission with a\nfatal **`MF-VAL-314`** diagnostic naming the exact cycle path — before any row\nis applied. Equipment seeds are additionally checked against the equipped\ndefinition's `slot_compatibility_predicate` at commit time (the same\n`MF-VAL-311`/`-312`/`-313` class of static enforcement), not only at spawn.\n\n**Spawn overrides:** the capability-gated runtime entry point\n`spawn_entity_definition` accepts optional state-delta overrides\n(`{state_id, delta_source}`) and added-condition overrides\n(`{condition_definition_id, duration_ticks}`), applied to the freshly spawned\nroot instance strictly AFTER every definition-level seed above (state,\ncapability, condition, containment, equipment — recursively) has already run.\nA state-delta override adds its DSL Int expression to the definition-seeded\nvalue for that `state_id` (or to `0` if unseeded); a condition override adds\nalongside any seeded conditions rather than replacing one. Overrides only\never touch the spawned instance's own live rows — never the `entity_definition`\nor its seed rows.\n\n## End-to-end proof\n\n```bash\njust spacetime-start && just wipe && just seed\njust seed docs/modding/examples/definition-seed-statblock.toml\n\n# What does the definition seed onto its instances?\nspellkave --url http://127.0.0.1:<port> entity-def-seed list --entity-def example_statblock/ghoul\n# {\"kind\":\"entity_def_seed\",\"entity_def_id\":\"example_statblock/ghoul\",\"seed_kind\":\"capability\",\"ref_id\":\"example_statblock/multiattack\",...}\n# {\"kind\":\"entity_def_seed\",\"entity_def_id\":\"example_statblock/ghoul\",\"seed_kind\":\"state\",\"ref_id\":\"example_statblock/hp\",\"value\":\"22\",...}\n\n# resolve the placed instance id\njust sql \"SELECT entity_id FROM entity WHERE name = 'Ghoul'\" # → e.g. 14\n\n# the instance was BORN with HP 22 (object_state) and Multiattack (capability) —\n# no per-instance rows were authored\njust sql \"SELECT state_id, value FROM object_state WHERE target_id = '14'\"\njust sql \"SELECT capability_id FROM capability WHERE entity_id = 14\"\n```\n\n`entity-def-seed list` shows what a definition will stamp on its instances;\n`object_state` / `capability` on the placed entity id show that the stamp\nhappened at admission. (`<port>` is the per-worktree node port printed by\n`just spacetime-start`; `just sql` resolves it automatically, the raw\n`spellkave` binary needs `--url`.)\n\n## Why this is the right shape\n\nThe seed is a generic **copy mechanism**, not new typology: `state_id` and\n`capability_id` are authored vocabulary row-ids, and the live rows it writes\n(`object_state`, `capability`) are the same content-neutral carriers the runtime\nalready uses (ADR-0021). Innate capabilities live in a **seed table**, not a new\nCSV column on `entity_definition` — the `grants_capability_while_*` CSV grant\nsurface is frozen legacy per ADR-0028. The runtime consumer reuses the existing\n`object_state` / `capability` write paths, adding no kernel enum variant.\n",
120
+ },
121
+ {
122
+ id: "dm-oversight",
123
+ title: "Define a DM that sees a region's hidden state",
124
+ kind: "example",
125
+ summary: "Author a game-master body that sees the Hidden rows of every body inside a bounded, authored region — without any DM type in the substrate.",
126
+ tags: ["dm","visibility","hidden","extent","place-graph","capability","oversight"],
127
+ body: "# Example - define a DM that sees a region's hidden state\n\nHow to author a game-master (\"DM\") body that sees the **Hidden** rows of every\nbody inside an authored region, while ordinary players see none of it. The\ncomplete manifest form is [`dm-oversight.toml`](./dm-oversight.toml). The\nconcept guide is [`dm-oversight.md`](../dm-oversight.md).\n\nThere is no \"DM\" type in the substrate. A DM is just a body holding a capability\nwhose `extent_ref` names a region and whose `extent_kind_ref` says how to\nresolve it. Those authored fields are the whole feature.\n\n## The oversight grant\n\nThe load-bearing row. `extent_ref` names a `place_graph_id` and\n`extent_kind_ref = \"place_graph\"` selects the core place-graph resolver; the body\nholding this grant now sees the `Hidden` rows of every body located in that\nplace graph.\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"dm_oversight/dm\"\ncapability_id = \"dm_oversight/oversee\"\nsource = \"dm_oversight\"\nbundle_id = \"dm_oversight\"\nextent_ref = \"dm_oversight/region\"\nextent_kind_ref = \"place_graph\"\nelevation_class = \"internal\"\n```\n\n`extent_ref` defaults to empty. An empty or omitted value broadens nothing\n(fail-closed) — a body without it sees only its own Hidden rows, exactly like a\nnormal player. `extent_kind_ref` is optional only for legacy place-graph\nmanifests; new manifests should set it explicitly. A typo that names no real\nextent grants no extra sight and is rejected at manifest apply; see the concept\nguide. `elevation_class = \"internal\"` is what reaches `Internal`/ungated\n`Discoverable` rows on top of `Hidden` — omitted, this grant would still see\n`Hidden` rows but not `Internal` ones (ADR-0084, #1938).\n\n## The hidden row it reveals\n\nA capability on a body **inside** the region, marked `visibility = \"hidden\"`. A\npassive player never receives this row through `visible_capability`; the\noverseeing DM does.\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"dm_oversight/guardian\" # a body at dm_oversight/region/vault\ncapability_id = \"dm_oversight/secret_trait\"\nsource = \"dm_oversight\"\nbundle_id = \"dm_oversight\"\nvisibility = \"hidden\"\n```\n\nThe guardian sits at `dm_oversight/region/vault`, a node of the\n`dm_oversight/region` graph the DM oversees, so the guardian's Hidden trait\nfalls inside the DM's extent. The `player` body sits in a different graph\n(`dm_oversight/outside`) and holds no extent, so it sees neither the guardian's\nHidden trait nor anything else outside its own body.\n\n## Why it is bounded\n\nThe DM sees Hidden rows only for bodies in the *named* place graph — never\nglobally. To oversee two regions, grant the capability twice with two\n`extent_ref`s. To share one DM seat among several people, bind several\nidentities to the one DM actor. The breadth is always authored data, never a\nhardcoded rule (ADR-0007 D-3/D-4).\n",
128
+ },
129
+ {
130
+ id: "spatial-minimal-cell",
131
+ title: "Minimal spatial cell",
132
+ kind: "example",
133
+ summary: "Add the smallest valid spatial cell with one graph and one node.",
134
+ tags: ["spatial","place_graph","place_node"],
135
+ body: "# Example — minimal spatial cell\n\nThe smallest workable spatial topology: one `place_graph` with one\n`place_node`. The complete manifest form is\n[`spatial-minimal-cell.toml`](./spatial-minimal-cell.toml); it was originally\nderived from the srd bundle's spatial probe (`base/spatial.toml`), retired\nwith that bundle in the world-fixtures retirement (2026-08-14).\n\n```toml\n[[place_graphs]]\nplace_graph_id = \"example_spatial_cell\"\nbundle_id = \"example_spatial_cell\"\nsubstrate_id = \"outdoor\"\ndisplay_name = \"Example Cell Graph\"\ndescription = \"One disconnected outdoor cell.\"\n\n[[place_nodes]]\nnode_id = \"example_spatial_cell/cell_a\"\nbundle_id = \"example_spatial_cell\"\nplace_graph_id = \"example_spatial_cell\"\nlocal_id = \"cell_a\"\nsubstrate_id = \"outdoor\"\ndisplay_name = \"Open Ground\"\npose_elevation_present = true\npos_x = 0\npos_y = 0\npos_present = true\n```\n\n## What's required, what's optional\n\n- `place_graph_id`, `bundle_id`, `substrate_id`, `display_name` — required.\n- `place_node`: `node_id`, `bundle_id`, `place_graph_id`, `local_id`,\n `substrate_id`, `display_name` — required.\n- `pos_x` / `pos_y` / `pos_present` — required by the validator;\n default-zero is fine for a probe.\n- `extent_shape_id` / `extent_params_json` — optional authored spatial\n extent (a shape reference into `area_shape_definition`, e.g.\n `core/area/cube` with a metre-native `extent_m`); omitted here, so this\n node's extent resolves from its bundle's default extent\n (`bundles.default_extent_shape_id`) — or fails admission if the bundle\n authors none (see `dsl-grammar.md`/`manifest-format.md` for the shape\n vocabulary).\n- `core/area/cube` accepts required fallback `extent_m` plus independent\n `extent_x_m`, `extent_y_m`, and `extent_z_m` half-extent overrides. The x/y\n axes are shape-local after rotation. `core/area/sphere` similarly accepts\n `radius_x_m`, `radius_y_m`, and `radius_z_m`, producing an ellipse/ellipsoid.\n Every supplied dimension must be finite and greater than zero. The z override\n participates only when both queried positions carry elevation.\n- `cell_res4`, `cell_res7`, `cell_res10` — H3 cell indices. Optional;\n the SRD probe omits them. Present on `core` bundle's outdoor nodes.\n- `pose_elevation_present` — required boolean; set `true` if elevation\n is meaningful.\n\n## How to verify\n\nLocal syntactic validation:\n\n```bash\nspellkave validate docs/modding/examples/spatial-minimal-cell.toml\n```\n\nLive module application:\n\n```bash\nspellkave manifest apply docs/modding/examples/spatial-minimal-cell.toml\n```\n\nIf both exit `0`, the row landed. You can confirm the place node is\nobservable through the public SDK with\n[`readLocationSnapshot`](../../../../packages/spellkave-sdk/src/core/readers/location_snapshot.ts):\n\n```ts\nconst snapshot = readLocationSnapshot(db, \"example_spatial_cell/cell_a\");\n// → { node_id, outgoing_edges: [], actors_here: [] }\n```\n\n`outgoing_edges` is empty because this example does not author any\nedges; a single-cell location is disconnected from the rest of the\nworld by design. To connect it, add `[[place_edges]]` rows pointing\n`from_node_id` / `to_node_id` to existing nodes — see\n[`../../../packages/spellkave-mechanics/fixtures/core/base/spatial.toml`](../../../../packages/spellkave-mechanics/fixtures/core/base/spatial.toml)\nfor the full edge contract.\n\n## Why this scores `fits`\n\nThe spatial schema captures everything the SRD's 5-ft-grid convention\nrequires: a typed substrate, a discrete cell with coordinates and an\n(optionally authored) spatial extent. No SRD attribute is lost on\ntranslation; no DSL is required.\nThis is the only SRD probe row that translated without dropped\nattributes — see\n[`../../../openspec/changes/archive/2026-05-18-srd-conformance-probe/gap-matrix.md`](../../../../openspec/changes/archive/2026-05-18-srd-conformance-probe/gap-matrix.md)\nfor the other four probe rows (`partial` / `gap`).\n",
136
+ },
137
+ {
138
+ id: "spell-identity-minimal",
139
+ title: "Minimal single-identity spell",
140
+ kind: "example",
141
+ summary: "Author the clean, lint-clean end-state of a spell: one identity (capability_id == entity_def_id == required_capability), one cast action with no twin, taxonomy tags on the identity only.",
142
+ tags: ["spell","identity","emit-spell","best-practice","lint","capability","render-discipline"],
143
+ body: "# Minimal single-identity spell\n\nThe smallest **lint-clean** spell skeleton — the shape the `emitSpell` primitive\nrenders and the author-time `manifest lint` accepts with zero findings. Copy it\nwhen adding a spell, then hang an effect body off the outcome (see\n[aoe-damage-spell](./aoe-damage-spell.md)).\n\nThe full rationale lives in\n[spell-authoring-best-practices.md](../spell-authoring-best-practices.md); this is\nthe worked artifact.\n\n## One spell = one identity\n\nA spell touches several row-kinds, but it has **one identity** — and three of those\nrows must agree on it:\n\n| Row | Field | Value |\n|---|---|---|\n| `entity_definitions` (the catalog identity) | `entity_def_id` | `spell_identity/spell/spark` |\n| `capability_definitions` (an actor can cast it) | `capability_id` | `spell_identity/spell/spark` |\n| `action_definitions` (the cast verb) | `required_capability` | `spell_identity/spell/spark` |\n\nThe cast **action** keeps its own verb id (`spell_identity/cast_spark`) — only the\n*identity* is unified. The catalog entity is what the bestiary/spell list shows;\nthe capability is the grantable \"can cast\"; the action's `required_capability`\nbinds back to that one identity so the runtime (and the validator's MF-VAL-264/265)\ncan see they are the same spell.\n\n## What the lint checks here — and why this example passes\n\nRun `manifest lint docs/modding/examples/spell-identity-minimal.toml --json`: it\nreports **clean**. Each of the five author-time rules is satisfied:\n\n- **`twin-action`** — there is exactly **one** `action_definition`. The affordance\n is an `affordance_template` pointing at the action's `outcome_template`, not a\n byte-identical `cast_spark/affordance` copy of the action.\n- **`tag-repetition`** — taxonomy tags (`spell`, `cantrip`, `school:evocation`)\n live on `entity_definition_tag` (the identity) **only**; they are not\n re-authored verbatim onto the capability or action rows.\n- **`spell-delimiter-drift`** — the slug is `…/spell/spark` (hyphen-delimited), not\n `…/spell/sp_ark`.\n- **`orphan-spell-capability`** / **`dangling-required-capability`** — the\n capability has its matching catalog `entity_definition`, and the action's\n `required_capability` resolves to a real `capability_definition`.\n\n## What this example deliberately omits\n\nIt is an **identity skeleton** — no effect body. A real spell hangs a\n`consequence_template` (dice damage, a save, a condition) off the outcome; that\neffect layer is shown in [aoe-damage-spell](./aoe-damage-spell.md) and the\nSRD behavior cluster. Keeping the skeleton effect-free isolates the *identity*\ndiscipline this example teaches.\n",
144
+ },
145
+ {
146
+ id: "weighted-int-roll-table",
147
+ title: "Weighted int roll table",
148
+ kind: "example",
149
+ summary: "Add a weighted non-identity int roll_table for non-die DSL draws (not a smuggled dN).",
150
+ tags: ["roll_table","dsl","weighted"],
151
+ body: "# Example — weighted int roll table\n\nA worked authoring of a **non-uniform, non-identity** int `roll_table`. Use\nthis shape for weighted draws (encounter severity, loot tiers, omen tables).\n\n**Do not** author a die as an identity-mapped uniform 1..N weight-1 int\ntable — that is MF-VAL-317 Fatal (sk-s1e / #2184). Author dice as DSL\nexpressions (`1d8`, `d20`, `2d6 + 3`) or an\n`entity_definition_item_dsl_source` slot (sk-84i.2 `.source`).\n\nThe complete manifest form is\n[`weighted-int-roll-table.toml`](./weighted-int-roll-table.toml).\n\n```toml\n[[roll_tables]]\nroll_table_id = \"example_weighted/severity\"\nbundle_id = \"example_weighted\"\ndisplay_name = \"Encounter severity\"\nresult_kind = \"int\"\n\n[[roll_table_entries]]\nroll_table_entry_id = \"example_weighted/severity:1\"\nroll_table_id = \"example_weighted/severity\"\nauthored_order = 1\nweight = 6\nresult_ref = \"10\"\n\n[[roll_table_entries]]\nroll_table_entry_id = \"example_weighted/severity:2\"\nroll_table_id = \"example_weighted/severity\"\nauthored_order = 2\nweight = 3\nresult_ref = \"20\"\n\n[[roll_table_entries]]\nroll_table_entry_id = \"example_weighted/severity:3\"\nroll_table_id = \"example_weighted/severity\"\nauthored_order = 3\nweight = 1\nresult_ref = \"30\"\n```\n\n## Things to notice\n\n- **`result_kind = \"int\"`** lets the DSL evaluator parse each `result_ref`\n as `i64`. Outcome-graph tables use `\"outcome_graph\"` instead.\n- **Unequal weights** skew the draw (here 6:3:1). Equal weights on\n **non-identity** values are also legal; identity 1..N with every\n `weight = 1` is not.\n- **DSL call:** `roll_table('example_weighted/severity')` resolves against\n the seeded entries at evaluation time.\n- **Static reference validation** still checks `roll_table('<id>')` calls\n (`MF-VAL-211`).\n\n## Retired: d20-as-roll-table\n\nThe previous `d20-roll-table` worked example taught a 20-row identity\nweight-1 table. That shape is now rejected at validate time. Prefer the\nnative `d20` / `1d20` DSL atom for dice.\n",
152
+ },
153
+ ];
154
+
155
+ // Individual Patternbook pages: title and problem summary derive from source.
156
+ export const GENERATED_PATTERN_DOCS: AuthoringDoc[] = [{"id":"patterns/actor-carried-feature-verb","title":"Actor-carried feature verb (a class feature the hero carries everywhere)","kind":"guide","summary":"A granted class feature (Second Wind, Rage, Channel Divinity) must be usable wherever the hero is — in the tomb, not only at the room where it was granted — and spend its own uses.","tags":["patterns","actor","carried","feature","verb"],"body":"# Actor-carried feature verb (a class feature the hero carries everywhere)\n\n## Name\n\n`actor-carried-feature-verb` — Feature verb offered wherever its owner stands\n\n## Problem\n\nA granted class feature (Second Wind, Rage, Channel Divinity) must be usable wherever the hero is — in the tomb, not only at the room where it was granted — and spend its own uses.\n\n## Forces\n\n- A `capability:*` niche authored without a `provider` used to fall back\n to place-provided in silence, leaving the verb dead outside an authored\n node (a level-1 fighter needed Second Wind in the tomb and it was not\n offered); `WA-CAP-002` now rejects that.\n- Scoping a feature to the place where it is \"normally\" exercised is a\n premise a blind playtest falsifies.\n- There is no class-definition inheritance: granting the capability does\n not seed the feature's resource; an unseeded `actor.stat(<uses>)` gate\n fails closed.\n- Uses are a pool the feature spends; a feature whose pool starts at 0 is\n correctly absent from the palette until something charges it.\n\n## Solution\n\n1. Niche `capability:<bundle>/class-feature/<class>/<slug>` with\n `provider = \"actor\"` — the acting creature's own capability carries the\n niche; no `spatial_niche_attachment`. Same shape attacks, Dodge and the\n rests use.\n2. Affordance gated on the feature's own pool:\n `actor.stat('<uses>') >= 1`; `spends_channel` on the right economy\n channel.\n3. Consequence: `ModifyResource` `-1` on the pool (ordinal 0), then the\n effect.\n4. Whoever grants the capability (creation confirm, level-up apply) also\n **seeds the pool** from the resource definition's `initial_value` or\n its documented seed formula\n ([`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/classes/fighter.toml`\n(Second Wind; bundle_id, display names and default-valued fields omitted) and `…/base/classes/caster-features.toml` (Divine Spark\nspend + effect):\n\n```toml\n[[affordance_templates]]\ncapability_id = \"srd/class-feature/fighter/second-wind\" # what disclosure keys on\nniche_id = \"capability:srd/class-feature/fighter/second-wind\"\noutcome_template_id = \"srd/fighter/second-wind/outcome\"\npredicate_source = \"actor.stat('srd/fighter/second-wind-uses') >= 1\"\nspends_channel = \"srd/economy_channel/bonus\"\ntemplate_id = \"srd/fighter/second-wind/affordance\"\n\n[[niche_definitions]]\ndisplay_name = \"Use Second Wind (self)\"\nniche_id = \"capability:srd/class-feature/fighter/second-wind\"\npredicate_source = \"\"\nprovider = \"actor\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/cleric/divine-spark-heal/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\ndelta_source = \"-1\"\nresource = \"srd/cleric/channel-divinity-uses\"\n\n[[consequence_frame_writes]]\nordinal = 1\ntemplate_id = \"srd/cleric/divine-spark-heal/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"max(0, 1d8)\"\nresource = \"srd/hp\"\n```\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-class-features-actor-carried.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/caster-features-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/second-wind.ts`,\n `…/channel-divinity.test.ts`\n\n## Related\n\n[`resource-spend-with-option-menu`](./resource-spend-with-option-menu.md)\n(one pool, several spend options),\n[`extra-action-budget`](./extra-action-budget.md) (a feature that grants\nbudget instead of an effect),\n[`affordance-needs-niche-attachment`](../repairs/affordance-needs-niche-attachment.md),\n[`sibling-resource-predicate-seeds`](../repairs/sibling-resource-predicate-seeds.md).\n\n## Known misuse / anti-pattern\n\n- Do **not** stretch this pattern to Halfling Lucky nat-1 auto-reroll: the\n reaction can be actor-carried, but eligibility still cannot read die faces\n (`packages/spellkave-srd-cc/docs/substrate-verdicts/lucky-nat1-reroll.md`).\n- A `capability:*` niche without `provider`, or attached to a place.\n- Granting the capability at confirm but not seeding its uses.\n- Filing \"feature not offered in the tomb\" as an affordance-resolution\n bug.\n\n## SRD features that use this\n\n- Second Wind, Action Surge (charged by level-up), Rage, Channel Divinity\n (Divine Spark), Bardic Inspiration, Wild Shape uses, Lay On Hands, Innate\n Sorcery. Tables:\n [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md),\n [`character-creation.md`](../../../spellkave-srd-cc/docs/character-creation.md)\n § \"Where a class feature can then be used\".\n- Spread Caltrops, Spill Ball Bearings: not class features, but the same\n actor-provided niche (`capability:srd/action/utilize`). They spend the\n carried item instead of a use pool\n ([`equipment-catalogue.md`](../../../spellkave-srd-cc/docs/equipment-catalogue.md)\n § \"Area hazards\").\n"},{"id":"patterns/advancement-choice","title":"Advancement choice menus (choose-N metadata)","kind":"guide","summary":"I need a choose-N menu (fighting style, subclass, ASI-or-feat, expertise) that a DM dialogue can render without hardcoding the member list in TypeScript.","tags":["patterns","advancement","choice"],"body":"# Advancement choice menus (choose-N metadata)\n\n## Name\n\n`advancement-choice` — Advancement choice menus (choose-N metadata)\n\n## Problem\n\nI need a choose-N menu (fighting style, subclass, ASI-or-feat, expertise) that a DM dialogue can render without hardcoding the member list in TypeScript.\n\n## Forces\n\n- The world must behave identically without the metadata (ADR-0073 D-1):\n menus are DM-side facts, never server behavior.\n- One attachment row **per option member**, never one row per menu — the\n reader regroups by menu id, and the members stay individually\n addressable.\n- Every member must be a real `entity_definition`; live apply validates\n that the ref exists (`MF-APPLY-026`), so capability ids and prose-only\n slugs fail seed. The check is global (the world API),\n not \"same bundle\" — keeping members in the menu's bundle is a convention.\n- Menu-only options that are not already entities (a \"divine order\", a\n metamagic) need small option entity_definitions beside the rows.\n\n## Solution\n\nEmit one metadata attachment per member under a choice namespace with\n`target_kind = \"entity_definition\"` and a payload carrying the menu id, the\npick count and an optional recommended default:\n\n| Field | Required | Meaning |\n|---|---|---|\n| `class` / owner key | yes | whose advancement this is |\n| `level` | yes | level at which the menu opens |\n| `choice_group` | yes | stable menu id: `<bundle>/<class>/<level>/<slug>` |\n| `choose_n` | yes | how many members to pick |\n| `recommended` | no | member `target_ref` the source names as default |\n| `rechoose` | no | `\"none\"` (default) or a documented re-pick policy |\n| `grants_ref` | no (srd-cc always emits it) | the real entity the option grants when `target_ref` is an option wrapper (`srd-cc/src/chapters/classes/advancement-metadata-units.ts:518`). The DM duty document copies it per member as `memberGrantRefs`, checked against this row at publish (`crates/spellkave-validate/src/dm_reference_metadata.rs` `choice_groups_for`); the DM host sends it as the answer's reference so a client can show the granted feat, weapon or order. It is presentation only: no runtime reader grants from it |\n\nA sibling **grant** namespace (`(class, level) → one entity id`) carries the\nunconditional grants. A reader regroups choice rows by `choice_group`; the\ndialogue offers them as [`dialog-choice-slots`](./dialog-choice-slots.md)\nand applies the pick on confirm\n([`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)). Derive\nlarge member sets from tag membership\n([`tag-membership-menu`](./tag-membership-menu.md)), not hand lists.\n\n## TOML example\n\nCopied from\n`packages/spellkave-srd-cc/fixtures/base/classes/advancement-metadata.toml`:\n\n```toml\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/archery\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\nsource = \"manifest\"\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/archery\"\n\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/defense\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\nsource = \"manifest\"\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/defense\"\n```\n\n`target_ref` is a **unique per-menu wrapper** entity\n(`<bundle>/advancement-choice-option/<class>/<level>/<member-tail>`) and\n`grants_ref` names the real entity the option grants. Attachments upsert on\n`(target_kind, target_ref, namespace, bundle_id)`\n(the world API), so within one bundle two\nmenus naming the same real feat must not share it as `target_ref` — later seed rows would overwrite\nearlier ones and drop whole choose-N groups from the live catalog.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-data-advancement.test.ts`\n (reader regroups by `choice_group`)\n- `packages/spellkave-srd-cc/src/test/offline/metadata-target-ref-resolution.test.ts`\n (every member resolves to an entity_definition)\n- `packages/spellkave-srd-cc/src/test/offline/advancement-metadata-units.test.ts`\n\n## Related\n\n[`metadata-attachments`](../metadata-attachments.md) (row shape, namespace\nregistry), [`dialog-choice-slots`](./dialog-choice-slots.md),\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`tag-membership-menu`](./tag-membership-menu.md),\n[`resource-spend-with-option-menu`](./resource-spend-with-option-menu.md)\n(runtime spend menus are a different thing: live actions, not metadata).\n\n## Known misuse / anti-pattern\n\n- Hand-listing members in TypeScript (derive from the tag).\n- Putting eligibility in TypeScript — gate with server-evaluated DSL\n (`actor.stat('<level>')`, identity tags).\n- Treating a member as granted before draft → confirm.\n- Pointing `target_ref` at a capability id or a slug no entity carries.\n- Using the real feat/weapon entity as `target_ref` in more than one menu\n (upsert collision silently drops a group) — wrap per menu.\n- Authoring a menu for options that are not expressible as entities yet\n (leave the feature as identity until they are).\n\n## SRD features that use this\n\n- Fighting Style (L1 / Paladin-Ranger L2), subclass L3, ASI-or-feat L4 for\n all 12 classes, Divine/Primal Order, Expertise, Metamagic, Eldritch\n Invocations. The shipped menus and the ASI mechanics split:\n [`advancement-choice.md`](../../../spellkave-srd-cc/docs/advancement-choice.md),\n [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md).\n"},{"id":"patterns/advisory-action-cue","title":"Advisory action cue (rank and explain a visible action)","kind":"guide","summary":"Several actions can be factually visible at once. An author wants to make a natural next step easier to discover (for example, speaking to a person or taking a visible exit), but …","tags":["patterns","advisory","action","cue"],"body":"# Advisory action cue (rank and explain a visible action)\n\n## Name\n\n`advisory-action-cue` — public presentation metadata that makes one already\nvisible action easier to notice and understand, without changing what the\nworld permits.\n\n## Problem\n\nSeveral actions can be factually visible at once. An author wants to make a\nnatural next step easier to discover (for example, speaking to a person or\ntaking a visible exit), but must not turn a UI preference into an eligibility\nrule, a hidden target binding, or a dialogue answer contract.\n\n## Forces\n\n- An affordance remains an attempt: the reducer is authoritative about whether\n it succeeds.\n- A response to an open dialogue question needs the server-owned occurrence\n contract in [`prompt-occurrence`](./prompt-occurrence.md), not a ranking\n hint.\n- A public cue is visible to every client that can already see its action, so\n it cannot carry private state, an entity reference, a payload default, or\n `semantic_context`.\n- Different consumers may present the same fact differently. A human shell can\n show the hint; an NPC may use the rank only to break an exact policy tie.\n\n## Solution\n\nAttach `ui.affordance_cue` metadata to an `affordance_template` (by its\nexact `template_id`) and declare the namespace **public** — the SDK drops\ncue rows whose namespace is not public\n(`packages/spellkave-sdk/src/core/readers/affordance_cue.ts:47-53`). The\npayload has only optional bounded presentation fields:\n\n```toml\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\npayload_json = '{\"rank\":4,\"hint\":\"Speak directly to a visible person.\"}'\nsource = \"manifest\"\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/speak-to/affordance\" # the template_id, not the action id\n\n[[metadata_namespaces]]\naudience = \"public\"\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\n```\n\n`rank` is an integer from 0 through 9. It breaks an otherwise exact local\npresentation or policy tie only. `hint` explains the suggestion in human\nlanguage. Consumers ignore malformed or absent fields. The SDK joins the first\navailable cue from the action's already-authoritative template source and\nprojects it alongside the action; no reducer argument changes.\n\nAn open prompt occurrence always wins over a cue. The client sends\n`semantic_context` only when it selected a real prompt response; a cue never\ncreates it.\n\n## TOML example\n\nGenerated by\n`packages/spellkave-srd-cc/src/ui/affordance-cues.ts` into\n`packages/spellkave-srd-cc/fixtures/ui/affordance-cues.toml`. That generator\ncurrently attaches a speech cue and a movement cue to the SRD playing-the-game\ntemplates:\n\n```toml\n# pattern: advisory-action-cue\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\npayload_json = '{\"rank\":2,\"hint\":\"A visible exit can take you onward.\"}'\nsource = \"manifest\"\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/affordance/step\"\n```\n\n## Proof\n\n- `packages/spellkave-sdk/src/__tests__/readers.test.ts` proves a public\n attachment projects into `readManipulationContext(...).actions[].cue`.\n- `apps/play/src/lib/fact-composer.test.ts` proves prompt responses retain\n precedence over ranked ordinary actions.\n- The TypeScript explore scorer that proved an NPC uses rank only for an exact\n affordance-score tie was deleted with the TypeScript host (sk-jay0.1.55.60.8).\n\n## Related\n\n[`prompt-occurrence`](./prompt-occurrence.md) for private, authoritative\nquestion-response binding; [`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)\nfor why a visible action is never a promise of success.\n\n## Known misuse / anti-pattern\n\n- Putting `target_ref`, an entity id, a speech payload, or `semantic_context`\n in cue metadata. Those are an attempt's data, not a public presentation hint.\n- Raising `rank` to make an action eligible, or lowering it to hide one. The\n server and ordinary visibility rules remain authoritative.\n- Using a cue for \"the answer to this question.\" Author a prompt occurrence\n instead; only it captures the response set and addressee safely.\n\n## SRD features that use this\n\nThe playing-the-game speech and movement templates. Further authored examples\nmust be public action-level hints with the same bounded payload shape.\n"},{"id":"patterns/advisory-action-default","title":"Advisory Action Default","kind":"guide","summary":"Advisory Action Default","tags":["patterns","advisory","action","default"],"body":"# Advisory Action Default\n\nUse public `ui.affordance_defaults` metadata on one `affordance_template` to\npublish a bounded draft suggestion to clients. It is presentation data: it\nnever makes an action eligible, supplies reducer arguments, or replaces an\nADR-0142 prompt occurrence.\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/dodge/affordance\"\nnamespace = \"ui.affordance_defaults\"\npayload_json = '{\"version\":1,\"target\":{\"kind\":\"actor\"}}'\nbundle_id = \"srd\"\nsource = \"manifest\"\n\n[[metadata_namespaces]]\naudience = \"public\" # the SDK reader drops non-public rows\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_defaults\"\n```\n\nCopied from `packages/spellkave-srd-cc/fixtures/ui/affordance-defaults.toml`\n(generated by `src/ui/affordance-defaults.ts`); reader:\n`packages/spellkave-sdk/src/core/readers/affordance_defaults.ts`.\n\nThe payload has `version: 1` and may contain one `target` plus\n`input_values`. `target.kind = \"actor\"` means the caller's own disclosed body;\n`reference` requires an exact `target_ref` that remains visible to that caller.\nInput values must match the same template's `ui.affordance_input` schema and\nare scalar strings or numbers. Do not publish utterances, semantic context,\noccurrence ids, or values inferred from a place, a current speaker, or an\naction label.\n\nOne template owns one whole default. A client withholds duplicate or malformed\nattachments rather than choosing precedence. A player can always override a\nsuggestion with an explicit bound target or typed input. Prompt responses are\nnot meant to consume ordinary defaults; their source and response contract\nremain authoritative (design intent; no test asserts this yet).\n"},{"id":"patterns/before-filing-a-kernel-gap","title":"Before filing a kernel gap","kind":"guide","summary":"Three lanes filed Action Surge as a kernel gap although `extra-action-budget` existed; two filed \"concentration needs damage facts\" although condition hooks existed. Canon-warden …","tags":["patterns","before","filing","a","kernel","gap"],"body":"# Before filing a kernel gap\n\n## Name\n\n`before-filing-a-kernel-gap` — The checklist every lane runs before a substrate verdict\n\n## Problem\n\nThree lanes filed Action Surge as a kernel gap although `extra-action-budget`\nexisted; two filed \"concentration needs damage facts\" although condition\nhooks existed. Canon-warden runs are expensive; a wrong \"kernel\" label costs\na design note, a review, and a redesign.\n\n## Checklist\n\nIn order; stop at the first hit.\n\n1. **Catalog by problem** — [`index.md`](./index.md). Search the Problem\n column, not the mechanism names.\n2. **Grep `packages/spellkave-world-author/docs/repairs/`** for the\n verb/effect name. Involuntary / un-gated primitives often already live\n there (RelocateEntity lesson — forced move without a place_edge is a\n repair, not a missing r_move flag).\n3. **Prior verdicts** — `packages/spellkave-srd-cc/docs/substrate-verdicts/`:\n what was already tried, and with which exact refusal.\n4. **Event-driven seams you may have missed**: condition hooks\n (`condition-hook-on-event`), autonomy jobs / `fire_at_boundary`\n (`lingering-hazard-zone`, `rest-boundary-resource-refill`), host watches\n (`kill-xp-grant`, `quest-xp-grant`) for grants and narration.\n5. **A reaction window is never a forced rule.** In a turn-based session a\n window has no timeout and waits for `r_react` (ADR-0093 D-7), so a\n player who never answers keeps the benefit; forced rules belong in\n condition hooks.\n6. **Attempt it and keep the error.** A verdict needs the authored rows and\n the verbatim validator/runtime refusal (`MF-VAL-…`, `MF-DSL-…`,\n `UnknownField`), not a reading of the corpus.\n7. **Classify honestly** (K-A rule, 2026-08-22; worked use in\n `packages/spellkave-srd-cc/docs/substrate-verdicts/dispatch-args-kernel-design.md`\n §B): a kernel-prepopulated fact is\n outside K-1..K-5 only when it is a *pure projection of state the kernel\n already holds, carrying zero vocabulary the kernel had to invent*\n (`core/distance_to_actor_mm`, `core/resolution_roll_modifier`). Anything\n that bakes an id, prefix, radius, or condition into the kernel is a closed\n convention — worse than an enum because it is ungreppable — and must be a\n **parameterised leaf with authored arguments** (`peers_near_target`,\n `participant_tag_group_count`, `shares_tag`). \"No new enum arm\" is not a\n sufficient test.\n8. **Name it content-neutrally.** The kernel has no damage, ally, faction,\n spell or class; it has resources, tags, conditions, events, subjects.\n9. **Grep the populators before claiming a fact is unreadable.**\n `selection/entity_facts.rs` (`subject_capability_facts`) and\n `roll_bias.rs` (`manipulation_spatial_gate_facts`) are the two places a\n condition gate / outcome guard reads cross-party capabilities and distance.\n A silent `has_capability → false` is often a missing thread into one of\n those pools, not a missing DSL op — and `target.has_capability` never sees\n granted capabilities (`sk-jay0.2.48`).\n\n## Related\n\n`extra-action-budget`, `condition-hook-on-event`, `post-commit-hit-reaction`,\n`mastery-gated-attack-variant`.\n"},{"id":"patterns/blueprint-instance-override","title":"Blueprint instance with overrides (scenario spawn from a catalog definition)","kind":"guide","summary":"My scenario needs an NPC or encounter that \"is a Commoner\" / \"is a Goblin\" / \"is three wolves at the bridge\" — how do I place it without re-typing the stat block, and how do I cha…","tags":["patterns","blueprint","instance","override"],"body":"# Blueprint instance with overrides (scenario spawn from a catalog definition)\n\n## Name\n\n`blueprint-instance-override` — Instantiate a catalog blueprint; override per instance\n\n## Problem\n\nMy scenario needs an NPC or encounter that \"is a Commoner\" / \"is a Goblin\" / \"is three wolves at the bridge\" — how do I place it without re-typing the stat block, and how do I change one number or give one body a role?\n\n## Forces\n\n- A hand-copied local definition typically carries only AC and HP and\n silently drops ability scores, speed, the baked proficiency stat and the\n size / type / CR tags the blueprint ships.\n- There is **no definition inheritance**: `entity_definition_initial_state`\n is definition-level only (`lineage_id` exists but nothing reads it).\n- A role-granting tag on the shared definition would make every instance\n of it a trainer / a giver.\n- Cross-bundle references are legal only when the scenario declares\n `depends_on` on the catalog bundle; the closure check is `MF-VAL-214`\n (`crates/spellkave-validate/src/refs.rs:36-40,102`). (`MF-VAL-291` is a\n different warning: an id a bundle *defines* outside its own namespace.)\n\n## Solution\n\n1. Point the `entities` row's `entity_def_id` at the catalog blueprint\n (full cross-bundle id). Instance identity (`name`, `description`) stays\n on the scenario row.\n2. One changed fact on a named instance → an admission-time\n `[[object_state]]` row for that `(entity, state_id)`; it supersedes the\n definition seed (the seeded row is deleted before the explicit one is\n inserted).\n3. A role that only this body has → an instance `[[entity_tag]]` row.\n Target-niche derivation unions instance tags with definition tags, so\n `has_tag` / `has_niche` readers see it.\n4. Universal behavior comes with the definition's identity tags\n ([`identity-tag-capability-grant`](./identity-tag-capability-grant.md))\n — do not copy capabilities onto the instance; reserve instance\n capability rows for a narrower source (a DM's watch extent, party\n sight).\n5. A *different creature* (numbers that are not a catalog stat block)\n still gets its own definition.\n\nEncounters are the same pattern in bulk: N instances of catalog blueprints\nat a node, each with its behavior-selecting instance tag\n([`role-driven-brain`](./role-driven-brain.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/monsters/slime-scout.toml`\n(one HP override) and `…/cast/monsters/storyline-encounters.toml` (an\nencounter wolf with a role tag):\n\n```toml\n[[entities]]\nbundle_id = \"elven_mini\"\nentity_def_id = \"srd/creature/gray-ooze\"\nentity_key = \"elven_mini/adventure/npc/slime_scout_1\"\nkind = \"npc\"\nname = \"Slime Scout\"\nplace_node_id = \"elven_mini/tomb/hall\"\n\n[[object_state]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/npc/slime_scout_1\"\nsource_template_id = \"manifest\"\nstate_id = \"srd/hp\"\nvalue_bool = true\nvalue_int = 3 # definition seeds 22; tutorial pacing wants 3\n\n[[entities]]\nbundle_id = \"elven_mini\"\nentity_def_id = \"srd/creature/wolf\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nkind = \"npc\"\nname = \"Road Wolf 1\"\nplace_node_id = \"elven_mini/river_crossing/bridge_mid\"\n\n[[entity_tag]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nsource = \"manifest\"\ntag = \"srd.creature.role.skirmisher\"\n```\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-actor-capabilities-no-dup.test.ts`\n (instances do not duplicate the capabilities their definition seeds)\n- No test asserts an instance override (the slime's HP 3 over the\n definition's 22) directly; the fixture rows above are the evidence.\n- `packages/spellkave-srd-cc/src/test/offline/creature-roles.test.ts`\n\n## Related\n\n[`identity-tag-capability-grant`](./identity-tag-capability-grant.md),\n[`role-driven-brain`](./role-driven-brain.md),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md),\n[`manifest-format`](../manifest-format.md) (`entities`, `object_state`,\n`entity_tag`).\n\n## Known misuse / anti-pattern\n\n- A local `entity_definitions` row that re-types a catalog stat block.\n- Expecting a local definition to inherit a blueprint's seeds via\n `lineage_id`.\n- Tagging the shared definition with a scenario role.\n- Mirroring the blueprint's tag-derived capabilities onto the instance.\n- Forgetting `depends_on` and reading the resulting `MF-VAL-214` as a\n kernel limit.\n\n## SRD features that use this\n\n- Mira and Aldwin (`srd/creature/commoner`), the Crypt Warden (goblin\n warrior, XP override), the Slime Scout (gray ooze, HP 3), every §5\n storyline encounter. Worked verdicts:\n [`scenario-blueprints.md`](../../../spellkave-srd-cc/docs/scenario-blueprints.md).\n"},{"id":"patterns/bundle-movement-default","title":"Bundle movement default (walking with zero per-edge rows)","kind":"guide","summary":"I want every edge in my bundle's place graphs to be walkable with the standard step policy and reach budget, without authoring a `place_edge_affordance` row on each edge.","tags":["patterns","bundle","movement","default"],"body":"# Bundle movement default (walking with zero per-edge rows)\n\n## Name\n\n`bundle-movement-default` — One bundle-scoped movement default instead of per-edge affordance rows\n\n## Problem\n\nI want every edge in my bundle's place graphs to be walkable with the standard step policy and reach budget, without authoring a `place_edge_affordance` row on each edge.\n\n## Forces\n\n- Ordinary walking needs zero per-edge rows (ADR-0101 A-1); a row per edge\n is generated noise that hides the few edges that really differ.\n- The kernel never names a bundle's ids: it resolves the reach resource\n and the long-running move session through binding keys.\n- Resolution is per edge, EDGE > GRAPH > BUNDLE on the edge's own\n `bundle_id`; `depends_on` does **not** propagate a default, so a\n consuming bundle must declare its own row.\n- An edge with no resolvable default and no rows still fails closed\n (`MissingTraversalAffordance`).\n\n## Solution\n\nAuthor ONE `[[movement_defaults]]` row per bundle (`place_graph_id = \"\"`,\n`mode_id = \"\"`) naming the step affordance template plus both bindings:\n`movement_reach_resource` (the per-tick reach budget) and\n`long_running_move_session` (the clock-only Sequential session opened when\none hop exceeds that reach — empty scheduler on purpose, a clock not\ninitiative). Then:\n\n- an edge's own row on the **same** template *refines* it (edge wins per\n binding key, e.g. a longer edge's `movement_cost_cells`);\n- a row on **another** template *AND-joins* it (the locked-door idiom);\n- `place_edge.inherit_movement_default = false` *replaces* it outright (a\n fly-only edge owning its whole mode set).\n\nA consuming bundle that wants the same policy declares its own row naming\nthe same template and bindings. A combat-grid blueprint only chooses the\nexisting step policy for its generated cell edges; its geometry is the\nbattle-map part.\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/hamlet.manifest.toml`\n(consuming bundle re-declaring the `srd` policy):\n\n```toml\n[[movement_defaults]]\naffordance_template_id = \"srd/affordance/step\"\nbindings_json = '{\"movement_reach_resource\":\"srd/speed-walk\",\"long_running_move_session\":\"srd/long_running_move\"}'\nbundle_id = \"elven_mini\"\nmode_id = \"\"\nplace_graph_id = \"\"\n```\n\nThe `srd` bundle's own row lives in\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/grid.toml` beside\nthe `srd/combat-grid/standard-10x10` preset.\n\n## Proof\n\n- Kernel: the world API unit tests\n `zero_edge_rows_inherits_bundle_default` (`:263`) and\n `graph_default_beats_bundle_default` (`:340`).\n- Scoping (`selected_defaults`, `movement_modes.rs:145-165`): a\n graph-scoped default (non-empty `place_graph_id`) matches on the edge's\n graph from any bundle and replaces the whole bundle-scoped set; a\n bundle-scoped default (`place_graph_id = \"\"`) applies only to edges of\n its own `bundle_id`.\n\n## Related\n\n[`long-running-actions`](../long-running-actions.md),\n[`tool-reference`](../tool-reference.md) (`spellkave_set_movement_default`,\n`spellkave_bind_edge_affordance`),\n[`edge-traversal-resource-seed`](../repairs/edge-traversal-resource-seed.md),\n[`adjacent-moves-ungated`](../repairs/adjacent-moves-ungated.md).\n\n## Known misuse / anti-pattern\n\n- A generated `place_edge_affordance` row on every edge.\n- Expecting `depends_on` to inherit the upstream bundle's default.\n- Re-authoring an adventure-namespaced copy of a shared grid preset when\n the policy is identical.\n\n## SRD features that use this\n\n- `srd/affordance/step` + `srd/speed-walk` + `srd/long_running_move` for\n the standalone `srd` bundle and every elven-mini graph; the shared\n `srd/combat-grid/standard-10x10` preset. Layout residue:\n [`fixtures-layout.md`](../../../spellkave-srd-cc/docs/fixtures-layout.md).\n"},{"id":"patterns/companion-combat","title":"Companion combat seat","kind":"guide","summary":"A friendly companion should follow the hero out of combat, fight with a named combat role when a scene session opens, never target the hero, and optionally spend a healing consuma…","tags":["patterns","companion","combat"],"body":"# Companion combat seat\n\n## Name\n\n`companion-combat` — Companion follow + role fight + ally targeting\n\n## Problem\n\nA friendly companion should follow the hero out of combat, fight with a\nnamed combat role when a scene session opens, never target the hero, and\noptionally spend a healing consumable when the hero is bloodied.\n\n## Forces\n\n- Follow already exists as seat policy (`companion-follow`) with no pathfinding\n FrameWriteOp.\n- Combat roles are content-free data (`@spellkave/adventure-runtime/npc-kinds`), run by the Rust NPC host's kinds (`crates/spellkave-npc-host`; the TypeScript brains were deleted, sk-jay0.1.55.60.8).\n- Ally vs foe identity is host-owned (the brain must not invent factions).\n- Healing is \"if a matching heal affordance is offered for the ally\" —\n inventory is expressed by the palette, not a second inventory protocol\n inside the brain. **No SRD verb gives a consumable to another creature\n today:** `srd/consume` targets a potion the drinker carries and heals the\n drinker, so a heal dispatched at the ally never matches it. Caddoc, the\n rogue and Hesper still wire `srd/consume` as their heal id (so it lights up\n if an administer verb lands); until then their heal branch does not fire\n (`npcs/quests/hesper.ts:61-68`; tracked as `sk-jay0.1.23.35.7`). A heal\n that works today needs an ally-targeted verb such as\n `srd/spell/cure-wounds/cast`.\n- Speech lines (join / combat join) are app-owned.\n\n## Solution\n\n**This is the generic party companion mechanism** — not a single-NPC seat.\nTwo shipped shapes use it:\n\n- **Companion kind** (the Rust host's `companion` kind; formerly `createCompanionBrain`): Caddoc\n (`healer`) and Aldwin's rogue (`skirmisher`) — steps 1–6 below.\n- **Shared player runtime kit** (Hesper, sk-jay0.1.23.12): Hesper no longer\n has a brain of her own. She runs the host's shared player runtime (the TypeScript\n `buildPlayerRuntimeSeat` was deleted); the archer role brain is her combat-cycle\n `tacticalOverride` (hero never a target), and the join is a policy switch\n after which only a human `follow` order moves her. See the header of\n `packages/spellkave-adventure-elven-mini/npcs/quests/hesper.ts`.\n\nCompanion brain steps:\n\n1. **Join trigger** — idle until `isCompanion()` (quest terminal / story latch).\n2. **Out of session** → `createFollowBrain` toward the ally node.\n3. **In session, my turn** → `createCombatRoleBrain` with caller `role`\n (Caddoc = `healer`, Aldwin's rogue = `skirmisher`; `lurker` also exists)\n and a host snapshot whose **foes are hostiles to the hero** and **allies\n include the hero**. Hard-filter any *attack* whose `targetRef` is the\n protected ally (heal affordances on the ally remain legal).\n4. **Heal** — role `healer` heals the **lowest** ally below half HP when a\n heal action from `healActionIds` is offered **for that ally**, else\n attacks; any role may pass a `heal` overlay. See the Forces note: with\n `srd/consume` as the heal id this branch never fires today.\n5. **Session ends** → follow automatically (`inSession === false`).\n6. Optional join / combat-join / addressed Speak-To lines (app-owned).\n\nA later companion is **configuration only**: `{ role, isCompanion, speech,\nallyTargetRef, readAllyNodeId, readSelfNodeId, world, actions }` (plus the\noptional `heal` overlay) — no new brain module (sk-609b.15).\n\nStoryline slots (sk-609b.15): **Aldwin's rogue** (`skirmisher`) at hero L2;\n**Hesper** (`archer`) after Q6; **Caddoc** (`healer`) after Q10. See\n[`elven-mini-party.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-party.md).\n\n## TOML example\n\nNo special TOML — seat policy in TypeScript. Generator / seat wiring cites\nthe pattern:\n\n```ts\n// pattern: companion-combat\ncreateCompanionBrain({\n isCompanion: () => joined,\n role: \"archer\",\n allyTargetRef: heroRef,\n readAllyNodeId,\n readSelfNodeId,\n world: () => ({ self, foes: hostilesToHero, allies: [hero] }),\n actions: { rangedActionId: \"srd/attack/ranged\", meleeActionId: \"srd/attack/melee\" },\n // A heal verb whose TARGET is the ally. Not `srd/consume`: its target is a\n // potion the drinker carries and the effect lands on the drinker.\n heal: { actionIds: [\"srd/spell/cure-wounds/cast\"] },\n speech: { speakToActionId, traceKindId, joinLine, combatJoinLine },\n});\n```\n\n## Proof\n\n- Offline simulation: the Rust host's companion engine tests (`crates/spellkave-npc-host`).\n- Live representative: `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/party-mill-fight.test.ts` (companion seats in a real multi-NPC fight). The never-the-hero and follow-after-session claims are proven offline only, in the companion-brain test above\n\n## Related\n\n[companion-follow](./companion-follow.md),\n`combat-role-brains.md` (deleted with the TypeScript host),\n[dialog-choice-slots](./dialog-choice-slots.md).\n\n## Known misuse / anti-pattern\n\n- Listing the hero in `world().foes` and relying on luck.\n- Kernel RelocateEntity every tick to teleport-follow (same anti-pattern as\n companion-follow).\n- Hardcoding SRD potion / attack ids inside the host engine (pass them in as data).\n\n## SRD features that use this\n\n- **Aldwin's Blade** (rogue skirmisher, companion brain) after hero L2 dialog offer.\n- **Hesper of the Lodge** (archer, player-runtime kit) after Q6; fights in Q7 warren.\n- **Brother Caddoc** (healer, companion brain) after Q10 — heal branch\n inert until an administer verb exists (`sk-jay0.1.23.35.7`).\n"},{"id":"patterns/companion-follow","title":"Companion follow seat","kind":"guide","summary":"After a quest, an NPC should follow the hero along place-graph edges without a kernel pathfinding primitive.","tags":["patterns","companion","follow"],"body":"# Companion follow seat\n\n## Name\n\n`companion-follow` — Companion follow seat\n\n## Problem\n\nAfter a quest, an NPC should follow the hero along place-graph edges without a kernel pathfinding primitive.\n\n## Forces\n\n- No pathfinding `FrameWriteOp`: movement is ordinary traverse/move\n affordances the seat chooses.\n- Companion mode is a seat policy, not a condition.\n- Who decides *where* the companion goes is a design choice: the seat itself\n (autonomous follow) or the human leading the party (ordered follow).\n\n## Solution\n\nTwo shipped shapes.\n\n**Autonomous follow brain** (Caddoc, Aldwin's rogue): the Rust host's companion kind\n(formerly the TypeScript `createFollowBrain`, deleted with the TypeScript host), composed out of combat. On its turn it waits when\nco-located with the ally; otherwise it prefers a scene exit whose disclosed\ndestination mentions the ally node's local name or full id, else a stable\nfirst exit.\n\n**Ordered follow under a companion policy** (Hesper, sk-jay0.1.23.12): the\nNPC runs the host's shared player runtime (the TypeScript `buildPlayerRuntimeSeat` was deleted). The quest\nterminal installs a `CompanionPolicy` (`createTerminalCompanionPolicySwitch`,\nelven-mini `npcs/quests/terminal-companion.ts`); from then on strategic\ndirection belongs to the human, and only a live `follow` order moves her,\nrouted through the leader-location reader and the perceived map. The\nfollow brain's substring / first-exit fallback is not used on this path\n(`player-runtime-seat.ts:609-611`). The switch reads the durable terminal\nevery cycle, so a restarted seat re-installs the policy from the world.\n\nQuest context: [`elven-mini-quests.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-quests.md),\n[`elven-mini-party.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-party.md).\n\n## TOML example\n\nNo special TOML — seat policy in TypeScript:\n\n```ts\n// pattern: companion-follow\n// autonomous (Caddoc, rogue): createCompanionBrain composes createFollowBrain\ncreateFollowBrain({ readAllyNodeId, readSelfNodeId });\n// ordered (Hesper): the terminal installs a CompanionPolicy on the player\n// runtime; only a human `follow` command moves the companion.\n```\n\n## Proof\n\n- Autonomous: the Rust host's companion engine tests (`crates/spellkave-npc-host`).\n- Ordered: elven-mini `npcs/__tests__/hesper-companion.test.ts`,\n `companion-commands.test.ts`, `terminal-companion.test.ts`.\n\n## Related\n\n[companion-combat](./companion-combat.md) (follow + role fight + ally heal),\n[quest-xp-grant](./quest-xp-grant.md).\n\n## Known misuse / anti-pattern\n\n- Kernel `RelocateEntity` every tick to teleport-follow.\n- Soft-locking when no traverse edge exists and there is no wait fallback.\n- Copying the follow brain's name-substring exit choice into the ordered\n path — the player runtime retired it there on purpose\n (`player-runtime-seat.ts:609-611`).\n\n## SRD features that use this\n\n- **Hesper of the Lodge** after Q6 (ordered follow, first sk-ruh companion slot).\n- **Brother Caddoc** after Q10 and **Aldwin's Blade** at hero L2 (autonomous follow brain).\n"},{"id":"patterns/computed-literal","title":"Computed-literal delta_source compositions","kind":"guide","summary":"I need to write a resource delta whose magnitude was computed outside the DSL (NPC host read another entity, TS chose N XP, etc.).","tags":["patterns","computed","literal"],"body":"# Computed-literal delta_source compositions\n\n## Name\n\n`computed-literal` — Computed-literal delta_source compositions\n\n## Problem\n\nI need to write a resource delta whose magnitude was computed outside the DSL (NPC host read another entity, TS chose N XP, etc.).\n\n## Forces\n\n- A frame-write formula can read its acting entity and its modified target,\n but cannot use that target binding to read an arbitrary third entity.\n- A literal fixes the authored amount; it does not track later live variance.\n- Live caller-selected amounts should use an admitted dispatch argument when\n the action already supports one.\n\n## Solution\n\nFor a build-time constant, compute the integer in the generator and author\n`delta_source = \"<N>\"` on the relevant `ModifyResource`. This is an ordinary\nDSL literal, not a new primitive.\n\nFor the current DM XP watches, keep the action definition fixed and supply\n`quantity` at dispatch. The award write reads\n`actor.stat('core/dispatch_arg_quantity')`; see\n[`kill-xp-grant`](./kill-xp-grant.md) and\n[`quest-xp-grant`](./quest-xp-grant.md). Their production hosts no longer\nrender an action definition or apply a manifest for each reward.\n\n## TOML example\n\nA schematic generator-produced constant write:\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"example/reward\"\ndelta_source = \"100\"\n```\n\nLegacy XP renderer exports can still compose publisher-authored scenes with\nliteral numeric entity references. Such compatibility composition does not\nestablish the production DM's per-play write authority.\n\n## Proof\n\n`packages/spellkave-srd-cc/src/chapters/spells/spell-behaviors.ts`\n(`aoeSpellSaveDcLiteral`) is a generator-owned computed constant.\nCurrent live XP behavior is proved by the live tests linked in the XP patterns.\n\n## Related\n\n[`derived-value-mechanism`](./derived-value-mechanism.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`quest-xp-grant`](./quest-xp-grant.md).\n\n## Known misuse / anti-pattern\n\n- Reading a corpse as `target` inside a write whose target is the killer.\n- Substituting a baked constant for a promised live-derived amount.\n- Publishing a per-play action solely to embed a quantity supported as an argument.\n\n## SRD features that use this\n\n- Spell upcast dice authored for each `SpellCastingOption` slot level.\n- AoE save DC: per-victim bodies rebind Actor, so `aoeSpellSaveDcLiteral`\n emits 13 from default proficiency 2 and casting modifier 3. This is the\n documented default-caster limitation, not a live caster-stat calculation.\n"},{"id":"patterns/condition-grant-and-suppression","title":"Condition capability grant and suppression","kind":"guide","summary":"While a condition holds I need to grant or remove an ability to act (a capability), not just a fact a predicate might forget to read.","tags":["patterns","condition","grant","and","suppression"],"body":"# Condition capability grant and suppression\n\n## Name\n\n`condition-grant-and-suppression` — Condition capability grant and suppression\n\n## Problem\n\nWhile a condition holds I need to grant or remove an ability to act (a capability), not just a fact a predicate might forget to read.\n\n## Forces\n\n- Affordance admission is structural on `capability_id` — status facts alone leave silent holes.\n- Suppression must apply to the actor's own attempts, never make them an illegal target.\n- Suppression wins over grant when both are active.\n\n## Solution\n\nSet `grants_capability_while_active` / `suppresses_capability_while_active` on\n`[[condition_definitions]]`. Enforced in `capability_ids_for_actor` (same fold\nas identity-tag grants and `entity_definitions.grants_capability_while_equipped`;\nsuppression still wins). Full repair:\n[`repairs/condition-capability-grant-and-suppression.md`](../repairs/condition-capability-grant-and-suppression.md).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/conditions.toml`\n(Dead suppresses, Unconscious grants; descriptions and default-valued fields\nomitted):\n\n```toml\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/dead\"\ndisplay_name = \"Dead\"\ngate_predicate_source = \"\" # required field, may be empty\nimplies = [\"srd/condition/incapacitated\"]\nsuppresses_capability_while_active = [\n \"srd/action/attack\",\n \"srd/capability/walk\",\n \"srd/capability/death_save\",\n # … dodge, help, drop-prone, short-rest, long-rest\n]\n\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/unconscious\"\ndisplay_name = \"Unconscious\"\ngate_predicate_source = \"\"\ngrants_capability_while_active = [\"srd/capability/death_save\"]\n```\n\n## Proof\n\n- Kernel fold unit tests in\n the world API:\n `suppression_removes_the_capability_from_the_actor_set`,\n `a_grant_adds_a_capability_the_body_does_not_own`,\n `suppression_beats_a_grant_of_the_same_capability` (`:1295-1332`).\n- The fold applies to the **actor** subject only; `target.has_capability`\n reads raw capability rows (`entity_facts.rs:185-201` vs `:346-351`; decision\n `sk-jay0.2.48`).\n- Repair doc: [`repairs/condition-capability-grant-and-suppression.md`](../repairs/condition-capability-grant-and-suppression.md).\n\n## Explain the condition to its holder\n\nSet `condition_definitions.description` to a plain-text explanation. Manifest\napplication persists that prose on the `condition_definition_description`\nsatellite (the catalog `condition_definition` row stays binary-compatible).\nAn empty or omitted description deletes the satellite row. Granular condition\nupdate preserves existing prose.\nThe text does not grant or suppress capabilities: those effects still come\nfrom the fields above. Authorized PLAYER condition detail returns nonblank\nprose for the holder's existing instances; missing prose stays absent.\nThe compact self summary retains its existing condition fields.\n\nPersistence and authorized-read proof:\n[`condition-descriptions.md`](https://github.com/b4arena/spellkave/blob/33eb5f1c0f4913a56fb38f8c9580db112b1dd87e/openspec/specs/player-tool-query-surface/demos/condition-descriptions.md)\n(historical captured evidence at the linked revision).\n\n## Related\n\n[extra-action-budget](./extra-action-budget.md) (channel FlatSet vs capability suppress), [action-economy](../action-economy.md), [identity-tag-capability-grant](./identity-tag-capability-grant.md) (the other grant sources in the same fold), [equip-gated-modifier](./equip-gated-modifier.md) (numeric bonus while equipped — not a capability).\n\n## Known misuse / anti-pattern\n\n- **Applying a condition with no way out.** `ApplyStatus` takes an optional\n `expires_at_boundary` (`{ boundary_id, owner_actor }`, worked example in\n [`action-economy.md`](../action-economy.md)); omit it and the condition\n persists until something explicitly removes it. That is correct for a\n condition its subject can end, and a trap for one it cannot. Elven-mini\n shipped a Prone that lasted forever — inflictable on a player by a monster,\n via the Topple weapon-mastery rider, with no save and no Stand Up authored\n (`sk-0m4.120.50`). Before authoring a condition, name the thing that ends\n it; if the answer is \"an action nobody has built yet\", give it a boundary.\n Note the two generated references do not show this field: `dsl-grammar.md`\n documents the DSL operator (which genuinely has only `subject` and\n `condition_definition_id`) and says in its own text that the manifest row\n is a different, structured shape.\n\n\nModelling a ring-granted spell as ApplyStatus + predicate, or as\n`grants_capability_while_active` on a condition — put it on the item's\n`grants_capability_while_equipped` CSV. Using suppression to block being\ntargeted (Speak with Dead must still work on a corpse).\n\n## SRD features that use this\n\n- **Dead** suppresses attack, dodge, help, drop-prone, rests, walk and death\n saves (`conditions.toml:100-122`).\n- **Unconscious** grants `srd/capability/death_save` (`conditions.toml:130`).\n- **See Invisibility** grants `srd/capability/see_invisibility`\n (`perception-conditions.toml:151`).\n- Not this pattern: Bless / Bane / Guidance / Resistance are roll modifiers\n (`condition_roll_mod`), and Hold Person is a primary-channel FlatSet\n ([extra-action-budget](./extra-action-budget.md)).\n- Incapacitated suppresses nothing yet (`conditions.toml:98`); speechless\n gating is not authored.\n- Worn items that grant a spell belong on `grants_capability_while_equipped`, not this pattern.\n"},{"id":"patterns/condition-hook-on-event","title":"Condition hook on event (auto-resolving, per holder)","kind":"guide","summary":"\"While I am concentrating, any damage forces a CON save.\" \"While raging, the first hit each turn adds dice.\" \"When I would drop to 0 HP, drop to 1 instead.\" The rule must fire by …","tags":["patterns","condition","hook","on","event"],"body":"# Condition hook on event (auto-resolving, per holder)\n\n## Name\n\n`condition-hook-on-event` — A condition reacts to a typed world event on its own holder, without a player-accepted window\n\n## Problem\n\n\"While I am concentrating, any damage forces a CON save.\" \"While raging, the\nfirst hit each turn adds dice.\" \"When I would drop to 0 HP, drop to 1\ninstead.\" The rule must fire by itself when something happens *to the\nholder*, with no reaction window to accept or decline. (Plain expiry — \"end\non a long rest\", \"clear at turn start\" — is not this pattern: use the\ncondition's `expires_at_boundary`.)\n\n## Forces\n\n- A reaction window (`post-commit-hit-reaction`) is **optional by design**:\n ADR-0093 D-7 turn-bound windows have no timeout, so \"never answer\" is a\n legal outcome. A forced save modelled as a window can be kept forever by\n silence — wrong rule, wrong canon.\n- Condition hooks already exist: `condition_definition.hooks` run on **every**\n typed event (the world API `record_event_typed`), iterate\n only the **active** `target_condition` rows, and run one side effect:\n `invoke_outcome_graph(...)` (see the next bullets).\n- `Layer2.ResourceDelta` hooks see `resource_id`/`template_id` (Text) and\n `entity_id`/`delta`/`new_value` (Int). Kernel opening K-B (2026-08-22,\n ADR-0106) made those Int facts readable, registered the newer event kinds\n for the validator, exposed the holder's own entity id as\n `target.stat('core/entity_id')`, and fixed the side-effect payload so hook\n consequences actually execute on the holder.\n- A hook cannot write `RemoveCondition` inline: the one side-effect op that\n **executes** inside a hook is `invoke_outcome_graph('<consequence_template_id>')`,\n which resolves to a **consequence template** (the name is historical) whose\n own `RemoveCondition`/`ModifyResource` frame writes run with the holder\n bound as Actor/TargetActor. `modify_resource`/`apply_status`/`emit_trace`,\n `OutcomeSequence` and `Arbitrate` parse but are recorded as explicit skips\n (`ConditionHookSkippedSideEffect`), never silent\n (the world API).\n\n## Solution\n\nPut the rule on the condition, keyed by the event kind that should trigger it:\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/spells/casting.toml`\n(description trimmed):\n\n```toml\n# pattern: condition-hook-on-event\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/concentrating\"\ndisplay_name = \"Concentrating\"\ngate_predicate_source = \"1 == 1\"\nremove_time_policy = \"srd/remove_policy/independent_lifetime\"\nstacking_rule = \"srd/stacking/single\"\n\n[[condition_definitions.hooks]]\ndetail_filter_source = \"$event.detail.entity_id == target.stat('core/entity_id') && $event.detail.resource_id == 'srd/hp' && $event.detail.delta < 0\"\nevent_kind = \"Layer2.ResourceDelta\"\nexpression_source = \"invoke_outcome_graph('srd/concentration/check')\"\n# `srd/concentration/check` is a consequence_template with one bare\n# RemoveCondition frame write. As shipped there is NO save — see below.\n```\n\nThe hook row accepts exactly `event_kind`, `detail_filter_source` and\n`expression_source` (unknown keys are rejected;\n`crates/spellkave-schema/src/lib.rs:2425-2440`). Field semantics:\n[`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md)\n§\"Reacting to events with condition hooks\".\n\n### Residual: DC cannot use `$event.detail.delta` inside the consequence\n\nAttempted (content, sk-609b.12.2): put the SRD DC\n`max(10, (0 - $event.detail.delta) / 2)` on the **consequence template's**\n`ForEachActorInRadius.predicate_source` (where the CON save must run, because\nhook evaluation facts do not carry ability scores — only event detail +\nholder `core/entity_id`). **Refused:** `$event.detail.*` is only in scope for\nhook `detail_filter_source` / `expression_source`. The consequence path binds\nActor/TargetActor via `apply_consequence_with_bindings` with\n`FrameBindingContext::literal_only()` and no event context\n(`condition_definition.rs` Phase B).\n\n**Shipped content: no save at all.** The filter has no die roll and the\ntemplate only removes the condition, so any HP loss the holder did not cause\nends concentration (`casting.toml:62-80`; bug `sk-jay0.3.12.1`). The\ngenerator comment, the template description (\"failed CON save DC 10\") and\nthe live-test header claim a DC 10 save that does not exist. The live proof\n`packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/condition-hooks.ts`\n(other-caused −7 HP) asserts only that the condition drops. A fixed DC 10\nwould equal `max(10, half damage)` for every hit dealing less than 22\ndamage.\n\n## Proof\n\n- Kernel demos (K-B): `openspec/specs/world-interaction-kernel/demos/sk-609b-kb-condition-hooks.demo.md`\n — other-caused HP loss removes the holder's condition via the template's\n `RemoveCondition`, a self-caused spend does not fire, a second\n concentrating creature is untouched; `sk-609b-kb-reentrancy-bound.demo.md`\n — an authored A↔B hook cycle stops at depth 3 with the reducer still `ok`.\n- Authoring reference: `interaction-dsl-and-world-authoring.md` §\"Reacting to\n events with condition hooks\".\n- Content: `packages/spellkave-srd-cc` concentration (`srd/condition/concentrating`),\n Deflect Attacks (`srd/condition/deflect-ready`), Relentless Endurance\n (`srd/condition/relentless-endurance-ready`) — sk-609b.12.2.\n\n## Used by\n\nThe srd-cc base content ships six hooks: Concentration\n(`spells/casting.toml`), Deflect Attacks mitigation (`classes/monk.toml`),\nRelentless Endurance 0-HP intercept (`character-origins/traits.toml`), the\nUnconscious condition (`playing-the-game/conditions.toml`), Barkskin and Shield of\nFaith (`spells/level-2/barkskin.toml`, `spells/level-1/shield-of-faith.toml`). The Frenzy marker and\nrest-expiry of blessings use `expires_at_boundary`, not hooks.\n\n## Related\n\n`post-commit-hit-reaction` (optional, player-accepted — use for choices, not\nforced rules), `rest-boundary-resource-refill`, `condition-grant-and-suppression`.\n\n## Residual: hook-invoked consequences lack spatial bindings\n\nK-B Part A4 binds Actor/TargetActor **entity** refs only\n(`FrameBindingContext { actor_ref, target_entity_ref, ..literal_only() }`).\n`ActorSpatialRef` / `TargetSpatialRef` are absent, so\n`ForEachActorInRadius` centers fail with `missing …SpatialRef binding`.\nUse **bare** `RemoveCondition` / `ModifyResource` frame writes (target_ref\n`Actor`), and put dice gates on the hook `detail_filter_source` (which can\nroll `d20` and read `$event.detail.*` + `target.stat('core/entity_id')` +\nstatuses — **not** ability scores or other resources).\n\nA flat save could therefore sit on the filter (e.g. `d20 >= 10`, DC 10, no\nmodifier); the CON modifier stays residual until hook facts gain ability\nscores or bindings gain spatial refs. Concentration does not ship even the\nflat save today (see above). That the filter can roll is inferred from the\nrng the hook evaluator receives\n(`condition_definition.rs:937`); no test asserts a d20 filter yet.\n\n## Misuse\n\n- Filing \"the kernel cannot see damage\" as a substrate gap: the kernel has no\n damage concept; it has `ResourceDelta` events and condition hooks. Two\n lanes and one lead filed this in 2026-08 before reading\n `condition_definition.hooks`.\n- Modelling a forced save as a reaction window.\n- Host-side watches (`kill-xp-grant` shape) for rules that must be atomic\n with the hit — those are for grants and narration, not for saves.\n- Expecting `$event.detail.delta` inside the **consequence template** the hook\n invokes: event detail is available on the hook gate/expression only. Put\n the CON save (or any delta-dependent gate) in `detail_filter_source` when\n ability scores are not required; put ability-score saves in the template\n with a baked DC when scores are required (DC 10 equals the SRD DC for\n damage below 22).\n- Expecting `Layer2.TurnStart` hooks to see `actor_id` today — the kind is\n registered but detail fields are not wired into hook evaluation; prefer\n `expires_at_boundary: turn_start` for per-turn counters.\n"},{"id":"patterns/consumable-inventory-consume","title":"Consumable inventory consume","kind":"guide","summary":"A stackable inventory item (potion, scroll dose) must apply its own effect to the carrier and remove one unit from the stack when used, and must fail cleanly when the carrier does…","tags":["patterns","consumable","inventory","consume"],"body":"# Consumable inventory consume\n\n## Name\n\n`consumable-inventory-consume` — Drink/use a carried stackable item through\none world verb whose target is the item\n\n## Problem\n\nA stackable inventory item (potion, scroll dose) must apply its own effect to\nthe carrier and remove one unit from the stack when used, and must fail\ncleanly when the carrier does not hold it. A creature should see ONE \"use a\nconsumable\" action, with exactly the consumables it carries as targets — not\none verb per item that every creature sees whether or not it holds the item.\n\n## Forces\n\n- The kernel binds a consequence to the ACTION, not to the affordance\n template: `r_manipulate` applies `action_definitions.on_success`\n (the world API). Several\n templates that share one action therefore share its consequence.\n- An outcome template may carry BOTH `manipulation_action_id` and an\n `outcome_expression_source`: `commit_resolved_manipulation` applies the\n action's frame first, then executes the selected template's outcome\n expression with the same binding context (`execute_outcome_expression`).\n An `invoke_outcome_graph(...)` there is the per-template effect seam; a\n graph node's outcome template carries its own `consequence_template_id`.\n- `RemoveItem { source: TargetItem }` removes from the dispatch target\n (`r_apply_consequence/remove_item.rs`); removing the last unit deletes the\n entity ([remove-item-deletes-stack](../repairs/remove-item-deletes-stack.md)).\n- When the item is spent on something ELSE (a key used on a seal, the target\n being the seal), remove it with\n `RemoveItem { source: { ActorInventoryItem: { actor_ref: \"Actor\", item_def_id } } }`\n instead: its prevalidate rejects the attempt atomically when the actor holds\n none, so that verb needs no separate possession check (elven-mini's\n `author/tomb-key.ts`).\n- The kernel derives target niches for an item, among them its\n `entity_def_id`, its home state (`core/owned`, `core/contained`,\n `core/grounded`), its tags and `on_consume:`/`on_destroy:` facts\n (the world API). A carried item is\n therefore a `core/owned` target the carrier's manipulation context lists.\n- For a carried target item, `r_manipulate` re-checks the template predicate\n (`revalidate_item_source`) against a NARROWER niche set: `item:<id>` and the\n item's `entity_def_id` only, no home state and no tags. A template predicate\n that reads `core/owned` or a tag fails there (`stale_item_source` /\n `predicate-fail`, measured live in sk-jay0.1.23.36.22.17). Put those facts on\n the niche, not on the template predicate.\n- A gate that KEEPS the item is a different job: put\n `actor.has_item('<item_def_id>')` on the affordance predicate. The DSL\n `items` pool carries the acting body's directly-carried items since sk-vjh.7\n (proof anchor: the `manipulation_facts_expose_carried_items_to_has_item`\n unit test in `r_manipulate/selection/candidates.rs`); see\n [has-item-dead-in-manipulate](../repairs/has-item-dead-in-manipulate.md) for\n the retired gotcha.\n- SRD potions are Bonus Actions; heal magnitude is dice (`2d4 + 2`).\n\n## Solution\n\n1. Stackable `entity_definitions` for each consumable (`stackable = true`),\n tagged with a consumable tag (srd-cc: `srd.consumable`). Only items that own\n a template carry the tag, so the niche never offers a target no template\n resolves.\n2. ONE target niche with `provider = \"entity\"`: the consumable tag AND\n `core/owned` (srd-cc: `srd/consumable`,\n `target.has_niche('srd.consumable') && target.has_niche('core/owned')`).\n3. ONE action (`spellkave_define_action`, no affordance of its own):\n `self_only = false`, `self_eligible = false`, and `on_success` a shared\n consequence `RemoveItem { count: 1, source: { TargetItem: {} } }`. srd-cc\n sets `required_capability = <bundle>/action/consume`, granted from the\n creature identity tag\n ([identity-tag-capability-grant](./identity-tag-capability-grant.md)).\n `required_capability` does not decide who sees or may use the verb: it is\n checked only when a sender acts through an actor it is not directly bound\n to (the world API).\n4. Per consumable, ONE affordance template on that niche. Its\n `capability_id` is what disclosure keys on — the materialiser offers only\n templates whose `capability_id` the actor holds\n (`affordance_materialiser/mod.rs:76-78`; an empty one is never offered,\n sk-jay0.1.23.36.22.10). Its `spends_channel = <bundle>/economy_channel/bonus`\n makes the drink a Bonus Action: `r_manipulate` meters the template's\n channel (`r_manipulate/mod.rs:556-575`); an action-level `spends_channel`\n meters only `r_react` reactions. Its predicate re-checks the capability,\n because act-time selection does not enforce `capability_id`\n (`sk-jay0.2.46`), and selects the item definition as target\n (`actor.has_capability('<cap>') && target.has_niche('<item_def_id>')`).\n Its outcome template names the shared action AND\n `invoke_outcome_graph('<item>/consume/graph')`. The graph is one terminal\n node whose outcome template carries the item's effect consequence (e.g.\n `ModifyResource` or `ApplyStatus` on `Actor`). The item's\n `on_consume_consequence_id` may name that effect consequence, but the\n kernel only exposes it as an `on_consume:<id>` niche fact\n (`target_niches.rs:132-138`); it never applies it.\n5. Pattern refs in generator + TOML (`// pattern:` / `# pattern:`).\n\nsrd-cc authoring: `playing-the-game/fragments/consume.ts` owns the action,\nniche and shared consequence; `consumeTemplateCalls` adds one template per\nconsumable beside its definition (magic-items). The graph + node pair is\nwritten through verb-runner's `outcomeGraphRowsCall`, the finding #66\nworkaround: `spellkave_write_rows` cannot write a bare graph and its nodes\natomically (`sk-jay0.7.172`). `spellkave_define_behavior` with the\nOutcomeGraph primitive writes a graph with its nodes only for a new action\nit creates itself, so an author outside srd-cc cannot build this pattern\nwith the public verbs today; write the rows as manifest TOML instead.\n\n## TOML example\n\nFrom `packages/spellkave-srd-cc/fixtures/base/playing-the-game/consume.toml`\nand `fixtures/base/magic-items/consumables-potion-of-healing.toml` (generated),\ntrimmed (bundle_id, display names and descriptions omitted):\n\n```toml\n# pattern: consumable-inventory-consume\n[[action_definitions]]\naction_id = \"srd/consume\"\non_success = \"srd/consume/success\" # RemoveItem TargetItem, count 1\nrequired_capability = \"srd/action/consume\"\nself_eligible = false\nself_only = false\nspends_channel = \"srd/economy_channel/bonus\" # meters r_react only; the template's channel meters the drink\n\n[[niche_definitions]]\nniche_id = \"srd/consumable\"\npredicate_source = \"target.has_niche('srd.consumable') && target.has_niche('core/owned')\"\nprovider = \"entity\"\n\n[[affordance_templates]]\ntemplate_id = \"srd/item/potion-of-healing/consume/affordance\"\nniche_id = \"srd/consumable\"\ncapability_id = \"srd/action/consume\"\npredicate_source = \"actor.has_capability('srd/action/consume') && target.has_niche('srd/item/potion-of-healing')\"\noutcome_template_id = \"srd/item/potion-of-healing/consume/outcome\"\nspends_channel = \"srd/economy_channel/bonus\" # the channel r_manipulate meters\n\n[[outcome_templates]]\noutcome_template_id = \"srd/item/potion-of-healing/consume/outcome\"\nmanipulation_action_id = \"srd/consume\"\noutcome_expression_source = \"invoke_outcome_graph('srd/item/potion-of-healing/consume/graph')\"\n\n[[outcome_templates]]\noutcome_template_id = \"srd/item/potion-of-healing/consume/effect\"\nconsequence_template_id = \"srd/item/potion-of-healing/consume/success\" # ModifyResource Actor srd/hp \"2d4 + 2\"\n\n[[outcome_graphs]]\noutcome_graph_id = \"srd/item/potion-of-healing/consume/graph\"\nmax_depth = 1\nmax_draws = 8\nmax_nodes = 1\n\n[[outcome_graph_nodes]]\noutcome_graph_id = \"srd/item/potion-of-healing/consume/graph\"\noutcome_graph_node_id = \"srd/item/potion-of-healing/consume/graph/effect\"\nnode_id = \"effect\"\noutcome_template_id = \"srd/item/potion-of-healing/consume/effect\"\nauthored_order = 0\nterminal = true\n```\n\nThe templates share action and niche with mutually exclusive predicates, so\n`MF-VAL-243` warns once per group (accepted in srd-cc's `pipeline.test.ts`).\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/magic-items-coverage.test.ts`\n (potion-of-healing consume unit).\n- Live: `q4-fanatic-loot.test.ts` (one `srd/consume` row disclosed, the held\n potion as its target, HP rises, the last dose is deleted) and\n `potions-and-recharge.test.ts` (condition applied), both when\n `SPELLKAVE_LOCAL_NODE=1`.\n\n## Related\n\n[has-item-dead-in-manipulate](../repairs/has-item-dead-in-manipulate.md),\n[remove-item-deletes-stack](../repairs/remove-item-deletes-stack.md),\n[loot-table-drop](./loot-table-drop.md),\n[container-with-loot](./container-with-loot.md).\n\n## Known misuse / anti-pattern\n\n- One self-only verb per consumable. Every creature sees every verb whether\n or not it carries the item, and a brain or player cannot tell from the\n context which consumable it holds. This package retired that shape in\n sk-jay0.1.23.36.22.17.\n- Putting the item effect on the shared action's consequence: every template\n would apply the same effect.\n- Reading `core/owned` or a tag in the template predicate: the carried-item\n revalidation does not see those facts and rejects the dispatch.\n- Adding `RemoveItem` to an action that should LEAVE the item with the actor,\n as a stand-in for a possession check. Gate that on the predicate with\n `actor.has_item(...)` instead.\n- Asserting `quantity == 0` after the last dose — the row is deleted.\n- Leaving the template's `capability_id` empty to mean \"anyone may drink\" —\n the materialiser then offers it to nobody, while a direct dispatch that\n passes the predicate still works.\n- Putting `spends_channel` only on the action: the drink is then unmetered.\n\n## SRD features that use this\n\n- `srd/consume` with one template per consumable (sk-jay0.1.23.36.22.17):\n Potion of Healing, all 4 tiers (`srd/item/potion-of-healing*`); Potion of\n Giant Strength (`srd/item/potion-of-giant-strength`); the expressible SRD\n potions (`srd/magic_item/potion-*`: climbing, heroism, resistance, speed,\n water breathing).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`): a\n targeted verb whose target is a creature; both the hit and the miss branch\n remove one item from inventory.\n- Spread Caltrops, Spill Ball Bearings (`srd/item/caltrops/spread`,\n `srd/item/ball-bearings/spill`): a self-only Utilize verb removes one item\n and schedules a `lingering-hazard-zone` pulse.\n"},{"id":"patterns/container-with-loot","title":"Container with loot","kind":"guide","summary":"A room needs a container (chest, cache, shelf) that visibly holds items a player can take, with no bespoke \"search\" or \"open\" action authored per adventure — reusing the SRD's own…","tags":["patterns","container","with","loot"],"body":"# Container with loot\n\n## Name\n\n`container-with-loot` — Place a container holding items; players take them out\n\n## Problem\n\nA room needs a container (chest, cache, shelf) that visibly holds items a\nplayer can take, with no bespoke \"search\" or \"open\" action authored per\nadventure — reusing the SRD's own generic pickup verb instead.\n\n## Forces\n\n- The SRD already grants every creature a Pick Up action for a loose item on\n the ground OR loose inside a grounded, non-body container (`srd/pickup`,\n SRD 5.2.1 \"Interacting with Objects\" / \"Time-Limited Object Interactions\",\n `packages/spellkave-srd-cc/src/chapters/playing-the-game/fragments/\n pickup.ts`) — authoring a second, adventure-local \"search the chest\" verb\n duplicates a capability the kernel already discloses generically.\n- The kernel derives a contained item's disclosure home (`core/contained`,\n the world API) from the item's own\n `entity_containment` row — no niche, predicate, or action needs authoring\n on the container OR the item for this to work; the container only needs to\n actually CONTAIN the item.\n- An open, lootable container is loose carriage, not a machine port:\n `slot_id`/`direction` stay empty on the `entity_containment` row (an open\n chest is not a socketed part).\n- A per-actor one-shot search gate (the retired \"faucet\" design, superseded\n by this pattern and never merged; PR #3618 shipped the rebuild) forges a fresh item out of nothing\n instead of moving an authored one, and needs an explicit per-actor\n `object_state` seed row for every body the search must work for — which\n itself risks two traps: `actor.stat(<state>)` on a resource with no seeded\n `object_state` row is `UnknownField`, which fails the WHOLE containing\n predicate closed rather than reading the resource's `initial_value`\n (FAIL-CLOSED PRE-SEEDING, `creation-candidate.ts`'s own header note); and a\n placement's own `resources` param clears and reseeds `object_state`, so\n seeding the gate BEFORE the body's own placement silently wipes the seed.\n A gate authored only for the creation candidate also strands every OTHER\n player body, since the gate is per-actor but seeded for exactly one actor\n (sk-jay0.1.23.36.22.3, closed as obsolete once this pattern replaced the\n faucet). None of that machinery is needed here.\n\n## Solution\n\n1. An entity def for the container — the SRD's own `srd/item/chest`\n (`packages/spellkave-srd-cc/fixtures/base/equipment/gear/chest.toml`, tag\n `srd.item.container`) or any other entity def — placed with\n `spellkave_place_entity`. A cross-bundle entity_def reference is legal\n when the defining bundle is in your `depends_on` closure (e.g.\n `depends_on = [\"srd\"]`; the closure check is `MF-VAL-214`); no local\n entity_definition is required just to hold loot.\n2. The loot items placed the same way, then moved inside the container with\n `spellkave_stow_item` (sk-9ll.3) — `item_entity_key` plus\n `container_entity_key` set to the container's key, `slot_id`/`direction`\n both omitted (loose carriage). No actor is needed for a container\n (sk-jay0.3.26.9), so a chest in a world without NPCs is filled the same\n way. With `actor_entity_key` (an actor with a spatial location) and\n `container_entity_key` omitted, the same verb puts the item straight\n into that actor's carriage — the way to hand a reward item to a hero at\n authoring time.\n3. NO verb to author. `srd/pickup`'s niche (`srd/item`, provider `entity`)\n already admits a target tagged `srd.item` that is either `core/grounded`\n or `core/contained`; a body with the `srd.creature` capability grant\n already carries `srd/action/pickup`. Dispatching `srd/pickup` on the\n contained item's own `item:<id>` target ref moves it into the actor's\n carriage and spends one of the actor's free object interactions\n (`srd/economy_channel/object_interaction`) — authored to cover exactly one\n pickup per turn (a second contained item needs a new turn:\n sk-jay0.1.23.36.22.6 finding).\n\n## TOML example\n\nUse the chest and item definitions from the ruleset targeted by your adventure. Include the authored place and the actor’s ordinary object-interaction capabilities to validate the complete workflow.\n\nFor a complete, separate offline graph example use\n`sk docs spatial-minimal-cell --full`; it does not implement this container task.\n\nNo `[[action_definitions]]`, `[[niche_definitions]]`, or\n`[[resource_definitions]]` rows for the container itself — `srd/pickup` is\nbundle-owned, authored once in `srd`.\n\n## Proof\n\n- Offline: `packages/spellkave-adventure-elven-mini` `typecheck` / `test`\n (`author:elven-mini:check`); `packages/spellkave-srd-cc` `test:fast`.\n- Live: `packages/spellkave-srd-cc/src/test/live-self-seeding/scenes/pickup-two-potions.test.ts`\n and `pickup-disclosure.test.ts` — a hero dispatches `srd/pickup` against both\n potions' `item:<id>` target refs through the generic PLAYER `r_manipulate`\n reducer (no elven-mini bespoke action, no admin move of items); the authored\n loft chest itself is pinned offline in\n `packages/spellkave-adventure-elven-mini/tests/offline/seed-facts.test.ts`; and\n `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/\n pickup-container.test.ts`, proving the generic capability against a\n disposable self-seeded scene. The one-pickup-per-turn budget comes from\n the channel capacity (`srd-cc fixtures/base/playing-the-game/action-economy.toml:52-54`,\n the world API);\n neither test asserts that a second same-turn pickup is refused — both\n advance the turn before each pickup.\n\n## Related\n\n[`consumable-inventory-consume`](./consumable-inventory-consume.md) (what a\nplayer does with the item once carried).\n\n## Known misuse / anti-pattern\n\n- A bespoke per-adventure \"search the container\" action that `InsertItem`s a\n fresh item into the actor's inventory instead of moving an authored one\n out of the container — the retired faucet design (never merged; PR #3618 shipped this pattern instead):\n it forges items ex nihilo, needs an explicit per-actor `object_state` seed\n row for every body (else `actor.stat` fails `UnknownField`, closing the\n whole predicate — see Forces), and a gate seeded only for the creation\n candidate strands every other player body. Do not reintroduce it;\n `srd/pickup` needs no per-actor state at all.\n- Authoring a custom niche for \"container contents\" — the kernel already\n derives `core/contained` from the `entity_containment` row itself; no\n niche or predicate authoring closes any gap here.\n- Tagging the container's ENTITY DEFINITION instead of the placed instance\n when a niche or the website compendium needs a per-instance tag — use\n `place_entity`'s own `tags` param on the instance; a definition-level tag\n lands in the overflow basin instead of the intended compendium page.\n\n## SRD features that use this\n\n- Elven-mini's loft chest (`elven_mini/adventure/item/loft_chest_1`, 2x Potion\n of Healing, sk-jay0.1.23.36.22.2 — design §6, L-4 loop pilot).\n"},{"id":"patterns/cross-party-capability-gate","title":"Cross-party capability gate","kind":"guide","summary":"A condition on one creature must open or close based on a capability held by someone else in the same roll — the attacker has Darkvision, the attacker has See Invisibility, the ta…","tags":["patterns","cross","party","capability","gate"],"body":"# Cross-party capability gate\n\n## Name\n\n`cross-party-capability-gate` — My condition gate must read the OTHER party's capability\n\n## Problem\n\nA condition on one creature must open or close based on a capability held by\nsomeone else in the same roll — the attacker has Darkvision, the attacker has\nSee Invisibility, the target still has a counter-sense. A gate that only sees\nthe bearer's own facts silently fails closed (`has_capability` → false).\n\n## Forces\n\n- Condition `gate_predicate_source` evaluates against the roll-bias fact pool,\n not the affordance-selection pool.\n- Before sk-609b.16 that pool carried distance only; capability facts were\n absent, so every `actor.has_capability(...)` in a gate was always false.\n- ADR-0045 D-4 forbids a second `capability` table scan — the gate pool must\n reuse `subject_capability_facts`.\n- Actor and Target subjects both matter: In Darkness gates on the actor;\n Invisible gates on the attacker while the condition sits on the target.\n- **The two subjects do not see the same capabilities.** `actor.has_capability`\n folds identity-tag, equipped-item and condition grants (and suppression);\n `target.has_capability` reads only the target's raw `capability` rows\n (the world API,\n `:185-201` vs `:346-351`). A gate on a *target's* granted sense (e.g. See\n Invisibility from the condition) is therefore false. Keep counter-capability\n reads on the actor, as the shipped gates below do (decision `sk-jay0.2.48`).\n\n## Solution\n\n1. **Kernel (already shipped sk-609b.16):**\n `manipulation_spatial_gate_facts` populates `capabilities` via\n `subject_capability_facts(ctx, Some(actor_ref), Some(target_entity_ref))`.\n Every roll-bias seam goes through `roll_bias::resolve`.\n2. **Content:** author the condition with a gate that names the counter-capability:\n - In Darkness on the actor:\n `gate_predicate_source = \"actor.has_capability('srd/capability/darkvision') == false\"`\n + actor-side `srd/attack_roll` Disadvantage.\n - Invisible on the target:\n `gate_predicate_source = \"actor.has_capability('srd/capability/see_invisibility') == false\"`\n + target-side `ResolutionCheck` Disadvantage (and a twin actor-side\n Advantage on `srd/attack_roll`).\n3. **Counter-capability grant:** See Invisibility is a timed condition with\n `grants_capability_while_active = [\"srd/capability/see_invisibility\"]`\n ([condition-grant-and-suppression](./condition-grant-and-suppression.md)).\n4. **Dark node entry:** apply In Darkness via\n `spatial_niche_attachment.on_entry_action_id` (idiom:\n [authored-dark-cave](../examples/authored-dark-cave.md)) — do not invent a\n place-level env-state fact for the roll-bias pool.\n\n## TOML example\n\nFrom `packages/spellkave-srd-cc/fixtures/base/playing-the-game/perception-conditions.toml`\n(generator: `src/chapters/playing-the-game/fragments/perception-conditions.ts`):\n\n```toml\n[[condition_definitions]]\ncondition_definition_id = \"srd/condition/invisible\"\ngate_predicate_source = \"actor.has_capability('srd/capability/see_invisibility') == false\"\nmodifier_template_id = \"srd/condition/invisible/attack_disadvantage\"\n\n[[modifier_templates]]\nmodifier_template_id = \"srd/condition/invisible/attack_disadvantage\"\napplies_to = \"ResolutionCheck\"\ndelta_kind = \"Disadvantage\"\n```\n\n## Proof\n\n- Server: `gate_predicate_reads_injected_actor_and_target_capability_facts`\n in `server/.../roll_bias.rs`.\n- Design: `packages/spellkave-srd-cc/docs/substrate-verdicts/perception-kernel-design.md`.\n- Offline fixture pins on the generated perception-conditions rows.\n\n## Related\n\n[condition-grant-and-suppression](./condition-grant-and-suppression.md),\n[before-filing-a-kernel-gap](./before-filing-a-kernel-gap.md),\n[offer-vs-resolution-roll](./offer-vs-resolution-roll.md).\n\n## Known misuse / anti-pattern\n\n- Filing a kernel gap for \"gates can't see the other party\" without grepping\n `selection/entity_facts.rs` and `roll_bias.rs` first.\n- Baking a place env-state into the roll-bias pool instead of ApplyStatus on\n entry (violates the five binding conditions in the design note).\n- A second raw `.capability().entity_id()` scan outside the one populator.\n\n## SRD features that use this\n\n- In Darkness / Darkvision (species traits + Darkvision spell grant).\n- Invisible / See Invisibility / (later) Truesight.\n"},{"id":"patterns/damage-type-routing","title":"Damage-type routing via defense tags","kind":"guide","summary":"I need fire/cold/etc. damage that respects immunity, resistance, and vulnerability without a kernel damage subsystem.","tags":["patterns","damage","type","routing"],"body":"# Damage-type routing via defense tags\n\n## Name\n\n`damage-type-routing` — Damage-type routing via defense tags\n\n## Problem\n\nI need fire/cold/etc. damage that respects immunity, resistance, and vulnerability without a kernel damage subsystem.\n\n## Forces\n\n- HP writes stay `ModifyResource`; only the amount is typed.\n- Resistance must not double-roll dice; immune must short-circuit.\n- Item slots that carry positive magnitude must not double-negate.\n\n## Solution\n\nUse `routeDamage` / `routeDamageMagnitude` from `@spellkave/world-author` (re-exported by shared tool runtime).\nTag defenses as `damage_immune:<type>`, `damage_resist:<type>`, `damage_vulnerable:<type>`.\nGuide: [`damage-type-routing.md`](../damage-type-routing.md).\n\n## TOML example\n\nCopied from `packages/spellkave-world-author/docs/examples/damage-type-routing.toml`\n(the shape `routeDamage` emits in srd-cc `src/chapters/spells/spell-behaviors.ts`):\n\n```toml\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"damage_routing/cast_fire_bolt/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\"\nresource = \"damage_routing/hp\"\n```\n\n## Proof\n\n- The worked example above: `docs/examples/damage-type-routing.toml`, validated by\n `packages/spellkave-world-author/src/__tests__/doc-evidence-examples.test.ts`.\n- The helpers: `packages/spellkave-world-author/src/__tests__/damage.test.ts`.\n- srd-cc offline: `src/test/offline/spells-coverage.test.ts` (BL-57),\n `thrown-consumables.test.ts`, `area-hazards.test.ts`.\n\n## Related\n\n[computed-literal](./computed-literal.md), [lingering-hazard-zone](./lingering-hazard-zone.md).\n\n## Known misuse / anti-pattern\n\nHand-rolling a different ladder order. Putting defense tags on capability_definition_tag. Negating both in the item slot and at the write site.\n\n## SRD features that use this\n\n- Every typed SRD spell and breath/area monster attack that calls `routeDamage`\n (Fireball, Scorching Ray, dragon breath, …). **Not** the baked Multiattack\n ordinals: they subtract raw damage (see\n [`multiattack-ordinals`](./multiattack-ordinals.md); `sk-jay0.3.10.5`).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`).\n- Caltrops pulse (`srd/item/caltrops/spread/pulse`): 1 Piercing, routed with\n `subject: \"actor\"` because the pulse binds each occupant as Actor.\n"},{"id":"patterns/derived-value-mechanism","title":"Derived value mechanism (macro vs baked stat vs effective vs literal)","kind":"guide","summary":"I have a number that is computed rather than stored (a proficiency bonus, an ability modifier, a DC) — which mechanism do I author it with, and where is each one illegal?","tags":["patterns","derived","value","mechanism"],"body":"# Derived value mechanism (macro vs baked stat vs effective vs literal)\n\n## Name\n\n`derived-value-mechanism` — Which mechanism computes a number\n\n## Problem\n\nI have a number that is computed rather than stored (a proficiency bonus, an ability modifier, a DC) — which mechanism do I author it with, and where is each one illegal?\n\n## Forces\n\n- Some subjects have a live feeding fact (a PC's level); others have none at\n run time (a monster's CR is documentary), so one rule may need two\n routes.\n- `ModifyResource.delta_source`/`ModifyChannel.delta_source` are parsed\n act-time with the SAME world macro closure the validator already admits\n them against (`crates/spellkave-validate/src/refs.rs`'s\n `check_frame_write_dsl_expr`) — a `macro(...)` there resolves against\n live `dsl_macro_definition` rows the same way a resolution predicate\n does; only an UNDEFINED macro id still fails closed\n (`MF-DSL-MACRO-UNKNOWN`).\n- Macro bodies are leaf-only — a macro cannot call another macro;\n composition happens at the call site.\n- `stat(...)` / `effective(...)` fail **closed** on an absent fact\n (`UnknownField`); `has_tag` / `has_capability` / `has_item` / `has_niche`\n fail **open** (`false`).\n- Integer division truncates toward zero, not floor.\n\n## Solution\n\nFour mechanisms; pick the FIRST row that matches:\n\n| The number is… | Use | Row kind / read |\n|---|---|---|\n| adjusted by active conditions / equipment at read time (AC, roll bias) | `effective(...)` over a seeded base | effective-int read |\n| applied CONDITIONALLY and a live feeding fact exists on the reader | DSL macro inside `cond(...)` | `dsl_macro_definitions`; `macro('<id>', <arg>)` |\n| an UNCONDITIONAL per-entity constant read by archetypes shared across subjects with and without a feeding fact | **baked stat**, seeded per entity, fail-closed | `resource_definitions` + `entity_definition_initial_state`; `actor.stat('<id>')` |\n| a task-shaped, scene-owned fact (this cliff is DC 15) | authored literal | plain number in the row |\n| a constant the SOURCE declares on one item, which no feeding fact of its wielder reproduces (Specter Life Drain \"7 (2d6)\" with Strength 1) | source-derived literal in that item's own slot, generated from the stat block and never typed | `entity_definition_item_dsl_source`, e.g. `2d6 + (0)` |\n| an entity-shaped fact (this guard's stubbornness) | NEVER a literal — one of the three above | — |\n\nWhere both a macro and a baked route encode the same rule, the generator\nreads ONE source table for both so they cannot disagree; the two ids may\nshare a literal (one concept, two row kinds — separate tables, no\ncollision) but they are different reads: grep for both when auditing.\n\nWhere macros are legal: any gate-shaped int/bool predicate\n(`resolution_predicate_source`, `order_roll_source`, offer predicates),\n`entity_definition_item_dsl_source.source` (item slots, `MF-VAL-318` parse / `MF-VAL-329` unresolved `stat`/`effective` ids), and\n— as of sk-awlo — `ModifyResource.delta_source`/`ModifyChannel.delta_source`\n(the world API\nparse with `act_time_compiler_definitions(ctx)`, the same act-time world\nclosure `order_roll_source`/`movement_cost_expression_source` use). Prefer\nthe item slot for reusable ATTACKER math shared across many weapons/actions\n([`item-sourced-damage`](./item-sourced-damage.md)); a `delta_source`\nmacro call is for a one-off, non-item-sourced number (a class-feature\nheal/damage formula, a channel budget grant) that doesn't warrant its own\nitem slot.\n\nRounding: floor-shaped formulas need the correction idiom\n`+ cond(rem < 0, -1, 0)`; truncation-shaped ones must NOT get it.\n\nStorage: per-actor numeric facts are `resource_definitions` (`stat` /\n`effective` ids must resolve to a kernel fact, a `resource_definitions` row\nor an `object_state_definitions` row — `MF-VAL-329`,\n`crates/spellkave-validate/src/refs.rs:86-92`); `max_value` is a safety ceiling, the real\nper-instance value is an explicit initial-state seed; `ModifyResource`\nauto-seeds an absent row from `initial_value`. A predicate that reads\n`stat`/`effective` on a target therefore **declares a seed precondition** —\nguarantee the seed in the definition, never re-introduce an offer-predicate\ngate for it (a target-fact read in an offer predicate also forces `Place`\nlocality).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/equipment/weapons/dagger.toml`\n(macro on an item slot) and\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(baked stat + `effective` in a resolution predicate):\n\n```toml\n[[entity_definition_item_dsl_source]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/weapon/dagger\"\nslot = \"srd/damage\"\nsource = \"1d4 + (max(macro('srd/strength_modifier'), macro('srd/dexterity_modifier')))\"\n\n[[action_definitions]]\naction_id = \"srd/attack/melee\"\nresolution_mode = \"Stochastic\"\nresolution_predicate_source = \"let attack_roll = d20; macro('srd/attack_roll_hits', attack_roll, attack_roll + macro('srd/ability_modifier', cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.property.finesse'), max(actor.effective('srd/str'), actor.effective('srd/dex')), actor.effective('srd/str'))) + (actor.stat('srd/proficiency_bonus')), (target.effective('srd/ac')), cond(actor.has_capability('srd/class-feature/fighter/champion/improved-critical'), 19, 20))\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/modifier-units.test.ts` and\n `attack-roll-units.test.ts` (rounding shapes, macro bodies)\n- `packages/spellkave-srd-cc/src/test/offline/derived-units.test.ts`\n (passive perception and provenance; its note that spell save DC is\n deferred is stale)\n- `crates/spellkave-validate/src/lib.rs:3625-3643` (`MF-VAL-318`: item\n slots are macro-aware) and `crates/spellkave-validate/tests/cross_row_refs.rs`\n (`MF-VAL-329` unresolved `stat`/`effective` ids)\n- the world API's\n `delta_source_macro_call_resolves_with_definition_present_and_fails_without`\n (sk-awlo) — a `delta_source` calling `macro('t/one')` resolves when the\n definition is live and still fails closed with `MF-DSL-MACRO-UNKNOWN`\n when it is not. The test drives the parser with a hand-built macro list;\n it does not read live `dsl_macro_definition` rows, so the act-time wiring\n itself has no direct test\n\n## Related\n\n[`dsl-grammar`](../dsl-grammar.md) (`cond`, `let`, `macro`, `stat`,\n`effective`), [`computed-literal`](./computed-literal.md) (a number\ncomputed outside the DSL entirely),\n[`effective-condition-modifiers`](../repairs/effective-condition-modifiers.md),\n[`sibling-resource-predicate-seeds`](../repairs/sibling-resource-predicate-seeds.md),\n[`item-sourced-damage`](./item-sourced-damage.md).\n\n## Known misuse / anti-pattern\n\n- Migrating a call site from the macro route to the stat route without\n checking what the affected entities seed (a five-hour all-attacks outage\n was exactly this: fail-closed doing its job).\n- A literal for an entity-shaped fact, or N difficulty tiers × M skills as\n generated rows — one generic row plus world state.\n- A second mutable \"proficiency bonus\" row on a PC that creation must keep\n in sync with level (derived state is derived).\n- Applying the floor-correction idiom to a truncation formula (breaks the\n lowest band).\n- **A `ForEachActorInRadius` body predicate ordering `stat(...)`/`effective(...)`\n before `has_tag`/`has_capability`/etc.** (sk-awlo, 2026-08-23). Such a\n predicate is evaluated against EVERY actor co-located with the frame\n write's center, not just the intended subject — a fail-closed `stat` read\n on a bystander that never bound that resource (a training dummy, an\n object, a corpse) throws `UnknownField`. Before sk-pgsm that aborted the\n WHOLE consequence, including an earlier legitimate write on the real\n target (`srd/attack/unarmed-strike/damage/success`'s HP subtraction rolled\n back when the Monster Death guard, ordered second, threw on a co-located\n training dummy). Today the loop skips that bystander and records a hidden\n `write_failure` provenance row; parse errors and other evaluation errors\n still abort (the world API).\n A skipped bystander is still a silently unapplied guard, so the rule\n stands: inside a `ForEachActorInRadius` predicate, always test a\n fail-open set-membership fact FIRST — `&&` short-circuits left-to-right, so\n an untagged/uncapable bystander never reaches the fail-closed read at all.\n A single-subject (non-radius) guard is NOT at risk this way — the target is\n always a real, resolved subject — so this rule is specific to radius/\n multi-candidate predicates, not derived-value authoring generally.\n\n## SRD features that use this\n\n- **Spell save DC / spell attack** = 8+PB+spellcasting_mod / PB+mod (srd-cc L12d).\n\n\n- Proficiency Bonus (macro from `srd/level` for PCs, baked from CR for\n monsters), the six ability-modifier macros, AC via `effective`, DCs as\n scene literals. SRD tables, ids and the PC-level/monster-CR rule:\n [`derived-values.md`](../../../spellkave-srd-cc/docs/derived-values.md).\n"},{"id":"patterns/dialog-choice-slots","title":"NPC dialog choice slots","kind":"guide","summary":"I need an NPC conversation with a small fixed set of answers (a menu, a quest accept/decline, a wizard step) without free text silently committing world state and without one affo…","tags":["patterns","dialog","choice","slots"],"body":"# NPC dialog choice slots\n\n## Name\n\n`dialog-choice-slots` — NPC dialog choice slots (numbered Answer 1..N palette)\n\n## Problem\n\nI need an NPC conversation with a small fixed set of answers (a menu, a quest accept/decline, a wizard step) without free text silently committing world state and without one affordance per option.\n\n## Forces\n\n- Free text **proposes**, it never commits (ADR-0096 D-7): \"I choose\n Ranger\" must not draft Ranger. **Shipped exception:** character creation\n turns an *exact* spoken label of the open closed menu (\"Ranger\") and the\n words \"confirm\"/\"discard\" into a pick\n (`packages/spellkave-adventure-runtime/src/dm/creation/draft-state.ts:207-240,300-312`).\n Whether that is parse-to-commit under D-7 is an open decision\n (`sk-jay0.1.48`); do not copy it into new dialogs until it is settled.\n- One affordance per class/species/quest answer explodes row counts and\n puts content in the palette that the NPC should be speaking.\n- The NPC, not the player, decides how many answers are open right now.\n- A slot fired without any utterance must succeed; an optional comment\n should still be heard as speech.\n- Talking NPCs must not need author access to run a conversation.\n\n## Solution\n\nOne dialog model for every conversation, composed from a **small fixed\npalette** the NPC provides:\n\n| Piece | Shape | Role |\n|---|---|---|\n| Talker tag | `srd.dm_npc.talker` (defined by the `dm` bundle) on the NPC's placement | composes who offers answers |\n| Niche | `provider = \"entity\"`, `target.has_niche('<talker tag>')` | answers are NPC-provided affordances |\n| Open-count resource | int `0..N` on the NPC, initial 0 | how many answers are open |\n| Answer k | `communicate` affordance gated `target.stat('<open>') >= k` | generic label `Answer k`; NPC speaks the option text |\n| Ask-menu N | ordinary self act carrying question and exactly N dispatch labels | inscribes the question and opens its occurrence in one frame |\n| Palette maintenance | self-only state setters, granted by the talker tag | closes/resets the palette and selects authored fixed dialogs |\n\nFiring a slot inscribes one speech trace whose payload carries the slot's\n`action_id`, the gate-admitted `occurrence_id` when bound, and the optional\ncomment as `text`. An authored `ui.response-slot=k` action tag identifies the\nslot for clients without parsing labels or ids. Presentation resolves words\nfrom the visible answered occurrence; missing or legacy history stays neutral.\nThe NPC brain decides on\nthe **acted id**; spoken words are context, except for the creation\nexception above. Talk state (which step, what was drafted) lives in the\nNPC's process memory — there are no `dialog/last-choice` or `dialog/step`\nworld rows (character creation rebuilds its draft from the speech history\nafter a restart; see [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)).\n\nThe same palette serves a **wizard** (draft in memory, a one-slot Confirm\nquestion and a Discard handle — see\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)) and **simple\ntalk** (a slot *is* the answer).\n\n## TOML example\n\nThe generated DM palette provides fixed Answer actions. The following\nfields show the slot and its speech write; its occurrence predicate must\nalso name the authored prompt that admits that response:\n\n```toml\n[[action_definitions]]\naction_id = \"dm/dialog/choice/1\"\nbundle_id = \"dm\"\ndescription = \"Numbered dialog answer 1. The NPC speaks the option text; this label stays generic.\"\ndisplay_name = \"Answer 1\"\nnon_steering = true\non_success = \"dm/dialog/choice/1/success\"\nrequired_capability = \"dm/action/dialog/choose\"\nresolution_mode = \"Deterministic\"\n\n[[action_definition_tag]]\naction_id = \"dm/dialog/choice/1\"\nbundle_id = \"dm\"\nsource = \"manifest\"\ntag = \"ui.response-slot=1\"\n\n[[affordance_templates]]\nbundle_id = \"dm\"\ncapability_id = \"dm/action/dialog/choose\"\ndisplay_name = \"Answer 1\"\nniche_id = \"dm/niche/dialog\"\noutcome_template_id = \"dm/dialog/choice/1/outcome\"\npredicate_source = \"target.stat('dm/dialog/open') >= 1\"\ntemplate_id = \"dm/dialog/choice/1/affordance\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"dm/dialog/choice/1/success\"\n\n[consequence_frame_writes.frame_write.Inscribe]\ncarry_addressee = true\ncarry_dispatch_text = true\ncarry_occurrence = true\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"ActorSpatialRef\"\npayload_json = '{\"text\":\"\",\"action_id\":\"dm/dialog/choice/1\"}'\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-dialog-slots.test.ts`\n- `packages/spellkave-adventure-elven-mini/tests/offline/mira-talk.test.ts` (simple\n talk cycle: greet → open=3 → choice/2 → send-off → open=0)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/player/dm-creation/creation-flow.test.ts`\n (candidate sees `dm/dialog/choice/k` after the DM's first cycle)\n\n## Related\n\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`quest-composition`](./quest-composition.md) (accept/decline slot as the\nquest giver), [`directed-speech-anchor`](./directed-speech-anchor.md) (the\nspeech trace; note the DM slot carries the addressee but anchors at the\nspeaker, `ActorSpatialRef` — `srd-cc fixtures/dm/manifest.toml:2364-2368`), [`advancement-choice`](./advancement-choice.md)\n(the menu members a wizard step lists).\n\n## Known misuse / anti-pattern\n\n- Matching the player's sentence against option labels as the save path.\n- One affordance per class / species / background / quest.\n- Rewriting generic action display names for each conversation; occurrence-bound\n question/option presentation supplies the visible words instead.\n- Per-NPC hardcoded slot lists in TypeScript — composition is the talker\n tag plus DSL gates on the NPC's own open-count.\n- Granting a talking NPC author access just to run a menu.\n\n## SRD features that use this\n\n- Aldwin's character-creation wizard and level-up dialogue; Mira's bar talk;\n every elven-mini quest giver's accept/decline slot. Ids, `.mdsl` dialog\n files and acceptance list:\n [`npc-dialog-choice-slots.md`](../../../spellkave-srd-cc/docs/npc-dialog-choice-slots.md).\n"},{"id":"patterns/directed-speech-anchor","title":"Directed speech anchor (anchor says WHERE, payload says TO WHOM)","kind":"guide","summary":"I need an NPC or player to say something to someone — broadcast to the room or directed at one body — so the right bodies perceive it and it does not follow anyone around.","tags":["patterns","directed","speech","anchor"],"body":"# Directed speech anchor (anchor says WHERE, payload says TO WHOM)\n\n## Name\n\n`directed-speech-anchor` — Directed speech anchored at the addressee's place\n\n## Problem\n\nI need an NPC or player to say something to someone — broadcast to the room or directed at one body — so the right bodies perceive it and it does not follow anyone around.\n\n## Forces\n\n- An `Inscribe` anchor answers one question only: *where* is this thing.\n Who it was aimed at, what was said, who left it — payload.\n- An entity anchor makes the trace travel with that entity: utterances\n accumulate on a person and are handed to whoever later stands next to\n them (a hero once perceived a stranger's entire character-creation\n exchange this way). It buys nothing: an entity anchor admits by\n co-location like any other.\n- There is no recipient column, on purpose (ADR-0040 / ADR-0095): the\n addressee routes nothing.\n- `carry_addressee` on a dispatch with no entity target fails at binding\n validation — deliberate, so readers never probe for a \"usually there\"\n key.\n- Speech is not a property of the room: attaching a speak niche to places\n leaves every unattached place silent.\n\n## Solution\n\n- **Who may speak** is an actor-carried capability from a vocal-modality\n tag ([`identity-tag-capability-grant`](./identity-tag-capability-grant.md));\n **who may be addressed** is the entity-provided communicable niche from\n the creature tag; a corpse is excluded by `target.status('<dead>') == false`\n on the affordance. No `spatial_niche_attachments` for either.\n- **Broadcast / self-shaped** speech anchors at the speaker's place\n (`ActorSpatialRef`).\n- **Directed** speech anchors at the addressee's **place**\n (`TargetSpatialRef`) so ordinary co-location admission delivers it\n there, and names the addressee in the payload (`carry_addressee`).\n Never `TargetEntityRef`. One shipped exception: the DM dialog answer\n slots (`dm/dialog/choice/N`) carry the addressee but anchor at the\n speaker (`ActorSpatialRef`, `srd-cc fixtures/dm/manifest.toml:2364-2368`),\n which works because the talker and the answering hero share a place.\n- Declare the payload contract on the trace kind (`schema_json`, flat\n key → type, `?` for optional); a required addressee is guaranteed by\n `carry_addressee`, not by the schema. `carry_dispatch_text` copies the\n dispatch's `dispatch_text` into `text`\n (the world API); since\n `srd/speech` requires `text`, a directed speak with no utterance fails the\n schema.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/speech.toml`\n(`srd/speak-to`, directed):\n\n```toml\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/speak-to/success\"\n\n[consequence_frame_writes.frame_write.Inscribe]\ncarry_addressee = true\ncarry_dispatch_text = true\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetSpatialRef\" # addressee's current place, never TargetEntityRef\npayload_json = \"{}\" # kernel fills text (from the dispatch's dispatch_text) + addressee\n\n# trace kind contract:\n# [[trace_kind_definitions]] kind_id = \"srd/speech\"\n# schema_json = '{\"text\":\"string\",\"addressee\":\"integer?\"}'\n# perceptible_for_ticks = 0 (an event — see trace-perceptibility-window)\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/speech.ts`\n (asserts anchor and payload separately; walks a body out / speaks /\n walks it back in)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/telepathy.ts`\n- Demo: `openspec/specs/world-knowledge-and-perception/demos/sk-n16-speech-anchor-and-temporal-admission.md`\n\n## Related\n\n[`trace-perceptibility-window`](./trace-perceptibility-window.md) (event\nvs mark), [`party-extent-grant`](./party-extent-grant.md) (addressing\nacross graphs), [`dialog-choice-slots`](./dialog-choice-slots.md) (slots\ninscribe this trace), [`communicate-with-actor`](../examples/communicate-with-actor.md),\n[`interaction-dsl-and-world-authoring`](../interaction-dsl-and-world-authoring.md)\n§ Trace Inscription.\n\n## Known misuse / anti-pattern\n\n- Anchoring a spoken line to the person spoken to (`TargetEntityRef`).\n- Authoring place attachments for speak verbs.\n- Treating `payload.addressee` as routing — anyone at the anchor perceives\n the trace.\n- Letting the creature tag or a language tag grant speech.\n\n## SRD features that use this\n\n- `srd/speak-aloud`, `srd/speak-to-room` (speaker-anchored),\n `srd/speak-to`, `srd/communicate/telepathy` (addressee-anchored), DM\n dialogue lines (speaker-anchored with an addressee, see above). Chains, ids and the extent residue:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n"},{"id":"patterns/dm-applied-extent-grant","title":"Condition-derived extent (reach activated by an authored act)","kind":"guide","summary":"A gift or agreement should activate cross-graph reach at a story moment. Seeding that reach can disclose a remote companion's location and knowledge before the bond. The carried i…","tags":["patterns","dm","applied","extent","grant"],"body":"# Condition-derived extent (reach activated by an authored act)\n\n## Name\n\n`dm-applied-extent-grant` — retained lookup name for the retired runtime delta\npattern. Authored condition activation replaces that workaround\n(sk-jay0.3.24.187; ADR-0155's no-grant-leaf decision stands).\n\n## Problem\n\nA gift or agreement should activate cross-graph reach at a story moment.\nSeeding that reach can disclose a remote companion's location and knowledge\nbefore the bond. The carried item must independently matter at command time.\n\n## Forces\n\n- The extent describes reachable targets; possession and bond predicates\n govern whether a command is admitted.\n- `grants_capability_while_active` carries plain IDs. The authored satellite\n `condition_capability_extent_grants` carries extent references.\n- A Party extent resolves instance tags, blueprint tags and existing session\n peers through the shared resolver. A membership tag alone does not activate\n a condition-derived grant.\n- `actor.has_item('<item definition>')` reads directly carried items at offer\n and dispatch. Carrying the stone needs no equipment slot.\n- Raw condition gates cannot depend on effective capabilities or caller scope.\n The bridge uses the Hidden observation floor; stored grants retain their\n authored ceilings.\n\n## Solution\n\n1. Author an ordinary command capability and a bond condition.\n2. Author one extent rule naming that condition, capability and Party tag.\n3. Place the companion with the membership tag. Leave the hero without the\n activating condition.\n4. Have the DM's fixed authored act apply the condition and record the hero's\n marker in one atomic consequence. Record the companion marker after its\n own successful act receipt. The watch resumes from durable markers.\n5. Require the command capability on action and affordance. Gate the stone\n channel on possession and both channels on sender/recipient bond markers.\n Removing a condition source withdraws reach only when no other admitted\n source remains.\n\n## TOML example\n\nGiven admitted condition and capability definitions in `demo`:\n\n```toml\n[[condition_capability_extent_grants]]\nbundle_id = \"demo\"\ncondition_definition_id = \"demo/bond-active\"\ncapability_id = \"demo/command-bond\"\nextent_kind_ref = \"party\"\nextent_ref = \"demo.companion.bond\"\n```\n\nThe activation consequence uses the existing leaf:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"demo/record-bond/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.ApplyStatus]\ntarget_kind = \"entity\"\ntarget_ref = \"TargetActor\"\ncondition_definition_id = \"demo/bond-active\"\n```\n\n## Proof\n\n- the world API: raw gates, suppression,\n independent sources, exclusive expiry and fail-closed behavior.\n- `crates/spellkave-validate/src/refs/condition_extents/tests.rs`: references,\n dependency closure, owner locking and reserved-capability refusal.\n- Elven-mini's unchanged Chapter 1 story assertions protect prebond fog.\n- `author/dm-acts.ts` and `dm/watches/companion-bond-watch.ts` author and\n execute receipt-ordered bond activation; Hesper retains her placed identity.\n\n## Gotchas\n\nMarker seeds follow placement: actor placement can reseed its state.\nThe bond tag remains separate from the shared party sight tag. Extent rules\ncannot name `frontier.*`. Inspect rules with\n`spellkave capability condition-extents`; Doctor checks their references.\nExact export covers this satellite, while parent condition hook source remains\nan existing export coverage gap.\n\n## Related\n\n[Conditions](../../../../docs/data-model-concepts/conditions.md#condition-derived-extents),\n[Party extent](./party-extent-grant.md),\n[Directed speech](./directed-speech-anchor.md).\n\n## Known misuse / anti-pattern\n\nSeeding command reach before the bond, using an item capability as a possession\npredicate, mutating a protected Party authority tag through an act, or using a\nper-play manifest apply to activate a fixed authored bond.\n"},{"id":"patterns/draft-then-confirm-wizard","title":"Draft-then-confirm wizard (multi-step form run by an NPC)","kind":"guide","summary":"I need a guided character-creation or advancement form where choices remain a draft until confirmation admits the sheet and inventory changes. Explicit name and description adopti…","tags":["patterns","draft","then","confirm","wizard"],"body":"# Draft-then-confirm wizard (multi-step form run by an NPC)\n\n## Name\n\n`draft-then-confirm-wizard` — Draft in NPC memory, grant through authored acts after Confirm\n\n## Problem\n\nI need a guided character-creation or advancement form where choices remain a\ndraft until confirmation admits the sheet and inventory changes. Explicit\nname and description adoption can update their bounded text homes earlier;\nfeature and equipment grants wait for Confirm.\n\n## Forces\n\n- Free text proposes a value for explicit adoption (ADR-0096 D-7). The\n creation parser's existing exact-label exception remains an open decision;\n new dialogs should select options by acted slot.\n- Grants follow confirmation, and each successful act precedes the corresponding\n latch (ADR-0096 D-4/D-5).\n- Menus can exceed the sixteen-slot palette and require repeated picks.\n- A talking NPC needs ordinary palette acts; privileged sheet changes use a\n separately admitted DM presence, within its extent.\n- There is no definition inheritance: the blueprint must initialize each\n resource and Text home the finite vocabulary will update.\n\n## Solution\n\n1. Author the shared Answer 1–16 palette and closed-question vocabulary before\n play. Request an ask-menu act with the question and exactly N option labels.\n The same frame inscribes the directed speech and opens its occurrence.\n [Dialog choice slots](./dialog-choice-slots.md) explains the fixed palette;\n [prompt occurrences](./prompt-occurrence.md) explains the bound trace.\n2. Associate the current option list with the observed player body in process\n memory. An acted slot selects that list's option. Large choose-N groups\n offer remaining options until the count is met; a group with no available\n options cannot leave an impossible open question.\n3. Parse supported name, scores and description inputs into proposals. Offer\n explicit adoption. Name and description adoption request bounded text acts;\n appearance updates an existing Public Text state and backstory an existing\n Hidden Text state, preserving ownership and visibility.\n4. Offer Confirm as a one-slot question when the structured draft is complete.\n The historical dedicated Confirm action is disabled (`1 == 0`); its ID\n remains readable in old traces. Independently recheck the draft before\n building the confirmation plan.\n5. Dispatch the finite sheet plan through the admitted DM presence: selected\n identity tags, absolute state values, feature tags and the compiled starting\n kit. Party membership and extent-bearing sight come from the unbound vessel's\n blueprint. Runtime code publishes no grant or prompt manifest.\n6. Advance the completion latch and announce completion only after successful\n receipts. A kit is one atomic frame, including nested items, equipment and\n its completion marker. Separate sheet acts can succeed before a later act\n refuses; the whole wizard is not one transaction. Retain unfinished work\n for retry and use the kit marker to prevent duplicate inventory.\n7. A host restart can reconstruct drafts from retained visible speech and\n compatible menu data. This is replay, not a durable draft snapshot. The\n world-owned body and items persist independently of the NPC's process.\n8. Let the candidate walk the answered questions. Author two input-less\n actions beside Discard, with the same phase gate, and name them in the duty\n document as `creation.wizard.back_action_id` and `forward_action_id` (the\n shared DM bundle ships `dm/creation/back` and `dm/creation/forward`). Back\n asks the question before the open one again and clears nothing; the old\n answer stands until another is acted. A new answer replaces what that\n question held, and a question that takes several picks is reopened whole.\n Forward leaves a reopened question as answered. Name, scores, appearance\n and backstory need neither: their own input actions can be sent again.\n Both actions leave a speech trace like every menu answer, which is what\n the replay of step 7 reads; a restart in the middle of a walk has not been\n tested.\n\n9. Keep the order of the questions as data, not in the NPC's program, and\n send where the dialogue stands with every question. The DM's creation\n wizard does both; [guided dialogue](./guided-dialogue.md) describes the\n step list and the machine side. The advancement wizard does not yet.\n\n## TOML example\n\nThe author seeds fixed question definitions; the runtime selects a question\nand supplies its presentation through the admitted act. The creation offer\nbuilder uses the same one-option shape for Confirm:\n\n```ts\nif (step === null && creationStructuredDraftsComplete(state, catalog)) {\n return offerFromPairs(\"confirmation\", \"confirm:character\", [\n { label: \"Confirm character creation\", pick: { kind: \"confirm\" } },\n ]);\n}\n```\n\nThe ask act carries one label; the player's Answer 1 consumes its occurrence.\nThe NPC then requests the confirmation plan's authored acts. No author delta\nis computed or applied by the dialogue runtime.\n\n## Proof\n\n- `crates/spellkave-npc-host/src/dm/engine/creation_tests.rs` pins the draft\n and its offers on the Rust DM engine: slot binding in catalog order, the\n class change that clears class-dependent picks, the token grammar, the\n vocabulary, and stepping back and forward\n (`native_creation_back_and_forward_walk_answered_questions`,\n `native_creation_back_reopens_a_multi_pick_question_whole`), and that the\n order follows the guide (`native_creation_asks_in_the_order_the_guide_holds`). These are pure\n engine tests; they do not prove live mutation. The TypeScript creation test\n this page named before went with the TypeScript host.\n- `packages/spellkave-srd-cc/src/test/offline/dm-level-up.test.ts` proves finite\n plans and accepted-receipt-before-latch ordering.\n- `packages/spellkave-adventure-runtime/src/dm/dialog/prompt-offer.test.ts`\n pins the atomic ask shape, labels and matching response count.\n- Live creation has no automated acceptance test since the TypeScript host\n was deleted; `just play-host` stages a world where the Rust DM runs it, and\n `apps/classic/PLAYTEST.md` records the hand-played runs.\n\n## Related\n\n[Dialog choice slots](./dialog-choice-slots.md),\n[advancement choice](./advancement-choice.md),\n[tag membership menu](./tag-membership-menu.md),\n[actor-carried feature verb](./actor-carried-feature-verb.md),\n[proactive level-up](./proactive-level-up.md), and\n[offer-gate/consume-guard parity](./offer-gate-consume-guard-parity.md).\n\n## Known misuse / anti-pattern\n\n- Runtime author deltas for prompt definitions, sheet grants or inventory.\n- Treating a completed announcement as proof that a privileged act succeeded.\n- Granting a feature capability without initializing its required resource.\n- Re-parenting the live body to a pregen definition to apply its sheet.\n- Claiming that all creation writes are deferred until Confirm: explicit name\n and description adoption can occur earlier.\n- Copying creation's exact spoken-label convenience into a new dialogue while\n its parse-to-propose decision (`sk-jay0.1.48`) remains open.\n\n## SRD features that use this\n\nAldwin's creation and advancement wizards use these steps. The SRD vocabulary,\nkit composition and world-owned vessel limits are described in\n[character creation](../../../spellkave-srd-cc/docs/character-creation.md).\n"},{"id":"patterns/equip-gated-modifier","title":"Equip-gated modifier (numeric stat modifier active while item is equipped)","kind":"guide","summary":"An item (armor, shield, ring, magic item) provides a continuous numeric bonus or replacement (e.g. Armor Class, Speed, saving throw bonus) while equipped in a valid equipment slot…","tags":["patterns","equip","gated","modifier"],"body":"# Equip-gated modifier (numeric stat modifier active while item is equipped)\n\n## Name\n\n`equip-gated-modifier` — Equip-gated modifier (item definition links to a modifier template via `entity_definition_equip_modifier`)\n\n## Problem\n\nAn item (armor, shield, ring, magic item) provides a continuous numeric bonus or replacement (e.g. Armor Class, Speed, saving throw bonus) while equipped in a valid equipment slot on an actor, and that modifier must automatically deactivate when the item is unequipped or removed.\n\n## Forces\n\n- Modifier must track equip state directly from `entity_equipment_slot` without requiring point-in-time condition sync (`ApplyStatus`/`RemoveCondition`) on every equip/unequip path.\n- Multiple equipped items modifying the same stat (e.g. body armor replacing AC + shield adding +2) must compose deterministically through `compose_modifiers_by_shape`.\n- Unarmored actors or actors without the item equipped must not pay any phantom modifier.\n\n## Solution\n\n1. Define the item in `[[entity_definitions]]` with its `slot_compatibility_predicate` using the closed three-form grammar (ADR-0118), e.g. `slot_id == \"srd/slot/chest\"` — not a bare slot id and not `spellkave-dsl`.\n2. Author a `[[modifier_templates]]` row on the target axis (e.g. `srd/ac`), with the appropriate `delta_kind` (`FlatSet` for armor replacement, `Plus` for shield/bonus) and expression.\n3. Link the item definition to the modifier template in `[[entity_definition_equip_modifier]]`:\n - `entity_def_id` = the item definition ID (e.g. `srd/armor/chain-mail`)\n - `modifier_template_id` = the modifier template ID (e.g. `srd/armor/chain-mail/ac_bonus`)\n - `bundle_id` = the owning bundle (e.g. `srd`)\n4. At runtime, the kernel's `fold_effective_int_facts` scans the actor's `entity_equipment_slot` memberships, resolves the equipped items' `entity_definition_equip_modifier` rows, lifts the modifier templates, and composes them into `target.effective('<stat>')`.\n\n## Numeric wearer facts and dependency limits\n\nAn equipped template's numeric value can read current wearer integers with\n`actor.stat('<field>')` and composed integers with\n`actor.effective('<field>')`. Here `Actor` is the wearer, including when\nan outer action reads a Target's equipment. The template's `Target` is not\nbound to either wearer or attacker. Macro expansion uses the same facts.\nOrdinary state changes take effect on the next collection; do not copy a\nwearer stat onto the item or synchronize it with equip callbacks.\n\nThis admission is for numeric values. Template predicates retain their\nexisting world/equipment fact context; a wearer stat/effective read missing\nthere still makes that predicate false. Existing condition-row evaluation\nalso keeps its own context. An equipped value can nevertheless read an axis\nwhose effective value combines already lifted condition rows and other\nlinked equipment modifiers.\n\nEffective dependencies resolve before their consumers. Raw `stat` reads\nremain leaves; they do not read the overlay. Self-dependencies, multi-axis\ncycles, missing dependencies, and uninspectable item sources refuse the\ncollection rather than silently dropping a contribution. All root-reachable\nnumeric branches are inspected, so even an inactive branch can introduce a\nrefused cycle. Directly selected item-source expressions retain their\nexisting one-source-layer limit and evaluate with the same subjects.\n\nPer wearer collection, the admitted graph allows at most 512 distinct axes,\n512 distinct reachable numeric expression nodes (shared expressions and\nselected sources count once), and an effective chain of 64 axes. Each\nexpression retains its DSL evaluation/draw bounds. Verified wearer-free\nsets retain the existing fold and bounds; an unresolved source cannot be\nclassified as wearer-free. Refusal returns no partial overlay. It can also\nprevent ordinary actions, including unequip, whose facts need that fold;\nan authorized author/operator can repair the bad template or link through\nexisting authoring paths, after which normal player actions resume.\n\nStrict handling applies to wearer-reading/source-inspection axes and their\neffective dependencies. Unrelated axes retain legacy lift/composition\nomissions and do not consume the strict graph's node budget. A numeric axis\nwith modifying rows retains the existing zero starting value when no raw\nrow exists, including when another modifier reads that axis effectively.\nAn effective read with neither a raw row nor modifying rows remains unknown.\n\nCurrent target facts are collected eagerly: cyclic gear can also refuse an\naction against its wearer even when that action reads no effective value.\n`EquipItem` validates the prospective graph before its equipment/lifecycle\nwrites: cyclic, unresolved or exhausted dependencies refuse admission. A\nsecond item closing a cycle also refuses. The live fixture proves denied\nPLAYER equip leaves the wearer targetable; publisher-staged legacy bad sets\nretain the collection/refusal and author-repair controls.\n\nPreparation includes earlier equips and resource writes. Pending items use\nthe insertion's resolved `initial_item_state`, definition tags and sources,\nwithout a synthetic entity ID. Earlier condition, tag/text, lifecycle or other\nunprojected writes conservatively refuse before stale gate/source evaluation,\nincluding for literal-only candidates. Split such frames into actions or\nauthor the equip before those writes, with the intended consequences reviewed.\nThis constraint also applies to plain equipment after `Inscribe` (the\nstructured EmitTrace surface), `ModifyChannel`, `OpenSession` or\n`ForEachActorInRadius`; their effects are not projected for this admission.\nResource-before-equip frames also refuse when an active ResourceDelta condition\nhook may run: the resource overlay cannot project its synchronous side effects,\nand preparation does not guess whether a dynamic detail filter will stay false.\nThe guarantee is validity at admission before the candidate's own lifecycle;\nthat hook, later writes or predicate changes can still invalidate the graph.\nAuthor validation emits advisory `MF-VAL-390` for possible cycles, unbound\nTarget reads, unresolved sources or exhausted inspection limits. Ordinary wearer\nraw/effective leaves are valid dependencies, including Dexterity-reading armor;\nthey do not independently emit a hazard. Runtime admission uses the concrete\nwearer snapshot and diagnoses missing leaves there. The doctor check\n`equipped_numeric_dependencies_resolve` reports current bad wearer sets.\nStarting equipment seeded by `Spawn` or `CreateWorldObject` does not pass\nthrough this EquipItem guard. Cyclic starting gear, as well as later state,\ntick or lifecycle changes, can still make its wearer unavailable. The checkout\nstarting-gear audit found zero wearer-reading sets (312 seed rows, 311\ndefinitions); this does not constrain new authoring. Lazy Target evaluation\nis the commissioned P1 follow-up `sk-jay0.2.71`; do not use collection refusal\nas a protection mechanic.\n\nComposition uses the existing law: a `FlatSet` result absorbs `Plus`\nin the same bucket. Include an intended body-armor enhancement in its\nreplacement expression; a separate `Plus` does not augment that replacement.\nThis fact admission does not change that law or complete the separate SRD\nmagic-armor content repair.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/equipment/armor/chain-mail.toml`:\n\n```toml\n# pattern: equip-gated-modifier\n\n[[entity_definitions]]\nbundle_id = \"srd\"\ndescription = \"Chain Mail (Heavy Armor, static AC 16)...\"\ndisplay_name = \"Chain Mail\"\nentity_def_id = \"srd/armor/chain-mail\"\nslot_compatibility_predicate = 'slot_id == \"srd/slot/chest\"'\n\n[[modifier_templates]]\napplies_to = \"srd/ac\"\nbundle_id = \"srd\"\ndelta_kind = \"FlatSet\"\ndisplay_name = \"Chain Mail AC 16\"\nmodifier_expression_source = \"let ac = 16; ac\"\nmodifier_template_id = \"srd/armor/chain-mail/ac_bonus\"\npredicate_source = \"\"\npriority = 0\n\n[[entity_definition_equip_modifier]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/armor/chain-mail\"\nmodifier_template_id = \"srd/armor/chain-mail/ac_bonus\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/scenes/equipped-modifier-wearer-facts.test.ts` (PLAYER values, gates, dependencies, refusal/recovery, isolation and session policies)\n- `packages/spellkave-srd-cc/src/test/offline/armor-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/equipment-coverage.test.ts`\n\n## Related\n\n[`item-sourced-damage`](./item-sourced-damage.md) (wielded weapons), [`derived-value-mechanism`](./derived-value-mechanism.md), [`damage-type-routing`](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\n- Trying to manage armor AC through `on_equip_consequence_id` firing `ApplyStatus` (risks orphan conditions if removal fails).\n- Hardcoding the AC on the actor's initial state and forgetting to recalculate on equip/unequip.\n- Using `Plus` instead of `FlatSet` for base body armor (body armor replaces base AC; use `Plus` for additive buckets, accounting for the FlatSet absorption law above).\n\n## SRD features that use this\n\n- All 13 SRD armors and shields (`fixtures/base/equipment/armor/*.toml`).\n- Magic items granting +N AC or stat bonuses while worn/attuned — intended,\n but not wired: magic armor ships `modifier_templates` (e.g.\n `magic-items/armor/chain-mail-plus-2.toml`) with no\n `entity_definition_equip_modifier` link, so neither its base AC nor its\n bonus applies (bug `sk-jay0.3.19.9`).\n"},{"id":"patterns/extra-action-budget","title":"Extra action budget (one-shot channel grant)","kind":"guide","summary":"I need a feature that gives the actor one extra action this round (Action Surge), without inventing a new kernel primitive.","tags":["patterns","extra","action","budget"],"body":"# Extra action budget (one-shot channel grant)\n\n## Name\n\n`extra-action-budget` — Extra action budget (one-shot channel grant)\n\n## Problem\n\nI need a feature that gives the actor one extra action this round (Action Surge), without inventing a new kernel primitive.\n\n## Forces\n\n- Standing haste-like bonuses should recompute every gate for as long as a condition holds.\n- One-shot \"this round only\" grants must evaporate on window rollover and must not leak.\n- Suppression (incapacitated FlatSet(0) on a channel) must still win over a positive grant.\n- Authors keep searching for a missing GrantAction arm and filing kernel gaps.\n\n## Solution\n\nUse `ModifyChannel` on the success consequence to grant one full (or signed)\npool of an existing economy channel for the current window. Spend any charge\nresource in the same consequence. Documented in\n[`action-economy.md`](../action-economy.md) §\"Grant one-shot extra budget with ModifyChannel\".\nDo **not** open a substrate verdict for Action Surge until this pattern is tried.\n\n## TOML example\n\nCopied from `packages/spellkave-world-author/docs/action-economy.md (canonical shape; wire into srd/fighter/action-surge via packages/spellkave-srd-cc/src/chapters/classes/index.ts `buildActionSurgeFragment`)`:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/ability/second_wind_of_action\"\nordinal = 0\nframe_write = { ModifyChannel = { actor = \"Actor\", channel = \"mybundle/channel/primary\" } }\n```\n\n## Proof\n\n`crates/spellkave-validate/tests/cross_row_refs.rs` (ModifyChannel.channel MF-VAL-312); live channel grant logic in the world API. Fighter charge spend: `packages/spellkave-srd-cc/src/test/offline/martial-features-coverage.test.ts`.\n\n## Related\n\n[action-economy](../action-economy.md), [condition-grant-and-suppression](./condition-grant-and-suppression.md) (suppression beats grant).\n\n## Known misuse / anti-pattern\n\nFiling Action Surge / Indomitable-as-extra-action as a kernel gap without trying ModifyChannel. Using a negative ModifyChannel to model 'cannot act' (use condition FlatSet / capability suppression instead).\n\n## SRD features that use this\n\n- Fighter **Action Surge** (classes.md Level 2) — charge resource is live; extra Primary-channel grant is this pattern.\n- Any one-shot 'act again this round' class feature.\n"},{"id":"patterns/guided-dialogue","title":"Guided dialogue (an NPC asks its questions in the order a data tree holds)","kind":"guide","summary":"I need an NPC that leads someone through several questions, where the order of the questions, which ones are skipped and which ones hang on an earlier answer are content I can cha…","tags":["patterns","guided","dialogue"],"body":"# Guided dialogue (an NPC asks its questions in the order a data tree holds)\n\n## Name\n\n`guided-dialogue` — Steps as data, one machine side per question\n\n## Problem\n\nI need an NPC that leads someone through several questions, where the order\nof the questions, which ones are skipped and which ones hang on an earlier\nanswer are content I can change without touching the NPC's program. A client\nshould be able to show \"answers so far\" and \"what is still ahead\" without\nremembering anything itself.\n\n## Forces\n\n- The order of a guided talk is content. Written into the NPC's program it\n gets copied: once to ask, again to step back, again to clear dependents.\n- A client that keeps its own list of answers must copy the NPC's rules to\n keep that list right, and loses it in another browser.\n- The NPC stays the authority. A client shows what it is sent and offers\n actions; the world decides (ADR-0141, ADR-0073 D-1).\n- NPC documents hold no expressions (ADR-0165 D-2). A step's condition is one\n atom about another step of the same guide.\n- What a question's options are is the kind's knowledge (a class's skills, a\n merchant's wares), not the guide's.\n\n## Solution\n\n1. **Write the steps as data.** A guide is a list of steps in the NPC's\n document. The DM carries it as `creation.guide`. Each step has:\n\n | Field | Meaning |\n |---|---|\n | `id`, `title` | Stable id (opaque to every reader) and a short name for the outline. |\n | `source` | A named option source the kind resolves. The DM kind knows `classes`, `backgrounds`, `species`, `class-skills`, `class-choice-groups`, `class-cantrips`, `class-prepared`, `class-kits`, `kit-equipment`, `pending-name`, `standard-array`, `confirm`. |\n | `options`, `pick` | Inline options `{ id, label, description?, ref? }` and how many are picked (`{ min, max }`), for a talk with fixed answers. |\n | `input` | The step is answered by a typed input (the DM kind knows `name`), not by a pick. An open input step asks no question; the NPC waits. |\n | `show_when` | `{ answered = \"<step>\" }` or `{ unanswered = \"<step>\" }`. One atom, no nesting. |\n | `depends_on` | Earlier steps this one hangs on. A different answer there drops the answers here. |\n | `reopen` | The step can be asked again with Back. Default true. |\n | `paged` | More options than slots are shown in pages. Default: cut at the slot count. |\n | `announce_remaining` | A step with several picks sends how many are left. |\n | `listed` | The step has its own line in the outline. Default true. |\n\n A step takes exactly one of `source`, `options`, `input`. A source belongs\n to one step. A step with nothing to ask is skipped.\n2. **Let the engine walk it.** `crates/spellkave-npc-host/src/guide.rs` finds\n the open question, the answered ones, the draft before a step, and the\n answers that hang on a changed step. It knows no step and no ruleset. The\n kind supplies where a source's options come from and where answers are\n kept. A document without a guide is refused; no order is built in.\n3. **Ask through the palette.** Each question is one ask-menu act\n ([dialog choice slots](./dialog-choice-slots.md)), which opens one\n [prompt occurrence](./prompt-occurrence.md) bound to its speech trace.\n4. **Send the machine side with every question.** The same act carries\n `dispatch_context`; the ask-menu write opts in with\n `carry_dispatch_context`, so the object lands on the trace payload as\n `context` and the SDK joins it to the prompt as `presentation.guide`:\n\n ```json\n {\n \"guide\": 1,\n \"step\": \"skills\",\n \"reopened\": false,\n \"remaining\": 2,\n \"outline\": [\n { \"step\": \"class\", \"title\": \"Class\", \"state\": \"answered\",\n \"answers\": [{ \"label\": \"Fighter\", \"ref\": \"srd/class/fighter\" }] },\n { \"step\": \"skills\", \"title\": \"Skill\", \"state\": \"open\",\n \"answers\": [{ \"label\": \"Athletics\", \"ref\": \"srd/skill/athletics\" }] },\n { \"step\": \"kit\", \"title\": \"Starting kit\", \"state\": \"ahead\" }\n ]\n }\n ```\n\n `state` is `answered`, `open` or `ahead`. A step with several questions has\n one entry per question once its questions are known. `remaining` is absent\n on a single pick. `truncated: true` marks an outline the NPC cut to stay\n inside 48 entries and 8 KiB. There is no step number and no total; a\n reader counts the outline.\n5. **Read it, do not rebuild it.** A client shows the outline as sent. It\n never branches on a step id, never guesses a step from the question's\n wording, and keeps no answer list of its own. A prompt without\n `presentation.guide` (an older host) still shows its question and labels.\n\n## TOML example\n\nThe write that asks a guided question opts into both carriages:\n\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetSpatialRef\"\npayload_json = \"{}\"\ncarry_dispatch_text = true\ncarry_addressee = true\ncarry_dispatch_options = true\ncarry_dispatch_context = true\n```\n\nThe steps themselves live in the NPC's document, not in the manifest. Three\nsteps of the DM's creation guide:\n\n```json\n{ \"id\": \"kit\", \"title\": \"Starting kit\", \"source\": \"class-kits\", \"depends_on\": [\"class\"] }\n{ \"id\": \"equipment\", \"title\": \"Equipment\", \"source\": \"kit-equipment\",\n \"depends_on\": [\"class\", \"kit\"], \"paged\": true }\n{ \"id\": \"scores\", \"title\": \"Ability scores\", \"source\": \"standard-array\",\n \"show_when\": { \"unanswered\": \"name\" }, \"reopen\": false }\n```\n\n## Proof\n\n- `crates/spellkave-npc-host/src/guide.rs` (inline tests): the walk follows\n the data order, a hidden step is skipped, a paged step leaves a slot for the\n page turn, a changed answer drops what hangs on it, the outline lists the\n draft and the way ahead and is cut at its bound.\n- `crates/spellkave-npc-host/src/dm/engine/creation_tests.rs`:\n `native_creation_asks_in_the_order_the_guide_holds` (swapping two steps in\n the data swaps the questions, forward and back),\n `native_creation_drops_dependent_answers_by_the_guide`,\n `native_creation_machine_side_lists_the_draft_and_the_way_ahead`,\n `native_creation_refuses_a_duty_document_without_a_guide`.\n- `crates/spellkave-validate/src/guide.rs` (inline tests): every shape rule\n refuses, `show_when` cannot nest.\n- the world API,\n `k5_dispatch_context_is_carried_only_when_opted_in`: the context reaches the\n payload only under the flag.\n- `packages/spellkave-sdk/src/__tests__/audience_trace_presentation.test.ts`:\n the machine side is read from the occurrence's own trace; a malformed one is\n dropped and the question kept.\n- These are engine, kernel and reader tests. The hand-played live run is\n recorded in `ledger/designs/guided-dialogue-tree.md`.\n\n## Related\n\n[Draft-then-confirm wizard](./draft-then-confirm-wizard.md),\n[dialog choice slots](./dialog-choice-slots.md),\n[prompt occurrence](./prompt-occurrence.md), and the\n[context carriage](../interaction-dsl-and-world-authoring.md#carrying-opaque-presentation-context-carry_dispatch_context).\n\n## Known misuse / anti-pattern\n\n- Branching on a step id in a client. Ids are opaque; show titles.\n- Putting anything private into the machine side. Everyone who hears the\n question can read it.\n- Treating the machine side as permission. It is presentation; the server\n reads none of it, and the prompt occurrence and the world decide what may\n be answered.\n- Changing the order of a guide while a draft is open. The NPC rebuilds a\n draft from the dialogue history and resolves a numbered answer against the\n question as it is asked now.\n- A second copy of the order in the kind's program \"for convenience\".\n\n## SRD features that use this\n\nAldwin's hero creation. Its guide is `creation.guide` in the DM duty document.\nThe menu-talker kind does not carry a guide yet.\n"},{"id":"patterns/identity-tag-capability-grant","title":"Identity-tag capability grant","kind":"guide","summary":"Every creature should be able to walk, attack, dodge, rest and attempt checks — how do I grant that once instead of copying capability rows onto every definition, and when is a di…","tags":["patterns","identity","tag","capability","grant"],"body":"# Identity-tag capability grant\n\n## Name\n\n`identity-tag-capability-grant` — Stable identity tags grant stable attempts\n\n## Problem\n\nEvery creature should be able to walk, attack, dodge, rest and attempt checks — how do I grant that once instead of copying capability rows onto every definition, and when is a direct grant still right?\n\n## Forces\n\n- Copying universal capability rows onto every definition is cargo cult\n that drifts; a scenario adopting a blueprint must not re-copy them.\n- Membership of a category (creature, player character) is not the same\n fact as a modality (can produce speech) or a competence (knows a\n language) — conflating them grants speech to corpses or to bodies that\n only *understand*.\n- A capability is eligibility to attempt; the verb's predicate, resources,\n conditions, target, range and equipment still constrain the attempt.\n- The effective capability union is an enforcement concept: direct-row\n listings do not expand tag, equipped-item, or condition grants.\n\n## Solution\n\nAn actor's effective capabilities are the union of four independent\nsources — use each for what it is:\n\n| Source | Use it for | Example |\n|---|---|---|\n| `tag_capability_grant` | stable identity-derived attempts | `<bundle>.creature` → walk, attack, dodge, checks |\n| explicit definition / instance grant | a narrow authored behavior or a sourced choice | a chosen skill proficiency, a DM's watch extent |\n| `entity_definitions.grants_capability_while_equipped` | ability granted while the item occupies an equipment slot | a ring that grants Detect Magic |\n| active condition | temporary behavior or suppression | [`condition-grant-and-suppression`](./condition-grant-and-suppression.md) |\n\nEquipped-item CSVs are folded on read from occupied `entity_equipment_slot`\nrows (same `capability_ids_for_actor` site as identity and conditions;\nsuppression still wins). Unequip drops that item's ids. Do not re-encode a\nworn grant as a condition to work around a missing fold — that was the\npre-sk-54d workaround. Weapon *eligibility* still uses item tags (see the\nSRD capabilities page), not this CSV.\n\nRules of thumb:\n\n- Separate **attempt** from **proficiency**: `check/<skill>` (may attempt;\n from the creature tag) vs `skill/<skill>` (proficient; an explicit\n choice). The predicate adds the bonus only when the second is present.\n- Separate **modality** from **membership** and **competence**: a vocal tag\n grants speech; the creature tag makes a body addressable; a language tag\n records competence. Derive the vocal tag from the source (an\n \"understands only\" line grants nothing).\n- Tags that select rule branches (`<bundle>.monster`) grant nothing; tags\n consumed by equipped-item behavior (weapon range class) grant nothing\n either — every live tag names its concrete reader.\n- Retain a direct grant only when its narrower source can be named.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/creature-identity.toml`:\n\n```toml\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/capability/walk\"\ntag = \"srd.creature\"\n\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/action/attack\"\ntag = \"srd.creature\"\n\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/action/dodge\"\ntag = \"srd.creature\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/character-identity-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/creature-units.test.ts`\n (vocal tag derived from the cached `Languages` line, 179 rows)\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-actor-capabilities-no-dup.test.ts`\n (instances do not mirror tag-derived grants)\n\n## Related\n\n[`blueprint-instance-override`](./blueprint-instance-override.md)\n(instances inherit definition tags),\n[`condition-grant-and-suppression`](./condition-grant-and-suppression.md),\n[`directed-speech-anchor`](./directed-speech-anchor.md) (who may speak),\n[`tag-membership-menu`](./tag-membership-menu.md),\n[`affordance-needs-niche-attachment`](../repairs/affordance-needs-niche-attachment.md).\n\n## Known misuse / anti-pattern\n\n- Granting all `skill/*` as a creature or PC baseline.\n- Making the creature tag or a language tag grant speech; using the vocal\n tag to model telepathy.\n- Mirroring tag-derived capabilities into\n `entity_definition_initial_capability` / `actor_capabilities`.\n- Reading `selfStates(kind=\"capability\")` as the effective set — verify a\n tag-derived grant by the tag plus the gated affordance it enables.\n\n## SRD features that use this\n\n- `srd.creature` (walk, Attack umbrella, Dash, Dodge, Help, Drop Prone,\n Stand Up, Utilize, Pickup, Consume, rests, 24 check verbs;\n `fixtures/base/playing-the-game/creature-identity.toml`), `srd.player_character` (Level Up, Claim Victory, Heroic\n Inspiration), `srd.communication.vocal` (Speak), caster class tags →\n `srd/action/magic`. The complete ownership split:\n [`capabilities-and-identity.md`](../../../spellkave-srd-cc/docs/capabilities-and-identity.md).\n"},{"id":"patterns/item-sourced-damage","title":"Item-sourced damage (weapon slot read by a shared attack)","kind":"guide","summary":"I need to give a weapon — manufactured or a monster's Bite/Slam — its own damage so ONE shared attack verb deals the right amount, without a bespoke action per weapon or per creat…","tags":["patterns","item","sourced","damage"],"body":"# Item-sourced damage (weapon slot read by a shared attack)\n\n## Name\n\n`item-sourced-damage` — Item-sourced damage (the wielded item owns its magnitude)\n\n## Problem\n\nI need to give a weapon — manufactured or a monster's Bite/Slam — its own damage so ONE shared attack verb deals the right amount, without a bespoke action per weapon or per creature.\n\n## Forces\n\n- A per-creature attack verb would appear in every palette that shares the\n capability (a wolf's Bite clone shows up for the fighter).\n- The magnitude must compose with attacker facts (ability modifier) and\n target facts (resistance), which a roll table cannot do.\n- Exactly one site may own the sign: negate in both the slot and the write\n and they cancel; negate in neither and you heal the target.\n- The to-hit side and the damage side must select the **same** ability\n (finesse is \"for the attack and damage rolls\").\n- A tagged weapon with no damage slot must fail loudly, not deal nothing.\n\n## Solution\n\n1. The item carries a **positive magnitude** in an\n `entity_definition_item_dsl_source` row, slot `<bundle>/damage`\n (`<die> + <ability modifier>`; item slots are macro-aware). A ranged\n item carries a second slot for its normal range.\n2. The item carries its identity tags: the weapon tag, the range class\n (`<melee|ranged>`) the shared offer predicate reads, and a documentary\n damage-type tag that the shared write reads for routing.\n3. The **shared attack write** reads\n `actor.equipped_item('<bundle>/slot/main-hand').source('<bundle>/damage')`, negates once, and\n composes the defense ladder\n ([`damage-type-routing`](./damage-type-routing.md)) keyed by the item's\n damage-type tag.\n4. **Natural weapons are wielded items**: tag them with the same weapon +\n range identity (no purchase category / mastery axes), seed them via\n definition-level initial equipment so every spawned instance is born\n with one. Derive the finesse tag per creature by comparing the source's\n damage bonus against both ability modifiers — never assume it.\n\nThe site that owns the `ModifyResource` owns the sign: item slots are\npositive and are negated by the shared write; a spell or trap, which has no\nitem, negates at its own write site.\n\nThe slot is authored vocabulary, not a built-in weapon classification. Declare\nit and use the same slot for equipment seeds, offer gates, to-hit checks and\ndamage reads. ADR-0126 supplies facts only for exactly one existing item in\nthat actor-slot relation; missing, dangling or ambiguous occupancy has no item\nfacts and does not fall back to carried items. Item source expressions retain\nthe surrounding Actor and Target. The legacy `actor.wielded_item` accessor\nremains available, but its minimum-ID selection is unsuitable when unrelated\nequipment must not determine which weapon this pattern reads.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/monsters/giant-rat.toml`\n(a natural weapon is a wielded item):\n\n```toml\n[[entity_definition_initial_equipment]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/creature/giant-rat\"\nequipped_entity_def_id = \"srd/natural-weapon/giant-rat-bite\"\nslot_id = \"srd/slot/main-hand\"\n\n[[entity_definition_item_dsl_source]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/natural-weapon/giant-rat-bite\"\nslot = \"srd/damage\"\nsource = \"1d4 + (max(macro('srd/strength_modifier'), macro('srd/dexterity_modifier')))\"\n\n[[entity_definition_tag]]\nentity_def_id = \"srd/natural-weapon/giant-rat-bite\"\ntag = \"srd.weapon\"\n# + srd.weapon.range.melee, srd.weapon.property.finesse (DEX-driven per the source), srd.damage_type.piercing\n```\n\nShared write, simplified from\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(one ladder branch; the melee variants also add\n`cond(actor.status('srd/condition/raging') == true, 2, 0)` to `dmg`):\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/hp\"\ndelta_source = \"cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.damage_type.piercing'), 0 - (let dmg = max(0, actor.equipped_item('srd/slot/main-hand').source('srd/damage')); cond(target.has_tag('damage_immune:piercing'), 0, cond(target.has_tag('damage_resist:piercing'), dmg / 2, cond(target.has_tag('damage_vulnerable:piercing'), dmg * 2, dmg)))), …)\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/weapon-attack-units.test.ts`\n (finesse branch, item identity gate)\n- Fail-closed on a missing slot: `MissingItemDslSource` in\n `crates/spellkave-dsl/src/eval.rs:1454` (unit tests at `:3419-3460`); the\n validator warns at authoring time (`crates/spellkave-validate/src/refs.rs:694`)\n- `packages/spellkave-srd-cc/src/test/offline/weapon-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/damage-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/monsters/starter-arena.test.ts`\n\n## Related\n\n[`damage-type-routing`](./damage-type-routing.md) (the ladder and the two\nhelpers), [`derived-value-mechanism`](./derived-value-mechanism.md) (macros\nlegal on slots AND on `delta_source`; prefer the item slot for reusable\nattacker math, `delta_source` for a one-off non-item-sourced number),\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`weapon-stricter-affordance-variant`](../repairs/weapon-stricter-affordance-variant.md),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md)\n(definition-level equipment seeds).\n\n## Known misuse / anti-pattern\n\n- A per-creature `…/action/bite` verb cloned from the shared attack.\n- Enumerating a die as an N-row weight-1 int roll table with a text\n pointer (retired idiom: it could not compose with any fact).\n- Negating in the slot as well as at the write; or a spell that reuses the\n positive-magnitude helper at its own write site.\n- Omitting the item because \"the dice happen to match\" — identity and\n affordance provenance are load-bearing.\n- Tagging a natural weapon with purchase category / mastery axes, or\n assuming finesse from a sample of two creatures.\n\n## SRD features that use this\n\n- Every manufactured weapon (`fixtures/base/equipment/weapons/<slug>.toml`),\n every CR 0–4 natural weapon, Opportunity Attack's weapon branch. The\n attack archetype, reach/range ownership and the retired-idiom tombstone:\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md),\n [`authoring-damage.md`](../../../spellkave-srd-cc/docs/authoring-damage.md).\n"},{"id":"patterns/kill-xp-grant","title":"Kill-time XP grant","kind":"guide","summary":"When a creature dies I need the killer to receive that corpse's XP worth immediately — not when someone later takes a \"claim victory\" verb.","tags":["patterns","kill","xp","grant"],"body":"# Kill-time XP grant\n\n## Name\n\n`kill-xp-grant` — Kill-time XP grant (NPC watch pays the killer)\n\n## Problem\n\nWhen a creature dies I need the killer to receive that corpse's XP worth immediately — not when someone later takes a \"claim victory\" verb.\n\n## Forces\n\n- The awarding NPC writing the killer cannot read a third entity's XP worth\n inside that write's `delta_source`. The host reads the observed corpse.\n- Attacks remain ordinary attacks; the award belongs to the DM's watch.\n- A persistent victim latch prevents repeated payments after successful awards\n and host restarts. Process memory alone cannot establish that guarantee.\n- Seeing the fight and holding authority to change state are separate grants.\n\n## Solution\n\nAuthor the finite `srd/dm/spend-xp-value` and `srd/dm/award-xp` actions before\nplay. Both require `frontier.set_state`; the DM needs admitted reach to their\ntargets as well as observation of the dead body and its recorded killer.\nThe watch in `adventure-runtime/src/dm/watches/initiative-watch.ts`:\n\n1. observes `srd/condition/dead`, the killer and live `srd/xp_value`;\n2. dispatches `srd/dm/spend-xp-value` at the victim and awaits success;\n3. dispatches `srd/dm/award-xp` at the killer with that observed quantity.\n\nThese are two ordered dispatches. If the award fails after the spend succeeds,\nthe value is already consumed and the host reports `kill_xp_award_lost`.\nThe pair is not one atomic transaction. A kill with no running NPC host is\nnot paid by this watch. No action definition or manifest delta is published\nper kill.\n\n## Authored write example\n\nThe following consequence fragments come from\n`spellkave-srd-cc/src/chapters/classes/dm-act-units.ts`. They belong to separate\npreauthored actions; the spend predicate requires positive victim XP worth.\n\n```toml\n# srd/dm/spend-xp-value, targeted at the victim:\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/xp_value\"\ndelta_source = \"-target.stat('srd/xp_value')\"\n\n# srd/dm/award-xp, targeted at the killer:\n# ModifyResource.actor = \"TargetActor\"\n# ModifyResource.resource = \"srd/xp\"\n# ModifyResource.delta_source = \"actor.stat('core/dispatch_arg_quantity')\"\n```\n\nThe quantity is an act argument evaluated during the dispatch, not a newly\nrendered literal definition. Legacy `renderGrantKillXp` exports remain\npublisher composition helpers; their offline rendering tests do not prove the\ncurrent watch's live dispatch path.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/kill-xp.live.test.ts`\n checks observed XP, spent latch and replay behavior through the actual watch.\n- `packages/spellkave-srd-cc/src/test/offline/dm-act-catalog.test.ts`\n checks the authored action catalog.\n\n## Related\n\n[`quest-xp-grant`](./quest-xp-grant.md),\n[`proactive-level-up`](./proactive-level-up.md),\n[`computed-literal`](./computed-literal.md),\n[`actor-stat-self-only`](../repairs/actor-stat-self-only.md).\n\n## Known misuse / anti-pattern\n\n- Publishing a per-kill action definition from the DM host.\n- Awarding without spending the persistent victim latch.\n- Treating the two receipts as an atomic award or silently ignoring a failed award.\n- Hardcoding an XP amount onto each attack template.\n\n## SRD features that use this\n\nElven-mini Aldwin's watch reads catalog creatures' `srd/xp_value`.\nBundle-specific values: [`kill-time-xp.md`](../../../spellkave-srd-cc/docs/kill-time-xp.md).\n"},{"id":"patterns/lingering-hazard-zone","title":"Lingering hazard zone (self-pulsing)","kind":"guide","summary":"I need a Cloudkill / burning-room hazard that damages whoever stands in it each round, then fades, without the player re-casting every turn.","tags":["patterns","lingering","hazard","zone"],"body":"# Lingering hazard zone (self-pulsing)\n\n## Name\n\n`lingering-hazard-zone` — Lingering hazard zone (self-pulsing)\n\n## Problem\n\nI need a Cloudkill / burning-room hazard that damages whoever stands in it each round, then fades, without the player re-casting every turn.\n\n## Forces\n\n- The world clock must not kill actors without a subject (ADR-0004 / ADR-0041).\n- Pulses need caster (or fire-entity) attribution and a bounded `repeats_remaining`.\n- Cast-time Inscribe of a spatial marker is separate from the pulse body (autonomy fence).\n\n## Solution\n\nAuthor a subject-bound `[[autonomy_jobs]]` (or cast → `ScheduleAutonomyJob`) whose\n`dsl_function` is a consequence that fans `ForEachActorInRadius` → `ModifyResource`.\nFull guide: [`lingering-hazard-zones.md`](../lingering-hazard-zones.md). Live\nno-cast proof: `mech_burning_room`.\n\n## TOML example\n\nCopied from `packages/spellkave-mechanics/fixtures/mech_burning_room/manifest.toml (generated by packages/spellkave-mechanics/src/burning-room.ts)`:\n\n```toml\n[[autonomy_jobs]]\nanchor_place_node_id = \"mech_burning_room/room\"\nbundle_id = \"mech_burning_room\"\ndsl_function = \"mech_burning_room/pulse\"\nfrequency_ms = 6000\njob_id = \"mech_burning_room/fire_pulse\"\nrepeats_remaining = 3\nrequires_subject_alive = false\nsubject_entity_key = \"mech_burning_room/fire\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"mech_burning_room/pulse\"\nframe_write = { ForEachActorInRadius = { center_ref = \"TargetSpatialRef\", shape_id = \"core/area/node_ball\", shape_params_json = '{\"ball_radius\": 0}', predicate_source = \"\", body = [ { ModifyResource = { actor = \"Actor\", resource = \"mech_burning_room/hp\", delta_source = \"-3\" } } ] } }\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/area-hazards.test.ts` (Caltrops\n and Ball Bearings pulses, routed damage ladder).\n- Validator: `crates/spellkave-validate/src/autonomy_jobs.rs` unit tests (pulse\n subject resolution, e.g. `subject_entity_key_resolving_to_an_entity_is_eligible`).\n- Guide: [`lingering-hazard-zones.md`](../lingering-hazard-zones.md).\n\n## Related\n\n[lingering-hazard-zones](../lingering-hazard-zones.md), [damage-type-routing](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\nAmbient world-clock damage with no subject. Unbounded `repeats_remaining`. Putting Inscribe on the pulse instead of the cast.\nCalling `macro()` in the pulse's `ForEachActorInRadius.predicate_source`:\noffline validation accepts it, but the kernel parses that predicate without\nthe macro table and disables the job at its first fire with\n`MF-DSL-MACRO-UNKNOWN` (sk-jay0.2.43). Inline the macro body instead.\n\n## SRD features that use this\n\n- **Moonbeam / Flaming Sphere / Spike Growth** (srd-cc L12d `lingering_damage_zone`).\n- **Cloudkill**: only the retired `srd` bundle authored its pulse (cast shape\n in lingering-hazard-zones.md); the srd-cc Cloudkill is identity-only.\n- Generic **burning room** environmental hazard (mech_burning_room).\n- **Caltrops / Ball Bearings** (srd-cc `srd/item/caltrops/spread`,\n `srd/item/ball-bearings/spill`, sk-jay0.3.19.6): a self-only Utilize verb\n spends the item, spares the creatures already on the node until their next\n turn start, and schedules a 10-round pulse on the user's node. The pulse\n predicate skips spared creatures and runs the occupant's Dexterity save; the\n body is damage plus a Speed 0 condition, or Prone, plus a \"struck\" status\n that spares the creature until its next turn start. Monster Death and PC\n Unconscious carriers follow in the same template. The pulse hits creatures\n standing in the area, not creatures that enter it: see\n `packages/spellkave-srd-cc/docs/equipment-catalogue.md` § Area hazards.\n"},{"id":"patterns/loot-table-drop","title":"Loot table drop","kind":"guide","summary":"A quest terminal or boss kill should pay a treasure item drawn from SRD rarity/CR guidance — without smuggling free-text item names into `roll_table` (int-draw only) and without a…","tags":["patterns","loot","table","drop"],"body":"# Loot table drop\n\n## Name\n\n`loot-table-drop` — Treasure draw via int roll table + host grant\n\n## Problem\n\nA quest terminal or boss kill should pay a treasure item drawn from SRD\nrarity/CR guidance — without smuggling free-text item names into\n`roll_table` (int-draw only) and without a kernel \"drop on death\" arm.\n\n## Forces\n\n- DSL `roll_table()` is **int-only** (`dsl-grammar.md` §RollTable, MF-VAL-317).\n- Item identity lives on `entity_definitions` (`srd/magic_item/…`, potions).\n- Kill-time and quest rewards already use DM/host computed grants\n ([kill-xp-grant](./kill-xp-grant.md), [quest-xp-grant](./quest-xp-grant.md)).\n- Party should perceive that loot appeared (trace / Public entity).\n\n## Solution\n\n1. Author weighted **int** `roll_tables` per rarity/CR/quest/boss band.\n2. Keep a TypeScript **code → entity_def_id** catalog beside the generator.\n3. At terminal/boss time the host (Aldwin) draws or selects a code, resolves\n the catalog, and **places** the item (or grants quantity) as a computed\n act — same class of solution as kill XP. **Not wired in elven-mini yet:**\n `watchForQuestLoot` (`packages/spellkave-adventure-runtime/src/dm/watches/quest-loot-watch.ts`) is exported but\n never started, and `decideBossLootDrop` (`author/loot-drop.ts:194`) is\n called only from tests, so no loot drops at runtime (bug\n `sk-jay0.3.4.11.6`).\n4. Emit a **party-visible trace** (`place_node_traces` / Inscribe) naming the\n drop so players can read it without operator SQL.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/magic-items/loot-tables.toml`\n(generated by `src/chapters/magic-items/loot-tables.ts`):\n\n```toml\n# pattern: loot-table-drop\n[[roll_tables]]\nroll_table_id = \"srd/loot/boss/q4-fanatic\"\nbundle_id = \"srd\"\nresult_kind = \"int\"\ndisplay_name = \"Q4 Sister Maelis boss drop\"\n\n[[roll_table_entries]]\nroll_table_entry_id = \"srd/loot/boss/q4-fanatic:1\"\nroll_table_id = \"srd/loot/boss/q4-fanatic\"\nauthored_order = 1\nweight = 5\nresult_ref = \"20\"\n```\n\nHost maps `20` → `srd/magic_item/longsword-plus-1` via `LOOT_CODE_CATALOG`.\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/magic-items-coverage.test.ts`\n (loot table fixture + catalog resolution).\n- Live (gated, `SPELLKAVE_LOCAL_NODE=1`):\n `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/q4-fanatic-loot.test.ts`\n seeds the loot entity directly and reads it back; it does not kill the\n fanatic or draw from the table. No test covers the draw-and-place step\n end to end.\n\n## Related\n\n[kill-xp-grant](./kill-xp-grant.md), [quest-xp-grant](./quest-xp-grant.md),\n[computed-literal](./computed-literal.md),\n[weighted-int-roll-table](../examples/weighted-int-roll-table.md).\n\n## Known misuse / anti-pattern\n\n- `result_ref = \"longsword +1\"` on an int table (`MF-VAL-210`, fatal).\n- Identity-mapped 1..N weight-1 die smuggled as a loot table (MF-VAL-317).\n- Kernel gap for \"drop on death\" before trying host grant + table draw.\n\n## SRD features that use this\n\n- Magic item treasure by rarity (magic-items.md).\n- Elven-mini Q3/Q10 rewards and Q4 boss drop (sk-609b.13) — designed and\n tabled, not yet dropped at runtime (see Solution step 3).\n"},{"id":"patterns/mastery-gated-attack-variant","title":"Mastery-gated attack variant (stricter sibling of a shared attack)","kind":"guide","summary":"I need an on-hit rider (Weapon Mastery Sap/Vex, Sneak Attack dice, …) that cannot live inside the shared melee/ranged success consequence, because the shared write either (a) rebo…","tags":["patterns","mastery","gated","attack","variant"],"body":"# Mastery-gated attack variant (stricter sibling of a shared attack)\n\n## Name\n\n`mastery-gated-attack-variant` — A full sibling attack action gated on a\nwielded-item (or class) tag, carrying its own hit consequence\n\n## Problem\n\nI need an on-hit rider (Weapon Mastery Sap/Vex, Sneak Attack dice, …) that\ncannot live inside the shared melee/ranged success consequence, because the\nshared write either (a) rebounds Actor away from the attacker inside\n`ForEachActorInRadius`, or (b) already hosts a multi-type damage ladder that\nanother rider would have to be threaded through.\n\n## Forces\n\n- Offer predicates that read attacker-only facts\n (`equipped_item('<slot>').has_tag`, `has_capability`, a once-per-turn spent\n marker) are fine — they stay on the\n acting subject.\n- Shared melee success cannot host a gated `ApplyStatus` that needs attacker\n weapon tags: `ForEach` rebinds Actor to the cell occupant (see\n `weapon-stricter-affordance-variant` and L12a mastery riders).\n- Folding class riders into the 13-type damage tower has already failed\n validation once (Sneak Attack attempt 1 → MF-VAL-256, a frame-write DSL\n parse error). The parser has no nesting limit, so the failure was an\n authoring error in a very long expression, not a ceiling; the shipped\n Sneak Attack instead adds its dice as a separate ordinal\n (`sneak-attack.toml:100-106`).\n- A miss still needs its own authored `on_failure` consequence\n ([`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)).\n\n## Solution\n\nAuthor a **dedicated shallow attack action** that is a full sibling of\n`srd/attack/melee` / `srd/attack/ranged`:\n\n1. **Offer** — capability + range + the distinguishing gate\n (`actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.mastery.vex')`, or\n `actor.has_capability('srd/class-feature/rogue/sneak-attack')` +\n Finesse/Ranged + `!actor.status('…/expended')`).\n2. **Resolution** — same Stochastic to-hit as the base attack\n (`resolution_scope = srd/attack_roll`, `accepts_global_storm = true`).\n3. **Consequence** — weapon damage (item-sourced) **plus** the rider\n (`ApplyStatus`, conditional Nd6, …) as its own ordinal on the same shallow\n template — not folded back into the shared ladder. A rider that deals\n typed damage needs its own routing ladder; the shipped Sneak Attack dice\n are not type-routed.\n4. **Once-per-turn** — prefer an actor-scoped spent condition with\n `expires_at_boundary = turn_start` / `owner_actor = Actor` (auto-clears next\n turn). Gate offer on `actor.status('…') == false`. Document the reset.\n\nCite this page from generator source (`// pattern: mastery-gated-attack-variant`)\nand emitted TOML (`# pattern: mastery-gated-attack-variant`).\n\n## TOML example\n\nSneak Attack (K-A facts) — `packages/spellkave-srd-cc/fixtures/base/playing-the-game/sneak-attack.toml`:\n\n```toml\n[[action_definitions]]\naction_id = \"srd/attack/sneak-attack\"\nbundle_id = \"srd\"\ndisplay_name = \"Sneak Attack\"\nrequired_capability = \"srd/action/attack\"\nresolution_mode = \"Stochastic\"\nresolution_scope = \"srd/attack_roll\"\non_success = \"srd/attack/sneak-attack/success\"\non_failure = \"srd/attack/sneak-attack/miss\"\n# offer predicate (generated) also requires Finesse|Ranged, dice ≥ 1,\n# !status(sneak-attack-expended)\n\n[[consequence_frame_writes]]\ntemplate_id = \"srd/attack/sneak-attack/success\"\nordinal = 0\n# weapon damage + cond(resolution_roll_modifier == 1 || peers_near_target(...), Nd6, 0)\n```\n\nVex mastery — `weapon-mastery-riders.toml` action `srd/attack/melee-vex`.\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/martial-features-coverage.test.ts` (#101 evidence)\n- Offline: mastery riders unit summaries in `weapon-mastery-riders.ts`\n- Live (when node up): `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/sneak-attack.ts`\n- Kernel facts demo: `openspec/specs/world-interaction-kernel/demos/sk-609b-ka-resolution-facts.demo.md`\n\n## Related\n\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`condition-grant-and-suppression`](./condition-grant-and-suppression.md),\n[`weapon-stricter-affordance-variant`](../repairs/weapon-stricter-affordance-variant.md),\n[`damage-type-routing`](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\n- Folding another class rider into the shared multi-type damage tower.\n- Putting `peers_near_target` / `core/resolution_roll_modifier` in an **offer**\n predicate (materialiser seam does not populate them — ADR-0105 G-1).\n- Expecting `ForEachActorInRadius` body predicates to see attacker\n `equipped_item(...)` tags.\n- Reading `actor.wielded_item` in a new gate: it is the legacy accessor that\n picks the lowest-id item (see [`item-sourced-damage`](./item-sourced-damage.md)).\n\n## SRD features that use this\n\n- Weapon Mastery Sap / Slow / Topple / Graze / **Vex**\n- Rogue **Sneak Attack** (`srd/attack/sneak-attack`)\nNot this pattern: Paladin **Divine Smite** (`srd/paladin/divine-smite`) is a\nDeterministic self-contained action that debits `srd/spell_slot_1` and deals\n2d8 radiant with no to-hit roll and no weapon damage\n(`fixtures/base/classes/caster-features.toml:253-268`).\n"},{"id":"patterns/milestone-gate-terminal-flags","title":"Milestone gate on prior terminal flags","kind":"guide","summary":"My advancement beat gates on flags a much larger prior beat already set — do I have to replay that whole beat?","tags":["patterns","milestone","gate","terminal","flags"],"body":"# Milestone gate on prior terminal flags\n\n## Name\n\n`milestone-gate-terminal-flags` — Milestone gate on prior terminal flags\n\n## Problem\n\nMy advancement beat gates on flags a much larger prior beat already set — do I have to replay that whole beat?\n\n## Forces\n\n- Honest proof still requires real action execution against a live node.\n- Replaying unrelated combat/narrative content wastes agent time and flakes.\n- Each flag's own predicate usually needs only a strict subset of prior entities.\n\n## Solution\n\nRead each composed flag's OWN consequence predicate. Stage a trimmed session\nwith only the entities those predicates read, then execute the real action\nthat writes each flag. Full repair (its worked example is archived\nPhandelver content):\n[`repairs/milestone-gate-terminal-flags.md`](../repairs/milestone-gate-terminal-flags.md).\n\n## TOML example\n\nLive example (elven-mini Q9): the Q9 terminal reads the persistent flag\n`elven_mini/quest/flag/q9_tomb_opened` and the deep-tomb stair edge reads the\nseal's spatial state; the one `elven_mini/quest/open-tomb` action writes both\n(`author/tomb-key.ts`). The proof stages\njust the giver, the DM, the hero, the key item and one companion at the seal\nnode — not the Rung III fights before it — and executes the real actions:\n\n```toml\n# compose only what the gate reads:\n# gates: Q9 terminal reads quest/flag/q9_tomb_opened; the stair edge reads the seal state\n# writer: elven_mini/quest/open-tomb (hero holds the tomb key, stands at the seal)\n# stage: giver + DM + hero + key + one companion at TOMB_SEAL_NODE\n```\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/quest-giver.live.test.ts`\n and `packages/spellkave-test-lab/src/scene-live/seal-gate.local-node.test.ts`\n (private scenes; accept Q9, open the tomb with the key, the stair opens).\n- `packages/spellkave-adventure-elven-mini/tests/offline/quest-progression.test.ts`.\n\n## Related\n\n[advancement-choice](./advancement-choice.md), [proactive-level-up](./proactive-level-up.md).\n\n## Known misuse / anti-pattern\n\nSeeding terminal flags in a *proof* without executing the actions that set\nthem (a story save state such as `fixtures/story/hero.toml`, which records\na world after the action ran, is a different thing). Assuming 'replay the\nwhole prior beat' is the only honest path.\n\n## SRD features that use this\n\n- Level-up / story milestone beats that gate on prior quest or combat terminals.\n"},{"id":"patterns/multiattack-ordinals","title":"Multiattack as baked ordinals","kind":"guide","summary":"I need a creature to make several attacks in one action (Multiattack), or an action whose numbers the shared attack archetype cannot host (flat damage, ability math that does not …","tags":["patterns","multiattack","ordinals"],"body":"# Multiattack as baked ordinals\n\n## Name\n\n`multiattack-ordinals` — Multiattack as N independent rolled ordinals in one consequence\n\n## Problem\n\nI need a creature to make several attacks in one action (Multiattack), or an action whose numbers the shared attack archetype cannot host (flat damage, ability math that does not match the creature's facts).\n\n## Forces\n\n- There is no kernel multiattack primitive and none is needed: a\n consequence already holds an ordered list of frame writes.\n- Each attack must roll its own d20 and its own damage.\n- Later ordinals must observe earlier ordinals' committed state (lethal\n cascade, temp-HP lose-first).\n- A bespoke creature verb must not leak into other actors' palettes.\n- **What a baked ordinal gives up.** The generated ordinal compares\n `roll + to-hit >= AC` directly and subtracts raw damage. It does not call\n `macro('srd/attack_roll_hits', …)`, so it has no natural-20/natural-1 or\n critical-hit handling, and it has no damage-type ladder, so resistance,\n immunity and vulnerability are ignored (srd-cc\n `src/chapters/monsters/starter-behaviors.ts:224-233`; the breath/area route\n does route, `:340-346`). Tracked as `sk-jay0.3.10.5`. Add the ladder from\n [`damage-type-routing`](./damage-type-routing.md) by hand if a stat block\n needs it.\n\n## Solution\n\nEmit ONE action whose success consequence carries N `ModifyResource`\nordinals, each self-contained:\n`let atkN_roll = d20; cond(atkN_roll + <to-hit> >= target.effective('<ac>'), 0 - (max(0, <damage>)), 0)`,\nfollowed by the consequence-side idioms:\n\n- **Lethality guard** as a trailing `ForEachActorInRadius` with\n `ball_radius 0` at `TargetSpatialRef`, predicate\n `actor.has_tag('<member>') && actor.stat('<hp>') <= 0` (membership before\n measurement — a co-located HP-less dummy raises `UnknownField` on the\n `stat` read; the kernel skips that occupant with a `write_failure`\n provenance row rather than aborting the batch, but the `has_tag` conjunct\n still belongs first). Inside that body the selected entity is `actor`, not\n `target`.\n- **Sequential ordinals chain**: two writes in one consequence may depend\n on each other; ordinal k+1 sees ordinal k's result.\n\nGate a bespoke creature action with TWO capabilities with different jobs:\nthe affordance template's `capability_id` is per-creature (granted only by\nthat creature's definition — keeps \"Black Bear — Multiattack\" out of the\nhero's palette), while the action's `required_capability` stays the shared\nhostile-action discriminator the initiative watch keys on.\n\nCheck the arithmetic first: if the shared archetype plus an equipped item\nalready reproduces the stat block ([`item-sourced-damage`](./item-sourced-damage.md)),\nprefer it — baked ordinals are the second route, not the default.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/monsters/starter-behaviors.toml`\n(Black Bear Multiattack, two attacks + lethality guard; other rows of the\nsame action omitted):\n\n```toml\n[[affordance_templates]]\naccepts_global_storm = true\nbundle_id = \"srd\"\ncapability_id = \"srd/creature/black-bear/action\" # per-creature gate\nniche_id = \"srd/niche/attack-verb\"\noutcome_template_id = \"srd/creature/black-bear/action/multiattack/outcome\"\nspends_channel = \"srd/economy_channel/primary\"\ntemplate_id = \"srd/creature/black-bear/action/multiattack/affordance\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let atk0_roll = d20; cond(atk0_roll + 4 >= target.effective('srd/ac'), 0 - (max(0, 1d6 + (2))), 0)\"\nresource = \"srd/hp\"\n\n[[consequence_frame_writes]]\nordinal = 1\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let atk1_roll = d20; cond(atk1_roll + 4 >= target.effective('srd/ac'), 0 - (max(0, 1d6 + (2))), 0)\"\nresource = \"srd/hp\"\n\n[[consequence_frame_writes]]\nordinal = 2\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius]\ncenter_ref = \"TargetSpatialRef\"\npredicate_source = \"actor.has_tag('srd.monster') && actor.stat('srd/hp') <= 0\"\nshape_id = \"core/area/node_ball\"\nshape_params_json = '{\"ball_radius\": 0}'\n\n[[consequence_frame_writes.frame_write.ForEachActorInRadius.body]]\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius.body.ApplyStatus]\ncondition_definition_id = \"srd/condition/dead\"\ntarget_kind = \"entity\"\ntarget_ref = \"Actor\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/bestiary-cr0-4-coverage.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/creature-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/monsters/starter-arena.test.ts`\n\n## Related\n\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`ordered-resource-grants`](../repairs/ordered-resource-grants.md)\n(ordinal ordering semantics),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md).\n\n## Known misuse / anti-pattern\n\n- Filing \"no multiattack primitive\" as a kernel gap.\n- Gating the bespoke action on the shared attack capability only (it then\n appears for every creature).\n- Writing `target.stat(...)` inside a `ForEachActorInRadius` body (the\n loop rebinds the selected entity to `actor`).\n- Reaching for baked ordinals when an equipped item would reproduce the\n numbers.\n- Assuming a baked ordinal respects resistance or crits (see Forces).\n\n## SRD features that use this\n\n- CR 0–4 bestiary Multiattack (Black/Brown Bear and the rest), flat-1\n damage actions, ability-mismatch stat blocks. Route selection and the\n n/a list (breath/AoE, condition riders):\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md).\n"},{"id":"patterns/offer-gate-consume-guard-parity","title":"Offer gate / consume guard parity","kind":"guide","summary":"An authored action is offered behind a gate (a phase state, a tag, a predicate on the world) and consumed by code that re-checks whether the thing is really ready. Two lists, two …","tags":["patterns","offer","gate","consume","guard","parity"],"body":"# Offer gate / consume guard parity\n\n## Name\n\n`offer-gate-consume-guard-parity` — the predicate that OFFERS an action and\nthe guard that COMMITS it are one list, in one place.\n\n## Problem\n\nAn authored action is offered behind a gate (a phase state, a tag, a\npredicate on the world) and consumed by code that re-checks whether the\nthing is really ready. Two lists, two files. They start identical and drift.\nWhen they disagree the action is offered, dispatched, and accepted — the\nworld really did fire the handle — and then quietly does nothing, because\nthe consumer's own guard refused. Nothing is written and nobody is told.\n\n## Forces\n\n- The gate must be cheap and world-readable: an affordance predicate can\n only see world state, so it reads a phase or a tag.\n- The consumer usually holds richer state than the gate can see — process\n memory, a draft, a catalog — so it re-checks. That re-check is legitimate.\n- A receipt of `accepted` means \"the handle dispatched\", not \"the intent\n succeeded\". Players and agents read it as the latter.\n- Failing closed is right. Failing closed *silently* is what turns a\n disagreement into an unexplainable wedge.\n\n## Solution\n\nExport ONE function that answers \"what is still missing\", and use it in both\nplaces: the guard returns early when it is non-empty, and the speaking or\nreporting path renders it. Reserve the success line for a commit that\nactually happened, so a refusal can never be mistaken for success.\n\n```ts\n/** Sole source for BOTH the reducer's guard and the DM's spoken rejection. */\nexport function missingConfirmKeys(state: DraftState): readonly string[] {\n\tconst missing: string[] = [];\n\tif (state.classSlug === null) missing.push(\"a class\");\n\tif (state.name === null) missing.push(\"a name\");\n\t// …\n\treturn missing;\n}\n\n// guard\nif (missingConfirmKeys(state).length > 0) return state; // unchanged, refused\nreturn { ...state, confirmed: true };\n\n// speech — same list, spoken\nHasRejectedConfirm(): boolean { return this.confirmMissingKeys.length > 0 && sawPick; }\n```\n\n## Proof\n\n`packages/spellkave-adventure-runtime/src/dm/creation/draft-state.ts`\n(`missingConfirmKeys`, used by `reduceCreationDraft`'s confirm branch) and\n`packages/spellkave-adventure-runtime/src/dm/creation/engine.ts`\n(`HasRejectedConfirm` / `SpeakConfirmRejection`, fed the same list through\nthe agent's per-cycle context) share the **guard and the spoken rejection**.\nTest: `packages/spellkave-srd-cc/src/test/offline/dm-creation.test.ts`,\n\"an incomplete confirm is SAID, not swallowed\" — asserts the DM names every\nopen key and does NOT speak the closing line.\n\n**The offer half is not shared yet.** The confirm offer is gated by a\ndifferent function, `creationStructuredDraftsComplete`\n(`…/dm/creation/steps.ts:104-146`), which accepts \"no kit\" and \"no skills\"\nwhen none remain to pick, while `missingConfirmKeys` always requires them.\nThat is this page's anti-pattern in the reference implementation (bug\n`sk-jay0.1.49`).\n\n## Related\n\n- [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md) — the wizard\n whose confirm this guards.\n- [`watch-reader-manifest-closure`](./watch-reader-manifest-closure.md) — the\n sibling failure where a read answers \"nothing found\" instead of failing.\n\n## Known misuse / anti-pattern\n\nSpeaking the success line off the *observed pick* rather than off the\n*committed state*. That is the version of this bug that lies loudest: the\nplayer hears \"It's done. Welcome to the world.\" while no character exists.\n\nEqually wrong: fixing the drift by loosening the consumer's guard so it\naccepts whatever the gate offered. The guard usually knows more than the\ngate; the answer is to share the guard's list with the gate, not to delete\nit.\n\nAlso not a fix: a timer or watchdog that retries the wedged step. A watchdog\nis the right tool for a genuinely missing wake-up signal; here the signal\narrives and the answer is wrong, so a cadence only hides the disagreement\nbehind a retry.\n\n## SRD features that use this\n\n- Elven-mini character creation's confirm: a one-slot runtime offer on\n `dm/dialog/choice/1` (the seeded `dm/creation/confirm` action is gated\n `1 == 0`, `…/dm/creation/seed.ts:800-809`), committed by the draft guard\n (six fixed keys plus the kit's equipment picks). Guard and speech share\n one list; the offer does not yet (see Proof).\n"},{"id":"patterns/offer-vs-resolution-roll","title":"Offer vs resolution roll (the d20 lives in act-time resolution)","kind":"guide","summary":"I need an attack or check that can miss: where does the d20 go so the verb is always offered when it is attemptable, and only the act decides hit or miss?","tags":["patterns","offer","vs","resolution","roll"],"body":"# Offer vs resolution roll (the d20 lives in act-time resolution)\n\n## Name\n\n`offer-vs-resolution-roll` — Offer proves attemptability; the roll lives in resolution\n\n## Problem\n\nI need an attack or check that can miss: where does the d20 go so the verb is always offered when it is attemptable, and only the act decides hit or miss?\n\n## Forces\n\n- Disclosure does not evaluate the template predicate: the materialiser\n offers a template when the actor holds its `capability_id`\n (the world API).\n The template predicate runs at act time with live draws\n (the world API).\n A die there turns a miss into a **rejected attempt**\n (`predicate_rejected`): no `on_failure` consequence runs and the rejection\n looks exactly like an ineligible target. (Before capability-only\n disclosure the same die also hid the verb: never once offered across 35\n live attempts.)\n- Offer predicates that read a target fact force `Place` locality and turn\n a target (an argument) into a precondition.\n- A miss needs its own authored outcome, not \"nothing happened\".\n- A `let`-bound die in an *affordance* predicate classifies as Global under\n the validator's conservative locality pass.\n\n## Solution\n\nSplit the verb into three stages:\n\n1. **Offer** — `affordance_templates.predicate_source` proves only\n *attemptability*: capability, wielded-item identity, range/reach. No\n die, no target-defense read.\n2. **Resolution** — `action_definitions.resolution_mode = \"Stochastic\"` +\n `resolution_predicate_source` holds the roll vs the target's effective\n defense, with an explicit `on_failure` consequence for the miss. srd-cc\n also sets `accepts_global_storm = true` on the attack affordances; the\n resolution die does not require it, because the validator's locality\n pass reads only `affordance_templates.predicate_source`\n (`crates/spellkave-validate/src/lib.rs:554-600`).\n3. **Consequence** — the hit's `ModifyResource` damage write. As of\n sk-awlo `delta_source` is macro-aware at act time — inline the formula\n for a genuinely one-off number, or call a macro when the same formula\n already has a named, reusable definition (see\n [`derived-value-mechanism`](./derived-value-mechanism.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(description and default-valued fields omitted):\n\n```toml\n[[action_definitions]]\naction_id = \"srd/attack/melee\"\nbundle_id = \"srd\"\ndisplay_name = \"Melee Attack\"\non_failure = \"srd/attack/melee/miss\"\non_success = \"srd/attack/melee/success\"\nrequired_capability = \"srd/action/attack\"\nresolution_mode = \"Stochastic\"\nresolution_predicate_source = \"let attack_roll = d20; macro('srd/attack_roll_hits', attack_roll, attack_roll + macro('srd/ability_modifier', cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.property.finesse'), max(actor.effective('srd/str'), actor.effective('srd/dex')), actor.effective('srd/str'))) + (actor.stat('srd/proficiency_bonus')), (target.effective('srd/ac')), cond(actor.has_capability('srd/class-feature/fighter/champion/improved-critical'), 19, 20))\"\nresolution_scope = \"srd/attack_roll\"\nself_eligible = false\nspends_channel = \"srd/economy_channel/primary\"\n```\n\n`srd/attack_roll_hits` takes four arguments (roll, total, AC, crit\nthreshold; `fixtures/base/playing-the-game/macros.toml`); the DSL rejects a wrong\nargument count (`crates/spellkave-dsl/src/lib.rs:1785`).\n\nThe matching affordance's `predicate_source` checks only the wielded item's\nrange identity and distance — never AC.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/attack-roll-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/making-an-attack-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/generic-check-units.test.ts`\n (checks use the same split with a DC)\n\n## Related\n\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`derived-value-mechanism`](./derived-value-mechanism.md),\n[`multiattack-ordinals`](./multiattack-ordinals.md) (several rolls inside\none consequence), [`interaction-dsl-and-world-authoring`](../interaction-dsl-and-world-authoring.md).\n\n## Known misuse / anti-pattern\n\n- `d20` (or any die) in an affordance predicate (a miss becomes a rejection).\n- A \"strikeable\" offer gate such as `target.stat('<ac>') >= 1` (retired: a\n target is an argument, not a precondition; it also forces locality).\n- An action with no `on_failure` for a stochastic resolution.\n- Filing \"attack never offered\" as a materialiser bug before checking the\n actor holds the template's `capability_id`.\n\n## SRD features that use this\n\n- Melee / Ranged / Unarmed / Opportunity Attack, every `srd/check/<subject>`\n verb, saving-throw style scene checks. Pipeline details:\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`): the\n target's Dexterity save, written from the thrower's side\n (`d20 + DC - mod >= 22`, same unbiased odds). The target's own save\n modifiers are not routed onto that d20; its against-bearer attack bias is\n (sk-jay0.2.41). Details:\n [`equipment-catalogue.md`](../../../spellkave-srd-cc/docs/equipment-catalogue.md#thrown-consumables).\n"},{"id":"patterns/operable-door","title":"An operable door between two places","kind":"guide","summary":"A player should open and close a door from either side. A closed or locked door should refuse a step, while the usual movement budget still applies.","tags":["patterns","operable","door"],"body":"# An operable door between two places\n\n## Name\n\n`operable-door` — Authored open/locked facts on a two-sided boundary.\n\n## Problem\n\nA player should open and close a door from either side. A closed or locked\ndoor should refuse a step, while the usual movement budget still applies.\n\n## Forces\n\n- `link_places --door` supplies a map tag. Traversal needs a predicate too.\n- The two directed edges represent one physical door. Changes at either\n endpoint must affect both directions.\n- Spatial-state definitions supply typed facts to location actions and to\n edge predicates (`@from_node` / `@to_node`). The writes are ordinary\n authored `Inscribe` consequences.\n- The door adds a gate to the existing movement mode. It retains the\n bundle's SRD step policy, speed budget and long-running movement session.\n\n## Solution\n\nGive this door its own pair of boolean spatial-state IDs, `open` and\n`locked`. Attach its operating niche to both endpoints. Each operation\nwrites the same value to both nodes in one consequence. Both directed\nedges read their own `@from_node` values, so either endpoint sees the same\nstate after an operation.\n\nThe worked fixture uses `door_pattern/open` and `door_pattern/locked` for\none door. Give another door distinct IDs, even when the doors share a room.\nMissing boolean values are false: this door starts closed and unlocked.\n\n| Open | Locked | Traversal | Open action |\n|---|---|---|---|\n| false | false | refused | admitted |\n| true | false | admitted | admitted |\n| false | true | refused | refused |\n\nThe fixture's lock action requires `open == false`. Its unlock action\nwrites `locked = false`. All four operations require the authored\n`door_pattern/operate` capability. A game with keys can give lock/unlock a\nseparate capability and grant that only to the appropriate player.\n\n## Authoring shape\n\nThe complete, CLI-authored example is\n[`behaviour/doors/fixtures/manifest.toml`](../../../spellkave-cli/behaviour/doors/fixtures/manifest.toml).\nIt places a player, Ada, in a two-room indoor graph and depends on `srd`.\nThe local proof seeds core mechanics and SRD before that root.\n\nDeclare each state through `write_rows --kind spatial_state_definitions`:\n\n```toml\n[[spatial_state_definitions]]\nbundle_id = \"door_pattern\"\nstate_id = \"door_pattern/open\"\ndescription = \"Whether the cellar door is open.\"\nvalue_type = \"bool\"\nwriter_policy = \"world_interaction\"\nmerge_rule = \"replace\"\nlod_policy = \"retain_latest\"\nfreshness_rule = \"expires_after_ticks:1000000000\"\n```\n\nDeclare `door_pattern/locked` with the same carrier. Use `define_niche`\nwith `attachments: [{node: <hall>}, {node: <room>}]`, and grant the operating\ncapability to the player. Each `define_action_verb` uses that niche. The\nopen action's eligibility predicate is:\n\n```text\ntarget.state('door_pattern/locked') == false\n```\n\nIts consequence has two `Inscribe` frame writes. One writes the hall:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"door_pattern/act/open/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"spatial_environment_state\"\nlocation_kind = \"place_node\"\nlocation_ref = \"door_pattern/cellar/hall\"\npayload_json = '{\"state_id\":\"door_pattern/open\",\"value\":true,\"visibility\":\"Public\"}'\n```\n\nThe second, at ordinal 1, writes `door_pattern/cellar/room` with the same\npayload. Close writes `open = false` at both endpoints. Lock and unlock\nwrite the corresponding `locked` value at both endpoints. These cooperative\nworld-state actions are unmetered and declare `non_steering = true`.\n\nThe edge gate has its own affordance template, using the existing\n`srd/capability/walk`, `srd/niche/traversable-square` and `srd/outcome/step`:\n\n```text\ntarget.state('door_pattern/open@from_node') == true && target.state('door_pattern/locked@from_node') == false\n```\n\nKeep the bundle's `set_movement_default` pointing at `srd/affordance/step`\nwith the normal speed and long-running-move bindings. Attach the extra gate\nto both directions:\n\n```bash\nsk bind_edge_affordance --from door_pattern/cellar/hall --to door_pattern/cellar/room --affordance-template-id door_pattern/door-gate --bidirectional\n```\n\nRows in the same default movement mode AND-join. Leave\n`inherit_movement_default` enabled. The\n[`bundle-movement-default`](bundle-movement-default.md) pattern explains the\ncomposition rule.\n\n## Player loop and proof\n\nRead `scene`, then copy the exit's own `handle` and `rev` into `move`.\nOperate the door by manipulating the current place node, for example:\n\n```bash\nsk --profile door-proof-ada manipulate --target-id place_node:door_pattern/cellar/hall --action-id door_pattern/act/open\n```\n\nInspect the action receipt; a successful CLI invocation alone does not prove\nthat the world accepted the action. Re-read the scene after a step to check\nthe player's location.\n\nThe live scenario in\n[`behaviour/doors/doors.feature`](../../../spellkave-cli/behaviour/doors/doors.feature)\nchecks the initially refused step, accepted open and traversal, close from\nthe room, refused return, and locked-door refusals. Run it with:\n\n```bash\nSPELLKAVE_PLAYTEST_LIVE=1 pnpm --filter @spellkave/cli run test:behaviour:doors\npnpm --filter @spellkave/cli run guide:doors\n```\n\nIt owns a disposable local world and uses a separate player credential.\nSupply a current prebuilt server module with `SPELLKAVE_SERVER_WASM_BIN`;\nthe default is the checkout's release Wasm under `server/target/`. The\nsuite starts the node and publishes that module once.\nThe generated [guide](../../../spellkave-cli/docs/doors-guide.md) and\n[evidence](../../../spellkave-cli/docs/doors-scenarios.md) contain the full\nCLI run.\n\n## Known misuse\n\n- Reusing one door's state IDs for a different door sharing an endpoint.\n- Updating only one endpoint: the reverse direction would retain old facts.\n- Putting the gate in another movement mode: alternatives OR-join and can\n leave a passing route around the door.\n- Disabling the inherited movement default and accidentally discarding the\n SRD movement budget.\n- Expecting a baseline reapply to reset played state. Runtime spatial-state\n overrides survive reapply (ADR-0154); use the authored operations to reset\n this door.\n\n## Related\n\n[Runtime ambient state on incident edges](../interaction-dsl-and-world-authoring.md#runtime-ambient-state-on-incident-edges),\n[place graphs and occupancy](../place-graph-occupancy.md),\n[bundle movement defaults](bundle-movement-default.md).\n"},{"id":"patterns/party-extent-grant","title":"Party-extent grant (addressability across graphs as a privilege)","kind":"guide","summary":"My DM (or a bonded item) must address a party member who is on ANOTHER place graph — the inn hearth to the tomb crypt — and a bigger `range_m` does not work.","tags":["patterns","party","extent","grant"],"body":"# Party-extent grant (addressability across graphs as a privilege)\n\n## Name\n\n`party-extent-grant` — Cross-graph reach via a capability extent, not a range number\n\n## Problem\n\nMy DM (or a bonded item) must address a party member who is on ANOTHER place graph — the inn hearth to the tomb crypt — and a bigger `range_m` does not work.\n\n## Forces\n\n- `validate_reachability` rejects cross-graph pairs as incomparable metric\n frames, and candidate expansion is same-graph: no range number can\n cross a graph boundary.\n- Ordinary telepaths (creatures, items) that only author a range should\n stay same-graph — privilege must be a grant, not a global change.\n- The addressee still perceives the line by co-location with the\n directed trace; no new admission model may be introduced.\n- An actor-only body without an `entity_location` row fails target\n resolution before the extent check (pre-existing, not a regression).\n\n## Solution\n\nGrant the SAME communicate capability on the privileged actor with an\n**extent**: `extent_kind_ref = \"party\"` and `extent_ref = <membership tag>`\n(the tag the party members carry). That admits every member as an addressee\nregardless of node or graph. The trace is still anchored at the addressee's\nplace ([`directed-speech-anchor`](./directed-speech-anchor.md)). Seat\nwatches that also want a \"same graph, in range\" guard keep it as their own\npolicy; the substrate no longer requires it.\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/npcs/aldwin.toml`:\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"elven_mini/adventure/npc/aldwin_1\"\nbundle_id = \"elven_mini\"\ncapability_id = \"srd/action/communicate/telepathy\"\nelevation_class = \"\"\nextent_kind_ref = \"party\"\nextent_ref = \"srd.party.heroes\" # the same membership tag the hero carries\nsource = \"srd\"\nsource_args_hash = \"\"\n```\n\nCompare the DM's sight grant in the same file: `elven_mini/dm/watch` with\n`extent_kind_ref = \"place_graph\"` — extents are the general privilege\nshape, party is one kind.\n\n## Proof\n\n- Kernel: the world API\n unit tests `extent_membership_is_an_alternative_to_metric_range` and\n `cross_graph_metric_still_rejects_without_extent` (`:1389-1437`).\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/telepathy.ts`\n covers directed speech heard only by the addressee (range, not extent).\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/aldwin-xp-threshold.test.ts`\n (invitation path)\n\n## Related\n\n[`directed-speech-anchor`](./directed-speech-anchor.md),\n[`proactive-level-up`](./proactive-level-up.md) (the invitation consumer),\n[`dm-oversight`](../dm-oversight.md) (graph-scoped sight extents).\n\n## Known misuse / anti-pattern\n\n- A very large `range_m` to \"reach\" another graph.\n- Inventing a DM-only communicate verb instead of granting the shared one\n with an extent.\n- Reading the extent as a recipient column — perception is still\n co-location with the anchor.\n\n## SRD features that use this\n\n- Aldwin's `srd/action/communicate/telepathy` party extent (level-up\n invitations). Creature / item telepathy stays range-only:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n"},{"id":"patterns/post-commit-hit-reaction","title":"Post-commit hit reaction (OA-shaped mitigate)","kind":"guide","summary":"A feature should fire as an off-turn reaction after another creature's manipulate commits against you (a counter-blow, a post-hit heal). Opportunity Attack already shows the off-t…","tags":["patterns","post","commit","hit","reaction"],"body":"# Post-commit hit reaction (OA-shaped mitigate)\n\n## Name\n\n`post-commit-hit-reaction` — Reaction after another creature's manipulate commits\n\n## Problem\n\nA feature should fire as an off-turn reaction after another creature's\nmanipulate commits against you (a counter-blow, a post-hit heal).\nOpportunity Attack already shows the off-turn reaction shape; this pattern\nuses the same producer with a post-commit trigger. Damage *mitigation* that\nmust read the damage amount (Deflect Attacks) is not this pattern: it is\n[`condition-hook-on-event`](./condition-hook-on-event.md) on\n`Layer2.ResourceDelta`, whose detail carries `delta`.\n\n## Forces\n\n- The reaction producer runs **after** `r_manipulate` commits\n (`reaction_producer::run` with `$event.kind == 'r_manipulate'` and empty\n detail on the post-commit path). Damage `ModifyResource` has already\n applied.\n- Candidate reactors are co-located entities **other than** the acting\n attacker (plus the attacker only when `self_eligible`). The hit target is\n therefore a normal co-located candidate.\n- Eligibility binds `actor` = reactor, `target` = triggering actor\n (attacker) (the world API).\n Gate with `actor.has_capability('<feature>')`.\n- The post-commit **manipulate intent** carries no damage magnitude or damage\n type. The HP write itself is visible as a `Layer2.ResourceDelta` event\n (`delta`, `entity_id`, `resource_id`) to a condition hook — use that when\n the amount matters.\n\n## Solution\n\n1. Author a reaction action like Opportunity Attack:\n - `spends_channel = srd/economy_channel/reaction`\n - `reaction_trigger = \"$event.kind == 'r_manipulate'\"` (post-commit;\n do not require `$event.detail.phase` — that is pre-commit only)\n - `reaction_eligibility = actor.has_capability('<feature>')`\n - `self_eligible = false` (the target is not the manipulator)\n2. Consequence: any frame writes on `Actor` (the reactor) or `TargetActor`\n (the attacker), e.g. a `ModifyResource` heal on the reactor. Clamp is\n automatic at resource max.\n3. When the rule needs the damage amount or type, switch to\n `condition-hook-on-event`; when it needs an event the kernel does not\n emit (a fall), record that in a substrate verdict.\n\n## TOML example\n\nSchematic (ids are illustrative; the shipped reaction with this shape is\nOpportunity Attack in `packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`,\nwhich uses an `r_move` trigger instead):\n\n```toml\n# pattern: post-commit-hit-reaction\n[[action_definitions]]\naction_id = \"my-bundle/feature/rally-on-hit\"\nreaction_trigger = \"$event.kind == 'r_manipulate'\"\nreaction_eligibility = \"actor.has_capability('my-bundle/feature/rally-on-hit')\"\nspends_channel = \"srd/economy_channel/reaction\"\nself_eligible = false\n\n[[consequence_frame_writes]]\ntemplate_id = \"my-bundle/feature/rally-on-hit/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/hp\"\ndelta_source = \"1d10 + macro('srd/ability_modifier', actor.effective('srd/dex'))\"\n```\n\nMacros are called as `macro('<id>', args…)`\n(`crates/spellkave-dsl/src/lib.rs:1759`).\n\n## Proof\n\n- Precedent: Opportunity Attack\n (`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`)\n- Heroic Inspiration uses the **pre-commit** stochastic path\n (`$event.detail.phase == 'resolution'`) — different seam; do not copy\n those detail conjuncts onto post-commit mitigate reactions.\n\n## Related\n\n- [`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)\n- Opportunity Attack eligibility geometry in\n [`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md)\n\n## Known misuse\n\n- Expecting `$event.detail.damage` or damage type on post-commit\n manipulate intents (not populated).\n- Authoring a hit reaction as `self_eligible` on the attacker's turn (wrong seat).\n- Using pre-commit Heroic Inspiration triggers for post-hit mitigate.\n\n## SRD features\n\n- Opportunity Attack (the shipped reaction shape, on `r_move`).\n- Deflect Attacks moved to `condition-hook-on-event` (sk-609b.12.2); the id\n `srd/monk/deflect-attacks` is now a self-only \"ready\" action, not a\n reaction (`fixtures/base/classes/monk.toml:1848-1861`).\n- Slow Fall needs a fall event (verdict when absent).\n- Concentration break on damage is a condition hook, not a reaction.\n\n## Misuse\n\n- A **forced** rule (concentration save, Relentless Endurance) as a reaction\n window: ADR-0093 D-7 turn-bound windows have no timeout, so silence keeps\n the benefit forever. Forced rules are `condition-hook-on-event`.\n- Filing \"no damage magnitude on the post-commit intent\" as a kernel gap\n before reading `condition_definition.hooks` (`Layer2.ResourceDelta` carries\n `delta`/`entity_id` as Int facts and `template_id`/`resource_id` as Text;\n `crates/spellkave-dsl/src/lib.rs:4035-4100`).\n"},{"id":"patterns/proactive-level-up","title":"Proactive level-up watch","kind":"guide","summary":"When the hero crosses the next XP threshold, the DM should call them over and offer the level-up — the player should not have to poll their own sheet.","tags":["patterns","proactive","level","up"],"body":"# Proactive level-up watch\n\n## Name\n\n`proactive-level-up` — Proactive level-up watch (NPC offers when a threshold is crossed)\n\n## Problem\n\nWhen the hero crosses the next XP threshold, the DM should call them over and offer the level-up — the player should not have to poll their own sheet.\n\n## Forces\n\n- An invitation needs addressability; the consent offer needs co-location.\n- One durable ceremony latch records the last applied level, so later levels\n can reopen the wizard. Process memory alone cannot prove sheet completion.\n- The drafting handles and choices must exist before the offer is delivered.\n- Movement carries hero and DM into the advancement limbo where the wizard's\n spatial niches are attached, and later returns them to the authored destination.\n\n## Solution\n\nThe DM's threshold watch reads observed XP and level and compares the next\nthreshold. Away heroes receive a directed telepathic invitation through the\nDM's authored Party extent. Once co-located, the watch offers the discrete\nAccept/Decline pair. Its per-hero/level memory limits repeated invitations;\na host restart can re-invite or re-offer before the durable latch changes.\n\nOrdinary `dm/level-up/enroll` remains a zero-delta initialization act for\nDM and trainee state homes. The current candidate blueprint also seeds its\nown draft homes. The watch checks the DM's visible applied-level latch before\nits offer; this is not a claim that enrollment uniquely creates every home.\nBefore offering, the host opens the preauthored `dm/level-up/drafting`\ncondition through `dm/act/level-up/open`. The condition admits fixed consent\nand drafting handles. No per-hero action definitions or runtime manifest\ngrants are published. The seat and XP watcher share one host-level opening\nreceipt per hero and observed level, so a delayed watcher cannot reopen a\nphase already declined. A refused opening remains retryable; a later earned\nlevel gets its own opening. A new host retains the documented reoffer behavior.\n\nOn consent, authored movement actions carry both participants into limbo.\nFeature and sheet acts complete before the applied-level latch advances;\nthe successful apply frame also removes the drafting condition, then return\ncarries both back. Decline removes the condition in the same frame that clears\nconsent, withdrawing all six phase-derived handles. Required\nadventure configuration supplies the hero resolver, persona, level cap,\ninvitation and return location; the runtime does not embed a story's cast.\n\n## Authored reach example\n\nThe elven-mini publisher gives Aldwin the Party-scoped telepathy capability:\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"elven_mini/adventure/npc/aldwin_1\"\nbundle_id = \"elven_mini\"\ncapability_id = \"srd/action/communicate/telepathy\"\nelevation_class = \"\"\nextent_kind_ref = \"party\"\nextent_ref = \"srd.party.heroes\"\nsource = \"srd\"\n```\n\nThat grant supplies reach, not evidence that an invitation, consent or sheet\nchange succeeded. The recorder must observe their actual receipts and effects.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/xp-threshold.live.test.ts`\n checks the away invitation and threshold watch.\n- `packages/spellkave-adventure-runtime/tests/live/seat-ceremony.live.test.ts`\n checks the autonomous menu-answer ceremony.\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/aldwin-xp-threshold.test.ts`\n checks the authored phase-opening plan.\n- `packages/spellkave-adventure-runtime/src/dm/level-up/grant-driver.test.ts`\n checks shared opening receipts, retries and later-level reopening.\n- The adventure story's level-up chapters check the resulting player sheet.\n\n## Related\n\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`advancement-choice`](./advancement-choice.md),\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`party-extent-grant`](./party-extent-grant.md),\n[`relocate-entity-ungated`](../repairs/relocate-entity-ungated.md).\n\n## Known misuse / anti-pattern\n\n- Free-text consent, repeated offers every tick or a one-shot level latch.\n- Increasing range to cross graphs instead of supplying admitted extent reach.\n- Moving the hero without the DM or the wizard's spatial attachments.\n- Treating the invitation or a selected decision as proof of successful acts.\n- Guarding world-triggered return work solely with restart-lost process memory.\n The current watch blocks repeated refused returns at one latch value through\n `refusedReturnAtLatch`; it does not establish a world-location guard.\n\n## SRD features that use this\n\nElven-mini Aldwin's levels 2–4 arc. Bundle IDs and recorder constraints:\n[`proactive-level-up.md`](../../../spellkave-srd-cc/docs/proactive-level-up.md).\n"},{"id":"patterns/prompt-occurrence","title":"Dialogue prompt occurrence (which question is open, for whom)","kind":"guide","summary":"A speaker asks a closed question (\"Which class?\", \"Stand with me? 1: yes, 2: I must pass\"). The answers are ordinary authored actions the addressee could also fire for a totally d…","tags":["patterns","prompt","occurrence"],"body":"# Dialogue prompt occurrence (which question is open, for whom)\n\n## Name\n\n`prompt-occurrence` — a typed, server-owned identity for \"the question this\nspeaker has open right now\"\n\n## Problem\n\nA speaker asks a closed question (\"Which class?\", \"Stand with me? 1: yes, 2:\nI must pass\"). The answers are ordinary authored actions the addressee could\nalso fire for a totally different reason. Nothing published says which\nactions answer the question that is open *now*, for *this* addressee — so a\nstale or reused answer silently misfires, and every client re-invents its own\nguess (hotbar ordering, a hard-coded id, a display-name matcher).\n\n## Forces\n\n- Disclosure is not eligibility (ADR-0139/ADR-0141): a client seeing an\n action does not mean it is THE answer to the open question.\n- Reused generic slots. A shared palette (`dialog-choice-slots`'s\n `dm/dialog/choice/k`) is fired by every conversation a talker ever has — a\n delayed \"Answer 1\" meant for question A can satisfy question B's own gate\n predicate and acquire B's meaning.\n- ABA. A static prompt id that closes and reopens (A → closed → A) makes a\n delayed answer to the FIRST A valid again once the SECOND A opens.\n- Duplicates. A generic answer only inscribes a trace; the asker closes the\n slots on a later cycle, so more than one response can land before closure.\n- Audience is a world relation (who is asked), not host/client configuration.\n- No new frame write: the opening/closing transitions already exist as\n authored `ModifyResource` writes (a phase resource, `dm/dialog/open`);\n nothing here adds a `FrameWriteOp` arm. The kernel does keep its own\n occurrence and consumption tables and a prompt gate in `r_manipulate`.\n\n## Solution\n\n1. **Definition** (`prompt_definition`, Layer-3, authored): `source_selector`\n (who may ask — an entity ref or tag), `open_predicate_source` (a DSL\n selector over the SPEAKER'S OWN state — `actor.stat(...)`, never\n `target.stat(...)`), `response_action_ids` (the ordered answer set),\n `audience_kind_ref` (`core/audience/directed_trace` or `core/audience/\n broadcast` — kernel-seeded, no authored row needed), `trace_window_ticks`,\n `contract_version`.\n2. **Occurrence** (`prompt_occurrence`, kernel-maintained, never client-written):\n the server opens one the moment `open_predicate_source` flips false→true\n on a matching speaker (the SAME post-frame hook that already refreshes\n factored context), captures `response_action_ids`, `contract_version` and `audience_trace_id`\n AT THAT MOMENT, and binds the addressee from the speaker's own directed\n speech trace. For `Broadcast` it stores the placeholder addressee `0`; the\n per-perceiver fan-out is not built yet\n (the world API).\n A → closed → A\n yields two DISTINCT occurrence ids — ABA is impossible by construction.\n3. **Check before interpret**: binding is decided at the OCCURRENCE, not the\n definition table. A response that carries\n `semantic_context = { source_ref, occurrence_id }` is ALWAYS judged against\n what is open now for (source, actor): open-for-this-pair → same-occurrence\n → response-in-this-occurrence's-captured-set → not-already-consumed, IN\n THAT ORDER, before the response's own authored predicate ever runs. A\n response WITHOUT context is prompt-bound only while an open occurrence for\n that pair captures its action id (`prompt_context_required`); with nothing\n open it is an ordinary menu answer governed by its own predicate — the\n same generic `dm/dialog/choice/N` slot serves creation menus, plain\n talkers and quest offers. The membership check is what stops a reused\n generic slot from cross-answering one occurrence with another's meaning.\n4. **Consume at commit**: consumption is recorded per (occurrence,\n answering actor) (`r_manipulate/prompt_gate.rs:220-231`) when the\n answer's outcome commits — in the admitting reducer for a deterministic\n outcome, later for a stochastic one that waits on a pending resolution.\n The first committed answer per actor wins; a rejected attempt consumes\n nothing.\n\n## TOML example\n\nTwo shipped shapes open occurrences.\n\n**Static authored prompt** (elven-mini quest offers,\n`packages/spellkave-adventure-elven-mini/author/adventure.ts:135-139`,\nrows in `fixtures/adventure/mechanics/actions.toml`): the giver's shared\nanswer set is disambiguated with the speaker's own bounded\n`dm/dialog/prompt` id — see [`dialog-choice-slots`](./dialog-choice-slots.md)'s\ngeneric `dm/dialog/prompt/set/<id>` family:\n\n```toml\nopen_predicate_source = \"actor.stat('dm/dialog/open') >= 1 && actor.stat('dm/dialog/prompt') == 7\"\nresponse_action_ids = [\"dm/dialog/choice/1\", \"dm/dialog/choice/2\"]\n```\n\n**Scripted menu act** (character creation): the DM presence performs a\nfinite `dm/dialog/ask-menu/<count>` action over the generic\n`dm/dialog/choice/N` response slots. Its consequence inscribes the directed\nquestion and `dispatch_options`, then opens the fixed prompt in the same\nframe. `dialogMenuAct` in\n`packages/spellkave-adventure-runtime/src/dm/dialog/prompt-offer.ts` builds\nthat plan; the host awaits its accepted receipt. No prompt definitions or\npresentation attachments are authored during play.\n\n## Presentation (what the player reads, never what the gate checks)\n\nStatic question text and labels can ride on a public `metadata_attachment`\nunder namespace `dialogue.prompt`, targeting a `prompt_definition`, with\npayload `{ \"question\": string?, \"responses\": { \"<action_id>\": \"<label>\" } }`.\nThe SDK also accepts the existing optional positive `picks_remaining` field\nfor static presentations.\n\nScripted menu definitions instead carry `{ \"presentation\": \"audience_trace\" }`.\nAt opening, the occurrence binds its directed speech trace in\n`audience_trace_id`; broadcast stores zero. The SDK reads the question and\nordered labels from that captured trace, so a later speech trace cannot\nreplace an already open menu's presentation. Creation puts the remaining-pick\ncount in the question text. `prompts[].presentation` exposes these values to\nplayer tools and the native `spellkave prompts` command.\n\nPresentation does not change response admission: the prompt gate checks the\noccurrence's captured response-action set, audience, identity and consumption.\nThe implementation lives in\n`packages/spellkave-sdk/src/core/readers/manipulation_context.ts` and\n`client/src/cli/prompt_presentation.rs`. The seeded shared `dm` namespace and\nfixed response vocabulary remain authored content. The runtime ownership guard\nproves the creation, level-up, dialogue and adventure host paths import no\nmanifest writer.\n\n## Proof\n\n- `crates/spellkave-validate/src/lib.rs`'s `prompt_definition_*` tests\n (locality/stratification, audience/response-action FK resolution).\n- the world API's `target_kinds_match_offline_validator_allowlist`\n (a `dialogue.prompt` label attaches to a `prompt_definition` row directly).\n- `packages/spellkave-adventure-elven-mini/tests/offline/quest-prompts.test.ts`\n (authored generic-offer definitions and presentation).\n- `packages/spellkave-srd-cc/src/test/live-preseeded/mechanics/prompt-creation.test.ts`\n (same-frame trace, immutable captured presentation, and authenticated CLI labels).\n- `packages/spellkave-srd-cc/src/test/live-preseeded/mechanics/prompt-occurrence-gates.test.ts`\n (broadcast zero, stale identity, ABA, member and consumption checks).\n- `packages/spellkave-adventure-runtime/src/dm/runtime-ownership.test.ts`\n (runtime and host import/port guard).\n\n## Related\n\n[`dialog-choice-slots`](./dialog-choice-slots.md) (the shared palette this\ndisambiguates), [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)\n(the creation phases this gates one at a time), [`quest-composition`](./quest-composition.md)\n(the accept/decline offer this identifies).\n\n## Known misuse / anti-pattern\n\n- Matching a spoken sentence or a display label as the save path — the\n occurrence id is the only thing a response's `semantic_context` may name.\n- A static prompt id with no occurrence: ABA-replayable, cannot express\n replacement or closure.\n- Authoring `audience_kind_ref` to a Rust-enumerated string instead of a\n `core/audience/*` id or an authored `audience_kind_definition` row\n (ADR-0018 D-1).\n- Bundling a free-form, many-turns-open station (several simultaneously\n valid actions, no single \"the\" answer) under one `prompt_definition` —\n D-5's at-most-once consumption would reject every response after the\n first. Not every open question fits this pattern; a multi-field input\n station does not (ADR-0142 G-5, still open).\n\n## SRD features that use this\n\nAldwin's character-creation class/background/species/confirm questions as\nauthored menu acts (`packages/spellkave-srd-cc/docs/character-creation.md`);\nelven-mini's quest accept/decline offers\n(`packages/spellkave-adventure-elven-mini/docs/elven-mini-quests.md`), whose\ncross-bundle `response_action_ids` resolve through the narrowed\n`action_definitions` reference-closure augmentation (sk-jay0.2.33.15.7).\n"},{"id":"patterns/quest-composition","title":"Quest composition (giver slot + objective + terminal watch + reward)","kind":"guide","summary":"I need a quest: an NPC offers it, the hero does something in the world, and when it is done the hero is rewarded — and there is no quest row kind.","tags":["patterns","quest","composition"],"body":"# Quest composition (giver slot + objective + terminal watch + reward)\n\n## Name\n\n`quest-composition` — A quest is a composition, not a primitive\n\n## Problem\n\nI need a quest: an NPC offers it, the hero does something in the world, and when it is done the hero is rewarded — and there is no quest row kind.\n\n## Forces\n\n- There is no quest primitive in the world (verified 2026-08-22), and the\n composition below does not need one.\n- Acceptance must be a discrete act (no free-text commitment).\n- The terminal condition is a predicate over world state the giver (or the\n DM) can observe; it must be testable offline against a fake view.\n- Rewards must be paid exactly once and must survive a host restart.\n- XP recipients are a policy decision (the present party, the killer, …);\n the host enumerates them and dispatches an award act per recipient —\n one write cannot broadcast to \"the party present\".\n\n## Solution\n\n| Part | Mechanism |\n|---|---|\n| Offer / accept | a [`dialog-choice-slots`](./dialog-choice-slots.md) pair on the giver (`1: I'll do it.` / `2: Not today.`); the accept writes a persistent world resource `<bundle>/quest/<id>/accepted` (elven-mini `author/quest-progress.ts:8-30`) — conversation steps stay private to the brain |\n| Objective | enemies, items and places authored as ordinary content ([`blueprint-instance-override`](./blueprint-instance-override.md)) |\n| Terminal | an exact boolean over a quest view — `dead(x) && …`, `has_item(hero, y)`, `at(npc, node)`, `flag(z)` — evaluated by the giver/DM seat watch against a live snapshot projection. A `flag(z)` term reads the persistent resource `<bundle>/quest/flag/<z>`, so **something must write it**: an action whose consequence sets it (elven-mini `author/tomb-key.ts` is the worked writer for `q9_tomb_opened`). A terminal flag with no writer never fires |\n| Reward | XP via finite authored recipient awards ([`quest-xp-grant`](./quest-xp-grant.md)), optional items / follow-up speech; each recipient owns an `xp-awarded` marker, and a separate giver settlement changes `accepted` and `rewarded` after successful awards. The watch's memory is only a fast path |\n| Parley (optional) | a villain slot open while `alive(villain) && minions_alive >= 1` whose accept must write the alternative terminal's flag. **Not wired in elven-mini yet:** `createParleyOverlay` (`npcs/quests/parley.ts`) has no production caller and no action writes `q4_maelis_surrendered`, `q5_camp_burned` or `q7_truce`, so those endings are reached only in offline tests (tracked on `sk-jay0.3.4.11`) |\n| Companion (optional) | the giver's seat flips to [`companion-follow`](./companion-follow.md) after the terminal |\n\nAuthor the catalog as data (giver, slot text, objective, terminal, reward,\nenemies) and derive both the seats and the offline proofs from it.\n\n## Authored composition example\n\nThe quest catalog is seat data; its world-facing parts are ordinary rows.\nFor Q1 the catalog reward is 50 XP per selected present recipient. The giver's\nshared Answer 1/2 palette accepts or declines the offer. A terminal watch\nobserves the dead cellar rats and swarm, then runs fixed\n`elven_mini/dm/award-quest-xp/Q1` actions and `elven_mini/dm/settle-quest/Q1`.\nThe generic action builder is `adventure-runtime/src/author/dm/quest-xp-acts.ts`;\nelven-mini binds its IDs in `author/dm-acts.ts`.\n\nThe award formula reads `actor.stat('core/dispatch_arg_quantity')`. Its\npredicate and write use the recipient's durable award marker; settlement uses\nthe giver's accepted and rewarded resources. Author these homes before play.\nThere is no per-terminal action definition or manifest publication.\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-quests.test.ts`\n (every terminal satisfies on a fake view; every reward returns the\n catalog XP; rung sums clear the thresholds)\n- Q1 live representative under `SPELLKAVE_LOCAL_NODE=1`:\n `packages/spellkave-adventure-elven-mini/tests/live-preseeded/player/adventure/levels/level-1/03-cellar-rats.ts`\n (driven by `…/player/adventure/adventure.test.ts`).\n\n## Related\n\n[`dialog-choice-slots`](./dialog-choice-slots.md),\n[`quest-xp-grant`](./quest-xp-grant.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`companion-follow`](./companion-follow.md),\n[`milestone-gate-terminal-flags`](./milestone-gate-terminal-flags.md)\n(gating a later beat on earlier terminals).\n\n## Known misuse / anti-pattern\n\n- Filing \"no quest system\" as a kernel gap.\n- Free-text acceptance (\"I'll help\") as the commit path.\n- Keeping commitments or paid rewards only in seat memory: a host restart\n forgets them and pays twice. Accept and reward are persistent world\n resources the grant predicate reads; only conversation steps stay in the\n seat.\n- A `flag(z)` terminal with no action that writes the flag.\n- Granting reward XP to whoever landed the last blow (that is kill XP, a\n different policy).\n\n## SRD features that use this\n\n- Elven-mini Q1–Q12 (givers, terminals, rewards, parleys, Hesper):\n [`elven-mini-quests.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-quests.md).\n"},{"id":"patterns/quest-xp-grant","title":"Quest XP grant","kind":"guide","summary":"When a quest terminal fires I need to grant a fixed XP reward to the present party (not the killer).","tags":["patterns","quest","xp","grant"],"body":"# Quest XP grant\n\n## Name\n\n`quest-xp-grant` — Quest XP grant\n\n## Problem\n\nWhen a quest terminal fires I need to grant a fixed XP reward to the present party (not the killer).\n\n## Forces\n\n- Terminal evaluation and recipient selection belong to the story's watch.\n- Durable per-recipient markers must survive retries and host restarts.\n- A completed giver settlement must follow successful recipient awards.\n- Elven-mini currently selects the hero and co-located catalog companions\n (Rogue, Hesper, Caddoc), joined or not. Its resolver does not filter on\n `srd.party.heroes`; this known membership gap is tracked as\n `sk-jay0.3.4.11.7`. Party extent admission is a separate kernel decision.\n\n## Solution\n\nAt authoring time define one award action and one settlement action per quest.\n`adventure-runtime/src/author/dm/quest-xp-acts.ts` builds these finite actions,\nrequiring `frontier.set_state`. Elven-mini binds them to\n`elven_mini/dm/award-quest-xp/<Qn>` and `elven_mini/dm/settle-quest/<Qn>`.\nThe running DM dispatches them through its act port; it publishes no\nper-terminal manifest or action definition.\n\nFor each unawarded recipient, one dispatch adds the quantity argument to\n`srd/xp` and sets that recipient's `<bundle>/quest/<id>/xp-awarded` marker\nfrom 0 to 1. The world predicate rejects repeat awards. After successful\nawards, a separate giver-targeted act changes `accepted` from 1 to 2 and\n`rewarded` from 0 to 1. If a later step fails, a fresh watch can retry while\nskipping already marked recipients. This is a sequence of receipt-bound\nacts, not one multi-recipient transaction.\n\nAuthor the XP and award-marker homes before play, including in the blueprint\nof a companion spawned later. Missing recipient award-marker observations make the watch's reward snapshot\nincomplete, so it dispatches nothing. This is not a general rule that numeric\nwrites cannot initialize absent rows from resource definitions. Changing an already placed body's\ndefinition does not create its new birth-time state homes; migration policy\nis tracked separately in `sk-jay0.2.57`.\n\n## Authored write example\n\nThe award action is targeted at one recipient and guarded by\n`target.stat('<bundle>/quest/<id>/xp-awarded') == 0`:\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/xp\"\ndelta_source = \"actor.stat('core/dispatch_arg_quantity')\"\n# A second write in the same dispatch increments the recipient's xp-awarded marker.\n```\n\nThe host supplies the catalog reward as the act's `quantity` argument.\nLegacy `renderGrantQuestXp` exports remain publisher composition helpers;\nthey are not the production watch's reward path.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/quest-xp.live.test.ts`\n checks terminal gating, recipient awards, settlement and replay through the watch.\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/q4-quest-xp.test.ts`\n checks actual hero and companion XP after Q4.\n- `packages/spellkave-adventure-elven-mini/tests/offline/dm-acts.test.ts`\n checks finite actions and initial companion award homes.\n\n## Related\n\n[`quest-composition`](./quest-composition.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`companion-follow`](./companion-follow.md),\n[`party-extent-grant`](./party-extent-grant.md).\n\n## Known misuse / anti-pattern\n\n- Awarding quest XP only to whoever landed the killing blow.\n- Settling the giver before successful recipient receipts.\n- Inferring initial zeroes from absent state rows.\n- Selecting recipients by co-location while claiming joined-party membership.\n- Leaving required reward-state readers outside the watch's reader closure:\n see [`watch-reader-manifest-closure`](./watch-reader-manifest-closure.md).\n\n## SRD features that use this\n\nElven-mini Q1–Q12 catalog rewards to the currently selected present recipients.\n"},{"id":"patterns/resource-spend-with-option-menu","title":"Resource spend with option menu","kind":"guide","summary":"I have a shared pool (spell slots, Channel Divinity uses) and several effects that each spend one use — how do I author the pool once and branch the menu?","tags":["patterns","resource","spend","with","option","menu"],"body":"# Resource spend with option menu\n\n## Name\n\n`resource-spend-with-option-menu` — Resource spend with option menu\n\n## Problem\n\nI have a shared pool (spell slots, Channel Divinity uses) and several effects that each spend one use — how do I author the pool once and branch the menu?\n\n## Forces\n\n- One resource_definitions row is the pool; many actions debit it.\n- Option menus for CD effects may be partial (one live branch, others backlog).\n- Gate on `actor.stat(pool) >= 1` on the affordance and debit on success.\n No validator enforces the gate; without it a debit at 0 is a floored no-op\n and the effect still lands\n ([modify-resource-floored-noop](../repairs/modify-resource-floored-noop.md)).\n\n## Solution\n\nAuthor the pool (`spellkave_define_resource` / chapter unit). Each option is its\nown action/affordance with the same spend debit (`ModifyResource` delta `-1` on\nthe pool) and distinct effect body. Advancement/metadata may list members for\nDM dialogue; live spend is still per-action. See\n[`spellcasting-substrate.md`](../../../spellkave-srd-cc/docs/spellcasting-substrate.md)\nand [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/spells/casting.toml + per-spell debit in fixtures/base/spells/level-1/* (generated by spell-slots.ts / spell-behaviors.ts); Channel Divinity uses in caster-features`:\n\n```toml\n[[resource_definitions]]\nbundle_id = \"srd\"\ndisplay_name = \"Level 1 Spell Slot\" # required\ninitial_value = 0\nmax_value = 9\nmin_value = 0\nrecovery_rule = \"long_rest\"\nresource_definition_id = \"srd/spell_slot_1\"\nvalue_kind = \"int\" # required\n\n# each leveled cast gates + debits the same pool:\n# predicate_source = \"actor.stat('srd/spell_slot_1') >= 1\"\n# frame_write ModifyResource { resource = \"srd/spell_slot_1\", delta_source = \"-1\" }\n```\n\n## Proof\n\npackages/spellkave-srd-cc/src/test/offline/caster-features-units.test.ts; spell casting axis tests; live channel-divinity.test.ts when SPELLKAVE_LOCAL_NODE=1.\n\n## Related\n\n[advancement-choice](./advancement-choice.md), [extra-action-budget](./extra-action-budget.md).\n\n## Known misuse / anti-pattern\n\nOne action that tries to encode every CD option with free-text parsing. Separate pools per option that never share recovery. Expecting a single action with a free-form integer parameter for Lay On Hands / Font costs — discrete menu rungs are the expressible shape until a parameterised spend leaf exists.\n\n## SRD features that use this\n\n- **Spell slots** (shared srd/spell_slot_1..2).\n- **Channel Divinity** uses — Cleric Divine Spark heal/damage, Turn Undead,\n Preserve Life; Paladin spend stub (L12c).\n- **Lay On Hands** discrete 1/5/10 HP menu (L12c).\n- **Font of Magic** slot↔sorcery-point conversions (L12c).\n- Single-option pools (Bardic Inspiration, Wild Shape uses) use the same\n gate + debit without a menu.\n"},{"id":"patterns/rest-boundary-resource-refill","title":"Rest-boundary resource refill","kind":"guide","summary":"Class features and spell slots declare `recovery_rule` (`long_rest`, `short_rest_partial_long_rest_full`, …) but that field is **documentary** — the kernel never scans it. Complet…","tags":["patterns","rest","boundary","resource","refill"],"body":"# Rest-boundary resource refill\n\n## Name\n\n`rest-boundary-resource-refill` — Complete Short/Long Rest refills recoverable pools\n\n## Problem\n\nClass features and spell slots declare `recovery_rule` (`long_rest`,\n`short_rest_partial_long_rest_full`, …) but that field is **documentary** —\nthe kernel never scans it. Completing a rest must actually restore HP, slots,\nand feature uses.\n\n## Forces\n\n- `FireBoundary` already refreshes economy channels and affordance\n `recharges_on` clocks; it does **not** walk `resource_definitions`.\n- There is no `ForEachResource` / tag-driven refill frame write. Attempts to\n invent one are a kernel gap; content must list the pools.\n- `actor.stat('<pool>')` fails closed when the pool was never seeded\n (finding #35). Gate every class-specific refill with\n `actor.has_capability('<feature>')` so `cond` is lazy and skips the\n untaken branch (`crates/spellkave-dsl` `Op::Cond`).\n- Full refill uses `actor.resource_max(id) - actor.stat(id)` (effective max\n honours `entity_resource_bound`). Partial short-rest recovery is a\n constant `+1` (Second Wind / Rage / Focus / Channel Divinity SRD shape).\n\n## Solution\n\n1. Keep Short Rest / Long Rest as actor-carried self verbs whose first\n ordinal is `FireBoundary` (`srd/boundary/short_rest` /\n `srd/boundary/long_rest`).\n2. Append one `ModifyResource` ordinal per recoverable pool on the rest\n consequence:\n - Long Rest full: `cond(has_capability, resource_max - stat, 0)` for a\n pool whose ceiling is the same at every level. A class pool whose size\n grows with level (Rage, Second Wind, Action Surge, Focus Points, Channel\n Divinity) refills to a per-level macro generated from the class's\n Features table instead: `cond(has_capability, max(0, macro('srd/rage_uses_max') - stat), 0)`.\n The resource ceiling of such a pool is its level-20 value, so\n `resource_max` would hand a level-1 hero the pool of a level-20 one. HP is\n ungated (every resting creature carries `srd/hp`) and heals a player\n character to its real maximum, the `srd/hit_point_maximum` macro, never\n to the resource ceiling; other creatures heal to `resource_max`.\n - Short Rest partial: one use back, never past the same per-level macro:\n `cond(has_capability, min(1, max(0, macro('srd/rage_uses_max') - stat)), 0)`\n for `short_rest_partial_long_rest_full` pools; refill to the macro for\n pools that recover on either rest (Action Surge).\n - Short Rest Hit Point Die: one die per rest, for a hurt player character\n with a die left. Create both counters with a zero delta first (a read of\n a resource the actor never had fails closed), capture the rolled heal\n (class die + Constitution modifier, at least 1, capped at the room below\n the real maximum) in the scratch resource `srd/hit-die-heal`, add the\n scratch to `srd/hp`, then add 1 to `srd/hit-dice-spent` only when the\n scratch is above 0. A hero has one die per level\n (`srd/hit-dice-spent < srd/level`). The Long Rest sets the spent counter\n back to 0. The capture is the idiom of the death save\n ([derived-value-mechanism](derived-value-mechanism.md)).\n3. Feature-specific mid-rest rites (Arcane Recovery, Magical Cunning) stay\n separate actor-carried verbs with their own once-per-long-rest use pool\n — they are not automatic on the shared boundary.\n\n## TOML example\n\nExcerpt from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/rest.toml`\n(ordinals 0, 2 and 5 of the Long Rest consequence; the others refill Heroic\nInspiration, spell slots and further class pools):\n\n```toml\n# pattern: rest-boundary-resource-refill\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.FireBoundary]\nboundary_id = \"srd/boundary/long_rest\"\nscope = \"Actor\"\n\n[[consequence_frame_writes]]\nordinal = 2\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/hp\"\ndelta_source = \"cond(actor.has_tag('srd.player_character'), max(0, macro('srd/hit_point_maximum') - actor.stat('srd/hp')), actor.resource_max('srd/hp') - actor.stat('srd/hp'))\"\n\n[[consequence_frame_writes]]\nordinal = 5\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/fighter/second-wind-uses\"\ndelta_source = \"\"\"\ncond(actor.has_capability('srd/class-feature/fighter/second-wind'),\n actor.resource_max('srd/fighter/second-wind-uses')\n - actor.stat('srd/fighter/second-wind-uses'), 0)\n\"\"\"\n```\n\n## Proof\n\n- Generator: `packages/spellkave-srd-cc/src/chapters/playing-the-game/fragments/rest.ts`\n- Offline: `packages/spellkave-srd-cc/src/test/offline/rest-refill-coverage.test.ts`\n (the rest fixture carries a `resource_max` refill ordinal per pool)\n- Live: complete Long Rest with spent Second Wind / slots → SQL read-back\n\n## Related\n\n- [`actor-carried-feature-verb`](./actor-carried-feature-verb.md) — the pools\n these refills charge\n- [`extra-action-budget`](./extra-action-budget.md) — Action Surge uses the\n same long/short full refill\n- [`action-economy.md`](../action-economy.md) — `FireBoundary` itself\n\n## Known misuse\n\n- Expecting `recovery_rule` alone to restore anything at runtime.\n- Ungated `actor.stat` on a class pool for every creature on rest (fails\n the whole consequence chain for non-owners).\n- Treating Arcane Recovery / Magical Cunning as automatic boundary side\n effects — they are optional rites with their own use counters.\n- Treating Relentless Endurance as \"just a rest-refilled charge\": the charge\n half fits this pattern, but the 0-HP intercept does not\n (`packages/spellkave-srd-cc/docs/substrate-verdicts/relentless-endurance-0hp-intercept.md`).\n\n## SRD features\n\nLong Rest HP/slot recovery and the return of spent Hit Point Dice; one Hit\nPoint Die spent per Short Rest; Second Wind / Rage / Focus / Channel Divinity\npartial short + full long; Action Surge either rest; Arcane Recovery and\nMagical Cunning as separate verbs (BL-70); curated wand charges (Wand of\nMagic Missiles, Wand of Fireballs, sk-609b.13) — modelled as a full refill\non a Long Rest (`rest.toml:308-317`), not the SRD's partial recharge at\ndawn.\n"},{"id":"patterns/role-driven-brain","title":"Role-driven brain (fight behavior selected by an instance tag)","kind":"guide","summary":"I have many enemies in many encounters and need each to fight sensibly (archers keep range, brutes charge, leaders hang back) without writing a bespoke seat per creature.","tags":["patterns","role","driven","brain"],"body":"# Role-driven brain (fight behavior selected by an instance tag)\n\n## Name\n\n`role-driven-brain` — Combat brain selected from a creature's role tag\n\n## Problem\n\nI have many enemies in many encounters and need each to fight sensibly (archers keep range, brutes charge, leaders hang back) without writing a bespoke seat per creature.\n\n## Forces\n\n- The module contains no actor decision logic: an NPC needs a driver\n ([`npc-needs-driver`](../repairs/npc-needs-driver.md)), and one driver\n per creature does not scale to a bestiary.\n- Behavior is a fact about the *instance in this scene* (the same goblin\n may be a skirmisher in one fight and a leader in another).\n- Speech / parley lines are adventure content, not part of the brain.\n- Tag families should be declared as tag prefixes (an undeclared prefix is\n warning `MF-VAL-298`; a `tag_value_definitions` row whose bundle does not\n own the prefix is fatal `MF-VAL-306`, `crates/spellkave-validate/src/tag_grammar.rs:76-79,127-129`)\n and every tag needs a reader.\n\n## Solution\n\n1. Define a registered tag family `<bundle>.creature.role.<role>` with a\n small closed vocabulary (skirmisher, archer, brute, leader, lurker,\n undead-tide, caster-boss, …) and stamp one on every monster definition\n (generator-owned heuristics: attack shape + type/size, with per-scene\n overrides) or on the instance's `[[entity_tag]]`.\n2. Keep content-free role brains in the NPC package; a **seat factory**\n reads the definition/instance tags (or an explicit `role`) and returns\n the brain. Speech and parley stay optional app-owned parameters.\n3. Stock fights then need only the instances + tags\n ([`blueprint-instance-override`](./blueprint-instance-override.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/monsters/storyline-encounters.toml`:\n\n```toml\n[[entity_tag]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nsource = \"manifest\"\ntag = \"srd.creature.role.skirmisher\"\n```\n\nSeat side (TypeScript, not TOML):\n`createRoleDrivenBrain({ definitionTags | role, hostileReplyLine?, … })`\nfrom `@spellkave/adventure-runtime` (`src/role-driven/index.ts`); the Crypt\nWarden uses `role: \"archer\"` plus its hostile refusal line\n(`hostileReplyLine`).\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/creature-roles.test.ts`\n (every monster definition carries exactly one role; overrides win)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/multi-role-fight.test.ts`\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/crypt-warden-brain.test.ts`\n\n## Related\n\n[`blueprint-instance-override`](./blueprint-instance-override.md),\n[`companion-follow`](./companion-follow.md) (another seat-policy pattern),\n[`npc-needs-driver`](../repairs/npc-needs-driver.md),\n`crates/spellkave-npc-host/MILESTONE-role-driven.md` (the role-driven contract).\n\n## Known misuse / anti-pattern\n\n- A bespoke seat per creature.\n- Encoding behavior in the kernel (a \"hostile AI\" primitive).\n- Hand-editing generated fixtures to set roles — override in the generator.\n- Minting a role tag without a reader.\n\n## SRD features that use this\n\n- Every `srd/creature/<slug>` definition; elven-mini §5 encounters, the\n Crypt Warden, storyline villains. Role table and assignment heuristics:\n [`combat-roles.md`](../../../spellkave-srd-cc/docs/combat-roles.md).\n"},{"id":"patterns/tag-membership-menu","title":"Tag-membership menu (derive lists from tags, tables from tag metadata)","kind":"guide","summary":"I need a list (all fighting styles, all wizard spells of level 1, every skill) for a menu or a filter, or a finite reference table (ability-score meaning bands, DC bands) for auth…","tags":["patterns","tag","membership","menu"],"body":"# Tag-membership menu (derive lists from tags, tables from tag metadata)\n\n## Name\n\n`tag-membership-menu` — Membership from tags, reference tables as tag metadata\n\n## Problem\n\nI need a list (all fighting styles, all wizard spells of level 1, every skill) for a menu or a filter, or a finite reference table (ability-score meaning bands, DC bands) for authors and DMs to read — without a hand-maintained list that chases the catalog.\n\n## Forces\n\n- A hand list silently rots when the catalog grows; tag membership is\n recomputed from the rows themselves.\n- A finite source table that explains ONE semantic class and has no\n structured runtime consumer should not become one row per rung.\n- Declare every tag family in the bundle's `tag_prefixes`. A tag whose\n namespace no declared prefix covers is warning `MF-VAL-298`; a\n `tag_value_definitions` row whose bundle does not declare the EXACT\n owning prefix is fatal `MF-VAL-306` (the bare bundle catch-all does not\n cover a longer family's value rows;\n `crates/spellkave-validate/src/tag_grammar.rs:76-79,127-129`). For an\n exact-value vocabulary every value must be a `tag_value_definitions` row\n (naming a non-member is fatal); other ref-typed prefixes only warn\n (`tag_grammar.rs:95-104`).\n- Vocabulary without a reader is cargo cult: every adopted tag names its\n consumer (predicate, server read, test, UI).\n\n## Solution\n\n- **Membership**: tag each member (`<bundle>.feat.fighting_style.*`,\n `<bundle>.spell.list.<class>`), register the family in the bundle\n header's `tag_prefixes`, and derive menus / pick lists by filtering rows\n on the tag (plus level or other facts). Feed\n [`advancement-choice`](./advancement-choice.md) members from this.\n- **Typed references** ride inside a dotted family when no first-class\n column exists (`<bundle>.ability.wis` on a skill capability refers to\n the `<bundle>/wis` resource); declare the family and target kind so\n lint and ref-chasing can resolve it.\n- **Reference tables** (ability-score meaning bands, difficulty-class bands)\n render into the shared `tag_value_definition.description` of the one\n tag that names the class, generated from the parsed source with\n provenance pinned. Discovery metadata only — predicates, macros and\n world facts remain the executable rule\n ([`derived-value-mechanism`](./derived-value-mechanism.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/classes/advancement-metadata.toml`\n(a menu member carrying the membership its tag already implies) and the\nweapon tag vocabulary:\n\n```toml\n# every entity tagged srd.feat.fighting_style is a member of this menu; the\n# generator derives both the tag and the member rows from the same parsed\n# feat category (advancement-metadata-units.ts:352-355), never a hand list\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/archery\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/archery\" # unique per-menu wrapper; grants_ref is the tagged feat\n\n# packages/spellkave-srd-cc/fixtures/base/equipment/weapons/dagger.toml\n[[entity_definition_tag]]\nentity_def_id = \"srd/weapon/dagger\"\ntag = \"srd.weapon.property.finesse\" # family srd.weapon registered in tag_prefixes\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-data-advancement.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/feats-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/tag-value-vocabulary.test.ts`\n (`srd.ability_score` description pinned to the parsed table, `:149-162`)\n\n## Related\n\n[`advancement-choice`](./advancement-choice.md),\n[`identity-tag-capability-grant`](./identity-tag-capability-grant.md)\n(tags that are live identity),\n[`metadata-attachments`](../metadata-attachments.md),\n[`fixture-correctness`](../fixture-correctness.md) (tag hygiene rows).\n\n## Known misuse / anti-pattern\n\n- A hand-written member list in TypeScript.\n- One tag or fixture row per table rung.\n- Colon-shaped or flat tags (`faction:party`) — fully dotted under the\n bundle namespace.\n- Forgetting the `tag_prefixes` entry and reading `MF-VAL-298` / `MF-VAL-306`\n as a validator bug. (`MF-VAL-306` used to double as a DSL-macro check too;\n sk-jay0.7.174.28 moved that one to `MF-VAL-356`.)\n- Minting a relation-shaped tag without declaring its family and target.\n\n## SRD features that use this\n\n- Fighting-style menus, class spell lists, skill → ability references,\n `srd.ability_score` / `srd.difficulty_class` descriptions. Naming rules\n and the rename history:\n [`tags-and-ids.md`](../../../spellkave-srd-cc/docs/tags-and-ids.md).\n"},{"id":"patterns/trace-perceptibility-window","title":"Trace perceptibility window (event vs standing mark)","kind":"guide","summary":"I need a perceivable thing that is either an event (heard only as it happens — speech) or a standing mark (a slime trail, a scorch — findable whenever someone walks in), or someth…","tags":["patterns","trace","perceptibility","window"],"body":"# Trace perceptibility window (event vs standing mark)\n\n## Name\n\n`trace-perceptibility-window` — Declare event-or-mark on the trace KIND\n\n## Problem\n\nI need a perceivable thing that is either an event (heard only as it happens — speech) or a standing mark (a slime trail, a scorch — findable whenever someone walks in), or something in between that fades.\n\n## Forces\n\n- A trace is perceived at two moments: when inscribed (everyone\n co-located) and on ARRIVAL, when a body later walks onto its node.\n- A tick is as long as the operator says (300 s by default): a whole\n scene plus several arrivals fits inside one, so \"this tick\" is not\n \"this instant\".\n- Deleting a trace reaches backwards: the player read path resolves each\n remembered trace through the `trace` table, so deletion silently\n un-hears a listener who had already heard.\n- An elevated/DM caller must still be able to read the full history of the\n nodes it watches.\n\n## Solution\n\nSet `trace_kind_definitions.perceptible_for_ticks` — it governs ONLY the\narrival moment, never the inscription moment, and never the row's life:\n\n| Value | Meaning | Example |\n|---|---|---|\n| *omitted* | standing **mark** — findable whenever you walk in | a slime trail |\n| `0` | **event** — perceived only as it happens | speech |\n| `n` | lingers, then fades | smoke, a scent |\n\nThe bound is exclusive: `n` admits arrivals through `inscribed_at + n - 1`,\nso `0` admits nothing on arrival at all, including on the utterance's own\ntick. The row survives either way; memories formed stay formed. Do **not**\nuse `expires_at_tick` to get this effect.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/speech.toml`\n(event) and `packages/spellkave-adventure-elven-mini/fixtures/adventure/story/traces.toml`\n(standing mark):\n\n```toml\n[[trace_kind_definitions]]\nbundle_id = \"srd\"\nkind_id = \"srd/speech\"\nlocation_kinds = \"place_node\"\nperceptible_for_ticks = 0\nschema_json = '{\"text\":\"string\",\"addressee\":\"integer?\"}'\n\n[[trace_kind_definitions]]\nbundle_id = \"elven_mini\"\ndescription = \"A glistening trail of translucent slime, still faintly wet — something crawled through here.\"\nkind_id = \"elven_mini/adventure/trace/slime_trail\"\nlocation_kinds = \"place_node\"\nschema_json = \"{}\"\n# perceptible_for_ticks omitted → standing mark\n```\n\n## Worked example: a KERNEL-emitted kind (`core/departure`)\n\nA trace kind is content even when the KERNEL writes its rows. When a body\nwalks out of a place node the kernel inscribes `core/departure` at the node it\nleft (bead sk-jay0.1.23.35.4), and this window is the whole reason a companion\none room behind can still follow: the departing body's own room-mates perceive\nit as it happens, and anyone who arrives within the authored window finds the\ntrail still fresh.\n\n```toml\n[[trace_kind_definitions]]\nbundle_id = \"core\"\nkind_id = \"core/departure\"\nlocation_kinds = \"place_node\"\ndescription = \"Someone left this place through an exit, and the way they went is still readable here.\"\nschema_json = '{\"mover\":\"integer\",\"via_place_edge_id\":\"string\",\"exit_label\":\"string\"}'\nperceptible_for_ticks = 6\n```\n\nCopied from\n`packages/spellkave-mechanics/fixtures/core/base/long-running-actions.toml`.\nRead the number as fiction: six ticks is a fresh trail, not a ledger. Author it\nshorter and a follower two rooms behind loses the scent; author it much longer\nand a room remembers every passer-by for an hour.\n\nTwo rules this example shows that the table above does not:\n\n- The row outlives the window on purpose, but it is not permanent: the\n kernel sets `expires_at = now + 10 × window` (60 ticks for the authored 6;\n fallback 60) (the world API).\n The window governs arrival; the ROW's life is a separate decision, and\n deleting the row early would un-perceive someone who already holds the\n memory.\n- The payload names the EXIT taken, never the destination node. A late arrival\n reads which way someone went and resolves that exit against the exits it can\n see itself — a footprint must not teach a room nobody has entered.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/speech.ts`\n (walk out / speak / walk back in pins the arrival rule)\n- Demo: `openspec/specs/world-knowledge-and-perception/demos/sk-n16-speech-anchor-and-temporal-admission.md`\n- the world API (the kernel-emitted\n example above: its seam-B window tests use the same number 6, hard-coded\n in the test, and assert the 10× lifetime)\n\n## Related\n\n[`directed-speech-anchor`](./directed-speech-anchor.md),\n[`lingering-hazard-zones`](../lingering-hazard-zones.md) § \"Traces that\nfade on their own\" (the decay-deletes warning in substrate terms),\n[`lingering-hazard-zone`](./lingering-hazard-zone.md).\n\n## Known misuse / anti-pattern\n\n- Decaying a trace (`expires_at_tick`) to make it stop being heard.\n- Expecting `perceptible_for_ticks = 0` speech to be heard by a body that\n arrives later in the same tick.\n- Modelling a standing mark as an event and wondering why explorers never\n find it.\n\n## SRD features\n\n- `srd/speech` (event), the elven-mini slime trail (mark), utility spell\n cast marks (mending / prestidigitation / alarm — srd-cc L12d `trace_cast`). Residue and the\n full lifetime note:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n"},{"id":"patterns/watch-reader-manifest-closure","title":"Watch reader-manifest closure","kind":"guide","summary":"An NPC watch runs on one connection and declares that connection's tables once, in its own `subscribeReaders` call. Hosts then inject callbacks — \"who is the hero\", \"who is presen…","tags":["patterns","watch","reader","manifest","closure"],"body":"# Watch reader-manifest closure\n\n## Name\n\n`watch-reader-manifest-closure` — a watch subscribes every table its injected\ncallbacks read, not only the ones its own body names.\n\n## Problem\n\nAn NPC watch runs on one connection and declares that connection's tables\nonce, in its own `subscribeReaders` call. Hosts then inject callbacks —\n\"who is the hero\", \"who is present\", \"is this quest accepted\" — and those\ncallbacks read tables the watch body never mentions. On an unsubscribed table\nan SDK reader does not throw: it sees an empty table and answers *nothing\nfound*. The watch keeps running and quietly does less than it was wired to\ndo.\n\n## Forces\n\n- Subscriptions are per connection. A DM seat has ONE port and connection\n that every watch on that seat shares; `subscribeReaders` widens it\n additively (the retired TypeScript DM port; the Rust host's reader tiers, `crates/spellkave-npc-host/READER-HYDRATION.md`).\n Nothing widens it automatically: a callback the host supplies reads only\n what some reader manifest on that connection has subscribed, so a table\n that neither the watch's manifest nor the host subscribes stays empty.\n- SDK readers fail soft by design: `readActorSnapshot` returns `null` when\n `visible_actor_spatial_location` carries no matching row, which is\n indistinguishable from \"that actor is genuinely nowhere\".\n- The degraded answer is usually a *legal* answer. An empty companion list is\n exactly what an omitted resolver produces, so the failure looks like the\n documented default rather than a bug.\n- Perception-gated `visible_*` tables differ per socket: the same reader can\n work on an operator connection and return nothing on the NPC's own.\n- Runtime `session` / `session_participant` are **private** (ADR-0057, sk-2qt).\n Clients subscribe `visible_session` / `visible_session_participant`. A caller\n sees only sessions whose roster includes a directly-controlled body, or a body\n reached by an Internal-elevated DM extent. Unrelated sockets receive no\n TravelState `state_json` and no distant initiative. Reading the raw table\n names yields an empty handle, which looks like \"no fight / not travelling\".\n\n## Solution\n\nTreat the callback contract as part of the subscription. When a watch accepts\nan optional resolver, its own reader manifest carries the tables that\nresolver's documented implementation needs, and a comment says which resolver\neach extra table is for — so a later reader deleting the \"unused\" table sees\nwhy it is there.\n\n```ts\nawait port.subscribeReaders([\n {\n requiredTables: [\n \"visible_manifest_authored_entity\",\n \"visible_manifest_authored_entity_coverage\",\n \"visible_target_condition\",\n \"entity\",\n \"actor\",\n \"visible_object_state\",\n // A host that answers `resolvePresentPartyEntityIds` by co-location\n // reads it through `readActorSnapshot`, which reads\n // `visible_actor_spatial_location`. Without this table the resolver\n // sees no companion anywhere and silently rebuilds the hero-only\n // grant it exists to replace.\n \"visible_actor_spatial_location\",\n ],\n },\n]);\n```\n\n## Proof\n\n`packages/spellkave-adventure-runtime/src/dm/watches/quest-xp-watch.ts`\n(reader list `QUEST_XP_WATCH_READERS` in `dm/lib/readers.ts`) subscribes `visible_actor_spatial_location` for\n`resolvePresentPartyEntityIds`;\n`packages/spellkave-adventure-elven-mini/npcs/catalog.ts` supplies the\nresolver. Live proof:\n`just srd-cc-live src/test/live-self-seeding/mechanics/q4-quest-xp.test.ts` —\n`Aldwin granted 200 quest XP for Q4 to 2,143,15`, `xpAfter={hero:200,\nrogue:200, hesper:200}`. Before the table was subscribed the same wiring\ngranted `to 2` alone (bead `sk-awlo.15`, PR #2792 measurement).\n\n## Related\n\n- [`quest-xp-grant`](./quest-xp-grant.md) — the grant this closure makes\n reach the whole present party.\n- [`party-extent-grant`](./party-extent-grant.md) — where party membership\n itself comes from.\n- [`before-filing-a-kernel-gap`](./before-filing-a-kernel-gap.md) — an empty\n live read is a subscription question before it is a substrate question.\n\n## Known misuse / anti-pattern\n\nConcluding from an empty read that the world is empty. `q4-quest-xp.test.ts`\ncarried exactly that inference in reverse: it saw `entityNodeId` return\nnothing on the operator socket, and hardcoded the companion pair rather than\nwidening the subscription — a correct local call that hid the production\ndefect for as long as it stood.\n\nEqually wrong: adding the whole `visible_*` surface to a watch \"to be safe\".\nEach table is bandwidth on a long-lived connection; subscribe what a named\nresolver reads, and say which one in a comment.\n\nEqually wrong for combat/travel: iterating `db.session` after sk-2qt. The raw\ntable is not on the wire; subscribe and read `visible_session` (and\n`visible_session_participant` for the roster) from a connection that actually\nparticipates or holds Internal DM elevation.\n\n## SRD features that use this\n\n- Elven-mini Q1–Q12 terminal quest XP to the co-located party.\n"}];
157
+
158
+ // Build-time projection; source prose remains owned by each product package.
159
+ export const GENERATED_PACKAGE_GUIDES: AuthoringDoc[] = [{"id":"cli/workflows","title":"Installed CLI workflows","kind":"guide","summary":"Choose the authoring or player loop, inspect arguments, recover a refusal and prove a supported change using the installed CLI.","tags":["cli","workflow","author","player","session","recovery","connection"],"body":"# Installed CLI workflows\n\n`sk` is a command-line surface over a Spellkave world's tool registry. For\n**registry tools** (the AUTHOR and PLAYER groups below) `sk` names no tool\nand hand-writes no flag: their commands, flags, and help text are derived at\nruntime from the registry, so that part of the surface stays accurate as the\nregistry grows. The file commands, `session`, `events`, `config`, and the\nglobal flags are `sk`'s own and hand-written. Use `sk --format jsonl list`\nfor the machine-readable registry, `sk help` for a human summary of every\ngroup described below, and `sk help <tool>` for one tool's schema-derived\nflags.\n\nExcept for `explore`, which defaults to TOON, results default to human Markdown\nonly when stdout is an interactive TTY;\ncaptured, redirected, or piped stdout stays canonical JSONL, one object per\nline with a snake_case `kind`. Agents and scripts should pass `--format\njsonl` when terminal detection is not under their control. `--format human`\nforces the same structured records through the generic Markdown/table\nprojection. Usage, one-tool help, and ambient-state announcements like\n\"using profile X\" remain on stderr.\n\nBefore relying on ambient author defaults, run `sk --format jsonl config show`.\nIt reports each effective value and source. Resolution is deterministic:\nflags > environment > project `.spellkave/config.toml` (gitignored, optional) >\nglobal XDG (`~/.config/spellkave/config.toml`) > built-ins.\nDo not infer a bundle from the working directory or\nwrite “last used” author state; use an explicit flag or reviewed project config.\nThe world a `--live` flush reaches is separate: `sk --format jsonl config view`\nreports it and its source (flag, environment or the worktree's current\ncontext, selected explicitly with `sk config use-context <name>`).\n\n`sk` has four groups of commands, and knowing which one you are in explains\nmost of its shape:\n\n| Group | What it is | Connection | Examples |\n|---|---|---|---|\n| **AUTHOR tools** | edit a world's *content* — place entities and actors, define capabilities, write typed rows, query schema; read admitted authored instances on publisher or role-scoped sessions | offline, except the connected tools (`get` / `describe` and `can-i` / `diff -k` / `apply -k` on the author path; `apply_manifest_delta` when it flushes `--live`; `export`) | `sk query`, `sk get`, `sk describe`, `sk place_entity`, `sk place_actor`, `sk define_capability`, `sk write_rows` |\n| **PLAYER tools** | perceive and act *as* one connected in-world actor | always connected, through a session daemon | `sk scene`, `sk move`, `sk inventory`, `sk react_option` |\n| **File commands** | take a manifest PATH; read commands may use configured `author.target` (a manifest file or directory), including its `[[include]]` closure; dependency manifests are explicit `--dep` inputs | none (local files) | `sk validate`, `sk lint`, `sk patch`, `sk render`, `sk inspect`, `sk map-inspect`, `sk map-render`, `sk skill` |\n| **Plugin groups** | a command group from a workspace package listed in `sk.plugins` (`sk plugin list`); flags derive from the verb's schema like a registry tool's | per verb | `sk plugin list`, `sk help dev`, `sk dev up --seed <manifest>` |\n\n**Spatial graph:** `sk map-inspect` (human) draws the shared SVG place-graph\ninline. `--images auto` (the default) tries the Kitty graphics protocol, then\nfalls back to timg quarter blocks when `timg` is installed, else a text\ninventory; `--images kitty|iterm2|half|quarter|sixel|timg|off` forces a mode.\n`sk map-render --out map.svg` writes that SVG. Registry tool `sk map_graph`\n(`spellkave_map_graph`) builds the same SVG from `spellkave_query` sources only.\n\n**Who is where (occupancy):** map badges are **counts only**. Default path\n(usually two calls — do **not** N× detail):\n\n```text\nsk map_graph # picture + density\nsk query --kind entities --fields preferred\n# registry: spellkave_query { kind: \"entities\", fields: \"preferred\", target?: \"local\" }\n# → group by place_node_id\n```\n\nDeeper playbook (gotchas, optional third call): `sk docs place-graph-occupancy`\n/ `spellkave_docs { doc: \"place-graph-occupancy\" }` — pull only if needed.\nDefault list stays ids-only; `actors` rows carry no location (the location is\nthe separate `actor_spatial_locations` row).\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| `0` | success |\n| `1` | usage or infrastructure error (bad flags, unresolvable connection, a tool that threw) |\n| `2` | in-world rejection — a tool ran correctly and reported `ok: false` (invalid manifest, refused delta, validator diagnostic) |\n| `3` | `sk lint --strict` — root-bundle findings present; `sk diff -k` — differences found (not `1` as in `kubectl diff`) |\n\nA tool that **throws** is infrastructure (`1`), never an in-world rejection.\n\n---\n\n# Part 1 — Authoring (AUTHOR tools + file commands)\n\nA clean `sk validate` runs the same validator crate the server runs at\nadmission, but the server validates against the definitions already applied\nto the target world; locally only the bundles you pass with `--dep`\napproximate that closure. A clean run is the deterministic **floor**, not\nproof of admission or of correctness. Two whole classes of fixture-correctness\nfailure pass `validate` clean:\n\n- **Silent-at-seed**: generator/hand id collisions, duplicate\n `(entity, state)` last-write-wins, above-`max` clamp. The validator cannot\n see seed-time commit behaviour — these surface only once the manifest is\n actually applied/seeded against a live world.\n- **Semantic**: a predicate or DC that *parses* but *mis-evaluates* at\n runtime. No general static gate exists (`sk lint`'s `dead-target-capability`\n catches one such class). For an isolated formula, `sk eval` / `spellkave_eval`\n is the offline oracle: evaluate the expression against supplied facts and\n trace which operand evaluated false, short-circuited, or exhausted dice without\n touching a live node. For holistic game-loop behavior (affordance disclosure,\n niche occupancy, act resolution), observe the effect on a live, connected\n world (see Part 2).\n\n\"Repair only from diagnostics\" applies to the deterministic class. For\nsilent-at-seed collisions there is no diagnostic to repair from — you seed and\nobserve, or you connect and prove it live. For a mis-evaluating predicate or DC,\nbench it offline with `sk eval` before touching a live node.\n\n## Query first — before reading prose\n\nThe compact machine surfaces below are generated from the same crates the\nvalidator runs. A prose read is the\nfallback for a *named, unresolved* question — never the default first move.\n\n| You want | Run | Not |\n|---|---|---|\n| Does it already exist? (**step 0**, before ANY authoring) | `sk docs --query \"<concept>\"` + grep the owning content directory for the slug | authoring a duplicate identity |\n| Row kinds / field names | `sk query --schema --kind <row_kind>` | reading the whole manifest-format doc |\n| DSL operators / arg shapes | `sk docs dsl-grammar` | reading the whole DSL grammar doc |\n| Why did a formula evaluate false? | `sk eval \"<expr>\" --facts '<json>' --dice <faces>` (or `spellkave_eval`) | seeding and guessing why a predicate failed |\n| Start here | `sk docs onramp` (AUTHOR + PLAYER tools; TOML as model) | dumping the whole corpus |\n| A known shape for a mechanic (consume an item, grant XP, gate on a capability, …) | `sk docs patterns` (the pattern catalog), then the pattern page it names | inventing a shape, or filing a kernel gap before the catalog says there is none |\n| Examples / how-to | `sk docs --query \"<intent>\"`, then `sk docs <id>` | reading the whole docs corpus |\n| Failure symptom | `sk docs --query \"<error or DSL name>\"` (repair sheets) | scrolling onramp gotchas |\n| Current world/bundle state | `sk inspect <root> --bundle` | reading whole fixture files by hand |\n| Find a place, definition or placed instance by name, then follow it | `sk --target <manifest> explore search \"<text>\"`, then run the printed `next` commands as printed (`explore detail`, `neighbors`, `references`, `field`) | guessing row ids, or hand-writing a `sk query --json '{\"explore\":...}'` request |\n| Authored instance on the live world | `sk get <kind> [<key>]` / `sk describe entities <key>` | export or `sk query --kind entities` without a live author connection |\n| A question the queries can't resolve | `sk docs <id>` for the named doc, targeted | a full-corpus read |\n| May this actor do this, and why not | `sk can-i <action> --as <body> --target <target>` | performing the act, or recomputing the checks offline |\n\n**Step 0's rule is binding: found → extend, grant, or reference — never\nre-author** a twin identity. Re-authoring an identity that already exists\nwastes a full authoring round-trip at best; at worst it lands twin\nidentities a lint pass flags only as an advisory smell, and seed-time\nresolves by last-write-wins collision.\n\n## Loop\n\n0. **Check it already exists** (mandatory): `sk docs --query \"<concept>\"` +\n a targeted grep of the owning content directory. Found → extend/grant/\n reference the existing identity — never re-author a twin.\n\n1. **Inspect** what's there before editing:\n\n```bash\nsk inspect <manifest.toml>\nsk inspect <manifest.toml> --bundle\nsk inspect --kind <row_kind>\nsk inspect --kind <row_kind> --id <row_id>\n```\n\nUse `--bundle` when the root manifest has `[[include]]` fragments; without\nit, an include-heavy bundle looks empty because the root only names\nfragment paths. For interactive exploration, stay on `inspect`: the overview\nprints each exact row-kind key, `--kind` lists its rows, and `--id` opens one\nrow plus its references. `sk query` remains the registry-level equivalent for\nagents and scripts. To find a row by what it is called or described as, run\n`sk explore search \"<text>\"` (files with `--target` or configured `author.target`, otherwise the connected world);\nsearch output defaults to TOON with up to five matches. Run the printed `next`\ncommands as written to inspect a result, continue a page or widen the limit when\noffered. Lists are bounded by both the requested row count and a 16,384-byte JSON\nanswer budget; a larger `--limit` does not remove the byte budget. Source and\ncoverage metadata identify non-default or incomplete reads; `--format jsonl`\nbefore `explore` gives the underlying JSON projection.\n\nLive exploration labels its scope as `caller-visible rows`: totals and\n`completeness` describe that admitted scope, including when the connection also\nreports `reads_as_publisher: true`. They do not establish equality with the\nauthored file catalog. A definition such as `Creation Candidate` is a blueprint;\nfinding it under `--collection definitions` does not prove that an instance\nexists under `--collection instances`. The current live instance projector\nreports `incomplete` with the existing `authored_entities_only` limit and no\ninventory total: runtime-born bodies lack authored keys, and graph extents can\nomit containment-only descendants. Empty matches therefore do not prove an\nempty world. Paging still walks the admitted projected rows; an unchanged retry\ndoes not broaden this fixed limit. The live 84/81 regression is in\n`behaviour/exploration/visibility.feature` and runs in the kernel-live CLI lane.\n\nFor authored inventory inside containers, an appropriate existing Bundle read\ngrant includes those authored descendants. The live BDD proves 81 directly\nplaced bodies under a graph grant and all 84 under the Bundle grant, without\nchanging admission. An authorized operator can grant the world's existing role:\n\n```sh\nsk --live grant --role dm --subject <identity> --extent-kind bundle --extent elven_mini --bundle elven_mini\nsk explore search --kind entities --bundle elven_mini --source live\nsk explore search Candidate --kind entity_definitions --source live\n```\n\nUse the intended caller's identity and an existing role with the required read\ndepth; configuration does not grant authority by itself. This fixes contained\nauthored inventory, while runtime references remain unsupported by the current\nprojector. The matching live scenarios are in `visibility.feature`.\n\nNative command names resolve to their existing schema-derived help, and a help\nflag is handled before invoking a command. These work without a world connection:\n\n```sh\nsk help grant\nsk help can-i\nsk session stop --help\nsk dev publish --help\n```\n\nThe installed CLI process scenarios in `configured-world.feature` prove the\nnative aliases, grant subcommands and post-verb help with an unreachable world\nconfigured. Help stays on stderr and leaves stdout empty.\n\nText relevance comes first: an exact mechanism name beats an entity-name prefix.\nWithin an equal text relevance tier, broad definition searches show entity\nblueprints before supporting mechanisms. When a single-definition answer offers\na relationship follow-up, it uses `references` instead of spatial `neighbors`,\nfollowing authored links such as initial capabilities. Continuations from the previous ordering are refused\nas stale; use the printed restart. These journeys are proved in\n`behaviour/exploration/candidate-discovery.feature`.\n\nAn explicit `--kind` selects its collection from the static schema, so\n`sk explore search --kind entities --field name --field kind` needs no\n`--collection instances`. Without either flag, search defaults to places. An\nexplicit collection that disagrees with the kind is a usage error, with the\nmatching collection named in the response. The real CLI scenarios in\n`behaviour/exploration/reusable-definitions.feature` cover these cases.\n\nInstance search totals count matching **rows**, not distinct objects. A complete\nsearch with matching rows from multiple instance kinds adds `counts_by_kind`; an entity body\nand its actor facet can share a key and still count as separate rows. These\ncounts cover the whole filtered result, remain stable across pages of the same\nsnapshot, and are omitted when coverage is incomplete. Narrow to `--kind entities`\nto count bodies, or `--kind actors` to inspect steering facets.\n\nTo inspect authored body classifications without losing the row identity:\n\n```bash\nsk explore search --collection instances --kind entities --field name --field kind\n```\n\nTOON keeps `kind` for the row kind (`entities`) and shows the authored scalar\nas `fields.kind` (`player`, `npc`, or `item`, for example), in lists and details.\nOther scalar names that collide with navigation columns use the same\n`fields.<name>` prefix. JSON keeps its nested `fields` object. A `player` body\nclassification alone does not establish a current human player claim. The\nreal-CLI regressions are in `behaviour/exploration/reusable-definitions.feature`.\n\nTo enter an unfamiliar place graph, search by its name:\n\n```bash\nsk explore search \"<graph-name>\" --kind place_graphs\n```\n\nFor one match, run its printed `neighbors` command. For several matches, use the\nprinted detail template for the chosen graph, then its printed `neighbors`\ncommand. A graph's neighbors include its rooms and stored parent/child graph\nlinks. Open a chosen room with its detail template, then follow `neighbors` to\nsee linked rooms and admitted occupants. Each link names its stored relationship;\nthe printed commands carry bundle and source identity. This walk is read-only and\ndoes not expand the whole world. The graph-to-room-to-occupant journey is proved\nin `behaviour/exploration/find-places.feature`.\n\nAn incomplete answer with `examined_row_bound` means the source reader reached\nits examination limit. Paging continues over the examined subset. A family with\n`no_live_projection` is not supported by that live reader. TOON explains these\nfixed limits and omits an unchanged retry when all gaps have either reason,\nincluding mixed answers. Transient or unknown gaps and refusals retain their\nrecovery routes; page continuations remain available. The underlying JSON\nprojection retains its original recovery metadata. Regression coverage is in\n`src/__tests__/explore-toon.test.ts`,\n`behaviour/exploration/search-ranking.feature` and the small live CLI scenario\nin `behaviour/exploration/visibility.feature` (also run by the existing kernel\nscoped-read CI row).\n\nFor adventures and rules in separate packages, configure the local manifest and\neach dependency once. From the checkout root, for Elven Mini:\n\n```bash\nsk config set --project author.target packages/spellkave-adventure-elven-mini/fixtures/adventure.manifest.toml\nsk explore search --kind place_graphs --limit 20\nsk map-inspect --images off\n```\n\nThis checkout tracks `.spellkave/defaults.toml`, which maps the `srd` and `dm`\nbundles, so the adventure's dependencies resolve with no extra flags. Defaults are\nthe lowest layer (flag, then project, then global config, then defaults) and may\nonly set `author.dependencies`, with repository-relative paths; set a project\nmapping with `sk config set --project author.dependencies.<bundle-id> <manifest>`\nto override one. Project paths resolve from the project root, including from subdirectories.\nDependency mappings apply to local registry reads (`explore`, `query`, `map_graph`)\nand follow transitive `depends_on` links. Unmapped IDs retain the conventional\n`<fixtures-root>/<bundle-id>/manifest.toml` lookup. An explicit `--fixtures-root`\noverrides configured mappings for that call and warns on stderr when mappings\nare present. `config show` reports each mapping\nand its source; `config unset --project author.dependencies.<bundle-id>` reveals\nits global default, if any. Global dependency paths resolve from the global\nconfig file's directory. A relative global `author.target` instead resolves from\nthe invocation's working directory, so use an absolute global target for reuse\nacross directories. Literal `~`-prefixed dependency paths are rejected; use an\nabsolute or appropriately relative path. These settings configure files; connection profiles\ncontinue to select live worlds. The configure-once behaviour is exercised by\n`packages/spellkave-cli/behaviour/exploration/configured-world.feature`.\n\nFor player-facing places, inspect both graph and node descriptions: a graph\nblurb does not supply a node's arrival prose (`author_place` has separate\n`description` and `nodes[].description` fields). Keep generator rationale and\noperator decisions in source comments or developer docs. Check spatial claims\nagainst the composed scene, including edges added by other fragments or at\nruntime; an empty edge list in one helper does not prove an isolated place.\nAfter a prose change, read the rendered PLAYER scene on the updated world.\n\n2. **Query** only the context the edit needs:\n\n```bash\nsk docs --query \"<intent>\"\nsk docs <id> # prose + a copyable example TOML\nsk query --schema --kind <row_kind> # one row kind's fields\nsk docs dsl-grammar # operators + arg shapes\n```\n\nNever guess game-mechanical numbers (stat blocks, DCs, damage dice). If a\nvalue isn't in the authored bundle or a cited source, say so and stop —\ndon't invent one.\n\n3. **Edit** structurally. Prefer a first-class patch op over freehand TOML —\n each op writes the typed round-trip and validates:\n\n```bash\nsk patch <manifest.toml> \\\n --op add-entity \\\n --json '{\"entity_key\":\"demo/guide\",\"name\":\"Guide\",\"kind\":\"npc\",\"place_node_id\":\"village/village_green\"}' \\\n --output <manifest.toml>\n```\n\nAn unknown op fails with `unknown patch op: <op>` (exit `1`) and does not\nlist the accepted ops. The op names are the arms of `dispatch` in the\n`spellkave-authoring` crate (`src/patch/mod.rs`); that list grows with the\nauthoring engine, not with this skill.\n\nFor a bulk edit (many rows of the same kind at once), build one\nschema-shaped JSON object and render it in a single call instead of looping\na patch op per row — the renderer fills row defaults and validates:\n\n```bash\nsk render --input <manifest.json> --output <manifest.toml>\n```\n\n`sk docs --query \"<row kind> seed\"` (or a nearby phrase naming the row kind)\nsurfaces a worked example and its doc id — reserve `sk patch` for\nincremental single-row edits.\n\nThe registry write verbs (`author_place`, `place_entity`, `place_actor`,\n`define_*`, `write_rows`) are the other edit path: they write into a\nworkspace scratch, not into a file or a world. `sk apply_manifest_delta` is\nthe transaction end — with no params it flushes that scratch to the active\ntarget (`local` merges into the target folder's `manifest.toml`, `live`\ndispatches `r_apply_manifest_delta`). Until then nothing outside the\nworkspace changes. `sk patch`, by contrast, writes the FILE you name.\n\nFiles of a root that is already on a world (a seeded root with an\n`applyset = \"<name>\"` line) reach that world with `sk diff -k <dir>` and\n`sk apply -k <dir>`, like `kubectl diff -k` / `apply -k`: `diff` classifies\nevery row against the world's applyset memory (`create`, `configure`,\n`move`, `prune`, `unchanged`; exit `3` on differences), `apply` sends only\nthe changed rows in one call and retracts dropped rows only with `--prune`; a placed entity's one `bundle_id:entity_key` retraction covers its authored instance rows (tag rows stay).\nWith publisher closure on a played test world, `--prune` of an entity the player touched needs `--force` so the tool can retract world-added rows (a carried item, a claimed seat); without it the apply refuses and lists them. Caller-scoped entity prune refuses even with force because that closure is unavailable. Rows the world holds but the applyset never applied are left alone. Kinds\nwithout a row identity are counted, not compared. Full rules, refusals and\nlimits: this package's `README.md`, \"Applyset diff and apply\".\n\n4. **Validate** every write and repair from diagnostics, re-running until\n exit `0`:\n\n```bash\nsk validate <manifest.toml>\nsk validate <manifest.toml> --bundle --dep <dep-manifest.toml>\n```\n\nUse `--bundle` for include-heavy content and repeat `--dep` once per\ndeclared dependency so cross-bundle references validate against the same\nclosure a live server would admit. Fix only what a diagnostic's\n`code`/`path`/`message` names — don't reopen the whole file.\n\n5. **Lint** for author-time duplication / binding smells (advisory, never\n fatal on its own):\n\n```bash\nsk lint <manifest.toml> [--bundle [--dep <dep>]...] --strict\n```\n\n`sk lint`'s findings are the author-time mirror of dangling references and\nduplication patterns the validator doesn't flag (twin actions, dangling\ncapability bindings, tag repetition, dead-predicate branches). By default\nfindings alone exit `0`; pass `--strict` in any flow that gates on `$?` so\nfindings on the root and its includes exit `3`. Dependency findings remain in\nthe report with their `bundleId`, but do not fail the root check. A finding\nwithout bundle provenance still fails strict mode. The complete,\ncurrent rule-id list — regenerated from the lint engine's own rule table,\nnever hand-copied — is:\n<!-- GENERATED:lint-rule-ids:start -->`twin-action`, `dangling-required-capability`, `orphan-spell-capability`, `spell-delimiter-drift`, `tag-repetition`, `dead-target-capability`, `dangling-ref-tag`, `ambiguous-ref-tag`, `duplicate-exit-label`<!-- GENERATED:lint-rule-ids:end -->.\n\n6. **Audit before shipping.** `validate` + `lint` are the floor — by\n construction they miss the silent-at-seed and semantic failure classes\n named above. For anything non-trivial, prove the change by actually\n seeding/applying it against a live world and observing the effect (Part\n 2) rather than trusting a green `validate` alone. For a new or changed DSL\n formula, bench its evaluation offline with `sk eval` before applying.\n\n## When the tool fights you\n\nFriction is a signal the *tooling* is missing something, not that you should\nwork around it by hand. If an edit no patch op expresses, if a diagnostic is\nunclear or missing, or if answering a small question cost you a whole-file\nread — note what you wanted, the command that fell short, and the workaround\nyou resorted to. Then route that friction to whoever owns the surface that\nfell short (a doc-gap/inexpressible-edit report from inside an authoring\nloop, or an issue against the tool) rather than silently absorbing the cost\nevery future session. Don't hot-patch `sk`, its registry, or the underlying\nauthoring engine mid-task — that path skips review and regresses easily; the\ndurable fix rides through the tool's own change process.\n\n---\n\n# Part 2 — Connected mode (PLAYER tools)\n\nPLAYER tools (`sk scene`, `sk self_summary`, `sk move`,\n`sk manipulation_context`, `sk manipulate`, `sk communicate`, `sk inventory`,\n`sk react_option`, `sk end_turn`, and\nmore — `sk list` names the current set) let you perceive and act as **one\nconnected in-world actor**. Unlike AUTHOR tools, there is no offline PLAYER\nmode: every PLAYER call needs a resolvable connection, because\nsubscribe-on-connect establishes the actor-scoped factual context. Until it\nis ready, a caller must treat discovery as unavailable rather than infer a\nblocked gate from an empty result.\n\n## The session daemon\n\nA PLAYER call doesn't hold its own connection — it dispatches through a\nbackground **session daemon**, keyed by the `(url, db, identity, actor)`\nbinding this invocation resolves:\n\n1. `sk` resolves the binding (see \"Connection resolution\" below).\n2. `sk` attaches to the ONE daemon already listening for that exact\n binding, or spawns one if none is running yet.\n3. `sk` sends one request over the daemon's socket, reads the response, and\n disconnects — the **daemon** keeps the live session open, not `sk`\n itself. Successive `sk` calls against the same binding (`sk scene`, then\n `sk move ...`, then `sk scene` again) reuse that one live session\n instead of reconnecting each time. The daemon also holds one ADR-0093\n `WorldEventBuilder` for that lifetime and piggybacks pending world-push\n events (hits, XP, turn transitions) on every invoke; `sk` prints each as\n its own JSONL line (`kind: \"push\"`) after the `tool_result`.\n\nThe daemon persists past the invocation that spawned it (an idle timeout\nshuts it down after a period of no activity), or you can manage it\nexplicitly:\n\n```bash\nsk --format jsonl session list # one JSONL line per known daemon, status, and observability mode\nsk session stop # stop the daemon THIS invocation's binding resolves to\nsk session stop <hash> # stop the daemon named by sk session list's own `hash` field\nsk session stop --all # stop every daemon this host knows about\nsk events --drain # drain pending world-push events without running a PLAYER tool\n```\n\n## Connection resolution\n\n`sk get` and `sk describe` use the **AUTHOR** path and connect on their own\n(no `--live`), the same ladder as `sk can-i` / `sk diff -k` / `sk apply -k`.\nThey do not open a second owner subscription and they do not call\n`r_export_manifest`.\n\nBoth a PLAYER call and an AUTHOR `--live` flush need a connection, but the\ntwo paths resolve it differently.\n\n**PLAYER tools** — the precedence, in order:\n\n1. **Explicit flags** — `--actor <id>` for the connected actor.\n2. **`--profile <name>`** — resolves `url`/`db`/`actor`/token from a stored\n persona profile.\n3. **The plain env chain** — `$SPELLKAVE_URL` / `$SPELLKAVE_DB` /\n `$SPELLKAVE_ACTOR`.\n4. **The remembered last-used profile** — a bare invocation with neither an\n explicit `--profile` nor a resolvable env chain falls back to whichever\n profile was last successfully used, **announced on stderr** so ambient\n state is never silent (`sk: using profile 'kira' (last used)`). A script\n that must not depend on machine state should pass `--profile`/the env\n vars explicitly instead.\n5. **Nothing resolvable** — a loud usage error naming every remedy.\n\n**AUTHOR `--live`** — `--profile <name>` supplies url/db/token outright;\nwithout it the plain env chain (`$SPELLKAVE_URL` / `$SPELLKAVE_DB`) resolves;\nwithout that, the worktree's **current context** (`sk config use-context\n<name>`, or the `local-<worktree>-<hash>` profile `sk dev up` selects). When\nthe environment and the context name different worlds the environment wins and\nstderr carries one warning naming both. There is no `--actor` step and no\nlast-used-profile fallback: `play-stage` and PLAYER `--profile` never move the\nauthor target. On both paths an explicit `--profile` beats the ambient env, so\nthe same flag never means opposite things. Check the target before a write\nwith `sk --format jsonl config view`.\n\nA connected author answer (`sk get`, `sk describe`, `sk can-i`, `sk diff -k`,\n`sk apply -k`, and `sk tool <name> --live`) includes `reads_as_publisher` and\n`connected_identity`. `reads_as_publisher` is true only after the publisher\nsubscription has applied. False means `sk get` / `sk describe` return no rows\n(`ok: false`, exit 2) — they do not fall back to `visible_*` or export. Other\ntools keep their reader-cache result and add a note naming `connected_identity`.\nIt does not claim the identity is not the publisher. Remedy: `sk config view`.\nAs a last resort, set `SPELLKAVE_CONNECT_TOKEN` from the node's `cli.toml`.\n\nInstance facts (containment, place, capabilities, equipment, object state) are\n`sk get` / `sk describe`, not operator-only SQL or observability commands.\n\nEvery `--live apply_manifest_delta` is journaled: the applied TOML as\n`.local/live-deltas/NNN-<utc>.toml` plus one line in\n`.local/live-deltas/journal.jsonl` (binding, source, ok, MF detail, duration,\nsha256), failures included; stderr names the file. `SPELLKAVE_LIVE_DELTA_JOURNAL=0`\nturns it off, `SPELLKAVE_LIVE_DELTA_JOURNAL_DIR` relocates it.\n\n`sk help` shows the current global-flag surface; this package's own\n`README.md` (shipped alongside this skill file) carries the complete\nflag/env-var reference table.\n\n## Live-proving a change\n\nThe oracle for a semantic authoring claim (a predicate/DC that parses\nbut might mis-evaluate) is a server-observed effect: connect (PLAYER tools,\nor the installed observability CLI if one is available), trigger the\nbehavior, and read the actual result off the live world — an HP delta, a\nmaterialised affordance, a state row — not an exit code and not row\nexistence. Capture the failing (\"RED\") signature first, fix, re-run the same\ncase, and confirm the signature is gone. Never author a test that\nre-implements the production logic inline as its own \"verification\" — that\npattern has produced false-positive \"verified\" verdicts before.\n\nWhen an act (`sk manipulate`, `sk move`) fails or resolves a check, its receipt\ncarries `provenance_id` matching the server evaluation record. Query the record\ndirectly via:\n\n```bash\nsk self_states --kind evaluation --provenance-id <id>\n```\n\nThis returns the exact failure details (`failure_kind`, `failure_detail`), the\ngate formula (`expression_ids`), and any resolved dice rolls (`draws`,\n`selected_template_ids`). To inspect a failing formula offline, feed its\npredicate, dice faces, and facts to `sk eval` (see Level A rule benching in\n`sk docs rule-bench`).\n\n## Observability\n\nThe session daemon emits run events for its own lifetime (one run per\ndaemon session, one event per dispatched call) plus reducer-attempt\ntracing, controlled by `$SPELLKAVE_RUN_EVENTS` (`off|jsonl|otlp|jsonl+otlp`,\ndefault `jsonl`) — captured at daemon **spawn** time, so changing it needs\n`sk session stop` followed by the next call respawning. `sk session list`\nreports the active mode per daemon, so this is never invisible ambient\nstate. This package's `README.md` names every observability env var.\n\n---\n\n# Self-contained by design\n\nEverything above holds wherever `sk` runs — this skill file ships packaged\nwith the `sk` CLI itself (`sk skill path` prints its own location) so it\ntravels with the tool, not just with one repository checkout.\n","source_path":"packages/spellkave-cli/docs/cli-workflows.md"},{"id":"personas/access","title":"Choose guidance for your task and access","kind":"guide","summary":"Route author, DM, player, observer and operator tasks to package-owned guidance using the available access surface, without inferring authority.","tags":["persona","workflow","cli","mcp","discovery"],"body":"# Choose guidance for your task and access\n\nA persona describes a task, not a grant. One person may use several of these\nroutes. Public help does not reveal private world rows, select a role or authorize\nan action. Check the offered tools and their current results before acting.\n\n## Access routes\n\n| Task lens | Repository and shell | Installed CLI, no checkout | Connector/browser, no filesystem | Guide owner |\n|---|---|---|---|---|\n| Game System Author | Authoring sources and proof tests | `sk docs find-an-authoring-pattern` → pattern and examples | `spellkave_docs` with the same `doc` IDs when offered; execution depends on available payload tools | world-author |\n| Adventure Author | Adventure sources and authored bundles | Same authoring guide; excerpts state required bundle/graph inputs | Same public guidance; scene setup remains pending its owning feature and hosted port | world-author and adventure package |\n| DM | Repository optional for product help | CLI workflow and offered connected tools | Public docs plus offered gameplay tools; presence, takeover, time control and private hints require their owning features | tool-player for gameplay; feature owner for privileged tasks |\n| Elevated Player | Same product guidance | Same player loop; rights remain server-enforced | Same offered tools; missing mutation tools do not hide public help | tool-player |\n| Player | Source unnecessary | `sk docs player/workflows` | `spellkave_docs` with `doc: \"player/workflows\"`, then offered gameplay tools | tool-player |\n| AI Inhabitant | Driver development is separate | Host provides actor observations/actions | Driver receives bounded observations and action contracts, not hidden world facts | tool-player and host adapter |\n| Observer | Product view help | Use only an offered observation route | Product UI or connector explains its available observations; no new observer runtime is promised | observation surface owner |\n| Publisher/operator | Operational runbooks and deployment tooling | `sk help op`; infrastructure setup still needs its operational distribution | Only explicitly offered operational routes; gameplay docs cannot provide operator credentials | sk-op and operations runbooks |\n| Kernel developer/CI maintainer | AGENTS, specs, ADRs, source and tests | A product installation is not a development checkout | Product help does not replace repository workflows | repository governance |\n| Reviewer/canon steward | PR/spec/evidence review | Versioned read-only evidence where supplied | Explicit public evidence; product help does not become a code-review environment | owning feature and review workflow |\n\n## Focused guides\n\nUse `sk docs cli/workflows` for installed CLI loops and\n`sk docs find-an-authoring-pattern` for problem search, source-backed excerpts\nand complete examples. The player loop is `player/workflows`. Large pages\nsupport exact headings and opt-in full retrieval.\n\nHosted consumers call `spellkave_docs` using `query`, `doc`, `section`, `outline`\nor `full`; they do not need to install a shell skill. A connector must actually\noffer that docs tool. This guide does not claim a deployed revision or a hosted\nrole context. Use `hosted-authoring-workflow` for public help, caller-owned presence selection\nand portable payloads. `hosted-authoring-guidance` retains planned compound stories.\n\n## Version and evidence\n\nThe response identifies its document and corpus revision. Missing connected\nserver evidence is `unknown`, not a claim of compatibility. The distribution\nreceipt and versioned proof accompanying a candidate identify the exact tested\nartifact. Historical captures retain their historical label.\n\nCompound scene setup, atomic hand-over and confidential hints retain their\nowning feature’s planned/unverified status. Native presence, payload and steering\nproofs retain their named runtime/surface limits; they do not certify a deployed\nconnector or external application. Repository working rules, Beads, local-node setup and\nCI instructions stay with repository skills; they are not installed product steps.\n","source_path":"packages/spellkave-cli/docs/persona-routes.md"},{"id":"player/workflows","title":"Observe, attempt and recover through offered gameplay tools","kind":"guide","summary":"Orient a connected actor, use offered observation and attempt tools, then recover a refusal without guessing hidden targets or broader credentials.","tags":["player","dm","workflow","observation","recovery"],"body":"# Observe, attempt and recover through offered gameplay tools\n\n## Orient\n\nBegin with the offered `spellkave_orient` tool. A connected gameplay context\nbelongs to the selected actor; reading public docs does not create or change that\ncontext. A caller without an actor can still read this guide through an adapter\nthat offers `spellkave_docs`, but gameplay availability remains a separate check.\n\n## Choose an attempt\n\n`spellkave_manipulation_context` supplies independent action and target facts.\nIts default answer is a bounded summary: open prompts, targets, participants,\nthe most relevant action rows, and `more_action_ids` naming every other\naction. Pass `action_ids` for the syntax rows of named actions;\n`detail: \"full\"` returns the whole registry (large, for programmatic readers).\nUse its actual typed target and action with `spellkave_manipulate`; those facts\nare not a promise that the attempt will be eligible. For sensing, use\n`spellkave_sense_context` and a direct `spellkave_sense` attempt. Communication\nuses `spellkave_communicate` with the current authored speech-act and target.\nInspect offered schemas for required arguments rather than inventing identifiers.\n\nAn installed CLI exposes these registry tools through its command aliases and\n`sk help <command>`. Hosted clients invoke the offered tool names directly and\nneed no shell. The CLI-specific loop is `cli/workflows`.\n\n## Recover and observe\n\nKeep revisions, opaque handles and cursors within the actor/world context that\nproduced them. If a refusal or stale handle changes the available choices, obtain\nfresh context and choose a currently disclosed attempt. Do not substitute another\nprincipal, publisher credentials or a guessed hidden target.\n\nRead returned consequences and world events before deciding the next step.\nAfter an outcome that has not arrived yet, make a suitable offered observation\ncall; an asynchronous world may have changed since the previous reply. A missing\nturn-based session does not by itself prevent exploration.\n\nA move longer than your reach becomes a journey of several ticks. Pass\n`wait_for_arrival_ms` to `spellkave_move` to wait for the arrival in the same\ncall. If the journey is still under way when the call returns, read\n`spellkave_scene` with `wait_for_arrival_ms`: it waits for the journey to end\nand answers with the scene as it is then. Re-reading the scene or the session\nstatus in a loop costs calls and learns nothing sooner.\n\n## DM and elevated-player limits\n\nA DM task lens does not grant capabilities. Role presence, NPC takeover, time\ncontrol, scene setup and private hint delivery require their owning contracts and\nhost ports. This guide describes the established observation/attempt loop, not a\nverified execution of those pending workflows. Use `hosted-authoring-guidance`\nfor their currently documented hosted prerequisites.\n\n## Proof boundary\n\nThis is package-owned workflow guidance derived from the canonical PLAYER\ncontracts. Source/schema checks prove tool names and guide distribution; they do\nnot prove a particular live actor's admission or a hosted role workflow. Public\ndocs neither read private world state nor execute the described attempts.\n\nResponse syntax may carry an optional `response_slot` in manipulation context,\nfrom the public authored `ui.response-slot=<N>` action tag. This identifies\nsyntax independently of target admission. Trace details and `speech_heard`\nevents may carry optional `response` history with `action_id`, `slot`,\n`occurrence_id` and a caller-visible `label`. A label resolves only from that\nanswered occurrence's presentation; a reused action or a newer prompt is not a\nhistory link. Missing occurrence identity or inaccessible presentation stays a\nneutral number. These MCP additions are optional and older clients ignore them.\n\nPrompt presentation may include optional `response_refs`, keyed by exact\nresponse action identity, from the occurrence's captured visible trace. A missing\nref has no description source. Refs are static authored definitions, not predicate\nresults. Action descriptors use nonempty template description text first, then\nthe authored action's world-public static description; with neither, they omit\nthe description. These are presentation facts and never certify admission.\n","source_path":"packages/spellkave-tool-player/docs/player-loop.md"},{"id":"evidence/auth-56-installed-cli","title":"Installed CLI candidate evidence — AUTH-56-01","kind":"reference","summary":"Historical partial installed-candidate capture; exact artifact, assertions, sanitized transcript and pinned text cost.","tags":["evidence","AUTH-56-01","installed-cli"],"body":"# Installed CLI candidate evidence — AUTH-56-01\n\n## Scope\n\nHistorical partial capture for the named unpublished candidate. This does not\nverify a later corpus, hosted delivery, live behavior or a public release.\nThe guide projection below is scoped to that artifact alone.\n\n## Captured commands\n\nAUTH-56-01 — verified on installed-cli-local-candidate fd23f72e8e43a722c89c8597a0fa88ea4b8a92bcace422cece83a9cb8cd95e3d.\n\nTest: packages/spellkave-cli/scripts/prove-portable.mjs; implementation: artifact-sha256:fd23f72e8e43a722c89c8597a0fa88ea4b8a92bcace422cece83a9cb8cd95e3d; fixture: docs-only; no world fixture; source: sha256:702b2270c5d0fdd24fd2f0e90d84a2478e43286cfce4724fe02538da79e03b87; captured: 2026-10-01T21:12:01.914Z.\n\n```json\n{\"argv\":[\"docs\",\"--query\",\"container loot\"],\"exit_code\":0}\n```\n\n```json\n{\"argv\":[\"docs\",\"patterns/container-with-loot\",\"--full\"],\"exit_code\":0}\n```\n\n```json\n{\"argv\":[\"docs\",\"find-an-authoring-pattern\"],\"exit_code\":0}\n```\n\n## Historical assertions and cost\n\nThe archived capture retains the full responses. This summary records what the earlier candidate was tested against.\n\n```json\n{\n \"capture\": {\n \"scenario\": \"AUTH-56-01\",\n \"test\": \"packages/spellkave-cli/scripts/prove-portable.mjs\",\n \"state\": \"proven\",\n \"implementing_revision\": \"artifact-sha256:fd23f72e8e43a722c89c8597a0fa88ea4b8a92bcace422cece83a9cb8cd95e3d\",\n \"fixture_revision\": \"docs-only; no world fixture\",\n \"source_revision\": \"sha256:702b2270c5d0fdd24fd2f0e90d84a2478e43286cfce4724fe02538da79e03b87\",\n \"surface\": \"installed-cli-local-candidate\",\n \"surface_revision\": \"fd23f72e8e43a722c89c8597a0fa88ea4b8a92bcace422cece83a9cb8cd95e3d\",\n \"tested_at\": \"2026-10-01T21:12:01.914Z\",\n \"assertions\": [\n \"task search returns a bounded hit for the selected pattern\",\n \"pattern, focused guide, CLI-owned workflow and complete example share the installed corpus revision\",\n \"sk skill path resolves the thin installed discovery projection\",\n \"AUTH-56-02 planned hosted guidance stays planned and outside supported discovery\",\n \"unknown URL-like ID and unknown section refuse distinctly; valid-section retry succeeds\",\n \"documentation consumer leaves isolated working directory and product home unchanged\"\n ],\n \"evidence_doc\": \"evidence/auth-56-installed-cli\"\n },\n \"cost\": {\n \"calls\": 11,\n \"retries\": 1,\n \"failed_attempts\": 0,\n \"expected_refusals\": 2,\n \"elapsed_ms\": 13494.02625,\n \"request_bytes\": 655,\n \"response_bytes\": 101213,\n \"schema_bytes\": 0,\n \"token_accounting\": {\n \"package\": \"js-tiktoken\",\n \"version\": \"1.0.21\",\n \"encoding\": \"o200k_base\",\n \"request_tokens\": 189,\n \"response_tokens\": 24003,\n \"schema_tokens\": 0,\n \"basis\": \"UTF-8 JSON {argv,stdin} requests; sanitized stdout+stderr responses, per call; no CLI schema transmitted\",\n \"agent_context_tokens\": 0,\n \"model\": null\n },\n \"image_accounting\": {\n \"images\": 0,\n \"tokens\": 0\n }\n },\n \"limitations\": [\n \"local unpublished platform-specific artifact; no registry/public release proof\",\n \"no hosted delivery or live world admission proof\",\n \"public evidence-link publication remains pending\"\n ]\n}\n```\n","source_path":"packages/spellkave-cli/docs/installed-cli-evidence.md","publication":{"content_status":"historical","supported_surfaces":["cli","local-mcp"]}},{"id":"evidence/auth-56-hosted-mcp","title":"Caller MCP guidance evidence — AUTH-56-01/02","kind":"reference","summary":"Versioned native real-caller public guidance capture, independent postconditions and whole-journey cost; no deployed-service claim.","tags":["evidence","AUTH-56-01","AUTH-56-02","hosted-mcp"],"body":"# Caller MCP guidance evidence — AUTH-56-01/02\n\nVerified for the captured implementation and disposable-node surface below. The current corpus may embed this earlier capture; its response metadata identifies that distinction. This is not deployed-service or external-application acceptance.\n\nAUTH-56-01 — verified on caller-http-mcp-disposable-node sha256:c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359.\n\nTest: packages/spellkave-mcp/src/__tests__/authority-tools.live.test.ts; implementation: 4c6f4f4f14fe42811c4df0048b94fde531f002a8; fixture: sha256:2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49; source: sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99; captured: 2026-10-07T07:31:11.421Z.\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"query\":\"container loot\",\"limit\":2}}},\"exit_code\":0}\n```\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"doc\":\"patterns/container-with-loot\",\"full\":true}}},\"exit_code\":0}\n```\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"doc\":\"hosted-authoring-workflow\",\"full\":true}}},\"exit_code\":0}\n```\n\nHistorical capture summary: `spellkave_docs with {\"doc\":\"evidence/auth-56-hosted-mcp-transcript\",\"full\":true}`.\n\nAUTH-56-02 — verified on caller-http-mcp-disposable-node sha256:c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359.\n\nTest: packages/spellkave-mcp/src/__tests__/authority-tools.live.test.ts; implementation: 4c6f4f4f14fe42811c4df0048b94fde531f002a8; fixture: sha256:2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49; source: sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99; captured: 2026-10-07T07:31:11.421Z.\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"doc\":\"hosted-authoring-guidance\",\"full\":true}}},\"exit_code\":0}\n```\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"doc\":\"patterns/container-with-loot\",\"section\":\"missing\"}}},\"exit_code\":2}\n```\n\n```json\n{\"mcp_request\":{\"method\":\"tools/call\",\"params\":{\"name\":\"spellkave_docs\",\"arguments\":{\"doc\":\"patterns/container-with-loot\",\"section\":\"Problem\"}}},\"exit_code\":0}\n```\n\nHistorical capture summary: `spellkave_docs with {\"doc\":\"evidence/auth-56-hosted-mcp-transcript\",\"full\":true}`.\n\n## Historical capture summary\n\nRetrieve `evidence/auth-56-hosted-mcp-transcript` for the archived run’s identity, assertions and cost.\n\n## Independent assertions and complete captured-run cost\n\n```json\n{\n \"implementing_revision\": \"4c6f4f4f14fe42811c4df0048b94fde531f002a8\",\n \"corpus_revision\": \"sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99\",\n \"fixture_source_sha256\": \"2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49\",\n \"module_sha256\": \"c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359\",\n \"assertions\": [\n {\n \"scenario\": \"AUTH-56-01\",\n \"noAuthorityDocs\": true,\n \"presenceOnlyAuthorDocs\": true,\n \"hostedDmDocs\": true,\n \"sameCorpus\": true,\n \"privatePrincipalAndBindingAbsent\": true,\n \"untrustedWorldInstructionsAbsent\": true,\n \"noBindingOrSeatMutation\": true,\n \"noAuthorityContextDenied\": true,\n \"ownedDmContextAccepted\": true\n },\n {\n \"scenario\": \"AUTH-56-02\",\n \"plannedStoryNotVerified\": true,\n \"pathNotRead\": true,\n \"missingSectionRefused\": true,\n \"validSectionRecovery\": true,\n \"bindingsUnchanged\": true\n }\n ],\n \"cost\": {\n \"calls\": 12,\n \"retries\": 0,\n \"elapsed_ms\": 176.0142909999995,\n \"suite_elapsed_ms\": 6001,\n \"expected_refusals\": 3,\n \"request_bytes\": 1596,\n \"response_bytes\": 109857,\n \"schema_bytes\": 4857,\n \"token_accounting\": {\n \"package\": \"js-tiktoken\",\n \"version\": \"1.0.21\",\n \"encoding\": \"o200k_base\",\n \"request_tokens\": 476,\n \"response_tokens\": 27632,\n \"schema_tokens\": 1134,\n \"agent_context_tokens\": 0,\n \"model\": null\n },\n \"images\": 0,\n \"failed_attempts\": 0,\n \"basis\": \"All AUTH-56 successful-run RPC JSON frames after approved fixture/path redaction; schemas are a response subset. Publisher setup, other-owner scenarios, SDK subscriptions and HTTP headers/SSE wrapping excluded from text cost; elapsed time sums both Vitest scenario durations including independent postconditions, with suite elapsed recorded separately; earlier development attempts retained privately and not counted as consumer retries.\"\n },\n \"limitations\": [\n \"Native caller-authenticated disposable-node HTTP/stdio transport, not deployed service or live WorkOS login\",\n \"Scripted proof, no unaided human/agent discovery or numeric efficiency threshold\",\n \"Captured corpus identity predates embedding this evidence; commands/test source must be revalidated when relevant contracts change\"\n ]\n}\n```\n","source_path":"packages/spellkave-world-author/docs/evidence/auth-56-hosted-mcp.md","publication":{"content_status":"historical","supported_surfaces":["cli","local-mcp","hosted-mcp","web"]}},{"id":"evidence/auth-56-hosted-mcp-transcript","title":"Historical caller MCP capture","kind":"reference","summary":"Identity, assertions and cost for the archived AUTH-56 integration run.","tags":["evidence","AUTH-56-01","AUTH-56-02","hosted-mcp"],"body":"# Historical caller MCP capture\n\nThe archived integration run covered AUTH-56-01 and AUTH-56-02. This summary identifies that capture and records its assertions and cost.\n\n```json\n{\n \"outcome\": \"passed\",\n \"implementing_revision\": \"4c6f4f4f14fe42811c4df0048b94fde531f002a8\",\n \"corpus_revision\": \"sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99\",\n \"fixture_source_sha256\": \"2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49\",\n \"module_sha256\": \"c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359\",\n \"captures\": [\n {\n \"scenario\": \"AUTH-56-01\",\n \"test\": \"packages/spellkave-mcp/src/__tests__/authority-tools.live.test.ts\",\n \"state\": \"proven\",\n \"implementing_revision\": \"4c6f4f4f14fe42811c4df0048b94fde531f002a8\",\n \"fixture_revision\": \"sha256:2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49\",\n \"source_revision\": \"sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99\",\n \"surface\": \"caller-http-mcp-disposable-node\",\n \"surface_revision\": \"sha256:c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359\",\n \"tested_at\": \"2026-10-07T07:31:11.421Z\",\n \"assertions\": [\n \"{\\\"scenario\\\":\\\"AUTH-56-01\\\",\\\"noAuthorityDocs\\\":true,\\\"presenceOnlyAuthorDocs\\\":true,\\\"hostedDmDocs\\\":true,\\\"sameCorpus\\\":true,\\\"privatePrincipalAndBindingAbsent\\\":true,\\\"untrustedWorldInstructionsAbsent\\\":true,\\\"noBindingOrSeatMutation\\\":true,\\\"noAuthorityContextDenied\\\":true,\\\"ownedDmContextAccepted\\\":true}\"\n ],\n \"evidence_doc\": \"evidence/auth-56-hosted-mcp\"\n },\n {\n \"scenario\": \"AUTH-56-02\",\n \"test\": \"packages/spellkave-mcp/src/__tests__/authority-tools.live.test.ts\",\n \"state\": \"proven\",\n \"implementing_revision\": \"4c6f4f4f14fe42811c4df0048b94fde531f002a8\",\n \"fixture_revision\": \"sha256:2cd93be3b6758fa383927b7cdd1b2135ef47049a47f36f869331a5feacec0c49\",\n \"source_revision\": \"sha256:019754b682b4b3653bd869787e611e777bd2a03fa1f148f8a32ae421c0acae99\",\n \"surface\": \"caller-http-mcp-disposable-node\",\n \"surface_revision\": \"sha256:c74484aada7842b443ad9e3a5cae022692999af12dd6d4e50af1eb09bc662359\",\n \"tested_at\": \"2026-10-07T07:31:11.421Z\",\n \"assertions\": [\n \"{\\\"scenario\\\":\\\"AUTH-56-02\\\",\\\"plannedStoryNotVerified\\\":true,\\\"pathNotRead\\\":true,\\\"missingSectionRefused\\\":true,\\\"validSectionRecovery\\\":true,\\\"bindingsUnchanged\\\":true}\"\n ],\n \"evidence_doc\": \"evidence/auth-56-hosted-mcp\"\n }\n ],\n \"assertions\": [\n {\n \"scenario\": \"AUTH-56-01\",\n \"noAuthorityDocs\": true,\n \"presenceOnlyAuthorDocs\": true,\n \"hostedDmDocs\": true,\n \"sameCorpus\": true,\n \"privatePrincipalAndBindingAbsent\": true,\n \"untrustedWorldInstructionsAbsent\": true,\n \"noBindingOrSeatMutation\": true,\n \"noAuthorityContextDenied\": true,\n \"ownedDmContextAccepted\": true\n },\n {\n \"scenario\": \"AUTH-56-02\",\n \"plannedStoryNotVerified\": true,\n \"pathNotRead\": true,\n \"missingSectionRefused\": true,\n \"validSectionRecovery\": true,\n \"bindingsUnchanged\": true\n }\n ],\n \"cost\": {\n \"calls\": 12,\n \"retries\": 0,\n \"elapsed_ms\": 176.0142909999995,\n \"suite_elapsed_ms\": 6001,\n \"expected_refusals\": 3,\n \"request_bytes\": 1596,\n \"response_bytes\": 109857,\n \"schema_bytes\": 4857,\n \"token_accounting\": {\n \"package\": \"js-tiktoken\",\n \"version\": \"1.0.21\",\n \"encoding\": \"o200k_base\",\n \"request_tokens\": 476,\n \"response_tokens\": 27632,\n \"schema_tokens\": 1134,\n \"agent_context_tokens\": 0,\n \"model\": null\n },\n \"images\": 0,\n \"failed_attempts\": 0,\n \"basis\": \"All AUTH-56 successful-run RPC JSON frames after approved fixture/path redaction; schemas are a response subset. Publisher setup, other-owner scenarios, SDK subscriptions and HTTP headers/SSE wrapping excluded from text cost; elapsed time sums both Vitest scenario durations including independent postconditions, with suite elapsed recorded separately; earlier development attempts retained privately and not counted as consumer retries.\"\n },\n \"limitations\": [\n \"Native caller-authenticated disposable-node HTTP/stdio transport, not deployed service or live WorkOS login\",\n \"Scripted proof, no unaided human/agent discovery or numeric efficiency threshold\",\n \"Captured corpus identity predates embedding this evidence; commands/test source must be revalidated when relevant contracts change\"\n ]\n}\n```\n","source_path":"packages/spellkave-world-author/docs/evidence/auth-56-hosted-mcp-transcript.md","publication":{"content_status":"historical","supported_surfaces":["cli","local-mcp","hosted-mcp","web"]}}];
160
+
161
+ // Full prose bodies for every guide/reference doc, keyed by filename stem
162
+ // (`onramp` = README.md). `corpus.ts`'s hand-authored PROSE_DOCS supplies the
163
+ // curated id/title/kind/tags; the body always comes from here (R1 — the
164
+ // package is self-contained, no repo-checkout read needed).
165
+ // ci-allow-start(raw-sql): guide prose embedded verbatim from the docs tree; a SQL snippet in here is an example someone typed into a guide, never a subscription call
166
+ export const GENERATED_PROSE_BODIES: Record<string, string> = {
167
+ "action-economy": "# Action economy: channels, boundaries, and fiction time\n\nSpellkave meters an action in **fiction milliseconds**. A channel is an\nauthored per-round pool, not a count of named actions: an action or affordance\nchooses a channel with `spends_channel`, and its `cost_time_ms` draws time from\nthat pool.\n\n## Define a channel and its boundary\n\nDeclare the named boundary first, then the channel which refreshes on it. The\nengine fires `turn_start` and `turn_end` both for session rotation and, outside\na session, on fiction-time window rollover; other declared boundaries are\navailable to authored `FireBoundary` consequences. Either core boundary works\nas a `resets_on` target in both modes.\n\n```toml\n[[boundary_definitions]]\nid = \"turn_start\"\nbundle_id = \"mybundle\"\n\n[[economy_channel_definitions]]\nid = \"mybundle/channel/primary\"\nbundle_id = \"mybundle\"\npool_ms_per_round = 6000\nresets_on = \"turn_start\"\noff_turn_eligible = false\n```\n\n`pool_ms_per_round` is the channel's base pool. The active window belongs to\nthe actor whose boundary fired. In a timed session, rotation fires those\nboundaries. Outside a session, fiction-time window rollover refreshes an\nactor's spend; it is not necessary to manufacture a global turn just to make\ntime pass.\n\nOutside a session, crossing the window boundary is the **only** thing that\nfires `turn_end` — emptying a pool does not (the sessionless boundary driver,\nthe world API).\nAn actor may enter the next round with budget left over, which is the normal\ncase when play is not turn-based.\nThis matters when you hang a round-scoped effect off `turn_end` (a\nconcentration-style condition, say): it expires when the clock says the round\nended, never because the actor happened to spend everything. On rollover the\noutgoing window's `turn_end` fires before the incoming window's `turn_start`,\nthe same order rotation uses.\n\n## Attach a cost\n\nSet `spends_channel` on the affordance/action edge and give the action a\nfiction-ms cost:\n\n```toml\n[[affordance_templates]]\ntemplate_id = \"mybundle/affordance/strike\"\nbundle_id = \"mybundle\"\n# other required affordance fields omitted\nspends_channel = \"mybundle/channel/primary\"\n\n[[action_definitions]]\naction_id = \"mybundle/strike\"\nbundle_id = \"mybundle\"\n# other required action fields omitted\ncost_time_ms = 3000\nspends_channel = \"mybundle/channel/primary\"\n```\n\nAn action which names a channel but omits `cost_time_ms` (or gives it `0`)\nspends one full pool from that channel. This is the useful default for an\nindivisible once-per-window action. An action with no `spends_channel` is\nunmetered; it does not consume a pool or participate in the action-economy\ngate.\n\nThe channel id is an open authored id, not a closed action-class enum. Keep\nthe same id on the affordance that is selected and the action that commits it.\n\n## Modify an effective pool with a condition\n\nThe effective pool is the channel's authored `pool_ms_per_round` plus every\nactive numeric `modifier_templates` contribution that targets that channel id.\nThis keeps haste-like effects declarative: author the condition and its normal\nmodifier template, target `mybundle/channel/primary`, and expiry removes the\nmodifier when the condition ends. Do not create a second channel merely to\nrepresent a temporary bonus.\n\n## Grant one-shot extra budget with `ModifyChannel`\n\nThe condition route above is *standing* — recomputed at every gate for as long as\nthe condition holds. For a **one-shot** adjustment scoped to the acting entity's\ncurrent round window, `ModifyChannel` is a consequence-frame write. This is the\nshape an Action-Surge-like ability wants: one extra action, this round, then gone.\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/ability/second_wind_of_action\"\nordinal = 0\nframe_write = { ModifyChannel = { actor = \"Actor\", channel = \"mybundle/channel/primary\" } }\n```\n\n- `channel` must resolve to an `economy_channel_definitions` row. A typo'd id is\n flagged (MF-VAL-312) once the full bundle `depends_on` closure is present —\n `manifest validate --bundle --dep …` or a live-published world; a lone-file\n `validate` pass without that closure trusts an unresolved channel id rather\n than rejecting it, mirroring `ModifyResource`'s own scoped-reference posture.\n- `delta_source` is optional. Omit it and the actor is granted exactly **one full\n `pool_ms_per_round`** of the named channel, mirroring the convention that an\n unauthored cost is a full pool. Supply it and it is an authored DSL **Int**\n expression evaluated at apply time — a constant (`\"-500\"`), a roll, or a\n `channel_pool('<id>')` read.\n- The delta is **signed**: a negative value removes budget.\n- Two grants in the same window are **additive**. On window rollover the grant is\n overwritten, never summed against the previous round — so a grant cannot leak\n into the next round (the world API).\n\n**Grants do not override suppression.** The grant adjusts the authored pool\n*first*, and active condition modifiers fold over the result *last*. A condition\nthat sets a channel to zero (`FlatSet(0)` — how an incapacitating condition is\nnormally expressed) therefore wins outright over any positive grant, while a\nplus-shaped modifier still stacks on top of the granted base. Do not author a\nnegative grant to represent \"this condition takes the action away\": a grant is\nwindow-scoped and evaporates at the next refill, whereas the modifier route is\nrecomputed at gate time and is refill-proof. See\n[condition capability grant and suppression](./repairs/condition-capability-grant-and-suppression.md).\n\nThe generated [manifest reference](./manifest-format.md) is the exact source for\nthe currently admitted write shape.\n\n## Fire a custom boundary\n\n`FireBoundary` is a consequence-frame write. It fires one declared boundary\nfor one owner, so it can refresh only that owner's matching channels, recharges,\nand boundary-driven autonomy. Use it for fiction that establishes an actual\nboundary (for example, completing a ritual phase), not as a generic reset\nbutton:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/ritual/complete\"\nordinal = 0\nframe_write = { FireBoundary = { boundary_id = \"mybundle/ritual_phase_end\", scope = \"Actor\" } }\n```\n\nThe `boundary_id` must resolve to `boundary_definitions`. `scope = \"Actor\"`\nfires for the acting owner; use the schema-defined scope deliberately rather\nthan treating a boundary as a world-wide reset. The generated\n[manifest reference](./manifest-format.md) is the exact source for the\ncurrently admitted write shape.\n\n## Boundary-relative expiry and autonomy\n\nBoundary-relative condition expiry is available on an `ApplyStatus` frame\nwrite. Set `expires_at_boundary` to a `boundary_id` and an `owner_actor`,\nmeaning “end when this owner's named boundary next fires.” The owner is a\nsingle-actor frame binding such as `Actor` or `TargetActor`; it is resolved\nwhen the condition is applied.\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/stance/apply\"\nordinal = 0\nframe_write = { ApplyStatus = { target_kind = \"entity\", target_ref = \"Actor\", condition_definition_id = \"mybundle/guarded\", expires_at_boundary = { boundary_id = \"turn_start\", owner_actor = \"Actor\" } } }\n```\n\nThe expiry is armed for that owner only. It is removed when that owner's\nboundary fires through session rotation, out-of-session round-window rollover,\nor an authored `FireBoundary`; another actor's boundary cannot expire it.\nTick-absolute `expires_at_tick` remains available and can compose with this\nmode. Do not use the retired `condition.lifecycle` field.\n\nAutonomy already has two mutually exclusive firing modes in an\n`autonomy_jobs` row:\n\n- Absolute fiction time: set `next_fire_at_ms` and a positive `frequency_ms`.\n- Owner boundary: set `fire_at_boundary` and `owner_actor`; do not also set\n `next_fire_at_ms`.\n\nThe boundary mode is actor-owned just like a channel refresh. A different\nactor's turn, window rollover, or explicit `FireBoundary` cannot make an\nowner's job fire.\n\n## Observe the result\n\nFor the acting PLAYER, `spellkave_self_states` with `kind: \"economy_budget\"`\nreads the current actor-scoped channel budget, including active condition\nmodifiers and window-local grants. Use this projection to decide whether a\npriced action is currently affordable. Spend history alone cannot reconstruct\nthe effective pool after a grant, suppression, or window refresh. The server\nstill evaluates the action at dispatch; a prior read does not reserve budget.\n\nThe projection uses the condition evaluator's current facts, including gate\npredicates, rather than a separate client-side approximation. No additional\nauthored rows are needed to expose an actor's existing channel definitions,\ngrants and spends through this PLAYER read.\n\n`spellkave turn inspect <actor>` shows the live channel-spend state and\n`spellkave events` shows the surrounding world events. The typed operational\nvocabulary is `ChannelSpend`, `ChannelWindowRefresh`, and `BoundaryFired`:\nthe first records time drawn from a channel, the second records its refreshed\nwindow, and the third identifies the boundary, owner, and source that caused\nthe refresh. Use `spellkave doctor` to detect unresolved channel references or\nmalformed recharge state. The client does not reconstruct a past effective\npool from the current condition snapshot.\n",
168
+ "actor-identity-bindings": "# Actor Identity Bindings\n\n`[[actor_identities]]` binds a SpacetimeDB login identity to an authored actor.\nUse a literal identity string when the principal is known ahead of time. Use\n`identity = \"$sender\"` when a fixture should bind the actor to the identity that\napplies the manifest; the server resolves it before the scheduled manifest\ndrain commits rows.\n\n**Driving and steering use different authority.** A primary or summoner\nbinding supplies direct control; `connectedActorId` and a capability row do\nnot create that binding. The four Layer-2 verbs and the current actor's\nSessionMove/compound-intent entries also admit an owned presence carrying\n`frontier.impersonate` over both the place and existing body. A presence body\ncannot be steered. For any Person-bound target, its primary owner first offers\ncontrol to the exact DM login; a `co-pilot` row grants consent without direct\ncontrol, sight or character selection. See [DM control](../dm-oversight.md#steering-and-held-npc-control).\n\n**Provenance is separate from connection lifetime.** New runtime claims are\n`Person` regardless of issuer and require a free body tagged\n`srd.player_character`; otherwise they refuse `claim_not_offered`. An\nidempotent re-claim preserves an existing Service row. Manifest bindings\ndefault to `provenance = \"service\"`; author human logins explicitly as\n`provenance = \"person\"`. Operator binding defaults to Person. A merge can\npromote Service to Person but cannot demote Person (ADR-0146 D-5). Offline\n`MF-VAL-376` rejects other values; `MF-VAL-377` rejects authored co-pilots on\nany Person row. A manifest co-pilot needs a durable authored Service primary;\nlive commit checks ownership when that primary is absent from the document.\nAn authored co-pilot cannot replace an existing direct identity row.\n\nA host-signed runtime claim remains connection-scoped; a trusted IdP claim,\nmanifest/operator binding, copied binding or spawn summoner has no connection\nattached. `r_assign_driver` also writes a durable Service primary. Passive\ndisconnect removes connection-scoped claims and cascades their co-pilots;\nprimary release/revoke/reassign also removes consent. Removing issuer trust\nstops new durable claims and does not release existing ones. Explicit\n`r_release_actor` releases the caller's ordinary bindings; Service mutations\nrequire the generation observed with the decision and refuse during a hold.\nThe lifetime rules are proved by `actor::claim`/`actor::release` tests and\n`client/tests/claim_admission.rs`; they do not depend on provenance alone.\n\n`spellkave actor inspect <actor_id>` and identity inspection include provenance and\n`assigned_by`. `spellkave actor control list|transitions|work|audit|events`\nuses authorized private observations. The doctor reports\n`co_pilot_without_primary`, `person_binding_on_unoffered_body` (durable Person\nprimary without an offer), `orphaned_drive_assignment`, and as a warning\n`person_on_service_only_audience_body` (a person identity controls a body that\nholds a [service-only audience](../metadata-attachments.md#audience)\ncapability, and reads nothing through it); it diagnoses and\ndoes not revoke rows. Whole-world identity checks report unverified when the\ncaller cannot read the needed private rows. Tests in\n`client/src/doctor/actor_control_tests.rs` distinguish those failures from a\nhealthy empty result.\n\n**`actor.has_item(...)` works inside an action predicate (`r_manipulate`) —\nsince sk-vjh.7.** `manipulation_facts`\n(the world API)\nbuilds the DSL `items` fact pool from the items the acting body directly\ncarries (`entity_containment.container_id == body`, equipped or loose), so a\npossession gate on a self-eligible or targeted action reads true at offer\n(materialiser) and act time. Proof anchor: the unit test\n`manipulation_facts_expose_carried_items_to_has_item` in that file. Before\nsk-vjh.7 the pool was empty outside `r_move`'s edge traversal, the clause was\ndead weight in any `&&` chain, and a `dead-manipulate-has-item` lint rule\nwarned about it; both the gotcha and the rule are retired — see\n[`has-item-dead-in-manipulate`](./has-item-dead-in-manipulate.md).\n\n**Gotcha — a self-eligible REACTION needs a `ModifyResource` write\n(narrowed 2026-08-01, PR #2079).** The validator (`MF-VAL-263`) rejects a\n`self_eligible = true` action_definition that carries reaction wiring\n(`reaction_eligibility`/`reaction_trigger`) whose `on_success` consequence\nhas no `ModifyResource` frame_write budget resource — the depleting budget\nis the only terminator against an unbounded free self-triggered reaction\nloop (ADR-0050). Add a second frame_write bumping a dedicated resource by 1\n(Klarg's `klarg_wriggle_free` → `klarg_allies_down`/`klarg_fled` is the\ncanonical precedent). A PLAIN self-targeted action with no reaction wiring\nis exempt since PR #2079 — a genuinely free self action (`ApplyStatus`-only,\nthe SRD Dropping Prone shape) now validates; see\n[`self-eligible-reaction-budget.md`](self-eligible-reaction-budget.md).\n\n**Gotcha — gate an ALREADY-EXISTING edge (including a Foundry-generated one)\nby adding a SECOND `place_edge_affordance` row on the same `edge_key`, not a\nnew node.** RH1/RH6 established the AND-chain (two rows sharing one\n`mode_id` on one `edge_key` both must pass — every row this gotcha touches\ncarries the implicit default `mode_id = \"\"`, so plain \"two rows on one\n`edge_key`\" is the same claim here; a row under a *different* `mode_id`\nwould instead be an alternative the edge OR's against, ADR-0101\nmovement-defaults-modes-terrain-cost); TT3 confirms it works identically on\na `#1696`-imported generated edge, not just a hand-authored bundle edge — no\nneed to touch the generated scene file or invent an intermediate node.\nAuthor a custom\n`affordance_template` (`niche_id = \"core/passable_portal\"`,\n`capability_id = \"core/walk\"`, predicate reading your own resource flag,\n`outcome_template_id = \"core/move_outcome\"`), then a `[[place_edge_affordance]]`\nrow pointing at the target direction's existing `edge_key` only — leave the\nreverse-direction `edge_key` untouched so exiting never re-triggers the gate\n(P6/RH1 precedent).\n\n**Gotcha — NPC monster defs lack `core/walk`.** An entity built from an\n`srd/monster/*` def cannot traverse place edges until you explicitly grant\n`[[actor_capabilities]] capability_id = \"core/walk\"` — without it, every\n`r_move` on that actor rejects `predicate_no_longer_holds` on the traversal\naffordance. This is affordance discipline (walk-capable actors prove\nwalkability), not a graph bug.\n\n**Gotcha — attacking a target claim-locks it, but a declared `self_only` action\non that SAME entity bypasses the target claim.** `r_manipulate` defaults to\n`SteeringClaimDecision::ClaimRequired` for any manipulate whose consequence\nisn't classified as `NonSteering` (`r_apply_consequence/steering_claim.rs`);\n`srd/attack/melee`'s generic outcome (HP `ModifyResource` + a conditional\ndeath `ApplyStatus`) does NOT classify as non-steering, so every hero attack\nagainst an NPC acquires/renews a `core/condition/controlled` claim-lock on\nit ([claims][claims], Item 20; TTL 10 ticks, renewed on each hit). No prior\ncombat beat needed the SAME entity to act on itself moments later. Since #2411,\nan action authored with `self_only = true` skips target-claim acquisition, so\nthe carrier can use a self-heal or another genuinely self-only verb while the\nattacker's claim remains intact. `self_eligible` alone is not this assertion:\nif another actor may also target the verb, its steering-shaped attempts still\nobey normal claim contention. Do not release an attacker's claim merely to let\nthe target use an authored `self_only` action; a rejection there is a runtime\nregression.\n\n**Gotcha — a carried item's manipulate target can fail with \"no reachable\nspatial location\", not just `out_of_range`.** A hand-built `entity:<id>` ref\nto an item the actor has picked up resolves through `entity_place_node_id`,\nwhich reads only `entity_location` — a carried item has no such row left\n(replaced by `entity_containment`) — and rejects with\n`\"r_manipulate: target entity <id> has no reachable spatial location\"`\n(the world API) — a plain\nresolution failure, not the range check that produces `out_of_range`.\nDon't assume one error string is exhaustive when grepping for this\ngotcha. Read the real `target_ref` from the caller-scoped manipulation\ncontext (`spellkave manipulation-context targets <perceiver_entity_id>`, or\n`readManipulationContext(db, perceiverEntityId).targets` in\n`@spellkave/sdk`) instead of hand-rolling `entity:<id>` for any target that\nmight already be carried; see\n[`manipulate-ref-niche-attachment`](./manipulate-ref-niche-attachment.md).\n\n**Gotcha — `srd/niche/strikeable_target` is per-node opt-in, not global.**\nAuthoring a `capability_id`-gated affordance on that niche (a monster\nattack, a breath weapon) is not enough by itself: without an explicit\n`[[spatial_niche_attachments]] niche_id = \"srd/niche/strikeable_target\"`\nrow at the node, every attempt rejects `precondition_failed\n(attachment_presence): no spatial_niche_attachment for niche\n'srd/niche/strikeable_target' at 'place_node:<id>'`. Every combat node\ncarries this row today (P5/cragmaw_castle/wave_echo_cave/RH2) — a NEW\ncombat node needs its own (TT4's `old_tower_interior`).\n\n**Gotcha — a `strikeable_target` affordance can silently pick the WRONG\nco-located-elsewhere target.** The niche materializes one affordance\ninstance per eligible target within `range_m` — if `range_m` is generous\n(30m+) it can reach a strikeable actor at an ENTIRELY DIFFERENT node\nwhose real-world Foundry pixel coordinates happen to sit nearby (TT4 hit\nthis: a `range_m = 30.0` breath weapon at `old_tower_interior` selected a\nTT1 zombie sitting at `thundertree/brown_horse`). A \"first match\" target\nlookup (the retired `readAffordances(...).find(a => a.action_id ===\nactionId)` shape, fine for a capability-only self-affordance, e.g. R1's\nRotting Gaze) is NOT safe here — construct the target ref directly from the\nKNOWN target's resolved entity id (`entity:${targetEntityId}`, TT3's\n`fightUntilDown` precedent) instead of trusting list ordering, and keep `range_m` tight\n(5-20 ft) unless the mechanic genuinely needs reach.\n\n**Gotcha — `recharges_on` alone does not gate re-use; it also needs\n`spends_channel`** (the field formerly named `consumes_action_class`;\nthe world API). An\n`affordance_templates` row with `recharges_on = \"turn_start\"` but an empty\n`spends_channel` lets every subsequent attempt succeed immediately — the\nbudget gate returns early on an empty channel before it ever writes a\nrecharge row, so no `action_recharging` rejection fires\n(the world API,\n`check`/`consume`). Pair `recharges_on` with a real channel (e.g.\n`spends_channel = \"srd/economy_channel/primary\"` in srd-cc) on the SAME\nrow; the two fields together are the load-bearing pair, not either alone.\n\n**Gotcha — item presence at a node is `entity_location`, not\n`actors_here`.** `readLocationSnapshot(...).actors_here` lists ACTORS only\n(actor_spatial_locations); a pickupable item (a chest, a dropped weapon)\nnever appears there even when correctly placed via `place_node_id` on its\n`[[entities]]` row. Check item presence with `entity_location` directly\n(`entityLocationNodeId(db, itemEntityId) === nodeId`, TT3's pattern) —\n`actors_here` will read as \"missing\" and mislead you into re-authoring\nplacement that was already correct.\n\n**Gotcha — a new `base/*.toml` file is invisible until it's in\n`manifest.toml`'s `[[include]]` list.** Scaffolding\n`world-fixtures/phandelver/base/<beat>.toml` does not wire it into the\nbundle; `just seed` silently seeds everything ELSE and the new content\nnever applies (no error — the file is just never read). Add an\n`[[include]] path = \"base/<beat>.toml\"` entry in the right dependency\nposition (after any file whose place_graph/resource/entity_def it reuses)\nin the SAME commit as the content.\n\n**Gotcha — the per-node opt-in above (`srd/niche/strikeable_target`) applies\nto EVERY `capability:<your_capability_id>`-keyed niche, not just the SRD\ncombat one.** A custom self-eligible or targeted capability (a flee act, a\nwarn-run, a posture-read) needs its own `[[spatial_niche_attachments]]\nniche_id = \"capability:<your_capability_id>\"` row at the node where it\nshould be offered, exactly like the SRD niche — CC2 hit this THREE separate\ntimes (a flee capability, a warn-run capability, and again for an NPC's\nranged-attack TARGET standing at a node that had never opted into\n`strikeable_target`) before generalizing the rule. Missing this rejects\n`precondition_failed (attachment_presence)`, not a capability/predicate\nerror, so double-check attachments before debugging the predicate.\n\n**Gotcha — normal birth state belongs on the definition; proof-only state\nbelongs on the proof instance.** The Phandelver hero's sourced HP 13 is an\n`entity_definition_initial_state`, so every ordinary instance starts healthy.\nI2 needs a visible healing-potion delta, so its assigned island authors an\nexplicit per-instance `object_state` HP 3 override. Do not change a shared\ndefinition baseline to satisfy one scenario, and do not reset it procedurally\nafter seed: author the exceptional instance state in that scenario's manifest.\n\n**Gotcha — a GROUNDED item's own niche (a bespoke pickup gate, e.g. a\nniche predicate on `target.has_niche(\"your.item.tag\")`) needs an explicit\n`[[spatial_niche_attachments]]` row at the hosting node too, exactly like\nthe capability-keyed gotcha above — it is NOT automatic just because the\nitem entity's `place_node_id` is set there.** WE8 hit this live: a\n`take_relic` affordance scoped to a custom guarded-item niche rejected with\n`precondition_failed (attachment_presence): no spatial_niche_attachment for\nniche '...' at 'place_node:...'` until the attachment row was added,\nidentical in shape to `core/pickup_cursed_chest`'s own wiring\n(`core/base/affordances.toml`) which DOES carry one. Contrast: a niche\nscoped to an item the actor already CARRIES/WIELDS (RH5's `equip_talon`,\nits own `phandelver/item/talon` niche) needs no spatial attachment at\nall — the rule is about NODE-SCOPED discovery of a grounded item, not\nabout item niches in general.\n\n**Gotcha — `cost_time_ms > 5_000` (`T_THRESHOLD_MS`,\nthe world API) promotes a flat action into\nthe authored `core/long_running_action` session.** Promotion now works\nend-to-end, and the validator warns at the strict threshold so authors can\nsee the resolved session target before apply. Use a long cost when the action\nis deliberately meant to occupy its actor, advance in fiction time, and\ncomplete through a session. For flavor-only duration on an otherwise ordinary\nflat action, keep `cost_time_ms` at flat-action scale (hundreds to low\nthousands of ms) and narrate the longer duration in\n`display_name`/description text instead.\n\n**Playable seats come from the authored tag `srd.player_character`, not from\na kind or a Rust enum (sk-pka5.4, ADR-0102 D-2).** The public `seat` table\nlists every actor whose current body carries that tag (on the entity or its\ndefinition): `actor_id`, `entity_id`, `name`, `embodied`, `claimed` — never the\noccupant identity. It is re-materialised on manifest commit, claim, release,\nbind, body swap and despawn (`sync_seat`). A trusted-IdP claim keeps\n`claimed = true` across disconnect; a host-signed claim does not. To offer an actor to players, tag its body (or\nits `entity_definition_tag`) with `srd.player_character`; NPCs without the tag\nnever appear and a new runtime claim refuses `claim_not_offered`. Hosting such\nan NPC needs publisher provisioning or the separately scoped drive writer; the\nplayable tag also grants SRD capabilities, so do not add it merely to bind a host. Read it with `spellkave seat list` (JSONL `seat` lines) or\n`readSeats` in `@spellkave/sdk`; the doctor check `seat_catalog_readable`\nproves the view is reachable. A seeded Elven-Mini currently offers only the\nCreation Candidate — the pregen Renn body in `reference/` is not seeded.\n\n[claims]: ../data-model-concepts/claims.md\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
169
+ "actor-stat-self-only": "# `actor.stat(...)` and a self-eligible `ModifyResource`'s `TargetActor` only ever read/write the ACTING entity's own row — never a third party\n\n**Gotcha — there is no cross-actor resource read/write shape.** In an\naffordance predicate, `actor.stat(\"your/pool\")` reads only the row belonging\nto the entity EVALUATING that affordance (the one about to perform the\naction) — never some other entity's row, even one co-located or targeted in\nthe same session. Symmetrically, a self-eligible action's `ModifyResource {\nactor = \"TargetActor\", ... }` writes only the ACTING entity's own row,\nbecause for a self-eligible action `actor == target` by definition. WT1\n(`wt1-wyvern-tor.toml`) hit both halves of this in the same beat: four\nbugbears' own self-eligible flee actions could not bump a resource meant to\nbe read off the HERO later (the write landed on each bugbear's own row,\ninvisible to `hero.stat(...)`), and a follow-up hero action gated on\n`actor.stat(\"wt1_bugbear_fled\") >= 1` silently rejected every time because\nthe hero's own row for that resource was never seeded/written by anyone —\nonly the bugbears' rows existed. **The fix, same shape both times: route the\nwrite through an action performed BY the entity whose row you need to land\non.** A cross-actor \"did X happen to some other entity\" signal cannot be\nexpressed as a predicate read; either have the entity that needs to expose\nthe fact write its own flag via its own action, or (P5/WT1's precedent) drop\nthe predicate gate to `predicate_bool = true` and let the walkthrough/caller\ndrive the timing — the same simplification `phandelver/flee_confrontation`\n(P5) already documents for morale.\n\n**Gotcha — for a `self_eligible = false` (targeted) action, `ModifyResource`'s\n`actor = \"Actor\"` vs `actor = \"TargetActor\"` are NOT interchangeable —\n`\"Actor\"` is the caller, `\"TargetActor\"` is the entity being manipulated.**\nThe self-eligible case above collapses this distinction (actor == target by\ndefinition), which makes it easy to copy a self-eligible action's `actor =\n\"TargetActor\"` convention into a NEW targeted action without noticing it now\nmeans something different. WE7's `grab_chest_defended` (hero manipulates the\nwraith Mormesk; self_eligible = false) first shipped both frame-writes —\nthe hero's own HP-drain damage and a hero-owned attempt counter — as `actor =\n\"TargetActor\"`; both silently landed on MORMESK's rows instead of the\nhero's, so the hero's `srd/hp` never dropped and the walkthrough's own\nattempt-counter assertion failed (caught live, not by inspection). Fix: any\nframe-write meant to affect the ACTING entity on a targeted action must say\n`actor = \"Actor\"`; `\"TargetActor\"` there deliberately means \"the other\nentity\" (WE6's `loot_leader_pouch` already used `\"Actor\"` correctly for this\nexact shape — the bug was in copying the wrong precedent, not a substrate\ngap).\n\n**Gotcha — inside a `ModifyResource.delta_source` formula, `target.*` is the\nMODIFIED entity (whichever actor THIS write's own `actor` field binds), never\nthe manipulation's other party.** This is easy to confuse with the same\n`target.*` syntax in a PREDICATE, where it genuinely does mean \"the entity\nthis action targets\" — the two contexts bind the word differently. `dm/\napply-level-up` (`packages/spellkave-adventure-runtime/src/dm/level-up/render.ts`,\nsk-tyhy) shipped `modifyResourceWrite({ actor: \"Actor\", ... deltaSource:\n\"target.stat('srd/level') - actor.stat('dm/aldwin/level-up-applied')\" })` —\na MANIPULATE action, Aldwin (`actor: \"Actor\"`) writing his own latch, trying\nto read the hero's (the manipulation target's) level to compute the delta.\nThe action's own predicate, `target.stat('srd/level') > actor.stat(...)`,\nresolved fine and the affordance was genuinely offered — but every dispatch\nwas rejected by the kernel (the `delta_source` evaluation in\nthe world API)\nwith `ModifyResource: delta_source\n'...' failed to evaluate: UnknownField { subject: Target, field_id:\n\"srd/level\" }`: `Target` never binds here, because this write's own subject\nis `\"Actor\"`, so there is no OTHER entity to be `target.*` inside it. **Fix:\nan `Actor`-scoped write cannot read the manipulation's other party at all —\nrestructure.** Two shapes that work: (1) a CONSTANT delta guarded by a\npredicate that already establishes the invariant you need (this fix's own\nchoice — the predicate already guarantees the hero is exactly one level\nahead of the latch on every dispatch, so `deltaSource: \"1\"` advances the\nlatch correctly, one ceremony per level gained, without ever needing to read\nthe hero's value inside the write); or (2) a `TargetActor`-scoped write,\nwhere `target.*` legitimately means the SAME entity the write modifies (see\nthe self-eligible gotcha above) — usable only when the value you need to\nwrite already lives on the target's own row.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
170
+ "adjacent-moves-ungated": "# Gotcha — `adjacentMoves()` lists raw graph geometry, not gated traversability; to prove an edge now rejects, attempt `.move()` and check the status\n\n`listAdjacentMoves` (`packages/spellkave-sdk/src/core/movement.ts`) iterates\n`place_edges` only — it performs ZERO affordance-predicate evaluation\n(`packages/spellkave-sdk/CLAUDE.md` §1/§4: the SDK is forbidden from\nre-implementing server-side runtime validation). An edge whose traversal\naffordance is gated shut (e.g. a trap that closes a room, WE10's statue\ntrap) still appears in `adjacentMoves()` — the `edge_key` geometrically\nexists; only its `place_edge_affordance` predicate is false. Asserting\npersistence of a closed gate by checking absence from `adjacentMoves()`\nis a false negative that will never fail even when the gate is genuinely\nbroken. Assert the real thing instead: call `.move(edge.edge_id)` and\ncheck `result.status === \"rejected\"`.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
171
+ "affordance-needs-niche-attachment": "# An affordance `niche_id` needs a `spatial_niche_attachment` only when its niche is place-provided — pick the niche's `provider` deliberately\n\n**Symptom — a granted capability yields no affordance at the actor's node.**\nGranting a capability via `actor_capabilities` does not, by itself, make an\naffordance derivable. The `capability:<id>` prefix some `niche_id` values use\nis a naming convention; nothing in the kernel matches on the `\"capability:\"`\nstring. What decides admission is the niche's `niche_definitions.provider`,\nwhich resolves to a `niche_provider_definition` row whose flags both the\nperceive side and the act side read\n(the world API;\nact-side branch in the world API,\nthe `resolve_niche_provider_flags` call before the attachment lookup).\n\nThe three seeded providers:\n\n- **`place`** (also what an empty `provider`, or a niche with no\n `niche_definitions` row, falls back to) — the niche exists only where a\n `spatial_niche_attachment` binds it to the node the perceiving actor\n occupies. This is where the original symptom comes from: no attachment at\n the actor's node, no affordance, and the act fails with\n `r_manipulate: precondition failed (element=attachment_presence): no spatial_niche_attachment for niche '…'`.\n The `self_eligible = true` flag does not change this.\n- **`entity`** — a candidate entity affords the niche through its own\n authored tags/state satisfying the niche predicate; no attachment row.\n Live example: `srd.advancement_trainer` in\n `packages/spellkave-srd-cc/fixtures/base/character-creation/advancement.toml`.\n- **`actor`** — the actor's own capability carries the verb everywhere; no\n attachment row is consulted (the act records\n `precondition:attachment_skipped:actor_provided`). Live example: the\n `capability:srd/class-feature/fighter/second-wind` `[[niche_definitions]]`\n row with `provider = \"actor\"` in\n `packages/spellkave-srd-cc/fixtures/base/classes/fighter.toml` (~line 1293).\n\n**Repair.** For a mount/buff/ability meant to work \"from anywhere\", author the\nniche with `provider = \"actor\"` (carrier-bound verbs) or `provider = \"entity\"`\n(target-provided verbs) instead of attaching it at every node. Keep `place`\n(with attachments) only when you actually mean room-scoping. A\n`capability:*` niche must name its provider explicitly — the world-author\npre-flight rejects the miss as `WA-CAP-002`; see\n[`running-an-authored-act`](../running-an-authored-act.md#anchoring-depends-on-the-niches-provider-changed-by-actor-carried-verbs).\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
172
+ "apply-status-claim-lock": "# Any consequence containing `ApplyStatus` acquires a 10-tick claim-lock on its target — a second actor's manipulate against that same target can hit `claim_contended`\n\n`r_manipulate` classifies a resolved action's consequence as *steering-shaped*\nwhenever any of its frame writes is `ApplyStatus`, `RemoveCondition`,\n`InsertModifier`, or an item-manipulation op — `ModifyResource { actor:\n\"TargetActor\" }` alone is the only thing that stays non-steering\n(`steering_claim.rs`). A steering-shaped consequence makes the ACTING actor\nacquire a `core/condition/controlled` claim-lock (`controlled_by:<actor\nentity id>`, 10-tick TTL) on its TARGET as a side effect — this has been true\nof every lethal attack since #1508 (the ordinal-1 `ApplyStatus` write), not\nsomething a new beat introduces. In normal (unpaused) play the claim expires\nnaturally between actions; anything that pauses world ticks (the SDK's\n`pauseWorldTicks()`) freezes the world clock, so the claim never expires on\nits own. (The original worked example was the walkthrough helper\n`prepareDeterministicBeat()`, which unconditionally paused ticks; it now\nexists only under `archive/apps/world-walkthrough/` — the mechanism is\nunchanged.) Concretely: actor A attacks actor B\n(B now claimed by A). A later action authored with `self_only = true` lets B\nact on themself without acquiring or contending on that target claim; A's claim\nremains unchanged. A steering-shaped manipulation from any OTHER actor still\ncontends normally. Release a claim only when its steering relationship is\nactually over, not as setup for a self-only verb. Diagnose genuine contention\nvia `evaluation_provenance.failure_kind = \"claim_contended\"`\n(`just sql \"SELECT * FROM evaluation_provenance\"`), not by staring at the\npredicate — the affordance itself is fine.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
173
+ "authoring-observability": "# Observability\n\nObserver knowledge is the canonical read surface for fog-of-war style\ncontent gates. Modders do not author `observer_knowledge` or\n`observer_place_knowledge` rows directly; reducers populate them when a\nbody perceives an entity or place. Predicate and reducer logic should\nread those tables when content depends on what an observer has already\nseen.\n\nBoth tables are body-keyed. `observer_entity_id` points at\n`entity.entity_id`, not an actor identity, so possession-style body\nswaps use the body's memory rather than merging memories into the\nsteering identity. The SDK reader is `readObserverKnowledge`\n(`packages/spellkave-sdk/src/core/readers/observer_knowledge.ts`). The former\nworked concept tour was retired with `apps/world-walkthrough` (2026-08-11) and\nsurvives only at `archive/apps/world-walkthrough/out/observer-knowledge.md`.\n\n**Manifest-time knowledge is primarily co-location-shaped — and it is\nindiscriminate.** There is no explicit \"seed actor X knows entity Y\"\nrow: an actor learns an entity by being co-located with it (an\nNPC placed at the same `place_node_id` as a lead item seed-learns that\nlead). The catch: co-location learning applies to *every* body that\nenters the node, so a lead you place in a room to seed an NPC's\nknowledge is also learned **for free** by any hero who later walks in —\nbefore any share/parley act runs. This makes a `CopyKnowledgeRow`\ntransfer act a no-op and collapses a \"the intel was absent until they\ntold me\" negative control. If a rescued/parleyed NPC must be the\n*exclusive* source of some intel, prefer a plain `[[object_state]]`\nflag written by their share act (gated on the act's precondition) over a\n`knows_entity` row — the flag has no co-location back-channel. Reach for\na real `knows_entity` row only when the knowledge subject can live at a\nnode the receiving actor never co-locates with.\n\n**A gated affordance still appears in topology/candidate lists — only\nthe attempt is refused.** A `knows_entity` (or any other predicate)\ngate on a `[[place_edge_affordance]]` or niche-attached affordance does\nnot remove the edge/target from what the client sees (`adjacentMoves()`, the\nmanipulation context's disclosed targets — the old per-actor affordance\ncache behind `readAffordances()` is retired); the server evaluates the predicate when the\nactor actually attempts the move/manipulate, and rejects with a\nnon-`success` status if it fails. When proving a knowledge gate is not\nvacuous, assert on the *attempt's* outcome, not on absence from the\nlisting — asserting the edge/affordance is missing from an ignorant\nactor's list will incorrectly fail even when the gate works correctly.\nTo diagnose *why* an attempt failed, take `provenance_id` from the act\nreceipt and query `spellkave_self_states` with `kind=evaluation` and\n`provenance_id=<id>` (or test the formula offline with `sk eval`, see\n[`rule-bench`](../rule-bench.md)) — do not query database tables directly\nwith SQL or inspect server logs.\n\n**Historical (retired 2026-08-11) — a new hero-tracked resource pool needed a\nsecond seed row, or island-suite beats saw it as permanently unset.** The\nisland-suite harness this paragraph describes (`apps/world-walkthrough`,\n`packages/world-explorer`) and the Phandelver hero it staged are retired; the\npaths now live under `archive/apps/world-walkthrough/` and\n`archive/packages/world-explorer/`, and there is no live second list to keep\nin sync. Kept as the motivating case for the definition-level seed below.\n`[[object_state]]` pre-instantiation\nagainst `entity_key = \"phandelver/hero\"` only seeds the *canonical* single-run\nhero. The island-suite test harness (`apps/world-walkthrough`'s\n`--only <beat>` islands) instead spawns a fresh per-island party, built by\n`packages/world-explorer/src/endurance/manifest.ts`'s `partyObjectState(...)`\ncalls — a second, hand-maintained list of hero-tracked state ids. A resource\nmissing from that list reads as `UnknownField` for the party hero (ADR-0035:\nunknown reads as predicate-false, never a default), so any affordance gated on\n`actor.stat(\"your/new_pool\") < 1` never materializes for island-driven beats\neven though the canonical hero and `just validate` both look fine. Add the new\n`state_id` to both `manifest.ts`'s hero `partyObjectState` chain and its\n`toContain` assertion in `endurance.test.ts` in the same PR that authors the\npool (then-current recipe; do not follow it today).\n\n**Alternative to `partyObjectState` — a definition-level seed reaches every\nclone, not just this one harness.** `partyObjectState` only fixes the beat-island\nstaging path (`archive/packages/world-explorer/src/stage-beat-islands.ts`). A fact that must be readable by *any*\nactor spawned from a given `entity_def_id` — a traversal-gate predicate check\nlike `actor.stat('your/gate_fact') < 1`, not just a hero-tracked quest pool —\nis better seeded once via `[[entity_definition_initial_state]]` keyed on\n`entity_def_id` (not `entity_key`): every manifest-authored entity created from\nthat definition picks it up at commit time\n(the world API →\n`definition_seed::apply_definition_seeds`), including per-island party clones\n(they are manifest-authored with `entity_def_id = \"phandelver/hero\"`,\n`archive/packages/world-explorer/src/endurance/manifest.ts`), the canonical hero, and\nany future clone mechanism — with no hand-maintained TS list to keep in sync.\nNeeds a same-bundle `state_id` that resolves against **either**\n`[[object_state_definitions]]` (the TOML section is plural — not the singular\ntable name) **or** `[[resource_definitions]]` — `MF-VAL-253` accepts either\ncatalog (widened for executable finding #10,\n`packages/spellkave-srd-cc/ledger/designs/finding-10-definition-time-resource-seed.md`:\nthe runtime materializer already copied `state_id`/`value` verbatim\nregardless of which catalog it came from, so a single authored row in either\ntable is sufficient — a `resource_definitions` row no longer also needs a\nparallel `object_state_definitions` row just to pass this check). The\n`sildar/lifecycle` pair in `sildar-companion.toml` predates the widening and\nauthors both for an unrelated reason (see that file's own comment); it is not\nrequired going forward for a resource-only id. **Visibility caveat (ADR-0120):**\n`entity_definition_initial_state` has no `visibility` column of its own — the\nmaterialized `object_state` row's `VisibilityClass` falls back to `Public`\nunless the `state_id` also resolves against `[[object_state_definitions]]`,\nwhose `default_visibility` is the only authoring surface for it; a\nresource-only id has no such surface, so author a parallel\n`object_state_definitions` row when Local/Hidden visibility is wanted. An explicit per-instance\n`[[object_state]]` row for\none specific `entity_key` still supersedes the seed for that one instance\n(author-override precedence, same file) — keep both when the canonical\ninstance already has its own row; there is no conflict. LR-93 fix:\n`we10-nezznar-terminal.toml`'s `phandelver/w19_collapsed` statue-trap gate\n(this file and `sildar-companion.toml` belonged to the retired Phandelver\nbundle, deleted in `fd2288bdea`; recover via `git show`).\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
174
+ "authoring-process": "# Authoring process — the shared agent contract\n\n<!-- BLAST RADIUS: this file is the single source for the SHARED authoring\n process (#1364). Consumers reference it and carry only role deltas:\n packages/spellkave-cli/skill/SKILL.md (sk CLI surface; home of the\n query-first decision table —\n `.agents/skills/sk-author/SKILL.md`\n is a stub pointing at it, `sk skill path`)\n packages/spellkave-srd-cc/CLAUDE.md (SRD compiler: rules sources, generators)\n the adventure packages' own CLAUDE.md files (adventure-specific scope)\n Edit a shared rule HERE, once. Restating it in a consumer file\n reintroduces the copy-drift this file exists to end. -->\n\nBinding process for every agent that authors world content — the srd-cc\ngenerators (`packages/spellkave-srd-cc/src/`, which emit\n`packages/spellkave-srd-cc/fixtures/`), `packages/spellkave-mechanics`, and the\nadventure packages (`packages/spellkave-adventure-<slug>/`). Role-specific\nscope, sources of truth, and proof targets live in the owning package's docs;\neverything below applies to all of them.\n\n## Step 0 — look up the pattern catalog, then does it already exist?\n\n**(MANDATORY before any authoring or gap filing.)**\n\n1. **Problem-indexed patterns first.** Open\n [`patterns/index.md`](./patterns/index.md) and find the problem you are\n solving (extra action this round, lingering hazard, kill XP, dialog slots,\n …). Try the documented composition before filing a `findingGap`, backlog\n item, or substrate verdict. Action Surge was filed three times as a kernel\n gap although [`action-economy.md`](./action-economy.md) §ModifyChannel\n already solved it — that miss is what the catalog exists to prevent.\n2. **Then** look for an existing identity before re-authoring one.\n\nNever author an identity you have not first looked for. Re-authoring an\nexisting identity wastes a full authoring round-trip at best; at worst it\nlands twin identities that the linter flags only as advisory smells and seed\nresolves by collision (catalog **R2**/**R3**).\n\n```bash\nsk docs --query \"<concept>\" # scored pointers: docs, examples, shapes\nsk docs patterns # problem → pattern catalog\ngrep -rn \"<slug-or-name>\" <owning-package>/fixtures/ # the owning bundle's rows\n```\n\n**Found → extend, grant, or reference it — never re-author.** Worked trace:\nasked for \"a fear spell\", the wrong move is to author one — `srd/spell/fear`\nalready exists (`packages/spellkave-srd-cc/fixtures/base/spells/level-3/fear.toml`)\nand one `sk docs --query` / grep finds it; the correct move\nis a capability grant or an extension of the existing identity. Not found →\nproceed, and place the row in the right layer (catalog **C1**/**S3**).\n\n## Query first, prose second\n\nThe compact machine surfaces answer most authoring questions in far fewer\nbytes than the prose files, several of which run to hundreds of lines. The decision table\nmapping each question class to its command lives at the top of\n[`packages/spellkave-cli/skill/SKILL.md`](../../spellkave-cli/skill/SKILL.md)\n— the packaged `sk` skill (`sk skill path` prints its own location;\n`.agents/skills/sk-author/SKILL.md` is a stub pointing at it, #1367)\n— consult it before opening any prose file in this directory. Prose reads\nare the documented fallback for questions the queries cannot resolve, never\nthe default.\n\n## Authoring pipeline — the ONLY legal way to write\n\n- Author through the **`@spellkave/world-author` render path**\n (`patchManifest` / `renderSchemaManifestJson` + `validateManifestToml`) or\n the AUTHOR verbs that write through it (`sk define_*`, `sk write_rows`, …).\n **NEVER hand-edit TOML past the validator.** A validator rejection is a\n FINDING, not a license to force bytes (ADR-0021/0025). No granular-reducer\n side doors.\n- Confirm row shapes with `sk query --schema --kind <row_kind>` before\n editing a driver or writing schema JSON.\n- **Surface ownership is ruled by ADR-0072** (`specifications/adr/0072-…`):\n behavior-chain **composition** (capability→outcome→affordance→action→\n consequence→frame-writes) belongs to the world-author **composition layer**\n (`ActorBehavior` / `authorBehaviorFragment`; promoted per #1526 into\n `src/compose.ts` in this package; the old `scripts/srd/behavior-cluster.ts`\n home and its re-export shim were retired with the `spellkave-srd` package).\n Queries, inspection, validation, and **mechanical one-row edits** belong to\n the `sk` CLI (`sk patch` ops). The CLI never grows behavior-chain\n composition, and a new `author-*.ts` driver file must cite ADR-0072 (D-3,\n a review rule, not a CI gate) — add data entries to an existing driver, or\n a new shape to the composition layer, instead.\n\n## Sources of truth — READ, never rely on memory\n\n- **Numbers come from the cited SRD source, never memory (catalog\n SO1/SO2).** For SRD content that is the in-repo CC-BY cache\n `packages/spellkave-srd-cc/cache/` (open5e JSON + the SRD markdown),\n refreshed only by `pnpm --filter @spellkave/srd-cc run sync-cache`; every\n rule claim pins a `cache/` file:line before it is authored (rules and\n layout: [`packages/spellkave-srd-cc/CLAUDE.md`](../../spellkave-srd-cc/CLAUDE.md)).\n Adventure content cites its own admitted sources. If the value is not in a\n cited source, STOP and ask the operator; never fall back to memory.\n- \"I don't know the value\" → say it and stop. Never guess.\n\n## Proof discipline — the shared core (binding)\n\n- **The proof is server-observed on the live lane** — an HP delta, a\n materialised affordance, a state row. Observe EFFECTS, not row existence\n and not exit codes.\n- **The oracle is deterministic non-recurrence:** capture the RED\n server-observed signature, fix, re-run the same live case, assert the\n signature is GONE. Not an LLM verdict, not an inline re-implementation.\n- **NEVER author a forgeable test** that re-implements the production line\n inline (Haiku/Sonnet both manufactured false \"verified\" verdicts this way —\n reverted 2026-06-09). LLM judges (the Tier-B judge) are advisory only and\n never gate a fix.\n- **DoD chain skeleton** (each consumer names its own seed set, live lane,\n and ledger): full-bundle `sk validate <manifest> --bundle` → exit `0`; then\n full-bundle `sk lint <manifest> --bundle --strict` → exit `0` (a finding exits\n `3` under `--strict` — always pass it so a smell fails the gate); then\n `just wipe && just seed …` → `status:ok`; then **live-prove** on the\n role's lane; then record the row in the role's ledger. Which gate catches\n which failure class — and why static-validate precedes seed precedes\n live-prove — is the catalog's **Detection-timing** table.\n\n> **What \"correct\" means** is catalogued once, in\n> [`fixture-correctness.md`](fixture-correctness.md) — every recurring\n> mistake, its failure class, and the gate that catches it. The read-only\n> `fixture-correctness-auditor` agent runs the whole catalog against a bundle.\n\n## Layering + escalation\n\n- **Stay in the owning package and declared work scope.** Follow its authoring\n documentation for reusable rules and adventure-specific content. A substrate\n change needs its own scoped work item; it is not an incidental content fix.\n Enforcement rationale: [fixture-correctness.md](fixture-correctness.md),\n catalog **S3** (generic-mechanic-in-content-bundle) and **C1**\n (reusable-bundle `base/**` is definitions-only).\n- **Record cross-layer findings before implementation.** Search the existing\n tracker, adopt matching work, or file a scoped Bead under the owning epic\n with evidence, dependencies, and acceptance criteria. Follow\n [docs/beads.md](../../../docs/beads.md); do not recreate the retired GitHub\n intake lane. Gate substrate direction with `canon-warden` and record any\n required operator decision before proceeding.\n- The four `canon-warden` axes (Gibson / ADR / K-rule / data-driven) bind\n every author — if your fix wants a new kernel arm, you are out of scope:\n escalate with K-5 evidence.\n\n## Hard rules (shared)\n\n- Follow the owning package's authoring path and run its manifest validation\n gates; do not bypass a rejected validator result.\n- Step 0 first — found → extend/reference, never re-author.\n- Use the owning package's admitted rules sources and provenance requirements\n for game content; do not invent values from memory.\n- Live proof, never forgeable, oracle = deterministic non-recurrence.\n- Branch + PR; **never push main, never auto-merge**. English only (even if\n the operator writes German).\n- **Use the current repository contracts.** Track scope and handoffs in\n Beads. In a repository checkout, read `docs/beads.md`,\n `docs/development.md`, and `docs/testing.md`; kernel/K-rule changes also\n follow `server/CLAUDE.md`, the governing ADRs, and the canon-warden gate.\n When design artifacts are required, follow `openspec/README.md` in that\n checkout. These are repository files, not addresses in the packaged docs\n corpus. Operator approval remains required wherever the governing contract\n or the current task requires it.\n\n## Prepare a named scene\n\nFor the Adventure Author's reusable blueprint plus figure workflow, follow\n[parameterized-scenes](parameterized-scenes.md). Render data values, review the\nselected caller's complete empty-source evidence, stage explicitly and inspect\nthe phase receipt. Use an already controlled actor for play; scene population\ndoes not confer control. Partial setup, defeated figures and cleanup remain\nvisible state requiring a fresh authorized decision.\n",
175
+ "behavior-composition": "# Behavior composition — the `ActorBehavior` layer\n\nThe composition layer in `@spellkave/world-author` turns **one declarative\n`ActorBehavior` object into the full behavior chain** — `capability_definitions`,\n`outcome_templates`, `affordance_templates`, `action_definitions`,\n`consequence_templates`, `consequence_frame_writes`, plus the live-wiring rows\n(`actor_capabilities`, `spatial_niche_attachments`) that let it fire. It is the\ncanonical way to author a spell, monster attack, zone, or condition effect\nprogrammatically (ADR-0072 D-1; promoted from the old `scripts/srd/behavior-cluster.ts`\nin #1526; that file's re-export shim was retired with the `spellkave-srd` package).\nEverything renders through `renderSchemaManifestJson` and the same\nwasm validator crate the server runs at admission — the manifest stays the only\nadmission contract (ADR-0025).\n\n## When to use it (ADR-0072's boundary)\n\n- **A behavior chain** (spell / attack / zone / summon / condition effect) →\n this layer. One typed declaration, one render, one validate.\n- **A mechanical one-row edit** (\"grant this actor that capability\", a tag, a\n placement, a state seed) → an `sk patch` op instead.\n- **One spell's identity core only** (capability + cast action + tags bound to\n one `…/spell/<slug>` identity, no effect chain) → `emitSpell` (see\n `spell-authoring-best-practices.md`).\n\n## Entry points\n\n```ts\nimport {\n type ActorBehavior,\n type BehaviorConfig,\n authorBehaviorFragment, // top-level: reads the manifest header, renders + guards, writes the fragment file\n clusterRows, // the engine: ActorBehavior[] -> row tables (pure, no fs)\n mergeRowTables, // concat-merge row-table maps\n renderFragmentFromRows, // rows -> header-stripped [[include]] fragment TOML\n renderCompleteManifest, // rows -> standalone manifest TOML (headers kept)\n INSTANCE_ROW_TABLES, // the definitions-vs-instances partition set\n} from \"@spellkave/world-author\";\n```\n\nMost drivers call only `authorBehaviorFragment({ behaviors, cfg, out })`. The\n`shape` field picks where the to-hit / save roll sits: `aoe`, `single-target`,\n`zone`, `scheduled-zone`, `env-state`, `summon`, `outcome-graph` — each expands\nto generic kernel primitives (`ForEachActorInRadius`, `ModifyResource`,\n`ApplyStatus`, `Inscribe`, `Spawn`, outcome graphs); the kernel never learns\n\"spell\" vs \"monster attack\". The authoritative field-by-field reference is the\ndoc comments on the `ActorBehavior` interface in\n`packages/spellkave-world-author/src/compose.ts`.\n\n## Minimal example\n\n```ts\nconst strike: ActorBehavior = {\n key: \"goblin-scimitar\",\n displayName: \"Goblin Scimitar\",\n emitCapability: true,\n actionTags: [\"srd\", \"monster-action\"],\n shape: \"single-target\",\n predicateSource: \"\", // OFFER: deterministic eligibility only — no die here (#1891)\n deltaSource: \"0 - (1d6 + 2)\", // negative = damage; positive would heal (max_value clamps)\n resolutionMode: \"Stochastic\", // ACT-TIME resolution: r_manipulate rolls for real\n resolutionPredicateSource: \"d20 >= 15\", // the to-hit roll now lives here\n onFailure: \"srd/goblin-scimitar/miss\", // a MISS applies this consequence instead of on_success\n};\n```\n\n> **Where the die goes.** For `shape: \"single-target\"` (and `clock`),\n> `predicateSource` compiles to `affordance_templates.predicate_source`.\n> Disclosure never evaluates that predicate (the materialiser offers by\n> `capability_id`), but `r_manipulate` evaluates it at act time with live\n> draws — so a die left there turns a miss into a rejected attempt with no\n> `onFailure` consequence (see\n> [`offer-vs-resolution-roll`](./patterns/offer-vs-resolution-roll.md)).\n> Put the roll in `resolutionPredicateSource` with `resolutionMode:\n> \"Stochastic\"` and an `onFailure` consequence, as the example above does.\n> These fields map 1:1 onto `action_definitions.resolution_mode` /\n> `.resolution_predicate_source` / `.on_failure` and are optional; `aoe` /\n> `outcome-graph` / `zone` / `scheduled-zone` branch on a roll inside their\n> own body or graph and do not use them (field doc comments on\n> `ActorBehavior` in `compose.ts`). Unlike `on_success` (always\n> auto-derived and emitted by this composer), `onFailure` is a bare\n> `consequence_templates` id the composer does **not** create — author the\n> miss consequence separately (e.g. `spellkave_define_consequence`) and pass\n> its id through.\n\nRender it with `authorBehaviorFragment` from a driver run via\na `just srd-cc-author-<driver>` recipe (e.g. `just srd-cc-author-dm`,\n`just srd-cc-author-elven-mini`; `just/authoring.just`) (freeze rule: prefer a data entry in an existing\ndriver over a new `author-*.ts` file — ADR-0072 D-3).\n\n## Node-only\n\n`authorBehaviorFragment` reads and writes files; the layer is exported from the\npackage root (Node entry) and deliberately **not** from `./browser`. Browser\nauthoring surfaces compose rows themselves and render via the browser wasm\npath.\n\n## Bounded place-seal transition\n\nA consequence may author the unit string `\"BreakPlaceSeal\"` in its ordered\n`frame_writes` list. This unit operation takes the normal place-node target and\nexisting `dispatch_text` argument; it has no graph-id or reason field of its own.\nIts privileged lane must be `frontier.break_seal`, backed by a live PlaceGraph\nbinding covering the resolved sealing ancestor. It stages the transition until\nthe enclosing ApplyConsequence event exists, then writes the break and Public\ntrace together. A later prepare failure drops the staged transition. Other writes\nkeep the same lane and independently check their own landing; a break grants no\nseal exemption for remaining ancestors or outside targets. See\n[prepared-boundary authoring](roles.md#break-a-prepared-boundary-through-an-authored-act).\n",
176
+ "can-i": "# Ask whether an actor may act\n\n`sk can-i` asks the world's admission probe. It does not roll the action's\nresolution, apply a consequence, or change the world. The answer is true for\none instant: turn, position, and resources can change before the act.\n\n```bash\nsk can-i core/cast_mark --as core/hero --target core/mark\nsk can-i core/cast_mark --as core/bystander --target core/mark --expect refused\n```\n\n`spellkave_can_i` is the same question. Proof: `openspec/specs/world-authoring-cli/spec.md`.\n\n## Supply the same participant arguments\n\nThe probe uses the literal `--args` object (`args` in `spellkave_can_i`).\nInclude the intended selected items and either `expected_participants` or\n`participant_context` when the selected template declares participants.\nSupply one expectation form at a time. The world checks it against the\ncurrent body and equipment; a missing or stale expectation is refused at\n`declared_participants` with `stale_participant_context`.\n\nRead the intended player's `manipulation_context` through that player's own\nprofile. Its admitted `participants` rows provide the action's context token\nand complete bindings. Pass that fresh token or those bindings explicitly to\nthe probe. The author caller still needs the probe authority described below;\nreading a player's choices confers no control over another body.\n\nPLAYER manipulation tools can compose the sole disclosed participant context\nwhen the request omits one. `can-i` does not perform that composition. Compare\nthe same body, target, selected items and explicit participant arguments at\nthe same world state. Omitting participant arguments from both requests can\nproduce different wire arguments through these two paths.\n\nThe refusal's optional `note` explains this requirement. Verdict fields,\nexpectations and exit codes retain their existing meaning; the note never\nselects a context or grants authority. The same-input investigation in\n`ledger/designs/can-i-participant-context.md` summarizes explicit-binding and\ncontext-token admission, independently bound player dispatch and rollback\nchecks over 203 schema tables.\n\n## What the answer means\n\n`admitted` means every check before resolution passed. It does not mean the\nact will succeed. The resolution, the reaction window, the checks at commit,\nand the consequence are listed as not run. Proof:\n`openspec/specs/world-affordance-resolution/spec.md`.\n\n`refused` names the check and the `failure_kind`. `capability_not_held`\nmeans the body lacks the selected action template's capability (including\ncapabilities carried by items). Proof: the requirement \"Selection admits\nonly templates whose capability the actor holds\" in\n`openspec/specs/world-affordance-resolution/spec.md`. It does not carry spent\namounts, positions, or another actor's id. `errored` means the act path\nitself failed; the label is named and the error text is not.\n\n`disclosed` is whether the factored context offers the action to that body.\nIt is reported beside `admitted`. When they differ, the result names both\nand calls neither a fault. Disclosure and eligibility stay separate\n(ADR-0140 D-4, ADR-0141 D-2).\n\nA template predicate that rolls a die can answer differently on a repeat.\nThe verdict marks that. For how a roll resolves, use `sk eval`.\n\n## Checks\n\nThe probe runs the act path's own checks, in that path's order, and stops\nbefore resolution. The two checks of the sender's control are not run: the\ngate is `frontier.apply_manifest` on the caller's bound actor, not a seat\non the body. A body that no actor inhabits is refused at the inhabit check.\nProof: ADR-0148 D-4 and `openspec/specs/world-affordance-resolution/spec.md`.\n\nHuman output (`--format human`) is one line for the answer, then one line\nper check (`label result`). A table was the other option in the design; one\nline per check stays readable in a terminal and is what the snapshot test\npins.\n\n## Authority\n\nThe world answers a caller whose bound actor holds `frontier.apply_manifest`.\nA caller without it gets no verdict. ADR-0094 D-2 is one genesis grant, not\na seat class. ADR-0103 D-1 grants nothing. The shipped PLAYER tools, DM\ntools, and `DmSeatPort` do not call the probe. Proof: ADR-0148 D-4.\n\n## Closed door\n\n`--expect admitted` or `--expect refused` exits 0 when the answer matches\nand 2 when it does not, naming both. An unknown authored key and a caller\nwithout authority also exit 2. An unknown action and a body no actor\ninhabits are answers of the world (`refused`) and exit 0. No reachable\nworld exits 1 and names `sk dev up` or `sk config use-context`.\n",
177
+ "condition-capability-grant-and-suppression": "# `grants_capability_while_active` grants a capability while a condition holds — and `suppresses_capability_while_active` takes one away\n\nBoth fields on `[[condition_definitions]]` are lists of `capability_id`s, and\nboth are enforced at one site: `capability_ids_for_actor`\n(the world API).\nEvery gate that decides what a body may DO reads through it — the\nmaterialiser's structural `affordance_template.capability_id` check, the act\npath, movement, sensing, and the DSL fact pool — so a condition adds or removes\nan ability in ONE place, with no per-affordance wiring. The same site also\nfolds identity-tag grants and equipped-item grants (see below); suppression\nstill wins over every grant source.\n\n```toml\n[[condition_definitions]]\ncondition_definition_id = \"srd/condition/incapacitated\"\nbundle_id = \"srd\"\ndisplay_name = \"Incapacitated\"\ngrants_capability_while_active = []\nsuppresses_capability_while_active = [\"srd/action/communicate/speak\"]\n```\n\n## Why a grant is not expressible as a status, and vice versa\n\nAn `affordance_template` carries a **structural** `capability_id` gate: without\nthe capability the affordance is never offered at all. A `condition` is only a\nfact, which each predicate must remember to read. So:\n\n- **A condition that grants an ability while it lasts** (Rage, a granted\n spell while Blessed) belongs in `grants_capability_while_active`.\n- **A ring that grants a spell while worn** belongs in\n `entity_definitions.grants_capability_while_equipped` (CSV of capability\n ids on the item definition), not on a condition. Modelling either as\n `ApplyStatus` + `actor.status(...)` means throwing away the structural gate\n on the spell's affordance and rebuilding it by hand in that affordance's\n predicate — and in every other affordance the grant should open.\n- **\"Can't speak\" while Incapacitated** belongs in\n `suppresses_capability_while_active`. The status route would need every\n authored predicate to remember `!actor.status('...')`; one that forgets is a\n silent hole.\n\nThe two are not interchangeable in either direction. Granting ADDS to an open\nvocabulary; suppressing SUBTRACTS from it. Expressing a grant as a suppression\nwould mean first giving every entity every conceivable capability and then\nmasking — which an open vocabulary cannot do.\n\n`ApplyStatus` + `actor.status(...)` (the bane/bless/bardic-inspiration idiom)\nremains the right tool for a fact a predicate reads: \"is blessed\", \"has taken\nthe Grappler feat\". Reach for the capability fields when the thing you are\ngranting or removing is an **ability to act**.\n\n## Suppression applies to the ACTOR, never to the target\n\nA condition that stops a creature acting does not stop it being acted upon.\n\"Speak with Dead\" is the caster's affordance targeting a corpse that is itself\nIncapacitated, and it stays authorable: the Target-subject fact pool\ndeliberately does not apply the fold, so the corpse still carries the\ncapability a caster's spell may name. Only its own attempts to act are gated.\n\n## Equipped items share this fold\n\n`entity_definitions.grants_capability_while_equipped` is a *source*, not a\nseeded `capability` row. Equip writes only an `entity_equipment_slot`; unequip\ndeletes it; `capability_ids_for_actor` scans occupied slots on read and unions\nthe CSVs into the wearer's grant set (bead sk-54d / #2940). Order inside the\nfold is identity grants, then equipped-item grants, then condition grants;\n`fold_actor_capabilities` then applies suppression. Unequipping drops only that\nitem's ids. `grants_capability_while_present_in_location` is still unread.\n\n## Precedence: suppression wins\n\nIf one active condition grants a capability and another suppresses it, the\nresult is suppressed. The same pass suppresses an equipped-item grant: a\nparalysed wearer of a spell-granting ring does not cast through the paralysis.\nThis mirrors the action-economy rule where a condition's `FlatSet` pool beats a\npositive `ModifyChannel` grant — taking an ability away is a safety statement,\nadding one is a convenience, and a tie fails closed.\n\nBoth lists are unioned across every active condition, and the\n`implies` cascade carries them: `dead implies incapacitated` suppresses through\nthe cascade with no re-declaration, because the cascade materialises each\nimplied condition as its own `target_condition` row.\n\n## History\n\nThis field shipped as **dead metadata** — written by the manifest committer,\nread by nothing — and as a CSV-in-a-string. Authoring it validated and seeded\ncleanly, then silently did nothing; the `dead-grants-capability-while-active`\nlint (#1846) existed to warn authors off it. Bead sk-syo made it real, added\nthe suppressing twin, turned both into proper lists, and retired that lint. If\nyou find prose anywhere claiming this field is inert, it predates sk-syo.\n\nThe sibling column `grants_capability_while_equipped` had the same\ndead-metadata shape (Equip never seeded a capability row) until sk-54d folded\nit into `capability_ids_for_actor`. Do not re-teach a worn item as a condition\ngrant to work around that; the item column is the primitive.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
178
+ "containment-policies": "# Containment exposure and access\n\nContainment remains the physical `entity_containment` relation. Narrative ownership\nremains `entities.owned_by_entity_key`; changing either relation does not implicitly\nchange the other. A perceived container can expose loose direct children through\nan authored policy. Ownership does not grant exposure.\n\n## Authoring\n\nThree optional manifest row families attach deterministic predicates:\n\n```toml\n[[containment_policy_definition]]\nbundle_id = \"example\"\npolicy_id = \"example/contents\"\nexposure_predicate_source = \"target.state('example/exposed')\"\naccess_predicate_source = \"target.state('example/accessible')\"\n\n[[entity_definition_containment_policy]]\nbundle_id = \"example\"\nentity_def_id = \"example/container\"\npolicy_id = \"example/contents\"\n\n[[entity_containment_policy]]\nbundle_id = \"example\"\nentity_key = \"example/special_container\"\npolicy_id = \"example/contents\"\n```\n\nThis fragment assumes the bundle, entity definition, entity and Boolean state\nvocabulary already exist. Author the states and their values through the existing\nobject-state contract. The definition attachment applies to every instance of that\nexact definition, including entities created at runtime without manifest keys.\nAn instance attachment takes precedence. An absent instance attachment falls back\nto the definition; a dangling or false instance policy denies rather than falling\nback. Retracting the instance attachment restores the definition policy.\n\nBoth predicates bind `actor` to the observing or acting body and `target` to the\ncontainer. They admit Boolean/integer literals, comparisons, logical and arithmetic\nexpressions, explicit `stat`/`state` reads, tags and conditions on these two subjects.\nUse `true == true` or `false == true` for constant predicates. Stochastic draws,\nsource/effective-resource reads, other subjects and unbound inputs are rejected by\nthe shared validator. Missing state or evaluation errors deny.\n\nExplicit Boolean entity state uses the shared Actor/Target fact collector used\nby manipulation predicates. A missing `object_state` row is not an authored\n`false`; author a value when a predicate requires one. Policies read entity\nstate only, without the place-state defaults that manipulation can also read.\nThe kernel live `container-policy.local-node.test.ts` pins both consumers for\nmissing, false and true values on each subject.\n\nExposure and removal access are separate. For example, an open display case can\nexpose its contents while its access predicate refuses removal. Author lockpicking\nor theft alternatives inside the access predicate using ordinary state, tags or\nconditions. There is no kernel-specific lock, lid or theft concept.\n\n## Player reads and actions\n\n`readContainerContents(db, actor, containerRef)` in `@spellkave/sdk/readers` returns\n`container_ref`, `scope: \"direct\"`, `revision`, `status` and `items`. Items carry\n`target_ref: \"item:<id>\"`, `parent_ref`, `name`, `quantity` and `entity_def_id`.\nSubscribe using `containerContentsManifest` from that entry point.\n\nStatuses distinguish `available`, exposed `empty`, `unavailable` and `truncated`.\nAbsent policy, unperceived containers, unready projections and older modules all\nproduce `unavailable` without hidden child counts or identities. Revisions hash\nonly the disclosed content and completeness. The projection admits each ancestor\nbefore reading children, excludes slotted/machine-port rows, and limits traversal\nto depth 64 and 512 disclosed edges per perceiver.\n\nSupported pickup from a perceived grounded non-body container checks exposure and\naccess before spending economy or applying writes, then checks again at mutation.\nThe existing structural restrictions remain: this does not enable nested pickup\nor transfer from another body's inventory. Removal from the actor's existing\npossession boundary is outside the access gate, preserving supported equip,\nconsume and drop operations without a policy on the actor's body. See-as and\nnarrative ownership alone do not confer this exception.\n\n## Diagnostics and release\n\n`spellkave containment policies`, `definition-bindings` and `instance-bindings`\ninspect private authoring data through the existing publisher-only SQL bridge.\n`contents <perceiver> <container>` and `coverage <perceiver> <container>` read the\ncaller's admitted views. `raw-contents` and `raw-coverage` are operator-only.\n\nDoctor reports unresolved policy attachments, loose-child containers lacking a\nresolvable policy, and inconsistent materialized edges/coverage. Missing coverage\nis a release-blocking error. Offline validation keeps existing initial-containment\nrecipes editable; runtime doctor checks the containers those recipes create.\nAn explicit deny policy satisfies coverage while keeping contents undisclosed. Keep diagnostic identities out of player output.\n\nShip the module with definition policies for the ruleset's runtime-created bodies,\nbags and corpses and the adventure's instance overrides. Apply attachments to a\npreserved world; do not reinitialize played containment or state. Rehearse the\nupgrade and doctor report together. Removing policies revokes public contents;\nrollback requires module/schema compatibility and the matching content revision.\n\n## Connected authoring validation\n\nWhen a connected author target already supplies a dependency policy, attachments\ncan reference it without copying its definition into the workspace. Policy\npredicates likewise resolve state, tag and condition identifiers against the\ntarget's existence/ownership vocabulary. The shared Rust validator still checks\nthe author's declared dependency closure; missing or out-of-closure references\nremain MF-VAL-391. Target rows are validation context only and are never persisted\nas authored rows. Existing dependency condition and policy DSL is not reconstructed\nor revalidated. Offline validation without a target remains closed-world.\n\nProof: `packages/spellkave-tool-authoring/src/__tests__/containment-target.test.ts`\n(the `ci-js` tool-authoring offline owner). The context is part of the validation\ncache key, so changing the target cannot reuse diagnostics from a previous target.\n",
179
+ "damage-type-routing": "# Damage-Type Routing Pattern\n\nDamage-type routing is an authoring pattern, not a kernel damage subsystem. A\ndamage spell still writes HP through `ModifyResource`; the amount is a\nDSL-valued `delta_source` that reads target defense tags.\n\nUse the canonical helper when authoring from TypeScript:\n\n```ts\nimport { routeDamage } from \"@spellkave/world-author\";\n\nconst deltaSource = routeDamage(\"8d6\", \"fire\");\n```\n\nIt emits:\n\n```text\nlet dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\n```\n\n## Two helpers: pick by who negates\n\n`routeDamage` emits a **negated** amount, ready to drop straight into a\n`ModifyResource.delta_source` that subtracts HP. That is the right helper\nwhen the routing sits AT the write site — a damage spell, a trap, an\nenvironmental effect.\n\n`routeDamageMagnitude` emits the identical routing ladder **un-negated** —\na positive magnitude:\n\n```ts\nimport { routeDamageMagnitude } from \"@spellkave/world-author\";\n\nconst magnitude = routeDamageMagnitude(\"1d8 + 3\", \"piercing\");\n// let dmg = 1d8 + 3; cond(target.has_tag('damage_immune:piercing'), 0, …)\n```\n\nUse it when the routed value is **consumed by something else** rather than\nwritten directly — the case it exists for is an item carrying its own\ndamage in a DSL slot (`entity_definition_item_dsl_source`), which a shared\nattack archetype then reads via `actor.wielded_item.source('<slot>')` and\nnegates once at ITS write site. Negating in both places would cancel out;\nnegating in neither would heal the target.\n\nBoth take the same `RouteDamageOptions` (`variableName`, `subject`,\n`tagPrefix`), so a slot can route off a subject other than `target` if the\nconsuming expression binds one.\n\nRule of thumb: **the site that owns the `ModifyResource` owns the sign.**\nEverything upstream of it stays positive.\n\n## Defense Tags\n\nDefense tags use this shape:\n\n| Meaning | Tag |\n|---|---|\n| immunity | `damage_immune:<type>` |\n| resistance | `damage_resist:<type>` |\n| vulnerability | `damage_vulnerable:<type>` |\n\nAuthor them on `[[entity_definition_tag]]` for every instance of a creature\ndefinition, or `[[entity_tag]]` for one placed instance. Those are the carriers\nthat `target.has_tag(...)` reads at apply time.\n\nDo not put defense tags on `[[capability_definition_tag]]`. Capability tags can\ndescribe the spell, such as `damage:fire`, but they are documentary metadata for\nthis pattern and do not affect a target.\n\n## Composition Idiom\n\nBind the damage amount once, then route the bound value:\n\n```toml\nframe_write = { ModifyResource = {\n actor = \"TargetActor\",\n resource = \"my-bundle/hp\",\n delta_source = \"let dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\"\n} }\n```\n\nThe fixed ladder order is:\n\n1. immune\n2. resistant\n3. vulnerable\n4. normal\n\nThe expression negates the routed positive magnitude at the end. For\nresistance, `dmg / 2` is integer division on the positive damage amount, so half\ndamage rounds down: raw `7` becomes HP delta `-3`.\n\n## Lazy Branches\n\n`cond` evaluates the bool, then exactly one int branch — this is the\nDSL's own documented laziness, generated from the interpreter's operator\nreference (see [`cond`](./dsl-grammar.md#cond)), not a property specific to\nthis pattern. Binding the raw roll with `let dmg = ...` prevents each branch\nfrom rolling its own dice, and laziness means a resistant target does not\nalso evaluate the vulnerable or normal branch. That is the \"no double\nresistance\" property of the simple ladder: the first matching defense case\nwins.\n\n## Known Boundary\n\nA target that has both `damage_resist:<type>` and\n`damage_vulnerable:<type>` for the same type is outside this static tag idiom.\nThe ladder checks resistance before vulnerability, so the tags do not cancel to\nRAW x1 damage. Static authored defense tags should not carry both for one type;\ndynamic resistance or vulnerability belongs in a future condition/modifier\nmechanism with its own proof.\n\nSee the complete worked bundle at\n[`examples/damage-type-routing.md`](./examples/damage-type-routing.md).\n",
180
+ "dm-oversight": "# Defining a DM: region oversight (see-as extent)\n\nHow to author a game-master with bounded oversight: use an authored role binding. The binding\nrealises its merged capabilities on a separate placeless presence body; the\nDM's character keeps its own gameplay capabilities. See [roles](./roles.md)\nfor admission, expiry and persistent rollout.\n\n## The problem this solves\n\nHidden rows are delivered to their owning body and to an admitted caller with\nextent-bearing grants covering that body. `Internal` rows require a higher\nelevation ceiling; `Discoverable` rows normally require knowledge, while that\nhigher ceiling admits them without a knowledge row (ADR-0081/0084). A DM needs\nthat reach within the scene, rather than across the whole world.\n\n## The mechanism: an extent-bearing grant\n\n```toml\n[[role_bindings]]\nbinding_id = \"campaign/alice-dm\"\nbundle_id = \"campaign\"\nsubject = \"$sender\"\nrole_id = \"dm\"\nextent_kind_ref = \"place_graph\"\nextent_ref = \"campaign/region\"\ndescription = \"Alice oversees the campaign region.\"\n```\n\nThe applying connection must already be admitted to manifest apply. D6 binding\nadmission separately decides whether this row is realised or remains inert.\nPublisher/genesis, covering `frontier.bind.dm`, or covering live grants of every\nmerged DM capability can realise it. The holder paths refuse extent-blind\ncapabilities; `dm` contains read authority, six scoped mutation capabilities, session setup\nand bounded impersonation. Pacing and\nmanifest apply have separate grants.\n\nA realised row creates a presence entity and actor, derives grants from the\nmerged role, and durably mirrors the subject's identity bindings with\n`role = \"presence\"`. `frontier.read_internal` derives `elevation_class =\n\"internal\"`; otherwise the derived class is `\"hidden\"`, including roles with\nno read capability. This preserves the existing extent-grant Hidden floor. This bridge is implemented in\nthe world API; the .35 compatibility stage also reads the `frontier.read_internal` ID\ndirectly. Legacy authored and derived classes remain active until hosted\nbackfill (.67) and cutover (.82). The scoped reader (.44) delivers admitted\nauthored instances and runtime tags with explicit completion metadata; pending\nbriefings retain separate coverage and redact opaque payloads. See\n[reading a world](reading-a-world.md) for the supported reader contract.\n\nThe ordinary extent-bearing grant in\n[`examples/dm-oversight.toml`](./examples/dm-oversight.toml) remains a valid\nworked example of the visibility substrate. It explicitly grants\n`dm_oversight/oversee` with `elevation_class = \"internal\"` to an ordinary\nactor body. It does not demonstrate role-binding admission. Gameplay grants\ncan still author `elevation_class`; role-binding authors choose a role and\nreceive the derived class instead.\n\nThe core extent kinds are authored vocabulary rows:\n\n- `place_graph`: members occupy nodes of the named graph, including child\n combat grids whose parent graph is in the region.\n- `party`: the named membership tag and current session peers resolve members.\n\nA non-empty `extent_ref` widens read scope. Extent shape resolves members;\n`frontier.read_internal` sets Internal depth, alongside legacy\n`elevation_class` during compatibility. An ordinary communicate or act grant can\nalso use extent membership to admit targets across graphs, independent of\nmetric range. Keep ordinary read-only watch capabilities out of action and\naffordance capability requirements so they do not acquire act reach.\n\n## How to author one\n\n1. Author the region and its place nodes.\n2. Choose `dm` or define a role containing the needed read capabilities.\n3. Author one `role_bindings` row per desired scope, using an identity hex,\n `$sender`, or an unambiguous non-playable NPC entity key as `subject`.\n4. Apply with an admitted author and sufficient D6 authority to realise it.\n5. Inspect the exact row with `sk explain binding <binding_id> --target live`.\n An inert row has no presence body or grants; a realised row has both.\n\nThe `spellkave_write_rows` tool accepts `kind = \"role_bindings\"`; the frozen\nnatural key is `binding_id`. Binding explanation reports scope, merged\ncapabilities, expiry and derived elevation. An ordinary connected caller sees\nits own identity mirrors; foreign identities are redacted. The publisher's\nopt-in owner subscription permits fuller inspection. This is explicit binding\ninspection (AUTH-34-01), before owned-actor selection (.45).\n\n## Invariants worth knowing\n\n- An empty extent broadens no read scope. Any extent-bearing grant retains\n the existing Hidden floor; Internal requires `frontier.read_internal` or the higher legacy derived/authored\n class during compatibility (`elevation_ceiling` and `owner_delivery_admits`).\n- A positive binding expiry is exclusive: `expires_at_tick <= now` confers no\n live authority. Omitted or zero binding expiry means permanent. Both scope\n reads and capability gates ignore expired grants.\n- Roles and aggregations are configuration, not authority by themselves.\n An inert binding stores configuration without creating capabilities.\n- Authority resides on the separate presence body. Caller resolution unions\n capabilities across its owned bodies; moving or possessing a character does\n not copy role authority onto the new character body.\n- An NPC subject is linked through runtime-only `subject_actor_id`, so its\n stable principal survives possession. Only durable primary identity bindings\n are mirrored; connection-scoped player claims are excluded.\n- The binding table identifies presence bodies. Claim, release, possession,\n direct binding and forged `role = \"presence\"` declarations cannot turn those\n bodies into player characters (`role_binding.rs`, actor claim/release gates).\n- Scope remains bounded. Use distinct binding IDs for two regions. Changing\n an existing realised binding requires authority over its old and new scope.\n\n## Acting through the presence\n\nA local host selects its caller-owned presence as the acting body. Its\n`manipulation_context` discloses the extent's place nodes, including empty\nclearings; the presence itself has no physical location. The shared manipulate\ntool dispatches the authored `core/act/*` actions described in\n[privileges](./privileges.md#privileged-runtime-acts). The exact selected binding\nmust still be live and cover each write's landing and subject. A second identity\ncannot act through that presence, and another body owned by the same identity\ndoes not lend its grant to the act.\n\nAn NPC host can explicitly pass `presenceActorId` to `createNpcSeat`; discovery\nand dispatch then use that presence rather than the host session's character.\nThe host hydrates `presenceActRequiredTables` on its existing caller connection.\nThe real local-node proof is `spellkave-npc-tests/src/live/presence-act.test.ts`;\n[recorded SDK, CLI and NPC evidence](../../../sandbox/privileged-acts-as-affordances/README.md)\nnames the exact supported routes and their measured cost.\nHosted selection and MCP composition remain transitional under `.45`.\n\n## Controlling the shared clock\n\nBind `timekeeper` separately when a person should pause, resume, step or set\nthe shared clock's cadence. This is an explicit global effect, even if its\nbinding names a region. The ordinary `dm` role grants no pacing authority.\nThe publisher alone loads adventure aggregations that add pacing authority.\n\nThe local `createPaceTimeTools` factory offers `spellkave_pace_time` with\n`op = pause | resume | step | interval` on the caller's own connection.\n`step` accepts `ticks` (default 1, maximum 10000); `interval` requires\n`seconds` within the world's configured bounds (default 5–86400).\nThe factory omits the tool without a current pacing presence and rejects\npublisher execution. Revoking a binding removes pacing authority immediately,\nincluding while the clock is paused. Hosted composition belongs to\n`authority-tools-over-mcp` (.45); these parameters describe the local tool\ncontract, not an available hosted invocation.\n\n`spellkave clock status` reports paused state, tick, configured and armed\ncadence, an estimated next fire time, and publisher-only pacing attribution in this compatibility stage. Ordinary\ntimekeepers and `read_internal` callers receive no private pacing rows; the\nread extension is deferred to `sk-jay0.3.24.86` after ADR-0151 acceptance. The\nestimate comes from the timer's arming time; it is not the host scheduler's\nactual next deadline. Pacing events record each admitted call, including\nno-ops, while the durable last-pacer row survives event retention. See the\n[local acceptance evidence](../../../sandbox/time-control-tools/README.md).\n\n## Authoring safety\n\nA missing extent reference is rejected by the shared FK closure check\n(`MF-VAL-101`). `spellkave doctor` also checks live capability extent references\nand reports expired extent grants. The report-only\n`elevation_class_internal_leftover` check inventories visible stored Internal\nrows; run as publisher to see the complete migration inventory and retain\nthose rows until role backfill and cutover are complete. NPC subject keys must resolve unambiguously\nto non-playable NPCs; player bodies are not binding subjects.\n\nBinding and role edits reconcile their realised grants together in one atomic\nauthority segment. Oversized authority work is refused before enqueue, rather\nthan partly realised. Earlier structural writes in a segmented live apply can\nremain after a later refusal: consult the [apply contract](./getting-started-with-verbs.md#authority-reconciliation-during-live-apply)\nand preserve quarantine/unknown-base recovery state.\n\n## Handing the seat to a real occupant\n\nFor role authority, edit `role_bindings.subject` to the intended identity or\nNPC principal. Do not move its grants onto a character or use a player claim\nas a DM handover. The writer must have covering binding authority over the\nexisting and replacement scope. Retraction or expiry revokes the realised\nconfiguration.\n\nCharacter-seat writers remain distinct:\n\n| Occupant | Writer | Durability |\n|---|---|---|\n| An NPC host before startup | publisher-authored `actor_identities` naming the host identity | durable (`connection_id: None`) |\n| An ordinary character handed to another identity | operator `r_bind_actor_identity` | durable; presence bodies excluded |\n| Host-signed or anonymous player | `r_claim_actor`, eligible primary character only | released on disconnect |\n| Player from a trusted identity issuer | `r_claim_actor`, eligible primary character only | durable (ADR-0102) |\n\n### The default: the publisher bootstraps the NPC host\n\nThe host first retains its credential and shares its identity with the local\npublisher/operator. Before starting the host, that publisher applies:\n\n```toml\n[[actor_identities]]\nbundle_id = \"campaign\"\nentity_key = \"campaign/aldwin\"\nidentity = \"<retained-host-identity-hex>\"\nrole = \"primary\"\n```\n\nThis durable membership creates the NPC subject's presence mirrors. The host\nthen claims its existing primary binding; the claim does not demote durable\nmembership. Re-declaring an already durable self-binding is unnecessary and\ncan be a no-op. An anonymous connection-scoped claim alone receives no presence\nauthority, and cannot apply a self-bind delta to bootstrap it (`MF-APPLY-015`).\nEven a separate apply grant does not waive D6 for changing a role-bound NPC's\ndurable primary membership. Use the publisher-mediated bootstrap rather than\nputting publishing credentials in the host. The host integration lives in\n`packages/spellkave-adventure-elven-mini/scripts/host.ts`; this source pointer\nis not a hosted acceptance claim.\n\n### The exception: an operator hands over a seat\n\nThe publishing identity can bind an ordinary character through\n`r_bind_actor_identity`. That reducer refuses presence bodies and the reserved\n`presence` label. Giving someone DM authority instead means authoring or\nediting the role binding; it does not require putting publishing credentials\nin the recipient's client.\n\n`spellkave doctor` flags placeholder character identities as an operator FYI.\nA fixed illustrative identity hex is not evidence of a real occupant.\n\n## See also\n\n- [Roles and bindings](./roles.md) — authored fields, D6 admission and rollout.\n- [Privileges](./privileges.md) — current gates and temporary bare-grant lane.\n- [Manifest format](./manifest-format.md) — role-binding and ordinary grant rows.\n- [Ordinary extent example](./examples/dm-oversight.toml) — the visibility substrate.\n- ADR-0007, ADR-0081, ADR-0084 — extent membership and elevation ceilings.\n- ADR-0097, ADR-0102 — connection-scoped and durable character bindings.\n\n## Working around prepared places\n\nA seal marks a prepared region that regional privileged edits must respect.\nChoose an unsealed destination, or let its bundle author make the correction.\nA wider PlaceGraph extent does not bypass an ancestor seal. Before applying,\ninspect the destination with `sk explain place <graph-or-node>`; a private live\npolicy is reported as `server decides`, and admission remains authoritative.\n\nA publisher export joins the durable break overlay as `broken = true` and\n`break_reason`. These fields participate in drift hashes and cannot be authored.\nA whole-bundle reload preserves the break when it reinserts that authored seal.\nAn applyset or delta upsert explicitly re-seals it by deleting the break overlay;\nretraction and despawn remove both rows. A copied instance seal belongs to the\ncause of the instance, including the world for runtime instances, so its lifetime\nfollows that instance. Session grids inherit without storing another seal row.\n\nWhen live drift cannot be read for a `place_seals` upsert, `sk apply -k` exits `2`\nand names the unread seal rows. Review with the publisher or deliberately use\n`--force`; the receipt records `world_changed`. An exempt raw delta is an\naccepted lower-level route that re-seals without that client decision. The\nauthored `core/act/break-seal` uses a warden presence with a covering PlaceGraph\nbinding and an explicit `dispatch_text` reason. It changes one selected seal,\nrecords a Public trace and preserves the ordinary consequence provenance; a\ngeneric forced edit does not invoke it. See [the authored break guide](roles.md#break-a-prepared-boundary-through-an-authored-act)\nand [local evidence](../../../sandbox/seal-break-as-affordance/README.md).\n\n## Steering and held NPC control\n\nA live DM presence with `frontier.impersonate` may act as an ordinary Actor\nbody inside its complete place/entity extent. Read authority alone does not\nadmit steering. A Person primary offers its exact DM login through\n`spellkave_offer_control`; `spellkave_withdraw_control` removes that consent.\nThese PLAYER tools create no direct control or sight. Authored Service rows\nmay declare backup co-pilots; manifests cannot consent on behalf of a Person.\n\nThe canonical manipulate, move, sense and manipulation_context tools offer `as_body_id`\nwhen the caller owns a current impersonation presence. Preview refreshes the\npuppet's derived discovery. An NPC act carries the `control_token` observed\nwith perception; preview never replaces it at dispatch. SessionMove and\ncompound-intent steering use the current actor's same admission through the\nSDK reducers. Their admission and step composition are proved at the server\ntier, with live refusal cases; the positive production walk remains\ntransitional until `sk-jay0.3.24.147` supplies its compound-intent bootstrap and\nauthoring path. These calls remain subject to authored action gates and seals.\n\n`spellkave_take_npc_control` acquires an eligible Service-driven NPC using an\nobserved world/generation, caller-owned presence, request id and reason.\n`spellkave_return_npc_control` explicitly surrenders the recorded hold. Idle,\ndisconnect, host restart and loss of the granting role do not resume the AI;\nthe recorded holder may still return after role loss. Another DM cannot inherit\nthat hold through role transfer. Publisher recovery is the separate installed\nCLI `actor control recover` operation. Every transition bumps generation, so\nwork perceived before takeover remains stale after return. The Service identity\nbinding stays in place throughout.\n\nWhen the publisher directly drives several Service participants, session\ncompletion requires an original observation for each of them. The installed\n`spellkave session close` accepts an explicit `--control-tokens` JSON array;\na single deciding-body token remains authoritative for its own body and cannot\nbe replaced by a newer value in that array. A stale or held participant refuses\nbefore termination writes. The local multi-Service proof captures the exact\ninstalled command and independently verifies completion and atomic refusals.\n\n`spellkave actor control list|transitions|work|audit|events` reports authorized\nprivate control state, history, frozen continuations, publisher refusal audit and\nsteering attribution. Driver-only and sight-only callers do not receive the\nDM's steering login. The local synthetic MCP/CLI consumer proof is\n`packages/spellkave-tool-player/src/__tests__/act-as-consent.local-node.test.ts`.\nProximity host integration remains transitional under `sk-jay0.3.24.144`;\npersistent hosted activation and legacy backfill/classification are owned by\n`sk-jay0.3.24.145`. A local proof does not certify public availability.\n\n\nThe [versioned local control walkthrough](../../../sandbox/act-as-and-consent/evidence/2026-10-06-local/index.json)\ncontains exact successful MCP parameters, installed CLI calls and atomic\nrefusal/recovery traces. For example, the verified MCP route offers\n`spellkave_take_npc_control` with `presence_actor_id`, `actor_id`,\n`expected_generation`, `world_instance_id`, `request_id` and `reason`; explicit\nsurrender uses `spellkave_return_npc_control` with the recorded actor, world and\ngeneration. Copy observed values from the current scene rather than reusing\nillustrative actor IDs or generations. Multi-Service `spellkave_session_close`\nalso accepts explicit `control_tokens` carrying each original participant\nobservation; these values do not refresh the deciding body's original token.\n\nThe installed package exposes this full guide through\n`sk docs --doc dm-oversight --full`; `sk docs --query \"held NPC\"` finds the\nrelevant control guidance. Both invocations were executed outside the checkout.\nThe captures measure scripted elapsed time, bytes, calls and developer setup\nseparately, with zero model calls. They do not measure unaided discovery or\ncertify hosted tool availability; `.45`/`.56` own that composition/publication.\n",
181
+ "dsl-grammar": "# DSL Grammar\n\n<!-- GENERATED by scripts/generate-authoring-reference-docs.ts. Do not edit the reference sections by hand. -->\n\nManifest fields ending in `_source` carry Spellkave DSL expressions. The\noperator reference below is generated from `spellkave_dsl::dsl_reference()`.\n\n## Operator Precedence\n\n**`||` binds tighter than `&&`** — the reverse of C, Rust and JavaScript.\n`a && b || c` parses as `a && (b || c)`, and `a && b && c || d` as\n`a && b && (c || d)`. Boolean terms cannot be parenthesised: `(` … `)`\ngroups integer expressions only, so `(a && b) || c` is a parse error.\nWrite the guard so the flat reading is the one you mean, or split it across\nseparate predicates. Whether to keep or flip this precedence is open decision\n`sk-jay0.7.105.10`.\n\n## Generated Operator Reference\n\n### BoolLiteral\n\nExpression kind: `predicate|outcome`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `value` | boolean literal |\n\n- Literal true/false value.\n- The bare literal parses only as a root int/outcome expression (`parse_int_expression`); as a Predicate operand it composes into a comparison, e.g. `true == true`.\n\nExamples:\n- `true`\n\n### IntLiteral\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `value` | integer literal |\n\n- Literal signed integer value.\n\nExamples:\n- `10`\n\n### TextLiteral\n\nExpression kind: `predicate|outcome`. Returns: `Text`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `value` | single-quoted text literal |\n\n- Literal text value.\n\nExamples:\n- `'opened'`\n\n### ReadInt\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|session\\|world\\|`bindings.<name>` (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`); `$event.detail.<int field>` |\n| `field_id` | authored or core field id |\n\n- Reads an integer fact supplied by the caller: `<subject>.stat('id')`, `bindings.<name>.<field>`, a bare binding name, or an int-typed `$event.detail.<field>`.\n- `location` is not a number-read subject — `location.stat(...)` does not parse.\n\nExamples:\n- `actor.stat('core/strength')`\n\n### ReadEffectiveInt\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|session\\|world\\|`bindings.<name>` (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `field_id` | authored or core field id |\n\n- Reads the EFFECTIVE integer value — base fact plus active modifier composition (e.g. condition-driven modifiers). `stat` reads the base value; `effective` opts in to the composed value.\n\nExamples:\n- `actor.effective('homebrew/Momentum')`\n\n### ReadText\n\nExpression kind: `predicate|outcome`. Returns: `Text`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | `<subject>.substrate_id` (actor\\|target\\|session\\|world\\|`bindings.<name>`); `$event.kind` / `$event.detail.<text field>`; `<subject>.text('id')` (actor\\|target\\|location\\|session\\|world) only as a `roll_table(...)` or `.source(...)` argument |\n| `field_id` | authored or core field id |\n\n- Reads a text fact supplied by the caller. There is no general text read: only the three forms in `subject` produce a ReadText node.\n- `.text('id')` is not a free-standing expression — it parses only inside the id argument of `roll_table(...)` or `<subject>.source(...)`.\n\nExamples:\n- `$event.detail.speech_act`\n\n### ReadBool\n\nExpression kind: `predicate|outcome`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `field_id` | authored or core field id |\n\n- Reads a boolean fact supplied by the caller via `<subject>.state('id')`.\n- Inside a macro body, a Bool-typed macro parameter name also reads as a ReadBool.\n\nExamples:\n- `target.state('is_open')`\n\n### ReadResourceMax\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|session\\|world\\|`bindings.<name>` (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `field_id` | resource_definition_id |\n\n- Reads the EFFECTIVE per-entity MAX bound for a resource — an `entity_resource_bound` override for the subject wins, else the bundle-wide `resource_definition.max_value` (#30 / sk-ct8.2).\n\nExamples:\n- `actor.resource_max('srd/hp')`\n\n### ReadResourceMin\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|session\\|world\\|`bindings.<name>` (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `field_id` | resource_definition_id |\n\n- Reads the EFFECTIVE per-entity MIN bound for a resource. Sibling of `ReadResourceMax`.\n\nExamples:\n- `actor.resource_min('srd/hp')`\n\n### HasCapability\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `capability_id` | capability definition id |\n\n- Checks capability membership in the subject fact pool.\n\nExamples:\n- `actor.has_capability('core/open')`\n\n### HasItem\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `item_def_id` | item definition id |\n\n- Checks item membership in the subject fact pool.\n\nExamples:\n- `actor.has_item('core/torch')`\n\n### HasNiche\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `niche_id` | niche definition id |\n\n- Checks niche membership in the subject fact pool.\n\nExamples:\n- `target.has_niche('core/container')`\n\n### HasTag\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `tag` | opaque authored tag |\n\n- Checks relational instance and definition tags supplied by the caller.\n\nExamples:\n- `target.has_tag('locked')`\n\n### SharesTag\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject_a` | actor\\|target\\|location\\|session\\|world |\n| `subject_b` | actor\\|target\\|location\\|session\\|world |\n| `prefix` | opaque authored tag-id prefix |\n\n- True iff the two subjects each carry a tag starting with the prefix and those prefix-filtered tag sets intersect.\n- Content-neutral set-intersection over the two subjects' tag pools — an open authored tag family, never a closed column.\n\nExamples:\n- `shares_tag(actor, target, 'actor.language.')`\n\n### HasStatus\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `condition_definition_id` | condition definition id |\n\n- Checks active condition/status membership.\n\nExamples:\n- `actor.status('core/poisoned') == true`\n\n### ImpliedByCount\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `condition_definition_id` | optional condition definition id; absent means current candidate |\n\n- Reads a kernel-pre-populated count of other active rows whose definitions imply the child condition.\n- The evaluator never reads database tables; empty context returns 0.\n\nExamples:\n- `implied_by_count('core/condition/incapacitated') == 0`\n\n### ParticipantTagGroupCount\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `prefix` | opaque authored tag-id prefix |\n| `excluding_condition_definition_id` | optional condition definition id |\n\n- Reads a kernel-pre-populated count of distinct matching tag values among session participants.\n- A missing pre-populated fact is an evaluation error, never a silent zero.\n\nExamples:\n- `participant_tag_group_count('side:', 'core/condition/unavailable') <= 1`\n\n### PeersNearTarget\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `prefix` | opaque authored tag-id prefix |\n| `radius_mm` | authored radius in millimeters |\n| `excluding_condition_definition_id` | optional condition definition id |\n\n- Reads a kernel-pre-populated count of actors other than Actor and Target within radius_mm of Target that share >=1 prefix-prefixed tag with Actor and do not carry the excluding condition.\n- The evaluator never reads database tables or computes geometry; a missing pre-populated fact is an evaluation error, never a silent zero.\n\nExamples:\n- `peers_near_target('srd.faction.', 1524, 'srd/condition/incapacitated') >= 1`\n\n### OccupantsAt\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `scope` | node scope: to_node or from_node on the traversal path, target on the manipulate / resolution path |\n| `excluding_condition_definition_id` | optional condition definition id |\n\n- Reads a kernel-pre-populated count of actors other than Actor standing on the scoped place node that do not carry the excluding condition (ADR-0134 D-3).\n- The evaluator never reads database tables; a scope the current path did not populate is an evaluation error, never a silent zero.\n\nExamples:\n- `occupants_at('to_node', 'srd/condition/dead') == 0`\n\n### ChannelPool\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `channel_id` | economy_channel_definitions.id |\n\n- Reads the authored pool_ms_per_round constant of an economy channel.\n- A missing kernel-pre-populated fact is an evaluation error, never a silent zero.\n\nExamples:\n- `channel_pool('core/action_class/primary')`\n\n### TracePresent\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `trace_kind_id` | trace kind id |\n\n- Checks whether a trace kind is present for the subject.\n\nExamples:\n- `target.trace('core/opened')`\n\n### KnowsEntity\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world (chains `actor.wielded_item.…` / `actor.equipped_item('<slot>').…`) |\n| `entity_id` | quoted entity-id string or `$bindings.<name>` |\n\n- The entity_id argument is the entity-id-typed binding surface: a single-quoted string or a `$bindings.<name>` path. A bare numeric id does not parse.\n\nExamples:\n- `actor.knows_entity($bindings.required_entity_id)`\n\n### And\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `operands` | two or more bool node ids |\n\n- Short-circuits to false when any operand is false.\n- Binds LOOSER than `||`: `a && b || c` parses as `a && (b || c)`. Boolean terms cannot be parenthesised (decision `sk-jay0.7.105.10`).\n\nExamples:\n- `actor.has_capability('core/open') && target.has_tag('locked')`\n\n### Or\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `operands` | two or more bool node ids |\n\n- Short-circuits to true when any operand is true.\n- Binds TIGHTER than `&&`: `a && b || c` parses as `a && (b || c)`. Boolean terms cannot be parenthesised (decision `sk-jay0.7.105.10`).\n\nExamples:\n- `target.has_tag('door') || target.has_tag('chest')`\n\n### Not\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `operand` | bool node id |\n\n- Negates one boolean operand.\n\nExamples:\n- `target.has_tag('sealed') == false`\n\n### Compare\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `op` | Eq\\|Ne\\|Lt\\|Lte\\|Gt\\|Gte |\n| `left` | bool\\|int\\|text node id |\n| `right` | same value type as left |\n\n- Both operands must have the same comparable value type.\n\nExamples:\n- `actor.stat('core/strength') >= 10`\n\n### Arithmetic\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `op` | Add\\|Sub\\|Mul\\|Div\\|Max\\|Min |\n| `left` | int node id |\n| `right` | int node id |\n\n- Division by zero is rejected at evaluation time.\n\nExamples:\n- `max(actor.stat('core/strength'), 2)`\n\n### Cond\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `cond` | bool node id |\n| `then_node` | int node id |\n| `else_node` | int node id |\n\n- Evaluates the bool, then exactly one int branch (lazy).\n\nExamples:\n- `cond(d20 >= 13, 0, 0 - d6)`\n\n### Roll\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `dice` | <count>d<sides> |\n\n- Uses the caller-provided deterministic evaluation RNG.\n- Single-die rolls (count == 1) consult the acting entity's composed roll bias (conditions with modifier delta_kind Advantage/Disadvantage/Plus): Advantage draws the die twice and keeps the max, Disadvantage the min, and BOTH physical faces are recorded individually in evaluation provenance.\n\nExamples:\n- `1d20`\n\n### RollUnder\n\nExpression kind: `predicate`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `dice` | die token (`d20`, `1d20`, `2d6`) — not an arbitrary int expression |\n| `target` | int expression |\n\n- Compares a roll result against a target number. The first argument must be a literal die token; the parser synthesizes the Roll node from it.\n- Consults the composed roll bias; success is a LOWER roll here, so Advantage keeps the min of two draws (the favorable direction flips relative to Roll).\n\nExamples:\n- `roll_under(1d20, actor.stat('core/dexterity'))`\n\n### RollTable\n\nExpression kind: `outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `table_id` | quoted roll table id or `<subject>.text('state_id')` |\n\n- Takes exactly one argument; the parser synthesizes the internal draw node.\n- Draws from an authored roll table; only the int-drawing form is parseable — there is no Outcome-returning form.\n- Int-valued draws consult the composed roll bias (Advantage re-draws and keeps the max, Disadvantage the min).\n\nExamples:\n- `roll_table('core/random_event')`\n\n### DslSource\n\nExpression kind: `predicate|outcome`. Returns: `Int`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `subject` | actor\\|target\\|location\\|session\\|world\\|binding\\|actor.wielded_item\\|actor.equipped_item('<slot>') |\n| `slot` | item DSL-source slot id |\n\n- Evaluates `subject`'s named DSL-source slot inline, against the SAME actor/target fact context as the calling expression (sk-84i.2, widened G-1).\n- Fails closed when the subject carries no matching item_dsl_source fact for the slot (ADR-0035).\n- actor.equipped_item('<slot>') selects exactly one existing item in the actor's authored equipment slot (ADR-0126); missing, dangling, or duplicate occupancy supplies no item facts, with no carried-item fallback.\n- The equipment-slot argument is a nonempty literal referencing an admitted equipment slot. This subject supports tags, integer/text state, and source reads; it does not add equipment effective-state, status, or resource-bound reads.\n- The slot's own source may not itself call `.source(...)` again — depth-limited to 1, fails closed on violation.\n- The inner expression's stochastic draws are charged against the SAME evaluation-wide draw budget as the caller (ADR-0059).\n\nExamples:\n- `actor.wielded_item.source('srd/damage')`\n- `actor.equipped_item('demo/main-hand').source('demo/damage')`\n\n### Let\n\nExpression kind: `predicate|outcome`. Returns: `Bool`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `name` | binding name |\n| `value` | int expression |\n| `body` | bool or int expression |\n\n- Introduces a lexical binding for the body node.\n- Returns the type of its body: Bool for a predicate body (as in the example), Int for an int body. The bound value is always an int expression.\n\nExamples:\n- `let difficulty = 10 ; 1d20 >= difficulty`\n\n### OutcomeSequence\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `steps` | one or more outcome expressions (`sequence`, `invoke_outcome_graph`, `arbitrate`, …) |\n\n- Outcome DSL text in `outcome_templates.outcome_expression_source`; the server runs the steps in authored order.\n\nExamples:\n- `sequence(invoke_outcome_graph('core/open_container'), invoke_outcome_graph('core/emit_noise'))`\n\n### InvokeOutcomeGraph\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `outcome_graph_id` | quoted outcome graph id |\n\n- Outcome DSL text in `outcome_templates.outcome_expression_source`; delegates to an authored `[[outcome_graphs]]` graph.\n\nExamples:\n- `invoke_outcome_graph('core/open_container')`\n\n### ModifyResource\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\n**Not DSL text** — no parser surface; it cannot appear in a `_source` field. The live write is a structured `[[consequence_frame_writes]]` row; the example below is that row's `frame_write` value. See `manifest-format.md`.\n\n| Arg | Shape |\n|---|---|\n| `actor` | binding ref of the entity whose resource changes, e.g. `Actor` |\n| `resource` | resource definition id |\n| `delta_source` | DSL int expression evaluated at apply time (`-3`, `0 - d6`, `cond(...)`) |\n\n- The `Op::ModifyResource` AST node has no parser surface; `modify_resource(...)` in DSL text does not parse.\n- Author a `[[consequence_frame_writes]]` row whose `frame_write` is `{ ModifyResource = { actor, resource, delta_source } }`.\n\nExamples:\n- `{ ModifyResource = { actor = \"Actor\", resource = \"core/hp\", delta_source = \"-3\" } }`\n\n### ApplyStatus\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\n**Not DSL text** — no parser surface; it cannot appear in a `_source` field. The live write is a structured `[[consequence_frame_writes]]` row; the example below is that row's `frame_write` value. See `manifest-format.md`.\n\n| Arg | Shape |\n|---|---|\n| `target_kind` | entity\\|item\\|world_object |\n| `target_ref` | binding ref of the target, e.g. `Actor` or `Target` |\n| `condition_definition_id` | condition definition id |\n| `expires_at_boundary` | optional `{ boundary_id, owner_actor }` |\n\n- The `Op::ApplyStatus` AST node has no parser surface; `apply_status(...)` in DSL text does not parse.\n- Author a `[[consequence_frame_writes]]` row whose `frame_write` is `{ ApplyStatus = { target_kind, target_ref, condition_definition_id } }`.\n\nExamples:\n- `{ ApplyStatus = { target_kind = \"entity\", target_ref = \"Target\", condition_definition_id = \"core/poisoned\" } }`\n\n### EmitTrace\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\n**Not DSL text** — no parser surface; it cannot appear in a `_source` field. The live write is a structured `[[consequence_frame_writes]]` row; the example below is that row's `frame_write` value. See `manifest-format.md`.\n\n| Arg | Shape |\n|---|---|\n| `kind` | trace kind id |\n| `location_kind` | where the trace lands, e.g. `binding` |\n| `location_ref` | binding ref of the location, e.g. `ActorSpatialRef` |\n| `payload_json` | JSON payload string |\n\n- The `Op::EmitTrace` AST node has no parser surface, and there is no `EmitTrace` frame write.\n- The trace write is the `Inscribe` frame write: a `[[consequence_frame_writes]]` row whose `frame_write` is `{ Inscribe = { kind, location_kind, location_ref, payload_json } }` (optional `expires_at_tick`, `expires_after_ticks`, `carry_dispatch_text`, `carry_addressee`, `carry_dispatch_options`, `carry_occurrence`, `carry_dispatch_context`).\n- `carry_dispatch_options` copies bounded `dispatch_options` labels as `options` and parallel optional `dispatch_option_refs` as `option_definition_refs` (null means no description). References are exact static authored ids, never eligibility-derived.\n- `carry_dispatch_context` copies the dispatch's `dispatch_context` (one JSON object sent as text, at most 8 KiB) onto the payload under `context`. The kernel checks only that it is an object within the bound and reads no key of it; it is presentation content for readers of the trace, and no prompt binding, response set or predicate depends on it. A speaker uses it for the machine side of a question (see [guided dialogue](patterns/guided-dialogue.md)).\n- `carry_occurrence` copies only the admitted occurrence id into answer history as a decimal string; unbound actions omit it. Response tags `ui.response-slot=<positive integer>` identify syntax without parsing action ids or labels. See [the carriage contracts](interaction-dsl-and-world-authoring.md#recording-an-answered-occurrence-carry_occurrence).\n\nExamples:\n- `{ Inscribe = { kind = \"core/opened\", location_kind = \"binding\", location_ref = \"ActorSpatialRef\", payload_json = \"{}\" } }`\n\n### Arbitrate\n\nExpression kind: `outcome`. Returns: `Outcome`.\n\nAuthored as parseable DSL text (predicate/outcome expression).\n\n| Arg | Shape |\n|---|---|\n| `request_shape_id` | quoted arbitration request shape id |\n| `context` | one quoted `fact_id=value` string |\n| `allowed_outcomes` | one or more quoted `outcome_id=outcome_graph_id` strings |\n\n- Outcome DSL text in `outcome_templates.outcome_expression_source`; opens an arbitration request with bounded allowed outcomes.\n- Every argument is a single-quoted string; a malformed `fact_id=value` or `outcome_id=outcome_graph_id` pair fails at execution time.\n\nExamples:\n- `arbitrate('core/dialogue_choice', 'mood=tense', 'agree=core/dialogue/agree', 'refuse=core/dialogue/refuse')`\n",
182
+ "edge-traversal-resource-seed": "# Gotcha — an edge-traversal affordance predicate reading a resource via `actor.stat(...)` needs that resource seeded on EVERY actor who might traverse the edge, and multiple `place_edge_affordance` rows on one `edge_key` AND-chain\n\n(The `phandelver/hero` and Foundry-imported `generated/*.toml` examples are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\nTwo facts compound here. First, `evaluate_edge_traversal_affordances`\n(the world API) ANDs every\n`place_edge_affordance` row that shares a `mode_id` on one `edge_key` — every\nrow this gotcha talks about, like every row authored before\nADR-0101 (movement-defaults-modes-terrain-cost), carries the implicit default\n`mode_id = \"\"`, so \"every row on the edge\" and \"every row in the edge's\ndefault mode\" are the same set here. (A row with a *different* `mode_id`\nis a separate alternative — the edge is traversable if *either* mode passes,\nnot both; that only matters once an edge authors more than one mode, e.g. a\nwalk-or-swim ford — see `spellkave_bind_edge_affordance`'s `mode_id`\nparameter.) So adding a second, stricter row IN THE SAME MODE to an edge that\nalready carries an ungated `core/affordance/traverse_open_portal` (common on\n`generated/*.toml` Foundry-imported topology, which cannot be hand-edited) is\na legitimate, harmless way to narrow traversal: the stricter row's predicate\nbecomes the effective gate once it goes false, while the looser row stays\ntrue and contributes nothing. Second, per the `actor.stat(...)`\nUnknownField-excludes-the-affordance gotcha in\n[`sibling-resource-predicate-seeds`](./sibling-resource-predicate-seeds.md),\nthe predicate is evaluated against\nWHICHEVER actor attempts the move — a resource seeded only on\n`phandelver/hero` will wrongly reject a co-located NPC (e.g. an escaping\nally) who has no object_state row for that same resource, even while the\ngate is meant to still be open. Seed the gating resource's `object_state`\nrow (value 0 / \"not yet closed\") for every actor who legitimately uses\nthat edge, not just the hero.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
183
+ "effective-condition-modifiers": "# Numeric condition modifiers need explicit `effective(...)` consumers\n\n`actor.stat(\"my/state\")` and `target.stat(\"my/state\")` always read the authored\nbase value. A condition whose `modifier_template_id` composes onto that state is\nvisible to behavior only through `actor.effective(\"my/state\")` or\n`target.effective(\"my/state\")`. Keep a base `stat(...)` check when it proves the\nstate exists, then use `effective(...)` for the modified comparison. SRD half\ncover demonstrates the split: attacks require base `srd/ac >= 1` so cover cannot\nmake scenery strikeable, but compare the attack roll against effective AC.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
184
+ "empty-predicate-source": "# An empty `predicate_source` needs `predicate_bool = true`, or the affordance silently never resolves\n\n(Worked examples B4/RH2/CC1 are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\n**Gotcha — `predicate_bool` is not a decorative default; it is the literal\nvalue used whenever `predicate_source` is the empty string.** An\nunconditional self-eligible act (B4's `approach_quietly`/`skulk_in_brush`,\nRH2's `search_cistern` — \"always available, no check\" acts, as opposed to a\nDC-gated check whose `predicate_source` carries a real roll expression)\nleaves `predicate_source = \"\"`; if `predicate_bool` is left at its\neasy-to-copy-paste default of `false` (the value every DC-check row in this\ncodebase carries, since a non-empty `predicate_source` makes `predicate_bool`\nirrelevant there), the affordance predicate always evaluates false and the\nact never resolves — `hero.manipulate(...)` comes back `rejected` with\n`failure_kind: \"predicate_rejected\"` and a `failure_detail` of the form\n\"r_manipulate: no authored affordance_template selected action_definition\n'…' — predicate_rejected: … its predicate evaluated false\"\n(the world API)\n(CC1 hit this on its own `quiet_approach` +\n`trigger_tripwire` acts, both copied from a DC-check template's field list\nwithout swapping this one field). Rule: whenever `predicate_source = \"\"`,\nset `predicate_bool = true` (B4's `cragmaw-hideout-approach.toml` is the\nprecedent to copy) — `false` there means \"this affordance can never fire.\"\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
185
+ "equip-item-target-ref": "# Equipping items: target-ref prefix, ownership depth, and `core/drop`'s real scope\n\n**Gotcha — `entity:<id>` vs `item:<id>` target refs resolve through DIFFERENT\nspatial resolvers.** `entity:` maps to `TargetRef::Entity`, which grounds the\ntarget purely via `entity_location`/`actor_spatial_location` — it has no\nconcept of \"carried\" or \"equipped\". `item:` maps to `TargetRef::Item`, which\nspecial-cases equipped (`entity_equipment_slot`) and directly-contained\n(`entity_containment`) items as always-co-located before falling back to\n`entity_location` (the world API).\nA GROUNDED item (sitting at a real place_node) works fine with either prefix.\nAn EQUIPPED or CARRIED item (place_node_id `\"\"`) only resolves correctly with\n`item:` — targeting it with `entity:` fails `out_of_range` (\"target place_node\n'' is out of range from actor place_node '<X>' (range_m=0)\"), a confusing\nerror that looks like a missing spatial_niche_attachment but is really just\nthe wrong prefix. Always use `item:<id>` for item-entity manipulate targets.\n\n**Gotcha — nested containment does not count as actor ownership for\nequip/unequip.** `EquipItem`/`UnequipItem`'s ownership check requires the\ntarget's `entity_containment.container_id` to equal the actor's body entity\nDIRECTLY. An item nested two levels deep (e.g. inside a container the actor\njust picked up — hero → chest → sword) fails `\"target entity <id> is not\nowned by actor <id>\"` even though it plainly travelled into the hero's pack.\nThe chest-carries-nested-contents shape (RH2's satchel, RH3's sarcophagus)\nonly proves an item TRAVELS with its container on pickup — it does not make\nthat item directly wieldable. An item you intend to equip must be its own\ntop-level pickup (`core.item` tag + a real `place_node_id`), not nested\ninside another pickupable container.\n\n**Gotcha — `core/drop`'s authored consequence does not actually unequip or\nrelocate.** `core/base/affordances.toml`'s `core/drop/success` consequence is\nInscribe-only (a trace write); the real unequip+relocate logic lives in the\n`drop_item` reducer (the world API), which is NOT wired into\n`r_manipulate`'s dispatch for the `core/drop` action — calling `core/drop` on\nan equipped item returns `status: \"success\"` but leaves\n`entity_equipment_slot`/`entity_containment` completely unchanged. To free an\nequipped slot, author your own item-targeted action instead, mirroring the\nequip pattern (`srd/equip_dagger`) but with `UnequipItem`:\n`frame_write = { UnequipItem = { actor_ref = \"Actor\", slot_id = \"<literal\nslot>\", source = { TargetItem = {} } } }`. `UnequipItem`/`EquipItem`'s\n`source` only supports `TargetItem`/literal `Item{id}` — `ActorInventoryItem`\nis explicitly unit-tested as unsupported in\n`r_apply_consequence/equip_item.rs`, so the action must be item-targeted\n(`self_eligible = false`), not self-eligible with a fixed-id lookup.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
186
+ "find-an-authoring-pattern": "# Find an authoring pattern without a checkout\n\n## Search by task\n\nUse `sk docs --query \"container loot\"` on an installed CLI. A shared MCP docs\ntool accepts `{ \"query\": \"container loot\" }` when that adapter offers it.\nSearch returns bounded summaries and stable document IDs, not a whole manual.\nNo world connection or mutation authority is required for this packaged lookup.\n\n## Read the pattern\n\nOpen `sk docs patterns/container-with-loot`. If a page defaults to an outline,\nread the relevant heading with `--section \"Solution\"`; `--full` retrieves the\ncomplete page. The result's metadata gives the corpus revision and maps relative\nMarkdown links to packaged document IDs. Unknown server compatibility remains\nexplicit; a document's publication does not prove its runtime example on your world.\n\nThe [container pattern](./patterns/container-with-loot.md) identifies its SRD\ndependencies and composition prerequisites. Its excerpt is not a standalone\nbundle. The [Patternbook index](./patterns/index.md) covers other tasks.\n\n## Retrieve the selected task input\n\n`sk docs examples/loft-chest-rows --full` retrieves the container pattern's exact\nsource-backed fixture rows. Its title and summary identify it as an excerpt.\nIt requires the `elven_mini` bundle, existing `elven_mini/inn/loft` node and SRD\nchest/potion definitions in the dependency closure. Pickup additionally requires\nan admitted SRD creature and its action economy; this docs journey does not\nperform pickup. The [container pattern](./patterns/container-with-loot.md)\nexplains these prerequisites. No copied subset of the rows is maintained here.\n\nA candidate's accompanying versioned proof records the search, pattern, selected\nexcerpt and prerequisite assertions. Its artifact receipt identifies the exact\ncorpus and implementation used. That is docs retrieval evidence, not live behavior.\n\n## Retrieve a complete separate example\n\n`sk docs spatial-minimal-cell --full` returns a complete worked manifest in the\n`toml` field, plus its walkthrough and expected offline validator diagnostics.\nThis is a different example from the container pattern. Its source bytes and\nvalidator verdict are guarded during corpus generation. Offline validation does\nnot prove live behavior; keep the owning feature's captured runtime evidence separate.\n\n## Recover a refusal\n\nAn unknown document returns `unknown_id`; an unknown heading returns\n`unknown_section` and the real headings. Retry with a known ID or heading.\nDo not treat a successful help lookup as an authority grant or a successful act.\nFor planned hosted authoring, the explicit reference is\n`hosted-authoring-guidance`; matching hosted execution evidence remains absent.\n\n## Publication and evidence\n\nAUTH-56-01 is the external consumer acceptance for guide retrieval. A\n[historical partial installed-candidate capture](../../spellkave-cli/docs/installed-cli-evidence.md)\nis available through `sk docs evidence/auth-56-installed-cli --full`, with its\nexact artifact hash, sanitized transcript, assertions and pinned text accounting.\nIt verifies that named candidate alone; current-release, hosted and live proof\nremain pending. AUTH-56-02 requires unexecuted stories to retain planned status.\nSource-generation tests remain source evidence.\n",
187
+ "fixture-correctness": "# Fixture correctness — the catalog\n\n**This file is the single source of truth for \"how do I author a fixture\nbundle *correctly*\".** Every enforcer points here and nothing restates these\nrules:\n\n- the deterministic validator codes (`MF-VAL-*` / `MF-APPLY-*`) in\n `crates/spellkave-validate` and\n the world API,\n- the `srd-fixture-hygiene` grep lint (retired 2026-08-11 alongside\n `world-fixtures/`'s move to `archive/world-fixtures/`; script archived to\n [`archive/scripts/ci/check-srd-fixture-hygiene.sh`](../../../archive/scripts/ci/check-srd-fixture-hygiene.sh) —\n see `archive/README.md` Phase D),\n- the read-only [`fixture-correctness-auditor`](../../../.claude/agents/fixture-correctness-auditor.md)\n agent (it *runs* this catalog against a bundle),\n- the packaged `sk` skill (`packages/spellkave-cli/skill/SKILL.md`) and the\n shared [`authoring-process.md`](authoring-process.md).\n\n> **Historical evidence.** Many rows and sweep notes below cite\n> `phandelver/`, `world-fixtures/` or `packages/spellkave-srd/` as the place a\n> failure was found. Those were retired on 2026-08-11/14 (`archive/README.md`);\n> read them under `archive/` or with `git show`. The rule each row states\n> still applies to the live bundles in the per-bundle map.\n\n> If you find yourself writing a fixture-authoring rule into a `CLAUDE.md`, an\n> agent file, or `SRD-MAP.md`, add it **here** and leave a one-line pointer\n> there instead. The whole point of this file is that the rules live in *one*\n> place. ([[#why-one-place]])\n\n## How the catalog is organised\n\nFixture-correctness failures split into four classes, and **the class decides\nthe enforcement** — this is the agreed strategy, not a per-mistake judgment call:\n\n| Class | Mechanically checkable? | Enforcement |\n|---|---|---|\n| **STRUCTURAL / ref-integrity** (dangling ref, wrong bundle scope, duplicate id) | yes | **LINT** — an `MF-VAL` rule (travels with the bundle, fail-closed *before* seed). Grow this family. |\n| **CONVENTION** (instance rows in a reusable bundle, seed-above-max clamp, naming, tag/taxonomy) | yes | **LINT** — same `MF-VAL` family. |\n| **SEMANTIC / modelling** (a predicate parses but doesn't *evaluate* as intended; wrong DC band; clumsy shape) | no | **GUIDANCE** (this file, at authoring time) + **live-prove** (proves it actually fires). |\n| **SOURCING** (numbers from memory not the Foundry cache; markdown mirror instead of JSON) | no (process) | **GUIDANCE**. |\n\nPrinciple: **anything deterministically checkable becomes a lint** (the hard\nlever that *compels*). Guidance is the soft complement for judgment + sourcing\nonly — a prose rule that isn't loaded into a prompt prevents little.\n\nStatus legend used below: ✅ enforced (deterministic gate exists) · ⚠️ gap → lint\ncandidate (only-at-seed, partial, or grep-only — wants an `MF-VAL` promotion) ·\n📖 guidance-only (not mechanically checkable).\n\n## Detection timing — where each gate fires\n\n| Surface | Codes / checks | When |\n|---|---|---|\n| **Static validate** | the `MF-VAL-*` family (static, 40+ codes) — `crates/spellkave-validate/src/refs.rs` | `spellkave validate` — *before* any node. Out-of-file frame-write refs hint (sk-zqc); `spellkave validate FILE --against <bundle>` or `--against live` resolves them against that existence-only index (sk-vjh.2). (`just check-manifest-refs`, the every-bundle CI gate over the central fixture pile, #1270, was retired 2026-08-11 alongside `world-fixtures/`'s move to `archive/world-fixtures/` — see `archive/README.md` Phase D.) |\n| **Grep lint** | `srd-fixture-hygiene` instance-row prohibition | `just srd-fixture-hygiene` — pre-seed, bash regex |\n| **Seed / apply** | the `MF-APPLY-*` family — the world API | `just seed` — DB constraint at commit (too late, fail-open until then) |\n| **Live-prove** | server-observed non-recurrence (the RED→fix→RED-absent loop) | the TS runners / `companion-twins` — proves a predicate *evaluates*, not just *parses* |\n\nThe deterministic codes are **self-documenting in the source** — this catalog\ndoes **not** copy them all; it indexes them by class and, critically, flags the\n**gaps** (the recurring mistakes a code does *not* yet catch). That is the\ncatalog's value: it is the map of what is mechanized vs. what is still only\nprose.\n\n## Scope subtlety — hygiene is for *reusable* bundles, not *content* bundles\n\nThe `base/** = definitions-only, no instance rows` rule (catalog row **C1**) is\n**scoped to reusable bundles** (`srd/`, and `core/`'s shared vocabulary), *not*\nto content bundles. A content bundle (an adventure such as `elven_mini`, a\n`packages/spellkave-mechanics` fixture) **legitimately\nships instance rows mixed with definitions** — that *is* the content. Applying an\n`srd`-style hygiene check\nblindly to every bundle would be **wrong**. See the per-bundle map for which\nbundles are reusable (hygiene-bound) vs. content (instance rows expected).\n\n## Per-bundle map\n\nThis is the table the auditor reads to know *which* rules apply *where*.\n\n| Bundle | `depends_on` | Role | Hygiene-bound? (C1) |\n|---|---|---|---|\n| `core` (`packages/spellkave-mechanics/fixtures/core`) | `[]` | World-agnostic floor (login, primary action) | partial — shared vocabulary should stay definition-like |\n| `srd` (`packages/spellkave-srd-cc/fixtures`, generated) | `[]` | The 5e ruleset (generic, **reusable**) | **yes** — `base/**` definitions only |\n| `dm` (`packages/spellkave-srd-cc/fixtures/dm`) | `srd` | Reusable authored dialogue, wizard phase conditions and finite DM acts | **yes** — never names an adventure |\n| `elven_mini` (`packages/spellkave-adventure-elven-mini/fixtures`) | `srd, dm` | One adventure (content) | no — instance rows expected |\n| `packages/spellkave-mechanics/fixtures/<mech_*>` | mostly `core` | Single-mechanic proof bundles (content) | no |\n\nReuse boundary, stated plainly: `srd` is separate from an adventure bundle\nbecause it is the **reusable ruleset** every adventure (elven-mini today, a\nmodder bundle later) `depends_on`. The split is also a **definitions-vs-instances**\ndiscipline that pays off even with one adventure — it is what the C1 hygiene\nlint protects. Do not fold `srd/` into a content bundle.\n\n## The catalog\n\n### STRUCTURAL / ref-integrity\n\n| ID | Symptom | Current detection | Enforcement |\n|---|---|---|---|\n| **R1** | A row references an id that resolves only *outside* its bundle's `depends_on` closure (dangling / wrong-scope ref). | `MF-VAL-214` (Fatal, static) | ✅ |\n| **R2** | A `capability_id` (global PK) is defined twice. | `MF-VAL-266` (static, `--bundle`) + `MF-APPLY-020` (seed) | ✅ — process-level guard: the mandatory pre-authoring existence check (step 0, [`authoring-process.md`](authoring-process.md), #1365) prevents the twin from being authored at all. |\n| **R3** | A generated fixture emits an id a hand-authored sibling also defines — file-clean, duplicates only **at seed**. Fix: rename or skip-emit on one of the two emitters (the acid_splash pattern); after the merge run `just wipe && just seed && just publish` to confirm, or trust `--bundle --dep` now that it's a static gate. Process-level guard: the pre-authoring existence check (step 0, [`authoring-process.md`](authoring-process.md), #1365). | `MF-VAL-272` (Fatal, static, `--bundle --dep`) + `MF-APPLY-020` (seed) | ✅ (#1359) — generalises the R2/MF-VAL-266 raw-`Vec` duplicate scan to `entity_def_id`, `action_id`, `roll_table_id`, `outcome_template_id`, `resource_definition_id`, `condition_definition_id`, `state_id` (object_state_definitions), `slot_id`, `template_id` (affordance_templates), and `entity_key`. Sweep found + fixed two live corpus offenders (a duplicate `srd/ac` object_state_definition and a duplicate `core/condition/controlled` id namespace collision in a self-contained demo). |\n| **R4** | Seed FK (`entity_definition_initial_state/_capability/_condition`) targets an id missing from the bundle + deps. | `MF-VAL-252/253/254/255` (Fatal, static) | ✅ |\n| **R5** | A converter drops rows (validator accepts *fewer* rows silently). | none (validator is happy with fewer) | 📖 row-count check after extraction; auditor compares source-field count vs. emitted. |\n| **R6** | Two seed rows write the same `(entity, state)` — a duplicate `object_state` / `entity_definition_initial_state` — and the later include **silently last-write-wins** (e.g. a Bat HP 5 clobbered to 30, historical evidence: `archive/world-fixtures/srd/coverage/spells-behavior.md`, since deleted whole — `world-fixtures-retirement` Phase D, 2026-08-14 — the failure class is unchanged, only its example anchor is gone). Not rejected; not clamped. | `MF-VAL-270` (static, **Fatal**) | ✅ (#1359 — ratcheted Warning → Fatal; corpus swept clean at 0 offenders) — distinct from C6 (bounds) and R2 (capability PK). |\n| **R7** | An `[[entities]]` instance (esp. `kind = npc`/`player`) carries **no `entity_def_id`**, so `derive_entity_target_niches` returns `None` and it is **silently dropped from `candidate_targets`** — it can never be a communicate/manipulate target (the footgun `demos/green_herald.toml` exists to document). | none | 📖 — **NOT a clean lint**: a sweep shows bare `npc`/`player` entities are the *norm* (~30+ across core/srd/phandelver/demos — most are legit runtime actors, not intended targets), so a blanket Warning would flag half the corpus. \"Forgot the def\" vs \"fine bare actor\" is intent-dependent. Needs an intent-aware check (canon-warden, issue filed). The narrow sub-case *`entity_def_id` set but **dangling*** IS a clean ref-integrity candidate. |\n| **R8** | A `[[metadata_attachments]]` row targets a missing world object (`target_kind` / `target_ref`) or uses an unregistered namespace / malformed payload. Without validation, author notes, driver personas, and art/narration pointers silently drift away from their objects. | apply-time metadata checks in `r_apply_world_manifest` + `spellkave-author manifest validate` namespace-shape checks; unknown `target_kind` also `MF-VAL-330` (static) | ✅ (#1765 + sk-jay0.3.5.15) — apply rejects unknown target kind, unresolved target ref, unregistered namespace, and malformed JSON; offline validate rejects unknown target kind (`MF-VAL-330`). Public `<bundle>.art.image` is legal on every admitted kind (not entity-only). Authoring docs live at [`metadata-attachments.md`](metadata-attachments.md). |\n| **R9** | An actor that will act as the SENDER of a `manipulate`/`move` call (any connection's `connectedActorId`, or the driving actor of a beat) carries **no `[[actor_identities]]` row**. Validates clean, seeds clean — rejected only at **act time**: `r_manipulate`/`r_move` return `status: \"rejected\"` with `evaluation_provenance.failure_kind = \"actor_authorization_failed\"` / `\"no control authority for actor <id>: sender not bound via actor_identity\"` (the `#856` sender-binding gate, landed 2026-06-17, the world API). Targets-only actors (never a sender) need no binding. Fix: `[[actor_identities]]` row with `identity = \"$sender\"` (resolves to the applying/connecting identity at manifest-apply), mirroring `phandelver/base/actors.toml:55` hero. Found live 2026-07-04: 3 pre-06-17 phandelver beats (`speak-to-room.toml`, `ranger-mark.toml`, `share-the-way.toml`) authored their bespoke driving actors before this gate existed and never got the row. | none (validator is happy; only the live apply-path rejects) | 📖 — runtime-only failure mode, same shape as R7 (silently absent until exercised); a static lint would need to cross-reference every beat's `connectedActorId`/sender against `actor_identities` rows, which the validator has no visibility into (that's walkthrough-script knowledge, not manifest content) — no clean static detection identified yet. |\n| **R10** | A location-dependent (place-provided) action/affordance has **no `spatial_niche_attachments` row** in the assembled manifest. Validates clean, seeds clean — rejected only at **act time** at `r_manipulate`'s `attachment_presence` precondition (no d20 ever rolls). Live evidence: sk-84i.1 wolf proof-scene forgot the `srd/niche/strikeable` attachment. Actor-/entity-provided niches and traversal templates do not need an attachment. | `MF-VAL-328` (static, **Warning**, sk-2wg) | ✅ — **Warning, not Fatal**: a reusable bundle (srd alone) legitimately ships niche-gated actions expecting a downstream scene to author the attachment. Definitions-only manifests (no `place_nodes`) are skipped. Combined-bundle-scope works for free (same as MF-VAL-273). RED tests in `refs.rs`. |\n| **R11** | A formula (`entity_definition_item_dsl_source.source` or `ModifyResource`/`ModifyChannel` `delta_source`) reads `stat`/`effective`/`resource_max`/`resource_min` for an id that is not a kernel-projected fact and has no `resource_definitions` or `object_state_definitions` row — first useful error used to appear only when a player acts (`UnknownField`). | `MF-VAL-329` (Fatal with the full `depends_on` closure present or on live admission; Info when the closure is not fully present offline, as `MF-VAL-217`) | ✅ (sk-84i.7) — diagnostic names the owning row and missing symbol. Unknown macros in the same formulas stay `MF-VAL-318` / `MF-DSL-MACRO-UNKNOWN`. |\n\n### CONVENTION\n\n| ID | Symptom | Current detection | Enforcement |\n|---|---|---|---|\n| **C1** | Instance rows (`entities`, `actors`, `actor_spatial_locations`, `actor_capabilities`, `object_state`, `place_nodes`, `spatial_niche_attachments`, `actor_identities`) shipped in a **reusable** bundle's `base/**` — they leak into every world that loads it. | `srd-fixture-hygiene` grep lint (srd only, ratchet allowlist) | ⚠️ → **flagship promotion**: bash-grep, srd-only, doesn't travel with the bundle. Promote to an `MF-VAL` rule scoped to reusable bundles (#1268). |\n| **C2** | A `bundle_id` violates the naming convention — snake_case (with `/` allowed as a namespace separator), aligned `file-stem == bundle_id == metadata.profile`. | `MF-VAL-271` (static, Warning) | ✅ — hyphen outliers migrated; the lint catches a regression. |\n| **C3** | An `srd.weapon`-tagged `entity_definition` carries no `entity_definition_item_dsl_source` slot `srd/damage`. | `MF-VAL-268` (Warning, static) | ✅ (repointed sk-hml / #2184 — was `srd/damage_profile`) |\n| **C3b** | An int `roll_table` is an identity-mapped uniform 1..N weight-1 table **without** a `die` tag (smuggled die / damage-profile class). | `MF-VAL-317` (Fatal, static **and live admission**) | ✅ (sk-s1e / #2184) — author `1dN`/`d20` or an item DSL-source slot; intentional named-die tables (`core/d20`) keep tag `die`. Live delta apply splices already-published headers/entries/die tags into the validation manifest (sk-3h5) so a second face on a living constant table is Fatal even when the delta omits the table. `roll_table('…')` refs against a published table admit via `LiveVocabulary`. |\n| **C4** | An `srd/spell/<slug>` capability has no matching `srd/spell/<slug>` `entity_definition`. | `MF-VAL-264` (Warning, static) | ✅ |\n| **C5** | Deprecated descriptor tags (`manipulation.action_id`, `communication.mode`) instead of the typed fields. | `MF-VAL-220/227` (Fatal) + `224/228/229` (Warning) | ✅ |\n| **C6** | A seeded `entity_definition_initial_state` or instance `object_state` value exceeds the resource's `max` (or undercuts `min`) → **silently clamped**, not rejected. | `MF-VAL-269` (static, **Fatal**) | ✅ (#1359 — ratcheted Warning → Fatal; corpus swept clean at 0 offenders) — compares seed `value_int` vs. `resource_definition` bounds. |\n\n### SEMANTIC / modelling\n\n| ID | Symptom | Current detection | Enforcement |\n|---|---|---|---|\n| **S1** | A predicate / DSL string **parses** but does not **evaluate** as intended (e.g. reads the wrong `target.state(...)`, integer-division edge). Example: `niche_definitions.predicate_source` using `target.has_tag('…')` — niche admission has no tag facts, only niche facts, so the predicate is always false; write `target.has_niche('…')` instead. | `MF-VAL-256/257/261` prove *parse + value-type* only | 📖 + **live-prove** (the only oracle: server-observed RED→fix→RED-absent). |\n| **S2** | Wrong difficulty modelling — a per-skill DC (`persuasion-dc`, `deception-dc`, …) instead of one intrinsic actor trait; a fixed DC where a contested check is the emergent shape. | none (parses fine) | 📖 prose-only: model ONE intrinsic actor trait and let contested checks emerge (the srd bundle's \"modeling per-NPC social difficulty\" coverage note retired with that bundle, 2026-08-14 — this row now carries the guidance). |\n| **S3** | A **generic** mechanic is authored into a **content** bundle (`phandelver/`) instead of `srd/` — the layering-invariant violation. A 5e-named stat column / statblock table / bespoke schema shape (anti-fossil). The mechanizable subset — ANY bundle defining an id outside its own namespace, not just `srd/`-shaped ones — is `MF-VAL-291` (static, **Warning**, #1510). The remaining 5e-named-column / bespoke-schema-shape judgment call is not mechanizable. | `MF-VAL-291` (static, Warning) for the id-namespace subset; prose-only (4 agent files) for the schema-shape subset | ✅ (namespace subset, #1510) / ⚠️ (schema-shape subset stays canon-warden + guidance). |\n| **S4** | Two (or more) `affordance_template` rows resolve the SAME `manipulation_action_id` — possibly at DIFFERENT niches — and EACH carries an independently stochastic predicate (a `d20`/dice/roll_table draw). The ADR-0021 D-2 Postscript retired the `priority` knob and promised a validation-time ambiguity diagnostic; `MF-VAL-341` (`affordance_selection.rs`) only covers the same-*niche* case. The act-time fan-out (`select_turn_aware`, the world API) evaluates every candidate across niches with its own fresh draw, first pass wins — a cross-niche overlap silently samples N independent rolls per act instead of the one each predicate individually implies (#1556 root cause). | `MF-VAL-273` (static, **Warning**, #1556) | ✅ — corpus swept clean for the known offenders: #1625 split `phandelver/hero/reactive_strike` away from `srd/attack/melee`, and #1629 split `phandelver/persuade` away from `srd/persuade`. |\n| **S5** | Two (or more) `affordance_template` rows share the SAME `niche_id` AND `outcome_template_id` with identical eligibility (`predicate_source` + `predicate_bool`) — leftover copies that differ only in `template_id` / `range_m`. Runtime then silently picks one via the `template_id` tie-break (crypt-fight deadlock: a range-0 twin of `srd/attack/melee/affordance`). `MF-VAL-341` groups by resolved action and skips move/sense, so this identical-offer shape was invisible there. Distinct predicates on the same niche+outcome (the core traversal-gate catalog) are alternative gates and stay quiet. | `MF-VAL-327` (static, **Warning**, sk-j8e.3 / BL-39) | ✅ — RED fixture `crates/spellkave-validate/tests/fixtures/duplicate_niche_outcome.toml`. |\n\n### SOURCING\n\n| ID | Symptom | Current detection | Enforcement |\n|---|---|---|---|\n| **SO1** | A number comes from memory, not the SRD / Foundry `.fvtt-cache`. | none | 📖 \"I don't know the SRD value\" → say it, stop. Never guess. |\n| **SO2** | A converter reads the lossy **markdown** mirror instead of the **JSON** cache. | none | 📖 always read the Foundry JSON; emit a per-field coverage report. |\n\n## Checking native fixture regressions\n\nRun `cargo test --manifest-path crates/Cargo.toml` from the checkout under\nreview. Cargo supplies the runtime package directory that the native tests use\nto locate their fixtures, including the\n[validator conformance fixtures](https://github.com/b4arena/spellkave/blob/main/crates/spellkave-validate/tests/conformance.rs).\nA shared build cache can reuse the executable while it checks this checkout's\nfiles. See the [shared Cargo cache guidance](https://github.com/b4arena/spellkave/blob/main/docs/development.md#shell-format-and-shared-cache-footguns)\nfor isolated reproductions and recovery from older compiled fixture paths.\n\nWhen changing validator regression fixtures, also check every native test target\nwith the pinned Clippy toolchain:\n\n```bash\ncargo clippy --manifest-path crates/Cargo.toml -p spellkave-validate -p spellkave-validate-wasm --all-targets -- -D warnings\n```\n\nThe [Rust crates CI lane](https://github.com/b4arena/spellkave/blob/main/scripts/ci/nx-projects/rust-crates-tests/project.json)\nruns this command alongside the native tests. Construct default-based fixtures\nwith struct initializers for their authored fields; this keeps fixture setup\nlint-clean without suppressing warnings.\n\n## Lint-promotion backlog (STRUCTURAL + CONVENTION gaps → `MF-VAL` family)\n\nRanked by frequency × blast-radius. Each new rule needs a **RED falsifier test\nbefore the rule exists** (a fixture that fails *without* the rule and passes\n*with* it), then a regenerated validate-wasm pkg.\n\n**Done:**\n\n- ✅ **CI coverage gap (#1270) — historical.** `scripts/ci/check_manifest_refs.sh`\n validated **every** `world-fixtures/*` bundle + each `demos/*.toml` (each in its\n own `core`-based closure, via the `check-refs` Rust binary), gating the existing\n rules over the previously-uncovered bundles and surfacing two demo bundles that\n shipped fatal-invalid — both fixed in the same PR. The gate itself was retired\n 2026-08-11 alongside `world-fixtures/`'s move to `archive/world-fixtures/` (see\n \"Static validate\" in the table above; `archive/README.md` Phase D) — `spellkave\n validate` / `sk validate --bundle --dep` remain the live per-invocation check.\n- ✅ **C6 → `MF-VAL-269`** (seed `value_int` vs. `resource_definition` bounds,\n Warning). RED tests in `refs.rs`. Sweep: 0 current offenders.\n- ✅ **R6 → `MF-VAL-270`** (no duplicate `(entity, state)` seed, Warning). RED\n tests. Sweep: 0 current offenders. Ratchet to Fatal once the corpus stays clean.\n- ✅ **C2 → `MF-VAL-271`** (`bundle_id` snake_case, Warning; `/` allowed as a\n namespace separator like `tag_authoring/homebrew`). The convention is also\n *applied*: the hyphen outliers (`green-herald`, `actors-and-bodies`) and the\n stem-vs-id mismatches (`singular-event.toml`, `deferred-external-resolution/`,\n `dm-see-as-extent`, `identity-rebind`, `role-capability-write-gate`) were renamed\n so `file-stem == bundle_id == metadata.profile`. RED tests. Sweep: 0 offenders.\n- ✅ **C6/R6 severity ratchet (#1359).** `MF-VAL-269` and `MF-VAL-270` promoted\n Warning → Fatal, exactly the ratchet both rows called for. Corpus sweep found\n and fixed one real `MF-VAL-269` offender:\n `srd/monster/carpet-of-flying-5-by-7-ft`'s SRD-sourced (not mis-imported) STR\n 40 seed, clamped to the resource's SRD-faithful 30 ceiling at import time\n (`archive/packages/spellkave-srd/src/import/import-foundry-actors.ts`, now archived, matching what the runtime clamp\n already did silently). `MF-VAL-270` swept clean at 0 offenders.\n- ✅ **R3 → `MF-VAL-272`** (#1359, \"duplicate id across generated + hand-authored\n bundle-closure rows\"). Generalises the R2/`MF-VAL-266` raw-`Vec` duplicate scan\n (previously `capability_definitions.capability_id` only) to every other\n globally-unique definitional id column authors actually generate content for:\n `entity_def_id`, `action_id`, `roll_table_id`, `outcome_template_id`,\n `resource_definition_id`, `condition_definition_id`, `state_id`\n (object_state_definitions), `slot_id`, `template_id` (affordance_templates),\n `entity_key`, plus (surfaced by the sweep) `discipline_id`\n (stacking_discipline_definitions) and `policy_id`\n (condition_remove_policy_definitions). Fatal, static, fires under\n `--bundle --dep` exactly where R3's \"only-at-seed `MF-APPLY-020`\" symptom used\n to hide. RED tests in `refs.rs`. Sweep found and fixed two real offenders: a\n duplicate `srd/ac` object_state_definition (`base/monsters.toml` — the\n generator, which needs the row for its own standalone self-validation gate —\n vs. `base/armor.toml`, which now defers to it, the acid_splash pattern applied\n in the generator-wins direction) and `demos/build_fixture.toml` privately\n re-declaring `core/stacking/single` / `core/remove_policy/independent_lifetime`\n / `core/condition/controlled` — a self-contained demo (no `depends_on`) that\n collided with core's real namespace once layered onto an already-seeded core\n in the normal dev loop; renamed into the demo's own `build_fixture/...`\n namespace instead.\n\n- ✅ **S3 (generalised) → `MF-VAL-291`** (#1510c) — generalises \"no `srd/`-shaped\n id defined outside `srd/`\" from the single `srd` namespace to EVERY bundle: a\n row that DEFINES an id (not one that merely *references* another bundle's\n vocabulary — Class 5/`MF-VAL-214` already covers dangling/wrong-scope refs)\n must live under its own `bundle_id`'s namespace. Scope mirrors `MF-VAL-272`'s\n definitional-id universe (`entity_def_id`, `action_id`, `roll_table_id`,\n `outcome_template_id`, `resource_definition_id`, `condition_definition_id`,\n `state_id`, `slot_id`, `template_id`, `discipline_id`, `policy_id`) plus\n `capability_definitions.capability_id` and the two instance-row id classes\n the sibling stacking-collision work targets, `entities.entity_key` and\n `place_graphs.place_graph_id`. RED tests in `refs.rs`. **Warning, not\n Fatal** — the #1510 coordination note (2026-07-02T19:13Z) is binding: a new\n Fatal lint landing mid-loop must never redden the running Phandelver\n night-loop's PRs, the same MF-VAL-270/271/272 posture as #1359. **Corpus\n sweep is NOT clean** (unlike the 0-offender starts of C2/R6/C6) — 96 distinct\n `(id, bundle)` offenders across 20 bundles: `place_graph_id = \"fixture\"` (×4)\n and `entity_key = \"actor\"` (×5, one more than #1510's tracked count) are\n being renamed by the sibling `change/1510-stacking-collisions` branch; `core`\n itself defines 6 foreign-namespace ids (`frontier.apply_manifest`,\n `homebrew/item/horn_blade`, `homebrew/horn-sheath`, place graphs `inn`/\n `village`/`zzz_storage_closet_blueprint`); `demos/deferred_external_resolution`\n abbreviates its own namespace (`deferred/*` instead of\n `deferred_external_resolution/*`, 7 ids); the remaining ~80 are `demos/*`,\n `srd`, and `phandelver` content bundles' own bare (non-namespaced) instance\n ids (`entities.entity_key` / `place_graphs.place_graph_id`) — pre-existing\n convention across nearly every content bundle, `phandelver`'s ~20 location\n blueprints included. Full breakdown in the PR body (refs #1510).\n\n- ✅ **S4 → `MF-VAL-273`** (#1556) — the ambiguity diagnostic the ADR-0021 D-2\n Postscript promised but the existing `MF-VAL-341` never delivered:\n `MF-VAL-341` groups candidates by `(niche_id, action_id)`, so a genuine\n overlap between candidates on *different* niches was invisible to it, even\n though the act-time selection fan-out (`select_turn_aware`) evaluates\n candidates across every niche in scope for the requested action. `MF-VAL-273`\n groups by `action_id` ONLY and additionally requires EVERY candidate in the\n group to carry an independently stochastic predicate\n (`spellkave_dsl::count_static_draws(predicate) > 0`) — a deterministic or\n single-stochastic-candidate group is not flagged, since only the\n all-stochastic case silently changes the act's effective pass rate. RED\n tests in `affordance_selection.rs` (4 cases: cross-niche same-action\n both-stochastic warns; same-action one-static-one-stochastic is quiet;\n same-stochastic-different-action is quiet; single-candidate is quiet).\n **Warning, not Fatal** — same posture as MF-VAL-341/270/271/272/291 (a new\n Fatal lint must not redden an in-flight corpus). **Cross-bundle scope\n works for free**: `validate_manifest` (and thus this lint) runs on whatever\n `Manifest` it is handed, and the `check-refs` binary already\n merges `core + srd + phandelver` into one combined `Manifest` before calling\n it (the runtime's own admission order) — no architectural change was needed\n to see across bundles. **Initial corpus sweep found 2 live offenders**:\n `srd/attack/melee` (`srd/attack/melee/affordance` +\n `phandelver/hero/reactive_strike/affordance`, the #1556 root-cause pair,\n fixed by #1625) and `srd/persuade` (`srd/persuade/affordance` +\n `phandelver/persuade/affordance`, gated at two different DCs — a fixed 21\n vs. Toblen's own `phandelver/persuasion-dc` stat — fixed by #1629). Current\n combined-bundle sweep is clean of `MF-VAL-273`.\n\n- ✅ **R10 → `MF-VAL-328`** (sk-2wg) — a place-provided niche used by a manipulate affordance must have ≥1 `spatial_niche_attachments` row in the assembled Manifest. **Warning, not Fatal** (reusable bundles expect a downstream scene to attach). Definitions-only (no `place_nodes`) skipped. RED tests in `refs.rs`. Actor-/entity-provided niches and traversal templates are exempt.\n- ✅ **Duplicate `consequence_frame_writes` ordinal per template → `MF-VAL-335`**\n (manifest-natural-keys 1.3) — two `[[consequence_frame_writes]]` rows of the\n same `template_id` MUST NOT share an `ordinal`. **Fatal**: the storage key is\n `(template_id, ordinal)` (task 1.1) and the server replaces a template's\n whole ordered write list on every apply, so a duplicate ordinal would abort\n the apply on a primary-key collision halfway through instead of failing\n cleanly at authoring time. RED tests in `crates/spellkave-validate/tests/cross_row_refs.rs`.\n- ✅ **Unknown visibility token → `MF-VAL-337`, unknown `elevation_class` → `MF-VAL-338`**\n (sk-jay0.7.174.29) — every authored visibility field\n (`object_state_definitions.default_visibility`,\n `capability_definitions.default_visibility`, `object_state.visibility`,\n `actor_capabilities.visibility`, `spatial_niche_attachments.visibility`,\n `spatial_environment_state.visibility`) MUST be `public`, `local`,\n `hidden`, `internal` or `discoverable` (either capitalisation), and\n `actor_capabilities.elevation_class` MUST be empty, `hidden`, `internal` or\n `full`. **Fatal**. Before this rule, a typo such as `visibility = \"private\"`\n passed validation, failed only inside the scheduled drain, and the author saw\n the generic `MF-APPLY-029` about 90 s later. Tests in\n `crates/spellkave-validate/src/visibility.rs`; the server pins both token\n lists to its parsers (`parse_authored_matches_offline_validator_tokens`,\n `elevation_ceiling_matches_offline_validator_tokens`).\n\n**Open:**\n\n1. **C1 → `MF-VAL` \"no instance rows in a reusable bundle's `base/**`\"** (#1268) —\n promote the `srd-fixture-hygiene` grep into the validate crate, scoped by a\n per-bundle reusable/content flag. **Deferred:** ships *inert* (fires on 0 real\n manifests until the srd allowlist burn-down completes); the grep already\n enforces it. Build alongside the burn-down, not before.\n2. **`MF-VAL-291` Warning → Fatal** — the ratchet this row calls for (same\n posture as C2/R6/C6). **Promotion condition:** the corpus must sweep clean\n first, and unlike those three rules this one did **not** start clean (see\n the Done entry above) — the burn-down is the sibling stacking-collision\n renames (in flight) **plus** a considerably larger follow-up pass over\n `core`'s own 6 offenders, `deferred_external_resolution`'s abbreviated\n namespace, and every content bundle's bare instance ids (`phandelver`'s ~20\n location blueprints are the biggest single chunk). Not a \"next loop-quiet\n window\" flip like #1359 — size the burn-down as its own tracked follow-up\n before proposing the Fatal flip.\n\n## <a id=\"why-one-place\"></a>Why one place\n\nBefore this file, the same rules lived in ~6 places — `SRD-MAP.md` pitfalls,\n`world-fixtures/CLAUDE.md`, `check-srd-fixture-hygiene.sh`, the `MF-VAL` comments\nin `refs.rs`, the layering invariant repeated across four agent files, and\n`coverage/social.md`. Nine duplicate groups. A rule in six places drifts; a rule\nthe authoring agent never loads prevents nothing. Consolidating to one catalog,\nwith enforcers pointing here, is the DRY lever: the knowledge has one home, and\nthe lints/agent/skill are *downstream* of it.\n",
188
+ "getting-started-with-verbs": "# Getting started with verbs\n\nAUTHOR **verb deep-dive** — linked from the start-here guide `onramp`\n(`sk docs onramp`). This page does **not** replace onramp; it walks the\nmulti-call AUTHOR verb flow once you already know the three command groups\n(AUTHOR / PLAYER / file commands) and that TOML is the underlying model.\n\nWrite manifest ROWS by calling the `spellkave_*` AUTHOR tools, not by\nhand-editing TOML text. Full parameter reference: `tool-reference`\n(`sk docs tool-reference`). Underlying row shapes: `manifest-format`.\nWorked examples: `sk docs` → Worked examples.\n\n## Why verbs, not TOML text\n\nHand-writing manifest TOML means holding the whole row/field schema in your\nhead, getting `bundle_id`/`depends_on`/id-namespacing right by hand, and only\ndiscovering a mistake when the validator rejects a wall of text with a line\nnumber. Each staging verb instead:\n\n- wraps the SAME `@spellkave/world-author` row-generation machinery a\n hand-authored bundle ultimately produces, so nothing is reinvented and the\n output validates identically;\n- validates its own inputs BEFORE writing anything, and an unsupported shape\n fails loudly, **naming the offending parameter** — never a bare TOML line\n number;\n- merges into your workspace's scratch manifest with **upsert-by-key**\n semantics (see [Idempotent re-authoring](#idempotent-re-authoring) below),\n so re-running a call to fix a typo replaces the row instead of duplicating\n it.\n\n## The 4-call fireball flow\n\nThe worked example this flow reproduces is\n[`examples/aoe-damage-spell.md`](./examples/aoe-damage-spell.md) (its\nmanifest, `examples/aoe-damage-spell.toml`, is generated by\n`scripts/doc-examples/aoe-damage-spell.ts`). Four write calls — plus the\nexisting `spellkave_apply_manifest_delta` to flush the result — produce a\nmanifest that validates with **zero diagnostics**. Two tests back this:\n\n- `packages/spellkave-tool-authoring/src/__tests__/doc-contract.test.ts`'s\n `DOC-PROMISE: getting-started-with-verbs#the-4-call-fireball-flow` case\n runs the exact snippets below and asserts zero diagnostics, well-formed\n node ids, and that apply passes the finished TOML through unchanged.\n- `packages/spellkave-session/src/player-tools/__tests__/authoring-verbs.test.ts`\n (\"is semantically equivalent to docs/examples/aoe-damage-spell.toml\")\n runs the same four calls with the example's hierarchical node ids\n (`aoe_blast/arena/center`, `aoe_blast/arena/fringe`, place graph\n `aoe_blast/arena`) and compares the spell-cluster and resource rows\n field-by-field against the example (modulo generated ids, comments, and two\n documented column divergences); entity and place rows are compared on\n counts and key fields only.\n\nThe step-1 snippet below is simplified to flat node ids (`aoe_blast/center`),\nso its place graph is `aoe_blast`, not the example's `aoe_blast/arena`.\n\n1. **`spellkave_author_place`** — author the place graph (one call per\n graph): a list of nodes sharing one common parent path, plus any edges\n between them. Node ids are `<place_graph_id>/<local_id>`. `place_graph_id`\n may itself contain `/` (a hierarchical id like `aoe_blast/arena`);\n `local_id` is the **last** path segment and must not contain `/`.\n Doctor check `node_id_well_formed` splits on the last slash.\n\n ```jsonc\n {\n \"bundle\": \"aoe_blast\",\n \"nodes\": [\n { \"id\": \"aoe_blast/center\", \"name\": \"Arena Center\" },\n { \"id\": \"aoe_blast/fringe\", \"name\": \"Arena Fringe\" }\n ],\n \"edges\": []\n }\n ```\n\n2. **`spellkave_define_resource`** — author the resource pool the spell will\n drain (a `resource_definitions` row + tag satellites). Write verbs never\n fabricate bounds for a pool they didn't create, so if `spellkave_define_behavior`'s\n `effect.write.resource` needs a pool that doesn't exist yet, define it\n first.\n\n ```jsonc\n {\n \"bundle\": \"aoe_blast\",\n \"id\": \"hp\",\n \"display_name\": \"Hit Points\",\n \"min_value\": 0,\n \"max_value\": 30,\n \"recovery_rule\": \"long_rest\",\n \"initial_value\": 30\n }\n ```\n\n3. **`spellkave_place_actor`** — declaratively place actor instances. The\n `placements` array shape places the SAME actor kind split across\n MULTIPLE place nodes in ONE call (mutually exclusive with the flat\n `at`/`count`/`resources` shape) — here, 3 npcs at the blast center (the\n caster plus two targets) and 1 at the fringe (a bystander that must stay\n outside a radius-0 blast, proving the selector is genuinely bounded).\n\n ```jsonc\n {\n \"bundle\": \"aoe_blast\",\n \"kind\": \"npc\",\n \"placements\": [\n { \"at\": \"aoe_blast/center\", \"count\": 3 },\n { \"at\": \"aoe_blast/fringe\", \"count\": 1 }\n ]\n }\n ```\n\n4. **`spellkave_define_behavior`** — author the spell itself: a capability +\n action + outcome + consequence chain, driven by the SAME `clusterRows`\n builder the SRD content drivers use. `grant_to` binds the capability to\n the caster (the first placed actor key); `effect.write.resource` must\n already resolve (step 2 authored it) — no verb auto-creates a pool it\n didn't itself define.\n\n ```jsonc\n {\n \"bundle\": \"aoe_blast\",\n \"id\": \"firebloom\",\n \"grant_to\": \"aoe_blast/npc_1\",\n \"offered_when\": { \"reach\": \"same_node\" },\n \"action_class\": \"spell\",\n \"effect\": {\n \"primitive\": \"ForEachActorInRadius\",\n \"shape\": { \"id\": \"core/area/node_ball\", \"radius\": 0 },\n \"per_target_gate\": \"d20 < 13\",\n \"write\": { \"primitive\": \"ModifyResource\", \"resource\": \"aoe_blast/hp\", \"delta\": \"-d6\" }\n }\n }\n ```\n\n5. **`spellkave_apply_manifest_delta`** — **commit** the finished workspace\n scratch to the active connection-level [target](#the-target-model-stage-then-commit).\n Call with **no arguments** (do not paste TOML): the tool reads the scratch\n pad. `live` dispatches through `r_apply_manifest_delta` (upsert semantics,\n ADR-0085); `local` merges into a target folder's own `manifest.toml`.\n Optional `toml` is only an escape hatch for an external delta.\n On `live`, the tool **waits for a push**: a new digest seal (ok) or a\n `manifest_apply_outcome` row (the MF-APPLY code). Enqueue is not success.\n A mid-segment commit error rolls that firing's writes back; enqueue has\n already armed a delayed `MF-APPLY-029` quarantine, so the waiter still\n sees a named outcome about 90 s later (`MANIFEST_APPLY_QUARANTINE_SLACK_SECS`,\n the world API) instead of waiting for the SDK's\n 15-minute watchdog (`MANIFEST_APPLY_WATCHDOG_MS`,\n `packages/spellkave-sdk/src/manifest-apply.ts`).\n\nNone of the four write calls needed a `spellkave_write_manifest_toml`-style\npre-seed: every write verb self-scaffolds its own `[[bundles]]` header the\nfirst time it sees a new `bundle` — a genuinely EMPTY workspace is a valid\nstarting point.\n\n## Smart defaults\n\nEvery write verb accepts an OPTIONAL `bundle` parameter. When you omit it,\nthe verb falls back to `context.defaultBundle` — the workspace/connection-level\ndefault a host can wire once per authoring session instead of repeating\n`bundle: \"<id>\"` on every call. Per-call `bundle` always wins when both are\nset; a host juggling multiple bundles in one session simply keeps passing\n`bundle` explicitly and the default is never consulted.\n\nOther defaults worth knowing before you pass a value you don't need to:\n\n- `spellkave_author_place`'s node `name` defaults to a title-cased local id\n when omitted.\n- `spellkave_query`'s `target` parameter, when omitted, reads the UNION of\n the workspace scratch manifest plus whatever connection-level target or\n live db is configured — `result.source` always says which sources were\n actually consulted (`\"workspace\"`, `\"workspace+local\"`, or\n `\"workspace+live\"`).\n- `spellkave_query`'s detail shape (`kind` + `id`) defaults `refs` to\n `\"both\"` — the row plus its outbound AND inbound refs — since a bounded\n single-row detail call is exactly where the ref payload earns its keep;\n list/summary shapes never carry refs (see\n [The target model](#the-target-model-stage-then-commit) below).\n\nSee [`tool-reference.md`](./tool-reference.md) for the full, generated\ndefault/required table per parameter, per verb.\n\n## Authored observation prose (#1968 B-9)\n\n`spellkave_define_behavior`'s outcome body accepts an optional `observation`\nstring — authored prose describing what a PLAYER perceives on a successful\nmanipulate or sensing outcome (the `outcome_templates.description` column\nunder the hood; #1921/#1923's `receipt`/`observation` split in the companion\nagent's act tools). Omit it and nothing changes: the tool result carries its\nexisting honest `observation: null` + `observation_gap` shape, exactly as it\ndid before this field existed.\n\nTwo things worth knowing before you author one:\n\n- **It is a bounded, closed vocabulary, not free text with variables.** The\n ONLY placeholders you may use are `{target_name}`, `{actor_name}`, and\n `{place_name}` — resolved from data the player is already authorized to\n see, never a raw id. A placeholder outside that set (or anything that\n dereferences live state — HP, a resource value, a condition) is rejected at\n validation time; state-dependent narrative belongs in the DSL outcome\n expression, not here. General-purpose prose interpolation is intentionally\n NOT supported — this is a single authored line, not a template language.\n- **It is NOT a discovery-gated reveal channel.** `observation` text is\n world-public static prose, exactly like a place node's `description` — it\n reads identically for every player who successfully triggers that outcome.\n The epistemic gate that decides WHETHER a player sees anything at all\n happens earlier, in the (owner-gated) provenance correlation that resolves\n which outcome fired — never in this text. If you want a conditional reveal\n (a hidden trap, a disguised NPC, \"you now know the guard is lying\"), that\n is a DIFFERENT, already-owned mechanism (the discovery-validated sensing\n path, ADR-0081 G-2) — do not try to smuggle a reveal into authored prose by\n writing two outcome templates and hoping only one is ever selected.\n\n## Idempotent re-authoring\n\nThe folding verbs (`spellkave_define_resource`, `spellkave_define_entity_type`,\n`spellkave_define_roll_table`, `spellkave_define_condition`,\n`spellkave_define_niche`, `spellkave_define_capability`, and\n`spellkave_define_behavior`) merge by **upsert-by-key**: re-authoring the\nSAME `bundle` + `id` REPLACES the row and every satellite wholesale — a\nsecond call with fewer tags, say, drops the stale ones rather than leaving\nthem behind. This is what makes \"call the verb again to fix a mistake\"\nsafe: you never need to hand-delete a stale satellite row first.\n\n`spellkave_write_rows` — the generic escape hatch for any row kind the\nnarrower verbs don't cover — upserts when the target `kind` has either a\nsingle-column natural key (`commit.rs`'s ADR-0085 upsert discipline) or a\nwider ordered composite key (ADR-0146: junction/satellite rows such as\n`*_tag`, `entity_definition_initial_*`, `actor_capabilities`, `object_state`,\nand more). A row whose full key already matches an existing row REPLACES it;\na row that omits any key field can only append, never collide. The one kind\nwith no key of either shape is `consequence_frame_writes` (its identity is the\nwhole ordered list per `template_id`, not a per-row key) — it stays\nAPPEND-ONLY through this verb; author it via its own consequence-authoring\nverb instead. For a wholesale reseed of a whole satellite set (not just\navoiding a duplicate), the parent folding verb is still the better tool.\n\n`spellkave_set_metadata` is the normal generic path for metadata, not a\n`spellkave_write_rows` shortcut. A root call replaces only its named\n`[metadata]` keys. An attachment call upserts by its live identity\n`(target_kind, target_ref, namespace, bundle_id)` and replaces its payload and\nsource; a batch either persists together or leaves the scratch unchanged.\nNamespace registrations use their owner identity and reject a foreign owner.\nSee [`metadata-attachments.md`](./metadata-attachments.md) for the three\ntarget shapes.\n\n## `spellkave_write_rows` and spatial niche attachments\n\n`spellkave_define_behavior` auto-generates a `spatial_niche_attachments` row\nbinding its `capability:<cap>` niche to `grant_to`'s own node. It resolves\nplacement from the workspace first, then the active target, and requires a\nnonblank `place_node_id`. A live AUTHOR may know the actor without being\nallowed to read its node; in that case the verb immediately names `grant_to`\nand `place_node_id` in an error and leaves scratch unchanged. Supply the\nactor's known current placement as an `actor_spatial_locations` workspace\nrow before retrying; do not guess a node. The regression is covered by\n`packages/spellkave-session/src/live/caster-placement.live.test.ts`.\n`spellkave_write_rows` does **not** generate attachments for you: it is the\ngeneric escape hatch for any row kind, with no `grant_to`/caster-node concept of its own to\nauto-attach against. An `action_definitions` or `affordance_templates` row\nauthored via `spellkave_write_rows` whose niche is **place-provided** (the\ndefault: `niche_definitions.provider` empty or `\"place\"`, and the fail-closed\nfallback for a niche with no definition row) and has no matching\n`spatial_niche_attachments` row anywhere in the workspace or your active\ntarget will never be selected by `r_manipulate`. The rejection names the\ncause: its hint carries `niche_unresolved` (no niche resolved for the\nactor's node), not the `predicate_rejected` marker an ordinary attack-roll\nmiss carries (the world API;\ntests in `selection/candidates/tests/turn_aware.rs`). Read the failure kind\nbefore assuming a bad roll. **Do not leave a `capability:*` niche without a `provider`.** That is how a\ncarrier-bound class feature silently becomes room-scoped (sk-0m4.69).\nAuthor `provider = \"actor\"` for verbs that travel with the hero; author\n`provider = \"place\"` only when you mean a node. Ordinary niches still default\nto place-provided when `provider` is empty — that default is not flipped.\nPre-flight **`WA-CAP-002`** is fatal when a `capability:*` niche has no\ndefinition row or an empty provider. The tool call also surfaces a\nnon-blocking `WARNING` when an authored niche has no attachment. Today that\nwarning fires for every such niche, including `provider = \"actor\"` niches\nthat need no attachment (`missingNicheAttachmentWarnings` in\n`packages/spellkave-tool-authoring/src/authoring-verbs.ts` never reads\n`provider`; bug `sk-jay0.7.173.2`), so for an actor-provided niche it is\nnoise. Otherwise treat either as a to-do — author the missing\n`niche_definitions` (and, for place-provided niches, the\n`spatial_niche_attachments`) row before relying on the action/affordance.\n\n## The target model: stage, then commit\n\nEvery write verb writes into the WORKSPACE — an in-memory (or host-persisted)\nscratch manifest, never applied anywhere until you say so. This is the\nstaging step. `spellkave_query` lets you inspect staged rows before committing;\ndispatch is inferred from which fields you pass,\nno `mode` flag:\n\n- **Omit `kind`** for a summary: bundle ids + a row-kind → count map (what\n `spellkave_manifest_inspect` used to answer alone) — generalized across\n `target`, and optionally scoped to one `bundle`.\n- **Pass `kind`** (optionally with `pattern`, a substring filter) for a\n bounded, ids-only catalog list for that row kind — what `spellkave_lookup`\n used to answer, generalized from 4 hardcoded kinds to ANY\n `ROW_KIND_NATURAL_KEY` name (`capability_definitions`,\n `affordance_templates`, `action_definitions`, `outcome_templates`,\n `entity_definitions`, … the same vocabulary `spellkave_write_rows` and\n every `spellkave_define_*` verb already use).\n- **Pass `kind` + `id`** for the complete authored row, its source, and (by\n default) its refs — the definition-lookup gap this merge closes. Every\n kind a `define_*` verb (or `spellkave_write_rows`) can WRITE is now also\n readable in full by the SAME name, not just the 4 catalog kinds\n `spellkave_lookup` used to expose. `outbound_refs` lists fields on the row\n pointing elsewhere; `inbound_refs` lists every OTHER row anywhere in the\n resolved source whose own field points AT this row, grouped by\n referencing kind — chase a chain (e.g. a capability → its\n `affordance_templates` → their `action_definitions` → `outcome_templates`)\n by re-calling `spellkave_query` with a ref's own `{kind, id}`; no separate\n traversal tool needed.\n\nLooking up existing ids — in the workspace, and optionally in a\nconnection-level `target` or live db — BEFORE you author against them beats\nwrite-then-fail-on-a-dangling-ref; checking the referenced IDs with `spellkave_query` catches missing\nreferences before the write. Live state can change before commit, so this\ninspection does not replace server admission.\n\n`spellkave_apply_manifest_delta` is the commit step of the authoring loop:\nwrite verbs stage into the workspace scratch; apply sends that\nscratch to whichever **connection-level target** is active —\n\n- **Default call `{}`** — reads `workspace.readToml()` and flushes it (`source:\n \"scratch\"`). No TOML paste, no path/id pointer needed beyond \"commit what I\n just authored\".\n- **Optional `toml`** — escape hatch for an external/ad-hoc delta string\n (`source: \"toml\"`), not the normal path after verbs.\n- `live` — dispatches through the `r_apply_manifest_delta` reducer (upsert\n semantics, validated server-side against live world ∪ delta, ADR-0085).\n Living roll tables are in that union (sk-3h5): a delta that never mentions\n a table still sees its published headers, entries, and die tags, so\n `MF-VAL-317` / `roll_table()` refs cannot skip the world that is already there;\n- `local` — renders/merges the batch into a target folder's own\n `manifest.toml` on disk. It validates that root together with its\n includes and `depends_on` closure, as `sk validate --bundle --dep` does.\n When the call creates a new root with one bundle, it also writes\n `applyset = \"<bundle_id>\"`, which `sk dev seed` requires, and reports\n it as `applyset` in the result. An existing root keeps its own line.\n A write verb's scaffolded `[[bundles]]` header never replaces a bundle\n row the root already has; call `spellkave_define_bundle` to change it.\n\nCalling `spellkave_apply_manifest_delta` with neither a `target` nor the\nlegacy `context.applyDelta` port wired throws, naming both — offline\nauthoring with no configured destination has nothing to flush to. An empty\nscratch with no `toml` also throws (nothing to commit). Workspace authoring\nverbs (`author_place`, `place_entity`, `place_actor`, `define_resource`,\n`define_behavior`) and offline inspect/query work without a connection.\nRunning-world get/describe/diff and live writes require their current connected\nreader or apply port.\n\n`spellkave_apply_manifest_delta` commits a scratch delta. Editing the FILES\nof a root that is already on a world (a seeded root with an `applyset` line)\nis a different loop: `spellkave_applyset_diff` / `sk diff -k <dir>` shows\nwhat changed against the world's applyset memory, and\n`spellkave_applyset_apply` / `sk apply -k <dir>` sends only those rows — no\nhand-built delta, no wipe and reseed (ADR-0145; rules and limits in the `sk`\nREADME, \"Applyset diff and apply\").\n\nTo remove a placed entity from local author files, use\n`sk --target <root> --workspace <scratch.toml> remove_entity --entity-key <exact-key>`.\nUnlike staging verbs, this immediately removes the root-owned entity and its\nowned instance rows from both files. Other scratch rows remain staged. Include\nownership and surviving references refuse with a repair hint. It sends nothing\nto the world; run `sk apply -k <root> --prune --dry-run` to inspect the prune,\nthen apply it explicitly. See the CLI README's \"Remove a placed entity from\nauthor files\" for the local-file and failure contract.\n\nThis comparison loop currently requires exact-publisher baseline access in CLI,\nHTTP MCP and local stdio MCP. A non-publisher receives `baseline_unavailable`\nbefore baseline subscription or enqueue, including a fresh root or `--force`.\nRegional baseline delivery is tracked in sk-jay0.3.24.160; see\n[reading a running world](./reading-a-world.md). Direct binding-only deltas and\nscoped instance reads retain their separate admission lanes.\n\nThe diff also compares readable live values. A seeded row with no applyset\nmemory is `adopt`: equal values establish memory without rewriting the row;\na difference is a conflict. Changed file rows compare against the comparable\nhash recorded at the previous sealed apply. Unchanged files may show drift\nfor inspection without scheduling a write. `sk apply -k <dir>` refuses\nconflicts before sending; `--force` requests that the file values win and\nalso retains takeover and publisher entity-prune overrides. Scoped entity\nprune still requires publisher closure. The result's\n`force_used` array names each override actually used.\n\nThe human report distinguishes world-added rows taken with a pruned entity,\nrows left behind, and authored rows changed in the world since the last\napply. `not_checked` explains missing comparisons rather than claiming\nagreement: unavailable or incomplete caller coverage, unsupported kinds, unread\nlive placement, or older memory without comparable hashes. Current role-scoped\nprojections supply comparison for the eight supported instance kinds described\nin [reading a world](reading-a-world.md). Apply refuses unchecked scoped writes;\n`--force` cannot manufacture missing coverage.\nServer ownership and extent checks still apply to adoption and forced writes.\nThe seeded-adoption/refusal assertions live in\n`crates/spellkave-authoring/src/diff_apply.rs` and\n`packages/spellkave-tool-authoring/src/__tests__/applyset-tools.test.ts`.\nThe [captured AUTH-37 local journey](../../../sandbox/diff-drift-decision/README.md)\nalso proves the actual CLI refusal, explicit recovery and independent world\npostconditions. It runs the workspace-installed CLI in an external temporary\ndirectory. [The scoped reader evidence](../../../sandbox/role-scoped-world-read/README.md)\nalso covers the bound author's source and unchecked-force refusal; hosted\ndelivery and portable publication remain the `.45`/`.56` follow-up surfaces.\n\n## Authority reconciliation during live apply\n\nLive apply is segmented; it is not a transaction over every manifest row.\nRole definitions, aggregations, bindings and all affected realised grants are\nreconciled together in atomic authority segment B, after the earlier structural\nsegment A. Changes cannot leave a partially updated authority set.\n\nAt enqueue the server records the original applying identity and the IDs of\nbindings admitted for realisation. It rechecks live authority before the drain\nwrites: expiry, revocation, current role composition and old/new extent coverage\ncan refuse work that was previously admitted. `$sender` resolves using the\noriginal submitter. The queued sender/verdict fields are server-owned and are\nnot manifest fields, authoring hints or export data.\n\nThe authority unit is bounded to **4096 authority-table row writes**, including\nidentity mirrors and realised grants. This is not a bound on the factual-context\nmaterialisation pipeline, which keeps its existing drain. An oversized authority\nunit is rejected before enqueue rather than divided into partial authority\ncommits (the world API).\n\nIf segment B fails, prior segment A writes can remain. Preserve the submission's\nquarantine and unknown-base state; do not report successful reconciliation or\nclear recovery state because the authority unit rolled back. Inspect live state,\ncorrect the cause and reconcile/resubmit through the existing applyset recovery\nflow. Module migration defaults an old queue's sender to `Identity::ZERO` and\nits optional realised-binding verdict to `None`; queued authority work without\na valid recorded verdict fails closed before authority writes and needs\nresubmission. Authors must not manufacture those hints.\n\nPersistent rollout uses two publishes: first publish this schema-compatible\nmodule with the binding table and defaulted queue/runtime fields while the\npublisher/genesis grant lane remains open. Apply migrated bundles as publisher\non every catalog world, realising bindings and withdrawing the old reserved\ngrants. Follow-up .67 supplies the second publish to close the bare-grant lane.\nPreserve existing authority and queued-state evidence during migration; this\nguide does not claim hosted rollout has been exercised.\n\n## Extent-scoped apply\n\nA presence-held apply grant authorizes rows inside its live extent. A Bundle\ngrant covers definitions and owned root graphs through applyset memory; a\nPlaceGraph or Party grant covers placed edits. The server checks pre-image and\npost-image placement and separately checks targets such as an entity receiving\na capability or state write. A new destination cannot authorize an old foreign\npre-image. The original sender and its admitting bindings are rechecked before\nevery mutation segment; a grant created by the same request cannot authorize a\nlater segment.\n\n`sk diff -k <dir>` uses the shared Rust advisory to show ownership refusals\nbefore sending; placement remains \"server decides\" because it needs private\nlive facts. `sk apply -k <dir>` uses the additive scoped applyset reducer.\nRaw delta consumers retain their existing signatures. The scoped and\npresence-held paths are active; deployed ordinary-body delta/bundle adapters\nremain transitional until `.67` and universal activation `.84`.\n\n| Code | Reason |\n|---|---|\n| `MF-APPLY-037` | Part entry bundle disagrees with its row or root bundle list |\n| `MF-APPLY-041` | Placement, target or placeless row lies outside held extents |\n| `MF-APPLY-042` | Ownership takeover or root bundle claim exceeds held Bundle extents |\n| `MF-APPLY-043` | Authored row exists but no applyset lists it |\n| `MF-APPLY-044` | Non-publisher whole-world replacement |\n\nFor an initial-state `object_state` row that no applyset lists, a raw\nowner-preserving overwrite can follow the entity's target reach while keeping\nthe live stamp. It still needs placement admission. Claiming memory, changing\nthe stamp or retracting that satellite additionally requires all target owners\ninside the writer's Bundle extents, with at least one owner (`042`). Listed\nstate rows retain ordinary ownership checks. Do not restamp runtime state to\nmake a scoped request pass; `.91` supplies ownership at its actual cause.\n\nAldwin has a publisher-authored Bundle binding over `elven_mini`. Its regional\nbinding admits placed edits and its Bundle binding admits own-adventure\nprompt definitions. The interim prompt consumer claims one explicit adventure\nbundle per prompt root, supports identical retry and retirement, and refuses\nprompt IDs outside `<adventure>/prompt/runtime/`; `.92` owns its runtime-state\nreplacement. Shared `dm` and foreign-adventure definition edits remain refused.\n\nThe applier and publisher can read `applied_by` and `applied_via` through\n`visible_manifest_apply_provenance` and existing manifest/applyset readers.\nUnrelated callers see commit metadata without principal fields. Denied enqueue\nwrites no memory; later refusals preserve earlier admitted commits and the\nexisting quarantine/unknown-base recovery. The live admission and independent\nobserver controls are in `extent-scoped-apply.live.test.ts`; the scope and\nsatellite unit controls are in the world API.\n\n## Live authoring: role grants and character binding\n\nA second live apply needs continuing manifest admission after genesis. An\nadmitted grantor creates a [role binding](./roles.md#bind-a-role-to-a-subject)\nthrough [grant_role](./grants.md), giving the author the role and explicit\nextent needed by its later operations. Role vocabulary alone and inert bindings\nsupply no live authority. `spellkave_bind_actor` directs `frontier.*` requests to\n`spellkave_grant_role`; it writes character identity and ordinary gameplay grants:\n\n```jsonc\n{\n \"bundle\": \"us_dungeon\",\n \"entity_key\": \"us_dungeon/npc_1\",\n \"capabilities\": [{ \"capability_id\": \"core/walk\", \"source\": \"core\" }]\n}\n```\n\n`identity` defaults to `$sender`, resolved to the original applying connection.\n`capabilities` defaults to `[]`: omit it for identity-only binding. A privileged\nrole grant realizes a separate presence body; it does not attach authority to\nthis playable character. The low-level publisher/genesis bare-grant adapter\nremains transitional until `.67`; the character tool uses role grants for\nprivileged requests.\n\nA manifest-written identity binding has `connection_id: None` and survives\ndisconnects. Ordinary character binding upserts remain distinct from role-bound\nNPC membership: changing the latter requires covering D6 bind rights, even for\nan existing transient claimant with separate apply authority. Before starting\na role-bound NPC host, the publisher/operator applies its retained identity as\na durable primary binding. The host claims that existing binding, which keeps\nit durable. An already durable self-bind can be a no-op; a connection-scoped\nclaim cannot bootstrap presence authority by applying its own `$sender` delta.\nSee [NPC bootstrap](./dm-oversight.md#the-default-the-publisher-bootstraps-the-npc-host).\n\n`spellkave_bind_actor` requires an existing `actor_spatial_locations` row; place\nthe character first with `spellkave_place_actor`. Role presence bodies are\ncreated by binding reconciliation and are not placed or claimed through this\ncharacter tool. The same optional `capabilities` array remains useful for\nordinary gameplay grants such as `core/walk`; see\n[movement gates](./running-an-authored-act.md#movement-gates-capability-reach-are-independent)\nfor the separate capability and movement-resource checks.\n\n## When a verb refuses\n\nEvery write verb validates its own inputs and, separately, re-validates the\nWHOLE merged workspace manifest before persisting anything — a call whose\nmerged manifest carries a **blocking** diagnostic is rejected and nothing NEW\nis written. Which diagnostics block depends on the verb\n(`commitOrReport`'s `blockOn` in\n`packages/spellkave-tool-authoring/src/authoring-verbs.ts`):\n`spellkave_write_rows`, `spellkave_set_metadata`, `spellkave_define_bundle`,\n`spellkave_define_trace_kind`, and the catalog `spellkave_define_*` verbs\n(entity type, roll table, condition, niche, affordance, capability,\nconsequence, action, session, action verb) block on `fatal` only; the\nremaining write verbs (place, actor, entity, resource, behavior, …) block on\nany diagnostic. With a connection-level `context.target` wired, every verb\nblocks on `fatal` only. Non-blocking warnings are returned but do not stop\nthe write.\nThree distinct failure shapes, in the order a call actually hits them:\n\n- **A parameter-shape violation** (e.g. a placement tool called with both\n `at` and `placements` set, or neither) is rejected before any row is even\n generated, and the call **throws**, naming the offending parameter(s)\n directly.\n- **A missing structurally-required field** on a `spellkave_write_rows` row\n (e.g. an `entity_definitions` row with no `display_name`) also **throws**\n — this fails at the row-rendering step, before the validator ever runs,\n because the field is required by the row's own Rust schema shape, not\n merely checked by a validator pass. The thrown message names the missing\n field, but it is a schema/parse-level error, not an `MF-VAL-nnn`\n diagnostic — the narrower `spellkave_define_*`/`spellkave_place_*`/\n `spellkave_author_place` verbs never hit this shape at all, since they\n only ever expose parameters for fields their own TypeBox schema already\n makes required.\n- **A blocking validator diagnostic** proper (e.g. a dangling reference like a\n `capability_id` that resolves to no authored row) surfaces the validator's\n own diagnostic — including its `MF-VAL-nnn` code — **gracefully, in the\n tool result** (`details.ok === false`, never a thrown error), mapped back\n to the offending row/param (`details.diagnostics[].param`), never a bare\n TOML line number in a document you never wrote by hand.\n\nIf you hit an intent no documented row kind or DSL form can express, call\n`spellkave_declare_inexpressible` — a well-justified \"I cannot express\nthis\" is a successful finding, not a failure. If the packaged docs\nthemselves led you to expect different validator behavior than what you\nobserved, call `spellkave_note_doc_gap` — it does not end your run, and it\nis exactly how promises like the ones this doc makes get corrected.\n",
189
+ "grants": "# Granting and recovering runtime roles\n\nUse `spellkave_grant_role` for live role authority and `spellkave_bind_actor` for\ncharacter identity and ordinary capabilities. A realized role binding has its\nown presence body. The server evaluates D-6 from the caller's current directly\nbound primary/presence bodies: exact `frontier.bind.<role_id>` over the binding\nextent, or every nonempty final merged role capability over that extent.\nSummoner edges and extent-blind `frontier.apply_manifest` grants supply no D-6\nright. Publisher admission remains available. Discovery is advisory; each call\nchecks current authority again. See [roles](./roles.md) for the ordinary-content\ninert insertion and transitional author lane.\n\n## Grant and revoke\n\nA connected publisher or admitted grantor can run:\n\n```bash\nsk --live grant dm 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef forest --extent-kind place_graph\nsk --live grants list --role dm\nsk --live revoke '<binding_id from the grant receipt>'\n```\n\nThese are synthetic subjects/extents; replace them with existing world facts.\nA community grantor needs D-6 for the chosen role and extent, without separate\napply/prune privileges. Rewrites need both old and new authority. A mixed delta\nstill needs ordinary author admission for its other rows. Runtime requests are\nworld-owned (`bundle_id = \"\"`) with no applyset memory or reserved grants bundle,\nfollowing ADR-0154 D-2/D-6 (Proposed planned canon). Workspace grant composition\nretains the selected authored bundle. Runtime grants survive authored bundle\nreapply; scripted bindings follow their bundle replacement/retraction contract.\n\nThe `grants/v1/` natural key encodes role, concrete subject, extent kind and\nreference unambiguously. `$sender` becomes the authenticated caller before key\nconstruction. Repeating an authorized unchanged grant is idempotent; expiry or\ndescription changes update that tuple. Requests check at enqueue and immediately\nbefore one atomic mutation. The batch bound is 128 mutations and 256 KiB of\ncanonical serialized manifest JSON. Oversized expansions refuse before staging.\nThe live test `grant-verb.live.test.ts` checks direct/tool transport parity,\nrevocation, mixed edits, authored storage refusal and queued loss of authority.\n\nA revoke confirms the binding is absent from its caller connection before\nreporting success. If it reports `binding remains`, treat that grant as active\nand inspect `sk --live grants list`; an earlier successful revoke does not\nconfirm removal after the same binding was restored. The command reports\nfailure instead of silently treating the earlier request as a new removal.\nIf current read authority cannot confirm absence, it reports an unconfirmed\nfailure; inspect with a principal that can still read/manage that binding.\n\n## Whole-world snapshot\n\n```bash\nsk --live grant dm '$sender' '*' --extent-kind place_graph\n```\n\n`*` is tool input only. The tool requires the server-computed complete expansion flag for the selected role and expands the admitted current root-graph and bundle inventory into explicit bindings, sorts/deduplicates it, previews every\nrow, and submits one batch. Missing or incomplete inventory, one denied extent or an\noversized batch refuses the entire operation. No world extent is stored. Later\nloaded roots/bundles require another grant. The receipt records tick, digest and\ncovered extents. Individual descriptions mention only their own extent, so a\nrecipient does not learn unrelated inventory through a binding description.\n\n## Private list and export\n\n`sk --live grants list` reads the server-filtered binding view. The publisher\nsees every row. Other callers see their own identity bindings, durable-primary\nNPC bindings and bindings manageable by D-6; inaccessible rows, counts and metadata are omitted. Grant inventory likewise omits root places the caller cannot bind; metadata-only role headers reveal completeness without naming omitted places. Subject-only descriptions are stripped. Opaque revocation\nrefuses absent and inaccessible IDs identically. `spellkave role-binding\nlist|inspect|inventory` and `spellkave doctor` provide the observability triplet.\n\n```bash\nsk --live grants export --out runtime-grants.json\n```\n\nThe portable `spellkave-grants/v1` export contains world-owned authored binding rows,\nconcrete subjects and a receipt with source endpoint, existing world instance,\nsource tick, original expiry, coverage and digests. It excludes derived presence,\ncapabilities and actor identity state. A publisher export is complete; a\nnonpublisher export is scoped and cannot be a full-world backup. Hosts without a\nfilesystem receive the artifact in the canonical tool result. Hosted MCP routing\nis transitional under `authority-tools-over-mcp` (`sk-jay0.3.24.45`); this guide\nclaims the local CLI/Pi contracts and portable artifact only.\n\n## Restore after reset\n\n```bash\nsk --live grants restore runtime-grants.json\nsk --live grants restore runtime-grants.json --rebase-expiry\nsk --live grants restore runtime-grants.json --rebase-expiry --apply\n```\n\nThe default is preview. Same-instance restore preserves absolute expiry. A\nchanged world instance requires explicit `--rebase-expiry`; expiry becomes the\ndestination tick plus remaining simulated ticks at export. Export tick 90,\nexpiry 100 and destination tick 3 becomes expiry 13. Permanent rows remain\npermanent; source-expired rows refuse. Downtime advances no simulated ticks.\nThe artifact/plan digests and destination identity, endpoint and instance are\npinned; application rechecks current D-6 and the expected instance on the server.\nRaw TOML replay has no export epoch receipt and cannot establish this recovery\npolicy. Restoration refuses tampered artifacts, changed destinations and\nunauthorized callers; it never silently extends expiry across resets.\n\nBefore a hosted reset, the release operator must obtain a complete publisher\nexport, preserve its receipt, seed required vocabulary, preview against the new\ninstance, then explicitly apply. Reset and restore are operator decisions, not\nautomatic tool side effects. See the change's release evidence for preservation,\nfeature disable and privacy-preserving compatibility constraints.\n\n## Hand over one binding\n\nPreparation reads the current row under the caller's own credentials:\n\n```sh\nsk --live grants prepare-hand-over '<binding_id>' '<backup identity or authored NPC key>'\n```\n\nCopy its `expected_digest`, `expected_merged_role_digest`, `expected_incarnation`\nand `expected_revision` into the explicit commit. Generate a fresh UUID once for\nthis operation and retain it across retries:\n\n```sh\nsk --live grants hand-over '<binding_id>' '<backup subject>' \\\n --expected-digest '<reviewed digest>' \\\n --expected-merged-role-digest '<reviewed merged role digest>' \\\n --expected-incarnation '<reviewed incarnation>' --expected-revision '<reviewed revision>' \\\n --request-id '<retained UUID>' --reason 'Backup takes over this region'\n```\n\nThe shared tool contracts are `spellkave_prepare_hand_over` and\n`spellkave_hand_over_role`. Hosted MCP routing is transitional until\n`authority-tools-over-mcp` (`sk-jay0.3.24.45`); portable guide publication belongs\nto `.56`. The CLI uses the same execution body and actual caller identity.\nThe server checks D-6 over both values at enqueue and atomic commit. Being the\ncurrent holder alone supplies no bypass. Before admission, missing bindings,\ncorrect-holder guesses and stale pins produce the same private refusal. There\nis no recipient accept step in this version: covering old/new D-6 admits the\ntransfer, and the recipient can resign a runtime binding with the existing\n`sk --live revoke` command. Future recipient acceptance is an explicit operator\ndecision in `sk-jay0.3.24.163`; personal control still requires its own consent. Transfer changes only subject and\npreserves the presence, role, extent, note and exclusive expiry. It cannot be\ncombined with another row, retraction or scope edit. An unchanged/inert row or\nnew grant does not require transfer preconditions.\n\n`binding_preconditions` is a typed optional manifest array containing those\nfour reviewed values, `binding_id`, `request_id` and `reason`. Digests use\n64 lowercase hexadecimal characters; revision is a decimal u64 wire string.\nReason must contain non-whitespace text within 1024 UTF-8 bytes. Incarnation and\nrevision are server-owned; every binding upsert advances revision, and a newly\ncreated row gets a fresh incarnation. A restored export supplies neither.\nA stale role, binding, expiry, away-and-back transition or natural-key reuse\nrequires a new preview. A successful receipt is the completion boundary;\npreparation and enqueue alone are not completion. An identical retry returns\nthat sender-bound receipt; altered request content refuses.\n\nThe optional authored `handover_note` contains shared plain text, bounded to\n16384 UTF-8 bytes. Its edits use ordinary old/new D-6. It is private metadata\nand cannot grant authority or execute instructions. Grant export includes it\nonly for caller-visible bindings; default export includes no transfer receipts\nor personal client conversations. A default grant backup preserves expiry;\nreset/restore never fabricates old receipts or old concurrency stamps.\n\nPreparation reports its source tick and separate request/job coverage.\n`outside_read_scope`, `reader_unavailable` or `incomplete` means unavailable or\npartial context; an empty list under such status is not evidence of no work.\n`payload_redacted` gives authorized headers with private payload withheld.\nThe projection intersects caller-authorized regional reads with the selected\nbinding's bounded spatial closure. Held blockers likewise report only admitted\nbodies in that closure. A preview is not a frozen snapshot.\n\n| Context | After transfer |\n|---|---|\n| Shared note, presence and grants | Attached to the same binding |\n| Pending requests and authority-only jobs | Same IDs and deadlines; landing rechecks current authority |\n| Independent grants and character claims | Retained by their original principal |\n| Personal steering and queued co-pilot work | Old selected generation invalidated; recipient needs their own consent |\n| Held NPC control | Remains suspended for the old holder; explicit return or publisher recovery precedes a new acquisition |\n| World pause and timekeeper | Unchanged; handover creates no independent clock authority |\n\nInspect history using `spellkave role-binding hand-over list` or\n`spellkave role-binding hand-over inspect '<request_id>' '<binding_id>'`.\n`Line::RoleBindingTransfer` and doctor `role_binding_transfer_integrity` use the\nprivate caller projection. Publisher, immutable old/new principal parties and\ncurrent D-6 administrators can inspect permitted metadata. An old receipt gives\nno current briefing right. Deleted bindings and expired transient apply records\nremain valid history; runtime reset clears it. Receipt logs contain only binding,\nrequest and revision references, without shared-note text or a copied briefing.\n\nPublish the schema/server before consumers send the new optional fields;\nconsumers feature-detect both handover views and refuse unsupported modules.\nIncremental publication preserves legacy binding rows with defaulted runtime\ncolumns and the existing held-control stamp of an untouched migrated row. Its\nfirst binding write permanently advances to a versioned stamp; new or recreated\nbindings cannot restore the legacy sentinel. Deploy matching generated bindings\nafter the schema upgrade: current bindings decoding predecessor row layouts are\nunsupported, and tool feature detection does not promise that decoding.\nTake an operator backup before a persistent deployment and verify\nbinding/presence/seat counts afterward. Rollback disables new tools first and\nuses a compatible build retaining guarded subject edits, privacy and receipt\nstorage; reopening the unguarded predecessor violates the security floor.\nFreeze grant writes if no compatible rollback exists, then forward-recover.\nThe hosted activation/pairing, rollback and eventual legacy-stamp branch retirement\nobligations are tracked in `.145`; retirement requires an inventory showing no\nuntouched migrated sentinel rows remain.\nLocal production/queued captures and the preservation/compatibility-build\nrehearsal are linked from the [handover evidence report](../../../sandbox/role-binding-hand-over/README.md).\nThe examples prove the named local caller surface; `.45` and `.56` own hosted\nrouting and portable publication, respectively.\nNo hosted reset is required or authorized by these local changes.\n",
190
+ "grid-anchor-forfeits-kill-zone": "# Placing an actor's manifest position on a session's grid ANCHOR node forfeits its authored kill-zone cell — it row-major-falls-back instead\n\nAn actor's `combat_grid_blueprint` seat is normally snapped from its authored\n`place_node_id` via `materialise_tactical_grid` (the \"seating naht\":\n`tactical-scene-graph-model` (open with `sk docs tactical-scene-graph-model`)\n§\"The ONE substrate change\"). That snap only fires when the actor's\n`source_node` differs from the session's grid anchor node — if you place an\nactor's `entity`/`actor_spatial_locations` rows AT the same node the session\nopens on (e.g. to satisfy a same-node predicate like communicate-scope\ncomprehension, #1871), `source_node == anchor_node` and `assign_grid_seats`\ntreats it as unpositioned: it gets whichever cell row-major pass 2 assigns\nnext in participant order, NOT its old authored cell. Leftover positions on\nan ephemeral tactical-grid instance\n(`place_graph_definition.is_ephemeral_instance` — typically a prior\n`session_grid_*`, never a name-prefix sniff) are also treated as unpositioned:\nsession-open ignores them and row-major-seats the participant on the new grid;\n`pre_session_place_node_id` falls back to that new grid's `anchor_node_id`\nrather than recording the leftover cell (BL-76). Two consequences to\nplan for: (1) any walkthrough/beat asserting a specific post-open grid cell\nfor that actor (`c_X_Y` in a `hero.move()`/melee-range check) breaks and must\nre-derive the cell empirically rather than assume the pre-relocation\nposition; (2) the authored kill-zone spread\n(`manifest-format` (open with `sk docs manifest-format`)\n`[[combat_grid_blueprints]]` §`edge_overrides_json`) degrades for that actor —\nacceptable for a deliberate same-node confrontation trade-off, not something\nto do accidentally.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
191
+ "has-item-dead-in-manipulate": "# `has_item` works inside a manipulate predicate — RETIRED gotcha, kept for readers of old manifests\n\n**This gotcha no longer applies.** Since bead sk-vjh.7,\n`actor.has_item('<item_def_id>')` is a real possession gate inside an\n`r_manipulate` action predicate. `manipulation_facts`\n(the world API)\nnow collects the items the acting body directly carries — every\n`entity_containment` row whose `container_id` is the body, equipped or loose —\ninto the Actor `items` fact pool, so the predicate reads true at offer\n(materialiser) time and at act (`r_manipulate`) time alike. Proof anchor: the\nunit test `manipulation_facts_expose_carried_items_to_has_item` in that same\nfile. The `dead-manipulate-has-item` lint rule that used to flag this shape is\nretired too, so `spellkave-author manifest lint` no longer warns.\n\nWrite the gate the obvious way:\n\n```toml\n[[affordance_templates]]\ntemplate_id = \"my/affordance/gift_comb\"\npredicate_source = \"actor.has_item('my/item/silver_comb')\"\n```\n\n## The `RemoveItem` prevalidate shape is still right — for a CONSUME\n\nA `RemoveItem` frame_write is the idiom for an action that **spends** the item.\n`apply_consequence_with_bindings` prevalidates every frame_write before\nexecuting any of them (`remove_item::prevalidate` -> `resolve_source_item_id`),\nso a stack the actor does not hold aborts the whole consequence atomically. Use\nit for drinking a potion or firing a piece of ammunition. Do not use it as a\n**possession gate** for an action that leaves the item in hand — that was the\nworkaround for the dead pool, and it made a keep-the-item action consume it or\nforced a compensating re-grant. A gate that keeps the item belongs on the\npredicate. See [`consumable-inventory-consume`](../patterns/consumable-inventory-consume.md).\n\n## History\n\nBefore sk-vjh.7, `manipulation_facts` left the DSL `items` pool at its empty\ndefault. Only `r_move`'s `traversal_affordance_facts_from_bindings` populated\nit, so `has_item(...)` was true only inside an edge-traversal predicate and\nsilently false everywhere else — a dead half of an `&&` chain that shipped\nunnoticed more than once. Manifests written in that era route around it: they\ngate on a resource or state flag toggled by an explicit act, or they lean on a\n`RemoveItem` prevalidate to reject the attempt. Those manifests still work.\nThey are no longer the recommended shape, and prose anywhere claiming\n`has_item` is dead in a manipulate predicate predates sk-vjh.7.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
192
+ "hosted-authoring-guidance": "# Hosted compound workflows — evidence and remaining stories\n\nStatus: **local scene setup verified; atomic DM hand-over planned**.\nThis combined reference retains planned publication status and is excluded from\nsupported discovery while the hand-over story remains unexecuted. Public docs and\ncaller-owned presence/payload tools are described in the supported\n[hosted workflow](./hosted-authoring-workflow.md).\n\n## Goal and remaining owners\n\nNamed scene setup is implemented by `parameterized-scene-setups`\n(`sk-jay0.3.24.50`). The [scene guide](./parameterized-scenes.md) describes its\npreview, separate graph/population commits, partial receipts and cleanup limits.\nThe [owning captures](../../../sandbox/parameterized-scene-setups/README.md)\nverify installed CLI and real caller HTTP MCP on a disposable local node, including\nsource guards and reset. They do not certify a persistent hosted deployment,\nexternal client or unaided discovery.\n\nAtomic transfer of DM responsibility still requires `role-binding-hand-over`\n(`sk-jay0.3.24.47`). Its owning usage artifact must supply runtime and consumer\nproof. This reference supplies no successful captured interaction for that story.\n\n## Available reference\n\nThe packaged [Patternbook](./patterns/index.md) explains compositions. A source\nexcerpt retains its explicit dependencies; reading it neither validates a world\nnor executes an example. Existing public documentation and presence selection do\nnot certify these compound workflows or confer any role.\n\n## Evidence status\n\nAUTH-56-02 requires an unexecuted story to retain its planned status. CLI, MCP and\nweb readers can open this combined reference, but supported search does not\nadvertise its remaining hand-over story as a usable workflow. Retrieve the scene\nguide for the implemented local operation and inspect the tools actually offered\nby your connection; documentation alone does not establish hosted availability.\n",
193
+ "hosted-authoring-workflow": "# Author or run a session through hosted tools\n\nPublic help uses `spellkave_docs` without a character or author grant. It reads\ncurated package content; it never selects a role, opens a file or executes an\nexample. The connector still requires its normal authentication. Start with\n`query: \"container loot\"`, retrieve `doc: \"patterns/container-with-loot\"` and\nuse `section` or `full` when needed. Replies identify the corpus and document.\n\n## Choose your context\n\nInspect the tools offered by this connection. A presence-only author can have\nauthoring tools without PLAYER movement tools. A DM's abilities come from the\ncurrent role and extent, not the persona name. Call `spellkave_acting_context`\nto read your admitted choices, then pass its returned `binding_id` to that same\ntool when you need a particular presence. Use returned identifiers; examples do\nnot supply a real world or binding ID. Foreign and revoked presences are refused.\n\nA caller without live authority can still read public help. A missing live tool\nmeans this connection cannot run that operation. Help grants no rights; do not\nsubstitute a publisher credential. Multiple candidate worlds produce the typed\n`ambiguous_authority_world` refusal. Its `public_tools` descriptor still identifies\npublic help; a direct `spellkave_docs` call remains available without world routing.\n\n## Prepare a portable change\n\nThe non-publisher MCP diff/apply workflow is temporarily unavailable after the\nprivate applyset baseline cutover. HTTP and local stdio author callers receive\nthe typed `baseline_unavailable` refusal before baseline subscription or enqueue,\nincluding for a new logical root or `force`. Tool discovery does not grant\nbaseline access. Publisher reconciliation retains its operator-view route;\nregional comparable baseline delivery is tracked in sk-jay0.3.24.160. Scoped\ninstance reads and direct binding tools retain their separate admission checks.\n\nWith publisher baseline access, use the offered `spellkave_applyset_diff` and\n`spellkave_applyset_apply` contracts.\nHosted input supplies `source` with `root_path`, `root_toml` and `fragments`.\nThese are logical file names and content, not server paths. Supply every include\nfragment. A path-only request is refused with payload recovery guidance; source\nis bounded to 1 MiB decoded UTF-8 and 128 fragments. Read the returned diff and\ncoverage before applying. Missing scoped observations cannot be overridden by\n`force`; the live server rechecks the caller's current authority.\n\nThe selected container example is an excerpt with bundle, place, SRD and actor\nprerequisites. Retrieving it does not assemble its dependency closure or prove\nlive pickup. Use the guide's explicit prerequisites and the offered schema.\n\n## Read or act within your scope\n\nUse the offered instance-read and gameplay tools. Scoped reads admit only the\ncaller’s current read depths and extents. Selecting a presence does not turn\npublic docs into a world reader. Mutation, time control, steering and consent\nretain the feature's server checks; tool discovery is not an authorization grant.\nThe [player loop](../../spellkave-tool-player/docs/player-loop.md) explains\nordinary observation, attempt and refusal recovery.\n\n## Evidence and limits\n\nThe [authority transport proof](../../../sandbox/authority-tools-over-mcp/README.md)\nrecords AUTH-45-01/02 on a disposable node with real caller HTTP and local stdio\nMCP, portable inputs and independent state assertions. Its named historical\ncaptures predate private baselines. The current AUTH-45-01 and local stdio cases\nrequire typed baseline refusal and unchanged publisher reconciliation and role\ninventories. The paused-revoke case owns its retained viewer binding through\npublisher setup, preserving its revocation assertions independently of payload\napply. AUTH-56-01/02 extend that consumer route with public-docs search,\nno-authority/presence-only/DM retrieval, private-state absence, planned status and\nrefusal recovery. These native transport proofs do not certify a deployed\nconnector, live WorkOS login, external Claude application or unaided discovery.\nDocumentation revisions do not certify world behavior. Missing server version\nevidence remains `unknown`.\n\n[Scene setup](./parameterized-scenes.md) under `parameterized-scene-setups` (.50)\nhas installed CLI and real caller HTTP MCP proof on a disposable local node;\nits captures do not certify a persistent hosted deployment. Atomic DM hand-over\nunder `role-binding-hand-over` (.47) remains\n[planned](./hosted-authoring-guidance.md), with no passing badge for that\nunexecuted story. Inspect this connection's offered tools before attempting either\noperation.\n\n## Scenario evidence\n\nAUTH-56-01/02 cover public discovery, caller-owned context, planned stories and\nrefusal/recovery through the native real-caller route. Retrieve\n`evidence/auth-56-hosted-mcp` for its named implementation and surface, independent\nassertions and complete journey cost; `evidence/auth-56-hosted-mcp-transcript`\ncontains the complete sanitized guidance RPC frames. These scoped historical\ncaptures remain distinct from the current corpus that embeds them and do not\ncertify a deployed service or external login.\n\n## Delegated live definition edits\n\nA hosted world's live `adventure-author` may use the Account API publisher Job\nservice with their own JWT bearer. `adventure-author` is full trust in that world:\nthis delegation covers definitions and descriptions as well as instances, across\nthe selected world even when the binding names a smaller extent. ANY live\n`adventure-author` binding grants world-wide publisher-level delta authority\nthrough this service; grant only to fully trusted accounts. An Account owner,\noperator, DM without author role, or author of another world has no implicit right.\n\nFrom a shell with the repository tools installed, provide your own bearer through\n`SPELLKAVE_OPERATOR_TOKEN` (do not print it) and run:\n\n```bash\nbin/skop --jwt world-delta <world-slug> /path/to/delta.toml\n```\n\nThe CLI submits `POST /v1/worlds/:slug/manifest-deltas` with `{ \"toml\": \"…\" }`,\nthen follows `GET /v1/worlds/:slug/manifest-delta-jobs/:jobId`. This is the hosted\nalternative when `spellkave_apply_manifest_delta` refuses a definition edit;\nthe MCP tool itself retains its scoped admission. Portable applyset diff/apply\nstill needs regional baselines and may return `baseline_unavailable`.\n\nSupply a complete delta, including `schema_version` and the full `[[bundles]]`\nheader for the changed bundle. Canonical ADR-0085 validation/upserts still apply.\nRe-declare a containment parent (`MF-APPLY-026`); entity retractions use\n`bundle:entity_key`. Missing apply authority (`MF-APPLY-015`) or a drain watchdog\n(`MF-APPLY-029`) is a refusal/uncertain outcome, never permission to retry blindly.\nThe payload limit is 16,384 characters. Publisher credentials stay in the Job.\n\nAdmission is valid for five minutes for that exact delta and world instance.\nRevocation stops subsequent admissions; it does not cancel already admitted work.\nA 202/job ID is not success. Wait for the bounded `world-delta/v1` receipt: CLI\nexit 0 means confirmed apply; exit 2 means refused or unconfirmed. Only the caller\ncan retrieve its receipt. Save the delta hash and Job ID, inspect uncertain world\nstate before retrying, and have a player observe the next ordinary read. Patches\nare silent; author an in-world signal when a player should notice the DM's change.\n\nDelegated content deltas refuse role bindings, definitions and aggregations,\nincluding their retractions, with `delta_role_changes_forbidden`. Use the explicit\nrole-management path for role changes. Capability definitions remain content and\nmay be edited. Invalid TOML is refused at admission with `delta_invalid_toml`;\nordinary content still receives canonical manifest validation in the Job.\n\nThe status route retains your original TOML, delta SHA-256 and terminal receipt\nafter executor Job expiry. Evidence lives in the publisher-only control journal\nand is returned only to the requesting account.\n",
194
+ "hosted-world-observability": "# Hosted-world observability for authors\n\nA world you own on the hosted runtime has a **scoped** observability\nsurface on the Account page (`account.spellkave.com`). It answers \"what\nare my NPCs doing\" and \"did that tool call fail\" for **your** worlds\nonly.\n\nThe hosted Account page is the author-facing observability surface (ADR-0108\nD-2). The browser talks to `/v1/author/worlds/{slug}/observability/*` on\nthe Account API; that process queries the sink with the operator\ncredential and drops any row whose `world_slug` is missing or is not\nthe owned slug (ADR-0117).\n\n## What you can see\n\n- NPC cycle health per seat (count, error count, average duration, last seen).\n- `tool_call` outcomes, split ok/error, with tool names from the\n adventure-declared roster (`metricsVocabulary` / tool-contracts).\n Unlisted names collapse to `other`.\n- Recent run events with the OTLP-safe field allowlist\n (`OTEL_SAFE_EVENT_DATA_FIELDS`), including `cause_id` when present.\n\n## What you cannot see\n\n- Another author's world, even if you are a member of it.\n- Rows that never received a world slug (they are dropped, not shown).\n- Player speech, intents, raw OAuth subjects, tool arguments, or the\n sink URL/credential.\n- A composable dashboard builder. The panels are curated; Perses is not\n the author surface.\n\nPlayers remain on `spellkave_feedback`. Local JSONL run artifacts stay\nthe local/CI record (ADR-0074) and are not this hosted view.\n\nBinding decision: ADR-0117 (author-scoped observability is a control-plane\nread, not a sink login).\n",
195
+ "index": "# Authoring docs — corpus index\n\n<!-- GENERATED by scripts/generate-authoring-docs-index.ts. Do not edit by hand. -->\n\nEvery doc in the composed public corpus, grouped by kind, with a one-line\nsummary from its owning metadata. World-author owns authoring prose and\npatterns; CLI owns its workflow guide. This is the same corpus `spellkave_docs` serves to an\nauthoring agent — this page exists for browsing it as plain markdown (GitHub\nrender, no external site generator) instead of calling the tool or reading\n`corpus.ts` source. 125 docs, 7 of them worked\n`.toml` examples.\n\nNew here? Start at [`README.md`](./README.md) (`onramp` — AUTHOR + PLAYER tools).\nAUTHOR verb deep-dive: [`getting-started-with-verbs.md`](./getting-started-with-verbs.md).\nSomething broken? Troubleshooting repairs below, or `sk docs --query \"<symptom>\"`.\n\nThe PLAYER/DM tool surface is a separate registry in a separate package, not\npart of this corpus — see\n[`../../spellkave-tool-player/docs/tool-reference.md`](../../spellkave-tool-player/docs/tool-reference.md).\n\n### Onramp — start here\n\n| Doc | Summary |\n|---|---|\n| [`onramp`](./README.md) | Start-here: AUTHOR + PLAYER tools, with TOML as the underlying model — not a gotcha encyclopedia. |\n\n### Guides\n\n| Doc | Summary |\n|---|---|\n| [`action-economy`](./action-economy.md) | Author fiction-ms channel pools, action costs, boundary refreshes, condition modifiers, and autonomy firing modes. |\n| [`authoring-process`](./authoring-process.md) | The shared query-first, pre-check, proof-then-escalate process every authoring agent role builds on. |\n| [`behavior-composition`](./behavior-composition.md) | Turn one declarative ActorBehavior object into the full capability/outcome/affordance/action/consequence chain. |\n| [`can-i`](./can-i.md) | Ask a running world whether one body may perform one action now, and which check decides. |\n| [`cli/workflows`](./../../spellkave-cli/docs/cli-workflows.md) | Choose the authoring or player loop, inspect arguments, recover a refusal and prove a supported change using the installed CLI. |\n| [`containment-policies`](./containment-policies.md) | Author definition defaults and instance overrides for perceived contents and removal access, preserving personal possession. |\n| [`damage-type-routing`](./damage-type-routing.md) | Author typed damage via a delta_source DSL expression that reads target resistance/immunity tags. |\n| [`dm-oversight`](./dm-oversight.md) | Bind a DM role to a principal through a separate presence body, with bounded read oversight and authorised handover. |\n| [`find-an-authoring-pattern`](./find-an-authoring-pattern.md) | Search by task, retrieve a complete pattern and worked example, and distinguish source evidence from installed or hosted proof. |\n| [`getting-started-with-verbs`](./getting-started-with-verbs.md) | AUTHOR verb deep-dive (4-call fireball) linked from onramp — not a rival start-here door. |\n| [`grants`](./grants.md) | Delegate roles as the caller, inspect private bindings, expand a complete world snapshot and export/restore with explicit expiry recovery. |\n| [`hosted-authoring-workflow`](./hosted-authoring-workflow.md) | Retrieve public help, choose a caller-owned presence and use offered scoped portable tools without server files. |\n| [`lingering-hazard-zones`](./lingering-hazard-zones.md) | Author a self-pulsing hazard zone (Cloudkill, Stinking Cloud) that damages occupants each round, then fades. |\n| [`long-running-actions`](./long-running-actions.md) | Author actions with real in-world duration (rituals, crafting, rests): the §5.10 promotion threshold, busy allow/break predicates, authored expiry, and opt-in resumable progress. |\n| [`metadata-attachments`](./metadata-attachments.md) | Validated annotations (provenance, art, narration, persona) that are for humans/tools, never server behavior. |\n| [`parameterized-scenes`](./parameterized-scenes.md) | Preview a data package, explicitly stage separate graph and population phases, and inspect partial receipts and cleanup limits. |\n| [`patterns`](./patterns/index.md) | Problem-indexed pattern catalog (extra action, hazards, XP grants, dialog slots, …) — look here before filing a kernel gap. |\n| [`patterns/actor-carried-feature-verb`](./patterns/actor-carried-feature-verb.md) | A granted class feature (Second Wind, Rage, Channel Divinity) must be usable wherever the hero is — in the tomb, not only at the room where it was granted — and spend its own uses. |\n| [`patterns/advancement-choice`](./patterns/advancement-choice.md) | I need a choose-N menu (fighting style, subclass, ASI-or-feat, expertise) that a DM dialogue can render without hardcoding the member list in TypeScript. |\n| [`patterns/advisory-action-cue`](./patterns/advisory-action-cue.md) | Several actions can be factually visible at once. An author wants to make a natural next step easier to discover (for example, speaking to a person or taking a visible exit), but … |\n| [`patterns/advisory-action-default`](./patterns/advisory-action-default.md) | Advisory Action Default |\n| [`patterns/before-filing-a-kernel-gap`](./patterns/before-filing-a-kernel-gap.md) | Three lanes filed Action Surge as a kernel gap although `extra-action-budget` existed; two filed \"concentration needs damage facts\" although condition hooks existed. Canon-warden … |\n| [`patterns/blueprint-instance-override`](./patterns/blueprint-instance-override.md) | My scenario needs an NPC or encounter that \"is a Commoner\" / \"is a Goblin\" / \"is three wolves at the bridge\" — how do I place it without re-typing the stat block, and how do I cha… |\n| [`patterns/bundle-movement-default`](./patterns/bundle-movement-default.md) | I want every edge in my bundle's place graphs to be walkable with the standard step policy and reach budget, without authoring a `place_edge_affordance` row on each edge. |\n| [`patterns/companion-combat`](./patterns/companion-combat.md) | A friendly companion should follow the hero out of combat, fight with a named combat role when a scene session opens, never target the hero, and optionally spend a healing consuma… |\n| [`patterns/companion-follow`](./patterns/companion-follow.md) | After a quest, an NPC should follow the hero along place-graph edges without a kernel pathfinding primitive. |\n| [`patterns/computed-literal`](./patterns/computed-literal.md) | I need to write a resource delta whose magnitude was computed outside the DSL (NPC host read another entity, TS chose N XP, etc.). |\n| [`patterns/condition-grant-and-suppression`](./patterns/condition-grant-and-suppression.md) | While a condition holds I need to grant or remove an ability to act (a capability), not just a fact a predicate might forget to read. |\n| [`patterns/condition-hook-on-event`](./patterns/condition-hook-on-event.md) | \"While I am concentrating, any damage forces a CON save.\" \"While raging, the first hit each turn adds dice.\" \"When I would drop to 0 HP, drop to 1 instead.\" The rule must fire by … |\n| [`patterns/consumable-inventory-consume`](./patterns/consumable-inventory-consume.md) | A stackable inventory item (potion, scroll dose) must apply its own effect to the carrier and remove one unit from the stack when used, and must fail cleanly when the carrier does… |\n| [`patterns/container-with-loot`](./patterns/container-with-loot.md) | A room needs a container (chest, cache, shelf) that visibly holds items a player can take, with no bespoke \"search\" or \"open\" action authored per adventure — reusing the SRD's own… |\n| [`patterns/cross-party-capability-gate`](./patterns/cross-party-capability-gate.md) | A condition on one creature must open or close based on a capability held by someone else in the same roll — the attacker has Darkvision, the attacker has See Invisibility, the ta… |\n| [`patterns/damage-type-routing`](./patterns/damage-type-routing.md) | I need fire/cold/etc. damage that respects immunity, resistance, and vulnerability without a kernel damage subsystem. |\n| [`patterns/derived-value-mechanism`](./patterns/derived-value-mechanism.md) | I have a number that is computed rather than stored (a proficiency bonus, an ability modifier, a DC) — which mechanism do I author it with, and where is each one illegal? |\n| [`patterns/dialog-choice-slots`](./patterns/dialog-choice-slots.md) | I need an NPC conversation with a small fixed set of answers (a menu, a quest accept/decline, a wizard step) without free text silently committing world state and without one affo… |\n| [`patterns/directed-speech-anchor`](./patterns/directed-speech-anchor.md) | I need an NPC or player to say something to someone — broadcast to the room or directed at one body — so the right bodies perceive it and it does not follow anyone around. |\n| [`patterns/dm-applied-extent-grant`](./patterns/dm-applied-extent-grant.md) | A gift or agreement should activate cross-graph reach at a story moment. Seeding that reach can disclose a remote companion's location and knowledge before the bond. The carried i… |\n| [`patterns/draft-then-confirm-wizard`](./patterns/draft-then-confirm-wizard.md) | I need a guided character-creation or advancement form where choices remain a draft until confirmation admits the sheet and inventory changes. Explicit name and description adopti… |\n| [`patterns/equip-gated-modifier`](./patterns/equip-gated-modifier.md) | An item (armor, shield, ring, magic item) provides a continuous numeric bonus or replacement (e.g. Armor Class, Speed, saving throw bonus) while equipped in a valid equipment slot… |\n| [`patterns/extra-action-budget`](./patterns/extra-action-budget.md) | I need a feature that gives the actor one extra action this round (Action Surge), without inventing a new kernel primitive. |\n| [`patterns/guided-dialogue`](./patterns/guided-dialogue.md) | I need an NPC that leads someone through several questions, where the order of the questions, which ones are skipped and which ones hang on an earlier answer are content I can cha… |\n| [`patterns/identity-tag-capability-grant`](./patterns/identity-tag-capability-grant.md) | Every creature should be able to walk, attack, dodge, rest and attempt checks — how do I grant that once instead of copying capability rows onto every definition, and when is a di… |\n| [`patterns/item-sourced-damage`](./patterns/item-sourced-damage.md) | I need to give a weapon — manufactured or a monster's Bite/Slam — its own damage so ONE shared attack verb deals the right amount, without a bespoke action per weapon or per creat… |\n| [`patterns/kill-xp-grant`](./patterns/kill-xp-grant.md) | When a creature dies I need the killer to receive that corpse's XP worth immediately — not when someone later takes a \"claim victory\" verb. |\n| [`patterns/lingering-hazard-zone`](./patterns/lingering-hazard-zone.md) | I need a Cloudkill / burning-room hazard that damages whoever stands in it each round, then fades, without the player re-casting every turn. |\n| [`patterns/loot-table-drop`](./patterns/loot-table-drop.md) | A quest terminal or boss kill should pay a treasure item drawn from SRD rarity/CR guidance — without smuggling free-text item names into `roll_table` (int-draw only) and without a… |\n| [`patterns/mastery-gated-attack-variant`](./patterns/mastery-gated-attack-variant.md) | I need an on-hit rider (Weapon Mastery Sap/Vex, Sneak Attack dice, …) that cannot live inside the shared melee/ranged success consequence, because the shared write either (a) rebo… |\n| [`patterns/milestone-gate-terminal-flags`](./patterns/milestone-gate-terminal-flags.md) | My advancement beat gates on flags a much larger prior beat already set — do I have to replay that whole beat? |\n| [`patterns/multiattack-ordinals`](./patterns/multiattack-ordinals.md) | I need a creature to make several attacks in one action (Multiattack), or an action whose numbers the shared attack archetype cannot host (flat damage, ability math that does not … |\n| [`patterns/offer-gate-consume-guard-parity`](./patterns/offer-gate-consume-guard-parity.md) | An authored action is offered behind a gate (a phase state, a tag, a predicate on the world) and consumed by code that re-checks whether the thing is really ready. Two lists, two … |\n| [`patterns/offer-vs-resolution-roll`](./patterns/offer-vs-resolution-roll.md) | I need an attack or check that can miss: where does the d20 go so the verb is always offered when it is attemptable, and only the act decides hit or miss? |\n| [`patterns/operable-door`](./patterns/operable-door.md) | A player should open and close a door from either side. A closed or locked door should refuse a step, while the usual movement budget still applies. |\n| [`patterns/party-extent-grant`](./patterns/party-extent-grant.md) | My DM (or a bonded item) must address a party member who is on ANOTHER place graph — the inn hearth to the tomb crypt — and a bigger `range_m` does not work. |\n| [`patterns/post-commit-hit-reaction`](./patterns/post-commit-hit-reaction.md) | A feature should fire as an off-turn reaction after another creature's manipulate commits against you (a counter-blow, a post-hit heal). Opportunity Attack already shows the off-t… |\n| [`patterns/proactive-level-up`](./patterns/proactive-level-up.md) | When the hero crosses the next XP threshold, the DM should call them over and offer the level-up — the player should not have to poll their own sheet. |\n| [`patterns/prompt-occurrence`](./patterns/prompt-occurrence.md) | A speaker asks a closed question (\"Which class?\", \"Stand with me? 1: yes, 2: I must pass\"). The answers are ordinary authored actions the addressee could also fire for a totally d… |\n| [`patterns/quest-composition`](./patterns/quest-composition.md) | I need a quest: an NPC offers it, the hero does something in the world, and when it is done the hero is rewarded — and there is no quest row kind. |\n| [`patterns/quest-xp-grant`](./patterns/quest-xp-grant.md) | When a quest terminal fires I need to grant a fixed XP reward to the present party (not the killer). |\n| [`patterns/resource-spend-with-option-menu`](./patterns/resource-spend-with-option-menu.md) | I have a shared pool (spell slots, Channel Divinity uses) and several effects that each spend one use — how do I author the pool once and branch the menu? |\n| [`patterns/rest-boundary-resource-refill`](./patterns/rest-boundary-resource-refill.md) | Class features and spell slots declare `recovery_rule` (`long_rest`, `short_rest_partial_long_rest_full`, …) but that field is **documentary** — the kernel never scans it. Complet… |\n| [`patterns/role-driven-brain`](./patterns/role-driven-brain.md) | I have many enemies in many encounters and need each to fight sensibly (archers keep range, brutes charge, leaders hang back) without writing a bespoke seat per creature. |\n| [`patterns/tag-membership-menu`](./patterns/tag-membership-menu.md) | I need a list (all fighting styles, all wizard spells of level 1, every skill) for a menu or a filter, or a finite reference table (ability-score meaning bands, DC bands) for auth… |\n| [`patterns/trace-perceptibility-window`](./patterns/trace-perceptibility-window.md) | I need a perceivable thing that is either an event (heard only as it happens — speech) or a standing mark (a slime trail, a scorch — findable whenever someone walks in), or someth… |\n| [`patterns/watch-reader-manifest-closure`](./patterns/watch-reader-manifest-closure.md) | An NPC watch runs on one connection and declares that connection's tables once, in its own `subscribeReaders` call. Hosts then inject callbacks — \"who is the hero\", \"who is presen… |\n| [`personas/access`](./../../spellkave-cli/docs/persona-routes.md) | Route author, DM, player, observer and operator tasks to package-owned guidance using the available access surface, without inferring authority. |\n| [`place-graph-occupancy`](./place-graph-occupancy.md) | Two-call playbook: map_graph for the picture, entities fields=preferred for names by place_node_id. |\n| [`playable-seats`](./playable-seats.md) | Distinguish authored SRD seat offers from current live claimed/embodied state, with Explorer searches and the existing seat reader. |\n| [`player/workflows`](./../../spellkave-tool-player/docs/player-loop.md) | Orient a connected actor, use offered observation and attempt tools, then recover a refusal without guessing hidden targets or broader credentials. |\n| [`reading-a-world`](./reading-a-world.md) | get and describe read admitted authored instances through publisher or role-scoped readers; inspect reads files; query reads definitions and the workspace. |\n| [`roles`](./roles.md) | Define and aggregate capability vocabulary, bind roles to principals through presences, and inspect composition and realised or inert bindings with explain. |\n| [`rule-bench`](./rule-bench.md) | Offline DSL expression and rule benching without a running node: facts shapes, chosen dice mechanics, traces, and resolution timing. |\n| [`spell-authoring-best-practices`](./spell-authoring-best-practices.md) | How to add a spell without hand-wiring a dozen rows or drifting into lint-flagged duplication. |\n\n### Planning references — unimplemented or historical\n\n| Doc | Summary |\n|---|---|\n| [`evidence/auth-56-hosted-mcp`](./../../spellkave-world-author/docs/evidence/auth-56-hosted-mcp.md) | Versioned native real-caller public guidance capture, independent postconditions and whole-journey cost; no deployed-service claim. |\n| [`evidence/auth-56-hosted-mcp-transcript`](./../../spellkave-world-author/docs/evidence/auth-56-hosted-mcp-transcript.md) | All AUTH-56 request/response frames for the named capture, available by explicit full retrieval. |\n| [`evidence/auth-56-installed-cli`](./../../spellkave-cli/docs/installed-cli-evidence.md) | Historical partial installed-candidate capture; exact artifact, assertions, sanitized transcript and pinned text cost. |\n| [`hosted-authoring-guidance`](./hosted-authoring-guidance.md) | Reference verified local scene setup and the remaining atomic DM hand-over story, with explicit hosted deployment limits. |\n\n### Reference\n\n| Doc | Summary |\n|---|---|\n| [`dsl-grammar`](./dsl-grammar.md) | Generated operator reference for the predicate/outcome DSL used inside `_source` fields. |\n| [`fixture-correctness`](./fixture-correctness.md) | The single source of truth for authoring a world-fixtures bundle correctly — every enforcer points here. |\n| [`interaction-dsl-and-world-authoring`](./interaction-dsl-and-world-authoring.md) | The broader interaction model: entities, containment, affordances, niches, outcomes, conditions, target refs. |\n| [`manifest-format`](./manifest-format.md) | Generated TOML row/field reference for every manifest row kind, derived from the Rust schema crate. |\n| [`osm-mapping`](./osm-mapping.md) | What to author (origin cell, sheet positions, portal edges, floors, extents, map layers) for a place to appear on the OSM-native world map, and the tags external OSM tools see (ADR-0123). |\n| [`privileges`](./privileges.md) | Every authority gate compiled into the server: named capabilities, operator identity, and elevation grants. |\n\n### Troubleshooting\n\n| Doc | Summary |\n|---|---|\n| [`actor-identity-bindings`](./repairs/actor-identity-bindings.md) | [[actor_identities]] binds a SpacetimeDB login identity to an authored actor. |\n| [`actor-stat-self-only`](./repairs/actor-stat-self-only.md) | Gotcha — there is no cross-actor resource read/write shape. In an |\n| [`adjacent-moves-ungated`](./repairs/adjacent-moves-ungated.md) | listAdjacentMoves (packages/spellkave-sdk/src/core/movement.ts) iterates |\n| [`affordance-needs-niche-attachment`](./repairs/affordance-needs-niche-attachment.md) | **Gotcha — granting a capability via actor_capabilities does not, by |\n| [`apply-status-claim-lock`](./repairs/apply-status-claim-lock.md) | r_manipulate classifies a resolved action's consequence as *steering-shaped* |\n| [`authoring-observability`](./repairs/authoring-observability.md) | Observer knowledge is the canonical read surface for fog-of-war style |\n| [`condition-capability-grant-and-suppression`](./repairs/condition-capability-grant-and-suppression.md) | Both fields on `[[condition_definitions]]` are lists of `capability_id`s, and |\n| [`edge-traversal-resource-seed`](./repairs/edge-traversal-resource-seed.md) | Two facts compound here. First, evaluate_edge_traversal_affordances |\n| [`effective-condition-modifiers`](./repairs/effective-condition-modifiers.md) | actor.stat(\"my/state\") and target.stat(\"my/state\") always read the authored |\n| [`empty-predicate-source`](./repairs/empty-predicate-source.md) | **Gotcha — predicate_bool is not a decorative default; it is the literal |\n| [`equip-item-target-ref`](./repairs/equip-item-target-ref.md) | **Gotcha — entity:<id> vs item:<id> target refs resolve through DIFFERENT |\n| [`grid-anchor-forfeits-kill-zone`](./repairs/grid-anchor-forfeits-kill-zone.md) | An actor's combat_grid_blueprint seat is normally snapped from its authored |\n| [`has-item-dead-in-manipulate`](./repairs/has-item-dead-in-manipulate.md) | **This gotcha no longer applies.** Since bead sk-vjh.7, |\n| [`hosted-world-observability`](./repairs/hosted-world-observability.md) | A hosted world's NPC cycles and tool outcomes are visible to the world |\n| [`join-session-global-scope`](./repairs/join-session-global-scope.md) | A JoinSession { participant_ref: \"Actor\" } frame-write (mid-combat |\n| [`leave-session-relocates`](./repairs/leave-session-relocates.md) | Skip a body without removing it via turn_eligibility_pred; LeaveSession relocates the leaver |\n| [`manipulate-ref-niche-attachment`](./repairs/manipulate-ref-niche-attachment.md) | **Gotcha — the generic (entity:<id>/item:<id>) manipulate-target |\n| [`manipulate-success-on-provenance`](./repairs/manipulate-success-on-provenance.md) | createActorClient(session, id, { successOnProvenance: true }) makes |\n| [`mass-stand-down-apply-status`](./repairs/mass-stand-down-apply-status.md) | A single deterministic act (e.g. an NPC leader calling off its allies) can |\n| [`milestone-gate-terminal-flags`](./repairs/milestone-gate-terminal-flags.md) | A milestone/advancement beat that gates on flags a much larger prior beat |\n| [`modify-resource-floored-noop`](./repairs/modify-resource-floored-noop.md) | Resources clamp at min_value (srd/hp's is 0). A consequence that deals |\n| [`no-knowledge-seed-primitive`](./repairs/no-knowledge-seed-primitive.md) | **Gotcha — the only manifest knowledge-writer is CopyKnowledgeRow |\n| [`npc-needs-driver`](./repairs/npc-needs-driver.md) | Spellkave's module has a hard rule: **it contains no actor decision |\n| [`ordered-resource-grants`](./repairs/ordered-resource-grants.md) | consequence_frame_writes execute by ascending ordinal, and each |\n| [`region-scale-geography`](./repairs/region-scale-geography.md) | **Gotcha — a beat brief's \"region nodes: ZERO\" open flank can go stale the |\n| [`relocate-entity-ungated`](./repairs/relocate-entity-ungated.md) | A consequence that must move an actor somewhere it did NOT choose to walk |\n| [`remove-item-deletes-stack`](./repairs/remove-item-deletes-stack.md) | RemoveItem's quantity split (remove_item.rs::decide_quantity) has two |\n| [`running-an-authored-act`](./running-an-authored-act.md) | Runbook of non-obvious requirements for an authored act to actually fire through r_manipulate, in bite order. |\n| [`self-eligible-reaction-budget`](./repairs/self-eligible-reaction-budget.md) | The rule, as it stands today. self_eligible = true has two independent |\n| [`sibling-resource-predicate-seeds`](./repairs/sibling-resource-predicate-seeds.md) | **Gotcha — seeding one resource pool does NOT seed a sibling pool with the |\n| [`target-has-capability-dead`](./repairs/target-has-capability-dead.md) | **Gotcha — target.has_capability(...) parses and seeds cleanly, then never |\n| [`weapon-stricter-affordance-variant`](./repairs/weapon-stricter-affordance-variant.md) | Two entity_definitions can represent \"the same\" item (e.g. srd/item/shortbow |\n\n### Tool reference (generated)\n\n| Doc | Summary |\n|---|---|\n| [`tool-reference`](./tool-reference.md) | Generated schema reference for the AUTHOR verb registry (`authorFacingToolDefinitions` / `AUTHOR_TOOL_NAMES`), walked structurally from their own TypeBox parameters. |\n\n### Worked examples (`docs/examples/**`)\n\nEach example is a validated `.toml` fixture plus a `.md` walkthrough. Tags\ncome from the example's own sidecar metadata.\n\n| Example | Intent | Tags |\n|---|---|---|\n| [`aoe-damage-spell`](./examples/aoe-damage-spell.md) | Add an area-of-effect blast that damages every co-located actor (ForEachActorInRadius + ModifyResource). | aoe, spell, damage, for-each-actor, modify-resource, frame-write |\n| [`authored-dark-cave`](./examples/authored-dark-cave.md) | Seed ambient spatial state from TOML and make authored traversal and manipulation predicates read it. | spatial, environment-state, movement, manipulation, predicate, cave |\n| [`communicate-with-actor`](./examples/communicate-with-actor.md) | Add a co-located NPC that can be addressed with core communication. | communication, actor, entity-definition, affordance, npc |\n| [`definition-seed-statblock`](./examples/definition-seed-statblock.md) | Give a creature definition its own HP and innate Multiattack so every spawned instance inherits them; also covers the definition-level containment/equipment seeds that spawn a fresh carried/equipped child instance. | entity-definition, object_state, capability, statblock, seed, containment, equipment |\n| [`spatial-minimal-cell`](./examples/spatial-minimal-cell.md) | Add the smallest valid spatial cell with one graph and one node. | spatial, place_graph, place_node |\n| [`spell-identity-minimal`](./examples/spell-identity-minimal.md) | Author the clean, lint-clean end-state of a spell: one identity (capability_id == entity_def_id == required_capability), one cast action with no twin, taxonomy tags on the identity only. | spell, identity, emit-spell, best-practice, lint, capability, render-discipline |\n| [`weighted-int-roll-table`](./examples/weighted-int-roll-table.md) | Add a weighted non-identity int roll_table for non-die DSL draws (not a smuggled dN). | roll_table, dsl, weighted |\n",
196
+ "interaction-dsl-and-world-authoring": "# Interaction DSL And World Authoring\n\nSpellkave authoring is declarative. A bundle defines durable world rows; clients\nand reducers turn those rows into runtime interaction.\n\nReducers remain authoritative. A client may display an affordance, but the\nserver revalidates current state before any mutation.\n\n## Typed DSL macros\n\nUse `[[dsl_macro_definitions]]` to name a small, reusable typed expression.\nMacros are authoring-time expansion only: admission checks the parameter and\nreturn types, substitutes each call's expression into `body_source`, and then\nruns the ordinary DSL validation and evaluation path. A macro is therefore not\nderived state and does not add a runtime function or evaluator operator.\n\nFor example, the SRD bundle defines its ability-score calculation once and\ncalls it with a live stat read:\n\n```toml\n[[dsl_macro_definitions]]\nmacro_id = \"srd/ability_modifier\"\nbundle_id = \"srd\"\nreturn_type = \"Int\"\nparameters = [{ name = \"score\", value_type = \"Int\" }]\nbody_source = \"((score) - 10) / 2 + cond(((score) - 10) - (((score) - 10) / 2) * 2 < 0, -1, 0)\"\n\n[[affordance_templates]]\ntemplate_id = \"my_bundle/check\"\n# … ordinary identity fields omitted …\npredicate_source = \"d20 + macro('srd/ability_modifier', actor.stat('srd/dex')) >= 15\"\n```\n\n> **Update (2026-07-31, #1891 / PR #2075):** the `d20` term above is retained\n> only to demonstrate macro composition syntax — it is stale authoring\n> PRACTICE. `affordance_templates.predicate_source` is a deterministic\n> ELIGIBILITY gate: as of #1891, any stochastic COMPARISON anywhere in an\n> offer predicate — including a die laundered through a `let` binding, e.g.\n> `let roll = d20; roll >= 15` — is treated as SATISFIED at materialise time\n> without ever drawing. It can no longer gate whether the affordance offers.\n> Author dice in the action's `resolution_predicate_source`\n> (`resolution_mode = \"Stochastic\"`) instead, and keep `predicate_source` to\n> capability/state/target checks (`actor.wielded_item.has_tag(...)`,\n> `target.stat(...) >= N`, and the like). This is deliberately crude at the\n> extremes: an unreachable DC (`d20 >= 30`) in an offer predicate still\n> offers unconditionally — the kernel only checks \"does this comparison draw\n> at all\", never the threshold — and simply fails honestly at act time, same\n> as any other miss.\n\nThe macro id is a fully qualified string, the parameter list is ordered, and\neach argument must match the declared `value_type` (`Bool`, `Int`, or `Text`).\nMacro bodies use the existing DSL but cannot call another macro in v1. Leaf\nmacros can still compose at an authored call site, for example\n`macro('srd/base_ac', macro('srd/ability_modifier', actor.stat('srd/dex')))`.\nKeep the input expression live—such as `actor.stat('srd/dex')` above—rather than\nmaterializing a calculated resource that can become stale when its source\nchanges. Use macros for repeated bounded calculations; use ordinary authored\nstate for facts that the world must actually store.\n\nThe bare `d20` term in the example above is also bias-compatible — see\n[Roll modifiers (Advantage/Disadvantage/flat bonus)](#roll-modifiers-advantagedisadvantageflat-bonus)\nbelow for how an active condition can shift a predicate's roll without the\npredicate authoring anything itself.\n\n## Roll modifiers (Advantage/Disadvantage/flat bonus)\n\nAdvantage, Disadvantage, and flat roll bonuses are never written into a\npredicate's own DSL text. They compose from the acting entity's active\n`condition_definitions` — a modifier template with `delta_kind` `Advantage`,\n`Disadvantage`, or `Plus` (see `tool-reference.md`'s `modifier_templates` row\nreference for the full `delta_kind` vocabulary) — into a `ComposedRollBias`\nthat the evaluator installs on the acting entity's evaluation context before\nrunning the predicate. An authored predicate has no way to reference this\nbias directly; it is ambient input the same way `actor.stat(...)` reads\nambient facts.\n\nThe evaluator consults the composed bias at exactly three points\n(`crates/spellkave-dsl/src/eval.rs`): a bare single-die `Roll` (the `d20`/\n`NdM` grammar, `count == 1` only — a multi-die literal like `2d6` is never\nbiased), `RollUnder`, and an `Int`-valued `RollTable` draw. Advantage draws\nthe die **twice** and keeps the more favorable flat-bonus-adjusted result;\nDisadvantage keeps the less favorable one. \"More favorable\" depends on which\ndirection the operator's own success condition runs: `Roll` and `RollTable`\nare consumed by a `>= target`-shaped comparison, so Advantage takes the\n**max** of the two draws (Disadvantage the min); `RollUnder` succeeds on a\n**lower** roll, so Advantage takes the **min** of the two draws there instead\n(Disadvantage the max).\n\nBoth physical dice are recorded individually in the evaluation's own\nprovenance (`stochastic_draws`), not just the one that decided the outcome —\nthis is what lets a post-roll intervention (the SRD's Heroic Inspiration\nreroll, `finding-58-post-roll-reroll-intervention.md`) replace exactly one of\nthe two recorded faces and recompute the branch, rather than only ever seeing\na single collapsed result.\n\n## Author Instances As Entities\n\nThe final substrate uses one instance table: `[[entities]]`.\n\n- Player bodies and NPC bodies are entities with `kind = \"player\"` or\n `kind = \"npc\"`.\n- Items are entities with `kind = \"item\"`.\n- Former world objects and fixtures are entities, usually with `kind = \"npc\"`,\n `kind = \"place\"`, or a tagged definition that explains their role.\n- Inventory and machine-port contents are `[[entity_containment]]`.\n- Ground placement is `entities.place_node_id`.\n- Object facts are `[[object_state]]`.\n\nOrdinary manipulation discovery is the factored per-perceiver\n`manipulation_context` (ADR-0140). There is no entity flag to opt into a\ngeneric affordance cache; that cache is retired. `r_manipulate` still\nrevalidates every attempt (ADR-0011 D-3) from authored templates, equipment,\nand containment — discovery rows are never authority.\n\n`[[items]]`, `[[item_locations]]`, `[[item_inventory]]`, `[[world_objects]]`,\nand `[[world_object_locations]]` are retired (#1968 B-10) — the manifest\nschema no longer accepts them at all. Use the `[[entities]]` +\n`[[entity_containment]]` + `[[object_state]]` shape above.\n\n## From Spatial Rows To Affordances\n\nMovement starts with spatial topology:\n\n<!-- snippet: traverse-edge-topology -->\n```toml\n[[place_edges]]\nedge_key = \"my_bundle/edge/a-b\"\nbundle_id = \"my_bundle\"\nplace_graph_id = \"my_bundle/graph\"\nfrom_node_id = \"my_bundle/graph/a\"\nto_node_id = \"my_bundle/graph/b\"\n\n[[place_edge_affordance]]\nedge_key = \"my_bundle/edge/a-b\"\naffordance_template_id = \"my_bundle/traverse\"\n```\n\nThe `affordance_template` supplies the predicate and outcome:\n\n<!-- snippet: traverse-edge-affordance -->\n```toml\n[[affordance_templates]]\ntemplate_id = \"my_bundle/traverse\"\nbundle_id = \"my_bundle\"\nniche_id = \"core/traversable_edge\"\ncapability_id = \"core/walk\"\ndisplay_name = \"Traverse\"\npredicate_source = \"actor.has_capability(\\\"core/walk\\\")\"\noutcome_template_id = \"core/traversal/move_outcome\"\n```\n\nTraversal predicate tables are gone; attach normal affordance templates to\nedges instead.\n\n**Edge endpoints may live in the committed world (#1666).** At apply\nadmission (`r_apply_world_manifest`), `from_node_id`/`to_node_id` resolve\nagainst this manifest's `[[place_nodes]]` *plus* already-committed\n`place_node` rows — so a later apply can patch an edge onto nodes from an\nearlier one, e.g. a `substrate_crossing` edge into a\n`[[place_graph_instances]]`-created node (instance first, edge in the next\ncall: instance node ids materialize at commit). An endpoint absent from both\nis a fatal `MF-VAL-105`. Two caveats: offline validation (`spellkave\nvalidate`, the merge-gate) has no live world and stays file-set-only, and the\nedge row's `bundle_id` must still be declared via `[[bundles]]` in the same\nmanifest. Live replay: `openspec/specs/world-manifest-validation/demos/edge-endpoint-live-nodes.md`.\n\n## Owning Instances And Their Defaults\n\n`place_graph_instances.bundle_id` names an incoming applying bundle header. It\nowns the expanded graph, nodes, edges, movement defaults, niche attachments and\ninhabitant capability grants; the blueprint's bundle remains provenance. Omit it\nwhen there is one applying header, or an inline blueprint declares an owner with\nan incoming header. A foreign blueprint in a multi-header apply needs an explicit\nowner (`MF-VAL-373`). Parent and anchor ownership do not choose it.\n\nPlay-created clones and tactical grids carry the world owner (`\"\"`), so authored\nbundle replacement preserves them. Apply-expanded clones belong to their applying\nbundle and are removed when that bundle is replaced. The OWN-91 survival tests\nprove both boundaries.\n\nA cloned node or edge with its instance graph's owner and a matching blueprint row\ninherits the original row's bundle defaults. A same-owner overwrite keeps that\ninheritance: set an explicit node extent, graph-scoped movement default or edge\naffordance to override or refine it. A new row with no original blueprint match,\nor a foreign-owner overwrite, uses its own bundle defaults. Graph-scoped movement\ndefaults still take precedence over bundle defaults. The OWN-91 default-boundary\nlive proof covers inherited traversal, explicit refinement, added edges and\nforeign-owner overwrites.\n\n## Actor↔Target Distance (`core/distance_to_actor_mm`)\n\n*(added 2026-07-31, #2077)* A predicate can read the acting actor's\ndistance to the current target, in millimeters, measured under the place\ngraph's authored metric shape, through the ordinary `target.stat(...)` read:\n\n<!-- snippet: distance-to-actor-predicate -->\n```toml\npredicate_source = \"target.stat(\\\"core/distance_to_actor_mm\\\") <= 9144\"\n```\n\nThis is a kernel-populated fact, not authored `object_state` — it is computed\nby `collect_spatial_inputs` from the SAME metric an affordance's own\n`range_m` field already gates on (`actor_target_distance_millimeters`, which\ncalls `node_pair_metric` + `node_pair_metric_distance` —\nthe world API), so a\ndistance-gated predicate agrees with a `range_m` cutoff on the identical\ngeometry. Reading it composes a normal/\nlong-range split, a \"within N ft\" third-party-style conjunct on the\nactor↔target pair, or any other distance-shaped gate that a hard `range_m`\ncutoff can't express (Disadvantage instead of a flat reject, for example).\n\n**Absent, not zero, when the metric is not comparable.** The fact is missing\n— `UnknownField`, so the predicate evaluates `false` — when the actor has no\nresolvable place_node, either node lacks a metric embedding, or the actor and\ntarget sit in different `place_graph`s (a cross-graph pair has no single\ncomparable distance). It is never fabricated as `0` or any other sentinel;\nauthor defensively the same way you would for any other optional stat read\n(a leading `actor.has_capability(...)`/co-location conjunct, or accept that\nthe predicate simply never fires cross-graph).\n\n**Deterministic — gates for real under offer evaluation too.** Unlike a bare\n`d20`-shaped comparison, this is a plain fact read: `evaluate_offer_predicate_expression`\n(the materialiser's offer/attemptability path, #2075) evaluates it normally\nand gates on it, it never short-circuits it as \"satisfied by construction\"\nthe way a stochastic comparison is. A predicate mixing a distance conjunct\nwith a real die (`target.stat(\"core/distance_to_actor_mm\") <= 1524 && d20 +\n5 >= 25`) is offered only when the distance gate genuinely holds; the die\nalone is what offer mode treats as attemptable regardless of outcome.\n\n**Reserved field id.** `core/distance_to_actor_mm` is populated by the kernel\nbefore any per-entity `object_state` fact is folded in, so it always wins a\nsame-name collision — an authored `object_state` row on the target that\nhappens to reuse this id can never shadow the kernel-computed value. Do not\nauthor your own `object_state` under this id; pick a different name for\nanything you want authored state (rather than the kernel) to own.\n\n## Leave-Reach Geometry (`core/distance_to_departed_mm`, `core/distance_to_destination_mm`)\n\n*(added 2026-08-17, bead sk-0m4.26)* During a **reaction-eligibility**\nevaluation triggered by another actor's movement, the kernel populates two\nadditional distance facts on the candidate reactor: the reactor's grid\ndistance to the node the mover just **left**, and to the mover's\n**destination**, both in millimeters. The distance uses the grid's authored\nmetric shape (`cell_distance_mm` in\nthe world API, 1 cell = 1524 mm):\nChebyshev on a blueprint that authors `core/metric/chebyshev` (the SRD one),\nEuclidean on a blueprint that resolves to Euclidean. Subject roles in that evaluation:\n`actor` is the candidate reactor, `target` is the mover (the mover's live\ncapability grants are folded under `target`, so `target.has_capability(...)`\nreads the mover). The SRD opportunity-attack gate is the canonical consumer;\nits full predicate, as shipped in\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(built by `OPPORTUNITY_ATTACK_ELIGIBILITY` in\n`packages/spellkave-srd-cc/src/chapters/playing-the-game/fragments/attacks.ts`),\nalso requires the reactor to hold `srd/action/attack` and not be Addled:\n\n<!-- snippet: leave-reach-eligibility-predicate -->\n```toml\nreaction_eligibility = \"actor.has_capability('srd/action/attack') && actor.stat('core/distance_to_departed_mm') <= actor.stat('srd/reach_mm') && actor.stat('core/distance_to_destination_mm') > actor.stat('srd/reach_mm') && target.has_capability('srd/action/disengage') == false && actor.status('srd/condition/addled') == false\"\n```\n\nThe kernel only measures; which reach stat to compare against and which\ncapability exempts the mover are entirely the author's choice — no `srd/`\nvocabulary is baked into the substrate.\n\n**Absent, not zero, off-grid.** Both facts exist only when the departed and\ndestination nodes carry grid positions (session grids). On unpositioned\nnodes the facts are missing (`UnknownField` ⇒ predicate `false`) and the\nkernel falls back to co-located candidate scoping.\n\n**Shadowable — do not author state ids under `core/distance_*`.** Unlike\n`core/distance_to_actor_mm`, these two facts are appended AFTER the reactor's\nown facts (the world API\nextends `int_fields` with them after `build_actor_subject_facts`), and a\n`stat` read takes the first matching fact (`Op::ReadInt` in\n`crates/spellkave-dsl/src/eval.rs`). An authored `object_state` on the\nreactor with the same id therefore wins over the kernel value. This is a\nknown bug (bead `sk-jay0.2.49`); until it is fixed, never author an\n`object_state` id under `core/distance_*`.\n\n## Dispatch Argument Quantity (`core/dispatch_arg_quantity`)\n\n*(added 2026-08-23, sk-609b.22 / K-D)* When a dispatching action carries a\n`quantity` argument (a split-quantity potion use, a Lay on Hands healing\namount), a resolution predicate, an outcome-graph edge guard, or an\napply-time `delta_source`/condition-gate composition can read it back through\nthe ordinary `actor.stat(...)` read:\n\n```toml\ndelta_source = \"-actor.stat(\\\"core/dispatch_arg_quantity\\\")\"\n```\n\nThis is a kernel-populated fact, not authored `object_state` — a pure\nprojection of the dispatch's own `ManipulationArgs.quantity`, already parsed\nand shape-validated (rejecting `0`) before the fact is ever pushed.\n\n**Absent, not zero — and, unlike `core/distance_to_actor_mm`, absence hard-fails\neverywhere it can be read.** No `quantity` arg on the dispatch pushes\nnothing. In a **`delta_source`** (an Int-typed evaluation), the missing fact\nresolves to an evaluation *error*, never a silent `0` — by design, so a\n`delta_source` reading a quantity that was never supplied fails loud instead\nof quietly healing/damaging for zero. In a **resolution predicate** or an\n**outcome-graph edge guard**, the missing fact is ALSO an evaluation error\n(`UnknownField`), and — unlike some other kernel-populated facts — nothing\nat either call site catches it: an absent-quantity resolution predicate\nrejects the whole dispatch as a technical failure, and an absent-quantity\noutcome-graph guard aborts the whole graph evaluation. **Do not author\n`actor.stat(\"core/dispatch_arg_quantity\")` in a resolution predicate or an\noutcome-graph guard unless the affordance's dispatch always supplies a\n`quantity` arg** — there is no graceful \"gate closed\" here, only a hard\nreject. Both driving cases (split-quantity potion use, Lay on Hands) read\nthis fact only as a `delta_source`, never in predicate/guard position, for\nexactly this reason.\n\nThis is the **primary dispatch subject** rule (ADR-0045 Postscript 2026-08-23\nand the 2026-09-02 D-5 carve-out): `UnknownField` on a fact the *action*\nwas supposed to supply stays fatal. It is the opposite of a\n`ForEachActorInRadius` per-candidate skip, which applies only to a\n**bystander / non-opted-in occupant** that never bound the measured fact\n(see [Area-of-effect frame writes](#area-of-effect-frame-writes)). Do not\nread `core/dispatch_arg_quantity` in a per-occupant radius predicate — it is\ndispatch-scoped, not occupant catalog.\n\n**Reserved field id.** Like `core/distance_to_actor_mm`, this id is\nkernel-populated and pushed ahead of any per-entity `object_state` fact, so\nit always wins a same-name collision. Do not author your own `object_state`\nunder this id.\n\n**Fan-out subject-lie.** Under a `ForEachActorInRadius` fan-out, `actor`\nrebinds to each selected occupant in turn, but `core/dispatch_arg_quantity`\nstays the SAME dispatch-scoped value for every occupant — it is not\nre-derived per occupant. An author reading `actor.stat(\"core/dispatch_arg_quantity\")`\ninside a per-occupant predicate/`delta_source` gets the one quantity the\nplayer chose for the whole dispatch, not a per-occupant share of it. If a\nmechanic needs a per-occupant split, divide the fact's value in the\nauthored expression rather than expecting the kernel to have already split it.\n\n**Narrower than `distance_to_actor_mm`.** Only three seams see this fact: the\ndispatch-time resolution predicate, outcome-graph edge guards, and apply-time\n`delta_source`/fan-out composition. It is never wired into reaction\neligibility or materialiser offer-eligibility (dispatch args do not exist\nbefore the player supplies them), and it is not wired into the roll-bias\ncondition-gate composition pool (no driving case needs a quantity-gated\n*condition*, as opposed to a resolution-predicate or `delta_source` read).\nSee `packages/spellkave-srd-cc/docs/substrate-verdicts/dispatch-args-kernel-design.md`\nfor the full seam map and the rejected sibling proposal (an arg-carried\nspatial-binding token, cut for lack of a driving case).\n\n## Session Participation (`core/session_id`)\n\n*(added 2026-08-27, sk-awlo.3)* Inside a **condition hook** — and only there —\na predicate can ask whether its holder is currently in a combat session:\n\n```toml\n[[condition_definitions.hooks]]\nevent_kind = \"Layer2.ConditionDelta\"\ndetail_filter_source = \"\"\"\n $event.detail.entity_id == target.stat('core/entity_id')\n && target.stat('core/session_id') > 0\n\"\"\"\nexpression_source = \"invoke_outcome_graph('my_bundle/leave-fight')\"\n```\n\nHook rows are `deny_unknown_fields` (`ConditionHookRow` in\n`crates/spellkave-schema/src/lib.rs`): the keys are `event_kind`,\n`detail_filter_source`, and exactly one of `expression_source` (shown) or the\nnumeric `expression`.\n\nThe value is the ambient scope session **if and only if this holder is a\nparticipant of it**. That conjunction is the whole point, and the name\npromises more than it delivers on purpose: there is exactly one session a\nholder can be in, so from the holder's own point of view it is *the* session.\nA fact mirroring the world-global `turn_state.scope_session_id` alone would\nanswer \"a fight is happening somewhere\", which is not a question any authored\nrule wants to ask.\n\n**Absent, not zero — and here absence is a graceful gate.** With no session in\nscope, or a holder who is not a participant of it, the fact is simply not\npushed, so reading it raises `UnknownField`. In a hook `detail_filter` that is\nalready understood as *\"this hook does not apply to this holder\"* and the hook\nquietly does not fire — unlike\n[`core/dispatch_arg_quantity`](#dispatch-argument-quantity-coredispatch_arg_quantity),\nwhose absence hard-fails. An authored `target.stat('core/session_id') == 0`\ntherefore never matches; write `> 0` when you mean \"I am in a fight\".\n\n**Scope: condition hooks only.** It is pushed in the per-`target_condition`\nloop that collects hook intents, beside `core/entity_id`. It is not available\nin affordance predicates, resolution predicates, or outcome-graph guards.\n\n**Kernel-populated field id.** Do not author an `object_state` under this id.\nThe fact is appended after the hook's base facts\n(`collect_condition_hook_intents` in\nthe world API) and a `stat`\nread takes the first match, so — as with the leave-reach facts above — the\nkernel value is not guaranteed to win a same-name collision.\n\n### What it does not unlock\n\nThe fact exists so a hook can gate a `LeaveSession` frame write safely — hook\nside effects are **not** isolated from their trigger, so an ungated\n`LeaveSession` aborts the very `ApplyStatus` that fired the hook, and a\ncreature dying outside combat would refuse to die.\n\nIt is **not** the way to make turn order skip a participant. `LeaveSession`\nremoves the row `r_advance_turn` rotates over, which works, but it also\nrelocates the leaver off the tactical grid as part of its contract, which makes\na corpse untargetable. To skip a body that stays in the scene, author\n`turn_eligibility_pred` on the session definition (ADR-0143). See\n[`leave-session-relocates`](./repairs/leave-session-relocates.md) for both.\n\n## Runtime Ambient State On Incident Edges\n\n`[[spatial_environment_state]]` rows can be seeded directly in a manifest when\nthe dark, smoky, noisy, or otherwise altered location is known up front. A\nruntime action can also write ambient state through an `Inscribe` frame write.\n\nFor traversal gates, the important target is the place edge: `r_move` evaluates\nedge-bound affordances with `target.state(\"...\")` populated from env-state on\nthat edge. When a cast should affect movement through the caster's current cell,\nauthor a spatial env-state write with `location_kind = \"binding\"` and\n`location_ref = \"ActorIncidentEdges\"`. The reducer resolves the actor's current\nnode, enumerates every incoming and outgoing `place_edge`, and writes one\nenv-state row per incident edge.\n\n<!-- snippet: actor-incident-edges-inscribe -->\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"my_bundle/cast_darkness/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"spatial_environment_state\"\nlocation_kind = \"binding\"\nlocation_ref = \"ActorIncidentEdges\"\npayload_json = '{\"state_id\":\"my_bundle/darkness\",\"value\":true,\"visibility\":\"Public\"}'\n```\n\nUse this with a normal edge affordance predicate:\n\n<!-- snippet: darkness-gated-predicate -->\n```toml\npredicate_source = \"actor.has_capability(\\\"core/walk\\\") && target.has_niche(\\\"core/passable_portal\\\") && target.state(\\\"my_bundle/darkness\\\") == false || actor.has_capability(\\\"my_bundle/darkvision\\\")\"\n```\n\nIf the same spell should also affect node-targeted manipulation, add a separate\n`Inscribe` write with `location_ref = \"ActorSpatialRef\"`. `ActorIncidentEdges`\nis only for `spatial_environment_state` writes, does not accept a payload\n`target_ref`, and does not create a ranged/targeted edge binding; a distant\ntarget's incident edges are not authorable through this token.\n\n### Node-Scoped Environment State On Traversal (`@from_node` / `@to_node`)\n\n*(added movement-defaults-modes-terrain-cost, ADR-0101 D-4)* `r_move` also\nprojects `spatial_environment_state` onto the TWO place nodes an edge\nconnects, alongside the edge-bound facts above. For every defined\n`spatial_state_definition`, a row whose `place_node_id` matches the edge's\n`from_node_id` becomes `<state_id>@from_node` (bool/int, typed per the\ndefinition; the definition's default when no row is present) plus a\n`<state_id>@from_node@updated_tick` freshness twin (same rule as the plain\n`@updated_tick` fact above); a row on the `to_node_id` becomes\n`<state_id>@to_node` / `<state_id>@to_node@updated_tick` the same way. The\nplain (unsuffixed) `<state_id>` name stays reserved for the edge-bound fact\nabove — `target.state(\"my_bundle/darkness\")` always means the EDGE's own\nstate, never a node's.\n\nThis is how terrain becomes a property of the *area* while still being paid\non the edge: an `[[affordance_templates]]` row may carry\n`movement_cost_expression_source`, an authored integer DSL expression (same\nint-root grammar as any other `_source` field — see `dsl-grammar.md`) that\nmultiplies the traversing edge's authored/metric distance. It evaluates in\nthe SAME `target`-scoped context the template's own `predicate_source`\nalready reads, so it reaches the node-scoped facts above through the\nordinary `target.stat(\"<id>@from_node\")` grammar:\n\n```toml\n[[affordance_templates]]\ntemplate_id = \"my_bundle/affordance/step\"\nniche_id = \"core/passable_portal\"\ncapability_id = \"core/walk\"\noutcome_template_id = \"core/traversal/move_outcome\"\npredicate_source = \"actor.has_capability(\\\"core/walk\\\")\"\nmovement_cost_expression_source = \"max(1, max(target.stat(\\\"my_bundle/difficult_terrain@from_node\\\"), target.stat(\\\"my_bundle/difficult_terrain@to_node\\\")))\"\n```\n\nWhether two difficult endpoints should take the worse of the two (`max`,\nabove) or stack (`target.stat(\"...@from_node\") * target.stat(\"...@to_node\")`)\nis entirely the author's call — the kernel never interprets any state id as\n\"difficult\"; it only projects whatever `spatial_environment_state` rows\nexist and multiplies whatever the expression returns (clamped to a\nnon-negative result; an absent expression leaves the distance unmultiplied,\ntoday's static-cost behaviour unchanged). A reducer that writes\n`my_bundle/difficult_terrain` on a node — a spell consequence, a hazard\ntrigger — changes the cost of the NEXT traversal into or out of that node,\nwith no manifest re-apply.\n\n## Trace Inscription — Payload Carriage, Anchors, And How Long A Trace Stays Perceivable\n\nAn `Inscribe` frame write that inserts a `trace` row (as opposed to the\n`spatial_environment_state` write path above) has several more authorable\nknobs: carrying the dispatching action's own text and addressee onto the\ntrace, anchoring the trace to an entity instead of a fixed place, and — on the\ntrace KIND rather than the write — how long the result stays perceivable to\nsomeone who arrives later.\n\n**The rule of thumb before you reach for any of them:** the anchor says WHERE\nthe trace is, the payload says everything else about it — who it was aimed at,\nwhat was said, who left it. Anchors are not a delivery mechanism. See\n\"Anchoring a trace to an entity\" below for what happens when you use one as\nthough it were.\n\n### Kernel-stamped join to the world event (not authorable)\n\nAn `Inscribe` or `InscribeTraceCluster` that runs inside `r_apply_consequence`\nstamps `trace.event_id` with the `world_event.id` of that consequence. Authors\ndo not set this column: it is not a manifest field, not a FrameWriteOp knob,\nand not part of `payload_json`. Seed traces (`[[location_traces]]`,\n`[[place_node_traces]]`) and raw `r_inscribe_trace` stay unlinked\n(`event_id = 0`). Operators join a waking NPC `cause_id` (a `trace_id`) to\nthe world event via `spellkave trace inspect`.\n\n### Carrying the dispatching action's text (`carry_dispatch_text`)\n\nSet `carry_dispatch_text = true` on an `Inscribe` write to fold the\ndispatching action's text into the trace's `payload_json`, under a `text` key,\nat dispatch time. The kernel reads the `dispatch_text` key of the dispatch's\n`args_json` (`ManipulationArgs.dispatch_text`); the shared tool runtime's\n`utterance` tool parameter (#1923) is folded to that kernel-wire key at the\nboundary, so the kernel never sees an `utterance` key\n(the world API,\n`extract_dispatch_text`, and the test there that fails a reader of the\n`utterance` key):\n\n<!-- snippet: carry-dispatch-text-inscribe -->\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"srd/speech_heard\"\nlocation_kind = \"place_node\"\nlocation_ref = \"ActorSpatialRef\"\npayload_json = '{\"speaker\":\"herald\"}'\ncarry_dispatch_text = true\n```\n\nIf the dispatch's `args_json` carries `{\"dispatch_text\": \"Open sesame\"}`, the\ninscribed trace's `payload_json` becomes `{\"speaker\":\"herald\",\"text\":\"Open\nsesame\"}`. `carry_dispatch_text` defaults to `false`, and `false`/absent\nleaves `payload_json` byte-identical to before this field existed — regardless\nof what the dispatch's `args_json` carries. `true` with no `dispatch_text` key\npresent (or a non-string value, or unparsable `args_json`) also leaves `payload_json` untouched; this is opt-in carriage, not a\nrequirement that every dispatch supply text. `payload_json` must already be a\nJSON object for the merge to succeed — a non-object payload under\n`carry_dispatch_text = true` is a loud authoring error, not a silent no-op.\n\n### Carrying the dispatch's addressee (`carry_addressee`)\n\nSet `carry_addressee = true` on an `Inscribe` write to fold the entity the\ndispatch is aimed at into the trace's `payload_json`, under an `addressee`\nkey, as an entity id:\n\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetSpatialRef\"\npayload_json = '{}'\ncarry_dispatch_text = true\ncarry_addressee = true\n```\n\nA dispatch targeting entity 4 with the text \"Well met.\" inscribes\n`{\"text\":\"Well met.\",\"addressee\":4}` at the ADDRESSEE's current place-node\n(`TargetSpatialRef`). This is how directed speech is authored (sk-0m4.33):\nthe trace sits where the addressee stands, ordinary co-location admission\ndelivers it there, and the payload records who it was aimed at. A grant\nextent on the communicate capability (sk-0m4.34) is what lets the act reach\nan addressee in another place graph; `range_m` alone cannot. Broadcast\nand self-shaped speech still use `ActorSpatialRef` (the speaker's place).\nNever `TargetEntityRef` — that glued the row to a person (sk-oj6).\n\nUnlike `carry_dispatch_text`, this one is **not** best-effort. Setting it on a\ndispatch with no entity target fails loudly at binding validation, before any\nwrite happens. That is deliberate: the flag is your declaration that this\ntrace's payload carries an addressee, and a payload whose addressee is\n\"usually there\" leaves every reader probing for it — the exact convention the\nflag exists to replace.\n\nAn addressee in the payload routes nothing. It is content, like the text\nitself, so everyone co-located still perceives the trace and overhears the\nexchange. Directed speech is a fact about the utterance, not a delivery list.\n\n### Carrying bounded menu labels (`carry_dispatch_options`)\n\nAn `Inscribe` write with `carry_dispatch_options = true` copies the dispatch's\n`dispatch_options` into the payload's `options` array. The dispatch admits\nat most sixteen string labels, each at most 120 Unicode characters; malformed labels\nrefuse the frame. Missing or null options leave the authored payload unchanged.\nThe parallel optional `dispatch_option_refs` argument carries exact static\nauthored definition ids (or null for an option without a reference). Under the\nsame opt-in it becomes `option_definition_refs` beside `options`; it never\nderives from eligibility. References require labels, equal list lengths and\nnonempty ids of at most 512 bytes. The merged payload must be a JSON object.\nWith carriage disabled the payload is unchanged.\n\nCompose this write with the closed-question state transition in one consequence.\nThe resulting occurrence keeps that frame's speech `audience_trace_id`; its\npresentation must use that trace rather than a later question. See\n[dialog choice slots](patterns/dialog-choice-slots.md) and\n[metadata attachments](metadata-attachments.md#dialogueprompt-closed-question-presentation).\nThe metadata marker is a client presentation convention; typed prompt rows,\nresponse sets and state predicates enforce admission.\n\n### Carrying opaque presentation context (`carry_dispatch_context`)\n\nAn `Inscribe` write with `carry_dispatch_context = true` copies the dispatch's\n`dispatch_context` argument onto the payload under `context`. The argument is\none JSON object sent as text, at most 8 KiB. The kernel checks only those two\nthings and reads no key of the object. Text that is not one JSON object, or is\nlarger, refuses the frame. A missing or null argument leaves the payload\nunchanged, and so does a write without the flag.\n\nThe context is content for whoever reads the trace, like the labels. It is\nheard by everyone who perceives the trace, so nothing private belongs in it.\nIts content is never read by the server: prompt rows, response sets and state\npredicates decide what may be answered. Only the shape and the bound are\nchecked, at dispatch, whether or not a write carries the context. The\nscripted ask-menu palette keeps its question traces without expiry, so every\ncarried context stays stored with its trace.\n\nCompose it with `carry_dispatch_options` on the write that asks a closed\nquestion. The occurrence binds that trace, so a reader gets the labels and the\ncontext of the same question, never of a later one. The shipped use is the\nmachine side of a guided question (step, outline, answers so far); see\n[guided dialogue](patterns/guided-dialogue.md) for its shape.\n\n### Recording an answered occurrence (`carry_occurrence`)\n\nAn `Inscribe` write with `carry_occurrence = true` copies the server gate's\nadmitted occurrence id into `occurrence_id` as a decimal string, including across\ndeferred execution. Caller payloads cannot select the binding. An unbound reuse\nof the same response action has no admitted occurrence and omits the field.\nThe flag opens no prompt. Label history resolves through the reader's visible\noccurrence and its bound presentation; missing history uses neutral numbers.\n\nTag response actions explicitly with `ui.response-slot=<positive integer>`.\nThis is client syntax independent of action ids and labels. Keep the prompt\nmetadata's response ordering consistent with the marker. Markers and static\nreferences grant no admission and expose no predicate results; the server\ndecides attempts (ADR-0166).\n\n### Declaring a payload contract (`trace_kind_definitions.schema_json`)\n\nA trace kind can declare what its payload must carry, and the kernel enforces\nit while assembling the payload — no host can bypass it, because the kernel is\nthe only place the finished payload exists.\n\n```toml\n[[trace_kind_definitions]]\nkind_id = \"srd/speech\"\nbundle_id = \"srd\"\nlocation_kinds = \"place_node\"\nschema_json = '{\"text\":\"string\",\"addressee\":\"integer?\"}'\n```\n\nThe shape is a flat object mapping a payload key to its type name:\n`string`, `integer`, `number`, `boolean`, `object`, `array`, `any`. Declared\nkeys are **required**; a `?` suffix makes the key optional (absent is fine,\npresent must still typecheck). Keys you do NOT declare are allowed through —\nthe schema states what must hold, not what may. An empty `schema_json`\ndeclares no contract at all, and an unrecognised type name is a loud error\nrather than a silent pass.\n\n### How long a trace stays findable (`trace_kind_definitions.perceptible_for_ticks`)\n\nA trace is perceived at two moments (ADR-0040): at inscription, by whoever is\nco-located then, and on ARRIVAL, by a body that later walks onto its node.\n`perceptible_for_ticks` governs only the second one.\n\n```toml\n[[trace_kind_definitions]]\nkind_id = \"my_bundle/slime_trail\"\n# field omitted -> unbounded: a standing MARK, findable whenever you walk in\n\n[[trace_kind_definitions]]\nkind_id = \"srd/speech\"\nperceptible_for_ticks = 0\n# 0 -> an EVENT: perceived only as it happens, never by walking in afterwards\n```\n\nOmitting the field is the default and preserves the behaviour every trace had\nbefore this knob existed. Author `0` for anything that is a sound or a flash\nrather than a mark. A finite value in between models a stimulus that lingers\nand fades — smoke, a scent.\n\nThe bound is **exclusive**: `n` admits arrivals for `n` ticks after\ninscription, through `inscribed_at + n - 1`. So `0` admits nothing on arrival\nat all, including on the utterance's own tick — deliberately, because a tick\nis as long as the operator says it is (`set_tick_interval_secs`, 300s by\ndefault). A whole scene plus several arrivals fits inside one tick, so an\ninclusive bound would let latecomers in and make a perception rule depend on\nan operations knob.\n\n**This is not a lifetime.** The row survives regardless: nothing is deleted,\na body that already perceived the trace keeps that memory forever, and a\ncaller holding a DM/oversight extent grant can still read the full history of\nthe nodes it watches.\n\nDo not reach for the lifetime fields (`expires_after_ticks`, or the absolute\n`expires_at_tick`) to get this effect. Those DELETE the row, and the player\nread path resolves each remembered trace back through the `trace` table — so\ndeleting it silently un-hears a listener who had already heard. Use them only\nfor traces that are genuinely meant to stop EXISTING, which is a different\nquestion:\n\n| Knob | Question it answers | Deletes? |\n|---|---|---|\n| `Inscribe.expires_after_ticks` | how long does the trace exist | yes |\n| `trace_kind_definitions.perceptible_for_ticks` | how long can it still be found by someone arriving | no |\n\nSmoke wants both — it thins out AND stops being findable. Speech wants only\nthe second: see \"Decay deletes; it does not un-tell\" in\n[`lingering-hazard-zones.md`](./lingering-hazard-zones.md).\n\n### Anchoring a trace to an entity (`location_kind = \"entity\"`)\n\n> **Do not use an entity anchor to model \"spoken to this person.\"** The\n> substrate supports the anchor and the following section documents it, but\n> speech was authored this way once and it was wrong. An entity anchor makes\n> the trace travel with the anchor, so utterances ACCUMULATE on a person and\n> get handed to whoever later stands next to them: a hero walking into a\n> tavern perceived another character's entire creation dialogue because the\n> NPC it was addressed to happened to be standing there (bead sk-oj6). It\n> bought nothing either — an entity anchor admits by co-location like any\n> other, so it was never addressee-exclusive delivery. For directed speech,\n> anchor at `TargetSpatialRef` (the addressee's place, never their entity)\n> and set `carry_addressee` (above).\n>\n> An entity anchor is right when the trace genuinely IS a property of that\n> object and should move with it — a tamper mark scratched into a chest,\n> the smell clinging to a carried corpse.\n\nA trace can be pinned to a specific entity instead of a fixed place —\n`location_kind = \"entity\"`, `location_ref = \"<entity_id>\"`. The trace then\ntravels with that entity: both ADR-0040 perception seams (inscription-time\nco-location and arrival-time co-location) admit whoever is co-located with the\nanchor entity's CURRENT position, re-resolved live — not the position it\noccupied at inscription time. This is explicitly **not** addressee-keyed\ndelivery: there is still no recipient column on `trace`; anyone who ends up\nstanding where the anchor currently is perceives it, the same free-overhearing\nshape a `place_node` anchor already has (ADR-0095).\n\nUse a literal entity id when the anchor is known at authoring time — a mark\nleft on a specific chest, say:\n\n<!-- snippet: entity-anchor-inscribe -->\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"my_bundle/tamper_mark\"\nlocation_kind = \"entity\"\nlocation_ref = \"42\"\npayload_json = '{}'\n```\n\nTwo authoring requirements come with it: the trace kind's\n`trace_kind_definitions.location_kinds` CSV must list `entity` (admission\nrejects an anchor scope the trace kind doesn't declare), and the referenced\nentity must actually exist (a bad `location_ref` is a loud authoring error,\nnot a silently unreachable anchor).\n\n### Anchoring to the current manipulation target (`TargetEntityRef`)\n\nWhen the anchor should be *whichever entity the dispatch is currently\ntargeting* rather than a literal id fixed at authoring time, use the\n`TargetEntityRef` binding token — a sibling of\n`ActorSpatialRef`/`TargetSpatialRef`:\n\n<!-- snippet: target-entity-ref-inscribe -->\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"srd/speech_heard\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetEntityRef\"\npayload_json = '{}'\ncarry_dispatch_text = true\n```\n\n`TargetEntityRef` resolves at `Inscribe` execution time to the manipulation\ntarget's entity id and then flows through the same `entity`-anchor path as a\nliteral `location_ref` — same `location_kinds` allowlist check, same\nco-location-with-current-position admission. A dispatch with no entity target\n(a place-node-targeted manipulation, say) fails loudly — \"frame binding:\nmissing TargetEntityRef binding\" — rather than silently anchoring nowhere.\n\nReach for this when the dispatch target is a THING the trace belongs to and\nshould travel with — marking whichever chest was tampered with, whichever\ncorpse was handled. It is the wrong tool for \"spoken to this person\": see the\nwarning at the top of the entity-anchor section, and use `carry_addressee`\ninstead.\n\n## Capabilities, Niches, Actions, Outcomes\n\nThe usual interaction chain is:\n\n1. `capability_definition`: what an actor may attempt.\n2. `niche_definition`: what kind of target can expose an interaction.\n3. `affordance_template`: capability + niche + predicate + outcome.\n4. `outcome_template`: the selected result identity and reducer-facing tags.\n5. `action_definition`: a concrete action row when a Layer-2 reducer dispatches\n through action metadata.\n6. `consequence_template` and `consequence_frame_writes`: durable mutation\n intent.\n\nOutcome tags are bounded metadata, not prose. Examples:\n\n```toml\ntags = \"movement.outcome=traverse_edge\"\ntags = \"manipulation.action_id=core/pickup_item\"\ntags = \"sense.query=look\"\n```\n\n## Finite Selections And Bounded Identity Writes\n\nA structured frame write can select a definition from an authored family:\n`{ \"allowed_ids\": [\"mymod/feature/a\", \"mymod/feature/b\"] }`.\nThe dispatch supplies the exact string `definition_ref`. A single-member\nfamily can omit it; a larger family cannot. Empty families, nonstring values,\nunlisted IDs and unresolved or out-of-scope definitions refuse admission or\nexecution rather than expanding the family. Tags, conditions and inserted\nitems each resolve against their own declared vocabulary.\n\n`SetEntityTag` carries `entity`, `tag` (the selection) and `present`. It\nidempotently adds or removes the selected instance tag, recording\n`source = \"frame_write\"`. It cannot write the player-seat tag or tags that\nsupply Party extents. Seed protected membership on the blueprint and use the\nadmitted authority route to change it. Identity and feature tags can derive\ncapabilities without manufacturing direct capability rows.\n\n`SetEntityText` carries `entity`, `destination` and an authored `max_chars`\nfrom 1 through 4096. It requires string `dispatch_text`, trims surrounding\nwhitespace and refuses empty or overlong text. The two destinations select\ndifferent table writes:\n\n- `\"EntityName\"` updates the entity name, matching embodied actor names and\n their seat labels. It does not change row identity or ownership.\n- `{ \"ObjectStateText\": { \"state_id\": \"mymod/backstory\" } }` updates an\n existing Text object-state row. It refuses a missing row or another value\n kind and preserves the row's visibility. Declare and initialize the home\n on the blueprint before offering this act.\n\nThese are structured `consequence_frame_writes`, not DSL expressions. Author\nfinite actions and their scoped bindings before play; the runtime selects\nadmitted arguments and observes receipts. See\n[the draft-then-confirm pattern](patterns/draft-then-confirm-wizard.md).\n\n## Kernel-Derived Target-Home Facts (`core/grounded`, `core/owned`, `core/contained`)\n\n*(added 2026-09-23, sk-jay0.1.23.36.22.4)* Every `Entity`/`Item` target\ncarries a kernel-populated fact naming its HOME — where the target\ncurrently sits, relative to the acting actor. `PlaceNode`/`PlaceNodeSet`/\n`PlaceEdge`/`Location`/`World` targets carry no home fact at all\n(`observed_targets.rs:199-203` returns no niches for those `TargetRef`\nvariants — there is nothing to be \"grounded\"/\"owned\"/\"contained\" relative\nto).\n\n**Read form: `target.has_niche(...)`, not `target.state(...) == true`.**\nBoth forms compile — `has_niche` reads the target's niche id list\n(`Op::HasNiche`, a plain membership check with no missing-key error path);\n`state` reads the SAME single-home value out of a separate bool-fact\nbucket (`Op::ReadBool`, `target_home_bool_fact`) — but exactly ONE of the\nthree home facts is ever populated per target (a grounded target carries\nno `core/contained` bool fact, and vice versa), and `Op::ReadBool` returns\n`Err(UnknownField)` — not `false` — when the field it names is absent\n(`crates/spellkave-dsl/src/eval.rs`). A predicate checking a single home\nagainst a target that turns out to have a DIFFERENT home therefore\n**errors closed** with `state()` (predicate_rejected, not \"cleanly\nfalse\") — and combining two homes with `||` makes this far worse: `Op::Or`\npropagates the first operand's error immediately (`crates/spellkave-dsl/\nsrc/eval.rs`'s `Op::Or` arm uses `?`, never catching a missing-field error\nto try the next operand), so `target.state(\"core/grounded\") == true ||\ntarget.state(\"core/contained\") == true` throws on whichever home is\nABSENT before ever reaching the second disjunct — a contained target can\nnever satisfy that predicate no matter what the second half says. Reaching\nthis for real (`@spellkave/srd-cc`'s `srd/pickup`) rejected every\ncontained-item dispatch with `predicate_rejected` until switched to\n`has_niche`. `has_niche` has no such trap — reads always find at most one\nof the three ids and simply return `false` for the other two:\n\n```toml\npredicate_source = \"target.has_niche(\\\"core/grounded\\\") || target.has_niche(\\\"core/contained\\\")\"\n```\n\n`TargetHome` (the world API) is a closed\nthree-variant enum — exactly three home states, mutually exclusive per\ntarget:\n\n- **`core/grounded`** — the target sits on the ground: it has its own\n `entity_location` row. Covers both entities (creatures, world objects) and\n items lying loose on the floor.\n- **`core/owned`** — the target is directly carried by the acting actor:\n equipped in one of the actor's equipment slots, or loosely contained with\n `container_id` = the actor's own body.\n- **`core/contained`** — the target is an item whose DIRECT container is a\n DIFFERENT entity that is itself grounded (has an `entity_location` row) and\n is NOT a body (no actor currently inhabits it) — e.g. a potion sitting in a\n chest on the floor. Disclosed as its own `Item` target fact, distinct from\n the chest's own `core/grounded` `Entity` target fact.\n\n Two consequences are deliberate, not oversights:\n - **Any authored open/closed/locked state on the container is ignored by\n this disclosure rule.** The kernel has no open/locked enum (by design —\n see §7.2.1's `PickupTargetItem` row) and does not consult one here. A\n world that wants \"only from an open chest\" gates it in an affordance\n predicate or niche predicate reading the container's OWN authored\n `object_state`/condition, layered on top of `core/contained`; it is\n `@spellkave/srd-cc` content, tracked as a backlog item there, never a\n kernel concern.\n - **An unbound body counts as a non-body container.** `is_body` (via\n `actor::actor_for_current_body`) is true only while some `actor` row's\n `current_body` currently points at the entity. A corpse — a body no\n actor inhabits anymore — is NOT a body by this test, so its loose\n carriage becomes a `core/contained` disclosure like any other grounded\n container's: a fallen creature's dropped-but-still-contained items are\n takeable.\n\n**Not disclosed at all** (no target fact, so no predicate can address it):\nan item in a machine port or other slotted containment, an item held by a\nDIFFERENT actor's body, and nested containment (an item in a bag that is\nitself inside a chest — the bag has no `entity_location` row of its own).\n`visible_entity_containment`'s possession set is unaffected by any of this —\nthese are independent, action-independent DISCLOSURE facts\n(`affordance_materialiser::observed_targets`), not a widening of what an\nactor's own inventory view returns (ADR-0120 postscript).\n\nThese are kernel literals (the world API),\nnot authored `object_state` or niche predicates — **do not author your own\nstate under these ids.** Unlike `core/distance_to_actor_mm` (above), which is\ndeliberately pushed into the act-path fact pool BEFORE per-entity\n`object_state` so it always wins a same-name collision\n(`r_manipulate/selection/spatial_facts.rs`'s documented ordering), the\ntarget-home facts share the Bool pool with place state. The act-path candidate\ncontext (`r_manipulate/selection/candidates.rs::manipulation_facts`) currently\nassembles place-state facts, then the kernel target-home fact, then explicit\nActor/Target entity Bool facts from the shared entity-state collector.\n`Op::ReadBool` resolves by first match. Do not rely on same-name collisions\nbetween these carriers; author entity state under bundle-owned ids instead of\n`core/grounded`/`core/owned`/`core/contained`.\n`@spellkave/srd-cc`'s self-sufficiency exception names all three explicitly\nas referenceable without a `core` bundle dependency (they are substrate, not\ncore-bundle content).\n\n## Conditions And Modifiers\n\nUse `condition_definition` for named effects with lifecycle, stack count,\nobservability, gates, or modifier behavior. Runtime application is a\n`target_condition` row. Client readers see the server-filtered\n`visible_target_condition` view. Mark a condition `observable = false` when the\napplied row should be hidden from unrelated clients; the runtime still shows it\nto the target body and the source body that applied it.\n\nTargets are now entity-shaped. An item is an entity whose kind is `item`, so\ncondition and consequence authoring should target `entity` unless a legacy\nruntime API explicitly asks for another shape.\n\nExample frame write:\n\n<!-- snippet: apply-status-frame-write -->\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"core/drink_poisoned_cup/success\"\nordinal = 0\nframe_write = { ApplyStatus = { target_kind = \"entity\", target_ref = \"Actor\", condition_definition_id = \"core/poisoned\" } }\n```\n\nUse `object_state` for ordinary object facts such as opened, lit, depleted, or\nlocked. Use conditions only when the fact has condition identity or modifier\nbehavior.\n\nRemoving a condition is a `RemoveCondition` frame write carrying a typed\n`source_match` selector that chooses which primary `target_condition` row(s) to\nremove:\n\n- `Exact` (keyed to the applying source's id) — remove only the row this source\n applied. Source-keyed cleanup: the default for self-reactions and targeted\n dispels.\n- `\"Any\"` — remove **every** matching primary condition row regardless of which\n source applied it. A source-agnostic cleanse, e.g. *Lesser Restoration* ending\n `poisoned` no matter who inflicted it. Each removed row still cascades through\n the same per-condition remove-time policy.\n\n<!-- snippet: remove-condition-frame-write -->\n```toml\n[consequence_frame_writes.frame_write.RemoveCondition]\ncondition_definition_id = \"srd/poisoned\"\nsource_match = \"Any\"\ntarget_kind = \"entity\"\ntarget_ref = \"TargetActor\"\n```\n\n### Modifier expiry is an absolute tick, not a runtime offset\n\n`ApplyModifier` (lowers to `FrameWriteOp::InsertModifier`) takes an\n`expires_at` parameter documented as \"optional world tick at which the\nmodifier auto-expires; `null` = permanent\". That tick is a literal integer\nbaked into the manifest/consequence at author time — there is no DSL\nexpression for \"N ticks from whenever this fires\" (no `current_tick() + N`\nequivalent). An author who wants \"this buff lasts 1 minute after the\ntriggering event\" cannot express it: the trigger time is runtime-determined,\nso no fixed tick authored in advance can be correct.\n\nTwo accepted workarounds, depending on what \"expiry\" needs to mean:\n\n- **A persistent flag instead of a timed buff**, via `object_state` (see\n above) — honest when the fact doesn't need to self-clear. (The former\n precedent, the Phandelver `phandelver/we8/bathe_weapon` action, is retired\n content; only its walkthrough survives under `archive/apps/world-walkthrough/`.)\n- **A self-pulsing scheduled effect**, via `ScheduleAutonomyJob` +\n `repeats_remaining`, when the effect genuinely needs to expire on its own\n after N rounds. See\n [`lingering-hazard-zones.md`](lingering-hazard-zones.md) — that pattern\n computes its own end condition at each pulse rather than pre-computing an\n absolute tick once.\n\n### Creating Tagged World Objects\n\nUse `CreateWorldObject` when a consequence should place a new entity-derived\nobject in the world. Its `tags` field is authored as a comma- or\nsemicolon-separated list; when the frame write succeeds, each tag is inserted as\nan `entity_tag` row on the newly created entity. Those rows are immediately\nvisible to `target.has_tag(...)` predicates and to later consequences that query\ninstance tags.\n\n<!-- snippet: create-world-object-frame-write -->\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"my_bundle/build_wall/success\"\nordinal = 0\nframe_write = { CreateWorldObject = { object_def_id = \"my_bundle/brick_wall\", destination = { Ground = { spatial_ref = { kind = \"binding\", id = \"TargetSpatialRef\" } } }, owner_ref = \"Actor\", initial_state_ids = [], tags = \"wall,cover,built_artifact\" } }\n```\n\nDefinition tags still belong in `[[entity_definition_tag]]` when every instance\nof the definition should share a classifier. `CreateWorldObject.tags` is for\nclassifiers that belong to the spawned instance produced by that authored\nconsequence.\n\n### Reacting to events with condition hooks\n\nA `condition_definition` row's `hooks[]` (see the generated `hooks[]` table\nin [`tool-reference.md`](tool-reference.md)'s `spellkave_define_condition`\nsection) let an ACTIVE condition react to something that happened elsewhere\nin the world — e.g. a concentrating caster's condition removing itself the\nmoment the caster takes damage. Each hook names an `event_kind` (e.g.\n`'Layer2.ResourceDelta'`, `'Layer2.ConditionDelta'` — the full closed set is\nwhatever `EventKind`/`Layer2Kind` currently produce; an unrecognised path is\na manifest-admission error, not a silent no-op), an optional\n`detail_filter_source` (an inline-DSL Bool sub-expression gating which\nINSTANCES of that event kind fire the hook), and a required\n`expression_source` (an inline-DSL Int sub-expression naming the side effect\nto apply when the hook fires; exactly one of `expression_source` or the\nlegacy numeric `expression` must be set — `ConditionHookRow` in\n`crates/spellkave-schema/src/lib.rs`).\n\n**Reading the firing event's own payload.** `detail_filter_source` and\n`expression_source` may read `$event.detail.<field>` — the fields available\ndepend on `event_kind` and are a DECLARED, closed set per kind (not every\nfield a detail table happens to carry is readable; the table is\n`EVENT_DETAIL_FIELDS` in `crates/spellkave-dsl/src/lib.rs`): `Layer2.ResourceDelta`\nexposes `entity_id`, `delta`, `new_value` (`Int`) and `template_id`,\n`resource_id` (`Text`); `Layer2.ConditionDelta`\nexposes `entity_id`, `applied` (`Int` 0/1 — the DSL's `$event.detail` grammar\nhas no `ReadBool` path), `condition_definition_id`, `template_id` (`Text`).\nReferencing a field a kind does NOT declare is a validation-time rejection at\nmanifest admission, not a runtime surprise. Every hook ALSO sees the\ncondition's own HOLDER as a fact, so a `detail_filter_source` can gate on \"did\nthis event concern the entity holding ME\": `target.stat('core/entity_id') ==\n$event.detail.entity_id`.\n\n**What a hook can actually DO when it fires.** `expression_source` is\nevaluated as an outcome expression, same as a consequence's own outcome\nside. Today, the only side effect that reliably reaches execution is\n`invoke_outcome_graph('<consequence_template_id>')` — the referenced\n`consequence_template` runs with the FIRING condition's own holder bound as\n`Actor`/`TargetActor` (self-targeting by default, e.g. a hook whose job is\nto remove its own holder's status). Every OTHER outcome shape a hook might\nauthor (`modify_resource(...)`, `apply_status(...)`, `arbitrate(...)`, a\nbare `RemoveCondition`/`EmitTrace`/`OutcomeSequence` op with inline\nparameters rather than a template reference) is recorded as an explicit\nskip — never applied, never silent — because a hook has no template id to\nresolve those against; a future change may close specific ones of these,\nbut do not author them expecting them to fire. The concentration idiom —\n\"remove my own condition when I take damage\" — is expressed as one\n`condition_definition` whose `hooks[]` entry names `event_kind =\n'Layer2.ResourceDelta'`, a `detail_filter_source` checking holder identity\nand `$event.detail.delta < 0`, and an `expression_source` of\n`invoke_outcome_graph('<bundle>/remove_own_condition')` pointing at a small\nconsequence template whose own `RemoveCondition` frame write does the\nremoval.\n\n## Epistemic Read Visibility: Internal, Discoverable, RevealState\n\nWhat the three base tokens mean for *delivery* — which clients receive a\nstate row at all (ADR-0120 as amended by ADR-0133):\n\n- **`Public`** — reaches every client that can *perceive* the owning body:\n its own controller, a DM whose extent covers it, anyone co-present (same\n place node, or a cell of the same combat grid), its session peers, a DM\n whose place-graph extent contains it, and the world's operator (the\n module publisher or a body with manifest-apply authority, who reads\n everything). Not the whole world otherwise: a creature's hit points in one\n room never reach a player whose bodies are elsewhere. `observable = true`\n on a condition lowers to this class. The rule is about *bodies* — entities\n an actor embodies; state on anything else (an item, a lever, a door, a\n container) reaches every client as it always did.\n- **`Local`** — reaches only its own controller, a covering DM extent,\n co-present bodies, and the operator; session peers in another place do\n not receive it.\n- **`Hidden`** — reaches only the owning body's controller (and a covering\n DM extent); perceiving the body never opens it.\n\nADR-0081 adds two\n`VisibilityClass` tokens alongside `Public`/`Local`/`Hidden` (authored the same\nway — definition default via `default_visibility`, per-row override via\n`visibility`; see the DM-oversight guide below for how elevated scope reads\nall five):\n\n- **`Internal`** — never delivered via the plain owner path, not even to the\n body that owns the row. Use it for mechanical simulation state no character\n \"knows\": encounter flags, hidden-loot dedup guards, pacing/authoring\n counters. An `Internal` row reaches a client only through an\n [ADR-0007 D-4 extent grant](dm-oversight.md) that explicitly authors\n `elevation_class = \"internal\"`\n (ADR-0084,\n #1938) — an ordinary extent grant with no `elevation_class` (the default,\n e.g. a `party` grant shared between ordinary party members) does NOT reach\n it.\n- **`Discoverable`** — delivered via the plain owner path only once the owning\n body has *learned* the fact. Use it for quest-stage trackers, clues, and\n other content a character comes to know during play rather than knowing\n from the start. An `elevation_class = \"internal\"` reader sees it ungated,\n same as `Internal`; an ordinary (default-ceiling) extent grant does not —\n it still needs the owning body to have learned the fact.\n\n<!-- snippet: discoverable-object-state-definition -->\n```toml\n[[object_state_definitions]]\nbundle_id = \"my_bundle\"\nstate_id = \"my_bundle/hidden_passage_found\"\ntarget_kind = \"entity\"\ndisplay_name = \"Hidden passage found\"\ndefault_visibility = \"Discoverable\"\n```\n\nA `Discoverable` row's \"learned\" gate is a per-body `observer_state_knowledge`\nrow, written explicitly by a `RevealState` frame write — never inferred or\npolled. Author it in the *same* consequence that teaches the fact (finishing a\ndialogue, succeeding an inspect check, advancing the quest stage):\n\n<!-- snippet: reveal-state-frame-write -->\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"my_bundle/study_the_map/success\"\nordinal = 1\n\n[consequence_frame_writes.frame_write.RevealState]\nowner_ref = \"Actor\"\nstate_id = \"my_bundle/hidden_passage_found\"\n```\n\n`owner_ref` (`Actor` / `TargetActor` / `TargetEntity` / a literal entity ref)\nnames the body whose `object_state` row becomes known; the *learner* is always\nthe acting subject (`Actor`) — the body that triggered the consequence, not\nnecessarily the row's owner. `state_id` must already have a live\n`object_state` row on the resolved owner, or the write is rejected\n(`RevealState: no object_state row for entity … state '…' — modder typo?`).\n\n**The authoring footgun this exists to warn about:** a `Discoverable` row with\nno matching `RevealState` write anywhere in the bundle is *pre-instantiated\nbut permanently ungated* — the owning body can never see it, silently, with\nno validator diagnostic (this is a live-prove concern, not a static one). When\nyou flip a state definition to `Discoverable`, grep the bundle for every\nconsequence that should teach that fact and add the paired reveal write in\nthe same PR.\n\n## Area-of-effect frame writes\n\nA frame write normally hits one target. To affect *every* actor an area shape\ncovers, wrap the per-target effect in a `ForEachActorInRadius` op. It selects\nactors against an authored `area_shape_definition` and runs its `body` once per\nselected actor, rebinding `Actor`/`ActorSpatialRef` to each one.\n\n<!-- snippet: aoe-for-each-actor-in-radius -->\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"aoe-blast/cast_firebloom/success\"\nordinal = 0\nframe_write = { ForEachActorInRadius = { center_ref = \"ActorSpatialRef\", shape_id = \"core/area/node_ball\", shape_params_json = '{\"ball_radius\": 0}', predicate_source = \"d20 < 13\", body = [ { ModifyResource = { actor = \"Actor\", resource = \"aoe-blast/hp\", delta_source = \"-d6\" } } ] } }\n```\n\n- `shape_id` references an `area_shape_definition` row. `core/area/node_ball`\n is topological (centre node + nodes within `ball_radius` graph-edges; `0` =\n same node) and works on any graph; `core/area/sphere` (`{\"radius_m\": 5.0}`) is\n metric and needs nodes with `pos_x`/`pos_y`.\n- `actor = \"Actor\"` in the body is the *per-actor* binding (the selected actor),\n not the caster.\n- `predicate_source` is an authored per-target DSL **Bool** evaluated once per\n selected actor (ADR-0045 D-2). `\"\"` = no filter (hit everyone); `\"d20 < 13\"`\n is a flat per-target DEX save — the body runs only on a failed save.\n A per-candidate `UnknownField` (the occupant never bound a fact the\n predicate reads — e.g. an HP-less dummy next to a lethality guard) **skips\n that actor** and writes an `evaluation_provenance` `write_failure` row; it\n does **not** abort the batch or roll back sibling writes (sk-pgsm;\n ADR-0045 Postscript 2026-09-02). Parse errors, wrong value-type, and\n draw-limit exceeded stay fatal for the whole consequence (ADR-0045 D-5).\n This skip is the **bystander / non-opted-in occupant** rule; it does not\n soften `UnknownField` on the **primary dispatch subject** (a resolution\n predicate, an outcome-graph guard, or `core/dispatch_arg_quantity` — see\n [Dispatch Argument Quantity](#dispatch-argument-quantity-coredispatch_arg_quantity)\n above). Still author **membership before measurement**\n (`has_tag(...) && stat(...)`) so a bystander short-circuits before the\n missing-fact read, rather than relying on the skip.\n- `delta_source` is an authored DSL **Int** expression evaluated per target\n (ADR-0045 D-1): a literal (`\"-7\"`), a dice roll (`\"-d6\"`), arithmetic\n (`\"-d4 - 1\"`), or a `cond` (save-for-half: `\"cond(d20 >= 13, 0 - d6 / 2, 0 - d6)\"`).\n- Dice expressions use a formula-aware draw budget (ADR-0059): the evaluator\n sizes the finite RNG draw allowance from the authored expression, so high-draw\n faithful save-for-half formulas such as `\"cond(d20 >= 13, 0 - (20d6 + 20d6) / 2, 0 - (20d6 + 20d6))\"`\n are authorable while oversized formulas still fail closed at the ceiling.\n- A resource named by `ModifyResource` must have a `resource_definitions` row,\n or the bundle is rejected (`MF-VAL-217`) — this closes the old \"spell admits\n but does nothing\" silent no-op.\n\nWorked, validating example: [`examples/aoe-damage-spell.toml`](./examples/aoe-damage-spell.md).\nDice damage and per-target saving throws are now authorable (ADR-0045), and\n**ranged placement** is authorable via the affordance's `range_m` (ADR-0053): a\nranged spell can act on a distant cell or entity within metric range, not only\nthe caster's own node. What an AoE damage spell still **cannot** express —\ndamage-type routing and level scaling — remains open under\n[#266](https://github.com/b4arena/spellkave/issues/266); per-caster range\n*modifiers* (folding a caster bonus into the authored `range_m` literal) are\nalso still deferred.\n\n## Spawn And Despawn Effects\n\n`Spawn` and `Despawn` are `effect_definition` primitives for runtime lifecycle\nchanges:\n\n- `Spawn` creates an entity or place-graph instance from `blueprint_id`.\n- `Despawn` removes an entity or place-graph instance named by `target_ref`.\n\nDirect cast effects may use the same frame bindings as the rest of the\nconsequence path. For `Spawn`, author `location_ref` as a binding spatial ref to\nplace the new instance at the caster's or selected target's runtime cell:\n\n```json\n{\n \"blueprint_id\": \"core/item/loot_dagger\",\n \"location_ref\": { \"kind\": \"binding\", \"id\": \"ActorSpatialRef\" }\n}\n```\n\n`TargetSpatialRef` is also accepted, but it must resolve to a `place_node`; refs\nthat resolve to a place edge or another spatial kind are rejected at the normal\nplacement boundary. Literal `{\"kind\":\"place_node\",\"id\":\"...\"}` refs still place\nat the authored node exactly as before.\n\nFor a world-owned playable vessel, `Spawn` accepts `unbound_actor = true`.\nIts entity blueprint supplies the actor, seat identity, initialized states\nand initial capabilities. The resulting actor has no identity binding; a\nlater seat claim controls it. This mode refuses place-graph blueprints\n(`MF-VAL-386`). Omitting the field retains the existing spawn behavior.\nA creation blueprint is unplaced authoring data, so adventure re-apply does\nnot redeclare the spawned body or its subsequently inserted inventory.\n\nThe invoking actor is the caller's acting seat. One person may hold several\nseats in a world (ADR-0161 D-5); when the caller's token carries the consent\nclaim `urn:spellkave:seat`, the default `Actor` binding resolves to the pinned\nseat only, and a `Spawn` binds its summoner identity to the controlling actor\nonly when that pin admits the controller. An unpinned caller keeps the\nexisting behavior.\n\nFor `Despawn`, an entity target can bind to the invoking actor or selected target\nentity:\n\n```json\n{\n \"target_ref\": { \"kind\": \"binding\", \"id\": \"TargetEntity\" }\n}\n```\n\n`Actor` is also accepted for entity despawn. Literal entity refs and\n`place_graph` refs stay literal. Missing bindings fail the reducer instead of\nguessing a runtime row. Despawn releases the spawned body's `summoner`\nbinding first; if that release fails, the consequence is refused with an\nerror and nothing changes. The current guard protects every playable vessel,\nincluding an unclaimed unfinished creation body. Do not use ordinary Despawn\nas an abandonment cleanup route; automatic replacement requires a separate\nadmitted transition.\n\nGraph Despawn removes every `place_edge_affordance` gate on each removed\ngraph-owned edge, including multiple templates and traversal modes, in the\nsame transaction as that edge. Session close and authored automatic\ntermination share this teardown. Gates on surviving edges remain. Legacy\norphan gates drain in capped world-clock sweeps; that repair pauses while a\nmanifest apply, failure/quarantine or applyset staging is pending. Publisher\ndoctor reports residual gates with `place_edge_affordance_has_edge`.\n\n## Equipment\n\nEquipment is entity-based:\n\n- `equipment_slot_definitions` defines slot vocabulary.\n- `entity_definitions.slot_compatibility_predicate` gates which entity\n definitions fit a slot. The field is a closed three-form grammar\n (ADR-0118: `\"\"`/`\"true\"`, `\"false\"`, `slot_id == \"<id>\"`), not a\n `spellkave-dsl` expression.\n- `actor_equipment_slots.item_key` names an authored item entity key.\n\n<!-- snippet: actor-equipment-slot -->\n```toml\n[[actor_equipment_slots]]\nactor_entity_key = \"srd/regdar\"\nslot_id = \"srd/main_hand\"\nitem_key = \"srd/item/dagger\"\n```\n\n### Reading an explicitly equipped item\n\nUse `actor.equipped_item('your-bundle/slot')` when a rule needs the item in a\nparticular authored slot (ADR-0126). The argument is a nonempty literal slot\nidentifier admitted in the bundle's reference scope, not a weapon category or\nan item selector inferred by the runtime. For example:\n\n```text\nactor.equipped_item('demo/main-hand').has_tag('demo.weapon')\nactor.equipped_item('demo/main-hand').stat('demo/charge')\nactor.equipped_item('demo/main-hand').source('demo/damage')\n```\n\nExactly one existing equipped item supplies tag, integer/text state, and source\nfacts. An empty slot, dangling item, or duplicate occupancy supplies no item\nfacts; there is no carried-item fallback. Missing positive tag tests are false;\nmissing scalar/source reads fail closed through the evaluator's normal errors.\nSource bodies retain the original interaction Actor and Target, rather than\nrebinding either to the selected equipment item. Equipment status, effective\nstate and resource-bound accessors are not added by this subject.\n\nThe legacy `actor.wielded_item` remains compatible: its current resolver picks\nthe lowest-ID equipped item across slots, or the lowest-ID carried item when\nnone is equipped (`selection/entity_facts.rs::resolve_wielded_item_entity`).\nIt does not distinguish armor from weapons. Content adopting explicit slots\nmust use the same authored slot across gates and attack/damage formulas; the\nnew accessor does not automatically migrate existing SRD expressions.\n\n### Weapons carry their own damage (attacker-sourced)\n\nAttack damage is **attacker-sourced**: the generic melee/ranged archetypes read\n`actor.equipped_item('srd/slot/main-hand').source('srd/damage')` from the same\nauthored slot used by their weapon eligibility predicates (ADR-0126;\n`spellkave-srd-cc/src/chapters/equipment/weapon-subject.ts`). A weapon-like `entity_definition` must\ntherefore ship a def-level `entity_definition_item_dsl_source` row for slot\n`srd/damage` — otherwise it materialises the attack affordance but fails closed\nat act time with `MissingItemDslSource` (ADR-0035 / ADR-0045 §D-5). That slot is\nmacro-aware (#2218): `source` may call `macro('srd/strength_modifier')`; commit\npersists the expanded AST and act time evaluates the cached tree:\n\n<!-- snippet: weapon-damage-source -->\n```toml\n[[entity_definition_tag]]\nentity_def_id = \"srd/item/longsword\"\ntag = \"srd.weapon\"\nbundle_id = \"srd\"\nsource = \"manifest\"\n\n[[entity_definition_item_dsl_source]]\nentity_def_id = \"srd/item/longsword\"\nslot = \"srd/damage\"\nsource = \"1d8 + ((actor.stat('srd/str') - 10) / 2)\"\nbundle_id = \"srd\"\n```\n\nThe validator surfaces a missing slot as **`MF-VAL-268`** (a Warning, not a\nrejection — the runtime already fail-closes, and a decorative weapon prop may\nnever be wielded). It fires for exact `srd.weapon`-tagged defs in the `srd`\nbundle or an srd-dependent bundle (sk-hml / #2184). An authored formula that\nreads `stat`/`effective`/`resource_max`/`resource_min` for an id with no\ncatalog row is **`MF-VAL-329`** — it names the owning row and the\nmissing symbol rather than waiting for act-time `UnknownField`. It is Fatal\nwhen the owning bundle's `depends_on` closure is fully present (or on live\nadmission) and Info with a hint when it is not, the same two-tier trust as\n`MF-VAL-217`, so a per-file validate of a formula reading `srd/str` declared\nin another file does not fail closed. See also\n[`packages/spellkave-srd-cc/docs/attack-and-damage.md`](../../spellkave-srd-cc/docs/attack-and-damage.md)\nand [`authoring-damage.md`](../../spellkave-srd-cc/docs/authoring-damage.md).\n\n## Observing What Happened\n\nUse JSONL commands rather than ad hoc SQL when possible:\n\n```bash\nspellkave manifest apply packages/spellkave-srd-cc/fixtures/manifest.toml # or: just seed <manifest>\nspellkave events 20\nspellkave manipulation-context actions <perceiver_entity_id>\nspellkave item list\nspellkave inventory list <entity>\nspellkave doctor\n```\n\n`manipulation-context actions` emits the caller-visible available-action\nfacts for one perceiver (ADR-0139; siblings `targets`, `participants`,\n`prompts`, `inspect`, `list`); the old per-actor affordance cache and its\n`affordance list` command are retired.\n\nEvery `spellkave` command emits one JSON object per line. Exit code `2` means\nan in-world assertion or validation finding; exit code `1` means infrastructure\nfailure.\n\nFor an ordinary direct `r_manipulate` action, an error returned by its frame\naborts that reducer transaction, including synchronous nested condition hooks,\nresources, conditions, events and new provenance. The invocation rejects;\nit does not retain a new `Failed/write_failure` receipt. Pre-frame admission\nrefusals still retain their structured failure receipt. Composition child\nfailure tolerance and scheduled-job isolation have separate caller policies;\nthis guarantee does not extend to those paths. The live proof (`frame-failure-atomicity.live.test.ts`, in the TypeScript\nadventure-runtime live tier) was deleted with the TypeScript host (sk-jay0.1.55.60.8).\n\nDoctor's `retained_execution_failure` warning identifies caller-visible\nAffordance/Failed/write_failure provenance: a committed execution failure whose\nrollback is unverified. It cannot reconstruct lost HP, rewards or other prior\nvalues, and hidden rows may be absent. Preserve historical evidence and audit\nmanually; do not replay failed actions or clear receipts as an automatic repair.\n\nRuntime evaluation history is finite: after event pruning, a clock sweep\nkeeps each linked evaluation while any cited terminal event remains, and\nretains the newest configured number of unlinked historical rows. Pending\nstochastic/arbitration work, all prompt consumptions' accepting evaluations\n(including closed occurrences), and receipts born in the current clock\ntransaction are protected. Each sweep deletes at most128 eligible rows;\nlegacy excess converges across advances. Missing expired evidence does not\nprove a failed commit. The existing `event_retention_limit` controls this\nhistory without changing its default or caller visibility. Publisher doctor\nchecks every consumption's accepting reference with\n`prompt_consumption_has_provenance`.\n\n## NPC Behavior\n\nManifests do not author autonomous NPC decision logic. A bundle can place an\nNPC entity and grant capabilities, but any creature behavior must come from an\nexternal SDK client that observes state and submits intents. In-module autonomy\nis reserved for scenery and mechanical jobs, not actor preference or planning.\n\n\n## Tagging DSL in TypeScript generators\n\nAuthors write DSL as TypeScript string literals, not as TOML. Mark those\nliterals with the `dsl` tagged template from `@spellkave/world-author` so\nthe text is greppable and can be validated without changing what generators\nemit:\n\n```ts\nimport { dsl } from \"@spellkave/world-author\";\n\ngate_predicate_source: dsl`1 == 1`,\n```\n\nThe tag is `String.raw`: interpolations work, the returned string is identical\nto a plain template. Do not introduce a second grammar here — `crates/spellkave-dsl`\nis the language (ADR-0131).\n",
197
+ "join-session-global-scope": "# `JoinSession`/`LeaveSession` read a GLOBAL `turn_state.scope_session_id` — the acting entity does not need to be a participant, but the room-alarm gate it often pairs with is a `spatial_environment_state`, not an `object_state`\n\nA `JoinSession { participant_ref: \"Actor\" }` frame-write (mid-combat\nreinforcement) and `LeaveSession { participant_ref: \"TargetActor\" }` (mid-combat\nflee) both resolve their target session from `turn_state.scope_session_id` — a\n**singleton**, not a per-actor field. It is set by session-open/`r_advance_turn`\nand cleared only when that session closes. The world-tick heartbeat of a\npromoted travel session does not take the scope from another live session, so\n`JoinSession`/`LeaveSession` fired while somebody travels beside a fight still\nresolve to the fight. Consequence: an off-grid,\nnon-participant entity can perform a self-eligible act that fires `JoinSession`\non itself and land correctly in whichever session is currently live — you do\nNOT need to pre-enroll it as an initial participant (every initial participant\ngets seated on the grid at session-open; there is no authored \"enrolled but\noff-grid\" state), and you do NOT need a `TargetActor` ref from an on-grid\ncombatant (cross-graph targeting rejects a grid cell targeting a room node, and\nvice versa — `place_graph_id` must match). The joiner must currently sit on a\nnon-ephemeral node: leftover positions on any ephemeral tactical-grid instance\n(`place_graph_definition.is_ephemeral_instance`) are rejected at join (\"already\nseated on this session's grid\" / \"already seated on an ephemeral grid\").\nSession-open is the reseat path — it ignores those leftover cells and\nrow-major-seats from the new grid, restoring later to the new grid's\n`anchor_node_id` (BL-76). `participant_ref` only ever\nresolves to `Actor`, `TargetActor`, or a literal numeric entity id (never\nauthorable, since entities are runtime-minted) — so the joiner/leaver must\nalways be the acting entity or its target, never a third named NPC.\n\nSeparately: an alarm-style room flag an outsider act needs to read (`raise the\nalarm` → `rush to reinforce once alarmed`) is authored as a\n`spatial_environment_state` (topology-scoped, keyed by `place_node_id`, written\nvia the `ActorReachableNodes:<n>` Inscribe binding) — NOT an entity `object_state`.\nRead it with `readSpatialNodeStateBool({ placeNodeId, stateId })`\n(`@spellkave/sdk`), never `readObjectStateInt` keyed by the entity: the two\ntables are disjoint, and a probe that reads the wrong one silently returns\n`null`/`0` forever without ever failing loudly.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
198
+ "leave-session-relocates": "# `LeaveSession` always relocates the leaver off the tactical grid — it removes a participant from the turn order at the cost of taking the body out of the scene, so it is the wrong tool for a corpse\n\nTo keep a body in the scene but stop handing it the turn, author\n`turn_eligibility_pred` on the session definition (ADR-0143). Reach for\n`LeaveSession` only when the entity is really leaving.\n\n## Skipping a participant: `turn_eligibility_pred`\n\n`r_advance_turn` hands the turn to every `session_participant` in order,\nunless the session's `[[session_definitions]]` row authors a Bool\n`turn_eligibility_pred`. With one, the advance scans the roster onward from the\noutgoing actor. It evaluates the predicate with each candidate as `actor`, and\nthe first candidate for which it is true gets the turn:\n\n```toml\n[[session_definitions]]\nsession_def_id = \"adventure/session/crypt-fight\"\nbundle_id = \"adventure\"\nturn_rule = \"Sequential\"\nturn_scheduler_id = \"srd/turn/initiative\"\n# Or call a zero-parameter Bool macro, so every combat session shares one rule.\nturn_eligibility_pred = \"actor.status('srd/condition/dead') == false\"\n```\n\nThe reference use is the srd ruleset's macro `srd/takes-turn` (body\n`actor.status('srd/condition/dead') == false`), which every srd combat proof\nsession names as `turn_eligibility_pred = \"macro('srd/takes-turn')\"`. It skips\na dead monster and a PC after its third failed death save, but keeps an\nUnconscious PC in the rotation so it can make its death save\n(`packages/spellkave-srd-cc/docs/death-and-dying.md`; live proof\n`packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/takes-turn.test.ts`).\n\nWhat a skipped participant keeps and loses:\n\n- It **stays a participant**. It is still targetable, lootable and seated on\n the grid, and `participant_tag_group_count(..)` in a `termination_pred`\n still counts it.\n- It never becomes the current actor. It gets no `TurnStart`/`TurnEnd`, no\n budget refresh, no recharge, no boundary autonomy job, and no start-of-turn\n hazard.\n- **Only its owner-keyed condition expiries fire** as the scan passes its\n slot. A condition the dead caster keyed to its own turn on a *living*\n target still ends on schedule.\n- If a ruleset needs a creature's other boundaries (a Paralyzed creature's\n end-of-turn save, a dying character's death save), that creature must stay\n eligible. Name only the state that should skip, for example Dead, not\n Incapacitated.\n- Revival is automatic: the predicate reads the live condition, so healing or\n clearing the condition makes the body eligible again at the next advance.\n\nEdge cases:\n\n- If **nobody** is eligible, the advance falls back to the unfiltered rotation\n and logs it. A `termination_pred` should end such a fight first.\n- A predicate that errors at run time counts the candidate as eligible and\n logs the error.\n- A participant that becomes ineligible **on its own turn** keeps the turn\n until something calls `end_turn`. The kernel never takes a turn away\n mid-turn (ADR-0092 D-1), so a seat or the player still ends it.\n\nThe predicate may read only the candidate's own facts: `actor.stat`,\n`actor.effective`, `actor.resource_max`/`resource_min`, `actor.status`,\n`actor.has_tag` and `actor.has_capability`, composed with literals,\ncomparisons and boolean logic. Dice, `target.*`, `has_niche`, `has_item`,\n`participant_tag_group_count` and `implied_by_count` are refused by\n`MF-VAL-334`. `spellkave session-def inspect <id>` shows the predicate a live\nworld carries.\n\n## `LeaveSession` is leaving, not skipping\n\n`FrameWriteOp::LeaveSession` deletes the `session_participant` row the\nrotation walks. Its own contract (BC-8) says so: it does not touch\n`current_actor`, and the next advance simply no longer finds the leaver.\n\nIt also relocates the leaver to its `pre_session_place_node_id` (BC-4), or to\nan authored `destination` if you supply one. That is not a side effect you can\nswitch off. It is half of what the op is for, and it is why the op exists\n(Klarg wriggling free and fleeing the fight). Applied to a body that should\nstay in the scene, it removes the body from the scene.\n\nLive-measured (sk-awlo.3, 2026-08-27) by wiring it as a consequence of\n`srd/condition/dead`: the mechanism worked exactly as designed. The corpse\nleft the roster and the turn moved on, proving BC-8 for the first time. The\nsame run turned three green `combat-arena` cases red, the first of them\n\n```\nError: manipulation context did not disclose `entity:13` as an observed target\n```\n\nbecause the corpse had been relocated to `srd_proof_scene/combat_arena_gate`,\noff the grid, where nothing on the grid can target it. A player who wants to\nsearch the body cannot find it, and neither can the loot drop that anchors on\nthe victim's node. Leaving also drops the body from `termination_pred`\ncounting.\n\nSo reach for `LeaveSession` when the entity really is **leaving**: fleeing,\nwithdrawing, being carried away. For a participant that should remain present\nand targetable, use `turn_eligibility_pred` above.\n\nTwo further things that bite when you do use it, both live-confirmed:\n\n- **Gate it, or it takes the trigger down with it.** Condition-hook side\n effects are *not* isolated from the event that fired them.\n `record_event_typed` ends in `resolve_condition_hook_intents_for_event(..)?`,\n which propagates back into `apply_status`. A `LeaveSession` that errors\n (no ambient session, holder not a participant, terminal lifecycle, no restore\n target) aborts the very `ApplyStatus` that triggered the hook. Wire a death\n to it ungated and the first creature to die outside combat simply refuses to\n die. `target.stat('core/session_id') > 0` is the gate; it is absent, never\n zero, for a non-participant, and a hook `detail_filter` reads that absence as\n \"this hook does not apply to me\".\n- **Do not author a literal `destination` just to dodge BC-9.** The default\n restore target is the participant's own `pre_session_place_node_id`, which is\n the correct per-creature answer; a literal node teleports every leaver in the\n world to the same place. Both enrolment paths write that field, so BC-9's\n empty-target error is defensive for anyone actually seated in a session.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
199
+ "lingering-hazard-zones": "# Lingering hazard zones (caster-attributed pulses)\n\nHow to author a hazard zone — *Cloudkill*, *Stinking Cloud*, *Web*, *Spike\nGrowth* — that damages whoever stands in it **each round on its own**, for a\nbounded duration, then fades. No player re-casts every turn; the zone pulses\nitself.\n\n> **Binding decision:** ADR-0054 — Caster-attributed autonomy jobs.\n> Substrate concept: [autonomy-jobs](../../../docs/data-model-concepts/autonomy-jobs.md).\n> The worked example below is the **historical** `srd` Cloudkill — the prose\n> and TOML shape are still correct (ranged placement via `anchor_place_node_id`,\n> the liveness-policy choice), but every artifact it cites is now archived:\n> `packages/spellkave-srd` was retired to `archive/packages/spellkave-srd/`\n> (`world-fixtures-retirement`, 2026-08-11, `sk-mts`) and its Tier-3 live proof\n> (`archive/packages/spellkave-srd/src/test/live-preseeded/zones.ts`,\n> `cloudkill_schedules_a_bounded_self_pulsing_zone`) no longer runs against this\n> tree; the original Rust `client/tests/cloudkill_lingering_zone.rs` it was\n> ported from is gone outright (deleted per #1219, not merely archived). The\n> live `srd-cc` Cloudkill (`packages/spellkave-srd-cc/fixtures/base/spells/level-5/cloudkill.toml`)\n> is identity-only — it does not author the self-pulsing shape this page\n> describes. **Live examples of the cast-scheduled shape** (a cast that\n> inscribes the marker and schedules a `ScheduleAutonomyJob` pulse with a\n> per-cast `source`) are the srd-cc Moonbeam and Spike Growth:\n> `packages/spellkave-srd-cc/fixtures/base/spells/level-2/moonbeam.toml`\n> (`srd/spell/moonbeam/schedule`, `srd/spell/moonbeam/pulse`) and\n> `packages/spellkave-srd-cc/fixtures/base/spells/level-2/spike-growth.toml`.\n> **For the no-cast shape** (a subject-bound `[[autonomy_jobs]]` row plus a\n> `ForEachActorInRadius` → `ModifyResource` pulse), see\n> [\"A manifest-authored hazard (no cast)\"](#a-manifest-authored-hazard-no-cast)\n> below — `packages/spellkave-mechanics/fixtures/mech_burning_room`,\n> generated (not hand-authored) and checked for byte-identical regeneration\n> by `pnpm --filter @spellkave/mechanics run generate:check`.\n\n## The shape\n\nA lingering hazard is **two** authored pieces plus the existing autonomy\nscheduler:\n\n1. **The cast** schedules a bounded recurring job that carries its caster.\n2. **The pulse** is a subject-bound `consequence_template` that fans damage over\n the zone's occupants. The autonomy scheduler re-fires it each round until it\n expires.\n\nWhy \"caster-attributed\"? The world clock has no acting subject of its own, so it\nmay not reach actors (ADR-0004 / ADR-0041 — *\"the clock killed the goblin\"* is\nforbidden). The fix is **provenance**: the job stores its caster, fires in a\n*non-ambient* context, and every pulse is attributed to that caster. The fence is\nsatisfied, not relaxed.\n\n## 1. The cast schedules the job\n\nYour cast action's success `consequence_template` references an\n`effect_definition` whose primitive is `ScheduleAutonomyJob`. At reducer time the\nscheduler captures the casting frame's actor into `autonomy_job.subject` **and**\nthe cast's resolved target cell into `autonomy_job.anchor_place_node_id` (ADR-0055).\n\nThe same `success` consequence ALSO inscribes the lingering marker\n(`Inscribe { kind = \"spatial_environment_state\" }`) — the marker write must stay\non the cast, because the autonomy fire-time fence admits only\n`ForEachActorInRadius` / `ModifyResource` / `ApplyStatus` frame writes on the\nclock (no `Inscribe`; `AUTONOMY_ELIGIBLE_FRAME_WRITES`,\n`crates/spellkave-validate/src/autonomy_jobs.rs`).\n\n```toml\n[[consequence_templates]]\ntemplate_id = \"srd/cast_cloudkill/success\"\neffect_refs_csv = \"srd/cast_cloudkill/schedule\"\n\n[[effect_definitions]]\neffect_def_id = \"srd/cast_cloudkill/schedule\"\nprimitives_csv = \"ScheduleAutonomyJob\"\n# repeats_remaining bounds the duration (10 rounds); requires_subject_alive picks\n# the liveness policy (see below). fires_at_ms is an ABSOLUTE fiction time\n# (ScheduleAutonomyJobParams, schedule_autonomy_job.rs), not an offset from the\n# cast: 6000 is already past in any running world, so the first pulse fires on\n# the next world tick after the cast. The {Actor}/{tick} placeholders in `source`\n# are interpolated at cast time (ADR-0055 D-3) so two casters — or one caster\n# re-casting — each get a distinct job_id instead of colliding on the PK.\nparameters_schema_json = '{\"dsl_function\":\"srd/cast_cloudkill/pulse\",\"fires_at_ms\":6000,\"payload_json\":\"{}\",\"source\":\"srd/cloudkill/{Actor}/{tick}\",\"frequency_ms\":6000,\"repeats_remaining\":10,\"requires_subject_alive\":false,\"priority\":0}'\n```\n\n> **Per-cast `source` (ADR-0055 D-3).** `job_id` is derived as\n> `\"<dsl_function>/<source>/<firing_key>\"`, where the firing key is\n> `at-ms-<fires_at_ms>` (or `boundary-<boundary>-owner-<owner_actor>` for a\n> boundary-relative job) — `build_runtime_job` / `resolve_firing_mode` in\n> the world API.\n> A static `source` makes two\n> concurrent casts collide on the primary key, capping the world at one live\n> instance per spell. Author `source` with an `{Actor}`, `{ResponsibleSubject}`,\n> or `{tick}` placeholder and the scheduler interpolates it at cast time —\n> identity still lives in the typed `subject` column, the string is only the\n> cancel/provenance key.\n\n## 2. The pulse damages occupants\n\nThe scheduled `dsl_function` resolves to a `consequence_template` whose frame\nwrite is a `ForEachActorInRadius` carrier fanning a `ModifyResource` leaf over\neach occupant. The carrier rebinds `Actor` to each occupant per leaf while the\ncaster stays the responsible subject. **You choose where the zone centers** via\n`center_ref`:\n\n| `center_ref` | Behaviour | Use for |\n|---|---|---|\n| `\"TargetSpatialRef\"` | the zone stays fixed on the **cast cell** (the captured anchor, ADR-0055), independent of where the caster moves | *Cloudkill* dropped on a distant cell |\n| `\"ActorSpatialRef\"` | the zone **follows the caster** (re-centers on the caster's current cell each fire) | a mobile aura |\n\nThe srd Cloudkill anchors on the cast cell with `\"TargetSpatialRef\"` — it resolves\nto the `anchor_place_node_id` captured at cast time, so the cloud lands on, and\nstays on, the targeted cell rather than drifting with the caster. The damage is the\nreal SRD payload, not a flat surrogate: 5d8 poison, CON save for half, with the save\nfolded into the `delta_source` `cond` (the proven save-for-half shape —\n`predicate_source = \"\"` means every occupant is hit, the save halves inside the\nexpression). The radius collapses to the single cell (`core/area/node_ball`,\n`ball_radius = 0`), so the cloud is node-local.\n\n```toml\n[[consequence_templates]]\ntemplate_id = \"srd/cast_cloudkill/pulse\"\n\n[[consequence_frame_writes]]\ntemplate_id = \"srd/cast_cloudkill/pulse\"\nordinal = 0\nframe_write = { ForEachActorInRadius = { center_ref = \"TargetSpatialRef\", shape_id = \"core/area/node_ball\", shape_params_json = '{\"ball_radius\": 0}', predicate_source = \"\", body = [ { ModifyResource = { actor = \"Actor\", resource = \"srd/hp\", delta_source = \"cond(d20 >= 15, 0 - (5d8 / 2), 0 - 5d8)\" } } ] } }\n```\n\n### What the substrate allows on the autonomy clock\n\nA subject-bound job may fire only a **minimal** actor-reaching set — `Damage`,\n`Heal`, `ApplyModifier` (as `EffectPrimitive`s) and the hazard\n`consequence_template` shape above: `ForEachActorInRadius` carriers with\n`ModifyResource` or `ApplyStatus` leaves. `ApplyStatus` was admitted by\nADR-0064 (#958, noted in the ADR-0054 header) for per-round condition pulses;\nthe srd-cc Caltrops (Speed 0) and Ball Bearings (Prone) pulses rely on it, and\nso do their Monster Death / PC Unconscious carriers. A template may carry\nseveral such carriers. Where the check runs depends on who scheduled the job:\n\n- A manifest-authored `[[autonomy_jobs]]` row is checked **at authoring\n time** by the validator (`validate_autonomy_jobs`,\n `crates/spellkave-validate/src/autonomy_jobs.rs`), and again at fire time.\n- A pulse scheduled by a cast (`ScheduleAutonomyJob`) is **not** checked\n against this list when you author it or when the cast schedules it (the\n schedule-time `validate_autonomy_job` checks only ids, source, and firing\n mode). The kernel checks it only at fire time\n (`dispatch_authored_effect`, the world API), where a violation\n disables the job.\n\nThe rules:\n\n- `PossessBody` is never allowed (possession on the clock is forbidden).\n- `Spawn` / `Despawn` carry their target in params and stay ineligible.\n- A subjectless (ambient) job may fire only `InscribeTraceCluster`.\n- A subject-bound actor-reaching job **must** be bounded\n (`repeats_remaining = Some(_)`) — an endless self-pulsing damage zone is\n rejected.\n\n## 3. Liveness policy — `requires_subject_alive`\n\nYou choose what happens to the zone when its caster leaves:\n\n| Value | Behaviour | Use for |\n|---|---|---|\n| `false` | zone keeps pulsing for its full `repeats_remaining`, attributed to the (now-absent) caster | *Cloudkill* — persists regardless of caster |\n| `true` | dispatcher deletes the job (zone dissipates) once the caster is gone | *Stinking Cloud*, *Web* — concentration-style |\n\n> ⚠️ **\"Alive\" means \"present\", not \"not HP-dead\".** Death is **not** a server\n> concept — `srd/hp` is just an authored number the kernel never interprets. So\n> `requires_subject_alive = true` dissipates the zone when the caster's `entity`\n> row is **despawned/removed**, *not* when its HP hits zero while the body\n> remains. Coupling dissipation to true HP-death needs a future authored liveness\n> predicate (ADR-0054 D-5, Known Gaps). For now, despawn the dead caster, or\n> accept that concentration zones outlive a downed-but-present caster.\n>\n> The first authored liveness predicate exists for **turn order**, not for\n> zones: a session's `turn_eligibility_pred` (ADR-0143) decides who is handed\n> the turn, with a ruleset macro such as \"not Dead\"\n> ([`leave-session-relocates`](./repairs/leave-session-relocates.md)). It is\n> not wired to `requires_subject_alive`; that dispatcher still reads presence.\n\n## Concentration sibling\n\nThe same shape with `requires_subject_alive = true` is the concentration variant\n(illustrative — the srd-cc Stinking Cloud is identity-only and does not author\nthis shape; only the ids change from Cloudkill, and `source` stays per-cast as\nthe note above requires):\n\n```toml\n[[effect_definitions]]\neffect_def_id = \"srd/cast_stinking_cloud/schedule\"\nprimitives_csv = \"ScheduleAutonomyJob\"\nparameters_schema_json = '{\"dsl_function\":\"srd/cast_stinking_cloud/pulse\",\"fires_at_ms\":6000,\"payload_json\":\"{}\",\"source\":\"srd/stinking_cloud/{Actor}/{tick}\",\"frequency_ms\":6000,\"repeats_remaining\":10,\"requires_subject_alive\":true,\"priority\":0}'\n```\n\n## A manifest-authored hazard (no cast)\n\nEverything above schedules the job **from a cast** — a `ScheduleAutonomyJob`\neffect captures the casting actor as `subject` at reducer time. But ADR-0054\nD-3 permits a manifest-authored `[[autonomy_jobs]]` row to set `subject`\ndirectly, with **no cast at all**: a burning room, a cursed shrine, a rigged\ntrap — any fixed, authored hazard that should pulse from world-start rather\nthan from a player's action.\n\nThe one authoring gap this shape used to have: `AutonomyJobRow.subject` is a\nnumeric `entity.entity_id`, which no TOML author can know for a\nmanifest-spawned entity (every prior authored subject was cast-captured, so\nthe numeric column was always filled by the reducer, never hand-typed).\n`authored-hazard-pulses` (sk-aao) closed it with `subject_entity_key`: the\nmanifest names the responsible entity by its own `entity_key`, and apply\nresolves it into `subject` (an unresolvable key, or a row setting both\n`subject` and `subject_entity_key`, is rejected at apply).\n\nThe live, currently-validating worked example is\n`packages/spellkave-mechanics/fixtures/mech_burning_room` (generated by\n`packages/spellkave-mechanics/src/burning-room.ts`, `just validate` against\nit returns zero diagnostics). A backing \"fire\" entity — scenery, never an\nactor, existing solely to be the job's `subject` — and an occupant whose\n`mech_burning_room/hp` resource the pulse drains every 6 seconds for 3\npulses:\n\n```toml\n[[entities]]\nbundle_id = \"mech_burning_room\"\nentity_def_id = \"mech_burning_room/fire\"\nentity_key = \"mech_burning_room/fire\"\nkind = \"item\"\nname = \"Burning Room Fire\"\nowned_by_entity_key = \"\"\nplace_node_id = \"mech_burning_room/room\"\nquantity = 1\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"mech_burning_room/pulse\"\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius]\ncenter_ref = \"TargetSpatialRef\"\npredicate_source = \"\"\nshape_id = \"core/area/node_ball\"\nshape_params_json = '{\"ball_radius\": 0}'\n\n[[consequence_frame_writes.frame_write.ForEachActorInRadius.body]]\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius.body.ModifyResource]\nactor = \"Actor\"\ndelta_source = \"-3\"\nresource = \"mech_burning_room/hp\"\n\n[[autonomy_jobs]]\nanchor_place_node_id = \"mech_burning_room/room\"\nbundle_id = \"mech_burning_room\"\ndescription = \"Burning room hazard pulse (authored-hazard-pulses, sk-aao): damages every occupant of the room every 6s for 3 pulses, attributed to the fire entity, no cast involved.\"\ndsl_function = \"mech_burning_room/pulse\"\nenabled = true\nfire_at_boundary = \"\"\nfrequency_ms = 6000\njob_id = \"mech_burning_room/fire_pulse\"\nnext_fire_at_ms = 0\nnotable = false\nowner_actor = 0\npayload_json = \"\"\npriority = 0\nrepeats_remaining = 3\nrequires_subject_alive = false\nsource = \"manifest\"\nsubject_entity_key = \"mech_burning_room/fire\"\n```\n\nThe damage delta is a fixed literal (`-3`), not a dice expression — unlike\nthe cast-based Cloudkill above, this fixture's live demo reads the occupant's\nhp before/after each pulse and needs a deterministic delta to compare against.\nThat demo is a captured manual session,\n`openspec/specs/world-manifest-authoring/demos/sk-aao-burning-room-hazard-pulse.md`,\nnot an automated test. A dice-based `delta_source` (the SRD save-for-half idiom\nabove) works identically here; the fixed value is a fixture-authoring choice\nfor a legible demo, not a substrate limitation.\n\n`center_ref = \"TargetSpatialRef\"` still resolves to the job's captured\n`anchor_place_node_id` — the SAME mechanism the cast-based Cloudkill uses —\nso the pulse stays fixed on the room regardless of whether the (stationary)\nfire entity ever moves. `repeats_remaining = 3` is a fixture-authoring choice\n(small, for a short live demo); any finite value satisfies ADR-0054 D-4.\n\n## Current authoring gaps\n\nSaving throws and dice damage **are** expressible in the pulse leaf (the Cloudkill\nexample folds a CON save-for-half into `delta_source`, per ADR-0045). Condition/status\npayloads (poisoned, restrained) **are now also expressible**: ADR-0064 admitted\n`ApplyStatus` into the subject-bound frame-write allowlist alongside\n`ForEachActorInRadius` and `ModifyResource`\n(`spellkave_validate::autonomy_jobs::AUTONOMY_ELIGIBLE_FRAME_WRITES`,\n`crates/spellkave-validate/src/autonomy_jobs.rs`, enforced identically at the\nkernel fire-time guard, the world API) — this section previously said\notherwise; that was stale against ADR-0064 (`authored-hazard-pulses`, sk-aao).\nA `ForEachActorInRadius` → `ApplyStatus` pulse (a zone that poisons its\noccupants each round rather than damaging them) is the condition-hazard\nsibling of the `ModifyResource` shapes above (both the cast-based Cloudkill\nand the manifest-authored burning room), same eligibility fence, same\nbounded-`repeats_remaining` requirement.\n\nWhat is still out of reach inside an autonomy pulse leaf:\n\n- **Damage-type routing** (resist/vuln/immune) — the `routeDamage()` `has_tag`\n ladder works in a normal cast's `delta_source`. srd-cc pulses author it\n (Moonbeam, Caltrops), and the Caltrops live proof evaluates it on an\n untagged creature; no live pulse proof covers the resist/immune/vulnerable\n branches yet.\n- **Macros in the pulse predicate** — `ForEachActorInRadius.predicate_source`\n is parsed at fire time without the manifest macro table, so `macro(...)`\n there disables the job with `MF-DSL-MACRO-UNKNOWN` although offline\n validation accepts it (sk-jay0.2.43). Inline the macro body (srd-cc:\n `abilityModifierBodyFor`).\n\nThe scheduling pattern itself is unchanged when these land.\n\nRanged placement of the zone on a distant cell **is** now supported: the cast\ncaptures its target cell as the job's `anchor_place_node_id` and the pulse\ncenters on it via `center_ref = \"TargetSpatialRef\"` (ADR-0055, #776). A moving or\nexpanding zone (a cloud that drifts downwind) is still out of scope — the anchor\nis a single cell fixed at cast time.\n\n## See also\n\n- ADR-0054 — the decision and its fences. ADR-0064 — admits `ApplyStatus`\n into the subject-bound frame-write allowlist.\n- [autonomy-jobs concept](../../../docs/data-model-concepts/autonomy-jobs.md) — the scheduling table and the eligibility fence.\n- `archive/packages/spellkave-srd/fixtures/base/spell-actions.toml` — the\n seeded `srd/cast_cloudkill/*` rows this guide's cast-based prose quotes.\n Historical: `packages/spellkave-srd` was retired to `archive/` and does not\n seed into any live node (the central `world-fixtures/` pile this page used\n to cite no longer exists anywhere in the repo, `world-fixtures-retirement`,\n 2026-08-14).\n- `packages/spellkave-srd-cc/fixtures/base/spells/level-2/moonbeam.toml`,\n `spike-growth.toml` — live cast-scheduled examples (marker `Inscribe` on\n the cast, `ScheduleAutonomyJob` with a per-cast `source`, pulse template).\n- `packages/spellkave-mechanics/fixtures/mech_burning_room` — the live,\n currently-validating worked example for the no-cast, manifest-authored\n shape ([\"A manifest-authored hazard (no cast)\"](#a-manifest-authored-hazard-no-cast), below).\n- [`aoe-damage-spell`](./examples/aoe-damage-spell.md) — an immediate (non-lingering) area spell.\n\n## Traces that fade on their own\n\nA trace normally lives forever. `Inscribe` takes two optional lifetime fields,\nand only one of them is usable from authored content:\n\n| Field | Meaning | Authorable? |\n|---|---|---|\n| `expires_at_tick` | An **absolute** world tick | ❌ in practice |\n| `expires_after_ticks` | Ticks **from the moment it is inscribed** | ✅ |\n\n`expires_at_tick` is absolute, and a manifest has no way to know the tick a\nfuture inscription will fire at — the trace is written when a player acts, not\nwhen the bundle is loaded. No live authored `Inscribe` sets it (a grep of the\nrepository's non-`archive/` `*.toml` files finds none). Reach for `expires_after_ticks` instead; the kernel resolves it to\n`inscribed_at + n` at inscription time. Set both and the absolute value wins.\n\nOmit both for a permanent trace — still the default, and still right for\nanything the world is meant to remember.\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/light_fire/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"mybundle/smoke\"\nlocation_kind = \"binding\"\nlocation_ref = \"ActorSpatialRef\"\npayload_json = \"{}\"\nexpires_after_ticks = 10 # the smoke thins out\n```\n\n### ⚠️ Decay deletes; it does not \"un-tell\"\n\nExpiry removes the trace ROW (`expire`,\nthe world API). Anyone who already perceived\nit keeps a private memory of it (`observer_trace_knowledge` copies the payload\nverbatim at first perception, and expiry does not delete that row). The\nplayer-facing trace read (the `visible_trace` view) resolves each remembered\ntrace back through the trace table and skips ids that no longer exist, so a\ndecayed trace drops out of the trace read **even for someone who perceived\nit**. Only the observer's own memory copy stays readable, through\n`spellkave_observer_trace_knowledge` (`readObserverTraceKnowledge`,\n`packages/spellkave-sdk/src/core/readers/observer_trace_knowledge.ts`, which\ndoes not filter out decayed ids).\n\nSo `expires_after_ticks` is right for traces that are ephemeral *by nature* —\nsmoke, smell, tracks, a lingering chill — where nobody is expected to recall\nthem afterwards. It is the wrong tool for anything a character is meant to\nremember having witnessed. Speech is the cautionary case: an utterance should\nstop lying around in the world, but the people who heard it must keep it, so\ndecay is not the answer there.\n\n**What IS the answer for that case:**\n`trace_kind_definitions.perceptible_for_ticks`. It is a separate axis — it\ngoverns how long an EXISTING trace stays admissible to an ARRIVING observer,\nand it deletes nothing. `srd/speech` declares `0`: heard by whoever was\npresent, never by someone who walks in afterwards, while the row itself\nsurvives for anyone who already perceived it and for a DM/oversight look-back.\nSee \"How long a trace stays findable\" in\n[`interaction-dsl-and-world-authoring.md`](./interaction-dsl-and-world-authoring.md).\nTwo knobs, two questions: *how long does it exist* vs *how long can it still\nbe found*.\n",
200
+ "long-running-actions": "# Long-running actions, busy policy, and resumable progress\n\nHow to author actions that take real in-world time — rituals, crafting,\ntravel, rests — and control what their actor may do while occupied.\n\n## The promotion rule (§5.10): you author a cost, the kernel picks the shape\n\nAny `action_definitions` row with `cost_time_ms > 5000` (strictly greater;\n5000 itself stays flat) is **auto-promoted** at submission time: instead of\ncommitting its consequence immediately, the kernel opens a session and the\nconsequence lands when the session completes. You never choose between\n\"frame action\" and \"session\" for a long action — the cost declares the\nfiction, the kernel decides the shape. The validator warns on every row\nthat crosses the threshold and names the session definition the promotion\nwill resolve (`session_def_id` if you set one, else\n`core/long_running_action` from the core bundle).\n\nFiction time is measured in **world ticks**, converted once at promotion:\n`duration_ticks = ceil(cost_time_ms / fiction_ms_per_tick)`, minimum 1.\nThe default calibration is `fiction_ms_per_tick = 6000` — one 5e combat\nround (6 s) per tick — so `cost_time_ms = 600000` (10 fiction minutes)\nruns for 100 ticks. Keep flavor-only durations (\"this takes a moment\") at\nflat-action scale (hundreds to low thousands of ms) and narrate longer\ntimes in `display_name`/description text; author a real cost only when the\naction should genuinely occupy its actor.\n\n## What the actor may do meanwhile: the busy policy\n\nWhile the promoted session is active the actor is flagged busy\n(`busy_in_session_kind` = the session definition id). Every action the\nbusy actor attempts gets exactly one of three verdicts, in this order:\n\n1. **allowed** — the attempt matches the session definition's\n `busy_allow_pred`.\n2. **session-breaking** — it matches `busy_break_pred`: the busy session\n closes with outcome `abandoned` (abort semantics below), then the\n attempted action proceeds.\n3. **rejected** — everything else, with rejection kind `busy_in_session`.\n\nBoth predicates are optional DSL predicates on `session_definitions`,\nevaluated against the *attempted* action: its authored tags are visible as\n`target.has_tag(\"...\")` and its id as `target.text('action_id')`.\n**Author neither predicate and you get the default: full block** — the\nonly always-allowed move is the actor's own `r_session_close` (give up).\n\nWorked shapes:\n\n```toml\n# A rest: light activity allowed, hostilities end it.\n[[session_definitions]]\nsession_def_id = \"mybundle/long_rest\"\nbusy_allow_pred = \"target.has_tag('light_activity')\"\nbusy_break_pred = \"target.has_tag('attack')\"\n# ... plus round_duration_ms = 6000 and a termination predicate, see below.\n```\n\n- **Ritual** — author nothing: full block, only abort escapes.\n- **Concentration** — broad `busy_allow_pred`, so the actor moves and\n fights while the effect holds.\n- **Travel** — allow perception/talk tags, break on hostile contact.\n\n## How the session ends\n\n`core/long_running_action` (shipped in `packages/spellkave-mechanics/fixtures/core`) is a solo\n`Sequential` session with `round_duration_ms = 6000` and this authored\ntermination predicate — plain DSL reads, no special machinery:\n\n```toml\ntermination_pred = \"world.tick - session.stat('opened_at') >= session.stat('promoted_duration_ticks')\"\n```\n\nEach world tick advances the solo session's turn, the predicate is\nre-evaluated, and at expiry the session terminates `completed`. These\nclock-only Sequential sessions (`core/long_running_action` and a bundle's\nown long-running-move session, e.g. `core/long_running_move` or\n`srd/long_running_move`) author an empty `turn_scheduler_id` on purpose:\nthe heartbeat still fires TurnStart/termination without pretending this\nis initiative combat (#2232). Combat Sequential sessions still need a\nreal scheduler. Terminal\nconsequences then fire in binding order: the session definition's\n`on_terminate` first (if authored), then the **originating action's**\n`on_success` — the same consequence a short action would have applied\ninstantly, just N ticks later. On abort (`abandoned`, whether explicit or\nvia `busy_break_pred`) the action's `on_failure` fires instead, when\nauthored; `on_success` never fires on an aborted run. To give a long\naction bespoke busy policy, point its `session_def_id` at your own\nsession definition — reuse the same termination predicate.\n\n## Interrupted work: progress and the perceivable trace\n\nAborting a promoted session records what was done:\n\n- an `interrupted_action_credit` row (actor, action, target, `progress_ticks` =\n elapsed ticks, capped at the promoted duration) that **expires** 1000\n ticks after recording, and\n- a trace of the authored kind `core/interrupted_work` at the target,\n tagged with the originating action id — co-located actors can *see*\n the half-drawn ritual circle.\n\nResumption is **opt-in per action**: set `resumable = true` on the\n`action_definitions` row and the next promotion of the same action by the\nsame actor on the same target consumes the unexpired progress row and\nshortens the new session by `progress_ticks` (100-tick craft aborted at\n60 → resumes as 40). Leave `resumable` unset (default `false`) for\nactions that must restart from zero — an interrupted long rest grants\nnothing.\n\nAuthoring surface note: all three fields have first-class verbs —\n`resumable` on `spellkave_define_action`, `busy_allow_pred` /\n`busy_break_pred` on `spellkave_define_session` (which also covers\ntermination predicates, turn scheduling, and grid wiring; see the generated\n[tool-reference](./tool-reference.md)). `spellkave_write_rows` remains the\nschema-driven escape hatch for anything else.\n",
201
+ "manifest-format": "# Manifest Format\n\n<!-- GENERATED by scripts/generate-authoring-reference-docs.ts. Do not edit the reference sections by hand. -->\n\nSpellkave bundles are TOML manifests loaded by the CLI and admitted by the\n`r_apply_world_manifest` reducer. The row/field reference below is generated\nfrom `spellkave_schema::manifest_json_schema()`.\n\n## Required Header\n\n```toml\n#:schema https://spellkave.dev/schema/world-manifest-1.0.0.json\nschema_version = \"1.0.0\"\n```\n\n## Applyset (root manifests)\n\nA root manifest names the applyset it belongs to with one top-level field,\nright after the header (ADR-0145):\n\n```toml\napplyset = \"srd\"\n```\n\nEvery applyset apply (`r_apply_bundle`, which `sk dev seed`/`sk dev up` use)\nrefuses a root without it; the server's applyset memory is keyed by this name,\nnot by `bundle_id`. Only the root declares it: an `[[include]]` fragment\nthat sets `applyset` is rejected. The other apply reducers ignore the field.\n\n`sk diff -k` displays file changes, world-added rows on pruned entities with `--prune`, and\n**authored, changed in the world since the last apply**. Existing readable rows absent from\nmemory are `adopt`: they gain memory without a live upsert. Changed file\nrows compare live values with the last sealed comparable hash; adoption\ncompares live values with the files. Conflicts stop `sk apply -k` before it\nsends (exit `2`); `--force` makes the files win and updates the baseline.\nUnchanged drifting rows remain informational. Unavailable export, unsupported\nrow kinds, unread live placement and missing comparable hashes produce\nexplicit `not_checked` reasons, never an assertion of no drift.\n\n## Initial Capability Extents\n\nAn `entity_definition_initial_capability` row has optional\n`extent_kind_ref` and `extent_ref` strings. Both default to empty.\nThey describe the scope that a newly realized instance must retain; they\nmust not be silently dropped when applying or spawning the definition.\n\nManifest commit and definition seeding preserve both strings on the realized\ncapability row. Empty extents retain their existing behavior.\n\n## Generated Row Reference\n\n### [[action_definition_tag]]\n\nSchema row: `ActionDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `action_id` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[action_definitions]]\n\nSchema row: `ActionDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `action_id` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `cost_time_ms` | no | `integer` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `non_steering` | no | `boolean` |\n| `on_failure` | no | `string` |\n| `on_success` | yes | `string` |\n| `reaction_eligibility` | no | `string,null` |\n| `reaction_trigger` | no | `string,null` |\n| `reaction_window_ms` | no | `integer,null` |\n| `required_capability` | yes | `string` |\n| `resolution_mode` | no | `value` |\n| `resolution_predicate_source` | no | `string` |\n| `resolution_scope` | no | `string` |\n| `resumable` | no | `boolean` |\n| `self_eligible` | no | `boolean` |\n| `self_only` | no | `boolean` |\n| `session_def_id` | no | `string` |\n| `spends_channel` | no | `string,null` |\n\n### [[actor_capabilities]]\n\nSchema row: `ActorCapabilityRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `actor_entity_key` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `elevation_class` | no | `string` |\n| `extent_kind_ref` | no | `string` |\n| `extent_ref` | no | `string` |\n| `source` | yes | `string` |\n| `source_args_hash` | no | `string` |\n| `visibility` | no | `string,null` |\n\n### [[actor_equipment_slots]]\n\nSchema row: `ActorEquipmentSlotRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `actor_entity_key` | yes | `string` |\n| `item_key` | yes | `string` |\n| `slot_id` | yes | `string` |\n\n### [[actor_identities]]\n\nSchema row: `ActorIdentityRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `identity` | yes | `string` |\n| `provenance` | no | `string,null` |\n| `role` | yes | `string` |\n\n### [[actor_spatial_locations]]\n\nSchema row: `ActorSpatialLocationRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `place_node_id` | yes | `string` |\n| `selection_path` | no | `string` |\n\n### [[actors]]\n\nSchema row: `ActorRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `entity_key` | yes | `string` |\n| `name` | yes | `string` |\n\n### [[affordance_template_participants]]\n\nSchema row: `AffordanceTemplateParticipantRow`.\n\nOptional template-owned participant declarations (ADR-0132).\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `role_id` | yes | `string` |\n| `slot_id` | yes | `string` |\n| `template_id` | yes | `string` |\n\n### [[affordance_templates]]\n\nSchema row: `AffordanceTemplateRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `accepts_global_storm` | no | `boolean` |\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `composes` | no | `array,null` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `locality_class` | no | `string` |\n| `movement_cost_expression_source` | no | `string` |\n| `niche_id` | yes | `string` |\n| `outcome_template_id` | yes | `string` |\n| `predicate_bool` | no | `boolean` |\n| `predicate_source` | no | `string` |\n| `range_m` | no | `number` |\n| `reads_occupancy` | no | `boolean` |\n| `recharges_on` | no | `string,null` |\n| `spends_channel` | no | `string,null` |\n| `stratification_ok` | no | `boolean` |\n| `template_id` | yes | `string` |\n\n### [[anchor_kind_definitions]]\n\nSchema row: `AnchorKindDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `kind_id` | yes | `string` |\n| `resolution_shape` | yes | `string` |\n\n### [[area_shape_definitions]]\n\nSchema row: `AreaShapeDefinitionRow`.\n\nItem 29 — area-shape vocabulary rows (sphere, cone, line, cube, node_ball).\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `parameter_schema_json` | yes | `string` |\n| `shape_id` | yes | `string` |\n\n### [[audience_kind_definitions]]\n\nSchema row: `AudienceKindDefinitionRow`.\n\nADR-0142 D-4 — audience vocabulary rows a `prompt_definition` names via `audience_kind_ref`. Insert into `audience_kind_definition`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `audience_kind_id` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `resolution_shape` | yes | `string` |\n\n### [[autonomy_jobs]]\n\nSchema row: `AutonomyJobRow`.\n\nADR-0041 / CR-14: authored ambient autonomy jobs. Insert into the live `autonomy_job` table. Bundle-scoped idempotent apply (clear-then-insert). ADR-0004 D-2 fence: a job's `dsl_function` may only resolve to an autonomy-eligible (ambient, non-actor-reaching) effect — enforced by the validator (`autonomy_jobs.rs`). NO movement/actor effects (no patrols).\n\n| Field | Required | Type |\n|---|---:|---|\n| `anchor_place_node_id` | no | `string,null` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `dsl_function` | yes | `string` |\n| `enabled` | no | `boolean` |\n| `fire_at_boundary` | no | `string` |\n| `frequency_ms` | yes | `integer` |\n| `job_id` | yes | `string` |\n| `next_fire_at_ms` | no | `integer,null` |\n| `notable` | no | `boolean` |\n| `owner_actor` | no | `integer` |\n| `payload_json` | no | `string` |\n| `priority` | no | `integer` |\n| `repeats_remaining` | no | `integer,null` |\n| `requires_subject_alive` | no | `boolean` |\n| `source` | no | `string` |\n| `subject` | no | `integer,null` |\n| `subject_entity_key` | no | `string` |\n\n### [[binding_preconditions]]\n\nSchema row: `BindingPrecondition`.\n\nGuarded subject replacement only; never an admission verdict.\n\n| Field | Required | Type |\n|---|---:|---|\n| `binding_id` | yes | `string` |\n| `expected_digest` | yes | `string` |\n| `expected_incarnation` | yes | `string` |\n| `expected_merged_role_digest` | yes | `string` |\n| `expected_revision` | yes | `integer` |\n| `reason` | yes | `string` |\n| `request_id` | yes | `string` |\n\n### [[boundary_definitions]]\n\nSchema row: `BoundaryDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `id` | yes | `string` |\n\n### [[bundles]]\n\nSchema row: `BundleRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `allow_flat_tags` | no | `boolean` |\n| `author` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `default_extent_params_json` | no | `string` |\n| `default_extent_shape_id` | no | `string` |\n| `depends_on` | no | `array` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `tag_prefixes` | no | `array` |\n| `version` | yes | `string` |\n\n### [[capability_definition_tag]]\n\nSchema row: `CapabilityDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[capability_definitions]]\n\nSchema row: `CapabilityDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `actor_kind` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `default_visibility` | no | `string` |\n| `description` | yes | `string` |\n| `display_name` | yes | `string` |\n\n### [[combat_grid_blueprints]]\n\nSchema row: `CombatGridBlueprintRow`.\n\nADR-0052: reusable authored blueprints for session-minted combat grids. Insert into the live `combat_grid_blueprint` table.\n\n| Field | Required | Type |\n|---|---:|---|\n| `accepts_stacked_occupancy` | no | `boolean` |\n| `blueprint_id` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `cell_size_m` | no | `number` |\n| `description` | no | `string` |\n| `distance_metric_id` | no | `string,null` |\n| `edge_affordance_bindings_json` | no | `string` |\n| `edge_affordance_template_id` | yes | `string` |\n| `edge_overrides_json` | no | `string` |\n| `height` | yes | `integer` |\n| `topology` | no | `string` |\n| `width` | yes | `integer` |\n\n### [[condition_capability_extent_grants]]\n\nSchema row: `ConditionCapabilityExtentGrantRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `condition_definition_id` | yes | `string` |\n| `extent_kind_ref` | yes | `string` |\n| `extent_ref` | yes | `string` |\n\n### [[condition_definition_tag]]\n\nSchema row: `ConditionDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `condition_definition_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[condition_definitions]]\n\nSchema row: `ConditionDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `condition_definition_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `gate_predicate_source` | yes | `string` |\n| `grants_capability_while_active` | no | `array` |\n| `hooks` | no | `array` |\n| `implies` | no | `array` |\n| `modifier_template_id` | no | `string` |\n| `observable` | no | `boolean` |\n| `remove_time_policy` | no | `string` |\n| `stacking_rule` | no | `string` |\n| `suppresses_capability_while_active` | no | `array` |\n\n### [[condition_remove_policy_definitions]]\n\nSchema row: `ConditionRemovePolicyDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `policy_id` | yes | `string` |\n| `remove_predicate_source` | yes | `string` |\n\n### [[consequence_frame_writes]]\n\nSchema row: `ConsequenceFrameWriteRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `frame_write` | yes | `value` |\n| `ordinal` | yes | `integer` |\n| `template_id` | yes | `string` |\n\n### [[consequence_templates]]\n\nSchema row: `ConsequenceTemplateRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `effect_refs_csv` | no | `string` |\n| `template_id` | yes | `string` |\n| `traces_json` | no | `string` |\n\n### [[containment_policy_definition]]\n\nSchema row: `ContainmentPolicyDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `access_predicate_source` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `exposure_predicate_source` | yes | `string` |\n| `policy_id` | yes | `string` |\n\n### [[coordinate_kind_definitions]]\n\nSchema row: `CoordinateKindDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `coordinate_kind_id` | yes | `string` |\n| `description` | no | `string` |\n\n### [[distance_metric_definitions]]\n\nSchema row: `DistanceMetricDefinitionRow`.\n\nADR-0134 D-1 — distance-metric vocabulary rows a `combat_grid_blueprint` names via `distance_metric_id`. Insert into `distance_metric_definition`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `metric_id` | yes | `string` |\n| `metric_shape` | yes | `string` |\n\n### [[dsl_macro_definitions]]\n\nSchema row: `DslMacroDefinitionRow`.\n\nTyped, author-time DSL macro definitions. Their bodies are compiled to the existing DSL AST before admission; no macro-call node is stored.\n\n| Field | Required | Type |\n|---|---:|---|\n| `body_source` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `macro_id` | yes | `string` |\n| `parameters` | no | `array` |\n| `return_type` | yes | `string` |\n\n### [[economy_channel_definitions]]\n\nSchema row: `EconomyChannelDefinitionRow`.\n\nAction-economy: authored per-round time channels. Insert into the live `economy_channel_definitions` table.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `id` | yes | `string` |\n| `off_turn_eligible` | no | `boolean` |\n| `pool_ms_per_round` | yes | `integer` |\n| `resets_on` | yes | `string` |\n\n### [[effect_definitions]]\n\nSchema row: `EffectDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `effect_def_id` | yes | `string` |\n| `parameters_schema_json` | no | `string` |\n| `primitives_csv` | yes | `string` |\n\n### [[entities]]\n\nSchema row: `EntityRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `entity_def_id` | no | `string` |\n| `entity_key` | yes | `string` |\n| `kind` | yes | `EntityKindRow` |\n| `name` | yes | `string` |\n| `owned_by_entity_key` | no | `string` |\n| `place_node_id` | yes | `string` |\n| `quantity` | no | `integer` |\n\n### [[entity_containment]]\n\nSchema row: `EntityContainmentRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `container_entity_key` | yes | `string` |\n| `direction` | no | `string` |\n| `entity_key` | yes | `string` |\n| `slot_id` | no | `string` |\n\n### [[entity_containment_policy]]\n\nSchema row: `EntityContainmentPolicyRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `policy_id` | yes | `string` |\n\n### [[entity_definition_containment_policy]]\n\nSchema row: `EntityDefinitionContainmentPolicyRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `policy_id` | yes | `string` |\n\n### [[entity_definition_equip_modifier]]\n\nSchema row: `EntityDefinitionEquipModifierRow`.\n\nsk-ct8.3 / finding #37 (BL-19): \"item is in a slot\" → modifier fold on the WEARER. Each row says \"while an entity of `entity_def_id` sits in ANY of the wearer's `entity_equipment_slot` rows, fold `modifier_template_id` into the wearer's effective-int overlay.\" Read at fact-collection time by `entity_facts.rs`'s equipped-item fold — NOT a spawn-time seed like its `entity_definition_initial_*` siblings.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `modifier_template_id` | yes | `string` |\n\n### [[entity_definition_initial_capability]]\n\nSchema row: `EntityDefinitionInitialCapabilityRow`.\n\nDefinition-level innate capability grants (#728). Each row seeds a `capability` row (entity-anchored) onto every placed instance.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `extent_kind_ref` | no | `string` |\n| `extent_ref` | no | `string` |\n\n### [[entity_definition_initial_condition]]\n\nSchema row: `EntityDefinitionInitialConditionRow`.\n\nDefinition-level initial conditions. Seeds a `target_condition` onto every placed instance; previously a table-only surface unreachable from authored manifests.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `condition_definition_id` | yes | `string` |\n| `duration_ticks` | no | `integer` |\n| `entity_def_id` | yes | `string` |\n\n### [[entity_definition_initial_containment]]\n\nSchema row: `EntityDefinitionInitialContainmentRow`.\n\nDefinition-level initial containment (sk-84i.3). Each row spawns an instance of `contained_entity_def_id` (recursively applying its own definition-level seeds) and inserts it loose-carried into every placed instance of `entity_def_id` — e.g. a bandit definition authoring its quiver, which itself authors its bolts.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `contained_entity_def_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `quantity` | no | `integer` |\n\n### [[entity_definition_initial_equipment]]\n\nSchema row: `EntityDefinitionInitialEquipmentRow`.\n\nDefinition-level initial equipment (sk-84i.3). Each row spawns an instance of `equipped_entity_def_id` and equips it into `slot_id` on every placed instance of `entity_def_id` — the equipped-item sibling of `entity_definition_initial_containment`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `equipped_entity_def_id` | yes | `string` |\n| `slot_id` | yes | `string` |\n\n### [[entity_definition_initial_state]]\n\nSchema row: `EntityDefinitionInitialStateRow`.\n\nDefinition-level initial state-values (#729). Each row seeds an `object_state` row onto every placed instance of `entity_def_id`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `state_id` | yes | `string` |\n| `value_bool` | no | `boolean` |\n| `value_int` | no | `integer,null` |\n| `value_text` | no | `string,null` |\n\n### [[entity_definition_item_dsl_source]]\n\nSchema row: `EntityDefinitionItemDslSourceRow`.\n\nsk-84i.2 (widened G-1): named DSL-source slots authored on an entity definition (e.g. slot `srd/damage` = `\"2d8\"`), evaluated inline by the kernel's `<subject>.source('slot')` primitive.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `slot` | yes | `string` |\n| `source` | yes | `string` |\n\n### [[entity_definition_tag]]\n\nSchema row: `EntityDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[entity_definitions]]\n\nSchema row: `EntityDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `affordance_seed_id` | no | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `entity_def_id` | yes | `string` |\n| `grants_capability_while_equipped` | no | `string` |\n| `grants_capability_while_present_in_location` | no | `string` |\n| `lineage_id` | no | `string` |\n| `on_consume_consequence_id` | no | `string` |\n| `on_destroy_consequence_id` | no | `string` |\n| `on_equip_consequence_id` | no | `string` |\n| `on_unequip_consequence_id` | no | `string` |\n| `slot_compatibility_predicate` | no | `string` |\n| `stackable` | no | `boolean` |\n\n### [[entity_resource_bound]]\n\nSchema row: `EntityResourceBoundRow`.\n\nPer-instance resource-bound overrides (#30 / sk-ct8.2).\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `max_value` | yes | `integer` |\n| `min_value` | yes | `integer` |\n| `resource_definition_id` | yes | `string` |\n\n### [[entity_tag]]\n\nSchema row: `EntityTagRow`.\n\nRelational instance-tag membership (CR-7 write leg / CR-4 relational-only convention). `entity_key` anchors on an authored `[[entities]]` row; the apply resolves it to the entity id and inserts an `entity_tag` row.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[equipment_slot_definitions]]\n\nSchema row: `EquipmentSlotDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `default_compatibility_predicate` | no | `string` |\n| `description` | no | `string` |\n| `label` | yes | `string` |\n| `slot_id` | yes | `string` |\n\n### [[extent_kind_definitions]]\n\nSchema row: `ExtentKindDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `kind_id` | yes | `string` |\n| `resolution_shape` | yes | `string` |\n\n### [[item_definitions]]\n\nSchema row: `ItemDefinitionRow`.\n\nLegacy compatibility overlay for equipment compatibility. Final authoring folds `slot_compatibility_predicate` into `entity_definitions`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `item_def_id` | yes | `string` |\n| `slot_compatibility_predicate` | no | `string` |\n| `slot_id` | no | `string` |\n\n### [[location_definitions]]\n\nSchema row: `LocationDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `cell_res10` | no | `integer` |\n| `cell_res4` | no | `integer` |\n| `cell_res7` | no | `integer` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `interior_graph_id` | no | `string` |\n| `location_def_id` | yes | `string` |\n| `parent_def` | no | `string` |\n\n### [[location_traces]]\n\nSchema row: `LocationTraceRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `location_def_id` | yes | `string` |\n| `trace_kind_id` | yes | `string` |\n\n### [[map_layers]]\n\nSchema row: `MapLayerRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `asset_module` | no | `string` |\n| `asset_path` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `grid_distance_m` | no | `number` |\n| `grid_size_px` | no | `integer` |\n| `image_height_px` | no | `integer` |\n| `image_origin_x` | no | `number` |\n| `image_origin_y` | no | `number` |\n| `image_width_px` | no | `integer` |\n| `local_height_cells` | no | `number` |\n| `local_width_cells` | no | `number` |\n| `map_layer_id` | yes | `string` |\n| `max_zoom` | no | `number` |\n| `min_zoom` | no | `number` |\n| `place_graph_id` | yes | `string` |\n| `posture` | no | `string` |\n| `rotation_deg` | no | `number` |\n| `source_kind` | no | `string` |\n| `state` | no | `string` |\n\n### [[metadata_attachments]]\n\nSchema row: `MetadataRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `namespace` | yes | `string` |\n| `payload_json` | yes | `string` |\n| `source` | no | `string` |\n| `target_kind` | yes | `string` |\n| `target_ref` | yes | `string` |\n\n### [[metadata_namespaces]]\n\nSchema row: `MetadataNamespaceRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `audience` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string,null` |\n| `namespace` | yes | `string` |\n| `on_demand` | no | `boolean` |\n\n### [[modifier_target_definitions]]\n\nSchema row: `ModifierTargetDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `shape` | yes | `string` |\n| `target_id` | yes | `string` |\n\n### [[modifier_template_tag]]\n\nSchema row: `ModifierTemplateTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `modifier_template_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[modifier_templates]]\n\nSchema row: `ModifierTemplateRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `applies_to` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `delta_kind` | no | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `modifier_expression_source` | yes | `string` |\n| `modifier_template_id` | yes | `string` |\n| `predicate_source` | yes | `string` |\n| `priority` | no | `integer` |\n| `replace_template_id` | no | `string,null` |\n\n### [[movement_defaults]]\n\nSchema row: `MovementDefaultRow`.\n\nADR-0101 D-1: bundle- or place-graph-scoped default traversal-mode rows. Bundle-scoped clear-then-insert at commit (no natural key — same discipline as `spatial_environment_state`).\n\n| Field | Required | Type |\n|---|---:|---|\n| `affordance_template_id` | yes | `string` |\n| `bindings_json` | no | `string` |\n| `bundle_id` | yes | `string` |\n| `mode_id` | no | `string` |\n| `place_graph_id` | no | `string` |\n\n### [[niche_definition_tag]]\n\nSchema row: `NicheDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `niche_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[niche_definitions]]\n\nSchema row: `NicheDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `display_name` | yes | `string` |\n| `niche_id` | yes | `string` |\n| `predicate_source` | no | `string` |\n| `provider` | no | `string` |\n\n### [[object_state]]\n\nSchema row: `ObjectStateRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `entity_key` | yes | `string` |\n| `expires_at_tick` | no | `integer` |\n| `source_template_id` | yes | `string` |\n| `state_id` | yes | `string` |\n| `value_bool` | no | `boolean` |\n| `value_int` | no | `integer,null` |\n| `value_text` | no | `string,null` |\n| `visibility` | no | `string,null` |\n\n### [[object_state_definition_tag]]\n\nSchema row: `ObjectStateDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `source` | no | `string` |\n| `state_id` | yes | `string` |\n| `tag` | yes | `string` |\n\n### [[object_state_definitions]]\n\nSchema row: `ObjectStateDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `default_visibility` | no | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `state_id` | yes | `string` |\n| `target_kind` | yes | `string` |\n\n### [[outcome_graph_edges]]\n\nSchema row: `OutcomeGraphEdgeRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `authored_order` | no | `integer` |\n| `from_node_id` | yes | `string` |\n| `guard_predicate_source` | no | `string` |\n| `outcome_graph_edge_id` | yes | `string` |\n| `outcome_graph_id` | yes | `string` |\n| `to_node_id` | yes | `string` |\n\n### [[outcome_graph_nodes]]\n\nSchema row: `OutcomeGraphNodeRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `authored_order` | no | `integer` |\n| `node_id` | yes | `string` |\n| `outcome_graph_id` | yes | `string` |\n| `outcome_graph_node_id` | yes | `string` |\n| `outcome_template_id` | no | `string` |\n| `terminal` | no | `boolean` |\n\n### [[outcome_graphs]]\n\nSchema row: `OutcomeGraphRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `max_depth` | no | `integer` |\n| `max_draws` | no | `integer` |\n| `max_nodes` | no | `integer` |\n| `outcome_graph_id` | yes | `string` |\n| `root_node_id` | yes | `string` |\n\n### [[outcome_template_tag]]\n\nSchema row: `OutcomeTemplateTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `outcome_template_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[outcome_templates]]\n\nSchema row: `OutcomeTemplateRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `communication_speech_act_id` | no | `string` |\n| `consequence_template_id` | no | `string` |\n| `description` | no | `string` |\n| `discovery_validated` | no | `boolean` |\n| `display_name` | yes | `string` |\n| `manipulation_action_id` | no | `string` |\n| `movement_descriptor` | no | `string` |\n| `outcome_bool` | no | `boolean` |\n| `outcome_expression_source` | no | `string` |\n| `outcome_template_id` | yes | `string` |\n| `sense_query_kind` | no | `string` |\n| `sense_visibility` | no | `value` |\n\n### [[place_edge_affordance]]\n\nSchema row: `PlaceEdgeAffordanceRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `affordance_template_id` | yes | `string` |\n| `bindings_json` | no | `string` |\n| `edge_key` | yes | `string` |\n| `mode_id` | no | `string` |\n\n### [[place_edges]]\n\nSchema row: `PlaceEdgeRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `cell_anchor` | no | `integer` |\n| `cell_anchor_present` | no | `boolean` |\n| `cell_anchor_u` | no | `number` |\n| `cell_anchor_v` | no | `number` |\n| `description` | no | `string` |\n| `edge_key` | yes | `string` |\n| `from_anchor_offset` | no | `number` |\n| `from_anchor_side` | no | `string` |\n| `from_node_id` | yes | `string` |\n| `inherit_movement_default` | no | `boolean` |\n| `place_graph_id` | yes | `string` |\n| `pose_dt_elevation` | no | `number` |\n| `pose_dt_elevation_present` | no | `boolean` |\n| `substrate_crossing` | no | `boolean` |\n| `to_anchor_offset` | no | `number` |\n| `to_anchor_side` | no | `string` |\n| `to_node_id` | yes | `string` |\n\n### [[place_graph_instances]]\n\nSchema row: `PlaceGraphInstanceRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `anchor` | yes | `value` |\n| `bearing_deg` | no | `number,null` |\n| `blueprint_id` | yes | `string` |\n| `bundle_id` | no | `string,null` |\n| `description` | no | `string` |\n| `instance_id` | no | `string,null` |\n| `override_params` | no | `object,null` |\n| `parent_graph_id` | no | `string,null` |\n\n### [[place_graphs]]\n\nSchema row: `PlaceGraphRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `anchor_node_id` | no | `string` |\n| `bearing` | no | `number` |\n| `blueprint_id` | no | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `is_ephemeral_instance` | no | `boolean` |\n| `metres_per_unit` | no | `number` |\n| `origin_cell_res10` | no | `integer` |\n| `origin_cell_res4` | no | `integer` |\n| `origin_cell_res7` | no | `integer` |\n| `parent_graph_id` | no | `string` |\n| `place_graph_id` | yes | `string` |\n| `substrate_id` | yes | `string` |\n\n### [[place_node_traces]]\n\nSchema row: `PlaceNodeTraceRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `node_id` | yes | `string` |\n| `trace_kind_id` | yes | `string` |\n\n### [[place_nodes]]\n\nSchema row: `PlaceNodeRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `cell_res10` | no | `integer` |\n| `cell_res4` | no | `integer` |\n| `cell_res7` | no | `integer` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `extent_params_json` | no | `string` |\n| `extent_shape_id` | no | `string` |\n| `is_ephemeral` | no | `boolean` |\n| `local_id` | yes | `string` |\n| `node_id` | yes | `string` |\n| `place_graph_id` | yes | `string` |\n| `pos_present` | no | `boolean` |\n| `pos_x` | no | `integer` |\n| `pos_y` | no | `integer` |\n| `pose_elevation` | no | `number` |\n| `pose_elevation_present` | no | `boolean` |\n| `substrate_id` | yes | `string` |\n\n### [[place_seals]]\n\nSchema row: `PlaceSealRow`.\n\nPrepared spatial regions protected from privileged writes (ADR-0151 D-9). Author seals on a graph whose root is owned by the same nonempty bundle. Instance seals are copied from their blueprint; instance graphs and world-owned roots cannot be sealed directly. `broken` and `break_reason` are hash-visible export-only observations, rejected in authoring input.\n\n| Field | Required | Type |\n|---|---:|---|\n| `break_reason` | no | `string,null` |\n| `broken` | no | `boolean,null` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `place_graph_id` | yes | `string` |\n\n### [[prompt_definitions]]\n\nSchema row: `PromptDefinitionRow`.\n\nADR-0142 D-1 — dialogue prompt contract rows. Insert into `prompt_definition`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `accepts_global_storm` | no | `boolean` |\n| `audience_kind_ref` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `contract_version` | no | `integer` |\n| `open_predicate_source` | no | `string` |\n| `prompt_def_id` | yes | `string` |\n| `response_action_ids` | no | `array` |\n| `source_selector` | yes | `string` |\n| `trace_window_ticks` | no | `integer` |\n\n### [[resource_definition_tag]]\n\nSchema row: `ResourceDefinitionTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `resource_definition_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[resource_definitions]]\n\nSchema row: `ResourceDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `initial_value` | no | `integer,null` |\n| `max_value` | yes | `integer` |\n| `min_value` | yes | `integer` |\n| `recovery_rule` | yes | `string` |\n| `resource_definition_id` | yes | `string` |\n| `value_kind` | yes | `string` |\n\n### [[retractions]]\n\nSchema row: `RetractionRow`.\n\nADR-0085 D-6: authored deletion tombstones for the upsert-semantics `r_apply_manifest_delta` reducer. Upsert cannot express deletion by omission (an authored key simply absent from a delta says nothing about whether it should be removed), so a delta MAY carry an explicit `[[retractions]]` array. Ignored by the whole-bundle `r_apply_world_manifest` clear-then-insert path (which has its own, unconditional clear).\n\n| Field | Required | Type |\n|---|---:|---|\n| `authored_key` | yes | `string` |\n| `row_kind` | yes | `string` |\n\n### [[role_aggregations]]\n\nSchema row: `RoleAggregationRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_ids` | yes | `array` |\n| `description` | yes | `string` |\n| `role_id` | yes | `string` |\n\n### [[role_bindings]]\n\nSchema row: `RoleBindingRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `binding_id` | yes | `string` |\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `expires_at_tick` | no | `integer,null` |\n| `extent_kind_ref` | no | `string` |\n| `extent_ref` | yes | `string` |\n| `handover_note` | no | `string,null` |\n| `role_id` | yes | `string` |\n| `subject` | yes | `string` |\n\n### [[role_definitions]]\n\nSchema row: `RoleDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_ids` | yes | `array` |\n| `description` | yes | `string` |\n| `display_name` | yes | `string` |\n| `role_id` | yes | `string` |\n\n### [[roll_table_entries]]\n\nSchema row: `RollTableEntryRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `authored_order` | yes | `integer` |\n| `result_ref` | yes | `string` |\n| `roll_table_entry_id` | yes | `string` |\n| `roll_table_id` | yes | `string` |\n| `weight` | yes | `integer` |\n\n### [[roll_table_entry_tag]]\n\nSchema row: `RollTableEntryTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `roll_table_entry_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[roll_table_tag]]\n\nSchema row: `RollTableTagRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `roll_table_id` | yes | `string` |\n| `source` | no | `string` |\n| `tag` | yes | `string` |\n\n### [[roll_tables]]\n\nSchema row: `RollTableRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `display_name` | yes | `string` |\n| `result_kind` | yes | `string` |\n| `roll_table_id` | yes | `string` |\n\n### [[session_definitions]]\n\nSchema row: `SessionDefinitionRow`.\n\nADR-0037: authored session templates. Insert into the live `session_definition` table. Bundle-scoped idempotent apply (clear-then-insert).\n\n| Field | Required | Type |\n|---|---:|---|\n| `auto_join_on_targeting` | no | `boolean` |\n| `bundle_id` | yes | `string` |\n| `busy_allow_pred` | no | `string,null` |\n| `busy_break_pred` | no | `string,null` |\n| `combat_grid_blueprint_id` | no | `string` |\n| `description` | no | `string` |\n| `grid_edge_affordance_bindings_json` | no | `string` |\n| `grid_edge_affordance_template_id` | no | `string` |\n| `initial_state` | no | `string` |\n| `legal_moves_csv` | no | `string` |\n| `on_terminate` | no | `string` |\n| `participants_pred` | no | `string` |\n| `round_duration_ms` | no | `integer` |\n| `session_def_id` | yes | `string` |\n| `stakes_required` | no | `string` |\n| `termination_pred` | no | `string` |\n| `turn_eligibility_pred` | no | `string` |\n| `turn_rule` | no | `string` |\n| `turn_scheduler_id` | no | `string` |\n| `visibility_policy` | no | `string` |\n| `winner_predicate` | no | `string` |\n\n### [[spatial_environment_state]]\n\nSchema row: `SpatialEnvironmentStateRow`.\n\nAuthored spatial ambient-state baselines. Commits only the applying bundle's row for each target and state; play's world-owned override wins and survives whole-bundle or delta re-apply (ADR-0154 G-3). To reset an override, author an Inscribe act that writes the desired baseline value, or reset the world through the operator recovery path. Readers do not expire values by freshness_rule; authored predicates inspect updated_tick.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `location_def_id` | no | `string` |\n| `place_edge_id` | no | `integer,null` |\n| `place_edge_key` | no | `string` |\n| `place_node_id` | no | `string` |\n| `state_id` | yes | `string` |\n| `updated_tick` | no | `integer` |\n| `value_bool` | no | `boolean` |\n| `value_int` | no | `integer,null` |\n| `value_text` | no | `string,null` |\n| `visibility` | no | `string` |\n\n### [[spatial_niche_attachments]]\n\nSchema row: `SpatialNicheAttachmentRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `condition_bool` | no | `boolean` |\n| `ecological_invariant` | no | `boolean` |\n| `niche_id` | yes | `string` |\n| `on_entry_action_id` | no | `string` |\n| `on_entry_target_entity_key` | no | `string` |\n| `place_edge_id` | no | `integer,null` |\n| `place_node_id` | no | `string` |\n| `visibility` | no | `string` |\n\n### [[spatial_state_definitions]]\n\nSchema row: `SpatialStateDefinitionRow`.\n\nAuthored spatial ambient-state vocabulary. Commits to the live `spatial_state_definition` table.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `freshness_rule` | yes | `string` |\n| `lod_policy` | yes | `string` |\n| `merge_rule` | yes | `string` |\n| `state_id` | yes | `string` |\n| `value_type` | yes | `string` |\n| `writer_policy` | yes | `string` |\n\n### [[stacking_discipline_definitions]]\n\nSchema row: `StackingDisciplineDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `discipline_id` | yes | `string` |\n| `display_name` | yes | `string` |\n| `expires_at_tick_outcome_source` | yes | `string` |\n| `stack_count_outcome_source` | yes | `string` |\n\n### [[substrate_definitions]]\n\nSchema row: `SubstrateDefinitionRow`.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `coordinate_kind_id` | yes | `string` |\n| `description` | no | `string` |\n| `substrate_id` | yes | `string` |\n\n### [[tag_capability_grant]]\n\nSchema row: `TagCapabilityGrantRow`.\n\nThe IDENTITY→capability bridge (sk-bwd). Each row says \"while an entity bears `tag`, it may act with `capability_id`\" — read live by `capability_ids_for_actor`, never seeded onto a placed instance.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `capability_id` | yes | `string` |\n| `tag` | yes | `string` |\n\n### [[tag_value_definitions]]\n\nSchema row: `TagValueDefinitionRow`.\n\nBundle-owned exact tag-value vocabulary. Each row identifies one complete dotted tag under a declared ref-typed prefix; it carries no behavior or dispatch payload.\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | yes | `string` |\n| `prefix` | yes | `string` |\n| `tag` | yes | `string` |\n\n### [[target_conditions]]\n\nSchema row: `TargetConditionRow`.\n\nAuthored initial condition rows on a target. Validated at admission, but the server `r_apply_world_manifest` path does not commit them to the live `target_condition` table today (open bug `sk-jay0.2.47`) — use `[[entity_definition_initial_condition]]` to seed a condition onto placed instances.\n\n| Field | Required | Type |\n|---|---:|---|\n| `condition_definition_id` | yes | `string` |\n| `expires_at_tick` | no | `integer,null` |\n| `source` | no | `string` |\n| `stack_count` | no | `integer` |\n| `target_id` | yes | `integer` |\n| `target_kind` | yes | `string` |\n\n### [[trace_kind_definitions]]\n\nSchema row: `TraceKindDefinitionRow`.\n\nADR-0043 / CR-22: authored trace-kind vocabulary. Insert into the live `trace_kind_definition` table. Bundle-scoped idempotent apply (clear-then-insert). Opens the closed `TRACE_KINDS` bootstrap list to modder authoring (e.g. a `phandelver/utterance` speech-trace kind).\n\n| Field | Required | Type |\n|---|---:|---|\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `kind_id` | yes | `string` |\n| `location_kinds` | yes | `string` |\n| `perceptible_for_ticks` | no | `integer,null` |\n| `schema_json` | no | `string` |\n\n### [[turn_scheduler]]\n\nSchema row: `TurnSchedulerRow`.\n\nAction-economy (batch 2): turn-advance scheduler rows. Insert into the live `turn_scheduler` table (#433); exactly one `active` per world.\n\n| Field | Required | Type |\n|---|---:|---|\n| `active` | yes | `boolean` |\n| `bundle_id` | yes | `string` |\n| `description` | no | `string` |\n| `id` | yes | `string` |\n| `order_roll_source` | no | `string,null` |\n| `scheduler_kind` | yes | `string` |\n",
202
+ "manipulate-ref-niche-attachment": "# An item-scoped place niche needs a `spatial_niche_attachment` (or `provider = \"entity\"`), however the manipulate ref is built\n\n(The RH*/WE*/CC* worked examples on this page come from the retired\nPhandelver bundle and its walkthrough, deleted 2026-08-14 — recoverable only\nvia `git log`/`git show`, see `archive/README.md`; the rules still hold.)\n\n**Gotcha — an item-scoped niche on the default `place` provider needs its\nown `spatial_niche_attachment`** (`niche_id` = the item's own\n`niche_definitions` row, predicate `target.has_niche(...)`, no\n`on_consume_consequence_id` link — RH7's `study_journal` shape). A\n`niche_definitions` row with an empty `provider` resolves to `place`, and\n`r_manipulate` then requires an attachment binding the niche at the hosting\nnode — the SAME per-niche opt-in as `srd/niche/strikeable_target` and CC2's\ncustom-capability niches. Without it the act rejects\n`r_manipulate: no authored affordance_template selected action_definition '…'\n— niche_unresolved: … no spatial_niche_attachment binds any of this action's\nniches to the actor's current node …`\n(the world API). Two fixes: add\nthe attachment row (CC3's `augury_statuette` shape), or author the item\nniche with `provider = \"entity\"` so the item's own tags/state are the gate\n(see [`affordance-needs-niche-attachment`](./affordance-needs-niche-attachment.md)).\n\nDo not hand-roll the target ref either: read it from the caller-scoped\nmanipulation context — `spellkave manipulation-context targets\n<perceiver_entity_id>` (CLI, `client/src/cli/manipulation_context.rs`), the\nplayer tool `spellkave_manipulation_context`, or\n`readManipulationContext(db, perceiverEntityId).targets[].target_ref` in\n`@spellkave/sdk` (`packages/spellkave-sdk/src/core/readers/manipulation_context.ts`).\nThose targets are disclosed references, not a claim that any action is legal\nagainst them; the reducer revalidates at act time. RH7's walkthrough\noriginally escaped the attachment by resolving its ref through the per-actor\naffordance cache (`readAffordances`), whose materialiser found co-located\nitems by a direct `entity_location` scan; that cache is retired (see\n[`interaction-dsl-and-world-authoring`](../interaction-dsl-and-world-authoring.md)),\nso that route no longer exists.\n\n**Gotcha — a `combat_grid` session's participants are spatially UNREACHABLE\nby a non-participant** (WE9). Opening a session relocates every seated\nactor into an ephemeral session-scoped sub-graph\n(`session_grid_<N>/c_<x>_<y>`) with NO `place_edge` back to the room\ngraph. A third-party actor's targeted action against a seated participant\nrejects — `range_m = 0.0` (exact-node match) fails outright, and\n`range_m > 0` does a real graph BFS (`place_node_ids_within_range`) that\nnever crosses into the disconnected sub-graph either. There is no\nworkaround short of NOT putting the reacting NPC in the session: let the\nsession run its course, then act strictly BETWEEN sessions once its\nparticipants have reverted to the real room node (the SAME reversion\nWE6's own after-session loot already depends on). For a story that needs\na third party to react mid-fight (e.g. \"flee once 3 of 4 allies fall\"),\nsplit the encounter into SEPARATE sequential 1v1 sessions (WE7's\nsolo-combat shape, reused N times against one shared `session_def_id`)\nrather than one combined multi-enemy session — the reacting NPC gets a\nreal, in-range window after each individual defeat.\n\n**Gotcha — a SECOND `combat_grid` session opened while an actor from the\nFIRST session is still seated still yields two disconnected grids**\n(#1814 ISS1814 / BL-76). `session_grid_<N>` is keyed by the OPENING session's\nown numeric id (`r_session_open.rs`, `format!(\"session_grid_{session_id}\")`),\nso two DIFFERENT sessions get two DIFFERENT grid graphs even when they share\nthe same `session_def_id`. Session-open no longer treats a leftover ephemeral\ngrid cell as an authored declared seat: any current node whose\n`place_graph_definition.is_ephemeral_instance` is set (this session's grid or\na foreign leftover — never a `session_grid_*` name sniff) is ignored, the\nparticipant is row-major-seated on the NEW grid, and\n`pre_session_place_node_id` falls back to that new grid's `anchor_node_id`\ninstead of recording the leftover cell. `JoinSession` rejects a joiner already\nseated on any ephemeral grid (leave or close first; join is not the reseat\npath). Workaround: still don't open a second concurrent session while any of\nits participants are seated in an earlier one — either reuse the FIRST\nsession for the new interaction (add the new actor to its ORIGINAL\nparticipant CSV) or let the first session close first. Two live sessions still\nmean two graphs with no `place_edge` between them, so range checks cannot\ncross.\n\n**Gotcha — outside an active session, an actor's `action_budget_state` for\na given action class does not refill from world-clock ticks alone** (WE9;\n`r_advance_turn.rs` + lazy window reset in `budget_gate.rs`): session turn\nadvance is the practical refill path for combat-shaped channels. A plain\nretry loop of `hero.manipulate(...)` with no `sessionOpen` typically lands\nexactly ONE `core/action_class/primary` action — subsequent calls reject\n`action_budget_exhausted`; `advanceScene`/`manualTick` advance the WORLD\nclock, not a session's turn. Beats needing more than one attack against the\nsame target should wrap the fight in a `combat_grid` session and drive\n`hero.advanceTurn(sessionId)` between attacks (WE6/WE7/CC5 precedent).\n(Some `turn_start`/`turn_end` channels also support lazy sessionless window\nreset — do not treat \"only `r_advance_turn` ever deletes a budget row\" as a\nuniversal kernel law without re-checking `budget_gate.rs`.)\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
203
+ "manipulate-success-on-provenance": "# `manipulate()`'s `successPredicate` has no fixed world-state signal for a stochastic (d20-driven) action — pass `successOnProvenance: true` on the client instead\n\n`createActorClient(session, id, { successOnProvenance: true })` makes\n`manipulate()` treat a `succeeded` `evaluation_provenance` row as success even\nwhen `successPredicate` never fires (`provenance.ts`; default `false` —\npredicate-driven, unchanged). A death-save roll, a Medicine/Perception/DC\ncheck, or any other action whose outcome branches on a live d20 draw has no\nsingle expected POST-state to poll for (unlike a deterministic action, e.g.\n`hpAfter === hpBefore + 6`) — without this option `manipulate()` times out to\n`unobserved_no_provenance` even though the server-side row shows\n`(succeeded = ())`, because the default path only resolves via\n`successPredicate` or a terminal `evaluation_provenance` status, and the\ncommon `() => false, () => null` combo (CC4/CC5's own `fightUntilDown`\nidiom) never satisfies the predicate branch on its own.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
204
+ "mass-stand-down-apply-status": "# Mass stand-down: `ForEachActorInRadius` + `ApplyStatus`, not per-entity writes\n\n(The G1/OW1 worked examples (`base/speak-to-room.toml`, `base/ow1-old-owl-well.toml`) are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\nA single deterministic act (e.g. an NPC leader calling off its allies) can\napply a condition to every co-located, tag-matching actor in ONE consequence\n— no need to author a hardcoded `ApplyStatus` frame-write per roster member.\nG1's `speak_aloud_to_room` (`base/speak-to-room.toml`) already proved\n`ForEachActorInRadius` selecting same-node actors and running an `Inscribe`\nbody per target; OW1 (`base/ow1-old-owl-well.toml`) composes the SAME\nselector with `ApplyStatus` instead, filtered by an authored tag:\n\n```toml\nframe_write = { ForEachActorInRadius = { center_ref = \"ActorSpatialRef\", shape_id = \"core/area/node_ball\", shape_params_json = '{\"ball_radius\": 0}', predicate_source = \"actor.has_tag(\\\"phandelver.ow1.zombie\\\")\", body = [ { ApplyStatus = { target_kind = \"entity\", target_ref = \"Actor\", condition_definition_id = \"core/condition/disengaged\" } } ] } }\n```\n\n`predicate_source` here is the per-target FILTER (evaluated once per\nselected actor, `actor` = that actor) — use it to exclude co-located actors\nthat shouldn't be affected (OW1 excludes the NPC leader itself, which is\nco-located but untagged). This scales to any roster size without touching\nthe manifest as the roster grows; a beat that fights this pattern by writing\nN near-identical `ApplyStatus` frame-writes is re-deriving what CR-8 already\nwired.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
205
+ "metadata-attachments": "# Metadata Attachments\n\nMetadata attachments are validated annotations on authored world objects. They\nare for humans, tools, and non-player clients, not for server behavior.\n\nThe rule from ADR-0073 is the contract:\n\n> Does the world behave differently if the datum is missing? Then it is not metadata.\n\nReducers, DSL predicates, schedulers, and perception materialisation must not\nread `payload_json` semantically. A client may read metadata, but if the server\nmust enforce the result, promote the datum to a typed table or world data.\n\n## Placement Ladder\n\nUse this ladder before adding a `[[metadata_attachments]]` row:\n\n| Rung | Use when | Mechanism |\n|---|---|---|\n| 1 | An actor should perceive it in-world | Typed world data behind perception, such as description columns |\n| 2 | The DSL gates or selects on it | Relational tags |\n| 3 | The server computes with it | A typed domain table |\n| 4 | Only authors, tools, UIs, observers, or drivers read it | `[[metadata_attachments]]` |\n\nExamples of the wrong rung:\n\n- \"This edge costs double movement\" is not metadata; movement changes.\n- \"This creature is undead for a spell predicate\" is not metadata; use tags or a typed table.\n- \"This room has an author TODO\" is metadata.\n\n## Row Shape\n\nThe `phandelver`/`triboar_*` ids in this page's examples are schematic: no\nlive fixture carries them. Substitute your own bundle's ids.\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_node\"\ntarget_ref = \"triboar_trail/ambush_site\"\nnamespace = \"editorial.note\"\npayload_json = '{\"text\":\"Review the clue wording before public release.\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n`target_kind` is one of `entity`, `entity_definition`, `item_definition`,\n`affordance_template`, `place_graph`, `place_node`, `place_edge`,\n`resource_definition`, `capability_definition`, `bundle`, or\n`prompt_definition` (`TARGET_KINDS`, the world API,\nmirrored by `METADATA_TARGET_KINDS` in\n`crates/spellkave-validate/src/metadata_attachments.rs`). `target_ref` must\nresolve at apply time. `source` defaults to `manifest` in the authoring\nsurface. Offline validate rejects an unknown kind (`MF-VAL-330`); live apply\nrejects unknown kinds and unresolved refs.\n\nUse `bundle` for content that belongs to the bundle as a whole and to no\nsubject in it, such as a docs page shell or chapter prose. Its `target_ref` is\na `[[bundles]]` `bundle_id` that is committed when the attachment applies,\nnormally the attaching bundle itself:\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"bundle\"\ntarget_ref = \"srd\"\nnamespace = \"srd.text\"\npayload_json = '{\"text\":\"This work includes material from the System Reference Document 5.2.1.\",\"source\":\"SRD 5.2.1\",\"license\":\"CC-BY-4.0\"}'\nbundle_id = \"srd\"\nsource = \"manifest\"\n```\n\nContent about one subject still attaches to that subject's own kind; `bundle`\nis not a shortcut around a missing subject row.\n\n## Native NPC driver documents (local stage 2)\n\nADR-0165's quest-giver port uses this client/driver rung. The source is an\nadventure-owned TOML document, compiled through\n`@spellkave/world-author/npc-quests` and the shared Rust validator into ordinary\nmetadata attachments, read capabilities and sealed NPC job references. Existing\nauthored actions still enforce acceptance and progress changes. The server does\nnot interpret the driver payload as a predicate or consequence.\n\nThe current quest compiler accepts `schema_version = 1`, one `quest-giver` kind,\n`hooks = {}`, the legacy quest shapes, configured giver boards, and\nexplicit action/flag/state/blueprint/place references. It validates those\nreferences against the supplied dependency worlds before returning an artifact.\nUnknown kinds, hooks, slots and versions refuse compilation. Missing reference\ntargets refuse except the explicitly reviewed missing-flag set tied to\n`sk-jay0.3.4.11`; the compiler reports those as `known-missing`. The adventure's\n`tests/offline/npc-quest-documents.test.ts` pins that exception set so it can only\nshrink. This is the initial quest-giver protocol, not an arbitrary scripting surface.\nThe canonical authored example is the repository source file\n`packages/spellkave-adventure-elven-mini/author/quests.toml`.\nThe repository test `packages/spellkave-world-author/src/__tests__/npc-quests.test.ts`\npins compilation, dependency closure, canonical hashing and tamper refusal.\n\nA board's private lines and own quest references attach to its actor's metadata\nnamespace. Shared catalog metadata contains terminal descriptions without private\nspoken lines. Each job pins the NPC kind, schema version, private and shared\nnamespaces, and shared catalog content hash. Admission checks the stored targets,\neach payload's self-declared hash and the matching publication IDs; the private\npayload hash is not independently pinned by the job. An actor receives read\ncapabilities for its own document and the shared catalog. Another giver's private document remains outside that read\ncapability. A document reference supplies no action or DM authority. The native\nhost's repository document `crates/spellkave-npc-host/QUEST-DOCUMENTS.md` defines\nthe replay and admission contracts, refusal names and local proof setup.\nThis variant stays unwired from hosted adventure bundles until stage 3.\n\n### Generated DM runtime table input\n\n`@spellkave/world-author/npc-dm-srd` compiles the platform's existing SRD runtime\ntables into `{schema_version: 1, tables, content_hash}`. `compileDmSrdData(tables)`\nuses the shared Rust/WASM schema; `parseDmSrdData(json)` validates again and\nchecks the canonical content hash. The schema preserves source strings, array\norder, null defense abilities and absent optional cantrip maps. Unknown fields,\nduplicate table rows/keys, unsafe numbers and inconsistent caster references\nrefuse admission. Tests in `src/__tests__/npc-dm-srd.test.ts` and\n`crates/spellkave-validate/tests/dm_srd.rs` pin these checks.\n\nThis is offline compiler input for the opt-in trusted DM duty carrier below.\nThe standalone table artifact supplies no read, write or DM authority. The\nenclosing carrier requires separate publisher and runtime admission. Do not\nput privileged table/configuration fields into an NPC's editable persona\ndocument.\n\nIn the repository, `pnpm exec tsx scripts/export-dm-srd-catalog.ts` exports all\nnine unchanged `adventure-runtime/src/dm/data/srd-catalog.ts` tables to\n`crates/spellkave-npc-host/corpus/documents/dm-srd-v1.generated.json`.\nThe `dm-srd-data-drift` registry gate runs the exporter with `--check` to compare\nwithout writing. The adventure's `tests/offline/dm-srd-data.test.ts` compares the\ngenerated values to every source table, including real prose and caster rows.\nThis stage adds no ruleset rows and does not activate a hosted DM engine.\n\n### DM presentation component\n\n`@spellkave/world-author/npc-dm-presentation` exposes\n`compileDmPresentationJson(value)` and `validateDmPresentationJson(json)`.\nBoth use `spellkave-validate` through WASM. Raw JSON validation retains duplicate\nfield checks before JavaScript parsing. The schema contains voice, creation and\nlevel-up text, companion-offer rule/summary labels, invitation text and quest-board\nprompt lines. It rejects\nact IDs, targets, quantities, recipients, kits and extents as structural fields.\nLabels are presentation values and cannot grant or select an authored action.\nThe required `companion_offer.agreement_reopen` label contains bounded, nonblank\n`rule` and `summary` strings, with the same admission as agreement accept and\ndecline labels. The exporter calls the existing TS `agreementRule(\"reopen\")`\nand copies `agreementSummary`; it does not infer a Rust-side label. Missing\nlabels and nested authority fields refuse admission. Older unshipped stage-2\npresentation documents require regeneration.\n\nThe required `voice.persona_slug` copies the authored TS seat `personaSlug`\nexactly for cycle-error step labels. It is a nonblank string of at most 16 KiB;\nolder unshipped presentation documents require regeneration.\n\nThe required `quest_board.lines` maps quest references to plain `greeting`,\n`accept`, `decline` and optional `complete` strings, using the existing giver\nline vocabulary. Every supplied string is nonblank and at most 16 KiB; unknown\nstructure, null values and authority fields refuse admission. The running TS\nboard and presentation exporter share the same `QUEST_PROMPT_LINES` projection.\nThe complete carrier additionally checks its keys and source text against the\nadmitted duty board and catalog source below. Older unshipped presentation\ndocuments require regeneration.\n\nComputed creation and class-flavour lines use flat text/value segments with\nfield-specific display slots. There is no callback, expression evaluator, world lookup or recursive\ntemplate. Shared `MAX_TEMPLATE_PARTS` and `MAX_TEXT_BYTES` bound each template\nto 64 parts and each text value to 16 KiB. Literal whitespace parts are preserved;\nplain display fields still require nonblank text. Callers supply preformatted display values; native concatenation\nrejects missing/extra inputs and bounds output at 256 KiB. Progress guidance\ndeclares separate ready/missing text. The exporter\n`scripts/export-dm-presentation.ts` captures unchanged legacy lines; a separate\ntest-only artifact records 86 rendering cases compared by native and TS tests.\n`dm-presentation-data-drift` checks both generated files without writing.\n\nThis component does not emit metadata rows, read grants, a trusted duty document,\na publication envelope or a mounted-engine declaration. The enclosing compiler,\npublisher and activation admission must validate those separately. The expected\nrendering cases are test assertions and must never be mounted as engine inputs.\nIts negative tests prove component checks. The carrier parser below separately\ntests publication-artifact refusal; live publication and activation negatives\nremain owed by `sk-jay0.3.33.7.7` and its integration owners.\n\n### Opt-in DM carrier compiler\n\n`@spellkave/world-author/npc-dm-documents` exports\n`compileNpcDmSource(sourceJson, canonicalWorlds)` and\n`parseNpcDmArtifact(artifactJson, canonicalWorlds)`, both returning\n`Promise<NpcDmArtifact>`. The strict JSON source contains original principal\nplan P, explicit read IDs, the existing compiled quest catalog, presentation,\ntyped duties and Job-only reference locators. Raw duplicate fields, unknown\nfields, unsupported versions and broken canonical references refuse. The\nparser rederives all artifact fields, rows, Pdocs, hashes, locators and grants.\n\nThe required `level_up.class_flavour` and `level_up.offer_with_class_flavour`\nare flat display templates captured by calling the TS `classFlavourLine` and\n`levelUpOfferUtterance` functions. Their slots are respectively `class_name` +\n`primary_ability` and `offer` + `class_flavour`; the append separator is\ncaptured literal text. The consumer uses the base offer when class flavour\nis absent or empty. Unknown class metadata suppresses flavour in the TS seat\nbut throws in its class-grant path; these are distinct behaviors. Templates\ncarry no action authority, callbacks, expressions or world-row lookups.\nMissing fields, invalid slots, unknown structure and existing size bounds\nrefuse admission; older unshipped presentation documents require regeneration.\n\nThe required `duties.quest_board.quest_refs` is a nonempty list of distinct,\nnonblank quest references bounded to 16 KiB each. It preserves the actual TS\nboard selection order; presentation map order supplies no scheduling policy.\nEach reference resolves to an independently admitted catalog quest owned by\n`giverKey == body_key`. Body presentation `quest_board.lines` must have exactly\nthe same keys. Source admission also requires each line object to equal that\nquest's `prompt_lines` from the compiled authored quest source; the runtime\ncatalog omits prose and runtime admission instead checks ownership, key closure\nand the existing document hash/publication links. Both exporters consume the\nrunning TS board's shared projection, without a new giver document, locator or\nread grant. Missing fields, unknown/foreign quests, duplicate references,\nmismatched keys and source prose drift refuse admission. Regenerate both source\nand presentation fixtures for this opt-in unshipped carrier extension; it does\nnot activate a native DM engine.\n\nThe required `duties.layer_topology` captures the ordered story-layer IDs and\nrole links from `ALDWIN_LAYER_TOPOLOGY`, shared with the actual TS layer factory.\n`ordered_ids` preserves highest-priority-first order and contains exactly the\ntwo distinct role IDs, each nonblank and bounded to 16 KiB. `companion_offer_id` and\n`quest_board_id` are distinct members of that list. `companion_yields_to` is a\npossibly empty list containing at most the quest-board ID. Extra layers are\nrefused until a corresponding producer and consumer ship.\nAn active layer named in that list suppresses the companion layer's observation\nand decision for that cycle; the existing ceremony controls remain separate.\nThe source constants drive the real TS IDs, array order and `mayRun` check, so\ncapturing the topology does not introduce a second authored table. IDs remain\nopen vocabulary; they grant no read or dispatch authority and are not canonical\nworld-row references. Unknown structural fields, missing links, duplicate IDs,\ndangling yields and self-yields refuse admission. Older unshipped stage-2 duty\ndocuments require regeneration. Native engine consumption belongs to the\ncompanion/body-arbitration work; this carrier change does not activate it.\n\nThe required `duties.creation.observation_vocabulary.class_tag_prefix` is\nthe exact query prefix shared with the TS class reader. It must be nonblank,\nbounded to 16 KiB, and concatenate with each admitted class slug to that\nclass's identity tag. Each slug must be nonempty and contain no dot, matching\nthe TS reader's single-segment rule. It is separate from the class speech-menu\ntoken and is not inferred from an identity tag. A future native class reader skips\nonly the class grant and offer flavour for multiple matching class tags,\nreturns normally with the approved `wait/ambiguous-class-tag` diagnostic and\ncontinues other duties; TS ordering for that ambiguous case is undefined.\nThis carrier does not activate that consumer or change the TS choice.\n\nClass-grant bounds come from each admitted `advancement_tags` level domain,\nnot a native literal or story maximum level. The exporter checks every full\nladder against the same source bounds used by the TS runtime renderer.\nCanonical admission compares its whole tag domain with the authored action\nselection, so a removed/truncated ladder refuses before activation. A level\nwithout an admitted tag is not synthesized into an action argument; preserve\nthe source refusal/throw boundary. An existing tag with no level-specific\nfeature still dispatches the advancement act.\n\nEach `duties.creation.observation_vocabulary.ability_states` row requires an\n`aliases` list for score input. Every alias must be a nonempty ASCII letter,\ndigit or underscore sequence; the list must contain the row's canonical\n`ability` key, ignoring ASCII case. Aliases must be unique ignoring ASCII case\nboth within a row and across all ability rows. Missing lists, ambiguous aliases\nand regex syntax refuse admission. The repository exporter imports the existing\ncreation parser's `ABILITY_ALIASES` table and checks every alias against that\nparser before emitting duty data. The native validator's `tests/dm_duties.rs`\npins required fields, malformed/colliding aliases and alternate ability names.\n\nThe required `observation_vocabulary.menu_tokens` declares the existing\ncreation parser's literal namespace, relative token prefixes, array-adoption\ntoken, decimal score width and ordered ability keys. Score order must contain\nexactly the admitted ability inventory. Prefixes must be nonempty literal\npaths ending in `/`, without overlapping branches; class and origin tokens\nmust agree with their declared prefix and slug. The exporter imports\n`CREATION_MENU_TOKEN_GRAMMAR` from the TS source, and that parser consumes the\nsame constants. Codec labels describe wire decoding, not executable action\nreferences: choice components retain permissive base64url and replacement\nUTF-8 decoding; adopted text requires lowercase, even-length hex and valid\nUTF-8. Unsupported codecs, missing fields, inconsistent orders and ambiguous\nprefixes refuse admission. Native mutation controls in `tests/dm_duties.rs`\nand the TS creation projection test protect this contract. Older unshipped\nstage-2 documents must be regenerated; there is no inferred namespace fallback.\n\nThe required `duties.creation.presentation_vocabulary` carries creation display\ntext and candidate aliases, exported from the TS runtime's\n`CREATION_PRESENTATION_VOCABULARY`, which the TS call sites also consume.\n`menu_labels` names class, background, species, skill, cantrip, prepared spell,\nstarting kit, name, ability scores and confirmation menus. `missing_phrases`\nnames class, background, species, name, skills and kit omissions; `list`\ncontains the empty-list word and pair, ordinary and last separators. These\nlabels and the empty-list word must be nonblank and at most 16 KiB each.\nSeparators must be nonempty and at most 16 KiB; literal whitespace is preserved.\nTheir wording is admitted data.\n\n`templates` requires each listed placeholder exactly once, in any order:\n`count_kind` uses `{kind}` and `{remaining}`; `kit_option` uses `{letter}`\nand `{description}`; `equipment_page` uses `{source_text}`, `{page}` and\n`{pages}`; `equipment_more` uses `{page}` and `{pages}`; `adopt_name`\nuses `{name}`; `remaining_one` and `remaining_many` use `{remaining}`;\n`answer_option` uses `{index}`. `adopt_array` and `confirm` contain no\nplaceholders. Unknown, repeated, missing or unmatched braces refuse admission.\nSubstitution is literal, without recursive interpolation or executable code.\n\n`spoken_confirm_aliases` and `spoken_discard_aliases` are nonempty lists of\nat most 64 distinct phrases, each at most 256 bytes, trimmed and containing\nlowercase ASCII letters, spaces, apostrophes or hyphens and at least one letter.\nThey must be disjoint and must not equal a canonical class, species or\nbackground display name. Slash-delimited menu tokens cannot match the admitted\nspoken alphabet. The existing TS normalization trims, lowercases and\nremoves terminal `.!?` before comparing. `text_field_aliases` requires\nnonempty `name`, `appearance` and `backstory` lists, at most 64 aliases per\nfield and 64 bytes per alias. Each alias contains only ASCII letters,\ndigits or underscores; aliases must be unique ignoring ASCII case within and across text fields\nand disjoint from ability aliases ignoring ASCII case. Keyed-text matching\nretains case-insensitive word boundaries, last-key-wins parsing and existing\nfield-specific termination and length bounds. These aliases and display labels\nconfer no dispatch authority. Spoken aliases select proposal parsing; typed\nforms instead use the separate required `creation.input_field_keys` (name,\nappearance and backstory), exported from `CREATION_INPUT_FIELD_KEYS`, which\nalso authors the forms. Those wire keys are distinct nonblank ASCII\nalphanumeric/underscore strings of at most 64 bytes. Typed values use the same\nfield-specific termination and length checks directly, without rebuilding keyed\nspeech. They retain the legacy rule that the last matching field alias inside a\nform value wins before termination (for example, `Renn; name=Bob` yields `Bob`).\nNative mutation\ncontrols in `tests/dm_duties.rs` protect these admission rules; the TS runtime's\ncreation tests protect existing output and parser behavior. Older unshipped\nstage-2 documents require regeneration with the new required field.\n\nThe required `duties.creation.kit_granted_value` is a positive JavaScript-safe\ninteger exported from `CREATION_KIT_GRANTED_VALUE` in the TS kit authoring\nsource. The authored marker bound, atomic completion write and TS completion\nreader share that constant (currently 1). Canonical kit admission derives its\nexpected completion delta from this value and refuses a value that disagrees\nwith the whole canonical action consequence. The canonical marker must also\nsatisfy `min_value <= initial_value < kit_granted_value <= max_value` (an omitted\ninitial value uses `min_value`, matching the kernel), preventing clamping and\ncompletion at birth. This is completion state data,\nnot a dispatch grant; older unshipped documents must be regenerated.\n\n`duties.creation.classes` is the creation menu. It may offer fewer classes than\n`srd.classes`: it must be a non-empty list of distinct classes, each of which is\nan admitted SRD class. A class outside the SRD data refuses admission, and so\ndoes a `duties.creation.kits[]` entry whose class is not in the menu, so an\nexporter that narrows the menu drops those kits too. `srd.classes` itself stays\ncomplete. `duties.creation.species` and `duties.creation.backgrounds` must still\nequal the admitted SRD lists. The native validator test\n`creation_classes_are_a_nonempty_subset_of_the_admitted_srd_classes` in\n`crates/spellkave-validate/tests/dm_duties.rs` covers the subset, an unknown\nclass, a stray kit and an empty menu.\n\nThe reference checks over the real worlds follow the same rule. The class\nidentity act may declare more class tags than the menu offers, so the menu\nclasses must be a non-empty subset of that act's tag domain. The class-derived\ntraining lists (`skill`, `cantrip`, `prepared_spell`, `proficiency`) stay the\ncomplete populations the training acts write; they must contain everything an\noffered class can train. Origin feats and choice members must still equal their\ncomplete lists. Do not narrow the training lists when you narrow the menu: the\ntraining act's exact tag write is still checked against every member.\n`crates/spellkave-validate/tests/dm_reference_metadata.rs` covers both.\n\n`duties.watches.initiative.on_sight` is optional. The DM's initiative watch\n(`mode = \"legacy\"`) calls initiative when it sees an attack between a party\nbody and a listed hostile. With `on_sight` it also calls initiative when one of\nthe listed hostiles and a party body come to share a node:\n\n- `actor_keys`: non-empty, distinct members of `hostile_actor_keys`. Only these\n hostiles open a fight by a meeting.\n- `unseen_condition_ids`: condition definitions that keep a party body's\n arrival from opening a fight (for example `srd/condition/invisible`).\n- `peace_condition_ids`: condition definitions on the hostile that switch the\n trigger off for it. A no-kill ending that leaves the hostile and the hero in\n one node must set one, or the hero's next return opens a fight.\n\nAll three lists are required when the object is present; the two condition\nlists may be empty and must not share an id. The object is refused with\n`mode = \"controller\"`. Every condition id must resolve in the admitted worlds.\nThe trigger is a meeting, not perception: the DM does not read what another\nbody sees. Whoever already stands together when the host starts is no meeting.\nA call the world refuses is not repeated for that meeting; the two must part\nand meet again.\nDesign: `ledger/designs/initiative-on-sight.md`; tests:\n`on_sight_initiative_is_optional_and_refuses_empty_unlisted_or_controller_use`\nin `crates/spellkave-validate/tests/dm_duties.rs` and\n`a_meeting_with_a_listed_on_sight_hostile_opens_initiative_once` in\n`crates/spellkave-npc-host/src/dm/engine/watches/reward_tests.rs`.\n\nEach `duties.creation.classes[].advancement_tags[]` ladder row also requires\n`missing_capability_definitions`, an ordered list exported from\n`grantableAdvancementCapabilities(target, classSlug, level).missingCapabilityDefinitions`.\nIt may be empty; members must be distinct, nonblank and at most 16 KiB.\nThe exporter asserts each listed capability is still absent from the canonical\nSRD population. These are source-reported absent capability definitions, not\ncanonical foreign\nkeys or executable grants. The existing contiguous ladder domain supplies the\nclass and level; no missing-list fallback is inferred for older documents.\n\nThe required `duties.watches.initiative` selectors are\n`trigger_capability_ids` (a nonempty list of distinct bounded, nonblank capability\nreferences), `party_tag_id` and `hostile_tag_id` (distinct bounded, nonblank tag\nreferences). Capability IDs must resolve in canonical `capability_definitions`;\nboth tags must resolve in `tag_value_definitions`. The exporter uses the TS\ninitiative tick's `DEFAULT_INITIATIVE_TRIGGER_CAPABILITY_IDS` unless its config\nprovides an override, and the existing encounter faction-tag constants. These\nselectors confer no capability or binding authority. Party-tag precedence and\nthe requirement that hostile participants also belong to `hostile_actor_keys`\nremain the consumer's existing policy. HP and exact death-condition selectors\nreuse `creation.observation_vocabulary.hp_state_id` and\n`watches.kill_xp.dead_condition_id`. Missing selector fields in older unshipped\nstage-2 documents require regeneration; no ruleset fallback is inferred.\nShape mutations in `tests/dm_duties.rs` and missing canonical-reference controls\nin `tests/dm_reference_metadata.rs` protect these requirements.\n\nCanonical inputs are complete publisher-admitted flattened roots after the\npublisher's original-P fresh preparation, followed by an independently parsed\nquest artifact's manifest contribution. The compiler never prepares content or\nself-injects its embedded catalog into those inputs. It retains all raw roots;\nonly the separate authority adapter projects its consumed columns. Boundary\ndefinitions stay in the raw inputs and cannot be queried through the DM global\nreference index. Existing no-document artifacts keep their existing parsers.\n\nThe manifest contributes two read capabilities, one reader role, two private\nnamespaces, the body's presentation grant and two document attachments. Its\nprincipal plan adds exactly one bundle reader binding to P; no binding subject\nis emitted by this compiler. Original act selectors, fiction powers and sight\nremain in P. Locator fields are exactly `catalog_namespace` and\n`reader_binding_id`. Each declared read grant has `socket_role`, `target_kind`,\n`target_ref`, `namespace`, `read_capability_id`, `content_hash` and\n`publication_id`; socket roles are `principal` or `body`.\n\nRuntime duties omit kit item recipes and all Job reference locators. Both\ndocuments include canonical content hashes and the same initial DM\nsource-hash publication ID; duties independently link the existing catalog's\nhash and publication ID. Each complete document is bounded at 256 KiB.\nShared Rust/WASM facets check content, finite policies, hashes and bounds.\nThe repository tests in `src/__tests__/npc-dm-documents.test.ts` cover actual\ncompile/parser consumers and real Web WASM, including all seven forbidden\npresentation fields across the admitted structural paths. These checks supply no observed-target,\nread-grant, live-credential, assignment, publication or engine-activation proof. Publisher and\nactivation owners must verify actual rows and owned reads before readiness.\nThis carrier remains unwired from hosted inputs until stage 3.\n\nFor repository development, finish `just build-validate-wasm` and\n`just build-authoring-wasm` before invoking pnpm or registry gates: wasm-pack\ntemporarily replaces the workspace package manifests during generation.\nChecks started during that replacement can report missing workspace packages;\nrerun them after generation completes.\n\n## Row Identity\n\nA `[[metadata_attachments]]` row's identity is `(target_kind, target_ref,\nnamespace)`, scoped to its `bundle_id` — the same key the server stores as\nthe row's primary key and upserts on (ADR-0146; `metadata_attachment_key`\nand `add_metadata_attachment`, the world API). The\ndatabase refuses a second row for one identity. Player and MCP output name an\nattachment by this key string (`provenance.attachment_id`). Re-declaring the same identity with a\nchanged `payload_json` (an editorial revision, for instance) lands the new\npayload/audience/source in place; it does not create a second row. This is\nalso the applyset row identity (`crates/spellkave-schema/src/row_identity.rs`,\nADR-0145): `sk dev seed`/`apply-bundle` and `spellkave manifest applyset\nshow` track and hash metadata attachments the same way they track any other\nrow kind, instead of only counting them. They cannot prune one: there is no\nretraction kind for `metadata_attachments` (`MF-VAL-293`). Retracting an entity\nalso leaves any attachment that names it in place. That slice waits on bead\n`sk-jay0.7.186.5.9` (`design.md` D-6 of change `applyset-prune-placed-entities`).\n\n## Action Definition References\n\nAn affordance whose player-facing label denotes one canonical definition may\ncarry `ui.affordance_reference` on its `affordance_template`:\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"affordance_template\"\ntarget_ref = \"dm/creation/class/barbarian/affordance\"\nnamespace = \"ui.affordance_reference\"\npayload_json = '{\"definition_ref\":\"srd/class/barbarian\"}'\nbundle_id = \"dm\"\nsource = \"manifest\"\n```\n\nThe reference is exact presentation data. Player surfaces may show its card\nwithout matching prose, while the normal affordance gate and action dispatch\nremain the only mechanical authority. Attach it only where one stable template\nalways denotes that definition; a reusable `Answer 1` template must not gain a\ndifferent reference for each live conversation.\nReusable menus instead carry parallel static `dispatch_option_refs` beside\ntheir dispatch labels; Inscribe stores them as `option_definition_refs` in the\nquestion trace. A missing reference means no description, never an eligibility\nlookup.\n\n## Authoring with `spellkave_set_metadata`\n\nUse `spellkave_set_metadata` for normal metadata authoring. It is one\ndiscriminated tool with the same flat `target`, `key`, and `value` vocabulary\nfor every operation: `target: \"manifest\"` replaces one named top-level\n`[metadata]` key; `target: \"namespace\"` registers one namespace; and an object\ntarget `{ \"kind\", \"ref\" }` sets one annotation. Root keys are replace-by-key\nrather than a deep merge, so unrelated root metadata remains untouched. Root\nvalues may use the scalar, array, and object forms admitted by shared metadata\nvalidation; attachment payloads remain JSON objects. The tool does not reserve\na docs or UI payload shape.\n\nAttachment identity is `(target_kind, target_ref, namespace, bundle_id)`, the\nsame identity used by live admission. Repeating that identity replaces its\npayload and `source`; it does not append a second historical annotation. The\ntool rejects an ambiguous pre-existing identity instead of choosing one. An\nattachment may use a namespace from an owning dependency; do not try to\nre-register that foreign namespace. A root metadata shape is authored into the\nworkspace manifest and validated before it is persisted; it does not by itself\nadd a new server-side storage or interpretation surface.\n\n```json\n// Root: replaces metadata.editor only, preserving other [metadata] keys.\n{ \"target\": \"manifest\", \"key\": \"editor\", \"value\": { \"summary\": \"Review names.\" } }\n\n// Namespace: bundle defaults to the active authoring context when one is set.\n// `audience` here is `mymod`'s own capability id (a dotted or slashed name it\n// defines and grants) — see Audience below for the built-in relation words.\n{ \"bundle\": \"mymod\", \"target\": \"namespace\", \"key\": \"mymod.hints\", \"value\": { \"audience\": \"mymod.author_notes\", \"description\": \"Author-only guidance, gated behind the mymod.author_notes capability.\" } }\n\n// Attachment: key is the namespace; source defaults to manifest.\n{ \"bundle\": \"mymod\", \"target\": { \"kind\": \"place_node\", \"ref\": \"mymod/shrine\" }, \"key\": \"mymod.hints\", \"value\": { \"text\": \"Mention the sigil.\" } }\n\n// Batch: every update is validated together and persists only if all are clean.\n{ \"bundle\": \"mymod\", \"updates\": [\n { \"target\": \"manifest\", \"key\": \"editor\", \"value\": { \"reviewed\": true } },\n { \"target\": \"namespace\", \"key\": \"mymod.hints\", \"value\": { \"audience\": \"mymod.author_notes\" } },\n { \"target\": { \"kind\": \"place_node\", \"ref\": \"mymod/shrine\" }, \"key\": \"mymod.hints\", \"value\": { \"text\": \"Mention the sigil.\" } }\n] }\n```\n\nAn attachment can include `audience` (and optional `description`) to register a\npreviously absent namespace in the same call. Omit both when using an already\nregistered namespace; a matching `audience` only verifies that registration and\ndoes not rewrite it. Change an owned registration deliberately with the\n`target: \"namespace\"` form. `source` is optional and defaults to `manifest`.\nDo not combine singleton `target`/`key`/`value` fields with `updates`, and do\nnot repeat a root key, namespace registration, or attachment identity inside a\nbatch. The generated tool reference carries the complete parameter schema.\n\n## Audience\n\nEvery namespace registration names an audience (ADR-0130 D-3, 2026-09-12\nrevision), and the server enforces it: a row is delivered to a caller only\nwhen the caller may see the row's target **and** the namespace audience\nadmits the caller (D-2). An audience never invents its own vocabulary — it is\none of the world's existing `VisibilityClass` tokens, the strict owner token\n`owned`, or a capability id:\n\n| Audience | Admits the caller when |\n|---|---|\n| `public`/`Public`, `local`/`Local` | always, subject to the caller being able to see the target |\n| `hidden`/`Hidden`, `internal`/`Internal`, `discoverable`/`Discoverable` | resolved exactly like `visible_object_state`: the target is an `entity` whose body is in the caller's `visible_bodies` (see-as scope) and that class's `owner_delivery_admits` gate passes for the body. Metadata carries no per-row knowledge substrate (no \"learned\" state), so `Discoverable` admits a plain owner exactly when `Internal` would — only through a [DM elevation grant](dm-oversight.md) (`elevation_class = \"internal\"`), never on ordinary ownership or an unelevated party extent |\n| `owned` | the target is an `entity` whose body the caller directly controls — the strict `owned_object_state` relation (steering the body), not merely seeing it |\n| any other value | it names a `capability_definition`, and the caller holds a live grant of it that reaches the target (extent-bounded: a grant reaches the caller's own bodies, bodies and places inside its extent, and catalog/bundle targets unconditionally) |\n\nA relation audience needs a body to resolve against. On `bundle`, catalog\n(`entity_definition`, `item_definition`, `resource_definition`,\n`affordance_template`, `capability_definition`), and place\n(`place_graph`/`place_node`/`place_edge`) targets, only `public`/`local` and\ncapability audiences ever admit anyone — `hidden`, `internal`, `discoverable`,\nand `owned` all fail closed there (`class_audience_admits`,\nthe world API).\n\nA capability id is shaped like `frontier.apply_manifest` or `core/world_admin`\n(it contains `/` or `.`, so it can never collide with a visibility-class token\nor `owned` — offline validate enforces this shape as `MF-VAL-331`, live apply\nadditionally requires the capability to exist). There is no generic `author`\nor `dm` word: a mod that wants an author- or DM-only namespace defines its own\ncapability and grants it with `[[actor_capabilities]]`, then names that\ncapability as the audience — no server change needed. `core`'s own\npre-ADR-0130 examples now read this way: author-only namespaces\n(`provenance.source`, `editorial.note`, `art.image`) are gated behind\n`frontier.apply_manifest` (whoever may change the world may read its author\nnotes), and the one DM-only namespace (`narration.read_aloud`) is gated behind\n`internal` (reached only through a DM elevation grant, never by an ordinary\nowner or an unelevated party extent).\n\nAn audience value the server does not recognize admits nobody (fail closed);\nit is never a silent downgrade to `public`.\n\n**Service-only capability audiences.** Tag the audience capability's\ndefinition with `core.service_only_audience` when no person may read the\nnamespace, whatever body or grant that person comes to hold:\n\n```toml\n[[capability_definition_tag]]\nbundle_id = \"mymod\"\ncapability_id = \"mymod/read-npc-config\"\ntag = \"core.service_only_audience\"\nsource = \"manifest\"\n```\n\nThe server then admits that capability as an audience only for a service\nidentity and for the publisher (holding `frontier.apply_manifest` is not\nenough). An identity is a person when any of its\ncontrolling `actor_identity` rows (every role except `co-pilot`) has Person\nprovenance: a runtime claim, an operator bind without `service`, a summon cast\nby a person. The NPC compilers put this tag on every read capability of\nprivate NPC configuration. A reader that must see such a namespace is bound as\na service (see [actor identity bindings](repairs/actor-identity-bindings.md));\na misspelt tag is an ordinary unknown tag and protects nothing. Proof: the\nlive test `k2_person_on_marked_body_reads_no_document`\n(`packages/spellkave-test-lab/src/scene-live/private-read-guard.local-node.test.ts`).\n\n## Delivery (`on_demand`)\n\n`[[metadata_namespaces]]` also carries `on_demand: bool` (default `false`,\nADR-0130 D-4). Audience and delivery are separate axes: audience decides *who*\nmay ever read a namespace; `on_demand` decides *when* an admitted client\nreceives it. A non-`on_demand` namespace is live-session content, delivered to\nevery admitted, subscribed client as part of ordinary play (`<bundle>.art.image`,\n`ui.affordance_group`, `ui.self_summary`). An `on_demand` namespace is\nreference content — rules text, creation data, docs — delivered only to a\nclient that explicitly subscribes the reference view; a play session does not\npull it on connect. `audience` and `on_demand` are denormalized onto each\nattachment row at write time (see Namespace Registry below for what that means\nfor a later re-registration).\n\n`spellkave_set_metadata`'s ergonomic `target: \"namespace\"` value shape is\n`{audience, description?, on_demand?}` — register an `on_demand` namespace\nthrough the same call used for every other namespace registration, no\n`spellkave_write_rows` escape hatch needed:\n\n```json\n{ \"target\": \"namespace\", \"key\": \"mymod.rules_text\",\n \"value\": { \"audience\": \"public\", \"description\": \"Reference prose.\", \"on_demand\": true } }\n```\n\n## Views\n\nThe server enforces D-2/D-3 through three views over the (now private)\n`metadata_attachment` table; clients never read the raw table by name. The\ntwo shared views admit the same rows for every caller\n(`shared_public_admits`, the world API):\n\n| View | Rows |\n|---|---|\n| `public_metadata_attachment` | audience `public` or `local`, not `on_demand`, target not a place |\n| `public_reference_metadata` | audience `public` or `local`, `on_demand`, target not a place |\n| `visible_metadata_attachment` | every other row the caller is admitted to (per-caller: visibility-class relations, the strict `owned` relation, or capability audiences, plus place targets), both delivery modes |\n\nA normal play session subscribes `public_metadata_attachment` together with\n`visible_metadata_attachment` — the live-session content path. Player clients\nnever receive `on_demand` rows, public or restricted, unless they explicitly\nsubscribe `public_reference_metadata` (reference/character-creation/authoring\ntooling does this); a restricted `on_demand` row still requires the caller's\naudience to admit it, same as any other restricted row.\n\n## Namespace Registry\n\nNamespaces are authored with `[[metadata_namespaces]]` rows before attachments\nuse them. The `core` fixture registers the base Spellkave catalog; a mod may\nregister its own namespace in its manifest or an included fragment:\n\n```toml\n[[metadata_namespaces]]\nnamespace = \"mymod.hints\"\naudience = \"mymod.author_notes\"\nbundle_id = \"mymod\"\ndescription = \"Author-only hints consumed by mymod tooling.\"\n```\n\nA namespace registration is not exclusive to one bundle: multiple bundles may\nregister the same namespace string as long as they agree on both `audience`\nand `on_demand`; a later registration of the same namespace with a different\n`audience` or `on_demand` is rejected at apply time, naming the mismatch\n(`resolve_namespace_registration`, the world API;\n#2119). Prefix your namespaces with your bundle id (`mymod.…`) unless you are\ndeliberately co-registering an existing shared namespace. Registrations are\ncleared and re-applied with their owning bundle; attachments copy the\nregistration's `audience` and `on_demand` at insert time, and `just doctor`\n(`metadata_namespace_registry_seeded`) flags an attachment whose copied\naudience no longer matches the current registration.\n\nOnce registered by the bundle or a seeded dependency, attachments can target the\nnamespace:\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_node\"\ntarget_ref = \"mymod/hidden_shrine\"\nnamespace = \"mymod.hints\"\npayload_json = '{\"text\":\"Mention the cracked moon sigil only if inspected.\"}'\nbundle_id = \"mymod\"\nsource = \"manifest\"\n```\n\nPayload keys are author-defined JSON object fields: the table below lists shared\nconventions that tools may choose to understand, not a server-owned schema.\n\n| Namespace | Audience | On-demand | Conventional payload keys |\n|---|---|---|---|\n| `provenance.source` | `frontier.apply_manifest` | no | `work`, `page`, `foundry_id`, `license` |\n| `editorial.note` | `frontier.apply_manifest` | no | `text` |\n| `observer.summary` | `hidden` | no | `text` |\n| `art.prompt` | `public` | no | `prompt` |\n| `art.image` | `frontier.apply_manifest` | no | `path`, `hash`, `license` |\n| `srd.text` | `public` | yes | `text`, `source`, `license` |\n| `narration.read_aloud` | `internal` | no | `text`, `trigger` |\n| `driver.persona` | `owned` | no | `personality`, `goals`, `secrets`, `voice` |\n\nFor public subject images, the SDK recognizes a separate convention:\n`<bundle_id>.art.image`, registered by that bundle with `public` audience.\nIt may attach to every admitted target kind that can carry a description\n(`entity`, `entity_definition`, `item_definition`, `affordance_template`,\n`place_graph`, `place_node`, `place_edge`, `resource_definition`, `capability_definition`) and projects\nonly `path`, `hash` (lowercase SHA-256), and `license`. The namespace prefix must\nmatch the attachment's bundle. For example, `elven_mini.art.image` and\n`orbital.art.image` share a payload convention without sharing ownership or\nencoding a particular application's layout. SRD catalog entries attach the\nsame way: a spell, feat, or class sprite lands on that entry's\n`entity_definition`; an offered-action sprite lands on its `affordance_template`; a named playing-the-game action (Attack, Dash, …) lands on its `capability_definition`.\nThe existing `frontier.apply_manifest`-gated `art.image` registration and\nannotations remain unchanged. See ADR-0073 (2026-09-07 postscript) and the\nexecutable\n[Elven Mini example](../../spellkave-adventure-elven-mini/docs/public-subject-art.md)\nfor asset validation, precedence, compatibility and consumer fallback rules.\n\nFor verbatim CC-BY SRD prose, register `srd.text` (`public` audience,\n`on_demand`, owned by bundle `srd`) with conventional keys `text`, `source`,\nand `license`. The server still requires only a JSON object; those keys are a\ntooling convention, not a kernel schema.\n\nAudience is enforced (ADR-0130, amending ADR-0073's G-1): `metadata_attachment`\nis a private table, and a client reads rows only through the views in Views\nabove. A row still reaches every caller its audience admits — including a\nplayer who controls the target (`owned`) or sees it (`hidden`/`internal`/\n`discoverable`) — so authors still choose deliberately: a namespace with a\ngenuine secret needs a capability audience that actually excludes the party,\nnot a visibility-class relation or `owned`.\n\nThe server and authoring CLI validate that the namespace is registered and that\n`payload_json` is a JSON object. They do not require the conventional keys\nabove, and they allow extra keys. If a payload shape must be enforced for\ngameplay or perception correctness, it is no longer metadata; promote it to\ntyped world data.\n\n## `dialogue.prompt` (closed-question presentation)\n\nA public attachment on a `prompt_definition` can provide fixed presentation\nas `{ \"question\": \"...\", \"responses\": { \"action/id\": \"Label\" } }`.\nFor an authored reusable menu, use `{ \"presentation\": \"audience_trace\" }`.\nThe latter tells clients to obtain the question and `options` from the exact\nspeech trace named by the occurrence's `audience_trace_id`. They must not\nsubstitute a newer trace or fall back to static labels when that trace is\nunavailable.\nMissing or mismatched visible presentation uses neutral response numbers, never\nraw action ids. The scripted ask-menu palette retains its question trace without\nautomatic expiry; each ask adds one retained trace, including after closure.\n\nThe marker and wording remain client presentation conventions. The server\nopens and consumes the occurrence through typed definitions, response sets\nand state gates; it does not inspect this metadata payload. An authored\nask-menu consequence inscribes `dispatch_text` and bounded `dispatch_options`\nand opens its question state in one frame, so refusal leaves neither a new\nquestion nor its open palette. The same write can carry the asker's opaque\n`dispatch_context` as `context`; readers get it as `presentation.guide`\n([guided dialogue](patterns/guided-dialogue.md)). See\n[trace inscription](interaction-dsl-and-world-authoring.md#carrying-bounded-menu-labels-carry_dispatch_options)\nand [dialog choice slots](patterns/dialog-choice-slots.md).\n\n## `ui.affordance_input` (player input forms)\n\nA public `ui.affordance_input` attachment on an `affordance_template`\ndeclares the form a player fills before dispatching that template's action:\n`{ \"fields\": [ { \"name\", \"label\", \"control\": \"text\"|\"textarea\"|\"number\",\n\"placeholder\"?, \"required\"?, \"min\"?, \"max\"?, \"max_length\"?, \"channel\"? } ],\n\"submit_label\"? }`. An explicit empty `fields` array means \"a complete\ninvocation with no form\". `channel` names the transport the world reads the\nvalue from: `\"utterance\"` — the actor says it (`spellkave_communicate`\nutterance, plain text for one field or a JSON object keyed by field name),\n`\"args_json\"` — the structured argument blob. The PLAYER tools refuse\n`args_json` values for an utterance-channel field before dispatch\n(`utterance_required`), so a fresh player does not learn the transport from a\nsilently dropped value (sk-jay0.1.46). Reader:\n`packages/spellkave-sdk/src/core/readers/affordance_input.ts`; the DM's\ncreation forms in `packages/spellkave-adventure-runtime/src/dm/creation/seed.ts`\nare all utterance-carried.\n\n## Examples\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_graph\"\ntarget_ref = \"triboar_wooded_bend\"\nnamespace = \"provenance.source\"\npayload_json = '{\"work\":\"Lost Mine of Phandelver\",\"page\":\"Chapter 1: Goblin Ambush\",\"license\":\"private-reconstruction\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_edge\"\ntarget_ref = \"phandelver/edge/ambush-woodedbend\"\nnamespace = \"editorial.note\"\npayload_json = '{\"text\":\"Reviewer note only; this does not affect traversal.\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_graph\"\ntarget_ref = \"triboar_wooded_bend\"\nnamespace = \"observer.summary\"\npayload_json = '{\"text\":\"This bend is the first pivot from travel into danger.\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_graph\"\ntarget_ref = \"triboar_wooded_bend\"\nnamespace = \"art.prompt\"\npayload_json = '{\"prompt\":\"Daylight fantasy trail bend with abandoned horses and scattered travel gear.\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_graph\"\ntarget_ref = \"cragmaw_castle\"\nnamespace = \"art.image\"\npayload_json = '{\"path\":\"assets/cragmaw-castle.png\",\"license\":\"private-reconstruction\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"place_node\"\ntarget_ref = \"triboar_trail/ambush_site\"\nnamespace = \"narration.read_aloud\"\npayload_json = '{\"text\":\"The trail bends between thick woods and opens onto the wreckage of a recent fight.\",\"trigger\":\"first_entry\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"entity\"\ntarget_ref = \"phandelver/klarg\"\nnamespace = \"driver.persona\"\npayload_json = '{\"personality\":\"Boastful and cruel.\",\"goals\":[\"Keep control of the hideout\"],\"secrets\":[\"Knows the map matters\"],\"voice\":\"loud and contemptuous\"}'\nbundle_id = \"phandelver\"\nsource = \"manifest\"\n```\n\n## Validation\n\nApply rejects unknown target kinds, unresolved target refs, unregistered\nnamespaces, malformed payload JSON, and payload JSON that does not decode to an\nobject. Offline validate also rejects unknown target kinds (`MF-VAL-330`) and\na namespace registration whose `audience` is neither a visibility-class\ntoken, `owned`, nor capability-shaped (`MF-VAL-331`, ADR-0130 D-3); live\napply additionally requires that the named capability actually exists.\nPayload keys are intentionally author-defined:\n\n```bash\nsk validate <your-bundle>/manifest.toml --bundle \\\n --dep packages/spellkave-mechanics/fixtures/core/manifest.toml \\\n --dep packages/spellkave-srd-cc/fixtures/manifest.toml\n```\n\n(`sk validate`, `packages/spellkave-cli/src/cli.ts`; exit 0 valid, 2 on a\nfatal diagnostic. `just validate FILE` validates one file with the Rust\n`spellkave` CLI, without the `--bundle`/`--dep` merge.)\n\nAfter seeding, inspect rows through the observability surface:\n\n```bash\nspellkave metadata list --target-kind place_graph --namespace provenance.source\nspellkave metadata namespaces\njust doctor\n```\n",
206
+ "milestone-gate-terminal-flags": "# A milestone gate composing over a prior beat's terminal flags only needs the ONE action each flag's own predicate requires — not a full re-derivation of that beat\n\n(The ADV4/CC5 worked examples are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\nA milestone/advancement beat that gates on flags a much larger prior beat\nalready sets (ADV4 gating on CC5's `castle_broken` + `cc5/wec_location_known`,\na 3-monster hostage-standoff terminal) does not need to replay that prior\nbeat's full narrative content to prove its own gate honestly. Read each\ncomposed flag's OWN consequence predicate: `rouse_gundren`'s predicate had no\ncombat prerequisite at all (`target.has_tag(...) && actor.stat('gundren_rescued')\n< 1`); `take_grol_map`'s predicate needed only the ONE named target's\n`srd/hp <= 0` (Grol's), not the other two monsters in the room. Composing a\nstrict subset of the prior beat's own already-proven session (same\n`session_definition`, participants trimmed to just the entities each\npredicate actually reads) is a real, non-vacuous replay — every flag still\nflips through genuine action execution against a live node, not a seeded\nshortcut — while skipping content (hostage stand-off, extra combatants,\nunrelated reveals) the new beat's own claim never depends on. Check each\ncomposed flag's predicate before assuming \"replay the whole prior beat\" is\nthe only honest path.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
207
+ "modify-resource-floored-noop": "# A `ModifyResource` against an already-floored resource is a silent no-op — use a dedicated counter to prove repeated harm\n\n(The CC5 worked example is from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\nResources clamp at `min_value` (`srd/hp`'s is 0). A consequence that deals\nfurther \"damage\" to a target ALREADY at 0 HP (e.g. an unconscious hostage,\n`core/condition/incapacitated` at `srd/hp=0`) is absorbed by the floor —\nthe write happens, the value doesn't move, and an assertion expecting the\nHP to visibly drop fails even though the mechanism fired correctly (CC5's\n`attack_grol_hostage` hostage-harm consequence, hit live: the target's HP\nstayed 0 across the \"harmful\" call). If the claim you need to prove is\n\"this consequence genuinely ran against this target\" rather than \"this\ntarget took lethal damage,\" add a small dedicated counter resource\n(`min_value=0`, generous `max_value`, no floor collision) instead of\nre-using the floored pool — same `ForEachActorInRadius` + `ModifyResource`\nshape, different resource id.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
208
+ "no-knowledge-seed-primitive": "# No manifest knowledge-seed primitive — OR-extend the reading predicate instead\n\n(The RH4/AG1/V2 worked examples are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\n**Gotcha — there is no direct \"insert this observer_knowledge row\"\nprimitive.** The observed manifest-time writers are `CopyKnowledgeRow`\n(giver-must-know) and co-location at seed time (`learn_at_node`, scanning\n`entity_location` at that node) for a GIVER's own knowledge. RH4 hit this first (Mirna sharing a distant heirloom lead) and\nrecorded it as a substrate observation: co-locating a knowledge-source proxy\nat the informant's own node also grants the SAME knowledge to any hero who\nlater merely visits that node — collapsing the informant's own \"share\" act\ninto a no-op negative control. RH4 sidestepped it with a plain resource flag\ninstead of a real `knows_entity` row.\n\nAG1 hit the identical trap for a DIFFERENT reason: Agatha needed to \"know\"\nCragmaw Castle (a real entity, anchored far away at\n`triboar_trail/cragmaw_approach`) so her divination answer could unlock V2's\nexisting `march_on_the_stronghold` traversal gate\n(`actor.knows_entity($bindings.castle)`) — but co-locating a castle-knowledge\nproxy at Agatha's lair would leak it to every hero visiting her, for free.\n**The fix, when the payoff needs to reach an EXISTING predicate that already\nreads `actor.knows_entity(...)`: OR-extend that predicate with a second,\nindependent gate** — a plain resource flag the new beat's answer act writes\n(`actor.stat(\"phandelver/ag1_castle_lead_known\") >= 1`), added as an\nadditional `||` clause on the SAME affordance_template. This delivers the\nidentical observable payoff (the edge now traverses) via a second route key,\nwithout needing a new knowledge-seed primitive and without touching the\nproven `knows_entity` branch. **DSL parenthesization caveat:** the grammar\nhas no generic `(...)` grouping for boolean sub-expressions (only\nfunction-call parens) — `parse_and` loops over `parse_or`-parsed segments, so\nOR naturally binds to the LAST AND-segment without needing parens at all:\nwrite `a && b && c || d` to get `a && b && (c || d)`, not `a && b && (c || d)`\nliterally (that fails to parse — \"expected `)`\"). See\nthe AG1 postscript in the deleted Phandelver `base/locate-castle.toml`\n(`git show fd2288bdea^:archive/world-fixtures/phandelver/base/locate-castle.toml`).\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
209
+ "npc-needs-driver": "# NPCs need a driver — there is no autonomous NPC behavior\n\nSpellkave's module has a hard rule: **it contains no actor decision\nlogic**. The world simulates physics, time, scenery, and mechanical\nphenomena — it does not decide what any creature wants or does. Every\nactor, human or AI, connects from *outside* via a SpacetimeDB SDK\nclient and submits intents.\n\nWhat this means for you as a modder:\n\n- You cannot declare \"this goblin patrols at night\" in a manifest.\n There is no field, predicate, or DSL form that animates an NPC\n from data alone.\n- A bundle-authored NPC without an external driver is effectively a\n **statue**: it can be targeted, struck, looted — but it\n will never move, speak, flee, or fight back on its own.\n- The in-module autonomy layer is **scenery-only**: weather, decay,\n scheduled phenomena. It deliberately refuses to branch on what an\n entity prefers, fears, or chooses.\n\nYou have exactly two paths to make a creature *do something*:\n\n1. **Ship an AI-bridge program.** Write an SDK client (Rust, TS, …)\n that connects to the node, claims the NPC, and submits intents on\n its behalf — exactly the way a human player's client does. The live\n Brief-20 claim-lock gate rejects competing manipulation intents with\n `claim_contended`, so AI-bridge programs must handle that rejection\n path; see [claims][claims]. This is the supported path for anything\n resembling \"behavior\" (patrols, aggression, dialogue, retreat,\n trade).\n2. **Re-express it as a mechanical phenomenon.** If the behavior is\n actually deterministic scenery in disguise, model it as a scheduled\n transformation: *\"at midnight, a swarm of bats spawns in cave B and\n despawns at dawn.\"* This is fine — no preferences, no branching on\n what anything \"wants,\" just clock-driven world change. If your\n description needs the word \"decides,\" \"tries,\" or \"wants,\" it does\n not fit this path; go back to option 1.\n\n**Worked example — a wandering goblin.** You want a goblin that paces\nits lair at night and attacks intruders.\n\n- *Manifest only:* not possible. Author the goblin entity, location,\n conditions, and item-entities; it will stand motionless until something\n external acts.\n- *Path 1 (driver):* author the goblin row, then run a small bridge\n process that subscribes to the goblin's tile, picks a neighboring\n tile each tick, and submits a `move` intent; on player proximity it\n submits `attack`. This is the observed path for preference-driven NPC behavior (no in-module planner exists; mechanical reframing is the other legal authoring path below).\n- *Path 2 (mechanical reframing):* drop the \"goblin that patrols\" idea\n and author instead a \"goblin ambush\" phenomenon — at a fixed tick,\n spawn a goblin entity adjacent to any player in the lair. No\n preferences, no pathing. Deterministic. Allowed.\n\nBinding rules:\nADR-0003 D-1\n(no actor decision logic in the module) and\nADR-0004 D-1/D-2\n(autonomy is scenery-only; NPC behavior is out of scope).\n\n## Host metrics vocabulary is not a manifest field\n\nCycle-step, error-code, and tool names on `spellkave.world_actor.cycle_failures_total`\nand `spellkave.world_actor.requests_total` are declared by the adventure package\nthat boots the driver — passed as `metricsVocabulary` into `startAdventureHost` —\nnot as world-manifest rows and not as a generic runtime registry (ADR-0115 D-4).\nA missing list is a boot error. An unlisted step, error code, or tool name is\nlogged once as unmapped; the exporter still collapses the metric attribute to\nbound cardinality. First consumer:\n`packages/spellkave-adventure-elven-mini/npcs/metrics-vocabulary.ts`. Contract:\n`packages/spellkave-adventure-runtime/docs/host-metrics-vocabulary.md`.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
210
+ "onramp": "# Modding Spellkave — onramp\n\nStart here. This page is the single door into authoring: what a world bundle\n*is*, how you change it with **AUTHOR tools**, how you prove it live with\n**PLAYER tools**, and where TOML fits underneath. For failure symptoms, query\nTroubleshooting repairs (`sk docs --query \"<error or DSL name>\"`) — do not hunt\ngotchas on this page.\n\nWithout a checkout, start with `sk docs find-an-authoring-pattern` or\n`sk docs --query \"<task>\"`. `sk docs cli/workflows` supplies the installed CLI\nloop; `sk docs personas/access` maps task lenses and access routes, and\n`sk docs player/workflows` supplies the PLAYER-owned loop. A connector offering `spellkave_docs` accepts the same stable IDs through\nits `doc` argument; help grants no world authority. Explicit\n`hosted-authoring-guidance` describes pending role-based execution prerequisites.\n\n## What you are looking at\n\nSpellkave content ships as a **bundle**: a directory (in-repo under a\npackage's `fixtures/`, e.g. `packages/spellkave-srd-cc/fixtures/` or\n`packages/spellkave-adventure-<slug>/fixtures/`, or any local target) with a\ntop-level `manifest.toml` plus includes.\nThe file format is **TOML**. Each include holds `[[row_kind]]` tables whose\nshapes come from the typed schema (`sk query --schema --kind <row_kind>`).\n\n**TOML is the underlying model**, not the preferred typing UX:\n\n- AUTHOR verbs write the same rows a hand-authored bundle would;\n- `sk validate` / admission check that TOML;\n- you read TOML when debugging verb output or editing fixtures.\n\nDeep row/field reference: corpus id `manifest-format`.\nPredicate/outcome expressions inside rows: `dsl-grammar`.\n\n## Three command groups (`sk`)\n\n| Group | Job | Connection |\n|---|---|---|\n| **AUTHOR tools** | Edit content — places, placed entities/actors, behaviors, rows | Offline (except the delta apply flush and `export`) |\n| **PLAYER tools** | Perceive and act *as* one in-world actor | Always connected (session daemon) |\n| **File commands** | `validate`, `lint`, `inspect`, `render`, … on a path | Local files |\n\nBrowse tools with `sk help`. Machine callers use `--format jsonl`.\n\n## AUTHOR path (write content)\n\n1. **Discover** — `sk docs` (index with summaries) or\n `sk docs --query \"<intent>\"`. Prefer a small hit over a long guide.\n2. **Check it already exists** before inventing a twin id, and check the\n pattern catalog (`sk docs patterns`) for a known shape.\n3. **Write** with verbs (`sk place_entity`, `sk place_actor`, `sk define_*`,\n `sk author_place`, …) or,\n for the multi-call fireball walkthrough, open `getting-started-with-verbs`.\n4. **Validate** — `sk validate` (the admission validator; the server also\n checks against definitions already in the world, so pass `--dep` for each\n dependency).\n5. **Apply** when connected — flush the workspace delta\n (`spellkave_apply_manifest_delta` / live AUTHOR apply).\n\nSchema without prose: `sk query --schema --kind <row_kind>`.\n\n## PLAYER path (prove it live)\n\nContent that only validates is not finished. Connect a session, then:\n\n1. Perceive — `sk scene` / self summary / inventory.\n2. Act — `sk move` (and reactions when offered).\n3. Observe — did the world change the way the author intended?\n\nPLAYER tools always need a resolvable connection (see the `sk` skill Part 2).\nThey are how you catch silent-at-seed and semantic mistakes validate cannot see.\n\n## Definition seeds (one pointer)\n\nReusable creature/item **definitions** can seed HP, innate capabilities, and\nstarting conditions onto every placed instance. Worked example:\n`definition-seed-statblock`. Concept detail lives with that example and\n`manifest-format`, not here.\n\n## Bundle layout and seed order (short)\n\n`just seed` has no default manifest (sk-mts): pass the bundle to seed, e.g.\n`packages/spellkave-mechanics/fixtures/core` for the bare substrate or\n`packages/spellkave-srd-cc/fixtures` for SRD rules, and layer your bundle on\ntop. Reserved keys and embedded DSL fields are explicit — see\n`manifest-format` and the world-manifest-authoring capability spec outside this\ncorpus if you need normative SHALL text.\n\n```bash\n# examples of local authoring checks\nsk validate path/to/bundle/manifest.toml --bundle\nsk lint path/to/bundle/manifest.toml --bundle --strict\nsk inspect path/to/bundle/manifest.toml --bundle\n```\n\n## Where to go next\n\n| Need | Corpus id / command |\n|---|---|\n| A known shape for a mechanic | `patterns` (problem → pattern catalog) |\n| AUTHOR verb deep-dive (4-call fireball) | `getting-started-with-verbs` |\n| Full verb parameter reference | `tool-reference` |\n| TOML row/field reference | `manifest-format` |\n| DSL operators | `dsl-grammar` |\n| Worked examples | `sk docs` → Worked examples, or `spatial-minimal-cell` |\n| Something broke | `sk docs --query \"<symptom>\"` (Troubleshooting / `repair`) |\n| Shared agent process | `authoring-process` |\n| One section of a long doc | `sk docs --doc <id> --section \"<heading>\"` |\n| AUTHOR verb index | `sk docs tool-reference` |\n| One AUTHOR verb | `sk docs tool-reference spellkave_define_session` |\n| Force full tool-reference | `sk docs --doc tool-reference --full` |\n\nOpen any id with `sk docs <id>` (same as `spellkave_docs` `--doc`).\n",
211
+ "ordered-resource-grants": "# Ordered resource grants can read earlier frame writes\n\n`consequence_frame_writes` execute by ascending `ordinal`, and each\n`ModifyResource.delta_source` evaluates against fresh live facts. One authored\nconsequence can therefore change a driver resource first and derive a later grant\nfrom the new value. For example, an advancement consequence can increment `level`\nat ordinal 0 and use `cond(target.stat('level') == 5, 1, 0)` for a proficiency\nresource at ordinal 2. A resource definition's `initial_value` supports\n`ModifyResource` seed-and-apply when the target row is absent, but it does not\nsynthesize a readable `object_state` row before the first write; author an explicit\nrow when the pre-action value must be perceived or read by the DSL.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
212
+ "osm-mapping": "# OSM mapping — how authored places become a map\n\nThe world map (maps.spellkave.com, OSM API / Overpass endpoints, vector\ntiles) is a **projection of the rows you author** — nothing is drawn that is\nnot a `place_graph`, `place_node`, `place_edge` or `map_layer` row. This\npage is the author-facing half of ADR-0123 (`specifications/adr/0123-osm-projection-of-the-place-graph.md`):\nwhat you must author for a place to show up, where it lands, and which OSM\ntags an external tool (JOSM, iD, QGIS, Overpass Turbo) will see.\n\nVisibility is **not** part of this mapping today: the map shows the full\nworld (operator catalog). Per-identity fog-of-war is a later bead\n(`sk-adr8.15`).\n\n## What you must author for a place to appear\n\n| You want | Author |\n|---|---|\n| The bundle on the real globe | `origin_cell_res10` on every **root** graph (`parent_graph_id = \"\"`). Its `anchor_node_id` sits on that cell's centroid. A root without an origin cell is **unplaced** — listed in the export's `unplaced_graphs`, drawn nowhere. |\n| Nodes at exact positions (a floorplan, a village sheet) | `pos_present = true`, `pos_x`/`pos_y` in sheet units (+x east, +y **south** — image rows), `metres_per_unit` on the graph, `bearing` if the sheet is not north-up. |\n| A building inside a village, a dungeon under a hill | `parent_graph_id` on the child graph **and** one portal `place_edge` between a parent node and a child node. The child's portal node lands exactly on the parent's portal node; everything else follows from the child's `pos_*`. (For indoor children this is the exporter's rule — ADR-0123 D-1 case 3 — not something today's SVG renders; it ships with its own fixture.) |\n| Floors | `pose_elevation_present = true`, `pose_elevation` in metres per node (0 = ground, 3 = first floor, −3 = cellar). Level index = `round(elevation / 3.0)`. |\n| Room outlines | an extent on the node: `extent_shape_id = \"core/area/cube\"` with `extent_x_m`/`extent_y_m`, or `core/area/sphere` with `radius_x_m`/`radius_y_m` (the bundle's default extent applies when the node has none). Cone/line extents draw no outline. |\n| The hand-drawn map under the nodes | a `[[map_layers]]` row with the grid metrics (`grid_size_px`, `grid_distance_m`, `image_origin_*`, `local_*_cells`, `rotation_deg`) — it becomes a georeferenced image source, not OSM data. Attribution (`posture`, `source_kind`) is exported and shown. |\n| A node on the map without a sheet | outdoor substrate + `cell_res10` ≠ 0 → centroid of that H3 cell (no `pos_*` needed). |\n\nPrecedence: a metric chain (sheet positions up to an origin cell) wins over\n`cell_res10` centroids; `cell_res10` wins over nothing; without either the\nnode is unplaced.\n\n## Where each row lands (OSM vocabulary)\n\nOSM knows three primitives — **node** (point), **way** (ordered node list,\nclosed = area) and **relation** (typed group) — plus free `key=value` tags.\nEvery Spellkave-specific key is prefixed `spellkave:`; everything else is a\nstandard OSM key. \"Indoor\" below means the substrate's `coordinate_kind_id`\nis `graph_local` (read through `[[substrate_definitions]]`), \"outdoor\" means\n`h3_cell` — the `substrate_id` string itself (`indoor`, `cave`, `sewer`, …)\nis yours to choose and is never matched.\n\n| Row | Becomes | Key tags |\n|---|---|---|\n| `place_node` | node | `name`, `description`, `ref=<local_id>`, `level=<n>` (indoor-class, when elevation authored), `spellkave:node_id`, `spellkave:graph`, `spellkave:substrate`, `spellkave:cell_res10` |\n| node extent | closed way around the node | `indoor=room` (indoor) / `spellkave:extent=yes` (outdoor), `level`, `name`, `spellkave:extent_shape` |\n| `place_edge` | 2-node way | `highway=corridor` (indoor) / `path` (outdoor) / `steps` (elevation delta), `oneway=yes` (edges are directed — author both directions, you get two ways), `door=yes` when `substrate_crossing`, `spellkave:edge_key`, `spellkave:portal=yes` for cross-graph edges |\n| `place_graph_definition` | relation | indoor: `type=building`, `building=yes`, `min_level`, `max_level`, `building:levels`; outdoor: `type=site`; always `name`, `spellkave:graph_id`, `spellkave:parent_graph`, `spellkave:anchor_node`, `spellkave:bearing`, `spellkave:metres_per_unit` |\n| `map_layer` | entry in `backdrops.json` (four lon/lat corners + url + license) | — |\n\nFull column-by-column tables, id derivation (stable 63-bit hashes of your\nids — renaming a `node_id` changes its OSM id), and the Simple Indoor\nTagging checklist: ADR-0123 D-2/D-3/D-5.\n\n## What is never on the map\n\nActors, items, niches, affordances, movement modes, knowledge. The map is\ngeography; live state (who stands where) arrives over a separate live\nsource in the maps app, and gating stays in the kernel. Session tactical\ngrids (`is_ephemeral`) are dropped from the export.\n\n## Proving it\n\nExport any adventure bundle (or a plain `rows.json` of place graph / node /\nedge / map_layer rows) with the product exporter:\n\n```bash\npnpm --filter @spellkave/world-map exec tsx src/cli.ts export <bundle> \\\n --xml out.osm --json out.json --backdrops backdrops.json --manifest manifest.json\n# or: just world-map-export <bundle>\n```\n\nThe package is `@spellkave/world-map` (ADR-0123 D-1..D-6). Unplaced roots\n(no `origin_cell_res10`) appear in `manifest.json` under `unplaced_graphs`.\nIndoor nest composition (D-1 case 3) is covered by the package's elven-mini\nfixture: `elven_mini/inn/foyer` lands within 2 m of `elven_mini/hamlet/inn_front`.\n\nThe **outdoor** half also still renders through `spellkave_map_graph` /\n`sk render` (shared tool runtime `h3-layout.ts`); a graph that lands wrong there\nwill land at the same wrong spot in OSM. That SVG path deliberately omits\nindoor floorplans — use `world-map export` for the full SIT building check.\n",
213
+ "parameterized-scenes": "# Parameterized scenes\n\nUse a scene package to start a named run from an existing empty place blueprint\nand existing figure definitions. Each run gets its own graph, node IDs and\nfigure keys; the rules and catalog definitions remain shared. This prepares\nstarting state. Play can change it permanently.\n\n## Inspect, render, then explicitly stage\n\nFirst choose the caller and world with the normal connection context. The\ncaller needs complete Internal source read authority, and apply authority over\nthe destination rows. The destination needs admitted placement authority as well as its owner Bundle\nclaim. Existing graph ownership or a PlaceGraph binding covering the anchor\nand generated descendant supplies that placement scope. Its owner header\nmust match the destination bundle when no header edit is authorized. The owning publisher can prepare\nthat bundle and grant its ordinary author binding. A changed header is an\nordinary bundle write and can be refused independently of the scene geometry.\n\nThe package is JSON data, not a template program:\n\n```json\n{\n \"format\": \"spellkave-scene/v1\",\n \"id\": \"target-room\",\n \"version\": \"1.0.0\",\n \"bundle_id\": \"trials\",\n \"blueprint_id\": \"catalog/room\",\n \"dependencies\": [\"catalog\"],\n \"figures\": [{\n \"key\": \"targets\", \"entity_def_id\": \"catalog/target\",\n \"node_local_id\": \"entry\", \"kind\": \"npc\", \"name\": \"Target\",\n \"default_count\": 1, \"max_count\": 4\n }]\n}\n```\n\nSupply `values` such as `{\"anchor_id\":\"catalog/room/entry\",\"counts\":{\"targets\":2},\"bearing_deg\":90}`,\n`setup_name` such as `trial-b`, and `dependencies` containing resolved TOML\npayloads. Include the dependency closure required by the existing manifest\nvalidator, including dependent bundle headers. Setup names use 1–64 lowercase\nletters, digits, dot, underscore or hyphen. Count groups are declared by the\npackage, with at most 128 figures in total. Unknown package/value fields,\nunresolved references and dependency collisions refuse before mutation.\n\n`sk render_scene --json '<payload>'` renders and validates without connecting.\nUse `sk --live render_scene --json '<payload>'` for an admitted live source\npreview. The returned `details.plan` includes the package and dependency\ndigests, normalized values, generated references, ordinary TOML phases and\nvalidation closure. Connected preview also pins the caller, endpoint,\nworld-instance identity and exact empty-source snapshot. Offline validation\nis not source admission and cannot authorize staging.\n\nReview the plan, then call:\n\n```bash\nsk --live stage_scene --json '{\"plan\": <the unmodified details.plan>, \"expected_world_instance_id\": \"<reviewed world instance>\"}'\n```\n\nReplace the placeholders with the returned JSON object and world identity.\nThe same AUTHOR payloads are `spellkave_render_scene` and\n`spellkave_stage_scene` over a supporting MCP caller connection. Supply\npayloads directly; these tools do not accept gateway filesystem paths. CLI\n`--json` avoids shell list parsing for TOML dependency arrays. The server must\nsupport source projection protocol 1; unavailable or incomplete source reads\nrefuse without a publisher credential fallback. `MF-APPLY-052` is the allocated\nscene-source precondition refusal: the source is unavailable, incomplete,\nchanged or inhabited; the instance name is used; or the graph-only envelope is\nunsupported. Inspect current state and preview again before deciding to retry.\nEarlier authority, seal and world-instance failures keep their existing codes.\n`MF-APPLY-050` and `MF-APPLY-051` remain unassigned.\n\n## Read the receipt before doing anything else\n\nGraph creation and explicit population are separate admitted phases. The graph\nphase rechecks the reviewed digest and absence of inhabitants atomically with\nall graph clone writes. A source containing any entity or positioned actor is\nineligible, including a player carrying an identity. Nodes, edges, gates,\nmovement defaults, authored traces, spatial niches and the source seal are\npinned. The bounded projection fails closed rather than certifying a truncated\nsource. Both phases carry the reviewed world-instance identity through enqueue\nand drain; a reset invalidates queued work and previews.\n\nA receipt lists each phase as `committed`, `refused` or `unknown`, preserves\nthe generated graph/node/figure keys and never reports partial success as full\nsuccess. Runtime figure IDs are included when subsequent authorized inspection\ncan observe them; unavailable inspection is explicit. It reports\n`controllable: false`: placing an entity definition does not assign an actor,\nidentity, driver, consent offer or role. Use your already controlled actor or\nan existing explicitly admitted controller association to exercise targets.\n\nInspect with existing `sk --live get --kind entities --key <figure-key>` and\n`sk --live describe --kind entities --key <figure-key>` before retrying. A\nrepeated setup name refuses while its graph exists; it does not reset or\nreconcile the run. After a disconnect, inspect current graph and figures before\nmaking another decision. Automatic retries of a non-idempotent graph phase\nare unsafe even when its response was lost.\n\n## Exercise and cleanup\n\nSelect your existing actor normally, inspect its available actions, and act\nagainst the observed typed target using `sk manipulate`. Inspect its act record\nwith `sk self_states --kind evaluation`, as described in [rule-bench](rule-bench.md).\nScene tools do not heal, respawn or monitor defeated figures. A new setup name\nstarts a new run; it does not change a previous figure's runtime state.\n\nCleanup needs current authority and inspection of references and occupants.\nExisting graph Despawn, where its surviving anchor and authorization admit it,\nupdates occupants' entity locations to that anchor. Inspect those entities afterward and report\nthem as survivors; graph absence is not body absence. Before removing a scene\ngraph, inspect its current anchor: a cloned entry node belongs to the graph and\nwill be removed with it. An admitted ordinary author edit can select a surviving\nexternal node first. The cleanup proof explicitly makes that choice, executes\nthe existing authored Despawn primitive and checks the surviving bodies. The\nlive proof also found that an occupant's `actor_spatial_location` can retain its\ndeleted node after this entity-location update. That existing cleanup defect is\ntracked in `sk-jay0.3.24.169`; spatial cleanup is incomplete, so inspect both\nlocation components and avoid treating graph removal as a coherent reset.\nRuntime spawns, carried\nloot, events and graph satellites may remain outside applyset memory. Existing\nentity retractions and other admitted acts apply their own live-reference\nchecks. A receipt supplies references, never deletion authority; a matching\nname prefix is not cleanup ownership. The receipt always reports cleanup\ncoverage as unknown and complete teardown as false. There is no one-shot\nuninstall, automatic reset or recorded-proof replay in this workflow.\n\nThe installed CLI and HTTP MCP caller-daemon scenarios are verified in the\n[AUTH-50-01/02 captures](https://github.com/b4arena/spellkave/pull/4015), with\n[reproduction and limits](../../../sandbox/parameterized-scene-setups/README.md).\nQueued source drift, late player arrival and a real world reset have separate\nlive proofs. CLI/MCP captures use synthetic local worlds; external client\nauthentication and unaided discovery remain unverified. Final portable evidence\npublication belongs to `portable-persona-guidance` (`sk-jay0.3.24.56`).\n",
214
+ "patterns": "# Patterns of Spellkave Manifest Authoring\n\nProblem-indexed pattern catalog (Fowler / PoEAA style). Mechanism guides under\n`docs/*.md` remain canonical for *how a primitive works*; this catalog is where\nan author looks up *the problem they are trying to solve* before filing a\nsubstrate gap or reinventing a composition.\n\n**Step 0:** search this table (and the linked page) before opening a findingGap /\nbacklog item / kernel verdict. Action Surge was filed three times as a missing\nprimitive although [`action-economy.md`](../action-economy.md) already solved it\nvia `ModifyChannel` — that class of miss is what this catalog prevents.\n\nMost pages follow one template: Name · Problem · Forces · Solution · TOML\nexample (real fixture path cited) · Proof · Related · Known misuse · SRD\nfeatures. Seat-policy pages show TypeScript instead of TOML, and a few short\npages have no headings.\n\nWhen you author a non-trivial composition (>2 frame writes on one consequence,\nor any `ModifyChannel` / `ApplyStatus` / zone / watch / option menu), cite the\npage from generator source (`// pattern: <slug>`) and emitted TOML\n(`# pattern: <slug>`).\n\n## The convention (no CI gate)\n\nThe pattern catalog was protected by a bidirectional CI gate\n(`scripts/ci/check-pattern-refs.sh`) until it was retired sk-jay0.7.164.5: it\nwas never wired into a GitHub workflow (reachable only through `just\nci-pr-gates`, itself workflow-unreachable — PR #3455 / `no-orphan-gates`),\nand was found failing against the tree — dangling composition refs, 10 orphan\npattern pages, 10 uncited complex-dir files — at deletion time, i.e. it had\nalready been silently unenforced for a while. The catalog and the citation\ndiscipline below stay; keeping them true is a review/authoring discipline\nnow, not a machine-checked one:\n\n1. **Forward resolution:** Every `// pattern: <slug>` in TS source and `# pattern: <slug>` in emitted TOML should resolve to a real pattern page under `packages/spellkave-world-author/docs/patterns/<slug>.md`.\n2. **Reverse orphan prevention:** Every pattern page in this catalog (except `index.md` and [`before-filing-a-kernel-gap.md`](./before-filing-a-kernel-gap.md)) should be cited by at least one live implementation (srd-cc, adventure-runtime or an adventure package source) or fixture TOML. A pattern without an implementation is a documentation fiction.\n3. **Complex directory coverage:** Every `.ts` source file across the complex directories (srd-cc `src/chapters/{spells,classes,monsters,magic-items}`, `packages/spellkave-adventure-runtime/src/dm/creation`, `packages/spellkave-adventure-elven-mini/{author,npcs}`) should carry at least one valid pattern citation, or an explicit opt-out comment with an honest reason:\n ```ts\n // pattern: none — barrel export for spells chapter\n ```\n An opt-out marker still needs a reason (`// pattern: none` alone reads as an incomplete comment).\n\n**Before any findingGap / substrate verdict:** run\n[`before-filing-a-kernel-gap`](./before-filing-a-kernel-gap.md) top to bottom.\n\nPages mined from the srd-cc authoring idioms keep the SRD-specific numbers,\nids and tables in `packages/spellkave-srd-cc/docs/` and link both ways; the\ngeneric mechanism lives here.\n\n## Catalog\n\n### Action economy\n\n| Problem | Pattern | Page |\n|---|---|---|\n| One extra action this round (Action Surge) | Extra action budget via ModifyChannel | [`extra-action-budget`](./extra-action-budget.md) |\n| Shared pool with several spend options (slots, Channel Divinity) | Resource spend with option menu | [`resource-spend-with-option-menu`](./resource-spend-with-option-menu.md) |\n| A class feature usable wherever the hero stands, spending its own uses | Actor-carried feature verb | [`actor-carried-feature-verb`](./actor-carried-feature-verb.md) |\n| Short/Long Rest must restore HP, slots, feature uses | Rest-boundary resource refill | [`rest-boundary-resource-refill`](./rest-boundary-resource-refill.md) |\n| Reaction after another creature's manipulate commits (counter after a hit) | Post-commit hit reaction | [`post-commit-hit-reaction`](./post-commit-hit-reaction.md) |\n\n### Attacks, damage & riders\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Typed damage with resist/immune/vulnerable | Damage-type routing | [`damage-type-routing`](./damage-type-routing.md) |\n| Magnitude computed outside the DSL | Computed-literal delta_source | [`computed-literal`](./computed-literal.md) |\n| A weapon or monster Bite with its own damage through ONE shared attack verb | Item-sourced damage | [`item-sourced-damage`](./item-sourced-damage.md) |\n| An attack / check that can miss and is still always offered | Offer vs resolution roll | [`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md) |\n| Several attacks in one action (Multiattack), flat or mismatched numbers | Multiattack as baked ordinals | [`multiattack-ordinals`](./multiattack-ordinals.md) |\n| Weapon mastery or monster attack on-hit condition riders | Mastery-gated attack variant | [`mastery-gated-attack-variant`](./mastery-gated-attack-variant.md) |\n| Which mechanism computes a number (macro / baked stat / effective / literal) | Derived value mechanism | [`derived-value-mechanism`](./derived-value-mechanism.md) |\n\n### Conditions, capabilities & identity\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Grant or remove an ability while a condition holds | Condition capability grant/suppression | [`condition-grant-and-suppression`](./condition-grant-and-suppression.md) |\n| My condition gate must read the OTHER party's capability | Cross-party capability facts in roll-bias gates | [`cross-party-capability-gate`](./cross-party-capability-gate.md) |\n| Every creature can walk / attack / check without copying rows onto each | Identity-tag capability grant | [`identity-tag-capability-grant`](./identity-tag-capability-grant.md) |\n| Derive a menu or filter from the catalog; publish a reference table | Tag-membership menu | [`tag-membership-menu`](./tag-membership-menu.md) |\n| A condition must react by itself when something happens to its holder (concentration break, 0-HP intercept, damage mitigation) | Condition hook on event | [`condition-hook-on-event`](./condition-hook-on-event.md) |\n\n### Scenario cast & encounters\n\n| Problem | Pattern | Page |\n|---|---|---|\n| An NPC / encounter that \"is a Goblin\" with one changed number or a role | Blueprint instance with overrides | [`blueprint-instance-override`](./blueprint-instance-override.md) |\n| Many enemies that fight sensibly without a seat per creature | Role-driven brain | [`role-driven-brain`](./role-driven-brain.md) |\n| Walkable edges without a row per edge | Bundle movement default | [`bundle-movement-default`](./bundle-movement-default.md) |\n| A player opens or closes a two-sided door, with a locked-door traversal refusal | Operable door | [`operable-door`](./operable-door.md) |\n\n### Resources & option menus\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Choose-N advancement menu as metadata | Advancement choice menus | [`advancement-choice`](./advancement-choice.md) |\n\n### Zones & hazards\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Self-pulsing damage zone that fades | Lingering hazard zone | [`lingering-hazard-zone`](./lingering-hazard-zone.md) |\n\n### Triggers & watches\n\n| Problem | Pattern | Page |\n|---|---|---|\n| DM offers level-up when XP crosses threshold | Proactive level-up watch | [`proactive-level-up`](./proactive-level-up.md) |\n| Advancement beat gates on prior terminals | Milestone gate terminal flags | [`milestone-gate-terminal-flags`](./milestone-gate-terminal-flags.md) |\n\n### Speech & traces\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Say something to the room or to one body, perceived by the right people | Directed speech anchor | [`directed-speech-anchor`](./directed-speech-anchor.md) |\n| An event heard only as it happens vs a mark found on arrival | Trace perceptibility window | [`trace-perceptibility-window`](./trace-perceptibility-window.md) |\n| Address a party member on another place graph | Party-extent grant | [`party-extent-grant`](./party-extent-grant.md) |\n| Grant cross-graph reach at a story moment (a gift), not at seed | DM-applied extent grant | [`dm-applied-extent-grant`](./dm-applied-extent-grant.md) |\n\n### Dialogue & quests\n\n| Problem | Pattern | Page |\n|---|---|---|\n| A visible action needs a gentle public ranking/explanation without changing eligibility | Advisory action cue | [`advisory-action-cue`](./advisory-action-cue.md) |\n| A visible action needs an overridable public shell draft suggestion without changing admission | Advisory action default | [`advisory-action-default`](./advisory-action-default.md) |\n| Numbered Answer 1..N dialog palette | Dialog choice slots | [`dialog-choice-slots`](./dialog-choice-slots.md) |\n| Which question is open right now, for whom, answered by which actions | Dialogue prompt occurrence | [`prompt-occurrence`](./prompt-occurrence.md) |\n| Multi-step guided form (creation, level-up) committed on Confirm | Draft-then-confirm wizard | [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md) |\n| Questions asked in an order held as data, with an outline a client can show | Guided dialogue | [`guided-dialogue`](./guided-dialogue.md) |\n| An action is offered, dispatched, \"accepted\" — and silently does nothing | Offer gate / consume guard parity | [`offer-gate-consume-guard-parity`](./offer-gate-consume-guard-parity.md) |\n| A quest: offer, objective, terminal, reward — with no quest primitive | Quest composition | [`quest-composition`](./quest-composition.md) |\n| NPC joins and follows the hero | Companion follow seat | [`companion-follow`](./companion-follow.md) |\n| Companion fights beside the hero | Companion combat (follow + role + ally heal) | [`companion-combat`](./companion-combat.md) |\n| Quest completion pays the present party | Quest XP grant | [`quest-xp-grant`](./quest-xp-grant.md) |\n| A watch's injected resolver reads a table the watch never subscribed, and answers \"nothing found\" | Watch reader-manifest closure | [`watch-reader-manifest-closure`](./watch-reader-manifest-closure.md) |\n\n### Progression & XP\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Killer is paid at the moment of death | Kill-time XP grant | [`kill-xp-grant`](./kill-xp-grant.md) |\n| A boss or quest drops a rolled item | Loot table drop | [`loot-table-drop`](./loot-table-drop.md) |\n\n### Equipment\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Continuous numeric stat/AC modifier active while item is equipped | Equip-gated modifier | [`equip-gated-modifier`](./equip-gated-modifier.md) |\n\n### Containers & inventory\n\n| Problem | Pattern | Page |\n|---|---|---|\n| Place a container holding items; players take them out with no bespoke verb | Container with loot | [`container-with-loot`](./container-with-loot.md) |\n| Drink or use a carried consumable; the dose is removed | Consumable inventory consume | [`consumable-inventory-consume`](./consumable-inventory-consume.md) |\n\n## Adding a page\n\nCopy any seeded page. Keep the heading set identical. Cite a **generated**\nfixture path (or the generator that emits it), a proof test, and the SRD\nfeature list. Register new slugs only when a composition is proven — not as\nspeculative stubs.\n",
215
+ "patterns/actor-carried-feature-verb": "# Actor-carried feature verb (a class feature the hero carries everywhere)\n\n## Name\n\n`actor-carried-feature-verb` — Feature verb offered wherever its owner stands\n\n## Problem\n\nA granted class feature (Second Wind, Rage, Channel Divinity) must be usable wherever the hero is — in the tomb, not only at the room where it was granted — and spend its own uses.\n\n## Forces\n\n- A `capability:*` niche authored without a `provider` used to fall back\n to place-provided in silence, leaving the verb dead outside an authored\n node (a level-1 fighter needed Second Wind in the tomb and it was not\n offered); `WA-CAP-002` now rejects that.\n- Scoping a feature to the place where it is \"normally\" exercised is a\n premise a blind playtest falsifies.\n- There is no class-definition inheritance: granting the capability does\n not seed the feature's resource; an unseeded `actor.stat(<uses>)` gate\n fails closed.\n- Uses are a pool the feature spends; a feature whose pool starts at 0 is\n correctly absent from the palette until something charges it.\n\n## Solution\n\n1. Niche `capability:<bundle>/class-feature/<class>/<slug>` with\n `provider = \"actor\"` — the acting creature's own capability carries the\n niche; no `spatial_niche_attachment`. Same shape attacks, Dodge and the\n rests use.\n2. Affordance gated on the feature's own pool:\n `actor.stat('<uses>') >= 1`; `spends_channel` on the right economy\n channel.\n3. Consequence: `ModifyResource` `-1` on the pool (ordinal 0), then the\n effect.\n4. Whoever grants the capability (creation confirm, level-up apply) also\n **seeds the pool** from the resource definition's `initial_value` or\n its documented seed formula\n ([`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/classes/fighter.toml`\n(Second Wind; bundle_id, display names and default-valued fields omitted) and `…/base/classes/caster-features.toml` (Divine Spark\nspend + effect):\n\n```toml\n[[affordance_templates]]\ncapability_id = \"srd/class-feature/fighter/second-wind\" # what disclosure keys on\nniche_id = \"capability:srd/class-feature/fighter/second-wind\"\noutcome_template_id = \"srd/fighter/second-wind/outcome\"\npredicate_source = \"actor.stat('srd/fighter/second-wind-uses') >= 1\"\nspends_channel = \"srd/economy_channel/bonus\"\ntemplate_id = \"srd/fighter/second-wind/affordance\"\n\n[[niche_definitions]]\ndisplay_name = \"Use Second Wind (self)\"\nniche_id = \"capability:srd/class-feature/fighter/second-wind\"\npredicate_source = \"\"\nprovider = \"actor\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/cleric/divine-spark-heal/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\ndelta_source = \"-1\"\nresource = \"srd/cleric/channel-divinity-uses\"\n\n[[consequence_frame_writes]]\nordinal = 1\ntemplate_id = \"srd/cleric/divine-spark-heal/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"max(0, 1d8)\"\nresource = \"srd/hp\"\n```\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-class-features-actor-carried.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/caster-features-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/second-wind.ts`,\n `…/channel-divinity.test.ts`\n\n## Related\n\n[`resource-spend-with-option-menu`](./resource-spend-with-option-menu.md)\n(one pool, several spend options),\n[`extra-action-budget`](./extra-action-budget.md) (a feature that grants\nbudget instead of an effect),\n[`affordance-needs-niche-attachment`](../repairs/affordance-needs-niche-attachment.md),\n[`sibling-resource-predicate-seeds`](../repairs/sibling-resource-predicate-seeds.md).\n\n## Known misuse / anti-pattern\n\n- Do **not** stretch this pattern to Halfling Lucky nat-1 auto-reroll: the\n reaction can be actor-carried, but eligibility still cannot read die faces\n (`packages/spellkave-srd-cc/docs/substrate-verdicts/lucky-nat1-reroll.md`).\n- A `capability:*` niche without `provider`, or attached to a place.\n- Granting the capability at confirm but not seeding its uses.\n- Filing \"feature not offered in the tomb\" as an affordance-resolution\n bug.\n\n## SRD features that use this\n\n- Second Wind, Action Surge (charged by level-up), Rage, Channel Divinity\n (Divine Spark), Bardic Inspiration, Wild Shape uses, Lay On Hands, Innate\n Sorcery. Tables:\n [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md),\n [`character-creation.md`](../../../spellkave-srd-cc/docs/character-creation.md)\n § \"Where a class feature can then be used\".\n- Spread Caltrops, Spill Ball Bearings: not class features, but the same\n actor-provided niche (`capability:srd/action/utilize`). They spend the\n carried item instead of a use pool\n ([`equipment-catalogue.md`](../../../spellkave-srd-cc/docs/equipment-catalogue.md)\n § \"Area hazards\").\n",
216
+ "patterns/advancement-choice": "# Advancement choice menus (choose-N metadata)\n\n## Name\n\n`advancement-choice` — Advancement choice menus (choose-N metadata)\n\n## Problem\n\nI need a choose-N menu (fighting style, subclass, ASI-or-feat, expertise) that a DM dialogue can render without hardcoding the member list in TypeScript.\n\n## Forces\n\n- The world must behave identically without the metadata (ADR-0073 D-1):\n menus are DM-side facts, never server behavior.\n- One attachment row **per option member**, never one row per menu — the\n reader regroups by menu id, and the members stay individually\n addressable.\n- Every member must be a real `entity_definition`; live apply validates\n that the ref exists (`MF-APPLY-026`), so capability ids and prose-only\n slugs fail seed. The check is global (the world API),\n not \"same bundle\" — keeping members in the menu's bundle is a convention.\n- Menu-only options that are not already entities (a \"divine order\", a\n metamagic) need small option entity_definitions beside the rows.\n\n## Solution\n\nEmit one metadata attachment per member under a choice namespace with\n`target_kind = \"entity_definition\"` and a payload carrying the menu id, the\npick count and an optional recommended default:\n\n| Field | Required | Meaning |\n|---|---|---|\n| `class` / owner key | yes | whose advancement this is |\n| `level` | yes | level at which the menu opens |\n| `choice_group` | yes | stable menu id: `<bundle>/<class>/<level>/<slug>` |\n| `choose_n` | yes | how many members to pick |\n| `recommended` | no | member `target_ref` the source names as default |\n| `rechoose` | no | `\"none\"` (default) or a documented re-pick policy |\n| `grants_ref` | no (srd-cc always emits it) | the real entity the option grants when `target_ref` is an option wrapper (`srd-cc/src/chapters/classes/advancement-metadata-units.ts:518`). The DM duty document copies it per member as `memberGrantRefs`, checked against this row at publish (`crates/spellkave-validate/src/dm_reference_metadata.rs` `choice_groups_for`); the DM host sends it as the answer's reference so a client can show the granted feat, weapon or order. It is presentation only: no runtime reader grants from it |\n\nA sibling **grant** namespace (`(class, level) → one entity id`) carries the\nunconditional grants. A reader regroups choice rows by `choice_group`; the\ndialogue offers them as [`dialog-choice-slots`](./dialog-choice-slots.md)\nand applies the pick on confirm\n([`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)). Derive\nlarge member sets from tag membership\n([`tag-membership-menu`](./tag-membership-menu.md)), not hand lists.\n\n## TOML example\n\nCopied from\n`packages/spellkave-srd-cc/fixtures/base/classes/advancement-metadata.toml`:\n\n```toml\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/archery\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\nsource = \"manifest\"\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/archery\"\n\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/defense\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\nsource = \"manifest\"\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/defense\"\n```\n\n`target_ref` is a **unique per-menu wrapper** entity\n(`<bundle>/advancement-choice-option/<class>/<level>/<member-tail>`) and\n`grants_ref` names the real entity the option grants. Attachments upsert on\n`(target_kind, target_ref, namespace, bundle_id)`\n(the world API), so within one bundle two\nmenus naming the same real feat must not share it as `target_ref` — later seed rows would overwrite\nearlier ones and drop whole choose-N groups from the live catalog.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-data-advancement.test.ts`\n (reader regroups by `choice_group`)\n- `packages/spellkave-srd-cc/src/test/offline/metadata-target-ref-resolution.test.ts`\n (every member resolves to an entity_definition)\n- `packages/spellkave-srd-cc/src/test/offline/advancement-metadata-units.test.ts`\n\n## Related\n\n[`metadata-attachments`](../metadata-attachments.md) (row shape, namespace\nregistry), [`dialog-choice-slots`](./dialog-choice-slots.md),\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`tag-membership-menu`](./tag-membership-menu.md),\n[`resource-spend-with-option-menu`](./resource-spend-with-option-menu.md)\n(runtime spend menus are a different thing: live actions, not metadata).\n\n## Known misuse / anti-pattern\n\n- Hand-listing members in TypeScript (derive from the tag).\n- Putting eligibility in TypeScript — gate with server-evaluated DSL\n (`actor.stat('<level>')`, identity tags).\n- Treating a member as granted before draft → confirm.\n- Pointing `target_ref` at a capability id or a slug no entity carries.\n- Using the real feat/weapon entity as `target_ref` in more than one menu\n (upsert collision silently drops a group) — wrap per menu.\n- Authoring a menu for options that are not expressible as entities yet\n (leave the feature as identity until they are).\n\n## SRD features that use this\n\n- Fighting Style (L1 / Paladin-Ranger L2), subclass L3, ASI-or-feat L4 for\n all 12 classes, Divine/Primal Order, Expertise, Metamagic, Eldritch\n Invocations. The shipped menus and the ASI mechanics split:\n [`advancement-choice.md`](../../../spellkave-srd-cc/docs/advancement-choice.md),\n [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md).\n",
217
+ "patterns/advisory-action-cue": "# Advisory action cue (rank and explain a visible action)\n\n## Name\n\n`advisory-action-cue` — public presentation metadata that makes one already\nvisible action easier to notice and understand, without changing what the\nworld permits.\n\n## Problem\n\nSeveral actions can be factually visible at once. An author wants to make a\nnatural next step easier to discover (for example, speaking to a person or\ntaking a visible exit), but must not turn a UI preference into an eligibility\nrule, a hidden target binding, or a dialogue answer contract.\n\n## Forces\n\n- An affordance remains an attempt: the reducer is authoritative about whether\n it succeeds.\n- A response to an open dialogue question needs the server-owned occurrence\n contract in [`prompt-occurrence`](./prompt-occurrence.md), not a ranking\n hint.\n- A public cue is visible to every client that can already see its action, so\n it cannot carry private state, an entity reference, a payload default, or\n `semantic_context`.\n- Different consumers may present the same fact differently. A human shell can\n show the hint; an NPC may use the rank only to break an exact policy tie.\n\n## Solution\n\nAttach `ui.affordance_cue` metadata to an `affordance_template` (by its\nexact `template_id`) and declare the namespace **public** — the SDK drops\ncue rows whose namespace is not public\n(`packages/spellkave-sdk/src/core/readers/affordance_cue.ts:47-53`). The\npayload has only optional bounded presentation fields:\n\n```toml\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\npayload_json = '{\"rank\":4,\"hint\":\"Speak directly to a visible person.\"}'\nsource = \"manifest\"\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/speak-to/affordance\" # the template_id, not the action id\n\n[[metadata_namespaces]]\naudience = \"public\"\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\n```\n\n`rank` is an integer from 0 through 9. It breaks an otherwise exact local\npresentation or policy tie only. `hint` explains the suggestion in human\nlanguage. Consumers ignore malformed or absent fields. The SDK joins the first\navailable cue from the action's already-authoritative template source and\nprojects it alongside the action; no reducer argument changes.\n\nAn open prompt occurrence always wins over a cue. The client sends\n`semantic_context` only when it selected a real prompt response; a cue never\ncreates it.\n\n## TOML example\n\nGenerated by\n`packages/spellkave-srd-cc/src/ui/affordance-cues.ts` into\n`packages/spellkave-srd-cc/fixtures/ui/affordance-cues.toml`. That generator\ncurrently attaches a speech cue and a movement cue to the SRD playing-the-game\ntemplates:\n\n```toml\n# pattern: advisory-action-cue\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_cue\"\npayload_json = '{\"rank\":2,\"hint\":\"A visible exit can take you onward.\"}'\nsource = \"manifest\"\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/affordance/step\"\n```\n\n## Proof\n\n- `packages/spellkave-sdk/src/__tests__/readers.test.ts` proves a public\n attachment projects into `readManipulationContext(...).actions[].cue`.\n- `apps/play/src/lib/fact-composer.test.ts` proves prompt responses retain\n precedence over ranked ordinary actions.\n- The TypeScript explore scorer that proved an NPC uses rank only for an exact\n affordance-score tie was deleted with the TypeScript host (sk-jay0.1.55.60.8).\n\n## Related\n\n[`prompt-occurrence`](./prompt-occurrence.md) for private, authoritative\nquestion-response binding; [`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)\nfor why a visible action is never a promise of success.\n\n## Known misuse / anti-pattern\n\n- Putting `target_ref`, an entity id, a speech payload, or `semantic_context`\n in cue metadata. Those are an attempt's data, not a public presentation hint.\n- Raising `rank` to make an action eligible, or lowering it to hide one. The\n server and ordinary visibility rules remain authoritative.\n- Using a cue for \"the answer to this question.\" Author a prompt occurrence\n instead; only it captures the response set and addressee safely.\n\n## SRD features that use this\n\nThe playing-the-game speech and movement templates. Further authored examples\nmust be public action-level hints with the same bounded payload shape.\n",
218
+ "patterns/advisory-action-default": "# Advisory Action Default\n\nUse public `ui.affordance_defaults` metadata on one `affordance_template` to\npublish a bounded draft suggestion to clients. It is presentation data: it\nnever makes an action eligible, supplies reducer arguments, or replaces an\nADR-0142 prompt occurrence.\n\n```toml\n[[metadata_attachments]]\ntarget_kind = \"affordance_template\"\ntarget_ref = \"srd/dodge/affordance\"\nnamespace = \"ui.affordance_defaults\"\npayload_json = '{\"version\":1,\"target\":{\"kind\":\"actor\"}}'\nbundle_id = \"srd\"\nsource = \"manifest\"\n\n[[metadata_namespaces]]\naudience = \"public\" # the SDK reader drops non-public rows\nbundle_id = \"srd\"\nnamespace = \"ui.affordance_defaults\"\n```\n\nCopied from `packages/spellkave-srd-cc/fixtures/ui/affordance-defaults.toml`\n(generated by `src/ui/affordance-defaults.ts`); reader:\n`packages/spellkave-sdk/src/core/readers/affordance_defaults.ts`.\n\nThe payload has `version: 1` and may contain one `target` plus\n`input_values`. `target.kind = \"actor\"` means the caller's own disclosed body;\n`reference` requires an exact `target_ref` that remains visible to that caller.\nInput values must match the same template's `ui.affordance_input` schema and\nare scalar strings or numbers. Do not publish utterances, semantic context,\noccurrence ids, or values inferred from a place, a current speaker, or an\naction label.\n\nOne template owns one whole default. A client withholds duplicate or malformed\nattachments rather than choosing precedence. A player can always override a\nsuggestion with an explicit bound target or typed input. Prompt responses are\nnot meant to consume ordinary defaults; their source and response contract\nremain authoritative (design intent; no test asserts this yet).\n",
219
+ "patterns/before-filing-a-kernel-gap": "# Before filing a kernel gap\n\n## Name\n\n`before-filing-a-kernel-gap` — The checklist every lane runs before a substrate verdict\n\n## Problem\n\nThree lanes filed Action Surge as a kernel gap although `extra-action-budget`\nexisted; two filed \"concentration needs damage facts\" although condition\nhooks existed. Canon-warden runs are expensive; a wrong \"kernel\" label costs\na design note, a review, and a redesign.\n\n## Checklist\n\nIn order; stop at the first hit.\n\n1. **Catalog by problem** — [`index.md`](./index.md). Search the Problem\n column, not the mechanism names.\n2. **Grep `packages/spellkave-world-author/docs/repairs/`** for the\n verb/effect name. Involuntary / un-gated primitives often already live\n there (RelocateEntity lesson — forced move without a place_edge is a\n repair, not a missing r_move flag).\n3. **Prior verdicts** — `packages/spellkave-srd-cc/docs/substrate-verdicts/`:\n what was already tried, and with which exact refusal.\n4. **Event-driven seams you may have missed**: condition hooks\n (`condition-hook-on-event`), autonomy jobs / `fire_at_boundary`\n (`lingering-hazard-zone`, `rest-boundary-resource-refill`), host watches\n (`kill-xp-grant`, `quest-xp-grant`) for grants and narration.\n5. **A reaction window is never a forced rule.** In a turn-based session a\n window has no timeout and waits for `r_react` (ADR-0093 D-7), so a\n player who never answers keeps the benefit; forced rules belong in\n condition hooks.\n6. **Attempt it and keep the error.** A verdict needs the authored rows and\n the verbatim validator/runtime refusal (`MF-VAL-…`, `MF-DSL-…`,\n `UnknownField`), not a reading of the corpus.\n7. **Classify honestly** (K-A rule, 2026-08-22; worked use in\n `packages/spellkave-srd-cc/docs/substrate-verdicts/dispatch-args-kernel-design.md`\n §B): a kernel-prepopulated fact is\n outside K-1..K-5 only when it is a *pure projection of state the kernel\n already holds, carrying zero vocabulary the kernel had to invent*\n (`core/distance_to_actor_mm`, `core/resolution_roll_modifier`). Anything\n that bakes an id, prefix, radius, or condition into the kernel is a closed\n convention — worse than an enum because it is ungreppable — and must be a\n **parameterised leaf with authored arguments** (`peers_near_target`,\n `participant_tag_group_count`, `shares_tag`). \"No new enum arm\" is not a\n sufficient test.\n8. **Name it content-neutrally.** The kernel has no damage, ally, faction,\n spell or class; it has resources, tags, conditions, events, subjects.\n9. **Grep the populators before claiming a fact is unreadable.**\n `selection/entity_facts.rs` (`subject_capability_facts`) and\n `roll_bias.rs` (`manipulation_spatial_gate_facts`) are the two places a\n condition gate / outcome guard reads cross-party capabilities and distance.\n A silent `has_capability → false` is often a missing thread into one of\n those pools, not a missing DSL op — and `target.has_capability` never sees\n granted capabilities (`sk-jay0.2.48`).\n\n## Related\n\n`extra-action-budget`, `condition-hook-on-event`, `post-commit-hit-reaction`,\n`mastery-gated-attack-variant`.\n",
220
+ "patterns/blueprint-instance-override": "# Blueprint instance with overrides (scenario spawn from a catalog definition)\n\n## Name\n\n`blueprint-instance-override` — Instantiate a catalog blueprint; override per instance\n\n## Problem\n\nMy scenario needs an NPC or encounter that \"is a Commoner\" / \"is a Goblin\" / \"is three wolves at the bridge\" — how do I place it without re-typing the stat block, and how do I change one number or give one body a role?\n\n## Forces\n\n- A hand-copied local definition typically carries only AC and HP and\n silently drops ability scores, speed, the baked proficiency stat and the\n size / type / CR tags the blueprint ships.\n- There is **no definition inheritance**: `entity_definition_initial_state`\n is definition-level only (`lineage_id` exists but nothing reads it).\n- A role-granting tag on the shared definition would make every instance\n of it a trainer / a giver.\n- Cross-bundle references are legal only when the scenario declares\n `depends_on` on the catalog bundle; the closure check is `MF-VAL-214`\n (`crates/spellkave-validate/src/refs.rs:36-40,102`). (`MF-VAL-291` is a\n different warning: an id a bundle *defines* outside its own namespace.)\n\n## Solution\n\n1. Point the `entities` row's `entity_def_id` at the catalog blueprint\n (full cross-bundle id). Instance identity (`name`, `description`) stays\n on the scenario row.\n2. One changed fact on a named instance → an admission-time\n `[[object_state]]` row for that `(entity, state_id)`; it supersedes the\n definition seed (the seeded row is deleted before the explicit one is\n inserted).\n3. A role that only this body has → an instance `[[entity_tag]]` row.\n Target-niche derivation unions instance tags with definition tags, so\n `has_tag` / `has_niche` readers see it.\n4. Universal behavior comes with the definition's identity tags\n ([`identity-tag-capability-grant`](./identity-tag-capability-grant.md))\n — do not copy capabilities onto the instance; reserve instance\n capability rows for a narrower source (a DM's watch extent, party\n sight).\n5. A *different creature* (numbers that are not a catalog stat block)\n still gets its own definition.\n\nEncounters are the same pattern in bulk: N instances of catalog blueprints\nat a node, each with its behavior-selecting instance tag\n([`role-driven-brain`](./role-driven-brain.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/monsters/slime-scout.toml`\n(one HP override) and `…/cast/monsters/storyline-encounters.toml` (an\nencounter wolf with a role tag):\n\n```toml\n[[entities]]\nbundle_id = \"elven_mini\"\nentity_def_id = \"srd/creature/gray-ooze\"\nentity_key = \"elven_mini/adventure/npc/slime_scout_1\"\nkind = \"npc\"\nname = \"Slime Scout\"\nplace_node_id = \"elven_mini/tomb/hall\"\n\n[[object_state]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/npc/slime_scout_1\"\nsource_template_id = \"manifest\"\nstate_id = \"srd/hp\"\nvalue_bool = true\nvalue_int = 3 # definition seeds 22; tutorial pacing wants 3\n\n[[entities]]\nbundle_id = \"elven_mini\"\nentity_def_id = \"srd/creature/wolf\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nkind = \"npc\"\nname = \"Road Wolf 1\"\nplace_node_id = \"elven_mini/river_crossing/bridge_mid\"\n\n[[entity_tag]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nsource = \"manifest\"\ntag = \"srd.creature.role.skirmisher\"\n```\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-actor-capabilities-no-dup.test.ts`\n (instances do not duplicate the capabilities their definition seeds)\n- No test asserts an instance override (the slime's HP 3 over the\n definition's 22) directly; the fixture rows above are the evidence.\n- `packages/spellkave-srd-cc/src/test/offline/creature-roles.test.ts`\n\n## Related\n\n[`identity-tag-capability-grant`](./identity-tag-capability-grant.md),\n[`role-driven-brain`](./role-driven-brain.md),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md),\n[`manifest-format`](../manifest-format.md) (`entities`, `object_state`,\n`entity_tag`).\n\n## Known misuse / anti-pattern\n\n- A local `entity_definitions` row that re-types a catalog stat block.\n- Expecting a local definition to inherit a blueprint's seeds via\n `lineage_id`.\n- Tagging the shared definition with a scenario role.\n- Mirroring the blueprint's tag-derived capabilities onto the instance.\n- Forgetting `depends_on` and reading the resulting `MF-VAL-214` as a\n kernel limit.\n\n## SRD features that use this\n\n- Mira and Aldwin (`srd/creature/commoner`), the Crypt Warden (goblin\n warrior, XP override), the Slime Scout (gray ooze, HP 3), every §5\n storyline encounter. Worked verdicts:\n [`scenario-blueprints.md`](../../../spellkave-srd-cc/docs/scenario-blueprints.md).\n",
221
+ "patterns/bundle-movement-default": "# Bundle movement default (walking with zero per-edge rows)\n\n## Name\n\n`bundle-movement-default` — One bundle-scoped movement default instead of per-edge affordance rows\n\n## Problem\n\nI want every edge in my bundle's place graphs to be walkable with the standard step policy and reach budget, without authoring a `place_edge_affordance` row on each edge.\n\n## Forces\n\n- Ordinary walking needs zero per-edge rows (ADR-0101 A-1); a row per edge\n is generated noise that hides the few edges that really differ.\n- The kernel never names a bundle's ids: it resolves the reach resource\n and the long-running move session through binding keys.\n- Resolution is per edge, EDGE > GRAPH > BUNDLE on the edge's own\n `bundle_id`; `depends_on` does **not** propagate a default, so a\n consuming bundle must declare its own row.\n- An edge with no resolvable default and no rows still fails closed\n (`MissingTraversalAffordance`).\n\n## Solution\n\nAuthor ONE `[[movement_defaults]]` row per bundle (`place_graph_id = \"\"`,\n`mode_id = \"\"`) naming the step affordance template plus both bindings:\n`movement_reach_resource` (the per-tick reach budget) and\n`long_running_move_session` (the clock-only Sequential session opened when\none hop exceeds that reach — empty scheduler on purpose, a clock not\ninitiative). Then:\n\n- an edge's own row on the **same** template *refines* it (edge wins per\n binding key, e.g. a longer edge's `movement_cost_cells`);\n- a row on **another** template *AND-joins* it (the locked-door idiom);\n- `place_edge.inherit_movement_default = false` *replaces* it outright (a\n fly-only edge owning its whole mode set).\n\nA consuming bundle that wants the same policy declares its own row naming\nthe same template and bindings. A combat-grid blueprint only chooses the\nexisting step policy for its generated cell edges; its geometry is the\nbattle-map part.\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/hamlet.manifest.toml`\n(consuming bundle re-declaring the `srd` policy):\n\n```toml\n[[movement_defaults]]\naffordance_template_id = \"srd/affordance/step\"\nbindings_json = '{\"movement_reach_resource\":\"srd/speed-walk\",\"long_running_move_session\":\"srd/long_running_move\"}'\nbundle_id = \"elven_mini\"\nmode_id = \"\"\nplace_graph_id = \"\"\n```\n\nThe `srd` bundle's own row lives in\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/grid.toml` beside\nthe `srd/combat-grid/standard-10x10` preset.\n\n## Proof\n\n- Kernel: the world API unit tests\n `zero_edge_rows_inherits_bundle_default` (`:263`) and\n `graph_default_beats_bundle_default` (`:340`).\n- Scoping (`selected_defaults`, `movement_modes.rs:145-165`): a\n graph-scoped default (non-empty `place_graph_id`) matches on the edge's\n graph from any bundle and replaces the whole bundle-scoped set; a\n bundle-scoped default (`place_graph_id = \"\"`) applies only to edges of\n its own `bundle_id`.\n\n## Related\n\n[`long-running-actions`](../long-running-actions.md),\n[`tool-reference`](../tool-reference.md) (`spellkave_set_movement_default`,\n`spellkave_bind_edge_affordance`),\n[`edge-traversal-resource-seed`](../repairs/edge-traversal-resource-seed.md),\n[`adjacent-moves-ungated`](../repairs/adjacent-moves-ungated.md).\n\n## Known misuse / anti-pattern\n\n- A generated `place_edge_affordance` row on every edge.\n- Expecting `depends_on` to inherit the upstream bundle's default.\n- Re-authoring an adventure-namespaced copy of a shared grid preset when\n the policy is identical.\n\n## SRD features that use this\n\n- `srd/affordance/step` + `srd/speed-walk` + `srd/long_running_move` for\n the standalone `srd` bundle and every elven-mini graph; the shared\n `srd/combat-grid/standard-10x10` preset. Layout residue:\n [`fixtures-layout.md`](../../../spellkave-srd-cc/docs/fixtures-layout.md).\n",
222
+ "patterns/companion-combat": "# Companion combat seat\n\n## Name\n\n`companion-combat` — Companion follow + role fight + ally targeting\n\n## Problem\n\nA friendly companion should follow the hero out of combat, fight with a\nnamed combat role when a scene session opens, never target the hero, and\noptionally spend a healing consumable when the hero is bloodied.\n\n## Forces\n\n- Follow already exists as seat policy (`companion-follow`) with no pathfinding\n FrameWriteOp.\n- Combat roles are content-free data (`@spellkave/adventure-runtime/npc-kinds`), run by the Rust NPC host's kinds (`crates/spellkave-npc-host`; the TypeScript brains were deleted, sk-jay0.1.55.60.8).\n- Ally vs foe identity is host-owned (the brain must not invent factions).\n- Healing is \"if a matching heal affordance is offered for the ally\" —\n inventory is expressed by the palette, not a second inventory protocol\n inside the brain. **No SRD verb gives a consumable to another creature\n today:** `srd/consume` targets a potion the drinker carries and heals the\n drinker, so a heal dispatched at the ally never matches it. Caddoc, the\n rogue and Hesper still wire `srd/consume` as their heal id (so it lights up\n if an administer verb lands); until then their heal branch does not fire\n (`npcs/quests/hesper.ts:61-68`; tracked as `sk-jay0.1.23.35.7`). A heal\n that works today needs an ally-targeted verb such as\n `srd/spell/cure-wounds/cast`.\n- Speech lines (join / combat join) are app-owned.\n\n## Solution\n\n**This is the generic party companion mechanism** — not a single-NPC seat.\nTwo shipped shapes use it:\n\n- **Companion kind** (the Rust host's `companion` kind; formerly `createCompanionBrain`): Caddoc\n (`healer`) and Aldwin's rogue (`skirmisher`) — steps 1–6 below.\n- **Shared player runtime kit** (Hesper, sk-jay0.1.23.12): Hesper no longer\n has a brain of her own. She runs the host's shared player runtime (the TypeScript\n `buildPlayerRuntimeSeat` was deleted); the archer role brain is her combat-cycle\n `tacticalOverride` (hero never a target), and the join is a policy switch\n after which only a human `follow` order moves her. See the header of\n `packages/spellkave-adventure-elven-mini/npcs/quests/hesper.ts`.\n\nCompanion brain steps:\n\n1. **Join trigger** — idle until `isCompanion()` (quest terminal / story latch).\n2. **Out of session** → `createFollowBrain` toward the ally node.\n3. **In session, my turn** → `createCombatRoleBrain` with caller `role`\n (Caddoc = `healer`, Aldwin's rogue = `skirmisher`; `lurker` also exists)\n and a host snapshot whose **foes are hostiles to the hero** and **allies\n include the hero**. Hard-filter any *attack* whose `targetRef` is the\n protected ally (heal affordances on the ally remain legal).\n4. **Heal** — role `healer` heals the **lowest** ally below half HP when a\n heal action from `healActionIds` is offered **for that ally**, else\n attacks; any role may pass a `heal` overlay. See the Forces note: with\n `srd/consume` as the heal id this branch never fires today.\n5. **Session ends** → follow automatically (`inSession === false`).\n6. Optional join / combat-join / addressed Speak-To lines (app-owned).\n\nA later companion is **configuration only**: `{ role, isCompanion, speech,\nallyTargetRef, readAllyNodeId, readSelfNodeId, world, actions }` (plus the\noptional `heal` overlay) — no new brain module (sk-609b.15).\n\nStoryline slots (sk-609b.15): **Aldwin's rogue** (`skirmisher`) at hero L2;\n**Hesper** (`archer`) after Q6; **Caddoc** (`healer`) after Q10. See\n[`elven-mini-party.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-party.md).\n\n## TOML example\n\nNo special TOML — seat policy in TypeScript. Generator / seat wiring cites\nthe pattern:\n\n```ts\n// pattern: companion-combat\ncreateCompanionBrain({\n isCompanion: () => joined,\n role: \"archer\",\n allyTargetRef: heroRef,\n readAllyNodeId,\n readSelfNodeId,\n world: () => ({ self, foes: hostilesToHero, allies: [hero] }),\n actions: { rangedActionId: \"srd/attack/ranged\", meleeActionId: \"srd/attack/melee\" },\n // A heal verb whose TARGET is the ally. Not `srd/consume`: its target is a\n // potion the drinker carries and the effect lands on the drinker.\n heal: { actionIds: [\"srd/spell/cure-wounds/cast\"] },\n speech: { speakToActionId, traceKindId, joinLine, combatJoinLine },\n});\n```\n\n## Proof\n\n- Offline simulation: the Rust host's companion engine tests (`crates/spellkave-npc-host`).\n- Live representative: `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/party-mill-fight.test.ts` (companion seats in a real multi-NPC fight). The never-the-hero and follow-after-session claims are proven offline only, in the companion-brain test above\n\n## Related\n\n[companion-follow](./companion-follow.md),\n`combat-role-brains.md` (deleted with the TypeScript host),\n[dialog-choice-slots](./dialog-choice-slots.md).\n\n## Known misuse / anti-pattern\n\n- Listing the hero in `world().foes` and relying on luck.\n- Kernel RelocateEntity every tick to teleport-follow (same anti-pattern as\n companion-follow).\n- Hardcoding SRD potion / attack ids inside the host engine (pass them in as data).\n\n## SRD features that use this\n\n- **Aldwin's Blade** (rogue skirmisher, companion brain) after hero L2 dialog offer.\n- **Hesper of the Lodge** (archer, player-runtime kit) after Q6; fights in Q7 warren.\n- **Brother Caddoc** (healer, companion brain) after Q10 — heal branch\n inert until an administer verb exists (`sk-jay0.1.23.35.7`).\n",
223
+ "patterns/companion-follow": "# Companion follow seat\n\n## Name\n\n`companion-follow` — Companion follow seat\n\n## Problem\n\nAfter a quest, an NPC should follow the hero along place-graph edges without a kernel pathfinding primitive.\n\n## Forces\n\n- No pathfinding `FrameWriteOp`: movement is ordinary traverse/move\n affordances the seat chooses.\n- Companion mode is a seat policy, not a condition.\n- Who decides *where* the companion goes is a design choice: the seat itself\n (autonomous follow) or the human leading the party (ordered follow).\n\n## Solution\n\nTwo shipped shapes.\n\n**Autonomous follow brain** (Caddoc, Aldwin's rogue): the Rust host's companion kind\n(formerly the TypeScript `createFollowBrain`, deleted with the TypeScript host), composed out of combat. On its turn it waits when\nco-located with the ally; otherwise it prefers a scene exit whose disclosed\ndestination mentions the ally node's local name or full id, else a stable\nfirst exit.\n\n**Ordered follow under a companion policy** (Hesper, sk-jay0.1.23.12): the\nNPC runs the host's shared player runtime (the TypeScript `buildPlayerRuntimeSeat` was deleted). The quest\nterminal installs a `CompanionPolicy` (`createTerminalCompanionPolicySwitch`,\nelven-mini `npcs/quests/terminal-companion.ts`); from then on strategic\ndirection belongs to the human, and only a live `follow` order moves her,\nrouted through the leader-location reader and the perceived map. The\nfollow brain's substring / first-exit fallback is not used on this path\n(`player-runtime-seat.ts:609-611`). The switch reads the durable terminal\nevery cycle, so a restarted seat re-installs the policy from the world.\n\nQuest context: [`elven-mini-quests.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-quests.md),\n[`elven-mini-party.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-party.md).\n\n## TOML example\n\nNo special TOML — seat policy in TypeScript:\n\n```ts\n// pattern: companion-follow\n// autonomous (Caddoc, rogue): createCompanionBrain composes createFollowBrain\ncreateFollowBrain({ readAllyNodeId, readSelfNodeId });\n// ordered (Hesper): the terminal installs a CompanionPolicy on the player\n// runtime; only a human `follow` command moves the companion.\n```\n\n## Proof\n\n- Autonomous: the Rust host's companion engine tests (`crates/spellkave-npc-host`).\n- Ordered: elven-mini `npcs/__tests__/hesper-companion.test.ts`,\n `companion-commands.test.ts`, `terminal-companion.test.ts`.\n\n## Related\n\n[companion-combat](./companion-combat.md) (follow + role fight + ally heal),\n[quest-xp-grant](./quest-xp-grant.md).\n\n## Known misuse / anti-pattern\n\n- Kernel `RelocateEntity` every tick to teleport-follow.\n- Soft-locking when no traverse edge exists and there is no wait fallback.\n- Copying the follow brain's name-substring exit choice into the ordered\n path — the player runtime retired it there on purpose\n (`player-runtime-seat.ts:609-611`).\n\n## SRD features that use this\n\n- **Hesper of the Lodge** after Q6 (ordered follow, first sk-ruh companion slot).\n- **Brother Caddoc** after Q10 and **Aldwin's Blade** at hero L2 (autonomous follow brain).\n",
224
+ "patterns/computed-literal": "# Computed-literal delta_source compositions\n\n## Name\n\n`computed-literal` — Computed-literal delta_source compositions\n\n## Problem\n\nI need to write a resource delta whose magnitude was computed outside the DSL (NPC host read another entity, TS chose N XP, etc.).\n\n## Forces\n\n- A frame-write formula can read its acting entity and its modified target,\n but cannot use that target binding to read an arbitrary third entity.\n- A literal fixes the authored amount; it does not track later live variance.\n- Live caller-selected amounts should use an admitted dispatch argument when\n the action already supports one.\n\n## Solution\n\nFor a build-time constant, compute the integer in the generator and author\n`delta_source = \"<N>\"` on the relevant `ModifyResource`. This is an ordinary\nDSL literal, not a new primitive.\n\nFor the current DM XP watches, keep the action definition fixed and supply\n`quantity` at dispatch. The award write reads\n`actor.stat('core/dispatch_arg_quantity')`; see\n[`kill-xp-grant`](./kill-xp-grant.md) and\n[`quest-xp-grant`](./quest-xp-grant.md). Their production hosts no longer\nrender an action definition or apply a manifest for each reward.\n\n## TOML example\n\nA schematic generator-produced constant write:\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"example/reward\"\ndelta_source = \"100\"\n```\n\nLegacy XP renderer exports can still compose publisher-authored scenes with\nliteral numeric entity references. Such compatibility composition does not\nestablish the production DM's per-play write authority.\n\n## Proof\n\n`packages/spellkave-srd-cc/src/chapters/spells/spell-behaviors.ts`\n(`aoeSpellSaveDcLiteral`) is a generator-owned computed constant.\nCurrent live XP behavior is proved by the live tests linked in the XP patterns.\n\n## Related\n\n[`derived-value-mechanism`](./derived-value-mechanism.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`quest-xp-grant`](./quest-xp-grant.md).\n\n## Known misuse / anti-pattern\n\n- Reading a corpse as `target` inside a write whose target is the killer.\n- Substituting a baked constant for a promised live-derived amount.\n- Publishing a per-play action solely to embed a quantity supported as an argument.\n\n## SRD features that use this\n\n- Spell upcast dice authored for each `SpellCastingOption` slot level.\n- AoE save DC: per-victim bodies rebind Actor, so `aoeSpellSaveDcLiteral`\n emits 13 from default proficiency 2 and casting modifier 3. This is the\n documented default-caster limitation, not a live caster-stat calculation.\n",
225
+ "patterns/condition-grant-and-suppression": "# Condition capability grant and suppression\n\n## Name\n\n`condition-grant-and-suppression` — Condition capability grant and suppression\n\n## Problem\n\nWhile a condition holds I need to grant or remove an ability to act (a capability), not just a fact a predicate might forget to read.\n\n## Forces\n\n- Affordance admission is structural on `capability_id` — status facts alone leave silent holes.\n- Suppression must apply to the actor's own attempts, never make them an illegal target.\n- Suppression wins over grant when both are active.\n\n## Solution\n\nSet `grants_capability_while_active` / `suppresses_capability_while_active` on\n`[[condition_definitions]]`. Enforced in `capability_ids_for_actor` (same fold\nas identity-tag grants and `entity_definitions.grants_capability_while_equipped`;\nsuppression still wins). Full repair:\n[`repairs/condition-capability-grant-and-suppression.md`](../repairs/condition-capability-grant-and-suppression.md).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/conditions.toml`\n(Dead suppresses, Unconscious grants; descriptions and default-valued fields\nomitted):\n\n```toml\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/dead\"\ndisplay_name = \"Dead\"\ngate_predicate_source = \"\" # required field, may be empty\nimplies = [\"srd/condition/incapacitated\"]\nsuppresses_capability_while_active = [\n \"srd/action/attack\",\n \"srd/capability/walk\",\n \"srd/capability/death_save\",\n # … dodge, help, drop-prone, short-rest, long-rest\n]\n\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/unconscious\"\ndisplay_name = \"Unconscious\"\ngate_predicate_source = \"\"\ngrants_capability_while_active = [\"srd/capability/death_save\"]\n```\n\n## Proof\n\n- Kernel fold unit tests in\n the world API:\n `suppression_removes_the_capability_from_the_actor_set`,\n `a_grant_adds_a_capability_the_body_does_not_own`,\n `suppression_beats_a_grant_of_the_same_capability` (`:1295-1332`).\n- The fold applies to the **actor** subject only; `target.has_capability`\n reads raw capability rows (`entity_facts.rs:185-201` vs `:346-351`; decision\n `sk-jay0.2.48`).\n- Repair doc: [`repairs/condition-capability-grant-and-suppression.md`](../repairs/condition-capability-grant-and-suppression.md).\n\n## Explain the condition to its holder\n\nSet `condition_definitions.description` to a plain-text explanation. Manifest\napplication persists that prose on the `condition_definition_description`\nsatellite (the catalog `condition_definition` row stays binary-compatible).\nAn empty or omitted description deletes the satellite row. Granular condition\nupdate preserves existing prose.\nThe text does not grant or suppress capabilities: those effects still come\nfrom the fields above. Authorized PLAYER condition detail returns nonblank\nprose for the holder's existing instances; missing prose stays absent.\nThe compact self summary retains its existing condition fields.\n\nPersistence and authorized-read proof:\n[`condition-descriptions.md`](https://github.com/b4arena/spellkave/blob/33eb5f1c0f4913a56fb38f8c9580db112b1dd87e/openspec/specs/player-tool-query-surface/demos/condition-descriptions.md)\n(historical captured evidence at the linked revision).\n\n## Related\n\n[extra-action-budget](./extra-action-budget.md) (channel FlatSet vs capability suppress), [action-economy](../action-economy.md), [identity-tag-capability-grant](./identity-tag-capability-grant.md) (the other grant sources in the same fold), [equip-gated-modifier](./equip-gated-modifier.md) (numeric bonus while equipped — not a capability).\n\n## Known misuse / anti-pattern\n\n- **Applying a condition with no way out.** `ApplyStatus` takes an optional\n `expires_at_boundary` (`{ boundary_id, owner_actor }`, worked example in\n [`action-economy.md`](../action-economy.md)); omit it and the condition\n persists until something explicitly removes it. That is correct for a\n condition its subject can end, and a trap for one it cannot. Elven-mini\n shipped a Prone that lasted forever — inflictable on a player by a monster,\n via the Topple weapon-mastery rider, with no save and no Stand Up authored\n (`sk-0m4.120.50`). Before authoring a condition, name the thing that ends\n it; if the answer is \"an action nobody has built yet\", give it a boundary.\n Note the two generated references do not show this field: `dsl-grammar.md`\n documents the DSL operator (which genuinely has only `subject` and\n `condition_definition_id`) and says in its own text that the manifest row\n is a different, structured shape.\n\n\nModelling a ring-granted spell as ApplyStatus + predicate, or as\n`grants_capability_while_active` on a condition — put it on the item's\n`grants_capability_while_equipped` CSV. Using suppression to block being\ntargeted (Speak with Dead must still work on a corpse).\n\n## SRD features that use this\n\n- **Dead** suppresses attack, dodge, help, drop-prone, rests, walk and death\n saves (`conditions.toml:100-122`).\n- **Unconscious** grants `srd/capability/death_save` (`conditions.toml:130`).\n- **See Invisibility** grants `srd/capability/see_invisibility`\n (`perception-conditions.toml:151`).\n- Not this pattern: Bless / Bane / Guidance / Resistance are roll modifiers\n (`condition_roll_mod`), and Hold Person is a primary-channel FlatSet\n ([extra-action-budget](./extra-action-budget.md)).\n- Incapacitated suppresses nothing yet (`conditions.toml:98`); speechless\n gating is not authored.\n- Worn items that grant a spell belong on `grants_capability_while_equipped`, not this pattern.\n",
226
+ "patterns/condition-hook-on-event": "# Condition hook on event (auto-resolving, per holder)\n\n## Name\n\n`condition-hook-on-event` — A condition reacts to a typed world event on its own holder, without a player-accepted window\n\n## Problem\n\n\"While I am concentrating, any damage forces a CON save.\" \"While raging, the\nfirst hit each turn adds dice.\" \"When I would drop to 0 HP, drop to 1\ninstead.\" The rule must fire by itself when something happens *to the\nholder*, with no reaction window to accept or decline. (Plain expiry — \"end\non a long rest\", \"clear at turn start\" — is not this pattern: use the\ncondition's `expires_at_boundary`.)\n\n## Forces\n\n- A reaction window (`post-commit-hit-reaction`) is **optional by design**:\n ADR-0093 D-7 turn-bound windows have no timeout, so \"never answer\" is a\n legal outcome. A forced save modelled as a window can be kept forever by\n silence — wrong rule, wrong canon.\n- Condition hooks already exist: `condition_definition.hooks` run on **every**\n typed event (the world API `record_event_typed`), iterate\n only the **active** `target_condition` rows, and run one side effect:\n `invoke_outcome_graph(...)` (see the next bullets).\n- `Layer2.ResourceDelta` hooks see `resource_id`/`template_id` (Text) and\n `entity_id`/`delta`/`new_value` (Int). Kernel opening K-B (2026-08-22,\n ADR-0106) made those Int facts readable, registered the newer event kinds\n for the validator, exposed the holder's own entity id as\n `target.stat('core/entity_id')`, and fixed the side-effect payload so hook\n consequences actually execute on the holder.\n- A hook cannot write `RemoveCondition` inline: the one side-effect op that\n **executes** inside a hook is `invoke_outcome_graph('<consequence_template_id>')`,\n which resolves to a **consequence template** (the name is historical) whose\n own `RemoveCondition`/`ModifyResource` frame writes run with the holder\n bound as Actor/TargetActor. `modify_resource`/`apply_status`/`emit_trace`,\n `OutcomeSequence` and `Arbitrate` parse but are recorded as explicit skips\n (`ConditionHookSkippedSideEffect`), never silent\n (the world API).\n\n## Solution\n\nPut the rule on the condition, keyed by the event kind that should trigger it:\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/spells/casting.toml`\n(description trimmed):\n\n```toml\n# pattern: condition-hook-on-event\n[[condition_definitions]]\nbundle_id = \"srd\"\ncondition_definition_id = \"srd/condition/concentrating\"\ndisplay_name = \"Concentrating\"\ngate_predicate_source = \"1 == 1\"\nremove_time_policy = \"srd/remove_policy/independent_lifetime\"\nstacking_rule = \"srd/stacking/single\"\n\n[[condition_definitions.hooks]]\ndetail_filter_source = \"$event.detail.entity_id == target.stat('core/entity_id') && $event.detail.resource_id == 'srd/hp' && $event.detail.delta < 0\"\nevent_kind = \"Layer2.ResourceDelta\"\nexpression_source = \"invoke_outcome_graph('srd/concentration/check')\"\n# `srd/concentration/check` is a consequence_template with one bare\n# RemoveCondition frame write. As shipped there is NO save — see below.\n```\n\nThe hook row accepts exactly `event_kind`, `detail_filter_source` and\n`expression_source` (unknown keys are rejected;\n`crates/spellkave-schema/src/lib.rs:2425-2440`). Field semantics:\n[`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md)\n§\"Reacting to events with condition hooks\".\n\n### Residual: DC cannot use `$event.detail.delta` inside the consequence\n\nAttempted (content, sk-609b.12.2): put the SRD DC\n`max(10, (0 - $event.detail.delta) / 2)` on the **consequence template's**\n`ForEachActorInRadius.predicate_source` (where the CON save must run, because\nhook evaluation facts do not carry ability scores — only event detail +\nholder `core/entity_id`). **Refused:** `$event.detail.*` is only in scope for\nhook `detail_filter_source` / `expression_source`. The consequence path binds\nActor/TargetActor via `apply_consequence_with_bindings` with\n`FrameBindingContext::literal_only()` and no event context\n(`condition_definition.rs` Phase B).\n\n**Shipped content: no save at all.** The filter has no die roll and the\ntemplate only removes the condition, so any HP loss the holder did not cause\nends concentration (`casting.toml:62-80`; bug `sk-jay0.3.12.1`). The\ngenerator comment, the template description (\"failed CON save DC 10\") and\nthe live-test header claim a DC 10 save that does not exist. The live proof\n`packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/condition-hooks.ts`\n(other-caused −7 HP) asserts only that the condition drops. A fixed DC 10\nwould equal `max(10, half damage)` for every hit dealing less than 22\ndamage.\n\n## Proof\n\n- Kernel demos (K-B): `openspec/specs/world-interaction-kernel/demos/sk-609b-kb-condition-hooks.demo.md`\n — other-caused HP loss removes the holder's condition via the template's\n `RemoveCondition`, a self-caused spend does not fire, a second\n concentrating creature is untouched; `sk-609b-kb-reentrancy-bound.demo.md`\n — an authored A↔B hook cycle stops at depth 3 with the reducer still `ok`.\n- Authoring reference: `interaction-dsl-and-world-authoring.md` §\"Reacting to\n events with condition hooks\".\n- Content: `packages/spellkave-srd-cc` concentration (`srd/condition/concentrating`),\n Deflect Attacks (`srd/condition/deflect-ready`), Relentless Endurance\n (`srd/condition/relentless-endurance-ready`) — sk-609b.12.2.\n\n## Used by\n\nThe srd-cc base content ships six hooks: Concentration\n(`spells/casting.toml`), Deflect Attacks mitigation (`classes/monk.toml`),\nRelentless Endurance 0-HP intercept (`character-origins/traits.toml`), the\nUnconscious condition (`playing-the-game/conditions.toml`), Barkskin and Shield of\nFaith (`spells/level-2/barkskin.toml`, `spells/level-1/shield-of-faith.toml`). The Frenzy marker and\nrest-expiry of blessings use `expires_at_boundary`, not hooks.\n\n## Related\n\n`post-commit-hit-reaction` (optional, player-accepted — use for choices, not\nforced rules), `rest-boundary-resource-refill`, `condition-grant-and-suppression`.\n\n## Residual: hook-invoked consequences lack spatial bindings\n\nK-B Part A4 binds Actor/TargetActor **entity** refs only\n(`FrameBindingContext { actor_ref, target_entity_ref, ..literal_only() }`).\n`ActorSpatialRef` / `TargetSpatialRef` are absent, so\n`ForEachActorInRadius` centers fail with `missing …SpatialRef binding`.\nUse **bare** `RemoveCondition` / `ModifyResource` frame writes (target_ref\n`Actor`), and put dice gates on the hook `detail_filter_source` (which can\nroll `d20` and read `$event.detail.*` + `target.stat('core/entity_id')` +\nstatuses — **not** ability scores or other resources).\n\nA flat save could therefore sit on the filter (e.g. `d20 >= 10`, DC 10, no\nmodifier); the CON modifier stays residual until hook facts gain ability\nscores or bindings gain spatial refs. Concentration does not ship even the\nflat save today (see above). That the filter can roll is inferred from the\nrng the hook evaluator receives\n(`condition_definition.rs:937`); no test asserts a d20 filter yet.\n\n## Misuse\n\n- Filing \"the kernel cannot see damage\" as a substrate gap: the kernel has no\n damage concept; it has `ResourceDelta` events and condition hooks. Two\n lanes and one lead filed this in 2026-08 before reading\n `condition_definition.hooks`.\n- Modelling a forced save as a reaction window.\n- Host-side watches (`kill-xp-grant` shape) for rules that must be atomic\n with the hit — those are for grants and narration, not for saves.\n- Expecting `$event.detail.delta` inside the **consequence template** the hook\n invokes: event detail is available on the hook gate/expression only. Put\n the CON save (or any delta-dependent gate) in `detail_filter_source` when\n ability scores are not required; put ability-score saves in the template\n with a baked DC when scores are required (DC 10 equals the SRD DC for\n damage below 22).\n- Expecting `Layer2.TurnStart` hooks to see `actor_id` today — the kind is\n registered but detail fields are not wired into hook evaluation; prefer\n `expires_at_boundary: turn_start` for per-turn counters.\n",
227
+ "patterns/consumable-inventory-consume": "# Consumable inventory consume\n\n## Name\n\n`consumable-inventory-consume` — Drink/use a carried stackable item through\none world verb whose target is the item\n\n## Problem\n\nA stackable inventory item (potion, scroll dose) must apply its own effect to\nthe carrier and remove one unit from the stack when used, and must fail\ncleanly when the carrier does not hold it. A creature should see ONE \"use a\nconsumable\" action, with exactly the consumables it carries as targets — not\none verb per item that every creature sees whether or not it holds the item.\n\n## Forces\n\n- The kernel binds a consequence to the ACTION, not to the affordance\n template: `r_manipulate` applies `action_definitions.on_success`\n (the world API). Several\n templates that share one action therefore share its consequence.\n- An outcome template may carry BOTH `manipulation_action_id` and an\n `outcome_expression_source`: `commit_resolved_manipulation` applies the\n action's frame first, then executes the selected template's outcome\n expression with the same binding context (`execute_outcome_expression`).\n An `invoke_outcome_graph(...)` there is the per-template effect seam; a\n graph node's outcome template carries its own `consequence_template_id`.\n- `RemoveItem { source: TargetItem }` removes from the dispatch target\n (`r_apply_consequence/remove_item.rs`); removing the last unit deletes the\n entity ([remove-item-deletes-stack](../repairs/remove-item-deletes-stack.md)).\n- When the item is spent on something ELSE (a key used on a seal, the target\n being the seal), remove it with\n `RemoveItem { source: { ActorInventoryItem: { actor_ref: \"Actor\", item_def_id } } }`\n instead: its prevalidate rejects the attempt atomically when the actor holds\n none, so that verb needs no separate possession check (elven-mini's\n `author/tomb-key.ts`).\n- The kernel derives target niches for an item, among them its\n `entity_def_id`, its home state (`core/owned`, `core/contained`,\n `core/grounded`), its tags and `on_consume:`/`on_destroy:` facts\n (the world API). A carried item is\n therefore a `core/owned` target the carrier's manipulation context lists.\n- For a carried target item, `r_manipulate` re-checks the template predicate\n (`revalidate_item_source`) against a NARROWER niche set: `item:<id>` and the\n item's `entity_def_id` only, no home state and no tags. A template predicate\n that reads `core/owned` or a tag fails there (`stale_item_source` /\n `predicate-fail`, measured live in sk-jay0.1.23.36.22.17). Put those facts on\n the niche, not on the template predicate.\n- A gate that KEEPS the item is a different job: put\n `actor.has_item('<item_def_id>')` on the affordance predicate. The DSL\n `items` pool carries the acting body's directly-carried items since sk-vjh.7\n (proof anchor: the `manipulation_facts_expose_carried_items_to_has_item`\n unit test in `r_manipulate/selection/candidates.rs`); see\n [has-item-dead-in-manipulate](../repairs/has-item-dead-in-manipulate.md) for\n the retired gotcha.\n- SRD potions are Bonus Actions; heal magnitude is dice (`2d4 + 2`).\n\n## Solution\n\n1. Stackable `entity_definitions` for each consumable (`stackable = true`),\n tagged with a consumable tag (srd-cc: `srd.consumable`). Only items that own\n a template carry the tag, so the niche never offers a target no template\n resolves.\n2. ONE target niche with `provider = \"entity\"`: the consumable tag AND\n `core/owned` (srd-cc: `srd/consumable`,\n `target.has_niche('srd.consumable') && target.has_niche('core/owned')`).\n3. ONE action (`spellkave_define_action`, no affordance of its own):\n `self_only = false`, `self_eligible = false`, and `on_success` a shared\n consequence `RemoveItem { count: 1, source: { TargetItem: {} } }`. srd-cc\n sets `required_capability = <bundle>/action/consume`, granted from the\n creature identity tag\n ([identity-tag-capability-grant](./identity-tag-capability-grant.md)).\n `required_capability` does not decide who sees or may use the verb: it is\n checked only when a sender acts through an actor it is not directly bound\n to (the world API).\n4. Per consumable, ONE affordance template on that niche. Its\n `capability_id` is what disclosure keys on — the materialiser offers only\n templates whose `capability_id` the actor holds\n (`affordance_materialiser/mod.rs:76-78`; an empty one is never offered,\n sk-jay0.1.23.36.22.10). Its `spends_channel = <bundle>/economy_channel/bonus`\n makes the drink a Bonus Action: `r_manipulate` meters the template's\n channel (`r_manipulate/mod.rs:556-575`); an action-level `spends_channel`\n meters only `r_react` reactions. Its predicate re-checks the capability,\n because act-time selection does not enforce `capability_id`\n (`sk-jay0.2.46`), and selects the item definition as target\n (`actor.has_capability('<cap>') && target.has_niche('<item_def_id>')`).\n Its outcome template names the shared action AND\n `invoke_outcome_graph('<item>/consume/graph')`. The graph is one terminal\n node whose outcome template carries the item's effect consequence (e.g.\n `ModifyResource` or `ApplyStatus` on `Actor`). The item's\n `on_consume_consequence_id` may name that effect consequence, but the\n kernel only exposes it as an `on_consume:<id>` niche fact\n (`target_niches.rs:132-138`); it never applies it.\n5. Pattern refs in generator + TOML (`// pattern:` / `# pattern:`).\n\nsrd-cc authoring: `playing-the-game/fragments/consume.ts` owns the action,\nniche and shared consequence; `consumeTemplateCalls` adds one template per\nconsumable beside its definition (magic-items). The graph + node pair is\nwritten through verb-runner's `outcomeGraphRowsCall`, the finding #66\nworkaround: `spellkave_write_rows` cannot write a bare graph and its nodes\natomically (`sk-jay0.7.172`). `spellkave_define_behavior` with the\nOutcomeGraph primitive writes a graph with its nodes only for a new action\nit creates itself, so an author outside srd-cc cannot build this pattern\nwith the public verbs today; write the rows as manifest TOML instead.\n\n## TOML example\n\nFrom `packages/spellkave-srd-cc/fixtures/base/playing-the-game/consume.toml`\nand `fixtures/base/magic-items/consumables-potion-of-healing.toml` (generated),\ntrimmed (bundle_id, display names and descriptions omitted):\n\n```toml\n# pattern: consumable-inventory-consume\n[[action_definitions]]\naction_id = \"srd/consume\"\non_success = \"srd/consume/success\" # RemoveItem TargetItem, count 1\nrequired_capability = \"srd/action/consume\"\nself_eligible = false\nself_only = false\nspends_channel = \"srd/economy_channel/bonus\" # meters r_react only; the template's channel meters the drink\n\n[[niche_definitions]]\nniche_id = \"srd/consumable\"\npredicate_source = \"target.has_niche('srd.consumable') && target.has_niche('core/owned')\"\nprovider = \"entity\"\n\n[[affordance_templates]]\ntemplate_id = \"srd/item/potion-of-healing/consume/affordance\"\nniche_id = \"srd/consumable\"\ncapability_id = \"srd/action/consume\"\npredicate_source = \"actor.has_capability('srd/action/consume') && target.has_niche('srd/item/potion-of-healing')\"\noutcome_template_id = \"srd/item/potion-of-healing/consume/outcome\"\nspends_channel = \"srd/economy_channel/bonus\" # the channel r_manipulate meters\n\n[[outcome_templates]]\noutcome_template_id = \"srd/item/potion-of-healing/consume/outcome\"\nmanipulation_action_id = \"srd/consume\"\noutcome_expression_source = \"invoke_outcome_graph('srd/item/potion-of-healing/consume/graph')\"\n\n[[outcome_templates]]\noutcome_template_id = \"srd/item/potion-of-healing/consume/effect\"\nconsequence_template_id = \"srd/item/potion-of-healing/consume/success\" # ModifyResource Actor srd/hp \"2d4 + 2\"\n\n[[outcome_graphs]]\noutcome_graph_id = \"srd/item/potion-of-healing/consume/graph\"\nmax_depth = 1\nmax_draws = 8\nmax_nodes = 1\n\n[[outcome_graph_nodes]]\noutcome_graph_id = \"srd/item/potion-of-healing/consume/graph\"\noutcome_graph_node_id = \"srd/item/potion-of-healing/consume/graph/effect\"\nnode_id = \"effect\"\noutcome_template_id = \"srd/item/potion-of-healing/consume/effect\"\nauthored_order = 0\nterminal = true\n```\n\nThe templates share action and niche with mutually exclusive predicates, so\n`MF-VAL-243` warns once per group (accepted in srd-cc's `pipeline.test.ts`).\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/magic-items-coverage.test.ts`\n (potion-of-healing consume unit).\n- Live: `q4-fanatic-loot.test.ts` (one `srd/consume` row disclosed, the held\n potion as its target, HP rises, the last dose is deleted) and\n `potions-and-recharge.test.ts` (condition applied), both when\n `SPELLKAVE_LOCAL_NODE=1`.\n\n## Related\n\n[has-item-dead-in-manipulate](../repairs/has-item-dead-in-manipulate.md),\n[remove-item-deletes-stack](../repairs/remove-item-deletes-stack.md),\n[loot-table-drop](./loot-table-drop.md),\n[container-with-loot](./container-with-loot.md).\n\n## Known misuse / anti-pattern\n\n- One self-only verb per consumable. Every creature sees every verb whether\n or not it carries the item, and a brain or player cannot tell from the\n context which consumable it holds. This package retired that shape in\n sk-jay0.1.23.36.22.17.\n- Putting the item effect on the shared action's consequence: every template\n would apply the same effect.\n- Reading `core/owned` or a tag in the template predicate: the carried-item\n revalidation does not see those facts and rejects the dispatch.\n- Adding `RemoveItem` to an action that should LEAVE the item with the actor,\n as a stand-in for a possession check. Gate that on the predicate with\n `actor.has_item(...)` instead.\n- Asserting `quantity == 0` after the last dose — the row is deleted.\n- Leaving the template's `capability_id` empty to mean \"anyone may drink\" —\n the materialiser then offers it to nobody, while a direct dispatch that\n passes the predicate still works.\n- Putting `spends_channel` only on the action: the drink is then unmetered.\n\n## SRD features that use this\n\n- `srd/consume` with one template per consumable (sk-jay0.1.23.36.22.17):\n Potion of Healing, all 4 tiers (`srd/item/potion-of-healing*`); Potion of\n Giant Strength (`srd/item/potion-of-giant-strength`); the expressible SRD\n potions (`srd/magic_item/potion-*`: climbing, heroism, resistance, speed,\n water breathing).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`): a\n targeted verb whose target is a creature; both the hit and the miss branch\n remove one item from inventory.\n- Spread Caltrops, Spill Ball Bearings (`srd/item/caltrops/spread`,\n `srd/item/ball-bearings/spill`): a self-only Utilize verb removes one item\n and schedules a `lingering-hazard-zone` pulse.\n",
228
+ "patterns/container-with-loot": "# Container with loot\n\n## Name\n\n`container-with-loot` — Place a container holding items; players take them out\n\n## Problem\n\nA room needs a container (chest, cache, shelf) that visibly holds items a\nplayer can take, with no bespoke \"search\" or \"open\" action authored per\nadventure — reusing the SRD's own generic pickup verb instead.\n\n## Forces\n\n- The SRD already grants every creature a Pick Up action for a loose item on\n the ground OR loose inside a grounded, non-body container (`srd/pickup`,\n SRD 5.2.1 \"Interacting with Objects\" / \"Time-Limited Object Interactions\",\n `packages/spellkave-srd-cc/src/chapters/playing-the-game/fragments/\n pickup.ts`) — authoring a second, adventure-local \"search the chest\" verb\n duplicates a capability the kernel already discloses generically.\n- The kernel derives a contained item's disclosure home (`core/contained`,\n the world API) from the item's own\n `entity_containment` row — no niche, predicate, or action needs authoring\n on the container OR the item for this to work; the container only needs to\n actually CONTAIN the item.\n- An open, lootable container is loose carriage, not a machine port:\n `slot_id`/`direction` stay empty on the `entity_containment` row (an open\n chest is not a socketed part).\n- A per-actor one-shot search gate (the retired \"faucet\" design, superseded\n by this pattern and never merged; PR #3618 shipped the rebuild) forges a fresh item out of nothing\n instead of moving an authored one, and needs an explicit per-actor\n `object_state` seed row for every body the search must work for — which\n itself risks two traps: `actor.stat(<state>)` on a resource with no seeded\n `object_state` row is `UnknownField`, which fails the WHOLE containing\n predicate closed rather than reading the resource's `initial_value`\n (FAIL-CLOSED PRE-SEEDING, `creation-candidate.ts`'s own header note); and a\n placement's own `resources` param clears and reseeds `object_state`, so\n seeding the gate BEFORE the body's own placement silently wipes the seed.\n A gate authored only for the creation candidate also strands every OTHER\n player body, since the gate is per-actor but seeded for exactly one actor\n (sk-jay0.1.23.36.22.3, closed as obsolete once this pattern replaced the\n faucet). None of that machinery is needed here.\n\n## Solution\n\n1. An entity def for the container — the SRD's own `srd/item/chest`\n (`packages/spellkave-srd-cc/fixtures/base/equipment/gear/chest.toml`, tag\n `srd.item.container`) or any other entity def — placed with\n `spellkave_place_entity`. A cross-bundle entity_def reference is legal\n when the defining bundle is in your `depends_on` closure (e.g.\n `depends_on = [\"srd\"]`; the closure check is `MF-VAL-214`); no local\n entity_definition is required just to hold loot.\n2. The loot items placed the same way, then moved inside the container with\n `spellkave_stow_item` (sk-9ll.3) — `item_entity_key` plus\n `container_entity_key` set to the container's key, `slot_id`/`direction`\n both omitted (loose carriage). No actor is needed for a container\n (sk-jay0.3.26.9), so a chest in a world without NPCs is filled the same\n way. With `actor_entity_key` (an actor with a spatial location) and\n `container_entity_key` omitted, the same verb puts the item straight\n into that actor's carriage — the way to hand a reward item to a hero at\n authoring time.\n3. NO verb to author. `srd/pickup`'s niche (`srd/item`, provider `entity`)\n already admits a target tagged `srd.item` that is either `core/grounded`\n or `core/contained`; a body with the `srd.creature` capability grant\n already carries `srd/action/pickup`. Dispatching `srd/pickup` on the\n contained item's own `item:<id>` target ref moves it into the actor's\n carriage and spends one of the actor's free object interactions\n (`srd/economy_channel/object_interaction`) — authored to cover exactly one\n pickup per turn (a second contained item needs a new turn:\n sk-jay0.1.23.36.22.6 finding).\n\n## TOML example\n\nUse the chest and item definitions from the ruleset targeted by your adventure. Include the authored place and the actor’s ordinary object-interaction capabilities to validate the complete workflow.\n\nFor a complete, separate offline graph example use\n`sk docs spatial-minimal-cell --full`; it does not implement this container task.\n\nNo `[[action_definitions]]`, `[[niche_definitions]]`, or\n`[[resource_definitions]]` rows for the container itself — `srd/pickup` is\nbundle-owned, authored once in `srd`.\n\n## Proof\n\n- Offline: `packages/spellkave-adventure-elven-mini` `typecheck` / `test`\n (`author:elven-mini:check`); `packages/spellkave-srd-cc` `test:fast`.\n- Live: `packages/spellkave-srd-cc/src/test/live-self-seeding/scenes/pickup-two-potions.test.ts`\n and `pickup-disclosure.test.ts` — a hero dispatches `srd/pickup` against both\n potions' `item:<id>` target refs through the generic PLAYER `r_manipulate`\n reducer (no elven-mini bespoke action, no admin move of items); the authored\n loft chest itself is pinned offline in\n `packages/spellkave-adventure-elven-mini/tests/offline/seed-facts.test.ts`; and\n `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/\n pickup-container.test.ts`, proving the generic capability against a\n disposable self-seeded scene. The one-pickup-per-turn budget comes from\n the channel capacity (`srd-cc fixtures/base/playing-the-game/action-economy.toml:52-54`,\n the world API);\n neither test asserts that a second same-turn pickup is refused — both\n advance the turn before each pickup.\n\n## Related\n\n[`consumable-inventory-consume`](./consumable-inventory-consume.md) (what a\nplayer does with the item once carried).\n\n## Known misuse / anti-pattern\n\n- A bespoke per-adventure \"search the container\" action that `InsertItem`s a\n fresh item into the actor's inventory instead of moving an authored one\n out of the container — the retired faucet design (never merged; PR #3618 shipped this pattern instead):\n it forges items ex nihilo, needs an explicit per-actor `object_state` seed\n row for every body (else `actor.stat` fails `UnknownField`, closing the\n whole predicate — see Forces), and a gate seeded only for the creation\n candidate strands every other player body. Do not reintroduce it;\n `srd/pickup` needs no per-actor state at all.\n- Authoring a custom niche for \"container contents\" — the kernel already\n derives `core/contained` from the `entity_containment` row itself; no\n niche or predicate authoring closes any gap here.\n- Tagging the container's ENTITY DEFINITION instead of the placed instance\n when a niche or the website compendium needs a per-instance tag — use\n `place_entity`'s own `tags` param on the instance; a definition-level tag\n lands in the overflow basin instead of the intended compendium page.\n\n## SRD features that use this\n\n- Elven-mini's loft chest (`elven_mini/adventure/item/loft_chest_1`, 2x Potion\n of Healing, sk-jay0.1.23.36.22.2 — design §6, L-4 loop pilot).\n",
229
+ "patterns/cross-party-capability-gate": "# Cross-party capability gate\n\n## Name\n\n`cross-party-capability-gate` — My condition gate must read the OTHER party's capability\n\n## Problem\n\nA condition on one creature must open or close based on a capability held by\nsomeone else in the same roll — the attacker has Darkvision, the attacker has\nSee Invisibility, the target still has a counter-sense. A gate that only sees\nthe bearer's own facts silently fails closed (`has_capability` → false).\n\n## Forces\n\n- Condition `gate_predicate_source` evaluates against the roll-bias fact pool,\n not the affordance-selection pool.\n- Before sk-609b.16 that pool carried distance only; capability facts were\n absent, so every `actor.has_capability(...)` in a gate was always false.\n- ADR-0045 D-4 forbids a second `capability` table scan — the gate pool must\n reuse `subject_capability_facts`.\n- Actor and Target subjects both matter: In Darkness gates on the actor;\n Invisible gates on the attacker while the condition sits on the target.\n- **The two subjects do not see the same capabilities.** `actor.has_capability`\n folds identity-tag, equipped-item and condition grants (and suppression);\n `target.has_capability` reads only the target's raw `capability` rows\n (the world API,\n `:185-201` vs `:346-351`). A gate on a *target's* granted sense (e.g. See\n Invisibility from the condition) is therefore false. Keep counter-capability\n reads on the actor, as the shipped gates below do (decision `sk-jay0.2.48`).\n\n## Solution\n\n1. **Kernel (already shipped sk-609b.16):**\n `manipulation_spatial_gate_facts` populates `capabilities` via\n `subject_capability_facts(ctx, Some(actor_ref), Some(target_entity_ref))`.\n Every roll-bias seam goes through `roll_bias::resolve`.\n2. **Content:** author the condition with a gate that names the counter-capability:\n - In Darkness on the actor:\n `gate_predicate_source = \"actor.has_capability('srd/capability/darkvision') == false\"`\n + actor-side `srd/attack_roll` Disadvantage.\n - Invisible on the target:\n `gate_predicate_source = \"actor.has_capability('srd/capability/see_invisibility') == false\"`\n + target-side `ResolutionCheck` Disadvantage (and a twin actor-side\n Advantage on `srd/attack_roll`).\n3. **Counter-capability grant:** See Invisibility is a timed condition with\n `grants_capability_while_active = [\"srd/capability/see_invisibility\"]`\n ([condition-grant-and-suppression](./condition-grant-and-suppression.md)).\n4. **Dark node entry:** apply In Darkness via\n `spatial_niche_attachment.on_entry_action_id` (idiom:\n [authored-dark-cave](../examples/authored-dark-cave.md)) — do not invent a\n place-level env-state fact for the roll-bias pool.\n\n## TOML example\n\nFrom `packages/spellkave-srd-cc/fixtures/base/playing-the-game/perception-conditions.toml`\n(generator: `src/chapters/playing-the-game/fragments/perception-conditions.ts`):\n\n```toml\n[[condition_definitions]]\ncondition_definition_id = \"srd/condition/invisible\"\ngate_predicate_source = \"actor.has_capability('srd/capability/see_invisibility') == false\"\nmodifier_template_id = \"srd/condition/invisible/attack_disadvantage\"\n\n[[modifier_templates]]\nmodifier_template_id = \"srd/condition/invisible/attack_disadvantage\"\napplies_to = \"ResolutionCheck\"\ndelta_kind = \"Disadvantage\"\n```\n\n## Proof\n\n- Server: `gate_predicate_reads_injected_actor_and_target_capability_facts`\n in `server/.../roll_bias.rs`.\n- Design: `packages/spellkave-srd-cc/docs/substrate-verdicts/perception-kernel-design.md`.\n- Offline fixture pins on the generated perception-conditions rows.\n\n## Related\n\n[condition-grant-and-suppression](./condition-grant-and-suppression.md),\n[before-filing-a-kernel-gap](./before-filing-a-kernel-gap.md),\n[offer-vs-resolution-roll](./offer-vs-resolution-roll.md).\n\n## Known misuse / anti-pattern\n\n- Filing a kernel gap for \"gates can't see the other party\" without grepping\n `selection/entity_facts.rs` and `roll_bias.rs` first.\n- Baking a place env-state into the roll-bias pool instead of ApplyStatus on\n entry (violates the five binding conditions in the design note).\n- A second raw `.capability().entity_id()` scan outside the one populator.\n\n## SRD features that use this\n\n- In Darkness / Darkvision (species traits + Darkvision spell grant).\n- Invisible / See Invisibility / (later) Truesight.\n",
230
+ "patterns/damage-type-routing": "# Damage-type routing via defense tags\n\n## Name\n\n`damage-type-routing` — Damage-type routing via defense tags\n\n## Problem\n\nI need fire/cold/etc. damage that respects immunity, resistance, and vulnerability without a kernel damage subsystem.\n\n## Forces\n\n- HP writes stay `ModifyResource`; only the amount is typed.\n- Resistance must not double-roll dice; immune must short-circuit.\n- Item slots that carry positive magnitude must not double-negate.\n\n## Solution\n\nUse `routeDamage` / `routeDamageMagnitude` from `@spellkave/world-author` (re-exported by shared tool runtime).\nTag defenses as `damage_immune:<type>`, `damage_resist:<type>`, `damage_vulnerable:<type>`.\nGuide: [`damage-type-routing.md`](../damage-type-routing.md).\n\n## TOML example\n\nCopied from `packages/spellkave-world-author/docs/examples/damage-type-routing.toml`\n(the shape `routeDamage` emits in srd-cc `src/chapters/spells/spell-behaviors.ts`):\n\n```toml\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"damage_routing/cast_fire_bolt/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let dmg = 8d6; -cond(target.has_tag('damage_immune:fire'), 0, cond(target.has_tag('damage_resist:fire'), dmg / 2, cond(target.has_tag('damage_vulnerable:fire'), dmg * 2, dmg)))\"\nresource = \"damage_routing/hp\"\n```\n\n## Proof\n\n- The worked example above: `docs/examples/damage-type-routing.toml`, validated by\n `packages/spellkave-world-author/src/__tests__/doc-evidence-examples.test.ts`.\n- The helpers: `packages/spellkave-world-author/src/__tests__/damage.test.ts`.\n- srd-cc offline: `src/test/offline/spells-coverage.test.ts` (BL-57),\n `thrown-consumables.test.ts`, `area-hazards.test.ts`.\n\n## Related\n\n[computed-literal](./computed-literal.md), [lingering-hazard-zone](./lingering-hazard-zone.md).\n\n## Known misuse / anti-pattern\n\nHand-rolling a different ladder order. Putting defense tags on capability_definition_tag. Negating both in the item slot and at the write site.\n\n## SRD features that use this\n\n- Every typed SRD spell and breath/area monster attack that calls `routeDamage`\n (Fireball, Scorching Ray, dragon breath, …). **Not** the baked Multiattack\n ordinals: they subtract raw damage (see\n [`multiattack-ordinals`](./multiattack-ordinals.md); `sk-jay0.3.10.5`).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`).\n- Caltrops pulse (`srd/item/caltrops/spread/pulse`): 1 Piercing, routed with\n `subject: \"actor\"` because the pulse binds each occupant as Actor.\n",
231
+ "patterns/derived-value-mechanism": "# Derived value mechanism (macro vs baked stat vs effective vs literal)\n\n## Name\n\n`derived-value-mechanism` — Which mechanism computes a number\n\n## Problem\n\nI have a number that is computed rather than stored (a proficiency bonus, an ability modifier, a DC) — which mechanism do I author it with, and where is each one illegal?\n\n## Forces\n\n- Some subjects have a live feeding fact (a PC's level); others have none at\n run time (a monster's CR is documentary), so one rule may need two\n routes.\n- `ModifyResource.delta_source`/`ModifyChannel.delta_source` are parsed\n act-time with the SAME world macro closure the validator already admits\n them against (`crates/spellkave-validate/src/refs.rs`'s\n `check_frame_write_dsl_expr`) — a `macro(...)` there resolves against\n live `dsl_macro_definition` rows the same way a resolution predicate\n does; only an UNDEFINED macro id still fails closed\n (`MF-DSL-MACRO-UNKNOWN`).\n- Macro bodies are leaf-only — a macro cannot call another macro;\n composition happens at the call site.\n- `stat(...)` / `effective(...)` fail **closed** on an absent fact\n (`UnknownField`); `has_tag` / `has_capability` / `has_item` / `has_niche`\n fail **open** (`false`).\n- Integer division truncates toward zero, not floor.\n\n## Solution\n\nFour mechanisms; pick the FIRST row that matches:\n\n| The number is… | Use | Row kind / read |\n|---|---|---|\n| adjusted by active conditions / equipment at read time (AC, roll bias) | `effective(...)` over a seeded base | effective-int read |\n| applied CONDITIONALLY and a live feeding fact exists on the reader | DSL macro inside `cond(...)` | `dsl_macro_definitions`; `macro('<id>', <arg>)` |\n| an UNCONDITIONAL per-entity constant read by archetypes shared across subjects with and without a feeding fact | **baked stat**, seeded per entity, fail-closed | `resource_definitions` + `entity_definition_initial_state`; `actor.stat('<id>')` |\n| a task-shaped, scene-owned fact (this cliff is DC 15) | authored literal | plain number in the row |\n| a constant the SOURCE declares on one item, which no feeding fact of its wielder reproduces (Specter Life Drain \"7 (2d6)\" with Strength 1) | source-derived literal in that item's own slot, generated from the stat block and never typed | `entity_definition_item_dsl_source`, e.g. `2d6 + (0)` |\n| an entity-shaped fact (this guard's stubbornness) | NEVER a literal — one of the three above | — |\n\nWhere both a macro and a baked route encode the same rule, the generator\nreads ONE source table for both so they cannot disagree; the two ids may\nshare a literal (one concept, two row kinds — separate tables, no\ncollision) but they are different reads: grep for both when auditing.\n\nWhere macros are legal: any gate-shaped int/bool predicate\n(`resolution_predicate_source`, `order_roll_source`, offer predicates),\n`entity_definition_item_dsl_source.source` (item slots, `MF-VAL-318` parse / `MF-VAL-329` unresolved `stat`/`effective` ids), and\n— as of sk-awlo — `ModifyResource.delta_source`/`ModifyChannel.delta_source`\n(the world API\nparse with `act_time_compiler_definitions(ctx)`, the same act-time world\nclosure `order_roll_source`/`movement_cost_expression_source` use). Prefer\nthe item slot for reusable ATTACKER math shared across many weapons/actions\n([`item-sourced-damage`](./item-sourced-damage.md)); a `delta_source`\nmacro call is for a one-off, non-item-sourced number (a class-feature\nheal/damage formula, a channel budget grant) that doesn't warrant its own\nitem slot.\n\nRounding: floor-shaped formulas need the correction idiom\n`+ cond(rem < 0, -1, 0)`; truncation-shaped ones must NOT get it.\n\nStorage: per-actor numeric facts are `resource_definitions` (`stat` /\n`effective` ids must resolve to a kernel fact, a `resource_definitions` row\nor an `object_state_definitions` row — `MF-VAL-329`,\n`crates/spellkave-validate/src/refs.rs:86-92`); `max_value` is a safety ceiling, the real\nper-instance value is an explicit initial-state seed; `ModifyResource`\nauto-seeds an absent row from `initial_value`. A predicate that reads\n`stat`/`effective` on a target therefore **declares a seed precondition** —\nguarantee the seed in the definition, never re-introduce an offer-predicate\ngate for it (a target-fact read in an offer predicate also forces `Place`\nlocality).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/equipment/weapons/dagger.toml`\n(macro on an item slot) and\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(baked stat + `effective` in a resolution predicate):\n\n```toml\n[[entity_definition_item_dsl_source]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/weapon/dagger\"\nslot = \"srd/damage\"\nsource = \"1d4 + (max(macro('srd/strength_modifier'), macro('srd/dexterity_modifier')))\"\n\n[[action_definitions]]\naction_id = \"srd/attack/melee\"\nresolution_mode = \"Stochastic\"\nresolution_predicate_source = \"let attack_roll = d20; macro('srd/attack_roll_hits', attack_roll, attack_roll + macro('srd/ability_modifier', cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.property.finesse'), max(actor.effective('srd/str'), actor.effective('srd/dex')), actor.effective('srd/str'))) + (actor.stat('srd/proficiency_bonus')), (target.effective('srd/ac')), cond(actor.has_capability('srd/class-feature/fighter/champion/improved-critical'), 19, 20))\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/modifier-units.test.ts` and\n `attack-roll-units.test.ts` (rounding shapes, macro bodies)\n- `packages/spellkave-srd-cc/src/test/offline/derived-units.test.ts`\n (passive perception and provenance; its note that spell save DC is\n deferred is stale)\n- `crates/spellkave-validate/src/lib.rs:3625-3643` (`MF-VAL-318`: item\n slots are macro-aware) and `crates/spellkave-validate/tests/cross_row_refs.rs`\n (`MF-VAL-329` unresolved `stat`/`effective` ids)\n- the world API's\n `delta_source_macro_call_resolves_with_definition_present_and_fails_without`\n (sk-awlo) — a `delta_source` calling `macro('t/one')` resolves when the\n definition is live and still fails closed with `MF-DSL-MACRO-UNKNOWN`\n when it is not. The test drives the parser with a hand-built macro list;\n it does not read live `dsl_macro_definition` rows, so the act-time wiring\n itself has no direct test\n\n## Related\n\n[`dsl-grammar`](../dsl-grammar.md) (`cond`, `let`, `macro`, `stat`,\n`effective`), [`computed-literal`](./computed-literal.md) (a number\ncomputed outside the DSL entirely),\n[`effective-condition-modifiers`](../repairs/effective-condition-modifiers.md),\n[`sibling-resource-predicate-seeds`](../repairs/sibling-resource-predicate-seeds.md),\n[`item-sourced-damage`](./item-sourced-damage.md).\n\n## Known misuse / anti-pattern\n\n- Migrating a call site from the macro route to the stat route without\n checking what the affected entities seed (a five-hour all-attacks outage\n was exactly this: fail-closed doing its job).\n- A literal for an entity-shaped fact, or N difficulty tiers × M skills as\n generated rows — one generic row plus world state.\n- A second mutable \"proficiency bonus\" row on a PC that creation must keep\n in sync with level (derived state is derived).\n- Applying the floor-correction idiom to a truncation formula (breaks the\n lowest band).\n- **A `ForEachActorInRadius` body predicate ordering `stat(...)`/`effective(...)`\n before `has_tag`/`has_capability`/etc.** (sk-awlo, 2026-08-23). Such a\n predicate is evaluated against EVERY actor co-located with the frame\n write's center, not just the intended subject — a fail-closed `stat` read\n on a bystander that never bound that resource (a training dummy, an\n object, a corpse) throws `UnknownField`. Before sk-pgsm that aborted the\n WHOLE consequence, including an earlier legitimate write on the real\n target (`srd/attack/unarmed-strike/damage/success`'s HP subtraction rolled\n back when the Monster Death guard, ordered second, threw on a co-located\n training dummy). Today the loop skips that bystander and records a hidden\n `write_failure` provenance row; parse errors and other evaluation errors\n still abort (the world API).\n A skipped bystander is still a silently unapplied guard, so the rule\n stands: inside a `ForEachActorInRadius` predicate, always test a\n fail-open set-membership fact FIRST — `&&` short-circuits left-to-right, so\n an untagged/uncapable bystander never reaches the fail-closed read at all.\n A single-subject (non-radius) guard is NOT at risk this way — the target is\n always a real, resolved subject — so this rule is specific to radius/\n multi-candidate predicates, not derived-value authoring generally.\n\n## SRD features that use this\n\n- **Spell save DC / spell attack** = 8+PB+spellcasting_mod / PB+mod (srd-cc L12d).\n\n\n- Proficiency Bonus (macro from `srd/level` for PCs, baked from CR for\n monsters), the six ability-modifier macros, AC via `effective`, DCs as\n scene literals. SRD tables, ids and the PC-level/monster-CR rule:\n [`derived-values.md`](../../../spellkave-srd-cc/docs/derived-values.md).\n",
232
+ "patterns/dialog-choice-slots": "# NPC dialog choice slots\n\n## Name\n\n`dialog-choice-slots` — NPC dialog choice slots (numbered Answer 1..N palette)\n\n## Problem\n\nI need an NPC conversation with a small fixed set of answers (a menu, a quest accept/decline, a wizard step) without free text silently committing world state and without one affordance per option.\n\n## Forces\n\n- Free text **proposes**, it never commits (ADR-0096 D-7): \"I choose\n Ranger\" must not draft Ranger. **Shipped exception:** character creation\n turns an *exact* spoken label of the open closed menu (\"Ranger\") and the\n words \"confirm\"/\"discard\" into a pick\n (`packages/spellkave-adventure-runtime/src/dm/creation/draft-state.ts:207-240,300-312`).\n Whether that is parse-to-commit under D-7 is an open decision\n (`sk-jay0.1.48`); do not copy it into new dialogs until it is settled.\n- One affordance per class/species/quest answer explodes row counts and\n puts content in the palette that the NPC should be speaking.\n- The NPC, not the player, decides how many answers are open right now.\n- A slot fired without any utterance must succeed; an optional comment\n should still be heard as speech.\n- Talking NPCs must not need author access to run a conversation.\n\n## Solution\n\nOne dialog model for every conversation, composed from a **small fixed\npalette** the NPC provides:\n\n| Piece | Shape | Role |\n|---|---|---|\n| Talker tag | `srd.dm_npc.talker` (defined by the `dm` bundle) on the NPC's placement | composes who offers answers |\n| Niche | `provider = \"entity\"`, `target.has_niche('<talker tag>')` | answers are NPC-provided affordances |\n| Open-count resource | int `0..N` on the NPC, initial 0 | how many answers are open |\n| Answer k | `communicate` affordance gated `target.stat('<open>') >= k` | generic label `Answer k`; NPC speaks the option text |\n| Ask-menu N | ordinary self act carrying question and exactly N dispatch labels | inscribes the question and opens its occurrence in one frame |\n| Palette maintenance | self-only state setters, granted by the talker tag | closes/resets the palette and selects authored fixed dialogs |\n\nFiring a slot inscribes one speech trace whose payload carries the slot's\n`action_id`, the gate-admitted `occurrence_id` when bound, and the optional\ncomment as `text`. An authored `ui.response-slot=k` action tag identifies the\nslot for clients without parsing labels or ids. Presentation resolves words\nfrom the visible answered occurrence; missing or legacy history stays neutral.\nThe NPC brain decides on\nthe **acted id**; spoken words are context, except for the creation\nexception above. Talk state (which step, what was drafted) lives in the\nNPC's process memory — there are no `dialog/last-choice` or `dialog/step`\nworld rows (character creation rebuilds its draft from the speech history\nafter a restart; see [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)).\n\nThe same palette serves a **wizard** (draft in memory, a one-slot Confirm\nquestion and a Discard handle — see\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)) and **simple\ntalk** (a slot *is* the answer).\n\n## TOML example\n\nThe generated DM palette provides fixed Answer actions. The following\nfields show the slot and its speech write; its occurrence predicate must\nalso name the authored prompt that admits that response:\n\n```toml\n[[action_definitions]]\naction_id = \"dm/dialog/choice/1\"\nbundle_id = \"dm\"\ndescription = \"Numbered dialog answer 1. The NPC speaks the option text; this label stays generic.\"\ndisplay_name = \"Answer 1\"\nnon_steering = true\non_success = \"dm/dialog/choice/1/success\"\nrequired_capability = \"dm/action/dialog/choose\"\nresolution_mode = \"Deterministic\"\n\n[[action_definition_tag]]\naction_id = \"dm/dialog/choice/1\"\nbundle_id = \"dm\"\nsource = \"manifest\"\ntag = \"ui.response-slot=1\"\n\n[[affordance_templates]]\nbundle_id = \"dm\"\ncapability_id = \"dm/action/dialog/choose\"\ndisplay_name = \"Answer 1\"\nniche_id = \"dm/niche/dialog\"\noutcome_template_id = \"dm/dialog/choice/1/outcome\"\npredicate_source = \"target.stat('dm/dialog/open') >= 1\"\ntemplate_id = \"dm/dialog/choice/1/affordance\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"dm/dialog/choice/1/success\"\n\n[consequence_frame_writes.frame_write.Inscribe]\ncarry_addressee = true\ncarry_dispatch_text = true\ncarry_occurrence = true\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"ActorSpatialRef\"\npayload_json = '{\"text\":\"\",\"action_id\":\"dm/dialog/choice/1\"}'\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-dialog-slots.test.ts`\n- `packages/spellkave-adventure-elven-mini/tests/offline/mira-talk.test.ts` (simple\n talk cycle: greet → open=3 → choice/2 → send-off → open=0)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/player/dm-creation/creation-flow.test.ts`\n (candidate sees `dm/dialog/choice/k` after the DM's first cycle)\n\n## Related\n\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`quest-composition`](./quest-composition.md) (accept/decline slot as the\nquest giver), [`directed-speech-anchor`](./directed-speech-anchor.md) (the\nspeech trace; note the DM slot carries the addressee but anchors at the\nspeaker, `ActorSpatialRef` — `srd-cc fixtures/dm/manifest.toml:2364-2368`), [`advancement-choice`](./advancement-choice.md)\n(the menu members a wizard step lists).\n\n## Known misuse / anti-pattern\n\n- Matching the player's sentence against option labels as the save path.\n- One affordance per class / species / background / quest.\n- Rewriting generic action display names for each conversation; occurrence-bound\n question/option presentation supplies the visible words instead.\n- Per-NPC hardcoded slot lists in TypeScript — composition is the talker\n tag plus DSL gates on the NPC's own open-count.\n- Granting a talking NPC author access just to run a menu.\n\n## SRD features that use this\n\n- Aldwin's character-creation wizard and level-up dialogue; Mira's bar talk;\n every elven-mini quest giver's accept/decline slot. Ids, `.mdsl` dialog\n files and acceptance list:\n [`npc-dialog-choice-slots.md`](../../../spellkave-srd-cc/docs/npc-dialog-choice-slots.md).\n",
233
+ "patterns/directed-speech-anchor": "# Directed speech anchor (anchor says WHERE, payload says TO WHOM)\n\n## Name\n\n`directed-speech-anchor` — Directed speech anchored at the addressee's place\n\n## Problem\n\nI need an NPC or player to say something to someone — broadcast to the room or directed at one body — so the right bodies perceive it and it does not follow anyone around.\n\n## Forces\n\n- An `Inscribe` anchor answers one question only: *where* is this thing.\n Who it was aimed at, what was said, who left it — payload.\n- An entity anchor makes the trace travel with that entity: utterances\n accumulate on a person and are handed to whoever later stands next to\n them (a hero once perceived a stranger's entire character-creation\n exchange this way). It buys nothing: an entity anchor admits by\n co-location like any other.\n- There is no recipient column, on purpose (ADR-0040 / ADR-0095): the\n addressee routes nothing.\n- `carry_addressee` on a dispatch with no entity target fails at binding\n validation — deliberate, so readers never probe for a \"usually there\"\n key.\n- Speech is not a property of the room: attaching a speak niche to places\n leaves every unattached place silent.\n\n## Solution\n\n- **Who may speak** is an actor-carried capability from a vocal-modality\n tag ([`identity-tag-capability-grant`](./identity-tag-capability-grant.md));\n **who may be addressed** is the entity-provided communicable niche from\n the creature tag; a corpse is excluded by `target.status('<dead>') == false`\n on the affordance. No `spatial_niche_attachments` for either.\n- **Broadcast / self-shaped** speech anchors at the speaker's place\n (`ActorSpatialRef`).\n- **Directed** speech anchors at the addressee's **place**\n (`TargetSpatialRef`) so ordinary co-location admission delivers it\n there, and names the addressee in the payload (`carry_addressee`).\n Never `TargetEntityRef`. One shipped exception: the DM dialog answer\n slots (`dm/dialog/choice/N`) carry the addressee but anchor at the\n speaker (`ActorSpatialRef`, `srd-cc fixtures/dm/manifest.toml:2364-2368`),\n which works because the talker and the answering hero share a place.\n- Declare the payload contract on the trace kind (`schema_json`, flat\n key → type, `?` for optional); a required addressee is guaranteed by\n `carry_addressee`, not by the schema. `carry_dispatch_text` copies the\n dispatch's `dispatch_text` into `text`\n (the world API); since\n `srd/speech` requires `text`, a directed speak with no utterance fails the\n schema.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/speech.toml`\n(`srd/speak-to`, directed):\n\n```toml\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/speak-to/success\"\n\n[consequence_frame_writes.frame_write.Inscribe]\ncarry_addressee = true\ncarry_dispatch_text = true\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetSpatialRef\" # addressee's current place, never TargetEntityRef\npayload_json = \"{}\" # kernel fills text (from the dispatch's dispatch_text) + addressee\n\n# trace kind contract:\n# [[trace_kind_definitions]] kind_id = \"srd/speech\"\n# schema_json = '{\"text\":\"string\",\"addressee\":\"integer?\"}'\n# perceptible_for_ticks = 0 (an event — see trace-perceptibility-window)\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/speech.ts`\n (asserts anchor and payload separately; walks a body out / speaks /\n walks it back in)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/telepathy.ts`\n- Demo: `openspec/specs/world-knowledge-and-perception/demos/sk-n16-speech-anchor-and-temporal-admission.md`\n\n## Related\n\n[`trace-perceptibility-window`](./trace-perceptibility-window.md) (event\nvs mark), [`party-extent-grant`](./party-extent-grant.md) (addressing\nacross graphs), [`dialog-choice-slots`](./dialog-choice-slots.md) (slots\ninscribe this trace), [`communicate-with-actor`](../examples/communicate-with-actor.md),\n[`interaction-dsl-and-world-authoring`](../interaction-dsl-and-world-authoring.md)\n§ Trace Inscription.\n\n## Known misuse / anti-pattern\n\n- Anchoring a spoken line to the person spoken to (`TargetEntityRef`).\n- Authoring place attachments for speak verbs.\n- Treating `payload.addressee` as routing — anyone at the anchor perceives\n the trace.\n- Letting the creature tag or a language tag grant speech.\n\n## SRD features that use this\n\n- `srd/speak-aloud`, `srd/speak-to-room` (speaker-anchored),\n `srd/speak-to`, `srd/communicate/telepathy` (addressee-anchored), DM\n dialogue lines (speaker-anchored with an addressee, see above). Chains, ids and the extent residue:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n",
234
+ "patterns/dm-applied-extent-grant": "# Condition-derived extent (reach activated by an authored act)\n\n## Name\n\n`dm-applied-extent-grant` — retained lookup name for the retired runtime delta\npattern. Authored condition activation replaces that workaround\n(sk-jay0.3.24.187; ADR-0155's no-grant-leaf decision stands).\n\n## Problem\n\nA gift or agreement should activate cross-graph reach at a story moment.\nSeeding that reach can disclose a remote companion's location and knowledge\nbefore the bond. The carried item must independently matter at command time.\n\n## Forces\n\n- The extent describes reachable targets; possession and bond predicates\n govern whether a command is admitted.\n- `grants_capability_while_active` carries plain IDs. The authored satellite\n `condition_capability_extent_grants` carries extent references.\n- A Party extent resolves instance tags, blueprint tags and existing session\n peers through the shared resolver. A membership tag alone does not activate\n a condition-derived grant.\n- `actor.has_item('<item definition>')` reads directly carried items at offer\n and dispatch. Carrying the stone needs no equipment slot.\n- Raw condition gates cannot depend on effective capabilities or caller scope.\n The bridge uses the Hidden observation floor; stored grants retain their\n authored ceilings.\n\n## Solution\n\n1. Author an ordinary command capability and a bond condition.\n2. Author one extent rule naming that condition, capability and Party tag.\n3. Place the companion with the membership tag. Leave the hero without the\n activating condition.\n4. Have the DM's fixed authored act apply the condition and record the hero's\n marker in one atomic consequence. Record the companion marker after its\n own successful act receipt. The watch resumes from durable markers.\n5. Require the command capability on action and affordance. Gate the stone\n channel on possession and both channels on sender/recipient bond markers.\n Removing a condition source withdraws reach only when no other admitted\n source remains.\n\n## TOML example\n\nGiven admitted condition and capability definitions in `demo`:\n\n```toml\n[[condition_capability_extent_grants]]\nbundle_id = \"demo\"\ncondition_definition_id = \"demo/bond-active\"\ncapability_id = \"demo/command-bond\"\nextent_kind_ref = \"party\"\nextent_ref = \"demo.companion.bond\"\n```\n\nThe activation consequence uses the existing leaf:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"demo/record-bond/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.ApplyStatus]\ntarget_kind = \"entity\"\ntarget_ref = \"TargetActor\"\ncondition_definition_id = \"demo/bond-active\"\n```\n\n## Proof\n\n- the world API: raw gates, suppression,\n independent sources, exclusive expiry and fail-closed behavior.\n- `crates/spellkave-validate/src/refs/condition_extents/tests.rs`: references,\n dependency closure, owner locking and reserved-capability refusal.\n- Elven-mini's unchanged Chapter 1 story assertions protect prebond fog.\n- `author/dm-acts.ts` and `dm/watches/companion-bond-watch.ts` author and\n execute receipt-ordered bond activation; Hesper retains her placed identity.\n\n## Gotchas\n\nMarker seeds follow placement: actor placement can reseed its state.\nThe bond tag remains separate from the shared party sight tag. Extent rules\ncannot name `frontier.*`. Inspect rules with\n`spellkave capability condition-extents`; Doctor checks their references.\nExact export covers this satellite, while parent condition hook source remains\nan existing export coverage gap.\n\n## Related\n\n[Conditions](../../../../docs/data-model-concepts/conditions.md#condition-derived-extents),\n[Party extent](./party-extent-grant.md),\n[Directed speech](./directed-speech-anchor.md).\n\n## Known misuse / anti-pattern\n\nSeeding command reach before the bond, using an item capability as a possession\npredicate, mutating a protected Party authority tag through an act, or using a\nper-play manifest apply to activate a fixed authored bond.\n",
235
+ "patterns/draft-then-confirm-wizard": "# Draft-then-confirm wizard (multi-step form run by an NPC)\n\n## Name\n\n`draft-then-confirm-wizard` — Draft in NPC memory, grant through authored acts after Confirm\n\n## Problem\n\nI need a guided character-creation or advancement form where choices remain a\ndraft until confirmation admits the sheet and inventory changes. Explicit\nname and description adoption can update their bounded text homes earlier;\nfeature and equipment grants wait for Confirm.\n\n## Forces\n\n- Free text proposes a value for explicit adoption (ADR-0096 D-7). The\n creation parser's existing exact-label exception remains an open decision;\n new dialogs should select options by acted slot.\n- Grants follow confirmation, and each successful act precedes the corresponding\n latch (ADR-0096 D-4/D-5).\n- Menus can exceed the sixteen-slot palette and require repeated picks.\n- A talking NPC needs ordinary palette acts; privileged sheet changes use a\n separately admitted DM presence, within its extent.\n- There is no definition inheritance: the blueprint must initialize each\n resource and Text home the finite vocabulary will update.\n\n## Solution\n\n1. Author the shared Answer 1–16 palette and closed-question vocabulary before\n play. Request an ask-menu act with the question and exactly N option labels.\n The same frame inscribes the directed speech and opens its occurrence.\n [Dialog choice slots](./dialog-choice-slots.md) explains the fixed palette;\n [prompt occurrences](./prompt-occurrence.md) explains the bound trace.\n2. Associate the current option list with the observed player body in process\n memory. An acted slot selects that list's option. Large choose-N groups\n offer remaining options until the count is met; a group with no available\n options cannot leave an impossible open question.\n3. Parse supported name, scores and description inputs into proposals. Offer\n explicit adoption. Name and description adoption request bounded text acts;\n appearance updates an existing Public Text state and backstory an existing\n Hidden Text state, preserving ownership and visibility.\n4. Offer Confirm as a one-slot question when the structured draft is complete.\n The historical dedicated Confirm action is disabled (`1 == 0`); its ID\n remains readable in old traces. Independently recheck the draft before\n building the confirmation plan.\n5. Dispatch the finite sheet plan through the admitted DM presence: selected\n identity tags, absolute state values, feature tags and the compiled starting\n kit. Party membership and extent-bearing sight come from the unbound vessel's\n blueprint. Runtime code publishes no grant or prompt manifest.\n6. Advance the completion latch and announce completion only after successful\n receipts. A kit is one atomic frame, including nested items, equipment and\n its completion marker. Separate sheet acts can succeed before a later act\n refuses; the whole wizard is not one transaction. Retain unfinished work\n for retry and use the kit marker to prevent duplicate inventory.\n7. A host restart can reconstruct drafts from retained visible speech and\n compatible menu data. This is replay, not a durable draft snapshot. The\n world-owned body and items persist independently of the NPC's process.\n8. Let the candidate walk the answered questions. Author two input-less\n actions beside Discard, with the same phase gate, and name them in the duty\n document as `creation.wizard.back_action_id` and `forward_action_id` (the\n shared DM bundle ships `dm/creation/back` and `dm/creation/forward`). Back\n asks the question before the open one again and clears nothing; the old\n answer stands until another is acted. A new answer replaces what that\n question held, and a question that takes several picks is reopened whole.\n Forward leaves a reopened question as answered. Name, scores, appearance\n and backstory need neither: their own input actions can be sent again.\n Both actions leave a speech trace like every menu answer, which is what\n the replay of step 7 reads; a restart in the middle of a walk has not been\n tested.\n\n9. Keep the order of the questions as data, not in the NPC's program, and\n send where the dialogue stands with every question. The DM's creation\n wizard does both; [guided dialogue](./guided-dialogue.md) describes the\n step list and the machine side. The advancement wizard does not yet.\n\n## TOML example\n\nThe author seeds fixed question definitions; the runtime selects a question\nand supplies its presentation through the admitted act. The creation offer\nbuilder uses the same one-option shape for Confirm:\n\n```ts\nif (step === null && creationStructuredDraftsComplete(state, catalog)) {\n return offerFromPairs(\"confirmation\", \"confirm:character\", [\n { label: \"Confirm character creation\", pick: { kind: \"confirm\" } },\n ]);\n}\n```\n\nThe ask act carries one label; the player's Answer 1 consumes its occurrence.\nThe NPC then requests the confirmation plan's authored acts. No author delta\nis computed or applied by the dialogue runtime.\n\n## Proof\n\n- `crates/spellkave-npc-host/src/dm/engine/creation_tests.rs` pins the draft\n and its offers on the Rust DM engine: slot binding in catalog order, the\n class change that clears class-dependent picks, the token grammar, the\n vocabulary, and stepping back and forward\n (`native_creation_back_and_forward_walk_answered_questions`,\n `native_creation_back_reopens_a_multi_pick_question_whole`), and that the\n order follows the guide (`native_creation_asks_in_the_order_the_guide_holds`). These are pure\n engine tests; they do not prove live mutation. The TypeScript creation test\n this page named before went with the TypeScript host.\n- `packages/spellkave-srd-cc/src/test/offline/dm-level-up.test.ts` proves finite\n plans and accepted-receipt-before-latch ordering.\n- `packages/spellkave-adventure-runtime/src/dm/dialog/prompt-offer.test.ts`\n pins the atomic ask shape, labels and matching response count.\n- Live creation has no automated acceptance test since the TypeScript host\n was deleted; `just play-host` stages a world where the Rust DM runs it, and\n `apps/classic/PLAYTEST.md` records the hand-played runs.\n\n## Related\n\n[Dialog choice slots](./dialog-choice-slots.md),\n[advancement choice](./advancement-choice.md),\n[tag membership menu](./tag-membership-menu.md),\n[actor-carried feature verb](./actor-carried-feature-verb.md),\n[proactive level-up](./proactive-level-up.md), and\n[offer-gate/consume-guard parity](./offer-gate-consume-guard-parity.md).\n\n## Known misuse / anti-pattern\n\n- Runtime author deltas for prompt definitions, sheet grants or inventory.\n- Treating a completed announcement as proof that a privileged act succeeded.\n- Granting a feature capability without initializing its required resource.\n- Re-parenting the live body to a pregen definition to apply its sheet.\n- Claiming that all creation writes are deferred until Confirm: explicit name\n and description adoption can occur earlier.\n- Copying creation's exact spoken-label convenience into a new dialogue while\n its parse-to-propose decision (`sk-jay0.1.48`) remains open.\n\n## SRD features that use this\n\nAldwin's creation and advancement wizards use these steps. The SRD vocabulary,\nkit composition and world-owned vessel limits are described in\n[character creation](../../../spellkave-srd-cc/docs/character-creation.md).\n",
236
+ "patterns/equip-gated-modifier": "# Equip-gated modifier (numeric stat modifier active while item is equipped)\n\n## Name\n\n`equip-gated-modifier` — Equip-gated modifier (item definition links to a modifier template via `entity_definition_equip_modifier`)\n\n## Problem\n\nAn item (armor, shield, ring, magic item) provides a continuous numeric bonus or replacement (e.g. Armor Class, Speed, saving throw bonus) while equipped in a valid equipment slot on an actor, and that modifier must automatically deactivate when the item is unequipped or removed.\n\n## Forces\n\n- Modifier must track equip state directly from `entity_equipment_slot` without requiring point-in-time condition sync (`ApplyStatus`/`RemoveCondition`) on every equip/unequip path.\n- Multiple equipped items modifying the same stat (e.g. body armor replacing AC + shield adding +2) must compose deterministically through `compose_modifiers_by_shape`.\n- Unarmored actors or actors without the item equipped must not pay any phantom modifier.\n\n## Solution\n\n1. Define the item in `[[entity_definitions]]` with its `slot_compatibility_predicate` using the closed three-form grammar (ADR-0118), e.g. `slot_id == \"srd/slot/chest\"` — not a bare slot id and not `spellkave-dsl`.\n2. Author a `[[modifier_templates]]` row on the target axis (e.g. `srd/ac`), with the appropriate `delta_kind` (`FlatSet` for armor replacement, `Plus` for shield/bonus) and expression.\n3. Link the item definition to the modifier template in `[[entity_definition_equip_modifier]]`:\n - `entity_def_id` = the item definition ID (e.g. `srd/armor/chain-mail`)\n - `modifier_template_id` = the modifier template ID (e.g. `srd/armor/chain-mail/ac_bonus`)\n - `bundle_id` = the owning bundle (e.g. `srd`)\n4. At runtime, the kernel's `fold_effective_int_facts` scans the actor's `entity_equipment_slot` memberships, resolves the equipped items' `entity_definition_equip_modifier` rows, lifts the modifier templates, and composes them into `target.effective('<stat>')`.\n\n## Numeric wearer facts and dependency limits\n\nAn equipped template's numeric value can read current wearer integers with\n`actor.stat('<field>')` and composed integers with\n`actor.effective('<field>')`. Here `Actor` is the wearer, including when\nan outer action reads a Target's equipment. The template's `Target` is not\nbound to either wearer or attacker. Macro expansion uses the same facts.\nOrdinary state changes take effect on the next collection; do not copy a\nwearer stat onto the item or synchronize it with equip callbacks.\n\nThis admission is for numeric values. Template predicates retain their\nexisting world/equipment fact context; a wearer stat/effective read missing\nthere still makes that predicate false. Existing condition-row evaluation\nalso keeps its own context. An equipped value can nevertheless read an axis\nwhose effective value combines already lifted condition rows and other\nlinked equipment modifiers.\n\nEffective dependencies resolve before their consumers. Raw `stat` reads\nremain leaves; they do not read the overlay. Self-dependencies, multi-axis\ncycles, missing dependencies, and uninspectable item sources refuse the\ncollection rather than silently dropping a contribution. All root-reachable\nnumeric branches are inspected, so even an inactive branch can introduce a\nrefused cycle. Directly selected item-source expressions retain their\nexisting one-source-layer limit and evaluate with the same subjects.\n\nPer wearer collection, the admitted graph allows at most 512 distinct axes,\n512 distinct reachable numeric expression nodes (shared expressions and\nselected sources count once), and an effective chain of 64 axes. Each\nexpression retains its DSL evaluation/draw bounds. Verified wearer-free\nsets retain the existing fold and bounds; an unresolved source cannot be\nclassified as wearer-free. Refusal returns no partial overlay. It can also\nprevent ordinary actions, including unequip, whose facts need that fold;\nan authorized author/operator can repair the bad template or link through\nexisting authoring paths, after which normal player actions resume.\n\nStrict handling applies to wearer-reading/source-inspection axes and their\neffective dependencies. Unrelated axes retain legacy lift/composition\nomissions and do not consume the strict graph's node budget. A numeric axis\nwith modifying rows retains the existing zero starting value when no raw\nrow exists, including when another modifier reads that axis effectively.\nAn effective read with neither a raw row nor modifying rows remains unknown.\n\nCurrent target facts are collected eagerly: cyclic gear can also refuse an\naction against its wearer even when that action reads no effective value.\n`EquipItem` validates the prospective graph before its equipment/lifecycle\nwrites: cyclic, unresolved or exhausted dependencies refuse admission. A\nsecond item closing a cycle also refuses. The live fixture proves denied\nPLAYER equip leaves the wearer targetable; publisher-staged legacy bad sets\nretain the collection/refusal and author-repair controls.\n\nPreparation includes earlier equips and resource writes. Pending items use\nthe insertion's resolved `initial_item_state`, definition tags and sources,\nwithout a synthetic entity ID. Earlier condition, tag/text, lifecycle or other\nunprojected writes conservatively refuse before stale gate/source evaluation,\nincluding for literal-only candidates. Split such frames into actions or\nauthor the equip before those writes, with the intended consequences reviewed.\nThis constraint also applies to plain equipment after `Inscribe` (the\nstructured EmitTrace surface), `ModifyChannel`, `OpenSession` or\n`ForEachActorInRadius`; their effects are not projected for this admission.\nResource-before-equip frames also refuse when an active ResourceDelta condition\nhook may run: the resource overlay cannot project its synchronous side effects,\nand preparation does not guess whether a dynamic detail filter will stay false.\nThe guarantee is validity at admission before the candidate's own lifecycle;\nthat hook, later writes or predicate changes can still invalidate the graph.\nAuthor validation emits advisory `MF-VAL-390` for possible cycles, unbound\nTarget reads, unresolved sources or exhausted inspection limits. Ordinary wearer\nraw/effective leaves are valid dependencies, including Dexterity-reading armor;\nthey do not independently emit a hazard. Runtime admission uses the concrete\nwearer snapshot and diagnoses missing leaves there. The doctor check\n`equipped_numeric_dependencies_resolve` reports current bad wearer sets.\nStarting equipment seeded by `Spawn` or `CreateWorldObject` does not pass\nthrough this EquipItem guard. Cyclic starting gear, as well as later state,\ntick or lifecycle changes, can still make its wearer unavailable. The checkout\nstarting-gear audit found zero wearer-reading sets (312 seed rows, 311\ndefinitions); this does not constrain new authoring. Lazy Target evaluation\nis the commissioned P1 follow-up `sk-jay0.2.71`; do not use collection refusal\nas a protection mechanic.\n\nComposition uses the existing law: a `FlatSet` result absorbs `Plus`\nin the same bucket. Include an intended body-armor enhancement in its\nreplacement expression; a separate `Plus` does not augment that replacement.\nThis fact admission does not change that law or complete the separate SRD\nmagic-armor content repair.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/equipment/armor/chain-mail.toml`:\n\n```toml\n# pattern: equip-gated-modifier\n\n[[entity_definitions]]\nbundle_id = \"srd\"\ndescription = \"Chain Mail (Heavy Armor, static AC 16)...\"\ndisplay_name = \"Chain Mail\"\nentity_def_id = \"srd/armor/chain-mail\"\nslot_compatibility_predicate = 'slot_id == \"srd/slot/chest\"'\n\n[[modifier_templates]]\napplies_to = \"srd/ac\"\nbundle_id = \"srd\"\ndelta_kind = \"FlatSet\"\ndisplay_name = \"Chain Mail AC 16\"\nmodifier_expression_source = \"let ac = 16; ac\"\nmodifier_template_id = \"srd/armor/chain-mail/ac_bonus\"\npredicate_source = \"\"\npriority = 0\n\n[[entity_definition_equip_modifier]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/armor/chain-mail\"\nmodifier_template_id = \"srd/armor/chain-mail/ac_bonus\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/scenes/equipped-modifier-wearer-facts.test.ts` (PLAYER values, gates, dependencies, refusal/recovery, isolation and session policies)\n- `packages/spellkave-srd-cc/src/test/offline/armor-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/equipment-coverage.test.ts`\n\n## Related\n\n[`item-sourced-damage`](./item-sourced-damage.md) (wielded weapons), [`derived-value-mechanism`](./derived-value-mechanism.md), [`damage-type-routing`](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\n- Trying to manage armor AC through `on_equip_consequence_id` firing `ApplyStatus` (risks orphan conditions if removal fails).\n- Hardcoding the AC on the actor's initial state and forgetting to recalculate on equip/unequip.\n- Using `Plus` instead of `FlatSet` for base body armor (body armor replaces base AC; use `Plus` for additive buckets, accounting for the FlatSet absorption law above).\n\n## SRD features that use this\n\n- All 13 SRD armors and shields (`fixtures/base/equipment/armor/*.toml`).\n- Magic items granting +N AC or stat bonuses while worn/attuned — intended,\n but not wired: magic armor ships `modifier_templates` (e.g.\n `magic-items/armor/chain-mail-plus-2.toml`) with no\n `entity_definition_equip_modifier` link, so neither its base AC nor its\n bonus applies (bug `sk-jay0.3.19.9`).\n",
237
+ "patterns/extra-action-budget": "# Extra action budget (one-shot channel grant)\n\n## Name\n\n`extra-action-budget` — Extra action budget (one-shot channel grant)\n\n## Problem\n\nI need a feature that gives the actor one extra action this round (Action Surge), without inventing a new kernel primitive.\n\n## Forces\n\n- Standing haste-like bonuses should recompute every gate for as long as a condition holds.\n- One-shot \"this round only\" grants must evaporate on window rollover and must not leak.\n- Suppression (incapacitated FlatSet(0) on a channel) must still win over a positive grant.\n- Authors keep searching for a missing GrantAction arm and filing kernel gaps.\n\n## Solution\n\nUse `ModifyChannel` on the success consequence to grant one full (or signed)\npool of an existing economy channel for the current window. Spend any charge\nresource in the same consequence. Documented in\n[`action-economy.md`](../action-economy.md) §\"Grant one-shot extra budget with ModifyChannel\".\nDo **not** open a substrate verdict for Action Surge until this pattern is tried.\n\n## TOML example\n\nCopied from `packages/spellkave-world-author/docs/action-economy.md (canonical shape; wire into srd/fighter/action-surge via packages/spellkave-srd-cc/src/chapters/classes/index.ts `buildActionSurgeFragment`)`:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"mybundle/ability/second_wind_of_action\"\nordinal = 0\nframe_write = { ModifyChannel = { actor = \"Actor\", channel = \"mybundle/channel/primary\" } }\n```\n\n## Proof\n\n`crates/spellkave-validate/tests/cross_row_refs.rs` (ModifyChannel.channel MF-VAL-312); live channel grant logic in the world API. Fighter charge spend: `packages/spellkave-srd-cc/src/test/offline/martial-features-coverage.test.ts`.\n\n## Related\n\n[action-economy](../action-economy.md), [condition-grant-and-suppression](./condition-grant-and-suppression.md) (suppression beats grant).\n\n## Known misuse / anti-pattern\n\nFiling Action Surge / Indomitable-as-extra-action as a kernel gap without trying ModifyChannel. Using a negative ModifyChannel to model 'cannot act' (use condition FlatSet / capability suppression instead).\n\n## SRD features that use this\n\n- Fighter **Action Surge** (classes.md Level 2) — charge resource is live; extra Primary-channel grant is this pattern.\n- Any one-shot 'act again this round' class feature.\n",
238
+ "patterns/guided-dialogue": "# Guided dialogue (an NPC asks its questions in the order a data tree holds)\n\n## Name\n\n`guided-dialogue` — Steps as data, one machine side per question\n\n## Problem\n\nI need an NPC that leads someone through several questions, where the order\nof the questions, which ones are skipped and which ones hang on an earlier\nanswer are content I can change without touching the NPC's program. A client\nshould be able to show \"answers so far\" and \"what is still ahead\" without\nremembering anything itself.\n\n## Forces\n\n- The order of a guided talk is content. Written into the NPC's program it\n gets copied: once to ask, again to step back, again to clear dependents.\n- A client that keeps its own list of answers must copy the NPC's rules to\n keep that list right, and loses it in another browser.\n- The NPC stays the authority. A client shows what it is sent and offers\n actions; the world decides (ADR-0141, ADR-0073 D-1).\n- NPC documents hold no expressions (ADR-0165 D-2). A step's condition is one\n atom about another step of the same guide.\n- What a question's options are is the kind's knowledge (a class's skills, a\n merchant's wares), not the guide's.\n\n## Solution\n\n1. **Write the steps as data.** A guide is a list of steps in the NPC's\n document. The DM carries it as `creation.guide`. Each step has:\n\n | Field | Meaning |\n |---|---|\n | `id`, `title` | Stable id (opaque to every reader) and a short name for the outline. |\n | `source` | A named option source the kind resolves. The DM kind knows `classes`, `backgrounds`, `species`, `class-skills`, `class-choice-groups`, `class-cantrips`, `class-prepared`, `class-kits`, `kit-equipment`, `pending-name`, `standard-array`, `confirm`. |\n | `options`, `pick` | Inline options `{ id, label, description?, ref? }` and how many are picked (`{ min, max }`), for a talk with fixed answers. |\n | `input` | The step is answered by a typed input (the DM kind knows `name`), not by a pick. An open input step asks no question; the NPC waits. |\n | `show_when` | `{ answered = \"<step>\" }` or `{ unanswered = \"<step>\" }`. One atom, no nesting. |\n | `depends_on` | Earlier steps this one hangs on. A different answer there drops the answers here. |\n | `reopen` | The step can be asked again with Back. Default true. |\n | `paged` | More options than slots are shown in pages. Default: cut at the slot count. |\n | `announce_remaining` | A step with several picks sends how many are left. |\n | `listed` | The step has its own line in the outline. Default true. |\n\n A step takes exactly one of `source`, `options`, `input`. A source belongs\n to one step. A step with nothing to ask is skipped.\n2. **Let the engine walk it.** `crates/spellkave-npc-host/src/guide.rs` finds\n the open question, the answered ones, the draft before a step, and the\n answers that hang on a changed step. It knows no step and no ruleset. The\n kind supplies where a source's options come from and where answers are\n kept. A document without a guide is refused; no order is built in.\n3. **Ask through the palette.** Each question is one ask-menu act\n ([dialog choice slots](./dialog-choice-slots.md)), which opens one\n [prompt occurrence](./prompt-occurrence.md) bound to its speech trace.\n4. **Send the machine side with every question.** The same act carries\n `dispatch_context`; the ask-menu write opts in with\n `carry_dispatch_context`, so the object lands on the trace payload as\n `context` and the SDK joins it to the prompt as `presentation.guide`:\n\n ```json\n {\n \"guide\": 1,\n \"step\": \"skills\",\n \"reopened\": false,\n \"remaining\": 2,\n \"outline\": [\n { \"step\": \"class\", \"title\": \"Class\", \"state\": \"answered\",\n \"answers\": [{ \"label\": \"Fighter\", \"ref\": \"srd/class/fighter\" }] },\n { \"step\": \"skills\", \"title\": \"Skill\", \"state\": \"open\",\n \"answers\": [{ \"label\": \"Athletics\", \"ref\": \"srd/skill/athletics\" }] },\n { \"step\": \"kit\", \"title\": \"Starting kit\", \"state\": \"ahead\" }\n ]\n }\n ```\n\n `state` is `answered`, `open` or `ahead`. A step with several questions has\n one entry per question once its questions are known. `remaining` is absent\n on a single pick. `truncated: true` marks an outline the NPC cut to stay\n inside 48 entries and 8 KiB. There is no step number and no total; a\n reader counts the outline.\n5. **Read it, do not rebuild it.** A client shows the outline as sent. It\n never branches on a step id, never guesses a step from the question's\n wording, and keeps no answer list of its own. A prompt without\n `presentation.guide` (an older host) still shows its question and labels.\n\n## TOML example\n\nThe write that asks a guided question opts into both carriages:\n\n```toml\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"srd/speech\"\nlocation_kind = \"binding\"\nlocation_ref = \"TargetSpatialRef\"\npayload_json = \"{}\"\ncarry_dispatch_text = true\ncarry_addressee = true\ncarry_dispatch_options = true\ncarry_dispatch_context = true\n```\n\nThe steps themselves live in the NPC's document, not in the manifest. Three\nsteps of the DM's creation guide:\n\n```json\n{ \"id\": \"kit\", \"title\": \"Starting kit\", \"source\": \"class-kits\", \"depends_on\": [\"class\"] }\n{ \"id\": \"equipment\", \"title\": \"Equipment\", \"source\": \"kit-equipment\",\n \"depends_on\": [\"class\", \"kit\"], \"paged\": true }\n{ \"id\": \"scores\", \"title\": \"Ability scores\", \"source\": \"standard-array\",\n \"show_when\": { \"unanswered\": \"name\" }, \"reopen\": false }\n```\n\n## Proof\n\n- `crates/spellkave-npc-host/src/guide.rs` (inline tests): the walk follows\n the data order, a hidden step is skipped, a paged step leaves a slot for the\n page turn, a changed answer drops what hangs on it, the outline lists the\n draft and the way ahead and is cut at its bound.\n- `crates/spellkave-npc-host/src/dm/engine/creation_tests.rs`:\n `native_creation_asks_in_the_order_the_guide_holds` (swapping two steps in\n the data swaps the questions, forward and back),\n `native_creation_drops_dependent_answers_by_the_guide`,\n `native_creation_machine_side_lists_the_draft_and_the_way_ahead`,\n `native_creation_refuses_a_duty_document_without_a_guide`.\n- `crates/spellkave-validate/src/guide.rs` (inline tests): every shape rule\n refuses, `show_when` cannot nest.\n- the world API,\n `k5_dispatch_context_is_carried_only_when_opted_in`: the context reaches the\n payload only under the flag.\n- `packages/spellkave-sdk/src/__tests__/audience_trace_presentation.test.ts`:\n the machine side is read from the occurrence's own trace; a malformed one is\n dropped and the question kept.\n- These are engine, kernel and reader tests. The hand-played live run is\n recorded in `ledger/designs/guided-dialogue-tree.md`.\n\n## Related\n\n[Draft-then-confirm wizard](./draft-then-confirm-wizard.md),\n[dialog choice slots](./dialog-choice-slots.md),\n[prompt occurrence](./prompt-occurrence.md), and the\n[context carriage](../interaction-dsl-and-world-authoring.md#carrying-opaque-presentation-context-carry_dispatch_context).\n\n## Known misuse / anti-pattern\n\n- Branching on a step id in a client. Ids are opaque; show titles.\n- Putting anything private into the machine side. Everyone who hears the\n question can read it.\n- Treating the machine side as permission. It is presentation; the server\n reads none of it, and the prompt occurrence and the world decide what may\n be answered.\n- Changing the order of a guide while a draft is open. The NPC rebuilds a\n draft from the dialogue history and resolves a numbered answer against the\n question as it is asked now.\n- A second copy of the order in the kind's program \"for convenience\".\n\n## SRD features that use this\n\nAldwin's hero creation. Its guide is `creation.guide` in the DM duty document.\nThe menu-talker kind does not carry a guide yet.\n",
239
+ "patterns/identity-tag-capability-grant": "# Identity-tag capability grant\n\n## Name\n\n`identity-tag-capability-grant` — Stable identity tags grant stable attempts\n\n## Problem\n\nEvery creature should be able to walk, attack, dodge, rest and attempt checks — how do I grant that once instead of copying capability rows onto every definition, and when is a direct grant still right?\n\n## Forces\n\n- Copying universal capability rows onto every definition is cargo cult\n that drifts; a scenario adopting a blueprint must not re-copy them.\n- Membership of a category (creature, player character) is not the same\n fact as a modality (can produce speech) or a competence (knows a\n language) — conflating them grants speech to corpses or to bodies that\n only *understand*.\n- A capability is eligibility to attempt; the verb's predicate, resources,\n conditions, target, range and equipment still constrain the attempt.\n- The effective capability union is an enforcement concept: direct-row\n listings do not expand tag, equipped-item, or condition grants.\n\n## Solution\n\nAn actor's effective capabilities are the union of four independent\nsources — use each for what it is:\n\n| Source | Use it for | Example |\n|---|---|---|\n| `tag_capability_grant` | stable identity-derived attempts | `<bundle>.creature` → walk, attack, dodge, checks |\n| explicit definition / instance grant | a narrow authored behavior or a sourced choice | a chosen skill proficiency, a DM's watch extent |\n| `entity_definitions.grants_capability_while_equipped` | ability granted while the item occupies an equipment slot | a ring that grants Detect Magic |\n| active condition | temporary behavior or suppression | [`condition-grant-and-suppression`](./condition-grant-and-suppression.md) |\n\nEquipped-item CSVs are folded on read from occupied `entity_equipment_slot`\nrows (same `capability_ids_for_actor` site as identity and conditions;\nsuppression still wins). Unequip drops that item's ids. Do not re-encode a\nworn grant as a condition to work around a missing fold — that was the\npre-sk-54d workaround. Weapon *eligibility* still uses item tags (see the\nSRD capabilities page), not this CSV.\n\nRules of thumb:\n\n- Separate **attempt** from **proficiency**: `check/<skill>` (may attempt;\n from the creature tag) vs `skill/<skill>` (proficient; an explicit\n choice). The predicate adds the bonus only when the second is present.\n- Separate **modality** from **membership** and **competence**: a vocal tag\n grants speech; the creature tag makes a body addressable; a language tag\n records competence. Derive the vocal tag from the source (an\n \"understands only\" line grants nothing).\n- Tags that select rule branches (`<bundle>.monster`) grant nothing; tags\n consumed by equipped-item behavior (weapon range class) grant nothing\n either — every live tag names its concrete reader.\n- Retain a direct grant only when its narrower source can be named.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/creature-identity.toml`:\n\n```toml\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/capability/walk\"\ntag = \"srd.creature\"\n\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/action/attack\"\ntag = \"srd.creature\"\n\n[[tag_capability_grant]]\nbundle_id = \"srd\"\ncapability_id = \"srd/action/dodge\"\ntag = \"srd.creature\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/character-identity-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/creature-units.test.ts`\n (vocal tag derived from the cached `Languages` line, 179 rows)\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-actor-capabilities-no-dup.test.ts`\n (instances do not mirror tag-derived grants)\n\n## Related\n\n[`blueprint-instance-override`](./blueprint-instance-override.md)\n(instances inherit definition tags),\n[`condition-grant-and-suppression`](./condition-grant-and-suppression.md),\n[`directed-speech-anchor`](./directed-speech-anchor.md) (who may speak),\n[`tag-membership-menu`](./tag-membership-menu.md),\n[`affordance-needs-niche-attachment`](../repairs/affordance-needs-niche-attachment.md).\n\n## Known misuse / anti-pattern\n\n- Granting all `skill/*` as a creature or PC baseline.\n- Making the creature tag or a language tag grant speech; using the vocal\n tag to model telepathy.\n- Mirroring tag-derived capabilities into\n `entity_definition_initial_capability` / `actor_capabilities`.\n- Reading `selfStates(kind=\"capability\")` as the effective set — verify a\n tag-derived grant by the tag plus the gated affordance it enables.\n\n## SRD features that use this\n\n- `srd.creature` (walk, Attack umbrella, Dash, Dodge, Help, Drop Prone,\n Stand Up, Utilize, Pickup, Consume, rests, 24 check verbs;\n `fixtures/base/playing-the-game/creature-identity.toml`), `srd.player_character` (Level Up, Claim Victory, Heroic\n Inspiration), `srd.communication.vocal` (Speak), caster class tags →\n `srd/action/magic`. The complete ownership split:\n [`capabilities-and-identity.md`](../../../spellkave-srd-cc/docs/capabilities-and-identity.md).\n",
240
+ "patterns/item-sourced-damage": "# Item-sourced damage (weapon slot read by a shared attack)\n\n## Name\n\n`item-sourced-damage` — Item-sourced damage (the wielded item owns its magnitude)\n\n## Problem\n\nI need to give a weapon — manufactured or a monster's Bite/Slam — its own damage so ONE shared attack verb deals the right amount, without a bespoke action per weapon or per creature.\n\n## Forces\n\n- A per-creature attack verb would appear in every palette that shares the\n capability (a wolf's Bite clone shows up for the fighter).\n- The magnitude must compose with attacker facts (ability modifier) and\n target facts (resistance), which a roll table cannot do.\n- Exactly one site may own the sign: negate in both the slot and the write\n and they cancel; negate in neither and you heal the target.\n- The to-hit side and the damage side must select the **same** ability\n (finesse is \"for the attack and damage rolls\").\n- A tagged weapon with no damage slot must fail loudly, not deal nothing.\n\n## Solution\n\n1. The item carries a **positive magnitude** in an\n `entity_definition_item_dsl_source` row, slot `<bundle>/damage`\n (`<die> + <ability modifier>`; item slots are macro-aware). A ranged\n item carries a second slot for its normal range.\n2. The item carries its identity tags: the weapon tag, the range class\n (`<melee|ranged>`) the shared offer predicate reads, and a documentary\n damage-type tag that the shared write reads for routing.\n3. The **shared attack write** reads\n `actor.equipped_item('<bundle>/slot/main-hand').source('<bundle>/damage')`, negates once, and\n composes the defense ladder\n ([`damage-type-routing`](./damage-type-routing.md)) keyed by the item's\n damage-type tag.\n4. **Natural weapons are wielded items**: tag them with the same weapon +\n range identity (no purchase category / mastery axes), seed them via\n definition-level initial equipment so every spawned instance is born\n with one. Derive the finesse tag per creature by comparing the source's\n damage bonus against both ability modifiers — never assume it.\n\nThe site that owns the `ModifyResource` owns the sign: item slots are\npositive and are negated by the shared write; a spell or trap, which has no\nitem, negates at its own write site.\n\nThe slot is authored vocabulary, not a built-in weapon classification. Declare\nit and use the same slot for equipment seeds, offer gates, to-hit checks and\ndamage reads. ADR-0126 supplies facts only for exactly one existing item in\nthat actor-slot relation; missing, dangling or ambiguous occupancy has no item\nfacts and does not fall back to carried items. Item source expressions retain\nthe surrounding Actor and Target. The legacy `actor.wielded_item` accessor\nremains available, but its minimum-ID selection is unsuitable when unrelated\nequipment must not determine which weapon this pattern reads.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/monsters/giant-rat.toml`\n(a natural weapon is a wielded item):\n\n```toml\n[[entity_definition_initial_equipment]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/creature/giant-rat\"\nequipped_entity_def_id = \"srd/natural-weapon/giant-rat-bite\"\nslot_id = \"srd/slot/main-hand\"\n\n[[entity_definition_item_dsl_source]]\nbundle_id = \"srd\"\nentity_def_id = \"srd/natural-weapon/giant-rat-bite\"\nslot = \"srd/damage\"\nsource = \"1d4 + (max(macro('srd/strength_modifier'), macro('srd/dexterity_modifier')))\"\n\n[[entity_definition_tag]]\nentity_def_id = \"srd/natural-weapon/giant-rat-bite\"\ntag = \"srd.weapon\"\n# + srd.weapon.range.melee, srd.weapon.property.finesse (DEX-driven per the source), srd.damage_type.piercing\n```\n\nShared write, simplified from\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(one ladder branch; the melee variants also add\n`cond(actor.status('srd/condition/raging') == true, 2, 0)` to `dmg`):\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/hp\"\ndelta_source = \"cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.damage_type.piercing'), 0 - (let dmg = max(0, actor.equipped_item('srd/slot/main-hand').source('srd/damage')); cond(target.has_tag('damage_immune:piercing'), 0, cond(target.has_tag('damage_resist:piercing'), dmg / 2, cond(target.has_tag('damage_vulnerable:piercing'), dmg * 2, dmg)))), …)\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/weapon-attack-units.test.ts`\n (finesse branch, item identity gate)\n- Fail-closed on a missing slot: `MissingItemDslSource` in\n `crates/spellkave-dsl/src/eval.rs:1454` (unit tests at `:3419-3460`); the\n validator warns at authoring time (`crates/spellkave-validate/src/refs.rs:694`)\n- `packages/spellkave-srd-cc/src/test/offline/weapon-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/damage-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/monsters/starter-arena.test.ts`\n\n## Related\n\n[`damage-type-routing`](./damage-type-routing.md) (the ladder and the two\nhelpers), [`derived-value-mechanism`](./derived-value-mechanism.md) (macros\nlegal on slots AND on `delta_source`; prefer the item slot for reusable\nattacker math, `delta_source` for a one-off non-item-sourced number),\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`weapon-stricter-affordance-variant`](../repairs/weapon-stricter-affordance-variant.md),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md)\n(definition-level equipment seeds).\n\n## Known misuse / anti-pattern\n\n- A per-creature `…/action/bite` verb cloned from the shared attack.\n- Enumerating a die as an N-row weight-1 int roll table with a text\n pointer (retired idiom: it could not compose with any fact).\n- Negating in the slot as well as at the write; or a spell that reuses the\n positive-magnitude helper at its own write site.\n- Omitting the item because \"the dice happen to match\" — identity and\n affordance provenance are load-bearing.\n- Tagging a natural weapon with purchase category / mastery axes, or\n assuming finesse from a sample of two creatures.\n\n## SRD features that use this\n\n- Every manufactured weapon (`fixtures/base/equipment/weapons/<slug>.toml`),\n every CR 0–4 natural weapon, Opportunity Attack's weapon branch. The\n attack archetype, reach/range ownership and the retired-idiom tombstone:\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md),\n [`authoring-damage.md`](../../../spellkave-srd-cc/docs/authoring-damage.md).\n",
241
+ "patterns/kill-xp-grant": "# Kill-time XP grant\n\n## Name\n\n`kill-xp-grant` — Kill-time XP grant (NPC watch pays the killer)\n\n## Problem\n\nWhen a creature dies I need the killer to receive that corpse's XP worth immediately — not when someone later takes a \"claim victory\" verb.\n\n## Forces\n\n- The awarding NPC writing the killer cannot read a third entity's XP worth\n inside that write's `delta_source`. The host reads the observed corpse.\n- Attacks remain ordinary attacks; the award belongs to the DM's watch.\n- A persistent victim latch prevents repeated payments after successful awards\n and host restarts. Process memory alone cannot establish that guarantee.\n- Seeing the fight and holding authority to change state are separate grants.\n\n## Solution\n\nAuthor the finite `srd/dm/spend-xp-value` and `srd/dm/award-xp` actions before\nplay. Both require `frontier.set_state`; the DM needs admitted reach to their\ntargets as well as observation of the dead body and its recorded killer.\nThe watch in `adventure-runtime/src/dm/watches/initiative-watch.ts`:\n\n1. observes `srd/condition/dead`, the killer and live `srd/xp_value`;\n2. dispatches `srd/dm/spend-xp-value` at the victim and awaits success;\n3. dispatches `srd/dm/award-xp` at the killer with that observed quantity.\n\nThese are two ordered dispatches. If the award fails after the spend succeeds,\nthe value is already consumed and the host reports `kill_xp_award_lost`.\nThe pair is not one atomic transaction. A kill with no running NPC host is\nnot paid by this watch. No action definition or manifest delta is published\nper kill.\n\n## Authored write example\n\nThe following consequence fragments come from\n`spellkave-srd-cc/src/chapters/classes/dm-act-units.ts`. They belong to separate\npreauthored actions; the spend predicate requires positive victim XP worth.\n\n```toml\n# srd/dm/spend-xp-value, targeted at the victim:\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/xp_value\"\ndelta_source = \"-target.stat('srd/xp_value')\"\n\n# srd/dm/award-xp, targeted at the killer:\n# ModifyResource.actor = \"TargetActor\"\n# ModifyResource.resource = \"srd/xp\"\n# ModifyResource.delta_source = \"actor.stat('core/dispatch_arg_quantity')\"\n```\n\nThe quantity is an act argument evaluated during the dispatch, not a newly\nrendered literal definition. Legacy `renderGrantKillXp` exports remain\npublisher composition helpers; their offline rendering tests do not prove the\ncurrent watch's live dispatch path.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/kill-xp.live.test.ts`\n checks observed XP, spent latch and replay behavior through the actual watch.\n- `packages/spellkave-srd-cc/src/test/offline/dm-act-catalog.test.ts`\n checks the authored action catalog.\n\n## Related\n\n[`quest-xp-grant`](./quest-xp-grant.md),\n[`proactive-level-up`](./proactive-level-up.md),\n[`computed-literal`](./computed-literal.md),\n[`actor-stat-self-only`](../repairs/actor-stat-self-only.md).\n\n## Known misuse / anti-pattern\n\n- Publishing a per-kill action definition from the DM host.\n- Awarding without spending the persistent victim latch.\n- Treating the two receipts as an atomic award or silently ignoring a failed award.\n- Hardcoding an XP amount onto each attack template.\n\n## SRD features that use this\n\nElven-mini Aldwin's watch reads catalog creatures' `srd/xp_value`.\nBundle-specific values: [`kill-time-xp.md`](../../../spellkave-srd-cc/docs/kill-time-xp.md).\n",
242
+ "patterns/lingering-hazard-zone": "# Lingering hazard zone (self-pulsing)\n\n## Name\n\n`lingering-hazard-zone` — Lingering hazard zone (self-pulsing)\n\n## Problem\n\nI need a Cloudkill / burning-room hazard that damages whoever stands in it each round, then fades, without the player re-casting every turn.\n\n## Forces\n\n- The world clock must not kill actors without a subject (ADR-0004 / ADR-0041).\n- Pulses need caster (or fire-entity) attribution and a bounded `repeats_remaining`.\n- Cast-time Inscribe of a spatial marker is separate from the pulse body (autonomy fence).\n\n## Solution\n\nAuthor a subject-bound `[[autonomy_jobs]]` (or cast → `ScheduleAutonomyJob`) whose\n`dsl_function` is a consequence that fans `ForEachActorInRadius` → `ModifyResource`.\nFull guide: [`lingering-hazard-zones.md`](../lingering-hazard-zones.md). Live\nno-cast proof: `mech_burning_room`.\n\n## TOML example\n\nCopied from `packages/spellkave-mechanics/fixtures/mech_burning_room/manifest.toml (generated by packages/spellkave-mechanics/src/burning-room.ts)`:\n\n```toml\n[[autonomy_jobs]]\nanchor_place_node_id = \"mech_burning_room/room\"\nbundle_id = \"mech_burning_room\"\ndsl_function = \"mech_burning_room/pulse\"\nfrequency_ms = 6000\njob_id = \"mech_burning_room/fire_pulse\"\nrepeats_remaining = 3\nrequires_subject_alive = false\nsubject_entity_key = \"mech_burning_room/fire\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"mech_burning_room/pulse\"\nframe_write = { ForEachActorInRadius = { center_ref = \"TargetSpatialRef\", shape_id = \"core/area/node_ball\", shape_params_json = '{\"ball_radius\": 0}', predicate_source = \"\", body = [ { ModifyResource = { actor = \"Actor\", resource = \"mech_burning_room/hp\", delta_source = \"-3\" } } ] } }\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/area-hazards.test.ts` (Caltrops\n and Ball Bearings pulses, routed damage ladder).\n- Validator: `crates/spellkave-validate/src/autonomy_jobs.rs` unit tests (pulse\n subject resolution, e.g. `subject_entity_key_resolving_to_an_entity_is_eligible`).\n- Guide: [`lingering-hazard-zones.md`](../lingering-hazard-zones.md).\n\n## Related\n\n[lingering-hazard-zones](../lingering-hazard-zones.md), [damage-type-routing](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\nAmbient world-clock damage with no subject. Unbounded `repeats_remaining`. Putting Inscribe on the pulse instead of the cast.\nCalling `macro()` in the pulse's `ForEachActorInRadius.predicate_source`:\noffline validation accepts it, but the kernel parses that predicate without\nthe macro table and disables the job at its first fire with\n`MF-DSL-MACRO-UNKNOWN` (sk-jay0.2.43). Inline the macro body instead.\n\n## SRD features that use this\n\n- **Moonbeam / Flaming Sphere / Spike Growth** (srd-cc L12d `lingering_damage_zone`).\n- **Cloudkill**: only the retired `srd` bundle authored its pulse (cast shape\n in lingering-hazard-zones.md); the srd-cc Cloudkill is identity-only.\n- Generic **burning room** environmental hazard (mech_burning_room).\n- **Caltrops / Ball Bearings** (srd-cc `srd/item/caltrops/spread`,\n `srd/item/ball-bearings/spill`, sk-jay0.3.19.6): a self-only Utilize verb\n spends the item, spares the creatures already on the node until their next\n turn start, and schedules a 10-round pulse on the user's node. The pulse\n predicate skips spared creatures and runs the occupant's Dexterity save; the\n body is damage plus a Speed 0 condition, or Prone, plus a \"struck\" status\n that spares the creature until its next turn start. Monster Death and PC\n Unconscious carriers follow in the same template. The pulse hits creatures\n standing in the area, not creatures that enter it: see\n `packages/spellkave-srd-cc/docs/equipment-catalogue.md` § Area hazards.\n",
243
+ "patterns/loot-table-drop": "# Loot table drop\n\n## Name\n\n`loot-table-drop` — Treasure draw via int roll table + host grant\n\n## Problem\n\nA quest terminal or boss kill should pay a treasure item drawn from SRD\nrarity/CR guidance — without smuggling free-text item names into\n`roll_table` (int-draw only) and without a kernel \"drop on death\" arm.\n\n## Forces\n\n- DSL `roll_table()` is **int-only** (`dsl-grammar.md` §RollTable, MF-VAL-317).\n- Item identity lives on `entity_definitions` (`srd/magic_item/…`, potions).\n- Kill-time and quest rewards already use DM/host computed grants\n ([kill-xp-grant](./kill-xp-grant.md), [quest-xp-grant](./quest-xp-grant.md)).\n- Party should perceive that loot appeared (trace / Public entity).\n\n## Solution\n\n1. Author weighted **int** `roll_tables` per rarity/CR/quest/boss band.\n2. Keep a TypeScript **code → entity_def_id** catalog beside the generator.\n3. At terminal/boss time the host (Aldwin) draws or selects a code, resolves\n the catalog, and **places** the item (or grants quantity) as a computed\n act — same class of solution as kill XP. **Not wired in elven-mini yet:**\n `watchForQuestLoot` (`packages/spellkave-adventure-runtime/src/dm/watches/quest-loot-watch.ts`) is exported but\n never started, and `decideBossLootDrop` (`author/loot-drop.ts:194`) is\n called only from tests, so no loot drops at runtime (bug\n `sk-jay0.3.4.11.6`).\n4. Emit a **party-visible trace** (`place_node_traces` / Inscribe) naming the\n drop so players can read it without operator SQL.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/magic-items/loot-tables.toml`\n(generated by `src/chapters/magic-items/loot-tables.ts`):\n\n```toml\n# pattern: loot-table-drop\n[[roll_tables]]\nroll_table_id = \"srd/loot/boss/q4-fanatic\"\nbundle_id = \"srd\"\nresult_kind = \"int\"\ndisplay_name = \"Q4 Sister Maelis boss drop\"\n\n[[roll_table_entries]]\nroll_table_entry_id = \"srd/loot/boss/q4-fanatic:1\"\nroll_table_id = \"srd/loot/boss/q4-fanatic\"\nauthored_order = 1\nweight = 5\nresult_ref = \"20\"\n```\n\nHost maps `20` → `srd/magic_item/longsword-plus-1` via `LOOT_CODE_CATALOG`.\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/magic-items-coverage.test.ts`\n (loot table fixture + catalog resolution).\n- Live (gated, `SPELLKAVE_LOCAL_NODE=1`):\n `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/q4-fanatic-loot.test.ts`\n seeds the loot entity directly and reads it back; it does not kill the\n fanatic or draw from the table. No test covers the draw-and-place step\n end to end.\n\n## Related\n\n[kill-xp-grant](./kill-xp-grant.md), [quest-xp-grant](./quest-xp-grant.md),\n[computed-literal](./computed-literal.md),\n[weighted-int-roll-table](../examples/weighted-int-roll-table.md).\n\n## Known misuse / anti-pattern\n\n- `result_ref = \"longsword +1\"` on an int table (`MF-VAL-210`, fatal).\n- Identity-mapped 1..N weight-1 die smuggled as a loot table (MF-VAL-317).\n- Kernel gap for \"drop on death\" before trying host grant + table draw.\n\n## SRD features that use this\n\n- Magic item treasure by rarity (magic-items.md).\n- Elven-mini Q3/Q10 rewards and Q4 boss drop (sk-609b.13) — designed and\n tabled, not yet dropped at runtime (see Solution step 3).\n",
244
+ "patterns/mastery-gated-attack-variant": "# Mastery-gated attack variant (stricter sibling of a shared attack)\n\n## Name\n\n`mastery-gated-attack-variant` — A full sibling attack action gated on a\nwielded-item (or class) tag, carrying its own hit consequence\n\n## Problem\n\nI need an on-hit rider (Weapon Mastery Sap/Vex, Sneak Attack dice, …) that\ncannot live inside the shared melee/ranged success consequence, because the\nshared write either (a) rebounds Actor away from the attacker inside\n`ForEachActorInRadius`, or (b) already hosts a multi-type damage ladder that\nanother rider would have to be threaded through.\n\n## Forces\n\n- Offer predicates that read attacker-only facts\n (`equipped_item('<slot>').has_tag`, `has_capability`, a once-per-turn spent\n marker) are fine — they stay on the\n acting subject.\n- Shared melee success cannot host a gated `ApplyStatus` that needs attacker\n weapon tags: `ForEach` rebinds Actor to the cell occupant (see\n `weapon-stricter-affordance-variant` and L12a mastery riders).\n- Folding class riders into the 13-type damage tower has already failed\n validation once (Sneak Attack attempt 1 → MF-VAL-256, a frame-write DSL\n parse error). The parser has no nesting limit, so the failure was an\n authoring error in a very long expression, not a ceiling; the shipped\n Sneak Attack instead adds its dice as a separate ordinal\n (`sneak-attack.toml:100-106`).\n- A miss still needs its own authored `on_failure` consequence\n ([`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)).\n\n## Solution\n\nAuthor a **dedicated shallow attack action** that is a full sibling of\n`srd/attack/melee` / `srd/attack/ranged`:\n\n1. **Offer** — capability + range + the distinguishing gate\n (`actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.mastery.vex')`, or\n `actor.has_capability('srd/class-feature/rogue/sneak-attack')` +\n Finesse/Ranged + `!actor.status('…/expended')`).\n2. **Resolution** — same Stochastic to-hit as the base attack\n (`resolution_scope = srd/attack_roll`, `accepts_global_storm = true`).\n3. **Consequence** — weapon damage (item-sourced) **plus** the rider\n (`ApplyStatus`, conditional Nd6, …) as its own ordinal on the same shallow\n template — not folded back into the shared ladder. A rider that deals\n typed damage needs its own routing ladder; the shipped Sneak Attack dice\n are not type-routed.\n4. **Once-per-turn** — prefer an actor-scoped spent condition with\n `expires_at_boundary = turn_start` / `owner_actor = Actor` (auto-clears next\n turn). Gate offer on `actor.status('…') == false`. Document the reset.\n\nCite this page from generator source (`// pattern: mastery-gated-attack-variant`)\nand emitted TOML (`# pattern: mastery-gated-attack-variant`).\n\n## TOML example\n\nSneak Attack (K-A facts) — `packages/spellkave-srd-cc/fixtures/base/playing-the-game/sneak-attack.toml`:\n\n```toml\n[[action_definitions]]\naction_id = \"srd/attack/sneak-attack\"\nbundle_id = \"srd\"\ndisplay_name = \"Sneak Attack\"\nrequired_capability = \"srd/action/attack\"\nresolution_mode = \"Stochastic\"\nresolution_scope = \"srd/attack_roll\"\non_success = \"srd/attack/sneak-attack/success\"\non_failure = \"srd/attack/sneak-attack/miss\"\n# offer predicate (generated) also requires Finesse|Ranged, dice ≥ 1,\n# !status(sneak-attack-expended)\n\n[[consequence_frame_writes]]\ntemplate_id = \"srd/attack/sneak-attack/success\"\nordinal = 0\n# weapon damage + cond(resolution_roll_modifier == 1 || peers_near_target(...), Nd6, 0)\n```\n\nVex mastery — `weapon-mastery-riders.toml` action `srd/attack/melee-vex`.\n\n## Proof\n\n- Offline: `packages/spellkave-srd-cc/src/test/offline/martial-features-coverage.test.ts` (#101 evidence)\n- Offline: mastery riders unit summaries in `weapon-mastery-riders.ts`\n- Live (when node up): `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/sneak-attack.ts`\n- Kernel facts demo: `openspec/specs/world-interaction-kernel/demos/sk-609b-ka-resolution-facts.demo.md`\n\n## Related\n\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`condition-grant-and-suppression`](./condition-grant-and-suppression.md),\n[`weapon-stricter-affordance-variant`](../repairs/weapon-stricter-affordance-variant.md),\n[`damage-type-routing`](./damage-type-routing.md).\n\n## Known misuse / anti-pattern\n\n- Folding another class rider into the shared multi-type damage tower.\n- Putting `peers_near_target` / `core/resolution_roll_modifier` in an **offer**\n predicate (materialiser seam does not populate them — ADR-0105 G-1).\n- Expecting `ForEachActorInRadius` body predicates to see attacker\n `equipped_item(...)` tags.\n- Reading `actor.wielded_item` in a new gate: it is the legacy accessor that\n picks the lowest-id item (see [`item-sourced-damage`](./item-sourced-damage.md)).\n\n## SRD features that use this\n\n- Weapon Mastery Sap / Slow / Topple / Graze / **Vex**\n- Rogue **Sneak Attack** (`srd/attack/sneak-attack`)\nNot this pattern: Paladin **Divine Smite** (`srd/paladin/divine-smite`) is a\nDeterministic self-contained action that debits `srd/spell_slot_1` and deals\n2d8 radiant with no to-hit roll and no weapon damage\n(`fixtures/base/classes/caster-features.toml:253-268`).\n",
245
+ "patterns/milestone-gate-terminal-flags": "# Milestone gate on prior terminal flags\n\n## Name\n\n`milestone-gate-terminal-flags` — Milestone gate on prior terminal flags\n\n## Problem\n\nMy advancement beat gates on flags a much larger prior beat already set — do I have to replay that whole beat?\n\n## Forces\n\n- Honest proof still requires real action execution against a live node.\n- Replaying unrelated combat/narrative content wastes agent time and flakes.\n- Each flag's own predicate usually needs only a strict subset of prior entities.\n\n## Solution\n\nRead each composed flag's OWN consequence predicate. Stage a trimmed session\nwith only the entities those predicates read, then execute the real action\nthat writes each flag. Full repair (its worked example is archived\nPhandelver content):\n[`repairs/milestone-gate-terminal-flags.md`](../repairs/milestone-gate-terminal-flags.md).\n\n## TOML example\n\nLive example (elven-mini Q9): the Q9 terminal reads the persistent flag\n`elven_mini/quest/flag/q9_tomb_opened` and the deep-tomb stair edge reads the\nseal's spatial state; the one `elven_mini/quest/open-tomb` action writes both\n(`author/tomb-key.ts`). The proof stages\njust the giver, the DM, the hero, the key item and one companion at the seal\nnode — not the Rung III fights before it — and executes the real actions:\n\n```toml\n# compose only what the gate reads:\n# gates: Q9 terminal reads quest/flag/q9_tomb_opened; the stair edge reads the seal state\n# writer: elven_mini/quest/open-tomb (hero holds the tomb key, stands at the seal)\n# stage: giver + DM + hero + key + one companion at TOMB_SEAL_NODE\n```\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/quest-giver.live.test.ts`\n and `packages/spellkave-test-lab/src/scene-live/seal-gate.local-node.test.ts`\n (private scenes; accept Q9, open the tomb with the key, the stair opens).\n- `packages/spellkave-adventure-elven-mini/tests/offline/quest-progression.test.ts`.\n\n## Related\n\n[advancement-choice](./advancement-choice.md), [proactive-level-up](./proactive-level-up.md).\n\n## Known misuse / anti-pattern\n\nSeeding terminal flags in a *proof* without executing the actions that set\nthem (a story save state such as `fixtures/story/hero.toml`, which records\na world after the action ran, is a different thing). Assuming 'replay the\nwhole prior beat' is the only honest path.\n\n## SRD features that use this\n\n- Level-up / story milestone beats that gate on prior quest or combat terminals.\n",
246
+ "patterns/multiattack-ordinals": "# Multiattack as baked ordinals\n\n## Name\n\n`multiattack-ordinals` — Multiattack as N independent rolled ordinals in one consequence\n\n## Problem\n\nI need a creature to make several attacks in one action (Multiattack), or an action whose numbers the shared attack archetype cannot host (flat damage, ability math that does not match the creature's facts).\n\n## Forces\n\n- There is no kernel multiattack primitive and none is needed: a\n consequence already holds an ordered list of frame writes.\n- Each attack must roll its own d20 and its own damage.\n- Later ordinals must observe earlier ordinals' committed state (lethal\n cascade, temp-HP lose-first).\n- A bespoke creature verb must not leak into other actors' palettes.\n- **What a baked ordinal gives up.** The generated ordinal compares\n `roll + to-hit >= AC` directly and subtracts raw damage. It does not call\n `macro('srd/attack_roll_hits', …)`, so it has no natural-20/natural-1 or\n critical-hit handling, and it has no damage-type ladder, so resistance,\n immunity and vulnerability are ignored (srd-cc\n `src/chapters/monsters/starter-behaviors.ts:224-233`; the breath/area route\n does route, `:340-346`). Tracked as `sk-jay0.3.10.5`. Add the ladder from\n [`damage-type-routing`](./damage-type-routing.md) by hand if a stat block\n needs it.\n\n## Solution\n\nEmit ONE action whose success consequence carries N `ModifyResource`\nordinals, each self-contained:\n`let atkN_roll = d20; cond(atkN_roll + <to-hit> >= target.effective('<ac>'), 0 - (max(0, <damage>)), 0)`,\nfollowed by the consequence-side idioms:\n\n- **Lethality guard** as a trailing `ForEachActorInRadius` with\n `ball_radius 0` at `TargetSpatialRef`, predicate\n `actor.has_tag('<member>') && actor.stat('<hp>') <= 0` (membership before\n measurement — a co-located HP-less dummy raises `UnknownField` on the\n `stat` read; the kernel skips that occupant with a `write_failure`\n provenance row rather than aborting the batch, but the `has_tag` conjunct\n still belongs first). Inside that body the selected entity is `actor`, not\n `target`.\n- **Sequential ordinals chain**: two writes in one consequence may depend\n on each other; ordinal k+1 sees ordinal k's result.\n\nGate a bespoke creature action with TWO capabilities with different jobs:\nthe affordance template's `capability_id` is per-creature (granted only by\nthat creature's definition — keeps \"Black Bear — Multiattack\" out of the\nhero's palette), while the action's `required_capability` stays the shared\nhostile-action discriminator the initiative watch keys on.\n\nCheck the arithmetic first: if the shared archetype plus an equipped item\nalready reproduces the stat block ([`item-sourced-damage`](./item-sourced-damage.md)),\nprefer it — baked ordinals are the second route, not the default.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/monsters/starter-behaviors.toml`\n(Black Bear Multiattack, two attacks + lethality guard; other rows of the\nsame action omitted):\n\n```toml\n[[affordance_templates]]\naccepts_global_storm = true\nbundle_id = \"srd\"\ncapability_id = \"srd/creature/black-bear/action\" # per-creature gate\nniche_id = \"srd/niche/attack-verb\"\noutcome_template_id = \"srd/creature/black-bear/action/multiattack/outcome\"\nspends_channel = \"srd/economy_channel/primary\"\ntemplate_id = \"srd/creature/black-bear/action/multiattack/affordance\"\n\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let atk0_roll = d20; cond(atk0_roll + 4 >= target.effective('srd/ac'), 0 - (max(0, 1d6 + (2))), 0)\"\nresource = \"srd/hp\"\n\n[[consequence_frame_writes]]\nordinal = 1\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\ndelta_source = \"let atk1_roll = d20; cond(atk1_roll + 4 >= target.effective('srd/ac'), 0 - (max(0, 1d6 + (2))), 0)\"\nresource = \"srd/hp\"\n\n[[consequence_frame_writes]]\nordinal = 2\ntemplate_id = \"srd/creature/black-bear/action/multiattack/success\"\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius]\ncenter_ref = \"TargetSpatialRef\"\npredicate_source = \"actor.has_tag('srd.monster') && actor.stat('srd/hp') <= 0\"\nshape_id = \"core/area/node_ball\"\nshape_params_json = '{\"ball_radius\": 0}'\n\n[[consequence_frame_writes.frame_write.ForEachActorInRadius.body]]\n\n[consequence_frame_writes.frame_write.ForEachActorInRadius.body.ApplyStatus]\ncondition_definition_id = \"srd/condition/dead\"\ntarget_kind = \"entity\"\ntarget_ref = \"Actor\"\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/bestiary-cr0-4-coverage.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/creature-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/monsters/starter-arena.test.ts`\n\n## Related\n\n[`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md),\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`ordered-resource-grants`](../repairs/ordered-resource-grants.md)\n(ordinal ordering semantics),\n[`definition-seed-statblock`](../examples/definition-seed-statblock.md).\n\n## Known misuse / anti-pattern\n\n- Filing \"no multiattack primitive\" as a kernel gap.\n- Gating the bespoke action on the shared attack capability only (it then\n appears for every creature).\n- Writing `target.stat(...)` inside a `ForEachActorInRadius` body (the\n loop rebinds the selected entity to `actor`).\n- Reaching for baked ordinals when an equipped item would reproduce the\n numbers.\n- Assuming a baked ordinal respects resistance or crits (see Forces).\n\n## SRD features that use this\n\n- CR 0–4 bestiary Multiattack (Black/Brown Bear and the rest), flat-1\n damage actions, ability-mismatch stat blocks. Route selection and the\n n/a list (breath/AoE, condition riders):\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md).\n",
247
+ "patterns/offer-gate-consume-guard-parity": "# Offer gate / consume guard parity\n\n## Name\n\n`offer-gate-consume-guard-parity` — the predicate that OFFERS an action and\nthe guard that COMMITS it are one list, in one place.\n\n## Problem\n\nAn authored action is offered behind a gate (a phase state, a tag, a\npredicate on the world) and consumed by code that re-checks whether the\nthing is really ready. Two lists, two files. They start identical and drift.\nWhen they disagree the action is offered, dispatched, and accepted — the\nworld really did fire the handle — and then quietly does nothing, because\nthe consumer's own guard refused. Nothing is written and nobody is told.\n\n## Forces\n\n- The gate must be cheap and world-readable: an affordance predicate can\n only see world state, so it reads a phase or a tag.\n- The consumer usually holds richer state than the gate can see — process\n memory, a draft, a catalog — so it re-checks. That re-check is legitimate.\n- A receipt of `accepted` means \"the handle dispatched\", not \"the intent\n succeeded\". Players and agents read it as the latter.\n- Failing closed is right. Failing closed *silently* is what turns a\n disagreement into an unexplainable wedge.\n\n## Solution\n\nExport ONE function that answers \"what is still missing\", and use it in both\nplaces: the guard returns early when it is non-empty, and the speaking or\nreporting path renders it. Reserve the success line for a commit that\nactually happened, so a refusal can never be mistaken for success.\n\n```ts\n/** Sole source for BOTH the reducer's guard and the DM's spoken rejection. */\nexport function missingConfirmKeys(state: DraftState): readonly string[] {\n\tconst missing: string[] = [];\n\tif (state.classSlug === null) missing.push(\"a class\");\n\tif (state.name === null) missing.push(\"a name\");\n\t// …\n\treturn missing;\n}\n\n// guard\nif (missingConfirmKeys(state).length > 0) return state; // unchanged, refused\nreturn { ...state, confirmed: true };\n\n// speech — same list, spoken\nHasRejectedConfirm(): boolean { return this.confirmMissingKeys.length > 0 && sawPick; }\n```\n\n## Proof\n\n`packages/spellkave-adventure-runtime/src/dm/creation/draft-state.ts`\n(`missingConfirmKeys`, used by `reduceCreationDraft`'s confirm branch) and\n`packages/spellkave-adventure-runtime/src/dm/creation/engine.ts`\n(`HasRejectedConfirm` / `SpeakConfirmRejection`, fed the same list through\nthe agent's per-cycle context) share the **guard and the spoken rejection**.\nTest: `packages/spellkave-srd-cc/src/test/offline/dm-creation.test.ts`,\n\"an incomplete confirm is SAID, not swallowed\" — asserts the DM names every\nopen key and does NOT speak the closing line.\n\n**The offer half is not shared yet.** The confirm offer is gated by a\ndifferent function, `creationStructuredDraftsComplete`\n(`…/dm/creation/steps.ts:104-146`), which accepts \"no kit\" and \"no skills\"\nwhen none remain to pick, while `missingConfirmKeys` always requires them.\nThat is this page's anti-pattern in the reference implementation (bug\n`sk-jay0.1.49`).\n\n## Related\n\n- [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md) — the wizard\n whose confirm this guards.\n- [`watch-reader-manifest-closure`](./watch-reader-manifest-closure.md) — the\n sibling failure where a read answers \"nothing found\" instead of failing.\n\n## Known misuse / anti-pattern\n\nSpeaking the success line off the *observed pick* rather than off the\n*committed state*. That is the version of this bug that lies loudest: the\nplayer hears \"It's done. Welcome to the world.\" while no character exists.\n\nEqually wrong: fixing the drift by loosening the consumer's guard so it\naccepts whatever the gate offered. The guard usually knows more than the\ngate; the answer is to share the guard's list with the gate, not to delete\nit.\n\nAlso not a fix: a timer or watchdog that retries the wedged step. A watchdog\nis the right tool for a genuinely missing wake-up signal; here the signal\narrives and the answer is wrong, so a cadence only hides the disagreement\nbehind a retry.\n\n## SRD features that use this\n\n- Elven-mini character creation's confirm: a one-slot runtime offer on\n `dm/dialog/choice/1` (the seeded `dm/creation/confirm` action is gated\n `1 == 0`, `…/dm/creation/seed.ts:800-809`), committed by the draft guard\n (six fixed keys plus the kit's equipment picks). Guard and speech share\n one list; the offer does not yet (see Proof).\n",
248
+ "patterns/offer-vs-resolution-roll": "# Offer vs resolution roll (the d20 lives in act-time resolution)\n\n## Name\n\n`offer-vs-resolution-roll` — Offer proves attemptability; the roll lives in resolution\n\n## Problem\n\nI need an attack or check that can miss: where does the d20 go so the verb is always offered when it is attemptable, and only the act decides hit or miss?\n\n## Forces\n\n- Disclosure does not evaluate the template predicate: the materialiser\n offers a template when the actor holds its `capability_id`\n (the world API).\n The template predicate runs at act time with live draws\n (the world API).\n A die there turns a miss into a **rejected attempt**\n (`predicate_rejected`): no `on_failure` consequence runs and the rejection\n looks exactly like an ineligible target. (Before capability-only\n disclosure the same die also hid the verb: never once offered across 35\n live attempts.)\n- Offer predicates that read a target fact force `Place` locality and turn\n a target (an argument) into a precondition.\n- A miss needs its own authored outcome, not \"nothing happened\".\n- A `let`-bound die in an *affordance* predicate classifies as Global under\n the validator's conservative locality pass.\n\n## Solution\n\nSplit the verb into three stages:\n\n1. **Offer** — `affordance_templates.predicate_source` proves only\n *attemptability*: capability, wielded-item identity, range/reach. No\n die, no target-defense read.\n2. **Resolution** — `action_definitions.resolution_mode = \"Stochastic\"` +\n `resolution_predicate_source` holds the roll vs the target's effective\n defense, with an explicit `on_failure` consequence for the miss. srd-cc\n also sets `accepts_global_storm = true` on the attack affordances; the\n resolution die does not require it, because the validator's locality\n pass reads only `affordance_templates.predicate_source`\n (`crates/spellkave-validate/src/lib.rs:554-600`).\n3. **Consequence** — the hit's `ModifyResource` damage write. As of\n sk-awlo `delta_source` is macro-aware at act time — inline the formula\n for a genuinely one-off number, or call a macro when the same formula\n already has a named, reusable definition (see\n [`derived-value-mechanism`](./derived-value-mechanism.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`\n(description and default-valued fields omitted):\n\n```toml\n[[action_definitions]]\naction_id = \"srd/attack/melee\"\nbundle_id = \"srd\"\ndisplay_name = \"Melee Attack\"\non_failure = \"srd/attack/melee/miss\"\non_success = \"srd/attack/melee/success\"\nrequired_capability = \"srd/action/attack\"\nresolution_mode = \"Stochastic\"\nresolution_predicate_source = \"let attack_roll = d20; macro('srd/attack_roll_hits', attack_roll, attack_roll + macro('srd/ability_modifier', cond(actor.equipped_item('srd/slot/main-hand').has_tag('srd.weapon.property.finesse'), max(actor.effective('srd/str'), actor.effective('srd/dex')), actor.effective('srd/str'))) + (actor.stat('srd/proficiency_bonus')), (target.effective('srd/ac')), cond(actor.has_capability('srd/class-feature/fighter/champion/improved-critical'), 19, 20))\"\nresolution_scope = \"srd/attack_roll\"\nself_eligible = false\nspends_channel = \"srd/economy_channel/primary\"\n```\n\n`srd/attack_roll_hits` takes four arguments (roll, total, AC, crit\nthreshold; `fixtures/base/playing-the-game/macros.toml`); the DSL rejects a wrong\nargument count (`crates/spellkave-dsl/src/lib.rs:1785`).\n\nThe matching affordance's `predicate_source` checks only the wielded item's\nrange identity and distance — never AC.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/attack-roll-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/making-an-attack-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/generic-check-units.test.ts`\n (checks use the same split with a DC)\n\n## Related\n\n[`item-sourced-damage`](./item-sourced-damage.md),\n[`derived-value-mechanism`](./derived-value-mechanism.md),\n[`multiattack-ordinals`](./multiattack-ordinals.md) (several rolls inside\none consequence), [`interaction-dsl-and-world-authoring`](../interaction-dsl-and-world-authoring.md).\n\n## Known misuse / anti-pattern\n\n- `d20` (or any die) in an affordance predicate (a miss becomes a rejection).\n- A \"strikeable\" offer gate such as `target.stat('<ac>') >= 1` (retired: a\n target is an argument, not a precondition; it also forces locality).\n- An action with no `on_failure` for a stochastic resolution.\n- Filing \"attack never offered\" as a materialiser bug before checking the\n actor holds the template's `capability_id`.\n\n## SRD features that use this\n\n- Melee / Ranged / Unarmed / Opportunity Attack, every `srd/check/<subject>`\n verb, saving-throw style scene checks. Pipeline details:\n [`attack-and-damage.md`](../../../spellkave-srd-cc/docs/attack-and-damage.md).\n- Thrown Acid, Alchemist's Fire, Holy Water (`srd/item/<slug>/throw`): the\n target's Dexterity save, written from the thrower's side\n (`d20 + DC - mod >= 22`, same unbiased odds). The target's own save\n modifiers are not routed onto that d20; its against-bearer attack bias is\n (sk-jay0.2.41). Details:\n [`equipment-catalogue.md`](../../../spellkave-srd-cc/docs/equipment-catalogue.md#thrown-consumables).\n",
249
+ "patterns/operable-door": "# An operable door between two places\n\n## Name\n\n`operable-door` — Authored open/locked facts on a two-sided boundary.\n\n## Problem\n\nA player should open and close a door from either side. A closed or locked\ndoor should refuse a step, while the usual movement budget still applies.\n\n## Forces\n\n- `link_places --door` supplies a map tag. Traversal needs a predicate too.\n- The two directed edges represent one physical door. Changes at either\n endpoint must affect both directions.\n- Spatial-state definitions supply typed facts to location actions and to\n edge predicates (`@from_node` / `@to_node`). The writes are ordinary\n authored `Inscribe` consequences.\n- The door adds a gate to the existing movement mode. It retains the\n bundle's SRD step policy, speed budget and long-running movement session.\n\n## Solution\n\nGive this door its own pair of boolean spatial-state IDs, `open` and\n`locked`. Attach its operating niche to both endpoints. Each operation\nwrites the same value to both nodes in one consequence. Both directed\nedges read their own `@from_node` values, so either endpoint sees the same\nstate after an operation.\n\nThe worked fixture uses `door_pattern/open` and `door_pattern/locked` for\none door. Give another door distinct IDs, even when the doors share a room.\nMissing boolean values are false: this door starts closed and unlocked.\n\n| Open | Locked | Traversal | Open action |\n|---|---|---|---|\n| false | false | refused | admitted |\n| true | false | admitted | admitted |\n| false | true | refused | refused |\n\nThe fixture's lock action requires `open == false`. Its unlock action\nwrites `locked = false`. All four operations require the authored\n`door_pattern/operate` capability. A game with keys can give lock/unlock a\nseparate capability and grant that only to the appropriate player.\n\n## Authoring shape\n\nThe complete, CLI-authored example is\n[`behaviour/doors/fixtures/manifest.toml`](../../../spellkave-cli/behaviour/doors/fixtures/manifest.toml).\nIt places a player, Ada, in a two-room indoor graph and depends on `srd`.\nThe local proof seeds core mechanics and SRD before that root.\n\nDeclare each state through `write_rows --kind spatial_state_definitions`:\n\n```toml\n[[spatial_state_definitions]]\nbundle_id = \"door_pattern\"\nstate_id = \"door_pattern/open\"\ndescription = \"Whether the cellar door is open.\"\nvalue_type = \"bool\"\nwriter_policy = \"world_interaction\"\nmerge_rule = \"replace\"\nlod_policy = \"retain_latest\"\nfreshness_rule = \"expires_after_ticks:1000000000\"\n```\n\nDeclare `door_pattern/locked` with the same carrier. Use `define_niche`\nwith `attachments: [{node: <hall>}, {node: <room>}]`, and grant the operating\ncapability to the player. Each `define_action_verb` uses that niche. The\nopen action's eligibility predicate is:\n\n```text\ntarget.state('door_pattern/locked') == false\n```\n\nIts consequence has two `Inscribe` frame writes. One writes the hall:\n\n```toml\n[[consequence_frame_writes]]\ntemplate_id = \"door_pattern/act/open/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.Inscribe]\nkind = \"spatial_environment_state\"\nlocation_kind = \"place_node\"\nlocation_ref = \"door_pattern/cellar/hall\"\npayload_json = '{\"state_id\":\"door_pattern/open\",\"value\":true,\"visibility\":\"Public\"}'\n```\n\nThe second, at ordinal 1, writes `door_pattern/cellar/room` with the same\npayload. Close writes `open = false` at both endpoints. Lock and unlock\nwrite the corresponding `locked` value at both endpoints. These cooperative\nworld-state actions are unmetered and declare `non_steering = true`.\n\nThe edge gate has its own affordance template, using the existing\n`srd/capability/walk`, `srd/niche/traversable-square` and `srd/outcome/step`:\n\n```text\ntarget.state('door_pattern/open@from_node') == true && target.state('door_pattern/locked@from_node') == false\n```\n\nKeep the bundle's `set_movement_default` pointing at `srd/affordance/step`\nwith the normal speed and long-running-move bindings. Attach the extra gate\nto both directions:\n\n```bash\nsk bind_edge_affordance --from door_pattern/cellar/hall --to door_pattern/cellar/room --affordance-template-id door_pattern/door-gate --bidirectional\n```\n\nRows in the same default movement mode AND-join. Leave\n`inherit_movement_default` enabled. The\n[`bundle-movement-default`](bundle-movement-default.md) pattern explains the\ncomposition rule.\n\n## Player loop and proof\n\nRead `scene`, then copy the exit's own `handle` and `rev` into `move`.\nOperate the door by manipulating the current place node, for example:\n\n```bash\nsk --profile door-proof-ada manipulate --target-id place_node:door_pattern/cellar/hall --action-id door_pattern/act/open\n```\n\nInspect the action receipt; a successful CLI invocation alone does not prove\nthat the world accepted the action. Re-read the scene after a step to check\nthe player's location.\n\nThe live scenario in\n[`behaviour/doors/doors.feature`](../../../spellkave-cli/behaviour/doors/doors.feature)\nchecks the initially refused step, accepted open and traversal, close from\nthe room, refused return, and locked-door refusals. Run it with:\n\n```bash\nSPELLKAVE_PLAYTEST_LIVE=1 pnpm --filter @spellkave/cli run test:behaviour:doors\npnpm --filter @spellkave/cli run guide:doors\n```\n\nIt owns a disposable local world and uses a separate player credential.\nSupply a current prebuilt server module with `SPELLKAVE_SERVER_WASM_BIN`;\nthe default is the checkout's release Wasm under `server/target/`. The\nsuite starts the node and publishes that module once.\nThe generated [guide](../../../spellkave-cli/docs/doors-guide.md) and\n[evidence](../../../spellkave-cli/docs/doors-scenarios.md) contain the full\nCLI run.\n\n## Known misuse\n\n- Reusing one door's state IDs for a different door sharing an endpoint.\n- Updating only one endpoint: the reverse direction would retain old facts.\n- Putting the gate in another movement mode: alternatives OR-join and can\n leave a passing route around the door.\n- Disabling the inherited movement default and accidentally discarding the\n SRD movement budget.\n- Expecting a baseline reapply to reset played state. Runtime spatial-state\n overrides survive reapply (ADR-0154); use the authored operations to reset\n this door.\n\n## Related\n\n[Runtime ambient state on incident edges](../interaction-dsl-and-world-authoring.md#runtime-ambient-state-on-incident-edges),\n[place graphs and occupancy](../place-graph-occupancy.md),\n[bundle movement defaults](bundle-movement-default.md).\n",
250
+ "patterns/party-extent-grant": "# Party-extent grant (addressability across graphs as a privilege)\n\n## Name\n\n`party-extent-grant` — Cross-graph reach via a capability extent, not a range number\n\n## Problem\n\nMy DM (or a bonded item) must address a party member who is on ANOTHER place graph — the inn hearth to the tomb crypt — and a bigger `range_m` does not work.\n\n## Forces\n\n- `validate_reachability` rejects cross-graph pairs as incomparable metric\n frames, and candidate expansion is same-graph: no range number can\n cross a graph boundary.\n- Ordinary telepaths (creatures, items) that only author a range should\n stay same-graph — privilege must be a grant, not a global change.\n- The addressee still perceives the line by co-location with the\n directed trace; no new admission model may be introduced.\n- An actor-only body without an `entity_location` row fails target\n resolution before the extent check (pre-existing, not a regression).\n\n## Solution\n\nGrant the SAME communicate capability on the privileged actor with an\n**extent**: `extent_kind_ref = \"party\"` and `extent_ref = <membership tag>`\n(the tag the party members carry). That admits every member as an addressee\nregardless of node or graph. The trace is still anchored at the addressee's\nplace ([`directed-speech-anchor`](./directed-speech-anchor.md)). Seat\nwatches that also want a \"same graph, in range\" guard keep it as their own\npolicy; the substrate no longer requires it.\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/npcs/aldwin.toml`:\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"elven_mini/adventure/npc/aldwin_1\"\nbundle_id = \"elven_mini\"\ncapability_id = \"srd/action/communicate/telepathy\"\nelevation_class = \"\"\nextent_kind_ref = \"party\"\nextent_ref = \"srd.party.heroes\" # the same membership tag the hero carries\nsource = \"srd\"\nsource_args_hash = \"\"\n```\n\nCompare the DM's sight grant in the same file: `elven_mini/dm/watch` with\n`extent_kind_ref = \"place_graph\"` — extents are the general privilege\nshape, party is one kind.\n\n## Proof\n\n- Kernel: the world API\n unit tests `extent_membership_is_an_alternative_to_metric_range` and\n `cross_graph_metric_still_rejects_without_extent` (`:1389-1437`).\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/telepathy.ts`\n covers directed speech heard only by the addressee (range, not extent).\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/aldwin-xp-threshold.test.ts`\n (invitation path)\n\n## Related\n\n[`directed-speech-anchor`](./directed-speech-anchor.md),\n[`proactive-level-up`](./proactive-level-up.md) (the invitation consumer),\n[`dm-oversight`](../dm-oversight.md) (graph-scoped sight extents).\n\n## Known misuse / anti-pattern\n\n- A very large `range_m` to \"reach\" another graph.\n- Inventing a DM-only communicate verb instead of granting the shared one\n with an extent.\n- Reading the extent as a recipient column — perception is still\n co-location with the anchor.\n\n## SRD features that use this\n\n- Aldwin's `srd/action/communicate/telepathy` party extent (level-up\n invitations). Creature / item telepathy stays range-only:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n",
251
+ "patterns/post-commit-hit-reaction": "# Post-commit hit reaction (OA-shaped mitigate)\n\n## Name\n\n`post-commit-hit-reaction` — Reaction after another creature's manipulate commits\n\n## Problem\n\nA feature should fire as an off-turn reaction after another creature's\nmanipulate commits against you (a counter-blow, a post-hit heal).\nOpportunity Attack already shows the off-turn reaction shape; this pattern\nuses the same producer with a post-commit trigger. Damage *mitigation* that\nmust read the damage amount (Deflect Attacks) is not this pattern: it is\n[`condition-hook-on-event`](./condition-hook-on-event.md) on\n`Layer2.ResourceDelta`, whose detail carries `delta`.\n\n## Forces\n\n- The reaction producer runs **after** `r_manipulate` commits\n (`reaction_producer::run` with `$event.kind == 'r_manipulate'` and empty\n detail on the post-commit path). Damage `ModifyResource` has already\n applied.\n- Candidate reactors are co-located entities **other than** the acting\n attacker (plus the attacker only when `self_eligible`). The hit target is\n therefore a normal co-located candidate.\n- Eligibility binds `actor` = reactor, `target` = triggering actor\n (attacker) (the world API).\n Gate with `actor.has_capability('<feature>')`.\n- The post-commit **manipulate intent** carries no damage magnitude or damage\n type. The HP write itself is visible as a `Layer2.ResourceDelta` event\n (`delta`, `entity_id`, `resource_id`) to a condition hook — use that when\n the amount matters.\n\n## Solution\n\n1. Author a reaction action like Opportunity Attack:\n - `spends_channel = srd/economy_channel/reaction`\n - `reaction_trigger = \"$event.kind == 'r_manipulate'\"` (post-commit;\n do not require `$event.detail.phase` — that is pre-commit only)\n - `reaction_eligibility = actor.has_capability('<feature>')`\n - `self_eligible = false` (the target is not the manipulator)\n2. Consequence: any frame writes on `Actor` (the reactor) or `TargetActor`\n (the attacker), e.g. a `ModifyResource` heal on the reactor. Clamp is\n automatic at resource max.\n3. When the rule needs the damage amount or type, switch to\n `condition-hook-on-event`; when it needs an event the kernel does not\n emit (a fall), record that in a substrate verdict.\n\n## TOML example\n\nSchematic (ids are illustrative; the shipped reaction with this shape is\nOpportunity Attack in `packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`,\nwhich uses an `r_move` trigger instead):\n\n```toml\n# pattern: post-commit-hit-reaction\n[[action_definitions]]\naction_id = \"my-bundle/feature/rally-on-hit\"\nreaction_trigger = \"$event.kind == 'r_manipulate'\"\nreaction_eligibility = \"actor.has_capability('my-bundle/feature/rally-on-hit')\"\nspends_channel = \"srd/economy_channel/reaction\"\nself_eligible = false\n\n[[consequence_frame_writes]]\ntemplate_id = \"my-bundle/feature/rally-on-hit/success\"\nordinal = 0\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/hp\"\ndelta_source = \"1d10 + macro('srd/ability_modifier', actor.effective('srd/dex'))\"\n```\n\nMacros are called as `macro('<id>', args…)`\n(`crates/spellkave-dsl/src/lib.rs:1759`).\n\n## Proof\n\n- Precedent: Opportunity Attack\n (`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml`)\n- Heroic Inspiration uses the **pre-commit** stochastic path\n (`$event.detail.phase == 'resolution'`) — different seam; do not copy\n those detail conjuncts onto post-commit mitigate reactions.\n\n## Related\n\n- [`offer-vs-resolution-roll`](./offer-vs-resolution-roll.md)\n- Opportunity Attack eligibility geometry in\n [`interaction-dsl-and-world-authoring.md`](../interaction-dsl-and-world-authoring.md)\n\n## Known misuse\n\n- Expecting `$event.detail.damage` or damage type on post-commit\n manipulate intents (not populated).\n- Authoring a hit reaction as `self_eligible` on the attacker's turn (wrong seat).\n- Using pre-commit Heroic Inspiration triggers for post-hit mitigate.\n\n## SRD features\n\n- Opportunity Attack (the shipped reaction shape, on `r_move`).\n- Deflect Attacks moved to `condition-hook-on-event` (sk-609b.12.2); the id\n `srd/monk/deflect-attacks` is now a self-only \"ready\" action, not a\n reaction (`fixtures/base/classes/monk.toml:1848-1861`).\n- Slow Fall needs a fall event (verdict when absent).\n- Concentration break on damage is a condition hook, not a reaction.\n\n## Misuse\n\n- A **forced** rule (concentration save, Relentless Endurance) as a reaction\n window: ADR-0093 D-7 turn-bound windows have no timeout, so silence keeps\n the benefit forever. Forced rules are `condition-hook-on-event`.\n- Filing \"no damage magnitude on the post-commit intent\" as a kernel gap\n before reading `condition_definition.hooks` (`Layer2.ResourceDelta` carries\n `delta`/`entity_id` as Int facts and `template_id`/`resource_id` as Text;\n `crates/spellkave-dsl/src/lib.rs:4035-4100`).\n",
252
+ "patterns/proactive-level-up": "# Proactive level-up watch\n\n## Name\n\n`proactive-level-up` — Proactive level-up watch (NPC offers when a threshold is crossed)\n\n## Problem\n\nWhen the hero crosses the next XP threshold, the DM should call them over and offer the level-up — the player should not have to poll their own sheet.\n\n## Forces\n\n- An invitation needs addressability; the consent offer needs co-location.\n- One durable ceremony latch records the last applied level, so later levels\n can reopen the wizard. Process memory alone cannot prove sheet completion.\n- The drafting handles and choices must exist before the offer is delivered.\n- Movement carries hero and DM into the advancement limbo where the wizard's\n spatial niches are attached, and later returns them to the authored destination.\n\n## Solution\n\nThe DM's threshold watch reads observed XP and level and compares the next\nthreshold. Away heroes receive a directed telepathic invitation through the\nDM's authored Party extent. Once co-located, the watch offers the discrete\nAccept/Decline pair. Its per-hero/level memory limits repeated invitations;\na host restart can re-invite or re-offer before the durable latch changes.\n\nOrdinary `dm/level-up/enroll` remains a zero-delta initialization act for\nDM and trainee state homes. The current candidate blueprint also seeds its\nown draft homes. The watch checks the DM's visible applied-level latch before\nits offer; this is not a claim that enrollment uniquely creates every home.\nBefore offering, the host opens the preauthored `dm/level-up/drafting`\ncondition through `dm/act/level-up/open`. The condition admits fixed consent\nand drafting handles. No per-hero action definitions or runtime manifest\ngrants are published. The seat and XP watcher share one host-level opening\nreceipt per hero and observed level, so a delayed watcher cannot reopen a\nphase already declined. A refused opening remains retryable; a later earned\nlevel gets its own opening. A new host retains the documented reoffer behavior.\n\nOn consent, authored movement actions carry both participants into limbo.\nFeature and sheet acts complete before the applied-level latch advances;\nthe successful apply frame also removes the drafting condition, then return\ncarries both back. Decline removes the condition in the same frame that clears\nconsent, withdrawing all six phase-derived handles. Required\nadventure configuration supplies the hero resolver, persona, level cap,\ninvitation and return location; the runtime does not embed a story's cast.\n\n## Authored reach example\n\nThe elven-mini publisher gives Aldwin the Party-scoped telepathy capability:\n\n```toml\n[[actor_capabilities]]\nactor_entity_key = \"elven_mini/adventure/npc/aldwin_1\"\nbundle_id = \"elven_mini\"\ncapability_id = \"srd/action/communicate/telepathy\"\nelevation_class = \"\"\nextent_kind_ref = \"party\"\nextent_ref = \"srd.party.heroes\"\nsource = \"srd\"\n```\n\nThat grant supplies reach, not evidence that an invitation, consent or sheet\nchange succeeded. The recorder must observe their actual receipts and effects.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/xp-threshold.live.test.ts`\n checks the away invitation and threshold watch.\n- `packages/spellkave-adventure-runtime/tests/live/seat-ceremony.live.test.ts`\n checks the autonomous menu-answer ceremony.\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/aldwin-xp-threshold.test.ts`\n checks the authored phase-opening plan.\n- `packages/spellkave-adventure-runtime/src/dm/level-up/grant-driver.test.ts`\n checks shared opening receipts, retries and later-level reopening.\n- The adventure story's level-up chapters check the resulting player sheet.\n\n## Related\n\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`advancement-choice`](./advancement-choice.md),\n[`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md),\n[`party-extent-grant`](./party-extent-grant.md),\n[`relocate-entity-ungated`](../repairs/relocate-entity-ungated.md).\n\n## Known misuse / anti-pattern\n\n- Free-text consent, repeated offers every tick or a one-shot level latch.\n- Increasing range to cross graphs instead of supplying admitted extent reach.\n- Moving the hero without the DM or the wizard's spatial attachments.\n- Treating the invitation or a selected decision as proof of successful acts.\n- Guarding world-triggered return work solely with restart-lost process memory.\n The current watch blocks repeated refused returns at one latch value through\n `refusedReturnAtLatch`; it does not establish a world-location guard.\n\n## SRD features that use this\n\nElven-mini Aldwin's levels 2–4 arc. Bundle IDs and recorder constraints:\n[`proactive-level-up.md`](../../../spellkave-srd-cc/docs/proactive-level-up.md).\n",
253
+ "patterns/prompt-occurrence": "# Dialogue prompt occurrence (which question is open, for whom)\n\n## Name\n\n`prompt-occurrence` — a typed, server-owned identity for \"the question this\nspeaker has open right now\"\n\n## Problem\n\nA speaker asks a closed question (\"Which class?\", \"Stand with me? 1: yes, 2:\nI must pass\"). The answers are ordinary authored actions the addressee could\nalso fire for a totally different reason. Nothing published says which\nactions answer the question that is open *now*, for *this* addressee — so a\nstale or reused answer silently misfires, and every client re-invents its own\nguess (hotbar ordering, a hard-coded id, a display-name matcher).\n\n## Forces\n\n- Disclosure is not eligibility (ADR-0139/ADR-0141): a client seeing an\n action does not mean it is THE answer to the open question.\n- Reused generic slots. A shared palette (`dialog-choice-slots`'s\n `dm/dialog/choice/k`) is fired by every conversation a talker ever has — a\n delayed \"Answer 1\" meant for question A can satisfy question B's own gate\n predicate and acquire B's meaning.\n- ABA. A static prompt id that closes and reopens (A → closed → A) makes a\n delayed answer to the FIRST A valid again once the SECOND A opens.\n- Duplicates. A generic answer only inscribes a trace; the asker closes the\n slots on a later cycle, so more than one response can land before closure.\n- Audience is a world relation (who is asked), not host/client configuration.\n- No new frame write: the opening/closing transitions already exist as\n authored `ModifyResource` writes (a phase resource, `dm/dialog/open`);\n nothing here adds a `FrameWriteOp` arm. The kernel does keep its own\n occurrence and consumption tables and a prompt gate in `r_manipulate`.\n\n## Solution\n\n1. **Definition** (`prompt_definition`, Layer-3, authored): `source_selector`\n (who may ask — an entity ref or tag), `open_predicate_source` (a DSL\n selector over the SPEAKER'S OWN state — `actor.stat(...)`, never\n `target.stat(...)`), `response_action_ids` (the ordered answer set),\n `audience_kind_ref` (`core/audience/directed_trace` or `core/audience/\n broadcast` — kernel-seeded, no authored row needed), `trace_window_ticks`,\n `contract_version`.\n2. **Occurrence** (`prompt_occurrence`, kernel-maintained, never client-written):\n the server opens one the moment `open_predicate_source` flips false→true\n on a matching speaker (the SAME post-frame hook that already refreshes\n factored context), captures `response_action_ids`, `contract_version` and `audience_trace_id`\n AT THAT MOMENT, and binds the addressee from the speaker's own directed\n speech trace. For `Broadcast` it stores the placeholder addressee `0`; the\n per-perceiver fan-out is not built yet\n (the world API).\n A → closed → A\n yields two DISTINCT occurrence ids — ABA is impossible by construction.\n3. **Check before interpret**: binding is decided at the OCCURRENCE, not the\n definition table. A response that carries\n `semantic_context = { source_ref, occurrence_id }` is ALWAYS judged against\n what is open now for (source, actor): open-for-this-pair → same-occurrence\n → response-in-this-occurrence's-captured-set → not-already-consumed, IN\n THAT ORDER, before the response's own authored predicate ever runs. A\n response WITHOUT context is prompt-bound only while an open occurrence for\n that pair captures its action id (`prompt_context_required`); with nothing\n open it is an ordinary menu answer governed by its own predicate — the\n same generic `dm/dialog/choice/N` slot serves creation menus, plain\n talkers and quest offers. The membership check is what stops a reused\n generic slot from cross-answering one occurrence with another's meaning.\n4. **Consume at commit**: consumption is recorded per (occurrence,\n answering actor) (`r_manipulate/prompt_gate.rs:220-231`) when the\n answer's outcome commits — in the admitting reducer for a deterministic\n outcome, later for a stochastic one that waits on a pending resolution.\n The first committed answer per actor wins; a rejected attempt consumes\n nothing.\n\n## TOML example\n\nTwo shipped shapes open occurrences.\n\n**Static authored prompt** (elven-mini quest offers,\n`packages/spellkave-adventure-elven-mini/author/adventure.ts:135-139`,\nrows in `fixtures/adventure/mechanics/actions.toml`): the giver's shared\nanswer set is disambiguated with the speaker's own bounded\n`dm/dialog/prompt` id — see [`dialog-choice-slots`](./dialog-choice-slots.md)'s\ngeneric `dm/dialog/prompt/set/<id>` family:\n\n```toml\nopen_predicate_source = \"actor.stat('dm/dialog/open') >= 1 && actor.stat('dm/dialog/prompt') == 7\"\nresponse_action_ids = [\"dm/dialog/choice/1\", \"dm/dialog/choice/2\"]\n```\n\n**Scripted menu act** (character creation): the DM presence performs a\nfinite `dm/dialog/ask-menu/<count>` action over the generic\n`dm/dialog/choice/N` response slots. Its consequence inscribes the directed\nquestion and `dispatch_options`, then opens the fixed prompt in the same\nframe. `dialogMenuAct` in\n`packages/spellkave-adventure-runtime/src/dm/dialog/prompt-offer.ts` builds\nthat plan; the host awaits its accepted receipt. No prompt definitions or\npresentation attachments are authored during play.\n\n## Presentation (what the player reads, never what the gate checks)\n\nStatic question text and labels can ride on a public `metadata_attachment`\nunder namespace `dialogue.prompt`, targeting a `prompt_definition`, with\npayload `{ \"question\": string?, \"responses\": { \"<action_id>\": \"<label>\" } }`.\nThe SDK also accepts the existing optional positive `picks_remaining` field\nfor static presentations.\n\nScripted menu definitions instead carry `{ \"presentation\": \"audience_trace\" }`.\nAt opening, the occurrence binds its directed speech trace in\n`audience_trace_id`; broadcast stores zero. The SDK reads the question and\nordered labels from that captured trace, so a later speech trace cannot\nreplace an already open menu's presentation. Creation puts the remaining-pick\ncount in the question text. `prompts[].presentation` exposes these values to\nplayer tools and the native `spellkave prompts` command.\n\nPresentation does not change response admission: the prompt gate checks the\noccurrence's captured response-action set, audience, identity and consumption.\nThe implementation lives in\n`packages/spellkave-sdk/src/core/readers/manipulation_context.ts` and\n`client/src/cli/prompt_presentation.rs`. The seeded shared `dm` namespace and\nfixed response vocabulary remain authored content. The runtime ownership guard\nproves the creation, level-up, dialogue and adventure host paths import no\nmanifest writer.\n\n## Proof\n\n- `crates/spellkave-validate/src/lib.rs`'s `prompt_definition_*` tests\n (locality/stratification, audience/response-action FK resolution).\n- the world API's `target_kinds_match_offline_validator_allowlist`\n (a `dialogue.prompt` label attaches to a `prompt_definition` row directly).\n- `packages/spellkave-adventure-elven-mini/tests/offline/quest-prompts.test.ts`\n (authored generic-offer definitions and presentation).\n- `packages/spellkave-srd-cc/src/test/live-preseeded/mechanics/prompt-creation.test.ts`\n (same-frame trace, immutable captured presentation, and authenticated CLI labels).\n- `packages/spellkave-srd-cc/src/test/live-preseeded/mechanics/prompt-occurrence-gates.test.ts`\n (broadcast zero, stale identity, ABA, member and consumption checks).\n- `packages/spellkave-adventure-runtime/src/dm/runtime-ownership.test.ts`\n (runtime and host import/port guard).\n\n## Related\n\n[`dialog-choice-slots`](./dialog-choice-slots.md) (the shared palette this\ndisambiguates), [`draft-then-confirm-wizard`](./draft-then-confirm-wizard.md)\n(the creation phases this gates one at a time), [`quest-composition`](./quest-composition.md)\n(the accept/decline offer this identifies).\n\n## Known misuse / anti-pattern\n\n- Matching a spoken sentence or a display label as the save path — the\n occurrence id is the only thing a response's `semantic_context` may name.\n- A static prompt id with no occurrence: ABA-replayable, cannot express\n replacement or closure.\n- Authoring `audience_kind_ref` to a Rust-enumerated string instead of a\n `core/audience/*` id or an authored `audience_kind_definition` row\n (ADR-0018 D-1).\n- Bundling a free-form, many-turns-open station (several simultaneously\n valid actions, no single \"the\" answer) under one `prompt_definition` —\n D-5's at-most-once consumption would reject every response after the\n first. Not every open question fits this pattern; a multi-field input\n station does not (ADR-0142 G-5, still open).\n\n## SRD features that use this\n\nAldwin's character-creation class/background/species/confirm questions as\nauthored menu acts (`packages/spellkave-srd-cc/docs/character-creation.md`);\nelven-mini's quest accept/decline offers\n(`packages/spellkave-adventure-elven-mini/docs/elven-mini-quests.md`), whose\ncross-bundle `response_action_ids` resolve through the narrowed\n`action_definitions` reference-closure augmentation (sk-jay0.2.33.15.7).\n",
254
+ "patterns/quest-composition": "# Quest composition (giver slot + objective + terminal watch + reward)\n\n## Name\n\n`quest-composition` — A quest is a composition, not a primitive\n\n## Problem\n\nI need a quest: an NPC offers it, the hero does something in the world, and when it is done the hero is rewarded — and there is no quest row kind.\n\n## Forces\n\n- There is no quest primitive in the world (verified 2026-08-22), and the\n composition below does not need one.\n- Acceptance must be a discrete act (no free-text commitment).\n- The terminal condition is a predicate over world state the giver (or the\n DM) can observe; it must be testable offline against a fake view.\n- Rewards must be paid exactly once and must survive a host restart.\n- XP recipients are a policy decision (the present party, the killer, …);\n the host enumerates them and dispatches an award act per recipient —\n one write cannot broadcast to \"the party present\".\n\n## Solution\n\n| Part | Mechanism |\n|---|---|\n| Offer / accept | a [`dialog-choice-slots`](./dialog-choice-slots.md) pair on the giver (`1: I'll do it.` / `2: Not today.`); the accept writes a persistent world resource `<bundle>/quest/<id>/accepted` (elven-mini `author/quest-progress.ts:8-30`) — conversation steps stay private to the brain |\n| Objective | enemies, items and places authored as ordinary content ([`blueprint-instance-override`](./blueprint-instance-override.md)) |\n| Terminal | an exact boolean over a quest view — `dead(x) && …`, `has_item(hero, y)`, `at(npc, node)`, `flag(z)` — evaluated by the giver/DM seat watch against a live snapshot projection. A `flag(z)` term reads the persistent resource `<bundle>/quest/flag/<z>`, so **something must write it**: an action whose consequence sets it (elven-mini `author/tomb-key.ts` is the worked writer for `q9_tomb_opened`). A terminal flag with no writer never fires |\n| Reward | XP via finite authored recipient awards ([`quest-xp-grant`](./quest-xp-grant.md)), optional items / follow-up speech; each recipient owns an `xp-awarded` marker, and a separate giver settlement changes `accepted` and `rewarded` after successful awards. The watch's memory is only a fast path |\n| Parley (optional) | a villain slot open while `alive(villain) && minions_alive >= 1` whose accept must write the alternative terminal's flag. **Not wired in elven-mini yet:** `createParleyOverlay` (`npcs/quests/parley.ts`) has no production caller and no action writes `q4_maelis_surrendered`, `q5_camp_burned` or `q7_truce`, so those endings are reached only in offline tests (tracked on `sk-jay0.3.4.11`) |\n| Companion (optional) | the giver's seat flips to [`companion-follow`](./companion-follow.md) after the terminal |\n\nAuthor the catalog as data (giver, slot text, objective, terminal, reward,\nenemies) and derive both the seats and the offline proofs from it.\n\n## Authored composition example\n\nThe quest catalog is seat data; its world-facing parts are ordinary rows.\nFor Q1 the catalog reward is 50 XP per selected present recipient. The giver's\nshared Answer 1/2 palette accepts or declines the offer. A terminal watch\nobserves the dead cellar rats and swarm, then runs fixed\n`elven_mini/dm/award-quest-xp/Q1` actions and `elven_mini/dm/settle-quest/Q1`.\nThe generic action builder is `adventure-runtime/src/author/dm/quest-xp-acts.ts`;\nelven-mini binds its IDs in `author/dm-acts.ts`.\n\nThe award formula reads `actor.stat('core/dispatch_arg_quantity')`. Its\npredicate and write use the recipient's durable award marker; settlement uses\nthe giver's accepted and rewarded resources. Author these homes before play.\nThere is no per-terminal action definition or manifest publication.\n\n## Proof\n\n- `packages/spellkave-adventure-elven-mini/tests/offline/elven-mini-quests.test.ts`\n (every terminal satisfies on a fake view; every reward returns the\n catalog XP; rung sums clear the thresholds)\n- Q1 live representative under `SPELLKAVE_LOCAL_NODE=1`:\n `packages/spellkave-adventure-elven-mini/tests/live-preseeded/player/adventure/levels/level-1/03-cellar-rats.ts`\n (driven by `…/player/adventure/adventure.test.ts`).\n\n## Related\n\n[`dialog-choice-slots`](./dialog-choice-slots.md),\n[`quest-xp-grant`](./quest-xp-grant.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`companion-follow`](./companion-follow.md),\n[`milestone-gate-terminal-flags`](./milestone-gate-terminal-flags.md)\n(gating a later beat on earlier terminals).\n\n## Known misuse / anti-pattern\n\n- Filing \"no quest system\" as a kernel gap.\n- Free-text acceptance (\"I'll help\") as the commit path.\n- Keeping commitments or paid rewards only in seat memory: a host restart\n forgets them and pays twice. Accept and reward are persistent world\n resources the grant predicate reads; only conversation steps stay in the\n seat.\n- A `flag(z)` terminal with no action that writes the flag.\n- Granting reward XP to whoever landed the last blow (that is kill XP, a\n different policy).\n\n## SRD features that use this\n\n- Elven-mini Q1–Q12 (givers, terminals, rewards, parleys, Hesper):\n [`elven-mini-quests.md`](../../../spellkave-adventure-elven-mini/docs/elven-mini-quests.md).\n",
255
+ "patterns/quest-xp-grant": "# Quest XP grant\n\n## Name\n\n`quest-xp-grant` — Quest XP grant\n\n## Problem\n\nWhen a quest terminal fires I need to grant a fixed XP reward to the present party (not the killer).\n\n## Forces\n\n- Terminal evaluation and recipient selection belong to the story's watch.\n- Durable per-recipient markers must survive retries and host restarts.\n- A completed giver settlement must follow successful recipient awards.\n- Elven-mini currently selects the hero and co-located catalog companions\n (Rogue, Hesper, Caddoc), joined or not. Its resolver does not filter on\n `srd.party.heroes`; this known membership gap is tracked as\n `sk-jay0.3.4.11.7`. Party extent admission is a separate kernel decision.\n\n## Solution\n\nAt authoring time define one award action and one settlement action per quest.\n`adventure-runtime/src/author/dm/quest-xp-acts.ts` builds these finite actions,\nrequiring `frontier.set_state`. Elven-mini binds them to\n`elven_mini/dm/award-quest-xp/<Qn>` and `elven_mini/dm/settle-quest/<Qn>`.\nThe running DM dispatches them through its act port; it publishes no\nper-terminal manifest or action definition.\n\nFor each unawarded recipient, one dispatch adds the quantity argument to\n`srd/xp` and sets that recipient's `<bundle>/quest/<id>/xp-awarded` marker\nfrom 0 to 1. The world predicate rejects repeat awards. After successful\nawards, a separate giver-targeted act changes `accepted` from 1 to 2 and\n`rewarded` from 0 to 1. If a later step fails, a fresh watch can retry while\nskipping already marked recipients. This is a sequence of receipt-bound\nacts, not one multi-recipient transaction.\n\nAuthor the XP and award-marker homes before play, including in the blueprint\nof a companion spawned later. Missing recipient award-marker observations make the watch's reward snapshot\nincomplete, so it dispatches nothing. This is not a general rule that numeric\nwrites cannot initialize absent rows from resource definitions. Changing an already placed body's\ndefinition does not create its new birth-time state homes; migration policy\nis tracked separately in `sk-jay0.2.57`.\n\n## Authored write example\n\nThe award action is targeted at one recipient and guarded by\n`target.stat('<bundle>/quest/<id>/xp-awarded') == 0`:\n\n```toml\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"TargetActor\"\nresource = \"srd/xp\"\ndelta_source = \"actor.stat('core/dispatch_arg_quantity')\"\n# A second write in the same dispatch increments the recipient's xp-awarded marker.\n```\n\nThe host supplies the catalog reward as the act's `quantity` argument.\nLegacy `renderGrantQuestXp` exports remain publisher composition helpers;\nthey are not the production watch's reward path.\n\n## Proof\n\n- `packages/spellkave-adventure-runtime/tests/live/quest-xp.live.test.ts`\n checks terminal gating, recipient awards, settlement and replay through the watch.\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/q4-quest-xp.test.ts`\n checks actual hero and companion XP after Q4.\n- `packages/spellkave-adventure-elven-mini/tests/offline/dm-acts.test.ts`\n checks finite actions and initial companion award homes.\n\n## Related\n\n[`quest-composition`](./quest-composition.md),\n[`kill-xp-grant`](./kill-xp-grant.md),\n[`companion-follow`](./companion-follow.md),\n[`party-extent-grant`](./party-extent-grant.md).\n\n## Known misuse / anti-pattern\n\n- Awarding quest XP only to whoever landed the killing blow.\n- Settling the giver before successful recipient receipts.\n- Inferring initial zeroes from absent state rows.\n- Selecting recipients by co-location while claiming joined-party membership.\n- Leaving required reward-state readers outside the watch's reader closure:\n see [`watch-reader-manifest-closure`](./watch-reader-manifest-closure.md).\n\n## SRD features that use this\n\nElven-mini Q1–Q12 catalog rewards to the currently selected present recipients.\n",
256
+ "patterns/resource-spend-with-option-menu": "# Resource spend with option menu\n\n## Name\n\n`resource-spend-with-option-menu` — Resource spend with option menu\n\n## Problem\n\nI have a shared pool (spell slots, Channel Divinity uses) and several effects that each spend one use — how do I author the pool once and branch the menu?\n\n## Forces\n\n- One resource_definitions row is the pool; many actions debit it.\n- Option menus for CD effects may be partial (one live branch, others backlog).\n- Gate on `actor.stat(pool) >= 1` on the affordance and debit on success.\n No validator enforces the gate; without it a debit at 0 is a floored no-op\n and the effect still lands\n ([modify-resource-floored-noop](../repairs/modify-resource-floored-noop.md)).\n\n## Solution\n\nAuthor the pool (`spellkave_define_resource` / chapter unit). Each option is its\nown action/affordance with the same spend debit (`ModifyResource` delta `-1` on\nthe pool) and distinct effect body. Advancement/metadata may list members for\nDM dialogue; live spend is still per-action. See\n[`spellcasting-substrate.md`](../../../spellkave-srd-cc/docs/spellcasting-substrate.md)\nand [`caster-features-l1-4.md`](../../../spellkave-srd-cc/docs/caster-features-l1-4.md).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/spells/casting.toml + per-spell debit in fixtures/base/spells/level-1/* (generated by spell-slots.ts / spell-behaviors.ts); Channel Divinity uses in caster-features`:\n\n```toml\n[[resource_definitions]]\nbundle_id = \"srd\"\ndisplay_name = \"Level 1 Spell Slot\" # required\ninitial_value = 0\nmax_value = 9\nmin_value = 0\nrecovery_rule = \"long_rest\"\nresource_definition_id = \"srd/spell_slot_1\"\nvalue_kind = \"int\" # required\n\n# each leveled cast gates + debits the same pool:\n# predicate_source = \"actor.stat('srd/spell_slot_1') >= 1\"\n# frame_write ModifyResource { resource = \"srd/spell_slot_1\", delta_source = \"-1\" }\n```\n\n## Proof\n\npackages/spellkave-srd-cc/src/test/offline/caster-features-units.test.ts; spell casting axis tests; live channel-divinity.test.ts when SPELLKAVE_LOCAL_NODE=1.\n\n## Related\n\n[advancement-choice](./advancement-choice.md), [extra-action-budget](./extra-action-budget.md).\n\n## Known misuse / anti-pattern\n\nOne action that tries to encode every CD option with free-text parsing. Separate pools per option that never share recovery. Expecting a single action with a free-form integer parameter for Lay On Hands / Font costs — discrete menu rungs are the expressible shape until a parameterised spend leaf exists.\n\n## SRD features that use this\n\n- **Spell slots** (shared srd/spell_slot_1..2).\n- **Channel Divinity** uses — Cleric Divine Spark heal/damage, Turn Undead,\n Preserve Life; Paladin spend stub (L12c).\n- **Lay On Hands** discrete 1/5/10 HP menu (L12c).\n- **Font of Magic** slot↔sorcery-point conversions (L12c).\n- Single-option pools (Bardic Inspiration, Wild Shape uses) use the same\n gate + debit without a menu.\n",
257
+ "patterns/rest-boundary-resource-refill": "# Rest-boundary resource refill\n\n## Name\n\n`rest-boundary-resource-refill` — Complete Short/Long Rest refills recoverable pools\n\n## Problem\n\nClass features and spell slots declare `recovery_rule` (`long_rest`,\n`short_rest_partial_long_rest_full`, …) but that field is **documentary** —\nthe kernel never scans it. Completing a rest must actually restore HP, slots,\nand feature uses.\n\n## Forces\n\n- `FireBoundary` already refreshes economy channels and affordance\n `recharges_on` clocks; it does **not** walk `resource_definitions`.\n- There is no `ForEachResource` / tag-driven refill frame write. Attempts to\n invent one are a kernel gap; content must list the pools.\n- `actor.stat('<pool>')` fails closed when the pool was never seeded\n (finding #35). Gate every class-specific refill with\n `actor.has_capability('<feature>')` so `cond` is lazy and skips the\n untaken branch (`crates/spellkave-dsl` `Op::Cond`).\n- Full refill uses `actor.resource_max(id) - actor.stat(id)` (effective max\n honours `entity_resource_bound`). Partial short-rest recovery is a\n constant `+1` (Second Wind / Rage / Focus / Channel Divinity SRD shape).\n\n## Solution\n\n1. Keep Short Rest / Long Rest as actor-carried self verbs whose first\n ordinal is `FireBoundary` (`srd/boundary/short_rest` /\n `srd/boundary/long_rest`).\n2. Append one `ModifyResource` ordinal per recoverable pool on the rest\n consequence:\n - Long Rest full: `cond(has_capability, resource_max - stat, 0)` for a\n pool whose ceiling is the same at every level. A class pool whose size\n grows with level (Rage, Second Wind, Action Surge, Focus Points, Channel\n Divinity) refills to a per-level macro generated from the class's\n Features table instead: `cond(has_capability, max(0, macro('srd/rage_uses_max') - stat), 0)`.\n The resource ceiling of such a pool is its level-20 value, so\n `resource_max` would hand a level-1 hero the pool of a level-20 one. HP is\n ungated (every resting creature carries `srd/hp`) and heals a player\n character to its real maximum, the `srd/hit_point_maximum` macro, never\n to the resource ceiling; other creatures heal to `resource_max`.\n - Short Rest partial: one use back, never past the same per-level macro:\n `cond(has_capability, min(1, max(0, macro('srd/rage_uses_max') - stat)), 0)`\n for `short_rest_partial_long_rest_full` pools; refill to the macro for\n pools that recover on either rest (Action Surge).\n - Short Rest Hit Point Die: one die per rest, for a hurt player character\n with a die left. Create both counters with a zero delta first (a read of\n a resource the actor never had fails closed), capture the rolled heal\n (class die + Constitution modifier, at least 1, capped at the room below\n the real maximum) in the scratch resource `srd/hit-die-heal`, add the\n scratch to `srd/hp`, then add 1 to `srd/hit-dice-spent` only when the\n scratch is above 0. A hero has one die per level\n (`srd/hit-dice-spent < srd/level`). The Long Rest sets the spent counter\n back to 0. The capture is the idiom of the death save\n ([derived-value-mechanism](derived-value-mechanism.md)).\n3. Feature-specific mid-rest rites (Arcane Recovery, Magical Cunning) stay\n separate actor-carried verbs with their own once-per-long-rest use pool\n — they are not automatic on the shared boundary.\n\n## TOML example\n\nExcerpt from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/rest.toml`\n(ordinals 0, 2 and 5 of the Long Rest consequence; the others refill Heroic\nInspiration, spell slots and further class pools):\n\n```toml\n# pattern: rest-boundary-resource-refill\n[[consequence_frame_writes]]\nordinal = 0\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.FireBoundary]\nboundary_id = \"srd/boundary/long_rest\"\nscope = \"Actor\"\n\n[[consequence_frame_writes]]\nordinal = 2\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/hp\"\ndelta_source = \"cond(actor.has_tag('srd.player_character'), max(0, macro('srd/hit_point_maximum') - actor.stat('srd/hp')), actor.resource_max('srd/hp') - actor.stat('srd/hp'))\"\n\n[[consequence_frame_writes]]\nordinal = 5\ntemplate_id = \"srd/rest/long/complete/success\"\n\n[consequence_frame_writes.frame_write.ModifyResource]\nactor = \"Actor\"\nresource = \"srd/fighter/second-wind-uses\"\ndelta_source = \"\"\"\ncond(actor.has_capability('srd/class-feature/fighter/second-wind'),\n actor.resource_max('srd/fighter/second-wind-uses')\n - actor.stat('srd/fighter/second-wind-uses'), 0)\n\"\"\"\n```\n\n## Proof\n\n- Generator: `packages/spellkave-srd-cc/src/chapters/playing-the-game/fragments/rest.ts`\n- Offline: `packages/spellkave-srd-cc/src/test/offline/rest-refill-coverage.test.ts`\n (the rest fixture carries a `resource_max` refill ordinal per pool)\n- Live: complete Long Rest with spent Second Wind / slots → SQL read-back\n\n## Related\n\n- [`actor-carried-feature-verb`](./actor-carried-feature-verb.md) — the pools\n these refills charge\n- [`extra-action-budget`](./extra-action-budget.md) — Action Surge uses the\n same long/short full refill\n- [`action-economy.md`](../action-economy.md) — `FireBoundary` itself\n\n## Known misuse\n\n- Expecting `recovery_rule` alone to restore anything at runtime.\n- Ungated `actor.stat` on a class pool for every creature on rest (fails\n the whole consequence chain for non-owners).\n- Treating Arcane Recovery / Magical Cunning as automatic boundary side\n effects — they are optional rites with their own use counters.\n- Treating Relentless Endurance as \"just a rest-refilled charge\": the charge\n half fits this pattern, but the 0-HP intercept does not\n (`packages/spellkave-srd-cc/docs/substrate-verdicts/relentless-endurance-0hp-intercept.md`).\n\n## SRD features\n\nLong Rest HP/slot recovery and the return of spent Hit Point Dice; one Hit\nPoint Die spent per Short Rest; Second Wind / Rage / Focus / Channel Divinity\npartial short + full long; Action Surge either rest; Arcane Recovery and\nMagical Cunning as separate verbs (BL-70); curated wand charges (Wand of\nMagic Missiles, Wand of Fireballs, sk-609b.13) — modelled as a full refill\non a Long Rest (`rest.toml:308-317`), not the SRD's partial recharge at\ndawn.\n",
258
+ "patterns/role-driven-brain": "# Role-driven brain (fight behavior selected by an instance tag)\n\n## Name\n\n`role-driven-brain` — Combat brain selected from a creature's role tag\n\n## Problem\n\nI have many enemies in many encounters and need each to fight sensibly (archers keep range, brutes charge, leaders hang back) without writing a bespoke seat per creature.\n\n## Forces\n\n- The module contains no actor decision logic: an NPC needs a driver\n ([`npc-needs-driver`](../repairs/npc-needs-driver.md)), and one driver\n per creature does not scale to a bestiary.\n- Behavior is a fact about the *instance in this scene* (the same goblin\n may be a skirmisher in one fight and a leader in another).\n- Speech / parley lines are adventure content, not part of the brain.\n- Tag families should be declared as tag prefixes (an undeclared prefix is\n warning `MF-VAL-298`; a `tag_value_definitions` row whose bundle does not\n own the prefix is fatal `MF-VAL-306`, `crates/spellkave-validate/src/tag_grammar.rs:76-79,127-129`)\n and every tag needs a reader.\n\n## Solution\n\n1. Define a registered tag family `<bundle>.creature.role.<role>` with a\n small closed vocabulary (skirmisher, archer, brute, leader, lurker,\n undead-tide, caster-boss, …) and stamp one on every monster definition\n (generator-owned heuristics: attack shape + type/size, with per-scene\n overrides) or on the instance's `[[entity_tag]]`.\n2. Keep content-free role brains in the NPC package; a **seat factory**\n reads the definition/instance tags (or an explicit `role`) and returns\n the brain. Speech and parley stay optional app-owned parameters.\n3. Stock fights then need only the instances + tags\n ([`blueprint-instance-override`](./blueprint-instance-override.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/monsters/storyline-encounters.toml`:\n\n```toml\n[[entity_tag]]\nbundle_id = \"elven_mini\"\nentity_key = \"elven_mini/adventure/encounter/road_wolf_1\"\nsource = \"manifest\"\ntag = \"srd.creature.role.skirmisher\"\n```\n\nSeat side (TypeScript, not TOML):\n`createRoleDrivenBrain({ definitionTags | role, hostileReplyLine?, … })`\nfrom `@spellkave/adventure-runtime` (`src/role-driven/index.ts`); the Crypt\nWarden uses `role: \"archer\"` plus its hostile refusal line\n(`hostileReplyLine`).\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/creature-roles.test.ts`\n (every monster definition carries exactly one role; overrides win)\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/multi-role-fight.test.ts`\n- `packages/spellkave-adventure-elven-mini/npcs/__tests__/crypt-warden-brain.test.ts`\n\n## Related\n\n[`blueprint-instance-override`](./blueprint-instance-override.md),\n[`companion-follow`](./companion-follow.md) (another seat-policy pattern),\n[`npc-needs-driver`](../repairs/npc-needs-driver.md),\n`crates/spellkave-npc-host/MILESTONE-role-driven.md` (the role-driven contract).\n\n## Known misuse / anti-pattern\n\n- A bespoke seat per creature.\n- Encoding behavior in the kernel (a \"hostile AI\" primitive).\n- Hand-editing generated fixtures to set roles — override in the generator.\n- Minting a role tag without a reader.\n\n## SRD features that use this\n\n- Every `srd/creature/<slug>` definition; elven-mini §5 encounters, the\n Crypt Warden, storyline villains. Role table and assignment heuristics:\n [`combat-roles.md`](../../../spellkave-srd-cc/docs/combat-roles.md).\n",
259
+ "patterns/tag-membership-menu": "# Tag-membership menu (derive lists from tags, tables from tag metadata)\n\n## Name\n\n`tag-membership-menu` — Membership from tags, reference tables as tag metadata\n\n## Problem\n\nI need a list (all fighting styles, all wizard spells of level 1, every skill) for a menu or a filter, or a finite reference table (ability-score meaning bands, DC bands) for authors and DMs to read — without a hand-maintained list that chases the catalog.\n\n## Forces\n\n- A hand list silently rots when the catalog grows; tag membership is\n recomputed from the rows themselves.\n- A finite source table that explains ONE semantic class and has no\n structured runtime consumer should not become one row per rung.\n- Declare every tag family in the bundle's `tag_prefixes`. A tag whose\n namespace no declared prefix covers is warning `MF-VAL-298`; a\n `tag_value_definitions` row whose bundle does not declare the EXACT\n owning prefix is fatal `MF-VAL-306` (the bare bundle catch-all does not\n cover a longer family's value rows;\n `crates/spellkave-validate/src/tag_grammar.rs:76-79,127-129`). For an\n exact-value vocabulary every value must be a `tag_value_definitions` row\n (naming a non-member is fatal); other ref-typed prefixes only warn\n (`tag_grammar.rs:95-104`).\n- Vocabulary without a reader is cargo cult: every adopted tag names its\n consumer (predicate, server read, test, UI).\n\n## Solution\n\n- **Membership**: tag each member (`<bundle>.feat.fighting_style.*`,\n `<bundle>.spell.list.<class>`), register the family in the bundle\n header's `tag_prefixes`, and derive menus / pick lists by filtering rows\n on the tag (plus level or other facts). Feed\n [`advancement-choice`](./advancement-choice.md) members from this.\n- **Typed references** ride inside a dotted family when no first-class\n column exists (`<bundle>.ability.wis` on a skill capability refers to\n the `<bundle>/wis` resource); declare the family and target kind so\n lint and ref-chasing can resolve it.\n- **Reference tables** (ability-score meaning bands, difficulty-class bands)\n render into the shared `tag_value_definition.description` of the one\n tag that names the class, generated from the parsed source with\n provenance pinned. Discovery metadata only — predicates, macros and\n world facts remain the executable rule\n ([`derived-value-mechanism`](./derived-value-mechanism.md)).\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/classes/advancement-metadata.toml`\n(a menu member carrying the membership its tag already implies) and the\nweapon tag vocabulary:\n\n```toml\n# every entity tagged srd.feat.fighting_style is a member of this menu; the\n# generator derives both the tag and the member rows from the same parsed\n# feat category (advancement-metadata-units.ts:352-355), never a hand list\n[[metadata_attachments]]\nbundle_id = \"srd\"\nnamespace = \"srd.advancement_choice\"\npayload_json = '{\"class\":\"fighter\",\"level\":1,\"choice_group\":\"srd/fighter/1/fighting-style\",\"choose_n\":1,\"rechoose\":\"none\",\"grants_ref\":\"srd/feat/archery\",\"recommended\":\"srd/advancement-choice-option/fighter/1/feat/defense\"}'\ntarget_kind = \"entity_definition\"\ntarget_ref = \"srd/advancement-choice-option/fighter/1/feat/archery\" # unique per-menu wrapper; grants_ref is the tagged feat\n\n# packages/spellkave-srd-cc/fixtures/base/equipment/weapons/dagger.toml\n[[entity_definition_tag]]\nentity_def_id = \"srd/weapon/dagger\"\ntag = \"srd.weapon.property.finesse\" # family srd.weapon registered in tag_prefixes\n```\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/offline/dm-data-advancement.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/feats-units.test.ts`\n- `packages/spellkave-srd-cc/src/test/offline/tag-value-vocabulary.test.ts`\n (`srd.ability_score` description pinned to the parsed table, `:149-162`)\n\n## Related\n\n[`advancement-choice`](./advancement-choice.md),\n[`identity-tag-capability-grant`](./identity-tag-capability-grant.md)\n(tags that are live identity),\n[`metadata-attachments`](../metadata-attachments.md),\n[`fixture-correctness`](../fixture-correctness.md) (tag hygiene rows).\n\n## Known misuse / anti-pattern\n\n- A hand-written member list in TypeScript.\n- One tag or fixture row per table rung.\n- Colon-shaped or flat tags (`faction:party`) — fully dotted under the\n bundle namespace.\n- Forgetting the `tag_prefixes` entry and reading `MF-VAL-298` / `MF-VAL-306`\n as a validator bug. (`MF-VAL-306` used to double as a DSL-macro check too;\n sk-jay0.7.174.28 moved that one to `MF-VAL-356`.)\n- Minting a relation-shaped tag without declaring its family and target.\n\n## SRD features that use this\n\n- Fighting-style menus, class spell lists, skill → ability references,\n `srd.ability_score` / `srd.difficulty_class` descriptions. Naming rules\n and the rename history:\n [`tags-and-ids.md`](../../../spellkave-srd-cc/docs/tags-and-ids.md).\n",
260
+ "patterns/trace-perceptibility-window": "# Trace perceptibility window (event vs standing mark)\n\n## Name\n\n`trace-perceptibility-window` — Declare event-or-mark on the trace KIND\n\n## Problem\n\nI need a perceivable thing that is either an event (heard only as it happens — speech) or a standing mark (a slime trail, a scorch — findable whenever someone walks in), or something in between that fades.\n\n## Forces\n\n- A trace is perceived at two moments: when inscribed (everyone\n co-located) and on ARRIVAL, when a body later walks onto its node.\n- A tick is as long as the operator says (300 s by default): a whole\n scene plus several arrivals fits inside one, so \"this tick\" is not\n \"this instant\".\n- Deleting a trace reaches backwards: the player read path resolves each\n remembered trace through the `trace` table, so deletion silently\n un-hears a listener who had already heard.\n- An elevated/DM caller must still be able to read the full history of the\n nodes it watches.\n\n## Solution\n\nSet `trace_kind_definitions.perceptible_for_ticks` — it governs ONLY the\narrival moment, never the inscription moment, and never the row's life:\n\n| Value | Meaning | Example |\n|---|---|---|\n| *omitted* | standing **mark** — findable whenever you walk in | a slime trail |\n| `0` | **event** — perceived only as it happens | speech |\n| `n` | lingers, then fades | smoke, a scent |\n\nThe bound is exclusive: `n` admits arrivals through `inscribed_at + n - 1`,\nso `0` admits nothing on arrival at all, including on the utterance's own\ntick. The row survives either way; memories formed stay formed. Do **not**\nuse `expires_at_tick` to get this effect.\n\n## TOML example\n\nCopied from `packages/spellkave-srd-cc/fixtures/base/playing-the-game/speech.toml`\n(event) and `packages/spellkave-adventure-elven-mini/fixtures/adventure/story/traces.toml`\n(standing mark):\n\n```toml\n[[trace_kind_definitions]]\nbundle_id = \"srd\"\nkind_id = \"srd/speech\"\nlocation_kinds = \"place_node\"\nperceptible_for_ticks = 0\nschema_json = '{\"text\":\"string\",\"addressee\":\"integer?\"}'\n\n[[trace_kind_definitions]]\nbundle_id = \"elven_mini\"\ndescription = \"A glistening trail of translucent slime, still faintly wet — something crawled through here.\"\nkind_id = \"elven_mini/adventure/trace/slime_trail\"\nlocation_kinds = \"place_node\"\nschema_json = \"{}\"\n# perceptible_for_ticks omitted → standing mark\n```\n\n## Worked example: a KERNEL-emitted kind (`core/departure`)\n\nA trace kind is content even when the KERNEL writes its rows. When a body\nwalks out of a place node the kernel inscribes `core/departure` at the node it\nleft (bead sk-jay0.1.23.35.4), and this window is the whole reason a companion\none room behind can still follow: the departing body's own room-mates perceive\nit as it happens, and anyone who arrives within the authored window finds the\ntrail still fresh.\n\n```toml\n[[trace_kind_definitions]]\nbundle_id = \"core\"\nkind_id = \"core/departure\"\nlocation_kinds = \"place_node\"\ndescription = \"Someone left this place through an exit, and the way they went is still readable here.\"\nschema_json = '{\"mover\":\"integer\",\"via_place_edge_id\":\"string\",\"exit_label\":\"string\"}'\nperceptible_for_ticks = 6\n```\n\nCopied from\n`packages/spellkave-mechanics/fixtures/core/base/long-running-actions.toml`.\nRead the number as fiction: six ticks is a fresh trail, not a ledger. Author it\nshorter and a follower two rooms behind loses the scent; author it much longer\nand a room remembers every passer-by for an hour.\n\nTwo rules this example shows that the table above does not:\n\n- The row outlives the window on purpose, but it is not permanent: the\n kernel sets `expires_at = now + 10 × window` (60 ticks for the authored 6;\n fallback 60) (the world API).\n The window governs arrival; the ROW's life is a separate decision, and\n deleting the row early would un-perceive someone who already holds the\n memory.\n- The payload names the EXIT taken, never the destination node. A late arrival\n reads which way someone went and resolves that exit against the exits it can\n see itself — a footprint must not teach a room nobody has entered.\n\n## Proof\n\n- `packages/spellkave-srd-cc/src/test/live-self-seeding/mechanics/speech.ts`\n (walk out / speak / walk back in pins the arrival rule)\n- Demo: `openspec/specs/world-knowledge-and-perception/demos/sk-n16-speech-anchor-and-temporal-admission.md`\n- the world API (the kernel-emitted\n example above: its seam-B window tests use the same number 6, hard-coded\n in the test, and assert the 10× lifetime)\n\n## Related\n\n[`directed-speech-anchor`](./directed-speech-anchor.md),\n[`lingering-hazard-zones`](../lingering-hazard-zones.md) § \"Traces that\nfade on their own\" (the decay-deletes warning in substrate terms),\n[`lingering-hazard-zone`](./lingering-hazard-zone.md).\n\n## Known misuse / anti-pattern\n\n- Decaying a trace (`expires_at_tick`) to make it stop being heard.\n- Expecting `perceptible_for_ticks = 0` speech to be heard by a body that\n arrives later in the same tick.\n- Modelling a standing mark as an event and wondering why explorers never\n find it.\n\n## SRD features\n\n- `srd/speech` (event), the elven-mini slime trail (mark), utility spell\n cast marks (mending / prestidigitation / alarm — srd-cc L12d `trace_cast`). Residue and the\n full lifetime note:\n [`speech-and-traces.md`](../../../spellkave-srd-cc/docs/speech-and-traces.md).\n",
261
+ "patterns/watch-reader-manifest-closure": "# Watch reader-manifest closure\n\n## Name\n\n`watch-reader-manifest-closure` — a watch subscribes every table its injected\ncallbacks read, not only the ones its own body names.\n\n## Problem\n\nAn NPC watch runs on one connection and declares that connection's tables\nonce, in its own `subscribeReaders` call. Hosts then inject callbacks —\n\"who is the hero\", \"who is present\", \"is this quest accepted\" — and those\ncallbacks read tables the watch body never mentions. On an unsubscribed table\nan SDK reader does not throw: it sees an empty table and answers *nothing\nfound*. The watch keeps running and quietly does less than it was wired to\ndo.\n\n## Forces\n\n- Subscriptions are per connection. A DM seat has ONE port and connection\n that every watch on that seat shares; `subscribeReaders` widens it\n additively (the retired TypeScript DM port; the Rust host's reader tiers, `crates/spellkave-npc-host/READER-HYDRATION.md`).\n Nothing widens it automatically: a callback the host supplies reads only\n what some reader manifest on that connection has subscribed, so a table\n that neither the watch's manifest nor the host subscribes stays empty.\n- SDK readers fail soft by design: `readActorSnapshot` returns `null` when\n `visible_actor_spatial_location` carries no matching row, which is\n indistinguishable from \"that actor is genuinely nowhere\".\n- The degraded answer is usually a *legal* answer. An empty companion list is\n exactly what an omitted resolver produces, so the failure looks like the\n documented default rather than a bug.\n- Perception-gated `visible_*` tables differ per socket: the same reader can\n work on an operator connection and return nothing on the NPC's own.\n- Runtime `session` / `session_participant` are **private** (ADR-0057, sk-2qt).\n Clients subscribe `visible_session` / `visible_session_participant`. A caller\n sees only sessions whose roster includes a directly-controlled body, or a body\n reached by an Internal-elevated DM extent. Unrelated sockets receive no\n TravelState `state_json` and no distant initiative. Reading the raw table\n names yields an empty handle, which looks like \"no fight / not travelling\".\n\n## Solution\n\nTreat the callback contract as part of the subscription. When a watch accepts\nan optional resolver, its own reader manifest carries the tables that\nresolver's documented implementation needs, and a comment says which resolver\neach extra table is for — so a later reader deleting the \"unused\" table sees\nwhy it is there.\n\n```ts\nawait port.subscribeReaders([\n {\n requiredTables: [\n \"visible_manifest_authored_entity\",\n \"visible_manifest_authored_entity_coverage\",\n \"visible_target_condition\",\n \"entity\",\n \"actor\",\n \"visible_object_state\",\n // A host that answers `resolvePresentPartyEntityIds` by co-location\n // reads it through `readActorSnapshot`, which reads\n // `visible_actor_spatial_location`. Without this table the resolver\n // sees no companion anywhere and silently rebuilds the hero-only\n // grant it exists to replace.\n \"visible_actor_spatial_location\",\n ],\n },\n]);\n```\n\n## Proof\n\n`packages/spellkave-adventure-runtime/src/dm/watches/quest-xp-watch.ts`\n(reader list `QUEST_XP_WATCH_READERS` in `dm/lib/readers.ts`) subscribes `visible_actor_spatial_location` for\n`resolvePresentPartyEntityIds`;\n`packages/spellkave-adventure-elven-mini/npcs/catalog.ts` supplies the\nresolver. Live proof:\n`just srd-cc-live src/test/live-self-seeding/mechanics/q4-quest-xp.test.ts` —\n`Aldwin granted 200 quest XP for Q4 to 2,143,15`, `xpAfter={hero:200,\nrogue:200, hesper:200}`. Before the table was subscribed the same wiring\ngranted `to 2` alone (bead `sk-awlo.15`, PR #2792 measurement).\n\n## Related\n\n- [`quest-xp-grant`](./quest-xp-grant.md) — the grant this closure makes\n reach the whole present party.\n- [`party-extent-grant`](./party-extent-grant.md) — where party membership\n itself comes from.\n- [`before-filing-a-kernel-gap`](./before-filing-a-kernel-gap.md) — an empty\n live read is a subscription question before it is a substrate question.\n\n## Known misuse / anti-pattern\n\nConcluding from an empty read that the world is empty. `q4-quest-xp.test.ts`\ncarried exactly that inference in reverse: it saw `entityNodeId` return\nnothing on the operator socket, and hardcoded the companion pair rather than\nwidening the subscription — a correct local call that hid the production\ndefect for as long as it stood.\n\nEqually wrong: adding the whole `visible_*` surface to a watch \"to be safe\".\nEach table is bandwidth on a long-lived connection; subscribe what a named\nresolver reads, and say which one in a comment.\n\nEqually wrong for combat/travel: iterating `db.session` after sk-2qt. The raw\ntable is not on the wire; subscribe and read `visible_session` (and\n`visible_session_participant` for the roster) from a connection that actually\nparticipates or holds Internal DM elevation.\n\n## SRD features that use this\n\n- Elven-mini Q1–Q12 terminal quest XP to the co-located party.\n",
262
+ "place-graph-occupancy": "# Intent — place graph + occupancy (who is where)\n\n**Pull this doc when you need more than the tool guidelines** — gotchas,\noptional third call, fixture quirks. The default path is already on the tools:\n\n| Goal | Call |\n|---|---|\n| Picture + density badges + scale | `spellkave_map_graph` (`target` if needed) |\n| Who sits on which node | `spellkave_query` `{ kind: \"entities\", fields: \"preferred\" }` |\n\nThen **group** entities by `place_node_id` and match to map places. That is\nusually **two calls**. Do **not** N× detail each entity.\n\n## Optional third call\n\nHuman place labels (`Proof Cell` vs raw node ids):\n\n```\nspellkave_query { kind: \"place_nodes\", fields: \"preferred\" }\n```\n\nSkip if node ids / map inventory already suffice.\n\n## Prerequisites\n\n- Authored/local: `author.target` (or `spellkave_config` `author.target`) on the\n manifest or directory you care about; pass `target: \"local\"` when you must\n force that source.\n- For `sk` local registry calls, configure `author.dependencies.<bundle-id>` with\n `sk config set --project author.dependencies.<bundle-id> <manifest-path>` when\n dependencies live in separate packages (this repository's tracked\n `.spellkave/defaults.toml` already maps `srd` and `dm`, as the lowest layer).\n `query`, `map_graph` and `explore`\n resolve these mappings through the transitive dependency closure. Project paths\n are relative to the project root; global dependency paths are relative to the\n global config directory. An explicit `--fixtures-root` overrides the mappings\n for that call with a stderr warning. The real-CLI configure-once regression is\n `packages/spellkave-cli/behaviour/exploration/configured-world.feature`.\n- Live world: connect first; same tools with `target: \"live\"` when available.\n- Empty map: configure a source — map_graph guidance text says how.\n\n### Terminal font (UTF-8 / braille maps)\n\n`spellkave_map_graph` emits **code points + optional ANSI color**. Glyph shape\nis entirely the **terminal emulator font** (Ghostty / Pi host) — not something\nthe tool can embed.\n\n**Operator prerequisite** for clean box-drawing and braille maps:\n\n| Role | Font |\n|---|---|\n| Recommended (often already installed) | **JetBrainsMono Nerd Font Mono** |\n| Strong alternative | **Cascadia Mono NF** / CaskaydiaCove Nerd Font |\n| Coverage needed | Box Drawing `U+2500–U+257F`, Braille `U+2800–U+28FF`, block elements |\n\nGhostty example:\n\n```ini\nfont-family = \"JetBrainsMono Nerd Font Mono\"\n# optional fallback:\nfont-family = \"Cascadia Mono NF\"\n```\n\nInstall (macOS):\n\n```bash\nbrew install --cask font-jetbrains-mono-nerd-font\n# and/or\nbrew install --cask font-caskaydia-cove-nerd-font\n```\n\nCheck locally:\n\n```bash\njust map-font-check\n```\n\nOverride the chrome hint string (does not change rendering):\n\n```bash\nexport SPELLKAVE_MAP_FONT_HINT=\"JetBrainsMono Nerd Font Mono\"\n```\n\nWithout a Nerd Mono font, maps still print but junctions/braille may look\ngappy or fall back to tofu. CI does not require a font.\n\n## Spatial toolbox verbs (prep for content)\n\nBeyond `author_place` + `map_graph`:\n\n| Tool | Purpose |\n|---|---|\n| `spellkave_link_places` | Portal between two existing nodes (cross-graph OK; auto `substrate_crossing`; optional `door` metadata) |\n| `spellkave_attach_map_layer` | `[[map_layers]]` pointer + provenance; image stays in `ccc3-maps` / `FVTT_DATA_ROOT` |\n| `spellkave_annotate_place` | `terrain.hint` metadata and/or demo `h3_origin_res10` on a graph |\n\n`map_graph` overlays resolved `map_layers` when the asset file is on disk\n(`CCC3_MAPS_ROOT` or git-sibling `ccc3-maps/`). Missing assets are skipped\n(CI-safe). details.backdrops_resolved / backdrops_skipped report counts.\n\nAn [operable-door pattern](./patterns/operable-door.md) composes open/closed\nand locked traversal with authored spatial states and edge gates; its live\nplayer proof covers both endpoints. The `door` flag alone remains map\nmetadata. Secret-door discovery, real H3 encode, walls/LOS and JPG auto-trace\nremain separate gaps.\n\n## What each surface means\n\n| Surface | Meaning |\n|---|---|\n| Map badge (blue number) | Count of `actor_spatial_locations` at that outdoor node |\n| `entities` + `fields: preferred` | `name`, `place_node_id`, `kind`, `entity_def_id` per instance |\n| Scale bar / chrome | Metric legend on the SVG (graph `metres_per_unit` → metres) |\n\nDefault `spellkave_query` lists stay **ids-only** (token bound). Always pass\n`fields: \"preferred\"` (or an explicit column list) when you need columns.\n\n## Do not\n\n- Use `actors` for location — they have names, not `place_node_id`.\n- Query `actor_spatial_locations` via `spellkave_query` — not a query kind today\n (map_graph still reads ASL internally for counts).\n- Open SQL / `just sql` for occupancy on authored manifests.\n- N× `kind=entities` + `id` when a preferred list would do.\n\n## Fixture honesty\n\nSome fixtures put **props** on the actor path so mechanics can target them\n(e.g. a pressure plate as `kind: \"npc\"` + `actors` row so a save can read\n`TargetActor` DC). Query and map will show them. When summarizing “people”,\nfilter by role/`kind`/entity_def if the user wants creatures only; the data is\nnot wrong — the fixture is mechanical.\n\n## Related\n\n- Spatial minimal cell: `spatial-minimal-cell`\n- Tool parameters: `tool-reference` (`spellkave_map_graph`, `spellkave_query`)\n- Metric embedding concept: package docs / ADR-0029 (graph `metres_per_unit`, not H3)\n",
263
+ "playable-seats": "# Discovering playable seats\n\nAn Explorer inventory describes rows admitted by its chosen source. An authored\nbody kind such as `player`, an actor row, or an arbitrary `playable` tag does\nnot establish current seat availability or human control. The Explorer does\nnot project live seat state. A zero tag search only means that tag did not\nmatch in the searched collection and reader scope.\n\nStart with `sk explore summary --source local`. Its default `srd.player_character`\ntag row counts admitted definitions and distinct objects separately. `>=1` means\nat least one match in an incomplete projection; `0` is exact only for complete\ncoverage. Definition tags are not inherited onto instances. Override the counted\ntag with `summary --tag <tag>`; this is authored metadata, not a seat-status query.\nThe inventory line explains objects versus technical body, controller and tag rows.\nFile and live counts can differ because live reads a caller-visible authored\nprojection, which may omit contained/runtime bodies and projects catalogs separately.\n\n`sk docs playable-seats` prints this guidance as text; an explicit\n`sk --format jsonl docs playable-seats` retains its metadata envelope.\n\n## Authored offers in an SRD world\n\nThe existing SRD seat contract uses the tag `srd.player_character` on an\nentity or its definition. Inspect authored offers with:\n\n```sh\nsk explore search --collection definitions --tag srd.player_character --source local\nsk explore search --kind entities --tag srd.player_character --source local\n```\n\nKeep the coverage stated by each answer: definitions can hit a fixed reader\nbound, and local authored rows do not prove a runtime body exists. Creation\nCandidate is a reusable definition; opening a creation seat can create its\nbody later. Do not add the tag merely to host an NPC: it also grants SRD\ncapabilities. These are SRD conventions, not a universal body classification.\n\n## Current live seats\n\nThe existing public `seat` table carries `actor_id`, `entity_id`, `name`,\n`embodied` and `claimed`, without occupant identity. The existing Rust CLI\nreads it with `spellkave seat list`; use that CLI's connection configuration\nfor the intended world. The SDK equivalent is `readSeats`.\n\n`sk explore` currently has no equivalent seat-status query. Its authored\ninventory cannot answer whether a particular body is currently claimable,\nclaimed, online, or human-controlled. Read the live seat surface for the\nfirst two facts; a seat row alone does not establish online or human control.\n\nThe detailed existing contract is in\n[actor identity bindings](repairs/actor-identity-bindings.md), including claim\nlifetime and the `seat_catalog_readable` doctor check. Reading seats does not\nclaim, release, or modify them.\n",
264
+ "privileges": "# Privileges: who may do and see what\n\nMost of what an actor may do is decided by authored data: an affordance's\n`gate_predicate` checks `actor.has_capability('core/walk')`, and a bundle can\nmint a new capability without a server change. A **privilege** also requires an authority boundary. The server checks named\nmaintenance/read gates, the publisher identity, dynamic role-binding families,\nand the reserved-prefix lane for authored acts. A manifest can define act\ntemplates under an admitted reserved capability; it cannot bypass these checks.\n\nThis page lists every privilege the server compiles in, plus one read the\nhost decides and this module does not. The CI check\n`the privilege-capability-ids skgate registry gate (bin/skgate run --gate privilege-capability-ids)`\nkeeps section 1 complete (see [Keeping this page complete](#keeping-this-page-complete)).\nIt does not see the host rule in section 2.\n\nRelated: [`dm-oversight.md`](./dm-oversight.md) explains elevation in depth.\nADR-0007 (DM role and trust elevation), ADR-0081 (epistemic visibility) and\nADR-0084 (per-grant elevation ceiling) record the in-module decisions.\nADR-0150 (Proposed, `specifications/adr/0150-publisher-reads-the-world-in-band.md`)\nrecords the publisher read.\n\n## The reserved prefix\n\nThe reserved prefix is `frontier.`. Gameplay condition grants and suppressions,\nidentity tags, equipped or carried items, and definition seeds cannot produce or\nremove authority under this prefix. Configure authority through a\n[`role_bindings`](./roles.md#bind-a-role-to-a-subject) row. Publisher/genesis\nexplicit `actor_capabilities` grants remain a migration lane until .67.\nBlueprint cloning skips\nreserved grants. Offline validation warns (`MF-VAL-375`) when templates,\naction gates or compiled literal predicate checks name reserved capabilities.\nApplying those rows requires each named capability, or `frontier.escalate`,\nin a live Bundle extent covering the row's defining bundle (`MF-APPLY-039`).\nThe publisher and genesis bypass that row admission; adding a bare reserved\nactor grant still follows the separate publisher/genesis-only lane. A manifest\nactor grant with `source = \"role_binding:...\"` is always refused (`MF-VAL-380`);\nonly binding realisation may create that source.\nRole bindings realise capabilities on a separate presence body. Configure\ngameplay equipment with ordinary capabilities.\n\n### Privileged frame landing\n\nA privileged consequence needs a live role binding that covers the affected\nplaces and entities. Transfers check both endpoints. Prepared-place seals\nalso apply. Revoking the binding prevents its pending work from landing.\n\nA placeless role presence can act at a covered target when the action offers\nprivileged templates. A visible target can still fail admission.\n\n## 1. Capabilities the server checks by name\n\nThe world resolves the caller through its bound actors and checks their current bodies,\nincluding placeless role presence bodies. Character selection and authority\nresolution are separate: a primary character does not hide another owned\npresence body's grants.\n\nActing reducers ordinarily bind the authenticated sender to a directly\ncontrolled current body. The reviewed Layer-2 verbs and current-actor\nSessionMove/compound-intent entries also admit bounded `frontier.impersonate`\nsteering, with exact-login consent for Person bindings. Read extent grants\nalone supply no acting authority. Publisher setup/ruling arms remain explicit;\nother direct-control paths keep their direct ownership checks. Service-client\nmutations and NPC steering require the original observation's world/generation;\na hold never transfers the Service edge or silently refreshes stale work.\n\n| Capability id | Unlocks | Special rule |\n|---|---|---|\n| `frontier.apply_manifest` | **Write:** apply a manifest or delta. **Read:** the \"operator\" bit of the spatial views, so the full place catalog without fog of war. | Genesis bootstrap; otherwise a live authored apply grant is required (`MF-APPLY-015`). Presence-held and explicit scoped requests additionally check each row and root against live extents; see codes below. The live apply-holder catalog-read arm remains through .82. |\n| `frontier.prune` | **Write:** ordinary scoped manifest tombstones, including their ownership and target cascade. | A live covering grant is required (`MF-APPLY-046`). Force does not bypass admission. Binding retractions use D6 instead; legacy ordinary-body holders retain the transitional adapter until .84. |\n| `frontier.escalate` | **Write:** maintain role rows and live reserved definitions over the defining bundle. | Alternative to holding all required ids (`MF-APPLY-045`). It does not waive affected-binding D6, clock introduction or reserved-definition introduction. |\n| `frontier.read_hidden` | **Read:** the existing Hidden see-as floor of a live extent grant. | No act authority. |\n| `frontier.read_internal` | **Read:** Internal depth inside a live extent. | Capability-derived depth works alongside the legacy scalar until hosted migration/cutover (.67/.82). |\n| `frontier.pace_time` | **Write:** manual tick(s), pause, resume, start tick loop and bounded cadence; additive `pace_time` tool RPC. | Publisher or a live authored grant on the sender's current body. World-wide regardless of extent; presence attribution precedes a character; no genesis exemption. The tool uses the caller identity and refuses publisher ports. |\n| `frontier.spawn_entity_definition` | **Write:** spawn a new instance of an `entity_definition` at runtime. | Publisher maintenance, or a live realised binding grant covering the actual landing and seal; bare grants land nowhere. No genesis exemption. |\n| `frontier.impersonate` | **Act:** steer an ordinary Actor body's reviewed Layer-2 verbs and current session entries. | Owned non-steerable presence; complete place/body extent, seals, Person consent and original generation. It grants no direct control or character selection. |\n| `frontier.drive` | **Identity:** assign/release durable Service drivers for eligible NPCs. | Owned presence; complete body extent; no playable or binding-subject target, authored binding takeover or already-bound identity. Release follows assigning presence without an extent check and refuses while held. |\n| `frontier.open_session` | **Write:** open an authored session for a bounded vector of existing actor bodies. | Caller-owned role presence; every participant, source and generated destination uses the same live extent and inherited seals. Raw third-party session setup remains publisher-only. |\n| `core/raw_trace_inscription` | **Write:** inscribe a raw `trace` row directly (`r_inscribe_trace`), outside the consequence path. | The body needs admitted direct control or bounded steering and this gameplay capability. A steered raw trace must name a covered place-node landing. |\n\nWhere they are defined and granted:\n\n- `frontier.apply_manifest`, `frontier.pace_time` and `frontier.spawn_entity_definition` are part of\n the world’s standard vocabulary,\n so every node has their definitions from first boot. The same rows exist in\n `packages/spellkave-mechanics/fixtures/core/base/affordances.toml`; the test\n `genesis_capability_rows_match_the_core_fixture_copies` keeps both copies\n identical.\n- `core/raw_trace_inscription` is defined only in\n `packages/spellkave-mechanics/fixtures/core/base/affordances.toml`. A node\n seeded without that fixture has no definition, so nobody can hold it.\n- Binding example: the Elven Mini DM NPC Aldwin receives `frontier.apply_manifest` and `frontier.pace_time`\n through an authored role binding\n (`packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/npcs/aldwin.toml`).\n\nA role binding's D6 gate checks the dynamic id `frontier.bind.<role_id>` or\ncovering live grants of every merged capability; publisher/genesis also admits\nit. This dynamic family is checked in\nthe world API, separately from the named\nconstant inventory above. Roles containing `frontier.apply_manifest` cannot use the holder paths until\n.82. `frontier.spawn_entity_definition` now uses the shared binding landing\ncheck and may participate in covered holder admission. The reference cases in\n`authority/verdict.rs` prove this distinction.\n\n### Manifest write refusals\n\nPresence-held and explicit scoped applies check ownership, both placement images\nand mutation targets at enqueue and before each drain segment. Codes identify\n`041` (outside every extent), `042` (foreign ownership or root claim), `043`\n(unlisted authored row) and `044` (non-publisher whole-world replacement), all\nin the `MF-APPLY` domain. Entry bundle mismatch is `MF-APPLY-037`.\nRole and aggregation maintenance also checks every affected realised binding against its old and final merged capabilities (`MF-APPLY-036`, `realised_binding_impact`). Scoped role writers need the final ids or `frontier.escalate` over the row bundle (`045`); introducing an unknown reserved definition or adding `frontier.pace_time` to a merged role remains publisher/genesis-only (`035`). Static `MF-VAL-379` is a warning, not admission. Authored gates on reserved\nids use the same bundle-scoped role-write verdict at enqueue and every drain\nrecheck (`MF-APPLY-039`); their offline warning (`MF-VAL-375`) does not admit a\nwrite. Spawn parameters choose either a fixed `blueprint_id`, or\n`definition_from_args = true` with a non-empty `allowlist_tag`. Invalid mixed\nmodes or missing spatial fields are fatal `MF-VAL-381`. In args mode,\n`definition_ref` must resolve at execution to an entity definition carrying\nthe tag; it cannot select a place-graph blueprint.\n\nThe legacy ordinary-body delta/bundle adapter remains until `.67`/`.84`;\nwhole-world replacement already requires the publisher.\n\nAn unlisted `object_state` row is a satellite of its entity. An owner-preserving\nraw overwrite keeps its existing stamp and checks placement plus target reach.\nClaiming it in applyset memory, changing its stamp or retracting it requires a\nnonempty target-owner set wholly inside the writer's Bundle extents. A listed\nstate row retains its ordinary takeover check. Policy tests live in\nthe world API; the live producer/observer proof\nis `packages/spellkave-cli/src/__tests__/extent-scoped-apply.live.test.ts`.\n\n## Privileged runtime acts\n\nAn affordance whose `capability_id` starts with `frontier.` selects a privileged\nframe. Its authority is the selected body, capability and binding, preserved\nthrough reactions and scheduled work. Every placed mutation checks the live\nrealised binding's current extent. Normal landings check their seals; the bounded\n`BreakPlaceSeal` operation alone selects and breaks a covered closed seal. Other\nwrites recheck their own landing, including any remaining ancestor seal. A stale grant\ncopy cannot widen a changed binding. Bare explicit grants select no binding and\nland nowhere. Ordinary frames retain ordinary reach; an action with both ordinary\nand privileged candidate templates requires the ordinary actor location before\nselection. These rules are pinned by `authority/landing.rs`, the enum landing\ninventory, and the live privileged-act journey.\n\nThe demo `core` bundle supplies these authored compositions. Adventures can\ncompose existing primitives with their own content. The `afflict` family covers\nconditions and identity tags; `set_state` covers state, name and text. These compositions\nuse ordinary mutation leaves and the bounded seal transition; `.92` owns the broader parameterized\ndispatch menus for those same families.\n\n| Action | Capability suffix | Target and argument |\n|---|---|---|\n| `core/act/spawn` | `spawn_entity_definition` | Place with the `core/mark_surface` niche; `args_json` carries `definition_ref`, an entity definition tagged `core/spawnable` |\n| `core/act/despawn` | `despawn` | Creature; refuses identity-bound and playable-seat bodies |\n| `core/act/lock`, `core/act/unlock` | `set_state` | Object tagged `core/lockable`; writes Boolean `core/locked` |\n| `core/act/give`, `core/act/take-back` | `transfer` | Creature; inserts/removes the authored `core/item/loot_dagger` choice |\n| `core/act/afflict`, `core/act/remove-condition` | `afflict` | Creature; applies/removes the authored `core/condition/prone` choice |\n| `core/act/plant` | `inscribe` | Place with the `core/mark_surface` niche; optional `dispatch_text` becomes clue text |\n| `core/act/break-seal` | `break_seal` | Place with the same niche; required nonblank `dispatch_text` of at most 1024 UTF-8 bytes; a covering PlaceGraph binding is required |\n\nThe core wolf is a neutral stat-free example tagged `core/spawnable`. An args-bound\nSpawn accepts entity definitions only, refuses a graph blueprint or non-allowlisted\nchoice, and gives the spawned body no summoner identity. A fixed graph Spawn must\nhave a landing graph and becomes its child. Each core act leaves a trace naming the presence. The ordinary act markers use\n`core/observed_change` at their landing. The seal transition creates exactly one\nPublic `seal_break` trace at the selected sealing graph's anchor, associated with\nthe same existing ApplyConsequence event as its durable break row.\nThe shared creature and lockable-object niches represent physical target facts;\nremove-condition additionally requires prone. Unplant is transitional under `sk-jay0.3.24.131`;\nprivate hints are transitional under `sk-jay0.3.24.132`.\n\nWriting a privileged template requires holder-or-escalate authority over its\nbundle at both enqueue and cursor recheck (`MF-APPLY-039`). Offline `MF-VAL-375`\nis advisory; `MF-VAL-380` fatally rejects a forged `role_binding:` grant source,\neven for the publisher. `sk explain capability <id> --target live` marks its\ntemplates with `privileged`. Doctor's `privileged_template_unheld` audit reads\nprivate applyset provenance and reports lost applier authority without retracting\nanything. Missing ownership/provenance evidence is reported as unknown; run as\npublisher for a whole-world audit.\n\n[Versioned local examples and refusal receipts](../../../sandbox/privileged-acts-as-affordances/README.md)\ninclude the installed CLI outside the checkout, caller-owned presence selection,\nindependent mutation assertions and whole-journey cost. The captured Plant argv\nuses `intent manipulate`, its selected presence and `args_json.dispatch_text`;\nuse targets disclosed in your own manipulation context instead of fixture IDs.\nThese packaged guides supply `.56`'s portable publication source; the evidence\ncovers local behavior and leaves unaided discovery unverified.\n\nLocal shared tools and the NPC presence seam are supported. Hosted MCP actor\nselection belongs to `.45`; this section does not imply a hosted invocation.\n\n## Defined, not yet checked\n\nThe bootstrap also defines the following authority vocabulary. Definitions and\nrole composition grant nothing by themselves. The corresponding implementation\nslice must supply the gate and binding semantics before these IDs authorize an\noperation; see [roles](./roles.md).\n\n| Capability id | Owning planned slice |\n|---|---|\n| `frontier.impersonate` | `act-as-and-consent` (.41) |\n| `frontier.deliver_private_hint` | principal-pinned private delivery (`sk-jay0.3.24.132`) |\n| `frontier.open_session` | publisher maintenance integration (.49) |\n\nThe read IDs already derive the elevation class of realised presence grants\n(.34): Internal for `frontier.read_internal`, otherwise Hidden, including\nroles without read capabilities. The read-depth compatibility stage also reads `frontier.read_internal` directly;\nlegacy scalar depth stays active until hosted migration (.67) and cutover (.82). Every extent-bearing grant retains the existing Hidden floor.\n\n## 2. Privileges bound to an identity, not a capability\n\nThese maintenance gates compare `ctx.sender()` with an identity. The publisher\narm of `require_world_authority` admits vocabulary, runtime maintenance and\nmodule configuration without a body. Neither an apply capability nor genesis\nadmits a non-publisher to raw maintenance; scoped authors use manifest apply.\n\n| Privilege | Gates |\n|---|---|\n| Operator: `config.operator_identity`, set to the publishing identity when the world is published; defaults to `Identity::ZERO`, which grants nothing | `r_bind_actor_identity` (ordinary actor bindings; optional provenance defaults to Person, and a Person identity reads no [service-only audience](metadata-attachments.md#audience), so bind an NPC seat with `service`; presence bodies and the reserved `presence` label are refused) |\n| Operator | direct vocabulary and runtime maintenance, authoring validation probes, retention/decay setters, `set_tick_interval_bounds` |\n| Operator | `r_revoke_seat`, `r_reassign_seat` |\n| Operator | `r_trust_identity_issuer`, `r_untrust_identity_issuer`, `r_trust_identity_audience`, `r_untrust_identity_audience` |\n| Operator | the same full-catalog read bit as `frontier.apply_manifest`; either the publisher or a live apply row is enough during compatibility |\n| Player seat claim: first come on an offered playable body, only for `role = \"primary\"` | `r_claim_actor` (presence bodies and role-binding subjects are excluded) |\n| `$sender` self-bind: an `actor_identities.identity` of `\"$sender\"` resolves to the applying connection | lets an admitted author write its ordinary seat binding; a role-bound NPC requires covering D6 bind authority and publisher-mediated durable host bootstrap |\n\nThe publisher's read of private world-state tables is not an authored\ncapability and not a reducer gate in `server/`. The host admits the database\nowner — the identity that published the module — to those tables, read-only,\nfor SQL and for a subscription. ADR-0150 is the opt-in on `connect()` (default off). `sk` sets that\npublisher option. The hosted gateway does not. A\nholder of `frontier.apply_manifest` who is not that identity is not admitted\nto the raw tables. The measured proof is\n[`../../../sandbox/owner-private-subscribe/README.md`](../../../sandbox/owner-private-subscribe/README.md).\nThe greps at the bottom of this page do not see the rule, because it is not\na string in the world implementation. `sk get` and `sk describe` use that cache after the publisher subscription applies\n(`reads_as_publisher`). Non-publishers use separate indexed authoring views with\nbinding-held Hidden/Internal read authority and per-kind coverage; an apply grant\nalone does not admit them to raw tables. See [reading a world](reading-a-world.md).\nNeither reader calls the manifest export.\n\n## 3. Elevation: capability grants that widen what you see\n\nElevation is data. Any capability grant with a non-empty `extent_ref` widens\nthe holder's view to the bodies in that extent (ADR-0007 D-4). A live `frontier.read_internal` row raises the reached bodies to Internal\nindependently of its scalar class. During compatibility, a legacy Internal\n`elevation_class` still raises depth too (ADR-0084). Extent and exclusive\nexpiry bound both paths; other grants retain the Hidden floor. The final\nscalar retirement is blocked on hosted backfill (.67) and owned by .82.\n\n| `elevation_class` | Reaches, through `owner_delivery_admits` |\n|---|---|\n| `\"\"` or `hidden` (default) | Hidden floor; a `frontier.read_internal` row also reaches Internal |\n| `internal` or `full` (synonyms, parsed by `elevation_ceiling` in the world API) | also `Internal` rows, and `Discoverable` rows without a knowledge row |\n\nAny other value is an authoring error at apply time. For role bindings authors\nchoose the role, not `elevation_class`: the reconciler derives that class from\nthe merged capabilities and writes grants to the separate presence body.\n\nShipped grants:\n\n| Capability id | `elevation_class` | Extent | Holder | Fixture |\n|---|---|---|---|---|\n| `dm_oversight/oversee` | `internal` | `place_graph` `dm_oversight/region` | `dm_oversight/dm` | [`examples/dm-oversight.toml`](./examples/dm-oversight.toml) |\n| `elven_mini/dm/watch` | `full` | `place_graph` `elven_mini/region` | Aldwin | `packages/spellkave-adventure-elven-mini/fixtures/adventure/cast/npcs/aldwin.toml` |\n| `elven_mini/dm/seat` | `full` | none | Aldwin | same file; an empty `extent_ref` widens nothing, so this grant is a marker checked by an affordance's `gate_predicate` |\n\n`core/world_admin` and\n`elven_mini/dm/seat` sound like privileges, but the server never checks them\nby name. Bundles use them in DSL predicates, like any ordinary capability.\n\n## Authored session setup\n\nDefine an action, affordance, outcome and consequence using the existing place\nniche. Its fixed frame write is `OpenSession { session_def_id = \"bundle/session\" }`;\nthe definition must resolve inside the template's dependency closure. Grant\n`frontier.open_session` through a role binding on the caller's own presence.\nThe standard `dm` role includes it; granting a role remains an authoring operation.\n\nThe manipulate argument `participant_entity_ids` enrolls 1–64 distinct runtime\nactor-body ids. The SDK accepts safe integers or decimal strings; Rust CLI JSON\naccepts numeric u64 values or nonzero decimal strings. It is separate from `expected_participants`, which checks\ndisclosed role bindings. The definition and default grid are authored; invocation\ncannot inject `definition_ref`, `destination` or `build_target`. All participants\nmust be current actor bodies co-located at the target node. Presences, missing\nactors and already-running members refuse. Every subject/source/anchor/planned\ncell must pass the same live grant and inherited seals; a Bundle grant over the\ngraph alone cannot enroll a player the bundle does not own.\n\nAn authored opener can enroll eligible actors at the target node. A failed\nsetup rolls back the new session. Existing expiry records associated with\nother owners survive the attempt. Enrollment grants no participant control\nor impersonation.\n\nClients discover the `manipulation_contract` enrollment marker before dispatch;\nan older module refuses locally, while omission keeps existing verbs compatible.\n",
265
+ "reading-a-world": "# Reading a running world\n\nFiles are read by `sk inspect`. The running world is read by `sk get` and\n`sk describe`. Definitions and the workspace scratch are read by `sk query`.\n\nThe publisher uses its owner cache. A non-publisher with binding-held\n`frontier.read_hidden` or `frontier.read_internal` uses an isolated snapshot of\nserver-admitted authoring views. The snapshot rechecks current grants and scope;\na write capability alone does not grant this read. Neither path calls the\nmanifest export.\n\n| You want | Run |\n|---|---|\n| Authored instance rows of one kind | `sk get <kind> [key]` (compact listings; keyed get returns the whole admitted row) |\n| One placed entity, admitted place or containment chain and belonging | `sk describe entities <key>` |\n| Definitions / workspace | `sk query --target live` |\n| Files | `sk inspect` |\n\nThe supported instance kinds are `entities`, `actors`,\n`actor_spatial_locations`, `actor_capabilities`, `actor_equipment_slots`,\n`entity_containment`, `entity_tag` and `object_state`. `object_state` listings\nkeep `value_int`/`value_bool`. Unsupported kinds return a usage error.\n\nKeys retain `{bundle_id}:{entity_key}` in private storage. Publisher reads use\n`operator_manifest_authored_entity`; scoped authoring reads use\n`authoring_manifest_authored_entity`. Gameplay uses\n`visible_manifest_authored_entity` with complete version-1 coverage.\nAnswers emit the stripped `entity_key`. Omit `--bundle` when that key is unique\nwithin admitted rows; ambiguity reports admitted bundles only. A token that is\none entity's key and another admitted entity's numeric id is refused as usage.\nUse an unambiguous authored key or numeric id. An inaccessible scoped key and\nan absent key both return `not_found_in_scope`; missing view support or revoked\nread authority returns `reader_unavailable` with a nonzero CLI exit.\n\nScoped answers include `source`: caller/world identity, connection and source\nepochs, transaction tick, projection version, admitted binding IDs/read depths,\nbundle scopes and coverage per kind. Coverage distinguishes complete, masked,\nincomplete and outside-read-scope observations. Empty complete results certify\nabsence within admitted scope; masked or incomplete observations do not.\nEnumeration examines at most 10,000 subjects/rows with one overflow sentinel.\nSource epochs change when observations change even while the world tick is\npaused. Snapshots are detached and immutable; each read retires the previous\nsubscription group before collecting the next transaction-complete group.\n\nThe `authored_entities_only` label bounds listings and keyed entry points.\nRelationships need both endpoints admitted. An outside containment endpoint\nends a scoped chain with `outside_read_scope`, without exposing its label or\nidentity. Runtime instance tags, including tags on unauthored spawned objects,\nuse the separate caller-admitted gameplay membership view. They are not added\nto authored comparison. Definition tags remain public vocabulary.\n\n`sk diff -k`, `sk apply -k` and the shared MCP applyset diff/apply tools currently\nrequire the exact publisher's baseline access. Other callers receive the typed\n`baseline_unavailable` refusal before baseline subscription or enqueue, including\nwith `--force` or a new logical root. This temporarily removes the non-publisher\nHTTP and local stdio MCP diff/apply workflow. Binding-only direct deltas and\nscoped `get`/`describe` retain their independent admission lanes. Regional\ncomparable baseline delivery is tracked in sk-jay0.3.24.160.\n\nPublisher comparison reads the root, parts and comparable hashes together through\none required operator-view subscription. Missing secure views return\n`reader_unavailable`; there is no fallback to public storage or optional hashes.\nThe server checks generation and current extent admission at commit. Runtime\nchanges can still race an optimistic comparison.\n\nLocal installed CLI and migration evidence:\n[role-scoped proof](../../../sandbox/role-scoped-world-read/README.md).\nHosted MCP transport and the complete exploration journey are proved by their\nowning changes, `authority-tools-over-mcp` (.45) and\n`persona-world-exploration` (.58). The publisher loft-chest example remains in\n`sandbox/apply-loop/README.md`; its full dependency closure is broader than a\nregional read.\n\nThe root, parts, comparable hashes and authored mapping bases are private.\n`private-applyset-baselines` closes this historical channel; refusal receipts,\nruntime-event satellites, validator audit and digest classification remain\nseparate follow-ups (.156, .157, .159 and .161). Complete authored-metadata\nsecrecy is not claimed. Hosted activation and .44 backfills remain release work\nunder .139.\n",
266
+ "region-scale-geography": "# Region-scale geography: check the live place graph, not a stale brief\n\n(OV1/RH1 and the Thundertree/Old Owl Well/Wyvern Tor graphs are worked\nexamples from the retired Phandelver bundle and its Foundry importer,\ndeleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`;\nthe rules still hold.)\n\n**Gotcha — a beat brief's \"region nodes: ZERO\" open flank can go stale the\nmoment new topology lands, and the beat's own `units.toml` row inherits the\nstaleness.** OV1's brief (written 2026-07-02) listed Thundertree/Old Owl\nWell/Wyvern Tor region nodes as entirely missing; the #1696 importer\n(2026-07-03) had already emitted the FULL `region` place_graph (12 nodes with\nmetric `pos_x`/`pos_y` from the scene's note pins) plus the site graphs, all\nwired into `manifest.toml` — the brief simply predated the import. At the\ntime the authoritative record of what an importer wave left ungated was the\nper-scene \"Deferred openings\" list in `coverage/foundry-scenes.md`; that\nrecord no longer exists (it lived under\n`archive/packages/spellkave-phandelver/fixtures/coverage/` and was deleted\nwith the bundle in `fd2288bdea`), and no importer coverage record replaces\nit. Today, before authoring any \"missing\" region/site nodes, check what the\nmanifest and the live node already carry — grep the bundle's\n`[[place_nodes]]`/`[[place_edges]]` rows and run `spellkave place-node list`\n/ `spellkave place-edge list` against a seeded node — not the brief or the\nbeat-dag `open_flanks`. The beat's real job may be proving the existing\ngraph live, not authoring new topology.\n\n**Gotcha — imported region-scale coordinates are a DIFFERENT coordinate space\nthan any hand-authored graph; compute expected compass directions from the\nreal `pos_x`/`pos_y`, never guess or copy real-world geography.** A Foundry\nscene importer emits `pos_x`/`pos_y` from the scene's own pixel/note-pin\nlayout, not the same origin or scale as a hand-authored graph like\n`base/spatial.toml`'s \"1 unit ≈ 1 mile\" trail. `readLocationSnapshot`'s\n`direction` field (X4) is derived purely from the two endpoint positions via\n`atan2` (`packages/spellkave-sdk/src/core/readers/location_snapshot.ts`), so\nit is internally consistent — but a brief's real-world claim (e.g. \"Old Owl\nWell is 18mi SE of Conyberry\") can come out differently once the actual\nimported positions are atan2'd (OV1: `region/conyberry_agatha` →\n`region/old_owl_well_approach` computes `\"northeast\"`, not the brief's\nguessed `\"southeast\"`). Assert whatever the real computed direction is, not\nthe brief's prose guess.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
267
+ "relocate-entity-ungated": "# `RelocateEntity` is the un-gated, world-scoped forced-move leaf — no `place_edge` required, unlike `JoinSession`/`LeaveSession` it never touches a session\n\nA consequence that must move an actor somewhere it did NOT choose to walk\n(flood knockback, a shove, a trap drop) authors a `RelocateEntity` frame-write\nleaf, not a fabricated `place_edge` + `r_move` call:\n\n```toml\n[consequence_frame_writes.frame_write.RelocateEntity]\ntarget_ref = \"TargetActor\"\n\n[consequence_frame_writes.frame_write.RelocateEntity.destination]\nkind = \"place_node\"\nid = \"triboar_trail/cave_mouth\"\n```\n\n`target_ref` resolves the same way `JoinSession`/`LeaveSession` do (`Actor`,\n`TargetActor`, or a literal numeric entity id) — a self-eligible act that\ntargets itself (the common case: a save-or-suffer hazard) uses `TargetActor`\nsince the acting entity IS its own target. `destination` is validated for\n**kind + existence only** — the write does NOT check a `place_edge` from the\nentity's current node, on purpose: a forced move is the involuntary\ncounterpart to `r_move`'s voluntary edge-gated traversal, and requiring an\nedge would make \"shove someone through a wall\" inexpressible. Unlike\n`JoinSession`/`LeaveSession`, `RelocateEntity` reads no\n`turn_state.scope_session_id` and touches no `session_participant` row — it\nworks identically in and out of a session, and the target does not need one\nopen (#1706 leg 4, ADR-0079).\n\n---\n\n## Known misuse / anti-pattern\n\nDo **not** fabricate a `place_edge` + `r_move` call to force a move the\nactor did not choose. That smuggles an involuntary relocation through the\nvoluntary traversal gate and teaches the next author that \"every move needs\nan edge\". Prefer `RelocateEntity`. Conversely, do **not** reach for\n`RelocateEntity` when the actor *is* walking a known edge — that is `r_move`.\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\nChecklist before filing a kernel gap:\n[`patterns/before-filing-a-kernel-gap.md`](../patterns/before-filing-a-kernel-gap.md).\n\n## Misuse / anti-pattern\n\n- Filing teleport / Misty Step as a missing kernel primitive: **use this leaf**.\n Teleport spells are `RelocateEntity`, not a movement-default or fabricated\n `place_edge` + `r_move`. Destination may be a concrete `place_node` id or a\n spatial binding (`TargetSpatialRef`) for player-chosen landings.\n",
268
+ "remove-item-deletes-stack": "# `RemoveItem` deletes a fully-consumed stack — it does not leave a zero-quantity row\n\n(The ISS1705 worked example — an ammo-tracked ranged attack — was retired `spellkave-srd` content, now only under `archive/packages/spellkave-srd/fixtures/base/attack-ranged.toml`; the rule still holds.)\n\n`RemoveItem`'s quantity split (`remove_item.rs::decide_quantity`) has two\nbranches: `current_quantity > requested_count` decrements in place, but\n`current_quantity == requested_count` **deletes the entity outright**. A\nconsequence that draws down a stackable resource (ammunition, charges,\nconsumable reagents) to exactly zero leaves NO entity to read back —\n`readItem`/`readEntity` returns `null`, not a row with `quantity: 0`. An\nassertion written as \"quantity drops to 0\" after the last unit is consumed\nwill hang or misfire; assert \"the item is now absent\" instead (ISS1705's\nammo-tracked ranged attack: 2 arrows, 2 shots, the second shot's\npost-consumption read is `null`).\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
269
+ "roles": "# Roles as authored content\n\nA role names capability definitions. A `role_definitions` row owns its\n`role_id`; another bundle contributes through `role_aggregations`, keyed by\n`role_id` and `bundle_id`. Both require an authored `description` and\n`capability_ids`. Definitions may be empty; aggregations must contribute at\nleast one resolving capability. The merged set is the sorted, deduplicated\nunion of the definition and every aggregation.\n\n```toml\n[[role_definitions]]\nrole_id = \"house/gm\"\nbundle_id = \"house\"\ndisplay_name = \"House GM\"\ndescription = \"Our campaign's authored role.\"\ncapability_ids = []\n\n[[role_aggregations]]\nrole_id = \"house/gm\"\nbundle_id = \"weather\"\ndescription = \"Adds our weather vocabulary.\"\ncapability_ids = [\"weather/set_weather\"]\n```\n\nThe referenced bundles and capability definitions must exist in the manifest\nclosure or live world. Offline validation also sees the kernel bootstrap.\nAn aggregation may refer to a live role without repeating a file dependency.\nAn attempted foreign role redeclaration is fatal (`MF-VAL-367`) before upsert;\nunresolved capabilities use `MF-VAL-366`, and an unknown role or empty\naggregation uses `MF-VAL-368`. Role rows do not participate in `MF-VAL-364`.\n\nThe kernel bootstrap defines these standard roles. Each listed capability has\nthe `frontier.` prefix:\n\n| Role | Capability suffixes |\n|---|---|\n| `viewer` | `read_hidden` |\n| `timekeeper` | `pace_time` |\n| `npc-host` | `drive` |\n| `dm` | `read_hidden`, `read_internal`, `spawn_entity_definition`, `despawn`, `set_state`, `transfer`, `afflict`, `inscribe`, `open_session`, `impersonate` |\n| `adventure-author` | `read_hidden`, `read_internal`, `apply_manifest`, `prune`, `bind.dm` |\n| `system-author` | `read_hidden`, `read_internal`, `apply_manifest`, `prune` |\n\nA definition grants no authority to a caller. A `role_bindings` row names\nwho receives the merged capabilities, for which extent, and until which tick.\nThe DM role contains read authority, the six scoped mutation capabilities,\nscoped session setup and bounded steering. `npc-host` grants `frontier.drive`\nwithout impersonation. No standard role grants `frontier.bind.npc-host`; the\npublisher or a holder covering every role capability binds the host.\nPacing and manifest apply remain separate capabilities. See\n[privileged runtime acts](./privileges.md#privileged-runtime-acts).\n\n`timekeeper` controls the shared world clock in every extent. A regional\ngrant still pauses every table in that world. Ordinary `dm` does not pace\ntime. Elven Mini's publisher-applied `elven_mini/scripted-dm` definition\nadds `frontier.pace_time` for Aldwin. The local tool factory offers\n`spellkave_pace_time` only on a caller-owned connection with a current\npacing presence; it refuses a publisher connection. Hosted roster and\nrouting are transitional until `authority-tools-over-mcp` (.45).\nSee [clock controls](./dm-oversight.md#controlling-the-shared-clock).\n\n## Bind a role to a subject\n\n```toml\n[[role_bindings]]\nbinding_id = \"house/alice-dm\"\nbundle_id = \"house\"\nsubject = \"$sender\"\nrole_id = \"dm\"\nextent_kind_ref = \"place_graph\"\nextent_ref = \"house/region\"\ndescription = \"The applying DM oversees our region.\"\n# expires_at_tick = 500 # omitted or 0 means permanent\n```\n\n`subject` accepts an identity hex, `$sender` (the original applying identity),\nor an unambiguous authored entity key belonging to a **non-playable NPC**.\nAn identity subject needs no character seat. An NPC subject resolves to its\nstable actor principal: the runtime-only `subject_actor_id` keeps that link\nwhen the NPC changes bodies. It is not an authoring field or an exported hint.\n\nA legacy ordinary-body apply holder can store a binding without possessing authority to realise\nit until .84 removes that adapter. Scoped writers need D6 even to store an inert record. Such a row is **inert**: `presence_entity_id = 0`, no grants or identity\nmirrors. A realised binding creates a separate placeless entity and actor,\nwith its role capabilities on that presence body and durable `role = \"presence\"`\nidentity mirrors. It does not put authority on the subject's character body.\nOnly the NPC's durable primary identity bindings are mirrored; a transient\nplayer claim does not inherit the NPC's authority. The publisher/operator\ninstalls the host's durable primary binding before NPC startup. For an ordinary\nnon-playable, non-binding-subject NPC, a host presence covering the body with\n`frontier.drive` may instead assign a previously unbound, distinct login through\n`r_assign_driver`. The assignment is durable `Service`, with `assigned_by` naming\nthat presence; disconnect or unmount does not release it. Replacement while a\nDM hold stands refuses with `driver_assign_while_held`, preserving the holder's\npin and every assignment/control field. An exact same-presence, same-identity\nrepeat is non-mutating and succeeds under a hold. A client-side hold check\ncan avoid work but cannot replace this atomic refusal. Keep the retained\ncredential for a suspended seat and retry after explicit return/recovery.\nAssigned driver identities also control their durable Service summons. A\nreplacement transfers those grants, including nested summons, in the same\ntransaction; stale retired wake, act and deferred work are refused. Exact\nrepeat assignment tolerates this summon set. Any held summon blocks the whole\nhandover or ordinary release with driver_summon_while_held; its authority pin\nis preserved. A driver identity refuses new actor or presence edges\n(assigned_identity_requires_isolation), except durable unassigned Service\n`summoner` rows. This shape exception also applies to operator, manifest and clone\nwriters, including runtime place-graph Spawn cloning a live summon. The rows\nalone do not prove that Spawn created them. Existing-pair\nupdates retain their lifecycle semantics. Graph cloning that would copy its\nassignment refuses the operation. Root release revokes the derived grants\npermanently: later root assignment does not resume them. A separately eligible,\nunbound summon may be assigned independently. Player summons still survive\ndisconnect. Manifest reapply/retraction that removes an assigned root instead\nwins over descendant holds, revokes both driver and hold, and leaves the live\nsummon unbound; the DM observes held=false through the scoped control view.\nIn-play Despawn of an assigned root body or retraction of its assigning\npresence also clears the assignment, derived grants and holds immediately; live\nsummon bodies remain. Presence retraction preserves the root body too, and a\nnew covering presence can assign the same identity without resuming old summons.\nDeleteEntity and full RemoveItem consumption share the physical-body cleanup;\nPossessBody to zero also revokes an assigned root's derived authority. Removing\na presence body retracts its role binding before losing the actor/body link.\nA nonzero body swap keeps its existing assignment semantics. Unrelated\nauthored/operator/Player bindings retain their existing Despawn lifetime.\nPossessBody to zero releases durable Service summoner grants, preserves Player\nsummoner and unassigned primary bindings, and evicts the former body's context.\nNonzero body swaps retain assignments and summons. Physical Despawn, DeleteEntity\nand full RemoveItem consumption end Player summon grants; live Player summons\ncontinue surviving disconnect. Presence revocation resolves current embodiment\nonly; no retained-control fallback or legacy backfill is provided.\n\nProximity-host integration is tracked by `sk-jay0.3.24.144`. An idempotent re-claim keeps\nthat existing binding and its provenance; a redundant self-bind is a no-op, not an authority\nbootstrap. Changing a role-bound NPC's durable primary membership requires D6\nbind rights; an existing connection-scoped claim does not waive them.\n\nRealisation requires publisher/genesis authority, or a covering\n`frontier.bind.<role_id>` grant, or covering grants of every capability in the\nnon-empty merged role. The holder paths refuse roles containing capabilities\nin the remaining extent-blind list: `frontier.apply_manifest` (until .82). Each grant must\nbe live and cover the requested extent; authority may be held across multiple\nbodies owned by the caller. Editing a realised binding also needs coverage of\nits existing extent. See the world API for\nthe shared D6 decision and reference cases. Bundle grants cover the same bundle and graphs whose root it owns; Bundle grants cover a Party extent when its tag definition is owned by that bundle. Unknown kinds or missing ownership fail closed. Reducer admission and the filtered grant inventory share the registered extent-resolution adapter (`authority::verdict::covers_shapes`); pure tests and `grant-verb.live.test.ts` cover that parity.\n\nA realised subject change uses the [guarded handover](./grants.md#hand-over-one-binding)\npreview and a single subject-only delta with typed `binding_preconditions`.\nRaw unguarded subject edits refuse with `MF-APPLY-047`. Edit or retract a row\nseparately to change its scope or revoke it. A positive expiry is exclusive: the binding\nceases to grant authority at that tick; omitted or zero means permanent. Presence bodies cannot be player-claimed,\nreleased as character seats, possessed, or directly rebound by forging the\nreserved `presence` identity label. The table predicate, rather than a label,\nidentifies them (the world API).\n\nA scoped writer changing a role definition or aggregation needs live covering grants of every required id, or `frontier.escalate`, over that row's bundle (`MF-APPLY-045`). This applies to ordinary ids too. Upserts check the final merged union and any removed pre-image ids; removals check the old row's own ids. An empty replacement proves no authority by itself. The check reads grants held before mutation, so adding an id to one's own role cannot authorize another write in that request.\n\nEvery changed merged role also checks its affected realised bindings, using the role index. The writer must be able to bind both the old and final sets at every retained binding extent (`MF-APPLY-036`, `realised_binding_impact`). Retracted bindings are checked as removals; an explicit rebind checks both sides. Inert bindings stay inert during role edits. Explicit resubmission of an inert binding can realise it when the sender passes D6; the existing duplicate-digest exception preserves that realization path. Unchanged role vocabulary does not trigger a new row authority decision. Escalate admits a row but does not waive these binding checks.\n\nTwo root operations still need publisher/genesis admission (`MF-APPLY-035`): introducing an unknown `frontier.*` capability definition (`reserved_definition_root`) and introducing `frontier.pace_time` into a merged role (`clock_root`), through definition, aggregation or replacement. Maintaining an existing reserved definition uses the ordinary scoped holder-or-escalate rule. A legacy ordinary-body apply holder retains main's ordinary-role rule until .84; reserved upsert ids still require the publisher. `MF-VAL-379` warns that these rows need live admission.\n\nScoped ordinary tombstones additionally need covering `frontier.prune` (`MF-APPLY-046`), including every remembered cascade target. `--force` only overrides applyset memory checks. Binding retractions use D6 without a prune prerequisite. Legacy ordinary-body pruning remains transitional until .84. The publisher/genesis bare `actor_capabilities` lane retains `MF-APPLY-033` until release follow-up .67; gameplay equipment, conditions, tags and blueprint cloning cannot produce reserved authority.\n\nPresence elevation is derived from the merged role: `frontier.read_internal`\nproduces Internal reach; otherwise the derived class is Hidden, including\nroles with no read capability. The read-depth compatibility bridge (.35)\nalso accepts capability-ID depth while retaining the legacy scalar until\nhosted migration (.67) and final cutover (.82).\n\n### Choose sight and write scope\n\n`place_graph` reaches a graph and its descendants, including a child combat\ngrid. `party` reaches the named party and its current encounter. `bundle`\nuses authored entity provenance for sight: it reaches the entities that bundle\nplaced, wherever they stand, without reaching an unrelated player merely\nstanding in its graph (the world API).\n\nFor manifest writes, Bundle coverage uses applyset ownership memory. It can\ncover placeless definitions and graphs whose root that bundle owns. A state\nwrite also checks its target entity independently; root-graph ownership does\nnot confer ownership of every body inside it. PlaceGraph and Party grants\nadmit placed edits but cannot claim a placeless definition or an applyset root.\nSee [extent-scoped apply](./getting-started-with-verbs.md#extent-scoped-apply)\nfor the row rules and compatibility boundary. [Captured local author examples](../../../sandbox/extent-scoped-apply/README.md)\nrecord an admitted `sk apply -k` edit, a refused `sk diff -k` takeover and\nindependent live postconditions for AUTH-36-01/02. The captures identify the\nproved revision and publisher bootstrap; hosted MCP delivery and packaged\npersona guidance remain with `.45` and `.56`.\n\nAldwin's publisher-authored `elven_mini/aldwin-author-bundle` binding grants\n`elven_mini/scripted-dm` over Bundle `elven_mini`, alongside the existing\nregional and party bindings. Its definition authoring stays inside that\nadventure; shared `dm` and `srd` vocabulary remain publisher-authored.\nThe generated fixture and `tests/offline/role-bindings.test.ts` in\n`packages/spellkave-adventure-elven-mini` prove the binding excludes those\nforeign bundles. Publisher listing precedes the seat claim. This content\nauthority is separate from the scripted runtime: Aldwin opens shared authored\nmenus through its admitted DM presence, and the occurrence retains the\ndirected trace that supplies its question and labels. Runtime creation and\nadvancement perform finite acts; the interim prompt applyset route is retired.\n`.91` supplies runtime condition/actor ownership, and world-owned vessels\nretain that state when their adventure bundle is reapplied.\n\n## Explain the authored vocabulary\n\n```sh\nsk explain role dm\nsk explain binding house/alice-dm --target live\nsk explain capability frontier.pace_time --target live\nsk explain extent-kind place_graph --target files\nsk explain role dm --human\n```\n\nFiles are the default: the configured local folder and scratch workspace are\ncombined with the shared kernel bootstrap and core extent kinds. Live requests\nread actual public vocabulary rows using the selected caller's credentials.\nThey add no read authority and do not invent missing bootstrap rows. The\nAUTHOR tool `spellkave_explain` returns the same structured answer with\n`{ \"kind\": \"role\", \"id\": \"dm\" }`.\n\nRole answers retain each bundle's contribution and capability descriptions,\nand `bound_to` lists their authored bindings. Binding answers select the exact\n`binding_id`, report planned (files), inert or realised (live) state, extent,\nmerged capabilities, expiry and derived read class. A connected ordinary caller\nsees its own identity mirrors. The server stores `role_binding` privately and\nserves admitted rows through `visible_role_binding`: subject-owned bindings,\ndurable primary NPC membership, D-6-manageable bindings and publisher inventory.\nInaccessible rows are absent, including their ids and counts; subject-only\ndescriptions are omitted. Empty subjects fail `MF-VAL-370` and the commit path\nindependently forbids empty stored subjects (the world API).\nRead elevation and transient NPC claims alone disclose no binding row\n(live regression: `role-bindings-and-presence.live.test.ts`). Explicit binding\ninspection is the AUTH-34-01 transition; owned-actor selection is still .45.\nCapability answers list the roles containing it and the authored templates\nand actions requiring it. Extent-kind answers retain the authored resolution\nshape. Unknown ids exit `2` and offer the nearest authored IDs by prefix.\n\nBoth role tables are public vocabulary with manifest-only writes. The Rust\nJSONL CLI reads them through `role-definition list|inspect` and\n`role-aggregation list`; doctor checks their capability and role references.\nBundle export reconstructs authored role and binding rows, excluding presence IDs,\nrealisation ticks and stable-principal runtime hints. Applyset prune withdraws that\nbundle's contributions while retaining other bundles' definitions.\n\nFor a persistent world, apply the generated core vocabulary delta before\nloading adventures. Publishing a module alone does not backfill roles in an\nexisting database. Preserve the role tables on rollback: an older module\nwithout those tables needs an explicit state-preserving migration, and the\ncombined privileged-namespace security floor must remain in force.\n\n## Verified local examples\n\nOn an admitted local world, an ordinary caller can use\n`sk --format jsonl explain role dm --target live` to inspect the public role\nvocabulary. The same installed CLI can explain a custom role and list the\nbundles contributing capabilities to it. A role definition alone grants no\nauthority: an unbound caller's valid `sk apply -k <manifest>` attempt is refused\nwith `MF-APPLY-015` and exit `2`.\n\nThe [versioned local acceptance record](https://github.com/b4arena/spellkave/blob/864d5276958ec3584005debc8a646319bdaf694c/sandbox/roles-as-content/evidence/acceptance.json)\nand [captured installed CLI journey](https://github.com/b4arena/spellkave/blob/864d5276958ec3584005debc8a646319bdaf694c/sandbox/roles-as-content/evidence/installed.json)\nrecord the ordinary credential boundary, actual bundle contributions,\nfiles/live agreement and independent unchanged-catalog assertions after refusal.\nThe installed artifact ran outside checkout with its declared peer explicitly\nsupplied and its dependency links contained inside the artifact; distribution\nportability follow-up `sk-jay0.3.24.62` owns those installation prerequisites.\n\nThese historical examples verify local explanation and refusal before bindings\nlanded. The binding contract above is implemented by .34; the dedicated\ngrant/revoke journey remains .43 (AJ-02). This record establishes neither the\nnew binding admissions nor hosted MCP delivery. The complete text accounting\nand failed exploratory attempts are linked from the acceptance directory; a\nscripted pass does not establish unaided discovery or an efficiency threshold.\n\n## Proven binding journeys\n\nThe [local binding evidence](../../../sandbox/role-bindings/README.md) records\nAUTH-34-01 targeted inspection of two distinct bindings and AUTH-34-02 revocation\nwhile retaining the independent character claim. Each versioned trace records\nreal admission, refusals and independent state checks. The examples above are\nsupported locally; hosted MCP delivery and final owned-presence selection remain\nseparate acceptance work. Scripted trace cost does not establish an efficiency\nthreshold or unaided discovery.\n\n## Persistent rollout\n\nRollout uses two publishes: first publish this schema-compatible module with\nthe binding table and defaulted runtime hints while the publisher/genesis grant\nlane remains open. Apply core roles and migrated binding bundles as publisher\non every catalog world. Follow-up .67 supplies the second publish, which closes\nthe bare-grant lane after that migration. Publishing alone does not backfill\nbindings. Preserve authored configuration and realised authority on rollback;\nan older module needs an explicit compatible migration. Legacy queued applies\nwithout a recorded sender/verdict fail closed and need resubmission; authors\nmust not supply server admission hints. See the [live apply contract](./getting-started-with-verbs.md#authority-reconciliation-during-live-apply).\n\nThe privacy fix in `sk-jay0.3.24.89` changes shipped live readers: subscribe to\n`visible_role_binding`, including AUTHOR explain/MCP, live AuthorTarget and the\nRust role-binding list/inspect and doctor surfaces. Authored manifest rows and\npublisher bundle export keep their original subject values. Grant-verb narrows\nthe projection further: inaccessible bindings are omitted rather than returning\nredacted metadata. A filtered role-edit preview defers private binding impact\nto the server; live D-6 still refuses unauthorized affected bindings without\nchanging role authority (`role-escalation-at-apply.live.test.ts`).\n\nFor a hosted world, the operator first verifies a backup and deploys the matching\nmodule and generated client bindings as one compatibility floor. Incrementally\npublish the module without delete-data or automatic reset, then verify binding,\npresence, seat and grant counts and subject/publisher and foreign-view controls.\nA publish refusal stops rollout with existing state retained; it does not\npermit resetting the persistent world. Rollback must preserve private storage\nand the view contract: use a compatible privacy-safe module or a forward fix.\nDo not republish the predecessor that exposed principal metadata. This fix's\nlocal proof does not authorize a hosted activation.\n\n## Role edit recovery and security floor\n\nAdmission and drain-time rechecks use the original submitting identity and live authority. The role definitions, aggregations, presence grants and bindings form the bounded atomic authority unit at cursor 1. A refusal before cursor 0 starts writes leaves the world unchanged. A refusal at cursor 1 can retain ordinary cursor-0 writes; it leaves the authority unit unchanged and follows the existing quarantine/unknown-applyset-base recovery contract. Inspect the failure, reconcile the actual state and resubmit an authorized delta; do not assume that the entire manifest rolled back.\n\nThe role-escalation slice changes no table, column, reducer signature or binding layout. The subsequent handover slice adds defaulted binding metadata, private receipt tables and caller projections; publish its matching schema and clients together. Preserve persistent state with an incremental publish and verify realised and inert bindings and grants. Recovery uses a compatible module or a forward fix retaining escalation, affected-binding, prune, namespace and privacy checks. An older module that admits the refused edits violates the security floor and is not a recovery build. The local rehearsal and supported CLI scenarios are linked in [the escalation evidence](../../../sandbox/role-escalation-at-apply/README.md); hosted activation and portable persona publication remain separate operator/.56 work.\n\n## Prepared places\n\nAn author declares `[[place_seals]]` on an authored graph or blueprint, with\n`place_graph_id`, `bundle_id` and optional `description`. The seal inherits\nthrough the parent chain, including session grids. `MF-VAL-378` rejects unknown\ngraphs, directly sealed instances, world-owned roots, duplicate seal rows,\nforeign root ownership and export-only break fields in authored input.\n\nA privileged apply or spawn checks its destination. A regional DM whose extent\ncovers a sealed dungeon receives `MF-APPLY-038` or the spawn `sealed` reason\nonce earlier authority checks pass. The publisher and a writer holding the\noperation's capability through a Bundle extent covering every owner of the\nroot pass its seals. The root owners come from applyset provenance; an authored\nbundle stamp alone does not establish the live exemption. On a world loaded\nwithout applyset memory, the publisher must list ownership before other authors\ncan use this exemption. An own-bundle DM is an author for this purpose.\n\nThe `MF-VAL-374` warning examines the core `dm` role only. It warns for a foreign\nBundle extent and for a PlaceGraph extent covered entirely by an ancestor seal;\nan own-bundle extent stays silent. Extent kinds resolve through their authored\n`resolution_shape`, including custom kind IDs. A warning does not change a grant.\n\n`sk explain place <graph-or-node> --target files` names the sealing ancestor.\nLive explanations use publisher observations; other callers see `server decides`\nbecause policy rows are private. Publisher `spellkave seal list|inspect` includes\nbreak provenance and descendant graph IDs. See the [local proof](../../../sandbox/place-seal/README.md)\nfor the precise surfaces and evidence status. Ordinary affordances continue to\nresolve inside sealed places; seals protect privileged editing, not gameplay.\n\n### Break a prepared boundary through an authored act\n\nThe core `warden` role proposes `frontier.break_seal` without creating a binding.\nBind a presence over a `place_graph` extent covering the sealing graph. The core\n`core/act/break-seal` action targets a place node; its consequence contains the\nunit frame write `frame_write = \"BreakPlaceSeal\"`. Custom action chains may use\nthat same unit string through `spellkave_define_consequence` or\n`spellkave_define_action_verb`.\n\nSupply the existing manipulation argument `dispatch_text` as the reason. It must\ncontain non-whitespace text and fit within 1024 UTF-8 bytes before trimming; the\nstored reason preserves its original text. The operation resolves the nearest\nunbroken sealing ancestor of the target, rechecks the live binding and capability,\nand refuses Party and Bundle extents. A descendant-only grant cannot break a\nseal on its parent. An open target refuses `not_sealed`; unknown ancestry or a\nmissing graph anchor fails closed.\n\nA successful consequence produces one durable break row and one Public\n`seal_break` trace at the sealing graph's anchor. Both name the same existing\nApplyConsequence event; the event retains the presence binding and capability.\nA later failed write in that consequence leaves no break, trace or successful\nconsequence event. Later sibling writes see a successful break as open while\nstill checking their own targets, extent and remaining ancestor seals. A deferred\nreaction resumes with the original reason and lane and rechecks current authority.\nAutonomy jobs cannot invoke this operation.\n\nPublisher `spellkave seal inspect <graph>` shows the acting presence, retained\nreason and audit association. Event retention may expire the event without\ninvalidating the durable break; doctor reports that distinction. An unrelated\n`--force` apply overrides applyset memory checks and does not perform this act.\nPublish the supporting module before content using this operation. For rollback,\nremove that content before restoring the compatible predecessor module; preserve\nseal and break rows and verify that remaining seals still refuse privileged edits.\n\nThe [versioned local proof](../../../sandbox/seal-break-as-affordance/README.md)\ncontains exact installed CLI arguments, shared-tool requests and independent\naudit assertions. The installed CLI ran outside the checkout with the warden's\nretained credential; the publisher supplied setup and the independent audit,\nnot the acting credential. `spellkave_manipulate` carries the reason in\n`args_json`; the existing `spellkave_communicate` utterance fold reaches the same\ntransport and preserves its normalized text through a real reaction. No reason\nfield is added to either tool contract.\n\nA generic force option is not a seal break. The captured regional edit first\nreceives `MF-APPLY-038`; its scoped forced retry receives `MF-APPLY-042` at root\nownership admission and changes neither the node, seal nor break audit. Root\nclaims and force decisions belong to `.36`/`.37`; this proves the break-specific\nsubstrate boundary. Hosted MCP delivery (`sk-jay0.3.24.45`) and final portable\npublication (`sk-jay0.3.24.56`) remain transitional. These package-owned examples\nsupply `.56`'s publication source; a scripted pass does not prove unaided discovery.\n\n## Runtime binding deltas\n\nA delta containing only role-binding writes/removals needs the current D-6\nbinding right for each mutation. It needs neither apply nor prune capability.\nA rewrite checks the old and new role/extent; admission rechecks the original\nsubmitter before committing the bounded batch atomically. Mixed content still\nrequires ordinary author admission. The runtime lane refuses a denied grant\nrather than storing it inert. Runtime binding rows use empty `bundle_id`, with\nno reserved bundle or applyset memory. Publisher backup must capture those\nworld-owned rows separately from authored bundle content.\n\nCaller binding reads include subject-owned and currently D-6-manageable rows.\nOther rows are omitted, including their ids, counts and descriptions. A\nsubject-owned binding alone gives no right to revoke it. `grant_inventory`\nreveals bindable extents and epoch/tick facts without principals or binding ids.\nPer-role completeness headers reveal no hidden roots; only complete admitted\nexpansion can support a whole-world request (`grant-verb.live.test.ts`).\n",
270
+ "rule-bench": "# Offline rule evaluation bench (`spellkave_eval` / `sk eval`)\n\n<!-- Budget: ≤300 lines. Entry point for offline formula and rule benching. -->\n\nThe offline rule evaluation bench lets authors test Spellkave DSL expressions\nlocally without a running node, a database connection, or game state. It uses the\nexact same evaluator that the SpacetimeDB server runs in production, compiled to\nWebAssembly (`crates/spellkave-validate-wasm`).\n\n## Two interfaces, identical results\n\nThe bench is exposed in two forms:\n\n1. **CLI:** `sk eval <expr> [--kind predicate|int|text] [--facts <json>] [--dice <faces...>] [--format human|jsonl]`\n2. **Author tool:** `spellkave_eval` in `@spellkave/tool-authoring`, callable by AI agents in authoring harnesses.\n\nBoth interfaces need no SpacetimeDB node, require no selected context, and return\nidentical values, stochastic draws, and execution traces.\n\n### Exit codes\n\nFollowing ADR-0002:\n\n- **`0` (Success):** The expression evaluated successfully. For a predicate, both `true` and `false` are valid evaluation results with exit code `0`.\n- **`2` (In-world rejection):** The evaluation could not complete due to missing facts, exhausted dice, exceeded resource bounds, unknown macros, or unsupported server-only operators.\n- **`1` (Usage error):** Invalid CLI syntax or schema violations (e.g. unknown `--kind`).\n\n## When formulas evaluate in the game loop\n\nTo author rules effectively, understand when each DSL formula is evaluated by the server:\n\n1. **Disclosure (Affordance generation):**\n - Purely capability-driven (`actor_capabilities` matching `affordance_templates.capability_id`).\n - Reads **no formula** and rolls no dice.\n - If an actor lacks the capability, the affordance is not disclosed.\n\n2. **Selection (Candidate validation):**\n - Evaluated during `r_manipulate` candidate selection (the world API).\n - Evaluates `affordance_templates.predicate_source`.\n - If this evaluates to `false`, the attempt is **rejected** (`predicate_rejected`), not treated as an in-world miss. If no spatial niche attached to the location, the attempt fails with `niche_unresolved`.\n - **Do not place attack rolls in the affordance template predicate** (see [`patterns/offer-vs-resolution-roll`](./patterns/offer-vs-resolution-roll.md)).\n\n3. **Resolution (Act execution):**\n - When an action has `resolution_mode = \"Stochastic\"`, the server evaluates `action_definitions.resolution_predicate_source` (the world API).\n - A `true` result executes `on_success` consequences (e.g. dealing full damage).\n - A `false` result executes `on_failure` consequences (e.g. a miss or partial effect).\n\n4. **Consequences:**\n - Evaluates modifier delta expressions (e.g. `delta_source` on `ModifyResource`) as consequences are applied.\n\nThe bench evaluates the supplied expression directly against author-provided facts. It has no ambient game world and no offer mode.\n\n## Fact shape\n\nThe `facts` parameter accepts an object grouping facts by subject or pool. The evaluator strictly validates subject and pool names:\n\n```json\n{\n \"actor\": {\n \"stat\": { \"str\": 16, \"demo/bonus\": 3, \"srd/hp\": 25 },\n \"tag\": [\"player\", \"warrior\"],\n \"capability\": [\"srd/capability/attack/melee\"],\n \"resource\": { \"srd/hp\": { \"min\": 0, \"max\": 30 } }\n },\n \"target\": {\n \"stat\": { \"ac\": 15, \"demo/threshold\": 15 },\n \"tag\": [\"undead\"]\n },\n \"location\": {\n \"tag\": [\"underground\", \"dark\"]\n },\n \"session\": {\n \"tag\": [\"combat\"]\n },\n \"world\": {\n \"stat\": { \"tick\": 4200 }\n },\n \"actor.wielded_item\": {\n \"stat\": { \"reach\": 5 },\n \"tag\": [\"slashing\", \"martial\"]\n },\n \"actor.equipped_item:main_hand\": {\n \"stat\": { \"bonus\": 1 }\n },\n \"bindings\": {\n \"target_entity\": \"1002\"\n },\n \"roll_tables\": {\n \"demo/loot\": [\n { \"entry_id\": \"demo/loot:gold\", \"weight\": 70, \"result_ref\": \"100\" },\n { \"entry_id\": \"demo/loot:gem\", \"weight\": 30, \"result_ref\": \"500\" }\n ]\n },\n \"item_sources\": {\n \"actor.wielded_item\": {\n \"damage\": \"1d8 + 3\"\n }\n }\n}\n```\n\n### Manifest resolution\n\nIf a manifest TOML exists in the author's workspace:\n- `macro('id')` expressions resolve definitions from `[[dsl_macro_definitions]]`.\n- `roll_table('id')` expressions resolve entries from `[[roll_tables]]` and `[[roll_table_entries]]`.\n- If `facts.roll_tables` provides entries for a table, those entries take precedence over the manifest.\n\n## Chosen dice mechanics\n\nThe `dice` parameter provides predetermined numbers for stochastic operations:\n\n- **Dice rolls (`1d20`, `2d6`):** Consumes faces sequentially from `dice`.\n- **Roll tables (`roll_table('demo/table')`):** Consumes **one number** from `dice` as raw entropy. The evaluator takes it modulo the table's total weight, then walks weighted entries in lexicographic `entry_id` order from zero; it is not a 1-based ticket. Replaying a recorded live value as this entropy is therefore not generally valid.\n- **Roll modifiers (advantage / disadvantage):** Under advantage or disadvantage, single-die rolls and integer roll tables consume two values from `dice`, keeping the highest or lowest as appropriate.\n- **Exhaustion:** If an expression requires more draws than provided in `dice`, evaluation halts immediately with `dice_exhausted`, naming the exact draw number that found the list empty.\n\n## Reading the evaluation trace\n\nWhen run with `--format human`, `sk eval` displays a tabular AST:\n\n```\n┌────┬───────┬────────────┬───────┬─────────────┬─────────────────────┬────────┐\n│ # │ Depth │ Operator │ Scope │ Value │ Table entries / Span│ Status │\n├────┼───────┼────────────┼───────┼─────────────┼─────────────────────┼────────┤\n│ #1 │ 3 │ Roll │ - │ 12 (Int) │ 1..4 │ ok │\n├────┼───────┼────────────┼───────┼─────────────┼─────────────────────┼────────┤\n│ #2 │ 3 │ IntLiteral │ - │ 3 (Int) │ 7..8 │ ok │\n├────┼───────┼────────────┼───────┼─────────────┼─────────────────────┼────────┤\n│ #3 │ 2 │ Arithmetic │ - │ 15 (Int) │ 1..8 │ ok │\n├────┼───────┼────────────┼───────┼─────────────┼─────────────────────┼────────┤\n│ #4 │ 2 │ IntLiteral │ - │ 15 (Int) │ 12..14 │ ok │\n├────┼───────┼────────────┼───────┼─────────────┼─────────────────────┼────────┤\n│ #5 │ 1 │ Compare │ - │ true (Bool) │ 0..14 │ ok │\n└────┴───────┴────────────┴───────┴─────────────┴─────────────────────┴────────┘\n```\n\nKey trace properties:\n1. **Completion order:** Children (operands) evaluate and complete before their parents. The root node appears last.\n2. **Depth:** Indicates AST nesting level (1 = root).\n3. **Scope:** Carries subject and slot context when evaluating nested item sources (e.g. `actor.wielded_item.damage`).\n4. **Failing nodes:** If evaluation fails (e.g. a missing fact), the node that raised the failure is marked with `! #<id>` and `FAILED: <reason>`. Ancestor nodes report the propagated failure.\n\nThe result's top-level `draws` list is the authoritative stochastic record. Trace rows deliberately do not claim individual draws: nested item-source evaluation and repeated AST-node evaluation make a node id insufficient to attribute a draw reliably. Roll-table trace rows instead show the selected `entry_id` values and which one was `kept`.\n\n### Operator precedence: `||` binds tighter than `&&`\n\nIn the Spellkave DSL grammar, the disjunction operator `||` has higher precedence than conjunction `&&`:\n\n`A && B || C` is parsed as `A && (B || C)`\n\nWhen `A` evaluates to `false`, the right-hand group `(B || C)` is short-circuited. The trace will show `A` evaluated to `false`, while `B` and `C` are omitted entirely from the trace.\n\n## Resolution limits\n\nTo protect the server from infinite recursion and denial of service, expressions are evaluated within bounded limits:\n\n- **Static draw budget:** `EvaluationLimits::for_expression` computes the static draw count times 2, capped at `MAX_DRAW_CEILING` (256 draws).\n- **Node limit:** Hard limit on the maximum number of AST nodes (512).\n- **Depth limit:** Maximum AST recursion depth (64).\n- **Item source depth:** One nested `actor.wielded_item.source(...)` evaluation; a source may not call `.source(...)` again.\n\nThe Rust evaluator defines these bounds in `EvaluationLimits::default`,\n`EvaluationLimits::for_expression` and `eval_dsl_source`; its bound and\nsource-recursion tests exercise the enforcement.\n\nRuntime node, depth and draw limits reject with `bound_exceeded`, naming the\nbound and its budget. A source that calls another source rejects with\n`recursion_limit`, naming the subject and slot.\n\n## Quick reference examples\n\nEvaluate an attack roll predicate with predetermined d20 face 12:\n\n```bash\nsk eval \"1d20 + actor.stat('demo/bonus') >= target.stat('demo/threshold')\" \\\n --kind predicate \\\n --facts '{\"actor\":{\"stat\":{\"demo/bonus\":3}},\"target\":{\"stat\":{\"demo/threshold\":15}}}' \\\n --dice 12\n```\n\nEvaluate a damage roll:\n\n```bash\nsk eval \"1d8 + 3\" --kind int --dice 6\n```\n\nEvaluate weapon damage reading an item source slot:\n\n```bash\nsk eval \"actor.wielded_item.source('damage')\" \\\n --kind int \\\n --facts '{\"item_sources\":{\"actor.wielded_item\":{\"damage\":\"1d8 + 3\"}}}' \\\n --dice 7\n```\n\n## Live act evaluation records (`provenance_id` and `self_states`)\n\nWhile Level A evaluates expressions offline, live simulation evaluates rules within the SpacetimeDB server. When an in-world PLAYER attempts an act or movement:\n\n1. **Act:** The client dispatches an action (`sk manipulate`, `sk move`).\n2. **Match receipt:** The receipt carries `provenance_id` naming the evaluation record that the client matched to the act.\n3. **Query record:** Query the single evaluation record with:\n ```bash\n sk self_states --kind evaluation --provenance-id <id>\n ```\n This returns the continuation envelope with `matched: 1` and the single row (or `matched: 0` if not found).\n4. **Read evaluation fields:**\n - If the act was **refused before resolution** (e.g. `predicate_rejected`), `expression_ids` names the action and gate formula that refused it, alongside `failure_kind` and `failure_detail`.\n - If the act **resolved a stochastic check**, `draws` contains the exact dice faces rolled, and `selected_template_ids` holds resolution labels such as `resolution_result:false` and `resolution_consequence:<id>`.\n5. **Reproduce at Level A:** Take the failing formula (or resolution predicate), the dice values from `draws`, and the relevant entity/target stats, and run `sk eval` to inspect the full AST trace.\n\n### Two lookup limits\n\nKeep two constraints in mind when reading live act evaluation records:\n\n1. **Client matching by arrival window:** The client matches an act receipt to a server evaluation row by the acting subject and baseline arrivals (rows absent before the act). When a body dispatches multiple acts in rapid succession, check `created_at_tick` on the returned record to confirm which act the record belongs to.\n2. **Body ownership scoping:** `spellkave_self_states` queries only records owned by the connected actor's body (`owner_body_entity_id == actor.entity_id`). An evaluation failure row written with owner body 0 (such as a pre-actor system-level rejection before body resolution) or belonging to another actor is not returned by the lookup (`matched: 0`).\n\n### Recorded live node run (hands-on verification)\n\nThe entire rule diagnosis, offline reproduction, repair, and re-verification loop runs over published surfaces without SQL queries, server logs, or kernel source inspection:\n\n1. **Refused act receipt:**\n The player attempts to traverse exit `s:exit:1`:\n ```bash\n sk move --handle s:exit:1 --rev <rev>\n ```\n The server rejects the move. The receipt carries the evaluation id:\n ```json\n {\"status\":\"dispatched\",\"verb_class\":\"movement\",\"handle\":\"s:exit:1\",\"outcome\":\"rejected\",\"provenance_id\":\"r_move:1:3\"}\n ```\n\n2. **Single record query (`provenance_id` lookup):**\n ```bash\n sk self_states --kind evaluation --provenance-id r_move:1:3 --format jsonl\n ```\n Returns 512 bytes with the exact failure details:\n ```json\n {\"kind\":\"tool_result\",\"tool\":\"spellkave_self_states\",\"ok\":true,\"details\":{\"listing\":\"paginated\",\"shown\":1,\"matched\":1,\"truncated\":false,\"next_cursor\":null,\"rev\":\"u2-irew8w\",\"items\":[{\"provenance_id\":\"r_move:1:3\",\"created_at_tick\":1,\"status\":\"Failed\",\"subject_id\":\"1\",\"selected_template_ids\":[],\"draws\":[],\"record_kind\":\"Affordance\",\"failure_kind\":\"predicate_no_longer_holds\",\"failure_detail\":\"affordance_template=core/affordance/traverse_known_threshold;mode=;predicate_source=canonical(template=core/affordance/traverse_known_threshold,root_node_id=4,nodes=4);span=unavailable;predicate_value=false\"}]}}\n ```\n\n3. **Level A offline reproduction:**\n Reproduce the failing predicate with `sk eval` and the actor/target facts:\n ```bash\n sk eval 'actor.has_capability(\"core/walk\") && target.has_niche(\"core/passable_portal\") && actor.has_capability(\"core/fly\")' \\\n --kind predicate \\\n --facts '{\"actor\":{\"capabilities\":[\"core/walk\"]},\"target\":{\"niches\":[\"core/passable_portal\"]}}' \\\n --format jsonl\n ```\n Returns 565 bytes with the full AST trace pinpointing node #3 (`HasCapability` for `core/fly` at span 112..113 returning `false`):\n ```json\n {\"kind\":\"tool_result\",\"tool\":\"spellkave_eval\",\"ok\":true,\"details\":{\"ok\":true,\"value\":{\"type\":\"Bool\",\"value\":false},\"draws\":[],\"trace\":[{\"node_id\":1,\"operator\":\"HasCapability\",\"depth\":2,\"span\":{\"start\":32,\"end\":33},\"scope\":[],\"value\":{\"type\":\"Bool\",\"value\":true},\"error\":null,\"table_entries\":null},{\"node_id\":2,\"operator\":\"HasNiche\",\"depth\":2,\"span\":{\"start\":76,\"end\":77},\"scope\":[],\"value\":{\"type\":\"Bool\",\"value\":true},\"error\":null,\"table_entries\":null},{\"node_id\":3,\"operator\":\"HasCapability\",\"depth\":2,\"span\":{\"start\":112,\"end\":113},\"scope\":[],\"value\":{\"type\":\"Bool\",\"value\":false},\"error\":null,\"table_entries\":null},{\"node_id\":4,\"operator\":\"And\",\"depth\":1,\"span\":{\"start\":0,\"end\":113},\"scope\":[],\"value\":{\"type\":\"Bool\",\"value\":false},\"error\":null,\"table_entries\":null}]}}\n ```\n\n4. **Apply rule correction:**\n The author edits `base/affordances.toml` to remove the unmeetable fly capability and sends the change:\n ```bash\n sk apply -k packages/spellkave-mechanics/fixtures/core\n ```\n The node configures `core/affordance/traverse_known_threshold` live.\n\n5. **Repeat act:**\n The player attempts to traverse exit `s:exit:1` again:\n ```bash\n sk move --handle s:exit:1 --rev <rev>\n ```\n The server accepts the move. The receipt returns:\n ```json\n {\"status\":\"dispatched\",\"verb_class\":\"movement\",\"handle\":\"s:exit:1\",\"outcome\":\"accepted\",\"provenance_id\":\"r_move:1:4\"}\n ```\n\n6. **Verify accepting evaluation record:**\n ```bash\n sk self_states --kind evaluation --provenance-id r_move:1:4 --format jsonl\n ```\n Returns 641 bytes confirming resolution:\n ```json\n {\"kind\":\"tool_result\",\"tool\":\"spellkave_self_states\",\"ok\":true,\"details\":{\"listing\":\"paginated\",\"shown\":1,\"matched\":1,\"truncated\":false,\"next_cursor\":null,\"rev\":\"u2-1ms0gw8\",\"items\":[{\"provenance_id\":\"r_move:1:4\",\"created_at_tick\":1,\"status\":\"Succeeded\",\"subject_id\":\"1\",\"selected_template_ids\":[\"core/affordance/traverse_known_threshold\",\"core/move_outcome\",\"place_edge:1\",\"selection_path:index[niche_id=core/passable_portal]\",\"precondition:address_validity\",\"precondition:target_existence\",\"precondition:reachability\",\"traversal_affordance:core/affordance/traverse_known_threshold\",\"precondition:attachment_presence\",\"precondition:visibility\"],\"draws\":[],\"record_kind\":\"Affordance\",\"expression_ids\":[\"core/affordance/traverse_known_threshold:predicate\",\"core/move_outcome:outcome\"]}]}}\n ```\n\n**Operational cost:** 6 CLI tool calls, 1,718 total JSONL response bytes across evaluation/eval payloads, 0 raw SQL queries, 0 server log greps, and 0 kernel source reads.\n",
271
+ "running-an-authored-act": "# Running an authored act through `r_manipulate`\n\nYou authored a capability, an affordance, an outcome, an action, and a\nconsequence — and `r_manipulate` still does nothing. This runbook lists the\n**non-obvious requirements** for an authored act to actually fire, in the order\nthey bite. (Companion to [`interaction-dsl-and-world-authoring.md`](./interaction-dsl-and-world-authoring.md),\nwhich covers the row shapes themselves.)\n\n## The full chain an act needs\n\nFor an actor to perform an action `X` via `r_manipulate`, all of these must be\nauthored — missing any one makes the act silently unselectable:\n\n| Row | Binds | Common miss |\n|---|---|---|\n| `capability_definitions` | declares capability `C` | — |\n| `actor_capabilities` | grants `C` to the actor entity | actor never granted `C` |\n| `affordance_templates` | `niche_id = \"capability:C\"`, `capability_id = C`, → `outcome_template_id` | — |\n| `outcome_templates` | `manipulation_action_id = X` | outcome not linked to the action |\n| `action_definitions` | `action_id = X`, `required_capability = C` | — |\n| `consequence_templates` + `consequence_frame_writes` | what the act *does* | — |\n| **`spatial_niche_attachments`** | binds `capability:C` to the **place node the actor stands on** | **most common miss** — see below |\n\n### Anchoring depends on the niche's `provider` (changed by actor-carried-verbs)\n\nWhether a niche needs spatial anchoring is now declared on the niche itself:\n`niche_definitions.provider` resolves to a `niche_provider_definition` row\nwhose typed flags drive admission. Three seeded providers:\n\n- `provider = \"actor\"` — the actor's capability carries the verb everywhere;\n **no attachment row is needed** (a target is an argument, not a\n precondition — bead `sk-rd0`). This is the right choice for\n `capability:*`-style verbs like attacks, Dodge or Rest.\n- `provider = \"entity\"` — a candidate entity affords the niche through its\n own tags/state satisfying the niche predicate; no attachment row.\n- `provider = \"\"` / `\"place\"` (the default for ordinary niches, and the\n fail-closed fallback for a niche with no `niche_definitions` row at all) —\n the pre-existing rule below applies unchanged: the niche exists only where\n a `spatial_niche_attachment` anchors it.\n\n**`capability:*` niches are the exception: `provider` is required.** Do not\nrely on the empty/place fallback for a capability-shaped niche. A missing or\nempty provider fails closed *silently* — the verb becomes place-provided\nwithout anyone saying so, and is dead everywhere an attachment was never\nauthored. That is how Fighter Second Wind vanished from the crypt (sk-0m4.69).\nAuthor the row with an explicit `provider` (`actor` for carrier-bound class\nfeatures and self-verbs; `place` only when you mean room-scoping). Do **not**\nflip the default to actor: capabilities are an authorization surface, and\nfail-open would make every granted capability a verb everywhere. The\nworld-author pre-flight rejects the miss as **`WA-CAP-002`** (fatal, same\nfamily as `WA-CAP-001`) so the next forgotten capability is caught by a gate,\nnot a playtest.\n\nFor a **place-provided** niche, authoring the capability and granting it is\nnot enough — without a `spatial_niche_attachment` binding `capability:C` to\nthe actor's node, selection finds nothing:\n\n```toml\n[[spatial_niche_attachments]]\nbundle_id = \"my-bundle\"\nplace_node_id = \"village/village_green\" # where the actor stands\nniche_id = \"capability:my-bundle/my_capability\"\n```\n\nThis is Gibson affordance discipline: an affordance is a property of the\nactor-in-a-place, not of the actor alone. If `r_manipulate` rejects with\n*\"no authored affordance_template selected action_definition '…'\"*\n(the world API),\nthe error now tells you which of\nthese is missing (no affordances / capability not held / niche not anchored) —\nand, since #1968's canon-warden gate pass 2, a niche that DID resolve but\nwhose affordance predicate simply evaluated false (an ordinary miss, e.g. a\nfailed attack roll) is now DISTINGUISHABLE from the \"niche never resolved\"\nshape above: the rejection's `failure_kind` is `\"niche_unresolved\"` for the\nmissing-`spatial_niche_attachment` case above, and `\"predicate_rejected\"` for\nan ordinary miss on a fully-attached affordance — the hint text names which\none fired. A third value, `\"capability_not_held\"`, means every candidate for\nthe action names a template `capability_id` the actor does not hold: the kernel\nchecks that capability at act time, so the predicate does not need to repeat it,\nand an empty `capability_id` is ungated. All are open `failure_kind` STRING\nvalues (ADR-0018), never a closed enum.\n\n## Player-facing proof flow\n\nOnce the rows validate and expose their per-actor facts, prove the authored behavior through the\nsame bounded PLAYER flow used during play:\n\n1. Read `spellkave_scene` and `spellkave_manipulation_context`.\n2. Use the context's independent disclosed action and target facts to compose\n one typed attempt. Disclosure is not an eligibility guarantee.\n3. Execute `spellkave_manipulate` with the authored `action_id` and `target_id`,\n or `spellkave_communicate` with its speech-act id and utterance.\n4. Re-read the relevant summary/detail\n surface (`spellkave_self_summary`, `spellkave_item_detail`,\n `spellkave_trace_detail`, or `spellkave_session_status`).\n\nThe PLAYER presents facts but the reducer independently revalidates authority\nand world predicates. A rejected direct attempt is an ordinary server result,\nnot proof that the disclosed facts were stale. Mark-making is an ordinary\nauthored manipulation; PLAYER does not receive a raw trace-payload tool.\n\nThe `spacetime call` commands below are **author/operator diagnostics**, not\nPLAYER guidance. General raw reducers remain useful for isolated authoring\nchecks, but their server authority/capability gates still apply.\n\n## Acting inside a session (combat, etc.)\n\nA session-scoped act (e.g. an in-combat move or attack) runs inside an open\nsession. `r_session_open` takes three arguments — the session definition, the\nparticipant entity ids, and a grid-extent JSON (`\"\"` for no tactical grid)\n(the world API):\n\n```bash\n# 1. open the session — participants, initiative, optional grid.\n# For a Sequential session with participants this also starts turn 1.\nspacetime call <db> r_session_open '\"my-bundle/session/combat\"' '[12, 13]' '\"\"'\n\n# 2. the participant whose turn it is can act\nspacetime call <db> r_manipulate 12 '{\"entity\":12}' '\"my-bundle/move\"' '{…args…}'\n\n# 3. end that turn and hand it to the next participant (arg: session_id)\nspacetime call <db> r_advance_turn 1\n```\n\n`r_session_open` calls the first turn advance itself when `turn_rule =\n\"Sequential\"` and the participant list is not empty (`r_session_open.rs:168-173`);\nan extra `r_advance_turn` right after opening skips the first participant.\n\n**Combat turns rotate only through `r_advance_turn`.** Since ADR-0092 no\nmulti-participant session auto-advances on the world clock, and the tick\nheartbeat does not read `round_duration_ms`; the heartbeat only terminates\npromoted long-running actions (the world API). A slow\nparticipant therefore holds the turn until someone calls `r_advance_turn`\n(the NPC host or a driver does this for NPC turns).\n\n## Target shape\n\n`r_manipulate` always takes a target. Variant tags are **lowercase**\n(`{\"entity\":N}`, `{\"item\":N}`, `{\"placeNode\":\"…\"}`, `{\"world\":{}}`). A\n**self-act** (a move repositioning the acting figure) targets the actor itself —\n`{\"entity\":<actor>}`, not `{\"world\":{}}` (world is rejected for subject-resolved\nacts).\n\n### Self-targeting (ADR-0060)\n\nBy default `r_manipulate` **rejects** an `{\"entity\": <actor>}` target when\nthe acting entity and the target are the same entity. This preserves the\n\"affordances are relations to distinct objects\" default.\n\nTo author a self-targeting manipulate action (e.g. Fighter **Second Wind**,\nBarbarian **Rage**, or any \"you regain HP / you gain advantage\" class feature),\nset `self_eligible = true` in the `[[action_definitions]]` row:\n\n```toml\n[[action_definitions]]\naction_id = \"srd/second_wind\"\nbundle_id = \"srd\"\ndisplay_name = \"Second Wind\"\nrequired_capability = \"srd/fighter/second-wind\"\non_success = \"srd/second_wind/success\"\nself_eligible = true # allows {\"entity\": <actor>} as target\n```\n\nWithout the flag the call fails immediately with outcome reason\n`self_target_not_eligible`. The per-actor manipulation context exposes the\nself-target fact only for actions whose `self_eligible = true`.\n\n`self_eligible = true` **admits** the acting entity as one target among\nothers — the affordance still fans out to every other co-located distinct\nentity too. For an action that should target **only** the acting entity\n(rest, meditate, a pure self-buff — never a co-located NPC), set\n`self_only = true` instead (ADR-0075, amends ADR-0060):\n\n```toml\n[[action_definitions]]\naction_id = \"srd/rest_long\"\nbundle_id = \"srd\"\ndisplay_name = \"Long Rest\"\nrequired_capability = \"srd/rest\"\non_success = \"srd/rest_long/success\"\nself_only = true # ONLY {\"entity\": <actor>} is admitted — no distinct\n # entity, place, or world target is offered or accepted\n```\n\n`self_only` implies self-admission — do not also set `self_eligible` on the\nsame row, it is redundant. A self-only action still needs its ordinary\nspatial gate (`spatial_niche_attachment`) if the affordance is meant to be\nnode-scoped (\"rest only at a campsite\"); `self_only` narrows *which entity*\nis targetable, it does not exempt the action from the affordance's normal\nlocation gating.\n\n## Args shape\n\n`ManipulationArgs` fields all default, but `spacetime call` deserialisation is\nstrict — pass every field explicitly (the struct has ten fields,\nthe world API):\n\n```json\n{\"selected_items\":[],\"quantity\":null,\"destination\":null,\n \"station_ref\":null,\"build_target\":null,\"required_absent_state_ids\":[],\n \"dispatch_text\":null,\"expected_participants\":null,\n \"participant_context\":null,\"semantic_context\":null}\n```\n\n## Provenance visibility\n\nEvery `r_manipulate` attempt writes `evaluation_provenance`, including rejected\nattempts. That row is now server-filtered: client subscriptions read\n`visible_evaluation_provenance`, while the raw `evaluation_provenance` table is\nprivate server state. Public and local provenance remains broadly readable, but\nhidden provenance is visible only to an authorized owner/observer projection.\n\nTarget conditions are filtered the same way. Clients read\n`visible_target_condition`; the raw `target_condition` table is private server\nstate. `condition_definition.observable = true` conditions remain public.\nNon-observable conditions are visible to the target body and the source body that\napplied them, so an author can model \"the poison landed\" without broadcasting the\ncondition to every passive client.\n\nFor authors, this means dice traces from roll-gated predicates are not a global\ndebug feed. Test an authored action through the acting player's connection when\nyou need to inspect its private roll provenance; a third-party observer may still\nsee public world effects, such as HP changing, without seeing the caster's hidden\ndice trace.\n\n## Worked example\n\nA grid combat session mints an **ephemeral place-graph** at open (ADR-0052): each\nparticipant stands on an ordinary `place_node` cell. The full chain is then plain\nsubstrate — a tactical move is `r_move` over a grid `place_edge` (budget-gated),\nand an AoE is `ForEachActorInRadius` over the grid's `place_node` positions. See\nADR-0052\nand the `tactical-grid-as-place-graph` change's demo for the worked proof.\n\n## Movement gates: capability + reach are independent\n\n`r_move` gates a step over a `place_edge` on **two separate mechanisms** —\nmixing them up costs real debugging time (a live grid-combat proof pass spent\nits first hour chasing the wrong one before finding this).\n\n1. **Capability gate — `actor.has_capability(\"core/walk\")`.** Every core\n traversal affordance template (`core/walk_edge`,\n `core/affordance/traverse_open_portal`, `traverse_known_threshold`,\n `traverse_locked_portal`) ANDs this with `target.has_niche(\"core/passable_portal\")`\n (`packages/spellkave-mechanics/fixtures/core/base/affordances.toml`, generated by\n `packages/spellkave-mechanics/src/core/affordances.ts`). `target.has_niche(...)` is satisfied\n automatically by attaching the template to the edge via\n `place_edge_affordance` — the traversal-affordance niche is NOT the same\n thing as a `spatial_niche_attachment` (that row anchors a *manipulation*\n capability's affordance to a place node; edge traversal never needs one).\n `actor.has_capability(\"core/walk\")`, on the other hand, is never granted\n for free: an actor with no `core/walk` `actor_capabilities` row fails\n every move over a **core** traversal template, always with the identical\n rejection (SRD content gates its own step templates on\n `srd/capability/walk` instead, granted by the `srd.creature` identity tag;\n srd-cc `fixtures/base/playing-the-game/grid.toml`) —\n a `predicate_no_longer_holds` detail carrying `predicate_value=false`, with\n no further signal about which clause of the predicate failed.\n2. **Reach gate — the OPTIONAL `movement_reach_resource` binding.** The\n binding is read off the edge's *resolved traversal mode* — a\n `place_edge_affordance` row's `bindings_json` (or a combat-grid\n blueprint's own `edge_affordance_bindings_json`), a bundle/graph-scoped\n `[[movement_defaults]]` row the edge inherits (ADR-0101,\n movement-defaults-modes-terrain-cost: ordinary edges author zero\n `place_edge_affordance` rows of their own and still resolve a reach\n binding this way — see \"Movement defaults: zero rows for ordinary\n walking\" below), or the two merged when the edge's own row *refines* the\n inherited default. When an edge authors more than one `mode_id`\n (alternatives — walk vs. fly vs. swim), the binding that actually applies\n to one attempt is the one on the mode `r_move` picks: the cheapest\n passing mode, not necessarily the edge's first-authored row. `r_move`\n treats the resolved resource as a per-actor movement BUDGET, in grid\n cells converted through the place graph's `metres_per_unit`. A step whose\n distance is within the budget still commits immediately. A step whose\n distance exceeds a **positive** budget is no longer refused (#2230): one\n `r_move` opens the session named by the resolved mode's\n `long_running_move_session` binding (srd authors `srd/long_running_move`;\n core authors `core/long_running_move`), the walker stays at the origin\n and is busy until `ceil(distance/speed)` of a 6000 ms round, then the\n destination write lands. Missing that binding fails loudly and names the\n binding. The travel session is Sequential with an empty\n `turn_scheduler_id` — a clock-only session, not combat initiative\n (#2232). Zero or missing speed still fails closed with\n `movement_reach_exceeded`. This check is evaluated before the capability\n predicate but is otherwise completely unrelated to it.\n\n**The two gates are easy to conflate because an unmet capability gate gives\nno signal that a reach binding even exists.** Setting `movement_reach_resource`\nalone, with no capability grant, produces the exact same\n`predicate_value=false` rejection as an edge with no reach binding at all —\nthere is nothing in the failure that distinguishes \"wrong resource binding\"\nfrom \"missing capability.\" If a move is rejected, check the capability grant\nFIRST; only look at `movement_reach_resource` once capability is confirmed.\n\n### Granting `core/walk`\n\n`core/walk` is a **core-shipped capability** (`capability_definitions`,\nbundle `core`) — it is authored nowhere per-bundle, only GRANTED. Every actor\nthat should traverse an edge through a **core** traversal template (including\nthe temporary cells a core combat-grid session opens) needs an\n`actor_capabilities` row for it; SRD content uses `srd/capability/walk`\nfrom the creature identity tag instead:\n\n- **Verb tools:** `spellkave_bind_actor`'s `capabilities` array grants the\n declared ordinary capability. Offline authoring resolves `core/walk` against\n the canonical core target; it is not a kernel bootstrap definition.\n Reserved `frontier.*` grants instead require publisher or actor-free genesis\n admission, as [the privilege guide](./privileges.md#the-reserved-prefix) explains:\n\n ```jsonc\n {\n \"bundle\": \"my_bundle\",\n \"entity_key\": \"my_bundle/npc_1\",\n \"capabilities\": [{ \"capability_id\": \"core/walk\", \"source\": \"core\" }]\n }\n ```\n\n- **Raw row:** `spellkave_write_rows` with `kind: \"actor_capabilities\"` —\n `{ actor_entity_key, capability_id: \"core/walk\", source: \"core\" }` — the\n shape every shipped fixture that moves an actor already carries (e.g.\n [`examples/authored-dark-cave.toml`](./examples/authored-dark-cave.md)'s\n `scout`/`delver` actors).\n\n`spellkave_define_behavior`'s `grant_to` does **not** apply here: it grants\nthe capability the SAME call defines (a fresh `capability_id` it mints), never\na pre-existing one — it cannot be pointed at `core/walk`.\n\n`movement_reach_resource`'s value is read off the ACTOR first (an\n`object_state` row on the moving entity) and only falls back to the\n`resource_definitions.initial_value` when the actor has none — the same\n\"a definition's `initial_value` is only the pool's bound, never a per-actor\ndefault\" gotcha every other resource pool in this corpus carries. Author a\nper-actor `object_state` row on that resource id if different actors should\nhave different reach; everyone shares the flat definition default otherwise.\n\n### Adjacency and co-location basics\n\nBeyond the two gates above, `r_move` also needs the plain spatial facts in\nplace:\n\n- The named `place_edge`'s `from_node_id` must equal the actor's CURRENT\n `actor_spatial_locations.place_node_id` — you can only step off the node\n you are actually standing on.\n- Both `from_node_id` and `to_node_id` must resolve to REGISTERED `place_node`\n rows — specifically, nodes whose `bundle_id` is in the target bundle's\n dependency chain (the bundle itself plus everything it transitively\n `depends_on`; the world API's\n `chain_scoped_node_ids` / edge-endpoints-resolve check). A dangling\n endpoint outside that chain is a FATAL validator diagnostic at author time,\n not a runtime `r_move` rejection — it never reaches the reducer at all.\n- The edge needs at least one *resolvable traversal mode* — an own\n `place_edge_affordance` row, an inherited bundle/graph\n `[[movement_defaults]]` row (see below), or a combat-grid blueprint's\n materialised edge row. An edge with none of those (and, if it opted out via\n `place_edge.inherit_movement_default = false`, no own row either) rejects\n with the same `MissingTraversalAffordance` reason as before this change,\n before either gate above is even evaluated.\n- **Destination occupancy is an authored read, not a kernel veto (ADR-0134\n D-3).** `r_move` has no built-in \"cell already taken\" rule. Whether a step\n onto an occupied node is legal is a clause on the edge's traversal\n template, read through the `occupants_at('<scope>', '<excluding_condition>')`\n leaf: it counts actors other than the mover that hold an\n `actor_spatial_location` row on the scoped node and do not carry the named\n condition. On the traversal path the scopes are `to_node` (the edge's\n destination) and `from_node` (its origin) — the same nodes the\n `<state_id>@to_node` / `@from_node` projections read, named without the\n `@` sigil because here the scope is an argument of its own. The second\n argument is optional; omitted, every occupant counts. The SRD 5.2\n grid-step template (`srd/affordance/grid-step`, the one its combat-grid\n blueprint binds) authors `&& occupants_at('to_node', 'srd/condition/dead') == 0`:\n a living creature blocks its cell, a corpse does not, and the condition id\n is content the kernel only compares. The ambient `srd/affordance/step`\n (the bundle-wide movement default every ordinary place edge inherits)\n carries no such clause, so ambient nodes keep free co-location. A refused step surfaces as the\n ordinary traversal-predicate refusal (`failure_kind`\n `predicate_no_longer_holds`, detail `affordance_template=<id>;…`,\n ADR-0091 D-3), never a dedicated occupancy kind. A grid whose template\n reads no `occupants_at` lets actors stack (see the\n `[[combat_grid_blueprints]]` section below for the annotation that makes\n that intent explicit). Session-join seating (`select_free_grid_cell`) and\n session-open seat assignment still never seat a joiner on an occupied\n cell; those are placement rules, not movement.\n\n### Movement defaults: zero rows for ordinary walking (ADR-0101)\n\nAuthoring one `place_edge_affordance` row per walkable edge was the only way\nto make an edge traversable before movement-defaults-modes-terrain-cost. A\nbundle- or graph-scoped `[[movement_defaults]]` row (authoring verb\n`spellkave_set_movement_default`) now supplies the default traversal mode for\nevery edge that does not opt out — resolution is EDGE > GRAPH (the edge's own\n`place_graph_id`) > BUNDLE (the edge's own `bundle_id`), and nothing walks\n`parent_graph_id` or keys on `blueprint_id`. `place_edges.inherit_movement_default`\n(default `true`) is the one per-edge escape hatch: set it `false` and the edge\nowns its *entire* mode set from its own `place_edge_affordance` rows alone\n(a fly-only chasm that must refuse an ordinary walker). Left `true`, an\nedge's own row on the *same* `affordance_template_id` as the inherited\ndefault *refines* it (a binding-level overlay, the edge's own value wins per\nkey — e.g. a two-cell-long edge overriding `movement_cost_cells`); an own row\non a *different* template AND-joins the default's mode (the locked-door\nidiom keeps working with no edit); an own row under a *different* `mode_id`\nis a fresh alternative the edge OR's against the default (walk-or-swim). See\n`spellkave_bind_edge_affordance`'s `mode_id` / `inherit_movement_default`\nparameters and `spellkave_set_movement_default` in the generated\n[tool-reference](./tool-reference.md) for the exact upsert keys.\n\n## Combat grid movement policy\n\nCombat grids are not a second movement system. Opening a grid-backed session\ncreates temporary `place_node` cells and `place_edge` links on top of the current\nworld location. Those rows live for the session, but while the session is active\nthey behave like ordinary spatial substrate: a player moves from cell to cell\nwith `r_move`, and the movement reducer evaluates the generated edge affordance\nthe same way it evaluates an authored world exit.\n\nBecause every generated edge still needs a traversal affordance, a grid-backed\nsession points at a combat grid blueprint. The blueprint declares the grid\nshape and the traversal affordance that should be materialised for generated\nedges. `combat_grid_blueprints.edge_affordance_template_id` /\n`edge_affordance_bindings_json` is the prior art `[[movement_defaults]]`\ngeneralised for ordinary place graphs (ADR-0101,\nmovement-defaults-modes-terrain-cost, \"Movement defaults\" above): one\nauthored default template + bindings applied to every generated edge unless\n`edge_overrides_json` says otherwise for that edge — the blueprint stays the\nproducer of concrete edge-tier rows for grids specifically (expanded once at\nsession open, no new precedence tier), while `[[movement_defaults]]` is the\nsame idea for edges that already exist in a manifest-authored place graph:\n\nThe following `example/*` rows are schematic. They demonstrate the shape of a\nstandard open grid; they do **not** name a kernel-seeded identity or promise that\na bundle called `example` is installed. The kernel has no implicit standard-grid\nfallback: authored content must reference a blueprint that exists in its bundle\ndependency closure.\n\n```toml\n[[session_definitions]]\nsession_def_id = \"example/session/combat\"\ncombat_grid_blueprint_id = \"example/combat-grid/standard\"\n\n[[combat_grid_blueprints]]\nblueprint_id = \"example/combat-grid/standard\"\nbundle_id = \"example\"\nwidth = 4\nheight = 4\ntopology = \"4\"\ncell_size_m = 1.5240000486373901\ndistance_metric_id = \"core/metric/manhattan\"\nedge_affordance_template_id = \"example/affordance/step\"\nedge_affordance_bindings_json = '{\"movement_reach_resource\":\"example/speed-walk\"}'\nedge_overrides_json = '''\n[\n {\"from\":\"c_0_0\",\"to\":\"c_1_0\",\"movement_cost_cells\":2,\"label\":\"Rough ground\"},\n {\"from\":\"c_0_1\",\"to\":\"c_1_1\",\"blocked\":true,\"label\":\"Blocked brush\"}\n]\n'''\n```\n\n`distance_metric_id` names the `[[distance_metric_definitions]]` row the grid\nmeasures distance under (ADR-0134): the reach gate, the\n`core/distance_to_actor_mm` fact, the movement cost of a step and\nopportunity-attack range all read the same metric, so they agree on every\ngrid. The `core` bundle seeds `core/metric/euclidean` (straight line, the\ndefault when the field is omitted), `core/metric/chebyshev` (every straight or\ndiagonal step is one cell — the SRD 5.2 grid rule, the natural pair for\n`topology = \"8\"`) and `core/metric/manhattan` (no diagonal shortcut, the\nnatural pair for `topology = \"4\"`). Topology says which cells are adjacent;\nthe metric says how far apart any two cells are — the two are not\ncross-validated, so a `\"4\"` grid with Chebyshev is legal and odd. An unknown\nid fails validation (`MF-VAL-332`) rather than falling back silently. Area\nshapes (`point_in_shape`, node extents) keep raw Euclidean geometry whatever\nthe grid's metric says.\n\n`accepts_stacked_occupancy` states that this grid lets actors share a cell.\nSince ADR-0134 D-3 the kernel has no built-in occupancy veto: whether a step\nonto an occupied cell is legal is a clause on the edge template, read through\n`occupants_at('to_node', '<condition id>')` (the SRD 5.2 grid-step template blocks\non any living occupant and lets corpses be entered). A blueprint whose\n`edge_affordance_template_id` template reads no `occupants_at` therefore\nlets actors stack, and the validator refuses that silently permissive shape\nwith `MF-VAL-333` unless the blueprint carries\n`accepts_stacked_occupancy = true` — the same intent-lives-in-a-column\npattern as `accepts_global_storm`. A template the manifest does not declare\nfollows the same two-tier rule as every cross-bundle reference: with the\nblueprint's whole `depends_on` closure present the template is undeclared\nand the check fails closed; in a per-bundle authoring run whose closure is\nincomplete (a proof scene binding the base bundle's `srd/affordance/step`)\nthe reference is trusted and the predicate is inspected by the pass that\nsees the whole closure (`just seed`, live admission).\n\nThe example above means \"every adjacent combat-grid edge is openly traversable\",\nwith two authored edge exceptions. Authors should treat it as the simplest grid\npolicy, not as a hard-coded combat rule. Terrain, locked cells, or flight-only\nmovement should change the grid blueprint or the edge affordance bindings, so\nthe same `r_move` path keeps carrying tactical movement — `GridEdgeOverride`\nalso carries `mode_id` (ADR-0101), so a generated edge can be given a fly-only\nor walk-or-swim alternative the same way a manifest-authored edge can. A\n`movement_cost_cells` override like `\"Rough ground\"` above authors a *static*\nper-edge multiplier; the same generated edge's traversal template can instead\ncarry a `movement_cost_expression_source` that reads the incident cells'\n`spatial_environment_state` (`@from_node`/`@to_node` facts, ADR-0101 D-4) — the\ngrid struct needs no change for that, the expression lives on the template.\nThe older `session_definitions.grid_edge_affordance_*` fields are a legacy\nfallback for direct reducer calls that pass an explicit grid extent; authored\ncombat content should prefer `combat_grid_blueprint_id`.\n\n**Walls = cover / line of sight.** A `blocked` edge override is more than\nimpassable terrain: it is a **wall** that also **occludes line of sight**. Metric\nreachability (`r_manipulate`, the same check that gates an attack's `range_m`)\nwalks the cells the attacker→target line crosses and, if any crossed edge is\n`blocked`, the target is *out of reach* — you cannot strike (or otherwise reach)\na target *through* a wall, even when it is metrically adjacent. So a creature\nlurking behind a thicket/boulder wall has **cover**: an attacker must flank to an\nopen edge. Author walls by adding `{\"from\":\"c_x_y\",\"to\":\"c_a_b\",\"blocked\":true}`\noverrides (both directions for a two-way wall); the kernel reads only the generic\n`blocked` flag — there is no separate \"wall\"/\"cover\" vocabulary.\n",
272
+ "self-eligible-reaction-budget": "# MF-VAL-263's budget requirement narrowed to self-eligible REACTIONS (2026-08-01, PR #2079) — a plain self-target action needs no `spends_channel` or `ModifyResource`\n\n**The rule, as it stands today.** `self_eligible = true` has two independent\nmeanings on an `[[action_definitions]]` row (see `running-an-authored-act.md`'s\n\"Self-targeting (ADR-0060)\" section for the targeting half). MF-VAL-263\n(`validate_self_reaction_resource_refs`, `crates/spellkave-validate/src/refs.rs`)\nonly cares about the OTHER half: whether this action is also wired into the\n§20 reaction producer, i.e. `reaction_eligibility` and/or `reaction_trigger` is\nset (ADR-0050 \"self-reaction-resolution-flip\" — the acting entity admitted as\nits own reactor, e.g. Legendary Resistance or the shipped\n`srd/heroic_inspiration/reroll`). **Only for that reaction-wired shape** must\nthe action spend a real `spends_channel`, or its `on_success` chain write a\n`ModifyResource` budget somewhere (including nested inside a\n`ForEachActorInRadius` body) — no budget resource, no admission:\n\n```\nMF-VAL-263: self_eligible action_definition '<id>' on_success '<id>/success'\nhas no ModifyResource budget resource\n```\n\n**Solo self reactions.** With `self_eligible = true`, the acting entity is a\nreaction candidate even when no seated peer shares its place. The authored\ntrigger, eligibility predicate and budget still decide whether its window\nopens. Do not add a peer merely to activate a self reaction: the production proof in\n`packages/spellkave-test-lab/src/live.solo-self-reaction.local-node.test.ts`\ncovers the solo case, the non-self negative control and peer deduplication.\nIt also pins the existing seatless-self bypass after a previously admitted\nstochastic act loses its seat; the interim seatless-policy replacement is\ntracked by `sk-dhu`.\n\n**Why reactions still need a budget.** A reusable self reaction needs an\nauthored cost rather than a free outcome flip. The commit-driven path does\nnot use `REACTION_MAX_DEPTH` to meter later self-triggering acts (ADR-0050),\nso budget a self reaction with `spends_channel` or a `ModifyResource` write\nreachable from `on_success`, as `srd/heroic_inspiration/reroll` does. The\nvalidator's `validate_self_reaction_resource_refs` and MF-VAL-263 tests in\n`crates/spellkave-validate/src/refs.rs` anchor this requirement.\n\n**What changed 2026-08-01 (finding #73,\n`packages/spellkave-srd-cc/ledger/designs/prone-free-action.md` Slice A,\nPR #2079).** Before this date the same budget requirement fired on EVERY\n`self_eligible` action, including ones with no reaction wiring at all — a\nplain self-targeted action like the SRD's Dropping Prone (\"you can give\nyourself the Prone condition ... without using an action or any of your\nSpeed\"), which spends nothing by design. That shape is now valid — the\nlive srd-cc row\n(`packages/spellkave-srd-cc/fixtures/base/playing-the-game/drop-prone.toml:14-27`):\n\n```toml\n[[action_definitions]]\naction_id = \"srd/movement/drop-prone\"\nbundle_id = \"srd\"\ncost_time_ms = 0\ndescription = \"You give yourself the Prone condition without spending an action or Speed, unless your Speed is already 0.\"\ndisplay_name = \"Drop Prone\"\non_failure = \"\"\non_success = \"srd/movement/drop-prone/success\"\nrequired_capability = \"srd/action/drop-prone\"\nresolution_mode = \"Deterministic\"\nresolution_predicate_source = \"\"\nresumable = false\nself_eligible = true\nself_only = true\nsession_def_id = \"\"\n# no spends_channel, no reaction_eligibility/reaction_trigger — genuinely free\n```\n\nIf your `self_eligible` action has neither `reaction_eligibility` nor\n`reaction_trigger` set, MF-VAL-263 no longer applies to it. If it does have\neither set, the budget rule above is unchanged.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
273
+ "sibling-resource-predicate-seeds": "# Sibling resource pools each need their OWN predicate-safety seed\n\n(The RH3/RH6/CC1–CC3 worked examples are from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\n**Gotcha — seeding one resource pool does NOT seed a sibling pool with the\nsame shape.** `actor.stat(...)` throws `UnknownField` (excluding the whole\naffordance) when no `object_state` fact exists yet for the reading actor —\ndocumented at RH3/RH6 and fixed at CC2 for `phandelver/castle_alert/gate`\n(an explicit `[[object_state]]` seed row, since CC1 never writes that pool\nuntil its own tripwire fires). CC1 defines THREE parallel wing pools\n(`castle_alert/gate`, `castle_alert/inner`, `castle_alert/posture`) from the\nsame `[[resource_definitions]]` template, but CC2 only seeded `gate` —\n`inner` stayed unseeded until CC3 needed to read it (a kneeling-vs-hidden\nposture predicate reading `<= 0` before its own tripwire ever fires) and hit\nthe identical throw. Authoring a resource pool with `initial_value = 0`\ndoes NOT auto-materialise an `object_state` row for every actor; each\ndistinct predicate that reads a pool via `<=`/`<` (a default-TRUE gate)\nneeds its own seed, even when a same-shaped sibling pool already got one.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
274
+ "spell-authoring-best-practices": "# Spell authoring best practices\n\nHow to add a spell to a Spellkave world without hand-wiring a dozen rows or\ndrifting into the duplication the author-time lint flags. This is the prose\ncompanion to the worked example\n[spell-identity-minimal](./examples/spell-identity-minimal.md) and the `emitSpell`\nprimitive in `@spellkave/world-author`.\n\nThe guiding maxim: **one spell is one identity, declared once, rendered by a\nprimitive.** Everything below follows from that.\n\n## 1. One identity, three agreeing rows (#835)\n\nA spell shows up across several row-kinds, but it has a single identity. Three rows\nmust carry the *same* id:\n\n- the catalog `entity_definitions.entity_def_id` — the spell as a thing in the world,\n- the `capability_definitions.capability_id` — \"an actor can cast it\",\n- the cast `action_definitions.required_capability` — the verb binds back to it.\n\nIn the SRD bundle that id is `srd/spell/<slug>` (e.g. `srd/spell/fire-bolt`). The\ncast **action** keeps its own verb id (`srd/cast_fire_bolt`) — only the *identity*\nis unified, never the verb. Binding the three lets the validator's **MF-VAL-264**\n(a `srd/spell/*` capability with no matching catalog entity) and **MF-VAL-265** (a\n`required_capability` with no `capability_definition`) catch a broken spell at seed,\nand lets the author-time lint catch it earlier still.\n\n## 2. Let the primitive emit the rows — don't hand-wire them\n\nUse `emitSpell({ capabilityId, actionId, bundleId, displayName, tags })` from\n`@spellkave/world-author` (or, in the SRD sweep, a `behavior-cluster.ts` shape). It\nbuilds the capability, the cast action, the outcome template, and their tags from\n**one declaration**, all bound to the same identity, so the three-row agreement\nabove is structural rather than something you keep consistent by hand. Pass\n`catalogEntityIds` and it asserts the catalog entity exists (the author-time form of\nMF-VAL-264) before it emits.\n\nHand-authoring the same rows in TOML is where drift creeps in: a mistyped\n`required_capability`, an underscore in one slug and a hyphen in another, a\ncopy-pasted action.\n\n## 3. The four duplication smells (and the lint that finds them)\n\nRun the author-time checker over a bundle:\n\n```\nsk lint <manifest.toml> [--bundle [--dep <dep-manifest>]...] --strict\n# SRD bundle: sk lint packages/spellkave-srd-cc/fixtures/manifest.toml --bundle --strict\n```\n\nIt emits **non-fatal warnings** — it never fails the run. It is deliberately\ndistinct from two neighbours: `sk validate` (which *fatals*, exit 2, on broken\nrefs) and the runtime `just doctor` (which checks a *live world's* health). The lint\nreasons over manifest *rows* at author time. Its rules:\n\n- **`twin-action`** — two `action_definitions` byte-identical except their id (the\n classic `cast_X` ↔ `cast_X/affordance` copy). Emit **one** canonical action and\n point the affordance template at it; don't duplicate the action.\n- **`tag-repetition`** — the catalog identity's tag set re-carried verbatim on the\n behavior capability/action rows. Put taxonomy tags on the **identity**\n (`entity_definition_tag`); the capability/action carry only behavior-specific tags,\n if any. (Tagging the capability **and** the action from one `emitSpell` call is\n fine — that is the primitive's single-sourced output, not a smell.)\n- **`spell-delimiter-drift`** — an underscore in a `srd/spell/<slug>` identity. The\n catalog convention is hyphen-delimited; mixed delimiters orphan the binding\n (`srd/spell/magic_missile` vs the catalog's `srd/spell/magic-missile`).\n- **`orphan-spell-capability`** / **`dangling-required-capability`** — the\n author-time mirror of MF-VAL-264/265: a `srd/spell/*` capability with no catalog\n entity, or a `required_capability` with no `capability_definition`.\n\n## 4. DRY via the substrate's own reuse points — not a new \"base spell\" row\n\nThe data model already gives you reuse primitives; lean on them instead of\ncopy-paste:\n\n- **id-references** — point at a shared `outcome_template` / `consequence_template`\n rather than re-authoring it.\n- **definition seeds** — `entity_definition_initial_state` /\n `…_initial_capability` / `…_initial_condition` give every instance of a definition\n its stats/capabilities/conditions (see\n [definition-seed-statblock](./examples/definition-seed-statblock.md)); you don't\n re-author them per instance.\n- **`affordance_templates.composes`** and **`condition_definitions.implies`** —\n compose affordances and chain conditions instead of duplicating them.\n\n⚠️ **Guardrail.** Reuse stays in the **authoring layer** that renders flat rows. Do\n**not** ask for a substrate-level \"base spell\" row-kind that other spells inherit\nfrom — that breaks the content-neutral substrate (ADR-0021, Gibson discipline). The\nblessed reuse points above already exist; spell authoring uses them, it does not add\nnew ones.\n\n## 5. Omit-the-default\n\nPrefer authoring only the fields that differ from a row-kind's schema default.\nTemplate rows carry constant boilerplate (`outcome_bool = true`,\n`discovery_validated = false`, empty csv/json fields); when a field equals its\ndefault, leaving it out keeps the manifest readable and the diff honest. (The schema\ndefault omission is tracked under #836-A; `emitSpell` already emits the lean form.)\n\n## Where this lives\n\n- Primitive: `emitSpell` / `assertSpellCatalogBinding` in\n `packages/spellkave-world-author/src/spell.ts`.\n- Lint: `lintManifest` in `packages/spellkave-world-author/src/lint.ts`; CLI\n `sk lint`.\n- Worked example: [spell-identity-minimal](./examples/spell-identity-minimal.md).\n- Identity unification rationale: issue #835; render-discipline + lint: issue #836.\n",
275
+ "target-has-capability-dead": "# `target.has_capability(...)` is dead — capability facts are Actor-only; gate a TARGET's kind via `target.has_niche(...)` (an entity-def tag) instead\n\n(The `ambush-loot.toml` worked example is from the retired Phandelver bundle, deleted in `fd2288bdea` — recover via `git show`, see `archive/README.md`; the rule still holds.)\n\n**Gotcha — `target.has_capability(...)` parses and seeds cleanly, then never\nderives an affordance.** `has_capability` is a subject-generic DSL primitive\n(`crates/spellkave-dsl/src/lib.rs`'s `parse_method_bool` admits any subject\nfor it), so `target.has_capability(\"my/thing\")` is syntactically valid — but\nthe world API's\n`manipulation_facts` (the function that builds the DSL evaluation context for\nevery candidate target) only ever inserts `DslSubjectRef::Actor` facts into\n`capabilities` — from the invoking actor's `actor_capabilities` grants and the\nActor arm of `item_definition_facts`. It inserts no `Target` capability\nfact, so in an **affordance predicate** `target.has_capability(...)` is\nalways `false`, silently — it validates, seeds, and never fires. (Other\nevaluation paths differ: reaction eligibility adds the target's folded\ncapabilities, the world API,\nand roll-bias condition gates add its raw `capability` rows,\n`selection/entity_facts.rs:83-110`; decision `sk-jay0.2.48`.) Author \"this target entity affords being acted on as an\nX\" the way `ambush-loot.toml`'s `gatherable_horses` niche already does: tag\nthe target's `entity_def_id` with an `entity_definition_tag` row and gate on\n`target.has_niche('<the tag string>')` — entity-def tags DO feed the `Target`\nniche facts `manipulation_facts` builds. Capabilities stay Actor-only by\ndesign (they answer \"can the ACTOR do X\", not \"does the TARGET afford X\").\n**Caught automatically since #1846:** `sk lint`'s\n`dead-target-capability` rule flags `target.has_capability(` in any\n`*predicate_source` field.\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
276
+ "tool-reference": "# Tool reference — AUTHOR surface\n\n<!-- GENERATED by scripts/generate-authoring-tool-reference.ts. Do not edit by hand. -->\n\nThis page is generated directly from `authorFacingToolDefinitions`\n(`packages/spellkave-tool-authoring/src/authoring.ts`) — the SAME TypeBox\nparameter schemas a host binds to `createAuthorFacingTools` and hands to an\nagent's tool-calling loop. Every name, required/optional flag, type, default,\nand description below is the tool's own runtime schema, not hand-copied prose:\nif a verb's parameters change, this page changes with it (the\n`authoring-tool-reference-drift` skgate registry gate fails the build otherwise). Every tool below that declares an offline-executable\nexample also carries a real, EXECUTED \"Example\" call + result — never\nhand-typed — run against a bespoke in-memory scratch workspace by this\ngenerator; a tool whose `run` requires a live connection instead carries an\nhonest \"requires an active connection\" marker.\nCorpus revision fields use `<packaged-corpus-revision>` here to avoid hashing a\npage containing its own digest; actual docs responses carry the current digest.\n\nFor a narrative walkthrough of the calling PATTERN (which verbs to call in\nwhat order, smart defaults, stage-then-commit), see\n[`getting-started-with-verbs.md`](./getting-started-with-verbs.md). For the\nunderlying TOML row shapes these verbs write, see\n[`manifest-format.md`](./manifest-format.md). For the PLAYER/DM tool surface —\na different audience, not served through `spellkave_docs` — see\n[the PLAYER tool reference](../../spellkave-tool-player/docs/tool-reference.md).\n\n## Tools, in registration order\n\n- [`spellkave_docs`](#spellkave_docs) — Modding Docs\n- [`spellkave_query`](#spellkave_query) — Query Manifest / Definitions\n- [`spellkave_eval`](#spellkave_eval) — Evaluate DSL Expression\n- [`spellkave_map_graph`](#spellkave_map_graph) — Map Graph\n- [`spellkave_declare_inexpressible`](#spellkave_declare_inexpressible) — Declare Inexpressible\n- [`spellkave_note_doc_gap`](#spellkave_note_doc_gap) — Note Doc Gap\n- [`spellkave_author_place`](#spellkave_author_place) — Author Place (verb PoC)\n- [`spellkave_link_places`](#spellkave_link_places) — Link Places\n- [`spellkave_bind_edge_affordance`](#spellkave_bind_edge_affordance) — Bind Edge Affordance\n- [`spellkave_set_movement_default`](#spellkave_set_movement_default) — Set Movement Default\n- [`spellkave_attach_map_layer`](#spellkave_attach_map_layer) — Attach Map Layer\n- [`spellkave_annotate_place`](#spellkave_annotate_place) — Annotate Place\n- [`spellkave_define_resource`](#spellkave_define_resource) — Define Resource (verb PoC)\n- [`spellkave_place_entity`](#spellkave_place_entity) — Place entity\n- [`spellkave_remove_entity`](#spellkave_remove_entity) — Remove Entity\n- [`spellkave_place_actor`](#spellkave_place_actor) — Place actor\n- [`spellkave_bind_actor`](#spellkave_bind_actor) — Bind Actor (verb)\n- [`spellkave_tag_entity`](#spellkave_tag_entity) — Tag Entity (verb)\n- [`spellkave_equip_item`](#spellkave_equip_item) — Equip Item (verb)\n- [`spellkave_stow_item`](#spellkave_stow_item) — Stow Item (verb)\n- [`spellkave_define_behavior`](#spellkave_define_behavior) — Define Behavior (verb PoC)\n- [`spellkave_define_entity_type`](#spellkave_define_entity_type) — Define Entity Type (verb)\n- [`spellkave_define_roll_table`](#spellkave_define_roll_table) — Define Roll Table (verb)\n- [`spellkave_define_condition`](#spellkave_define_condition) — Define Condition (verb)\n- [`spellkave_define_niche`](#spellkave_define_niche) — Define Niche (verb)\n- [`spellkave_define_affordance`](#spellkave_define_affordance) — Define Affordance (verb)\n- [`spellkave_define_capability`](#spellkave_define_capability) — Define Capability (verb)\n- [`spellkave_define_consequence`](#spellkave_define_consequence) — Define Consequence (verb)\n- [`spellkave_define_action`](#spellkave_define_action) — Define Action (verb)\n- [`spellkave_define_session`](#spellkave_define_session) — Define Session (verb)\n- [`spellkave_define_action_verb`](#spellkave_define_action_verb) — Define Action Verb (verb)\n- [`spellkave_define_bundle`](#spellkave_define_bundle) — Define Bundle (deliberate [[bundles]] header)\n- [`spellkave_define_trace_kind`](#spellkave_define_trace_kind) — Define Trace Kind (verb)\n- [`spellkave_set_metadata`](#spellkave_set_metadata) — Set Metadata\n- [`spellkave_write_rows`](#spellkave_write_rows) — Write Rows (generic escape hatch)\n- [`spellkave_apply_manifest_delta`](#spellkave_apply_manifest_delta) — Apply Manifest Delta\n- [`spellkave_export`](#spellkave_export) — Export Manifest\n- [`spellkave_diff`](#spellkave_diff) — Diff Manifests\n- [`spellkave_applyset_diff`](#spellkave_applyset_diff) — Diff Applyset\n- [`spellkave_applyset_apply`](#spellkave_applyset_apply) — Apply Applyset\n- [`spellkave_can_i`](#spellkave_can_i) — Can I\n- [`spellkave_explain`](#spellkave_explain) — Spellkave Explain\n- [`spellkave_get`](#spellkave_get) — Get\n- [`spellkave_describe`](#spellkave_describe) — Describe\n- [`spellkave_grant_role`](#spellkave_grant_role) — Grant role\n- [`spellkave_revoke_role`](#spellkave_revoke_role) — Revoke role\n- [`spellkave_list_grants`](#spellkave_list_grants) — List grants\n- [`spellkave_export_grants`](#spellkave_export_grants) — Export grants\n- [`spellkave_prepare_hand_over`](#spellkave_prepare_hand_over) — Prepare role handover\n- [`spellkave_hand_over_role`](#spellkave_hand_over_role) — Hand over role\n- [`spellkave_render_scene`](#spellkave_render_scene) — Render scene\n- [`spellkave_stage_scene`](#spellkave_stage_scene) — Stage scene\n\n## `spellkave_docs`\n\n**Modding Docs** — execution mode `parallel`.\n\nOrient on the packaged authoring corpus (DOCS-ONLY). Index (`shape: \"index\"`): id/title/kind/summary/has_example. Query (`shape: \"hits\"`): ranked summary+excerpt only (not full bodies). Doc (`shape: \"doc\"`): one id — oversized docs default to outline (headings); pass `section` for one heading or `full` for the entire body. Narrow hits with `doc_paths`; `limit` default 3. Reads ONLY the packaged corpus.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `doc` | no | string | | Exact corpus id (a `rel` from the index or a hit, e.g. 'dm-oversight') — returns that ONE doc whole: its prose body, the worked-example walkthrough when the id has both halves, and the complete example manifest TOML when `has_example` is true. This is how you get something copyable rather than only readable. Mutually exclusive with `query`; takes precedence if both are set. |\n| `doc_paths` | no | array<string> | | Optional corpus-id filter (substring match) restricting the search to specific packaged docs. Only applies with `query` set; can only narrow the corpus, never widen it. |\n| `full` | no | boolean | | With `doc`, force the complete body even when oversized (tool-reference, long references). Prefer `section` instead. Default false. |\n| `limit` | no | number | | Max number of doc slices to return when `query` is set (default 3). |\n| `outline` | no | boolean | | With `doc`, return title + summary + heading list only (no full body). Default for oversized docs when neither `section` nor `full` is set. |\n| `query` | no | string | | Free-text question about how to author something, e.g. 'how do I express object decay over time'. Matched (keyword/heading) against the packaged authoring corpus. Omit to list the bounded corpus index instead of querying it. |\n| `section` | no | string | | Optional heading text or anchor within `doc` — returns only that section's markdown instead of the full body. Unknown section fails (does not silently return the whole doc). Ignored without `doc`. |\n\n### Example\n\nCall:\n\n```json\n{}\n```\n\nResult:\n\n```json\n{\n \"shape\": \"index\",\n \"metadata\": {\n \"document_id\": \"index\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"index\": [\n {\n \"metadata\": {\n \"document_id\": \"onramp\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Start here\",\n \"rel\": \"onramp\",\n \"title\": \"Modding onramp\",\n \"kind\": \"guide\",\n \"summary\": \"Start-here: AUTHOR + PLAYER tools, with TOML as the underlying model — not a gotcha encyclopedia.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"action-economy\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"action-economy\",\n \"title\": \"Action economy: channels, boundaries, and fiction time\",\n \"kind\": \"guide\",\n \"summary\": \"Author fiction-ms channel pools, action costs, boundary refreshes, condition modifiers, and autonomy firing modes.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"authoring-process\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"authoring-process\",\n \"title\": \"Authoring process — shared agent contract\",\n \"kind\": \"guide\",\n \"summary\": \"The shared query-first, pre-check, proof-then-escalate process every authoring agent role builds on.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"behavior-composition\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"behavior-composition\",\n \"title\": \"Behavior composition — the ActorBehavior layer\",\n \"kind\": \"guide\",\n \"summary\": \"Turn one declarative ActorBehavior object into the full capability/outcome/affordance/action/consequence chain.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"can-i\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"can-i\",\n \"title\": \"Ask whether an actor may act\",\n \"kind\": \"guide\",\n \"summary\": \"Ask a running world whether one body may perform one action now, and which check decides.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"cli/workflows\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"cli/workflows\",\n \"title\": \"Installed CLI workflows\",\n \"kind\": \"guide\",\n \"summary\": \"Choose the authoring or player loop, inspect arguments, recover a refusal and prove a supported change using the installed CLI.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"containment-policies\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"containment-policies\",\n \"title\": \"Containment exposure and access\",\n \"kind\": \"guide\",\n \"summary\": \"Author definition defaults and instance overrides for perceived contents and removal access, preserving personal possession.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"damage-type-routing\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"damage-type-routing\",\n \"title\": \"Damage-type routing pattern\",\n \"kind\": \"guide\",\n \"summary\": \"Author typed damage via a delta_source DSL expression that reads target resistance/immunity tags.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"dm-oversight\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"dm-oversight\",\n \"title\": \"Defining a DM: region oversight (see-as extent)\",\n \"kind\": \"guide\",\n \"summary\": \"Bind a DM role to a principal through a separate presence body, with bounded read oversight and authorised handover.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"find-an-authoring-pattern\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"find-an-authoring-pattern\",\n \"title\": \"Find an authoring pattern without a checkout\",\n \"kind\": \"guide\",\n \"summary\": \"Search by task, retrieve a complete pattern and worked example, and distinguish source evidence from installed or hosted proof.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"getting-started-with-verbs\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"getting-started-with-verbs\",\n \"title\": \"Getting started with verbs\",\n \"kind\": \"guide\",\n \"summary\": \"AUTHOR verb deep-dive (4-call fireball) linked from onramp — not a rival start-here door.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"grants\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"grants\",\n \"title\": \"Granting and recovering runtime roles\",\n \"kind\": \"guide\",\n \"summary\": \"Delegate roles as the caller, inspect private bindings, expand a complete world snapshot and export/restore with explicit expiry recovery.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"hosted-authoring-workflow\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\",\n \"hosted-mcp\",\n \"web\"\n ],\n \"feature_prerequisites\": [],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"hosted-authoring-workflow\",\n \"title\": \"Author or run a session through hosted tools\",\n \"kind\": \"guide\",\n \"summary\": \"Retrieve public help, choose a caller-owned presence and use offered scoped portable tools without server files.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"lingering-hazard-zones\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"lingering-hazard-zones\",\n \"title\": \"Lingering hazard zones (caster-attributed pulses)\",\n \"kind\": \"guide\",\n \"summary\": \"Author a self-pulsing hazard zone (Cloudkill, Stinking Cloud) that damages occupants each round, then fades.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"long-running-actions\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"long-running-actions\",\n \"title\": \"Long-running actions, busy policy, and resumable progress\",\n \"kind\": \"guide\",\n \"summary\": \"Author actions with real in-world duration (rituals, crafting, rests): the §5.10 promotion threshold, busy allow/break predicates, authored expiry, and opt-in resumable progress.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"metadata-attachments\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"metadata-attachments\",\n \"title\": \"Metadata attachments\",\n \"kind\": \"guide\",\n \"summary\": \"Validated annotations (provenance, art, narration, persona) that are for humans/tools, never server behavior.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"parameterized-scenes\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"parameterized-scenes\",\n \"title\": \"Parameterized scene setup\",\n \"kind\": \"guide\",\n \"summary\": \"Preview a data package, explicitly stage separate graph and population phases, and inspect partial receipts and cleanup limits.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns\",\n \"title\": \"Patterns of Spellkave Manifest Authoring\",\n \"kind\": \"guide\",\n \"summary\": \"Problem-indexed pattern catalog (extra action, hazards, XP grants, dialog slots, …) — look here before filing a kernel gap.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/actor-carried-feature-verb\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/actor-carried-feature-verb\",\n \"title\": \"Actor-carried feature verb (a class feature the hero carries everywhere)\",\n \"kind\": \"guide\",\n \"summary\": \"A granted class feature (Second Wind, Rage, Channel Divinity) must be usable wherever the hero is — in the tomb, not only at the room where it was granted — and spend its own uses.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/advancement-choice\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/advancement-choice\",\n \"title\": \"Advancement choice menus (choose-N metadata)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a choose-N menu (fighting style, subclass, ASI-or-feat, expertise) that a DM dialogue can render without hardcoding the member list in TypeScript.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/advisory-action-cue\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/advisory-action-cue\",\n \"title\": \"Advisory action cue (rank and explain a visible action)\",\n \"kind\": \"guide\",\n \"summary\": \"Several actions can be factually visible at once. An author wants to make a natural next step easier to discover (for example, speaking to a person or taking a visible exit), but …\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/advisory-action-default\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/advisory-action-default\",\n \"title\": \"Advisory Action Default\",\n \"kind\": \"guide\",\n \"summary\": \"Advisory Action Default\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/before-filing-a-kernel-gap\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/before-filing-a-kernel-gap\",\n \"title\": \"Before filing a kernel gap\",\n \"kind\": \"guide\",\n \"summary\": \"Three lanes filed Action Surge as a kernel gap although `extra-action-budget` existed; two filed \\\"concentration needs damage facts\\\" although condition hooks existed. Canon-warden …\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/blueprint-instance-override\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/blueprint-instance-override\",\n \"title\": \"Blueprint instance with overrides (scenario spawn from a catalog definition)\",\n \"kind\": \"guide\",\n \"summary\": \"My scenario needs an NPC or encounter that \\\"is a Commoner\\\" / \\\"is a Goblin\\\" / \\\"is three wolves at the bridge\\\" — how do I place it without re-typing the stat block, and how do I cha…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/bundle-movement-default\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/bundle-movement-default\",\n \"title\": \"Bundle movement default (walking with zero per-edge rows)\",\n \"kind\": \"guide\",\n \"summary\": \"I want every edge in my bundle's place graphs to be walkable with the standard step policy and reach budget, without authoring a `place_edge_affordance` row on each edge.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/companion-combat\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/companion-combat\",\n \"title\": \"Companion combat seat\",\n \"kind\": \"guide\",\n \"summary\": \"A friendly companion should follow the hero out of combat, fight with a named combat role when a scene session opens, never target the hero, and optionally spend a healing consuma…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/companion-follow\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/companion-follow\",\n \"title\": \"Companion follow seat\",\n \"kind\": \"guide\",\n \"summary\": \"After a quest, an NPC should follow the hero along place-graph edges without a kernel pathfinding primitive.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/computed-literal\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/computed-literal\",\n \"title\": \"Computed-literal delta_source compositions\",\n \"kind\": \"guide\",\n \"summary\": \"I need to write a resource delta whose magnitude was computed outside the DSL (NPC host read another entity, TS chose N XP, etc.).\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/condition-grant-and-suppression\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/condition-grant-and-suppression\",\n \"title\": \"Condition capability grant and suppression\",\n \"kind\": \"guide\",\n \"summary\": \"While a condition holds I need to grant or remove an ability to act (a capability), not just a fact a predicate might forget to read.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/condition-hook-on-event\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/condition-hook-on-event\",\n \"title\": \"Condition hook on event (auto-resolving, per holder)\",\n \"kind\": \"guide\",\n \"summary\": \"\\\"While I am concentrating, any damage forces a CON save.\\\" \\\"While raging, the first hit each turn adds dice.\\\" \\\"When I would drop to 0 HP, drop to 1 instead.\\\" The rule must fire by …\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/consumable-inventory-consume\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/consumable-inventory-consume\",\n \"title\": \"Consumable inventory consume\",\n \"kind\": \"guide\",\n \"summary\": \"A stackable inventory item (potion, scroll dose) must apply its own effect to the carrier and remove one unit from the stack when used, and must fail cleanly when the carrier does…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/container-with-loot\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/container-with-loot\",\n \"title\": \"Container with loot\",\n \"kind\": \"guide\",\n \"summary\": \"A room needs a container (chest, cache, shelf) that visibly holds items a player can take, with no bespoke \\\"search\\\" or \\\"open\\\" action authored per adventure — reusing the SRD's own…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/cross-party-capability-gate\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/cross-party-capability-gate\",\n \"title\": \"Cross-party capability gate\",\n \"kind\": \"guide\",\n \"summary\": \"A condition on one creature must open or close based on a capability held by someone else in the same roll — the attacker has Darkvision, the attacker has See Invisibility, the ta…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/damage-type-routing\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/damage-type-routing\",\n \"title\": \"Damage-type routing via defense tags\",\n \"kind\": \"guide\",\n \"summary\": \"I need fire/cold/etc. damage that respects immunity, resistance, and vulnerability without a kernel damage subsystem.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/derived-value-mechanism\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/derived-value-mechanism\",\n \"title\": \"Derived value mechanism (macro vs baked stat vs effective vs literal)\",\n \"kind\": \"guide\",\n \"summary\": \"I have a number that is computed rather than stored (a proficiency bonus, an ability modifier, a DC) — which mechanism do I author it with, and where is each one illegal?\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/dialog-choice-slots\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/dialog-choice-slots\",\n \"title\": \"NPC dialog choice slots\",\n \"kind\": \"guide\",\n \"summary\": \"I need an NPC conversation with a small fixed set of answers (a menu, a quest accept/decline, a wizard step) without free text silently committing world state and without one affo…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/directed-speech-anchor\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/directed-speech-anchor\",\n \"title\": \"Directed speech anchor (anchor says WHERE, payload says TO WHOM)\",\n \"kind\": \"guide\",\n \"summary\": \"I need an NPC or player to say something to someone — broadcast to the room or directed at one body — so the right bodies perceive it and it does not follow anyone around.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/dm-applied-extent-grant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/dm-applied-extent-grant\",\n \"title\": \"Condition-derived extent (reach activated by an authored act)\",\n \"kind\": \"guide\",\n \"summary\": \"A gift or agreement should activate cross-graph reach at a story moment. Seeding that reach can disclose a remote companion's location and knowledge before the bond. The carried i…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/draft-then-confirm-wizard\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/draft-then-confirm-wizard\",\n \"title\": \"Draft-then-confirm wizard (multi-step form run by an NPC)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a guided character-creation or advancement form where choices remain a draft until confirmation admits the sheet and inventory changes. Explicit name and description adopti…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/equip-gated-modifier\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/equip-gated-modifier\",\n \"title\": \"Equip-gated modifier (numeric stat modifier active while item is equipped)\",\n \"kind\": \"guide\",\n \"summary\": \"An item (armor, shield, ring, magic item) provides a continuous numeric bonus or replacement (e.g. Armor Class, Speed, saving throw bonus) while equipped in a valid equipment slot…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/extra-action-budget\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/extra-action-budget\",\n \"title\": \"Extra action budget (one-shot channel grant)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a feature that gives the actor one extra action this round (Action Surge), without inventing a new kernel primitive.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/guided-dialogue\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/guided-dialogue\",\n \"title\": \"Guided dialogue (an NPC asks its questions in the order a data tree holds)\",\n \"kind\": \"guide\",\n \"summary\": \"I need an NPC that leads someone through several questions, where the order of the questions, which ones are skipped and which ones hang on an earlier answer are content I can cha…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/identity-tag-capability-grant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/identity-tag-capability-grant\",\n \"title\": \"Identity-tag capability grant\",\n \"kind\": \"guide\",\n \"summary\": \"Every creature should be able to walk, attack, dodge, rest and attempt checks — how do I grant that once instead of copying capability rows onto every definition, and when is a di…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/item-sourced-damage\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/item-sourced-damage\",\n \"title\": \"Item-sourced damage (weapon slot read by a shared attack)\",\n \"kind\": \"guide\",\n \"summary\": \"I need to give a weapon — manufactured or a monster's Bite/Slam — its own damage so ONE shared attack verb deals the right amount, without a bespoke action per weapon or per creat…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/kill-xp-grant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/kill-xp-grant\",\n \"title\": \"Kill-time XP grant\",\n \"kind\": \"guide\",\n \"summary\": \"When a creature dies I need the killer to receive that corpse's XP worth immediately — not when someone later takes a \\\"claim victory\\\" verb.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/lingering-hazard-zone\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/lingering-hazard-zone\",\n \"title\": \"Lingering hazard zone (self-pulsing)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a Cloudkill / burning-room hazard that damages whoever stands in it each round, then fades, without the player re-casting every turn.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/loot-table-drop\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/loot-table-drop\",\n \"title\": \"Loot table drop\",\n \"kind\": \"guide\",\n \"summary\": \"A quest terminal or boss kill should pay a treasure item drawn from SRD rarity/CR guidance — without smuggling free-text item names into `roll_table` (int-draw only) and without a…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/mastery-gated-attack-variant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/mastery-gated-attack-variant\",\n \"title\": \"Mastery-gated attack variant (stricter sibling of a shared attack)\",\n \"kind\": \"guide\",\n \"summary\": \"I need an on-hit rider (Weapon Mastery Sap/Vex, Sneak Attack dice, …) that cannot live inside the shared melee/ranged success consequence, because the shared write either (a) rebo…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/milestone-gate-terminal-flags\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/milestone-gate-terminal-flags\",\n \"title\": \"Milestone gate on prior terminal flags\",\n \"kind\": \"guide\",\n \"summary\": \"My advancement beat gates on flags a much larger prior beat already set — do I have to replay that whole beat?\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/multiattack-ordinals\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/multiattack-ordinals\",\n \"title\": \"Multiattack as baked ordinals\",\n \"kind\": \"guide\",\n \"summary\": \"I need a creature to make several attacks in one action (Multiattack), or an action whose numbers the shared attack archetype cannot host (flat damage, ability math that does not …\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/offer-gate-consume-guard-parity\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/offer-gate-consume-guard-parity\",\n \"title\": \"Offer gate / consume guard parity\",\n \"kind\": \"guide\",\n \"summary\": \"An authored action is offered behind a gate (a phase state, a tag, a predicate on the world) and consumed by code that re-checks whether the thing is really ready. Two lists, two …\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/offer-vs-resolution-roll\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/offer-vs-resolution-roll\",\n \"title\": \"Offer vs resolution roll (the d20 lives in act-time resolution)\",\n \"kind\": \"guide\",\n \"summary\": \"I need an attack or check that can miss: where does the d20 go so the verb is always offered when it is attemptable, and only the act decides hit or miss?\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/operable-door\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/operable-door\",\n \"title\": \"An operable door between two places\",\n \"kind\": \"guide\",\n \"summary\": \"A player should open and close a door from either side. A closed or locked door should refuse a step, while the usual movement budget still applies.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/party-extent-grant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/party-extent-grant\",\n \"title\": \"Party-extent grant (addressability across graphs as a privilege)\",\n \"kind\": \"guide\",\n \"summary\": \"My DM (or a bonded item) must address a party member who is on ANOTHER place graph — the inn hearth to the tomb crypt — and a bigger `range_m` does not work.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/post-commit-hit-reaction\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/post-commit-hit-reaction\",\n \"title\": \"Post-commit hit reaction (OA-shaped mitigate)\",\n \"kind\": \"guide\",\n \"summary\": \"A feature should fire as an off-turn reaction after another creature's manipulate commits against you (a counter-blow, a post-hit heal). Opportunity Attack already shows the off-t…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/proactive-level-up\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/proactive-level-up\",\n \"title\": \"Proactive level-up watch\",\n \"kind\": \"guide\",\n \"summary\": \"When the hero crosses the next XP threshold, the DM should call them over and offer the level-up — the player should not have to poll their own sheet.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/prompt-occurrence\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/prompt-occurrence\",\n \"title\": \"Dialogue prompt occurrence (which question is open, for whom)\",\n \"kind\": \"guide\",\n \"summary\": \"A speaker asks a closed question (\\\"Which class?\\\", \\\"Stand with me? 1: yes, 2: I must pass\\\"). The answers are ordinary authored actions the addressee could also fire for a totally d…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/quest-composition\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/quest-composition\",\n \"title\": \"Quest composition (giver slot + objective + terminal watch + reward)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a quest: an NPC offers it, the hero does something in the world, and when it is done the hero is rewarded — and there is no quest row kind.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/quest-xp-grant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/quest-xp-grant\",\n \"title\": \"Quest XP grant\",\n \"kind\": \"guide\",\n \"summary\": \"When a quest terminal fires I need to grant a fixed XP reward to the present party (not the killer).\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/resource-spend-with-option-menu\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/resource-spend-with-option-menu\",\n \"title\": \"Resource spend with option menu\",\n \"kind\": \"guide\",\n \"summary\": \"I have a shared pool (spell slots, Channel Divinity uses) and several effects that each spend one use — how do I author the pool once and branch the menu?\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/rest-boundary-resource-refill\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/rest-boundary-resource-refill\",\n \"title\": \"Rest-boundary resource refill\",\n \"kind\": \"guide\",\n \"summary\": \"Class features and spell slots declare `recovery_rule` (`long_rest`, `short_rest_partial_long_rest_full`, …) but that field is **documentary** — the kernel never scans it. Complet…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/role-driven-brain\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/role-driven-brain\",\n \"title\": \"Role-driven brain (fight behavior selected by an instance tag)\",\n \"kind\": \"guide\",\n \"summary\": \"I have many enemies in many encounters and need each to fight sensibly (archers keep range, brutes charge, leaders hang back) without writing a bespoke seat per creature.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/tag-membership-menu\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/tag-membership-menu\",\n \"title\": \"Tag-membership menu (derive lists from tags, tables from tag metadata)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a list (all fighting styles, all wizard spells of level 1, every skill) for a menu or a filter, or a finite reference table (ability-score meaning bands, DC bands) for auth…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/trace-perceptibility-window\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/trace-perceptibility-window\",\n \"title\": \"Trace perceptibility window (event vs standing mark)\",\n \"kind\": \"guide\",\n \"summary\": \"I need a perceivable thing that is either an event (heard only as it happens — speech) or a standing mark (a slime trail, a scorch — findable whenever someone walks in), or someth…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"patterns/watch-reader-manifest-closure\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"patterns/watch-reader-manifest-closure\",\n \"title\": \"Watch reader-manifest closure\",\n \"kind\": \"guide\",\n \"summary\": \"An NPC watch runs on one connection and declares that connection's tables once, in its own `subscribeReaders` call. Hosts then inject callbacks — \\\"who is the hero\\\", \\\"who is presen…\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"personas/access\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"personas/access\",\n \"title\": \"Choose guidance for your task and access\",\n \"kind\": \"guide\",\n \"summary\": \"Route author, DM, player, observer and operator tasks to package-owned guidance using the available access surface, without inferring authority.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"place-graph-occupancy\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"place-graph-occupancy\",\n \"title\": \"Intent — place graph + occupancy (who is where)\",\n \"kind\": \"guide\",\n \"summary\": \"Two-call playbook: map_graph for the picture, entities fields=preferred for names by place_node_id.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"playable-seats\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"playable-seats\",\n \"title\": \"Discovering playable seats\",\n \"kind\": \"guide\",\n \"summary\": \"Distinguish authored SRD seat offers from current live claimed/embodied state, with Explorer searches and the existing seat reader.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"player/workflows\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"player/workflows\",\n \"title\": \"Observe, attempt and recover through offered gameplay tools\",\n \"kind\": \"guide\",\n \"summary\": \"Orient a connected actor, use offered observation and attempt tools, then recover a refusal without guessing hidden targets or broader credentials.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"reading-a-world\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"reading-a-world\",\n \"title\": \"Reading a running world\",\n \"kind\": \"guide\",\n \"summary\": \"get and describe read admitted authored instances through publisher or role-scoped readers; inspect reads files; query reads definitions and the workspace.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"roles\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"roles\",\n \"title\": \"Roles as authored content\",\n \"kind\": \"guide\",\n \"summary\": \"Define and aggregate capability vocabulary, bind roles to principals through presences, and inspect composition and realised or inert bindings with explain.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"rule-bench\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"rule-bench\",\n \"title\": \"Offline rule evaluation bench (`spellkave_eval` / `sk eval`)\",\n \"kind\": \"guide\",\n \"summary\": \"Offline DSL expression and rule benching without a running node: facts shapes, chosen dice mechanics, traces, and resolution timing.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"spell-authoring-best-practices\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Guides\",\n \"rel\": \"spell-authoring-best-practices\",\n \"title\": \"Spell authoring best practices\",\n \"kind\": \"guide\",\n \"summary\": \"How to add a spell without hand-wiring a dozen rows or drifting into lint-flagged duplication.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"dsl-grammar\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"dsl-grammar\",\n \"title\": \"DSL grammar reference\",\n \"kind\": \"reference\",\n \"summary\": \"Generated operator reference for the predicate/outcome DSL used inside `_source` fields.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"fixture-correctness\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"fixture-correctness\",\n \"title\": \"Fixture correctness — the catalog\",\n \"kind\": \"reference\",\n \"summary\": \"The single source of truth for authoring a world-fixtures bundle correctly — every enforcer points here.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"index\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"index\",\n \"title\": \"Authoring docs — corpus index\",\n \"kind\": \"reference\",\n \"summary\": \"Generated index of every corpus doc, grouped by kind, with a one-line summary each (#1968 browsable docs).\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"interaction-dsl-and-world-authoring\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"interaction-dsl-and-world-authoring\",\n \"title\": \"Interaction model and world authoring\",\n \"kind\": \"reference\",\n \"summary\": \"The broader interaction model: entities, containment, affordances, niches, outcomes, conditions, target refs.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"manifest-format\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"manifest-format\",\n \"title\": \"Manifest format reference\",\n \"kind\": \"reference\",\n \"summary\": \"Generated TOML row/field reference for every manifest row kind, derived from the Rust schema crate.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"osm-mapping\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"osm-mapping\",\n \"title\": \"OSM mapping — how authored places become a map\",\n \"kind\": \"reference\",\n \"summary\": \"What to author (origin cell, sheet positions, portal edges, floors, extents, map layers) for a place to appear on the OSM-native world map, and the tags external OSM tools see (ADR-0123).\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"privileges\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"privileges\",\n \"title\": \"Privileges: who may do and see what\",\n \"kind\": \"reference\",\n \"summary\": \"Every authority gate compiled into the server: named capabilities, operator identity, and elevation grants.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"tool-reference\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Reference\",\n \"rel\": \"tool-reference\",\n \"title\": \"Tool reference — AUTHOR surface\",\n \"kind\": \"reference\",\n \"summary\": \"Generated schema reference for the AUTHOR verb registry (`authorFacingToolDefinitions` / `AUTHOR_TOOL_NAMES`), walked structurally from their own TypeBox parameters.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"actor-identity-bindings\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"actor-identity-bindings\",\n \"title\": \"Actor Identity Bindings\",\n \"kind\": \"repair\",\n \"summary\": \"[[actor_identities]] binds a SpacetimeDB login identity to an authored actor.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"actor-stat-self-only\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"actor-stat-self-only\",\n \"title\": \"`actor.stat(...)` and a self-eligible `ModifyResource`'s `TargetActor` only ever read/write the ACTING entity's own row — never a third party\",\n \"kind\": \"repair\",\n \"summary\": \"Gotcha — there is no cross-actor resource read/write shape. In an\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"adjacent-moves-ungated\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"adjacent-moves-ungated\",\n \"title\": \"`adjacentMoves()` lists raw graph geometry, not gated traversability; to prove an edge now rejects, attempt `.move()` and check the status\",\n \"kind\": \"repair\",\n \"summary\": \"listAdjacentMoves (packages/spellkave-sdk/src/core/movement.ts) iterates\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"affordance-needs-niche-attachment\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"affordance-needs-niche-attachment\",\n \"title\": \"An affordance `niche_id` needs a `spatial_niche_attachment` only when its niche is place-provided — pick the niche's `provider` deliberately\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — granting a capability via actor_capabilities does not, by\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"apply-status-claim-lock\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"apply-status-claim-lock\",\n \"title\": \"Any consequence containing `ApplyStatus` acquires a 10-tick claim-lock on its target — a second actor's manipulate against that same target can hit `claim_contended`\",\n \"kind\": \"repair\",\n \"summary\": \"r_manipulate classifies a resolved action's consequence as *steering-shaped*\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"authoring-observability\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"authoring-observability\",\n \"title\": \"Observability\",\n \"kind\": \"repair\",\n \"summary\": \"Observer knowledge is the canonical read surface for fog-of-war style\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"condition-capability-grant-and-suppression\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"condition-capability-grant-and-suppression\",\n \"title\": \"`grants_capability_while_active` grants a capability while a condition holds — and `suppresses_capability_while_active` takes one away\",\n \"kind\": \"repair\",\n \"summary\": \"Both fields on `[[condition_definitions]]` are lists of `capability_id`s, and\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"edge-traversal-resource-seed\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"edge-traversal-resource-seed\",\n \"title\": \"an edge-traversal affordance predicate reading a resource via `actor.stat(...)` needs that resource seeded on EVERY actor who might traverse the edge, and multiple `place_edge_affordance` rows on one `edge_key` AND-chain\",\n \"kind\": \"repair\",\n \"summary\": \"Two facts compound here. First, evaluate_edge_traversal_affordances\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"effective-condition-modifiers\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"effective-condition-modifiers\",\n \"title\": \"Numeric condition modifiers need explicit `effective(...)` consumers\",\n \"kind\": \"repair\",\n \"summary\": \"actor.stat(\\\"my/state\\\") and target.stat(\\\"my/state\\\") always read the authored\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"empty-predicate-source\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"empty-predicate-source\",\n \"title\": \"An empty `predicate_source` needs `predicate_bool = true`, or the affordance silently never resolves\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — predicate_bool is not a decorative default; it is the literal\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"equip-item-target-ref\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"equip-item-target-ref\",\n \"title\": \"Equipping items: target-ref prefix, ownership depth, and `core/drop`'s real scope\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — entity:<id> vs item:<id> target refs resolve through DIFFERENT\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"grid-anchor-forfeits-kill-zone\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"grid-anchor-forfeits-kill-zone\",\n \"title\": \"Placing an actor's manifest position on a session's grid ANCHOR node forfeits its authored kill-zone cell — it row-major-falls-back instead\",\n \"kind\": \"repair\",\n \"summary\": \"An actor's combat_grid_blueprint seat is normally snapped from its authored\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"has-item-dead-in-manipulate\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"has-item-dead-in-manipulate\",\n \"title\": \"`has_item` works inside a manipulate predicate — RETIRED gotcha, kept for readers of old manifests\",\n \"kind\": \"repair\",\n \"summary\": \"**This gotcha no longer applies.** Since bead sk-vjh.7,\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"hosted-world-observability\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"hosted-world-observability\",\n \"title\": \"Hosted-world observability for authors\",\n \"kind\": \"repair\",\n \"summary\": \"A hosted world's NPC cycles and tool outcomes are visible to the world\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"join-session-global-scope\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"join-session-global-scope\",\n \"title\": \"`JoinSession`/`LeaveSession` read a GLOBAL `turn_state.scope_session_id` — the acting entity does not need to be a participant, but the room-alarm gate it often pairs with is a `spatial_environment_state`, not an `object_state`\",\n \"kind\": \"repair\",\n \"summary\": \"A JoinSession { participant_ref: \\\"Actor\\\" } frame-write (mid-combat\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"leave-session-relocates\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"leave-session-relocates\",\n \"title\": \"`LeaveSession` always relocates the leaver off the tactical grid — it removes a participant from the turn order at the cost of taking the body out of the scene, so it is the wrong tool for a corpse\",\n \"kind\": \"repair\",\n \"summary\": \"Skip a body without removing it via turn_eligibility_pred; LeaveSession relocates the leaver\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"manipulate-ref-niche-attachment\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"manipulate-ref-niche-attachment\",\n \"title\": \"An item-scoped place niche needs a `spatial_niche_attachment` (or `provider = \\\"entity\\\"`), however the manipulate ref is built\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — the generic (entity:<id>/item:<id>) manipulate-target\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"manipulate-success-on-provenance\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"manipulate-success-on-provenance\",\n \"title\": \"`manipulate()`'s `successPredicate` has no fixed world-state signal for a stochastic (d20-driven) action — pass `successOnProvenance: true` on the client instead\",\n \"kind\": \"repair\",\n \"summary\": \"createActorClient(session, id, { successOnProvenance: true }) makes\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"mass-stand-down-apply-status\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"mass-stand-down-apply-status\",\n \"title\": \"Mass stand-down: `ForEachActorInRadius` + `ApplyStatus`, not per-entity writes\",\n \"kind\": \"repair\",\n \"summary\": \"A single deterministic act (e.g. an NPC leader calling off its allies) can\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"milestone-gate-terminal-flags\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"milestone-gate-terminal-flags\",\n \"title\": \"A milestone gate composing over a prior beat's terminal flags only needs the ONE action each flag's own predicate requires — not a full re-derivation of that beat\",\n \"kind\": \"repair\",\n \"summary\": \"A milestone/advancement beat that gates on flags a much larger prior beat\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"modify-resource-floored-noop\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"modify-resource-floored-noop\",\n \"title\": \"A `ModifyResource` against an already-floored resource is a silent no-op — use a dedicated counter to prove repeated harm\",\n \"kind\": \"repair\",\n \"summary\": \"Resources clamp at min_value (srd/hp's is 0). A consequence that deals\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"no-knowledge-seed-primitive\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"no-knowledge-seed-primitive\",\n \"title\": \"No manifest knowledge-seed primitive — OR-extend the reading predicate instead\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — the only manifest knowledge-writer is CopyKnowledgeRow\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"npc-needs-driver\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"npc-needs-driver\",\n \"title\": \"NPCs need a driver — there is no autonomous NPC behavior\",\n \"kind\": \"repair\",\n \"summary\": \"Spellkave's module has a hard rule: **it contains no actor decision\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"ordered-resource-grants\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"ordered-resource-grants\",\n \"title\": \"Ordered resource grants can read earlier frame writes\",\n \"kind\": \"repair\",\n \"summary\": \"consequence_frame_writes execute by ascending ordinal, and each\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"region-scale-geography\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"region-scale-geography\",\n \"title\": \"Region-scale geography: check the live place graph, not a stale brief\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — a beat brief's \\\"region nodes: ZERO\\\" open flank can go stale the\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"relocate-entity-ungated\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"relocate-entity-ungated\",\n \"title\": \"`RelocateEntity` is the un-gated, world-scoped forced-move leaf — no `place_edge` required, unlike `JoinSession`/`LeaveSession` it never touches a session\",\n \"kind\": \"repair\",\n \"summary\": \"A consequence that must move an actor somewhere it did NOT choose to walk\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"remove-item-deletes-stack\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"remove-item-deletes-stack\",\n \"title\": \"`RemoveItem` deletes a fully-consumed stack — it does not leave a zero-quantity row\",\n \"kind\": \"repair\",\n \"summary\": \"RemoveItem's quantity split (remove_item.rs::decide_quantity) has two\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"running-an-authored-act\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"running-an-authored-act\",\n \"title\": \"Running an authored act through r_manipulate\",\n \"kind\": \"repair\",\n \"summary\": \"Runbook of non-obvious requirements for an authored act to actually fire through r_manipulate, in bite order.\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"self-eligible-reaction-budget\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"self-eligible-reaction-budget\",\n \"title\": \"MF-VAL-263's budget requirement narrowed to self-eligible REACTIONS (2026-08-01, PR #2079) — a plain self-target action needs no `spends_channel` or `ModifyResource`\",\n \"kind\": \"repair\",\n \"summary\": \"The rule, as it stands today. self_eligible = true has two independent\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"sibling-resource-predicate-seeds\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"sibling-resource-predicate-seeds\",\n \"title\": \"Sibling resource pools each need their OWN predicate-safety seed\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — seeding one resource pool does NOT seed a sibling pool with the\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"target-has-capability-dead\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"target-has-capability-dead\",\n \"title\": \"`target.has_capability(...)` is dead — capability facts are Actor-only; gate a TARGET's kind via `target.has_niche(...)` (an entity-def tag) instead\",\n \"kind\": \"repair\",\n \"summary\": \"**Gotcha — target.has_capability(...) parses and seeds cleanly, then never\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"weapon-stricter-affordance-variant\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Troubleshooting\",\n \"rel\": \"weapon-stricter-affordance-variant\",\n \"title\": \"Opting ONE weapon copy into a stricter affordance variant without regressing its siblings\",\n \"kind\": \"repair\",\n \"summary\": \"Two entity_definitions can represent \\\"the same\\\" item (e.g. srd/item/shortbow\",\n \"has_example\": false\n },\n {\n \"metadata\": {\n \"document_id\": \"aoe-damage-spell\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"aoe-damage-spell\",\n \"title\": \"Area-of-effect damage spell\",\n \"kind\": \"example\",\n \"summary\": \"Add an area-of-effect blast that damages every co-located actor (ForEachActorInRadius + ModifyResource).\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"authored-dark-cave\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"authored-dark-cave\",\n \"title\": \"Author a dark cave passage\",\n \"kind\": \"example\",\n \"summary\": \"Seed ambient spatial state from TOML and make authored traversal and manipulation predicates read it.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"communicate-with-actor\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"communicate-with-actor\",\n \"title\": \"Communicate with a co-located actor\",\n \"kind\": \"example\",\n \"summary\": \"Add a co-located NPC that can be addressed with core communication.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"definition-seed-statblock\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"definition-seed-statblock\",\n \"title\": \"Statblock stats & innate capability on a definition\",\n \"kind\": \"example\",\n \"summary\": \"Give a creature definition its own HP and innate Multiattack so every spawned instance inherits them; also covers the definition-level containment/equipment seeds that spawn a fresh carried/equipped child instance.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"spatial-minimal-cell\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"spatial-minimal-cell\",\n \"title\": \"Minimal spatial cell\",\n \"kind\": \"example\",\n \"summary\": \"Add the smallest valid spatial cell with one graph and one node.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"spell-identity-minimal\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"spell-identity-minimal\",\n \"title\": \"Minimal single-identity spell\",\n \"kind\": \"example\",\n \"summary\": \"Author the clean, lint-clean end-state of a spell: one identity (capability_id == entity_def_id == required_capability), one cast action with no twin, taxonomy tags on the identity only.\",\n \"has_example\": true\n },\n {\n \"metadata\": {\n \"document_id\": \"weighted-int-roll-table\",\n \"corpus_revision\": \"<packaged-corpus-revision>\",\n \"content_status\": \"implemented\",\n \"supported_surfaces\": [\n \"cli\",\n \"local-mcp\"\n ],\n \"server_revision\": \"unknown\",\n \"compatibility\": \"unknown\"\n },\n \"topic\": \"Worked examples\",\n \"rel\": \"weighted-int-roll-table\",\n \"title\": \"Weighted int roll table\",\n \"kind\": \"example\",\n \"summary\": \"Add a weighted non-identity int roll_table for non-die DSL draws (not a smuggled dN).\",\n \"has_example\": true\n }\n ]\n}\n```\n\n## `spellkave_query`\n\n**Query Manifest / Definitions** — execution mode `parallel`.\n\nRead the authored world — merges the former spellkave_manifest_inspect + spellkave_lookup, plus the definition-lookup gap's missing single-row detail/ref-traversal capability, into ONE tool. Dispatch is inferred from which fields you pass (no mode flag): omit `kind` for a workspace/target summary (bundle ids + row-kind -> count map); pass `kind` alone (or with `pattern`) for a bounded catalog list (default ids-only; add fields:'preferred' or fields:[col,…] to project extra scalars — e.g. entities preferred yields name+place_node_id for who-is-where in one call); pass `kind` + `id` for the complete authored row, its source, and (by default) its outbound/inbound refs — chase a ref by re-calling this tool with its own {kind, id} (e.g. a capability -> its affordance_templates -> their action_definitions -> outcome_templates). Sources, in order: the workspace scratch manifest, plus the active connection-level `target` when wired, or the legacy live `context.db` when no target is configured (result.source says which). Offline with neither, this is workspace-only. `target` overrides the source for THIS call only (read-only — write verbs offer no such override).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | Restrict to rows stamped with this bundle_id (summary/list shapes only). |\n| `explore` | no | object | | Bounded admitted discovery. Summary inventories all three collections with coverage and per-kind counts (incomplete kinds are lower bounds). Instance summary/search count objects once by default; view rows preserves technical rows and explicit kind selects rows. Defaults to live; search collection follows kind, otherwise unrestricted text searches all collections and empty text defaults to places. An explicit collection must agree with kind. Explicit workspace/local source is never unioned. Follow exact returned references; no read grants write permission. |\n| `fields` | no | \"preferred\" \\\\| array<string> | | List shape only (`kind` without `id`; ignored for detail/summary/schema). Default (omit): token-safe catalog — each item is only `{ id, bundle_id? }`. `preferred`: project a small kind-specific field set (e.g. entities → name, place_node_id, kind, entity_def_id) so one list call can answer who-is-where without N detail round-trips. Explicit string[]: project exactly those column names from each row (unknown/missing names omitted; nested values skipped). `id` is always present; `bundle_id` is included when the row has it. |\n| `id` | no | string | | An exact natural-key value within `kind` — returns the complete authored row (detail shape), its source, and (by default) its refs. For a composite-keyed `*_tag` satellite kind, this is its ordered key fields' values joined by '::' (e.g. 'srd/wis::ability_score' for resource_definition_tag's `{resource_definition_id, tag}` — get the exact ids from a `kind`-only list call first). Mutually exclusive with `pattern`; requires `kind`. |\n| `kind` | no | string | | A manifest row-kind name (a ROW_KIND_NATURAL_KEY key — e.g. 'capability_definitions', 'affordance_templates', 'action_definitions', 'outcome_templates', 'entity_definitions', 'area_shape_definitions', 'resource_definitions'), the SAME vocabulary spellkave_write_rows and every define_* verb already use — not a closed enum. Also accepts a `*_tag` satellite kind (e.g. 'resource_definition_tag', 'capability_definition_tag') — these have a TWO-field composite key (parent id + tag) instead of a single natural key; see `schema: true` for the field order. Omit for a workspace/target summary (bundle ids + a row-kind -> count map) instead of listing one kind. |\n| `pattern` | no | string | | A substring filter on `kind`'s ids (its natural-key value, or its '::'-joined composite-key value for a `*_tag` satellite kind) — returns a filtered list instead of the full catalog. Mutually exclusive with `id`; requires `kind`. |\n| `refs` | no | \"none\" \\\\| \"outbound\" \\\\| \"both\" | | Detail shape only (`kind`+`id`; ignored otherwise). 'outbound': fields on this row pointing elsewhere (already-computed string-ref heuristic). 'both' additionally computes inbound_refs — every OTHER row anywhere in the resolved source whose own outbound ref points AT this row, grouped by referencing kind — so a caller traverses a chain (e.g. capability -> affordance -> action -> outcome) by re-calling spellkave_query with a ref's own {kind, id}, no separate traversal tool needed. Default: 'both' when `id` is set. |\n| `schema` | no | boolean | | Ask what a row of `kind` may CONTAIN instead of which rows exist : with `kind`, that row kind's required fields, field types, and natural/composite key; without `kind`, the row-kind vocabulary itself (every kind the manifest schema defines, flagged for whether this tool can also list its rows). Schema covers all 79 manifest row kinds — a superset of the ~53 `id`/`pattern` can address: the 40 with a single-column natural key, plus the `*_tag` satellite kinds and `tag_capability_grant` with a two-field composite key (finding ; sk-bwd). Ignores `id`/`pattern`/`bundle`/`target`: a row kind's shape is the same everywhere, so no source is consulted. |\n| `target` | no | \"workspace\" \\\\| \"local\" \\\\| \"live\" | | connection-level target override (READ-only — no write verb offers this): 'workspace' reads ONLY the workspace scratch manifest, ignoring any connection-level target/live db this call would otherwise consult. 'local' reads ONLY the active local folder target — errors if none is configured. 'live' reads ONLY the active live target (or the legacy live db when no target is wired at all) — errors if neither is available. Omit for the default union: workspace + whatever is configured (result.source says which). |\n\n#### `explore`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | |\n| `collection` | no | \"places\" \\\\| \"definitions\" \\\\| \"instances\" | | |\n| `cursor` | no | string | | |\n| `direction` | no | \"outbound\" \\\\| \"inbound\" | | |\n| `facets` | no | boolean | | Summary only: include definition counts by kind and detailed authored tag facets. Default false; the compact summary offers this as a follow-up. |\n| `field` | no | string | | |\n| `fields` | no | array<string> | | search/detail only: scalar names from the collection schema for search, or the selected row kind's schema for detail; `label` is also selectable. |\n| `kind` | no | string | | |\n| `limit` | no | integer | | Page size. Default 12 tag facets for summary, 5 for search (ranked: label equals, starts with, contains, then other text), 20 otherwise. |\n| `offset` | no | integer | | |\n| `operation` | yes | \"summary\" \\\\| \"search\" \\\\| \"detail\" \\\\| \"neighbors\" \\\\| \"references\" \\\\| \"field\" | | |\n| `ref` | no | object | | |\n| `source` | no | \"live\" \\\\| \"workspace\" \\\\| \"local\" | | |\n| `source_id` | no | string | | The `source.source_id` of the response that returned `ref`/`within`. Required with `ref` and `within`; another source, world or connection is refused. |\n| `tags` | no | array<string> | | Summary: count these literal tags separately on definitions and distinct objects. Search: require all tags. Tags are never inherited from definitions. |\n| `text` | no | string | | |\n| `view` | no | \"objects\" \\\\| \"rows\" | | Summary/search/neighbors only. Default objects: instance bodies once, without tag rows. Explicit kind selects rows. Use rows for the technical inventory. |\n| `within` | no | object | | |\n\n##### `explore.ref`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | |\n| `id` | yes | string | | |\n| `kind` | yes | string | | |\n\n##### `explore.within`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | |\n| `id` | yes | string | | |\n| `kind` | yes | string | | |\n\n### Example\n\nCall:\n\n```json\n{\n \"kind\": \"resource_definitions\",\n \"id\": \"aoe_blast/hp\"\n}\n```\n\nResult:\n\n```json\n{\n \"shape\": \"detail\",\n \"kind\": \"resource_definitions\",\n \"id\": \"aoe_blast/hp\",\n \"found\": true,\n \"source\": \"workspace\",\n \"row\": {\n \"resource_definition_id\": \"aoe_blast/hp\",\n \"bundle_id\": \"aoe_blast\",\n \"display_name\": \"Hit Points\",\n \"value_kind\": \"int\",\n \"min_value\": 0,\n \"max_value\": 30,\n \"recovery_rule\": \"long_rest\",\n \"initial_value\": 30\n },\n \"outbound_refs\": [],\n \"inbound_refs\": []\n}\n```\n\n## `spellkave_eval`\n\n**Evaluate DSL Expression** — execution mode `parallel`.\n\nEvaluate a Spellkave DSL expression offline using the wasm-compiled resolution evaluator. Accepts expression source, kind (predicate, int, or text), author-supplied facts grouped by subject or pool, and die faces in draw order. Returns the result value with its type, draws used, and evaluation trace, or a named rejection naming the cause.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `dice` | no | array<integer> | | Die faces in draw order consumed by stochastic roll operators and roll tables. |\n| `expression` | yes | string | | DSL source text to evaluate offline. |\n| `facts` | no | object | | The values the expression reads, grouped by subject (actor, target, location, session, world, actor.wielded_item, equipped items, bindings, event), plus roll_tables, item_sources, roll_modifier_bias, event_kind, occupants_at, peers_near_target, channel_pools. Validated strictly in Rust. |\n| `kind` | yes | \"predicate\" \\\\| \"int\" \\\\| \"text\" | | Expression result kind: 'predicate', 'int', or 'text'. |\n\n## `spellkave_map_graph`\n\n**Map Graph** — execution mode `parallel`.\n\nRender the authored place-graph as the shared spatial-graph view. Sources rows only through the same workspace/target/live resolution as spellkave_query (place_graphs, place_nodes, place_edges, actor_spatial_locations). output_type picks the ONE artifact computed and returned: 'svg' (default) — this tool's picture-first interactive use case: the raw SVG in details.svg plus an ImageContent PNG for hosts that render tool images (Pi TUI / Ghostty Kitty). 'utf8'/'ascii'/'braille' return that text variant in the like-named details field instead (no image). 'inventory' skips the graph picture entirely, details.inventory only. 'jpg' writes a backdrop-composed JPEG to output_dir/output_name and returns its path as details.jpg_path — no svg/ascii/utf8/braille text in the response.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `graph` | no | string | | Optional place_graph_id filter — when set, draw that graph (any substrate). Omit to compose every outdoor positioned graph (world map). |\n| `lod` | no | \"structure\" \\\\| \"furnished\" | | structure = rooms/routes only (no occupancy badges); furnished = + actor counts (default). |\n| `output_dir` | no | string | | output_type='jpg' only; ignored otherwise. Directory to write the map-art JPEG into — absolute, or RELATIVE to the host process's own cwd. Optional: omit for a fresh temp directory (mkdtemp). Resolves this graph's authored [[map_layers]] backdrop (unmasked — same drawn-in-full contract every backdrop render in this package follows), rasterizes via resvg then encodes via ffmpeg -q:v 4, skipping the rewrite when an unchanged render already sits there (deterministic churn guard). |\n| `output_name` | no | string | | output_type='jpg' only; ignored otherwise. Base filename (no extension) for the JPEG written under output_dir. Optional: omit for a name derived from graph, or 'map' when graph itself is also omitted (a world-compose call). |\n| `output_type` | no | \"utf8\" \\\\| \"ascii\" \\\\| \"braille\" \\\\| \"inventory\" \\\\| \"svg\" \\\\| \"jpg\" | | Which single artifact to render — the engine computes ONLY this one (bead sk-due: the old `terminal` param picked the text body while the engine rendered svg + utf8 + ascii + braille + inventory regardless, every call). 'svg' (default) — this tool's own interactive picture-first use case: the raw SVG in details.svg plus an ImageContent PNG for hosts that render tool images (Pi TUI / Ghostty Kitty). 'utf8'/'ascii'/'braille' return that text variant in the like-named details field instead (no image). 'inventory' skips the graph picture entirely, details.inventory only. 'jpg' writes a backdrop-composed JPEG to output_dir/output_name and returns its path as details.jpg_path — no svg/ascii/utf8/braille text in the response. |\n| `slice` | no | \"elevation_band\" \\\\| \"all_floors_offset\" \\\\| \"topology_only\" \\\\| \"metric\" \\\\| \"h3_world\" | | How to project multi-floor / unpositioned graphs: elevation_band (one floor), all_floors_offset (floors side-by-side), topology_only (adjacency layout), metric (all z in one plane), h3_world (outdoor multi-graph from cell_res10 — same plane idea as web WorldMapView). Omit for auto (indoor multi-z → elevation_band at z=0; outdoor compose uses h3 when cells present). |\n| `target` | no | \"workspace\" \\\\| \"local\" \\\\| \"live\" | | Same read-only source override as spellkave_query (`workspace` \\| `local` \\| `live`). Omit for the default workspace+configured-target union. |\n| `z` | no | number | | Elevation for slice=elevation_band (default 0). Matches pose_elevation. |\n| `z_tolerance` | no | number | | Half-width of elevation_band in elevation units (default 0.5). |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_declare_inexpressible`\n\n**Declare Inexpressible** — execution mode `sequential`.\n\nDeclare that no documented row kind / DSL form can express this intent within the validator's surface — a runtime/schema gap surfaced through authoring. A well-justified 'I cannot express this' is a SUCCESSFUL finding, not a failure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `reason` | yes | string | | Precisely why no documented row kind / DSL form can express this intent within the validator's surface. |\n\n### Example\n\nCall:\n\n```json\n{\n \"reason\": \"No documented row kind expresses a resource pool that regenerates on a delay after combat ends — every recovery_rule is a fixed enum (e.g. long_rest/short_rest), not a scheduled predicate.\"\n}\n```\n\nResult:\n\n```json\n{\n \"reason\": \"No documented row kind expresses a resource pool that regenerates on a delay after combat ends — every recovery_rule is a fixed enum (e.g. long_rest/short_rest), not a scheduled predicate.\"\n}\n```\n\n## `spellkave_note_doc_gap`\n\n**Note Doc Gap** — execution mode `sequential`.\n\nRecord a discrepancy between what the modding docs implied and what the validator actually accepted. Does NOT end your run — keep authoring. Sharpens the docs shipped to other authors.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `actual` | yes | string | | What the validator actually did — the discrepancy. |\n| `doc` | yes | string | | Which corpus doc id you were working from, e.g. 'dsl-grammar'. |\n| `expected` | yes | string | | What the doc led you to expect. |\n\n### Example\n\nCall:\n\n```json\n{\n \"doc\": \"manifest-format\",\n \"expected\": \"resource_definitions.recovery_rule accepts an arbitrary string.\",\n \"actual\": \"The validator rejects any recovery_rule outside the documented closed set.\"\n}\n```\n\nResult:\n\n```json\n{\n \"doc\": \"manifest-format\",\n \"expected\": \"resource_definitions.recovery_rule accepts an arbitrary string.\",\n \"actual\": \"The validator rejects any recovery_rule outside the documented closed set.\"\n}\n```\n\n## `spellkave_author_place`\n\n**Author Place (verb PoC)** — execution mode `sequential`.\n\nPoC : author ONE place_graph + its place_nodes (+ optional place_edges) in a single call, wrapping the existing patchManifest place ops. Self-scaffolds the `[[bundles]]` header if `bundle` has none yet (FIX②b). Nodes get metric positions (explicit x/y or auto circle/line) and optional elevation. substrate defaults to outdoor; pass substrate:'indoor' for buildings. PoC boundary: one place_graph per call. map_graph draws outdoor world-compose by default; pass graph=<id> to draw an indoor plan. Top-level `description` sets the GRAPH's own description; each `nodes[].description` sets that ONE node's own arrival prose instead (T5 follow-up) — author both when a node deserves its own sensory detail beyond the graph-level blurb.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bearing` | no | number | | Clockwise rotation degrees relative to parent/world frame (ADR-0029). Default 0. |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | Sets the generated place_graph's own `description` column (— a first-class, never load-bearing authoring field, not a metadata_attachments row). |\n| `display_name` | no | string | | place_graph display_name; default title-cased graph local id. |\n| `edges` | yes | array<array<string>> | | [from_node_id, to_node_id] pairs; both ends must be in `nodes`. Pass [] for disconnected nodes (e.g. two same-radius cells with no traversal edge between them, as the worked example does). |\n| `metres_per_unit` | no | number | | Graph unit → metres (ADR-0029). Default 1. Outdoor world maps often use >1. |\n| `nodes` | yes | array<object> | | One or more place nodes. Every id must share ONE common parent path (one place_graph per call — a PoC boundary); the FIRST node becomes the place_graph's anchor_node_id. |\n| `origin_cell_res10` | no | string | | Root outdoor H3 res10 anchor as decimal u64 string. Only composition roots should set this; res7/res4 parents are derived. Nested graphs omit (origin stays 0). |\n| `parent_graph_id` | no | string | | Composition parent place_graph_id (ADR-0029 / Item 25). Empty/omit = root. Nested outdoor graphs project into the parent frame on the world map. |\n| `substrate` | no | string | | substrate_id for the graph and every node (core: outdoor \\| indoor \\| tactical). Default 'outdoor'. Houses/interiors should use 'indoor'. |\n\n#### `nodes[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `cell_res10` | no | string | | Optional outdoor H3 res10 cell as decimal u64 string (parents res7/res4 derived via h3-js). Prefer strings so values above MAX_SAFE_INTEGER stay exact. |\n| `description` | no | string | | Sets THIS node's own `place_nodes.description` column (T5 follow-up, pattern: a first-class field, never a metadata_attachments detour — same shape as the top-level `description` param below, which sets the GRAPH's own description instead). Read by movement-observation tools (e.g. spellkave_move) as the arrival prose for THIS node; falls back to the graph's own description only on a graph-crossing move when omitted. |\n| `elevation` | no | number | | Optional graph-local pose_elevation (metres-ish via graph metres_per_unit). Use for floors/cellars (e.g. 0 ground, -3 cellar). Omit for 0 with pose_elevation_present=true. |\n| `extent_params_json` | no | string | | place_nodes.extent_params_json — the params_json paired with `extent_shape_id` (e.g. '{\"radius_m\": 2.5}' for core/area/sphere). Only meaningful alongside `extent_shape_id`. |\n| `extent_shape_id` | no | string | | place_nodes.extent_shape_id (place-node-extent D-2, sk-71u): an explicit spatial extent for THIS node — one of the KNOWN_AREA_SHAPE_IDS kernel shapes (e.g. 'core/area/sphere', 'core/area/cube'). Overrides the bundle's own default_extent_shape_id (spellkave_define_bundle) for this node only. Pair with `extent_params_json`; omit both to fall back to the bundle default. |\n| `id` | yes | string | | Fully-qualified place-node id '<place_graph_id>/<local_id>' (e.g. 'aoe_blast/arena/center'). PoC boundary: bare local ids are not supported. |\n| `name` | no | string | | display_name; defaults to a title-cased local id. |\n| `x` | no | number | | Optional metric graph-local pos_x (integer graph units). When any node omits x/y, author_place auto-layouts all nodes on a circle (n>=3) or a line (n=1..2). |\n| `y` | no | number | | Optional metric graph-local pos_y (integer graph units). See `x`. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"nodes\": [\n {\n \"id\": \"aoe_blast/arena/center\",\n \"name\": \"Arena Center\"\n },\n {\n \"id\": \"aoe_blast/arena/fringe\",\n \"name\": \"Arena Fringe\"\n }\n ],\n \"edges\": [],\n \"description\": \"Blast arena: center holds the caster + targets, fringe proves the radius-0 boundary.\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 4,\n \"diagnostics\": [],\n \"place_graph_id\": \"aoe_blast/arena\",\n \"layout\": [\n \"aoe_blast/arena/center \\\"Arena Center\\\" @ (0, 0, z=0)\",\n \"aoe_blast/arena/fringe \\\"Arena Fringe\\\" @ (10, 0, z=0)\"\n ],\n \"edges\": []\n}\n```\n\n## `spellkave_link_places`\n\n**Link Places** — execution mode `sequential`.\n\nAuthor a portal between two existing place_nodes (same graph or cross-graph). Writes place_edges with place_graph_id \"\" when graphs differ (Stonehill pattern), sets substrate_crossing automatically for outdoor↔indoor. Does NOT attach a place_edge_affordance by default (ADR-0101): an ordinary edge just inherits the bundle/graph movement_default (spellkave_set_movement_default) via place_edges.inherit_movement_default, which defaults to true — zero per-edge rows for ordinary walking. Pass portal:true (+ affordance_template_id / bindings_json) only for a special affordance you want attached to THIS edge at creation time; spellkave_bind_edge_affordance is the preferred (FK-validated) path for that, including after the edge already exists. Use after spellkave_author_place on both sides.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `affordance_template_id` | no | string | | place_edge_affordance.affordance_template_id when portal is true (portal defaults to false — see that field). Default \"core/affordance/traverse_open_portal\" when portal is true and this is omitted. Self-sufficient packs pass e.g. \"srd/affordance/step\". |\n| `bidirectional` | no | boolean | | Author reverse edge too (default true). |\n| `bindings_json` | no | string | | place_edge_affordance.bindings_json when portal is true (default \"\"). e.g. '{\"movement_reach_resource\":\"srd/speed-walk\",\"long_running_move_session\":\"srd/long_running_move\"}' for srd Step. |\n| `bundle` | no | string | | bundle_id stamped on generated edges. Omit to fall back to `context.defaultBundle`. |\n| `cell_anchor` | no | string | | H3 res10 cell anchor as decimal u64 string for substrate_crossing edges (MF-VAL-102). Omit to use dummy 1 (legacy); outdoor portals should pass a real cell. |\n| `description` | no | string | | Optional edge description. |\n| `door` | no | boolean | | If true, attach metadata namespace place.door on each edge_key (inert; locks later). |\n| `from` | yes | string | | Fully-qualified place_node id (must already exist in workspace/target). |\n| `portal` | no | boolean | | Attach a place_edge_affordance on each edge (default FALSE, ADR-0101 — ordinary edges inherit the bundle/graph movement_default instead, no per-edge row needed). Pass true only to attach a special affordance right at creation time; template defaults to core/affordance/traverse_open_portal unless affordance_template_id is set. |\n| `substrate_crossing` | no | boolean | | Force substrate_crossing. Omit to auto: true when the two nodes' substrates differ, or when they belong to different place_graphs (cross-graph portal). |\n| `to` | yes | string | | Fully-qualified place_node id (must already exist in workspace/target). |\n\n## `spellkave_bind_edge_affordance`\n\n**Bind Edge Affordance** — execution mode `sequential`.\n\nAttach a place_edge_affordance to an edge that ALREADY exists (author it first via spellkave_link_places / spellkave_author_place) — closes the write_rows-only gap where a raw place_edge_affordance write validated nothing against edge_key (sk-9ll.2). Derives edge_key(s) exactly as spellkave_link_places does (from->to), validates the edge AND the affordance_template_id both already resolve (workspace, live, or the active target), then upserts by (edge_key, affordance_template_id, mode_id) — re-authoring the SAME triple REPLACES bindings_json rather than duplicating (mirrors the Rust add-place-edge-affordance patch op; ADR-0101 widened the key with mode_id). Optionally also REPLACES the edge's own inherit_movement_default flag (requires the edge already authored in THIS workspace).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `affordance_template_id` | yes | string | | place_edge_affordance.affordance_template_id — must already resolve to an authored affordance_templates row (workspace, live, or the active target); this call does not auto-create it. |\n| `bidirectional` | no | boolean | | Attach to both from->to and to->from edges (default true) — mirrors spellkave_link_places' own default. Both edges must already exist when true. Pass false to bind only the from->to direction. |\n| `bindings_json` | no | string | | place_edge_affordance.bindings_json (default \"\"). e.g. '{\"movement_reach_resource\":\"srd/speed-walk\"}' for srd Step. |\n| `from` | yes | string | | place_edges.from_node_id of an edge that ALREADY exists (workspace, live, or the active target) — this call never creates one. Author it first via spellkave_link_places / spellkave_author_place. |\n| `inherit_movement_default` | no | boolean | | place_edges.inherit_movement_default (ADR-0101 D-1, schema default true) — REPLACES the flag on every already-existing edge this call targets (from->to, and to->from too when bidirectional). false means the edge owns its FULL mode set from its own place_edge_affordance rows alone (the fly-only-chasm idiom); true (or omitting this param) leaves/restores the resolved bundle/graph movement_default in play. Requires the edge to already be an authored [[place_edges]] row IN THIS WORKSPACE (not just live/target) — this is a whole-row re-author under the hood, so it needs the edge's other columns already in hand to avoid silently dropping them. |\n| `mode_id` | no | string | | place_edge_affordance.mode_id (ADR-0101 D-1, default \"\" — the implicit default mode). An open author-chosen id (e.g. \"fly\", \"swim\") — rows sharing one (edge_key, mode_id) AND-join (all must pass); distinct mode_ids on the SAME edge OR (the cheapest passing mode charges and supplies the long-running-move session). Upserts by (edge_key, affordance_template_id, mode_id) — the SAME template under two different mode_ids on one edge is a sibling row, not a replace. |\n| `to` | yes | string | | place_edges.to_node_id of the same already-existing edge. |\n\n## `spellkave_set_movement_default`\n\n**Set Movement Default** — execution mode `sequential`.\n\nAuthor a bundle- or graph-scoped default traversal mode (ADR-0101) — the primitive that makes ordinary walking need ZERO per-edge place_edge_affordance rows (A-1). Validates affordance_template_id (and place_graph_id, when given) both already resolve, then upserts by (bundle_id, place_graph_id, mode_id, affordance_template_id) — re-authoring the SAME scope+mode+template REPLACES bindings_json; a second template in the same scope+mode is a sibling row (AND-join); a distinct mode_id is a third alternative (OR, cheapest-mode charges).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `affordance_template_id` | yes | string | | movement_defaults.affordance_template_id — must already resolve to an authored affordance_templates row (workspace, live, or the active target); this call does not auto-create it. |\n| `bindings_json` | no | string | | movement_defaults.bindings_json (default \"\"). e.g. '{\"movement_reach_resource\":\"srd/speed-walk\",\"long_running_move_session\":\"srd/long_running_move\"}' for srd Step. |\n| `bundle` | no | string | | movement_defaults.bundle_id. Omit to fall back to `context.defaultBundle`. ALWAYS the scope owner, even when place_graph_id narrows the row to one graph. |\n| `mode_id` | no | string | | movement_defaults.mode_id (default \"\" — the implicit default mode, same open author-chosen vocabulary as spellkave_bind_edge_affordance's mode_id, e.g. \"fly\"). Rows sharing one (scope, mode_id) AND-join; a distinct mode_id under the same scope is an alternative the kernel OR-picks the cheapest passing one from. |\n| `place_graph_id` | no | string | | movement_defaults.place_graph_id (default \"\" — bundle scope, applies to every edge in the bundle with no closer graph default). Set to scope this default to ONE place_graph instead (must already exist in workspace/live/target) — a graph-scoped default beats a bundle-scoped one for edges in that graph (D-2: edge > graph > bundle). |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_attach_map_layer`\n\n**Attach Map Layer** — execution mode `sequential`.\n\nAuthor a [[map_layers]] backdrop pointer for a place_graph (Phandelver parity). Does NOT vendor the image — asset_path resolves at map_graph time via CCC3_MAPS_ROOT or FVTT_DATA_ROOT. Optionally stamps provenance metadata on the graph. When the file is present, image_width/height are filled from PNG IHDR if unset.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `asset_module` | no | string | | Asset root module id (default \"ccc3-maps\"). Also resolves FVTT_DATA_ROOT/<module>. |\n| `asset_path` | yes | string | | Relative path under asset root, e.g. \"maps/306 Fortified Hamlet.jpg\" for ccc3-maps. |\n| `bundle` | no | string | | |\n| `display_name` | no | string | | |\n| `grid_distance_m` | no | number | | |\n| `grid_size_px` | no | number | | |\n| `image_height_px` | no | number | | |\n| `image_origin_x` | no | number | | |\n| `image_origin_y` | no | number | | |\n| `image_width_px` | no | number | | |\n| `license_url` | no | string | | |\n| `local_height_cells` | no | number | | |\n| `local_width_cells` | no | number | | |\n| `map_id` | no | string | | Catalog map id for provenance payload. |\n| `map_layer_id` | no | string | | Defaults to <place_graph_id>/backdrop. |\n| `place_graph_id` | yes | string | | place_graph this backdrop belongs to. |\n| `posture` | no | string | | License posture stamp (default \"cc-by-4.0\" for ccc3). |\n| `provenance` | no | boolean | | |\n| `rotation_deg` | no | number | | |\n| `source_kind` | no | string | | Default \"elven-tower-ccc\". |\n| `source_url` | no | string | | |\n| `state` | no | string | | aligned \\| provisional \\| unmatched \\| template (default \"template\"). |\n\n## `spellkave_annotate_place`\n\n**Annotate Place** — execution mode `sequential`.\n\nAttach inert metadata (terrain.hint / custom) to a place_graph, place_node, or place_edge, and/or stamp demo H3 origin cells on a graph. Does not create playable niches yet — tags are the authoring vocabulary for later niche wiring (E prep).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | |\n| `h3_origin_res10` | no | number | | When target_kind=place_graph, stamp origin_cell_res10 (and anchor node cell_res10 if anchor known). Must be within Number.MAX_SAFE_INTEGER. Real H3 encoding later. |\n| `namespace` | no | string | | Override namespace (default terrain.hint when terrain set, else \"place.note\"). |\n| `payload` | no | object | | |\n| `target_kind` | yes | \"place_graph\" \\\\| \"place_node\" \\\\| \"place_edge\" | | What the annotation attaches to. |\n| `target_ref` | yes | string | | place_graph_id / node_id / edge_key. |\n| `terrain` | no | array<string> | | Tags e.g. [\"road\",\"difficult\",\"hazard_slime\"] → namespace terrain.hint |\n\n## `spellkave_define_resource`\n\n**Define Resource (verb PoC)** — execution mode `sequential`.\n\nPoC (FIX②): author ONE resource_definitions row (a spell-slot/HP/charge-style pool) + its resource_definition_tag satellites (verb-UX round 2) in a single call — the scaffolding step placement-tool `resources` seeds and spellkave_define_behavior's `effect.write.resource`/`cost.pool` both need to already resolve against (neither verb fabricates bounds for a pool it didn't create). Self-scaffolds the `[[bundles]]` header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + EVERY tag satellite wholesale (fewer tags on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on the generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | Sets the generated resource_definitions row's own `description` column . |\n| `display_name` | no | string | | resource_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | Local resource stem; the full resource_definition_id is '<bundle>/<id>' (e.g. bundle='aoe_blast', id='hp' -> 'aoe_blast/hp'). |\n| `initial_value` | no | number | | resource_definitions.initial_value — the object_state seed for an un-instantiated pool. Omit to fall back to min_value at runtime (a charges/gold-shaped pool); set e.g. to max_value for an HP-shaped pool that must start full. |\n| `max_value` | yes | number | | resource_definitions.max_value. |\n| `min_value` | yes | number | | resource_definitions.min_value. |\n| `recovery_rule` | no | \"none\" \\\\| \"persistent\" \\\\| \"long_rest\" \\\\| \"short_rest_partial_long_rest_full\" | | resource_definitions.recovery_rule (default 'none'). Closed PoC enum over the corpus's own observed vocabulary — the field itself is open-string at the schema level (ADR-0018). |\n| `tags` | no | array<string> | | One resource_definition_tag row per tag (verb-UX round 2 — mirrors spellkave_define_entity_type/_condition/_niche's own `tags` fold instead of a separate spellkave_write_rows call). |\n| `value_kind` | no | string | | resource_definitions.value_kind (default 'int' — the only value observed corpus-wide). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"hp\",\n \"display_name\": \"Hit Points\",\n \"min_value\": 0,\n \"max_value\": 30,\n \"recovery_rule\": \"long_rest\",\n \"initial_value\": 30\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [],\n \"resource_definition_id\": \"aoe_blast/hp\"\n}\n```\n\n## `spellkave_place_entity`\n\n**Place entity** — execution mode `sequential`.\n\nDeclaratively place authored world instances at build time. Emits an entity (+ optional object_state) without actor rows; use it for authored instances that are not steerable actors. Place them all at ONE node with the flat `at`/`count`/`resources`/`tags`, or split them across MULTIPLE nodes in the SAME call with `placements`; the two shapes are mutually exclusive. Self-scaffolds the `[[bundles]]` header if `bundle` has none yet (FIX②b). `kind` is explicit; optional `entity_def` is a separate fully-qualified catalog reference. Resolves `entity_def`/every `at` against the workspace, the active connection-level `target` when wired , and (legacy) live world when `context.db` is set directly — fails loudly on a dangling ref rather than authoring a broken instance. Returns the generated `entity_keys` (in placement order) for a later spellkave_define_behavior `grant_to`. workspace idempotency: pass `key_prefix` (flat shape) / `placements[].key_prefix` (placements shape) to give a placement an EXPLICIT, reproducible identity — a re-run with the SAME key_prefix upserts its owned rows. Anonymous placements are ADDITIVE — every call adds genuinely NEW instances, named '<bundle>/<short entity_def slug>_<n>' by default (falling back to the fully-qualified slug only on a short-slug collision across different entity_defs, addendum); name placements for idempotent scripts. sk-9ll.6: pass `entity_key` (flat) / `placements[].entity_key` (placements shape) instead of `key_prefix` for an explicit, LITERAL key with NO ordinal minted at all (e.g. a fixture-mandated 'bundle/hero') — mutually exclusive with `key_prefix`, only legal for a single instance. sk-9ll.7: pass `tags` (flat) / `placements[].tags` (placements shape) for INSTANCE-level `entity_tag` rows seeded on every instance in that shape — clear-and-reseed idempotent exactly like `resources` (a re-run with FEWER tags drops the stale ones). Tag-grammar membership (MF-VAL-300) is enforced by the shared validator at commit, not re-validated here; when a tag carries an authored tag_capability_grant, the result's `tag_capability_grants` reports the capability it live-grants (informational, never blocking). sk-ntz.1: pass `name` (flat) / `placements[].name` (placements shape) for a VERBATIM `entities.name`/`actors.name` override (no ordinal suffix appended) instead of the default title-cased `kind`/`entity_def` naming — the per-placement value wins when both flat `name` and a placement's own `name` are set. Pass `quantity` (flat) / `placements[].quantity` (placements shape) for an explicit `entities.quantity` (stack size) override instead of the schema default (1) — spellkave_place_entity ONLY; spellkave_place_actor rejects a set `quantity` outright (actors carry no stack) — the per-placement value wins here too. This authors manifest rows; runtime creation belongs to future DM spawn tools.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `at` | no | string | | FLAT single-location shape: an already-authored place_node id every instance is placed at. Mutually exclusive with `placements` (FIX①) — set `at` (+ `count`/`resources`) for ONE location, or `placements` to split a batch across MULTIPLE locations in one call, never both. |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `count` | no | number | | FLAT shape only: how many identical instances to place (default 1). |\n| `description` | no | string | | Sets EVERY placed entity's own `description` column (across every placement) — e.g. 'the guard with the limp' (— a first-class, never load-bearing authoring field, not a metadata_attachments row). |\n| `entity_def` | no | string | | Optional fully-qualified catalog entity_def_id (contains '/', e.g. 'srd/monster/goblin') that must already resolve in the workspace or live world. `kind` remains explicit and independent. |\n| `entity_key` | no | string | | FLAT shape only (mutually exclusive with `placements` — set `placements[].entity_key` there instead). sk-9ll.6: see `placements[].entity_key`'s description for the full semantics — this is the same field, for the single-location flat shape. |\n| `key_prefix` | no | string | | FLAT shape only (mutually exclusive with `placements` — set `placements[].key_prefix` there instead). workspace idempotency: see `placements[].key_prefix`'s description for the full semantics — this is the same field, for the single-location flat shape. Mutually exclusive with `entity_key`. |\n| `kind` | yes | \"player\" \\\\| \"npc\" \\\\| \"item\" \\\\| \"place\" | | Manifest entity kind accepted by the current authoritative schema. The placement tool controls whether actor steering rows exist; `kind` does not. The open-vocabulary migration is tracked by. |\n| `name` | no | string | | sk-ntz.1: FLAT shape (also `placements[].name`, which wins when both are set): sets EVERY placed entity's own `entities.name`/`actors.name` verbatim (no ordinal suffix), instead of the default title-cased `kind`/`entity_def` naming. A first-class, never load-bearing authoring field, mirrors `description`'s own shared-across-every-placement convention. Mutually exclusive with `name_prefix`. Omit for the existing default — unchanged. |\n| `name_prefix` | no | string | | sk-jay0.7.15.3: FLAT shape (also `placements[].name_prefix`, which wins when both are set): replaces only the title-cased `kind`/`entity_def` half of the derived name and KEEPS the ordinal (`'<name_prefix> <n>'`) across every placed instance. The group-placement counterpart to verbatim `name`. Mutually exclusive with `name`. Illegal with `entity_key`. Omit for the existing default — unchanged. |\n| `placements` | no | array<object> | | MULTI-LOCATION shape (FIX①): one or more {at, count?, resources?, tags?} groups placing the SAME kind/entity_def split across DIFFERENT place_nodes in a single call (e.g. 3 targets at the blast center + 1 bystander at the fringe). Mutually exclusive with the flat `at`/`count`/`resources`/`tags` — set ONE shape or the other, never both. |\n| `quantity` | no | integer | | sk-ntz.1: FLAT shape (also `placements[].quantity`, which wins when both are set): sets EVERY placed entity's own `entities.quantity` (stack size) — spellkave_place_entity ONLY; spellkave_place_actor rejects a set `quantity` (actors carry no stack — use spellkave_place_entity for a stackable item instance instead). Omit for the schema default (1) — unchanged. |\n| `resources` | no | array<object> | | FLAT shape only: per-instance object_state overrides seeded on EVERY placed entity in this call (e.g. a non-default starting pool value). Does NOT declare the resource_definitions row itself (use spellkave_define_resource first). |\n| `tags` | no | array<string> | | One INSTANCE-level entity_tag row per tag ('this goblin is the leader / faction X') — NOT an entity_definition_tag. Tag-grammar membership (MF-VAL-300) and dedup are enforced by the shared validator at commit; an unknown-grammar tag is reported as a diagnostic, not persisted. When a tag has authored tag_capability_grant rows (workspace/live), the result surfaces 'tag X grants capability Y' so the author sees the consequence — informational, never blocking. |\n\n#### `placements[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `at` | yes | string | | An already-authored place_node id (e.g. from spellkave_author_place) every instance in THIS placement is placed at. |\n| `count` | no | number | | How many identical instances at this placement (default 1). |\n| `entity_key` | no | string | | sk-9ll.6: THIS placement's own explicit, LITERAL entity_key, used verbatim — NO bundle prefix and NO ordinal suffix minted (contrast `key_prefix`'s derived '<bundle>/<key_prefix>_<n>'). For a pre-known exact key a script/fixture depends on (e.g. 'fastlane/hero') that does not follow the '<bundle>/<stem>_<n>' convention — the escape hatch that let raw write_rows chains mint exact keys this verb previously could not reproduce. Re-running with the SAME entity_key upserts its owned rows, same as `key_prefix`. Mutually exclusive with `key_prefix`; only legal for a single instance — omit `count` or set it to 1. |\n| `key_prefix` | no | string | | workspace idempotency: THIS placement's own explicit identity stem — keys become '<bundle>/<key_prefix>_<n>' (n restarts at 1 for this placement's own prefix, EVERY call — never derived from what already exists in the workspace). A re-run with the SAME key_prefix therefore reproduces the SAME keys and UPSERTS the rows owned by the selected placement tool. Omit for an anonymous, additive placement (default '<bundle>/<slugified entity_def>_<n>', numbered onward from whatever already exists in the workspace so repeated calls never collide) — name placements for idempotent scripts. Mutually exclusive with `entity_key`. |\n| `name` | no | string | | sk-ntz.1: THIS placement's own explicit, VERBATIM `entities.name`/`actors.name` override — used AS-IS on every instance in THIS placement, no ordinal suffix appended (contrast the default title-cased `kind`/`entity_def` naming, which DOES append an ordinal for multi-instance placements). Overrides the flat `name` when both are set (THIS placement's own `name` wins) — the escape hatch that let raw write_rows chains author a custom display name this verb previously could not reproduce (the fold this verb was widened for, sk-ntz.1, otherwise had no way to keep a fixture's own 'Fast-lane Hero' style name). Mutually exclusive with `name_prefix`. Omit for the existing default: title-cased `kind`/`entity_def`, ordinal-suffixed for multi-instance placements — unchanged. |\n| `name_prefix` | no | string | | sk-jay0.7.15.3: THIS placement's own display-name STEM — replaces only the title-cased `kind`/`entity_def` half of the derived name and KEEPS the ordinal (`'<name_prefix> <n>'`). The group-placement counterpart to verbatim `name` (which is used AS-IS with no ordinal, so a count>1 batch would otherwise share one identical name). Overrides the flat `name_prefix` when both are set (THIS placement's own `name_prefix` wins). Mutually exclusive with `name`. Illegal with `entity_key` (no ordinal is minted — use `name` for a single literal key). Omit for the existing default — unchanged. |\n| `quantity` | no | integer | | sk-ntz.1: THIS placement's own explicit `entities.quantity` (stack size) override for every instance in THIS placement — spellkave_place_entity ONLY (a stackable item's own on-instance count, e.g. a 10-credit purse); spellkave_place_actor rejects a set `quantity` outright (actors carry no stack — use spellkave_place_entity instead). Overrides the flat `quantity` when both are set (THIS placement's own `quantity` wins). Omit for the schema default (1) — unchanged. |\n| `resources` | no | array<object> | | Per-instance object_state overrides seeded on EVERY instance in THIS placement. |\n| `tags` | no | array<string> | | One INSTANCE-level entity_tag row per tag ('this goblin is the leader / faction X') — NOT an entity_definition_tag. Tag-grammar membership (MF-VAL-300) and dedup are enforced by the shared validator at commit; an unknown-grammar tag is reported as a diagnostic, not persisted. When a tag has authored tag_capability_grant rows (workspace/live), the result surfaces 'tag X grants capability Y' so the author sees the consequence — informational, never blocking. |\n\n##### `placements[].resources[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `resource` | yes | string | | A resource_definition_id (or any object_state state_id). |\n| `value` | yes | number | | The per-instance value_int override. |\n\n#### `resources[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `resource` | yes | string | | A resource_definition_id (or any object_state state_id). |\n| `value` | yes | number | | The per-instance value_int override. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"kind\": \"item\",\n \"at\": \"aoe_blast/arena/center\",\n \"key_prefix\": \"lever\",\n \"description\": \"A fixed brass lever set into the arena wall.\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [],\n \"entity_keys\": [\n \"aoe_blast/lever_1\"\n ]\n}\n```\n\n## `spellkave_remove_entity`\n\n**Remove Entity** — execution mode `sequential`.\n\nRemove a placed entity and its dependent instance rows from the active local root file, and clean matching staged scratch rows so a later flush cannot recreate it. Requires a local target; live targets are refused. Root headers, definitions and unrelated rows remain. Include-owned rows and surviving containment/ownership references are refused with recovery guidance before writes. Reports removed row counts. Does not change the running world: use diff/apply with prune separately.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `entity_key` | yes | string | | Exact authored key of the placed entity to remove from the local root and staged scratch, e.g. my_adventure/torch. This edits files only; preview and apply world pruning separately. |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_place_actor`\n\n**Place actor** — execution mode `sequential`.\n\nDeclaratively place authored world instances at build time. Emits an entity plus actor and actor_spatial_location rows; use it only for world participants that can be steered as actors. Place them all at ONE node with the flat `at`/`count`/`resources`/`tags`, or split them across MULTIPLE nodes in the SAME call with `placements`; the two shapes are mutually exclusive. Self-scaffolds the `[[bundles]]` header if `bundle` has none yet (FIX②b). `kind` is explicit; optional `entity_def` is a separate fully-qualified catalog reference. Resolves `entity_def`/every `at` against the workspace, the active connection-level `target` when wired , and (legacy) live world when `context.db` is set directly — fails loudly on a dangling ref rather than authoring a broken instance. Returns the generated `entity_keys` (in placement order) for a later spellkave_define_behavior `grant_to`. workspace idempotency: pass `key_prefix` (flat shape) / `placements[].key_prefix` (placements shape) to give a placement an EXPLICIT, reproducible identity — a re-run with the SAME key_prefix upserts its owned rows. Anonymous placements are ADDITIVE — every call adds genuinely NEW instances, named '<bundle>/<short entity_def slug>_<n>' by default (falling back to the fully-qualified slug only on a short-slug collision across different entity_defs, addendum); name placements for idempotent scripts. sk-9ll.6: pass `entity_key` (flat) / `placements[].entity_key` (placements shape) instead of `key_prefix` for an explicit, LITERAL key with NO ordinal minted at all (e.g. a fixture-mandated 'bundle/hero') — mutually exclusive with `key_prefix`, only legal for a single instance. sk-9ll.7: pass `tags` (flat) / `placements[].tags` (placements shape) for INSTANCE-level `entity_tag` rows seeded on every instance in that shape — clear-and-reseed idempotent exactly like `resources` (a re-run with FEWER tags drops the stale ones). Tag-grammar membership (MF-VAL-300) is enforced by the shared validator at commit, not re-validated here; when a tag carries an authored tag_capability_grant, the result's `tag_capability_grants` reports the capability it live-grants (informational, never blocking). sk-ntz.1: pass `name` (flat) / `placements[].name` (placements shape) for a VERBATIM `entities.name`/`actors.name` override (no ordinal suffix appended) instead of the default title-cased `kind`/`entity_def` naming — the per-placement value wins when both flat `name` and a placement's own `name` are set. Pass `quantity` (flat) / `placements[].quantity` (placements shape) for an explicit `entities.quantity` (stack size) override instead of the schema default (1) — spellkave_place_entity ONLY; spellkave_place_actor rejects a set `quantity` outright (actors carry no stack) — the per-placement value wins here too. This authors manifest rows; runtime creation belongs to future DM spawn tools.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `at` | no | string | | FLAT single-location shape: an already-authored place_node id every instance is placed at. Mutually exclusive with `placements` (FIX①) — set `at` (+ `count`/`resources`) for ONE location, or `placements` to split a batch across MULTIPLE locations in one call, never both. |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `count` | no | number | | FLAT shape only: how many identical instances to place (default 1). |\n| `description` | no | string | | Sets EVERY placed entity's own `description` column (across every placement) — e.g. 'the guard with the limp' (— a first-class, never load-bearing authoring field, not a metadata_attachments row). |\n| `entity_def` | no | string | | Optional fully-qualified catalog entity_def_id (contains '/', e.g. 'srd/monster/goblin') that must already resolve in the workspace or live world. `kind` remains explicit and independent. |\n| `entity_key` | no | string | | FLAT shape only (mutually exclusive with `placements` — set `placements[].entity_key` there instead). sk-9ll.6: see `placements[].entity_key`'s description for the full semantics — this is the same field, for the single-location flat shape. |\n| `key_prefix` | no | string | | FLAT shape only (mutually exclusive with `placements` — set `placements[].key_prefix` there instead). workspace idempotency: see `placements[].key_prefix`'s description for the full semantics — this is the same field, for the single-location flat shape. Mutually exclusive with `entity_key`. |\n| `kind` | yes | \"player\" \\\\| \"npc\" \\\\| \"item\" \\\\| \"place\" | | Manifest entity kind accepted by the current authoritative schema. The placement tool controls whether actor steering rows exist; `kind` does not. The open-vocabulary migration is tracked by. |\n| `name` | no | string | | sk-ntz.1: FLAT shape (also `placements[].name`, which wins when both are set): sets EVERY placed entity's own `entities.name`/`actors.name` verbatim (no ordinal suffix), instead of the default title-cased `kind`/`entity_def` naming. A first-class, never load-bearing authoring field, mirrors `description`'s own shared-across-every-placement convention. Mutually exclusive with `name_prefix`. Omit for the existing default — unchanged. |\n| `name_prefix` | no | string | | sk-jay0.7.15.3: FLAT shape (also `placements[].name_prefix`, which wins when both are set): replaces only the title-cased `kind`/`entity_def` half of the derived name and KEEPS the ordinal (`'<name_prefix> <n>'`) across every placed instance. The group-placement counterpart to verbatim `name`. Mutually exclusive with `name`. Illegal with `entity_key`. Omit for the existing default — unchanged. |\n| `placements` | no | array<object> | | MULTI-LOCATION shape (FIX①): one or more {at, count?, resources?, tags?} groups placing the SAME kind/entity_def split across DIFFERENT place_nodes in a single call (e.g. 3 targets at the blast center + 1 bystander at the fringe). Mutually exclusive with the flat `at`/`count`/`resources`/`tags` — set ONE shape or the other, never both. |\n| `quantity` | no | integer | | sk-ntz.1: FLAT shape (also `placements[].quantity`, which wins when both are set): sets EVERY placed entity's own `entities.quantity` (stack size) — spellkave_place_entity ONLY; spellkave_place_actor rejects a set `quantity` (actors carry no stack — use spellkave_place_entity for a stackable item instance instead). Omit for the schema default (1) — unchanged. |\n| `resources` | no | array<object> | | FLAT shape only: per-instance object_state overrides seeded on EVERY placed entity in this call (e.g. a non-default starting pool value). Does NOT declare the resource_definitions row itself (use spellkave_define_resource first). |\n| `tags` | no | array<string> | | One INSTANCE-level entity_tag row per tag ('this goblin is the leader / faction X') — NOT an entity_definition_tag. Tag-grammar membership (MF-VAL-300) and dedup are enforced by the shared validator at commit; an unknown-grammar tag is reported as a diagnostic, not persisted. When a tag has authored tag_capability_grant rows (workspace/live), the result surfaces 'tag X grants capability Y' so the author sees the consequence — informational, never blocking. |\n\n#### `placements[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `at` | yes | string | | An already-authored place_node id (e.g. from spellkave_author_place) every instance in THIS placement is placed at. |\n| `count` | no | number | | How many identical instances at this placement (default 1). |\n| `entity_key` | no | string | | sk-9ll.6: THIS placement's own explicit, LITERAL entity_key, used verbatim — NO bundle prefix and NO ordinal suffix minted (contrast `key_prefix`'s derived '<bundle>/<key_prefix>_<n>'). For a pre-known exact key a script/fixture depends on (e.g. 'fastlane/hero') that does not follow the '<bundle>/<stem>_<n>' convention — the escape hatch that let raw write_rows chains mint exact keys this verb previously could not reproduce. Re-running with the SAME entity_key upserts its owned rows, same as `key_prefix`. Mutually exclusive with `key_prefix`; only legal for a single instance — omit `count` or set it to 1. |\n| `key_prefix` | no | string | | workspace idempotency: THIS placement's own explicit identity stem — keys become '<bundle>/<key_prefix>_<n>' (n restarts at 1 for this placement's own prefix, EVERY call — never derived from what already exists in the workspace). A re-run with the SAME key_prefix therefore reproduces the SAME keys and UPSERTS the rows owned by the selected placement tool. Omit for an anonymous, additive placement (default '<bundle>/<slugified entity_def>_<n>', numbered onward from whatever already exists in the workspace so repeated calls never collide) — name placements for idempotent scripts. Mutually exclusive with `entity_key`. |\n| `name` | no | string | | sk-ntz.1: THIS placement's own explicit, VERBATIM `entities.name`/`actors.name` override — used AS-IS on every instance in THIS placement, no ordinal suffix appended (contrast the default title-cased `kind`/`entity_def` naming, which DOES append an ordinal for multi-instance placements). Overrides the flat `name` when both are set (THIS placement's own `name` wins) — the escape hatch that let raw write_rows chains author a custom display name this verb previously could not reproduce (the fold this verb was widened for, sk-ntz.1, otherwise had no way to keep a fixture's own 'Fast-lane Hero' style name). Mutually exclusive with `name_prefix`. Omit for the existing default: title-cased `kind`/`entity_def`, ordinal-suffixed for multi-instance placements — unchanged. |\n| `name_prefix` | no | string | | sk-jay0.7.15.3: THIS placement's own display-name STEM — replaces only the title-cased `kind`/`entity_def` half of the derived name and KEEPS the ordinal (`'<name_prefix> <n>'`). The group-placement counterpart to verbatim `name` (which is used AS-IS with no ordinal, so a count>1 batch would otherwise share one identical name). Overrides the flat `name_prefix` when both are set (THIS placement's own `name_prefix` wins). Mutually exclusive with `name`. Illegal with `entity_key` (no ordinal is minted — use `name` for a single literal key). Omit for the existing default — unchanged. |\n| `quantity` | no | integer | | sk-ntz.1: THIS placement's own explicit `entities.quantity` (stack size) override for every instance in THIS placement — spellkave_place_entity ONLY (a stackable item's own on-instance count, e.g. a 10-credit purse); spellkave_place_actor rejects a set `quantity` outright (actors carry no stack — use spellkave_place_entity instead). Overrides the flat `quantity` when both are set (THIS placement's own `quantity` wins). Omit for the schema default (1) — unchanged. |\n| `resources` | no | array<object> | | Per-instance object_state overrides seeded on EVERY instance in THIS placement. |\n| `tags` | no | array<string> | | One INSTANCE-level entity_tag row per tag ('this goblin is the leader / faction X') — NOT an entity_definition_tag. Tag-grammar membership (MF-VAL-300) and dedup are enforced by the shared validator at commit; an unknown-grammar tag is reported as a diagnostic, not persisted. When a tag has authored tag_capability_grant rows (workspace/live), the result surfaces 'tag X grants capability Y' so the author sees the consequence — informational, never blocking. |\n\n##### `placements[].resources[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `resource` | yes | string | | A resource_definition_id (or any object_state state_id). |\n| `value` | yes | number | | The per-instance value_int override. |\n\n#### `resources[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `resource` | yes | string | | A resource_definition_id (or any object_state state_id). |\n| `value` | yes | number | | The per-instance value_int override. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"kind\": \"npc\",\n \"placements\": [\n {\n \"at\": \"aoe_blast/arena/center\",\n \"count\": 3,\n \"key_prefix\": \"caster\"\n },\n {\n \"at\": \"aoe_blast/arena/fringe\",\n \"count\": 1,\n \"key_prefix\": \"bystander\"\n }\n ],\n \"description\": \"Fireball proof cast: caster_1 is the mage; caster_2/caster_3 are targets; bystander_1 is the control.\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 12,\n \"diagnostics\": [],\n \"entity_keys\": [\n \"aoe_blast/caster_1\",\n \"aoe_blast/caster_2\",\n \"aoe_blast/caster_3\",\n \"aoe_blast/bystander_1\"\n ]\n}\n```\n\n## `spellkave_bind_actor`\n\n**Bind Actor (verb)** — execution mode `sequential`.\n\nverb-UX round 6: bind an already-placed actor's identity (actor_identities, upsert-by-entity_key) and, optionally, grant it one or more capabilities (actor_capabilities) in a single call — folds the genesis-window self-grant idiom (an identity bind + a `frontier.apply_manifest` grant, the `srd/regdar`/`phandelver/hero` pattern every ad-hoc live-authored actor bundle needs post-core/player-retirement) from 2 spellkave_write_rows calls into 1. `entity_key` must already carry an actor_spatial_locations row (workspace, live, or the active target) — place it first via spellkave_place_actor (mirrors spellkave_define_behavior's own `grant_to` precondition). workspace idempotency: re-authoring the SAME entity_key's identity bind REPLACES it (never duplicates — the server itself upserts on (actor_id, identity), and every corpus fixture binds one entity_key to exactly one identity); each capabilities[] grant upserts by (actor_entity_key, capability_id, source), mirroring add-capability-grant.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `capabilities` | no | array<object> | | actor_capabilities grants issued to the SAME entity_key, alongside the identity bind. Default `[]` (identity-only bind — no grant). Ordinary capability rows are supported; frontier.* capability requests are refused with a pointer to spellkave_grant_role. |\n| `entity_key` | yes | string | | entity_key of an already-placed actor (e.g. via spellkave_place_actor) — must already carry an actor_spatial_locations row (workspace, live, or the active target); this call does not place one. |\n| `identity` | no | string | | actor_identities.identity. Default '$sender' resolves to whoever submits the applying delta. Pass a concrete identity hex string only when binding to a KNOWN, fixed identity instead. |\n| `role` | no | string | | actor_identities.role. Default 'primary' (the corpus-dominant value; 'dm' is the one observed override). NOT a cosmetic label: r_claim_actor refuses every value but 'primary', so authoring 'dm' deliberately makes the seat un-self-claimable — right for a human DM anchor handed over by the operator, wrong for a programmatic seat that wants the self-claim path. It never affects visibility or write authority, which come from the capability grant alone. |\n\n#### `capabilities[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `capability_id` | yes | string | | actor_capabilities.capability_id — must already resolve to an authored capability_definitions row (workspace, live, or the active target); this call does not auto-create it. Privileged frontier.* ids use spellkave_grant_role with an explicit role and extent. |\n| `extent_kind_ref` | no | string | | actor_capabilities.extent_kind_ref. |\n| `extent_ref` | no | string | | actor_capabilities.extent_ref (ADR-0007 D-4 see-as scope). |\n| `source` | no | string | | actor_capabilities.source. Omit for the schema default 'manifest' (mirrors `add-capability-grant`'s own default). This is grant provenance, not authority over a role or extent. |\n| `visibility` | no | string | | actor_capabilities.visibility (ADR-0120 read-visibility override). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"entity_key\": \"aoe_blast/caster_1\",\n \"capabilities\": [\n {\n \"capability_id\": \"core/walk\",\n \"source\": \"core\"\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": false,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-365\",\n \"severity\": \"fatal\",\n \"message\": \"actor_capability 'aoe_blast/caster_1:core/walk' does not resolve in bundle 'aoe_blast' dependency closure or kernel bootstrap vocabulary\",\n \"path\": \"actor_capabilities.capability_id\"\n }\n ]\n}\n```\n\n## `spellkave_tag_entity`\n\n**Tag Entity (verb)** — execution mode `sequential`.\n\nsk-ntz.2: retag an already-placed entity's INSTANCE-level entity_tag rows from a call/file OTHER than the one that placed it (e.g. crypt-fight.ts tagging a hero placed by hero.ts) — the narrow post-placement counterpart to spellkave_place_entity/spellkave_place_actor's own `tags` param, for exactly the case those verbs cannot cover: an entity_key placed elsewhere. `entity_key` must already carry an entities row (workspace or the active target) — place it first via spellkave_place_entity/spellkave_place_actor (mirrors spellkave_bind_actor's own precondition). Default `mode: 'add'` upserts the listed tags and leaves every OTHER tag on the entity untouched (idempotent); `mode: 'replace'` clears every existing entity_tag row for `entity_key` first, then reseeds exactly `tags` — use `replace` only when THIS call owns the entity's complete tag set, since it WOULD clobber tags authored by the entity's own placement call otherwise. Tag-grammar membership (MF-VAL-300) is enforced by the shared validator at commit, not re-validated here; when a tag carries an authored tag_capability_grant, the result's `tag_capability_grants` reports the capability it live-grants (informational, never blocking).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated entity_tag row. Omit to fall back to `context.defaultBundle` (smart default). NOTE: this is the bundle OWNING the new tag row(s), not necessarily the bundle that placed `entity_key` — a cross-bundle caller stamps ITS own bundle_id here (the elven-mini idiom this verb replaces: crypt-fight.ts/dm-npc.ts tag the hero placed in hero.ts, all three sharing one bundle in that fixture, but nothing requires it). |\n| `entity_key` | yes | string | | entity_key of an already-placed entity (e.g. via spellkave_place_entity/spellkave_place_actor, in THIS bundle or another) — must already carry an entities row (workspace or the active target); this call does not place one. Use this verb instead of re-invoking the placement tool when the entity's placement call lives in a DIFFERENT file/call than the one adding this tag. |\n| `mode` | no | \"add\" \\\\| \"replace\" | | Default 'add': upsert the listed tags, leaving every OTHER tag already on this entity_key untouched (idempotent — re-listing an already-present tag is a no-op) — the safe default for a cross-file caller that does not own the entity's full tag set (this verb's whole reason to exist: REPLACING would clobber tags the entity's OWN placement call already authored elsewhere). Set 'replace' only when THIS call owns the entity's complete tag set: it clears EVERY existing entity_tag row for `entity_key` first, then reseeds exactly `tags` (a re-run with fewer tags drops the stale ones, mirroring spellkave_place_entity/spellkave_place_actor's own clear-and-reseed). |\n| `tags` | yes | array<string> | | One INSTANCE-level entity_tag row per tag, mirroring spellkave_place_entity/spellkave_place_actor's own `tags` param exactly (same row shape, same MF-VAL-300 grammar, same tag_capability_grant diagnostic) — the difference is WHEN: this verb runs AFTER the entity already exists, against an entity_key placed by a DIFFERENT call/file. |\n\n## `spellkave_equip_item`\n\n**Equip Item (verb)** — execution mode `sequential`.\n\nsk-9ll.3: equip an already-placed, already-stowed item into a named equipment slot on an actor (actor_equipment_slots, upsert-by-(actor_entity_key, slot_id)) — folds the 'give the hero a starter weapon' idiom's raw actor_equipment_slots write into one checked call. `slot_id` existence and `item_entity_key`'s existence/placeability are enforced by the SAME validator the linter and manifest admission use (no bespoke re-check here); THIS call's own precondition is the one thing only it can see across separate tool calls — a slot already occupied by a DIFFERENT item is a hard rejection (matches the runtime EquipItem affordance's SlotAlreadyOccupied check), while re-equipping the SAME item into the SAME slot is idempotent.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `actor_entity_key` | yes | string | | actor_equipment_slots.actor_entity_key — must already carry an actor_spatial_locations row (workspace, live, or the active target); place it first via spellkave_place_actor. |\n| `bundle` | no | string | | bundle_id stamped on the generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `item_entity_key` | yes | string | | actor_equipment_slots.item_key — an already-authored entities row that entity_containment already places inside actor_entity_key (stow it first via spellkave_stow_item). |\n| `slot_id` | yes | string | | actor_equipment_slots.slot_id — must already resolve to an authored equipment_slot_definitions row. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"actor_entity_key\": \"aoe_blast/caster_1\",\n \"item_entity_key\": \"aoe_blast/lever_1\",\n \"slot_id\": \"core/slot/main_hand\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [],\n \"actor_entity_key\": \"aoe_blast/caster_1\",\n \"item_entity_key\": \"aoe_blast/lever_1\",\n \"slot_id\": \"core/slot/main_hand\"\n}\n```\n\n## `spellkave_stow_item`\n\n**Stow Item (verb)** — execution mode `sequential`.\n\nsk-9ll.3: place an already-authored entity inside a container (entity_containment, upsert-by-entity_key — a re-authored containment MOVES the entity, mirroring add-entity-containment's own upsert semantics). Folds the 'starter pack straight into the hero' / 'item straight onto its holder' idiom (container_entity_key omitted, defaults to actor_entity_key) AND the nested-container idiom (container_entity_key explicit, e.g. a torch into an already-stowed field kit) into one checked call, replacing a raw spellkave_write_rows entity_containment call.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `actor_entity_key` | no | string | | The actor stowing item_entity_key — must already carry an actor_spatial_locations row (workspace, live, or the active target); place it first via spellkave_place_actor. Also the DEFAULT container when container_entity_key is omitted. Omit it to put an item into a placed container with no actor involved (a potion in a chest): then container_entity_key is required. |\n| `bundle` | no | string | | bundle_id stamped on the generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `container_entity_key` | no | string | | entity_containment.container_entity_key. Default actor_entity_key — the common 'give the actor this item directly' case (a starter weapon straight into the hero's inventory). Pass a DIFFERENT already-placed container (e.g. a field kit already stowed on the actor) to nest item_entity_key inside IT instead (the torch-inside-the-field-kit idiom). |\n| `direction` | no | string | | entity_containment.direction — machine-port direction ('in'/'out'). Default '' (loose carriage). |\n| `item_entity_key` | yes | string | | entity_containment.entity_key — an already-placed entity (workspace or the active target) to move into container_entity_key (or actor_entity_key when container_entity_key is omitted). |\n| `slot_id` | no | string | | entity_containment.slot_id — machine-port slot id. Default '' (loose carriage — the common item-in-backpack/actor-holding-item case, not a machine port). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"actor_entity_key\": \"aoe_blast/caster_1\",\n \"item_entity_key\": \"aoe_blast/lever_1\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [],\n \"item_entity_key\": \"aoe_blast/lever_1\",\n \"container_entity_key\": \"aoe_blast/caster_1\"\n}\n```\n\n## `spellkave_define_behavior`\n\n**Define Behavior (verb PoC)** — execution mode `sequential`.\n\nPoC : author ONE capability→affordance→action→outcome→consequence→frame_write chain (+ an optional cost debit) in a single call, granted to `grant_to`. Drives @spellkave/world-author's `clusterRows` — the SAME behavior-cluster builder the SRD content drivers use (FIX③, de-fork) — bundle-namespaced via `BehaviorConfig.idNamespace`. `primitive` fields are CLOSED PoC enums — only the real kernel shapes the worked fireball/find_familiar/core-mark examples need are wired; anything else fails loudly naming the PoC boundary. US9 VERB EXPANSION: `effect.write.primitive` now also accepts 'Spawn' (Brief 26 EffectPrimitive::Spawn — instantiate an entity_def at the actor's own node) and 'Inscribe' (the raw FrameWriteOp::Inscribe trace idiom — a durable typed footprint, no resource delta); both require `offered_when.target: 'self'|'place'` (a target concept beyond 'hit others in a radius') and never combine with `effect.shape`/`effect.per_target_gate`. `target: 'self'` needs a `cost` (else this tool errors BEFORE validation with a hint, MF-VAL-263); `target: 'place'` needs none (self_eligible stays false, so the self-budget check never engages). `effect.write.resource` (ModifyResource) / `effect.write.entity_def` (Spawn) must already be authored (this PoC never auto-creates write-target resources/blueprints — use spellkave_define_resource / spellkave_define_entity_type first); `cost.pool`, if new, IS auto-created with generic bounds. workspace idempotency: re-authoring the SAME bundle+id REPLACES the whole generated cluster (capability/ outcome/affordance/action/consequence/frame-write/live-wiring rows) rather than duplicating it.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `action_class` | yes | string | | action_definition_tag applied to the generated action (e.g. 'spell'). REQUIRED — has no default (finding A1): omitting it throws a named-param error rather than silently authoring a corrupt row. Overridden (not supplemented) by `tags` when that param is set. |\n| `action_prefix` | no | string | | srd-migration round: override the derived action id's prefix — the full action id is '<bundle>/<action_prefix><id>' (default 'cast_', e.g. id='fireball' -> '<bundle>/cast_fireball'). Pass '' to derive a BARE '<bundle>/<id>' action id (e.g. the Hex/Bless/Bardic-Inspiration condition-modified-roll family's WRITER/CONSUMER pair, whose action ids are '<bundle>/<key>', not '<bundle>/cast_<key>') — mirrors compose.ts's BehaviorConfig.actionPrefix verbatim; outcome/affordance/success ids all derive from the SAME action id, so this affects all four. |\n| `bind_to_definition` | no | string | | An already-authored entity_definitions catalog id (workspace, live, or the active target — same 3-way resolution as the placement tools' `entity_def`) that inherits this call's capability at instance birth via entity_definition_initial_capability. This PoC does not auto-create the definition (use spellkave_define_entity_type first). |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `capability_id` | no | string | | verb-UX round 2: override the derived '<bundle>/spell/<id>' capability_id — e.g. for a CATALOG spell whose entity_definitions.entity_def_id already exists under a different id shape (mirrors compose.ts's ActorBehavior.capabilityId — for a catalog spell this MUST equal the catalog entity_def_id so the capability IS the catalog identity). `action_id` is never touched by this — only the capability's own id changes. |\n| `communication_speech_act_id` | no | string | | verb-UX round 4 (SPEECH-ACT lens, Searle) — when set, the generated action's outcome_templates row carries this `communication_speech_act_id`, so the affordance SURFACES as a communication speech act while r_manipulate still EXECUTES the gated consequence normally via `manipulation_action_id` (mirrors compose.ts's ActorBehavior.communicationSpeechActId — the Persuasion 'directive' worked example). Omit for the legacy default: no speech-act framing. |\n| `cost` | no | object | | |\n| `def_instance` | no | object | | |\n| `description` | no | string | | Sets the generated capability_definitions row's own `description` column — the capability is this behavior's natural authoring-identity anchor, so that is where the description lands (NOT the affordance/action/outcome/consequence/resource rows this verb also generates). |\n| `display_name` | no | string | | verb-UX round 2: overrides the derived 'Cast <TitleCase id>' display name stamped onto every generated row that carries one (capability/action/affordance/outcome). Omit for the smart default — naive per-word title-casing mangles a multi-word id containing a preposition (e.g. 'circle_of_death' -> 'Cast Circle Of Death' instead of 'Cast Circle of Death'). |\n| `effect` | yes | object | | |\n| `emit_capability` | no | boolean | | srd-migration round: whether this call authors a capability_definitions row for `capability_id`/the derived id. Default true. Pass false when the capability ALREADY exists (authored by ANOTHER call/fragment, e.g. a feat grant that already created it) and this call should REUSE it — `required_capability`/`actor_capabilities`/the niche all still key on `capability_id` (which then MUST be set — omitting it AND setting false derives an id no prior call could have authored), but no duplicate capability_definitions row is emitted (mirrors compose.ts's ActorBehavior.emitCapability, a required field there, made an optional smart default here since every prior verb caller wanted true). |\n| `grant_to` | yes | string \\\\| array<string> | | entity_key of the caster (already placed via spellkave_place_actor) granted the capability — or an ARRAY of entity_keys to grant the SAME capability to several actors in one call (finding B4: 'author once, grant twice' — e.g. two mechanically-identical monsters sharing one scimitar). The capability/action/affordance/outcome/consequence cluster is authored exactly ONCE regardless (keyed off the FIRST entry, which also becomes `defaultCaster` for any `[[actors]]`/entities the shape itself emits, e.g. Spawn's `def_instance`) — every entry gets its OWN `actor_capabilities` grant + `spatial_niche_attachments` row (attached to ITS OWN node, resolved independently per entity_key, exactly like the single-actor case). Each caster needs a nonblank place_node_id, resolved from the workspace before the active target. If a live AUTHOR cannot read the caster's placement, the call fails before writing scratch; supply its known current actor_spatial_locations workspace row. workspace idempotency: re-authoring the SAME bundle+id REPLACES the WHOLE grant set — an entity_key dropped from the array on a later call has its grant and attachment rows cleared, not left behind (mirrors every other satellite this verb folds). |\n| `id` | yes | string | | Behavior key stem — derives capability_id '<bundle>/spell/<id>' and action_id '<bundle>/cast_<id>' (+ its outcome/affordance/consequence siblings), unless overridden by `capability_id`. |\n| `observation` | no | string | | B-9: authored PLAYER-facing prose for what a player perceives on a successful manipulate or sensing outcome — distinct from `description` above, which stays operator-only on capability_definitions. Sets the generated outcome_templates row's own `description` column (its actual authoring/read home — see outcome_template.rs's doc comment for why that table, not action_definitions/consequence_templates). May reference ONLY the frozen placeholders `{target_name}`, `{actor_name}`, `{place_name}` (resolved from data the player already sees, never a raw id) — a state-dereferencing value (HP, a resource, a condition) belongs in the DSL outcome expression, not here, and an unknown placeholder or a description over 500 chars is rejected at validation. Omit for the existing default: the tool result carries an honest `observation: null` + `observation_gap`, byte-identical to today. |\n| `offered_when` | yes | object | | |\n| `tags` | no | array<string> | | verb-UX round 2: the FULL capability_definition_tag AND action_definition_tag row set — when set, REPLACES the single `action_class` tag as the authoritative list for BOTH satellites (include `action_class`'s own value in `tags` too, if wanted — it is not auto-prepended). Omit for the legacy default: `action_class` alone becomes the one action tag, no capability tags — `action_class` itself is REQUIRED either way (no default of its own, finding A1): this param only controls what ELSE joins it, never whether it is needed. |\n\n#### `cost`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `amount` | yes | number | | How much to debit per cast. |\n| `pool` | yes | string | | resource_definition_id debited on cast (e.g. a spell-slot pool). |\n\n#### `def_instance`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `entity_key` | yes | string | | The proof instance's fully-qualified entity_key, e.g. 'srd/actor/polar-bear-def'. |\n| `name` | yes | string | | entities.name / actors.name for the proof instance. |\n| `node` | no | string | | An already-authored place_node id the proof instance is placed at. Omit to default to the resolved caster node (`grant_to`'s own node) — the niche this behavior's capability attaches is already anchored there. |\n\n#### `effect`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `per_target_gate` | no | string | | Authored Bool DSL expression gating the write, e.g. 'd20 < 13' (a failed save) or 'd20 >= 13' (a hit). Omit for an ungated write. aoe (effect.shape set): gates the body PER SELECTED ACTOR. single-target (effect.shape omitted): gates the AFFORDANCE itself (a miss/failed-check skips the whole consequence — the attack-roll seam). ModifyResource only — MUST be omitted for 'Spawn'/'Inscribe'. |\n| `primitive` | yes | \"ForEachActorInRadius\" | | Closed PoC enum — only 'ForEachActorInRadius' is wired. |\n| `shape` | no | object | | |\n| `write` | yes | object | | |\n\n##### `effect.shape`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `id` | yes | \"core/area/node_ball\" \\\\| \"core/area/sphere\" | | Closed PoC enum: 'core/area/node_ball' (topological — radius = ball_radius graph-edge hops, 0 = same node) or 'core/area/sphere' (metric — radius = radius_m). Other area shapes need direct authoring. |\n| `radius` | yes | number | | node_ball: integer edge-hop radius. sphere: metric radius_m. |\n\n##### `effect.write`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `attacks` | no | array<object> | | One entry per sub-attack (2+ for an SRD Multiattack, but generalises to any N) — see this field's own top-level description for the full shape. |\n| `branches` | no | array<object> | | OutcomeGraph only: one entry per branch arm (2+ — see this field's own top-level description). Required, and must be non-empty, when effect.write.primitive is 'OutcomeGraph'. |\n| `condition` | no | string | | ApplyStatus/RemoveCondition only: the condition_definitions condition_definition_id landed on (ApplyStatus) or deleted from (RemoveCondition) the single TargetActor — must already resolve (workspace, live, or the active target); this PoC does not auto-create the condition (use spellkave_define_condition first). |\n| `content` | no | string | | Inscribe only: the trace's `payload_json` content — a JSON-encodable string describing the mark (e.g. '{\"action\":\"relieve\"}'). |\n| `delta` | no | string | | ModifyResource only: authored Int DSL expression evaluated per target, e.g. '-d6'. aoe: applied to every selected actor. single-target: applied once, to the ONE TargetActor. Ignored (may be omitted) when `attacks` is set. |\n| `entity_def` | no | string | | Spawn only: the entity_definitions catalog id to instantiate at the actor's own node (e.g. 'srd/monster/cat', mirroring srd/cast_find_familiar) — must already resolve (workspace or live); this PoC does not auto-create the blueprint. |\n| `env_state_center` | no | \"actor\" \\\\| \"target\" | | EnvState only: 'actor' (default) writes the CASTER'S OWN cell (ActorSpatialRef — follows the caster, a Darkness-shaped ambient cast). 'target' anchors on the cast's TARGET cell (TargetSpatialRef) instead. |\n| `env_state_id` | no | string | | EnvState only: the spatial_state_definitions id this write flips (e.g. 'srd/darkness') — auto-created by this call as a BOOL state def with writer_policy 'world_interaction' (so the apply path may write it at cast time) and a long freshness, mirroring `cost.pool`'s auto-create; this PoC never requires it pre-authored. A separately-authored consumer affordance reads target.state(env_state_id) — this call does not author the consumer. |\n| `env_state_value` | no | boolean | | EnvState only: the bool value the marker Inscribe writes. Default true ('on'). |\n| `primitive` | yes | \"ModifyResource\" \\\\| \"Spawn\" \\\\| \"Inscribe\" \\\\| \"ApplyStatus\" \\\\| \"RemoveCondition\" \\\\| \"EnvState\" \\\\| \"OutcomeGraph\" \\\\| \"ScheduledZone\" \\\\| \"Clock\" | | Closed PoC enum — the REAL kernel primitive names (US9/srd-migration round, never invented; verified against world-fixtures/srd/base/summon.toml + world-fixtures/core/base/affordances.toml + world-fixtures/srd/base/hold-monster.toml + world-fixtures/srd/base/lesser-restoration.toml + world-fixtures/srd/base/darkness.toml + world-fixtures/srd/base/acid-arrow.toml + world-fixtures/srd/base/moonbeam.toml + world-fixtures/srd/base/death-saves.toml): 'ModifyResource' (a resource/state delta — the original fireball-wired primitive), 'Spawn' (Brief 26 EffectPrimitive::Spawn — instantiate an entity_def at the actor's own node, the find_familiar shape; requires `offered_when.target`), 'Inscribe' (the raw FrameWriteOp::Inscribe trace idiom core/mark/core/pickup/core/drop use — a durable typed footprint, NO ModifyResource delta and NO companion definition row; requires `offered_when.target`), 'ApplyStatus' (lands a condition on the single TargetActor — the B9 Hold-Person/Hold-Monster/Bless-family shape; single-target only, no `offered_when.target`), 'RemoveCondition' (the INVERSE — deletes a matching target_condition row, the Lesser-Restoration cleanse shape; single-target only, no `offered_when.target`), 'EnvState' (verb-UX round 4 — the Darkness/Silence/Fog AMBIENT-EFFECT shape, compose.ts's 'env-state': the cast's ONLY write is an Inscribe{kind:'spatial_environment_state'} bool marker on the caster's cell (or the target cell — see `env_state_center`); this call auto-creates the backing spatial_state_definitions row, mirroring `cost.pool`'s auto-create; a SEPARATELY-authored consumer affordance reads target.state(env_state_id); single-target only, no `offered_when.target`), 'OutcomeGraph' (verb-UX round 4 — the branch-on-outcome shape, compose.ts's 'outcome-graph': the action's outcome invokes a graph whose `branches` (see that field) each carry their OWN ModifyResource(TargetActor, srd/hp,...) consequence, selected by the first true edge guard in array order — unlike a gated single-target write, EVERY branch can apply an effect (a Melf's Acid Arrow miss still deals half damage); single-target only, no `offered_when.target`), 'ScheduledZone' (verb-UX round 5 — the TRUE LINGERING hazard shape, compose.ts's 'scheduled-zone' (ADR-0054): the cast's ONLY direct write is the SAME Inscribe{kind:'spatial_environment_state'} marker EnvState uses (auto-creates the backing spatial_state_definitions row, `zone_state_id`/`zone_intensity`/ `zone_visibility`/`zone_center` — see those fields); it ALSO schedules a subject-bound ScheduleAutonomyJob (`schedule` — repeats/frequency/liveness/source) that re-fires a SEPARATE, self-contained pulse consequence each round — a node-local ForEachActorInRadius (fixed radius, ball_radius 0) wrapping `effect.write.pulse`, which REUSES this same closed enum's two autonomy-clock-eligible bodies ('ModifyResource' damage/heal via `pulse.delta`, or 'ApplyStatus' condition via `pulse.condition`) rather than inventing a third write vocabulary; `effect.per_target_gate` (if set) gates the PULSE body per occupant (the save-negate seam — Stinking Cloud), not the affordance; single-target-only, no `offered_when.target`), 'Clock' (finding C2 — the SELF-TARGETED multi-ordinal clock shape, compose.ts's 'clock' (the death-saves death-and-dying pattern): unlike every OTHER primitive above (each writes a TargetActor or a radius-selected OTHER actor), a clock's every write targets the ACTING subject alone. `tallies` (see that field) — N bare ModifyResource(actor='Actor',...) ordinals, authored first, array order = ordinal order — followed by `thresholds` (see that field) — M ForEachActorInRadius(node_ball, ball_radius 0) ordinals wrapping an ApplyStatus/RemoveCondition on 'Actor', reading the tallies' just-written state; requires `offered_when.target: 'self'` (a clock is inherently self-only — there is no 'hit others' reading of it) and needs no separate `cost` (the tallies themselves satisfy MF-VAL-263's on_success ModifyResource requirement); single-target-topology-only, no `effect.shape`/`effect.per_target_gate` (each threshold carries its OWN `when` instead of one shared per-target gate — `effect.per_target_gate`, if set, becomes the AFFORDANCE's own eligibility gate instead, e.g. \"actor.status('dying') == true &&...\", the same seam single-target's attack-roll gate reuses)). 'Spawn'/'Inscribe' are NOT FrameWriteOp arms nestable inside a ForEachActorInRadius body — they never combine with `effect.shape`/`effect.per_target_gate` (PoC boundary: only 'ModifyResource' selects actors in a radius). 'ApplyStatus'/'RemoveCondition'/'EnvState'/'OutcomeGraph'/'ScheduledZone'/'Clock' are single-target-only too (PoC boundary: no aoe condition/env-state/outcome-graph/scheduled-zone-CAST/clock pulse is wired — the scheduled-zone shape's OWN pulse is always the fixed node_ball-0 radius, never `effect.shape`) — they never combine with `effect.shape` either ('ScheduledZone' reuses `effect.per_target_gate` for its pulse's per-occupant gate instead, 'Clock' reuses it for the affordance's eligibility gate instead, see above). |\n| `pulse` | no | object | | ScheduledZone only: the pulse's own write. Required when effect.write.primitive is 'ScheduledZone' — a zone with no pulse body would schedule a job that fires nothing. |\n| `remove_source` | no | string | | RemoveCondition only: an exact source key to match (FrameWriteOp::RemoveCondition's `source_match: Exact`). Omit for the default 'Any' — source-agnostic removal (matches ANY target_condition row for `condition`, regardless of what applied it). |\n| `resource` | no | string | | ModifyResource only: must already resolve to an authored resource_definitions row (workspace, live, or the active target) — this PoC does not auto-create write-target resources (only `cost.pool` auto-creates, see the tool description). aoe (effect.shape set): the resource every selected actor's body write targets. single-target (effect.shape omitted, verb-UX round 2): the resource the ONE TargetActor write targets — defaults to 'srd/hp'-shaped combat use but any already-authored resource/state works (e.g. a non-HP disposition state). |\n| `schedule` | no | object | | ScheduledZone only: the ADR-0054 autonomy-pulse cadence + provenance. Every field optional — omit the whole object for compose.ts's defaults (repeats 10, frequency_ms 6000, requires_subject_alive false, source 'srd/<id>'). |\n| `tallies` | no | array<object> | | Clock only: one entry per self-targeted tally ordinal, authored FIRST (array order = ordinal order, before every `thresholds` entry) — see this field's own top-level description. Required, non-empty, when effect.write.primitive is 'Clock'. |\n| `thresholds` | no | array<object> | | Clock only: one entry per self-targeted threshold ordinal, authored AFTER every `tallies` entry (array order = ordinal order) — see this field's own top-level description. Required, non-empty, when effect.write.primitive is 'Clock'. |\n| `trace_kind` | no | string | | Inscribe only: the trace's `kind` discriminant (e.g. 'puddle_mark') — an arbitrary authored string; unlike `resource`, this is NEVER ref-checked against a definitions row (core/mark's own 'scrape_marks' has none either — FrameWriteOp::Inscribe's own doc: 'a durable typed footprint without a resource delta'). |\n| `zone_center` | no | \"actor\" \\\\| \"target\" | | ScheduledZone only: 'actor' (default) anchors the marker AND every pulse on the CASTER'S CURRENT cell each fire (ActorSpatialRef — a mobile aura that follows the caster). 'target' anchors on the cast's TARGET cell instead (TargetSpatialRef — the captured anchor_place_node_id stays FIXED even if the caster moves; the faithful 'dropped at range' hazard every shipped scheduled-zone spell today uses — Cloudkill/Moonbeam/Stinking Cloud/the scheduled-damage-zone batch). Mirrors EnvState's `env_state_center` — same two-value anchor concept, kept as its own field because it is scoped to a different write primitive. |\n| `zone_intensity` | no | number | | ScheduledZone only: the documentary int value the marker Inscribe stamps (e.g. the spell's damage magnitude — Cloudkill's 5d8 stamps 5). Default 0. Never read by the pulse itself (the pulse's own damage/condition comes from `pulse.delta`/`pulse.condition`) — purely an observable marker value. |\n| `zone_state_id` | no | string | | ScheduledZone only: the spatial_state_definitions id the marker Inscribe (and every pulse) reads/writes (e.g. 'srd/hazard/cloudkill') — auto-created by this call as an INT state def with writer_policy 'world_interaction' and a long freshness, mirroring EnvState's `env_state_id` auto-create (and `cost.pool`'s). Required when effect.write.primitive is 'ScheduledZone'. |\n| `zone_visibility` | no | string | | ScheduledZone only: the marker Inscribe's visibility class. Default 'Public'. |\n\n###### `effect.write.attacks[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `delta` | yes | string | | This sub-attack's authored Int DSL expression, self-gating its OWN attack roll (e.g. 'cond(d20 >= 11, 0 - (1d8 + 5), 0)') — a miss on THIS roll must resolve to 0, not skip the whole action (unlike the single-attack affordance-gated shape). |\n| `label` | no | string | | Human tag for this sub-attack (e.g. 'Rend'), report-only. |\n\n###### `effect.write.branches[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `delta` | yes | string | | This branch's authored Int DSL expression — the ModifyResource delta its terminal node's consequence applies when selected (e.g. '0 - 4d4'), written against `subject`'s `resource`. |\n| `guard` | yes | string | | This branch's edge guard predicate, evaluated root→node in array order — the FIRST true guard wins (e.g. 'd20 >= 13'); the LAST branch should carry a '1 == 1' fallthrough so some branch always selects. |\n| `label` | no | string | | Human tag for this branch, report-only. |\n| `node` | yes | string | | This branch's outcome_graph node id (e.g. 'hit'/'miss'; also the outcome/consequence id stem). |\n| `resource` | no | string | | This branch's own write resource — must already resolve to an authored resource_definitions row, same rule as the top-level `resource` field. Defaults to 'srd/hp'. Omit to keep today's byte-identical shape. |\n| `subject` | no | string | | This branch's own write subject — a kernel symbolic actor ref: 'TargetActor' (default, the damage-against-target shape every prior branch authored) or 'Actor' (the CASTER, e.g. a defeat-consequence XP credit back to the attacker — playable-fighter-l1-20 D-1). Omit to keep today's byte-identical shape. |\n\n###### `effect.write.pulse`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `condition` | no | string | | pulse.primitive 'ApplyStatus' only: the condition_definitions id landed on every occupant whose `effect.per_target_gate` passes (e.g. 'srd/poisoned') — must already resolve (workspace, live, or the active target); this PoC does not auto-create it (use spellkave_define_condition first). Required when pulse.primitive is 'ApplyStatus'. |\n| `delta` | no | string | | pulse.primitive 'ModifyResource' only: the authored Int DSL expression applied to EVERY occupant's srd/hp each pulse (e.g. 'cond(d20 >= 13, 0 - (5d8 / 2), 0 - 5d8)' for save-for-half — fold the save into the delta the same way single-target/aoe do). Required when pulse.primitive is 'ModifyResource'. |\n| `primitive` | yes | \"ModifyResource\" \\\\| \"ApplyStatus\" | | The scheduled pulse's OWN per-round frame_write body (wrapped in a fixed node-local ForEachActorInRadius, ball_radius 0, by clusterRows — never `effect.shape`) — REUSES this tool's two autonomy-clock-eligible write shapes rather than a new vocabulary: 'ModifyResource' (a damage/heal delta on 'srd/hp', the Cloudkill/Moonbeam/scheduled-damage-zone-batch shape) or 'ApplyStatus' (lands a condition on each occupant, the Stinking Cloud save-or-condition shape — admits ApplyStatus to the subject-bound autonomy fence). |\n\n###### `effect.write.schedule`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `frequency_ms` | no | number | | Fiction-millisecond period between pulses. Default 6000 (fires every round). |\n| `repeats` | no | number | | How many rounds the pulse re-fires — bounds the duration (a subject-bound actor-reaching autonomy job MUST be bounded, server fence + MF-VAL-249). Default 10 (SRD's common 'concentration up to 1 minute' → 10 one-tick rounds). |\n| `requires_subject_alive` | no | boolean | | Whether the zone dissipates if the caster's entity is removed. Default false (the zone lingers its full duration regardless — the SRD Cloudkill/Moonbeam behaviour). Set true for a concentration-style hazard that ends with its caster. |\n| `source` | no | string | | The cancel-by-source/provenance key stamped on the runtime autonomy_job — author with the {Actor}/{ResponsibleSubject}/{tick} placeholders (ADR-0055 D-3), e.g. '<bundle>/<id>/{Actor}/{tick}', so the scheduler interpolates a PER-CAST-UNIQUE job_id at cast time (two concurrent casts never collide on the autonomy_job PK). Omit for the compose.ts legacy default ('srd/<id>', UNqualified by `bundle` — pass this explicitly for any non-'srd' bundle). |\n\n###### `effect.write.tallies[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `delta` | no | string | | Clock only: with `predicate` set, the increment amount (default '1') — the expression becomes 'cond(<predicate>, <delta>, 0)'. With `predicate` OMITTED, this is the WHOLE raw delta_source expression verbatim (the scratch-cell-capture idiom — see `predicate`'s own doc). Required when `predicate` is omitted. |\n| `predicate` | no | string | | Clock only: an authored Bool DSL expression — when set, this ordinal's delta_source becomes 'cond(<predicate>, <delta ?? \"1\">, 0)', the increment-on-condition idiom every tally-split ordinal needs (e.g. \"actor.stat('death_save_last_roll') >= 10\" to tally a success). Omit for a raw (non-conditional) `delta` expression instead — the scratch-cell-capture idiom a clock's FIRST ordinal often needs (e.g. \"d20 - actor.stat('death_save_last_roll')\", a set-via-delta that lands exactly on a fresh roll). Exactly one of `predicate`/`delta` must convey the real expression: set `predicate` alone for a plain +1-on-condition tally, `delta` alone for a raw capture, or both when the increment amount is not 1. |\n| `resource` | yes | string | | Clock only: the resource_definitions id this tally ordinal's bare ModifyResource(actor='Actor',...) reads/writes — must already resolve (workspace, live, or the active target); this PoC does not auto-create tally resources (use spellkave_define_resource first, same posture as effect.write.resource). |\n\n###### `effect.write.thresholds[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `apply_status` | no | string | | Clock only: the condition_definitions id this threshold lands on 'Actor' when `when` is true — must already resolve (workspace, live, or the active target); this PoC does not auto-create it (use spellkave_define_condition first). Exactly one of `apply_status`/`remove_condition` must be set per threshold entry. |\n| `remove_condition` | no | string | | Clock only: the condition_definitions id this threshold REMOVES from 'Actor' when `when` is true (the inverse of `apply_status`) — must already resolve. Exactly one of `apply_status`/`remove_condition` must be set per threshold entry. |\n| `remove_condition_source` | no | string | | Clock + `remove_condition` only: an exact source key to match (RemoveCondition's `source_match: Exact`). Omit for the default 'Any' — source-agnostic removal. |\n| `when` | yes | string | | Clock only: this threshold ordinal's own ForEachActorInRadius(node_ball, ball_radius 0) predicate_source, evaluated against the POST-tally state (this ordinal runs after every `tallies` entry) — e.g. \"actor.stat('death_save_failures') >= 3\", or an OR-branched short-circuit like a nat-20 immediate-stabilize check. A bare ApplyStatus/RemoveCondition carries no delta/predicate of its own to fold a `cond(..)` into, so this wrapper's own predicate_source is the only way to gate one — safe here specifically because every `tallies` ordinal already wrote 'Actor' alone (never a co-located bystander). |\n\n#### `offered_when`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `range_m` | no | number | | Affordance range_m (metres, ADR-0053 metric embedding) — author via the ft feet→metric helper (e.g. ft(5) for standard 5-ft melee reach), never a raw metre literal. Omit for the default range_m=0 (touch/same-node only). |\n| `reach` | yes | \"same_node\" | | Closed PoC enum — only 'same_node' is wired (its own range_m default, see `range_m`). |\n| `target` | no | \"self\" \\\\| \"place\" | | US9 — a target concept beyond 'ForEachActorInRadius hits others in a radius'. Omit for the legacy default (`effect.write.primitive` must be 'ModifyResource', wrapped in `effect.shape`'s ForEachActorInRadius — unaffected by this param). 'self': the acting actor targets ITSELF (action_definitions.self_eligible=true, mirrors srd/cast_find_familiar's self_eligible=true) — MF-VAL-263 then requires SOME ModifyResource in the on_success chain; `effect.write.primitive: 'ModifyResource'` satisfies it on its own, but 'Spawn'/'Inscribe' need an explicit `cost` (else this tool errors BEFORE validation with a hint). 'place': the write lands at the actor's OWN place_node with NO target-actor selection and NO self-targeting at all (self_eligible stays false — MF-VAL-263 never engages, so no `cost` pool is required or accepted); only 'Spawn'/'Inscribe' support 'place' (no fixture idiom modifies a resource with neither an actor nor a self target). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"firebloom\",\n \"grant_to\": \"aoe_blast/caster_1\",\n \"offered_when\": {\n \"reach\": \"same_node\"\n },\n \"action_class\": \"spell\",\n \"effect\": {\n \"primitive\": \"ForEachActorInRadius\",\n \"shape\": {\n \"id\": \"core/area/node_ball\",\n \"radius\": 0\n },\n \"per_target_gate\": \"d20 < 13\",\n \"write\": {\n \"primitive\": \"ModifyResource\",\n \"resource\": \"aoe_blast/hp\",\n \"delta\": \"-d6\"\n }\n },\n \"description\": \"Firebloom: AoE blast, flat DEX save DC13 negates, 1d6 damage on a failed save.\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 10,\n \"diagnostics\": []\n}\n```\n\n## `spellkave_define_entity_type`\n\n**Define Entity Type (verb)** — execution mode `sequential`.\n\nAuthor ONE entity_definitions catalog blueprint (+ its entity_definition_tag/initial_state/initial_capability/initial_condition/initial_containment/initial_equipment satellites) in a single call — the 53%-of-authored-rows cluster, folding what would otherwise be a per-tag/per-seed spellkave_write_rows call each. Self-scaffolds the [[bundles]] header if `bundle` has none yet. This authors the CATALOG blueprint only (placement tools instantiate entities that may reference it via entity_def). workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + EVERY satellite wholesale (fewer tags/seeds on a re-run means the stale ones are gone, not left behind). initial_containment/initial_equipment are structural (each spawns a child instance), not a flat-value copy like the other three satellites — the equipment/containment graph is cycle-checked server-side (MF-VAL-314) at admission, not re-validated here.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `affordance_seed_id` | no | string | | entity_definitions.affordance_seed_id (default ''). |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | entity_definitions.description (first-class column). PLAYER-REACHABLE: `readAuthorizedItemDetail` (@spellkave/sdk item_detail reader) falls back to this column whenever a placed instance has no per-instance `entity_description` row, so it must hold only what any observer may plausibly know on sight — never stat-block numbers, hidden mechanics, or spoilers. Stat-block/rules prose belongs in an `srd.text` `metadata_attachments` row instead, which keeps it out of description-reading tool responses — but that is not an access-control boundary today (audience enforcement doesn't exist yet, see metadata-attachments.md). |\n| `display_name` | no | string | | entity_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `grants_capability_while_equipped` | no | string | | CSV capability ids granted to the bearer while it equips an entity of this definition (default ''). |\n| `grants_capability_while_present_in_location` | no | string | | CSV capability ids granted to entities at locations where an entity of this definition is present (default ''). |\n| `id` | yes | string | | Local entity_def_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='item/sword' -> 'core/item/sword'). May itself contain '/' for sub-namespacing (matches the corpus convention, e.g. 'npc/caravan', 'class/barbarian'). |\n| `initial_capabilities` | no | array<object> | | entity_definition_initial_capability rows — innate capability grants. |\n| `initial_conditions` | no | array<object> | | entity_definition_initial_condition rows — conditions born active on every placed instance. |\n| `initial_containment` | no | array<object> | | entity_definition_initial_containment rows — each spawns a child instance carried loose (no equipment slot) on every placed/spawned instance. Structural, not a flat-value copy; MF-VAL-314 cycle-checked server-side at admission (not duplicated here). |\n| `initial_equipment` | no | array<object> | | entity_definition_initial_equipment rows — each spawns a child instance and equips it into the named slot on every placed/spawned instance. Structural, not a flat-value copy; MF-VAL-314 cycle-checked server-side at admission (not duplicated here). |\n| `initial_states` | no | array<object> | | entity_definition_initial_state rows — seeded onto every placed instance at admission/spawn. |\n| `lineage_id` | no | string | | entity_definitions.lineage_id (default ''). |\n| `on_consume_consequence_id` | no | string | | entity_definitions.on_consume_consequence_id (default ''). |\n| `on_destroy_consequence_id` | no | string | | entity_definitions.on_destroy_consequence_id (default ''). |\n| `slot_compatibility_predicate` | no | string | | Closed three-form slot-compatibility grammar (not spellkave-dsl); '' or 'true' means any slot, 'false' means none, slot_id == <quoted id> means only that slot. |\n| `stackable` | no | boolean | | entity_definitions.stackable — may authored instances use quantity>1 (default false). |\n| `tags` | no | array<string> | | One entity_definition_tag row per tag. |\n\n#### `initial_capabilities[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `capability` | yes | string | | capability_definitions capability_id granted unconditionally to every placed instance of this entity_def (an entity_definition_initial_capability seed row). |\n| `extent_kind_ref` | no | string | | Authored extent kind for this innate grant; preserve the same paired kind/ref contract as actor_capabilities. Omit both fields for an unscoped grant. |\n| `extent_ref` | no | string | | Extent reference paired with extent_kind_ref, copied to every spawned instance's innate capability grant. |\n\n#### `initial_conditions[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `condition` | yes | string | | condition_definitions condition_definition_id seeded onto every placed instance of this entity_def. |\n| `duration_ticks` | no | number | | Ticks until auto-expiry; 0 or omitted = permanent (schema default 0). |\n\n#### `initial_containment[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `contained_entity_def_id` | yes | string | | entity_def_id of the child instance spawned and carried loose (entity_containment, slot_id = '') on every placed/spawned instance of this entity_def (an entity_definition_initial_containment seed row). Structural, not a flat-value copy: the child's OWN initial_* seeds apply to it first (recursion). The containment/equipment graph is cycle-checked server-side (MF-VAL-314) at admission. |\n| `quantity` | no | number | | Stack-vs-instance-count rule (ADR-0028 D-6): when the contained definition is stackable, ONE instance is spawned carrying this as its stack count; otherwise this many separate instances are spawned. Default 1. |\n\n#### `initial_equipment[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `equipped_entity_def_id` | yes | string | | entity_def_id of the child instance spawned and equipped into `slot_id` on every placed/spawned instance of this entity_def (an entity_definition_initial_equipment seed row) — a child, one slot, implicit quantity 1. The containment/equipment graph is cycle-checked server-side (MF-VAL-314) at admission, and the equipped definition's slot_compatibility_predicate is checked at commit (MF-VAL-311/-312/-313). |\n| `slot_id` | yes | string | | equipment_slot_definitions slot_id the spawned child is equipped into. |\n\n#### `initial_states[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `state` | yes | string | | object_state_definitions OR resource_definitions state_id (MF-VAL-253 accepts either catalog) seeded as an object_state row onto every placed instance of this entity_def. Visibility caveat: a resource-only id has no default_visibility authoring surface, so the seeded row falls back to Public — author a parallel object_state_definitions row when Local/Hidden visibility is wanted. |\n| `value_bool` | no | boolean | | Bool carrier (schema default true when neither value_int nor value_text is set). Carrier precedence at commit: value_int > value_text > value_bool. |\n| `value_int` | no | number | | Int carrier — highest commit precedence. |\n| `value_text` | no | string | | Text carrier — commit precedence between value_int and value_bool. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"npc/goblin_scout\",\n \"display_name\": \"Goblin Scout\",\n \"tags\": [\n \"npc\",\n \"hostile\"\n ],\n \"initial_capabilities\": [\n {\n \"capability\": \"core/walk\"\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": false,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-254\",\n \"severity\": \"fatal\",\n \"message\": \"definition-level seed references capability_definition 'core/walk', which no manifest row provides\",\n \"path\": \"entity_definition_initial_capability.capability_id\",\n \"param\": \"initial_capabilities[0].capability_id\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"entity_definition_tag row 'aoe_blast/npc/goblin_scout' has flat tag 'hostile' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"entity_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"entity_definition_tag row 'aoe_blast/npc/goblin_scout' has flat tag 'npc' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"entity_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"entity_definition_tag row 'aoe_blast/npc/goblin_scout' has tag 'hostile' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"entity_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"entity_definition_tag row 'aoe_blast/npc/goblin_scout' has tag 'npc' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"entity_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n }\n ]\n}\n```\n\n## `spellkave_define_roll_table`\n\n**Define Roll Table (verb)** — execution mode `sequential`.\n\nAuthor ONE roll_tables row + its ordered roll_table_entries (+ roll_table_tag/roll_table_entry_tag satellites) in a single call. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + EVERY satellite wholesale (fewer/reordered entries on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated row (roll_table_entries excepted — that row kind carries no bundle_id column). Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | roll_tables.description (first-class column). |\n| `display_name` | no | string | | roll_tables.display_name. Omit to derive a title-cased `id` (smart default). |\n| `entries` | yes | array<object> | | One row per entry, in AUTHORED order. `authored_order` (1-based) and `roll_table_entry_id` ('<roll_table_id>:<authored_order>') are BOTH derived from array position + the parent id, matching the corpus convention verbatim — never hand-specified. |\n| `id` | yes | string | | Local roll_table_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='d20' -> 'core/d20'). |\n| `result_kind` | yes | string | | roll_tables.result_kind — an open string (the corpus already uses more than one value, e.g. 'int', 'outcome_graph'); no closed PoC enum. |\n| `tags` | no | array<string> | | One roll_table_tag row per tag. |\n\n#### `entries[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `result_ref` | yes | string | | roll_table_entries.result_ref — the drawn value/reference text for this entry. |\n| `tags` | no | array<string> | | One roll_table_entry_tag row per tag, for THIS entry. |\n| `weight` | no | number | | roll_table_entries.weight (default 1). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"loot/scout_drops\",\n \"result_kind\": \"int\",\n \"entries\": [\n {\n \"result_ref\": \"1d4 gold\",\n \"weight\": 3\n },\n {\n \"result_ref\": \"a bent dagger\",\n \"weight\": 1\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": false,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-210\",\n \"severity\": \"fatal\",\n \"message\": \"roll_table_entry 'aoe_blast/loot/scout_drops:1' parent roll_table 'aoe_blast/loot/scout_drops' has result_kind='int' but result_ref '1d4 gold' is not parseable as i64\",\n \"path\": \"roll_table_entries.result_ref\",\n \"param\": \"entries[0].result_ref\"\n },\n {\n \"code\": \"MF-VAL-210\",\n \"severity\": \"fatal\",\n \"message\": \"roll_table_entry 'aoe_blast/loot/scout_drops:2' parent roll_table 'aoe_blast/loot/scout_drops' has result_kind='int' but result_ref 'a bent dagger' is not parseable as i64\",\n \"path\": \"roll_table_entries.result_ref\",\n \"param\": \"entries[1].result_ref\"\n }\n ]\n}\n```\n\n## `spellkave_define_condition`\n\n**Define Condition (verb)** — execution mode `sequential`.\n\nAuthor ONE condition_definitions row (+ condition_definition_tag satellites) in a single call, optionally ALSO authoring the condition_remove_policy_definitions/stacking_discipline_definitions vocabulary rows it references (shared cross-condition vocabulary — upserted by their OWN id, never duplicated, mirroring the server's own upsert-in-place discipline for these two kinds, ADR-0085) and any modifier_templates (+ modifier_template_tag) it needs (also upserted by their own modifier_template_id). DSL-bearing fields (gate_predicate_source, hooks[]._source, remove_predicate_source, *_outcome_source, predicate_source, modifier_expression_source) are passed through as free text verbatim — single-parse discipline is the server's job. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the condition row + its tag satellites wholesale (fewer tags on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | condition_definitions.description (first-class column). |\n| `display_name` | no | string | | condition_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `gate_predicate_source` | no | string | | DSL Bool expression gating condition-triggered modifier application (default ''). |\n| `grants_capability_while_active` | no | array<string> | | Capability ids GRANTED to the bearer while this condition is active (default []). Enforced in capability_ids_for_actor; use this rather than a status when the thing granted is an ability to act, because affordance_template.capability_id is a structural gate a status cannot reproduce. |\n| `hooks` | no | array<object> | | condition_definitions.hooks[]. |\n| `id` | yes | string | | Local condition_definition_id stem; full id '<bundle>/<id>'. |\n| `implies` | no | array<string> | | condition_definitions.implies — cascade edges (each id is ALSO applied when this condition is applied). |\n| `modifier_template_id` | no | string | | condition_definitions.modifier_template_id — REFERENCE an existing modifier (default ''). Omit when `modifiers` has EXACTLY one entry (auto-wired to it); REQUIRED when `modifiers` has more than one entry (which one is the FK, otherwise ambiguous). |\n| `modifiers` | no | array<object> | | modifier_templates rows (+ their modifier_template_tag satellites) authored in this call. |\n| `observable` | no | boolean | | condition_definitions.observable (default true). |\n| `remove_policy` | no | object | | |\n| `remove_time_policy` | no | string | | condition_definitions.remove_time_policy — REFERENCE an existing policy id (default 'core/remove_policy/independent_lifetime'). Pass `remove_policy` instead to ALSO author the row. |\n| `stacking` | no | object | | |\n| `stacking_rule` | no | string | | condition_definitions.stacking_rule — REFERENCE an existing discipline id (default 'core/stacking/single'). Pass `stacking` instead to ALSO author the row. |\n| `suppresses_capability_while_active` | no | array<string> | | Capability ids SUPPRESSED on the bearer AS AN ACTOR while this condition is active (default []). Suppression beats a grant of the same id. Applies to the bearer's own attempts to act only — it never makes the bearer an illegal TARGET, so a spell like Speak with Dead stays authorable against a corpse that cannot itself speak. |\n| `tags` | no | array<string> | | One condition_definition_tag row per tag. |\n\n#### `hooks[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `detail_filter_source` | no | string | | Inline-DSL Bool sub-expression gating which event instances this hook fires for. Passed through verbatim (single-parse discipline is the server's job, not this verb's). |\n| `event_kind` | yes | string | | condition_definitions.hooks[].event_kind, e.g. 'Layer2.ApplyConsequence'. |\n| `expression_source` | no | string | | Inline-DSL Int sub-expression evaluated when the hook fires. Passed through verbatim. |\n\n#### `modifiers[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `applies_to` | yes | string | | modifier_templates.applies_to — the composition-axis vocabulary id (an authored modifier_target_definitions row, e.g. 'ResolutionCheck'; open string). |\n| `delta_kind` | no | \"Advantage\" \\\\| \"Disadvantage\" \\\\| \"Plus\" \\\\| \"Times\" \\\\| \"FlatSet\" \\\\| \"Replace\" | | modifier_templates.delta_kind (default 'Plus') — the validator's OWN closed vocabulary (MF-VAL-243), not a PoC-narrower enum. |\n| `display_name` | no | string | | modifier_templates.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | Local modifier_templates id stem; full id '<bundle>/<id>'. |\n| `modifier_expression_source` | yes | string | | DSL expression producing the modifier's magnitude. |\n| `predicate_source` | no | string | | DSL Bool gate; '' (default) means always-active. |\n| `priority` | no | number | | modifier_templates.priority (default 0). |\n| `replace_template_id` | no | string | | Required (by the validator) when delta_kind='Replace' — the modifier_template id this one replaces. |\n| `tags` | no | array<string> | | One modifier_template_tag row per tag, for THIS modifier. |\n\n#### `remove_policy`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `display_name` | no | string | | condition_remove_policy_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | The FULL condition_remove_policy_definitions policy_id (cross-bundle vocabulary — e.g. 'core/remove_policy/independent_lifetime'; NOT bundle-prefixed by this verb, unlike `id`). |\n| `remove_predicate_source` | yes | string | | DSL Bool expression; the removal path evaluates this instead of branching on the policy id. |\n\n#### `stacking`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `display_name` | no | string | | stacking_discipline_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `expires_at_tick_outcome_source` | yes | string | | Int-valued DSL expression; -1 means 'leave the existing expiry unchanged'. |\n| `id` | yes | string | | The FULL stacking_discipline_definitions discipline_id (cross-bundle vocabulary — e.g. 'core/stacking/single'; NOT bundle-prefixed by this verb, unlike `id`). |\n| `stack_count_outcome_source` | yes | string | | Int-valued DSL expression over the existing row state (facts: stack_count, expires_at_tick, world_tick). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"burning\",\n \"description\": \"Ongoing fire damage from a failed Firebloom save.\",\n \"tags\": [\n \"debuff\",\n \"damage_over_time\"\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 3,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\",\n \"param\": \"tags[1].tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\",\n \"param\": \"tags[1].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n }\n ],\n \"condition_definition_id\": \"aoe_blast/burning\"\n}\n```\n\n## `spellkave_define_niche`\n\n**Define Niche (verb)** — execution mode `sequential`.\n\nAuthor ONE niche_definitions row (+ niche_definition_tag satellites, + spatial_niche_attachments binding it to place nodes/edges) in a single call. Self-scaffolds the [[bundles]] header if `bundle` has none yet. NOTE: an attachment referencing a BOOTSTRAP-seeded niche (one with no niche_definitions row of its own in any bundle, e.g. core's 'core/passable_portal') cannot be authored through THIS verb (it always emits a niche_definitions parent row) — use spellkave_write_rows for a standalone spatial_niche_attachments row in that case. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + EVERY satellite wholesale (fewer tags/attachments on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `attachments` | no | array<object> | | spatial_niche_attachments rows binding this niche to place nodes/edges. |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | yes | string | | niche_definitions.description — REQUIRED (unlike every OTHER verb's optional `description?`): NicheDefinitionRow kept its own PRE-EXISTING required description column through the description-column decision (no `#[serde(default)]` in the schema); omitting it would author an invalid row, not merely a less-documented one. |\n| `display_name` | no | string | | niche_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | Local niche_id stem; full id '<bundle>/<id>'. |\n| `predicate_source` | no | string | | DSL Bool predicate (default '' = trivially-true, matches any candidate target). |\n| `tags` | no | array<string> | | One niche_definition_tag row per tag. |\n\n#### `attachments[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `condition_bool` | no | boolean | | spatial_niche_attachments.condition_bool (default true). |\n| `ecological_invariant` | no | boolean | | spatial_niche_attachments.ecological_invariant (default false). |\n| `edge` | no | number | | spatial_niche_attachments.place_edge_id — a place_edge numeric id (0 is the SpacetimeDB 'every edge' wildcard convention, e.g. a global passable-portal gate). EXACTLY ONE of `node`/`edge`. |\n| `node` | no | string | | spatial_niche_attachments.place_node_id — an authored place_node id. EXACTLY ONE of `node`/`edge` must be set per attachment (the two authored attachment shapes the corpus actually uses). |\n| `visibility` | no | string | | spatial_niche_attachments.visibility (default 'Public'). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trap/plate\",\n \"description\": \"A pressure plate hidden at the arena fringe.\",\n \"tags\": [\n \"trap\"\n ],\n \"attachments\": [\n {\n \"node\": \"aoe_blast/arena/fringe\"\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 3,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has flat tag 'trap' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"niche_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has tag 'trap' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"niche_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n }\n ],\n \"niche_id\": \"aoe_blast/trap/plate\"\n}\n```\n\n## `spellkave_define_affordance`\n\n**Define Affordance (verb)** — execution mode `sequential`.\n\nverb-UX round 6: author ONE niche-triggered ENVIRONMENTAL affordance — an outcome_templates row + an affordance_templates row referencing an ALREADY-authored `niche_id`/`capability_id` — in a single call, with NO actor grant (contrast spellkave_define_behavior, which always binds a capability to a `grant_to` caster). The US5-7 live-dungeon pressure-plate trap shape: 'any actor holding an existing capability (e.g. core/walk) that steps onto an existing niche triggers this'. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES both rows wholesale.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `capability_id` | yes | string | | affordance_templates.capability_id — an ALREADY-authored capability_definitions id (workspace, live, or the active target, e.g. 'core/walk') this call never creates — the pre-existing capability any qualifying actor already holds (no NEW grant is authored by this call). |\n| `display_name` | no | string | | Overrides the derived title-cased `id` for BOTH the outcome and affordance rows. |\n| `id` | yes | string | | Local affordance key stem — derives template_id '<bundle>/<id>/affordance' and outcome_template_id '<bundle>/<id>/outcome'. |\n| `manipulation_action_id` | no | string | | outcome_templates.manipulation_action_id — executes a pre-authored action_definitions row instead (the darkness-consumer idiom, packages/spellkave-srd/src/author/author-darkness.ts's `act_in_dark`). Exactly ONE of `outcome_expression_source`/`manipulation_action_id` is required. |\n| `niche_id` | yes | string | | affordance_templates.niche_id — an ALREADY-authored niche_definitions id (workspace, live, or the active target, e.g. via spellkave_define_niche) this call never creates — the trigger surface (a trap/trigger niche, e.g. a pressure plate). |\n| `outcome_expression_source` | no | string | | outcome_templates.outcome_expression_source — invokes a pre-authored effect (e.g. \"invoke_outcome_graph('<bundle>/<id>/graph')\"). Exactly ONE of `outcome_expression_source`/`manipulation_action_id` is required — an affordance with neither would trigger nothing. |\n| `predicate_source` | no | string | | affordance_templates.predicate_source — the deterministic ELIGIBILITY gate for whether this affordance offers (e.g. a capability/state check like 'target.stat(\"srd/ac\") >= 1'). A stochastic comparison here (e.g. 'd20 >= 13') is treated as satisfied at materialise time and never gates offer — author dice on the action's resolution_predicate_source (resolution_mode = 'Stochastic') instead. Omit for an ungated trigger (predicate_bool = true). |\n| `range_m` | no | number | | affordance_templates.range_m (ADR-0053 metric embedding). Default 0. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trap/plate\",\n \"niche_id\": \"aoe_blast/trap/plate\",\n \"capability_id\": \"aoe_blast/trigger/plate\",\n \"manipulation_action_id\": \"aoe_blast/cast_firebloom\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 2,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has flat tag 'trap' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"niche_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has tag 'trap' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"niche_definition_tag.tag\"\n }\n ],\n \"outcome_template_id\": \"aoe_blast/trap/plate/outcome\",\n \"template_id\": \"aoe_blast/trap/plate/affordance\"\n}\n```\n\n## `spellkave_define_capability`\n\n**Define Capability (verb)** — execution mode `sequential`.\n\nAuthor ONE capability_definitions row (+ capability_definition_tag satellites) in a single call — the verb-UX round's named missing bare-vocabulary verb. Self-scaffolds the [[bundles]] header if `bundle` has none yet. capability_definitions is referenced from MANY affordance_templates/action_definitions rows (not satellite-owned by a single parent) — those stay on spellkave_write_rows/spellkave_define_behavior, whichever fits the calling context. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + its tag satellite wholesale (fewer tags on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `actor_kind` | yes | string | | capability_definitions.actor_kind — an open string (the corpus already uses more than one value, e.g. 'entity', 'operator'); no closed PoC enum. |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `default_visibility` | no | string | | capability_definitions.default_visibility — the ADR-0120 read-visibility default concrete grants inherit unless overridden. Omit to default 'Public' (smart default — matches the schema's own `default_public` serde default). |\n| `description` | yes | string | | capability_definitions.description — REQUIRED (unlike every OTHER verb's optional `description?`): CapabilityDefinitionRow kept its own PRE-EXISTING required description column through the description-column decision (no `#[serde(default)]` in the schema); omitting it would author an invalid row, not merely a less-documented one (same carve-out as spellkave_define_niche's own required `description`). |\n| `display_name` | no | string | | capability_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | Local capability_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='walk' -> 'core/walk'). A handful of corpus capability ids are DELIBERATELY cross-namespace (e.g. 'frontier.apply_manifest' under bundle_id='core') — this verb always derives '<bundle>/<id>', so a cross-namespace id stays on spellkave_write_rows (mirrors spellkave_define_entity_type's own cross-namespace carve-out). |\n| `tags` | no | array<string> | | One capability_definition_tag row per tag. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trigger/plate\",\n \"actor_kind\": \"entity\",\n \"description\": \"Any entity that can trip the arena's hidden pressure plate.\",\n \"tags\": [\n \"trigger\"\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 2,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"tags[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n }\n ],\n \"capability_id\": \"aoe_blast/trigger/plate\"\n}\n```\n\n## `spellkave_define_consequence`\n\n**Define Consequence (verb)** — execution mode `sequential`.\n\nAuthor ONE consequence_templates row (+ its consequence_frame_writes satellites, in authored order) in a single call, with NO actor grant (contrast spellkave_define_behavior, which always binds its generated consequence to a `grant_to` caster's action cluster). Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + every consequence_frame_writes row wholesale (fewer frame_writes on a re-run means the stale ones are gone, not left behind).\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on the consequence_templates row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | consequence_templates.description (first-class column). |\n| `effect_ref` | no | string | | consequence_templates.effect_refs_csv — an already-authored effect_definitions id this consequence invokes (e.g. a scheduled-zone/summon effect). The corpus never joins more than one id here despite the column's '_csv' name — a single ref, not a real CSV list. Omit for a consequence with no effect_definitions reference. |\n| `frame_writes` | no | array<object \\\\| \"BreakPlaceSeal\"> | | consequence_frame_writes rows, in AUTHORED order — each a raw FrameWriteOp body object or the unit string BreakPlaceSeal (e.g. {Inscribe: {...}}, {ModifyResource: {...}}, {PickupTargetItem: {...}}), mirroring spellkave_write_rows' own untyped row shape (the closed Rust FrameWriteOp enum is never modeled in TypeBox here). `ordinal` (0-based) is derived from array position — never hand-specified. |\n| `id` | yes | string | | Local consequence_template_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='pickup/success' -> 'core/pickup/success'). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trap/plate/success\",\n \"frame_writes\": [\n {\n \"Inscribe\": {\n \"kind\": \"trap_triggered\",\n \"location_kind\": \"binding\",\n \"location_ref\": \"ActorSpatialRef\",\n \"payload_json\": \"{\\\"trap\\\":\\\"plate\\\"}\"\n }\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 2,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n }\n ],\n \"template_id\": \"aoe_blast/trap/plate/success\"\n}\n```\n\n## `spellkave_define_action`\n\n**Define Action (verb)** — execution mode `sequential`.\n\nAuthor ONE action_definitions row (+ action_definition_tag satellites) in a single call, with NO actor grant (contrast spellkave_define_behavior, which always binds its generated action to a `grant_to` caster). `required_capability` must already resolve (workspace, live, or the active target) — this verb never auto-creates it (use spellkave_define_capability first). Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row + its tag satellite wholesale.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on the action_definitions row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `cost_time_ms` | no | number | | action_definitions.cost_time_ms in fiction milliseconds. With spends_channel, omit or set 0 to spend one full channel pool; without a channel, 0 is unmetered. |\n| `description` | no | string | | action_definitions.description (first-class column). |\n| `display_name` | no | string | | action_definitions.display_name. Omit to derive a title-cased `id` (smart default). |\n| `id` | yes | string | | Local action_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='pickup' -> 'core/pickup'). |\n| `non_steering` | no | boolean | | Explicit author assertion that target effects are cooperative/non-steering and need no target claim. Omit/false for conservative automatic classification; marking a hostile effect true is a content bug. |\n| `on_failure` | no | string | | action_definitions.on_failure — the consequence_templates id applied on failure. Omit for none (schema default: empty string). |\n| `on_success` | yes | string | | action_definitions.on_success — the consequence_templates id (e.g. via spellkave_define_consequence) applied when this action resolves successfully. |\n| `reaction_eligibility` | no | string | | action_definitions.reaction_eligibility — a DSL predicate over a candidate reactor (§8.4 WHO axis). Omit for not-a-reaction-candidate (schema default: absent). |\n| `reaction_trigger` | no | string | | action_definitions.reaction_trigger — a DSL predicate over the triggering event (§8.4 WHAT axis). Omit to provoke on every co-located trigger (schema default: absent). |\n| `reaction_window_ms` | no | number | | action_definitions.reaction_window_ms. Omit for an implementation default when `reaction_eligibility` is set. |\n| `required_capability` | yes | string | | action_definitions.required_capability — an ALREADY-authored capability_definitions id (workspace, live, or the active target, e.g. via spellkave_define_capability) this call never creates. |\n| `resolution_mode` | no | \"Deterministic\" \\\\| \"Stochastic\" \\\\| \"Deferred\" | | action_definitions.resolution_mode. Omit for the schema default ('Deterministic'). |\n| `resolution_predicate_source` | no | string | | action_definitions.resolution_predicate_source — authored boolean DSL for Stochastic resolution. Omit for empty (Deterministic/Deferred). |\n| `resolution_scope` | no | string | | action_definitions.resolution_scope — open authored id selecting scoped actor-side roll modifiers. Omit for no narrow scope. |\n| `resumable` | no | boolean | | action_definitions.resumable — interrupted long-running progress is credited on the next matching promotion (same actor, action, target). Omit for the schema default (false). |\n| `self_eligible` | no | boolean | | action_definitions.self_eligible. Omit for the schema default (false). |\n| `self_only` | no | boolean | | action_definitions.self_only (ADR-0075). Omit for the schema default (false). |\n| `session_def_id` | no | string | | action_definitions.session_def_id. Omit for the schema default (empty string). |\n| `spends_channel` | no | string | | action_definitions.spends_channel — an open FK into economy_channel_definitions.id (action-economy budgeting). Omit for unmetered (schema default: absent). |\n| `tags` | no | array<string> | | One action_definition_tag row per tag. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trigger_plate\",\n \"required_capability\": \"aoe_blast/trigger/plate\",\n \"on_success\": \"aoe_blast/trap/plate/success\",\n \"display_name\": \"Trigger Pressure Plate\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n }\n ],\n \"action_id\": \"aoe_blast/trigger_plate\"\n}\n```\n\n## `spellkave_define_session`\n\n**Define Session (verb)** — execution mode `sequential`.\n\nAuthor ONE session_definitions row in a single call — the first-class shape for sessions: a long-running/timed solo session (smart defaults: turn_rule 'Sequential', visibility 'Public'; set round_duration_ms=6000 + a termination_pred for tick-paced expiry) or a combat encounter (point turn_scheduler_id / combat_grid_blueprint_id at already-authored rows — this verb never creates or ref-checks them; the validator's cross-row pass judges FKs at validate/apply). Busy policy (busy_allow_pred / busy_break_pred) governs what a busy participant may attempt; both absent = full block. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the row wholesale.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `auto_join_on_targeting` | no | boolean | | session_definitions.auto_join_on_targeting (ADR-0037 D-7). Omit for the schema default (false). |\n| `bundle` | no | string | | bundle_id stamped on the session_definitions row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `busy_allow_pred` | no | string | | session_definitions.busy_allow_pred — actions matching this DSL predicate (attempted action tags via target.has_tag(..), id via target.text('action_id')) stay ALLOWED while a participant is busy in this session. Omit for none (with busy_break_pred also absent: full block). |\n| `busy_break_pred` | no | string | | session_definitions.busy_break_pred — actions matching this predicate ABANDON the session (abort semantics: on_failure + progress record), then proceed. Omit for none. |\n| `combat_grid_blueprint_id` | no | string | | session_definitions.combat_grid_blueprint_id — FK into an ALREADY-authored combat_grid_blueprint row (ADR-0045/0052 tactical grid). Omit for no automatic grid (schema default: empty). |\n| `description` | no | string | | session_definitions.description (first-class column). |\n| `grid_edge_affordance_bindings_json` | no | string | | session_definitions.grid_edge_affordance_bindings_json. Omit for the schema default (empty). |\n| `grid_edge_affordance_template_id` | no | string | | session_definitions.grid_edge_affordance_template_id. Omit for the schema default (empty). |\n| `id` | yes | string | | Local session_def_id stem; the full id is '<bundle>/<id>' (e.g. bundle='core', id='long_running_action' -> 'core/long_running_action'). |\n| `initial_state` | no | string | | session_definitions.initial_state (JSON). Omit for the schema default (empty). |\n| `legal_moves_csv` | no | string | | session_definitions.legal_moves_csv — comma-separated move-template ids `r_session_move` accepts. Omit for the schema default (empty). |\n| `on_terminate` | no | string | | session_definitions.on_terminate — a consequence_templates id applied on 'completed' termination, before the originating action's own on_success (binding order). Omit for none (schema default: empty). |\n| `participants_pred` | no | string | | session_definitions.participants_pred. Omit for the schema default (empty; currently not validated at open — architecture Phase E/F). |\n| `round_duration_ms` | no | number | | session_definitions.round_duration_ms (ADR-0037 D-5). Omit for the schema default (0 = unbound). Set 6000 for a default-tick-paced session whose termination_pred should be re-evaluated every world tick (the `core/long_running_action` shape). |\n| `stakes_required` | no | string | | session_definitions.stakes_required. Omit for the schema default (empty). |\n| `termination_pred` | no | string | | session_definitions.termination_pred — DSL predicate evaluated after every turn advance; on match the session terminates 'completed'. For a time-bound session use \"world.tick - session.stat('opened_at') >= session.stat('promoted_duration_ticks')\". Omit for none (schema default: empty). |\n| `turn_eligibility_pred` | no | string | | session_definitions.turn_eligibility_pred (ADR-0143) — Bool DSL predicate evaluated per participant as `actor` when the turn advances; a false result skips that participant without removing it (it stays targetable and counted). Actor-subject reads only (MF-VAL-334), e.g. \"actor.status('<condition_id>') == false\" or a Bool macro. Omit to hand every participant the turn. |\n| `turn_rule` | no | string | | session_definitions.turn_rule. Omit for 'Sequential' (smart default — the only rule `r_session_open`/`r_advance_turn` schedule today; other values pass through verbatim). |\n| `turn_scheduler_id` | no | string | | session_definitions.turn_scheduler_id — FK into an ALREADY-authored turn_scheduler row (ADR-0037 D-3/D-4, e.g. a RolledOrder d20 initiative). Omit for the world-active scheduler (schema default: empty). |\n| `visibility_policy` | no | string | | session_definitions.visibility_policy. Omit for 'Public' (smart default). |\n| `winner_predicate` | no | string | | session_definitions.winner_predicate. Omit for the schema default (empty). |\n\n## `spellkave_define_action_verb`\n\n**Define Action Verb (verb)** — execution mode `sequential`.\n\nAuthor ONE action-verb chain — action_definitions + outcome_templates + affordance_templates + consequence_templates (+ optional consequence_frame_writes) — in a single call, with NO actor grant (contrast spellkave_define_behavior, which always binds its generated cluster to a `grant_to` caster). The composite fold for the action/affordance/outcome/consequence chain (executable finding): `required_capability`/`niche_id` must already resolve (workspace, live, or the active target) — this verb never auto-creates either (use spellkave_define_capability first; `niche_id` needs no niche_definitions row at all for the two common synthetic-niche shapes, see this verb's own file-header note). Omit `consequence.frame_writes` entirely for MF-VAL-222's own no-op consequence shape. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES all four rows + every satellite wholesale.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `accepts_global_storm` | no | boolean | | affordance_templates.accepts_global_storm — modder opt-in acknowledging this template's predicate classifies as Global. Default false. |\n| `affordance_capability_id` | no | string | | actor-carried-verbs D6: overrides affordance_templates.capability_id independently of action_definitions.required_capability — for the creature-carried-statblock shape, where the ACTION stays keyed on a shared discriminator (e.g. 'srd/action/attack', an initiative-watch read site) while the AFFORDANCE's actual admission gate is a per-creature capability (e.g. 'srd/creature/black-bear/action') granted only to that creature. An ALREADY-authored capability_definitions id (workspace, live, or the active target) this call never creates — same existence-check posture as `required_capability` (a non-empty value is checked; '' is not). Omit for the verb's original single-id posture (default: `required_capability`'s own value). |\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `communication_speech_act_id` | no | string | | sk-9ll.6: outcome_templates.communication_speech_act_id — when set, the generated outcome surfaces as a communication speech act (mirrors spellkave_define_behavior's own identical pass-through) while r_manipulate still EXECUTES the gated consequence normally. Omit for the legacy default: no speech-act framing. |\n| `composes` | no | array<string> | | sk-9ll.6: affordance_templates.composes — child affordance_template ids this template unrolls into on a successful manipulate (the action-composition slice, `r_manipulate`'s own composition unroll). Pass-through, verbatim, in AUTHORED order. Omit for the schema default (no composition, this verb's own consequence fires alone). |\n| `consequence` | no | object | | |\n| `consequence_id_suffix` | no | string | | sk-9ll.6: the local suffix qualifying the generated consequence_templates id (and `action_definitions.on_success`) as '<action_id>/<consequence_id_suffix>'. Omit for the legacy default 'success'. Raw write_rows chains this verb is meant to fold use several different suffixes here (e.g. 'consequence') — set this to match an existing convention instead of falling back to spellkave_write_rows. |\n| `cost_time_ms` | no | number | | action_definitions.cost_time_ms in fiction milliseconds. With spends_channel, omit or set 0 to spend one full channel pool; without a channel, 0 is unmetered. |\n| `description` | no | string | | action_definitions.description (first-class column). |\n| `display_name` | no | string | | Overrides the derived title-cased `id` for the action/outcome/affordance rows alike (mirrors spellkave_define_affordance's own shared display_name). Omit for the smart default . |\n| `id` | yes | string | | Local id stem every derived id qualifies against '<bundle>/<id>': action_id itself, plus '<action_id>/outcome' (outcome_templates), '<action_id>/affordance' (affordance_templates), and '<action_id>/success' (consequence_templates, also `action_definitions.on_success`) — matches both grounding call sites' own naming convention verbatim, never a caller override. |\n| `niche_id` | yes | string | | affordance_templates.niche_id. NOT existence-checked against niche_definitions (see this verb's own file-header note) — a bare entity_definition_tag value (e.g. 'creature') or the 'capability:<capability_id>' synthetic-niche convention are both LEGAL here despite authoring no niche_definitions row of their own, but a bare entity_definition_tag with no niche_definitions row resolves to the 'place' provider's fail-closed default (requires_spatial_attachment: true) and REJECTS every dispatch with attachment_presence — an actor-carried tag has no place attachment to satisfy it. Pair the tag with an explicit spellkave_write_rows niche_definitions row (provider = 'entity') whenever the niche is entity-provided, not place-attached. An authored niche_definitions id (via spellkave_define_niche) works too. |\n| `non_steering` | no | boolean | | Explicit author assertion that target effects are cooperative/non-steering and need no target claim. Omit/false for conservative automatic classification; marking a hostile effect true is a content bug. |\n| `on_failure` | no | string | | action_definitions.on_failure — the consequence_templates id applied on failure. Omit for none (schema default: empty string) — this verb only ever AUTHORS the on_success consequence, never an on_failure one (neither grounding call site needs one; author it separately, e.g. via spellkave_define_consequence, if wanted). |\n| `outcome_expression_source` | no | string | | outcome_templates.outcome_expression_source (playable-fighter-l1-20 D-1) — e.g. \"invoke_outcome_graph('<bundle>/<id>/graph')\" to ALSO fire a pre-authored outcome graph, in addition to this action's own `consequence` (independent, sequential — the action runs first, followed by the expression in the same binding context). Every prior corpus example (`srd/acid_arrow`, `srd/outcome_guard_state_branch`) sets this INSTEAD of `consequence` (an empty-consequence, graph-only action) — setting BOTH on this verb's own generated outcome row is new with this field, structurally supported (no validator or runtime exclusivity found), used to bolt a defeat-consequence (e.g. an XP credit) onto an action whose own damage/ condition writes are unchanged. Omit for '' (schema default) — today's byte-identical behavior. |\n| `outcome_id_suffix` | no | string | | sk-9ll.6: the local suffix qualifying the generated outcome_templates id as '<action_id>/<outcome_id_suffix>' (also `affordance_templates.outcome_template_id`). Omit for the legacy default 'outcome'. Raw write_rows chains this verb is meant to fold use several different suffixes here (e.g. 'hit') — set this to match an existing convention instead of falling back to spellkave_write_rows. |\n| `predicate_source` | no | string | | affordance_templates.predicate_source — the deterministic ELIGIBILITY gate for whether this affordance offers. A stochastic comparison here (e.g. 'd20 >= 13') is treated as satisfied at materialise time and never gates offer — use this verb's own resolution_predicate_source (with resolution_mode = 'Stochastic') for dice instead. Omit for an ungated trigger (predicate_bool = true) — mirrors spellkave_define_affordance's identical omit-for-ungated convention. |\n| `range_m` | no | number | | affordance_templates.range_m (ADR-0053 metric embedding). Default 0. |\n| `reaction_eligibility` | no | string | | action_definitions.reaction_eligibility — a DSL predicate over a candidate reactor (§8.4 WHO axis). Omit for not-a-reaction-candidate (schema default: absent). |\n| `reaction_trigger` | no | string | | action_definitions.reaction_trigger — a DSL predicate over the triggering event (§8.4 WHAT axis). Omit to provoke on every co-located trigger (schema default: absent). |\n| `reaction_window_ms` | no | number | | action_definitions.reaction_window_ms. Omit for an implementation default when `reaction_eligibility` is set. |\n| `required_capability` | no | string | | An ALREADY-authored capability_definitions id (workspace, live, or the active target, e.g. via spellkave_define_capability) this call never creates — reused for BOTH action_definitions.required_capability AND affordance_templates.capability_id (this verb's own grounding call sites always use the SAME id in both places), UNLESS `affordance_capability_id` overrides the affordance half (see that param). sk-9ll.6: omit (or pass '') for an UNGATED verb — some authored chains (e.g. an always-hit attack with no gating capability at all) need no capability row, matching the schema's own empty-string default; an empty value is never existence-checked — only a non-empty value still requires a matching capability_definitions row. |\n| `resolution_mode` | no | \"Deterministic\" \\\\| \"Stochastic\" \\\\| \"Deferred\" | | action_definitions.resolution_mode. Omit for the schema default ('Deterministic'). |\n| `resolution_predicate_source` | no | string | | action_definitions.resolution_predicate_source — authored boolean DSL for Stochastic resolution. Omit for empty (Deterministic/Deferred). |\n| `resolution_scope` | no | string | | action_definitions.resolution_scope — open authored id selecting scoped actor-side roll modifiers. Omit for no narrow scope. |\n| `self_eligible` | no | boolean | | action_definitions.self_eligible. Omit for the schema default (false). |\n| `self_only` | no | boolean | | action_definitions.self_only (ADR-0075). Omit for the schema default (false). |\n| `session_def_id` | no | string | | action_definitions.session_def_id. Omit for the schema default (empty string). |\n| `spends_channel` | no | string | | action_definitions.spends_channel — an open FK into economy_channel_definitions.id (action-economy budgeting). Omit for unmetered (schema default: absent). |\n| `spends_channel_placement` | no | \"affordance\" \\\\| \"action\" \\\\| \"both\" | | sk-9ll.6: where a set `spends_channel` value is written. Default 'both' (this verb's original mirrored behavior) — the server reads `spends_channel` off BOTH rows for DIFFERENT purposes: an on-turn action reads the resolved affordance template, while an off-turn reaction uses the originating action definition. A reaction action with no action-row spends_channel is UNMETERED (free). Pass 'affordance' to write it only on affordance_templates (a non-reaction, on-turn-only verb where the action-row copy is genuinely dead), or 'action' to write it only on action_definitions. Ignored when `spends_channel` itself is omitted. |\n| `tags` | no | array<string> | | One action_definition_tag row per tag. |\n\n#### `consequence`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `description` | no | string | | consequence_templates.description (first-class column). |\n| `effect_ref` | no | string | | consequence_templates.effect_refs_csv — an already-authored effect_definitions id this consequence invokes. Omit for a consequence with no effect_definitions reference (the common case for a check-shaped action). |\n| `frame_writes` | no | array<object \\\\| \"BreakPlaceSeal\"> | | consequence_frame_writes rows, in AUTHORED order — each a raw FrameWriteOp body object or the unit string BreakPlaceSeal, mirroring spellkave_define_consequence's own `frame_writes` param verbatim. Omit entirely for MF-VAL-222's own documented no-op shape: a manipulation-dispatchable action needs a non-empty `on_success`, and a consequence_templates row with NO frame_writes at all is the validator-sanctioned way to satisfy that with no actual effect (both this verb's grounding call sites use exactly this shape for most of their generated checks). |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"id\": \"trap/plate/inspect\",\n \"required_capability\": \"aoe_blast/trigger/plate\",\n \"niche_id\": \"aoe_blast/trap/plate\",\n \"display_name\": \"Inspect Pressure Plate\",\n \"predicate_source\": \"target.state(\\\"aoe_blast/plate_disarmed\\\") == false\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 4,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has flat tag 'trap' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"niche_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has tag 'trap' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"niche_definition_tag.tag\"\n }\n ],\n \"action_id\": \"aoe_blast/trap/plate/inspect\",\n \"outcome_template_id\": \"aoe_blast/trap/plate/inspect/outcome\",\n \"template_id\": \"aoe_blast/trap/plate/inspect/affordance\",\n \"consequence_template_id\": \"aoe_blast/trap/plate/inspect/success\"\n}\n```\n\n## `spellkave_define_bundle`\n\n**Define Bundle (deliberate [[bundles]] header)** — execution mode `sequential`.\n\nAuthor (or upsert) the workspace's own `[[bundles]]` header row DELIBERATELY — the first-class alternative to every other write verb's silent `depends_on: [\"core\"]` auto-scaffold, named by srd-cc executable finding (ledger/findings.md). `depends_on` is REQUIRED and explicit (pass [] for a foundational bundle) — there is no default, unlike the casual auto-scaffold. workspace idempotency: re-authoring the SAME `bundle_id` REPLACES the header row (changed params land; an unchanged re-run is a no-op). Does NOT touch `context.defaultBundle` — combine this verb with a host-side `context.defaultBundle` set to the same id so later calls omit `bundle`. The generic spellkave_write_rows escape hatch (kind: \"bundles\") remains available for raw row access.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `author` | no | string | | bundles.author (default 'spellkave-verb-tools'). |\n| `bundle_id` | yes | string | | bundles.bundle_id — the bundle's own id (e.g. 'srd', 'core'). This verb authors the [[bundles]] header row itself, so there is no separate `bundle` scoping param the way other define_* verbs have: the row being defined IS the bundle. |\n| `default_extent_params_json` | no | string | | bundles.default_extent_params_json — the params_json paired with default_extent_shape_id (e.g. '{\"extent_m\": 9}' for core/area/cube). Only meaningful alongside default_extent_shape_id. |\n| `default_extent_shape_id` | no | string | | bundles.default_extent_shape_id (place-node-extent D-2): the shape a place_node in this bundle resolves its extent from when it authors none of its own (an area_shape_definition.shape_id reference, e.g. 'core/area/cube'). Omit to leave the bundle without a default — every place_node then MUST author its own explicit extent or fail admission. |\n| `depends_on` | yes | array<string> | | bundles.depends_on — REQUIRED and explicit on purpose (srd-cc executable finding): deliberateness is the whole point of this verb over the auto-scaffold every other write verb falls back to (which silently defaults to ['core']). Pass [] for a foundational, drop-in-identity bundle (mirroring core's own depends_on = []), or the real dependency list otherwise. |\n| `description` | no | string | | Sets the generated bundles row's own `description` column. |\n| `display_name` | no | string | | bundles.display_name. Omit to derive a title-cased `bundle_id` (smart default). |\n| `version` | no | string | | bundles.version (default '1.0.0'). |\n\n## `spellkave_define_trace_kind`\n\n**Define Trace Kind (verb)** — execution mode `sequential`.\n\nAuthor ONE trace_kind_definitions row (+ optional place_node_traces satellites placing that kind at already-authored place nodes as standing, ambient traces) in a single call. Self-scaffolds the [[bundles]] header if `bundle` has none yet. workspace idempotency: re-authoring the SAME bundle+id REPLACES the parent row + every `places[]` satellite wholesale (fewer places on a re-run means the stale ones are gone, not left behind). Both `node_id` and `trace_kind_id` are validated at commit (sk-9ll.8): an unknown place_node or an unregistered trace kind now fails the commit instead of silently defaulting.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on every generated row. Omit to fall back to `context.defaultBundle` (smart default). |\n| `description` | no | string | | trace_kind_definitions.description — human-readable, for authors and operator tooling. Default ''. |\n| `id` | yes | string | | Local trace-kind id stem; full id '<bundle>/<id>'. |\n| `location_kinds` | no | string | | trace_kind_definitions.location_kinds — comma-joined registered scopes this kind can attach to (e.g. \"place_node\", or \"place_node,location_definition\"). Default 'place_node' — the scope every corpus trace kind uses today, and the only scope `places[]` (below) can target. |\n| `perceptible_for_ticks` | no | number | | trace_kind_definitions.perceptible_for_ticks — how many ticks after inscription this kind stays admissible to an ARRIVING observer (ADR-0040 seam B). Omit for unbounded (a standing mark — footprints, a slime trail, a scorch); 0 = perceptible only at the moment of inscription (an EVENT, not a mark — bead sk-n16). |\n| `places` | no | array<object> | | place_node_traces rows binding this trace kind to already-authored place nodes as a standing, ambient trace. Omit to author only the vocabulary. |\n| `schema_json` | no | string | | trace_kind_definitions.schema_json — canonical JSON schema for the trace payload (flat object mapping a required key to its type name, '?' suffix marks it optional, e.g. '{\"text\":\"string\",\"addressee\":\"integer?\"}'). Default '' (no contract — most trace kinds carry no structured payload). |\n\n#### `places[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `node` | yes | string | | place_node_traces.node_id — an already-authored place_node id (workspace, live, or the active target) this call never creates. Rejected at commit if it does not resolve to a place_node (sk-9ll.8: no more silent fallback to bundle 'core'). |\n\n## `spellkave_set_metadata`\n\n**Set Metadata** — execution mode `sequential`.\n\nSet open metadata with one flat target/key/value update or an explicit atomic updates batch. target 'manifest' replaces one root metadata key, target 'namespace' registers one namespace, and target {kind, ref} upserts one object annotation. Attachment identity follows live admission: target_kind + target_ref + namespace + bundle_id; source and payload are replaced on a repeat call. The shared validator owns namespace payload semantics and admitted target kinds.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `audience` | no | string | | Singleton attachment form: registers an absent namespace in this atomic call; never defaults. |\n| `bundle` | no | string | | Owning bundle for namespace and attachment updates. Omit to use context.defaultBundle; manifest updates need none. |\n| `description` | no | string | | Singleton attachment form: optional description when this call registers the namespace. |\n| `key` | no | string | | Singleton form: the top-level [metadata] key, or the metadata namespace for a registration or attachment. |\n| `source` | no | string | | Attachment source for the singleton attachment form; defaults to 'manifest'. |\n| `target` | no | \"manifest\" \\\\| \"namespace\" \\\\| object | | Singleton form: 'manifest' for a top-level [metadata] key, 'namespace' to register a namespace, or {kind, ref} to attach metadata to an admitted target. Omit when passing updates[]. |\n| `updates` | no | array<object \\\\| object \\\\| object> | | Explicit atomic batch. Do not combine with singleton target/key/value fields; every update is validated before anything persists. |\n| `value` | no | value | | Singleton form: a JSON-compatible scalar, array, or object for target 'manifest'; {audience, description?} for target 'namespace'; an open metadata object for an attachment target. |\n\n## `spellkave_write_rows`\n\n**Write Rows (generic escape hatch)** — execution mode `sequential`.\n\nThe generic long-tail authoring verb : write one or more rows of ANY Manifest row kind not covered by the narrower verbs — kernel/substrate content (extent kinds, conditions, modifiers, niches, roll tables, action-economy scheduling, metadata namespaces,...) has no narrative-authoring shape a spell/place/spawn verb was ever meant to fit. `kind` is validated against the ACTUAL schema surface at call time (never a hand-maintained list) — an unsupported kind fails loudly naming the valid set. Rows are merged into the scratch bundle and re-validated whole (merge → validate → persist-only-if-clean, the SAME safety net every other write verb uses) — never a partial/poisoned write. workspace idempotency: when `kind` has its OWN single-column natural key (`ROW_KIND_NATURAL_KEY` — the same table `commit.rs`'s ADR-0085 upsert/collision discipline is keyed against, e.g. entity_def_id/action_id/capability_id/roll_table_id/...), a row whose key already exists in the workspace REPLACES it instead of duplicating (closing MF-VAL-272 on a re-run). ADR-0146 (sk-jay0.7.174.30) extended the same upsert discipline to kinds with a WIDER ordered composite identity (`ROW_KIND_STORAGE_KEY` — junction/satellite rows such as `*_tag`, `entity_definition_initial_*`, `roll_table_entry_tag`, `spatial_niche_attachments`, `actor_capabilities`, `object_state`, `entity_containment`, `metadata_attachments`, and more): a row whose FULL key tuple already matches an existing row REPLACES it; a row that omits any of that kind's key fields can only ever append, never accidentally collide with an unrelated row that also omits the same field. The one kind absent from BOTH key tables is `consequence_frame_writes` — a Class-β 'set-level' kind (design.md D3) whose identity is the WHOLE ordered list per `template_id`, not a per-row key — so it stays APPEND-ONLY through THIS verb; author it via spellkave_define_behavior/spellkave_define_action_verb's own consequence-authoring path instead, which replaces the set wholesale. For a WHOLESALE reseed of a satellite set (not just avoiding a duplicate), the parent folding verb remains the better tool even though the composite-key upsert now prevents duplicates here too: DEFINITION-level `*_tag` (e.g. entity_definition_tag, resource_definition_tag, condition_definition_tag) via spellkave_define_entity_type/_resource/_condition/_niche/_capability's own `tags` param; INSTANCE-level entity_tag AND object_state via spellkave_place_entity/spellkave_place_actor's own `tags`/`resources` params (sk-9ll.7 — the parent verb here IS the placement verb, not a `define_*` verb). `turn_scheduler` and `combat_grid_blueprints` are DOCUMENTED-INTENTIONAL raw kinds (sk-9ll.4): each is a narrow one-off definition row with its own natural key (upserted here like any other kind), and spellkave_define_session's own FK columns (`turn_scheduler_id`, `combat_grid_blueprint_id`) deliberately never create or ref-check them — that verb's cross-row validation happens at validate/apply, not at authoring time — so this escape hatch is the sole author-facing path for either row kind today; no narrower verb is planned.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id stamped on the scaffolded `[[bundles]]` header (self-scaffolds if new) and defaulted onto every row that doesn't already set its own `bundle_id` (only when the target kind's schema has that column). Omit to fall back to `context.defaultBundle` (smart default) — an error names `bundle` when neither is set. |\n| `kind` | yes | string | | The exact Manifest row-kind name — a `[[kind]]` TOML table, e.g. 'extent_kind_definitions' or 'roll_table_entries'. The generic escape hatch for any row kind the other verbs (author_place/spawn/define_resource/define_behavior) don't cover — validated at call time against @spellkave/world-author's live schema surface (describeManifestSchema), never a fixed list here; an unsupported kind fails loudly naming the current valid set. See spellkave_docs (manifest-format) for the full row/field reference. |\n| `rows` | yes | array<object> | | One or more row objects in this kind's own field shape (see the manifest-format reference doc). Each row is merged as-is into the scratch bundle and re-validated with everything else already authored — nothing is persisted unless the WHOLE merged manifest is clean. |\n\n### Example\n\nCall:\n\n```json\n{\n \"bundle\": \"aoe_blast\",\n \"kind\": \"capability_definition_tag\",\n \"rows\": [\n {\n \"capability_id\": \"aoe_blast/trigger/plate\",\n \"tag\": \"hazard\",\n \"bundle_id\": \"aoe_blast\",\n \"source\": \"manifest\"\n }\n ]\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"rows_added\": 1,\n \"diagnostics\": [\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'hazard' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"rows[0].tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has flat tag 'trigger' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"rows[0].tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'damage_over_time' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has flat tag 'debuff' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-297\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has flat tag 'trap' with no namespace segment ('.'); either adopt the dot-namespace convention or set 'allow_flat_tags = true' on bundle 'aoe_blast'\",\n \"path\": \"niche_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'hazard' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"rows[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"capability_definition_tag row 'aoe_blast/trigger/plate' has tag 'trigger' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"capability_definition_tag.tag\",\n \"param\": \"rows[0].tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'damage_over_time' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"condition_definition_tag row 'aoe_blast/burning' has tag 'debuff' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"condition_definition_tag.tag\"\n },\n {\n \"code\": \"MF-VAL-298\",\n \"severity\": \"warning\",\n \"message\": \"niche_definition_tag row 'aoe_blast/trap/plate' has tag 'trap' whose namespace is not declared by bundle 'aoe_blast', any bundle in its depends_on closure, or 'core' — add a matching '[[bundle.tag_prefixes]]' entry\",\n \"path\": \"niche_definition_tag.tag\"\n }\n ],\n \"kind\": \"capability_definition_tag\",\n \"description_per_row_allowed\": false\n}\n```\n\n## `spellkave_apply_manifest_delta`\n\n**Apply Manifest Delta** — execution mode `sequential`.\n\nCommit/flush authored rows to the ACTIVE connection-level target ('connection-level target' decision): default (no params) reads the workspace scratch and flushes it — the transaction end after write verbs (author_place/spawn/define_*). Optional `toml` is an escape hatch for an external delta string. `live` dispatches through r_apply_manifest_delta (upsert semantics, ADR-0085); `local` renders/merges into the target folder's manifest.toml. Falls back to the legacy `context.applyDelta` live port when no `target` is wired (back-compat). Requires EITHER to be wired — throws if neither is (offline authoring with no target has no flush destination). A live apply waits for a subscribed outcome: a new digest seal (ok) or a manifest_apply_outcome row (MF-APPLY code). A mid-segment commit error rolls the world back but may publish no failure row; the waiter then hits the scheduler watchdog, not a short poll. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `toml` | no | string | | Optional escape hatch: a full manifest-delta TOML string to flush. Omit to commit the active workspace scratch (workspace.readToml) — the normal transaction end after write verbs. Pass only when applying an external/ad-hoc delta that is not the scratch pad. |\n\n## `spellkave_export`\n\n**Export Manifest** — execution mode `sequential`.\n\nReconstruct a live bundle via r_export_manifest (ADR-0086 snapshot semantics, ADR-0149 publisher only) and write TOML. The caller must be the module publisher; any other caller is refused with MF-EXPORT-001. Optional actor= keeps only that entity and what hangs off it (containment, owned_by, equipment). Requires a live connection. Pass exactly one of out= or out_dir=. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `actor` | no | string | | entity_key of the hero to keep. When set, only that actor and what hangs off it remain. |\n| `bundle` | yes | string | | bundle_id to reconstruct via r_export_manifest (ADR-0086). |\n| `out` | no | string | | Write the rendered TOML to this file path. |\n| `out_dir` | no | string | | Write <slug>.toml into this directory (slug from --actor, else the bundle id). |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_diff`\n\n**Diff Manifests** — execution mode `parallel`.\n\nCompare two manifest TOML files semantically: rows matched by natural/composite identity, line order ignored. only-left = gaps (in the reference, missing from the export); only-right = snapshot/play; changed = same key, field-level diffs. Offline. Default ignore list drops snapshot/enrichment noise (elevation_class, visibility, expires_at_tick, place_node_id on entities/locations, object_state.bundle_id, value_bool beside value_int/value_text). Repeatable --map-key from=to rewrites entity/actor key prefixes (and fields that carry them) before compare.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `ignore_fields` | no | string | | Comma-separated extra field names to ignore on every kind (merged with the default snapshot/enrichment list). |\n| `kinds` | no | string | | Comma-separated row kinds to compare (default: every array-valued kind). |\n| `left` | yes | string | | Reference manifest TOML (only-left rows are gaps). |\n| `map_key` | no | array<string> | | Repeatable from=to key-prefix maps (sk-0m4.54). Rewrites entity/actor keys and every string field that is or embeds that key before compare, so an export keyed candidate_1 can match a reference keyed hero_1. |\n| `only` | no | \"gaps\" \\\\| \"snapshot\" \\\\| \"changed\" | | Restrict the report: gaps = only-left, snapshot = only-right, changed = same key with field diffs. |\n| `right` | yes | string | | Compared manifest TOML (only-right rows are snapshot/play). |\n\n### Example\n\nCall:\n\n```json\n{\n \"left\": \"packages/spellkave-world-author/docs/examples/weighted-int-roll-table.toml\",\n \"right\": \"packages/spellkave-world-author/docs/examples/spatial-minimal-cell.toml\",\n \"only\": \"changed\"\n}\n```\n\nResult:\n\n```json\n{\n \"ok\": true,\n \"kind\": \"manifest_diff\",\n \"left\": \"packages/spellkave-world-author/docs/examples/weighted-int-roll-table.toml\",\n \"right\": \"packages/spellkave-world-author/docs/examples/spatial-minimal-cell.toml\",\n \"only_left\": 0,\n \"only_right\": 0,\n \"changed\": 0,\n \"kinds\": [],\n \"gaps\": [],\n \"snapshot\": [],\n \"changes\": [],\n \"unkeyed_kinds\": []\n}\n```\n\n## `spellkave_applyset_diff`\n\n**Diff Applyset** — execution mode `sequential`.\n\nCompare an applyset root (its manifest.toml and includes) with what the world remembers applying from it (the applyset memory, ADR-0145), like kubectl diff. Every row is create (not applied yet), configure (applied with other content), move (same content, other file), prune (applied before, in no file now) or unchanged. Rows the world holds but this applyset never applied are left alone. Publisher export or complete caller-scoped instance projections supply live comparison. Rows whose live value differs from the files carry a drift warning (information only); incomplete, masked, unsupported or unavailable observations are explicit. With prune=true, previews world-added rows on each entity candidate; unreadable contents are refused explicitly, and entity-content inspection requires publisher closure. Sends nothing. Requires a live connection. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `dep` | no | array<string> | | Repeatable dependency root manifests (or their directories), loaded for validation only and never sent. |\n| `dir` | no | string | | The applyset root: a directory holding manifest.toml, or the root manifest file itself. Its includes are read too; only the root's own rows are compared and sent. |\n| `prune` | no | boolean | | Preview an apply with pruning: inspect world-added rows on each removed entity, without writing. Requires publisher closure to inspect entity contents; an unreadable candidate is reported as a refusal. Off by default. |\n| `source` | no | object | | |\n\n#### `source`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `fragments` | yes | array<object> | | |\n| `root_path` | yes | string | | Stable logical relative root name recorded in applyset provenance; never a server file path. |\n| `root_toml` | yes | string | | |\n\n##### `source.fragments[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `path` | yes | string | | |\n| `toml` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_applyset_apply`\n\n**Apply Applyset** — execution mode `sequential`.\n\nApply an applyset root to the world like kubectl apply: compute the same difference as spellkave_applyset_diff, send only the create and configure rows (and, with prune, retractions for rows the files no longer name) in one r_apply_bundle call with the changed part lists and the memory generation it read, and wait for the seal. Refuses before sending when a changed row cannot be updated by a delta or the validator rejects the built root plus retractions. A concurrent apply (stale generation), another root path owning the name (without force) or a world without apply authority is refused by the world. Scoped ordinary writes need a fresh complete comparable observation and a known baseline, or complete authorized Bundle absence for a new row. Force overrides known conflicts only; it cannot supply missing read coverage. Scoped entity-prune and whole-world export require publisher closure. Binding-only deltas retain their separate authority lane; mixed unchecked rows refuse. Comparison remains optimistic against later world changes. Requires a live connection. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `dep` | no | array<string> | | Repeatable dependency root manifests (or their directories), loaded for validation only and never sent. |\n| `dir` | no | string | | The applyset root: a directory holding manifest.toml, or the root manifest file itself. Its includes are read too; only the root's own rows are compared and sent. |\n| `dry_run` | no | boolean | | Compute and report the difference; send nothing (same as diff). |\n| `force` | no | boolean | | Let the files win over observed world changes, let this root take over an applyset name recorded under another root path, and retract an entity with world-added rows or unreadable prune contents. The answer reports the meanings used as a force_used list containing world_changed, root_takeover, and/or world_added_rows. |\n| `prune` | no | boolean | | Also retract rows the applyset applied before and the files no longer name. Retracting an entity covers its authored containment, state, resource bound, equipment (the wearer side), actor, position, identity, and capability rows (those kinds cannot be removed alone); tag rows stay. Pruning an equipped item together with its slot row while the wearer stays is refused. A containment row the files replace with another containment for the same contained entity needs no retraction. Retracting an entity on which the world holds rows beyond what the files put there, or any entity prune when those rows cannot be read, is refused unless --force. Off by default. |\n| `source` | no | object | | |\n\n#### `source`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `fragments` | yes | array<object> | | |\n| `root_path` | yes | string | | Stable logical relative root name recorded in applyset provenance; never a server file path. |\n| `root_toml` | yes | string | | |\n\n##### `source.fragments[]`\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `path` | yes | string | | |\n| `toml` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_can_i`\n\n**Can I** — execution mode `sequential`.\n\nAsk a running world whether one body may perform one action on one target now, and which admission check decides. Calls the world's probe. Does not evaluate a predicate, select a template, or perform the act. admitted and disclosed are reported side by side. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `action` | yes | string | | The action id. |\n| `args` | no | object | | Literal manipulation arguments for the probe. Supply the same selected items and either fresh expected_participants or participant_context as the intended dispatch; can-i does not compose a participant context. |\n| `as` | yes | string | | The body the question is about, as its authored entity key or its entity id. |\n| `expect` | no | \"admitted\" \\\\| \"refused\" | | Closed-door expectation. A differing answer is a rejection. |\n| `target` | yes | string \\\\| object | | The target of the attempt, as an authored key, entity id, or target reference. |\n\n## `spellkave_explain`\n\n**Spellkave Explain** — execution mode `parallel`.\n\nRead authored role, binding, capability or extent-kind vocabulary. Files include the workspace closure and kernel bootstrap; live reads the connected world. Role answers include merged capabilities, contributing bundles and bound-to rows. Binding answers inspect the exact binding ID, its state, scope and derived elevation; identity details are self-only unless the publisher reads them. This grants no authority.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `id` | yes | string | | |\n| `kind` | yes | \"verb\" \\\\| \"persona\" \\\\| \"role\" \\\\| \"binding\" \\\\| \"capability\" \\\\| \"extent-kind\" \\\\| \"place\" | | |\n| `target` | no | \"files\" \\\\| \"live\" | | |\n\n## `spellkave_get`\n\n**Get** — execution mode `sequential`.\n\nRead running-world instance rows from the publisher owner cache or a separate caller-scoped reader. Scoped reads support entities, actors, actor_spatial_locations, actor_capabilities, actor_equipment_slots, entity_containment, entity_tag and object_state with binding-held Hidden/Internal read authority. Answers include caller/world source epochs and complete, masked or incomplete coverage; inaccessible keys report not_found_in_scope. Does not read files or workspace scratch. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id. Omit when the authored key is unique. |\n| `fields` | no | array<string> | | Listing columns. Omit for the compact preferred set. Key fields are always kept. Keyed get ignores this (whole row). |\n| `key` | no | string | | Key field values joined with:: in schema natural- or storage-key order. Omit to list. |\n| `kind` | yes | string | | Instance row kind: entities, actors, actor_spatial_locations, actor_capabilities, actor_equipment_slots, entity_containment, entity_tag, or object_state. |\n| `limit` | no | integer | | Listing cap (default 50). |\n| `pattern` | no | string | | Substring filter on key fields for listings. |\n\n## `spellkave_describe`\n\n**Describe** — execution mode `sequential`.\n\nRead one admitted authored entity, its place or containment chain and admitted containment, ownership and equipment. Publisher closure and caller-scoped reads use separate sources. Scoped relationships require both endpoints; an outside endpoint is marked outside_scope without its identity or label. Answers carry source and coverage information. When connected, the answer includes reads_as_publisher and connected_identity. reads_as_publisher is true only after the publisher subscription applies. Caller-scoped instance reads use current role grants and report source and coverage. An unavailable reader needs an appropriate read grant or connection selection (`sk config view`). Export and entity prune require publisher closure.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | bundle_id when the key is not unique. |\n| `key` | yes | string | | Authored entity_key or numeric id of an authored entity. |\n| `kind` | yes | string | | Must be entities. |\n| `limit` | no | integer | | Belonging-list cap (default 50). |\n\n## `spellkave_grant_role`\n\n**Grant role** — execution mode `sequential`.\n\nDelegate a role through a binding-only manifest delta as the caller. Exact covering frontier.bind.<role> OR all nonempty merged role ids admit the request; no apply or prune privilege is required. Whole-world extent * requires complete inventory and never covers later roots or bundles.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `bundle` | no | string | | |\n| `description` | no | string | | |\n| `expires_at_tick` | no | string | | |\n| `extent` | yes | string | | |\n| `extent_kind` | yes | string | `\"place_graph\"` | |\n| `role` | yes | string | | |\n| `subject` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_revoke_role`\n\n**Revoke role** — execution mode `sequential`.\n\nRetract a manageable binding through the same D-6-checked apply lane as the caller. No apply or prune privilege is required.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `binding_id` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_list_grants`\n\n**List grants** — execution mode `sequential`.\n\nList only subject-owned or D-6-manageable bindings; filters narrow the authorized set.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `extent` | no | string | | |\n| `role` | no | string | | |\n| `subject` | no | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_export_grants`\n\n**Export grants** — execution mode `sequential`.\n\nReturn an artifact of authorized world-owned runtime bindings with source world instance, tick, endpoint, original expiry, digest and complete or scoped coverage. Only a complete publisher export is a reset backup. Optional out uses a host filesystem; hosted delivery returns the artifact.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `out` | no | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_prepare_hand_over`\n\n**Prepare role handover** — execution mode `sequential`.\n\nReview one live binding and bounded authorized context as the caller. The preview is not a frozen snapshot; copy every returned precondition into the explicit commit. Shared notes are text, never authority.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `binding_id` | yes | string | | |\n| `subject` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_hand_over_role`\n\n**Hand over role** — execution mode `sequential`.\n\nCommit one reviewed subject replacement through guarded apply as the caller. Preserve binding, presence, extent and expiry. Personal consent and NPC holds never transfer. Completion requires a server receipt; reuse the same request UUID to reconcile a lost response.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `binding_id` | yes | string | | |\n| `expected_digest` | yes | string | | |\n| `expected_incarnation` | yes | string | | |\n| `expected_merged_role_digest` | yes | string | | |\n| `expected_revision` | yes | string | | |\n| `reason` | yes | string | | |\n| `request_id` | yes | string | | |\n| `subject` | yes | string | | |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_render_scene`\n\n**Render scene** — execution mode `sequential`.\n\nRender a spellkave-scene/v1 data package, values and dependency TOML payloads into validated ordinary manifests and deterministic setup keys. Offline render never mutates or proves live admission. On a caller connection, preview pins a complete empty blueprint and the selected caller/world. Hosted calls accept payloads, never filesystem paths or executable packages.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `dependencies` | yes | array<string> | | Resolved dependency TOML payloads for offline validation. |\n| `package` | yes | object | | Resolved spellkave-scene/v1 data package; no executable templates or filesystem paths. |\n| `setup_name` | yes | string | | |\n| `values` | yes | object | | Data values: anchor_id, optional bearing_deg and counts. |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n\n## `spellkave_stage_scene`\n\n**Stage scene** — execution mode `sequential`.\n\nExplicitly stage an unmodified connected scene preview as the same caller in the expected world instance. Existing apply admission guards graph expansion and population; each phase reports committed, refused or unknown. Never retries an unknown result, resets a reused name or grants controller/deletion authority. Inspect the world before recovery; graph Despawn ejects occupants and leaves cleanup residuals.\n\n| Field | Required | Type | Default | Description |\n|---|---:|---|---|---|\n| `expected_world_instance_id` | yes | string | | |\n| `plan` | yes | object | | Unmodified plan from a connected render_scene preview. |\n\n### Example\n\n_Requires an active connection — no offline example; this tool cannot be demonstrated without a live/local target wired._\n",
277
+ "weapon-stricter-affordance-variant": "# Opting ONE weapon copy into a stricter affordance variant without regressing its siblings\n\n(The worked example below — duplicate shortbow ids, `weapon.requires_ammunition`,\n`attack-ranged.toml`'s `/ammo` variant — is retired content from\n`archive/packages/spellkave-srd/fixtures/base/`. The live srd-cc attacks in\n`packages/spellkave-srd-cc/fixtures/base/playing-the-game/attacks.toml` carry\nno ammo variant. The general pattern still applies.)\n\nTwo entity_definitions can represent \"the same\" item (e.g. `srd/item/shortbow`\nand `srd/weapon/shortbow` both exist, pre-dating any single-source-of-truth\ncleanup) and already have DIFFERENT proven wielders. Adding a new, stricter\nmechanic (ammo tracking) to a SHARED consequence/affordance template affects\nevery wielder of every entity_def that reaches it — including beats you don't\ncontrol and can't regress. The safe pattern: (1) pick a distinguishing tag\n(`weapon.requires_ammunition`) applied ONLY to the specific entity_def copy\nyou're opting in — check first whether any *proven* beat already wields that\nexact id (if so, pick the untouched sibling copy instead, or mint a new\ndef); (2) append `&& actor.wielded_item.has_tag('<tag>') == false` to the\nEXISTING affordance's predicate (a no-op for every current wielder, since\nnone carry the new tag yet); (3) author a full sibling\noutcome/affordance/action cluster with the SAME to-hit math but the tag\ncheck flipped to `== true`, plus the new consequence frame_write. The two\nvariants then never double-materialise for the same wielder, and zero\nalready-committed transcripts change (attack-ranged.toml's\n`srd/attack/ranged` vs `srd/attack/ranged/ammo`).\n\n---\n\nRelated: start at `onramp`; search repairs with `sk docs --query \"…\"`.\n",
278
+ };
279
+ // ci-allow-end(raw-sql)