agentsys 5.3.3 → 5.3.5

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.
Files changed (108) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.kiro/agents/agent-enhancer.json +1 -1
  4. package/.kiro/agents/ci-fixer.json +1 -1
  5. package/.kiro/agents/ci-monitor.json +1 -1
  6. package/.kiro/agents/claudemd-enhancer.json +1 -1
  7. package/.kiro/agents/consult-agent.json +1 -1
  8. package/.kiro/agents/cross-file-enhancer.json +1 -1
  9. package/.kiro/agents/debate-orchestrator.json +1 -1
  10. package/.kiro/agents/delivery-validator.json +1 -1
  11. package/.kiro/agents/deslop-agent.json +1 -1
  12. package/.kiro/agents/docs-enhancer.json +1 -1
  13. package/.kiro/agents/exploration-agent.json +1 -1
  14. package/.kiro/agents/hooks-enhancer.json +1 -1
  15. package/.kiro/agents/implementation-agent.json +1 -1
  16. package/.kiro/agents/learn-agent.json +1 -1
  17. package/.kiro/agents/map-validator.json +1 -1
  18. package/.kiro/agents/perf-analyzer.json +1 -1
  19. package/.kiro/agents/perf-code-paths.json +1 -1
  20. package/.kiro/agents/perf-investigation-logger.json +1 -1
  21. package/.kiro/agents/perf-orchestrator.json +1 -1
  22. package/.kiro/agents/perf-theory-gatherer.json +1 -1
  23. package/.kiro/agents/perf-theory-tester.json +1 -1
  24. package/.kiro/agents/plan-synthesizer.json +1 -1
  25. package/.kiro/agents/planning-agent.json +1 -1
  26. package/.kiro/agents/plugin-enhancer.json +1 -1
  27. package/.kiro/agents/prompt-enhancer.json +1 -1
  28. package/.kiro/agents/reviewer-perf-test.json +1 -1
  29. package/.kiro/agents/reviewer-quality-security.json +1 -1
  30. package/.kiro/agents/simple-fixer.json +1 -1
  31. package/.kiro/agents/skills-enhancer.json +1 -1
  32. package/.kiro/agents/sync-docs-agent.json +1 -1
  33. package/.kiro/agents/task-discoverer.json +1 -1
  34. package/.kiro/agents/test-coverage-checker.json +1 -1
  35. package/.kiro/agents/web-session.json +1 -1
  36. package/.kiro/agents/worktree-manager.json +1 -1
  37. package/CHANGELOG.md +14 -0
  38. package/bin/cli.js +48 -36
  39. package/lib/adapter-transforms.js +3 -3
  40. package/package.json +1 -1
  41. package/site/content.json +32 -8
  42. package/.cursor/commands/audit-project-agents.md +0 -454
  43. package/.cursor/commands/audit-project-github.md +0 -141
  44. package/.cursor/commands/audit-project.md +0 -330
  45. package/.cursor/commands/consult.md +0 -417
  46. package/.cursor/commands/debate.md +0 -381
  47. package/.cursor/commands/delivery-approval.md +0 -334
  48. package/.cursor/commands/deslop.md +0 -142
  49. package/.cursor/commands/drift-detect.md +0 -259
  50. package/.cursor/commands/enhance.md +0 -172
  51. package/.cursor/commands/learn.md +0 -165
  52. package/.cursor/commands/next-task.md +0 -519
  53. package/.cursor/commands/perf.md +0 -464
  54. package/.cursor/commands/repo-map.md +0 -124
  55. package/.cursor/commands/ship-ci-review-loop.md +0 -468
  56. package/.cursor/commands/ship-deployment.md +0 -348
  57. package/.cursor/commands/ship-error-handling.md +0 -265
  58. package/.cursor/commands/ship.md +0 -517
  59. package/.cursor/commands/sync-docs.md +0 -171
  60. package/.cursor/commands/web-ctl.md +0 -101
  61. package/.cursor/skills/consult/SKILL.md +0 -425
  62. package/.cursor/skills/debate/SKILL.md +0 -316
  63. package/.cursor/skills/deslop/SKILL.md +0 -204
  64. package/.cursor/skills/discover-tasks/SKILL.md +0 -297
  65. package/.cursor/skills/drift-analysis/SKILL.md +0 -324
  66. package/.cursor/skills/enhance-agent-prompts/SKILL.md +0 -277
  67. package/.cursor/skills/enhance-claude-memory/SKILL.md +0 -387
  68. package/.cursor/skills/enhance-cross-file/SKILL.md +0 -110
  69. package/.cursor/skills/enhance-docs/SKILL.md +0 -298
  70. package/.cursor/skills/enhance-hooks/SKILL.md +0 -554
  71. package/.cursor/skills/enhance-orchestrator/SKILL.md +0 -255
  72. package/.cursor/skills/enhance-plugins/SKILL.md +0 -319
  73. package/.cursor/skills/enhance-prompts/SKILL.md +0 -340
  74. package/.cursor/skills/enhance-skills/SKILL.md +0 -436
  75. package/.cursor/skills/learn/SKILL.md +0 -349
  76. package/.cursor/skills/orchestrate-review/SKILL.md +0 -260
  77. package/.cursor/skills/perf-analyzer/SKILL.md +0 -37
  78. package/.cursor/skills/perf-baseline-manager/SKILL.md +0 -30
  79. package/.cursor/skills/perf-benchmarker/SKILL.md +0 -52
  80. package/.cursor/skills/perf-code-paths/SKILL.md +0 -32
  81. package/.cursor/skills/perf-investigation-logger/SKILL.md +0 -41
  82. package/.cursor/skills/perf-profiler/SKILL.md +0 -42
  83. package/.cursor/skills/perf-theory-gatherer/SKILL.md +0 -35
  84. package/.cursor/skills/perf-theory-tester/SKILL.md +0 -36
  85. package/.cursor/skills/repo-mapping/SKILL.md +0 -83
  86. package/.cursor/skills/sync-docs/SKILL.md +0 -351
  87. package/.cursor/skills/validate-delivery/SKILL.md +0 -186
  88. package/.cursor/skills/web-auth/SKILL.md +0 -177
  89. package/.cursor/skills/web-browse/SKILL.md +0 -516
  90. package/.kiro/steering/audit-project-agents.md +0 -459
  91. package/.kiro/steering/audit-project-github.md +0 -146
  92. package/.kiro/steering/audit-project.md +0 -330
  93. package/.kiro/steering/consult.md +0 -422
  94. package/.kiro/steering/debate.md +0 -386
  95. package/.kiro/steering/delivery-approval.md +0 -339
  96. package/.kiro/steering/deslop.md +0 -149
  97. package/.kiro/steering/drift-detect.md +0 -264
  98. package/.kiro/steering/enhance.md +0 -177
  99. package/.kiro/steering/learn.md +0 -166
  100. package/.kiro/steering/next-task.md +0 -481
  101. package/.kiro/steering/perf.md +0 -469
  102. package/.kiro/steering/repo-map.md +0 -126
  103. package/.kiro/steering/ship-ci-review-loop.md +0 -473
  104. package/.kiro/steering/ship-deployment.md +0 -353
  105. package/.kiro/steering/ship-error-handling.md +0 -270
  106. package/.kiro/steering/ship.md +0 -522
  107. package/.kiro/steering/sync-docs.md +0 -178
  108. package/.kiro/steering/web-ctl.md +0 -106
@@ -1,264 +0,0 @@
1
- ---
2
- inclusion: manual
3
- name: "drift-detect"
4
- description: "Use when user asks to \"check plan drift\", \"compare docs to code\", \"verify roadmap\", \"scan for reality gaps\". Analyzes documentation vs actual code to detect drift and outdated plans."
5
- ---
6
-
7
- # /drift-detect - Reality Check Scanner
8
-
9
- Perform deep repository analysis to identify drift between documented plans and actual implementation.
10
-
11
- ## Architecture
12
-
13
- ```
14
- scan.md → collectors.js (pure JS) → plan-synthesizer (Opus) → report
15
- ├─ scanGitHubState() (single call with full context)
16
- ├─ analyzeDocumentation()
17
- └─ scanCodebase()
18
- ```
19
-
20
- Data collection is pure JavaScript (no LLM). Only semantic analysis uses Opus.
21
-
22
- ## Arguments
23
-
24
- Parse from $ARGUMENTS:
25
- - `--sources`: Comma-separated list of sources to scan (default: github,docs,code)
26
- - `--depth`: Scan depth - quick or thorough (default: thorough)
27
- - `--output`: Output mode - file, display, or both (default: both)
28
- - `--file`: Output file path (default: drift-detect-report.md)
29
-
30
- Example: `/drift-detect --sources github,docs --depth quick --output file`
31
-
32
- ## Phase 1: Parse Arguments and Collect Data
33
-
34
- ```javascript
35
-
36
- const pluginRoot = getPluginRoot('drift-detect');
37
- if (!pluginRoot) { console.error('Error: Could not locate drift-detect plugin root'); process.exit(1); }
38
-
39
-
40
-
41
- // Suggest repo-map if missing or stale
42
- const mapStatus = repoMap.status(process.cwd());
43
- if (!mapStatus.exists) {
44
- console.log('Repo map not found. For faster, more accurate drift detection, run: /repo-map init');
45
- } else if (mapStatus.status?.staleness?.isStale) {
46
- console.log('Repo map is stale (' + mapStatus.status.staleness.reason + '). Consider: /repo-map update');
47
- }
48
-
49
- // Parse arguments
50
- const args = '$ARGUMENTS'.split(' ').filter(Boolean);
51
- const options = {
52
- sources: ['github', 'docs', 'code'],
53
- depth: 'thorough',
54
- output: 'both',
55
- file: 'drift-detect-report.md',
56
- cwd: process.cwd()
57
- };
58
-
59
- // Parse flags
60
- for (let i = 0; i < args.length; i++) {
61
- if (args[i] === '--sources' && args[i+1]) {
62
- options.sources = args[++i].split(',').map(s => s.trim());
63
- } else if (args[i] === '--depth' && args[i+1]) {
64
- options.depth = args[++i];
65
- } else if (args[i] === '--output' && args[i+1]) {
66
- options.output = args[++i];
67
- } else if (args[i] === '--file' && args[i+1]) {
68
- options.file = args[++i];
69
- }
70
- }
71
-
72
- // Validate options
73
- const allowedSources = ['github', 'docs', 'code'];
74
- const allowedDepths = ['quick', 'thorough'];
75
- const allowedOutputs = ['file', 'display', 'both'];
76
-
77
- const invalidSources = options.sources.filter(s => !allowedSources.includes(s));
78
- if (invalidSources.length > 0) {
79
- console.error(`Invalid --sources value(s): ${invalidSources.join(', ')}. Allowed: ${allowedSources.join(', ')}`);
80
- process.exit(1);
81
- }
82
-
83
- if (!allowedDepths.includes(options.depth)) {
84
- console.error(`Invalid --depth value: ${options.depth}. Allowed: ${allowedDepths.join(', ')}`);
85
- process.exit(1);
86
- }
87
-
88
- if (!allowedOutputs.includes(options.output)) {
89
- console.error(`Invalid --output value: ${options.output}. Allowed: ${allowedOutputs.join(', ')}`);
90
- process.exit(1);
91
- }
92
-
93
- console.log(`
94
- ## Starting Reality Check Scan
95
-
96
- **Sources**: ${options.sources.join(', ')}
97
- **Depth**: ${options.depth}
98
- **Output**: ${options.output}
99
-
100
- Collecting data...
101
- `);
102
-
103
- // Collect all data using pure JavaScript (no LLM)
104
- const collectedData = await collectors.collectAllData(options);
105
-
106
- // Check if GitHub data collection succeeded
107
- if (options.sources.includes('github') && collectedData.github && !collectedData.github.available) {
108
- console.log(`
109
- [WARN] GitHub CLI not available or not authenticated.
110
- Run \`gh auth login\` to enable GitHub issue scanning.
111
- Continuing with other sources...
112
- `);
113
- }
114
-
115
- console.log(`
116
- ### Data Collection Complete
117
-
118
- ${collectedData.github?.available ? `- **GitHub**: ${collectedData.github.issues.length} issues, ${collectedData.github.prs.length} PRs` : '- **GitHub**: Not available'}
119
- ${collectedData.docs ? `- **Documentation**: ${Object.keys(collectedData.docs.files).length} files analyzed` : '- **Documentation**: Skipped'}
120
- ${collectedData.code?.summary?.totalDirs ? `- **Code**: ${collectedData.code.summary.totalDirs} directories scanned` : '- **Code**: Skipped'}
121
-
122
- → Sending to semantic analyzer...
123
- `);
124
- ```
125
-
126
- ## Phase 2: Semantic Analysis (Single Opus Call)
127
-
128
- Send all collected data to plan-synthesizer for deep semantic analysis:
129
-
130
- ```javascript
131
- const analysisPrompt = `
132
- You are analyzing a project to identify drift between documented plans and actual implementation.
133
-
134
- ## Collected Data
135
-
136
- ### GitHub State
137
- ${'```'}json
138
- ${JSON.stringify(collectedData.github, null, 2)}
139
- ${'```'}
140
-
141
- ### Documentation Analysis
142
- ${'```'}json
143
- ${JSON.stringify(collectedData.docs, null, 2)}
144
- ${'```'}
145
-
146
- ### Codebase Analysis
147
- ${'```'}json
148
- ${JSON.stringify(collectedData.code, null, 2)}
149
- ${'```'}
150
-
151
- ## Your Task
152
-
153
- Be BRUTALLY SPECIFIC. The user wants concrete, actionable insights - not generic observations.
154
-
155
- ### 1. Issue-by-Issue Verification
156
-
157
- For EACH open issue, determine:
158
- - Is this already implemented? → "Close issue #X - implemented in src/auth/login.js"
159
- - Is this stale/irrelevant? → "Close issue #X - no longer applicable after Y refactor"
160
- - Is this blocked? → "Issue #X blocked by: missing Z dependency"
161
-
162
- ### 2. Phase/Checkbox Validation
163
-
164
- For EACH phase or checkbox marked "complete" in docs:
165
- - Verify against actual code: Does the feature exist?
166
- - Check for missing pieces: "Phase 'Authentication' marked complete but MISSING:
167
- - Password reset functionality (no code in auth/)
168
- - Session timeout handling (not implemented)
169
- - Tests for login flow (0 test files)"
170
-
171
- ### 3. Release Readiness Assessment
172
-
173
- If there are milestones or planned releases, assess:
174
- - "Your plan to release tomorrow is UNREALISTIC because:
175
- - 3 critical tests missing for payment module
176
- - No QA coverage on authentication flows
177
- - Issue #45 (security) still open
178
- - Phase B only 40% complete despite being marked done"
179
-
180
- ### 4. Specific Recommendations
181
-
182
- Output SPECIFIC actions, not generic advice:
183
- - "Close issues: #12, #34, #56 (already implemented)"
184
- - "Reopen: Phase C (missing: X, Y, Z)"
185
- - "Block release until: tests added for auth/, issue #78 fixed"
186
- - "Update PLAN.md: Phase B is NOT complete - missing items listed above"
187
-
188
- ## Output Format
189
-
190
- ```markdown
191
- # Reality Check Report
192
-
193
- ## Executive Summary
194
- [2-3 sentences: Overall project health and biggest concerns]
195
-
196
- ## Issues to Close (Already Done)
197
- - #XX: [title] - Implemented in [file/location]
198
- - #YY: [title] - No longer relevant because [reason]
199
-
200
- ## Phases Marked Complete But NOT Actually Done
201
- ### [Phase Name]
202
- **Status in docs**: Complete [OK]
203
- **Actual status**: INCOMPLETE
204
- **Missing**:
205
- - [ ] [Specific missing item 1]
206
- - [ ] [Specific missing item 2]
207
-
208
- ## Release Blockers
209
- If you're planning to ship soon, these MUST be addressed:
210
- 1. [Specific blocker with file/issue reference]
211
- 2. [Specific blocker with file/issue reference]
212
-
213
- ## Issues That Need Attention
214
- - #XX: [why it's stale/blocked/misprioritized]
215
-
216
- ## Quick Wins
217
- Things you can do right now:
218
- 1. Close issue #XX (already done)
219
- 2. Update Phase Y status (not complete)
220
- 3. Add test for [specific untested code]
221
- ```
222
- `;
223
-
224
- Delegate to the `plan-synthesizer` subagent.
225
- ```
226
-
227
- ## Phase 3: Output Report
228
-
229
- After the synthesizer completes, the report is available. Handle output per settings:
230
-
231
- ```javascript
232
- // The synthesizer outputs the report directly
233
- // Handle file writing if requested
234
-
235
- if (options.output === 'file' || options.output === 'both') {
236
- console.log(`\n---\nReport saved to: ${options.file}`);
237
- }
238
-
239
- console.log(`
240
- ## Reality Check Complete
241
-
242
- Use the findings above to realign your project with reality.
243
- Run \`/drift-detect --depth quick\` for faster subsequent scans.
244
- `);
245
- ```
246
-
247
- ## Quick Reference
248
-
249
- | Flag | Values | Default | Description |
250
- |------|--------|---------|-------------|
251
- | --sources | github,docs,code | all three | Which sources to scan |
252
- | --depth | quick, thorough | thorough | How deep to analyze |
253
- | --output | file, display, both | both | Where to output results |
254
- | --file | path | drift-detect-report.md | Output file path |
255
-
256
- ## Success Criteria
257
-
258
- - Data collected via pure JavaScript (no LLM overhead)
259
- - Single Opus call for semantic analysis with full context
260
- - Drift and gaps clearly identified with examples
261
- - Prioritized reconstruction plan produced
262
- - Report output per user settings
263
-
264
- Begin scan now.
@@ -1,177 +0,0 @@
1
- ---
2
- inclusion: manual
3
- name: "enhance"
4
- description: "Use when user asks to \"enhance prompts\", \"improve agents\", \"analyze plugins\", \"optimize documentation\", \"review CLAUDE.md\". Runs 5 parallel analyzers on prompts, agents, plugins, docs, and project memory files."
5
- ---
6
-
7
- # /enhance - Master Enhancement Orchestrator
8
-
9
- Run all enhancement analyzers in parallel and generate a unified report.
10
-
11
- ## Overview
12
-
13
- The master `/enhance` command orchestrates 7 specialized enhancers:
14
- - **plugin** - Plugin structures, MCP tools, security patterns
15
- - **agent** - Agent prompts, frontmatter, tool restrictions
16
- - **claudemd** - CLAUDE.md/AGENTS.md project memory files
17
- - **docs** - Documentation structure and RAG optimization
18
- - **prompt** - General prompt quality and clarity
19
- - **hooks** - Hook definitions and frontmatter quality
20
- - **skills** - SKILL.md structure and trigger clarity
21
-
22
- ## Arguments
23
-
24
- Parse from $ARGUMENTS:
25
- - **target-path**: Directory or file to analyze (default: current directory)
26
- - **--apply**: Apply auto-fixes for HIGH certainty issues after report
27
- - **--focus=TYPE**: Run only specified enhancer(s): plugin, agent, claudemd/claude-memory, docs, prompt, hooks, skills
28
- - **--verbose**: Include LOW certainty issues in report
29
- - **--show-suppressed**: Show what's being filtered by auto-learned suppressions
30
- - **--no-learn**: Disable auto-learning for this run (analyze but don't save)
31
- - **--reset-learned**: Clear all auto-learned suppressions for this project
32
- - **--export-learned**: Export learned suppressions as JSON for team sharing
33
-
34
- ## Workflow
35
-
36
- 1. **Discovery** - Detect what content types exist in target path
37
- 2. **Load Suppressions** - Load auto-learned and manual suppressions for project
38
- 3. **Launch** - Start all relevant enhancers in parallel via Task()
39
- 4. **Aggregate** - Collect and deduplicate findings from all enhancers
40
- 5. **Report** - Generate unified report from aggregated findings
41
- 6. **Auto-Learn** - Detect false positives and save for future runs (unless --no-learn)
42
- 7. **Fix** - Apply auto-fixes if --apply flag is present
43
-
44
- ## Implementation
45
-
46
- Execute the `enhance-orchestrator` skill directly. The skill workflow:
47
-
48
- 1. Parse arguments from $ARGUMENTS
49
- 2. Run discovery to find content types
50
- 3. Spawn enhancer agents in parallel via Task() for each content type
51
- 4. Aggregate results from all enhancers
52
- 5. Generate unified report
53
-
54
- See `skills/enhance-orchestrator/SKILL.md` for detailed implementation.
55
-
56
- ## Output Format
57
-
58
- ```markdown
59
- # Enhancement Analysis Report
60
-
61
- **Target**: {targetPath}
62
- **Date**: {timestamp}
63
- **Enhancers Run**: plugin, agent, docs
64
-
65
- ## Executive Summary
66
-
67
- | Enhancer | HIGH | MEDIUM | LOW | Auto-Fixable |
68
- |----------|------|--------|-----|--------------|
69
- | plugin | 2 | 3 | 1 | 1 |
70
- | agent | 1 | 2 | 0 | 1 |
71
- | docs | 0 | 4 | 2 | 0 |
72
- | **Total** | **3** | **9** | **3** | **2** |
73
-
74
- ## HIGH Certainty Issues (3)
75
-
76
- [Grouped by enhancer, sorted by file]
77
-
78
- ## MEDIUM Certainty Issues (9)
79
-
80
- [...]
81
-
82
- ## Auto-Fix Summary
83
-
84
- 2 issues can be automatically fixed with `--apply` flag.
85
- ```
86
-
87
- ## Example Usage
88
-
89
- ```bash
90
- # Full analysis of current directory
91
- /enhance
92
-
93
- # Focus on specific enhancer type
94
- /enhance --focus=agent
95
-
96
- # Apply auto-fixes for HIGH certainty issues
97
- /enhance --apply
98
-
99
- # Analyze specific path with verbose output
100
- /enhance plugins/next-task --verbose
101
-
102
- # Combined flags
103
- /enhance --focus=plugin --apply --verbose
104
-
105
- # Auto-Learning Suppression System
106
- # See what's being filtered by auto-learned suppressions
107
- /enhance --show-suppressed
108
-
109
- # Run without auto-learning (analyze only, don't save new suppressions)
110
- /enhance --no-learn
111
-
112
- # Reset all learned suppressions for this project
113
- /enhance --reset-learned
114
-
115
- # Export learned suppressions for team sharing
116
- /enhance --export-learned > suppressions-export.json
117
- ```
118
-
119
- ## Success Criteria
120
-
121
- - All relevant enhancers run in parallel
122
- - Findings deduplicated and sorted by certainty
123
- - Clear executive summary with counts
124
- - Auto-fixable issues highlighted
125
- - Fixes applied only with explicit --apply flag
126
- - Auto-learning detects false positives with 90%+ confidence
127
- - Learned suppressions stored in cross-platform location (${STATE_DIR}/enhance/suppressions.json)
128
- - Zero token waste on previously suppressed findings
129
-
130
- ---
131
-
132
- # /plugin
133
-
134
- Spawns `plugin-enhancer` agent which invokes `enhance-plugins` skill.
135
- See skill for patterns, detection logic, and auto-fix implementations.
136
-
137
- ---
138
-
139
- # /agent
140
-
141
- Spawns `agent-enhancer` agent which invokes `enhance-agent-prompts` skill.
142
- See skill for patterns, detection logic, and auto-fix implementations.
143
-
144
- ---
145
-
146
- # /docs
147
-
148
- Spawns `docs-enhancer` agent which invokes `enhance-docs` skill.
149
- See skill for patterns, detection logic, and auto-fix implementations.
150
-
151
- ---
152
-
153
- # /claudemd
154
-
155
- Spawns `claudemd-enhancer` agent which invokes `enhance-claude-memory` skill.
156
- See skill for patterns, detection logic, and auto-fix implementations.
157
-
158
- ---
159
-
160
- # /prompt
161
-
162
- Spawns `prompt-enhancer` agent which invokes `enhance-prompts` skill.
163
- See skill for patterns, detection logic, and auto-fix implementations.
164
-
165
- ---
166
-
167
- # /hooks
168
-
169
- Spawns `hooks-enhancer` agent which invokes `enhance-hooks` skill.
170
- See skill for patterns, detection logic, and auto-fix implementations.
171
-
172
- ---
173
-
174
- # /skills
175
-
176
- Spawns `skills-enhancer` agent which invokes `enhance-skills` skill.
177
- See skill for patterns, detection logic, and auto-fix implementations.
@@ -1,166 +0,0 @@
1
- ---
2
- inclusion: manual
3
- name: "learn"
4
- description: "Use when user asks to \"learn about topic\", \"research subject\", \"create learning guide\", \"build knowledge base\", \"study topic\". Gathers online sources and synthesizes comprehensive guide with RAG index."
5
- ---
6
-
7
- # /learn - Learning Guide Generator
8
-
9
- Research any topic by gathering online resources and synthesize into a comprehensive learning guide with RAG-optimized indexes.
10
-
11
- ## Depth Levels
12
-
13
- | Level | Sources | Use Case |
14
- |-------|---------|----------|
15
- | `brief` | 10 | Quick overview, time-sensitive |
16
- | `medium` | 20 | **Default** - balanced coverage |
17
- | `deep` | 40 | Comprehensive, academic depth |
18
-
19
- ## Arguments
20
-
21
- Parse from $ARGUMENTS:
22
-
23
- - **topic**: The subject to learn about (required)
24
- - **--depth**: `brief` (10 sources), `medium` (20, default), or `deep` (40)
25
- - **--no-enhance**: Skip enhancement pass (default: enhance enabled)
26
-
27
- ## Execution
28
-
29
- ### Phase 1: Parse Arguments
30
-
31
- ```javascript
32
- const args = '$ARGUMENTS';
33
-
34
- // Extract depth flag
35
- const depthMatch = args.match(/--depth=(brief|medium|deep)/);
36
- const depth = depthMatch ? depthMatch[1] : 'medium';
37
- const noEnhance = args.includes('--no-enhance');
38
-
39
- // Extract topic (everything except flags)
40
- const topic = args
41
- .replace(/--depth=(brief|medium|deep)/g, '')
42
- .replace(/--no-enhance/g, '')
43
- .trim();
44
-
45
- if (!topic) {
46
- return 'Usage: /learn <topic> [--depth=brief|medium|deep]';
47
- }
48
-
49
- // Generate slug for filenames
50
- const slug = topic
51
- .toLowerCase()
52
- .replace(/[^a-z0-9\s-]/g, '')
53
- .replace(/\s+/g, '-')
54
- .replace(/-+/g, '-')
55
- .replace(/^-|-$/g, '')
56
- .substring(0, 64);
57
-
58
- // Source counts by depth
59
- const sourceCounts = { brief: 10, medium: 20, deep: 40 };
60
- const minSources = sourceCounts[depth];
61
- ```
62
-
63
- ### Phase 2: Check Existing Guide
64
-
65
- ```javascript
66
- // Check if guide already exists
67
- const existingGuide = await Glob({ pattern: `agent-knowledge/${slug}.md` });
68
-
69
- if (existingGuide.length > 0) {
70
- // Ask user: update existing or create fresh?
71
- const choice = **A guide for **
72
-
73
- 1. **Update existing** - Add new sources and refresh content
74
- 2. **Create fresh** - Start over with new research
75
-
76
- Reply with the number or name of your choice.
77
-
78
- if (choice === 'Create fresh') {
79
- // Will overwrite
80
- }
81
- }
82
- ```
83
-
84
- ### Phase 3: Spawn Learn Agent
85
-
86
- ```javascript
87
- const taskOutput = Delegate to the `learn-agent` subagent:
88
- > Research and create a learning guide.
89
- ```
90
-
91
- ### Phase 4: Parse Results
92
-
93
- ```javascript
94
- function parseLearnResult(output) {
95
- const match = output.match(/=== LEARN_RESULT ===[\s\S]*?({[\s\S]*?})[\s\S]*?=== END_RESULT ===/);
96
- return match ? JSON.parse(match[1]) : null;
97
- }
98
-
99
- const result = parseLearnResult(taskOutput);
100
- ```
101
-
102
- ### Phase 5: Present Results
103
-
104
- ```markdown
105
- ## Learning Guide Created
106
-
107
- **Topic**: {topic}
108
- **File**: agent-knowledge/{slug}.md
109
- **Sources**: {sourceCount} resources analyzed
110
-
111
- ### Quality Assessment
112
-
113
- | Metric | Rating |
114
- |--------|--------|
115
- | Coverage | {coverage}/10 |
116
- | Source Diversity | {diversity}/10 |
117
- | Example Quality | {examples}/10 |
118
- | Confidence | {confidence}/10 |
119
-
120
- ### Source Breakdown
121
-
122
- | Type | Count |
123
- |------|-------|
124
- | Official Docs | {n} |
125
- | Tutorials | {n} |
126
- | Q&A/Stack Overflow | {n} |
127
- | Blog Posts | {n} |
128
- | GitHub Examples | {n} |
129
-
130
- ### Next Steps
131
-
132
- - [ ] Review the guide at `agent-knowledge/{slug}.md`
133
- - [ ] Check source quality in `agent-knowledge/resources/{slug}-sources.json`
134
- - [ ] Run `/learn {related-topic}` to expand your knowledge base
135
- ```
136
-
137
- ## Output Structure
138
-
139
- Each `/learn` run creates/updates:
140
-
141
- ```
142
- agent-knowledge/
143
- CLAUDE.md # Master index (updated)
144
- AGENTS.md # Master index for OpenCode/Codex (updated)
145
- {slug}.md # Topic-specific guide (created)
146
- resources/
147
- {slug}-sources.json # Source metadata (created)
148
- ```
149
-
150
- ## Error Handling
151
-
152
- | Error | Action |
153
- |-------|--------|
154
- | No topic provided | Show usage help |
155
- | WebSearch fails | Retry with alternative queries |
156
- | Insufficient sources | Warn user, proceed with available |
157
- | Enhancement fails | Skip enhancement, note in output |
158
-
159
- ## Example Usage
160
-
161
- ```bash
162
- /learn recursion
163
- /learn react hooks --depth=deep
164
- /learn "kubernetes networking" --depth=brief
165
- /learn python async --no-enhance
166
- ```