Merge main; align lint and skill practices with essential memory/history and the four graded examples

This commit is contained in:
2026-11-04 13:08:47 +00:00
217 changed files with 8560 additions and 1937 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"path/filepath"
)
var skillFiles = []string{"SKILL.md", "references/orchestration.md", "references/work.md", "references/queue.md", "references/debugging.md", "references/delivery.md", "references/format.md", "references/notifications.md", "references/operations.md", "references/transfer.md", "references/verification.md", "references/control.md", "references/harnesses.md", "references/access.md", "references/schedules.md"}
var skillFiles = []string{"SKILL.md", "references/orchestration.md", "references/work.md", "references/queue.md", "references/debugging.md", "references/delivery.md", "references/format.md", "references/notifications.md", "references/operations.md", "references/transfer.md", "references/verification.md", "references/control.md", "references/harnesses.md", "references/access.md", "references/schedules.md", "references/practices.md"}
func SkillDirectory() (string, error) {
dir := os.Getenv("XDG_CONFIG_HOME")
+14 -6
View File
@@ -35,8 +35,11 @@ explain the gap; ask before authoring. Do not add a task-specific pipeline as a
## Authoring
A definition is Markdown: `# stage <Name>` sections with `prompt`, `configs`,
`tools`, `edges`, and optional `limits`/`checks`. Start from
`examples/`. Use stage names that describe the work:
`tools`, `edges`, and `limits`/`checks` where required: every stage that can
modify the workspace declares `checks` (commands on the `delivery=true` stage,
otherwise `none: <reason>`), and every loop has `limits`. Start from
`examples/` and read `references/practices.md` before writing prompts. Use stage
names that describe the work:
`Plan` · `Code` · `Review` · `UIReview` · `Land` (`Prepare` and `Survey` are
useful variants).
@@ -46,8 +49,10 @@ constraints. The runner enforces turns, tools and limits; prompts do not need to
repeat them. Only `# outcome` is parsed from `output.md`; everything else is
free markdown. Use `links` and `memory` only when they clarify a handoff.
`pipelines validate DRAFT` checks a draft; `pipelines submit DRAFT` publishes a
new immutable version. `pipelines help <command>` has flags.
`pipelines validate DRAFT` checks a draft, including the authoring rules in
`references/practices.md` (errors block submit; `warning:` lines do not but should
be fixed); `pipelines submit DRAFT` publishes a new immutable version.
`pipelines help <command>` has flags.
Schedules are separate saved run configurations: pipeline/version, prompt,
workspace and other run options, plus timing. Never add `# settings` or schedule
@@ -58,10 +63,12 @@ explicitly asks to manage a schedule; scheduling alone is not workflow authoring
## Turns and artifacts
Each visit has `input.md` (the run prompt; later visits add the previous body), `memory.md`
(completed turns), `output.md`, and `private/`. Every run also has one shared
(short essential memory inlined in the prompt: task, previous stage's `# handoff`,
outcome ledger, changed files; 4 KB cap), `history.md` (completed turns in full,
read on demand), `output.md`, and `private/`. Every run also has one shared
`public/` directory, addressed by its absolute path; files there are visible to
later stages and are the stage's real artifacts. `input.md`, `memory.md`,
`output.md` and `session.html` are system evidence for auditing, not stage
`history.md`, `output.md` and `session.html` are system evidence for auditing, not stage
output.
## References
@@ -71,6 +78,7 @@ Read only what the task needs:
| Need | Reference |
| --- | --- |
| Definition syntax and turn files | `references/format.md` |
| Good practices (tokens, checks, prompts, loops) | `references/practices.md` |
| Limits, tools and permissions | `references/control.md` |
| Stages, parallel work, recovery | `references/orchestration.md` |
| CLI, storage and evidence | `references/operations.md` |
+3 -2
View File
@@ -41,8 +41,9 @@ nonterminal edge. Without `on`, entering beyond the cap fails before execution.
Global 30-step/five-visits-per-stage safety limits still apply.
A model stage reads its turn's `input.md` (the run prompt on the first visit,
the previous turn's output afterwards) and `memory.md` (completed turns with the
files each added to `public/`). The `memory` block is retired: it no longer
the previous turn's output afterwards), its inlined, capped `memory.md` (task,
previous stage's `# handoff`, outcome ledger, changed files) and, on demand,
`history.md` (completed turns in full with the files each added to `public/`). The `memory` block is retired: it no longer
selects fields or replaces previous output for model stages, and old definitions
that contain one parse but ignore it. Reviewers therefore see the previous
turn's output and the accumulated memory rather than a field projection.
+87 -23
View File
@@ -4,8 +4,8 @@ Definitions are Markdown made only of `# stage KEY` headings and fenced blocks.
Scheduling belongs to separate saved run configurations, not `# settings` or
schedule blocks in the definition. No unrelated prose outside blocks. The first
stage receives the run prompt in its `input.md`; later stages receive
the previous turn's output. Every visit also gets a `memory.md` of completed
turns. There are no stage `input`, `output`, or `memory` blocks: the model reads
the previous turn's output. Every visit also gets a short `memory.md` (essential
memory, inlined in the prompt) and a full `history.md` of completed turns. There are no stage `input`, `output`, or `memory` blocks: the model reads
the turn files and writes free-form markdown, and only the `# outcome` section is
interpreted. Read `references/control.md` for runner-enforced limits.
@@ -15,7 +15,7 @@ Each model stage requires nonempty `prompt`, `configs`, and `edges` blocks:
# stage worker
```prompt
Perform the task. Write the complete output.md markdown; only `# outcome` is required.
Perform the task.
```
```configs
@@ -42,17 +42,64 @@ An omitted error edge defaults to failure. Execution is sequential; forks choose
one outcome, never execute parallel branches. Cycles are allowed; every stage
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.
prompts/outputs: publishing rejects an edge to the same or an earlier stage
(definition order) unless the source stage limits that outcome or the target
stage has `limits` (a human stage's choices are exempt). Read
`references/control.md` for the exact format.
## Checks
Every model stage that can modify the workspace (it declares `edit` or `shell`,
has no `tools` block, or sets `delivery=true`) must declare a `checks` block, so
the author decides where verification happens. Read-only stages need none.
- A `delivery=true` stage lists 1–20 commands, one per line. The server runs them
on the committed candidate (and again on a merged tree) before landing; a
failing command blocks landing. These are the run's deterministic checks.
- Every other stage writes exactly one line, `none: <reason>`, naming where
verification happens instead, for example
`none: focused tests only; the Land delivery gate runs the suite` or
`none: read-only review; shell is used only for git diff`. Commands on a
non-delivery stage are rejected because nothing would run them.
A check must fail when it cannot run. Validation rejects guards that pass
without running anything: `|| true`, `|| :`, `|| exit 0`, `|| echo`,
`[ ! -x tool ] || ...`, `test ! -f ... || ...`, `! command -v tool || ...`,
an `if ...; then ...; fi` with no failing else, and `set +e`. Cover every
language the run can change (a Go-only check list does not verify Flutter work).
`pipelines validate` reports these with the remaining authoring rules
(`references/practices.md`).
## Result format
Each visit gets `input.md`, `memory.md`, `output.md` and `private/` in
`<run>/stages/<seq>-<stage>/`, plus the run-level shared `public/`. The model
reads input and memory and returns the complete `output.md` markdown. The only
required section is the outcome heading, followed by one of the stage's declared
edge words:
Each visit gets `input.md`, `memory.md`, `history.md`, `output.md` and
`private/` in `<run>/stages/<seq>-<stage>/`, plus the run-level shared
`public/`. What a stage receives:
- `memory.md` (essential, hard cap 4 KB, always inlined in the prompt): the run
task, the previous stage's handoff with its outcome and public/ additions, a
one-line-per-stage outcome ledger (latest visit; a revisit is marked) and the
server-captured changed files. A stage must be able to work from this alone.
- `input.md` (on demand): the full run task and the previous turn's full output.
- `history.md` (on demand, never inlined): every completed turn in full, the
format `memory.md` had before essential memory existed.
Stages with `read` are told the two on-demand paths; stages without it get
`input.md` inlined too (capped at 32 KB) but never `history.md`.
The previous stage's handoff is its `# handoff` section (any level, up to the
next heading of the same or higher level); without one the server uses the head
of its output, marked as such. Either is truncated to fit with a pointer to
`input.md`, so nothing depends on the model following the convention. The
prompt asks every stage to start its output with a short handoff: what it did,
files changed, open issues or findings. The only required section is the
outcome heading, followed by one of the stage's declared edge words:
````markdown
# handoff
Fixed both review findings in cache.go; tests pass. No open issues.
# outcome
success
@@ -82,6 +129,14 @@ and accepts integers 0–100; explicit 0 disables execution retries. Optional
`timeout` defaults to `1h` per attempt and accepts positive durations such as
`30m` or `90s`.
A stage that declares a `skipped` edge (for example a UI reviewer) is eligible
for the server skip fallback: when every earlier visit's file-change capture was
complete and recorded no changed files or screenshots, the server completes the
stage as `skipped` without a model call (`reason_source: fallback`). Any recorded
change or incomplete capture runs the model. Optional `auto_skip=false` (values
`true`/`false`, default `true`) always runs the model. Read
`references/operations.md` ("Server skip fallback") for the exact rule.
Optional `reasoning_effort=high` selects a model's reasoning/thinking level for
this stage. Values are `default`, `none` (alias `off`), `minimal`, `low`, `medium`,
`high`, `xhigh`, or `max`. Omission or `default` preserves the harness/model
@@ -123,13 +178,13 @@ run directory; no file list is required. `shell` supports commands appropriate t
the repository's language and tooling, not a language-specific allowlist. A missing
tools block uses local read/glob/grep/edit/shell tools; prefer explicit stage roles.
Planning stages must not label a task blocked simply because they defer edits to
an implementer stage. Bundled starters show the intended role split: a task stage
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; a committer has read/glob/grep
and shell but no edit. Never force web access for
an implementer stage. The intended role split: an implementer may
read/glob/grep/edit/shell; a planner reads, plus conditional web search/fetch only
when external knowledge is needed; a reviewer reads and may run read-only checks
with shell but never edits; a source-only review stage has no edit/shell; a
research stage uses web search/fetch; a committer has read/glob/grep and shell but
no edit. The bundled examples (`one-stage`, `two-stages`, `feedback-loop`,
`human-decision`) follow it without web tools. 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
@@ -204,6 +259,10 @@ grep
shell
```
```checks
none: commits locally; the manager lands and runs the suite
```
```edges
success -> #success
blocked -> #failure
@@ -211,6 +270,10 @@ error -> #failure
```
````
A landing committer instead sets `delivery=true` in `configs` and lists the
repository's required check commands in `checks`; the server runs them, so its
prompt does not run the suite again.
State this pre-commit checklist in the prompt:
1. Inspect `git status` and the full diff. Stage this run's change, including
@@ -218,9 +281,10 @@ State this pre-commit checklist in the prompt:
exclusion. Do not rely on a model-declared file list.
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.
3. Without a delivery gate, run the repository's required checks once (summary
output) 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. With `delivery=true` the server runs the `checks` block; skip this step.
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;
@@ -231,9 +295,9 @@ State this pre-commit checklist in the prompt:
documentation writer folds notes later (`references/orchestration.md`). An item that
staled no shared document has no note and needs no step 6.
This list is the canonical checklist. The bundled starters `task`, `three-stage` and
`docs-fold` each repeat it in their committer prompt because a template is embedded and
published on its own; keep those copies in sync with this list.
This list is the canonical checklist. Repeat it in each committer prompt, because a
definition is published on its own; keep those copies in sync with this list. The
bundled examples leave changes uncommitted and have no committer.
The committer prepares the complete clean candidate and resolves integration conflicts.
When `delivery=true`, the server executes the declared checks and lands after the
@@ -274,6 +338,6 @@ stage parks the run), `artifacts=markdown`.
Read this skill's `references/notifications.md` for the minimal terminal-path
recipe and optional native publisher format. Prefer hooks for ordinary success/error
alerts; a request to notify is not a request for a new delivery stage. Do not scan
the user's repository for Pipelines docs. Bundled starters are generic and manual-only.
the user's repository for Pipelines docs. Bundled examples are generic and manual-only.
Notification attachment/report support and model availability need real runtime
tests; structural validation alone cannot confirm delivery.
+32 -11
View File
@@ -10,8 +10,9 @@ 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, three-stage, review, research
and debug; a fresh database starts empty. Templates can be created directly with
guards. The four generic examples (one-stage, two-stages, feedback-loop,
human-decision) are the template set; a brand-new database is seeded with them
once, and an existing or already-seeded database never is. 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
then submission creates a new immutable version.
@@ -190,9 +191,14 @@ The stage's File changes section highlights added/removed lines and hunk headers
node_modules and common environment/key/credential/database paths are excluded.
This is path-based protection, **not secret-content scanning**. Patches may still
contain sensitive text; never publish them without approval.
- Limits: 10,000 entries, 1 MiB/file, 32 MiB/snapshot, five-second snapshot context,
5,000 combined text lines, 64 KiB/patch, 128 KiB serialized file evidence/visit.
Missing/skipped/truncated captures must be described as partial/unavailable.
- Limits: 10,000 entries, 1 MiB/file and 32 MiB/snapshot of retained text,
256 MiB/hashed file, five-second snapshot context, 5,000 combined text lines,
64 KiB/patch, 128 KiB serialized file evidence/visit. Text over the 1 MiB or
32 MiB budget is still compared by hash, and in Git a path the snapshot could
not compare is listed when its `git status` entry changes; such entries carry
`no_patch: true` (and `truncated`) with no patch, and the visit is `partial`.
Missing/skipped/truncated captures must be described as partial/unavailable;
`inspect` adds a run-level `warnings` entry naming every partial/unavailable visit.
- Failed/canceled stages retain changes when execution returns; unconfirmed agent
cleanup is partial. Crashes may have no after-capture. Historical visits say
not recorded—**never infer no edits from absent evidence**.
@@ -200,22 +206,36 @@ The stage's File changes section highlights added/removed lines and hunk headers
changes outside scope, ignored new files and changes reverted before capture can
be absent or mixed in. Capture failure does not change the declared run verdict.
### Server skip fallback (`skipped` edge)
A non-human stage that declares a `skipped` edge is completed by the server, with
no model call, and routed along `skipped` only when **every** earlier visit of the
run recorded `file_changes` with status `complete`, none recorded any changed file,
and none captured an image artifact. The step's verdict reason starts
"Server fallback skip (no model run):" with `reason_source: fallback`. Any changed
file (no path or extension is treated as "not UI"), any partial/unavailable or
missing capture (crash, historical row, human decision, checkpoint-retry prefix)
runs the model, which may still answer `skipped` itself. `auto_skip=false` in the
stage's `configs` disables the fallback for that stage. Never describe a fallback
skip as a model judgement, and never treat it as evidence that nothing changed.
Do not add model output fields, new stages or extra model calls merely to obtain
file diffs: current capture is server-owned. Do not promise full files/rollback.
## Retained stage artifacts
Every model visit gets a file-based turn under the data directory
(`<data>/artifacts/<run>/stages/<seq>-<stage>/`) with `input.md`, `memory.md`,
`output.md` and `private/`; `public/` is run-level and shared by every stage.
(`<data>/artifacts/<run>/stages/<seq>-<stage>/`) with `input.md`, `memory.md`
(capped essential memory, inlined), `history.md` (full earlier turns, read on
demand), `output.md` and `private/`; `public/` is run-level and shared by every stage.
The root is configurable and defaults next to the database. The writable
`private/` and shared `public/` directories are stated in the agent prompt for
every harness, and `PIPELINES_ARTIFACTS_DIR` points at the turn directory for a
locally spawned Pi process. OpenCode V2 tools run inside the shared serve
process, so there the prompt, not the environment, is the reliable carrier.
Turn-local files belong in `private/`; reports, logs and screenshots for later
stages belong in `public/`. The server owns `input.md`, `memory.md` and
`output.md` and never asks the model to write them directly.
stages belong in `public/`. The server owns `input.md`, `memory.md`,
`history.md` and `output.md` and never asks the model to write them directly.
After the visit the server makes one bounded inventory of the turn and public
directories and records each file's name, size, content type (extension, sniff
@@ -223,8 +243,9 @@ fallback) and a relative url; these appear under each step's `artifacts` in
`inspect RUN_ID --json` and the TUI's `A` artifacts view, which groups them by
stage and visit, marks images and shows the recorded count,
capture-pending/not-recorded wording and partial-capture notes. Public entries
carry a `public/` prefix. `input.md`, `memory.md` and `output.md` are the primary
artifacts of every model visit.
carry a `public/` prefix. `input.md`, `memory.md`, `history.md` and `output.md`
are the primary artifacts of every model visit. To see what a late stage was
given, read its `memory.md`; `history.md` is the full record it could consult.
`GET /artifacts/<run>/<step>/<name>` serves the bytes (correct Content-Type and
Content-Length, HEAD, and Range/206/416 via `http.ServeContent`), refusing
traversal, absolute paths, symlink escapes and unknown runs/steps. A pre-turn
@@ -0,0 +1,69 @@
# Good practices
Pipelines are written by models through this skill, and a run's cost is roughly
model calls × context per call. Most waste comes from stages that re-read or
re-generate large output. `pipelines validate` enforces the mechanical rules
below (errors block publishing; warnings print and do not).
## Where work belongs
- **Deterministic checks belong in the server `checks` block, not the model.**
The landing stage sets `delivery=true` and lists the full check commands; the
server runs them on the committed candidate. A model running the suite puts
every log line into its context, and every later call pays for it again.
- **Code runs focused tests only**: the test file or package it touched, with
quiet or summary output. Never the full suite.
- **Review reads the diff, not the repository.** Start from the server-captured
changed-file list the runner adds to the prompt and `git diff --stat`, then read
only the changed hunks and the code around them. Review runs no suites; it judges
the reported checks and names missing coverage.
- **Land/committer relies on server checks.** With a delivery gate its prompt
commits and stops; it does not re-run what the gate runs. Do not claim "the
server lands it" unless a stage has `delivery=true` (error otherwise).
- Every stage that can modify the workspace declares `checks`, even if only
`none: <reason>` (`references/format.md`, Checks). Checks must fail when a tool
is missing: no `|| true`, `[ ! -x tool ] || ...` or similar guards (error).
Cover every language the run can change.
## Prompts
- **Short stage prompts**: the goal and the real constraints. Over 2000 bytes
warns. Shared procedure belongs in project docs or this skill.
- **No runner boilerplate.** The runner already explains `output.md`, the
`# outcome` and `# handoff` sections, allowed outcomes, turn files, tools and
honesty rules (`internal/stage/model_prompt.go`). Repeating them warns.
- **Every outcome a prompt names is a declared edge.** "Return skipped" with no
`skipped` edge, or an undeclared `blocked_retryable`, fails the stage at run
time; validation rejects it (unquoted outcome words such as `skipped`,
`blocked`, `rejected`, `approved`, `advisory`; other back-quoted words after
return/report warn).
## Memory and handoffs
- The runner inlines the **essential memory** (`memory.md`: task, previous
stage's handoff, outcome ledger, changed files; capped) into every prompt, and
asks each stage to start its output with a short `# handoff`: what it did,
outcome, files changed, open findings, in a few lines. Do not repeat that
instruction; say only what this stage's handoff must carry if it is special.
- The **full history** (`history.md`) and full `input.md` are on demand. Never
tell a stage to read the whole history every visit (warning); say when it
needs it, e.g. "read history.md only if the handoff lacks a detail you need".
## Loops and budgets
- **Loops get limits.** An edge back to the same or an earlier stage needs
`limits` on the source outcome or the target (error). Use `max_visits` 2–3.
- **Re-entry gets only findings**: a rejected review hands back must-fix items
with location and fix, not a full re-review, and the implementer fixes those
items rather than redoing the task. Use `advisory` for non-blocking notes so
they do not buy another loop.
- Set **per-stage `budget_tokens`** (and `budget_usd` if wanted) as a runaway
guard on stages that loop or explore, sized a few times a normal visit.
## Commands and scope
- **Quiet commands**: summary flags, `git diff --stat` before a full diff,
`grep`/`glob` before `read`, read file ranges rather than whole files, tail or
filter long logs, never print generated or vendored files.
- **Small task scope**: one independently testable change per run (roughly a
10–15 minute change). Split larger work into several runs in parallel.