Skill: chat tools, skill library, retry/worktree facts, current auth

Add references/chat.md (pipelines MCP chat tools incl. show_diff, sent
references, question forms, chat RPCs with send_at) and install it.
SKILL.md: run worktrees, retry modes and failed-only retry, wait through
human stages, server skill library, chat tools pointer.
operations/debugging: retry resumes the failed stage by default; interrupted
and canceled runs cannot retry; runs rm; search --debug-files; per-run
worktrees no longer future; session export for OpenCode/Claude/Pi and repair.
access: hashed web password, ./password, server-token, current proxy routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 19:05:57 +00:00
parent 509d4c624f
commit fc3bb5a004
6 changed files with 142 additions and 52 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"path/filepath" "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", "references/practices.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", "references/chat.md"}
func SkillDirectory() (string, error) { func SkillDirectory() (string, error) {
dir := os.Getenv("XDG_CONFIG_HOME") dir := os.Getenv("XDG_CONFIG_HOME")
+22 -4
View File
@@ -21,11 +21,16 @@ background command (one per run, or one loop over several ids) so the session is
notified the moment the run ends, then read its result with notified the moment the run ends, then read its result with
`pipelines inspect <id> --json` and act on it: land, retry, or fix and report. `pipelines inspect <id> --json` and act on it: land, retry, or fix and report.
Do not poll with repeated `pipelines runs` calls, and do not tell the user a run Do not poll with repeated `pipelines runs` calls, and do not tell the user a run
is done, or will be reported, without a wait covering it. is done, or will be reported, without a wait covering it. `wait` keeps blocking
while a run is `waiting` on a human stage (`pipelines decide`, user's choice only).
A failed run keeps its worktree and commits. Read `pipelines inspect <id> --json` A run started from a repository's main checkout runs in its own worktree
before deciding: resume the failed stage (`pipelines retry <id>`), fix directly, (`<repo>-runs/...`, branch `pipelines/run-...`); a failed run keeps that tree and
or continue from the preserved branch. its commits. Read `pipelines inspect <id> --json` before deciding: resume the
failed stage (`pipelines retry <id>`; `--stage`/`--visit`, `--input-file`,
`--mode=restart` from entry), fix directly, or continue from the preserved
branch. Only `failed` runs can be retried; `interrupted` (server stopped
mid-run) and `canceled` runs need a new run or direct work on their branch.
## Use an existing pipeline ## Use an existing pipeline
@@ -64,6 +69,18 @@ Claude-only, allowlisted MCP access. Prefer read-only tools; unattended stages
deny every MCP tool not listed. The name is the Claude Code display name deny every MCP tool not listed. The name is the Claude Code display name
(mapped internally to `mcp__<server>__<tool>`). (mapped internally to `mcp__<server>__<tool>`).
The server keeps a versioned skill library: `pipelines skills list`, `skills show
NAME [--version N]`, and `skills import FOLDER` (root `SKILL.md` with
`name`/`description` frontmatter plus `references/`, `scripts/`, `assets/`; import
only when asked). Stage use: `references/format.md`.
## In a Pipelines chat
A chat's agent has a `pipelines` MCP server: `show_file`, `show_image`,
`show_html`, `show_diff` (show the operator changes, e.g. before a pull request)
and `notify` (phone, only when the operator must look now). Show instead of
telling the operator a path. Details, limits, chat RPCs: `references/chat.md`.
## References ## References
Read only what the task needs. Rows marked operator only are for setting up or Read only what the task needs. Rows marked operator only are for setting up or
@@ -79,6 +96,7 @@ debugging the server; skip them when authoring.
| Failures | `references/debugging.md` | | Failures | `references/debugging.md` |
| Delivery and installation | `references/delivery.md` | | Delivery and installation | `references/delivery.md` |
| Notifications | `references/notifications.md` | | Notifications | `references/notifications.md` |
| Chat tools, sent references, questions, chat RPCs | `references/chat.md` |
| Saved run schedules (never in a definition) | `references/schedules.md` | | Saved run schedules (never in a definition) | `references/schedules.md` |
| Transfer and versions | `references/transfer.md` | | Transfer and versions | `references/transfer.md` |
| Queue and work items | `references/work.md`, `references/queue.md` | | Queue and work items | `references/work.md`, `references/queue.md` |
+15 -9
View File
@@ -1,26 +1,32 @@
# Hosting, access and deployment # Hosting, access and deployment
The browser client is `web/serve.mjs`: static files plus a `/connect` WebSocket The front door is `web/serve.mjs`: sign-in, the Flutter web app built from
proxy and `/artifacts/` proxy to the Pipelines server. Plain `node serve.mjs` is `app/`, and a same-origin proxy to the Pipelines server for `/connect`,
enough for local work. `/files`, `/artifacts/` and `/chat-uploads`; it also serves app updates at
`/updates/`. The native apps go through it too.
## Password gate ## Password gate
`serve.mjs` refuses pages, assets, artifacts and `/connect` without a signed `serve.mjs` refuses pages, assets, artifacts and `/connect` without a signed
session cookie. The password and signing secret live outside the repository: session cookie. The password and signing secret live outside the repository:
`~/.config/pipelines/web-auth.json` (mode `600`), e.g. `~/.config/pipelines/web-auth.json` (mode `600`, `PIPELINES_WEB_AUTH_FILE`)
holds an scrypt `password_hash`, the cookie `secret` and a `generation`; a
```json plaintext `password` written there is hashed on load and signs everyone out.
{ "password": "…", "secret": "…" }
```
The sign-in page is `/login`; **Remember me** keeps a 30-day cookie, otherwise The sign-in page is `/login`; **Remember me** keeps a 30-day cookie, otherwise
the cookie lives until the browser closes. Wrong passwords are throttled. Tests the cookie lives until the browser closes. Wrong passwords are throttled. Tests
that start their own `serve.mjs` set `PIPELINES_WEB_AUTH=disabled`; never put that that start their own `serve.mjs` set `PIPELINES_WEB_AUTH=disabled`; never put that
in a service. in a service.
Changing the password: edit the file, then restart the web service. Change the password with `./password` from the source checkout (signs every
device out; `--revoke-all` keeps the password); Settings → Sign-in security →
Sign out everywhere revokes sessions without a restart.
The proxy reaches the server with `X-Pipelines-Token` from the private
`~/.config/pipelines/server-token` (`PIPELINES_SERVER_TOKEN_FILE`), which the
installer creates; local CLI calls and server-launched stages and chats read
the same file. It is separate from the web password.
## Bind and exposure ## Bind and exposure
+56
View File
@@ -0,0 +1,56 @@
# Working in a Pipelines chat
A Pipelines chat runs on OpenCode, Claude Code or Codex. The operator reads it in
the Pipelines app (desktop, web or phone), often not at this machine's terminal.
## Pipelines tools (`pipelines` MCP server)
Each call adds a persisted item to the transcript and returns one short line; a
refusal comes back as an error with the reason. Paths must resolve inside the
operator's home (absolute, `~/...`, or relative to the chat's directory).
| Tool | Arguments | Use for |
| --- | --- | --- |
| `show_file` | `path`, `title?` | Any file the operator should see: images inline, other files as a preview card. Use instead of naming a path. |
| `show_image` | `url_or_path`, `title?`, `alt?` | A home `image/*` file or an `https://` URL (no credentials, at most 2048 chars). |
| `show_html` | `html`, `title?`, `height_hint?` (120-600) | Self-contained HTML/SVG: diagrams, charts, tables. Sandboxed: no JavaScript, no network; inline CSS/SVG, `<details>`, `:hover`. Refused above 512 KiB. |
| `show_diff` | `path?`, `base?`, `committed_only?`, `title?` | A Git diff card when the operator asks to see the changes, or before submitting a pull request. No `base`: uncommitted work (staged, unstaged, untracked) against HEAD. `base` (e.g. `main`): everything since the merge base, which is what a PR contains, plus uncommitted work unless `committed_only`. Pipelines runs Git; do not paste the diff. |
| `notify` | `title`, `message`, `priority?` | A phone push that opens this chat. Only when the operator must look now (long task done, blocked on them). 5 per minute per chat; undelivered sends report why. |
`show_diff` lists at most 300 files; a file patch over 256 KiB or a total over
1 MiB is shown partially and says so; binaries have no patch; renames show as
delete plus add. `base` is a plain revision name. Tools are absent when the
harness could not register them (logged); then name paths instead.
## References sent into the chat
The operator can send a run, a pipeline or a run artifact to a chat. It arrives
in the composer draft as text naming the run id, title, pipeline/version and,
for an artifact, stage, visit and a readable URL. Treat it as a pointer: read
`pipelines inspect RUN_ID --json` (or `pipelines show NAME --version N`) for the
authoritative record before acting.
## Questions and approvals
Claude Code questions appear as a form. The operator may pick an option, answer
in their own words, or dismiss it; a dismissal arrives as a denial saying they
will reply in the chat, so wait for that message. Question text, descriptions
and option descriptions render Markdown.
## Chat protocol (via `pipelines rpc -`)
Only when the user asks to drive another chat. Envelopes carry `type` and `id`:
- `chat_sessions`: the operator's chats (`id`, `directory`, `title`, `backend`).
- `chat_prompt` with `chat_prompt: {session_id, text, send_at?}`: sends a
prompt (at most 64 KiB). A busy chat queues it durably, in order, across
restarts. `send_at` (epoch milliseconds, future) holds it until that time;
prompts queued after it wait behind it.
- `chat_unqueue` with `chat_unqueue: {session_id, operation_id}` removes a
prompt not yet delivered.
- `chat_interrupt` with `chat_query: {session_id}` stops the current turn;
`chat_stop_tasks` (same body) stops background tasks without interrupting it.
Chat sessions are separate from pipeline run sessions; `pipelines chat-adopt
SESSION_ID [--harness opencode|claude|codex]` brings an existing harness session
into the chat list. Do not keep using an adopted session elsewhere.
@@ -10,10 +10,12 @@
4. Verify the repair with a focused regression; run broader checks once relevant 4. Verify the repair with a focused regression; run broader checks once relevant
inputs settle. Do not raise retry/time budgets to hide a reproducible defect. inputs settle. Do not raise retry/time budgets to hide a reproducible defect.
Use `pipelines help retry` to discover the installed options. When supported, `pipelines retry ID` resumes the failed stage; `--stage KEY [--visit N]` picks a
select a recorded stage/visit, bounded input correction and explicit compatible recorded stage, `--input-file FILE|-` merges a bounded JSON correction,
version of the same pipeline. Verify actual retained stage input, not merely `--version N` a published version of the same pipeline, `--mode=restart` starts
successful admission. Do not silently restart from entry. at entry (say so). Only `failed` runs retry; an `interrupted` run (server stopped
mid-stage) or a `canceled` one needs a new run or direct work on its preserved
branch. Verify the retry's actual stage input, not merely its admission.
A clean preparation stage succeeds without an empty commit. A `land` stage with a A clean preparation stage succeeds without an empty commit. A `land` stage with a
delivery gate succeeds with a clean checked candidate; the server lands afterward. delivery gate succeeds with a clean checked candidate; the server lands afterward.
+42 -34
View File
@@ -1,9 +1,10 @@
# System, storage and run evidence # System, storage and run evidence
Pipelines turns a reusable process into sequential stages with explicit handoffs, Pipelines turns a reusable process into sequential stages with explicit handoffs,
outcome routing and retained evidence. A Go CLI/TUI connects to an execution server; outcome routing and retained evidence. A Go CLI/TUI and the Pipelines app connect
the server owns execution and SQLite history, OpenCode owns model/tool sessions, to an execution server; the server owns execution and SQLite history, the stage's
and optional ntfy delivery supplies notifications. It is technology-neutral, not a harness (OpenCode, Claude Code or Pi) owns model/tool sessions, operator chats
run on OpenCode, Claude Code or Codex, and optional ntfy delivers notifications. It is technology-neutral, not a
parallel/distributed task engine or a guarantee that model reports are correct. parallel/distributed task engine or a guarantee that model reports are correct.
## Lifecycle and location ## Lifecycle and location
@@ -16,12 +17,14 @@ brand-new database is seeded with them
an editable prefilled name or customized first. Editing a bundled repository an editable prefilled name or customized first. Editing a bundled repository
template changes no installed or published definition; only explicit authoring template changes no installed or published definition; only explicit authoring
then submission creates a new immutable version. then submission creates a new immutable version.
- Retire an unused pipeline with `pipelines archive NAME --yes` (no deletion exists): - Retire an unused pipeline with `pipelines archive NAME --yes` (pipelines cannot be deleted):
it leaves lists and cannot run, its history stays, its name stays reserved, and it leaves lists and cannot run, its history stays, its name stays reserved, and
enabled schedules must be paused first; `unarchive` and `list --archived` undo/show it. enabled schedules must be paused first; `unarchive` and `list --archived` undo/show it.
- A run pins its exact definition version, initial input and resolved directory. - A run pins its exact definition version, initial input and resolved directory.
The client invocation directory is the default, but files/tools execute on the The client invocation directory is the default (`--workspace`), but files/tools
server. Docker needs that directory mounted at the same absolute path. A remote execute on the server. From a repository's main checkout the run gets its own
worktree and branch (`references/format.md`, Run worktrees); a linked worktree
and every retry use their directory as is. Docker needs that directory mounted at the same absolute path. A remote
client does not upload its repository or make host credentials available remotely. client does not upload its repository or make host credentials available remotely.
- Host and Docker OpenCode credentials are separate. Preserve setup-selected model - Host and Docker OpenCode credentials are separate. Preserve setup-selected model
inheritance; do not select a provider just because its ID appears in an example. inheritance; do not select a provider just because its ID appears in an example.
@@ -35,12 +38,14 @@ brand-new database is seeded with them
owning active run is an orphan and still refuses new work until interrupted. owning active run is an orphan and still refuses new work until interrupted.
Reusing that active run's request key reattaches idempotently. Reusing that active run's request key reattaches idempotently.
`type=human` decision stages exist and pause the run (see `references/format.md`); `type=human` decision stages exist and pause the run (see `references/format.md`);
there are no parallel branches. Optional worktrees, full backup/restore, there are no parallel branches. Full backup/restore,
automatic database sync and independent verifier stage types are future ideas, automatic database sync and independent verifier stage types are future ideas,
not existing capabilities. Do not invent them in definitions. not existing capabilities. Do not invent them in definitions.
- Services are native or Docker-based. With an existing Docker installation do not - Services are native or Docker-based. With an existing Docker installation do not
start a competing native server. Server APIs are unauthenticated: trusted networks start a competing native server. The server API has no login: it accepts only
only; never recommend public exposure. Tool scope is not a universal OS sandbox. loopback Host/no-Origin requests plus, when configured, the private
`server-token` file's header; expose only the authenticated web proxy
(`references/access.md`), never the server itself. Tool scope is not a universal OS sandbox.
## Where data lives ## Where data lives
@@ -63,7 +68,9 @@ Use the authoritative `CLI_PREFIX` from the prompt:
text, a bare status word (`queued`/`running`/`succeeded`/`failed`/`canceled`/ text, a bare status word (`queued`/`running`/`succeeded`/`failed`/`canceled`/
`interrupted`) selecting those runs, or a lone date expression (`today`, `interrupted`) selecting those runs, or a lone date expression (`today`,
`yesterday`, `this week` — Monday 00:00 local — or `YYYY-MM-DD`) selecting the `yesterday`, `this week` — Monday 00:00 local — or `YYYY-MM-DD`) selecting the
runs created in that window; anything else stays free text. `--type` is the only runs created in that window; anything else stays free text. Runner-internal
files (`input.md`, `memory.md`, `history.md`, `output.md`, `session.html`,
`private/`) match only with `--debug-files`. `--type` is the only
narrowing mechanism and takes one of `pipeline`, `version`, `run`, `step`, narrowing mechanism and takes one of `pipeline`, `version`, `run`, `step`,
`field`, `artifact`; an unknown kind is an error. Ranking is exact name (3) > `field`, `artifact`; an unknown kind is an error. Ranking is exact name (3) >
name substring (2) > body text (1), equal tiers by recency, and every hit name substring (2) > body text (1), equal tiers by recency, and every hit
@@ -217,31 +224,27 @@ landed.
### Session export ### Session export
- When an OpenCode-harness model stage finishes, the server exports its real - When a model stage finishes, the server exports its real harness session
session read-only (v1 `opencode export <id>`, v2 `opencode session export <id>`) (OpenCode, Claude or Pi) read-only into one `session.html` in the turn artifacts
and writes exactly one file, `session.html`, into the same turn artifacts directory; it lists and serves like any other artifact. Older runs may still
directory; it lists and serves like any other artifact. list a retired `session.md`, which clients hide.
- The `session.md` export is retired: nothing writes it any more and it is never - Source and rendered file are capped at 8 MiB each; a cut export carries a
presented. A run recorded before the HTML-only change still lists `session.md` visible banner and `session_export.truncated: true` and is never called whole.
among its stored artifacts (dated evidence kept on disk, not deleted); every - The step records `session_export` (`session_id`, `backend`, `source`, html file
listing — app, TUI, web spike — hides it rather than showing it beside the html. name, `html_bytes`, `messages`, `truncated`, `diagnostic`) in `inspect --json`.
- The source read is capped at 8 MiB and the rendered file at 8 MiB, matching the Incomplete exports retry automatically up to three times after the run settles
ordinary per-artifact file bound; a cut source or a cut rendered file carries a (`session_export_recovery`); `pipelines repair-session-export RUN_ID SEQUENCE`
visible truncation banner at both ends and `session_export.truncated: true`, and writes a versioned repair file without replacing originals.
a truncated export is never called whole. - A failed or empty export records a diagnostic and never fails the run or
- The step records `session_export` (`session_id`, `backend`, `source`, the html changes the stage result. An existing `session.html` is never overwritten.
file name, `html_bytes`, `messages`, `truncated`, `diagnostic`) in
`inspect RUN_ID --json`. A record written before the change still carried
`markdown` and `markdown_bytes`; readers ignore those fields.
- A failed export, or a Pi stage with no native export path, records a diagnostic
(Pi: `source: "unavailable"`) and never fails the run or changes the stage result.
An existing `session.html` is never overwritten.
### Operator-only retention ### Operator-only retention
Run history and its artifacts are never pruned automatically. The operator-only Run history and its artifacts are never pruned automatically. Only explicit
`pipelines retention report` (strictly read-only) and `pipelines retention apply` commands remove them: `pipelines runs rm ID...` (finished runs, after
(removal after explicit approval) are the only commands that remove them; no confirmation; active runs and runs an unfinished retry depends on are refused) and
the operator-only `pipelines retention report` (strictly read-only) and
`pipelines retention apply` (removal after explicit approval); no
server startup, scheduler, `list_runs`, `stats`, `runs` or `inspect` path calls server startup, scheduler, `list_runs`, `stats`, `runs` or `inspect` path calls
retention, and there is no background goroutine, timer or startup hook. A policy retention, and there is no background goroutine, timer or startup hook. A policy
selects by rolling UTC age (`--older-than`), newest-N count (`--keep`), or their selects by rolling UTC age (`--older-than`), newest-N count (`--keep`), or their
@@ -264,8 +267,13 @@ assistant message with the same bounded readback as the final result, so a small
final result is visible behind large prior tool content. Inspect the retained final result is visible behind large prior tool content. Inspect the retained
session itself when a preview is bounded or omitted; never assume a complete tool session itself when a preview is bounded or omitted; never assume a complete tool
history from a preview. history from a preview.
Retry is allowed for a failed run after cleanup stops: a fresh run/session starts Retry is allowed only for a `failed` run after cleanup stops (`interrupted` and
at entry with the original input/directory/pinned version/edit scope. Previous `canceled` runs need a new run). It creates a new linked run with the original
input, directory, pinned version, edit scope and overrides. The default `resume`
mode restarts the failed stage (or `--stage`/`--visit`) with the completed
prefix's handoff and `public/` files; `--mode=restart` starts at entry;
`--input-file` merges a bounded JSON correction into the selected stage's input;
`--version N` picks another published version of the same pipeline. Previous
side effects remain and can happen again. Never describe retry or cancellation as side effects remain and can happen again. Never describe retry or cancellation as
rollback, or resume/replay admitted tool work just to recover formatting. rollback, or resume/replay admitted tool work just to recover formatting.