{
  "schema": "prism/prompt/1",
  "goal": "Decide if a player's gesture in Verdant Resonance reaches the plant they face. The garden then answers the same walk the same way.",
  "pattern": "decisionTable",
  "repository": "afflom/verdant-resonance",
  "app": {
    "name": "garden-attunement",
    "title": "Plant attunement",
    "purpose": "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.",
    "fields": [
      {
        "name": "angle",
        "kind": "number",
        "min": 0,
        "means": "degrees between the player's gaze and the plant",
        "max": 180
      },
      {
        "name": "distance",
        "kind": "number",
        "min": 0,
        "means": "how far the plant is, in metres",
        "max": 100
      },
      {
        "name": "cooldown",
        "kind": "number",
        "min": 0,
        "means": "milliseconds of the attune refractory period left",
        "max": 1100
      }
    ],
    "outcomes": [
      "attuned",
      "dormant",
      "distant"
    ],
    "meanings": {
      "attuned": "the plant attunes and sings",
      "dormant": "the gesture is ignored during its refractory pause, the plant rests",
      "distant": "the plant is outside the forward gaze cone and is not activated"
    },
    "rules": [
      {
        "when": [
          {
            "field": "distance",
            "op": ">",
            "value": 22
          }
        ],
        "then": "distant",
        "why": "prism/src/Foundation/Humane/V1/Model.lex.tex evaluateGazeTargetInForwardCone: distMeters <= 22, maxInteractiveRangeMeters 22"
      },
      {
        "when": [
          {
            "field": "angle",
            "op": ">",
            "value": 62
          }
        ],
        "then": "distant",
        "why": "Humane Model.lex.tex: forwardFovHalfAngleDeg 62; GardenCanvas.tsx never activates elements behind the player"
      },
      {
        "when": [
          {
            "field": "cooldown",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "dormant",
        "why": "Humane Model.lex.tex GestureHoldAndCooldownPolicy attuneRefractoryMs 1100: GardenCanvas.tsx ignores attune while it cools down"
      }
    ],
    "otherwise": "attuned",
    "otherwiseWhy": "in the forward gaze cone and rested: the focal plant attunes",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "distance",
            "op": ">",
            "value": 22
          }
        ],
        "then": "attuned",
        "why": "no plant answers a player out of reach"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "angle",
            "op": ">",
            "value": 62
          }
        ],
        "then": "attuned",
        "why": "behindPlayerActivationsCount is 0: nothing behind the player activates"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "cooldown",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "attuned",
        "why": "mindful pacing: a repeated gesture never attunes during its refractory pause"
      }
    ],
    "examples": [
      {
        "request": "10 8 0",
        "response": "attuned"
      },
      {
        "request": "62 22 0",
        "response": "attuned"
      },
      {
        "request": "180 5 0",
        "response": "distant"
      },
      {
        "request": "0 23 0",
        "response": "distant"
      },
      {
        "request": "30 4 1100",
        "response": "dormant"
      },
      {
        "request": "30 4 1",
        "response": "dormant"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "Player",
      "text": "Wanders the garden and needs each plant to answer the same way to the same walk.",
      "concerns": [
        "Correct answers"
      ]
    },
    {
      "name": "Sound designer",
      "text": "Places plants and tunes the humane pacing and needs plants outside the gaze cone, or a rushed gesture, to stay silent.",
      "concerns": [
        "Proved guarantees",
        "Calm interaction"
      ]
    }
  ],
  "concerns": [
    {
      "name": "Calm interaction",
      "text": "Gestures follow the Humane design standard: focal gaze-cone selection and refractory pauses, with no activation behind the player.",
      "model": "quality"
    }
  ],
  "components": [
    {
      "name": "Garden client",
      "kind": "staticSite",
      "text": "The browser game, src/components/GardenCanvas.tsx, which finds the focal plant and sends the gesture."
    },
    {
      "name": "Soundscape engine",
      "kind": "service",
      "text": "src/game/soundscapeEngine.ts, the Web Audio voices an attuned plant plays."
    }
  ],
  "threats": [
    {
      "name": "Key-repeat flood",
      "text": "Operating-system key repeat fires attune many times a second, so plants chatter.",
      "stride": "denialOfService",
      "asset": "request",
      "likelihood": "medium",
      "impact": "minor",
      "control": {
        "name": "Refractory pause",
        "text": "Attune is ignored for 1100 ms after a gesture, proved for every request, and OS key repeat is suppressed.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "GardenAttunementProofs::inv003Holds"
          },
          {
            "kind": "review",
            "reference": "prism/src/Foundation/Humane/V1/Model.lex.tex GestureHoldAndCooldownPolicy"
          }
        ]
      }
    },
    {
      "name": "Activation behind the player",
      "text": "A plant behind the player attunes, breaking the focal gaze law.",
      "stride": "elevationOfPrivilege",
      "asset": "answer",
      "likelihood": "low",
      "impact": "minor",
      "control": {
        "name": "Gaze cone proved",
        "text": "Beyond 62 degrees nothing attunes, proved for every request.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "GardenAttunementProofs::inv002Holds"
          },
          {
            "kind": "review",
            "reference": "src/game/prismModel.test.ts focalGazeSelection"
          }
        ]
      }
    },
    {
      "name": "Client range drift",
      "text": "The client finds focal plants up to 32 m away while the model allows 22 m, so the page and the model disagree.",
      "stride": "tampering",
      "asset": "source",
      "likelihood": "medium",
      "impact": "minor",
      "accepted": "The app follows the LexLean model, 22 m; src/game/prismModel.ts findNearestPlant uses 32 m, a drift for the repository to reconcile."
    }
  ],
  "quality": [
    {
      "characteristic": "Safety",
      "subcharacteristic": "Operational constraint",
      "requirement": "No activation behind the player",
      "text": "An attune gesture never activates a plant outside the forward gaze cone.",
      "measure": "Behind-player activations",
      "measureText": "Requests with an angle over 62 degrees answered attuned, behindPlayerActivationsCount in the model.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "Player",
      "steps": [
        "REQ-001",
        "REQ-002",
        "REQ-003",
        "otherwise"
      ]
    },
    {
      "stakeholder": "Sound designer",
      "steps": [
        "INV-001",
        "INV-002",
        "INV-003"
      ]
    }
  ]
}
