Skip to content

pi-flow v2: user-defined flows with per-stage model and HITL/AFK orchestration - #9

Merged
maikeffi merged 3 commits into
mainfrom
pi-flow-v2
Jun 13, 2026
Merged

pi-flow v2: user-defined flows with per-stage model and HITL/AFK orchestration#9
maikeffi merged 3 commits into
mainfrom
pi-flow-v2

Conversation

@maikeffi

Copy link
Copy Markdown
Contributor

Implements the pi-flow v2 redesign from #1: the three hardcoded pipelines become user-defined flows — an ordered list of skills, each with its own model and a HITL/AFK mode — read from a top-level pi-flow key in settings.json and merged over three built-in flows.

Highlights

  • Flows as data, one engine. resolveFlows validates and defaults user config (mode→HITL, model→no-switch) and overlays it on BUILTIN_FLOWS. See ADR-0001.
  • HITL/AFK modes. AFK stages auto-advance on agent_end (guarded by a generic anti-signal check) — an all-AFK flow traverses unattended; HITL stages wait for /pi-flow:next.
  • Commands: run (with flow-name autocomplete), next, skip, retry, cancel, status, show.
  • Safe failures: models validated at run start; a stage that can't start halts the flow instead of cascading.
  • Built-ins out of the box (model-less, so they never trip validation), overridable by a same-named user flow.
  • Session restore with unknown-flow clearing.
  • Removed: pipelines.ts, the per-flow commands, setup, the design/code model binary, and the per-skill completion detector.

Tests

55 passing (vitest run), through the two seams the PRD specified — pure functions (flows, detector) and a fake ExtensionAPI/ExtensionContext (pi-flow.test.ts).

Caveats

  • This project has no static typecheck tooling (jiti-only runtime); correctness rests on the test suite.
  • readUserFlows (the settings.json fs adapter) is the one untested boundary — deliberately thin, below the seam.
  • Not yet run inside a live pi session (real agent_end / skill invocation is the manual integration check).
  • Breaking change → warrants the 2.0.0 bump at release (handled by the tag-driven workflow).

Closes #2
Closes #3
Closes #4
Closes #5
Closes #6
Closes #7
Closes #8

🤖 Generated with Claude Code

maikeffi and others added 3 commits June 13, 2026 18:01
ADR-0001 records making flows user-authored data run by one generic engine; CONTEXT.md glossary updated (Flow, Stage, Mode, Model).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…AFK modes

Replaces the three hardcoded pipelines with user-defined flows read from the top-level pi-flow key in settings.json, merged over three built-in flows. Each stage is { skill, model?, mode? }: omitting model keeps the current model, mode defaults to HITL. AFK stages auto-advance on agent_end (guarded by a generic anti-signal check) so an all-AFK flow traverses unattended; HITL stages wait for /pi-flow:next.

Adds run/next/skip/retry/cancel/status/show, run-start model validation, failure halts, and session restore with unknown-flow clearing. Removes pipelines.ts, the per-flow commands, setup, and the per-skill completion detector.

Implements #2, #3, #4, #5, #6, #7, #8 (parent #1). 55 tests via the pure-function and fake-ExtensionAPI seams.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Documents user-defined flows, the pi-flow settings.json schema, built-ins, modes, and the new command set; removes the old pipeline and design/code model-pair docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maikeffi
maikeffi merged commit ce0931f into main Jun 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment