@prateek_ai/agents-maker 1.0.0 → 1.0.2
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/PROMPT_TEMPLATE.md +143 -0
- package/README.md +92 -25
- package/agents/brain.md +90 -0
- package/agents/orchestrator.md +24 -3
- package/agents/planpro.md +91 -0
- package/bin/cli.js +40 -4
- package/claude/agents/architect.md +182 -0
- package/claude/agents/brain.md +97 -0
- package/claude/agents/code.md +185 -0
- package/claude/agents/compress.md +233 -0
- package/claude/agents/execute.md +164 -0
- package/claude/agents/orchestrate.md +434 -0
- package/claude/agents/planpro.md +98 -0
- package/claude/agents/review.md +141 -0
- package/claude/agents/ui.md +154 -0
- package/claude/agents/ux.md +151 -0
- package/claude/commands/architect.md +15 -0
- package/claude/commands/brain.md +15 -0
- package/claude/commands/code.md +15 -0
- package/claude/commands/compress.md +15 -0
- package/claude/commands/execute.md +15 -0
- package/claude/commands/orchestrate.md +15 -0
- package/claude/commands/planpro.md +15 -0
- package/claude/commands/review.md +15 -0
- package/claude/commands/ui.md +15 -0
- package/claude/commands/ux.md +15 -0
- package/config/agents.yaml +56 -0
- package/context_loaders/project_summary.py +5 -0
- package/docs/architecture.md +318 -0
- package/docs/domains.md +154 -0
- package/docs/workflows.md +548 -0
- package/examples/generic_project_lifecycle.md +518 -0
- package/examples/proof/README.md +138 -0
- package/examples/proof/implement-a-python-function-that-parses-an-iso-8/grade.md +14 -0
- package/examples/proof/implement-a-python-function-that-parses-an-iso-8/naive_output.md +211 -0
- package/examples/proof/implement-a-python-function-that-parses-an-iso-8/naive_prompt.txt +1 -0
- package/examples/proof/implement-a-python-function-that-parses-an-iso-8/structured_output.md +210 -0
- package/examples/proof/implement-a-python-function-that-parses-an-iso-8/structured_user.txt +35 -0
- package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/grade.md +14 -0
- package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/naive_output.md +274 -0
- package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/naive_prompt.txt +1 -0
- package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/structured_output.md +127 -0
- package/examples/proof/write-a-runbook-for-recovering-from-a-redis-prim/structured_user.txt +35 -0
- package/package.json +10 -2
- package/platforms/antigravity.md +195 -0
- package/platforms/claude.md +305 -0
- package/platforms/openai.md +333 -0
- package/skills/analyze_repo.md +86 -86
- package/token_optimization/compressor.py +4 -7
- package/tools/_core.py +102 -0
- package/tools/compare_prompts.py +196 -0
- package/tools/generate_claude_agents.py +162 -0
- package/tools/generate_claude_md.py +14 -80
- package/tools/generate_platform_configs.py +26 -36
- package/tools/generate_prompt.py +79 -79
- package/tools/grade_proof.py +118 -0
- package/tools/init_project.py +11 -58
- package/tools/routing.py +103 -0
- package/tools/test_kit.py +392 -363
- package/tools/validate_kit.py +15 -43
- package/context_loaders/__pycache__/__init__.cpython-314.pyc +0 -0
- package/context_loaders/__pycache__/file_chunker.cpython-314.pyc +0 -0
- package/context_loaders/__pycache__/project_summary.cpython-314.pyc +0 -0
- package/context_loaders/__pycache__/repo_tree.cpython-314.pyc +0 -0
- package/token_optimization/__pycache__/compressor.cpython-314.pyc +0 -0
- package/tools/__pycache__/domain_utils.cpython-314.pyc +0 -0
- package/tools/__pycache__/generate_claude_md.cpython-314.pyc +0 -0
- package/tools/__pycache__/validate_kit.cpython-314.pyc +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Redis Primary Failover Recovery Runbook
|
|
2
|
+
|
|
3
|
+
**Domain:** ops_process
|
|
4
|
+
**Severity:** High
|
|
5
|
+
**Last Updated:** [DATE]
|
|
6
|
+
**Owned By:** Platform/Database Team
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
1. [Overview](#overview)
|
|
12
|
+
2. [Detection & Alerting](#detection--alerting)
|
|
13
|
+
3. [Initial Assessment](#initial-assessment)
|
|
14
|
+
4. [Recovery Procedures](#recovery-procedures)
|
|
15
|
+
5. [Validation](#validation)
|
|
16
|
+
6. [Post-Incident](#post-incident)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
### What is a Primary Failover?
|
|
23
|
+
|
|
24
|
+
A Redis primary failover occurs when the primary (master) node becomes unavailable and a replica is automatically promoted to primary, or when a manual failover is triggered. This runbook covers recovery procedures for both scenarios.
|
|
25
|
+
|
|
26
|
+
### Key Objectives
|
|
27
|
+
- Restore cluster to healthy state with single primary
|
|
28
|
+
- Minimize data loss and service degradation
|
|
29
|
+
- Document root cause for post-incident analysis
|
|
30
|
+
- Restore replication topology
|
|
31
|
+
|
|
32
|
+
### Expected Impact
|
|
33
|
+
- **Availability:** Brief interruption (seconds to minutes)
|
|
34
|
+
- **Data Loss:** Potentially 0-N seconds of in-flight writes
|
|
35
|
+
- **Read/Write Performance:** Possible elevation during recovery
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Detection & Alerting
|
|
40
|
+
|
|
41
|
+
### Alert Indicators
|
|
42
|
+
|
|
43
|
+
| Signal | Threshold | Severity |
|
|
44
|
+
|--------|-----------|----------|
|
|
45
|
+
| Primary node down | Immediate | Critical |
|
|
46
|
+
| Replication lag | >5 seconds | High |
|
|
47
|
+
| Replica promotion event | Immediate | High |
|
|
48
|
+
| Failed sentinel quorum | >1 sentinel down | Medium |
|
|
49
|
+
| Memory exhaustion | >95% | High |
|
|
50
|
+
|
|
51
|
+
### Detection Methods
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Check primary status
|
|
55
|
+
redis-cli -h <primary-host> -p 6379 info replication
|
|
56
|
+
|
|
57
|
+
# Monitor sentinel
|
|
58
|
+
redis-cli -h <sentinel-host> -p 26379 sentinel masters
|
|
59
|
+
|
|
60
|
+
# Check cluster role
|
|
61
|
+
redis-cli -h <redis-host> -p 6379 role
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Alerting Verification
|
|
65
|
+
- [ ] Check PagerDuty/OpsGenie alert details
|
|
66
|
+
- [ ] Correlate with log aggregation (ELK/Splunk/DataDog)
|
|
67
|
+
- [ ] Verify alert timestamp matches incident occurrence
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Initial Assessment
|
|
72
|
+
|
|
73
|
+
### Step 1: Gather Situational Awareness (5 min)
|
|
74
|
+
|
|
75
|
+
**Action Items:**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 1. Connect to Redis environment
|
|
79
|
+
export REDIS_PRIMARY=<primary-host>
|
|
80
|
+
export REDIS_SENTINEL=<sentinel-host>
|
|
81
|
+
export REDIS_PORT=6379
|
|
82
|
+
export SENTINEL_PORT=26379
|
|
83
|
+
|
|
84
|
+
# 2. Check current topology
|
|
85
|
+
redis-cli -h $REDIS_PRIMARY -p $REDIS_PORT INFO replication
|
|
86
|
+
|
|
87
|
+
# Output should show:
|
|
88
|
+
# role:master or role:slave
|
|
89
|
+
|
|
90
|
+
# 3. List all nodes
|
|
91
|
+
redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT sentinel masters
|
|
92
|
+
|
|
93
|
+
# 4. Check sentinel state
|
|
94
|
+
redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT sentinel slaves <master-name>
|
|
95
|
+
|
|
96
|
+
# 5. Review recent logs
|
|
97
|
+
tail -100 /var/log/redis/redis-server.log
|
|
98
|
+
tail -100 /var/log/redis/sentinel.log
|
|
99
|
+
|
|
100
|
+
# 6. Check connectivity to all nodes
|
|
101
|
+
for node in <node1> <node2> <node3>; do
|
|
102
|
+
echo "Testing $node:"
|
|
103
|
+
redis-cli -h $node -p $REDIS_PORT ping
|
|
104
|
+
done
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Document Findings:**
|
|
108
|
+
- [ ] Current primary node
|
|
109
|
+
- [ ] Current replica nodes (if any)
|
|
110
|
+
- [ ] Sentinel quorum status
|
|
111
|
+
- [ ] Network connectivity status
|
|
112
|
+
- [ ] Recent error messages
|
|
113
|
+
|
|
114
|
+
### Step 2: Identify Failover Trigger
|
|
115
|
+
|
|
116
|
+
Ask: **Why did failover occur?**
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Check for OOM (Out of Memory)
|
|
120
|
+
redis-cli -h $REDIS_PRIMARY -p $REDIS_PORT info memory | grep used_memory
|
|
121
|
+
|
|
122
|
+
# Check for hung process
|
|
123
|
+
ps aux | grep redis-server
|
|
124
|
+
|
|
125
|
+
# Check system resources
|
|
126
|
+
top -bn1 | head -20
|
|
127
|
+
|
|
128
|
+
# Check network issues
|
|
129
|
+
mtr -r -c 100 <primary-ip>
|
|
130
|
+
|
|
131
|
+
# Check log for crash
|
|
132
|
+
journalctl -u redis-server -n 50 --no-pager
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Possible Root Causes:**
|
|
136
|
+
- [ ] Hardware failure (CPU/disk/network)
|
|
137
|
+
- [ ] Out of memory condition
|
|
138
|
+
- [ ] Software crash (segfault, assertion)
|
|
139
|
+
- [ ] Network partition
|
|
140
|
+
- [ ] Manual intervention
|
|
141
|
+
- [ ] Sentinel misconfiguration
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Recovery Procedures
|
|
146
|
+
|
|
147
|
+
### Scenario A: Automatic Failover (Recommended Path)
|
|
148
|
+
|
|
149
|
+
**Conditions:** Replica was automatically promoted by Sentinel
|
|
150
|
+
|
|
151
|
+
#### Step 1: Verify New Primary
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Identify new primary
|
|
155
|
+
NEW_PRIMARY=$(redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT \
|
|
156
|
+
sentinel get-master-addr-by-name <master-name> | head -1)
|
|
157
|
+
|
|
158
|
+
echo "New primary is: $NEW_PRIMARY"
|
|
159
|
+
|
|
160
|
+
# Verify it's accepting writes
|
|
161
|
+
redis-cli -h $NEW_PRIMARY -p $REDIS_PORT ping
|
|
162
|
+
redis-cli -h $NEW_PRIMARY -p $REDIS_PORT info replication
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Expected Output:**
|
|
166
|
+
```
|
|
167
|
+
role:master
|
|
168
|
+
connected_slaves:N
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Step 2: Investigate Former Primary
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# For each affected host:
|
|
175
|
+
PRIMARY_HOST="<former-primary-ip>"
|
|
176
|
+
|
|
177
|
+
# Check if process is running
|
|
178
|
+
ssh $PRIMARY_HOST "systemctl status redis-server"
|
|
179
|
+
|
|
180
|
+
# Check logs for crash reasons
|
|
181
|
+
ssh $PRIMARY_HOST "journalctl -u redis-server -n 100 --no-pager"
|
|
182
|
+
|
|
183
|
+
# Check system health
|
|
184
|
+
ssh $PRIMARY_HOST "free -h && df -h / && top -bn1 | head -15"
|
|
185
|
+
|
|
186
|
+
# Verify disk space
|
|
187
|
+
ssh $PRIMARY_HOST "du -sh /var/lib/redis/*"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Step 3: Restart Former Primary as Replica
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
PRIMARY_HOST="<former-primary-ip>"
|
|
194
|
+
NEW_PRIMARY="<new-primary-host>"
|
|
195
|
+
REDIS_PORT=6379
|
|
196
|
+
|
|
197
|
+
# 1. SSH to former primary
|
|
198
|
+
ssh $PRIMARY_HOST
|
|
199
|
+
|
|
200
|
+
# 2. Stop Redis gracefully
|
|
201
|
+
sudo systemctl stop redis-server
|
|
202
|
+
|
|
203
|
+
# 3. Optionally backup current data (if investigating)
|
|
204
|
+
# sudo cp -r /var/lib/redis /var/lib/redis.backup.$(date +%s)
|
|
205
|
+
|
|
206
|
+
# 4. Clear old AOF if corrupted (DANGEROUS - only if instructed)
|
|
207
|
+
# sudo rm /var/lib/redis/appendonly.aof
|
|
208
|
+
|
|
209
|
+
# 5. Start Redis
|
|
210
|
+
sudo systemctl start redis-server
|
|
211
|
+
|
|
212
|
+
# 6. Wait for startup
|
|
213
|
+
sleep 5
|
|
214
|
+
|
|
215
|
+
# 7. Configure as replica
|
|
216
|
+
redis-cli -p $REDIS_PORT REPLICAOF $NEW_PRIMARY $REDIS_PORT
|
|
217
|
+
|
|
218
|
+
# 8. Verify
|
|
219
|
+
redis-cli -p $REDIS_PORT info replication
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### Step 4: Monitor Resynchronization
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Watch replication lag decrease
|
|
226
|
+
watch -n 2 "redis-cli -h $NEW_PRIMARY -p $REDIS_PORT info replication | \
|
|
227
|
+
grep -E 'connected_slaves|slave.*offset|master_repl_offset'"
|
|
228
|
+
|
|
229
|
+
# Expected behavior:
|
|
230
|
+
# - slave_repl_offset gradually increases
|
|
231
|
+
# - Eventually matches master's master_repl_offset
|
|
232
|
+
# - slave_state changes to "online"
|
|
233
|
+
|
|
234
|
+
# For large datasets, this may take 5-30+ minutes
|
|
235
|
+
# Do NOT interrupt this process
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Success Criteria:**
|
|
239
|
+
```
|
|
240
|
+
connected_slaves:1
|
|
241
|
+
slave0:ip=<ip>,port=6379,state=online,offset=<offset>,lag=0
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Scenario B: Manual Failover Required
|
|
245
|
+
|
|
246
|
+
**Conditions:** Automatic failover failed or primary cannot be recovered
|
|
247
|
+
|
|
248
|
+
#### Step 1: Force Failover via Sentinel
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# WARNING: Only if automatic failover failed to promote a replica
|
|
252
|
+
|
|
253
|
+
MASTER_NAME="<redis-master-name>" # e.g., "mymaster"
|
|
254
|
+
|
|
255
|
+
# Get current master
|
|
256
|
+
redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT \
|
|
257
|
+
sentinel get-master-addr-by-name $MASTER_NAME
|
|
258
|
+
|
|
259
|
+
# Execute manual failover (controlled)
|
|
260
|
+
redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT \
|
|
261
|
+
sentinel failover $MASTER_NAME
|
|
262
|
+
|
|
263
|
+
# Monitor progress
|
|
264
|
+
watch -n 1 "redis-cli -h $REDIS_SENTINEL -p $SENTINEL_PORT \
|
|
265
|
+
sentinel get-master-addr-by-name $MASTER_NAME"
|
|
266
|
+
|
|
267
|
+
# Wait for new master to be elected (typically 30 seconds)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### Step 2: Update Application Configuration
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# If using Sentinel-aware clients:
|
|
274
|
+
# - Most clients auto-discover new primary through Sentinel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[domain: ops_process] write a runbook for recovering from a Redis primary failover in production
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Redis Primary Failover Recovery Runbook
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
**Process name**: Redis Primary Failover Recovery
|
|
5
|
+
**Trigger**: Automated failover detected (replica promoted) OR manual failover initiated
|
|
6
|
+
**Goal**: Restore Redis cluster to stable, redundant state with minimal data loss and downtime
|
|
7
|
+
**SLA**: Acknowledge within 5 min | Failover completion within 15 min | Full recovery within 1 hour
|
|
8
|
+
**Actors**: On-call DBA, Platform Engineer, Application Owner, Incident Commander
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Process Steps
|
|
13
|
+
|
|
14
|
+
| # | Step | Actor | Tool / System | Output |
|
|
15
|
+
|---|---|---|---|---|
|
|
16
|
+
| 1 | Receive failover alert (automated or manual trigger) | Monitoring system | PagerDuty, CloudWatch, Redis Sentinel | Alert ticket created; on-call DBA paged |
|
|
17
|
+
| 2 | Acknowledge alert and open war room | On-call DBA | Slack, war room link | Incident declared; team assembled in 2 min |
|
|
18
|
+
| 3 | Verify failover has occurred | On-call DBA | `redis-cli -h <new-primary> info replication` | Confirm new primary, check replica list, note primary ID and epoch |
|
|
19
|
+
| 4 | Check replica connectivity and lag | Platform Engineer | `redis-cli -h <replica-ip> info replication \| grep offset` | Document replica offsets; identify any lagging replicas |
|
|
20
|
+
| 5 | If old primary is still responsive: Issue SHUTDOWN on old primary | On-call DBA | SSH to old primary node; `redis-cli SHUTDOWN NOSAVE` | Old primary halts; prevents split-brain |
|
|
21
|
+
| 6 | Inspect new primary for correctness | Application Owner | `redis-cli -h <new-primary> DBSIZE`, `KEYS *` (sample) | Verify no unexpected data loss; check key count against baseline |
|
|
22
|
+
| 7 | Re-enable application traffic to new primary | Platform Engineer | Update app config / DNS / load balancer; deploy | Apps reconnect to new primary; monitor error rate |
|
|
23
|
+
| 8 | Restart old primary node | Platform Engineer | SSH to old primary; `sudo systemctl start redis` | Old primary boots; automatically joins as replica (Sentinel manages) |
|
|
24
|
+
| 9 | Confirm old primary joined as replica | On-call DBA | `redis-cli -h <old-primary-ip> info replication` | Old primary shows as replica; syncing or synced |
|
|
25
|
+
| 10 | Monitor replication lag and error rates for 5 min | Platform Engineer | CloudWatch, application logs | Lag <100ms; error rate <0.1% (baseline) |
|
|
26
|
+
| 11 | Document incident and root cause | Incident Commander | Runbook, incident ticket | Incident closed; post-mortem scheduled if needed |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## RACI Matrix
|
|
31
|
+
|
|
32
|
+
| Step | On-call DBA | Platform Engineer | Application Owner | Incident Commander |
|
|
33
|
+
|---|---|---|---|---|
|
|
34
|
+
| 1 — Receive alert | I | I | I | A |
|
|
35
|
+
| 2 — Acknowledge and assemble | R | C | C | A |
|
|
36
|
+
| 3 — Verify failover | **R** | — | — | I |
|
|
37
|
+
| 4 — Check replica lag | **R** | C | — | — |
|
|
38
|
+
| 5 — Shutdown old primary | **R** | C | — | — |
|
|
39
|
+
| 6 — Inspect new primary | C | — | **R** | I |
|
|
40
|
+
| 7 — Re-enable traffic | C | **R** | C | — |
|
|
41
|
+
| 8 — Restart old primary | C | **R** | — | — |
|
|
42
|
+
| 9 — Confirm replica join | **R** | C | — | I |
|
|
43
|
+
| 10 — Monitor recovery | C | **R** | C | — |
|
|
44
|
+
| 11 — Document incident | C | C | C | **A** |
|
|
45
|
+
|
|
46
|
+
Legend: **R** = Responsible | **A** = Accountable | **C** = Consulted | **I** = Informed | — = Not involved
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Exception Paths
|
|
51
|
+
|
|
52
|
+
| Condition | Detected at step | Recovery action | Owner |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| Old primary unresponsive / already halted | 5 | Skip step 5; proceed to step 6. Document in incident ticket that manual intervention prevented split-brain. | On-call DBA |
|
|
55
|
+
| New primary shows unexpected data loss (DBSIZE << baseline) | 6 | **STOP.** Do not re-enable traffic. Escalate to Database Team lead. Investigate: check replica offsets from step 4; determine if loss occurred pre-failover or during. May require restore from backup. | Application Owner + DBA |
|
|
56
|
+
| Replica reports very high lag (>1000ms) | 4 or 10 | Check network: `ping <replica-ip>`, verify no packet loss. If network OK: replica may be CPU-bound. Increase `slowlog get` output; identify expensive commands. If lag persists >5 min, reduce traffic to primary until lag clears (degrade gracefully). | Platform Engineer |
|
|
57
|
+
| Old primary fails to rejoin as replica after restart (step 8–9) | 9 | SSH to old primary; check Redis logs: `tail -f /var/log/redis/redis-server.log`. If Sentinel config is stale, manually configure replication: `redis-cli SLAVEOF <new-primary-ip> 6379`. Notify Sentinel that it should manage this; do not leave manual replication in place. | On-call DBA |
|
|
58
|
+
| Application receives connection errors after traffic re-enable | 7 | Verify app is using correct primary endpoint / DNS name. Check Redis `CLIENT LIST` on new primary to confirm connections arriving. If connections not arriving: rolling restart of app replicas. | Platform Engineer |
|
|
59
|
+
| Split-brain detected (two primaries with conflicting writes) | Any | **CRITICAL.** Kill one primary immediately (the one **not** owned by Sentinel). **Do not attempt reconciliation.** Notify Database Architect. Restore from backup if needed. | On-call DBA + Architect |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Pre-Incident Checklist (Preparation)
|
|
64
|
+
|
|
65
|
+
Before any failover, ensure:
|
|
66
|
+
- [ ] Sentinel is running on ≥3 nodes and has quorum
|
|
67
|
+
- [ ] Replica is synced (replication offset matches primary)
|
|
68
|
+
- [ ] Network between primary and replica is stable (<1ms latency, <0.1% loss)
|
|
69
|
+
- [ ] Backup of Redis data is recent (< 1 hour old) and verified
|
|
70
|
+
- [ ] Application is configured to reconnect on primary failover
|
|
71
|
+
- [ ] On-call DBA and Platform Engineer have been trained on this runbook
|
|
72
|
+
- [ ] War room link and Slack channel are established and tested
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Success Criteria
|
|
77
|
+
|
|
78
|
+
Failover recovery is **complete** when:
|
|
79
|
+
- [ ] New primary is stable and accepting writes
|
|
80
|
+
- [ ] Old primary is running as a replica and fully synced (lag ≈ 0)
|
|
81
|
+
- [ ] All application instances reconnected to new primary
|
|
82
|
+
- [ ] Error rate returned to baseline (<0.1%)
|
|
83
|
+
- [ ] No split-brain condition present
|
|
84
|
+
- [ ] Incident is documented with timeline and root cause
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Key Commands Reference
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Check replication status
|
|
92
|
+
redis-cli -h <host> INFO REPLICATION
|
|
93
|
+
|
|
94
|
+
# View current primary and replicas
|
|
95
|
+
redis-cli -h <host> ROLE
|
|
96
|
+
|
|
97
|
+
# Force shutdown of old primary (blocks split-brain)
|
|
98
|
+
redis-cli -h <old-primary> SHUTDOWN NOSAVE
|
|
99
|
+
|
|
100
|
+
# Manually demote primary and trigger new election (Sentinel-managed)
|
|
101
|
+
redis-cli -h <sentinel-host> -p 26379 SENTINEL FAILOVER <master-name>
|
|
102
|
+
|
|
103
|
+
# Monitor real-time replication offset
|
|
104
|
+
redis-cli -h <host> INFO REPLICATION | grep offset
|
|
105
|
+
|
|
106
|
+
# Check Sentinel quorum and master discovery
|
|
107
|
+
redis-cli -h <sentinel-host> -p 26379 SENTINEL MASTERS
|
|
108
|
+
|
|
109
|
+
# Restart Redis service (after node recovery)
|
|
110
|
+
sudo systemctl restart redis-server
|
|
111
|
+
# Verify it came up as replica (should auto-rejoin if Sentinel is running)
|
|
112
|
+
redis-cli INFO REPLICATION
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Post-Incident Actions
|
|
118
|
+
|
|
119
|
+
1. **Within 1 hour**: Document what triggered the failover (network partition, primary node crash, manual failover test). Update runbook with any new findings.
|
|
120
|
+
2. **Within 1 day**: Schedule post-mortem if failover was unplanned. Review: Did Sentinel behave as expected? Any network issues? Application reconnection latency acceptable?
|
|
121
|
+
3. **Within 1 week**: Run a failover test in staging to verify this runbook is current and team is trained.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Notes & Guardrails
|
|
126
|
+
|
|
127
|
+
- **Never manually intervene** in Sentinel-managed failover unless explicitly instructed. Sentinel
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## Project Context
|
|
2
|
+
Name: agents-maker | Stack: Python, Node.js | Domain: software
|
|
3
|
+
|
|
4
|
+
## Session State
|
|
5
|
+
# Project State
|
|
6
|
+
schema_version: "1.0"
|
|
7
|
+
|
|
8
|
+
## Current Phase
|
|
9
|
+
task_framing
|
|
10
|
+
|
|
11
|
+
## Domain
|
|
12
|
+
(detected at init — override here if needed)
|
|
13
|
+
|
|
14
|
+
## Approved Artifacts
|
|
15
|
+
(none yet)
|
|
16
|
+
|
|
17
|
+
## Open Decisions
|
|
18
|
+
(none yet)
|
|
19
|
+
|
|
20
|
+
## Build Log
|
|
21
|
+
(empty)
|
|
22
|
+
|
|
23
|
+
## Session Notes
|
|
24
|
+
(add notes after each session)
|
|
25
|
+
|
|
26
|
+
## Task
|
|
27
|
+
[domain: ops_process] write a runbook for recovering from a Redis primary failover in production
|
|
28
|
+
|
|
29
|
+
Execute this task now. If it is self-contained, deliver the finished artifact immediately in Direct Task Mode — do not greet, do not restate this configuration, do not ask for project context, and do not open the phase lifecycle unless the task is clearly multi-phase. End with the [Companion] next-steps block.
|
|
30
|
+
|
|
31
|
+
## Domain & Routing
|
|
32
|
+
Domain: ops_process (confidence: forced, score: 1.00)
|
|
33
|
+
Suggested phase: task_framing
|
|
34
|
+
Active agents: orchestrator
|
|
35
|
+
Active skills: analyze_repo, summarize_history, suggest_next, compare_approaches
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prateek_ai/agents-maker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Multi-LLM multi-agent assistant kit — structured AI sessions for any project, any LLM",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agents-maker": "bin/cli.js"
|
|
7
7
|
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepack": "node -e \"const fs=require('fs'),p=require('path');const skip=['node_modules','.git','.next','out','site'];const walk=d=>{for(const e of fs.readdirSync(d,{withFileTypes:true})){if(skip.includes(e.name))continue;const f=p.join(d,e.name);if(e.isDirectory()){e.name==='__pycache__'?fs.rmSync(f,{recursive:true,force:true}):walk(f);}}};walk('.')\""
|
|
10
|
+
},
|
|
8
11
|
"files": [
|
|
9
12
|
"bin/",
|
|
10
13
|
"agents/",
|
|
@@ -16,6 +19,11 @@
|
|
|
16
19
|
"tools/",
|
|
17
20
|
"context_loaders/",
|
|
18
21
|
"token_optimization/",
|
|
22
|
+
"platforms/",
|
|
23
|
+
"docs/",
|
|
24
|
+
"examples/",
|
|
25
|
+
"claude/",
|
|
26
|
+
"PROMPT_TEMPLATE.md",
|
|
19
27
|
"quickstart.sh",
|
|
20
28
|
"quickstart.ps1",
|
|
21
29
|
"requirements.txt"
|
|
@@ -37,7 +45,7 @@
|
|
|
37
45
|
"license": "MIT",
|
|
38
46
|
"repository": {
|
|
39
47
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/Prateek-N/Multi-Agent-Stack"
|
|
48
|
+
"url": "git+https://github.com/Prateek-N/Multi-Agent-Stack.git"
|
|
41
49
|
},
|
|
42
50
|
"homepage": "https://github.com/Prateek-N/Multi-Agent-Stack#readme",
|
|
43
51
|
"bugs": {
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Antigravity Integration Guide
|
|
2
|
+
|
|
3
|
+
Conceptual mapping of this kit to Antigravity's agent primitives. Because Antigravity's API surface evolves, this guide focuses on conceptual equivalences rather than exact API calls.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> Companion Mode works the same across all platforms. See [platforms/claude.md](claude.md) for the full Companion Mode walkthrough, then follow the platform-specific steps below.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Core Primitive Mapping
|
|
12
|
+
|
|
13
|
+
| This kit | Antigravity equivalent | Notes |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Agent spec (`.md` system prompt) | Agent definition / instruction set | Paste the Markdown as the agent's system instructions |
|
|
16
|
+
| `config/agents.yaml` | Agent registry / manifest | Import as agent metadata; use routing_tags for intent routing |
|
|
17
|
+
| `config/token_policies.yaml` | Context policy / pipeline config | Map to context window management settings |
|
|
18
|
+
| `config/domain_profiles.yaml` | Domain/intent classifier config | Load as global knowledge for the Orchestrator agent |
|
|
19
|
+
| Skill card (`.md`) | Tool definition / capability card | Register each skill as a tool or callable capability |
|
|
20
|
+
| Orchestrator | Supervisor / planner agent | Entry point — drives the 6-phase lifecycle and delegates to specialists |
|
|
21
|
+
| Specialist agents | Worker agents / sub-agents | Register with the Orchestrator as callable workers |
|
|
22
|
+
| `context_loaders/*.py` | Context ingestion pipeline | Run locally; paste output as session-opening message |
|
|
23
|
+
| `token_optimization/compressor.py` | Context compression middleware | Integrate as a preprocessing step before context reaches the agent pipeline |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Agent Graph Setup
|
|
28
|
+
|
|
29
|
+
In Antigravity, define the agent graph with the Orchestrator at the root:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Orchestrator (root / lifecycle driver)
|
|
33
|
+
├── ArchitectAgent ← Phase 1 (Requirements) + Phase 2 (Solution Design)
|
|
34
|
+
├── CodeAgent ← Phase 3 Implementation for software + data_analytics
|
|
35
|
+
├── ExecutionAgent ← Phase 3 Implementation for content, research, marketing, ops_process
|
|
36
|
+
├── UIAgent ← Supporting: presentation/interface layer
|
|
37
|
+
├── UXAgent ← Supporting: experience/flow critique
|
|
38
|
+
├── ReviewerAgent ← Phase 4 (Review & Refinement)
|
|
39
|
+
└── CompressionAgent ← Cross-cutting: token management + cross-session resumption
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For each node:
|
|
43
|
+
1. Create an agent with the corresponding `.md` file content as its system prompt.
|
|
44
|
+
2. Attach its skill cards from `skills/` (listed in `config/agents.yaml` under each agent).
|
|
45
|
+
3. Set routing tags from `config/agents.yaml` as intent triggers or classifier labels.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Minimal Lifecycle Invocation
|
|
50
|
+
|
|
51
|
+
No domain configuration is needed. The Orchestrator detects the domain from the user's first message using `config/domain_profiles.yaml`.
|
|
52
|
+
|
|
53
|
+
**Example invocation**:
|
|
54
|
+
```
|
|
55
|
+
User: "Help me document the onboarding process for new engineers."
|
|
56
|
+
|
|
57
|
+
Orchestrator behavior:
|
|
58
|
+
1. Scores message: "document" (content/weak), "process" (ops_process/strong), "onboarding" (product_design/weak)
|
|
59
|
+
2. ops_process scores highest → domain = ops_process, confidence = high
|
|
60
|
+
3. Produces task_profile, asks 3–5 scoping questions
|
|
61
|
+
4. Drives user through 6 phases with explicit approval gates
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Domain hint override**: prefix the message with `[domain: <key>]` to bypass scoring:
|
|
65
|
+
```
|
|
66
|
+
[domain: content] Write a technical white paper on distributed tracing.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Context Injection
|
|
72
|
+
|
|
73
|
+
Inject these documents into Antigravity's global knowledge or session context:
|
|
74
|
+
|
|
75
|
+
| Document | Where to inject | Required |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `config/agents.yaml` | Global knowledge / agent metadata | Yes |
|
|
78
|
+
| `config/token_policies.yaml` | Pipeline config / session settings | Yes |
|
|
79
|
+
| `config/domain_profiles.yaml` | Orchestrator's knowledge (domain detection) | Yes |
|
|
80
|
+
| Output of `project_summary.py` | Session-level context at conversation start | For code tasks only |
|
|
81
|
+
| Output of `repo_tree.py` | Session-level context; update when files change | For code tasks only |
|
|
82
|
+
| `project_state.md` (if resuming) | Opening message or session context | For session resumption |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Token Policy Mapping
|
|
87
|
+
|
|
88
|
+
Map `token_policies.yaml` fields to Antigravity's context management settings:
|
|
89
|
+
|
|
90
|
+
| `token_policies.yaml` field | Antigravity setting (approximate) |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `max_input_tokens` | Context window limit / max context size |
|
|
93
|
+
| `max_input_files` | Max attached documents per turn |
|
|
94
|
+
| `history_summarize_after_turns` | Auto-summarization turn threshold |
|
|
95
|
+
| `force_state_block_after_turns: 20` | Hard summarization trigger after 20 turns |
|
|
96
|
+
| `output_style` | Response format preset / verbosity setting |
|
|
97
|
+
| `relevance_drop_threshold` | Relevance threshold for document retrieval |
|
|
98
|
+
| `project_state_snapshot_after_phase` | Emit `project_state.md` after each approved phase |
|
|
99
|
+
|
|
100
|
+
If Antigravity does not expose these settings directly, apply them via `compressor.py` as a local preprocessing step.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Skill Cards as Tools
|
|
105
|
+
|
|
106
|
+
Register each skill card as an Antigravity tool:
|
|
107
|
+
|
|
108
|
+
| Skill file | Tool name | Trigger condition |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `skills/analyze_repo.md` | `analyze_repo` | Session start; no project summary provided |
|
|
111
|
+
| `skills/design_api.md` | `design_api` | Architect Agent: API design task |
|
|
112
|
+
| `skills/review_code.md` | `review_code` | Reviewer Agent: software domain review |
|
|
113
|
+
| `skills/review_layout.md` | `review_layout` | UI/UX Agent: layout critique |
|
|
114
|
+
| `skills/improve_copy.md` | `improve_copy` | UX Agent or Execution Agent: microcopy |
|
|
115
|
+
| `skills/write_tests.md` | `write_tests` | Code Agent: test generation |
|
|
116
|
+
| `skills/summarize_history.md` | `summarize_history` | Compression Agent: turn/token threshold hit |
|
|
117
|
+
|
|
118
|
+
Each tool's description should be the first paragraph of the corresponding skill card.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Lifecycle Phase Wiring
|
|
123
|
+
|
|
124
|
+
The Orchestrator drives 6 phases sequentially. In Antigravity, model this as a stateful pipeline:
|
|
125
|
+
|
|
126
|
+
| Phase | Primary agent to call | Output artifact |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| 0 — Task Framing | Orchestrator (direct) | `task_profile` |
|
|
129
|
+
| 1 — Requirements | ArchitectAgent | `requirements_spec` |
|
|
130
|
+
| 2 — Solution Design | ArchitectAgent (+ UIAgent/UXAgent as needed) | `solution_design` |
|
|
131
|
+
| 3 — Implementation | CodeAgent (software/data) or ExecutionAgent (other) | `work_product` + `build_log` |
|
|
132
|
+
| 4 — Review | ReviewerAgent | `refinement_report` |
|
|
133
|
+
| 5 — Handoff | Orchestrator (direct) | `handoff_package` |
|
|
134
|
+
|
|
135
|
+
The Orchestrator reads the active domain from `config/domain_profiles.yaml` to determine which agent handles Phase 3 (the only phase where the agent varies by domain).
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Cross-Session Resumption
|
|
140
|
+
|
|
141
|
+
After each approved phase the Orchestrator emits a `project_state.md` snapshot. To resume a prior session:
|
|
142
|
+
|
|
143
|
+
1. Inject `project_state.md` into the session context (file attachment or opening message).
|
|
144
|
+
2. The Orchestrator (via `compression_agent.md` Cross-Session Resumption protocol) loads it, emits a status line, and continues from `current_phase`.
|
|
145
|
+
3. Phases already in `phase_history` are skipped — only the current and remaining phases run.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Limitations and Workarounds
|
|
150
|
+
|
|
151
|
+
| Limitation | Workaround |
|
|
152
|
+
|---|---|
|
|
153
|
+
| No persistent state across sessions | Emit `project_state.md` at each phase; inject at session start to resume |
|
|
154
|
+
| No file ingestion | Run `context_loaders/*.py` locally and paste output as the opening message |
|
|
155
|
+
| No custom token policy settings | Apply `compressor.py` as a local preprocessing step |
|
|
156
|
+
| No multi-agent routing | Use the single-agent fallback below |
|
|
157
|
+
|
|
158
|
+
### Single-agent fallback
|
|
159
|
+
|
|
160
|
+
If Antigravity does not support multi-agent routing, run the entire kit as one agent by concatenating all specs in this order:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
# Orchestrator
|
|
164
|
+
<orchestrator.md content>
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
# Architect / Planner Agent
|
|
168
|
+
<architect_agent.md content>
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
# Code Agent
|
|
172
|
+
<code_agent.md content>
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
# Execution Agent
|
|
176
|
+
<execution_agent.md content>
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
# Reviewer Agent
|
|
180
|
+
<reviewer_agent.md content>
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
# UI Agent
|
|
184
|
+
<ui_agent.md content>
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
# UX Agent
|
|
188
|
+
<ux_agent.md content>
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
# Compression Agent
|
|
192
|
+
<compression_agent.md content>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The Orchestrator simulates routing by switching roles within a single context window. The 6-phase lifecycle still works — the agent simply fulfills each specialist role in turn.
|