{
 "paper": "j17",
 "a": "1.1",
 "b": "1.2",
 "summary": "From v1.1 (14 Jun) to v1.2 (29 Jul): 10,681 words to 11,078 words, 1,034 words in new or rewritten paragraphs and 637 taken out, 20 paragraphs changed.",
 "note": {
  "title": "New mechanisms described; claims narrowed to an engineering design",
  "kind": "revision",
  "body": "## Summary\n\nThis version adds mechanisms built since June and pulls back on what the paper claims. The abstract is cut almost in half and now calls the work an implemented systems design, not a formal language: there is no formal semantics, no soundness proof and no public benchmark. The new mechanisms come from the improvement notes of 7 June, which this version marks as incorporated. The notes give the reason for the narrower claims: tests show behaviour, not that typed recipes beat prose ones.\n\n- New section: recipes take typed parameters, checked before dispatch, filled from stored values, context or memory, or by pausing to ask.\n- Spawned workers now have token and tool-call limits that are enforced during the run, not just planned.\n- Parallel runs return one result per input, so one failure no longer sinks the batch.\n- The supervisor that checks completion is itself a recipe with a computed loop limit.\n- Recipe edits made by the agent live in a separate overlay that survives software updates.\n- Two limitations added: no formal semantics, and no comparative benchmark. The conclusion is rewritten to match.",
  "source": "change note"
 },
 "paragraphs_changed": 20,
 "changes": [
  {
   "section": "Abstract",
   "old": "An agent \"recipe\" — an ordered, portable workflow of steps an intelligent worker follows — is a good unit of operational knowledge, but in its plain form it is a sequence of English instructions, and English is a lossy wire format. A step's result reaches the next step as prose that the next step must re-parse, re-interpret, and hope it understood; nothing checks, before the run, that step seven actually consumes a field step three actually produces. This paper describes a small set of primitives that turn that lossy English-passing pipeline into a *typed, composable programming language* that an agent can author, type-check, compose, run, recover from failure inside, and sharpen against its own usage. The core is seven things. First, a **gradual typed value model with named ports**: a step may declare an `out:` schema and named `in:` ports bound from earlier steps' typed outputs, while any step that declares neither stays exactly the prose it was — typing is an overlay, never a rewrite. Second, **contracts at boundaries**: at plan-compile time, before any step executes, every input port and every guard reference is checked to resolve to a strictly-earlier producer whose output schema actually declares the referenced field. Third, a **boolean control grammar** — a `when:` guard evaluated by a tiny, sandboxed, side-effect-free expression evaluator (an OR-of-AND-of-comparisons over typed fields, explicitly *not* a JavaScript `eval`) and a `return:`/`done:` early-exit that closes the plan carrying the exiting step's typed value. Fourth, a **combinator algebra** — `map`/`filter` iteration over a typed array edge with a static or *dynamically-resolved* worker recipe, `compose` via the sub-recipe `uses:` edge, and `if-then-else` via the guard-plus-exit pair. Fifth, a **searchable skill standard library** an `invoke skill:` step resolves against, with the resolved skill's output schema adopted at compile so downstream ports type-check against the real contract. Sixth, **catchable recovery** — a classified-error taxonomy plus an `onError:` policy router (retry, fallback to another recipe, or continue-partial), with `done-partial` as a non-aborting terminal settlement. Seventh, **all bounds derived, never frozen** — re-dispatch, combinator fan-out, composition depth, and recovery-retry budgets are each computed from the live situation rather than read off a constant.",
   "new": null,
   "marked": "[-An agent \"recipe\" — an ordered, portable workflow of steps an intelligent worker follows — is a good unit of operational knowledge, but in its plain form it is a sequence of English instructions, and English is a lossy wire format. A step's result reaches the next step as prose that the next step must re-parse, re-interpret, and hope it understood; nothing checks, before the run, that step seven actually consumes a field step three actually produces. This paper describes a small set of primitives that turn that lossy English-passing pipeline into a *typed, composable programming language* that an agent can author, type-check, compose, run, recover from failure inside, and sharpen against its own usage. The core is seven things. First, a **gradual typed value model with named ports**: a step may declare an `out:` schema and named `in:` ports bound from earlier steps' typed outputs, while any step that declares neither stays exactly the prose it was — typing is an overlay, never a rewrite. Second, **contracts at boundaries**: at plan-compile time, before any step executes, every input port and every guard reference is checked to resolve to a strictly-earlier producer whose output schema actually declares the referenced field. Third, a **boolean control grammar** — a `when:` guard evaluated by a tiny, sandboxed, side-effect-free expression evaluator (an OR-of-AND-of-comparisons over typed fields, explicitly *not* a JavaScript `eval`) and a `return:`/`done:` early-exit that closes the plan carrying the exiting step's typed value. Fourth, a **combinator algebra** — `map`/`filter` iteration over a typed array edge with a static or *dynamically-resolved* worker recipe, `compose` via the sub-recipe `uses:` edge, and `if-then-else` via the guard-plus-exit pair. Fifth, a **searchable skill standard library** an `invoke skill:` step resolves against, with the resolved skill's output schema adopted at compile so downstream ports type-check against the real contract. Sixth, **catchable recovery** — a classified-error taxonomy plus an `onError:` policy router (retry, fallback to another recipe, or continue-partial), with `done-partial` as a non-aborting terminal settlement. Seventh, **all bounds derived, never frozen** — re-dispatch, combinator fan-out, composition depth, and recovery-retry budgets are each computed from the live situation rather than read off a constant.-]"
  },
  {
   "section": "Abstract",
   "old": "This is no longer a design that promises a target; it is a shipped language whose seven pillars are implemented and tested in the running substrate. We are precise throughout about what each pillar actually does, and about the two places where a mechanism is shipped but its strongest mode is held off by default (autonomous recipe self-editing is gated to *propose-only* unless an operator opts in) or scoped narrowly (the combinator algebra is the iteration combinators plus the guard/exit/compose primitives, not yet a closed set of four named higher-order recipes). We also situate the language against the live open-source ecosystem it now interoperates with — a context-compression layer (chopratejas/headroom) that answers the same lossy-prose problem from the opposite direction, an engineering-discipline plugin (addyosmani/agent-skills) and a marketing-skills corpus (coreyhaines31/marketingskills) whose authoring conventions sharpen ours, and a distribution registry (Journey / journeykits.ai) whose `kit/1.0` schema is the same grammar BROCA emits, making recipes a cross-registry interchange format rather than a private DSL.",
   "new": null,
   "marked": "[-This is no longer a design that promises a target; it is a shipped language whose seven pillars are implemented and tested in the running substrate. We are precise throughout about what each pillar actually does, and about the two places where a mechanism is shipped but its strongest mode is held off by default (autonomous recipe self-editing is gated to *propose-only* unless an operator opts in) or scoped narrowly (the combinator algebra is the iteration combinators plus the guard/exit/compose primitives, not yet a closed set of four named higher-order recipes). We also situate the language against the live open-source ecosystem it now interoperates with — a context-compression layer (chopratejas/headroom) that answers the same lossy-prose problem from the opposite direction, an engineering-discipline plugin (addyosmani/agent-skills) and a marketing-skills corpus (coreyhaines31/marketingskills) whose authoring conventions sharpen ours, and a distribution registry (Journey / journeykits.ai) whose `kit/1.0` schema is the same grammar BROCA emits, making recipes a cross-registry interchange format rather than a private DSL.-]"
  },
  {
   "section": "Abstract",
   "old": null,
   "new": "An agent \"recipe\" — an ordered, portable workflow of steps an intelligent worker follows — is a good unit of operational knowledge, but in its plain form it is a sequence of English instructions, and English is a lossy wire format. A step's result reaches the next step as prose that the next step must re-parse, re-interpret, and hope it understood; nothing checks, before the run, that step seven actually consumes a field step three actually produces. This paper describes a small set of primitives that turn that lossy English-passing pipeline into a typed, composable workflow system that an agent can author, check, compose, run, and recover inside. The core comprises gradual named-port value edges; pre-dispatch checks over ports, guards, and parameters; a closed boolean control grammar; iteration and composition operators; a searchable skill library; classified recovery and settled parallel failures; derived and enforced resource bounds; and typed external parameters with private storage and durable missing-value resolution.",
   "marked": "{+An agent \"recipe\" — an ordered, portable workflow of steps an intelligent worker follows — is a good unit of operational knowledge, but in its plain form it is a sequence of English instructions, and English is a lossy wire format. A step's result reaches the next step as prose that the next step must re-parse, re-interpret, and hope it understood; nothing checks, before the run, that step seven actually consumes a field step three actually produces. This paper describes a small set of primitives that turn that lossy English-passing pipeline into a typed, composable workflow system that an agent can author, check, compose, run, and recover inside. The core comprises gradual named-port value edges; pre-dispatch checks over ports, guards, and parameters; a closed boolean control grammar; iteration and composition operators; a searchable skill library; classified recovery and settled parallel failures; derived and enforced resource bounds; and typed external parameters with private storage and durable missing-value resolution.+}"
  },
  {
   "section": "Abstract",
   "old": null,
   "new": "This is an implemented systems design, not a formal account of a language. Its mechanisms are exercised in the running substrate, including enforced per-spawn resource envelopes, typed recipe parameters, durable resolution of missing values, and failure-isolating parallel execution. The evidence supports claims about implementation behavior. It does **not** yet support type soundness, semantic preservation, or lower integration-failure rates than prose workflows: no formal operational semantics, soundness proof, or public comparative benchmark is provided. We therefore use “type system” as an engineering description of gradually adopted, schema-checked contracts, not as a metatheoretic result.",
   "marked": "{+This is an implemented systems design, not a formal account of a language. Its mechanisms are exercised in the running substrate, including enforced per-spawn resource envelopes, typed recipe parameters, durable resolution of missing values, and failure-isolating parallel execution. The evidence supports claims about implementation behavior. It does **not** yet support type soundness, semantic preservation, or lower integration-failure rates than prose workflows: no formal operational semantics, soundness proof, or public comparative benchmark is provided. We therefore use “type system” as an engineering description of gradually adopted, schema-checked contracts, not as a metatheoretic result.+}"
  },
  {
   "section": "Contributions",
   "old": "1. **A gradual type system for prose workflows.** A per-step `out:`/`in:` directive vocabulary that adds named, schema-checked value edges to a recipe *without* converting it to code, where an undeclared step keeps its exact prose behavior — typing is opt-in per step and additive, not a migration. 2. **Compile-time contracts at boundaries.** A seed-time port-wiring check and a seed-time guard-reference check that each verify every consumer reference resolves to a real, strictly-earlier producer that declares the referenced field — turning a class of integration errors from deep-runtime failures into fast, precise authoring-time rejections. 3. **A combinator algebra over recipes.** `map`/`filter` iterate a worker recipe over a typed array edge (with the worker resolvable *dynamically* from a prior step's output), `compose` chains recipes through the depth-/cycle-guarded `uses:` edge, and `if-then-else` is the `when:`-guard / `return:`-exit pair — combinators are ordinary recipes, so they inherit fitness, archive, and versioning for free. 4. **A skill standard library as the composition vocabulary.** A searchable, versioned `SkillLibrary` (surface-embedding search with a keyword fallback, Laplace-smoothed fitness ranking) that an `invoke skill:` step resolves against; the resolved skill's output schema is adopted *at compile* so downstream `in:` ports type-check against the real contract, and a `recipe.compose` RPC mechanically assembles a recipe from the top-ranked skill hits. 5. **Catchable recovery with a classified-error taxonomy.** Every step failure is classified into one of a closed set of error kinds with a computed `recoverable` flag; an `onError:` policy router does retry (honored only for recoverable errors), fallback to a recovery recipe, or continue-partial, the last settling as a non-aborting `done-partial` that keeps the survivors. 6. **A self-sharpening loop over real usage.** A nightly consolidation lane reads per-step struggle from the live plan archive and proposes `rewrite_step_text` mutations for struggling steps; an apply path guarded by five rails (strict promote gate, authorship guard, snapshot-before-write, validate-or-skip, kill-switch) can enact them — but is *propose-only by default*, enacting nothing unless an operator sets the kill-switch. 7. **All bounds derived, not frozen.** Re-dispatch, combinator fan-out, composition depth, and recovery-retry budgets are each a function of live signals — value-of-work, historical confidence, prior effort spent, and affordability — never a hardcoded constant.",
   "new": "1. **A gradual type system for prose workflows.** A per-step `out:`/`in:` directive vocabulary that adds named, schema-checked value edges to a recipe *without* converting it to code, where an undeclared step keeps its exact prose behavior — typing is opt-in per step and additive, not a migration. 2. **Compile-time contracts at boundaries.** A seed-time port-wiring check and a seed-time guard-reference check that each verify every consumer reference resolves to a real, strictly-earlier producer that declares the referenced field — turning a class of integration errors from deep-runtime failures into fast, precise authoring-time rejections. 3. **A combinator algebra over recipes.** `map`/`filter` iterate a worker recipe over a typed array edge (with the worker resolvable *dynamically* from a prior step's output), `compose` chains recipes through the depth-/cycle-guarded `uses:` edge, and `if-then-else` is the `when:`-guard / `return:`-exit pair — combinators are ordinary recipes, so they inherit fitness, archive, and versioning for free. 4. **A skill standard library as the composition vocabulary.** A searchable, versioned `SkillLibrary` (surface-embedding search with a keyword fallback, Laplace-smoothed fitness ranking) that an `invoke skill:` step resolves against; the resolved skill's output schema is adopted *at compile* so downstream `in:` ports type-check against the real contract, and a `recipe.compose` RPC mechanically assembles a recipe from the top-ranked skill hits. 5. **Catchable recovery with a classified-error taxonomy.** Every step failure is classified into one of a closed set of error kinds with a computed `recoverable` flag; an `onError:` policy router does retry (honored only for recoverable errors), fallback to a recovery recipe, or continue-partial, the last settling as a non-aborting `done-partial` that keeps the survivors. 6. **A self-sharpening loop over real usage.** A nightly consolidation lane reads per-step struggle from the live plan archive and proposes `rewrite_step_text` mutations for struggling steps; an apply path guarded by five rails (strict promote gate, authorship guard, snapshot-before-write, validate-or-skip, kill-switch) can enact them — but is *propose-only by default*, enacting nothing unless an operator sets the kill-switch. 7. **All bounds derived, not frozen.** Re-dispatch, combinator fan-out, composition depth, and recovery-retry budgets are each a function of live signals — value-of-work, historical confidence, prior effort spent, and affordability — never a hardcoded constant. 8. **Typed external signatures and binding resource contracts.** Recipes may declare typed parameters that are validated before dispatch and resolved through explicit values, private storage, context, memory, and an optional durable ask. Child spawns carry token and tool-call caps that the embedded runner enforces during execution, converting a derived plan into a binding resource boundary.",
   "marked": "1. **A gradual type system for prose workflows.** A per-step `out:`/`in:` directive vocabulary that adds named, schema-checked value edges to a recipe *without* converting it to code, where an undeclared step keeps its exact prose behavior — typing is opt-in per step and additive, not a migration. 2. **Compile-time contracts at boundaries.** A seed-time port-wiring check and a seed-time guard-reference check that each verify every consumer reference resolves to a real, strictly-earlier producer that declares the referenced field — turning a class of integration errors from deep-runtime failures into fast, precise authoring-time rejections. 3. **A combinator algebra over recipes.** `map`/`filter` iterate a worker recipe over a typed array edge (with the worker resolvable *dynamically* from a prior step's output), `compose` chains recipes through the depth-/cycle-guarded `uses:` edge, and `if-then-else` is the `when:`-guard / `return:`-exit pair — combinators are ordinary recipes, so they inherit fitness, archive, and versioning for free. 4. **A skill standard library as the composition vocabulary.** A searchable, versioned `SkillLibrary` (surface-embedding search with a keyword fallback, Laplace-smoothed fitness ranking) that an `invoke skill:` step resolves against; the resolved skill's output schema is adopted *at compile* so downstream `in:` ports type-check against the real contract, and a `recipe.compose` RPC mechanically assembles a recipe from the top-ranked skill hits. 5. **Catchable recovery with a classified-error taxonomy.** Every step failure is classified into one of a closed set of error kinds with a computed `recoverable` flag; an `onError:` policy router does retry (honored only for recoverable errors), fallback to a recovery recipe, or continue-partial, the last settling as a non-aborting `done-partial` that keeps the survivors. 6. **A self-sharpening loop over real usage.** A nightly consolidation lane reads per-step struggle from the live plan archive and proposes `rewrite_step_text` mutations for struggling steps; an apply path guarded by five rails (strict promote gate, authorship guard, snapshot-before-write, validate-or-skip, kill-switch) can enact them — but is *propose-only by default*, enacting nothing unless an operator sets the kill-switch. 7. **All bounds derived, not frozen.** Re-dispatch, combinator fan-out, composition depth, and recovery-retry budgets are each a function of live signals — value-of-work, historical confidence, prior effort spent, and affordability — never a hardcoded [-constant.-] {+constant. 8. **Typed external signatures and binding resource contracts.** Recipes may declare typed parameters that are validated before dispatch and resolved through explicit values, private storage, context, memory, and an optional durable ask. Child spawns carry token and tool-call caps that the embedded runner enforces during execution, converting a derived plan into a binding resource boundary.+}"
  },
  {
   "section": "4.3 Typed recipe parameters and durable value resolution",
   "old": null,
   "new": "### 4.3 Typed recipe parameters and durable value resolution",
   "marked": "{+### 4.3 Typed recipe parameters and durable value resolution+}"
  },
  {
   "section": "4.3 Typed recipe parameters and durable value resolution",
   "old": null,
   "new": "The contract surface now extends to a recipe's external inputs. A `params:` frontmatter block declares named values of type `string`, `number`, `boolean`, `enum`, or `list<string>`, with optional defaults, patterns, descriptions, and a `secret` marker. `checkParamRefs` rejects undeclared prose substitutions at seed time, while `validateParams` rejects unknown values and coerces or validates supplied values before any worker is dispatched. This turns a recipe from a fixed document into a reusable operation with a checked external signature, although the current implementation does not infer a principal type or prove substitution preservation.",
   "marked": "{+The contract surface now extends to a recipe's external inputs. A `params:` frontmatter block declares named values of type `string`, `number`, `boolean`, `enum`, or `list<string>`, with optional defaults, patterns, descriptions, and a `secret` marker. `checkParamRefs` rejects undeclared prose substitutions at seed time, while `validateParams` rejects unknown values and coerces or validates supplied values before any worker is dispatched. This turns a recipe from a fixed document into a reusable operation with a checked external signature, although the current implementation does not infer a principal type or prove substitution preservation.+}"
  },
  {
   "section": "4.3 Typed recipe parameters and durable value resolution",
   "old": null,
   "new": "Resolution is tiered. Explicit call-site values, recipe-scoped or global private values, environment values, and defaults are considered first; best-effort context extraction and episodic-memory recall follow. Every inferred or recalled candidate is revalidated against the declaration, and `secret:true` values are excluded from inference and recall. If a required value remains missing, the non-interactive default is a classified `missing-var` failure before dispatch. An interactive run may instead opt into a durable ask: the plan is persisted as `blocked-awaiting-input`, the missing names and prompts are surfaced, and the run resumes after an answer without retaining a synchronous stack frame. The private store lives outside the publishable recipe and is written with owner-only permissions, separating the shareable signature from machine-local values.",
   "marked": "{+Resolution is tiered. Explicit call-site values, recipe-scoped or global private values, environment values, and defaults are considered first; best-effort context extraction and episodic-memory recall follow. Every inferred or recalled candidate is revalidated against the declaration, and `secret:true` values are excluded from inference and recall. If a required value remains missing, the non-interactive default is a classified `missing-var` failure before dispatch. An interactive run may instead opt into a durable ask: the plan is persisted as `blocked-awaiting-input`, the missing names and prompts are surfaced, and the run resumes after an answer without retaining a synchronous stack frame. The private store lives outside the publishable recipe and is written with owner-only permissions, separating the shareable signature from machine-local values.+}"
  },
  {
   "section": "5. Derived, Not Frozen — The Budget Principle",
   "old": "- **Re-dispatch budget** (`deriveRedispatchBudget`, `redispatch-budget.ts`). When a typed step's output fails to validate against its `out:` schema, the runner re-dispatches with a corrective prompt carrying the validator's error text. How many times is `1 + min(3, ⌊requiredFieldCount/2⌋)` worth-of-work, scaled by `(0.5 + uncertainty)` where `uncertainty = 1 − fitnessSuccessRate`, then clamped by affordability (`⌊remainingTokenBudget / estStepTokens⌋`) and floored at 1. More structure at stake earns more attempts (saturating, so a huge schema cannot run away); a shakier recipe earns more attempts; a thin budget cuts them. - **Combinator fan-out** (`deriveCombinatorFanOut`, `combinator-budget.ts`). The width of a `map`/`filter` step is `min(arrayLength, ⌊remainingDispatchBudget / estIterationCost⌋)` — exactly as wide as the data, narrowed only when the budget cannot pay for the full array. No frozen iteration cap. - **Composition depth** (`deriveUsesDepthBudget`, `combinator-budget.ts`). The maximum `uses:`/combinator nesting depth is `max(USES_DEPTH_FLOOR, ⌊remainingDispatchBudget / estIterationCost⌋)`, with `USES_DEPTH_FLOOR = 3` as the floor when no budget signal is threaded. The runner computes `MAX_USES_DEPTH = deriveUsesDepthBudget({})` — a derivation that defaults to the floor, not a literal `const MAX_DEPTH = 3`. - **Recovery-retry budget** (`deriveRecoveryRetryBudget`, `recovery-budget.ts`). How many times an `onError: retry` policy re-runs a failed step is `max(1, ambition − priorAttempts)` where `ambition = 1 + round(2·uncertainty)`, again clamped by affordability. A reliable recipe still gets the floor of 1; a wholly unreliable one gets up to ~3 fresh attempts; each prior attempt shaves one off (diminishing returns).",
   "new": "- **Re-dispatch budget** (`deriveRedispatchBudget`, `redispatch-budget.ts`). When a typed step's output fails to validate against its `out:` schema, the runner re-dispatches with a corrective prompt carrying the validator's error text. How many times is `1 + min(3, ⌊requiredFieldCount/2⌋)` worth-of-work, scaled by `(0.5 + uncertainty)` where `uncertainty = 1 − fitnessSuccessRate`, then clamped by affordability (`⌊remainingTokenBudget / estStepTokens⌋`) and floored at 1. More structure at stake earns more attempts (saturating, so a huge schema cannot run away); a shakier recipe earns more attempts; a thin budget cuts them. - **Combinator fan-out** (`deriveCombinatorFanOut`, `combinator-budget.ts`). The width of a `map`/`filter` step is `min(arrayLength, ⌊remainingDispatchBudget / estIterationCost⌋)` — exactly as wide as the data, narrowed only when the budget cannot pay for the full array. No frozen iteration cap. - **Composition depth** (`deriveUsesDepthBudget`, `combinator-budget.ts`). The maximum `uses:`/combinator nesting depth is `max(USES_DEPTH_FLOOR, ⌊remainingDispatchBudget / estIterationCost⌋)`, with `USES_DEPTH_FLOOR = 3` as the floor when no budget signal is threaded. The runner computes `MAX_USES_DEPTH = deriveUsesDepthBudget({})` — a derivation that defaults to the floor, not a literal `const MAX_DEPTH = 3`. - **Recovery-retry budget** (`deriveRecoveryRetryBudget`, `recovery-budget.ts`). How many times an `onError: retry` policy re-runs a failed step is `max(1, ambition − priorAttempts)` where `ambition = 1 + round(2·uncertainty)`, again clamped by affordability. A reliable recipe still gets the floor of 1; a wholly unreliable one gets up to ~3 fresh attempts; each prior attempt shaves one off (diminishing returns). - **Child-spawn envelope** (`deriveSpawnBudget`, `spawn-budget.ts`). A recipe may carry per-child token and tool-call limits. The RPC boundary validates them, and the embedded attempt loop evaluates usage after tool results and assistant-message ticks. Meeting either cap aborts the child with `stopReason: budget-exhausted`; the orchestration layer classifies the result as non-recoverable `budget-exceeded`. This is enforcement, not merely scheduling advice. - **Supervision and missing-value waits.** `deriveOverseerLoopBudget` sizes completion-critic passes from recipe fitness, whether the completion gap is shrinking, prior iterations, and affordability. The ask timeout for a missing parameter is derived in the same manner. Literal maxima remain structural ceilings rather than working values.",
   "marked": "- **Re-dispatch budget** (`deriveRedispatchBudget`, `redispatch-budget.ts`). When a typed step's output fails to validate against its `out:` schema, the runner re-dispatches with a corrective prompt carrying the validator's error text. How many times is `1 + min(3, ⌊requiredFieldCount/2⌋)` worth-of-work, scaled by `(0.5 + uncertainty)` where `uncertainty = 1 − fitnessSuccessRate`, then clamped by affordability (`⌊remainingTokenBudget / estStepTokens⌋`) and floored at 1. More structure at stake earns more attempts (saturating, so a huge schema cannot run away); a shakier recipe earns more attempts; a thin budget cuts them. - **Combinator fan-out** (`deriveCombinatorFanOut`, `combinator-budget.ts`). The width of a `map`/`filter` step is `min(arrayLength, ⌊remainingDispatchBudget / estIterationCost⌋)` — exactly as wide as the data, narrowed only when the budget cannot pay for the full array. No frozen iteration cap. - **Composition depth** (`deriveUsesDepthBudget`, `combinator-budget.ts`). The maximum `uses:`/combinator nesting depth is `max(USES_DEPTH_FLOOR, ⌊remainingDispatchBudget / estIterationCost⌋)`, with `USES_DEPTH_FLOOR = 3` as the floor when no budget signal is threaded. The runner computes `MAX_USES_DEPTH = deriveUsesDepthBudget({})` — a derivation that defaults to the floor, not a literal `const MAX_DEPTH = 3`. - **Recovery-retry budget** (`deriveRecoveryRetryBudget`, `recovery-budget.ts`). How many times an `onError: retry` policy re-runs a failed step is `max(1, ambition − priorAttempts)` where `ambition = 1 + round(2·uncertainty)`, again clamped by affordability. A reliable recipe still gets the floor of 1; a wholly unreliable one gets up to ~3 fresh attempts; each prior attempt shaves one off (diminishing [-returns).-] {+returns). - **Child-spawn envelope** (`deriveSpawnBudget`, `spawn-budget.ts`). A recipe may carry per-child token and tool-call limits. The RPC boundary validates them, and the embedded attempt loop evaluates usage after tool results and assistant-message ticks. Meeting either cap aborts the child with `stopReason: budget-exhausted`; the orchestration layer classifies the result as non-recoverable `budget-exceeded`. This is enforcement, not merely scheduling advice. - **Supervision and missing-value waits.** `deriveOverseerLoopBudget` sizes completion-critic passes from recipe fitness, whether the completion gap is shrinking, prior iterations, and affordability. The ask timeout for a missing parameter is derived in the same manner. Literal maxima remain structural ceilings rather than working values.+}"
  },
  {
   "section": "5. Derived, Not Frozen — The Budget Principle",
   "old": null,
   "new": "The completion critic is itself expressed as a recipe. Its single loop continues until the critic emits an explicit completion marker, with the runner substituting the derived supervision budget under a hard structural ceiling. This is a concrete instance of the control model governing a meta-workflow rather than a separate hard-coded loop.",
   "marked": "{+The completion critic is itself expressed as a recipe. Its single loop continues until the critic emits an explicit completion marker, with the runner substituting the derived supervision budget under a hard structural ceiling. This is a concrete instance of the control model governing a meta-workflow rather than a separate hard-coded loop.+}"
  },
  {
   "section": "9.3 `done-partial` settlement",
   "old": null,
   "new": "The native JavaScript orchestration surface applies the same rule to `parallel()` and `pipeline()`. Each input produces a `Settled<T>` result in input order: either `{ok:true,value}` or `{ok:false,error,index}`. `parallel()` contains a rejected thunk without rejecting the barrier; `pipeline()` records the failed item, skips its remaining stages, and lets other items continue. This is an implementation-level failure-isolation contract, not a formal progress theorem, but it removes the earlier silent-null behavior and preserves attribution to the failing input.",
   "marked": "{+The native JavaScript orchestration surface applies the same rule to `parallel()` and `pipeline()`. Each input produces a `Settled<T>` result in input order: either `{ok:true,value}` or `{ok:false,error,index}`. `parallel()` contains a rejected thunk without rejecting the barrier; `pipeline()` records the failed item, skips its remaining stages, and lets other items continue. This is an implementation-level failure-isolation contract, not a formal progress theorem, but it removes the earlier silent-null behavior and preserves attribution to the failing input.+}"
  },
  {
   "section": "9.4 The self-sharpening loop — propose-only by default",
   "old": null,
   "new": "Mutation durability is separated from the bundled source. Reads probe a writable home-directory recipe overlay before the extension's bundled recipe directory, and saves of `recipe.md` or `kit.md` are redirected to that overlay. The bundled recipe is therefore an immutable base while agent-authored or rewritten recipes survive an upstream source update. Snapshot-before-write protects revision history; overlay-first resolution protects the mutation from being overwritten by deployment.",
   "marked": "{+Mutation durability is separated from the bundled source. Reads probe a writable home-directory recipe overlay before the extension's bundled recipe directory, and saves of `recipe.md` or `kit.md` are redirected to that overlay. The bundled recipe is therefore an immutable base while agent-authored or rewritten recipes survive an upstream source update. Snapshot-before-write protects revision history; overlay-first resolution protects the mutation from being overwritten by deployment.+}"
  },
  {
   "section": "12. Implementation Status and Verification",
   "old": "- **The gradual typed value model and named ports** — `recipe-types.ts` (`Port`, `StepIo`, `parseStepIoDirectives`) and `recipe-runner.ts` (`validateTypedNote`): `out:`/`in:` directives, overlay-not-delete parsing, typed-field binding and `{{steps.n.out.path}}` resolution, and persistence of a validated step output as a structured artifact. - **The compile-time contracts** — `checkPortWiring` (and the guard-reference check) reject forward/self references, missing producers, producers with no `out:` schema, and undeclared fields, with the run refused before any dispatch; an invoked skill's `outputSchema` is adopted at compile so downstream ports check against it. The compile test exercises all rejection paths. - **The combinator algebra** — `parseMapIterDirective`/`parseFilterIterDirective`/`parseKeepDirective` plus the `executeOnce` fan-out: array-edge iteration, dynamic worker resolution via `resolveKitRefTemplate`, single-increment composition depth, `keep:` predicates over the `when:` engine, and survivor aggregation under continue-partial. - **The skill standard library** — `skill-library.ts` (`search`/`read`/`rank`/`recordOutcome`, surface-embedding search with Jaccard fallback, Laplace ranking), `invoke skill:` resolution at compile and dispatch, fitness loopback, and the `prefrontal.recipe.compose` RPC. - **Catchable recovery** — the `ClassifiedError` taxonomy, the `onError:` router (retry honored only for recoverable errors, fallback via the `uses:` edge, continue-partial), and `done-partial` non-aborting settlement. - **The empirical-fitness loop** — `stampRecipeAttribution` (producer), `attributeRecipe`/`updateRecipeFitness` (consolidation), `makeFitnessLookup`/`fitnessSuccessRate` (consumer into the budgets and the matcher). - **All four derived bounds** — `deriveRedispatchBudget`, `deriveCombinatorFanOut`, `deriveUsesDepthBudget` (floor 3), `deriveRecoveryRetryBudget`, each varying with its live inputs and clamped by affordability, wired into the runner and the orchestration schema. - **The control grammar** — `parseWhenDirective`/`evaluateWhen`/`WhenEvalError` and `parseEarlyExitDirective`, with the guard-skip-as-done and `early-exit`-closes-as-`done` settlements. - **Machine-authorability** — `buildRecipeMd`/`validateRecipeSpec`, emitting directives the runner parses back. - **Cross-registry interop** — the `kit/1.0` schema is shared with the Journey registry; a license-gated, attribution-stamped import pipeline distilled four external kits into the live library, which then acquired the contracts, budgets, and recovery of the runner.",
   "new": "- **The gradual typed value model and named ports** — `recipe-types.ts` (`Port`, `StepIo`, `parseStepIoDirectives`) and `recipe-runner.ts` (`validateTypedNote`): `out:`/`in:` directives, overlay-not-delete parsing, typed-field binding and `{{steps.n.out.path}}` resolution, and persistence of a validated step output as a structured artifact. - **The compile-time contracts** — `checkPortWiring` (and the guard-reference check) reject forward/self references, missing producers, producers with no `out:` schema, and undeclared fields, with the run refused before any dispatch; an invoked skill's `outputSchema` is adopted at compile so downstream ports check against it. The compile test exercises all rejection paths. - **The combinator algebra** — `parseMapIterDirective`/`parseFilterIterDirective`/`parseKeepDirective` plus the `executeOnce` fan-out: array-edge iteration, dynamic worker resolution via `resolveKitRefTemplate`, single-increment composition depth, `keep:` predicates over the `when:` engine, and survivor aggregation under continue-partial. - **The skill standard library** — `skill-library.ts` (`search`/`read`/`rank`/`recordOutcome`, surface-embedding search with Jaccard fallback, Laplace ranking), `invoke skill:` resolution at compile and dispatch, fitness loopback, and the `prefrontal.recipe.compose` RPC. - **Catchable recovery** — the `ClassifiedError` taxonomy, the `onError:` router (retry honored only for recoverable errors, fallback via the `uses:` edge, continue-partial), and `done-partial` non-aborting settlement. - **The empirical-fitness loop** — `stampRecipeAttribution` (producer), `attributeRecipe`/`updateRecipeFitness` (consolidation), `makeFitnessLookup`/`fitnessSuccessRate` (consumer into the budgets and the matcher). - **The original four derived bounds** — `deriveRedispatchBudget`, `deriveCombinatorFanOut`, `deriveUsesDepthBudget` (floor 3), `deriveRecoveryRetryBudget`, each varying with its live inputs and clamped by affordability, wired into the runner and the orchestration schema. - **Binding spawn budgets and derived meta-bounds** — validated token/tool-call envelopes enforced by the embedded attempt loop, plus derived Overseer and missing-value wait bounds. - **Typed external parameters** — declared frontmatter types, seed-time reference checks, pre-dispatch validation, private/public value separation, context/memory resolution with revalidation, and optional durable ask/resume. - **Failure isolation in native orchestration** — input-ordered `Settled<T>` results for `parallel()` and `pipeline()`, with classified, index-attributed failures. - **Mutation-safe storage** — overlay-first reads and overlay-directed writes keep agent-authored recipe evolution outside the bundled source tree. - **The control grammar** — `parseWhenDirective`/`evaluateWhen`/`WhenEvalError` and `parseEarlyExitDirective`, with the guard-skip-as-done and `early-exit`-closes-as-`done` settlements. - **Machine-authorability** — `buildRecipeMd`/`validateRecipeSpec`, emitting directives the runner parses back. - **Cross-registry interop** — the `kit/1.0` schema is shared with the Journey registry; a license-gated, attribution-stamped import pipeline distilled four external kits into the live library, which then acquired the contracts, budgets, and recovery of the runner.",
   "marked": "- **The gradual typed value model and named ports** — `recipe-types.ts` (`Port`, `StepIo`, `parseStepIoDirectives`) and `recipe-runner.ts` (`validateTypedNote`): `out:`/`in:` directives, overlay-not-delete parsing, typed-field binding and `{{steps.n.out.path}}` resolution, and persistence of a validated step output as a structured artifact. - **The compile-time contracts** — `checkPortWiring` (and the guard-reference check) reject forward/self references, missing producers, producers with no `out:` schema, and undeclared fields, with the run refused before any dispatch; an invoked skill's `outputSchema` is adopted at compile so downstream ports check against it. The compile test exercises all rejection paths. - **The combinator algebra** — `parseMapIterDirective`/`parseFilterIterDirective`/`parseKeepDirective` plus the `executeOnce` fan-out: array-edge iteration, dynamic worker resolution via `resolveKitRefTemplate`, single-increment composition depth, `keep:` predicates over the `when:` engine, and survivor aggregation under continue-partial. - **The skill standard library** — `skill-library.ts` (`search`/`read`/`rank`/`recordOutcome`, surface-embedding search with Jaccard fallback, Laplace ranking), `invoke skill:` resolution at compile and dispatch, fitness loopback, and the `prefrontal.recipe.compose` RPC. - **Catchable recovery** — the `ClassifiedError` taxonomy, the `onError:` router (retry honored only for recoverable errors, fallback via the `uses:` edge, continue-partial), and `done-partial` non-aborting settlement. - **The empirical-fitness loop** — `stampRecipeAttribution` (producer), `attributeRecipe`/`updateRecipeFitness` (consolidation), `makeFitnessLookup`/`fitnessSuccessRate` (consumer into the budgets and the matcher). - [-**All-] {+**The original+} four derived bounds** — `deriveRedispatchBudget`, `deriveCombinatorFanOut`, `deriveUsesDepthBudget` (floor 3), `deriveRecoveryRetryBudget`, each varying with its live inputs and clamped by affordability, wired into the runner and the orchestration schema. {+- **Binding spawn budgets and derived meta-bounds** — validated token/tool-call envelopes enforced by the embedded attempt loop, plus derived Overseer and missing-value wait bounds. - **Typed external parameters** — declared frontmatter types, seed-time reference checks, pre-dispatch validation, private/public value separation, context/memory resolution with revalidation, and optional durable ask/resume. - **Failure isolation in native orchestration** — input-ordered `Settled<T>` results for `parallel()` and `pipeline()`, with classified, index-attributed failures. - **Mutation-safe storage** — overlay-first reads and overlay-directed writes keep agent-authored recipe evolution outside the bundled source tree.+} - **The control grammar** — `parseWhenDirective`/`evaluateWhen`/`WhenEvalError` and `parseEarlyExitDirective`, with the guard-skip-as-done and `early-exit`-closes-as-`done` settlements. - **Machine-authorability** — `buildRecipeMd`/`validateRecipeSpec`, emitting directives the runner parses back. - **Cross-registry interop** — the `kit/1.0` schema is shared with the Journey registry; a license-gated, attribution-stamped import pipeline distilled four external kits into the live library, which then acquired the contracts, budgets, and recovery of the runner."
  },
  {
   "section": "12. Implementation Status and Verification",
   "old": null,
   "new": "**Not formally established.** The implementation defines parsers, validators, transitions, and settlement behavior, but this paper gives no formal syntax, small-step or big-step operational semantics, preservation/progress argument, or soundness theorem. Likewise, the unit and integration tests do not establish comparative research efficacy. The contribution should therefore be read as a systems design with executable contracts, pending formalization or public benchmark evidence.",
   "marked": "{+**Not formally established.** The implementation defines parsers, validators, transitions, and settlement behavior, but this paper gives no formal syntax, small-step or big-step operational semantics, preservation/progress argument, or soundness theorem. Likewise, the unit and integration tests do not establish comparative research efficacy. The contribution should therefore be read as a systems design with executable contracts, pending formalization or public benchmark evidence.+}"
  },
  {
   "section": "13. Limitations and Negative Results",
   "old": null,
   "new": "10. **There is no formal semantics or soundness result.** “Gradual type system” names an engineering architecture of optional schemas, pre-dispatch checks, runtime validation, and classified transitions. The paper does not define a formal judgment or prove progress, preservation, blame, or gradual guarantees.",
   "marked": "{+10. **There is no formal semantics or soundness result.** “Gradual type system” names an engineering architecture of optional schemas, pre-dispatch checks, runtime validation, and classified transitions. The paper does not define a formal judgment or prove progress, preservation, blame, or gradual guarantees.+}"
  },
  {
   "section": "13. Limitations and Negative Results",
   "old": null,
   "new": "11. **There is no public comparative workflow benchmark.** Repository tests verify that mechanisms behave as implemented; they do not show fewer integration failures, lower carry-forward cost, or better task outcomes than prose-only workflows or other orchestration systems. Those claims remain hypotheses until evaluated on a public corpus with matched baselines, ablations, repeated runs, and uncertainty estimates.",
   "marked": "{+11. **There is no public comparative workflow benchmark.** Repository tests verify that mechanisms behave as implemented; they do not show fewer integration failures, lower carry-forward cost, or better task outcomes than prose-only workflows or other orchestration systems. Those claims remain hypotheses until evaluated on a public corpus with matched baselines, ablations, repeated runs, and uncertainty estimates.+}"
  },
  {
   "section": "17. Conclusion",
   "old": "BROCA supplies the missing grammar, and it is built, not promised. A gradual typed value model lets a step declare what it produces and consume named, typed fields from its predecessors, while every untyped step keeps its exact prose behavior. Compile-time contracts check, before anything runs, that every input port and every guard reference resolves to a real, earlier producer that declares the field — and a skill's output contract is folded in at compile so even composed steps type-check. A `when:` guard backed by a closed, sandboxed boolean grammar (emphatically not an `eval`) and a `return:`/`done:` early-exit carrying a typed value give the minimal control surface — and *are* the if-then-else branch. A combinator algebra maps and filters a worker recipe across a typed array, with the worker selectable by the data itself, and composes recipes through a depth-guarded sub-recipe edge. A searchable skill standard library gives the algebra a vocabulary, and a `compose` RPC assembles recipes from it mechanically. Catchable recovery classifies every failure and routes it through retry, fallback, or continue-partial, so a survivable failure is a recorded `done-partial`, not a crash. A nightly loop reads per-step struggle from the live archive and proposes sharper step text — applying it autonomously only when an operator opts in. And every bound the language enforces — re-dispatch, fan-out, depth, recovery-retry — is derived from value-of-work, confidence, effort, and affordability, never frozen to a constant.",
   "new": null,
   "marked": "[-BROCA supplies the missing grammar, and it is built, not promised. A gradual typed value model lets a step declare what it produces and consume named, typed fields from its predecessors, while every untyped step keeps its exact prose behavior. Compile-time contracts check, before anything runs, that every input port and every guard reference resolves to a real, earlier producer that declares the field — and a skill's output contract is folded in at compile so even composed steps type-check. A `when:` guard backed by a closed, sandboxed boolean grammar (emphatically not an `eval`) and a `return:`/`done:` early-exit carrying a typed value give the minimal control surface — and *are* the if-then-else branch. A combinator algebra maps and filters a worker recipe across a typed array, with the worker selectable by the data itself, and composes recipes through a depth-guarded sub-recipe edge. A searchable skill standard library gives the algebra a vocabulary, and a `compose` RPC assembles recipes from it mechanically. Catchable recovery classifies every failure and routes it through retry, fallback, or continue-partial, so a survivable failure is a recorded `done-partial`, not a crash. A nightly loop reads per-step struggle from the live archive and proposes sharper step text — applying it autonomously only when an operator opts in. And every bound the language enforces — re-dispatch, fan-out, depth, recovery-retry — is derived from value-of-work, confidence, effort, and affordability, never frozen to a constant.-]"
  },
  {
   "section": "17. Conclusion",
   "old": null,
   "new": "BROCA supplies an implemented grammar. A gradual typed value model lets a step declare what it produces and consume named fields from its predecessors, while every untyped step keeps its prose behavior. Pre-dispatch contracts check ports, guards, and parameter references; runtime validation checks produced values. Typed external parameters separate publishable signatures from private values and can pause durably for missing operator input. A closed `when:` grammar and typed early exit provide conditional control. Iteration and native parallel pipelines isolate branch failures as classified settlements. Child resource envelopes are enforced during execution, and supervision and recovery bounds are derived from live signals. Agent-authored mutations live in an overlay that survives source updates.",
   "marked": "{+BROCA supplies an implemented grammar. A gradual typed value model lets a step declare what it produces and consume named fields from its predecessors, while every untyped step keeps its prose behavior. Pre-dispatch contracts check ports, guards, and parameter references; runtime validation checks produced values. Typed external parameters separate publishable signatures from private values and can pause durably for missing operator input. A closed `when:` grammar and typed early exit provide conditional control. Iteration and native parallel pipelines isolate branch failures as classified settlements. Child resource envelopes are enforced during execution, and supervision and recovery bounds are derived from live signals. Agent-authored mutations live in an overlay that survives source updates.+}"
  },
  {
   "section": "17. Conclusion",
   "old": "We have been precise about the lines that remain: autonomous self-editing is shipped but off by default; the combinators are shipped as mechanism with their first-class naming deliberately unfrozen; the value-model efficiency claim is argued but not yet measured; and the skill embedding ranks surface similarity, not meaning, with quality carried by the fitness loop rather than the geometry. Those lines are not hedges — they are the same discipline the type system itself embodies. A grammar earns trust by checking its claims before it acts on them. So should the paper that describes it.",
   "new": null,
   "marked": "[-We have been precise about the lines that remain: autonomous self-editing is shipped but off by default; the combinators are shipped as mechanism with their first-class naming deliberately unfrozen; the value-model efficiency claim is argued but not yet measured; and the skill embedding ranks surface similarity, not meaning, with quality carried by the fitness loop rather than the geometry. Those lines are not hedges — they are the same discipline the type system itself embodies. A grammar earns trust by checking its claims before it acts on them. So should the paper that describes it.-]"
  },
  {
   "section": "17. Conclusion",
   "old": null,
   "new": "The research boundary is equally important: autonomous self-editing is off by default; first-class combinator packaging remains unfrozen; the value-model efficiency claim is unmeasured; and the paper supplies neither formal semantics nor a public comparative workflow benchmark. The implementation is evidence that the mechanisms exist, not evidence of soundness or superiority. A grammar earns trust by checking its claims before it acts on them. So should the paper that describes it.",
   "marked": "{+The research boundary is equally important: autonomous self-editing is off by default; first-class combinator packaging remains unfrozen; the value-model efficiency claim is unmeasured; and the paper supplies neither formal semantics nor a public comparative workflow benchmark. The implementation is evidence that the mechanisms exist, not evidence of soundness or superiority. A grammar earns trust by checking its claims before it acts on them. So should the paper that describes it.+}"
  }
 ]
}
