# Parallel sprint wave: N workers, N worktrees, one integration branch Use this when an approved sprint plan has a wave of independent items (e.g. 3 items) that go to the same worker profile (e.g. the mobile developer agent) in parallel. Dispatch via terminal `hermes -p chat`, NOT delegate_task, unless the user says otherwise. ## 1. Branch base - Create the sprint integration branch from `main`: `git branch sprint-NN main`. - Do not base it on a branch that is still waiting for user approval (e.g. a tested but unmerged feature). Otherwise the sprint becomes hostage to that approval. After that branch is merged, merge/rebase it into the sprint branch. Give the user this reasoning in one sentence. - Park unrelated old investigations (leave their worktree untouched) and give the user a recommendation on whether they are still a priority. ## 2. Worktrees ``` git worktree add .worktrees/sNN- -b feature/ sprint-NN cp .worktrees//local.properties .worktrees/sNN-/ # Android SDK path; gitignored ``` A new worktree has no `local.properties`. Without it Gradle cannot find the SDK and the worker loses turns. ## 3. Resource allocation (example: 16 GB machine, 3 Android workers; size it to your RAM) Each worker gets its own, written into its brief: - AVD name + emulator port (5554/5556/5558). Command: `emulator -avd -port

-no-window -no-snapshot-save -memory 2048`. Use `adb -s emulator-

` everywhere; never kill another emulator. - Fake gateway port (e.g. 9151/9152/9153). - `./gradlew --max-workers=2`; the worker kills its own emulator at the end. List the AVDs (`emulator -list-avds`) and devices (`adb devices`) first, and assign distinct AVDs. ## 4. Briefs - One shared rules file (`ortak.md`) with: scope/permissions (commit only in own worktree, no push/PR/merge/rebase, don't touch other worktrees/main), secrets rule, resource rules, delivery (tests + assemble green, evidence under `docs/qa/sprintNN//`, RAPOR.md with a pre-state table, an AC table Geçti/Kısmi/Gerçek cihaz bekliyor, commit SHAs, final message), and "don't fabricate real-device tests". - One brief per item: worktree/branch/item code, AVD/ports, story, PM decisions, pre-state (see "measure before brief" in SKILL.md), tasks, ACs with concrete emulator commands, and a "Dokunma" list naming the other parallel items' areas. Ask the worker to keep shared-file edits (MainActivity, Settings) small to reduce merge conflicts. - Store briefs in the PM's own workspace (`/sprintNN/`), not the repo. Build the query file with `{ echo "Sen 'sın. Aşağıdaki işi uygula."; cat ortak-.md .md; } > .query.md`, then expand any shorthand placeholders (e.g. `$B` → full launcher path) with `sed` and `grep` the query files to confirm the safety section and expanded paths are present. - Later waves: write a NEW shared file per wave (`ortak-b.md`) with the new base SHA and any new rules; don't edit the earlier wave's file — it is the record of what those workers were told. - Before briefing, re-read the plan's wave table (`grep -n "S-\|Dalga" plan.md`): items not in the current wave are not briefed now, even if they look ready. - If a brief's AC needs a fixture the worker isn't allowed to create (forbidden tool/path), the PM creates it before dispatch and the brief says "hazır kurulu". ## 5. Dispatch The terminal tool refuses `&` in foreground commands. Use one terminal call per worker, all in the same turn, with `background=true, notify=true`: ``` hermes -p chat --query-file /.query.md --oneshot -Q \ --in /.worktrees/sNN- --source -sNN --max-turns 400 > /.log 2>&1 ``` `--in` sets the worker's cwd; `--source` tags the sessions so they can be found later. If the exact dispatch command from an earlier wave was lost to compaction, recover it from the PM profile's session db (include the WAL — recent writes live there): `hermes -p sessions list` and `hermes -p sessions export ... --session-id ` (never open the session database directly). ## 6. Monitoring (no polling loops; one check, then end the turn) With `-Q` the log holds almost nothing (only "compacting context" lines), so judge progress from these: ``` git -C status --porcelain | wc -l; git -C log --oneline sprint-NN..HEAD hermes -p sessions list --limit 5 hermes -p logs agent --session -n 5 ``` New `API call #` lines / a moving last-activity time = the worker is alive. No commits in the first minutes is normal: workers measure first. ## 7. Report to user after dispatch Table (item → worktree/branch/ports), base-branch decision + reason, scope narrowings found during measurement, parked work, risks (real device missing, RAM), next step (verify each RAPOR, merge locally into sprint-NN, report at wave end, no push). Put questions under **Sorular** at the end. ## 7b. User decisions between waves When the user approves items for later (real-device tour at sprint end, a limitation deferred to next sprint), append them to the plan file under "Sonraki sprinte devredilen" so the decision survives compaction. Before deleting a worktree the user approved removing, check `git worktree list`, the directory and `git branch --list `; if already gone, report that rather than claiming deletion. ## 8. Wave completion Verify each item independently (see SKILL.md step 10). Then merge the feature branches into `sprint-NN` locally, run tests/assemble on the merged result, and report the wave to the user. Push/PR/merge to main requires the user's approval.