Skip to content

Commit c0ec800

Browse files
authored
feat(skills)!: move machine envelope to orchestration layer (#28)
## What Moves the machine-readable turn envelope out of the per-skill contract and into the orchestration layer that is its only consumer. - Removes the `## Machine envelope` section and its turn-contract emission clause from the 14 user-facing skills that carried it: `audit-docs, audit-pr, bump-skill, design-feature, execute-phase, generate-docs, init-workspace, log-session, plan-feature, plan-fix, product-audit, review-change, ship-roadmap, triage-issue`. Every turn now ends cleanly at the closing `→ Next:` block. - `workflow-status` is unchanged — emitting the envelope inline *is* its function. - `orchestration-envelope` (internal) gains the canonical **driver-injected system-prompt snippet** and documents the **repair loop** (parse-fail → re-invoke with `Emit only the machine envelope for the turn above.`; one retry, then a driver-level `FAILED`). - `docs/workflow/ORCHESTRATION.md` and `docs/workflow/PORTABLE_PROMPT.md` mirror the snippet + repair-loop protocol for driver authors. - MAJOR version bump for each of the 14 skills; MINOR for `orchestration-envelope`. `CHANGELOG.md`/`CHANGELOG.es.md` rows, README skill/model tables refreshed, `docs/workflow/MIGRATION.md` entry added. - `packages/agentic-workflow-schema/` (the envelope JSON schema + npm package) is untouched — parsers keep working. ## Why - The envelope's only consumer is an external driver/orchestrator; in interactive chat the trailing JSON was noise. - Weak models drop end-of-document duties — the workflow's own stated reasoning for front-loading turn contracts — yet the envelope sat at the very end, so weak models were penalized for a duty a static `SKILL.md` instruction could never actually enforce or recover from. - Enforcement now sits at the layer that reads the envelope: a driver can detect a missing envelope and re-ask, something a skill body cannot do for itself. ## Driver gate note The SPEC records this as a driver-gated feature: execution should not start until an external driver's repair loop is confirmed ready. No such external driver exists yet for this repo (user-confirmed during execution), so this was proceeded under `--force`, recorded in `decisions.md` (D9). Any future driver picking up this repo must inject the canonical snippet (from `orchestration-envelope`) and implement the repair loop before relying on these 14 skills' output for routing. ## Evidence - AC1–AC10 all green (see `docs/features/10-envelope-orchestrator-only/TASKS.md` for the full per-phase verification log). - `npx skills add . --list` — 56 skills discovered, no malformed frontmatter. - `git diff --name-only origin/main...HEAD | grep '^packages/agentic-workflow-schema/'` — no output (schema untouched). Closes #17
2 parents a543edb + ccad7f2 commit c0ec800

33 files changed

Lines changed: 1006 additions & 423 deletions

File tree

CHANGELOG.es.md

Lines changed: 29 additions & 1 deletion
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 28 additions & 1 deletion
Large diffs are not rendered by default.

README.es.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,22 @@ mantiene, el techo se mueve.
347347

348348
## Orquestación programática
349349

350-
Toda skill de cara al usuario termina con un **envelope máquina** — un bloque
351-
JSON fijo y cercado (state, unit, phase, PR, findings, blockers, orden de
352-
construcción de dependencias, siguiente comando recomendado + pista de tier de
353-
modelo). Un driver externo — un bucle de shell, CI, tu propio programa — lo
350+
Las skills se leen limpias en el chat interactivo — sin JSON al final. Un
351+
driver que quiera orquestarlas (un bucle de shell, CI, tu propio programa)
352+
inyecta el **snippet canónico de system-prompt** para que cada invocación
353+
termine con un **envelope máquina** — un bloque JSON fijo y cercado (state,
354+
unit, phase, PR, findings, blockers, orden de construcción de dependencias,
355+
siguiente comando recomendado + pista de tier de modelo) — y ejecuta un
356+
**bucle de reparación** cuando un turno lo omite (reintenta con un prompt de
357+
una línea; un reintento, luego un fallo a nivel de driver). El driver lo
354358
parsea e invoca la siguiente skill con el modelo que tú elijas en cada paso.
355359
Es la sustitución neutral de proveedor del `/loop` y los subagentes de Claude
356360
Code: el mismo bucle que `ship-roadmap` ejecuta dentro del agente, alojado
357-
fuera de cualquier agente. `workflow-status` es el sensor de solo lectura que
358-
reporta el árbol de dependencias completo y qué es arrancable. Protocolo,
359-
máquina de estados y esqueleto de driver:
361+
fuera de cualquier agente. `workflow-status` es la única skill que sigue
362+
emitiendo el envelope en línea — es un sensor de solo lectura que reporta el
363+
árbol de dependencias completo y qué es arrancable, así que emitirlo es toda
364+
su función. Protocolo, snippet, bucle de reparación, máquina de estados y
365+
esqueleto de driver:
360366
**[`docs/workflow/ORCHESTRATION.md`](docs/workflow/ORCHESTRATION.md)**. Para
361367
drivers JS/TS, **[`@gtrabanco/agentic-workflow-schema`](packages/agentic-workflow-schema/)**
362368
(npm) trae los tipos, el JSON Schema y `parseEnvelope()` implementando el

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,20 @@ produce shallower judgment; the discipline holds, the ceiling moves.
335335

336336
## Programmatic orchestration
337337

338-
Every user-facing skill ends with a **machine envelope** — one fixed, fenced
339-
JSON block (state, unit, phase, PR, findings, blockers, dependency build
340-
order, recommended next command + model-tier hint). An external driver — a
341-
shell loop, CI, your own program — parses it and invokes the next skill on
342-
the model you choose per step. This is the vendor-neutral replacement for
343-
Claude Code's `/loop` and subagents: the same loop `ship-roadmap` runs
344-
in-agent, hosted outside any agent. `workflow-status` is the read-only sensor
345-
that reports the full dependency tree and what's startable. Protocol, state
346-
machine, and a driver skeleton:
338+
The skills read cleanly in interactive chat — no trailing JSON. A driver that
339+
wants to orchestrate them (a shell loop, CI, your own program) injects the
340+
canonical **system-prompt snippet** so each invocation ends with a **machine
341+
envelope** — one fixed, fenced JSON block (state, unit, phase, PR, findings,
342+
blockers, dependency build order, recommended next command + model-tier
343+
hint) — and runs a **repair loop** when a turn omits it (re-ask with a
344+
one-line prompt; one retry, then a driver-level failure). The driver then
345+
parses the envelope and invokes the next skill on the model you choose per
346+
step. This is the vendor-neutral replacement for Claude Code's `/loop` and
347+
subagents: the same loop `ship-roadmap` runs in-agent, hosted outside any
348+
agent. `workflow-status` is the one skill that still emits the envelope
349+
inline — it's a read-only sensor reporting the full dependency tree and
350+
what's startable, so emitting it is its whole job. Protocol, snippet, repair
351+
loop, state machine, and a driver skeleton:
347352
**[`docs/workflow/ORCHESTRATION.md`](docs/workflow/ORCHESTRATION.md)**. For
348353
JS/TS drivers, **[`@gtrabanco/agentic-workflow-schema`](packages/agentic-workflow-schema/)**
349354
(npm) ships the types, the JSON Schema, and `parseEnvelope()` implementing the

docs/features/01-generate-docs/SPEC.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ agentic-workflow pack itself.
7878
frontmatter key (`generated-by: agentic-workflow/generate-docs`,
7979
`source-unit: <NN-slug|fix-n>`), so audit-docs can find orphans.
8080
- Turn contract, fixed output contract (report block + `PASS | FAIL`-style
81-
decision), closing `→ Next:` block, machine envelope (last output),
81+
decision), closing `→ Next:` block, machine envelope (last output;
82+
superseded 2026-07-10 by feature 10 — see `docs/workflow/MIGRATION.md`),
8283
`## Portability` section, Allowed/Forbidden lists.
8384
2. `execute-phase`: at unit close-out, when a docs adapter is declared, the
8485
closing `→ Next:` block recommends `/generate-docs` (docs regeneration is a

docs/features/06-design-feature/SPEC.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ Docs/skills-only change — the skills are the product here. Invariants to hold:
222222
`plan-feature``state` = `OK` (designed), `NEEDS_INPUT` (interview question
223223
pending), or `BLOCKED` (unresolvable capability gap). `next.recommended` =
224224
`/plan-feature <slug>`.
225+
*(Superseded 2026-07-10 by feature 10: `design-feature` dropped its inline
226+
`## Machine envelope` section; the contract moved to the orchestration
227+
layer. See `docs/workflow/MIGRATION.md`.)*
225228
- **One-PR-per-unit, against `main`**; conventional commits.
226229

227230
## Design
@@ -445,8 +448,9 @@ this feature. This is the substrate later phases reference.
445448
contract`, `Step 0`, `Process` (raw-idea interview folded in + proportional
446449
research + capability-closure checklist + per-feature tooling notes + upsert +
447450
interaction rule + scale-down), `Guardrails`, `## Portability`, `Relationship to
448-
other skills`, `Done when`, `→ Next:` block, and the machine envelope. Writes the
449-
SPEC product half + stamps the `designed` marker.
451+
other skills`, `Done when`, `→ Next:` block, and the machine envelope
452+
*(superseded 2026-07-10 by feature 10 — see `docs/workflow/MIGRATION.md`)*.
453+
Writes the SPEC product half + stamps the `designed` marker.
450454

451455
**P3 — `plan-feature` slim (MAJOR) + interview retirement + from-issue/scaffold
452456
alignment.** Slim the router (remove interview path; add the redirect gate on the
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# 10 — envelope-orchestrator-only · PLAN
2+
3+
Phased implementation plan. Phases are labelled `P1, P2, …` (the executor's
4+
argument, e.g. `execute-phase 10 P2`). Planning is done; `P1` is the first
5+
implementation phase. The last phase is hardening. Opening the PR is the final
6+
*step* of P4, not a phase of its own.
7+
8+
> **Execution is driver-gated.** Do not start P1 until the user confirms the
9+
> external opencode/Node driver ships the envelope repair loop (see SPEC
10+
> Dependencies + `known-issues.md`). Planning is complete regardless.
11+
12+
## P1 — Orchestration home (the contract moves in)
13+
14+
One concern: the orchestration layer. Add, before anything is removed from the
15+
skills, the canonical contract at its new home so nothing is momentarily
16+
homeless.
17+
18+
- Add the canonical **driver system-prompt snippet** (fenced, verbatim) to
19+
`skills/orchestration-envelope/SKILL.md`.
20+
- Document the **repair loop** protocol (parse-fail → re-invoke with the one-line
21+
prompt) in `docs/workflow/ORCHESTRATION.md`.
22+
- Mirror the snippet into `docs/workflow/PORTABLE_PROMPT.md` (the prompt a driver
23+
injects).
24+
- Note `workflow-status` stays the inline emitter (no repair loop needed for it).
25+
- Gate: AC4, AC5.
26+
27+
## P2 — Strip the 14 skills
28+
29+
One concern/layer: skills text. Uniform, mechanical, grep-checkable. Apply the
30+
three-deletion removal shape (SPEC → Design) to each:
31+
`audit-docs, audit-pr, bump-skill, design-feature, execute-phase, generate-docs,
32+
init-workspace, log-session, plan-feature, plan-fix, product-audit, review-change,
33+
ship-roadmap, triage-issue`.
34+
35+
- Delete the `## Machine envelope` section.
36+
- Delete the turn-contract envelope box line(s).
37+
- Remove any "then the machine envelope" clause so `→ Next:` is the true last
38+
output.
39+
- Do **not** touch `workflow-status` or `orchestration-envelope`.
40+
- Do **not** hand-edit `version:` here (P3 does it via bump-skill).
41+
- Gate: AC1, AC2, AC3.
42+
43+
## P3 — Release metadata
44+
45+
One concern: version/release docs.
46+
47+
- Run `bump-skill` for the 14 stripped skills: MAJOR bump each, add rows to
48+
`CHANGELOG.md` + `CHANGELOG.es.md`, refresh both README skill/model tables.
49+
- Add the `docs/workflow/MIGRATION.md` entry (what/where-now, per SPEC → Design).
50+
- Gate: AC6, AC7.
51+
52+
## P4 — Hardening + PR
53+
54+
Edge cases + dev-scenario failure modes, then close out.
55+
56+
- Sweep for **dangling envelope references** across `skills/` and `docs/workflow/`
57+
(AC10) — any skill still pointing at a removed section is fixed.
58+
- Confirm `packages/agentic-workflow-schema/` is untouched (AC8).
59+
- Confirm `npx skills add . --list` lists all skills (AC9).
60+
- Re-confirm `workflow-status` still emits (AC3) and P1's repair-loop doc reads
61+
coherently end-to-end.
62+
- Re-run every AC command; all pass.
63+
- Open the PR (`gh pr create --body-file …`, body includes `Closes #17`), PRINT
64+
THE PR URL, update the roadmap row to `done · [#<pr>]`, commit `docs: link PR`.
65+
- Gate: full AC re-run green.

0 commit comments

Comments
 (0)