48 Commits

Author SHA1 Message Date
Marie Stephen Leo
be7a26cf3c Merge pull request #5 from stephenleo/fix-gate
fix(bad): write session state to .claude/ instead of TMPDIR
2026-04-19 14:42:20 +08:00
stephenleo
b09e3a425c fix(bad): schedule rate-limit resume 10 min after reset to avoid false positives
Firing the check exactly at resets_at risks hitting the API before the
quota has fully cleared. Adding a 600s buffer ensures the window has
settled before BAD re-checks and resumes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 12:55:03 +08:00
stephenleo
c29fc6e1b9 fix(bad): clarify re-run guard in statusline hook setup to prevent dropped chain
The ambiguous "stop at first file / skip bad-statusline.sh" wording caused
the scan to halt at priority 2 when bad-statusline.sh was already installed,
never reaching the original chain command (e.g. cship) at priority 4.
Rewrite Step 1 as explicit skip-and-continue vs stop-and-capture branches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 12:53:34 +08:00
stephenleo
f78a5b030d fix(bad): write session state to .claude/ instead of TMPDIR
Store bad-session-state.json next to the statusline script in .claude/
so it persists reliably outside the sandbox-restricted temp directory.
Gate-pre-continuation now reads from .claude/bad-session-state.json
(relative to project root) — no setup-time path substitution required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 09:41:06 +08:00
Marie Stephen Leo
db95d2cf2c Merge pull request #4 from stephenleo/bad-v1.2.0-audit
feat(bad): v1.2.0 — watchdog integration, 7-step pipeline, consistency audit
v1.2.0
2026-04-12 20:02:06 +08:00
stephenleo
44bce85c67 fix(bad): revert inline gate duplication, keep reference + mandatory language
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 20:00:11 +08:00
stephenleo
5200672209 fix(bad): make pre-continuation checks mandatory and surface missing session state
- Mark pre-continuation checks as mandatory (never skip, even with parallel
  stories) in the Phase 2 after-each-step note and as explicit Rule #12
- gate-pre-continuation.md now warns when bad-session-state.json is missing
  or rate_limits data is absent, instead of silently skipping — prevents
  usage thresholds being bypassed when the session-state hook isn't installed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 19:56:49 +08:00
stephenleo
8695e5fa73 fix(bad): add per-step notifications and fix timer Telegram formatting
- Add 📣 Notify callout after each Phase 2 step completes, replacing the
  single end-of-pipeline notify — coordinator now sends a status update
  for every step (Steps 1–7) of every story as it progresses
- Fix [M] option in pattern-timer.md Telegram message: <minutes> rendered
  as &lt;minutes&gt; in Telegram due to HTML parsing; changed to {minutes}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 19:35:15 +08:00
stephenleo
9292244bba audit(bad): extract inline subagent prompts to reference files, fix doc inconsistencies
- Extract Phase 3 cleanup, Phase 4 assessment, and Step 6 CI fallback
  inline prompts into dedicated reference files for maintainability
- Add pending_prs field to Phase 0 report structure for PR-merge watching
- Clarify MODEL_STANDARD scope to cover all non-review subagents
- Fix pattern-monitor.md: Step 4→6 typo and conclusion→success action
- Add Step 5 to watchdog long-running subagent list
- Simplify docs/index.md config table (remove Config Key column), add
  epic-level test design and retrospective steps to workflow overview
- Tighten delegate-mode rule to enumerate coordinator-only operations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 16:49:46 +08:00
stephenleo
66c2f31bf9 audit(bad): fix numbering, add missing config var, clarify notify pattern
- Add STALE_TIMEOUT_MINUTES to SKILL.md config table (was in README/docs but missing from skill)
- Fix Rules section: rule 11 was out of order between 6 and 7; resequenced 7–11 monotonically
- Fix duplicate Step 4 in module-setup.md (Core Config was also labeled Step 4); renumber Steps 5–9 and fix all internal cross-references
- Fix pattern-notify.md contradiction: restructure so terminal print is always-first and Telegram is additive; remove conflicting "always both" closing line
- Clarify gate-pre-continuation.md: note /reload-plugins is a built-in CLI command, not a Skill tool call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 16:01:01 +08:00
stephenleo
a6f5d04e97 refactor(bad/setup): fully interactive setup via AskUserQuestion
- Steps 3 & 4: separate AskUserQuestion calls per hook (state hook,
  activity hook), each waiting for its answer before installing
- Step 4 (core config): AskUserQuestion for name + language if not set
- Step 5: print all config as text then single AskUserQuestion —
  accept all defaults or type KEY=VALUE overrides via Other field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 13:29:45 +08:00
stephenleo
2fad48acd1 fix(bad/setup): clarify AskUserQuestion as an explicit tool call
Use "call the `AskUserQuestion` tool" phrasing so the coordinator
identifies it as a tool invocation rather than a prose description.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 13:11:22 +08:00
stephenleo
6dda6ac1ba fix(bad/setup): use AskUserQuestion for Steps 3 & 4 hook installs
Replaced free-text Y/n prompts (buried inside the Step 5 config block)
with explicit AskUserQuestion calls so each hook decision is a proper
interactive turn. Headless / accept-all-defaults path unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 12:53:07 +08:00
stephenleo
a0d0b893db fix(bad): always run activity-hook step on reconfiguration
Step 4 was silently skipped when Step 3 (statusLine) resolved as
already-configured, because the LLM incorrectly inferred both hooks
were done. Added an explicit always-run directive and a pre-check that
detects an existing hook and reinstalls without prompting, mirroring
the conditional logic pattern used by setup-statusline-hook.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 12:12:52 +08:00
stephenleo
8fa07e5012 feat(bad): bump to v1.2.0 — watchdog integration, 7-step pipeline, consistency audit
- Bump module_version and marketplace.json to 1.2.0
- Add pattern-watchdog.md and setup-activity-hook.py (hung-agent detection)
- Wire watchdog into SKILL.md Phase 2 and add Watchdog Pattern reference section
- Fix step-number drift: CI monitoring was mislabelled Step 4 throughout — corrected
  to Step 6 (pattern-monitor.md ×3, SKILL.md Monitor Pattern section)
- Fix Rule 3 in SKILL.md: sequential steps listed as 1→5, now 1→7
- Renumber module-setup.md steps from 1,2,2b,2c,3…6 → 1–8 (strictly increasing)
- Update all cross-references to renamed steps (gate-pre-continuation, setup-statusline-hook,
  pattern-watchdog)
- Update README and docs/index.md: 5-step → 7-step pipeline with ATDD (Step 2) and
  Test Review (Step 4); add STALE_TIMEOUT_MINUTES to config tables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 12:00:10 +08:00
Marie Stephen Leo
922c6ce201 Merge pull request #3 from stephenleo/bad-tdd
feat(bad): integrate BMAD Test Architect into pipeline
2026-04-12 11:39:38 +08:00
stephenleo
13133d685e feat(bad): auto-detect and chain existing statusLine during setup
Setup now scans settings files highest→lowest precedence, finds the
effective statusLine command, chains it stdin-safely into bad-statusline.sh,
and writes only to settings.local.json — no other files touched.
Detailed logic extracted to references/coordinator/setup-statusline-hook.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 10:17:07 +08:00
stephenleo
b0d09a3454 fix(bad): guard Phase 4 wait against empty BATCH_PRS when AUTO_PR_MERGE=true
When AUTO_PR_MERGE=true, Phase 3 merges all batch PRs before Phase 4
runs. The PR-merge Monitor receives an empty BATCH_PRS list, so ALL_DONE
stays true and ALL_MERGED fires on the first tick — skipping the pause
entirely. Fix by routing AUTO_PR_MERGE=true directly to the Timer path
so the WAIT_TIMER_SECONDS cooldown still fires before the next batch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 08:52:33 +08:00
stephenleo
77816e54d7 fix(bad): correct MODEL_STANDARD/MODEL_QUALITY step references in config table
Steps 1,2,4,5 / Step 3 were stale from the 5-step pipeline. Now correctly
reflects the 7-step pipeline: MODEL_STANDARD for Steps 1,2,3,4,6,7 and
MODEL_QUALITY for Step 5 (code review).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 21:03:33 +08:00
stephenleo
67ba7a5312 feat(bad): integrate BMAD Test Architect into pipeline
Adds three new test architecture steps to the BAD pipeline:

- Epic-Start Test Design (Phase 1, blocking): runs /bmad-testarch-test-design
  at the start of each new epic before any story pipelines begin
- Step 2 ATDD: runs /bmad-testarch-atdd after story creation, before development;
  sets new `atdd-done` sprint-status to prevent re-runs on restart
- Step 4 Test Review: runs /bmad-testarch-test-review after development, before
  code review

Renumbers pipeline from 5 to 7 steps. Updates skip table, task lists, Phase 3
PR collection reference, and Phase 4 batch summary table accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 20:57:28 +08:00
Marie Stephen Leo
147dcdd947 Merge pull request #2 from stephenleo/monitor-pattern
feat(bad): Monitor tool support + progressive disclosure refactor (v1.1.0)
v1.1.0
2026-04-11 19:51:57 +08:00
stephenleo
b2f5fa2302 feat(bad): wire up session-state capture for Pre-Continuation Checks
The coordinator's rate-limit and context-window checks were always
gracefully skipping because they had no way to read session state data.

Claude Code exposes context_window and rate_limits via the statusLine
script mechanism (JSON piped to the script on every API response).

- Add assets/bad-statusline.sh: captures session JSON to
  $TMPDIR/bad-session-state.json on every API response
- Add module-setup.md Step 2b: copies and chmod+x the script, wires it
  as the statusLine in .claude/settings.json; warns and defers if a
  statusLine already exists
- Update gate-pre-continuation.md: replace vague "read from stdin"
  instruction with a concrete Bash tool call to read the temp file;
  graceful skip still applies if file is absent (non-CC harnesses)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 19:34:04 +08:00
stephenleo
9f1ea09c2d fix(bad): resolve gh path before Monitor script to fix silent failures
The Monitor tool runs in a stripped shell where PATH doesn't include
/opt/homebrew/bin (or distro equivalents), so `gh` was silently not found.
Combined with 2>/dev/null this produced empty output on every poll cycle,
causing the merge check to never fire.

Fix: resolve gh's full path with `command -v gh` (POSIX-portable, OS-agnostic)
at the top of both poll scripts — CI poller and PR-merge watcher — before the
Monitor shell takes over. Add common-mistake note to the PR-merge watcher docs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 19:01:25 +08:00
stephenleo
7577312a6c feat(bad): auto-reconnect channel plugin at gate points and on notify failure
- gate-pre-continuation.md: run /reload-plugins at the top of every gate
  check when a channel is configured — no-op when already connected,
  silently restores a dropped Telegram (or other) MCP server
- pattern-notify.md: on channel tool failure, reload-plugins and retry once
  before falling back to terminal; set NOTIFY_SOURCE="terminal" if still
  failing to avoid repeated reload attempts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 15:55:45 +08:00
stephenleo
ed8df76664 fix(bad): use PR merge status for epic completion, not sprint-status done
The Phase 4 assessment subagent was equating sprint-status `done` with
"merged PR", causing the retrospective to fire immediately after Step 5
completes — even when all PRs were still open (AUTO_PR_MERGE=false).

sprint-status `done` is written by the Step 5 subagent after code review,
not after the PR lands on main. Add dependency-graph.md to the assessment
reads and explicitly require PR Status = `merged` (from the dependency
graph's authoritative GitHub-sourced column) for current_epic_merged and
all_epics_complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 15:50:50 +08:00
stephenleo
1328fa9d45 fix(bad): audit skill and docs for inconsistencies
- Fix task deletion referencing '& continuation' vs creation using '+ continuation' (leftover from prior & → + fix)
- Broaden gate-pre-continuation.md description: checks run between Phase 2 steps, after Phase 3 merges, and after retrospective — not only before Phase 0
- Fix wrong config path in docs and module-setup.md: _bmad/bad/config.yaml → bad: section of _bmad/config.yaml
- Fix '4-step pipeline' → '5-step pipeline' in README and docs/index.md (Steps 1–5 were always listed)
- Add missing API threshold variables to README config table
- Add Claude Code sandbox requirement (enableWeakerNetworkIsolation) to gh CLI setup steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 14:24:22 +08:00
stephenleo
6cb0438bcf feat(bad): add gh→curl fallback pattern for sandbox/TLS failures
Adds pattern-gh-curl-fallback.md with curl equivalents for all gh read
operations (pr list, pr view, pr checks, issue list, run view), wired
into SKILL.md, phase0-graph, and phase3-merge so subagents self-recover
when gh fails due to sandbox restrictions or TLS errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 14:08:17 +08:00
stephenleo
494a7390f9 refactor(bad): reorganize references into coordinator/ and subagents/ subdirs
Rename reference files into semantic subdirectories:
- coordinator/: gate-pre-continuation, pattern-monitor, pattern-notify, pattern-timer
- subagents/: phase0-graph, phase0-prompt, phase3-merge

Extract Phase 0 subagent prompt into phase0-prompt.md; SKILL.md now
delegates to it with a single-line read instruction. Update all internal
cross-references to reflect new paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 13:26:40 +08:00
stephenleo
e3246ced53 fix(bad): replace & with + in task names to avoid HTML entity encoding
TaskCreate HTML-encodes & to &amp; which renders as literal text in the
terminal UI. Using + avoids the encoding issue in Phase 2 Step 4 and
Phase 4 task labels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 12:56:35 +08:00
stephenleo
403b8b8042 fix(bad): gate retrospective on merged PRs, add Stop BAD option to retro timer
- Fix epic completion check: split current_epic_complete into
  current_epic_merged (all PRs landed) and current_epic_prs_open
  (PRs exist but unmerged) so retrospective only fires after PRs
  are actually merged, not just open
- Add [X] Stop BAD option to retrospective timer so user can halt
  the pipeline entirely without having to skip retro first
- Update timer-pattern.md to support optional [X] label/action
  (backwards-compatible — omitted when caller doesn't supply it)
- Fix Branch B status line messaging to distinguish epic-pending-merge
  from batch-complete states

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 10:51:08 +08:00
stephenleo
4b82538ed3 fix(bad): rebuild task list after Phase 0 to fix display order
Tasks render in creation order, so Phase 3/4 (created at startup) were
appearing before story-specific Phase 2 tasks (added after Phase 0).
Now all seven generic startup tasks are deleted and re-added in correct
execution order: Phase 2 story tasks → Phase 3 → Phase 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 10:21:20 +08:00
stephenleo
5241ba80db fix(bad): fix monitor pattern bugs, audit and correct stale references
- Fix PR-merge watcher: add --state merged, wait for ALL batch PRs before stopping monitor
- Fix duplicate task creation: initial task list now owns Phase 1/3/4, expand step only replaces generic Phase 2 tasks with story-specific ones
- Fix batch summary table missing Step 5 column
- Fix undefined MODEL_DEV variable → MODEL_STANDARD
- Fix stale Phase 4 reference in phase4-auto-merge.md → Phase 3
- Fix MODEL_STANDARD description to include Step 5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 10:11:47 +08:00
stephenleo
4d67ead598 fix(bad): always show Phase 3 in task list, mark skipped when AUTO_PR_MERGE=false
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:31:14 +08:00
stephenleo
12faba6f11 docs(bad): add --dangerously-skip-permissions guidance and Agent tool clarity
Document that BAD should be started with --dangerously-skip-permissions for
the full autonomous experience (no per-subagent permission prompts). Update
both README.md and docs/index.md Usage sections. Also clarify in SKILL.md
that the coordinator spawns subagents via the Agent tool explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:19:38 +08:00
stephenleo
b1736e8a0a docs(bad): sync README and docs with v1.1.0 pipeline and config changes
Add Step 5 (PR code review) to the pipeline description in both README.md
and docs/index.md, reflecting the split from the old Step 4. Add
MONITOR_SUPPORT, CONTEXT_COMPACTION_THRESHOLD, and TIMER_SUPPORT to the
README config table (already present in docs/index.md); add MONITOR_SUPPORT
to docs/index.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:02:46 +08:00
stephenleo
2d70f92379 feat(bad): split PR code review into Step 5, add GitHub issue creation in Phase 0
- Phase 0 now creates GitHub issues for all backlog stories (when gh
  auth is available), writes GH issue numbers back to epics.md, and
  skips gracefully in local-only mode
- Step 4 (PR & CI) now reads the GH issue number from epics.md and
  includes it in the PR title and description
- Extracted nested code review subagent from Step 4 into a dedicated
  Step 5 (PR Code Review), eliminating nested fenced code blocks and
  giving PR review first-class visibility in the task list
- Fixed Phase 3 heading backtick rendering issue
- Fixed stale _bmad/bad/config.yaml reference (now _bmad/config.yaml)
- TaskCreate now runs before Phase 0 spawns for live progress visibility
- CI branch conditions clarified as if/else-if/else

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:40:06 +08:00
stephenleo
b02f1a1ef4 fix(bad): add phase labels to story step tasks in task list
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:03:46 +08:00
stephenleo
ee31b9ba43 fix(bad): improve task visibility and CI branch clarity
- Create Phase 0 task as in_progress before spawning the subagent,
  giving live progress visibility from the start of the pipeline
- Expand remaining tasks after Phase 0 reports back instead of
  creating the full list after the fact
- Clarify CI branch as if/else-if/else so RUN_CI_LOCALLY correctly
  gates the Monitor and manual polling paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 18:00:46 +08:00
stephenleo
de8cd5b275 feat(bad): add Monitor tool support for CI polling and PR-merge watching (v1.1.0)
- Add MONITOR_SUPPORT config flag (true for Claude Code, false for Bedrock/Vertex/Foundry)
- Replace manual CI polling loop in Step 4 with Monitor tool when supported
- Replace blind WAIT_TIMER sleep in Phase 4 Branch B with Monitor PR-merge watcher + CronCreate fallback
- Extract Notify, Timer, and Monitor patterns into dedicated reference files for progressive disclosure
- Add sprint task list (TaskCreate) after Phase 0 for live progress tracking in UI
- Update module-setup.md and marketplace.json to register monitor_support alongside timer_support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 17:01:22 +08:00
stephenleo
02384c6983 update image 2026-04-05 14:43:12 +08:00
stephenleo
b0261a12de adding image 2026-04-05 14:40:25 +08:00
Marie Stephen Leo
a4833dd177 Merge pull request #1 from stephenleo/docs/update-installation-command
docs: update installation command to use npx skills add
v1.0.0
2026-04-05 13:52:13 +08:00
stephenleo
a54f13ac85 docs: update installation command to use npx skills add
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 13:50:34 +08:00
stephenleo
74150dc780 fix: improve Configure BAD help entry description and args
- Clarify SU description to list what gets configured (parallelism, models, worktree paths, timers)
- Add 'install' to SU args to match all trigger keywords in module-setup.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 13:36:06 +08:00
stephenleo
08b8191978 refactor: replace git checkout with git switch/restore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 13:03:13 +08:00
stephenleo
6616ecf548 docs: mention git worktrees as the parallelism isolation mechanism
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 12:57:24 +08:00
stephenleo
303af472f9 feat: initial release of BAD — BMad Autonomous Development v1.0.0
Standalone BMad module that orchestrates fully autonomous parallel
multi-agent pipelines through the full story lifecycle (create → dev →
review → PR), driven by the sprint backlog and dependency graph.

- Every step runs in a dedicated subagent with a fresh context window
- Harness-agnostic: detects Claude Code, Cursor, Copilot, etc. at setup
- Configurable models, timers, CI, and merge behaviour per harness
- Self-registering via assets/module-setup.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 12:49:27 +08:00
Marie Stephen Leo
563d649a61 Initial commit 2026-04-05 12:04:52 +08:00