flow-workflows 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/adapters/README.md +128 -0
  4. package/adapters/codex/AGENTS.md +82 -0
  5. package/adapters/codex/CORE.md +522 -0
  6. package/adapters/codex/PRIMITIVES.md +64 -0
  7. package/adapters/codex/README.md +126 -0
  8. package/adapters/codex/config.snippet.toml +88 -0
  9. package/adapters/codex/skills/flow-bug-fix/SKILL.md +171 -0
  10. package/adapters/codex/skills/flow-bug-investigate/SKILL.md +216 -0
  11. package/adapters/codex/skills/flow-bug-postmortem/SKILL.md +98 -0
  12. package/adapters/codex/skills/flow-bug-review/SKILL.md +190 -0
  13. package/adapters/codex/skills/flow-bug-ship/SKILL.md +187 -0
  14. package/adapters/codex/skills/flow-bug-start/SKILL.md +212 -0
  15. package/adapters/codex/skills/flow-bug-validate/SKILL.md +99 -0
  16. package/adapters/codex/skills/flow-doctor/SKILL.md +254 -0
  17. package/adapters/codex/skills/flow-feat-build/SKILL.md +350 -0
  18. package/adapters/codex/skills/flow-feat-design/SKILL.md +399 -0
  19. package/adapters/codex/skills/flow-feat-plan/SKILL.md +165 -0
  20. package/adapters/codex/skills/flow-feat-review/SKILL.md +350 -0
  21. package/adapters/codex/skills/flow-feat-ship/SKILL.md +417 -0
  22. package/adapters/codex/skills/flow-feat-start/SKILL.md +289 -0
  23. package/adapters/codex/skills/flow-feat-validate/SKILL.md +216 -0
  24. package/adapters/codex/skills/flow-init/SKILL.md +153 -0
  25. package/adapters/codex/skills/flow-news/SKILL.md +57 -0
  26. package/adapters/codex/skills/flow-next/SKILL.md +55 -0
  27. package/adapters/codex/skills/flow-work-README/SKILL.md +247 -0
  28. package/adapters/codex/skills/flow-work-abandon/SKILL.md +103 -0
  29. package/adapters/codex/skills/flow-work-clean/SKILL.md +228 -0
  30. package/adapters/codex/skills/flow-work-daily/SKILL.md +114 -0
  31. package/adapters/codex/skills/flow-work-green/SKILL.md +162 -0
  32. package/adapters/codex/skills/flow-work-query/SKILL.md +169 -0
  33. package/adapters/codex/skills/flow-work-respond/SKILL.md +176 -0
  34. package/adapters/codex/skills/flow-work-resume/SKILL.md +123 -0
  35. package/adapters/codex/skills/flow-work-status/SKILL.md +127 -0
  36. package/adapters/codex/skills/flow-work-try/SKILL.md +94 -0
  37. package/adapters/codex/skills/flow-work-watch/SKILL.md +223 -0
  38. package/adapters/gemini/CORE.md +521 -0
  39. package/adapters/gemini/PRIMITIVES.md +117 -0
  40. package/adapters/gemini/README.md +149 -0
  41. package/adapters/gemini/commands/flow/bug/fix.toml +168 -0
  42. package/adapters/gemini/commands/flow/bug/investigate.toml +213 -0
  43. package/adapters/gemini/commands/flow/bug/postmortem.toml +95 -0
  44. package/adapters/gemini/commands/flow/bug/review.toml +187 -0
  45. package/adapters/gemini/commands/flow/bug/ship.toml +184 -0
  46. package/adapters/gemini/commands/flow/bug/start.toml +209 -0
  47. package/adapters/gemini/commands/flow/bug/validate.toml +96 -0
  48. package/adapters/gemini/commands/flow/doctor.toml +251 -0
  49. package/adapters/gemini/commands/flow/feat/build.toml +347 -0
  50. package/adapters/gemini/commands/flow/feat/design.toml +396 -0
  51. package/adapters/gemini/commands/flow/feat/plan.toml +162 -0
  52. package/adapters/gemini/commands/flow/feat/review.toml +347 -0
  53. package/adapters/gemini/commands/flow/feat/ship.toml +414 -0
  54. package/adapters/gemini/commands/flow/feat/start.toml +286 -0
  55. package/adapters/gemini/commands/flow/feat/validate.toml +213 -0
  56. package/adapters/gemini/commands/flow/init.toml +150 -0
  57. package/adapters/gemini/commands/flow/news.toml +54 -0
  58. package/adapters/gemini/commands/flow/next.toml +52 -0
  59. package/adapters/gemini/commands/flow/work/README.toml +244 -0
  60. package/adapters/gemini/commands/flow/work/abandon.toml +100 -0
  61. package/adapters/gemini/commands/flow/work/clean.toml +225 -0
  62. package/adapters/gemini/commands/flow/work/daily.toml +111 -0
  63. package/adapters/gemini/commands/flow/work/green.toml +159 -0
  64. package/adapters/gemini/commands/flow/work/query.toml +166 -0
  65. package/adapters/gemini/commands/flow/work/respond.toml +173 -0
  66. package/adapters/gemini/commands/flow/work/resume.toml +120 -0
  67. package/adapters/gemini/commands/flow/work/status.toml +124 -0
  68. package/adapters/gemini/commands/flow/work/try.toml +91 -0
  69. package/adapters/gemini/commands/flow/work/watch.toml +220 -0
  70. package/adapters/gemini/settings.snippet.json +11 -0
  71. package/adapters/hermes/CORE.md +522 -0
  72. package/adapters/hermes/PRIMITIVES.md +86 -0
  73. package/adapters/hermes/README.md +145 -0
  74. package/adapters/hermes/config.snippet.yaml +63 -0
  75. package/adapters/hermes/skills/flow-bug-fix/SKILL.md +171 -0
  76. package/adapters/hermes/skills/flow-bug-investigate/SKILL.md +216 -0
  77. package/adapters/hermes/skills/flow-bug-postmortem/SKILL.md +98 -0
  78. package/adapters/hermes/skills/flow-bug-review/SKILL.md +190 -0
  79. package/adapters/hermes/skills/flow-bug-ship/SKILL.md +187 -0
  80. package/adapters/hermes/skills/flow-bug-start/SKILL.md +212 -0
  81. package/adapters/hermes/skills/flow-bug-validate/SKILL.md +99 -0
  82. package/adapters/hermes/skills/flow-doctor/SKILL.md +254 -0
  83. package/adapters/hermes/skills/flow-feat-build/SKILL.md +350 -0
  84. package/adapters/hermes/skills/flow-feat-design/SKILL.md +399 -0
  85. package/adapters/hermes/skills/flow-feat-plan/SKILL.md +165 -0
  86. package/adapters/hermes/skills/flow-feat-review/SKILL.md +350 -0
  87. package/adapters/hermes/skills/flow-feat-ship/SKILL.md +417 -0
  88. package/adapters/hermes/skills/flow-feat-start/SKILL.md +289 -0
  89. package/adapters/hermes/skills/flow-feat-validate/SKILL.md +216 -0
  90. package/adapters/hermes/skills/flow-init/SKILL.md +153 -0
  91. package/adapters/hermes/skills/flow-news/SKILL.md +57 -0
  92. package/adapters/hermes/skills/flow-next/SKILL.md +55 -0
  93. package/adapters/hermes/skills/flow-work-README/SKILL.md +247 -0
  94. package/adapters/hermes/skills/flow-work-abandon/SKILL.md +103 -0
  95. package/adapters/hermes/skills/flow-work-clean/SKILL.md +228 -0
  96. package/adapters/hermes/skills/flow-work-daily/SKILL.md +114 -0
  97. package/adapters/hermes/skills/flow-work-green/SKILL.md +162 -0
  98. package/adapters/hermes/skills/flow-work-query/SKILL.md +169 -0
  99. package/adapters/hermes/skills/flow-work-respond/SKILL.md +176 -0
  100. package/adapters/hermes/skills/flow-work-resume/SKILL.md +123 -0
  101. package/adapters/hermes/skills/flow-work-status/SKILL.md +127 -0
  102. package/adapters/hermes/skills/flow-work-try/SKILL.md +94 -0
  103. package/adapters/hermes/skills/flow-work-watch/SKILL.md +223 -0
  104. package/adapters/install.sh +99 -0
  105. package/adapters/opencode/CORE.md +521 -0
  106. package/adapters/opencode/PRIMITIVES.md +118 -0
  107. package/adapters/opencode/README.md +113 -0
  108. package/adapters/opencode/commands/flow-bug-fix.md +169 -0
  109. package/adapters/opencode/commands/flow-bug-investigate.md +214 -0
  110. package/adapters/opencode/commands/flow-bug-postmortem.md +96 -0
  111. package/adapters/opencode/commands/flow-bug-review.md +188 -0
  112. package/adapters/opencode/commands/flow-bug-ship.md +185 -0
  113. package/adapters/opencode/commands/flow-bug-start.md +210 -0
  114. package/adapters/opencode/commands/flow-bug-validate.md +97 -0
  115. package/adapters/opencode/commands/flow-doctor.md +252 -0
  116. package/adapters/opencode/commands/flow-feat-build.md +348 -0
  117. package/adapters/opencode/commands/flow-feat-design.md +397 -0
  118. package/adapters/opencode/commands/flow-feat-plan.md +163 -0
  119. package/adapters/opencode/commands/flow-feat-review.md +348 -0
  120. package/adapters/opencode/commands/flow-feat-ship.md +415 -0
  121. package/adapters/opencode/commands/flow-feat-start.md +287 -0
  122. package/adapters/opencode/commands/flow-feat-validate.md +214 -0
  123. package/adapters/opencode/commands/flow-init.md +151 -0
  124. package/adapters/opencode/commands/flow-news.md +55 -0
  125. package/adapters/opencode/commands/flow-next.md +53 -0
  126. package/adapters/opencode/commands/flow-work-README.md +245 -0
  127. package/adapters/opencode/commands/flow-work-abandon.md +101 -0
  128. package/adapters/opencode/commands/flow-work-clean.md +226 -0
  129. package/adapters/opencode/commands/flow-work-daily.md +112 -0
  130. package/adapters/opencode/commands/flow-work-green.md +160 -0
  131. package/adapters/opencode/commands/flow-work-query.md +167 -0
  132. package/adapters/opencode/commands/flow-work-respond.md +174 -0
  133. package/adapters/opencode/commands/flow-work-resume.md +121 -0
  134. package/adapters/opencode/commands/flow-work-status.md +125 -0
  135. package/adapters/opencode/commands/flow-work-try.md +92 -0
  136. package/adapters/opencode/commands/flow-work-watch.md +221 -0
  137. package/adapters/opencode/opencode.json +8 -0
  138. package/bin/cli.mjs +222 -0
  139. package/package.json +43 -0
  140. package/plugins/flow/.claude-plugin/plugin.json +21 -0
  141. package/plugins/flow/CHANGELOG.md +1744 -0
  142. package/plugins/flow/examples/FLOW.template.md +324 -0
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: flow-work-abandon
3
+ description: "Close a work without shipping (discarded feature, non-issue, etc.)"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/work/abandon.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `/flow-work-abandon`
9
+
10
+ > **hermes adapter — how the Claude Code primitives named below map here.**
11
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
12
+ > - `Agent <role>` / `Agent general-purpose` / subagents → `delegate_task`, which creates the child on the spot from the `goal` and `context` you give it: the name in `agents.<role>` in `FLOW.md` is a role to state in that prompt, not an agent to declare anywhere; empty → do it in this context.
13
+ > - Parallel fan-out → several `delegate_task` calls in one response, capped at `agents.fanout_max` (empty → 4) and, above that, by `delegation.max_concurrent_children` in `config.yaml` (default 10); `agents.fanout_tool` is Claude Code-only, ignore it.
14
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → Hermes schedules itself: the `cronjob` tool, or `/cron add "every 30m" "<this command>"`. Each firing is a fresh session with no history, so the state still lives in `monitor.md` and the scheduled text must stand alone; retiring the job from inside a firing needs `cron.allow_agent_scheduling: true`.
15
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
16
+ > - `Skill commit-commands:commit-push-pr` → `git add` · `git commit` · `git push -u origin HEAD` · the `git.cli` CLI (`gh pr create` / `glab mr create`).
17
+ > - `/model <value>` → Hermes's own `/model`; a subagent's model is `delegation.model` in `config.yaml`, one value for every child of a round.
18
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `mcp_servers` in `~/.hermes/config.yaml` (see `config.snippet.yaml`).
19
+ > - `$ARGUMENTS` → what the user typed after the skill name: Hermes takes everything from the first non-skill token on as the instruction.
20
+
21
+ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, autonomy, how a stop reads, `panel.json`, `00-summary.md`) — skip if you already read it in this session.
22
+
23
+ Clean closure for works that will not reach the base branch: a feature discarded after `design`, a bug that is not one (expected behavior, external problem, user misconfiguration), a work absorbed by another ticket.
24
+
25
+ ## 1. Pre-flight
26
+
27
+ - Locate the active `meta.json` by current branch; not found → ask the user for the ticket.
28
+ - `phase` already `done` → do not abandon: notify and stop (finished works are archived, not abandoned).
29
+ - Read `meta.json` and `00-summary.md`; open the existing artifacts in full only where the summary does not say what was done (missing summary → read the artifacts).
30
+
31
+ ## 2. Reason
32
+
33
+ Ask with `AskUserQuestion`. Typical options:
34
+
35
+ - **Discarded feature** (not enough value).
36
+ - **Not actually a bug** (expected behavior or external problem).
37
+ - **Absorbed by another ticket** (will be done in a different ticket).
38
+ - **Externally blocked** (depends on something outside our control).
39
+ - **Other** (user explains).
40
+
41
+ Record the reason in a single line — it goes into the artifact.
42
+
43
+ ## 3. Minimal capture
44
+
45
+ Write `.claude/work/<TICKET>/99-abandoned.md`:
46
+
47
+ ```markdown
48
+ # Abandoned <TICKET>
49
+
50
+ ## Reason
51
+ <one line>
52
+
53
+ ## State at abandonment
54
+ - Phase reached: <phase>
55
+ - Completed phases: <phases_done>
56
+ - Branch: <branch>
57
+ - Worktree: <meta.worktree path, or "none"> — <removed / kept>
58
+ - Commits on branch: <git log --oneline <base>..HEAD | wc -l>
59
+ - Is there unmerged code?: yes / no
60
+
61
+ ## What was learned (if applicable)
62
+ <short bullets on analysis conclusions, if any>
63
+
64
+ ## Follow-up actions (if applicable)
65
+ - New ticket to open:
66
+ - Changes to revert:
67
+ - Branch to delete: yes / no
68
+ ```
69
+
70
+ `<base>` = `git.default_base` in FLOW.md; empty → `origin/main` or `origin/master` per the repo's real base branch.
71
+
72
+ ## 4. Domain knowledge (conditional offer)
73
+
74
+ **Only if any `knowledge` role is set and the analysis left non-obvious findings** (why the domain works as it does, legal constraints, surprising integrations): ask whether to consolidate them (flow-core §0). Silence by default; the role empty → skip silently. An abandoned work is where this matters most: nobody comes back to read `99-abandoned.md`, and what the analysis learned about the domain is true whether or not the feature shipped.
75
+
76
+ ## 5. Git state
77
+
78
+ Ask the user what to do with the branch — do not decide alone:
79
+
80
+ - **Delete it locally** (nothing worth keeping): `git checkout <base> && git branch -D <branch>`. **Only if the user confirms** — destructive.
81
+ - **Leave it** (the topic may come back): do nothing.
82
+ - **Push it to the remote as a reference** (rare; valid when there is valuable analysis).
83
+
84
+ `meta.json.worktree` not null → the branch is checked out in a worktree and cannot be deleted while it exists:
85
+ - On **Delete it locally**: first, from the main checkout (not inside it), `git worktree remove <worktree>` (`--force` only if it has changes the user confirms discarding), then `git branch -D <branch>`.
86
+ - On **Leave it**: you may still offer to remove just the worktree directory (`git worktree remove <worktree>`) while keeping the branch.
87
+ - Note what was done in `99-abandoned.md`.
88
+
89
+ ## 6. Close
90
+
91
+ - Update `meta.json`: `phase = "abandoned"`; `phases_done` not touched (it reflects what was actually done); `notes` += abandonment reason; `updated_at` updated.
92
+ - Overwrite `00-summary.md` whole (≤15 lines, flow-core §5).
93
+ - **Tracker: move to won't-do** (never "done" — this work did not ship). Only if `tracker.tool` is not `none`/empty, `tracker.abandon_cmd` is set, and `meta.json.ticket` is a **real tracker id** (skip for local-only slugs). Run `tracker.abandon_cmd` substituting `{TICKET}` = `meta.json.ticket`. Same contract as `/flow-feat-start §6.5`: **best-effort, idempotent, gated** (ask once in `autonomy.mode: manual`; automatic in `guided`/`auto`); failure or already-in-state ticket → warn and continue, never block. `tracker.abandon_cmd` empty → do nothing (the user closes the ticket by hand if they want).
94
+ - `panel.json` present (`/flow-work-README`) → overwrite with a terminal state before archiving: the title, one `block` line saying the work was abandoned and why, no `Decision` line.
95
+ - Move the folder to `.claude/work/_archive/` **keeping its directory name** (`_archive/<work-dir>/`, the folder located in §1 — e.g. `<TICKET>-<slug>`) so `/flow-work-status` no longer lists it.
96
+ - Report to the user: ticket abandoned, reason, what was done with the branch.
97
+
98
+ ## Recovery
99
+
100
+ Intentionally manual — no dedicated command. If the topic resurfaces:
101
+ 1. Move the folder back: `mv .claude/work/_archive/<TICKET> .claude/work/<TICKET>`.
102
+ 2. Change `phase` to the phase from which to resume.
103
+ 3. Recreate the branch if it was deleted.
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: flow-work-clean
3
+ description: "Sweep what finished work left behind — merged worktrees, dead branches, unarchived work folders"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/work/clean.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `/flow-work-clean $ARGUMENTS`
9
+
10
+ > **hermes adapter — how the Claude Code primitives named below map here.**
11
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
12
+ > - `Agent <role>` / `Agent general-purpose` / subagents → `delegate_task`, which creates the child on the spot from the `goal` and `context` you give it: the name in `agents.<role>` in `FLOW.md` is a role to state in that prompt, not an agent to declare anywhere; empty → do it in this context.
13
+ > - Parallel fan-out → several `delegate_task` calls in one response, capped at `agents.fanout_max` (empty → 4) and, above that, by `delegation.max_concurrent_children` in `config.yaml` (default 10); `agents.fanout_tool` is Claude Code-only, ignore it.
14
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → Hermes schedules itself: the `cronjob` tool, or `/cron add "every 30m" "<this command>"`. Each firing is a fresh session with no history, so the state still lives in `monitor.md` and the scheduled text must stand alone; retiring the job from inside a firing needs `cron.allow_agent_scheduling: true`.
15
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
16
+ > - `Skill commit-commands:commit-push-pr` → `git add` · `git commit` · `git push -u origin HEAD` · the `git.cli` CLI (`gh pr create` / `glab mr create`).
17
+ > - `/model <value>` → Hermes's own `/model`; a subagent's model is `delegation.model` in `config.yaml`, one value for every child of a round.
18
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `mcp_servers` in `~/.hermes/config.yaml` (see `config.snippet.yaml`).
19
+ > - `$ARGUMENTS` → what the user typed after the skill name: Hermes takes everything from the first non-skill token on as the instruction.
20
+
21
+ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, autonomy, how a stop reads, `panel.json`, `00-summary.md`) — skip if you already read it in this session.
22
+
23
+ The forge (`git.cli`) is **best-effort**: CLI missing, unauthenticated, or over ~5s → fall back to the local evidence in §4 and say so in one line; never block.
24
+
25
+ The periodic sweep of the three residues a finished work leaves — its **worktree**, its **local branch**, its **`.claude/work/` folder** — which `/flow-feat-ship` and `/flow-work-abandon` only offer to remove at their end (and a train's intermediate MR/PR never sets `phase = "done"`). Inventory all three, judge each by **the forge's verdict**, remove only what is provably finished, and only after showing the whole list. The only flow command whose purpose is deletion; §0 governs.
26
+
27
+ ## 0. The rule that never bends
28
+
29
+ **Every deletion is confirmed by the user, in every `autonomy.mode` — including `auto`.**
30
+
31
+ Deletion is not flow mechanics — it can destroy work that exists nowhere else. `auto` does not authorize it; neither does an earlier confirmed sweep. Invoking the command authorizes the **sweep**; the §6 list authorizes the **deletions**, once, for that list only.
32
+
33
+ - **Never `--force`, never `-D` on a guess.** A removal that needs force is left alone and reported.
34
+ - **When the evidence is unclear, the entry is not a candidate.** Silence from the forge is not a merge.
35
+
36
+ ## 1. Modes
37
+
38
+ Parse `$ARGUMENTS`:
39
+
40
+ - **empty** → full sweep: inventory (§2–§3), classify (§4), show (§6), confirm and act (§7).
41
+ - **`--dry-run`** → §2–§6 only: prints the same table and stops. Touches nothing, asks nothing.
42
+ - **`--worktrees`** / **`--branches`** / **`--works`** → restrict the sweep to that inventory (combinable).
43
+ - **`--purge-archive <N>d`** → the separate, opt-in pass in §8. Not part of the default sweep.
44
+ - Anything else → unrecognized: explain the modes above and stop.
45
+
46
+ ## 2. Guard: run this from the main checkout
47
+
48
+ ```bash
49
+ git rev-parse --git-dir
50
+ git rev-parse --git-common-dir
51
+ ```
52
+ Differ → the session is **inside a worktree**, which cannot remove itself. Stop; tell the user to run from the main checkout, naming its path (first in `git worktree list`).
53
+
54
+ Read the current branch (`git branch --show-current`) — protected by §5 regardless of its state.
55
+
56
+ Refresh the remote view once so "merged" is not judged against a stale base:
57
+
58
+ ```bash
59
+ git fetch --prune origin
60
+ ```
61
+ `--prune` drops remote-tracking refs the forge deleted on merge (evidence for §4). Fetch fails (offline) → continue with what is local, note it in one line, treat every "merged" verdict as unconfirmed (§4, degraded).
62
+
63
+ ## 3. Take the inventory
64
+
65
+ Three lists, gathered in one pass:
66
+
67
+ - **Worktrees** — `git worktree list --porcelain` → path + branch per entry. Skip the first (the main checkout).
68
+ - **Local branches** — `git for-each-ref --format='%(refname:short)|%(upstream:short)|%(upstream:track)' refs/heads/`.
69
+ - **Work folders** — `ls -1 .claude/work/` (ignore `_archive`), reading each `meta.json` for `ticket`, `branch`, `phase`, `worktree`, `mrs[]`.
70
+
71
+ Two strays caught in the same sweep:
72
+
73
+ - **Prunable worktree registrations** — `git worktree prune --dry-run`: tracked entries whose directory is gone.
74
+ - **Orphan directories** — under the parent of `git.worktree_path` (empty → `.worktrees/`), claimed by no worktree in the inventory (remains of an `rm -rf`). Report; never delete a directory git does not know about without the user saying so explicitly.
75
+
76
+ Join on branch name — one row per branch with whichever of {worktree, branch, work folder} exist. A row with only one of the three is normal.
77
+
78
+ ## 4. Establish the verdict per branch
79
+
80
+ One question: **is this branch's work already in the base branch?** Strongest evidence first. `<base>` = `git.default_base`; empty → `git symbolic-ref --short refs/remotes/origin/HEAD`.
81
+
82
+ **(a) The forge — authoritative, and asked exactly once.** CLI from `git.cli` (or infer from `git.host`). Fetch merged and open lists in **two calls total**, join locally. Never query per branch.
83
+
84
+ ```bash
85
+ # GitLab
86
+ glab mr list --merged --per-page 100 -F json # → .source_branch, .web_url
87
+ glab mr list --per-page 100 -F json # open MRs
88
+ # GitHub
89
+ gh pr list --state merged --limit 100 --json headRefName,number,url
90
+ gh pr list --state open --limit 100 --json headRefName,number,url
91
+ ```
92
+
93
+ Merged list → **`merged`**. Open list → **`open`**. Neither → (b); conclude nothing from absence (the page limit alone explains it). More than ~100 MRs/PRs between sweeps → raise the limit or report that older entries were not covered.
94
+
95
+ **Third state, not in either list: `closed`.** An MR/PR closed *without* merging — rejected or superseded, neither `merged` nor in flight. **Never a candidate** (the code exists only on that branch); the report must say which: `MR !9679 closed without merging` vs `no MR/PR, 4 commits of its own`.
96
+
97
+ **(b) Ancestry — reliable when the forge merges with a merge commit.**
98
+
99
+ ```bash
100
+ git merge-base --is-ancestor <branch> origin/<base>
101
+ ```
102
+ True → **`merged`**.
103
+
104
+ **(c) Squash detection — (b) fails on every squash merge** (commits replaced by one new sha). Replay the tree onto the merge-base and ask whether the patch is upstream:
105
+
106
+ ```bash
107
+ mb=$(git merge-base origin/<base> <branch>)
108
+ synthetic=$(git commit-tree "$(git rev-parse <branch>^{tree})" -p "$mb" -m _)
109
+ git cherry origin/<base> "$synthetic"
110
+ ```
111
+ `git cherry` prints `- <sha>` → equivalent patch already in the base → **`merged`, squashed**; `+ <sha>` → fall through. The synthetic commit is a dangling object, gone at the next `gc`.
112
+
113
+ **(d) Nothing of its own** — `git rev-list --count origin/<base>..<branch>` is `0` → **`empty`** (never diverged, nothing to lose).
114
+
115
+ **(e) Otherwise** → **`unknown`**. Reported, never touched.
116
+
117
+ **Second pass, bounded.** Still `unknown` after (b)–(d) (older than (a)'s page window, or a squash whose MR/PR absorbed review changes): if **25 or fewer**, ask the forge per branch:
118
+
119
+ ```bash
120
+ glab mr list --source-branch <branch> --all -F json # GitLab
121
+ gh pr list --head <branch> --state all --json state,number,url # GitHub
122
+ ```
123
+ Above 25 → skip the pass and report how many were left unresolved.
124
+
125
+ Degraded mode (no forge, no successful fetch): keep the (b)–(d) verdicts, mark the whole table `(local evidence only — origin not refreshed)`, and drop `merged, squashed` to `unknown`.
126
+
127
+ ## 5. The protected set
128
+
129
+ A candidate must survive all of these — each a hard exclusion, not a warning:
130
+
131
+ | Protected | Why |
132
+ |---|---|
133
+ | The **current branch** and the **main checkout** | You are standing on it |
134
+ | `<base>` and any long-lived branch (`main`, `master`, `develop`, `staging`, `production`, `release/*`, or whatever the forge reports as protected) | Never candidates, whatever the verdict |
135
+ | A worktree with **uncommitted or staged changes** (`git -C <wt> status --porcelain` non-empty) | Unsaved work, and removing it would need `--force` |
136
+ | A branch with **commits not on the remote** and verdict ≠ `merged` | Exists only here |
137
+ | Verdict `open` | The MR/PR is live; the branch is in use |
138
+ | Verdict `closed` | The MR/PR was closed unmerged; the code lives only on that branch |
139
+ | Verdict `unknown` | See §0 — unclear evidence is not permission |
140
+ | A work folder whose `phase` is neither `done` nor `abandoned`, unless §6.C's reconciliation applies | Work in flight |
141
+ | Anything under `.claude/work/` — as **deletion** | This command archives folders; it never deletes them |
142
+
143
+ - "Not on the remote" is measured against **`refs/remotes/origin/<branch>`**, not `@{u}` (flow uses `git worktree add --no-track`, so a pushed branch has **no configured upstream**). Only with no remote ref at all does the count fall back to `origin/<base>..<branch>`.
144
+ - A `merged` branch with a dirty worktree gets its own report line (the MR/PR went in; edits in that checkout never left it). Leave it alone — the user's decision.
145
+
146
+ ## 6. Show the sweep
147
+
148
+ Group by action, most consequential first. One line per row, no prose between:
149
+
150
+ ```
151
+ Sweep of <repo> · base <base> · <N> worktrees · <N> branches · <N> work folders
152
+ Forge: <glab|gh> · <N> merged / <N> open MRs/PRs read
153
+
154
+ A. Worktrees to remove — MR/PR merged (<N>)
155
+ PROJ-1234-billing-retry-window .worktrees/PROJ-1234-… merged #412 branch too
156
+ PROJ-1240-invoice-pdf-export .worktrees/PROJ-1240-… merged #418 branch too
157
+
158
+ B. Branches to delete — merged, no worktree (<N>)
159
+ PROJ-1198-timezone-in-digest merged #401 (squashed)
160
+
161
+ C. Work folders to archive (<N>)
162
+ PROJ-1234-billing-retry-window phase: done → _archive/
163
+ PROJ-1150-legacy-import-spike branch gone, MRs merged → _archive/ ⚠ needs your call
164
+
165
+ D. Registrations to prune (<N>)
166
+ .worktrees/PROJ-1102-… directory gone
167
+
168
+ Left alone (<N>)
169
+ PROJ-1301-webhook-signing open MR/PR #430
170
+ PROJ-1288-rate-limit-headers merged #421, but worktree has uncommitted changes
171
+ PROJ-1210-batch-import MR/PR #388 closed without merging
172
+ spike-cache-layer no MR/PR, 4 commits not on the remote
173
+ .worktrees/PROJ-1090-stale directory not registered as a worktree
174
+
175
+ _archive: <N> folders (<size>) — untouched; see --purge-archive
176
+ ```
177
+
178
+ - Every row carries **why** — `merged #412`, `merged #401 (squashed)`, `never diverged` for `empty` — the reason is what the user approves. A row without one is a bug.
179
+ - `⚠ needs your call` in **C** = *settled but not closed out*: `phase` not `done`, yet every `meta.json.mrs` entry is `merged` and the branch is gone or merged (a train whose last `ship` never ran). Never fold into a bulk yes — confirm each individually; on confirmation set `phase = "done"` and `updated_at` before moving the folder.
180
+ - Every group empty → say the repo is clean, one line, stop.
181
+
182
+ ## 7. Confirm and execute
183
+
184
+ Ask once with `AskUserQuestion`: **Everything** · **Worktrees and branches only** · **Work folders only** · **Pick individually** · **Nothing**. On *Pick individually*, collect every choice before executing any — a half-applied sweep is worse than none.
185
+
186
+ Execute in this order (a branch cannot be deleted while a worktree holds it):
187
+
188
+ 1. **Worktrees** — `git worktree remove <path>`. No `--force`, ever: §5 excluded the dirty ones, so a failure means something changed since the inventory. Stop that row, report it, continue.
189
+ 2. **Branches** — `git branch -d <branch>` first. Git refuses on a squash merge; only then `git branch -D`, and only for rows whose verdict came from **the forge** (§4a) — never a locally inferred one. Name it in the report: `-D (squash-merged, MR #401)`.
190
+ 3. **Work folders** — `mv .claude/work/<dir> .claude/work/_archive/<dir>`, keeping the name, as `/flow-work-abandon` §6 does. Never `rm`.
191
+ 4. **Prune** — `git worktree prune`.
192
+
193
+ Never touch the remote (no `git push --delete`; deleting merged remote branches is the forge's job).
194
+
195
+ A step fails → report that row as failed with the git error verbatim, keep going. Never retry with a stronger flag.
196
+
197
+ ## 8. `--purge-archive <N>d` (opt-in, separate)
198
+
199
+ The sweep never touches `.claude/work/_archive/`; this opt-in pass is for when it has become noise. Only folders **archived more than `<N>` days ago** (newest `updated_at` in `meta.json`, else directory mtime) **and fully committed to git**, verified per folder:
200
+
201
+ ```bash
202
+ git ls-files --error-unmatch <dir> >/dev/null # tracked?
203
+ git status --porcelain <dir> # and no local modifications?
204
+ ```
205
+ Tracked and clean → in history (`git log -- <path>` brings it back). **Untracked** (`.claude/work/` is often git-ignored) → the only copy: exclude it, list it separately, say plainly that purging would be permanent.
206
+
207
+ Show the list with sizes, confirm as in §7, `rm -rf` only the tracked-and-clean ones. Report how many purged and how many kept for being untracked.
208
+
209
+ ## 9. Report
210
+
211
+ State first, then the numbers:
212
+
213
+ ```
214
+ <repo> · swept · <N> removed, <N> archived, <N> left alone
215
+ Worktrees removed: <N> (<disk freed>)
216
+ Branches deleted: <N>
217
+ Folders archived: <N>
218
+ Failed: <N> (<row>: <error>)
219
+ ```
220
+
221
+ Then at most three lines of body, only what could change a decision: failed rows, rows left alone for an actionable reason (dirty merged worktree, unpushed branch), the untracked-archive note if §8 ran. Nothing already in the §6 table.
222
+
223
+ ## Notes
224
+
225
+ - **Read the forge, not the calendar.** Age is never evidence — except in §8, where the entry is already archived and in git.
226
+ - **`/flow-work-status` §4 and `/flow-work-daily` §4 surface the same residue** as a count and point here; they never delete.
227
+ - **It does not advance `meta.json.phase`** — except the individually confirmed §6.C reconciliation (sets `done` when all MRs/PRs merged).
228
+ - **Safe to run often.** `--dry-run` is read-only; a clean repo produces one line.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: flow-work-daily
3
+ description: "Your work assistant — a Scrum-style daily standup across all your work (local + forge + tracker)"
4
+ ---
5
+
6
+ <!-- GENERATED by script/adapter-build.py from plugins/flow/commands/work/daily.md — do not edit; change the plugin file and run the script. -->
7
+
8
+ # `/flow-work-daily $ARGUMENTS`
9
+
10
+ > **hermes adapter — how the Claude Code primitives named below map here.**
11
+ > - `AskUserQuestion` → ask in plain text with numbered options and wait for the reply.
12
+ > - `Agent <role>` / `Agent general-purpose` / subagents → `delegate_task`, which creates the child on the spot from the `goal` and `context` you give it: the name in `agents.<role>` in `FLOW.md` is a role to state in that prompt, not an agent to declare anywhere; empty → do it in this context.
13
+ > - Parallel fan-out → several `delegate_task` calls in one response, capped at `agents.fanout_max` (empty → 4) and, above that, by `delegation.max_concurrent_children` in `config.yaml` (default 10); `agents.fanout_tool` is Claude Code-only, ignore it.
14
+ > - `ScheduleWakeup` / `Monitor` / `/loop` → Hermes schedules itself: the `cronjob` tool, or `/cron add "every 30m" "<this command>"`. Each firing is a fresh session with no history, so the state still lives in `monitor.md` and the scheduled text must stand alone; retiring the job from inside a firing needs `cron.allow_agent_scheduling: true`.
15
+ > - `TaskCreate` → a markdown checklist in the phase artifact.
16
+ > - `Skill commit-commands:commit-push-pr` → `git add` · `git commit` · `git push -u origin HEAD` · the `git.cli` CLI (`gh pr create` / `glab mr create`).
17
+ > - `/model <value>` → Hermes's own `/model`; a subagent's model is `delegation.model` in `config.yaml`, one value for every child of a round.
18
+ > - `knowledge.*` roles → whatever tools `FLOW.md` names there; an MCP tool keeps its name, its server is declared under `mcp_servers` in `~/.hermes/config.yaml` (see `config.snippet.yaml`).
19
+ > - `$ARGUMENTS` → what the user typed after the skill name: Hermes takes everything from the first non-skill token on as the instruction.
20
+
21
+ Read `~/.claude/flow/CORE.hermes.md` first (shared rules: `FLOW.md` step 0, autonomy, how a stop reads, `panel.json`, `00-summary.md`) — skip if you already read it in this session.
22
+
23
+ External sources (tracker, forge, `knowledge`) are all **best-effort**: a CLI missing/unauthenticated, an MCP failing, or a call over ~3s → continue without that source and note it in a single line; **never block**.
24
+
25
+ Your **work assistant**: a Scrum-style daily standup — *"what was I working on?"*, *"what's left?"*, *"what should I pick up today?"* — from three sources: **local** work state, the **forge** (open MRs/PRs, reviews, CI), the **tracker** (assigned/re-prioritized tickets). Unlike `/flow-work-status` (technical table) and `/flow-work-resume` (one branch), a cross-cutting narrative briefing.
26
+
27
+ **Read-only.** Never touches `meta.json`, git, the forge, or the tracker; its only write is the "last seen" marker (§6), like `/flow-news`.
28
+
29
+ ## Modes
30
+
31
+ - **No `$ARGUMENTS`** → full daily briefing (§5 three-block format).
32
+ - **`$ARGUMENTS` is a question** (e.g. `/flow-work-daily what's left on the payment work?`) → answer *that* from the same sources, without the full briefing. Do not move the marker (ad-hoc lookup, like `/flow-news vX.Y.Z`).
33
+
34
+ ## 1. Local layer (always — the base of the briefing)
35
+
36
+ - `git branch --show-current` → the **active** work.
37
+ - `ls -1 .claude/work/` (ignore `_archive`); read each `meta.json`.
38
+ - **"Last session" boundary**: the marker from §6 if present; otherwise the most recent commit date and the newest `updated_at` across works.
39
+ - Order works by `updated_at` (most recent first); the first is the *"what were we on?"* answer.
40
+ - Repo pulse: `git log --oneline --since="<last-session boundary>"` (fallback `-10`) and `git status --short` for uncommitted changes.
41
+ - Per work: `phase`, `phases_done`, MRs and their `status` (from `meta.json.mrs`), and what was **left pending** — synthesized from the most recent artifact(s) (`NN-*.md`) and `meta.notes`, not re-derived from code.
42
+ - **Cross-repo parts**: `meta.json.related_repos` entries not `done` → a *sibling repo* still needs work. Surface only what is recorded — never scan or open the other repo.
43
+ - **Open follow-ups**: `followups[]` entries not `declined`/`logged`/`done`, from the live works **and** from `_archive/*/meta.json` (flow-core §7). The archive is read for this and nothing else.
44
+
45
+ ## 2. Forge layer (best-effort, via `git.cli`)
46
+
47
+ What the team is asking of you **right now**. Resolve the CLI from `git.cli` (or infer from `git.host`); "you" is `git.assignee` if set, else the CLI's own identity (`@me`).
48
+
49
+ - **Your open MRs/PRs**: `glab mr list --author=@me` / `gh pr list --author @me`.
50
+ - **Awaiting your review**: `glab mr list --reviewer=@me` / `gh pr list --search "review-requested:@me"`.
51
+ - **CI red** on your MRs/PRs → flag it (→ `/flow-work-green`).
52
+ - **Cannot merge** — the forge's verdict, distinct from the pipeline: conflicts, behind base, draft, approvals missing (`detailed_merge_status`/`has_conflicts` on GitLab · `mergeable`/`mergeStateStatus`/`reviewDecision` on GitHub). Flag separately, naming the reason. Conflicts / behind-base → `/flow-work-green`; draft and approvals are yours or the reviewers' to clear.
53
+ - **Threads that need *your* reply** — **latest comment not yours**, fetched per open MR/PR (`glab api .../merge_requests/:iid/discussions` · `gh api` review threads), compared against `git.assignee` / `@me`. This — **not** the raw *unresolved* count — is the signal for `/flow-work-respond` (it **never resolves** threads, so an answered thread stays unresolved until the reviewer closes it).
54
+ - **Threads awaiting the reviewer** — unresolved, latest comment **is yours**: **informational only**, never an action for you.
55
+
56
+ Degrade: `git.cli` empty / not installed / unauthenticated / timeout → skip this layer and print one line, e.g. `(forge unavailable: gh not authenticated)`. The term MR/PR follows `git.host` (`gitlab` → MR, otherwise PR).
57
+
58
+ ## 3. Tracker layer (best-effort, via `tracker.tool`)
59
+
60
+ What you should **start or re-prioritize**. Resolve from `tracker.tool` (`acli` Jira / `gh` issues / `glab` issues / `linear` / `none`):
61
+
62
+ - **Assigned to you**: `gh issue list --assignee @me` / `glab issue list --assignee=@me` / the Jira (`acli`) or Linear equivalent (Linear via its MCP if available).
63
+ - Highlight: recently assigned, **priority changes**, and status changes that do not match your local work state.
64
+
65
+ Degrade like §2. `tracker.tool` `none`/empty → skip with one line (`(no tracker configured)`). Ticket format follows `tracker.prefix`.
66
+
67
+ ## 4. Cross the three layers (the real value)
68
+
69
+ Turn the *joins* into concrete, **suggested** commands (never act):
70
+
71
+ - Ticket assigned to you with **no local work** → `/flow-feat-start <TICKET>` or `/flow-bug-start <TICKET>`.
72
+ - Local work `done`/`ship` but its ticket still open in the tracker → divergence to close out.
73
+ - Local work whose branch has an open MR/PR with **CI red or an unmergeable state** (conflicts, behind base) → `/flow-work-green`; with **threads awaiting your reply** (latest comment not yours) → `/flow-work-respond`.
74
+ - A ticket's **priority was raised** while you were on something else → call out the possible refocus.
75
+ - `related_repos` entries not `done` → the **other repo's part is still open**: surface it (`<repo>: <scope>`) and suggest `/flow-feat-start <TICKET>` in that repo. `contract_handoff` `pending` → add that the contract was never handed over; the fix is `/flow-feat-ship` §6.3 on this side first. flow only reminds; it never scans the sibling.
76
+ - **Follow-ups nobody has decided on** → one line at most, not a list: `<N> follow-ups awaiting a decision (oldest: <TICKET> F2 — <title>)`, and separately any `accepted` entry with no `work` started, suggesting `/flow-feat-start <ticket>`. A standup is where deferred work should resurface; it is not where it gets triaged — that is `ship`, once. Say nothing when there are none.
77
+ - Uncommitted local changes not reflected in any log/artifact → nudge toward the relevant phase.
78
+ - **Residue piling up** → `/flow-work-clean`. Cheap local check, no extra forge calls: `git worktree list` (minus the main checkout) against the works already read; a worktree whose work is `done`, or that no work folder claims, is a finished branch still holding a checkout. One line with the count, at the end, only above a handful — housekeeping, never the headline.
79
+
80
+ Suggest only. The user decides.
81
+
82
+ ## 5. Output — the daily briefing (no `$ARGUMENTS`)
83
+
84
+ A short, narrative standup in three blocks, then next steps:
85
+
86
+ ```
87
+ ☀ Daily — <repo> · since <last-session boundary>
88
+
89
+ Yesterday / last session
90
+ <what you were on, what was left mid-way — 2-4 lines, most recent first>
91
+
92
+ Today
93
+ <what to resume + what the forge/tracker asks of you, ordered by urgency>
94
+
95
+ Blockers / attention
96
+ <CI red · reviews awaiting you (latest comment not yours) · divergences · raised priorities — or "none">
97
+
98
+ Awaiting others (optional)
99
+ <threads you already answered, waiting on the reviewer — informational, not yours to act on>
100
+
101
+ Next: <2-4 concrete flow commands>
102
+ ```
103
+
104
+ - Scannable prose, not a raw dump. Mark degraded sources inline so the user knows what was **not** checked (e.g. a trailing `(tracker unavailable)` line).
105
+ - **Blockers is only what *you* must act on.** Threads you already answered go in *Awaiting others*, never in Blockers — omit that block when empty.
106
+ - No local works and no external items → say so plainly and suggest `/flow-feat-start` or `/flow-bug-start`.
107
+
108
+ ## 6. "Last seen" marker (the only write)
109
+
110
+ Like `/flow-news`: a timestamp in `~/.claude/flow/daily-last-seen` (outside the repo) makes *"since last session"* precise.
111
+
112
+ - First run (no marker): derive the boundary from commits/`updated_at` (§1) and create the marker at the end.
113
+ - Update the marker **only** in the no-`$ARGUMENTS` briefing mode; untouched when answering an ad-hoc question.
114
+ - The documented exception to the read-only rule; everything else observes.