|
| 1 | +# bmad → superpowers transition (design) |
| 2 | + |
| 3 | +- **Date:** 2026-05-31 |
| 4 | +- **Status:** approved, ready for plan |
| 5 | +- **Scope:** workflow transition for the `httpware` project from bmad to superpowers, plus the first two pieces of work under the new flow. |
| 6 | + |
| 7 | +## Why |
| 8 | + |
| 9 | +bmad's ceremony has outweighed its value on this project. The planning artifacts produced (59KB PRD, 57KB architecture, 57KB epics, 40KB+ per-story specs) hold genuinely useful decisions, but the per-story workflow — `create-story → dev-story → code-review → retro` with extensive Given/When/Then ACs — is slow and over-engineered for a five-person-equivalent OSS library. We're switching the workflow to superpowers (brainstorming → writing-plans → executing-plans → requesting-code-review) while preserving the load-bearing engineering decisions in a single distilled doc. |
| 10 | + |
| 11 | +Five stories have shipped (1-1 through 1-5). Twenty-seven remain in the bmad backlog. The cutover happens between stories so the next story-1-6 starts on a clean flow. |
| 12 | + |
| 13 | +## Decisions |
| 14 | + |
| 15 | +| Decision | Choice | |
| 16 | +| --- | --- | |
| 17 | +| Workflow | Pure superpowers: brainstorming → spec → writing-plans → plan → executing-plans/subagent-driven → requesting-code-review → finishing-a-development-branch | |
| 18 | +| Topic naming | Kebab-case descriptions (`msgspec-decoder-adapter`), not story IDs | |
| 19 | +| Legacy planning docs | Distill load-bearing decisions into `docs/engineering.md`; archive the rest under `docs/archive/` | |
| 20 | +| AI entrypoint | `CLAUDE.md` stays the AI entrypoint and points at `docs/engineering.md` | |
| 21 | +| First task | Retrospective code review of shipped work (1-1 through 1-5) via `superpowers:requesting-code-review` | |
| 22 | +| Second task | Refactor based on review findings, one cohesive PR per finding-group | |
| 23 | +| Ordering | Transition (single PR) lands first; tasks 1–2 run on the new structure | |
| 24 | +| `deferred-work.md` | Kept at repo root as-is; remains the "real but not actionable now" log | |
| 25 | + |
| 26 | +## Distilled doc: `docs/engineering.md` |
| 27 | + |
| 28 | +One focused ~250–350 line document, written for both human contributors and AI agents. Sections: |
| 29 | + |
| 30 | +1. **Project intent** — 3–4 sentences. What `httpware` is, what it supersedes (`community-of-python/base-client`), who consumes it. |
| 31 | +2. **Architectural invariants** — the CI-enforced list from CLAUDE.md, plus one-line "why" for each so the next contributor can judge edge cases: |
| 32 | + - No `httpx2` leakage outside `src/httpware/transports/httpx2.py`. |
| 33 | + - No `httpx2` private API. |
| 34 | + - No `from __future__ import annotations` (Python 3.11+ floor). |
| 35 | + - No `print()` (ruff-enforced). |
| 36 | + - No global logging config; only `logging.getLogger("httpware")` or namespaced child loggers. |
| 37 | + - Type suppressions use `# ty: ignore[<rule>]`, never `# type: ignore` or `# mypy: ignore`. |
| 38 | +3. **The five protocol seams** — name, location, contract, the rule across it: |
| 39 | + 1. `Middleware ↔ Transport` (chain bottom calls `transport.__call__`) |
| 40 | + 2. `AsyncClient ↔ Middleware` (chain composed at construction) |
| 41 | + 3. `AsyncClient ↔ ResponseDecoder` (called when `response_model` provided) |
| 42 | + 4. `Httpx2Transport ↔ httpx2` (only `transports/httpx2.py` imports `httpx2`) |
| 43 | + 5. `httpware ↔ optional extras` (extras imported only inside their dedicated modules) |
| 44 | +4. **Exception contract** — mandatory fields on `StatusError` (`status: int`, `body: bytes`, `headers: Mapping`, `json: Any | None`, `request_method: str`, `request_url: str`), keyword-args-only construction, the `httpx2 → httpware` mapping table at the transport seam. |
| 45 | +5. **Module layout** — current tree (post-1.5) with which modules exist now vs. planned. |
| 46 | +6. **Testing patterns** — `pytest-asyncio` auto mode (no `@pytest.mark.asyncio`); `RecordedTransport` for transport mocking, not `respx`; Hypothesis property-based tests for concurrency-sensitive code in files named `test_*_props.py`. |
| 47 | +7. **Optional-extras pattern** — pydantic, msgspec, opentelemetry isolated to their own modules; import inside the module, never at package top-level. |
| 48 | +8. **Remaining roadmap** — short bullets, one line per remaining story (1-6 through 6-5), grouped by epic. No 40KB specs. When work starts on a roadmap item, it gets a superpowers spec. |
| 49 | +9. **Deferred work** — pointer to `docs/deferred-work.md`; not duplicated here. |
| 50 | + |
| 51 | +Explicit omissions vs. the bmad planning bundle: the 47 numbered FRs, 25 NFRs, persona work, and long architecture-decision essays move to `docs/archive/` and are cited only when a future spec needs the original rationale (e.g., "we decided X because of NFR-12"). |
| 52 | + |
| 53 | +## Archive layout |
| 54 | + |
| 55 | +Single commit moves bmad artifacts to `docs/archive/`: |
| 56 | + |
| 57 | +``` |
| 58 | +docs/ |
| 59 | +├── engineering.md (NEW — the distilled doc) |
| 60 | +├── deferred-work.md (KEEP at root — actively used) |
| 61 | +├── superpowers/ |
| 62 | +│ ├── specs/ (NEW — this spec is the first artifact) |
| 63 | +│ └── plans/ (NEW — implementation plans) |
| 64 | +└── archive/ |
| 65 | + ├── README.md (NEW — 1 paragraph framing) |
| 66 | + ├── prd.md |
| 67 | + ├── architecture.md |
| 68 | + ├── epics.md |
| 69 | + ├── product-brief-httpware.md |
| 70 | + ├── product-brief-httpware-distillate.md |
| 71 | + └── stories/ |
| 72 | + ├── 1-1-project-scaffold-and-tooling.md |
| 73 | + ├── 1-2-core-data-types.md |
| 74 | + ├── 1-3-exception-hierarchy-with-plain-fields.md |
| 75 | + ├── 1-4-transport-protocol-and-httpx2transport-adapter.md |
| 76 | + ├── 1-5-responsedecoder-protocol-and-pydantic-adapter.md |
| 77 | + └── sprint-status.yaml |
| 78 | +``` |
| 79 | + |
| 80 | +`docs/archive/README.md` (~1 paragraph) frames the archive: these files are historical reference, not authoritative; load-bearing parts were distilled into `../engineering.md` on 2026-05-31; consult these only for original rationale or to settle a "why did we decide X" question. |
| 81 | + |
| 82 | +`.review-tmp/` at repo root (bmad code-review artifact dump) is deleted. The story diffs and bundle are recoverable from git history if ever needed. |
| 83 | + |
| 84 | +`CLAUDE.md` updates: |
| 85 | +- Replace the "Project Overview" bmad bullets with pointers to `engineering.md` (primary) and `docs/archive/` (history). |
| 86 | +- Add a one-liner describing the per-feature flow: brainstorming → spec in `docs/superpowers/specs/` → writing-plans → plan in `docs/superpowers/plans/` → executing-plans → requesting-code-review. |
| 87 | +- The "Architecture invariants (CI-enforced)" and "Code conventions" sections stay verbatim — these are AI-enforcement rules, not design rationale. |
| 88 | + |
| 89 | +## New per-feature workflow |
| 90 | + |
| 91 | +For every future piece of work — story 1-6 onwards, the upcoming refactor, anything else: |
| 92 | + |
| 93 | +``` |
| 94 | +1. brainstorming → docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md |
| 95 | +2. writing-plans → docs/superpowers/plans/YYYY-MM-DD-<topic>-plan.md |
| 96 | +3. using-git-worktrees (isolate workspace) |
| 97 | +4. executing-plans OR subagent-driven-development (depending on task shape) |
| 98 | +5. test-driven-development (rigid skill, applied throughout step 4) |
| 99 | +6. verification-before-completion (before claiming done) |
| 100 | +7. requesting-code-review (before merge) |
| 101 | +8. finishing-a-development-branch (merge / PR / cleanup) |
| 102 | +``` |
| 103 | + |
| 104 | +Topic slugs use kebab-case descriptions, not story IDs (`msgspec-decoder-adapter`, not `story-1-6`). The mapping to the old backlog lives in `engineering.md`'s roadmap section. |
| 105 | + |
| 106 | +Gone: |
| 107 | +- 40KB story files with extensive Given/When/Then ACs. |
| 108 | +- `sprint-status.yaml`, retros (the existing five stories had retros marked `optional` anyway). |
| 109 | +- The bmad code-review workflow / `.review-tmp/` bundle. Replaced by `superpowers:requesting-code-review`, which reviews the branch diff against the spec. |
| 110 | +- The epics layer as a workflow construct. The "epic" framing survives only as a grouping in `engineering.md`'s roadmap bullets. |
| 111 | + |
| 112 | +Kept implicitly: |
| 113 | +- All architectural invariants and protocol seams enforced by CI (lint rules, grep checks, exception-construction contracts). These are code-level and survive any workflow change. |
| 114 | +- `deferred-work.md` for review-surfaced items that are real but not actionable now. |
| 115 | +- `CHANGELOG.md` per release. |
| 116 | + |
| 117 | +Choice between executing-plans vs. subagent-driven-development: `executing-plans` with checkpoints for multi-day or multi-PR work; `subagent-driven-development` for smaller work that fits in one session and has independent sub-tasks. |
| 118 | + |
| 119 | +## First-task plan |
| 120 | + |
| 121 | +### Cutover PR (transition, executed first) |
| 122 | + |
| 123 | +1. Write `docs/engineering.md` distilled from PRD, architecture, the five merged stories. |
| 124 | +2. Create `docs/archive/`; move `prd.md`, `architecture.md`, `epics.md`, both product briefs, and `stories/` into it. |
| 125 | +3. Write `docs/archive/README.md`. |
| 126 | +4. `docs/superpowers/specs/` already contains this spec; the cutover commit adds the corresponding plan to `docs/superpowers/plans/`. |
| 127 | +5. Update `CLAUDE.md` per the rules above. |
| 128 | +6. Delete `.review-tmp/`. |
| 129 | +7. Single commit, single PR, merge to `main`. This is the cutover point. |
| 130 | + |
| 131 | +### Task 1 — retrospective code review of shipped work |
| 132 | + |
| 133 | +- Invoke `superpowers:requesting-code-review` against `main` with everything merged through story 1-5 as the review target. |
| 134 | +- Scope: stories 1-1 through 1-5 (scaffold, core data types, exception hierarchy, transport + httpx2 adapter, decoder protocol + pydantic adapter). |
| 135 | +- Triage findings into three buckets: |
| 136 | + - **Refactor now** — feeds Task 2. |
| 137 | + - **Defer** — added to `docs/deferred-work.md`. |
| 138 | + - **Discard** — noise / disagree, with one-line rationale. |
| 139 | +- Output: triaged review report committed at `docs/superpowers/specs/YYYY-MM-DD-shipped-work-review.md`. |
| 140 | + |
| 141 | +### Task 2 — refactor based on review |
| 142 | + |
| 143 | +- Brainstorm scope from the "Refactor now" bucket → spec → plan → execute → review → merge. |
| 144 | +- One refactor PR per logically-cohesive group of findings. Avoid one-giant-PR. |
| 145 | +- Brainstorming for Task 2 is short: the discovery happened in Task 1, so the brainstorm is mostly grouping findings and ordering them. |
| 146 | + |
| 147 | +### Out of scope for this design's first execution |
| 148 | + |
| 149 | +- Story 1-6 (msgspec decoder). It's the next normal-flow item after Tasks 1–2 settle. |
| 150 | +- Migrating any merged code to a new pattern uncovered during review. That belongs inside Task 2, not bundled into the cutover. |
| 151 | + |
| 152 | +## Risks and mitigations |
| 153 | + |
| 154 | +| Risk | Mitigation | |
| 155 | +| --- | --- | |
| 156 | +| `engineering.md` and `CLAUDE.md` drift apart. | Boundary rule: `CLAUDE.md` = AI invariants and commands; `engineering.md` = design rationale, seams, roadmap. If a rule belongs in both, it lives in `CLAUDE.md` and is referenced from `engineering.md`, not copied. | |
| 157 | +| Retrospective review surfaces too many findings to triage usefully. | The three-bucket triage is the relief valve: "Defer" is a real outcome, not a failure. `deferred-work.md` already absorbs review fallout; the new flow extends that pattern. | |
| 158 | +| Loss of the FR/NFR numbering convenience when future specs need to cite a constraint. | The archive preserves the numbered lists; specs can cite `archive/prd.md#NFR-12`. | |
| 159 | +| Distilled doc misses a load-bearing decision. | Archive is preserved; if a missing decision surfaces, it's added to `engineering.md` rather than restored. The archive remains the fallback. | |
| 160 | + |
| 161 | +## Definition of done |
| 162 | + |
| 163 | +- `docs/engineering.md` exists and replaces the per-document references in CLAUDE.md. |
| 164 | +- `docs/archive/` contains the listed files with a framing README. |
| 165 | +- `docs/superpowers/specs/` and `docs/superpowers/plans/` exist; this spec is committed there. |
| 166 | +- `.review-tmp/` is removed. |
| 167 | +- `CLAUDE.md` no longer references bmad artifacts as authoritative. |
| 168 | +- The cutover lands as a single PR, merged before Task 1 begins. |
0 commit comments