Update templates and authoring skill to the current pipeline contract
Bring the packaged starters and the pipelines skill up to the guidelines the project now works to. Templates: - task and three-stage now end in a committer stage that stages the union of the runner's captured input.server_changed_files and the producer's declared changed_files, runs the repository's checks, commits locally and never pushes; their producers no longer commit. - Every model/agent prompt states the line-oriented result contract (outcome on the first non-empty line, "# output" JSON map, other "# <heading>" sections kept verbatim as evidence) and an "# evidence" section for exact commands and results, with proportionate verification and no fabricated checks. - Stages that can write save their reports, logs and screenshots into the runtime artifacts directory. - Remove the summary starter: a tool-free single-prompt text transform with no repository interaction, artifact or commit is a format demonstration, not a reusable workflow. No starter invents a pretend approval stage; a decision point is a type=human stage. Skill: - references/format.md gains a Result format section (line form, legacy JSON precedence, result_parse, raw-output.md, artifacts) and a Committer stages section with the pre-commit checklist; the role-split and envelope notes mention the line form and the committer. - orchestration.md points at the checklist and records that a genuine gate is a human stage; operations.md and the SKILL.md index drop the removed starter and name the result format and committer. No new reference, so the managed inventory is unchanged. Docs/tests: examples/README, README, docs/cli, docs/first-version-testing, the CLI help example and the smoke script track the four starters; catalog, tool-role, server, tui and pipeline tests are updated, with a new test pinning the committer ending and server-captured change set. Commands run: go build ./...; go vet ./...; go test ./...; python3 -m unittest discover -s scripts -p 'test_*.py'; python3 scripts/smoke-first-install.py. All passed. Templates inspected through an isolated CLI server (pipelines templates; pipelines template KEY --source). No server, service or device was restarted, and nothing was pushed.
This commit is contained in:
@@ -63,7 +63,7 @@ and `references/format.md` (in parallel when possible); for notifications also r
|
||||
| Parallel lanes, worktrees, sync/merge, restart replay | `references/lanes.md` |
|
||||
| Diagnose a wedged, blocked or failed run | `references/debugging.md` |
|
||||
| Publish artefacts, LAN URLs, install boundaries | `references/delivery.md` |
|
||||
| Definition format, tools, permissions, routing, schedules, budgets | `references/format.md` |
|
||||
| Result format, tools, permissions, committer, routing, schedules, budgets | `references/format.md` |
|
||||
| Bounded loops, independent review, selected shared context | `references/control.md` |
|
||||
| OpenCode/Pi configuration, model defaults, harness limits | `references/harnesses.md` |
|
||||
| Phone alerts and report/file attachments | `references/notifications.md` |
|
||||
|
||||
@@ -47,6 +47,39 @@ must be reachable from entry and have a possible path to a terminal. Use bounded
|
||||
runner-owned `limits` for feedback loops, never revision counters in model
|
||||
prompts/outputs. Read `references/control.md` for the exact format.
|
||||
|
||||
## Result format
|
||||
|
||||
A model or agent stage returns a line-oriented document: the first non-empty line
|
||||
is the declared outcome (one of the stage's non-error `edges` keys), sections begin
|
||||
with `# <heading>`, and the required `# output` section holds one JSON object — the
|
||||
output map that later stages and `memory` select from. Every other heading becomes
|
||||
an evidence field keyed by its normalised heading (lowercased, spaces to
|
||||
underscores) and is retained verbatim, so prose, code fences, quotes and embedded
|
||||
JSON need no escaping. Extra sections are best-effort and never fail the stage.
|
||||
|
||||
````markdown
|
||||
success
|
||||
|
||||
# output
|
||||
{"task": "x", "changed_files": ["a.go"]}
|
||||
|
||||
# evidence
|
||||
go test ./... — PASS (observed output)
|
||||
````
|
||||
|
||||
The legacy single JSON envelope `{ "outcome": "...", "output": {...} }` is still
|
||||
accepted unchanged. The parser chooses by precedence: a response whose first
|
||||
non-empty character is `{` (after an optional surrounding fence) uses the JSON path;
|
||||
a `# ` heading that appears before any `{` uses the line path. A missing outcome, an
|
||||
undeclared outcome, or a missing/invalid `# output` fails the stage with
|
||||
`FINAL RESULT VALIDATION`; salvageable sections are retained and the parse status is
|
||||
recorded under the reserved key `result_parse` (`parsed`, `partial`, `failed`). The
|
||||
full raw response is saved as `raw-output.md` in the stage's artifacts directory. Use
|
||||
the line form when the evidence is prose, logs or code; never fabricate a result,
|
||||
never flatten the output fields alongside the outcome, and save any reports, logs or
|
||||
screenshots you produce into the artifacts directory the runtime names
|
||||
(`references/delivery.md`).
|
||||
|
||||
Model configs may set `harness=opencode` or `harness=pi`; omission preserves
|
||||
historical OpenCode execution. Read `references/harnesses.md` for setup/limits.
|
||||
Use the exact provider/model IDs validated during server setup. New drafts/templates
|
||||
@@ -89,7 +122,8 @@ may read/edit/shell and conditionally use `websearch`/`webfetch`; a planner may
|
||||
read plus conditional web search/fetch; a three-stage implementer has no web tools
|
||||
and works from the planner's research with local read/glob/grep/edit/shell; a
|
||||
reviewer may read plus conditional web; a source-only review stage has no
|
||||
edit/shell; a research stage uses web search/fetch. Never force web access for
|
||||
edit/shell; a research stage uses web search/fetch; a committer has read/glob/grep
|
||||
and shell but no edit. Never force web access for
|
||||
trivial, fully understood local edits, and return blocked only when required
|
||||
reliable evidence cannot be obtained rather than whenever one search tool fails.
|
||||
Keep examples and prompts language-neutral unless the task itself asks for a
|
||||
@@ -145,6 +179,60 @@ a repeated decision for an already-decided visit does not double-apply. Cancel a
|
||||
retry keep working while waiting and after a decision, and a human stage is never
|
||||
killed by a stage timeout or `max_visits` (the shared run budget still applies).
|
||||
|
||||
## Committer stages
|
||||
|
||||
A workflow that changes the repository ends in a committer: a normal model stage
|
||||
whose prompt commits the run's change locally and never pushes, tags, deploys or
|
||||
rewrites history. It is not a native type. Declare `shell` (and `read`/`glob`/`grep`
|
||||
when it inspects content) and no `edit`, so a failed check is reported rather than
|
||||
patched, and select the runner's captured change set alongside the producer's
|
||||
declared list:
|
||||
|
||||
````markdown
|
||||
# stage committer
|
||||
|
||||
```prompt
|
||||
Commit this run's change locally; never push.
|
||||
```
|
||||
|
||||
```memory
|
||||
{"changed_files":"implementer.changed_files","server_changed_files":"input.server_changed_files"}
|
||||
```
|
||||
|
||||
```tools
|
||||
read
|
||||
glob
|
||||
grep
|
||||
shell
|
||||
```
|
||||
|
||||
```edges
|
||||
success -> #success
|
||||
blocked -> #failure
|
||||
error -> #failure
|
||||
```
|
||||
````
|
||||
|
||||
State this pre-commit checklist in the prompt:
|
||||
|
||||
1. Stage the union of `input.server_changed_files` (the authoritative,
|
||||
server-captured set) and the declared `changed_files`, restricted to paths that
|
||||
still exist, keeping every exclusion. A declared list can be incomplete, and a
|
||||
captured path it omitted is still this run's change (`references/control.md`).
|
||||
2. Inspect the staged diff before committing; never commit unrelated work, secrets
|
||||
or generated artifacts.
|
||||
3. Run the repository's required checks and record the exact commands and observed
|
||||
results as evidence. Do not commit when a required check fails; return `blocked`
|
||||
with the failing output instead.
|
||||
4. Create no empty commit: when nothing is staged, return `success` with a clear
|
||||
note.
|
||||
5. Commit with a concise message naming the run's change and report the commit hash;
|
||||
never push, tag, rebase or amend.
|
||||
|
||||
Merging is the operator's or a lane's job, not the committer's: it commits locally
|
||||
and stops (`references/orchestration.md`, `references/lanes.md`). The server does
|
||||
not create the commit and cannot enforce the message; a reviewer checks the rules.
|
||||
|
||||
Malformed final JSON has bounded recovery even with `retries=0`; it never changes
|
||||
verdict/evidence. Recovery tries a deterministic local pass first (append missing
|
||||
closing delimiters, drop one trailing comma, or insert the single comma/colon the
|
||||
@@ -162,9 +250,10 @@ retained deny-all, no-inference compatibility probe identifies known format
|
||||
incompatibility. Incompatible native backends and V2 require strict local envelope
|
||||
validation. Do not promise recovery of truncated strings, missing evidence or
|
||||
invalid outcomes.
|
||||
Return the strict `{ "outcome": "declared-edge-key", "output": { ... } }`
|
||||
envelope. Do not treat tool-call/DSML markup, plain prose or flattened output as
|
||||
success, or rerun tool work to fix a response's formatting.
|
||||
Return the line-oriented result format above, or the strict
|
||||
`{ "outcome": "declared-edge-key", "output": { ... } }` envelope. Do not treat
|
||||
tool-call/DSML markup, plain prose or flattened output as success, or rerun tool
|
||||
work to fix a response's formatting.
|
||||
|
||||
## Scheduling
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ parallel/distributed task engine or a guarantee that model reports are correct.
|
||||
|
||||
- Drafts are editable Markdown plus JSON metadata. Publishing validates and creates
|
||||
immutable versions; drafts remain retained. Keep context create-only/base-version
|
||||
guards. Five optional generic starters are task, summary, review, research and
|
||||
guards. Four optional generic starters are task, review, research and
|
||||
three-stage; a fresh database starts empty. Templates can be created directly with
|
||||
an editable prefilled name or customized first. Editing a bundled repository
|
||||
template changes no installed or published definition; only explicit authoring
|
||||
|
||||
@@ -119,7 +119,11 @@ Adapt the scope and publishing lines per item; keep the rest.
|
||||
files. It must select `input.server_changed_files` (the runner's captured evidence,
|
||||
`references/control.md`) alongside the implementer's declared `changed_files` and
|
||||
stage their union: an implementer's declared list can be incomplete, and a captured
|
||||
path it omitted is still this run's change.
|
||||
path it omitted is still this run's change. Its prompt carries the pre-commit
|
||||
checklist in `references/format.md`; it commits locally and stops, never pushing.
|
||||
- A run cannot approve its own work. When an item genuinely needs an operator gate
|
||||
before it continues or commits, insert a `type=human` decision stage
|
||||
(`references/format.md`); never invent a model stage that pretends to approve.
|
||||
- Choose per item: a logic, server or format change usually wants the planner
|
||||
(a plan/implement/review pipeline); a small, fully understood tweak may use the
|
||||
leaner implementer-first variant. Both keep all review stages.
|
||||
|
||||
@@ -58,7 +58,7 @@ Use pipelines help <command> for its flags. Names with spaces must be quoted.
|
||||
Examples:
|
||||
pipelines edit "bug fix" "Add a review step"
|
||||
pipelines new "release notes" "Summarize changes and notify my phone"
|
||||
pipelines new "Text summary" --template summary --no-open --json --yes
|
||||
pipelines new "Add a feature" --template task --no-open --json --yes
|
||||
pipelines validate /path/to/draft.md --json
|
||||
pipelines submit /path/to/draft.md
|
||||
pipelines run "bug fix" "Fix the layout" --json
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestShowcaseDefinitions(t *testing.T) {
|
||||
for _, name := range []string{"task", "summary", "review", "research", "three-stage"} {
|
||||
for _, name := range []string{"task", "review", "research", "three-stage"} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
|
||||
if err != nil {
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestTemplatesDoNotSeedDatabaseAndCreateOnlyPreservesExisting(t *testing.T)
|
||||
if err := wsjson.Read(ctx, conn, &response); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if response.Type != protocol.Templates || len(response.Templates) != 5 {
|
||||
if response.Type != protocol.Templates || len(response.Templates) != 4 {
|
||||
t.Fatal("missing catalog", response.Type, len(response.Templates))
|
||||
}
|
||||
items, err := store.List(ctx)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestShowcaseGraphsRender(t *testing.T) {
|
||||
for _, name := range []string{"task", "summary", "review", "research", "three-stage"} {
|
||||
for _, name := range []string{"task", "review", "research", "three-stage"} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
|
||||
if err != nil {
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
|
||||
m.templateOpen, m.keys.templates = true, true
|
||||
m.defaultModel = "fixture/model"
|
||||
for i, item := range m.templates {
|
||||
if item.Key == "summary" {
|
||||
if item.Key == "review" {
|
||||
m.templateIndex = i
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
|
||||
m = updated.(Model)
|
||||
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyCtrlK})
|
||||
m = updated.(Model)
|
||||
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("Simple summary")})
|
||||
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("Simple review")})
|
||||
m = updated.(Model)
|
||||
updated, cmd = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
|
||||
m = updated.(Model)
|
||||
@@ -81,7 +81,7 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
|
||||
t.Fatal("single create confirmation did not send or failed to retain draft")
|
||||
}
|
||||
retained, err := draft.Load(m.pendingDraft.path)
|
||||
if err != nil || retained.Name != "Simple summary" || retained.Server != url || !retained.CreateOnly || retained.BaseVersion != 0 {
|
||||
if err != nil || retained.Name != "Simple review" || retained.Server != url || !retained.CreateOnly || retained.BaseVersion != 0 {
|
||||
t.Fatal("template draft metadata lost", retained, err)
|
||||
}
|
||||
text, err := draft.Read(retained.Path)
|
||||
|
||||
Reference in New Issue
Block a user