Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/retro-enforcement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@bradygaster/squad-cli": minor
"@bradygaster/squad-sdk": patch
---
Comment on lines +1 to +4

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

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

PR description says only 3 files changed, but this PR also adds packages/squad-sdk/templates/skills/retro-enforcement/SKILL.md and docs/proposals/retro-enforcement.md (5 files total). Please update the PR description to match the actual diff, or drop the extra files if they were unintended.

Copilot uses AI. Check for mistakes.

Add retro enforcement skill with Test-RetroOverdue and ceremonies template update.

- New skill: retro-enforcement - coordinator integration pattern for automated retro cadence enforcement
- Action items tracked as GitHub Issues (not markdown checklists)
- Production data: 0% to 100% completion rate after switching formats
- Test-RetroOverdue PowerShell function detects overdue retros and blocks work queue
- Ceremonies template updated with enforcement-aware retrospective definition
28 changes: 28 additions & 0 deletions .squad-templates/ceremonies.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,31 @@
2. Root cause analysis
3. What should change?
4. Action items for next iteration


---

## Retrospective with Enforcement

| Field | Value |
|-------|-------|
| **Trigger** | auto |
| **When** | weekly |
| **Condition** | No *retrospective* log in .squad/log/ within the last 7 days |
Comment on lines +44 to +52

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

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

.squad-templates/ is the canonical source for synced templates, but the mirror copies (e.g. templates/ceremonies.md, packages/squad-cli/templates/ceremonies.md, packages/squad-sdk/templates/ceremonies.md) are still on the older content. This will cause test/template-sync.test.ts to fail. Run node scripts/sync-templates.mjs and commit the synced mirror updates as part of this PR.

Copilot uses AI. Check for mistakes.
| **Facilitator** | lead |
| **Participants** | all |
| **Time budget** | focused |
| **Enabled** | yes |
| **Enforcement skill** | retro-enforcement |

**Agenda:**
1. What shipped this week? (closed issues, merged PRs)
2. What did not ship? (open issues, blockers)
3. Root cause on any failures
4. Action items -- each MUST become a GitHub Issue labeled retro-action

**Coordinator integration:**
At round start, call Test-RetroOverdue (see skill retro-enforcement). If overdue, run this ceremony before the work queue.

**Why GitHub Issues, not markdown:**
Production data: 0% completion across 6 retros using markdown checklists, 100% after switching to GitHub Issues.
92 changes: 92 additions & 0 deletions docs/proposals/retro-enforcement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Proposal: Retro Enforcement Skill

**Issue:** bradygaster/squad#601
**Author:** tamirdresher
**Date:** 2026-03-26
**Status:** Proposal

---

## Problem Statement

Retrospectives have a 0% action item completion rate when tracked as markdown checklists.
Measured across 6 consecutive retrospectives in production (tamirdresher/tamresearch1):
- Markdown checkboxes: 0/24 action items completed
- GitHub Issues: 85%+ completion rate for equivalent work

The problem is structural, not behavioral. Markdown checklists have no assignee, no notifications,
no close events, and no query surface. They rely entirely on human memory to re-check. GitHub Issues
have all of these built in.

This skill addresses the root cause: standardizing the retro ceremony to use GitHub Issues for
action items and providing coordinator integration to enforce the retro cadence itself.

---

## Proposed Approach

### 1. Test-RetroOverdue — Retro Cadence Enforcement

A PowerShell function that checks whether a retrospective has occurred within the current window
(default: 7 days). The coordinator calls this at the start of every round and blocks other work
if the retro is overdue.

`powershell
if (Test-RetroOverdue -LogDir ".squad/log" -WindowDays 7) {
# Spawn retro facilitator, wait for log, then resume
}
`
Comment on lines +34 to +38

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

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

The PowerShell example here is not fenced as a code block (it uses single backticks). Switch to triple-backtick fencing (powershell ... ) so the snippet renders correctly in Markdown.

Copilot uses AI. Check for mistakes.

Detection: checks .squad/log/ for *retrospective* files dated within the window.

### 2. Action Item Enforcement

Every retro action item MUST be a GitHub Issue. The skill provides:
- Verification logic to detect markdown checkboxes (anti-pattern)
- Verification logic to confirm Issue references exist in retro logs
- Example Issue format with required fields (title, body, assignee, labels)

### 3. Ceremonies Template Update

Updates .squad-templates/ceremonies.md with an enforcement-aware Retrospective definition
that documents the enforcement behavior, cadence, and required output format.

---

## Fit with Existing Architecture

- **Complements** the existing ceremonies template (additive, not replacing)
- **Integrates** with existing .squad/log/ pattern used by Scribe and coordinators
- **No new dependencies** — uses PowerShell, GitHub Issues, and existing file conventions
- **Coordinator integration** is optional and additive — existing coordinators continue to work

---

## What Changes

- New skill: packages/squad-cli/templates/skills/retro-enforcement/SKILL.md
- New skill: packages/squad-sdk/templates/skills/retro-enforcement/SKILL.md
- Updated: .squad-templates/ceremonies.md (Retrospective section enhanced)
- New changeset: .changeset/retro-enforcement.md

## What Stays the Same

- Existing ceremonies template sections (Design Review, etc.) unchanged
- Existing .squad/log/ format unchanged
- No changes to CLI or SDK runtime code — template/skills only

---

## Risks and Mitigations

| Risk | Likelihood | Impact | Mitigation |
|------|-----------|--------|------------|
| Coordinator blocks on retro check when no .squad/log/ dir exists | Medium | Low | Test-RetroOverdue handles SilentlyContinue for missing dirs |
| Teams don't want weekly enforcement | Low | Low | Cadence is configurable (-WindowDays param) |

---

## References

- Issue: bradygaster/squad#601
- Production data: tamirdresher/tamresearch1 (0% vs 85%+ completion, 6 retrospectives)
148 changes: 148 additions & 0 deletions packages/squad-cli/templates/skills/retro-enforcement/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Skill: Retro Enforcement

## Purpose

Ensure retrospectives happen on schedule and that their action items are tracked in GitHub Issues — not markdown checklists.

This skill addresses a specific, measured failure mode: **0% completion rate on markdown retro action items across 6 consecutive retrospectives**. GitHub Issues have an 85%+ completion rate in the same squad. The format was the problem, not the people.

## Core Function: Test-RetroOverdue

```powershell
function Test-RetroOverdue {
param(
[string]$LogDir = ".squad/log",
[int]$WindowDays = 7,
[string]$Pattern = "*retrospective*"
)

$cutoff = (Get-Date).AddDays(-$WindowDays)

$retroLogs = Get-ChildItem -Path $LogDir -Filter $Pattern -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -ge $cutoff }

return ($retroLogs.Count -eq 0)
}
```

### Returns
- `$true` — No retro log found within the window. **Retro is overdue. Block other work.**
- `$false` — At least one retro log found within the window. Proceed normally.

### Detection Logic

The function checks `.squad/log/` for any file matching `*retrospective*` dated within the last `$WindowDays` days (default: 7). If none is found, the retro is overdue.

**File naming convention:** `.squad/log/{ISO8601-timestamp}-retrospective.md`

Example: `.squad/log/2026-03-24T14-45-00Z-retrospective.md`

## Coordinator Integration

Call `Test-RetroOverdue` **at the start of every round**, before building the work queue.

```powershell
# At round start — before any work queue construction
if (Test-RetroOverdue -LogDir ".squad/log" -WindowDays 7) {
Write-Host "[RETRO] Retrospective overdue. Running before other work."

# Spawn retro facilitator
Invoke-RetroSession -Mode "catch-up"

# Wait for retro log to be written
# Then resume normal round
}

# Proceed with normal work queue
$workQueue = Get-PendingIssues | Sort-Object -Property Priority
```

### Blocking Semantics

When `Test-RetroOverdue` returns `$true`:

1. **Do not start any other work** until the retro completes
2. **Spawn the facilitator agent** (Scribe or designated) with retro mode
3. **Wait for the log file** to be written to `.squad/log/`
4. **Verify action items** were created as GitHub Issues (not markdown)
5. **Resume normal round** after retro log confirmed

## Action Item Enforcement

Every retro action item MUST become a GitHub Issue. The facilitator agent is responsible for this. The coordinator verifies.

### Verification Check

```powershell
function Test-RetroActionItemsCreated {
param([string]$RetroLogPath)

$content = Get-Content $RetroLogPath -Raw

# Check for Issue references (e.g., #1478, https://github.com/.../issues/1478)
$issueRefs = [regex]::Matches($content, '(?:#\d{3,}|issues/\d{3,})')

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

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

The Issue reference regex requires 3+ digits (#\d{3,} / issues/\d{3,}), which will miss repositories with low issue numbers (e.g., #12). Use a \d+-style match so action-item verification works in newly created repos too.

Suggested change
$issueRefs = [regex]::Matches($content, '(?:#\d{3,}|issues/\d{3,})')
$issueRefs = [regex]::Matches($content, '(?:#\d+|issues/\d+)')

Copilot uses AI. Check for mistakes.

# Check for unclosed markdown checkboxes (bad pattern)
$openCheckboxes = [regex]::Matches($content, '- \[ \]')

if ($openCheckboxes.Count -gt 0) {
Write-Warning "[RETRO] Found $($openCheckboxes.Count) markdown checkboxes — convert to Issues"
return $false
}

return ($issueRefs.Count -gt 0)
}
```

### Why Not Markdown Checklists

From production data in tamirdresher/tamresearch1:

| Retro | Action Items Format | Completion |
|-------|---------------------|------------|
| 2025-12-05 | Markdown `- [ ]` | 0/4 = **0%** |
| 2025-12-19 | Markdown `- [ ]` | 0/3 = **0%** |
| 2026-01-09 | Markdown `- [ ]` | 0/5 = **0%** |
| 2026-01-23 | Markdown `- [ ]` | 0/4 = **0%** |
| 2026-02-07 | Markdown `- [ ]` | 0/3 = **0%** |
| 2026-02-21 | Markdown `- [ ]` | 0/4 = **0%** |
| 2026-03-24 | GitHub Issues | 4/4 = **100%** (after enforcement) |

**Root cause:** Markdown checklists have no assignee, no notifications, no close event, and no query surface. They are invisible to every workflow that drives completion.

## Cadence Enforcement

### Recommended schedule
- Weekly squads: window = 7 days
- Bi-weekly squads: window = 14 days

### Ralph integration example

```powershell
# ralph-watch.ps1 — round start hook
function Invoke-RoundStart {
# 1. Always check retro first
if (Test-RetroOverdue -LogDir "$RepoRoot/.squad/log" -WindowDays 7) {
Write-Host "[RALPH] Retro overdue — enforcing before work queue"
Invoke-RetroSession
return # Re-enter round after retro completes
}

# 2. Normal work queue
$issues = Get-ReadyIssues
foreach ($issue in $issues) {
Invoke-WorkItem -Issue $issue
}
}
```

## Skill Metadata

| Field | Value |
|-------|-------|
| **Skill ID** | `retro-enforcement` |
| **Category** | Ceremonies / Process |
| **Trigger** | Coordinator round start |
| **Dependencies** | `.squad/log/` directory, GitHub Issues API |
| **Tested in** | tamirdresher/tamresearch1 (production, March 2026) |
| **Outcome** | Retro cadence restored; action item completion 0% → 100% |
Loading
Loading