From 9d3c4b467b68b2dd98b34d8a94e61a8d3d9e8296 Mon Sep 17 00:00:00 2001 From: devanonyme42 Date: Sun, 2 Aug 2026 10:07:26 +0200 Subject: [PATCH] docs: specify the gate statement in the ProseScript grammar Resolves #147 --- skills/open-prose/prose.md | 2 ++ skills/open-prose/prosescript.md | 43 ++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/skills/open-prose/prose.md b/skills/open-prose/prose.md index c5e1c7ed..75cbf564 100644 --- a/skills/open-prose/prose.md +++ b/skills/open-prose/prose.md @@ -818,6 +818,8 @@ Runtime delegation and `gate()` share the same yield/resume shape: Both are coroutine-style interruptions where the VM mediates between the yielding render and an external actor. +The ProseScript statement form for gates (`gate expression`, optionally bound with `let`) is specified in the Gates section of `prosescript.md`. + --- ## The Copy-on-Return Mechanism diff --git a/skills/open-prose/prosescript.md b/skills/open-prose/prosescript.md index 5487e5a6..e631b939 100644 --- a/skills/open-prose/prosescript.md +++ b/skills/open-prose/prosescript.md @@ -122,7 +122,8 @@ agent_property ::= "model:" expression NEWLINE shape_property ::= ("self" | "delegates" | "prohibited") ":" expression NEWLINE statement ::= binding | assignment | return_stmt - | call_stmt | session_stmt | resume_stmt | do_block | do_call + | call_stmt | session_stmt | resume_stmt | gate_stmt + | do_block | do_call | parallel_block | repeat_block | for_block | loop_block | if_stmt | choice_block | try_block | throw_stmt @@ -152,6 +153,8 @@ session_expr ::= "session" ( string | ":" identifier | identifier ":" identif property_block? resume_stmt ::= ["let" target "="] resume_expr NEWLINE? resume_expr ::= "resume" ":" identifier property_block? +gate_stmt ::= ["let" target "="] gate_expr NEWLINE? +gate_expr ::= "gate" expression property_block ::= NEWLINE INDENT property+ DEDENT property ::= identifier ":" expression NEWLINE @@ -386,6 +389,41 @@ Validation: | Invalid shape property | Error | | Direct `session` in `### Execution` when an equivalent `function` exists | Warning | +## Gates + +A `gate` yields the run to a human operator and blocks until the operator +responds. Use it for decisions the render must not absorb: approvals, rulings, +and anything irreversible. + +```prose +let acceptance = gate "operator reads the decision sheet and rules per item" + +gate "confirm the deployment plan before it is applied" +``` + +The payload expression is presented to the operator. When the statement is +bound with `let`, the operator's response becomes the bound value. + +Gate forms: + +| Form | Meaning | +|------|---------| +| `gate "prompt"` | Yield to the operator with a prompt, discard the response | +| `let x = gate "prompt"` | Yield to the operator, bind the response | +| `gate reference` | Yield with a structured payload, such as a decision sheet | + +Like `call`, `session`, and `resume`, a gate is an implicit yield point; there +is no `await` keyword in ProseScript. The runtime delegation comparison in +`prose.md` describes the same interaction at the VM protocol level as +`await gate(payload)` → response. Unlike runtime delegation, the wait is +indefinite: a gate resumes only on operator input. + +Validation: + +| Check | Result | +|-------|--------| +| `gate` without a payload expression | Error | + ## Variables And Context `let` creates a mutable binding. `const` creates an immutable binding. @@ -825,7 +863,8 @@ Execution has three phases: 2. Validate names, scopes, target contracts, inputs, outputs, loop bounds, and surface-specific restrictions. 3. Execute in source order, using the Prose VM from `prose.md` for function - calls, sessions, state, bindings, retries, and final result publication. + calls, sessions, gates, state, bindings, retries, and final result + publication. Contract Markdown `### Execution`: