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
6 changes: 6 additions & 0 deletions .changeset/cross-squad-orchestration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bradygaster/squad-sdk": minor
"@bradygaster/squad-cli": minor
---

Cross-squad orchestration — discovery, delegation, and manifest (#316). Adds manifest schema, `squad discover` / `squad delegate` commands, and runtime module for coordinating work across multiple Squad instances.
12 changes: 12 additions & 0 deletions .squad/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "squad",
"version": "1.0.0",
"description": "Squad — Programmable multi-agent runtime for GitHub Copilot",
"capabilities": ["multi-agent", "copilot", "sdk", "cli"],
"contact": {
"repo": "bradygaster/squad",
"labels": ["squad"]
},
"accepts": ["issues", "prs"],
"skills": ["squad-conventions", "cli-wiring", "agent-collaboration"]
}
61 changes: 61 additions & 0 deletions .squad/manifest.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Squad Manifest",
"description": "Public contract a squad exposes for cross-squad discovery and delegation.",
"type": "object",
"required": ["name", "capabilities", "contact", "accepts"],
"properties": {
"name": {
"type": "string",
"description": "Human-readable squad name (e.g., 'platform-squad').",
"minLength": 1
},
"version": {
"type": "string",
"description": "Schema version for forward compatibility.",
"default": "1.0.0"
},
"description": {
"type": "string",
"description": "One-line description of this squad's purpose."
},
"capabilities": {
"type": "array",
"description": "Capability tags (e.g., ['kubernetes', 'helm', 'monitoring']).",
"items": { "type": "string" },
"minItems": 1
},
"contact": {
"type": "object",
"description": "How to reach this squad.",
"required": ["repo"],
"properties": {
"repo": {
"type": "string",
"description": "GitHub repository in 'owner/repo' format.",
"pattern": "^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$"
},
"labels": {
"type": "array",
"description": "Labels to apply when creating issues for this squad.",
"items": { "type": "string" }
}
}
},
"accepts": {
"type": "array",
"description": "Work types this squad accepts from other squads.",
"items": {
"type": "string",
"enum": ["issues", "prs"]
},
"minItems": 1
},
"skills": {
"type": "array",
"description": "Named skills this squad offers.",
"items": { "type": "string" }
}
},
"additionalProperties": false
}
114 changes: 114 additions & 0 deletions .squad/skills/cross-squad/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
name: "cross-squad"
description: "Coordinating work across multiple Squad instances"
domain: "orchestration"
confidence: "medium"
source: "manual"
tools:
- name: "squad-discover"
description: "List known squads and their capabilities"
when: "When you need to find which squad can handle a task"
- name: "squad-delegate"
description: "Create work in another squad's repository"
when: "When a task belongs to another squad's domain"
---

## Context
When an organization runs multiple Squad instances (e.g., platform-squad, frontend-squad, data-squad), those squads need to discover each other, share context, and hand off work across repository boundaries. This skill teaches agents how to coordinate across squads without creating tight coupling.

Cross-squad orchestration applies when:
- A task requires capabilities owned by another squad
- An architectural decision affects multiple squads
- A feature spans multiple repositories with different squads
- A squad needs to request infrastructure, tooling, or support from another squad

## Patterns

### Discovery via Manifest
Each squad publishes a `.squad/manifest.json` declaring its name, capabilities, and contact information. Squads discover each other through:
1. **Well-known paths**: Check `.squad/manifest.json` in known org repos
2. **Upstream config**: Squads already listed in `.squad/upstream.json` are checked for manifests
3. **Explicit registry**: A central `squad-registry.json` can list all squads in an org

```json
{
"name": "platform-squad",
"version": "1.0.0",
"description": "Platform infrastructure team",
"capabilities": ["kubernetes", "helm", "monitoring", "ci-cd"],
"contact": {
"repo": "org/platform",
"labels": ["squad:platform"]
},
"accepts": ["issues", "prs"],
"skills": ["helm-developer", "operator-developer", "pipeline-engineer"]
}
```

### Context Sharing
When delegating work, share only what the target squad needs:
- **Capability list**: What this squad can do (from manifest)
- **Relevant decisions**: Only decisions that affect the target squad
- **Handoff context**: A concise description of why this work is being delegated

Do NOT share:
- Internal team state (casting history, session logs)
- Full decision archives (send only relevant excerpts)
- Authentication credentials or secrets

### Work Handoff Protocol
1. **Check manifest**: Verify the target squad accepts the work type (issues, PRs)
2. **Create issue**: Use `gh issue create` in the target repo with:
- Title: `[cross-squad] <description>`
- Label: `squad:cross-squad` (or the squad's configured label)
- Body: Context, acceptance criteria, and link back to originating issue
3. **Track**: Record the cross-squad issue URL in the originating squad's orchestration log
4. **Poll**: Periodically check if the delegated issue is closed/completed

### Feedback Loop
Track delegated work completion:
- Poll target issue status via `gh issue view`
- Update originating issue with status changes
- Close the feedback loop when delegated work merges

## Examples

### Discovering squads
```bash
# List all squads discoverable from upstreams and known repos
squad discover

# Output:
# platform-squad → org/platform (kubernetes, helm, monitoring)
# frontend-squad → org/frontend (react, nextjs, storybook)
# data-squad → org/data (spark, airflow, dbt)
```

### Delegating work
```bash
# Delegate a task to the platform squad
squad delegate platform-squad "Add Prometheus metrics endpoint for the auth service"

# Creates issue in org/platform with cross-squad label and context
```

### Manifest in squad.config.ts
```typescript
export default defineSquad({
manifest: {
name: 'platform-squad',
capabilities: ['kubernetes', 'helm'],
contact: { repo: 'org/platform', labels: ['squad:platform'] },
accepts: ['issues', 'prs'],
skills: ['helm-developer', 'operator-developer'],
},
});
```

## Anti-Patterns
- **Direct file writes across repos** — Never modify another squad's `.squad/` directory. Use issues and PRs as the communication protocol.
- **Tight coupling** — Don't depend on another squad's internal structure. Use the manifest as the public API contract.
- **Unbounded delegation** — Always include acceptance criteria and a timeout. Don't create open-ended requests.
- **Skipping discovery** — Don't hardcode squad locations. Use manifests and the discovery protocol.
- **Sharing secrets** — Never include credentials, tokens, or internal URLs in cross-squad issues.
- **Circular delegation** — Track delegation chains. If squad A delegates to B which delegates back to A, something is wrong.
Loading
Loading