Skip to content

feat: integrate PhaseFlow as a native spec-driven workflow (v0.3.0) - #1

Merged
jbrahy merged 14 commits into
mainfrom
feat/phaseflow-integration
Jul 12, 2026
Merged

feat: integrate PhaseFlow as a native spec-driven workflow (v0.3.0)#1
jbrahy merged 14 commits into
mainfrom
feat/phaseflow-integration

Conversation

@jbrahy

@jbrahy jbrahy commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Integrates PhaseFlow (MIT, © 2025 Lex Christopherson) into gophermind as a first-class native subsystem, internal/phaseflow — the spec-driven loop Roadmap → Phases → Plan → Execute → Verify → Milestone, with state persisted under .planning/ (interchangeable with upstream's on-disk model).

What's included

  • Go state model — ROADMAP.md parser (decimal/inserted-phase ordering), progress computation, config.json load/save preserving unknown keys, and in-place checkbox mutation that preserves hand-authored formatting.
  • Embedded upstream assets — 67 phase commands, 33 subagent definitions, 34 templates vendored under internal/phaseflow/assets/ via go:embed (attribution in CREDITS.md + assets/LICENSE.upstream).
  • Command engine — deterministic ops in Go; agentic steps build a state-seeded prompt from the embedded command for gophermind's own agent to run.
  • User surfacegophermind phase <cmd> (CLI) and /phase <cmd> (TUI). The full embedded command surface is runnable by name.
  • Deterministic bookkeeping ported to Go (no model calls, cannot drift from the checkboxes): phase done, phase sync, phase archive.

Review & quality

Three rounds of adversarial review (haiku subagents). Findings fixed with regression tests:

  • 🔴 path traversal in ArchiveMilestone (version interpolated into a filename) — now validated.
  • 🟠 setCheckbox flipped a marker inside the description instead of the leftmost checkbox — now leftmost-only.
  • 🟡 swallowed MarkPhase error in CompletePlan — now propagated.
  • 🟠 absolute local path in PROJECT.md — removed.

Round 3: no remaining bugs. go build ./..., go vet ./..., gofmt, and full go test ./... all green. make snapshot validates the cross-platform release pipeline (darwin/linux/windows, deb/rpm/apk, SBOMs, Homebrew/scoop/winget).

Targets v0.3.0 (see CHANGELOG).

🤖 Generated with Claude Code

jbrahy and others added 14 commits July 11, 2026 04:08
Port of PhaseFlow's on-disk workflow model into Go: .planning/ layout,
ROADMAP.md phase/plan parser with decimal-phase ordering, progress
computation, in-place checkbox mutation, and config.json load/save that
preserves unmodeled upstream keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Vendor PhaseFlow's phase commands, subagent definitions, and workflow
templates (MIT, (c) 2025 Lex Christopherson) into internal/phaseflow/assets
and embed them via go:embed. Adds a frontmatter-aware loader exposing
Command/AgentPrompt/Template lookups so the engine can seed gophermind's
agent with the upstream prompts without an external install.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Engine drives the loop over the state model: Init scaffolds .planning/
(config/ROADMAP/STATE/PROJECT), Status renders progress and the current
phase, Next resolves the next incomplete phase. Agentic steps (roadmap,
plan, execute, verify, milestone) build a state-seeded prompt from the
embedded upstream command asset for gophermind's agent to run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
State commands (init/status/next/commands) run locally; loop steps
(roadmap/plan/execute/verify/milestone) build a state-seeded prompt that
runs through the standard agent path. Adds `phase` to completion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
/phase init|status|next|commands print to the transcript; loop steps
(roadmap/plan/execute/verify/milestone) send a state-seeded prompt to the
agent. Guards arg parsing and updates /help.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a PhaseFlow section to the README, an Unreleased CHANGELOG entry, and
upstream attribution in CREDITS for the vendored MIT assets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Any embedded PhaseFlow command (map-codebase, code-review, ship, …), not
just the five core loop steps, now runs agentically by name via
BuildCommandPrompt, from both `phase <cmd>` and `/phase <cmd>`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert PhaseFlow's deterministic SDK logic (state.cjs position/progress
sync, milestone.cjs archiving) from prompt-driven agent work into native Go:

- SyncState recomputes STATE.md's Current Position/progress from the roadmap
- CompletePlan marks a plan done, auto-ticks a finished phase, and syncs state
- ArchiveMilestone snapshots the shipped roadmap and appends a stat-bearing
  entry to .planning/MILESTONES.md, gated on all phases being complete

Wired as `phase done|sync|archive` (CLI) and `/phase done|sync|archive` (TUI).
These run locally with no tokens and cannot drift from the checkboxes.

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

Rework comments across the package to say why: the in-place ROADMAP edit
rationale, the friendly-verb→upstream-filename mapping, why state is injected
into step prompts, and the scope of the tiny frontmatter reader. Correct the
setCheckbox and parseAsset comments to match actual behavior, and inline the
redundant stateBar helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add PROJECT.md (committed project overrides: build/test commands, repo
conventions, PhaseFlow notes). Gitignore CONTEXT.md and .claude-resume as
machine/session-specific local state.

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

- SECURITY: validate milestone version before interpolating into a filename,
  rejecting path separators and '..' so `phase archive` cannot write outside
  .planning/milestones/ (with a traversal regression test)
- reliability: propagate MarkPhase failure in CompletePlan instead of swallowing
  it, so an unticked phase after all plans done is no longer silent
- privacy: drop the absolute local path from PROJECT.md

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

setCheckbox replaced the first marker *type* found anywhere on the line, so a
plan/phase whose description text contained a '[ ]'/'[x]' token had its
description corrupted instead of its checkbox. Select the leftmost marker
occurrence — the list item's own checkbox always precedes its text. Adds a
regression test with markers embedded in a plan description.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant