From e7af1fe94e399dc93be9421c1f8d6ead4cdf97b9 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Fri, 13 Nov 2026 15:10:30 +0100 Subject: [PATCH] Rewrite dev-workflow: subsessions + per-feature worktrees Aligned with pi-web native subsessions (pi-subagents retired): implementation and review run in tracked child sessions, review is a separate fresh-context child reading code-review SKILL.md by path. Issue IID drives branch naming (type/IID-slug). New section 3: one git worktree per feature for parallel features, cleanup after merge. Dropped global branch-strategy block in favor of project AGENTS.md rules. --- dev/dev-workflow/SKILL.md | 73 +++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/dev/dev-workflow/SKILL.md b/dev/dev-workflow/SKILL.md index 1b388ac..e92a6c3 100644 --- a/dev/dev-workflow/SKILL.md +++ b/dev/dev-workflow/SKILL.md @@ -1,46 +1,73 @@ --- name: dev-workflow -description: Personal development workflow for software projects. +description: Personal development workflow for software projects. Use when implementing an approved plan, when the user says "workflow" or "implement", or when creating the issue/branch/MR chain for a feature or fix. Assumes pi-web subsessions and one worktree per feature. --- # Dev Workflow -This skill enforces my personal development workflow for software projects. +My personal workflow for software projects. Assumes pi-web (subsession tools +available). Without them, implement and review in the main session and say so. -## Branch Strategy +Core idea: the main chat plans and discusses; implementation and review run in +tracked subsessions; every feature lives in its own git worktree so several +features can run in parallel without branches fighting over one checkout. -- **Main branch**: `master` or `main` (production) -- **Development**: Always on feature branches off main -- **New work**: Features, fixes, and chores each get their own branch +## 1. Plan and approve -## Workflow +Discuss the task until there is an implementation plan: summary plus discrete +steps. **Wait for explicit approval** (`go`, `approved`, `start`) before +creating anything. -### 1. Research / Discussion / Plan +## 2. Issue -Discuss the task, idea, or bug with the coding agent. The outcome is an **implementation plan** that includes: +Follow the project's AGENTS.md for branches, commits, and MRs. Without project +rules: branch off the integration branch (e.g. `development`), never off main. -- Summary of research and discussion -- Implementation plan broken into discrete steps +- Create a GitLab issue containing the plan (English), normal human title. +- Note the IID; everything below derives its name from it. -Create a GitLab/Git issue for the plan. The issue title starts with the feature slug, and the description contains the full plan. **WAIT for explicit user approval before creating the issue.** +## 3. Worktree (one per feature) -### 2. Implementation +Worktrees let several features run in parallel; plain branch switching cannot. -**Only proceed if the user explicitly approves the plan** (e.g., `go`, `approved`, `start`). Do not start implementing on your own. Before starting, the agent reads `AGENT.md` (project guidelines). Implementation proceeds step-by-step according to the plan. Each step is committed individually. +- Check for an existing worktree for this IID (`git worktree list`). Reuse it + if present; do not create duplicates. +- Otherwise, from the main checkout (which stays on the integration branch): + `git worktree add ../- -b /-` + e.g. `git worktree add ../ai-cowork-mode-routing -b feature/105-mode-model-routing`. +- The main checkout is never the implementation target while a worktree exists. +- Node projects: install dependencies in the fresh worktree once before + implementing (follow the project's AGENTS.md toolchain notes). -### 3. Review +## 4. Implementation (tracked subsession in the worktree) -After implementation is complete, a subagent with **fresh context** reviews the code and implementation using `code-review`. +Spawn ONE subsession with `cwd` set to the worktree path. Task text: approved +plan, issue IID, branch name, and "read AGENTS.md first". Stay responsive in +the main chat; the user watches and steers the subsession directly in pi-web. +At the join point call `yield_to_subsessions`, then verify the commits +(`git log`) before moving on. -### 4. Iteration +## 5. Review (fresh context, separate subsession, same worktree) -The agent fixes any findings the reviewer reported. This cycle continues until the reviewer subagent approves. +Spawn a SECOND subsession with the same `cwd` — never reuse the implementation +child. Task text: diff range (`git diff ...HEAD`), issue reference, and: +"Read /home/markus/workspace/skills/dev/code-review/SKILL.md and follow it." +(subsessions do not inherit the skills catalog.) The reviewer reports findings +and fixes nothing. -### 5. Merge Request +## 6. Iterate, merge, clean up -Create an MR/PR and inform the user. +- Fix findings as NEW commits (never amend/force-push a pushed branch). +- Substantial findings: another fresh review pass. +- Create the MR (English title/description), inform the user, then watch the + pipeline (gitlab_pipeline_status, job logs) and fix failures as new commits. +- After the MR merges: `git worktree remove ../-` and delete the + branch, unless the user wants it kept for follow-up work. -## Language Rule +## 7. Long work -- **Plans and artifacts**: Always in **English** -- **User discussions**: Any language +Work spanning multiple sessions: track it in goal-state.yaml (goal-state skill). + +## Language + +Plans, issues, commits, MR descriptions: English. Discussion: any language.