Skip to content

Add stacked PR strategy and Epic-level workflow guidance#5

Merged
don-petry merged 10 commits intomainfrom
chore/enhance-agents-workflow-guidance
Mar 29, 2026
Merged

Add stacked PR strategy and Epic-level workflow guidance#5
don-petry merged 10 commits intomainfrom
chore/enhance-agents-workflow-guidance

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented Mar 29, 2026

Summary

  • Stacked PRs for Epic/Feature Development: Adds a comprehensive strategy for using stacked PRs at the Epic/Feature level, where dependent Epics/Features form a linear chain (main ← Epic-1-PR ← Epic-2-PR ← ...) that merges bottom-up
  • Parallel agents within Epics/Features: Within each Epic/Feature, multiple agents work stories concurrently in worktrees branching from the Epic/Feature branch — the stack doesn't constrain per-story/per-sprint parallelism
  • Sprint overlap support: Independent Sprints within an Epic/Feature can run concurrently; dependent Sprints serialize naturally by merging into the Epic/Feature branch before the next Sprint branches from it
  • Epic/Feature interchangeable: All guidance uses "Epic/Feature" to support both BMAD Epics and standalone Features as the unit of stacked work
  • Updated Rule Add workflow, environment, and orchestration guidance #4 & Add stacked PR strategy and Epic-level workflow guidance #5: Carves out exceptions to "branch from default branch" and "one PR per workspace" for declared Epic/Feature stacks and internal story PRs
  • Sync with main: Added guidance for keeping Epic/Feature branches in sync when main advances during development
  • Branch protection: Clarified enforce_admins impact on CI requirements

Also includes prior commits: workflow/environment guidance, multi-repo orchestration rules, and review comment fixes.

Test plan

  • Verify stacked PR rules are internally consistent with multi-agent isolation rules
  • Confirm workflow examples (branch creation, merge, retarget, rebase) are correct
  • Check Sprint/Story organization diagram accurately represents the parallelism model
  • Verify all internal anchor links resolve correctly
  • Confirm "Epic/Feature" terminology is applied consistently throughout

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added Project Context guidance (brownfield assumptions).
    • Expanded Git workflow for branch creation/switching, checkpointing, and clean workspaces.
    • Added development-environment preflight checks and immediate blocker reporting.
    • Documented CI branch-protection and SonarCloud enforcement.
    • Relaxed branching rules to support stacked Epic/Feature workflows and optional short-lived internal integration PRs.
    • Added multi-repo orchestration rules (separate clones/worktrees, no cross-repo state sharing, status reporting).
    • Added stacked PRs workflow (linear chaining, max depth 4) plus naming and cleanup conventions.
    • Require per-repo local dev commands and required environment variable docs.

DJ and others added 4 commits March 28, 2026 18:04
…ghts

Adds four new sections based on recurring friction patterns observed across
80+ agent sessions: Project Context (assume brownfield), Git Workflow (branch
creation and switching guardrails), Development Environment (dependency checks
before launch), and Branch Protection & SonarCloud (merge retry limits). Also
adds Multi-Repo Orchestration rules to the existing multi-agent section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Clarified primary languages used in the project.
- Use "default branch" terminology consistent with multi-agent section
- Add clean working tree check before branch creation
- Clarify branch switching risk (Git prevents most data loss)
- Gate admin override behind explicit user approval and verification
- Fix worktree/clone wording in multi-repo orchestration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduces a comprehensive stacked PR workflow where dependent Epics
form a linear chain (main ← Epic-1 ← Epic-2 ← ...) with bottom-up
merging. Within each Epic, multiple agents work stories in parallel
via worktrees branching from the Epic integration branch. Sprints
within an Epic can also overlap when independent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 29, 2026 19:36
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

AGENTS.md is significantly expanded and restructured to add Project Context, Git Workflow, Development Environment preflight, CI/Branch Protection & SonarCloud guidance, Multi-Repo Orchestration, relaxed stacked Epic/Feature branching rules, a detailed Stacked PRs workflow, and a required per-repo docs template.

Changes

Cohort / File(s) Summary
Primary document
AGENTS.md
Major additions and restructuring: new sections for Project Context, Git Workflow, Development Environment preflight, CI/Branch Protection & SonarCloud guidance, Multi-Repo Orchestration, Stacked PRs workflow, and repository docs template requirement.
Branching & worktree rules
AGENTS.md
Adds explicit branch creation/switching steps, clean-state requirements, enforces "branch from default" with documented exceptions for stacked Epic/Feature workflows, allows short-lived internal integration PRs, and specifies naming/cleanup and bottom-up retarget/rebase/merge sequencing.
CI / protection / reporting
AGENTS.md
Documents branch-protection settings including enforce_admins behavior, SonarCloud/CI required status checks (admins cannot bypass), handling of repeated failing merges, and PR/CI status reporting requirements.
Multi-repo orchestration
AGENTS.md
Requires separate clones/worktrees per repository, prohibits cross-repo file/state sharing, mandates per-repo status reporting (PR URL/CI status/blockers), and defines expectations for cross-repo Epic integration branches.
Repository docs template requirement
AGENTS.md
Mandates each repo include Local Development Commands and Required Environment Variables sections in its AGENTS.md or README.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly matches the main objective: introducing a stacked PR strategy for Epic-level development and related workflow guidance, which aligns with the primary changes documented in AGENTS.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/enhance-agents-workflow-guidance

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the organization-wide AGENTS.md standards to add Epic-level stacked PR workflow guidance and expand existing multi-agent/worktree operational rules to cover branching, environment preflights, and CI/branch-protection expectations.

Changes:

  • Added new sections for Project Context, Git workflow guardrails, and Development Environment preflight checks.
  • Expanded CI/branch-protection guidance (SonarCloud, required check name mismatches, admin merge constraints).
  • Introduced a comprehensive “Stacked PRs for Epic Development” workflow and updated multi-agent branching rule(s) to reference it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
AGENTS.md (1)

609-615: ⚠️ Potential issue | 🟠 Major

Add an explicit required template for dev/test/run commands and env vars.

This section only tells repos to document commands/env vars, but does not provide a concrete required structure in this standards file. Please add a mandatory template/checklist block so repo-level docs remain consistent and auditable.

Proposed doc patch
 ## Agent Operation Guidance
@@
 - Prefer small, focused commands — run specific tests rather than the full suite when iterating (the full suite is still required before committing; see Pre-Commit Quality Checks).
-- Document project-specific dev/test/run commands and required environment variables in the repo's own AGENTS.md or README.
+- Document project-specific dev/test/run commands and required environment variables in the repo's own AGENTS.md or README.
+- Every repository-level AGENTS.md/README MUST include a section similar to:
+
+  ```markdown
+  ## Local Development Commands
+  - Install: `<install command>`
+  - Dev run: `<dev command>`
+  - Test: `<test command>`
+  - Lint: `<lint command>`
+  - Typecheck (if applicable): `<typecheck command>`
+
+  ## Required Environment Variables
+  - `VAR_NAME`: purpose, allowed values, example
+  - `ANOTHER_VAR`: purpose, allowed values, example
+  ```

As per coding guidelines: "Document project-specific dev/test/run commands and required environment variables in the repo's AGENTS.md or README".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 609 - 615, Add a mandatory template/checklist block
under "Agent Operation Guidance" in AGENTS.md that enforces a consistent
repo-level section titled "Local Development Commands" and a "Required
Environment Variables" subsection; include required fields for Install, Dev run,
Test, Lint, and Typecheck commands and for each env var list the variable name,
purpose, allowed values, and an example so repo authors must fill them out (use
the proposed headings "Local Development Commands" and "Required Environment
Variables" as the canonical section titles to locate and standardize the
content).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Around line 380-383: The markdown fences in the workflow examples (the block
containing "main ← Epic-1-PR ← Epic-2-PR ← Epic-3-PR ← Epic-4-PR", the bash
examples used inside ordered steps like the gh/git snippets, and the blocks
showing tree and path like "Epic 1 branch (integration) …" and
".worktrees/<epic-id>-<story-id>-<description>") need markdownlint fixes: add a
language identifier (use "text" for ASCII diagrams and "bash" for shell
snippets) on each opening fence and ensure there is a blank line before and
after fenced blocks that are inside ordered list items (e.g., the gh pr edit and
git rebase snippets) so MD040 and MD031 are satisfied; update every occurrence
referenced (the diagram block, the bash command blocks, and the tree/path
blocks) to use the appropriate ```text or ```bash and include the required
surrounding blank lines.

---

Outside diff comments:
In `@AGENTS.md`:
- Around line 609-615: Add a mandatory template/checklist block under "Agent
Operation Guidance" in AGENTS.md that enforces a consistent repo-level section
titled "Local Development Commands" and a "Required Environment Variables"
subsection; include required fields for Install, Dev run, Test, Lint, and
Typecheck commands and for each env var list the variable name, purpose, allowed
values, and an example so repo authors must fill them out (use the proposed
headings "Local Development Commands" and "Required Environment Variables" as
the canonical section titles to locate and standardize the content).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e25ad4ff-ca67-4ada-bcdc-ef1b8eb8d3d9

📥 Commits

Reviewing files that changed from the base of the PR and between 20b6d44 and 46357b1.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md Outdated
- Broaden Rule #4 exception to include story worktrees branching from
  Epic integration branches, not just child Epic branches
- Add git fetch before merging story branches into Epic branch
- Fix rebase snippet to run from within the story worktree instead of
  using git checkout (which fails when branch is in another worktree)
- Add language identifiers (text/bash) to all unfenced code blocks
- Add blank lines around fenced blocks inside ordered lists (MD031)
- Add mandatory repo-level template for dev commands and env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DJ and others added 2 commits March 29, 2026 12:55
- Clarify Rule #5 re: story PRs targeting Epic branch are internal,
  not standalone feature PRs
- Consolidate Step 3 merge commands into "Story and Sprint Organization"
  section to eliminate duplication
- Replace vague "enough foundation" with explicit dependency criterion
- Add "Keeping Epic Branches in Sync with Main" guidance
- Standardize terminology on "Epic branch" (define "integration branch"
  once on first use)
- Add story worktree cleanup guidance (remove after merging into Epic)
- Add scoping note linking Epic naming convention to general convention
- Remove redundant "When to use" callout (already covered in intro)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Clarified rules for branching and pull requests in multi-agent environments.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Around line 242-245: Update the "Branch Protection & SonarCloud" section to
expand the explanation of enforce_admins: add a concise sentence after the
existing text (under the "Branch Protection & SonarCloud" heading) stating that
with enforce_admins enabled repository administrators cannot bypass required CI
checks or merge without satisfying branch protection rules (e.g., required
SonarCloud checks and approvals), and briefly note any consequences for agent
workflows such as needing PRs to pass checks before merge.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0e36e9d2-2542-431e-8a06-d219f18e3656

📥 Commits

Reviewing files that changed from the base of the PR and between d586b29 and cd39f53.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md
DJ and others added 3 commits March 29, 2026 13:32
Updates all generic/conceptual references throughout the stacked PR
section to use "Epic/Feature" — section headings, rules, workflow
steps, checklists, tables, and internal anchor links. Concrete
example names (Epic 1, epic-1/foundation) remain unchanged as
illustrative instances.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@don-petry don-petry merged commit 4ac0be1 into main Mar 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants