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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/agents/squad.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: Squad
description: "Your AI team. Describe what you're building, get a team of specialists that live in your repo."
---

<!-- version: 0.0.0-source -->
<!-- version: 0.9.1-build.3 -->

You are **Squad (Coordinator)** — the orchestrator for this project's AI team.

### Coordinator Identity

- **Name:** Squad (Coordinator)
- **Version:** 0.0.0-source (see HTML comment above — this value is stamped during install/upgrade). Include it as `Squad v{version}` in your first response of each session (e.g., in the acknowledgment or greeting).
- **Version:** 0.9.1-build.3 (see HTML comment above — this value is stamped during install/upgrade). Include it as `Squad v0.9.1-build.3` in your first response of each session (e.g., in the acknowledgment or greeting).
- **Role:** Agent orchestration, handoff enforcement, reviewer gating
- **Inputs:** User request, repository state, `.squad/decisions.md`
- **Outputs owned:** Final assembled artifacts, orchestration log (via Scribe)
Expand Down
29 changes: 29 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

You are working on a project that uses **Squad**, an AI team framework. When picking up issues autonomously, follow these guidelines.

## Git Safety — Mandatory Rules

**These rules are non-negotiable. Violating them risks deleting production source code.**

### Staging
- ❌ **NEVER** use `git add .` or `git add -A` — these stage unintended deletions from incomplete working trees
- ❌ **NEVER** use `git commit -a` — same risk
- ✅ **ALWAYS** stage specific files: `git add path/to/file1.ts path/to/file2.ts`
- ✅ **ALWAYS** review before committing: run `git diff --cached --stat` and verify the file count matches your intent

### Pushing
- ❌ **NEVER** push directly to `dev` or `main` — always open a PR
- ❌ **NEVER** force push (`git push --force` or `--force-with-lease`) to shared branches
- ✅ **ALWAYS** work on a feature branch: `git checkout -b squad/{issue-number}-{slug}`
- ✅ **ALWAYS** open a PR: `gh pr create --base dev --draft`

### Pre-Push Checklist
Before pushing any commit, verify:
1. `git diff --cached --stat` — file count matches intent (expect ≤10 files for most fixes)
2. `git diff --cached --diff-filter=D --name-only` — NO unintended deletions
3. `npm run build` — build succeeds with your changes
4. Commit message references the issue: `Closes #N`

### Red Flags — STOP and Ask
If you see any of these, STOP immediately and comment on the issue asking for guidance:
- More than 20 files in your diff
- ANY file deletions you didn't explicitly intend
- Changes outside the scope of your assigned issue

## Team Context

Before starting work on any issue:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/squad-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,43 @@ jobs:
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps

- name: "🔒 Source tree canary check"
run: |
echo "Verifying critical source files exist..."
MISSING=0
for f in \
"packages/squad-sdk/src/index.ts" \
"packages/squad-cli/src/cli/index.ts" \
"packages/squad-sdk/package.json" \
"packages/squad-cli/package.json"; do
if [ ! -f "$f" ]; then
echo "::error::MISSING critical file: $f"
MISSING=$((MISSING + 1))
fi
done
if [ $MISSING -gt 0 ]; then
echo "::error::$MISSING critical source files missing — possible accidental deletion"
exit 1
fi
echo "✅ All critical source files present"

- name: "🔒 Large deletion guard"
if: github.event_name == 'pull_request'
run: |
DELETED=$(git diff --diff-filter=D --name-only origin/${{ github.base_ref }}...HEAD | wc -l)
echo "Files deleted in this PR: $DELETED"
if [ "$DELETED" -gt 50 ]; then
echo "::error::This PR deletes $DELETED files (threshold: 50). If intentional, add the 'large-deletion-approved' label."
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name' 2>/dev/null || echo "")
if echo "$LABELS" | grep -q "large-deletion-approved"; then
echo "✅ Large deletion approved via label"
else
exit 1
fi
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Build
run: npm run build

Expand Down
8 changes: 8 additions & 0 deletions .squad/commit-msg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
docs(squad): log mega triage session

- Crash recovery: merged 10 PRs, closed 3 duplicates
- Repo hygiene: removed test artifacts, consolidated .gitignore, cleaned garbage files, pruned 21 local + 31 remote branches
- Issue triage: 12+ issues routed and closed
- PR management: merged #628 (model config), reviewed #629, routed Tamir PRs to dev branch pending proposals

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 changes: 4 additions & 0 deletions .squad/decisions/inbox/booster-ci-deletion-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### 2026-03-26: CI deletion guard and source tree canary
**By:** Booster (CI/CD)
**What:** Added two safety checks to squad-ci.yml: (1) source tree canary verifying critical files exist, (2) large deletion guard failing PRs that delete >50 files without 'large-deletion-approved' label. Branch protection on dev requested (may need manual setup).
**Why:** Incident #631 — @copilot deleted 361 files on dev with no CI gate catching it.
4 changes: 4 additions & 0 deletions .squad/decisions/inbox/retro-copilot-git-safety.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### 2026-03-26: Copilot git safety rules
**By:** RETRO (Security)
**What:** Added mandatory Git Safety section to copilot-instructions.md: prohibits `git add .`, requires feature branches and PRs, adds pre-push checklist, defines red-flag stop conditions.
**Why:** Incident #631 — @copilot used destructive staging on an incomplete working tree, deleting 361 files.
37 changes: 37 additions & 0 deletions .squad/log/2026-03-26T17-09-631-investigation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Session Log: P0 Incident #631 Investigation
**Date:** 2026-03-26T17:09
**Issue:** #631 — @copilot deleted 361 files on dev
**Team:** Flight, Booster, RETRO, FIDO

## Summary

Team fanned out to investigate P0 incident #631 — @copilot deleted 361 files on dev. All 4 agents confirmed the issue claims. Key findings: zero branch protection on dev/main, no CI gates, copilot-instructions.md doesn't enforce PR workflow. Dev is still broken.

## What Happened

During a single session, @copilot performed a `git add .` operation that inadvertently staged and committed 361 file deletions along with 6 modifications. The intended change was 1 line in `test/docs-links.test.ts`, but without proper working tree verification or branch protection, the operation cascaded into a destructive commit on the dev branch.

## Agents & Scope

| Agent | Scope | Status |
|-------|-------|--------|
| Flight | Strategic analysis & root cause | ✅ Complete |
| Booster | CI/CD pipeline gaps | ✅ Complete |
| RETRO | Security & permissions | ✅ Complete |
| FIDO | Git forensics & file categories | ✅ Complete |

## Key Findings

1. **Zero Branch Protection:** Both dev and main branches have no branch protection rules (404 error)
2. **No CI Gates:** All 15 workflows are post-push observers; none gate merges
3. **Workflow Not Enforced:** copilot-instructions.md assumes PR workflow but doesn't enforce it
4. **@copilot Permissions:** Has unrestricted write access to all branches
5. **Scope of Deletion:** 361 files deleted across multiple directories, confirmed by FIDO

## Outcomes

- ✅ All claims in issue #631 verified
- ✅ Root cause identified (incomplete working tree + git add .)
- ✅ 13 prevention recommendations prioritized
- ⚠️ Dev branch still broken — revert needed
- ✅ Gap analysis complete — infrastructure improvements identified
39 changes: 39 additions & 0 deletions .squad/orchestration-log/2026-03-26T17-09-investigation-631.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Orchestration Log: P0 Incident #631 Investigation
**Timestamp:** 2026-03-26T17:09
**Issue:** #631 — @copilot deleted 361 files on dev branch
**Status:** Investigation Complete

## Spawn Manifest

### Flight (explore, background, claude-haiku-4.5)
**Mission:** Strategic incident analysis
**Output:** Analyzed commit 1ab2f5c, verified all claims in the issue, traced root cause to incomplete working tree + git add . + zero branch protection on dev. Prioritized 13 prevention recommendations.

### Booster (explore, background, claude-haiku-4.5)
**Mission:** CI/CD gap analysis
**Output:** Found 15 workflows, NONE gate merges on dev, all are post-push observers. No deletion guards, no pre-commit hooks, no canary checks exist.

### RETRO (explore, background, claude-haiku-4.5)
**Mission:** Security & permissions audit
**Output:** Confirmed both dev and main have ZERO branch protection (404). @copilot has unrestricted write access. copilot-instructions.md assumes PRs but doesn't enforce them. Identified 3 simultaneous failures that enabled the incident.

### FIDO (explore, background, claude-haiku-4.5)
**Mission:** Git forensics
**Output:** Verified 361 files deleted, 6 modified. The intended fix was 1 line in test/docs-links.test.ts. Categorized all deletions by directory. Confirmed dev is still broken (no revert yet). Parent 28ea025 is intact.

## Findings Summary

- **Root Cause:** Incomplete working tree state combined with `git add .` without proper verification
- **Enablers:**
1. Zero branch protection on dev/main
2. No CI gates preventing merges
3. copilot-instructions.md doesn't enforce PR workflow
- **Current State:** dev branch still broken (361 files deleted)
- **Prevention Recommendations:** 13 prioritized actions identified

## Next Steps

- Revert commits on dev
- Implement branch protection rules
- Add pre-commit hooks and CI gates
- Enforce mandatory PR workflow
Loading
Loading