@bradygaster/squad-sdk 0.8.25 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +296 -296
- package/dist/adapter/client.d.ts +17 -0
- package/dist/adapter/client.d.ts.map +1 -1
- package/dist/adapter/client.js +101 -1
- package/dist/adapter/client.js.map +1 -1
- package/dist/agents/history-shadow.d.ts.map +1 -1
- package/dist/agents/history-shadow.js +129 -62
- package/dist/agents/history-shadow.js.map +1 -1
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-selector.d.ts +2 -0
- package/dist/agents/model-selector.d.ts.map +1 -1
- package/dist/agents/model-selector.js +41 -35
- package/dist/agents/model-selector.js.map +1 -1
- package/dist/agents/personal.d.ts +35 -0
- package/dist/agents/personal.d.ts.map +1 -0
- package/dist/agents/personal.js +67 -0
- package/dist/agents/personal.js.map +1 -0
- package/dist/build/github-dist.js +42 -42
- package/dist/builders/index.d.ts +3 -2
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +28 -0
- package/dist/builders/index.js.map +1 -1
- package/dist/builders/types.d.ts +13 -0
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/config/init.d.ts +8 -0
- package/dist/config/init.d.ts.map +1 -1
- package/dist/config/init.js +304 -193
- package/dist/config/init.js.map +1 -1
- package/dist/config/models.d.ts +112 -0
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +329 -18
- package/dist/config/models.js.map +1 -1
- package/dist/coordinator/index.js +2 -2
- package/dist/coordinator/index.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/platform/azure-devops.d.ts +42 -0
- package/dist/platform/azure-devops.d.ts.map +1 -1
- package/dist/platform/azure-devops.js +75 -0
- package/dist/platform/azure-devops.js.map +1 -1
- package/dist/platform/comms-file-log.d.ts.map +1 -1
- package/dist/platform/comms-file-log.js +2 -1
- package/dist/platform/comms-file-log.js.map +1 -1
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +1 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/ralph/capabilities.d.ts +67 -0
- package/dist/ralph/capabilities.d.ts.map +1 -0
- package/dist/ralph/capabilities.js +111 -0
- package/dist/ralph/capabilities.js.map +1 -0
- package/dist/ralph/index.d.ts +2 -0
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +6 -5
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/rate-limiting.d.ts +99 -0
- package/dist/ralph/rate-limiting.d.ts.map +1 -0
- package/dist/ralph/rate-limiting.js +170 -0
- package/dist/ralph/rate-limiting.js.map +1 -0
- package/dist/resolution.d.ts +24 -2
- package/dist/resolution.d.ts.map +1 -1
- package/dist/resolution.js +106 -6
- package/dist/resolution.js.map +1 -1
- package/dist/roles/catalog-categories.d.ts +146 -0
- package/dist/roles/catalog-categories.d.ts.map +1 -0
- package/dist/roles/catalog-categories.js +374 -0
- package/dist/roles/catalog-categories.js.map +1 -0
- package/dist/roles/catalog-engineering.d.ts +212 -0
- package/dist/roles/catalog-engineering.d.ts.map +1 -0
- package/dist/roles/catalog-engineering.js +549 -0
- package/dist/roles/catalog-engineering.js.map +1 -0
- package/dist/roles/catalog.d.ts +24 -0
- package/dist/roles/catalog.d.ts.map +1 -0
- package/dist/roles/catalog.js +28 -0
- package/dist/roles/catalog.js.map +1 -0
- package/dist/roles/index.d.ts +69 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +197 -0
- package/dist/roles/index.js.map +1 -0
- package/dist/roles/types.d.ts +87 -0
- package/dist/roles/types.d.ts.map +1 -0
- package/dist/roles/types.js +14 -0
- package/dist/roles/types.js.map +1 -0
- package/dist/runtime/benchmarks.js +5 -5
- package/dist/runtime/benchmarks.js.map +1 -1
- package/dist/runtime/constants.d.ts +2 -2
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +5 -3
- package/dist/runtime/constants.js.map +1 -1
- package/dist/runtime/cross-squad.d.ts +118 -0
- package/dist/runtime/cross-squad.d.ts.map +1 -0
- package/dist/runtime/cross-squad.js +234 -0
- package/dist/runtime/cross-squad.js.map +1 -0
- package/dist/runtime/otel-init.d.ts +24 -17
- package/dist/runtime/otel-init.d.ts.map +1 -1
- package/dist/runtime/otel-init.js +29 -20
- package/dist/runtime/otel-init.js.map +1 -1
- package/dist/runtime/otel-metrics.d.ts +5 -0
- package/dist/runtime/otel-metrics.d.ts.map +1 -1
- package/dist/runtime/otel-metrics.js +54 -0
- package/dist/runtime/otel-metrics.js.map +1 -1
- package/dist/runtime/rework.d.ts +71 -0
- package/dist/runtime/rework.d.ts.map +1 -0
- package/dist/runtime/rework.js +107 -0
- package/dist/runtime/rework.js.map +1 -0
- package/dist/runtime/scheduler.d.ts +128 -0
- package/dist/runtime/scheduler.d.ts.map +1 -0
- package/dist/runtime/scheduler.js +427 -0
- package/dist/runtime/scheduler.js.map +1 -0
- package/dist/runtime/squad-observer.d.ts.map +1 -1
- package/dist/runtime/squad-observer.js +4 -0
- package/dist/runtime/squad-observer.js.map +1 -1
- package/dist/runtime/streaming.d.ts +2 -0
- package/dist/runtime/streaming.d.ts.map +1 -1
- package/dist/runtime/streaming.js +6 -0
- package/dist/runtime/streaming.js.map +1 -1
- package/dist/runtime/telemetry.d.ts +2 -0
- package/dist/runtime/telemetry.d.ts.map +1 -1
- package/dist/runtime/telemetry.js +6 -0
- package/dist/runtime/telemetry.js.map +1 -1
- package/dist/sharing/consult.d.ts +2 -2
- package/dist/sharing/consult.js +83 -83
- package/dist/sharing/consult.js.map +1 -1
- package/dist/sharing/export.d.ts.map +1 -1
- package/dist/sharing/export.js +17 -4
- package/dist/sharing/export.js.map +1 -1
- package/dist/skills/handler-types.d.ts +271 -0
- package/dist/skills/handler-types.d.ts.map +1 -0
- package/dist/skills/handler-types.js +31 -0
- package/dist/skills/handler-types.js.map +1 -0
- package/dist/skills/index.d.ts +3 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +3 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/skill-script-loader.d.ts +65 -0
- package/dist/skills/skill-script-loader.d.ts.map +1 -0
- package/dist/skills/skill-script-loader.js +227 -0
- package/dist/skills/skill-script-loader.js.map +1 -0
- package/dist/skills/skill-source.d.ts.map +1 -1
- package/dist/skills/skill-source.js +5 -1
- package/dist/skills/skill-source.js.map +1 -1
- package/dist/tools/index.d.ts +10 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +49 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/upstream/resolver.d.ts.map +1 -1
- package/dist/upstream/resolver.js +14 -5
- package/dist/upstream/resolver.js.map +1 -1
- package/package.json +34 -3
- package/templates/casting/Futurama.json +10 -0
- package/templates/casting-history.json +4 -4
- package/templates/casting-policy.json +37 -35
- package/templates/casting-reference.md +104 -0
- package/templates/casting-registry.json +3 -3
- package/templates/ceremonies.md +41 -41
- package/templates/charter.md +53 -53
- package/templates/constraint-tracking.md +38 -38
- package/templates/cooperative-rate-limiting.md +229 -0
- package/templates/copilot-instructions.md +46 -46
- package/templates/history.md +10 -10
- package/templates/identity/now.md +9 -9
- package/templates/identity/wisdom.md +15 -15
- package/templates/issue-lifecycle.md +412 -0
- package/templates/keda-scaler.md +164 -0
- package/templates/machine-capabilities.md +75 -0
- package/templates/mcp-config.md +90 -98
- package/templates/multi-agent-format.md +28 -28
- package/templates/orchestration-log.md +27 -27
- package/templates/package.json +3 -0
- package/templates/plugin-marketplace.md +49 -49
- package/templates/ralph-circuit-breaker.md +313 -0
- package/templates/ralph-triage.js +543 -0
- package/templates/raw-agent-output.md +37 -37
- package/templates/roster.md +60 -60
- package/templates/routing.md +39 -54
- package/templates/run-output.md +50 -50
- package/templates/schedule.json +19 -0
- package/templates/scribe-charter.md +119 -119
- package/templates/skill.md +24 -24
- package/templates/skills/agent-collaboration/SKILL.md +42 -0
- package/templates/skills/agent-conduct/SKILL.md +24 -0
- package/templates/skills/architectural-proposals/SKILL.md +151 -0
- package/templates/skills/ci-validation-gates/SKILL.md +84 -0
- package/templates/skills/cli-wiring/SKILL.md +47 -0
- package/templates/skills/client-compatibility/SKILL.md +89 -0
- package/templates/skills/cross-squad/SKILL.md +114 -0
- package/templates/skills/distributed-mesh/SKILL.md +287 -0
- package/templates/skills/distributed-mesh/mesh.json.example +30 -0
- package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -0
- package/templates/skills/distributed-mesh/sync-mesh.sh +104 -0
- package/templates/skills/docs-standards/SKILL.md +71 -0
- package/templates/skills/economy-mode/SKILL.md +114 -0
- package/templates/skills/external-comms/SKILL.md +329 -0
- package/templates/skills/gh-auth-isolation/SKILL.md +183 -0
- package/templates/skills/git-workflow/SKILL.md +204 -0
- package/templates/skills/github-multi-account/SKILL.md +95 -0
- package/templates/skills/history-hygiene/SKILL.md +36 -0
- package/templates/skills/humanizer/SKILL.md +105 -0
- package/templates/skills/init-mode/SKILL.md +102 -0
- package/templates/skills/model-selection/SKILL.md +117 -0
- package/templates/skills/nap/SKILL.md +24 -0
- package/templates/skills/personal-squad/SKILL.md +57 -0
- package/templates/skills/project-conventions/SKILL.md +56 -56
- package/templates/skills/release-process/SKILL.md +423 -0
- package/templates/skills/reskill/SKILL.md +92 -0
- package/templates/skills/reviewer-protocol/SKILL.md +79 -0
- package/templates/skills/secret-handling/SKILL.md +200 -0
- package/templates/skills/session-recovery/SKILL.md +155 -0
- package/templates/skills/squad-conventions/SKILL.md +69 -0
- package/templates/skills/test-discipline/SKILL.md +37 -0
- package/templates/skills/windows-compatibility/SKILL.md +74 -0
- package/templates/squad.agent.md +1287 -1146
- package/templates/workflows/squad-ci.yml +24 -24
- package/templates/workflows/squad-docs.yml +54 -50
- package/templates/workflows/squad-heartbeat.yml +171 -316
- package/templates/workflows/squad-insider-release.yml +61 -61
- package/templates/workflows/squad-issue-assign.yml +161 -161
- package/templates/workflows/squad-label-enforce.yml +181 -181
- package/templates/workflows/squad-preview.yml +55 -55
- package/templates/workflows/squad-promote.yml +120 -120
- package/templates/workflows/squad-release.yml +77 -77
- package/templates/workflows/squad-triage.yml +260 -260
- package/templates/workflows/sync-squad-labels.yml +169 -169
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Cooperative Rate Limiting for Multi-Agent Deployments
|
|
2
|
+
|
|
3
|
+
> Coordinate API quota across multiple Ralph instances to prevent cascading failures.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
The [circuit breaker template](ralph-circuit-breaker.md) handles single-instance rate limiting well. But when multiple Ralphs run across machines (or pods on K8s), each instance independently hits API limits:
|
|
8
|
+
|
|
9
|
+
- **No coordination** — 5 Ralphs each think they have full API quota
|
|
10
|
+
- **Thundering herd** — All Ralphs retry simultaneously after rate limit resets
|
|
11
|
+
- **Priority inversion** — Low-priority work exhausts quota before critical work runs
|
|
12
|
+
- **Reactive only** — Circuit opens AFTER 429, wasting the failed request
|
|
13
|
+
|
|
14
|
+
## Solution: 6-Pattern Architecture
|
|
15
|
+
|
|
16
|
+
These patterns layer on top of the existing circuit breaker. Each is independent — adopt one or all.
|
|
17
|
+
|
|
18
|
+
### Pattern 1: Traffic Light (RAAS — Rate-Aware Agent Scheduling)
|
|
19
|
+
|
|
20
|
+
Map GitHub API `X-RateLimit-Remaining` to traffic light states:
|
|
21
|
+
|
|
22
|
+
| State | Remaining % | Behavior |
|
|
23
|
+
|-------|------------|----------|
|
|
24
|
+
| 🟢 GREEN | >20% | Normal operation |
|
|
25
|
+
| 🟡 AMBER | 5–20% | Only P0 agents proceed |
|
|
26
|
+
| 🔴 RED | <5% | Block all except emergency P0 |
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
type TrafficLight = 'green' | 'amber' | 'red';
|
|
30
|
+
|
|
31
|
+
function getTrafficLight(remaining: number, limit: number): TrafficLight {
|
|
32
|
+
const pct = remaining / limit;
|
|
33
|
+
if (pct > 0.20) return 'green';
|
|
34
|
+
if (pct > 0.05) return 'amber';
|
|
35
|
+
return 'red';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function shouldProceed(light: TrafficLight, agentPriority: number): boolean {
|
|
39
|
+
if (light === 'green') return true;
|
|
40
|
+
if (light === 'amber') return agentPriority === 0; // P0 only
|
|
41
|
+
return false; // RED — block all
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Pattern 2: Cooperative Token Pool (CMARP)
|
|
46
|
+
|
|
47
|
+
A shared JSON file (`~/.squad/rate-pool.json`) distributes API quota:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"totalLimit": 5000,
|
|
52
|
+
"resetAt": "2026-03-22T20:00:00Z",
|
|
53
|
+
"allocations": {
|
|
54
|
+
"picard": { "priority": 0, "allocated": 2000, "used": 450, "leaseExpiry": "2026-03-22T19:55:00Z" },
|
|
55
|
+
"data": { "priority": 1, "allocated": 1750, "used": 200, "leaseExpiry": "2026-03-22T19:55:00Z" },
|
|
56
|
+
"ralph": { "priority": 2, "allocated": 1250, "used": 100, "leaseExpiry": "2026-03-22T19:55:00Z" }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Rules:**
|
|
62
|
+
- P0 agents (Lead) get 40% of quota
|
|
63
|
+
- P1 agents (specialists) get 35%
|
|
64
|
+
- P2 agents (Ralph, Scribe) get 25%
|
|
65
|
+
- Stale leases (>5 minutes without heartbeat) are auto-recovered
|
|
66
|
+
- Each agent checks their remaining allocation before making API calls
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface RatePoolAllocation {
|
|
70
|
+
priority: number;
|
|
71
|
+
allocated: number;
|
|
72
|
+
used: number;
|
|
73
|
+
leaseExpiry: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface RatePool {
|
|
77
|
+
totalLimit: number;
|
|
78
|
+
resetAt: string;
|
|
79
|
+
allocations: Record<string, RatePoolAllocation>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function canUseQuota(pool: RatePool, agentName: string): boolean {
|
|
83
|
+
const alloc = pool.allocations[agentName];
|
|
84
|
+
if (!alloc) return true; // Unknown agent — allow (graceful)
|
|
85
|
+
|
|
86
|
+
// Reclaim stale leases from crashed agents
|
|
87
|
+
const now = new Date();
|
|
88
|
+
for (const [name, a] of Object.entries(pool.allocations)) {
|
|
89
|
+
if (new Date(a.leaseExpiry) < now && name !== agentName) {
|
|
90
|
+
a.allocated = 0; // Reclaim
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return alloc.used < alloc.allocated;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Pattern 3: Predictive Circuit Breaker (PCB)
|
|
99
|
+
|
|
100
|
+
Opens the circuit BEFORE getting a 429 by predicting when quota will run out:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface RateSample {
|
|
104
|
+
timestamp: number; // Date.now()
|
|
105
|
+
remaining: number; // from X-RateLimit-Remaining header
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
class PredictiveCircuitBreaker {
|
|
109
|
+
private samples: RateSample[] = [];
|
|
110
|
+
private readonly maxSamples = 10;
|
|
111
|
+
private readonly warningThresholdSeconds = 120;
|
|
112
|
+
|
|
113
|
+
addSample(remaining: number): void {
|
|
114
|
+
this.samples.push({ timestamp: Date.now(), remaining });
|
|
115
|
+
if (this.samples.length > this.maxSamples) {
|
|
116
|
+
this.samples.shift();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Predict seconds until quota exhaustion using linear regression */
|
|
121
|
+
predictExhaustion(): number | null {
|
|
122
|
+
if (this.samples.length < 3) return null;
|
|
123
|
+
|
|
124
|
+
const n = this.samples.length;
|
|
125
|
+
const first = this.samples[0];
|
|
126
|
+
const last = this.samples[n - 1];
|
|
127
|
+
|
|
128
|
+
const elapsedMs = last.timestamp - first.timestamp;
|
|
129
|
+
if (elapsedMs === 0) return null;
|
|
130
|
+
|
|
131
|
+
const consumedPerMs = (first.remaining - last.remaining) / elapsedMs;
|
|
132
|
+
if (consumedPerMs <= 0) return null; // Not consuming — safe
|
|
133
|
+
|
|
134
|
+
const msUntilExhausted = last.remaining / consumedPerMs;
|
|
135
|
+
return msUntilExhausted / 1000;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
shouldOpen(): boolean {
|
|
139
|
+
const eta = this.predictExhaustion();
|
|
140
|
+
if (eta === null) return false;
|
|
141
|
+
return eta < this.warningThresholdSeconds;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Pattern 4: Priority Retry Windows (PWJG)
|
|
147
|
+
|
|
148
|
+
Non-overlapping jitter windows prevent thundering herd:
|
|
149
|
+
|
|
150
|
+
| Priority | Retry Window | Description |
|
|
151
|
+
|----------|-------------|-------------|
|
|
152
|
+
| P0 (Lead) | 500ms–5s | Recovers first |
|
|
153
|
+
| P1 (Specialists) | 2s–30s | Moderate delay |
|
|
154
|
+
| P2 (Ralph/Scribe) | 5s–60s | Most patient |
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
function getRetryDelay(priority: number, attempt: number): number {
|
|
158
|
+
const windows: Record<number, [number, number]> = {
|
|
159
|
+
0: [500, 5000], // P0: 500ms–5s
|
|
160
|
+
1: [2000, 30000], // P1: 2s–30s
|
|
161
|
+
2: [5000, 60000], // P2: 5s–60s
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const [min, max] = windows[priority] ?? windows[2];
|
|
165
|
+
const base = Math.min(min * Math.pow(2, attempt), max);
|
|
166
|
+
const jitter = Math.random() * base * 0.5;
|
|
167
|
+
return base + jitter;
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Pattern 5: Resource Epoch Tracker (RET)
|
|
172
|
+
|
|
173
|
+
Heartbeat-based lease system for multi-machine deployments:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface ResourceLease {
|
|
177
|
+
agent: string;
|
|
178
|
+
machine: string;
|
|
179
|
+
leaseStart: string;
|
|
180
|
+
leaseExpiry: string; // Typically 5 minutes from now
|
|
181
|
+
allocated: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Each agent renews its lease every 2 minutes
|
|
185
|
+
// If lease expires (agent crashed), allocation is reclaimed
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Pattern 6: Cascade Dependency Detector (CDD)
|
|
189
|
+
|
|
190
|
+
Track downstream failures and apply backpressure:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Agent A (rate limited) → Agent B (waiting for A) → Agent C (waiting for B)
|
|
194
|
+
↑ Backpressure signal: "don't start new work"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
When a dependency is rate-limited, upstream agents should pause new work rather than queuing requests that will fail.
|
|
198
|
+
|
|
199
|
+
## Kubernetes Integration
|
|
200
|
+
|
|
201
|
+
On K8s, cooperative rate limiting can use KEDA to scale pods based on API quota:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
apiVersion: keda.sh/v1alpha1
|
|
205
|
+
kind: ScaledObject
|
|
206
|
+
spec:
|
|
207
|
+
scaleTargetRef:
|
|
208
|
+
name: ralph-deployment
|
|
209
|
+
triggers:
|
|
210
|
+
- type: external
|
|
211
|
+
metadata:
|
|
212
|
+
scalerAddress: keda-copilot-scaler:6000
|
|
213
|
+
# Scaler returns 0 when rate limited → pods scale to zero
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
See [keda-copilot-scaler](https://github.com/tamirdresher/keda-copilot-scaler) for a complete implementation.
|
|
217
|
+
|
|
218
|
+
## Quick Start
|
|
219
|
+
|
|
220
|
+
1. **Minimum viable:** Adopt Pattern 1 (Traffic Light) — read `X-RateLimit-Remaining` from API responses
|
|
221
|
+
2. **Multi-machine:** Add Pattern 2 (Cooperative Pool) — shared `rate-pool.json`
|
|
222
|
+
3. **Production:** Add Pattern 3 (Predictive CB) — prevent 429s entirely
|
|
223
|
+
4. **Kubernetes:** Add KEDA scaler for automatic pod scaling
|
|
224
|
+
|
|
225
|
+
## References
|
|
226
|
+
|
|
227
|
+
- [Circuit Breaker Template](ralph-circuit-breaker.md) — Foundation patterns
|
|
228
|
+
- [Squad on AKS](https://github.com/tamirdresher/squad-on-aks) — Production K8s deployment
|
|
229
|
+
- [KEDA Copilot Scaler](https://github.com/tamirdresher/keda-copilot-scaler) — Custom KEDA external scaler
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
# Copilot Coding Agent — Squad Instructions
|
|
2
|
-
|
|
3
|
-
You are working on a project that uses **Squad**, an AI team framework. When picking up issues autonomously, follow these guidelines.
|
|
4
|
-
|
|
5
|
-
## Team Context
|
|
6
|
-
|
|
7
|
-
Before starting work on any issue:
|
|
8
|
-
|
|
9
|
-
1. Read `.squad/team.md` for the team roster, member roles, and your capability profile.
|
|
10
|
-
2. Read `.squad/routing.md` for work routing rules.
|
|
11
|
-
3. If the issue has a `squad:{member}` label, read that member's charter at `.squad/agents/{member}/charter.md` to understand their domain expertise and coding style — work in their voice.
|
|
12
|
-
|
|
13
|
-
## Capability Self-Check
|
|
14
|
-
|
|
15
|
-
Before starting work, check your capability profile in `.squad/team.md` under the **Coding Agent → Capabilities** section.
|
|
16
|
-
|
|
17
|
-
- **🟢 Good fit** — proceed autonomously.
|
|
18
|
-
- **🟡 Needs review** — proceed, but note in the PR description that a squad member should review.
|
|
19
|
-
- **🔴 Not suitable** — do NOT start work. Instead, comment on the issue:
|
|
20
|
-
```
|
|
21
|
-
🤖 This issue doesn't match my capability profile (reason: {why}). Suggesting reassignment to a squad member.
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Branch Naming
|
|
25
|
-
|
|
26
|
-
Use the squad branch convention:
|
|
27
|
-
```
|
|
28
|
-
squad/{issue-number}-{kebab-case-slug}
|
|
29
|
-
```
|
|
30
|
-
Example: `squad/42-fix-login-validation`
|
|
31
|
-
|
|
32
|
-
## PR Guidelines
|
|
33
|
-
|
|
34
|
-
When opening a PR:
|
|
35
|
-
- Reference the issue: `Closes #{issue-number}`
|
|
36
|
-
- If the issue had a `squad:{member}` label, mention the member: `Working as {member} ({role})`
|
|
37
|
-
- If this is a 🟡 needs-review task, add to the PR description: `⚠️ This task was flagged as "needs review" — please have a squad member review before merging.`
|
|
38
|
-
- Follow any project conventions in `.squad/decisions.md`
|
|
39
|
-
|
|
40
|
-
## Decisions
|
|
41
|
-
|
|
42
|
-
If you make a decision that affects other team members, write it to:
|
|
43
|
-
```
|
|
44
|
-
.squad/decisions/inbox/copilot-{brief-slug}.md
|
|
45
|
-
```
|
|
46
|
-
The Scribe will merge it into the shared decisions file.
|
|
1
|
+
# Copilot Coding Agent — Squad Instructions
|
|
2
|
+
|
|
3
|
+
You are working on a project that uses **Squad**, an AI team framework. When picking up issues autonomously, follow these guidelines.
|
|
4
|
+
|
|
5
|
+
## Team Context
|
|
6
|
+
|
|
7
|
+
Before starting work on any issue:
|
|
8
|
+
|
|
9
|
+
1. Read `.squad/team.md` for the team roster, member roles, and your capability profile.
|
|
10
|
+
2. Read `.squad/routing.md` for work routing rules.
|
|
11
|
+
3. If the issue has a `squad:{member}` label, read that member's charter at `.squad/agents/{member}/charter.md` to understand their domain expertise and coding style — work in their voice.
|
|
12
|
+
|
|
13
|
+
## Capability Self-Check
|
|
14
|
+
|
|
15
|
+
Before starting work, check your capability profile in `.squad/team.md` under the **Coding Agent → Capabilities** section.
|
|
16
|
+
|
|
17
|
+
- **🟢 Good fit** — proceed autonomously.
|
|
18
|
+
- **🟡 Needs review** — proceed, but note in the PR description that a squad member should review.
|
|
19
|
+
- **🔴 Not suitable** — do NOT start work. Instead, comment on the issue:
|
|
20
|
+
```
|
|
21
|
+
🤖 This issue doesn't match my capability profile (reason: {why}). Suggesting reassignment to a squad member.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Branch Naming
|
|
25
|
+
|
|
26
|
+
Use the squad branch convention:
|
|
27
|
+
```
|
|
28
|
+
squad/{issue-number}-{kebab-case-slug}
|
|
29
|
+
```
|
|
30
|
+
Example: `squad/42-fix-login-validation`
|
|
31
|
+
|
|
32
|
+
## PR Guidelines
|
|
33
|
+
|
|
34
|
+
When opening a PR:
|
|
35
|
+
- Reference the issue: `Closes #{issue-number}`
|
|
36
|
+
- If the issue had a `squad:{member}` label, mention the member: `Working as {member} ({role})`
|
|
37
|
+
- If this is a 🟡 needs-review task, add to the PR description: `⚠️ This task was flagged as "needs review" — please have a squad member review before merging.`
|
|
38
|
+
- Follow any project conventions in `.squad/decisions.md`
|
|
39
|
+
|
|
40
|
+
## Decisions
|
|
41
|
+
|
|
42
|
+
If you make a decision that affects other team members, write it to:
|
|
43
|
+
```
|
|
44
|
+
.squad/decisions/inbox/copilot-{brief-slug}.md
|
|
45
|
+
```
|
|
46
|
+
The Scribe will merge it into the shared decisions file.
|
package/templates/history.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Project Context
|
|
2
|
-
|
|
3
|
-
- **Owner:** {user name}
|
|
4
|
-
- **Project:** {project description}
|
|
5
|
-
- **Stack:** {languages, frameworks, tools}
|
|
6
|
-
- **Created:** {timestamp}
|
|
7
|
-
|
|
8
|
-
## Learnings
|
|
9
|
-
|
|
10
|
-
<!-- Append new learnings below. Each entry is something lasting about the project. -->
|
|
1
|
+
# Project Context
|
|
2
|
+
|
|
3
|
+
- **Owner:** {user name}
|
|
4
|
+
- **Project:** {project description}
|
|
5
|
+
- **Stack:** {languages, frameworks, tools}
|
|
6
|
+
- **Created:** {timestamp}
|
|
7
|
+
|
|
8
|
+
## Learnings
|
|
9
|
+
|
|
10
|
+
<!-- Append new learnings below. Each entry is something lasting about the project. -->
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
---
|
|
2
|
-
updated_at: {timestamp}
|
|
3
|
-
focus_area: {brief description}
|
|
4
|
-
active_issues: []
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# What We're Focused On
|
|
8
|
-
|
|
9
|
-
{Narrative description of current focus — 1-3 sentences. Updated by coordinator at session start.}
|
|
1
|
+
---
|
|
2
|
+
updated_at: {timestamp}
|
|
3
|
+
focus_area: {brief description}
|
|
4
|
+
active_issues: []
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# What We're Focused On
|
|
8
|
+
|
|
9
|
+
{Narrative description of current focus — 1-3 sentences. Updated by coordinator at session start.}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
---
|
|
2
|
-
last_updated: {timestamp}
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Team Wisdom
|
|
6
|
-
|
|
7
|
-
Reusable patterns and heuristics learned through work. NOT transcripts — each entry is a distilled, actionable insight.
|
|
8
|
-
|
|
9
|
-
## Patterns
|
|
10
|
-
|
|
11
|
-
<!-- Append entries below. Format: **Pattern:** description. **Context:** when it applies. -->
|
|
12
|
-
|
|
13
|
-
## Anti-Patterns
|
|
14
|
-
|
|
15
|
-
<!-- Things we tried that didn't work. **Avoid:** description. **Why:** reason. -->
|
|
1
|
+
---
|
|
2
|
+
last_updated: {timestamp}
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Team Wisdom
|
|
6
|
+
|
|
7
|
+
Reusable patterns and heuristics learned through work. NOT transcripts — each entry is a distilled, actionable insight.
|
|
8
|
+
|
|
9
|
+
## Patterns
|
|
10
|
+
|
|
11
|
+
<!-- Append entries below. Format: **Pattern:** description. **Context:** when it applies. -->
|
|
12
|
+
|
|
13
|
+
## Anti-Patterns
|
|
14
|
+
|
|
15
|
+
<!-- Things we tried that didn't work. **Avoid:** description. **Why:** reason. -->
|