/flowyeah:buildfrom flowyeah
Use when implementing work from an issue, error report, CI failure, plan file, or the conversation; when resuming a paused or crashed session; or with --intermittent for a flaky test
Ships in flowyeah. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Single command. Takes any source, produces tested, reviewed, merged PRs.
flowyeah:build [from <source>] [--continuous] [--intermittent] [--on-branch <branch>]
The agent's commitment: from step 3 onward, every command — git, bundle, test runners, anything — runs with the worktree at .flowyeah/worktrees/<name>/ as cwd. The checkout the pipeline was invoked from (the "primary checkout") stays as the user left it. If a command must reference the primary's state, do it through read-only access (git show <sha>:<file>, git log, git blame), never by cd-ing back to the primary to mutate it. See primary-checkout.md at the plugin root for the read-only command table and what the rule excludes.
Steps 0-2 (validate config, resolve source, pick task) are explicitly read-only against the primary checkout — see step 1's "read-only, main checkout" annotation in the pipeline diagram. Step 3 creates the worktree without touching the primary's tree, index, or HEAD: refs are updated via git fetch, the branch is based on origin/$DEFAULT_BRANCH, and artifact ignoring goes through info/exclude. From that point on, all subsequent steps (implement, commit, test, push, PR, hooks, mark-done, cleanup) operate inside the worktree exclusively.
This invariant is held by the build agent itself — tree-guard.sh does not enforce it for build sessions (see primary-checkout.md, "What tree-guard enforces"). Git itself prevents the primary from sharing the worktree's branch, so the build branch's state is mechanically isolated regardless of what happens on the primary.
Every ask-mode setting — pull_requests.merge: ask, issues.create_when_missing: ask, and any other the schema adds — splits the question and the action across two response turns.
Turn 1 — ask, then end your response. Put the question to the user in the configured language. Your response ends there: no API call, no further pipeline step. Control returns to the user.
Turn 2 — act on the answer. The user's next message decides what happens. An ambiguous answer means asking again, which is a fresh Turn 1.
The question ends your turn; the action starts the next one. This holds even when you are confident which way the user will answer — a setting is ask because the user wants the choice, not your prediction of it.
| Source | Example | Adapter |
|---|---|---|
| No argument | flowyeah:build | Resume from tmp/flowyeah/plans/ or ask |
| Conversation | flowyeah:build (mid-conversation) | Use current context |
| File | flowyeah:build from docs/plans/redesign.md | Read file directly |
| Prefix-based | flowyeah:build from prefix:id | Load adapters/<prefix>/source.md |
Prefix-based sources match the command prefix to a source adapter and config in flowyeah.yml:
flowyeah:build from gitlab:#5588 → reads adapters.gitlab config → loads adapters/gitlab/source.md (+ connection.md)flowyeah:build from github:#45 → reads adapters.github config → loads adapters/github/source.md (+ connection.md)flowyeah:build from linear:PROJ-123 → reads adapters.linear config → loads adapters/linear/source.md (+ connection.md)flowyeah:build from bugsink:68b87507-8b6f-4250-9d5c-55a1dc39d9c6 → reads adapters.bugsink config → loads adapters/bugsink/source.md (+ connection.md)flowyeah:build from newrelic:MXxBUE18... → reads adapters.newrelic config → loads adapters/newrelic/source.md (+ connection.md)New source? Create an adapter directory with connection.md + source.md, add config to flowyeah.yml under adapters. Zero changes to this skill.
If source is prose without tasks: brainstorm with the user, generate a task plan, save as canonical format.
# Plan: <title>
## Tasks
- [ ] Task description
- [ ] Another task
- [ ] Subtask A (leaf — this gets picked first)
- [ ] Subtask B
- [x] Completed task
Nesting uses standard markdown indentation (2 spaces). Only leaf tasks (no children) are picked for implementation. A parent task is automatically marked [x] when all its children are done.
Saved to tmp/flowyeah/plans/<key>.md in the main checkout.
Plan key derivation:
| Source | Key | Example path |
|---|---|---|
gitlab:#5588 | gitlab-5588 | tmp/flowyeah/plans/gitlab-5588.md |
linear:PROJ-123 | linear-proj-123 | tmp/flowyeah/plans/linear-proj-123.md |
github:#45 | github-45 | tmp/flowyeah/plans/github-45.md |
bugsink:68b87507-... | bugsink-68b87507 | tmp/flowyeah/plans/bugsink-68b87507.md |
newrelic:MXxBUE18... | newrelic-mxxbue18 | tmp/flowyeah/plans/newrelic-mxxbue18.md |
ghactions:65262548526 | ghactions-65262548526 | tmp/flowyeah/plans/ghactions-65262548526.md |
| File source | slugified filename | tmp/flowyeah/plans/redesign.md |
| Conversation (no source) | slugified work description | tmp/flowyeah/plans/webhook-retry.md |
Plan keys are filesystem identifiers for deduplication — for GUID-based sources (bugsink, newrelic) they use the first 8 characters of the GUID, lowercased; a vaguer rule would let different sessions derive different keys for the same error and defeat dedup. Branch names (see table below) may use a different, more descriptive slug strategy defined by each adapter (e.g., NEWRELIC includes the error class in the branch name for readability).
The tmp/ directory should be gitignored. Plans are developer process artifacts, not versioned deliverables.
digraph pipeline {
rankdir=TB;
node [shape=box];
validate [label="0. Validate Config\n(keys, adapters, auth)"];
resolve [label="1. Resolve Source\n(read-only, main checkout)"];
pick [label="2. Pick Task(s)"];
worktree [label="3. Worktree + Branch"];
verify_wt [label="3b. Verify Isolation" shape=diamond];
implement [label="4. Brainstorm → Plan → TDD"];
commit [label="5. Commit"];
test [label="6. Test"];
criteria [label="6a. Criteria Check" shape=diamond];
approval [label="6b. Implementation Approval\n(implementation.approval)" shape=diamond];
verification [label="6b2. Verification Gate\n(process_skills.verification)" shape=diamond];
deliver [label="6c. Rebase → Push"];
issue_link [label="6d. Issue Linkage\n(issues.create_when_missing)" shape=diamond];
pr [label="7. Create PR/MR"];
pr_hooks [label="7a. Run PR Hooks\n(pr.after_create)"];
ci_loop [label="7b. CI + Code Review Loop" shape=diamond];
before_merge [label="7b2. Before-Merge Hook\n(pr.before_merge)" shape=diamond];
merge_decision [label="7c. Merge Decision\n(pull_requests.merge)" shape=diamond];
hooks [label="8. Run Hooks\n(pr.after_merge)"];
mark [label="9. Mark Task Done"];
cleanup [label="10. Cleanup Worktree"];
awaiting [label="Awaiting Merge\n(paused session)"];
next [label="Next task?" shape=diamond];
validate -> resolve -> pick -> worktree -> verify_wt;
verify_wt -> implement [label="in worktree"];
verify_wt -> worktree [label="NOT in worktree\nSTOP"];
implement -> commit -> test -> criteria;
criteria -> approval [label="all met or\nnot verifiable here"];
criteria -> implement [label="unmet"];
approval -> verification [label="approved /\nauto-approved"];
verification -> deliver [label="fresh evidence /\nnot configured"];
verification -> implement [label="verification fails"];
approval -> implement [label="changes requested"];
deliver -> issue_link -> pr -> pr_hooks -> ci_loop;
ci_loop -> commit [label="issues found\nfix → commit → push\nskip approval+review"];
ci_loop -> before_merge [label="CI green +\nreview clean"];
before_merge -> merge_decision [label="done /\nnot configured"];
before_merge -> commit [label="HEAD changed"];
before_merge -> before_merge [label="fails / told to stop:\nSTOP, ask"];
merge_decision -> hooks [label="auto:\nmerge via adapter"];
merge_decision -> awaiting [label="manual:\nreport URL, pause"];
merge_decision -> hooks [label="ask:\nuser says yes"];
merge_decision -> awaiting [label="ask:\nuser says no"];
awaiting -> hooks [label="resume:\nPR merged"];
awaiting -> next [label="--continuous:\npick next task"];
hooks -> mark -> cleanup -> next;
next -> pick [label="--continuous:\ntasks remain"];
next -> finish [label="single task done /\nplan complete"];
finish [label="Report & exit"];
}
Before any pipeline step, validate the loaded flowyeah.yml:
config-schema.md from the plugin root.git_host, and issues.adapter (when create_when_missing is ask or always; an unreachable issue adapter discovered only at step 6d wastes the whole implementation) — verify credentials are reachable:
token_env + token_source → check the env var exists (via the token source file)github → verify gh auth status succeedslinear → verify Linear MCP is availableIf validation fails, STOP with actionable error messages. Do not proceed with a broken config.
Parse command arguments, read content, convert to canonical plan format. Save to tmp/flowyeah/plans/<key>.md.
github.com/.*/actions/runs/.*/job/.*), parse it to extract owner/repo, run_id, and job_id. Route to ghactions adapter with all parsed fields — the adapter uses job_id for metadata and run_id for fetching failed logs. Key: ghactions-<job_id>.adapters.bugsink.url, path contains /issues/issue/<uuid>), extract the issue UUID from the path. Route to bugsink adapter. Key: bugsink-<first-8-chars-of-uuid>.gitlab:#5588): verify prefix matches an adapter in flowyeah.yml adapters that has a source.md. Load adapters/<prefix>/connection.md + adapters/<prefix>/source.md, read its config from flowyeah.yml adapters.<prefix>, follow the adapter's instructions to fetch and convert to canonical format. Key: <prefix>-<id> (e.g., gitlab-5588). Save the adapter's Issue Linkage values (Issue-Ref, Issue-Close) — these will be written to state.md in Step 3 and used for PR/MR title and body in Step 7.tmp/..flowyeah/worktrees/*/.flowyeah/state.md (the Crash Recovery flow). Active sessions take precedence over plan resume: a half-done task must continue in its existing worktree — going straight to the plan would make the claim rule (step 2) skip the crashed task's branch and silently abandon the session while a fresh worktree starts the next task. Status: Awaiting Merge sessions follow their own resume flow (step 7c). Only when no active session exists, fall back to plans in tmp/flowyeah/plans/:
[ ] task in the active plan (tmp/flowyeah/plans/<key>.md, from main checkout)git branch -a — branch with task slug exists → skip to nextCreate worktree and branch. Always worktree, always branch. Worktree directory names derive from the branch with / flattened to - (worktree-lifecycle.md, Directory Naming) — <type>/<slug> branches live at .flowyeah/worktrees/<type>-<slug>/.
When --intermittent is passed: the worktree is created from $DEFAULT_BRANCH, never from a PR branch — read intermittent.md in this skill's directory before continuing, then resume the standard flow below. --intermittent overrides --on-branch.
When --on-branch <branch> is passed: skip the normal branch creation flow and attach to the existing branch instead — read on-branch.md in this skill's directory and follow it, then resume at 3b.
# Read git.default_branch from flowyeah.yml (default: main)
# Refs only — never checkout or pull in the primary (see invariant)
git fetch origin $DEFAULT_BRANCH
mkdir -p .flowyeah/worktrees tmp/flowyeah/plans
# Ignore flowyeah artifacts without mutating the primary's tracked files:
# info/exclude is shared by every worktree and never versioned
EXCLUDE="$(git rev-parse --git-common-dir)/info/exclude"
git check-ignore -q .flowyeah/worktrees 2>/dev/null || echo ".flowyeah/" >> "$EXCLUDE"
git check-ignore -q tmp/flowyeah 2>/dev/null || echo "tmp/" >> "$EXCLUDE"
# First run: setup wrote flowyeah.yml here untracked, and the branch commits
# the same file. git merge/pull aborts rather than overwrite an untracked file,
# but overwrites an ignored one — so ignore it until the branch lands.
if [ -f flowyeah.yml ] && [ -z "$(git ls-files flowyeah.yml)" ]; then
grep -qxF "/flowyeah.yml" "$EXCLUDE" || echo "/flowyeah.yml" >> "$EXCLUDE"
fi
# Base the branch on the fetched remote ref, not the primary's HEAD
git worktree add .flowyeah/worktrees/<type>-<slug> -b <type>/<slug> origin/$DEFAULT_BRANCH
If the repo has no origin remote, skip the fetch and base the worktree on the local $DEFAULT_BRANCH instead.
After creating the worktree, check if flowyeah.yml exists there. On first run, the file was just created by setup and isn't committed yet — worktrees are created from HEAD, so uncommitted files don't appear. Copy it from the main checkout:
MAIN_WORKTREE=$(git worktree list --porcelain | head -1 | sed 's/worktree //')
cd .flowyeah/worktrees/<type>-<slug>
# Copy flowyeah.yml if missing (first run — not yet in any branch)
if [ ! -f flowyeah.yml ] && [ -f "$MAIN_WORKTREE/flowyeah.yml" ]; then
/bin/cp "$MAIN_WORKTREE/flowyeah.yml" ./flowyeah.yml
# -f: the /flowyeah.yml exclude rule above applies to this worktree too
git add -f flowyeah.yml
fi
# Version the ignore rules via this branch's .gitignore (info/exclude covers
# the local repo, but teammates need the entries too). Exact-line check —
# check-ignore would false-positive on the info/exclude rules just added.
grep -qxF '.flowyeah/' .gitignore 2>/dev/null || echo '.flowyeah/' >> .gitignore
grep -qxF 'tmp/' .gitignore 2>/dev/null || echo 'tmp/' >> .gitignore
The first commit in the worktree will include flowyeah.yml and the .gitignore entries, so they reach the default branch via the PR — never committed directly to it. The primary checkout's own .gitignore is never touched.
Branch naming:
| Source | Branch name |
|---|---|
| linear:PROJ-123 | <type>/PROJ-123 |
| gitlab:#5588 | <type>/5588 |
| github:#45 | <type>/45 |
| ghactions:12345678 | fix/ci-<last_6_digits> (always fix, see adapter) |
| newrelic:MXxBUE18... | fix/<error-class-slug>-<guid-prefix> (always fix, see adapter) |
| bugsink:68b87507-... | fix/<first-8-uuid> (always fix, see adapter) |
| Prose/idea | <type>/<slug> |
Type inference:
| Task pattern | Type |
|---|---|
| "Add...", "Implement...", "Create..." | feat |
| "Fix...", "Resolve...", "Correct..." | fix |
| "Refactor...", "Extract...", "Move..." | refactor |
| "Update deps", "Configure..." | chore |
| Ambiguous | Ask the user |
Claim issue (when source is an issue tracker):
If the source came from an issue tracker (GITLAB, GITHUB, LINEAR), assign the issue to the current dev now — before any implementation begins. This signals to the team that someone is working on it.
gh issue edit <number> --add-assignee "@me"save_issue(id: "<id>", assignee: "me") via MCPIf the source is not an issue tracker (prose, BUGSINK, NEWRELIC), skip — there's no issue to claim. Issue creation stays at Step 6d (issues.create_when_missing).
Start-of-work status transition (when source is Linear):
After claiming, check adapters.linear.on_start in flowyeah.yml. If configured, follow the "On Start" section in adapters/linear/source.md to transition the issue status.
Create session directory and state files in the worktree:
mkdir -p .flowyeah
Write 4 session files (see Session Management section below). session-files.md defines how mission.md carries the source's criteria. If --intermittent was passed, set Investigation: intermittent in state.md — this switches Step 4 from standard debugging to the escalating intermittent-failure investigation.
Worktree symlinks and environment setup:
After writing session files, follow the Setup procedure from worktree-lifecycle.md (at the plugin root):
worktree.symlinks from flowyeah.ymlworktree.env, persist to state.md under ## Worktree Env, export, run worktree.setup commandsgit rev-parse --show-toplevel | grep -qF '.flowyeah/worktrees/' || echo "NOT IN WORKTREE — STOP"
NEVER write code outside a worktree. Analysis and planning are OK. Code changes are not.
Resolving the main checkout path (needed for plan files in tmp/ and cleanup):
MAIN_WORKTREE=$(git worktree list --porcelain | head -1 | sed 's/worktree //')
Use $MAIN_WORKTREE/tmp/flowyeah/plans/<key>.md to access plan files from inside a worktree.
Two independent decisions control this step:
implementation.brainstormimplementation.process_skillsThese are independent. brainstorm decides WHETHER brainstorming/planning happen. process_skills decides HOW each phase executes when it runs. A configured process skill is mandatory for its phase — it is not a suggestion, not a "nice to have", and not something to skip because the task looks simple.
Decision 1 — Which phases run (implementation.brainstorm):
always — brainstorm → plan → TDD for every task, regardless of apparent complexity.auto (default) — trivial tasks (single config change, rename, docs-only) go straight to TDD; non-trivial tasks go through the full brainstorm → plan → TDD cycle.Decision 2 — How each phase executes (implementation.process_skills):
| Phase | Skill configured? | Execution |
|---|---|---|
| Brainstorm | Yes | MUST invoke the configured skill via Skill tool |
| Brainstorm | No | Brainstorm inline |
| Plan | Yes | MUST invoke the configured skill via Skill tool |
| Plan | No | Plan inline |
| TDD | Yes | MUST invoke the configured skill via Skill tool |
| TDD | No | Do TDD inline |
| Debug | Yes | MUST invoke the configured skill via Skill tool |
| Debug | No | Debug inline |
| Verification | Yes | MUST invoke the configured skill via Skill tool (step 6b2) |
| Verification | No | No gate beyond step 6 |
Configured process skills are mandatory. If process_skills.tdd is configured and you are about to do TDD, you MUST invoke that skill — even if the task is trivial, even if you're on the "direct TDD" path, even if the source is a one-line fix from ghactions.
Full cycle (when brainstorming):
process_skills.brainstorming if configured; brainstorm inline otherwise.
When ### From source in mission.md is empty, the criteria are this session's own, so nothing outside it vouches for them. Set Status: Awaiting criteria approval in state.md, show the ### Added criteria, ask whether they are right, and end your response. Update mission.md with the answer, then go to the plan.process_skills.planning if configured; plan inline otherwise.process_skills.tdd if configured; do TDD inline otherwise.state.md on every phase transition.Direct TDD (when skipping brainstorm):
process_skills.tdd if configured; do TDD inline otherwise.state.md after completion.Red flags — if you're thinking any of these, STOP:
| Thought | Reality |
|---|---|
| "This is a trivial fix, I don't need the TDD skill" | brainstorm controls phases, not skills. Configured skills are mandatory for every phase that runs. |
| "I already understand the problem, I'll skip brainstorming" | Fine if brainstorm: auto — but if a brainstorming skill is configured AND you decide to brainstorm, you MUST use it. |
| "The ghactions/CI fix is simple, I'll just code it" | TDD still runs. If process_skills.tdd is configured, invoke it. |
| "I brainstormed with the user in Step 1 already" | Step 1 brainstorming (source resolution) is about WHAT to build. Step 4 brainstorming is about HOW to build it. They serve different purposes. |
| "The process skill is overkill for this change" | The user configured it for a reason. Invoke it. |
When Investigation: intermittent is set in state.md: replace the standard investigation with the escalating approach in intermittent.md (this skill's directory), which reads the failure log from mission.md and escalates until the cause is found. Return to the normal TDD cycle above once it is.
How much effort goes into commit messages depends on pull_requests.merge_strategy:
merge_strategy | Commit message effort | Why |
|---|---|---|
squash | Minimal. Clear and descriptive, but no conventions or writer agent needed. These commits will be squashed — the PR title+description is what survives (see Step 7). | Individual commits are thrown away on merge. |
rebase | Full. Apply commits.conventions and commits.writer (if null, write the message directly without delegating to an agent). These commits ARE the final history — they land directly on the target branch. | No merge commit; individual commits are the permanent record. |
merge | Full. Apply commits.conventions and commits.writer (if null, write the message directly without delegating to an agent). Individual commits are visible in branch history. | Both merge commit (PR title) and branch commits survive. |
Before running tests, export the worktree env vars from state.md's ## Worktree Env section. These must be active for every command that interacts with isolated dependencies (database, Redis, etc.).
# Export worktree env (read from state.md ## Worktree Env section)
export DB_SUFFIX=kM4tQ8hN
export REDIS_DB=pL7nR2wY
# Test (from flowyeah.yml testing.command)
<testing.command> <scoped-spec-files>
Test scope (testing.scope):
related — directly changed files and related integration/feature/system/e2e specsfull — run the full test suiteRead requirements-check.md at the plugin root and apply it to git diff origin/$DEFAULT_BRANCH...HEAD, with mission.md as the reference. Give every criterion under ## Success Criteria a verdict in mission.md:
| Verdict | How it reads in mission.md |
|---|---|
| Met | - [x] <criterion> |
| Unmet | - [ ] <criterion> |
| Only provable outside this environment (a bank accepting a file, a real device) | - [ ] <criterion> (not verifiable here: <why>) |
Any unmet criterion, or a scope or coherence problem, returns to step 4. Do not push.
This step also runs when step 7b or 7b2 restarts from step 5, because the fix commits change what the verdicts rest on.
Check implementation.approval in flowyeah.yml:
always — present the implementation for developer approval before pushing. For legacy, large, or critical codebases where every change needs human review before leaving the local environment.auto (default) — AI assesses risk: straightforward changes proceed to push automatically; complex, large, or high-risk changes ask for approval.When asking for approval, present:
Then ask: "Approve implementation?" with options:
When auto skips approval, log to state.md that approval was auto-granted with the rationale.
If implementation.process_skills.verification is not configured, this step is a no-op — go straight to step 6c. Step 6's test run is the only check.
When configured, it is mandatory. Invoke the configured skill via the Skill tool, then:
testing.command with the step 6 scope, with the worktree env exported.state.md under ## Verification: the exact command, the HEAD SHA it ran against, and the result (pass/fail counts or exit code).git rev-parse HEAD. Any commit after the run makes it stale; run it again.This step also runs when step 7b or 7b2 restarts from step 5 — skipping approval and code review on retry does not skip the evidence gate.
# Rebase (if pull_requests.rebase is true)
git fetch origin $DEFAULT_BRANCH && git rebase origin/$DEFAULT_BRANCH
# Push (force-with-lease only after rebase; regular push otherwise)
if pull_requests.rebase; then
git push -u origin $BRANCH --force-with-lease
else
git push -u origin $BRANCH
fi
Failure handling:
origin/$DEFAULT_BRANCH), continue the rebase, re-run the tests before pushing. If a conflict can't be resolved confidently, git rebase --abort and STOP — ask the user.--force-with-lease failure or non-fast-forward): someone pushed to the branch since the last fetch. git fetch origin $BRANCH, inspect what landed, re-rebase on top of it, and retry once. Still rejected → STOP and ask — never escalate to a plain --force.If the source was an issue tracker, Issue-Ref and Issue-Close are already set from step 1. Skip this step.
If the source was NOT an issue tracker (file, conversation, Bugsink, New Relic, GitHub Actions), check issues.create_when_missing:
issues.create_when_missing | Action |
|---|---|
ask | Two-Turn Stop (see the section above). |
always | Create one automatically via issues.adapter. |
never | Skip silently. |
Two-Turn Stop for issue creation. Turn 1 asks "Create an issue to track this work? (Yes/No)" and ends there — no issue, no step 7. Turn 2 acts: yes → create via issues.adapter, save Issue Linkage values, proceed to step 7; no → skip issue creation, proceed to step 7.
When creating an issue, use the source adapter pointed to by issues.adapter to create it. Save the resulting Issue Linkage values (Issue-Ref, Issue-Close) to state.md — they will be used for the PR title and body in step 7.
External-resource creation is never a smoke test. Any adapter call that creates an issue, MR, comment, or other external resource (here, step 7, step 8 hooks, any adapter write) writes to the real project and persists in its history. If the call fails with cryptic output, do NOT retry with a Test-like payload, switch endpoints, or fire another mutating request to isolate the problem — that creates garbage resources visible to the whole team. Verify connectivity with a read-only endpoint, then diagnose the failing write in place with verbose flags. See each adapter's connection.md → "Write Safety" for the concrete recipe.
GATE — verify Step 6d before proceeding. Check Issue linkage (6d) in progress.md. If it is unchecked and issues.create_when_missing is not never, STOP and execute Step 6d now. Do NOT create the PR/MR until issue linkage is resolved.
Always check if an open PR/MR already exists before creating one — fix iterations from 7b and restarts from 7b2 re-enter this step, and --on-branch sessions may attach to a branch that already has one (the hosting adapters' "Check for Existing PR" operation does this; reuse only OPEN ones):
# GitHub
gh pr view <branch> --json number,url,state 2>/dev/null
# GitLab — use the git host adapter's equivalent
Create PR/MR (7) is already checked in progress.md (this session created it and is re-entering from 7b), rewrite the title and body against the current diff with the rules below and apply them through the adapter's "Update PR/MR" operation: the fix commits changed the diff, and with squash the description becomes the merge commit. A PR/MR this session did not create (e.g. --on-branch attached to it) keeps its title and body.Load the git host adapter from adapters/<git_host>/connection.md + adapters/<git_host>/hosting.md, read its config from flowyeah.yml adapters.<git_host>, and follow the adapter's instructions to create the PR/MR.
The skill provides these values to the adapter:
git.default_branchpull_requests.delete_source_branchPR/MR title and body are the permanent record when squashing. How much effort goes into them depends on merge_strategy:
merge_strategy | Title + body effort | Why |
|---|---|---|
squash | Full. Apply commits.conventions and the writer (see writer rules below) to the PR title+description. The title becomes the squash commit message — it IS the final history. | Individual commits are thrown away; PR title survives. |
merge | Full. Apply commits.conventions and the writer (see writer rules below). The title becomes the merge commit message. | Merge commit (PR title) is what shows in git log --first-parent. |
rebase | Minimal. Descriptive title in language, no conventions. Individual commits (Step 5) already carry the conventions. Only pull_requests.writer applies here — commits.writer does not. | PR title is UI-only; individual commits are the permanent record. The description is still what reviewers read. |
Title rules:
languageIssue-Ref exists in state.md, append it in parentheses at the end — e.g., Implementar retry de webhook (#5588) or Add payment validation (PROJ-123)commits.conventions applies (see table above): follow the convention (e.g., feat: implementar retry de webhook (#5588))Body rules:
Issue-Close exists in state.md, include it — e.g., Closes #5588Source: in state.md is not an issue tracker, include a section headed exactly ## Criteria (a literal marker flowyeah:review looks for, in any language) with every line under ## Success Criteria in mission.md, word for word, with its verdict from step 6a. Nothing else records these criteria once step 10 removes the worktree.Writer rules — who writes the title and body:
pull_requests.writer set → delegate both to that agent, in every merge_strategy.squash or merge and commits.writer set → delegate both to commits.writer.When delegating, pass the agent the full diff (git diff <git.default_branch>...HEAD), the source issue/card content with Issue-Ref and Issue-Close from state.md, the session plan (Plan: in state.md), mission.md, language, and commits.conventions when the table above applies it. Without the issue and the plan the description degrades into a diff summary. Check the returned title and body against the title and body rules above before handing them to the adapter.
Code review results are reported in the terminal only — this is your current work session, not a team review artifact.
PR created ≠ done. Creating the PR/MR is the BEGINNING of delivery, not the end. You MUST proceed through 7a → 7b → 7b2 → 7c without stopping. Do NOT ask "what next?" or "should I monitor CI?" — always yes. Proceed immediately.
After PR/MR creation, check hooks.pr.after_create in flowyeah.yml. If configured, read the markdown file and follow its instructions.
Context available: Branch, PR/MR number+url, issue reference (if any), adapter config, diff.
Execution: Same as step 8 (Run Hooks) — read the file, follow instructions, best-effort. If the hook fails, report and continue to 7b.
Skip condition: If the PR already existed (was not just created), skip this hook — it already ran when the PR was originally created.
Do NOT give the prompt back. Stay in the loop until CI passes and reviews are clean. Use the git host adapter for CI polling. Fixing CI failures and review issues is a fundamental part of the build flow — the work is not done until CI is green and reviews are clean.
Red flags — if you're thinking any of these, STOP and re-read this section:
While waiting for CI:
Give each agent its own checkout to read from. Review agents can write, and they have edited production files to test a hypothesis. In this worktree such an edit would end up in the next commit, and in a shared checkout one agent would measure another's edit. Create one detached checkout for each agent that item 2 launches, at .flowyeah/review-checkouts/<agent>/, on the head 6c pushed:
HEAD_SHA=$(git rev-parse @{upstream})
NAME=$(printf '%s' "<agent>" | tr ':/' '--')
git worktree add -q --detach ".flowyeah/review-checkouts/$NAME" "$HEAD_SHA"
The checkouts sit inside this worktree's .flowyeah/, so the build owns them by containment: flowyeah:status scans one level under .flowyeah/worktrees/ and never reports them as orphans, and .flowyeah/review-worktrees/ stays the namespace of flowyeah:review, keyed by PR/MR number. Each agent's prompt gives the absolute path of its own checkout as the code to read and says: "Read-only. Do not edit files. Do not run tests." A finding that needs execution to be proven comes back as a hypothesis, and you verify it in this worktree after every agent has returned. A new round creates fresh checkouts at the new head.
Run code review agents from flowyeah.yml:
code_review.agents — always launch all of these.code_review.optional_agents — launch based on what changed (e.g., security-analyst if auth code was touched, code-quality-analyst for large refactors). Use judgment.code_review.agents is empty or missing: STOP and complain. Do NOT continue without code review.If code_review.instructions is configured, include the file contents as additional context passed to each agent alongside the diff and changed files.
When results come back: remove the checkouts first, before fixing anything. Their copies of the code would otherwise be in reach of any test runner or linter that does not honor .gitignore. This worktree's own git status does not show an edit made inside a checkout, so ask each one:
shopt -s nullglob
for CHECKOUT in .flowyeah/review-checkouts/*/; do
git -C "$CHECKOUT" status --porcelain # non-empty: that agent edited its checkout
git worktree remove --force "$CHECKOUT"
done
shopt -u nullglob
git worktree prune
A non-empty status means that agent edited files: report the agent and the files, and treat its findings as measured on modified code: confirm each one against the pushed head before acting on it. Then:
Git strategy for fixes: Always create new commits, never amend — new commits make it easy to review what changed between CI runs. With merge_strategy: squash (the default) they collapse at merge; with merge or rebase the fix commits become permanent history, so tidy them into meaningful commits before the final push if they would read as noise (step 5's table makes rebase-mode commits the permanent record).
If hooks.pr.before_merge is not configured, this step is a no-op — check off Before-merge hook (7b2) as "N/A — no before_merge hook" and go straight to step 7c.
When configured, it runs in every pull_requests.merge mode: before the merge API call in auto, before the PR/MR URL is reported in manual, and before the "Merge now?" question in ask — never between the two turns of the Two-Turn Stop.
Context available: Branch, PR/MR number+url, issue reference (if any), adapter config, diff. It runs inside the worktree with the worktree env exported, like every step from 3 on.
Execution:
$MAIN_WORKTREE/<path>, the hook is not on the default branch yet (typically just written in the primary checkout): read it from the primary — reads there are allowed — and say in the report that it is not on the default branch yet. Missing in both → STOP and report.| Outcome | How to tell | Action |
|---|---|---|
| Hook failed, or its instructions say to stop | — | STOP. Report why and end the turn. The user decides: re-run the hook; proceed to step 7c anyway — check off 7b2 as "overridden by user — " so the 7c gate lets it through; or abandon the session (Pipeline Rollback). |
| Hook left uncommitted changes | git status --porcelain is not empty | STOP. Report the files and end the turn. Merging now would ship without them, and step 10 cannot remove a dirty worktree. The user decides whether they are committed (then HEAD moves — next row) or discarded. |
HEAD moved | git rev-parse HEAD differs from git rev-parse @{upstream} | The diff 7b validated is gone. Increment Before-merge restarts in state.md (absent counts as 0). If it reaches 3, the hook has changed HEAD three times: STOP and ask instead of restarting — the same ceiling as "CI fails 3 times" in 7b, since a hook that always finds something to fix would otherwise loop forever; if the user says to continue, reset Before-merge restarts to 0 and restart. Otherwise, in progress.md, uncheck CI + code review (7b) and restart from step 5 (commit → test → verification gate → push → CI). That retry skips implementation approval and code review, as 7b's fix iterations do — but 7b2 runs again: it gates the final HEAD. |
Hook completed, HEAD unchanged | — | Check off 7b2, proceed to step 7c. |
@{upstream} is the head 6c pushed and 7b's CI ran on. Comparing against it rather than a SHA recorded before the hook keeps the check right when a crash or compaction interrupts the hook after it committed: on resume, the commit is still ahead of the pushed head.
Not best-effort, unlike the other project hooks. after_create and after_merge run after an irreversible act — the PR/MR exists, the merge happened — so stopping undoes nothing and they continue on failure. before_merge runs before one: stopping costs nothing and keeps a failed check from being merged. What the hook does is entirely up to its file; the pipeline only reads whether it finished, stopped, left changes behind, or moved HEAD.
GATE — verify Step 7b2 before proceeding. Check Before-merge hook (7b2) in progress.md. If progress.md has no Before-merge hook (7b2) line, add it unchecked below CI + code review (7b). If it is unchecked (and not N/A), STOP and execute Step 7b2 now — a session that crashed mid-hook must not reach the merge without passing through it. A session resumed from Awaiting Merge already passed 7b2 and does not re-run it.
CRITICAL — you MUST respect pull_requests.merge before merging anything:
pull_requests.merge | Action | Can you merge? |
|---|---|---|
auto | Use the git host adapter to merge | Yes |
manual | STOP. Report the PR/MR URL and do NOT merge. Do NOT proceed to step 8. Pause the session — see "Awaiting Merge" below. | No. Never. |
ask | Two-Turn Stop (see the section above). | Only if user says yes in a separate turn |
Two-Turn Stop for the merge decision. Turn 1 sets Status: Awaiting merge decision in state.md, presents the PR/MR URL, asks "Merge now? (Yes/No)", and ends there — no merge API call, no step 8, no further pipeline steps. Turn 2 acts: yes → merge via the git host adapter, proceed to step 8; no → report the PR/MR URL and pause the session (see "Awaiting Merge" below).
If pull_requests.merge is manual or ask (and user says no), the session pauses here. No merge happened, so nothing that presumes a merge may run: the task is NOT marked done, after-merge hooks do NOT fire, and the worktree is NOT removed. Steps 8-10 are deferred to resume.
On pause:
Status: Awaiting Merge in state.md. Keep the worktree and all session files.progress.md, check off Merge decision (7c) with the note "paused — awaiting manual merge". Steps 8-10 stay unchecked; they run on resume.On resume — whenever a later invocation encounters a session with Status: Awaiting Merge (crash-recovery scan, bare flowyeah:build, or the user asking about it), query the PR state via the Query PR State / Query MR State section of adapters/<git_host>/hosting.md:
Session: in its state.md with this conversation's $CLAUDE_CODE_SESSION_ID, then complete the deferred steps for that session: step 8 (after-merge hooks), step 9 (mark task done), step 10 (cleanup worktree).Merge failure recovery (auto mode only):
Before-merge hook (7b2) and run step 7b2 again before retrying the merge — the rebased HEAD is not the one the hook sawmanual mode — show the PR URL and let the user handle itGATE — verify Step 7c before proceeding. Check Merge decision (7c) in progress.md. If it is unchecked, STOP — you cannot run after-merge hooks before the merge is complete.
After a successful merge, check hooks.pr.after_merge in flowyeah.yml. If configured, read the markdown file and follow its instructions. The flat hooks.after_merge form is removed (see the schema's Deprecated Keys) — it is not consulted; flowyeah:check flags it with the migration hint.
| Hook | When it runs | Context available |
|---|---|---|
hooks.pr.after_create | After PR/MR creation (step 7a) | Branch, PR/MR number+url, issue reference (if any), adapter config, diff |
hooks.pr.before_merge | After CI and code review pass, before the merge decision (step 7b2) | Branch, PR/MR number+url, issue reference (if any), adapter config, diff |
hooks.pr.after_merge | After successful merge, before marking task done | Branch, MR/PR number+url, issue reference (if any), adapter config |
Execution:
flowyeah.yml hooks sectionflowyeah.yml)Hooks are best-effort. The merge already happened — the code is delivered. If hook instructions fail (API error, resource not found, permission denied), report the failure to the user with details, suggest manual action, and continue to step 9. Do not retry, do not roll back the merge. before_merge is the exception: it runs before the merge, and a failure there stops the pipeline (see step 7b2).
Hook files are project-level artifacts, versioned with the project. They follow the same pattern as adapters: markdown instructions that the AI reads and follows.
Example flowyeah.yml:
hooks:
pr:
after_create: docs/flowyeah-hooks/after-pr-create.md
before_merge: docs/flowyeah-hooks/before-merge.md
after_merge: docs/flowyeah-hooks/after-merge.md
Example hook file (docs/flowyeah-hooks/after-merge.md):
# After Merge: Associate Milestone
1. Read current version from line 5 of CHANGELOG
2. Calculate next patch version
3. Find or create milestone with that version
4. Associate the MR and issue to the milestone
If no hooks are configured, this step is a no-op.
GATE — step 9 runs only after a completed merge (auto, ask→yes, or an Awaiting Merge session resumed after the PR merged — never on the pause path itself). Check After-merge hooks (8) in progress.md: if it is unchecked and hooks.pr.after_merge is configured, STOP and execute Step 8 now. If no after-merge hook is configured, check it off as "N/A" and proceed.
.flowyeah/findings.md to auto memory[x] in tmp/flowyeah/plans/<key>.md (from main checkout, after merge)Closes #<iid> in MR description (no action needed)Closes #<number> in PR body (no action needed)bugsink: AND flowyeah performed the merge, and adapters.bugsink.on_merge is configured, follow the "On Merge" section in adapters/bugsink/source.md. Otherwise no action.GATE — verify Steps 8 and 9 before proceeding. Check After-merge hooks (8) and Mark task done (9) in progress.md. If either is unchecked (and not marked N/A), STOP and execute the missing steps first. Do NOT clean up the worktree until post-merge obligations are fulfilled.
Every unchecked step between your current position and cleanup is a step you must execute — the injection hook repeats unchecked pipeline items at the end of every prompt for exactly this reason. The pull from a completed merge straight to cleanup is what this gate exists to stop.
Removes the worktree and everything in it, including .flowyeah/ session files.
Follow the Teardown procedure from worktree-lifecycle.md (at the plugin root):
state.md ## Worktree Env, export, run worktree.teardowncd to main checkout, git worktree removeBefore removal, refresh the default branch ref — the next worktree is created from origin/$DEFAULT_BRANCH, so a refs-only fetch is all the update needed (the primary's HEAD stays wherever the user left it):
cd "$MAIN_WORKTREE"
git fetch origin $DEFAULT_BRANCH
Then remove the worktree as Teardown step 3 describes: reviewer checkouts left by step 7b first, then the worktree, then git worktree prune.
--continuous)Before entering the loop, check for another active continuous session on the same plan:
# Scan active worktrees for sessions targeting the same plan file.
# The sed strips the field name, any inline "# ..." comment the state.md
# template carries on these lines, and surrounding whitespace — a plain
# cut would keep the comment and the comparison would never match.
for state_file in "$MAIN_WORKTREE"/.flowyeah/worktrees/*/.flowyeah/state.md; do
PLAN=$(grep -m1 '^Plan:' "$state_file" 2>/dev/null | sed -e 's/^Plan:[[:space:]]*//' -e 's/[[:space:]]*#.*$//' -e 's/[[:space:]]*$//')
MODE=$(grep -m1 '^Mode:' "$state_file" 2>/dev/null | sed -e 's/^Mode:[[:space:]]*//' -e 's/[[:space:]]*#.*$//' -e 's/[[:space:]]*$//')
if [ "$PLAN" = "<this run's plan path>" ] && [ "$MODE" = "continuous" ]; then
echo "conflict: $state_file"
fi
done
If any active session has the same Plan: path AND Mode: continuous (the comparison happens inside the loop — each session is checked, not just the last one scanned), STOP: "Another continuous session is already working on this plan (). Running two continuous sessions on the same plan risks concurrent file writes when marking tasks done. Use a single continuous session per plan, or run without --continuous."
loop:
1. Pick next task
2. None left? → "Plan complete" → exit
3. Worktree → implement → commit → test → push → PR → CI loop
4. Stop condition hit? → stop and ask
5. Success? → back to step 1
Stop conditions for continuous mode:
Plans in tmp/flowyeah/plans/ accumulate over time. Cleanup rules (evaluated in order — first match wins):
[x], last modified >7 days ago): delete silently, log to stdoutOn each flowyeah:build run, before resolving the source, check for stale plans and clean up. First-match-wins means a completed plan is always cleaned up at 7 days — it never reaches the 30-day orphaned check.
Session state lives in .flowyeah/ inside the worktree. It survives context compaction (via hook injection) and crashes (files persist on disk). Cleaned up with the worktree in step 10.
.flowyeah/worktrees/<type>-<slug>/
└── .flowyeah/
├── state.md # WHERE — current position + decision context
├── mission.md # WHY — goal, scope, success criteria
├── progress.md # WHAT — task checklist with stats
├── findings.md # LEARNED — discoveries, gotchas, insights
└── review-checkouts/ # step 7b only: one detached checkout per review agent
Full schema, the worked example, and the update cadence live in session-files.md (this skill's directory). These header lines are the contract other parts of flowyeah read, so step 3 must write them and later steps must keep them current:
Type: build
Session: <$CLAUDE_CODE_SESSION_ID> # step 3; rewritten on every resume
Status: <phase, or "Awaiting Merge" when paused at 7c>
Step: <number and name>
Mode: single | continuous
Task / Source / Plan / Branch / Worktree
Issue-Ref / Issue-Close # from the source adapter's Issue Linkage (step 1)
Investigation: intermittent # step 3, when --intermittent was passed
On-Branch: true # step 3, when --on-branch was passed
Below the header, ## Worktree Env holds the resolved env that step 6 exports and worktree.teardown needs at step 10.
Update when: every pipeline step transition, every phase transition within step 4, after completing subtasks, after discovering dead ends, after making key decisions. The more context there, the better a resumed session performs.
Has two sections: Items (implementation tasks from the plan) and Pipeline (operational steps from step 5 onward). Both are updated as work progresses. The pipeline checklist ensures no post-implementation step is skipped — particularly after-merge hooks, which are easy to forget after a long session.
# Progress
## Items
- [x] Design retry strategy
- [x] Implement retry model
- [ ] Implement retry service
- [ ] Controller integration
- [ ] Feature specs
## Pipeline
- [ ] Commit (5)
- [ ] Test (6)
- [ ] Criteria check (6a)
- [ ] Implementation approval (6b)
- [ ] Verification gate (6b2)
- [ ] Rebase + push (6c)
- [ ] Issue linkage (6d)
- [ ] Create PR/MR (7)
- [ ] PR hooks (7a)
- [ ] CI + code review (7b)
- [ ] Before-merge hook (7b2)
- [ ] Merge decision (7c)
- [ ] After-merge hooks (8)
- [ ] Mark task done (9)
- [ ] Cleanup worktree (10)
## Stats
- Total: 5
- Done: 2
- Remaining: 3
Pipeline section rules:
implementation.approval is auto and auto-approved, check it off with a noteprocess_skills.verification is not configured, check off Verification gate as "N/A — no verification skill"issues.create_when_missing is never, check off Issue linkage as "skipped — create_when_missing: never"hooks.pr.after_create is not configured, check off PR hooks as "N/A — no after_create hook"hooks.pr.before_merge is not configured, check off Before-merge hook as "N/A — no before_merge hook"pull_requests.merge is manual (or ask→no), check off Merge decision as "paused — awaiting manual merge". Steps 8-10 stay unchecked — they run when the session resumes after the merge (see "Awaiting Merge" in step 7c)Schemas and hook behaviour are in session-files.md. What matters while working: keep findings.md's ## Summary current — the injection hook shows only that section, and step 9 promotes qualified findings to auto memory before the worktree is removed.
After a crash, the user returns to the main checkout. Run flowyeah:build:
.flowyeah/worktrees/*/.flowyeah/state.md for active sessionsStatus: Awaiting Merge are not resumed into implementation — handle them via the "Awaiting Merge" resume flow in step 7c (check the PR state via the hosting adapter first)Active sessions:
1. feat-5588 → Webhook retry logic (Step 4: TDD)
2. fix-5590 → Payment validation (Step 7b: CI wait)
3. chore-update-deps → Update dependencies (Step 7: Creating MR)
cd into chosen worktree, rewrite Session: in its state.md with this conversation's $CLAUDE_CODE_SESSION_ID (the hooks inject state only into the conversation it names), and continue from state.md.flowyeah/review-checkouts/ holds anything, the agents that read from it ended with the crashed conversation and their results are lost. Remove the checkouts with the loop from step 7b (reporting any that an agent edited), and if the session was in step 7b, dispatch the review agents againWhen a pipeline step fails irrecoverably (e.g., 3 CI failures, a merge conflict that can't be resolved) and the user has said to abandon the session. Rollback is never self-initiated: hitting a stop condition means STOP and ask — it deletes branches and a worktree, so it runs only on the user's explicit go-ahead.
state.md and findings.md to tmp/flowyeah/aborted/<key>/ for post-mortem[x] → [ ] in tmp/flowyeah/plans/<key>.md if it was prematurely markedworktree-lifecycle.md Teardown step 3 describes (before branch deletion — git refuses to delete a branch checked out in a worktree)git branch -D <branch>. Without the local deletion, the claim rule in step 2 sees the leftover branch as a claim and skips the retried task on every future run. Skip both deletions when On-Branch: true — the branch existed before flowyeah and should not be deleted on rollback.The aborted session artifacts in tmp/flowyeah/aborted/ persist for review. Cleanup: delete aborted entries older than 30 days during the plan lifecycle check (same timing as orphaned plan cleanup). Warn the user before deleting.
Before worktree cleanup:
findings.md and identify insights worth keeping.flowyeah/ directoryBefore claiming a task, check if another instance is already working on it:
git branch -a | grep -E 'feat/|fix/|refactor/|chore/'Concurrent --continuous guard: Two continuous sessions on the same plan file can race when marking tasks as [x]. Branch coordination prevents picking the same task, but concurrent file writes to the plan file are unguarded. The continuous mode entry check (see Continuous Mode section) detects and blocks this scenario.
One task = one reasonable PR. If a task is too large:
tmp/flowyeah/plans/<key>.mdflowyeah.ymlAll project conventions live in flowyeah.yml at the project root (versioned).
Precedence: flowyeah.yml overrides CLAUDE.md for all flowyeah operations. If flowyeah.yml says default_branch: develop and CLAUDE.md says something else, flowyeah.yml wins.
flowyeah.yml)If flowyeah.yml does not exist, load setup.md from the plugin root and follow its interactive setup instructions. Then proceed with the pipeline.
See config-schema.md at the plugin root for the full schema, types, defaults, and validation rules.
# Example — see config-schema.md for full schema and defaults
language: pt-br
git:
default_branch: develop
testing:
command: bundle exec rspec
implementation:
brainstorm: always
approval: always
git_host: gitlab
adapters:
gitlab:
url: https://gitlab.example.com
token_env: GITLAB_TOKEN
token_source: .env
project_id: 123
Platform integrations live in adapters/ at the plugin level, shared across skills. adapters/README.md has the directory layout, what each role file does, and how to add an integration.
Config lookup rule: all adapter config is under adapters.<name> in flowyeah.yml, regardless of whether the adapter is used as a source, a git host, or both.
STOP immediately and ask when:
| Condition | Action |
|---|---|
| Ambiguous task | Present interpretations, ask |
| No tasks remaining | Report plan status |
| Tests fail 3x | Show failures, ask for guidance |
| Before-merge hook stops | Failed, told to stop, left uncommitted changes, or its file is missing — report why and ask (see step 7b2) |
Before-merge hook changes HEAD 3x | Ask whether to continue (see step 7b2) |
| Architectural decision needed | Present options, ask |
| Missing dependency | State what's needed |
| Criteria this session wrote, after brainstorm | Ask for approval (see step 4) |
| No code review agents | STOP and complain |
| Auth failure (401/403) | Token may have expired — report the error and ask for a fresh token |
| Rate limited (429) | Wait for Retry-After duration (or 60s), retry once. If still limited, ask. |
| Transient API error (5xx, timeout) | Retry once after 5 seconds. If still failing, report and ask. |
When stopping, always provide:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rodrigomanhaes/flowyeah --plugin flowyeahOther plugins' skills for the same job
5 skills in this plugin
/checkUse when auditing or validating flowyeah.yml, or when a flowyeah setting is not taking effect and the config may be at fault/respondUse when addressing review feedback on a pull request or merge request. Use --own to work through the findings from a prior review --own round./reviewUse when reviewing a pull request or merge request. Use --own to self-audit your own PR without submitting anything, and finalize to tear down review state./statusUse when checking what flowyeah work is in flight — active sessions, plans, worktrees. Use `clean` to remove stale artifacts interactively.