agentsys 5.3.0 → 5.3.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor/commands/audit-project-agents.md +454 -0
- package/.cursor/commands/audit-project-github.md +141 -0
- package/.cursor/commands/audit-project.md +330 -0
- package/.cursor/commands/consult.md +417 -0
- package/.cursor/commands/debate.md +381 -0
- package/.cursor/commands/delivery-approval.md +334 -0
- package/.cursor/commands/deslop.md +142 -0
- package/.cursor/commands/drift-detect.md +259 -0
- package/.cursor/commands/enhance.md +172 -0
- package/.cursor/commands/learn.md +165 -0
- package/.cursor/commands/next-task.md +519 -0
- package/.cursor/commands/perf.md +464 -0
- package/.cursor/commands/repo-map.md +124 -0
- package/.cursor/commands/ship-ci-review-loop.md +468 -0
- package/.cursor/commands/ship-deployment.md +348 -0
- package/.cursor/commands/ship-error-handling.md +265 -0
- package/.cursor/commands/ship.md +517 -0
- package/.cursor/commands/sync-docs.md +171 -0
- package/.cursor/commands/web-ctl.md +101 -0
- package/.cursor/skills/consult/SKILL.md +425 -0
- package/.cursor/skills/debate/SKILL.md +316 -0
- package/.cursor/skills/deslop/SKILL.md +204 -0
- package/.cursor/skills/discover-tasks/SKILL.md +297 -0
- package/.cursor/skills/drift-analysis/SKILL.md +324 -0
- package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
- package/.cursor/skills/enhance-docs/SKILL.md +298 -0
- package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
- package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
- package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
- package/.cursor/skills/enhance-skills/SKILL.md +436 -0
- package/.cursor/skills/learn/SKILL.md +349 -0
- package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
- package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
- package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
- package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
- package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.cursor/skills/perf-profiler/SKILL.md +42 -0
- package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
- package/.cursor/skills/repo-mapping/SKILL.md +83 -0
- package/.cursor/skills/sync-docs/SKILL.md +351 -0
- package/.cursor/skills/validate-delivery/SKILL.md +186 -0
- package/.cursor/skills/web-auth/SKILL.md +177 -0
- package/.cursor/skills/web-browse/SKILL.md +516 -0
- package/.kiro/agents/agent-enhancer.json +12 -0
- package/.kiro/agents/ci-fixer.json +13 -0
- package/.kiro/agents/ci-monitor.json +12 -0
- package/.kiro/agents/claudemd-enhancer.json +12 -0
- package/.kiro/agents/consult-agent.json +13 -0
- package/.kiro/agents/cross-file-enhancer.json +12 -0
- package/.kiro/agents/debate-orchestrator.json +13 -0
- package/.kiro/agents/delivery-validator.json +12 -0
- package/.kiro/agents/deslop-agent.json +12 -0
- package/.kiro/agents/docs-enhancer.json +12 -0
- package/.kiro/agents/exploration-agent.json +12 -0
- package/.kiro/agents/hooks-enhancer.json +11 -0
- package/.kiro/agents/implementation-agent.json +13 -0
- package/.kiro/agents/learn-agent.json +12 -0
- package/.kiro/agents/map-validator.json +11 -0
- package/.kiro/agents/perf-analyzer.json +12 -0
- package/.kiro/agents/perf-code-paths.json +11 -0
- package/.kiro/agents/perf-investigation-logger.json +12 -0
- package/.kiro/agents/perf-orchestrator.json +13 -0
- package/.kiro/agents/perf-theory-gatherer.json +12 -0
- package/.kiro/agents/perf-theory-tester.json +13 -0
- package/.kiro/agents/plan-synthesizer.json +12 -0
- package/.kiro/agents/planning-agent.json +12 -0
- package/.kiro/agents/plugin-enhancer.json +12 -0
- package/.kiro/agents/prompt-enhancer.json +12 -0
- package/.kiro/agents/reviewer-perf-test.json +11 -0
- package/.kiro/agents/reviewer-quality-security.json +11 -0
- package/.kiro/agents/simple-fixer.json +13 -0
- package/.kiro/agents/skills-enhancer.json +11 -0
- package/.kiro/agents/sync-docs-agent.json +13 -0
- package/.kiro/agents/task-discoverer.json +12 -0
- package/.kiro/agents/test-coverage-checker.json +12 -0
- package/.kiro/agents/web-session.json +12 -0
- package/.kiro/agents/worktree-manager.json +13 -0
- package/.kiro/skills/consult/SKILL.md +425 -0
- package/.kiro/skills/debate/SKILL.md +316 -0
- package/.kiro/skills/deslop/SKILL.md +204 -0
- package/.kiro/skills/discover-tasks/SKILL.md +297 -0
- package/.kiro/skills/drift-analysis/SKILL.md +324 -0
- package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
- package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
- package/.kiro/skills/enhance-docs/SKILL.md +298 -0
- package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
- package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
- package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
- package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
- package/.kiro/skills/enhance-skills/SKILL.md +436 -0
- package/.kiro/skills/learn/SKILL.md +349 -0
- package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
- package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
- package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
- package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
- package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
- package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
- package/.kiro/skills/perf-profiler/SKILL.md +42 -0
- package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
- package/.kiro/skills/repo-mapping/SKILL.md +83 -0
- package/.kiro/skills/sync-docs/SKILL.md +351 -0
- package/.kiro/skills/validate-delivery/SKILL.md +186 -0
- package/.kiro/skills/web-auth/SKILL.md +177 -0
- package/.kiro/skills/web-browse/SKILL.md +516 -0
- package/.kiro/steering/audit-project-agents.md +459 -0
- package/.kiro/steering/audit-project-github.md +146 -0
- package/.kiro/steering/audit-project.md +330 -0
- package/.kiro/steering/consult.md +422 -0
- package/.kiro/steering/debate.md +386 -0
- package/.kiro/steering/delivery-approval.md +339 -0
- package/.kiro/steering/deslop.md +149 -0
- package/.kiro/steering/drift-detect.md +264 -0
- package/.kiro/steering/enhance.md +177 -0
- package/.kiro/steering/learn.md +166 -0
- package/.kiro/steering/next-task.md +481 -0
- package/.kiro/steering/perf.md +469 -0
- package/.kiro/steering/repo-map.md +126 -0
- package/.kiro/steering/ship-ci-review-loop.md +473 -0
- package/.kiro/steering/ship-deployment.md +353 -0
- package/.kiro/steering/ship-error-handling.md +270 -0
- package/.kiro/steering/ship.md +522 -0
- package/.kiro/steering/sync-docs.md +178 -0
- package/.kiro/steering/web-ctl.md +106 -0
- package/CHANGELOG.md +15 -0
- package/bin/cli.js +2 -2
- package/lib/adapter-transforms.js +34 -2
- package/package.json +1 -1
- package/site/content.json +1 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: learn
|
|
3
|
+
description: "Research any topic online and create learning guides. Use when user asks to 'learn about', 'research topic', 'create learning guide', 'build knowledge base', or 'study subject'."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
argument-hint: "[topic] [--depth=brief|medium|deep]"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# learn
|
|
9
|
+
|
|
10
|
+
Research any topic by gathering online resources and creating a comprehensive learning guide with RAG-optimized indexes.
|
|
11
|
+
|
|
12
|
+
## Parse Arguments
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
|
|
16
|
+
const depth = args.find(a => a.startsWith('--depth='))?.split('=')[1] || 'medium';
|
|
17
|
+
const topic = args.filter(a => !a.startsWith('--')).join(' ');
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Input
|
|
21
|
+
|
|
22
|
+
Arguments: `<topic> [--depth=brief|medium|deep]`
|
|
23
|
+
|
|
24
|
+
- **topic**: Subject to research (required)
|
|
25
|
+
- **--depth**: Source gathering depth
|
|
26
|
+
- `brief`: 10 sources (quick overview)
|
|
27
|
+
- `medium`: 20 sources (default, balanced)
|
|
28
|
+
- `deep`: 40 sources (comprehensive)
|
|
29
|
+
|
|
30
|
+
## Research Methodology
|
|
31
|
+
|
|
32
|
+
Based on best practices from:
|
|
33
|
+
- Anthropic's Context Engineering
|
|
34
|
+
- DeepLearning.AI Tool Use Patterns
|
|
35
|
+
- Anara's AI Literature Reviews
|
|
36
|
+
|
|
37
|
+
### 1. Progressive Query Architecture
|
|
38
|
+
|
|
39
|
+
Use funnel approach to avoid noise from long query lists:
|
|
40
|
+
|
|
41
|
+
**Broad Phase** (landscape mapping):
|
|
42
|
+
```
|
|
43
|
+
"{topic} overview introduction"
|
|
44
|
+
"{topic} documentation official"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Focused Phase** (core content):
|
|
48
|
+
```
|
|
49
|
+
"{topic} best practices"
|
|
50
|
+
"{topic} examples tutorial"
|
|
51
|
+
"{topic} site:stackoverflow.com"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Deep Phase** (advanced, if depth=deep):
|
|
55
|
+
```
|
|
56
|
+
"{topic} advanced techniques"
|
|
57
|
+
"{topic} pitfalls mistakes avoid"
|
|
58
|
+
"{topic} 2025 2026 latest"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. Source Quality Scoring
|
|
62
|
+
|
|
63
|
+
Multi-dimensional evaluation (max score: 100):
|
|
64
|
+
|
|
65
|
+
| Factor | Weight | Max | Criteria |
|
|
66
|
+
|--------|--------|-----|----------|
|
|
67
|
+
| Authority | 3x | 30 | Official docs (10), recognized expert (8), established site (6), blog (4), random (2) |
|
|
68
|
+
| Recency | 2x | 20 | <6mo (10), <1yr (8), <2yr (6), <3yr (4), older (2) |
|
|
69
|
+
| Depth | 2x | 20 | Comprehensive (10), detailed (8), overview (6), superficial (4), fragment (2) |
|
|
70
|
+
| Examples | 2x | 20 | Multiple code examples (10), one example (6), no examples (2) |
|
|
71
|
+
| Uniqueness | 1x | 10 | Unique perspective (10), some overlap (6), duplicate content (2) |
|
|
72
|
+
|
|
73
|
+
**Selection threshold**: Top N sources by score (N = depth target)
|
|
74
|
+
|
|
75
|
+
### 3. Just-In-Time Retrieval
|
|
76
|
+
|
|
77
|
+
Don't pre-load all content (causes context rot):
|
|
78
|
+
|
|
79
|
+
1. **Collect URLs first** via WebSearch
|
|
80
|
+
2. **Score based on metadata** (title, description, URL)
|
|
81
|
+
3. **Fetch only selected sources** via WebFetch
|
|
82
|
+
4. **Extract summaries** (not full content)
|
|
83
|
+
|
|
84
|
+
### 4. Content Extraction Guidelines
|
|
85
|
+
|
|
86
|
+
For each source, extract:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"url": "https://...",
|
|
91
|
+
"title": "Article Title",
|
|
92
|
+
"qualityScore": 85,
|
|
93
|
+
"scores": {
|
|
94
|
+
"authority": 9,
|
|
95
|
+
"recency": 8,
|
|
96
|
+
"depth": 7,
|
|
97
|
+
"examples": 9,
|
|
98
|
+
"uniqueness": 6
|
|
99
|
+
},
|
|
100
|
+
"keyInsights": [
|
|
101
|
+
"Concise insight 1",
|
|
102
|
+
"Concise insight 2"
|
|
103
|
+
],
|
|
104
|
+
"codeExamples": [
|
|
105
|
+
{
|
|
106
|
+
"language": "javascript",
|
|
107
|
+
"description": "Basic usage pattern"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"extractedAt": "2026-02-05T12:00:00Z"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Copyright compliance**: Summaries and insights only, never verbatim paragraphs.
|
|
115
|
+
|
|
116
|
+
## Output Structure
|
|
117
|
+
|
|
118
|
+
### Topic Guide Template
|
|
119
|
+
|
|
120
|
+
Create `agent-knowledge/{slug}.md`:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
# Learning Guide: {Topic}
|
|
124
|
+
|
|
125
|
+
**Generated**: {date}
|
|
126
|
+
**Sources**: {count} resources analyzed
|
|
127
|
+
**Depth**: {brief|medium|deep}
|
|
128
|
+
|
|
129
|
+
## Prerequisites
|
|
130
|
+
|
|
131
|
+
What you should know before diving in:
|
|
132
|
+
- Prerequisite 1
|
|
133
|
+
- Prerequisite 2
|
|
134
|
+
|
|
135
|
+
## TL;DR
|
|
136
|
+
|
|
137
|
+
Essential points in 3-5 bullets:
|
|
138
|
+
- Key point 1
|
|
139
|
+
- Key point 2
|
|
140
|
+
- Key point 3
|
|
141
|
+
|
|
142
|
+
## Core Concepts
|
|
143
|
+
|
|
144
|
+
### {Concept 1}
|
|
145
|
+
|
|
146
|
+
{Synthesized explanation from multiple sources}
|
|
147
|
+
|
|
148
|
+
**Key insight**: {Most important takeaway}
|
|
149
|
+
|
|
150
|
+
### {Concept 2}
|
|
151
|
+
|
|
152
|
+
{Synthesized explanation}
|
|
153
|
+
|
|
154
|
+
## Code Examples
|
|
155
|
+
|
|
156
|
+
### Basic Example
|
|
157
|
+
|
|
158
|
+
```{language}
|
|
159
|
+
// Description of what this demonstrates
|
|
160
|
+
{code}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Advanced Pattern
|
|
164
|
+
|
|
165
|
+
```{language}
|
|
166
|
+
{code}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Common Pitfalls
|
|
170
|
+
|
|
171
|
+
| Pitfall | Why It Happens | How to Avoid |
|
|
172
|
+
|---------|---------------|--------------|
|
|
173
|
+
| Issue 1 | Root cause | Prevention strategy |
|
|
174
|
+
|
|
175
|
+
## Best Practices
|
|
176
|
+
|
|
177
|
+
Synthesized from {n} sources:
|
|
178
|
+
|
|
179
|
+
1. **Practice 1**: Explanation
|
|
180
|
+
2. **Practice 2**: Explanation
|
|
181
|
+
|
|
182
|
+
## Further Reading
|
|
183
|
+
|
|
184
|
+
| Resource | Type | Why Recommended |
|
|
185
|
+
|----------|------|-----------------|
|
|
186
|
+
| [Title]({url}) | Official Docs | Authoritative reference |
|
|
187
|
+
| [Title]({url}) | Tutorial | Step-by-step guide |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
*Generated by /learn from {count} sources.*
|
|
192
|
+
*See `resources/{slug}-sources.json` for full source metadata.*
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Master Index Template
|
|
196
|
+
|
|
197
|
+
Create/update `agent-knowledge/CLAUDE.md`:
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+
# Agent Knowledge Base
|
|
201
|
+
|
|
202
|
+
> Learning guides created by /learn. Reference these when answering questions about listed topics.
|
|
203
|
+
|
|
204
|
+
## Available Topics
|
|
205
|
+
|
|
206
|
+
| Topic | File | Sources | Depth | Created |
|
|
207
|
+
|-------|------|---------|-------|---------|
|
|
208
|
+
| {Topic 1} | {slug1}.md | {n} | medium | 2026-02-05 |
|
|
209
|
+
| {Topic 2} | {slug2}.md | {n} | deep | 2026-02-04 |
|
|
210
|
+
|
|
211
|
+
## Trigger Phrases
|
|
212
|
+
|
|
213
|
+
Use this knowledge when user asks about:
|
|
214
|
+
- "How does {topic1} work?" → {slug1}.md
|
|
215
|
+
- "Explain {topic1}" → {slug1}.md
|
|
216
|
+
- "{Topic2} best practices" → {slug2}.md
|
|
217
|
+
|
|
218
|
+
## Quick Lookup
|
|
219
|
+
|
|
220
|
+
| Keyword | Guide |
|
|
221
|
+
|---------|-------|
|
|
222
|
+
| recursion | recursion.md |
|
|
223
|
+
| hooks, react | react-hooks.md |
|
|
224
|
+
|
|
225
|
+
## How to Use
|
|
226
|
+
|
|
227
|
+
1. Check if user question matches a topic
|
|
228
|
+
2. Read the relevant guide file
|
|
229
|
+
3. Answer based on synthesized knowledge
|
|
230
|
+
4. Cite the guide if user asks for sources
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Copy to `agent-knowledge/AGENTS.md` for OpenCode/Codex.
|
|
234
|
+
|
|
235
|
+
### Sources Metadata
|
|
236
|
+
|
|
237
|
+
Create `agent-knowledge/resources/{slug}-sources.json`:
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"topic": "{original topic}",
|
|
242
|
+
"slug": "{slug}",
|
|
243
|
+
"generated": "2026-02-05T12:00:00Z",
|
|
244
|
+
"depth": "medium",
|
|
245
|
+
"totalSources": 20,
|
|
246
|
+
"sources": [
|
|
247
|
+
{
|
|
248
|
+
"url": "https://...",
|
|
249
|
+
"title": "...",
|
|
250
|
+
"qualityScore": 85,
|
|
251
|
+
"scores": {
|
|
252
|
+
"authority": 9,
|
|
253
|
+
"recency": 8,
|
|
254
|
+
"depth": 7,
|
|
255
|
+
"examples": 9,
|
|
256
|
+
"uniqueness": 6
|
|
257
|
+
},
|
|
258
|
+
"keyInsights": ["..."]
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Self-Evaluation Checklist
|
|
265
|
+
|
|
266
|
+
Before finalizing, rate output (1-10):
|
|
267
|
+
|
|
268
|
+
| Metric | Question | Target |
|
|
269
|
+
|--------|----------|--------|
|
|
270
|
+
| Coverage | Does guide cover main aspects? | ≥7 |
|
|
271
|
+
| Diversity | Are sources from diverse types? | ≥6 |
|
|
272
|
+
| Examples | Are code examples practical? | ≥7 |
|
|
273
|
+
| Accuracy | Confidence in content accuracy? | ≥8 |
|
|
274
|
+
|
|
275
|
+
**Flag gaps**: Note any important subtopics not covered.
|
|
276
|
+
|
|
277
|
+
## Enhancement Integration
|
|
278
|
+
|
|
279
|
+
If enhance=true, invoke after guide creation:
|
|
280
|
+
|
|
281
|
+
```javascript
|
|
282
|
+
// Enhance the topic guide for RAG
|
|
283
|
+
Skill({ name: 'enhance-docs', args: `agent-knowledge/${slug}.md --ai` });
|
|
284
|
+
|
|
285
|
+
// Enhance the master index
|
|
286
|
+
Skill({ name: 'enhance-prompts', args: 'agent-knowledge/CLAUDE.md' });
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Output Format
|
|
290
|
+
|
|
291
|
+
Return structured JSON between markers:
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
=== LEARN_RESULT ===
|
|
295
|
+
{
|
|
296
|
+
"topic": "recursion",
|
|
297
|
+
"slug": "recursion",
|
|
298
|
+
"depth": "medium",
|
|
299
|
+
"guideFile": "agent-knowledge/recursion.md",
|
|
300
|
+
"sourcesFile": "agent-knowledge/resources/recursion-sources.json",
|
|
301
|
+
"sourceCount": 20,
|
|
302
|
+
"sourceBreakdown": {
|
|
303
|
+
"officialDocs": 4,
|
|
304
|
+
"tutorials": 5,
|
|
305
|
+
"stackOverflow": 3,
|
|
306
|
+
"blogPosts": 5,
|
|
307
|
+
"github": 3
|
|
308
|
+
},
|
|
309
|
+
"selfEvaluation": {
|
|
310
|
+
"coverage": 8,
|
|
311
|
+
"diversity": 7,
|
|
312
|
+
"examples": 9,
|
|
313
|
+
"accuracy": 8,
|
|
314
|
+
"gaps": ["tail recursion optimization not covered"]
|
|
315
|
+
},
|
|
316
|
+
"enhanced": true,
|
|
317
|
+
"indexUpdated": true
|
|
318
|
+
}
|
|
319
|
+
=== END_RESULT ===
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Error Handling
|
|
323
|
+
|
|
324
|
+
| Error | Action |
|
|
325
|
+
|-------|--------|
|
|
326
|
+
| WebSearch fails | Retry with simpler query |
|
|
327
|
+
| WebFetch timeout | Skip source, note in metadata |
|
|
328
|
+
| <minSources found | Warn user, proceed with available |
|
|
329
|
+
| Enhancement fails | Skip, note in output |
|
|
330
|
+
| Index doesn't exist | Create new index |
|
|
331
|
+
|
|
332
|
+
## Token Budget
|
|
333
|
+
|
|
334
|
+
Estimated token usage by phase:
|
|
335
|
+
|
|
336
|
+
| Phase | Tokens | Notes |
|
|
337
|
+
|-------|--------|-------|
|
|
338
|
+
| WebSearch queries | ~2,000 | 5-8 queries |
|
|
339
|
+
| Source scoring | ~1,000 | Metadata only |
|
|
340
|
+
| WebFetch extraction | ~40,000 | 20 sources × 2,000 avg |
|
|
341
|
+
| Synthesis | ~10,000 | Guide generation |
|
|
342
|
+
| Enhancement | ~5,000 | Two skill calls |
|
|
343
|
+
| **Total** | ~60,000 | Within opus budget |
|
|
344
|
+
|
|
345
|
+
## Integration
|
|
346
|
+
|
|
347
|
+
This skill is invoked by:
|
|
348
|
+
- `learn-agent` for `/learn` command
|
|
349
|
+
- Potentially other research-oriented agents
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orchestrate-review
|
|
3
|
+
version: 5.1.0
|
|
4
|
+
description: "Use when user asks to \"deep review the code\", \"thorough code review\", \"multi-pass review\", or when orchestrating the Phase 9 review loop. Provides review pass definitions (code quality, security, performance, test coverage), signal detection patterns, and iteration algorithms."
|
|
5
|
+
metadata:
|
|
6
|
+
short-description: "Multi-pass code review orchestration"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Orchestrate Review
|
|
10
|
+
|
|
11
|
+
Multi-pass code review with parallel Task agents, finding aggregation, and iteration until clean.
|
|
12
|
+
|
|
13
|
+
## Scope-Based Specialist Selection
|
|
14
|
+
|
|
15
|
+
Select conditional specialists based on the review scope:
|
|
16
|
+
- **User request**: Detect signals from content user refers to (files, directory, module)
|
|
17
|
+
- **Workflow (Phase 9)**: Detect signals from changed files only
|
|
18
|
+
- **Project audit**: Detect signals from project structure as a whole
|
|
19
|
+
|
|
20
|
+
## Review Passes
|
|
21
|
+
|
|
22
|
+
Spawn parallel `general-purpose` Task agents (model: `sonnet`), one per pass:
|
|
23
|
+
|
|
24
|
+
### Core (Always)
|
|
25
|
+
```javascript
|
|
26
|
+
const corePasses = [
|
|
27
|
+
{ id: 'code-quality', role: 'code quality reviewer',
|
|
28
|
+
focus: ['Style and consistency', 'Best practices', 'Bugs and logic errors', 'Error handling', 'Maintainability', 'Duplication'] },
|
|
29
|
+
{ id: 'security', role: 'security reviewer',
|
|
30
|
+
focus: ['Auth/authz flaws', 'Input validation', 'Injection risks', 'Secrets exposure', 'Insecure defaults'] },
|
|
31
|
+
{ id: 'performance', role: 'performance reviewer',
|
|
32
|
+
focus: ['N+1 queries', 'Blocking operations', 'Hot path inefficiencies', 'Memory leaks'] },
|
|
33
|
+
{ id: 'test-coverage', role: 'test coverage reviewer',
|
|
34
|
+
focus: ['Missing tests', 'Edge case coverage', 'Test quality', 'Integration needs', 'Mock appropriateness'] }
|
|
35
|
+
];
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Conditional (Signal-Based)
|
|
39
|
+
```javascript
|
|
40
|
+
if (signals.hasDb) passes.push({ id: 'database', role: 'database specialist',
|
|
41
|
+
focus: ['Query performance', 'Indexes/transactions', 'Migration safety', 'Data integrity'] });
|
|
42
|
+
if (signals.needsArchitecture) passes.push({ id: 'architecture', role: 'architecture reviewer',
|
|
43
|
+
focus: ['Module boundaries', 'Dependency direction', 'Cross-layer coupling', 'Pattern consistency'] });
|
|
44
|
+
if (signals.hasApi) passes.push({ id: 'api', role: 'api designer',
|
|
45
|
+
focus: ['REST conventions', 'Error/status consistency', 'Pagination/filters', 'Versioning'] });
|
|
46
|
+
if (signals.hasFrontend) passes.push({ id: 'frontend', role: 'frontend specialist',
|
|
47
|
+
focus: ['Component boundaries', 'State management', 'Accessibility', 'Render performance'] });
|
|
48
|
+
if (signals.hasBackend) passes.push({ id: 'backend', role: 'backend specialist',
|
|
49
|
+
focus: ['Service boundaries', 'Domain logic', 'Concurrency/idempotency', 'Background job safety'] });
|
|
50
|
+
if (signals.hasDevops) passes.push({ id: 'devops', role: 'devops reviewer',
|
|
51
|
+
focus: ['CI/CD safety', 'Secrets handling', 'Build/test pipelines', 'Deploy config'] });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Signal Detection
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
const signals = {
|
|
58
|
+
hasDb: files.some(f => /(db|migrations?|schema|prisma|typeorm|sql)/i.test(f)),
|
|
59
|
+
hasApi: files.some(f => /(api|routes?|controllers?|handlers?)/i.test(f)),
|
|
60
|
+
hasFrontend: files.some(f => /\.(tsx|jsx|vue|svelte)$/.test(f)),
|
|
61
|
+
hasBackend: files.some(f => /(server|backend|services?|domain)/i.test(f)),
|
|
62
|
+
hasDevops: files.some(f => /(\.github\/workflows|Dockerfile|k8s|terraform)/i.test(f)),
|
|
63
|
+
needsArchitecture: files.length > 20 // 20+ files typically indicates cross-module changes
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Task Prompt Template
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
You are a ${pass.role}. Review these changed files:
|
|
71
|
+
${files.join('\n')}
|
|
72
|
+
|
|
73
|
+
Focus: ${pass.focus.map(f => `- ${f}`).join('\n')}
|
|
74
|
+
|
|
75
|
+
Return JSON:
|
|
76
|
+
{
|
|
77
|
+
"pass": "${pass.id}",
|
|
78
|
+
"findings": [{
|
|
79
|
+
"file": "path.ts",
|
|
80
|
+
"line": 42,
|
|
81
|
+
"severity": "critical|high|medium|low",
|
|
82
|
+
"description": "Issue",
|
|
83
|
+
"suggestion": "Fix",
|
|
84
|
+
"confidence": "high|medium|low",
|
|
85
|
+
"falsePositive": false
|
|
86
|
+
}]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Example findings (diverse passes and severities):
|
|
90
|
+
|
|
91
|
+
// Security - high severity
|
|
92
|
+
{ "file": "src/auth/login.ts", "line": 89, "severity": "high",
|
|
93
|
+
"description": "Password comparison uses timing-vulnerable string equality",
|
|
94
|
+
"suggestion": "Use crypto.timingSafeEqual() instead of ===",
|
|
95
|
+
"confidence": "high", "falsePositive": false }
|
|
96
|
+
|
|
97
|
+
// Code quality - medium severity
|
|
98
|
+
{ "file": "src/utils/helpers.ts", "line": 45, "severity": "medium",
|
|
99
|
+
"description": "Duplicated validation logic exists in src/api/validators.ts:23",
|
|
100
|
+
"suggestion": "Extract to shared lib/validation.ts",
|
|
101
|
+
"confidence": "high", "falsePositive": false }
|
|
102
|
+
|
|
103
|
+
// Performance - low severity
|
|
104
|
+
{ "file": "src/config.ts", "line": 12, "severity": "low",
|
|
105
|
+
"description": "Magic number 3600 should be named constant",
|
|
106
|
+
"suggestion": "const CACHE_TTL_SECONDS = 3600;",
|
|
107
|
+
"confidence": "medium", "falsePositive": false }
|
|
108
|
+
|
|
109
|
+
// False positive example
|
|
110
|
+
{ "file": "src/crypto/hash.ts", "line": 78, "severity": "high",
|
|
111
|
+
"description": "Non-constant time comparison",
|
|
112
|
+
"suggestion": "N/A - intentional for non-secret data",
|
|
113
|
+
"confidence": "low", "falsePositive": true }
|
|
114
|
+
|
|
115
|
+
Report all issues with confidence >= medium. Empty findings array if clean.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Aggregation
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
function aggregateFindings(results) {
|
|
122
|
+
const items = [];
|
|
123
|
+
for (const {pass, findings = []} of results) {
|
|
124
|
+
for (const f of findings) {
|
|
125
|
+
items.push({
|
|
126
|
+
id: `${pass}:${f.file}:${f.line}:${f.description}`,
|
|
127
|
+
pass, ...f,
|
|
128
|
+
status: f.falsePositive ? 'false-positive' : 'open'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Deduplicate by id
|
|
134
|
+
const deduped = [...new Map(items.map(i => [i.id, i])).values()];
|
|
135
|
+
|
|
136
|
+
// Group by severity
|
|
137
|
+
const bySeverity = {critical: [], high: [], medium: [], low: []};
|
|
138
|
+
deduped.forEach(i => !i.falsePositive && bySeverity[i.severity || 'low'].push(i));
|
|
139
|
+
|
|
140
|
+
const totals = Object.fromEntries(Object.entries(bySeverity).map(([k, v]) => [k, v.length]));
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
items: deduped,
|
|
144
|
+
bySeverity,
|
|
145
|
+
totals,
|
|
146
|
+
openCount: Object.values(totals).reduce((a, b) => a + b, 0)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Iteration Loop
|
|
152
|
+
|
|
153
|
+
**Security Note**: Fixes are applied by the orchestrator using standard Edit tool permissions. Critical/high severity findings should be reviewed before applying - do not blindly apply LLM-suggested fixes to security-sensitive code. The orchestrator validates each fix against the original issue.
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
// 5 iterations balances thoroughness vs cost; 1 stall (2 consecutive identical-hash iterations) indicates fixes aren't progressing
|
|
157
|
+
const MAX_ITERATIONS = 5, MAX_STALLS = 1;
|
|
158
|
+
let iteration = 1, stallCount = 0, lastHash = null;
|
|
159
|
+
|
|
160
|
+
while (iteration <= MAX_ITERATIONS) {
|
|
161
|
+
// 1. Spawn parallel Task agents
|
|
162
|
+
const results = await Promise.all(passes.map(pass => Task({
|
|
163
|
+
subagent_type: 'general-purpose',
|
|
164
|
+
model: 'sonnet',
|
|
165
|
+
prompt: /* see template above */
|
|
166
|
+
})));
|
|
167
|
+
|
|
168
|
+
// 2. Aggregate findings
|
|
169
|
+
const findings = aggregateFindings(results);
|
|
170
|
+
|
|
171
|
+
// 3. Check if done
|
|
172
|
+
if (findings.openCount === 0) {
|
|
173
|
+
workflowState.completePhase({ approved: true, iterations: iteration });
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 4. Fix issues (severity order: critical → high → medium → low)
|
|
178
|
+
// Orchestrator reviews each suggestion before applying via Edit tool
|
|
179
|
+
for (const issue of [...findings.bySeverity.critical, ...findings.bySeverity.high,
|
|
180
|
+
...findings.bySeverity.medium, ...findings.bySeverity.low]) {
|
|
181
|
+
if (!issue.falsePositive) {
|
|
182
|
+
// Read file, locate issue.line, validate suggestion, apply via Edit tool
|
|
183
|
+
// For complex fixes, use simple-fixer agent pattern
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// 5. Commit
|
|
188
|
+
exec(`git add . && git commit -m "fix: review feedback (iteration ${iteration})"`);
|
|
189
|
+
|
|
190
|
+
// 6. Post-iteration deslop
|
|
191
|
+
Task({ subagent_type: 'deslop-agent', model: 'sonnet' });
|
|
192
|
+
|
|
193
|
+
// 7. Stall detection
|
|
194
|
+
const hash = crypto.createHash('sha256')
|
|
195
|
+
.update(JSON.stringify(findings.items.filter(i => !i.falsePositive)))
|
|
196
|
+
.digest('hex');
|
|
197
|
+
stallCount = hash === lastHash ? stallCount + 1 : 0;
|
|
198
|
+
lastHash = hash;
|
|
199
|
+
|
|
200
|
+
// 8. Check limits
|
|
201
|
+
if (stallCount >= MAX_STALLS || iteration >= MAX_ITERATIONS) {
|
|
202
|
+
const reason = stallCount >= MAX_STALLS ? 'stall-detected' : 'iteration-limit';
|
|
203
|
+
console.log(`[BLOCKED] Review loop ended: ${reason}. Remaining: ${JSON.stringify(findings.totals)}`);
|
|
204
|
+
// Ask the user before advancing - do not silently proceed to delivery-validation
|
|
205
|
+
const question = `Review loop blocked (${reason}). Open issues remain. How should we proceed?`;
|
|
206
|
+
const response = AskUserQuestion({
|
|
207
|
+
questions: [{
|
|
208
|
+
question,
|
|
209
|
+
header: 'Review Blocked',
|
|
210
|
+
multiSelect: false,
|
|
211
|
+
options: [
|
|
212
|
+
{ label: 'Override and proceed', description: 'Advance to delivery-validation with unresolved issues (risky)' },
|
|
213
|
+
{ label: 'Abort workflow', description: 'Stop here; open issues must be fixed manually' }
|
|
214
|
+
]
|
|
215
|
+
}]
|
|
216
|
+
});
|
|
217
|
+
// AskUserQuestion returns { answers: { [questionText]: selectedLabel } }
|
|
218
|
+
const choice = response.answers?.[question] ?? response[question];
|
|
219
|
+
if (choice === 'Override and proceed') {
|
|
220
|
+
workflowState.completePhase({
|
|
221
|
+
approved: false, blocked: true, overridden: true,
|
|
222
|
+
reason, remaining: findings.totals
|
|
223
|
+
});
|
|
224
|
+
} else {
|
|
225
|
+
workflowState.failPhase(`Review blocked: ${reason}. ${JSON.stringify(findings.totals)} issues remain.`);
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
iteration++;
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Review Queue
|
|
235
|
+
|
|
236
|
+
Store state at `{stateDir}/review-queue-{timestamp}.json`:
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"status": "open|resolved|blocked",
|
|
240
|
+
"scope": { "type": "diff", "files": ["..."] },
|
|
241
|
+
"passes": ["code-quality", "security"],
|
|
242
|
+
"items": [],
|
|
243
|
+
"iteration": 0,
|
|
244
|
+
"stallCount": 0
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Delete when approved. Keep when blocked for orchestrator inspection.
|
|
249
|
+
|
|
250
|
+
## Cross-Platform Compatibility
|
|
251
|
+
|
|
252
|
+
This skill uses `Task({ subagent_type: ... })` which is Claude Code syntax. For other platforms:
|
|
253
|
+
|
|
254
|
+
| Platform | Equivalent Syntax |
|
|
255
|
+
|----------|-------------------|
|
|
256
|
+
| Claude Code | `Task({ subagent_type: 'general-purpose', model: 'sonnet', prompt: ... })` |
|
|
257
|
+
| OpenCode | `spawn_agent({ type: 'general-purpose', model: 'sonnet', prompt: ... })` |
|
|
258
|
+
| Codex CLI | `$agent general-purpose --model sonnet --prompt "..."` |
|
|
259
|
+
|
|
260
|
+
The aggregation and iteration logic remains the same across platforms - only the agent spawning syntax differs.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-analyzer
|
|
3
|
+
description: "Use when synthesizing perf findings into evidence-backed recommendations and decisions."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-analyzer
|
|
8
|
+
|
|
9
|
+
Synthesize performance investigation results into clear recommendations.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
- Baseline data
|
|
16
|
+
- Experiment results
|
|
17
|
+
- Profiling evidence
|
|
18
|
+
- Hypotheses tested
|
|
19
|
+
- Breaking point results
|
|
20
|
+
|
|
21
|
+
## Output Format
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
summary: <2-3 sentences>
|
|
25
|
+
recommendations:
|
|
26
|
+
- <actionable recommendation 1>
|
|
27
|
+
- <actionable recommendation 2>
|
|
28
|
+
abandoned:
|
|
29
|
+
- <hypothesis or experiment that failed>
|
|
30
|
+
next_steps:
|
|
31
|
+
- <if user should continue or stop>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Constraints
|
|
35
|
+
|
|
36
|
+
- Only cite evidence that exists in logs or code.
|
|
37
|
+
- If data is insufficient, say so and request a re-run.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-baseline-manager
|
|
3
|
+
description: "Use when managing perf baselines, consolidating results, or comparing versions. Ensures one baseline JSON per version."
|
|
4
|
+
version: 5.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# perf-baseline-manager
|
|
8
|
+
|
|
9
|
+
Manage baseline storage and comparison.
|
|
10
|
+
|
|
11
|
+
Follow `docs/perf-requirements.md` as the canonical contract.
|
|
12
|
+
|
|
13
|
+
## Required Rules
|
|
14
|
+
|
|
15
|
+
- One baseline JSON per version.
|
|
16
|
+
- Store under `{state-dir}/perf/baselines/<version>.json`.
|
|
17
|
+
- Record metrics + environment metadata.
|
|
18
|
+
|
|
19
|
+
## Output Format
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
baseline_version: <version>
|
|
23
|
+
metrics: <summary>
|
|
24
|
+
file: <path>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Constraints
|
|
28
|
+
|
|
29
|
+
- Overwrite older baseline for the same version.
|
|
30
|
+
- Do not create multiple files for one version.
|