Skip to content
14 changes: 11 additions & 3 deletions meta/techniques/workflow-engine/TECHNIQUE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
metadata:
version: 6.10.0
version: 6.11.0
---

## Capability
Expand All @@ -25,6 +25,14 @@ Client walks dispatch workers via [dispatch-activity](./dispatch-activity.md), e

Resource refs returned in operation bodies (e.g. `planning-readme`) are lightweight pointers. When `get_activity` includes a sibling `resources` map, reuse those bodies (or unchanged markers). Otherwise load via `get_resource { session_index, resource_id }`.

The ids come from the delivery: the `resources` map keys, `resource_refs`, and the refs in the operation bodies this response carried, each already qualified. Pass one of those verbatim. A ref that will not resolve is a definition defect to report, not a spelling to search for — an id guessed under another workflow prefix or another slug spelling costs a round trip and returns an error, and the id that would have worked was in the response already.

### fetch-costs-what-it-delivers

A fetch hands over the whole composed body — thousands of characters, whatever fraction of it a step reads — so ask for what the step needs and reuse what a response already carried.

A second ask is cheap rather than free, and cheap is not a licence: how to avoid it is [resource-section-or-whole](#resource-section-or-whole), when a marker comes back instead of a body is [agent-id-scopes-delivery](#agent-id-scopes-delivery), and a marker inside one response is explained by that response's own notes, which govern. Read a marker as the expected answer rather than an error, and where content has genuinely left this context, [force-full-after-summarization](#force-full-after-summarization) is how to get it back.

### resource-section-or-whole

Choose bare vs `#section` `resource_id` by how much of the resource this agent context will need. Prefer a `#section` anchor when the current step needs a single slice of a large resource. When the same agent context will need two or more sections from the same resource in the current activity (or in the immediate next steps of that activity), call `get_resource` once with the bare resource id and reuse that content — do not issue repeated section fetches for the same file. Bare and `#section` ids are distinct delivery keys: loading sections does not populate the whole-resource key, and loading the whole file does not collapse a later section fetch under a different key. In the eager `resources` map the file takes precedence — a bundled whole resource carries its own sections, so a technique citing both ways receives the file alone and its sections are read out of that body rather than fetched again. Unchanged-references and `full: true` follow [force-full-after-summarization](#force-full-after-summarization).
Expand All @@ -35,7 +43,7 @@ Variables mutate from two sources only: checkpoint option effects (`setVariable`

### agent-id-scopes-delivery

The delivery ledger is keyed on agent context, not on the session. `agent_id` on `get_activity`, `get_technique` and `get_resource` names that context — the worker agent identity bound into the stub that dispatches or continues the agent — and each context reads and writes its own ledger. A first dispatch under a new `agent_id` holds no prior deliveries, so it takes full delivery; the same `agent_id` calling again is that context resumed, where `bundle: "reference"` collapses what it already received to unchanged markers. A solo walk is the one case carrying no `agent_id`, the session's own agent being its only context.
The delivery ledger is keyed on agent context, not on the session. `agent_id` on `get_activity`, `get_technique` and `get_resource` names that context — the worker agent identity bound into the stub that dispatches or continues the agent — and each context reads and writes its own ledger. A first dispatch under a new `agent_id` holds no prior deliveries, so it takes full delivery; the same `agent_id` calling again is that context resumed, and what it already received arrives as unchanged markers — on `get_activity` when the call carries `bundle: "reference"`, and on a repeat `get_technique` or `get_resource` whether or not it does ([fetch-costs-what-it-delivers](#fetch-costs-what-it-delivers)). The session's own identity is the exception, whether a call passes it or omits `agent_id` and falls back to it: several contexts can hold it at once, so under it a name is no evidence of one context and a repeat collapses only where the call declares reference delivery — which is what a solo walk, the one context that legitimately owns that identity, does.

### force-full-after-summarization

Expand All @@ -47,4 +55,4 @@ Before executing any step, confirm the activity `id` returned by the `get_activi

### progressive-step-technique-load

A step's bound technique loads as that step is reached; the whole activity is never pre-fetched. `get_technique { session_index, step_id }` serves steps not already inlined, and where `get_activity` carries `step_techniques` or a sibling `resources` map, those response notes govern — begin-beat, reuse map, lazy remainder — rather than bundling policy re-derived in prose.
A step's bound technique loads as that step is reached; the whole activity is never pre-fetched. `get_technique { session_index, step_id }` serves steps not already inlined, and where `get_activity` carries `step_techniques` or a sibling `resources` map, those response notes govern — begin-beat, reuse map, lazy remainder — rather than bundling policy re-derived in prose. An inlined step is read from the bundle; re-fetching it pays the round trip for content the response already delivered ([fetch-costs-what-it-delivers](#fetch-costs-what-it-delivers)).
6 changes: 3 additions & 3 deletions meta/techniques/workflow-engine/activity-worker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
metadata:
version: 1.5.0
version: 1.6.0
---

## Capability
Expand Down Expand Up @@ -35,7 +35,7 @@ Worker agent identity for this dispatch.

- Confirm the activity `id` on the `get_activity` response whose operations bundle delivered this technique equals `{activity_id}` per [verify-dispatched-activity](./TECHNIQUE.md#verify-dispatched-activity)
- Follow the operations bundle and delivery notes on that same response (`step_techniques_note`, `resources_note`, reference-mode notes)
- Read `may_continue` from `_meta.batch` on that response — this context's standing against its bound ([batch-ends-where-the-server-says](#batch-ends-where-the-server-says))
- Read `may_continue` from the `batch:` block leading that response — this context's standing against its bound ([batch-ends-where-the-server-says](#batch-ends-where-the-server-says))

### 2. Load resources

Expand Down Expand Up @@ -81,4 +81,4 @@ The last thing this context emits is the envelope this activity owes — the `ch

### batch-ends-where-the-server-says

`_meta.batch` on each `get_activity` reports how many activities this context has taken, what it has been delivered, and whether it may take another. On `may_continue: false`, finish the current activity and report it — do not ask for a further one. If you do ask, the server refuses with the payload undelivered: report that activity as needing its own dispatch and stop.
Each `get_activity` opens with a `batch:` block reporting how many activities this context has taken, what it has been delivered, its two limits, and whether it may take another; `_meta.batch` carries the same reading. On `may_continue: false`, finish the current activity and report it — do not ask for a further one. If you do ask, the server refuses with the payload undelivered: report that activity as needing its own dispatch and stop.
8 changes: 7 additions & 1 deletion meta/techniques/workflow-engine/dispatch-activity.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
metadata:
version: 1.17.0
version: 1.18.0
---

## Capability
Expand Down Expand Up @@ -74,6 +74,12 @@ Where the session record and a just-completed worker's `activity_complete` envel

Client finalize/retrospective paths that consume execution history MUST resolve accumulated `trace_tokens[]` once via `get_trace { session_index, trace_tokens }` (optionally `inspect_session` for fetch/fidelity context). This operation owns the accumulate half of the contract; the client's close-out path owns the resolve. Skip resolve when `trace_tokens` is empty.

### say-what-a-dispatch-is-doing

Leave the user no silent minute. Before spawning, tell them what is about to run, which gate their answer is next needed at — the first checkpoint of that activity, or that it runs to completion without one — and how long a comparable dispatch took where the session record carries a figure. Where this dispatch is one of a run of activities under one worker, say which of the run it is. Name any wait you impose between dispatches as you impose it: a commit cycle, a reconciliation, a retry.

A dispatch produces nothing the user can read while it runs, and a gate arrives whenever the worker reaches one. So a cost not quoted before it is spent reads as a stall, and a gate nobody was told to expect arrives to someone who has stopped watching.

### no-get-activity-from-orchestrator

Workflow orchestrators NEVER call `get_activity`.
Expand Down
4 changes: 2 additions & 2 deletions meta/techniques/workflow-engine/finalize-activity.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
metadata:
version: 1.4.0
version: 1.5.0
---

## Capability
Expand All @@ -23,7 +23,7 @@ Array of artifact entries (`id`, `name`, `path`).

### batch_may_continue

Whether this worker's context may take another activity, read from `_meta.batch.may_continue` on the `get_activity` response for this activity ([batch-ends-where-the-server-says](./activity-worker.md#batch-ends-where-the-server-says)). The envelope is the only place this answer appears again, so it is read here and carried there unchanged.
Whether this worker's context may take another activity, read from `may_continue` in the `batch:` block of the `get_activity` response for this activity ([batch-ends-where-the-server-says](./activity-worker.md#batch-ends-where-the-server-says)). The envelope is the only place this answer appears again, so it is read here and carried there unchanged.

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion meta/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$schema: ../../schemas/workflow.schema.json
id: meta
version: 5.20.0
version: 5.21.0
title: Meta Workflow
description: Top-level lifecycle workflow that orchestrates client workflow sessions. Excluded from list_workflows — bootstrap navigates here directly.
author: m2ux
Expand Down