@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,518 @@
|
|
|
1
|
+
# Example Session: Generic Project Lifecycle
|
|
2
|
+
|
|
3
|
+
Two annotated mini-scenarios demonstrating the full 6-phase lifecycle:
|
|
4
|
+
|
|
5
|
+
1. **Software** — complaint-tracking microservice for a government portal.
|
|
6
|
+
2. **Research** — market research brief on algorithmic trading among Indian retail traders.
|
|
7
|
+
|
|
8
|
+
Each scenario shows example prompts, orchestrator responses at each phase, approval gates, and how `project_state` evolves.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Scenario A — Software: Complaint-Tracking Microservice
|
|
13
|
+
|
|
14
|
+
**Opening message from user**:
|
|
15
|
+
> Build a microservice that tracks user complaints with SLAs for an Indian government portal. The portal is Python/FastAPI. We use Postgres and RabbitMQ already.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### Phase 0 — Task Framing
|
|
20
|
+
|
|
21
|
+
**Orchestrator detects**: keywords `microservice`, `FastAPI`, `Postgres` → domain: `software`. New service → `greenfield`.
|
|
22
|
+
|
|
23
|
+
**Orchestrator response** (style: `qa_brief`):
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
I've detected this is a greenfield software task. Before I frame it precisely:
|
|
27
|
+
|
|
28
|
+
1. What SLA tiers do you need? (e.g., P1 = resolve in 24h, P2 = 72h, P3 = 7 days)
|
|
29
|
+
2. Who raises complaints — citizens via a web portal, internal staff, or both?
|
|
30
|
+
3. Is there an existing auth system, or does this service handle auth itself?
|
|
31
|
+
4. Should escalation notifications go via email, SMS, RabbitMQ events, or all three?
|
|
32
|
+
5. Any compliance requirements? (e.g., data residency, RTI Act audit trail)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**User answers**: 3 tiers (P1/P2/P3), citizens via web portal, existing JWT auth, email + RabbitMQ event, RTI Act audit trail required.
|
|
36
|
+
|
|
37
|
+
**Orchestrator produces `task_profile`**:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
## task_profile
|
|
41
|
+
- domain: software
|
|
42
|
+
- task_type: greenfield
|
|
43
|
+
- goal: Microservice to track citizen complaints with 3-tier SLAs, escalation, and RTI audit trail
|
|
44
|
+
- constraints: [Python 3.11, FastAPI, Postgres, RabbitMQ, existing JWT auth, RTI compliance]
|
|
45
|
+
- inputs_available: [existing auth service, RabbitMQ broker config]
|
|
46
|
+
- success_criteria: Complaints can be filed, tracked, escalated on SLA breach, and audited
|
|
47
|
+
- primary_agents: [architect_agent, code_agent, reviewer_agent]
|
|
48
|
+
- applicable_token_policy: generic_project_lifecycle.software
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Approval gate**:
|
|
52
|
+
```
|
|
53
|
+
Phase 0 complete. Artifact: task_profile
|
|
54
|
+
|
|
55
|
+
A) Approve — proceed to Phase 1 (Requirements)
|
|
56
|
+
B) Request changes
|
|
57
|
+
C) Change direction
|
|
58
|
+
```
|
|
59
|
+
*User: A*
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### Phase 1 — Requirements
|
|
64
|
+
|
|
65
|
+
**Architect/Planner Agent produces `requirements_spec`** (style: `requirements_spec`):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
## requirements_spec
|
|
69
|
+
|
|
70
|
+
### Goals
|
|
71
|
+
- Track complaints through lifecycle: Filed → Acknowledged → In Progress → Resolved → Closed
|
|
72
|
+
- Enforce SLA: P1=24h, P2=72h, P3=7 days; auto-escalate on breach
|
|
73
|
+
- Emit RabbitMQ event on status change and SLA breach
|
|
74
|
+
- RTI-compliant audit trail: every state change logged with actor + timestamp
|
|
75
|
+
|
|
76
|
+
### Non-Goals
|
|
77
|
+
- User authentication (existing JWT service handles this)
|
|
78
|
+
- Frontend UI (API only)
|
|
79
|
+
- Complaint categorisation / ML triage (future phase)
|
|
80
|
+
|
|
81
|
+
### Stakeholders
|
|
82
|
+
| Role | Need |
|
|
83
|
+
|---|---|
|
|
84
|
+
| Citizen | File and track complaint status |
|
|
85
|
+
| Portal Admin | View all complaints, override SLA tier |
|
|
86
|
+
| System (SLA job) | Escalate complaints that breach SLA |
|
|
87
|
+
| Compliance Officer | Audit trail export |
|
|
88
|
+
|
|
89
|
+
### Deliverables
|
|
90
|
+
| Deliverable | Acceptance criteria |
|
|
91
|
+
|---|---|
|
|
92
|
+
| REST API | All 7 endpoints functional, documented, auth-protected |
|
|
93
|
+
| SLA background job | Escalates within 5 min of breach; emits RabbitMQ event |
|
|
94
|
+
| Postgres schema | Complaint + audit_log tables with migration |
|
|
95
|
+
| Test suite | ≥80% line coverage; all SLA breach paths covered |
|
|
96
|
+
|
|
97
|
+
### Constraints
|
|
98
|
+
- [technical] Python 3.11, FastAPI, SQLAlchemy, Alembic, pytest
|
|
99
|
+
- [compliance] Every state change must be written to audit_log (RTI Act)
|
|
100
|
+
- [technical] No new infrastructure — use existing Postgres + RabbitMQ
|
|
101
|
+
- [time] MVP in 2 sprints
|
|
102
|
+
|
|
103
|
+
### Assumptions
|
|
104
|
+
- JWT tokens contain user_id and role claims
|
|
105
|
+
- RabbitMQ exchange `portal.events` already exists
|
|
106
|
+
- SLA clock starts at complaint creation time, not acknowledgment
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Approval gate**:
|
|
110
|
+
```
|
|
111
|
+
Phase 1 complete. Artifact: requirements_spec
|
|
112
|
+
|
|
113
|
+
A) Approve — proceed to Phase 2 (Solution Design)
|
|
114
|
+
B) Request changes — revise requirements_spec (specify what to change)
|
|
115
|
+
C) Change direction — restart Phase 1 with a different scope
|
|
116
|
+
D) Abort
|
|
117
|
+
```
|
|
118
|
+
User selects A.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### Phase 2 — Solution Design
|
|
123
|
+
|
|
124
|
+
**Architect/Planner Agent produces `solution_design`** (style: `solution_design`):
|
|
125
|
+
|
|
126
|
+
Key outputs (abbreviated):
|
|
127
|
+
|
|
128
|
+
**API Contract**:
|
|
129
|
+
| Method | Path | Description |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| POST | `/complaints` | File a new complaint |
|
|
132
|
+
| GET | `/complaints/{id}` | Get complaint detail + history |
|
|
133
|
+
| PATCH | `/complaints/{id}/status` | Update status (admin only) |
|
|
134
|
+
| POST | `/complaints/{id}/escalate` | Manual escalation |
|
|
135
|
+
| GET | `/complaints` | List with filters (status, tier, date range) |
|
|
136
|
+
| GET | `/complaints/{id}/audit` | RTI audit trail for a complaint |
|
|
137
|
+
| GET | `/health` | Liveness check |
|
|
138
|
+
|
|
139
|
+
**Data model**:
|
|
140
|
+
```sql
|
|
141
|
+
complaints (id, citizen_id, title, body, tier, status, created_at, resolved_at, escalated_at)
|
|
142
|
+
audit_log (id, complaint_id, actor_id, action, from_status, to_status, timestamp, metadata)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**SLA job design**: APScheduler task runs every 5 minutes; queries complaints where `status NOT IN ('resolved','closed')` and `NOW() - created_at > sla_threshold(tier)`; updates status to `escalated`, writes audit_log row, publishes `complaint.sla_breached` to RabbitMQ.
|
|
146
|
+
|
|
147
|
+
**ADR**: Use APScheduler (in-process) over a separate Celery worker — simpler ops for MVP; revisit if job volume exceeds 1000 complaints/run.
|
|
148
|
+
|
|
149
|
+
**Approval gate**:
|
|
150
|
+
```
|
|
151
|
+
Phase 2 complete. Artifact: solution_design
|
|
152
|
+
|
|
153
|
+
A) Approve — proceed to Phase 3 (Implementation)
|
|
154
|
+
B) Request changes — revise solution_design (specify section to change)
|
|
155
|
+
C) Change direction — restart Phase 2 with a different approach
|
|
156
|
+
D) Abort
|
|
157
|
+
```
|
|
158
|
+
User selects A.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### Phase 3 — Implementation (abbreviated)
|
|
163
|
+
|
|
164
|
+
**Code Agent proposes build order**:
|
|
165
|
+
1. Postgres models + Alembic migration
|
|
166
|
+
2. Repository layer (ComplaintRepository, AuditRepository)
|
|
167
|
+
3. Service layer (ComplaintService, SLAService)
|
|
168
|
+
4. API routes + dependencies
|
|
169
|
+
5. SLA background job
|
|
170
|
+
6. Test suite
|
|
171
|
+
|
|
172
|
+
Each increment delivered in `implementation_slice` format. Example (Increment 1):
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
## Increment 1: Postgres models + migration
|
|
176
|
+
|
|
177
|
+
Increment Plan
|
|
178
|
+
- This slice: SQLAlchemy models for complaints + audit_log; Alembic migration
|
|
179
|
+
- Depends on: approved data model from solution_design
|
|
180
|
+
- Next slice: Repository layer
|
|
181
|
+
|
|
182
|
+
[diff showing models/complaint.py, models/audit_log.py, migrations/001_initial.py]
|
|
183
|
+
|
|
184
|
+
What changed and why
|
|
185
|
+
- audit_log.metadata stored as JSONB for flexibility; RTI audit needs actor context that varies by action type
|
|
186
|
+
- complaint.escalated_at nullable; only set on SLA breach
|
|
187
|
+
|
|
188
|
+
Caveats
|
|
189
|
+
- Migration assumes Postgres 14+; check target environment version
|
|
190
|
+
|
|
191
|
+
build_log entry: "Increment 1 — Postgres models: complaints + audit_log tables, Alembic migration 001"
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
Approve this increment / request changes / change direction?
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Example: user requests changes on Increment 1**
|
|
198
|
+
|
|
199
|
+
> **User:** Request changes — add a `CHECK` constraint so `status` only allows known values, and index `complaints(citizen_id, created_at)` for the list query.
|
|
200
|
+
|
|
201
|
+
> **Orchestrator → Code Agent (Increment 1 revised):**
|
|
202
|
+
> ```
|
|
203
|
+
> ## Increment 1 (revised): Postgres models + migration
|
|
204
|
+
>
|
|
205
|
+
> Increment Plan
|
|
206
|
+
> - This slice: same as before + CHECK constraint on status + composite index
|
|
207
|
+
> - Depends on: approved data model from solution_design
|
|
208
|
+
> - Next slice: Repository layer (unchanged)
|
|
209
|
+
>
|
|
210
|
+
> + ALTER TABLE complaints ADD CONSTRAINT chk_status
|
|
211
|
+
> + CHECK (status IN ('open','in_review','escalated','resolved','closed'));
|
|
212
|
+
> + CREATE INDEX idx_complaints_citizen_created
|
|
213
|
+
> + ON complaints(citizen_id, created_at DESC);
|
|
214
|
+
>
|
|
215
|
+
> What changed and why
|
|
216
|
+
> - CHECK constraint enforces the domain enum at the DB layer; cheaper than application-only validation
|
|
217
|
+
> - Composite index covers the GET /complaints list query filter used by citizen dashboards
|
|
218
|
+
>
|
|
219
|
+
> build_log entry: "Increment 1 (revised) — models + migration + status constraint + list index"
|
|
220
|
+
>
|
|
221
|
+
> ---
|
|
222
|
+
> Approve this increment / request changes / change direction?
|
|
223
|
+
> ```
|
|
224
|
+
|
|
225
|
+
User approves. Code Agent continues to Increment 2.
|
|
226
|
+
|
|
227
|
+
**project_state after Phase 3** (abbreviated):
|
|
228
|
+
```
|
|
229
|
+
current_phase: review_refinement
|
|
230
|
+
build_log:
|
|
231
|
+
- Increment 1: Postgres models + migration
|
|
232
|
+
- Increment 2: Repository layer (ComplaintRepository, AuditRepository)
|
|
233
|
+
- Increment 3: Service layer with SLA logic
|
|
234
|
+
- Increment 4: API routes + JWT dependency injection
|
|
235
|
+
- Increment 5: APScheduler SLA job
|
|
236
|
+
- Increment 6: pytest suite (87% line coverage)
|
|
237
|
+
key_decisions:
|
|
238
|
+
- APScheduler over Celery (Turn 9, ADR approved)
|
|
239
|
+
- SLA clock starts at created_at not acknowledged_at (Turn 4)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### Phase 4 — Review
|
|
245
|
+
|
|
246
|
+
**Reviewer Agent produces `refinement_report`** (abbreviated):
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
Verdict: minor_revisions_needed
|
|
250
|
+
Summary: 0 critical, 2 high, 3 medium, 1 low
|
|
251
|
+
|
|
252
|
+
| Severity | Area | Issue | Recommendation |
|
|
253
|
+
|---|---|---|---|
|
|
254
|
+
| high | security | PATCH /complaints/{id}/status has no ownership check — any admin can update any complaint | Add portal_id scoping to ComplaintRepository.get() |
|
|
255
|
+
| high | correctness | SLA job does not handle complaints created before service deployed (missing backfill guard) | Add WHERE created_at >= service_start_date config var |
|
|
256
|
+
| medium | test_coverage | No test for concurrent SLA escalation (race condition) | Add test using threading.Barrier |
|
|
257
|
+
| medium | correctness | audit_log.metadata not validated — None can be inserted | Add NOT NULL DEFAULT '{}' to migration |
|
|
258
|
+
| medium | compliance | audit_log has no index on complaint_id — RTI export query will be slow at scale | Add index idx_audit_log_complaint_id |
|
|
259
|
+
| low | readability | SLAService.check_and_escalate() is 60 lines — extract _compute_breach() helper | Refactor for testability |
|
|
260
|
+
|
|
261
|
+
Positive Findings
|
|
262
|
+
- Repository layer cleanly separates data access from business logic
|
|
263
|
+
- All 7 endpoints protected with JWT dependency; consistent error shape across routes
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Code Agent applies fixes. Reviewer confirms: "All critical and high findings resolved. Ready for handoff."
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### Phase 5 — Handoff
|
|
271
|
+
|
|
272
|
+
**`handoff_package`**:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
## Summary
|
|
276
|
+
- Complaint-tracking microservice: 7 REST endpoints, 3-tier SLA enforcement, RTI audit trail
|
|
277
|
+
- Tech: FastAPI + SQLAlchemy + APScheduler + RabbitMQ publisher
|
|
278
|
+
- Test coverage: 91% line coverage after Phase 4 fixes
|
|
279
|
+
|
|
280
|
+
## How to Deploy
|
|
281
|
+
1. Set env vars: DATABASE_URL, RABBITMQ_URL, JWT_SECRET, SLA_SERVICE_START_DATE
|
|
282
|
+
2. Run: alembic upgrade head
|
|
283
|
+
3. Start: uvicorn app:app --host 0.0.0.0 --port 8000
|
|
284
|
+
|
|
285
|
+
## What's Done
|
|
286
|
+
- All 7 endpoints (see API contract in solution_design)
|
|
287
|
+
- SLA job (runs every 5 min; breach → escalated status + audit_log + RabbitMQ event)
|
|
288
|
+
- Full RTI audit trail with JSONB metadata
|
|
289
|
+
|
|
290
|
+
## What's Next
|
|
291
|
+
P1 (must do before production):
|
|
292
|
+
- Load test SLA job with 10K+ complaints to validate APScheduler at scale
|
|
293
|
+
- Add complaint_id to JWT scope validation (portal multi-tenancy)
|
|
294
|
+
|
|
295
|
+
P2 (strongly recommended):
|
|
296
|
+
- Add GET /complaints export endpoint for bulk RTI requests
|
|
297
|
+
- Add RabbitMQ consumer for complaint acknowledgment from field teams
|
|
298
|
+
|
|
299
|
+
P3 (future enhancement):
|
|
300
|
+
- ML complaint triage (auto-assign tier based on text)
|
|
301
|
+
- Citizen-facing status push notifications
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**project_state evolution summary**:
|
|
305
|
+
| Turn | Milestone |
|
|
306
|
+
|---|---|
|
|
307
|
+
| 3 | task_profile confirmed |
|
|
308
|
+
| 6 | requirements_spec approved |
|
|
309
|
+
| 10 | solution_design approved (ADR for APScheduler) |
|
|
310
|
+
| 21 | All 6 implementation increments approved |
|
|
311
|
+
| 24 | refinement_report: 2 high fixed |
|
|
312
|
+
| 26 | handoff_package confirmed |
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Scenario B — Research: Algorithmic Trading Market Brief
|
|
319
|
+
|
|
320
|
+
**Opening message from user**:
|
|
321
|
+
> Write a 5-page market research brief on algorithmic trading adoption among Indian retail traders. Audience is fintech analysts. Public sources only.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### Phase 0 — Task Framing
|
|
326
|
+
|
|
327
|
+
**Orchestrator detects**: "market research brief", "adoption", "Indian retail traders" → domain: `research`, type: `greenfield`.
|
|
328
|
+
|
|
329
|
+
**Orchestrator response** (style: `qa_brief`):
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
1. 5 pages — roughly 2,500 words or formatted PDF pages?
|
|
333
|
+
2. Should this cover only retail adoption, or also compare with institutional algo trading?
|
|
334
|
+
3. Key timeframe: current state (2024–2025), or historical trend since SEBI first allowed algos?
|
|
335
|
+
4. Any specific angle you want emphasised — technology, regulation, platforms, or barriers?
|
|
336
|
+
5. Should I include a recommendations section, or findings + outlook only?
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**User**: ~2,500 words, retail only, current state + near-term outlook, barriers + regulation most important, findings + outlook only (no recommendations).
|
|
340
|
+
|
|
341
|
+
**`task_profile`**:
|
|
342
|
+
```
|
|
343
|
+
## task_profile
|
|
344
|
+
- domain: research
|
|
345
|
+
- task_type: greenfield
|
|
346
|
+
- goal: 2,500-word brief on algo trading adoption among Indian retail traders (barriers + regulation focus)
|
|
347
|
+
- constraints: [public sources only, fintech analyst audience, professional tone, findings + outlook only]
|
|
348
|
+
- inputs_available: []
|
|
349
|
+
- success_criteria: Brief covers adoption rate, barriers, regulatory landscape, platform comparison, and near-term outlook with cited public sources
|
|
350
|
+
- primary_agents: [architect_agent, execution_agent, reviewer_agent]
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### Phase 1 — Requirements
|
|
356
|
+
|
|
357
|
+
**`requirements_spec`** (abbreviated):
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
### Goals
|
|
361
|
+
- Quantify retail algo trading adoption where public data allows
|
|
362
|
+
- Identify primary barriers to wider adoption
|
|
363
|
+
- Summarise SEBI's regulatory framework and recent changes
|
|
364
|
+
- Compare 2–3 major platforms enabling retail algo trading
|
|
365
|
+
- Provide a near-term (12–18 month) outlook
|
|
366
|
+
|
|
367
|
+
### Non-Goals
|
|
368
|
+
- Institutional or HFT algo trading
|
|
369
|
+
- Recommendations for investors or platforms
|
|
370
|
+
- Primary research (surveys, interviews)
|
|
371
|
+
|
|
372
|
+
### Constraints
|
|
373
|
+
- [compliance] Public sources only; cite every factual claim
|
|
374
|
+
- [tone] Professional, data-driven; avoid advocacy language
|
|
375
|
+
- [length] 2,400–2,600 words across 7 sections
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
### Phase 2 — Solution Design
|
|
381
|
+
|
|
382
|
+
**Architect/Planner Agent produces `solution_design`** — document outline + research plan:
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
## solution_design
|
|
386
|
+
|
|
387
|
+
### Context
|
|
388
|
+
Indian retail participation in algorithmic trading has grown significantly post-SEBI's 2012 framework,
|
|
389
|
+
but penetration remains low relative to total retail investors. This brief maps the current landscape
|
|
390
|
+
for a fintech analyst audience.
|
|
391
|
+
|
|
392
|
+
### Approach
|
|
393
|
+
Desk research using SEBI circulars, NSE/BSE statistics, fintech industry reports (NASSCOM, BCG),
|
|
394
|
+
and major financial press (Economic Times, Mint). Analysis framework: PESTLE for barrier analysis.
|
|
395
|
+
|
|
396
|
+
### Structure (Document Outline)
|
|
397
|
+
1. Executive Summary (drafted last, ~200 words)
|
|
398
|
+
2. Market Size & Adoption Rate (~350 words) — quantitative data on retail algo trader count
|
|
399
|
+
3. Key Adoption Drivers (~350 words) — smartphone penetration, discount brokers, API availability
|
|
400
|
+
4. Barriers to Wider Adoption (~450 words) — PESTLE analysis: tech literacy, capital, regulation, trust
|
|
401
|
+
5. Regulatory Landscape (~400 words) — SEBI framework, algo approval process, 2022 circular
|
|
402
|
+
6. Platform Comparison (~350 words) — Zerodha Streak, Upstox Pro, Angel One SmartAPI
|
|
403
|
+
7. Near-Term Outlook (~400 words) — SEBI sandbox, institutional spillover, UPI/ONDC implications
|
|
404
|
+
8. Executive Summary (return to draft after sections 2–7 complete)
|
|
405
|
+
|
|
406
|
+
### Research Questions
|
|
407
|
+
- RQ1: How many Indian retail investors currently use algo trading? (Section 2)
|
|
408
|
+
- RQ2: What factors have driven adoption? (Section 3)
|
|
409
|
+
- RQ3: What prevents wider adoption? (Section 4, PESTLE)
|
|
410
|
+
- RQ4: What does SEBI's current framework permit and restrict? (Section 5)
|
|
411
|
+
- RQ5: How do the top 3 platforms compare on accessibility and feature depth? (Section 6)
|
|
412
|
+
- RQ6: What will shape adoption in the next 12–18 months? (Section 7)
|
|
413
|
+
|
|
414
|
+
### Risks & Open Questions
|
|
415
|
+
1. Public data on retail algo trader count is sparse — may need to use proxy metrics (API activations, platform disclosures)
|
|
416
|
+
2. Platform comparison data may be outdated if pricing changed post-research date
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
### Phase 3 — Drafting (abbreviated)
|
|
422
|
+
|
|
423
|
+
**Execution Agent proposes draft order**: Sections 2 → 3 → 4 → 5 → 6 → 7 → 1 (Executive Summary last).
|
|
424
|
+
|
|
425
|
+
**Increment 3 example** (Barriers section):
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
## Increment 3: Section 4 — Barriers to Wider Adoption
|
|
429
|
+
|
|
430
|
+
Increment Plan
|
|
431
|
+
- This slice: PESTLE analysis of adoption barriers (~450 words)
|
|
432
|
+
- Depends on: Approved Sections 2 and 3 (for context references)
|
|
433
|
+
- Next slice: Section 5 — Regulatory Landscape
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## 4. Barriers to Wider Adoption
|
|
438
|
+
|
|
439
|
+
Despite favourable macro conditions, algo trading penetration among Indian retail investors
|
|
440
|
+
remains below 1% of active equity traders (Source: NSE, 2024). A PESTLE analysis reveals
|
|
441
|
+
barriers across six dimensions.
|
|
442
|
+
|
|
443
|
+
**Political / Regulatory**: SEBI's 2022 circular requires all third-party algo strategies to be
|
|
444
|
+
approved by exchanges before deployment. [DATA: Exact approval timeline from NSE not publicly
|
|
445
|
+
disclosed.] This has deterred smaller platforms from launching algo marketplaces...
|
|
446
|
+
|
|
447
|
+
[CONFLICT: BCG 2023 estimates 0.8% penetration; NASSCOM 2024 cites "less than 2%" — using
|
|
448
|
+
the more conservative BCG figure given it is methodology-documented.]
|
|
449
|
+
|
|
450
|
+
...
|
|
451
|
+
|
|
452
|
+
**build_log entry**: "Increment 3 — Section 4 (Barriers): PESTLE analysis, 447 words, 4 sources cited, 1 data gap flagged"
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
Approve this increment / request changes / change direction?
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### Phase 4 — Review
|
|
461
|
+
|
|
462
|
+
**Reviewer Agent `refinement_report`** (abbreviated):
|
|
463
|
+
|
|
464
|
+
```
|
|
465
|
+
Verdict: minor_revisions_needed
|
|
466
|
+
Summary: 0 critical, 1 high, 2 medium, 1 low
|
|
467
|
+
|
|
468
|
+
| Severity | Area | Issue | Recommendation |
|
|
469
|
+
|---|---|---|---|
|
|
470
|
+
| high | research | Section 5 (Regulatory) describes the 2012 framework but does not mention SEBI's 2024 consultation paper on algo trading — significant omission for "current state" framing | Add paragraph on 2024 consultation paper and its implications |
|
|
471
|
+
| medium | content | Executive Summary written before Section 7 was finalised; Outlook summary does not match Section 7 content | Revise Executive Summary after Section 7 approval |
|
|
472
|
+
| medium | style | "Proliferation" used 4 times across sections 2 and 3 — noticeable repetition | Vary vocabulary |
|
|
473
|
+
| low | citations | Section 6 platform comparison cites "platform website, 2024" — should use specific page title | Improve citation specificity |
|
|
474
|
+
|
|
475
|
+
Positive Findings
|
|
476
|
+
- PESTLE framework in Section 4 is well-structured and consistently applied
|
|
477
|
+
- Data gap flags ([DATA:] and [CONFLICT:]) are used correctly — reviewer can identify unverified claims immediately
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Execution Agent applies fixes. Reviewer confirms ready for handoff.
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
### Phase 5 — Handoff
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
## Summary
|
|
488
|
+
- 2,580-word market research brief on Indian retail algo trading
|
|
489
|
+
- Covers: market size, adoption drivers, barriers (PESTLE), SEBI regulation, platform comparison, 12-month outlook
|
|
490
|
+
- 18 public sources cited; 2 data gaps explicitly flagged for further verification
|
|
491
|
+
|
|
492
|
+
## What's Done
|
|
493
|
+
- All 7 sections drafted and reviewed
|
|
494
|
+
- 2024 SEBI consultation paper incorporated (Phase 4 fix)
|
|
495
|
+
|
|
496
|
+
## What's Next
|
|
497
|
+
P1 (before distribution):
|
|
498
|
+
- Verify the 2 [DATA:] placeholders with primary sources or remove them
|
|
499
|
+
- Legal review if distributing to regulated entities (investment advice boundary)
|
|
500
|
+
|
|
501
|
+
P2 (strongly recommended):
|
|
502
|
+
- Commission a 1-page visual summary (charts: adoption rate trend, PESTLE heatmap)
|
|
503
|
+
- Refresh platform comparison data quarterly
|
|
504
|
+
|
|
505
|
+
P3 (future research):
|
|
506
|
+
- Primary research: survey 200 retail traders on top 3 barriers to validate PESTLE findings
|
|
507
|
+
- Deep-dive on SEBI 2024 consultation paper outcomes once finalised
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
**project_state evolution summary**:
|
|
511
|
+
| Turn | Milestone |
|
|
512
|
+
|---|---|
|
|
513
|
+
| 3 | task_profile confirmed |
|
|
514
|
+
| 5 | requirements_spec approved |
|
|
515
|
+
| 7 | solution_design approved (7-section outline + PESTLE framework) |
|
|
516
|
+
| 16 | All 7 section drafts approved (Sections 2–7 + Executive Summary) |
|
|
517
|
+
| 19 | refinement_report: 1 high fixed (2024 SEBI paper added) |
|
|
518
|
+
| 21 | handoff_package confirmed |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Proof-of-value experiments
|
|
2
|
+
|
|
3
|
+
Reproducible before/after comparisons: the same task run through the **same
|
|
4
|
+
model** as (1) a **naive** prompt (raw task) and (2) the **agents-maker
|
|
5
|
+
structured** prompt (`generate_prompt.py --full`). Generated by
|
|
6
|
+
[`tools/compare_prompts.py`](../../tools/compare_prompts.py).
|
|
7
|
+
|
|
8
|
+
Goal: replace "trust me, structure helps" with evidence — including evidence
|
|
9
|
+
that it *doesn't*, where that's what the data shows.
|
|
10
|
+
|
|
11
|
+
## How to reproduce
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Uses the Claude Code CLI (claude -p) by default — no API key needed.
|
|
15
|
+
python tools/compare_prompts.py "[domain: ops_process] write a runbook for Redis failover"
|
|
16
|
+
|
|
17
|
+
# Or point it at any provider that reads a prompt on stdin:
|
|
18
|
+
python tools/compare_prompts.py "your task" --runner "llm -m gpt-4o"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Each run writes `naive_prompt.txt`, `structured_prompt.txt`, `naive_output.md`,
|
|
22
|
+
`structured_output.md` to a per-task folder here.
|
|
23
|
+
|
|
24
|
+
## ⚠️ Methodology caveat (read before trusting numbers)
|
|
25
|
+
|
|
26
|
+
The default runner is `claude -p` (Claude Code), which is an **environment-aware
|
|
27
|
+
agent**, not a raw chat completion. It inspects its working directory, so the
|
|
28
|
+
harness runs it in an **isolated empty temp dir** to stop it from reading this
|
|
29
|
+
repo. Even so, an empty cwd is itself a signal the agent reacts to. **For a
|
|
30
|
+
clean, publishable comparison, run with a raw-API runner** (`messages.create` /
|
|
31
|
+
`chat.completions`) so the only variable is the prompt. The findings below are
|
|
32
|
+
therefore *preliminary*.
|
|
33
|
+
|
|
34
|
+
## Findings
|
|
35
|
+
|
|
36
|
+
Two runs matter for the verdict — **how the prompt is composed changes the result.**
|
|
37
|
+
|
|
38
|
+
### Round 1 — single-blob paste via an agent CLI (`claude -p`): FAILED
|
|
39
|
+
|
|
40
|
+
`generate_prompt.py --full` concatenates the entire system prompt **and** the
|
|
41
|
+
task into one message. An agent-style runner (`claude -p`) reads that blob as
|
|
42
|
+
onboarding — "here's my setup, I'm ready, what do you want?" — and the `## Task`
|
|
43
|
+
is ignored. The structured prompt **greeted instead of doing the task**, while
|
|
44
|
+
the naive prompt produced an excellent runbook. This exposed real defects, since
|
|
45
|
+
fixed:
|
|
46
|
+
1. **Direct Task Mode** added to `agents/orchestrator.md` as the default.
|
|
47
|
+
2. **Forced-domain override made imperative** (`[domain: X]` never → `unknown`).
|
|
48
|
+
3. **Execute-now directive** appended by `generate_prompt.py`.
|
|
49
|
+
|
|
50
|
+
### Round 2 — role-separated API (how the kit is meant to run): STRUCTURE WINS
|
|
51
|
+
|
|
52
|
+
Re-run with `--api` (system prompt in the `system` field, task+context as the
|
|
53
|
+
`user` message), model `claude-haiku-4-5`. The structured prompt now **executes**
|
|
54
|
+
and adds domain-appropriate structure the naive prompt lacks:
|
|
55
|
+
|
|
56
|
+
| Task (domain) | Naive | Structured (agents-maker) |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| Redis failover runbook (`ops_process`) | Solid technical how-to (commands, escalation) | Same technical depth **plus** a numbered step table with Actor/Tool/Output, a full **RACI matrix**, an **Exception Paths** table, and SLA/actors — i.e. the `write_process_map` skill contract |
|
|
59
|
+
| ISO-8601 duration parser (`software`) | Impl + `unittest` tests | Impl + idiomatic **pytest** with **more edge cases** (invalid/empty/negative/overflow), a "What changed and why" section, **Run the tests** instructions, and a **[Companion]** next-steps block — the `code_agent`+`write_tests` contract |
|
|
60
|
+
|
|
61
|
+
In both, the structured output opened by recognizing a self-contained task and
|
|
62
|
+
delivering immediately (Direct Task Mode working), then layered on the domain's
|
|
63
|
+
format and accountability/coverage that the naive answer omitted.
|
|
64
|
+
|
|
65
|
+
### Round 3 — blind adversarial grade
|
|
66
|
+
|
|
67
|
+
Both pairs were then graded by a **different, impartial judge model**
|
|
68
|
+
(`claude-haiku-4-5`) with the two responses **anonymized A/B** (order fixed by a
|
|
69
|
+
per-folder hash, so it's blind but reproducible). See each folder's `grade.md`
|
|
70
|
+
and reproduce with `tools/grade_proof.py`.
|
|
71
|
+
|
|
72
|
+
| Task | completeness | correctness | actionability | structure | total | winner |
|
|
73
|
+
|---|---|---|---|---|---|---|
|
|
74
|
+
| Redis runbook — naive | 4 | 4 | **5** | 4 | 17 | |
|
|
75
|
+
| Redis runbook — **structured** | 5 | 5 | 4 | 5 | **19** | ✅ structured |
|
|
76
|
+
| ISO parser — naive | 5 | 5 | 4 | 4 | 18 | |
|
|
77
|
+
| ISO parser — **structured** | 5 | 5 | 5 | 5 | **20** | ✅ structured |
|
|
78
|
+
|
|
79
|
+
Structured won both, and the win is **nuanced, not a blowout**: it leads on
|
|
80
|
+
completeness / correctness / structure, while the naive runbook actually scored
|
|
81
|
+
*higher on actionability* (it packed in more raw commands). The judge's stated
|
|
82
|
+
reasons matched the kit's design intent — RACI/exception governance for ops,
|
|
83
|
+
pytest + next-steps for software.
|
|
84
|
+
|
|
85
|
+
(Judge caveat: same model *family* as the one that produced the outputs, so a
|
|
86
|
+
mild self-preference bias can't be fully excluded; a cross-vendor judge would be
|
|
87
|
+
stronger.)
|
|
88
|
+
|
|
89
|
+
### Honest verdict + caveats
|
|
90
|
+
|
|
91
|
+
- **When run as designed (role-separated), the structuring adds real, visible
|
|
92
|
+
value** — domain-appropriate format, RACI/exception handling, richer test
|
|
93
|
+
coverage, and a next-steps block. That's a genuine win over a strong naive
|
|
94
|
+
baseline.
|
|
95
|
+
- **When pasted as one blob into an agent, it underperforms** — use the API /
|
|
96
|
+
system-role path (`platforms/claude.md` Option A), not `--full` into a CLI.
|
|
97
|
+
- **Caveats:** small n (2 tasks, 1 model, Haiku); results not adversarially
|
|
98
|
+
graded. And the full system prompt is **~29k input tokens**, which tripped a
|
|
99
|
+
10k-tokens/minute account rate limit — a real **cost/latency** consideration
|
|
100
|
+
worth optimizing (trim or lazy-load skills).
|
|
101
|
+
|
|
102
|
+
Reproduce:
|
|
103
|
+
```bash
|
|
104
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
105
|
+
python tools/compare_prompts.py "[domain: ops_process] write a Redis failover runbook" --api
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Cost / token optimization
|
|
109
|
+
|
|
110
|
+
The full system prompt (all 8 agents + 12 skills) is ~30k input tokens per call —
|
|
111
|
+
the cost/latency issue the grading surfaced. Two levers now reduce it:
|
|
112
|
+
|
|
113
|
+
1. **Task-scoped (lazy-loaded) system prompt.** `generate_prompt.py --full` and
|
|
114
|
+
`--system-only` now inline only the agents + skills the **detected domain**
|
|
115
|
+
uses, not the whole kit (`tools/routing.py:domain_agents`). Measured:
|
|
116
|
+
|
|
117
|
+
| System prompt | chars | ~tokens |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| Full kit (`system_prompt.md`) | 120,599 | ~30,100 |
|
|
120
|
+
| Scoped — `software` | 104,763 | ~26,200 |
|
|
121
|
+
| Scoped — `ops_process` / `content` | 74,320 | ~18,600 |
|
|
122
|
+
|
|
123
|
+
Quality is preserved because domain scoping only drops *other* domains'
|
|
124
|
+
specialists — the ones that added value (e.g. `write_process_map` for ops,
|
|
125
|
+
`write_tests` for software) are still included.
|
|
126
|
+
|
|
127
|
+
2. **Prompt caching.** `compare_prompts.py --api` marks the system prompt with
|
|
128
|
+
`cache_control: ephemeral`, so after the first call repeats read it at ~0.1x
|
|
129
|
+
input cost (usage is printed per call).
|
|
130
|
+
|
|
131
|
+
**Honest limits:** scoping helps most for non-software domains; `software`
|
|
132
|
+
legitimately uses most specialists, so it stays heavy (~26k tokens). Getting
|
|
133
|
+
under a small (e.g. 10k tokens/min) account tier would require either a higher
|
|
134
|
+
tier, caching (cost only, not first-call rate limit), or trimming the verbose
|
|
135
|
+
agent/skill specs — flagged as future work. A live re-run of the scoped+cached
|
|
136
|
+
path wasn't completed here because the test API key was rotated mid-session; the
|
|
137
|
+
scoping change is covered by the unit suite (60/60) and only removes
|
|
138
|
+
non-domain content, so the graded ops result above is unaffected.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Blind grade — implement-a-python-function-that-parses-an-iso-8
|
|
2
|
+
|
|
3
|
+
- **Judge:** `claude-haiku-4-5-20251001` (different model than the one that produced the outputs)
|
|
4
|
+
- **Blind mapping:** structured = Response A
|
|
5
|
+
- **Winner:** **structured**
|
|
6
|
+
- **Reason:** Response A provides better project organization (separate files), uses pytest (industry standard), includes more detailed test documentation, and offers clear next-step guidance, while Response B embeds tests in a single file with unittest and lacks actionable follow-up direction.
|
|
7
|
+
|
|
8
|
+
| Criterion | naive | structured |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| completeness | 5 | 5 |
|
|
11
|
+
| correctness | 5 | 5 |
|
|
12
|
+
| actionability | 4 | 5 |
|
|
13
|
+
| structure | 4 | 5 |
|
|
14
|
+
| **total** | **18** | **20** |
|