omnilearn-workflow 1.0.0

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.
@@ -0,0 +1,434 @@
1
+ ---
2
+ description: Refine, update, or get answers about a specific subtopic within a skill's learning roadmap. Deep research + structured updates for individual topics.
3
+ ---
4
+
5
+ # /omnilearn-refine — Refine a Subtopic or Answer Questions About It
6
+
7
+ ## Usage
8
+ ```
9
+ /omnilearn-refine Rust ownership I'm confused about borrowing rules
10
+ /omnilearn-refine Python decorators Can you add more depth to this topic?
11
+ /omnilearn-refine React hooks The explanation of useEffect is too shallow
12
+ /omnilearn-refine Machine Learning gradient-descent I need more math background
13
+ /omnilearn-refine Go concurrency Can you restructure this topic?
14
+ ```
15
+
16
+ ## Purpose
17
+
18
+ This command handles TWO scenarios:
19
+
20
+ 1. **User has questions or doubts** about a specific subtopic they're learning → research + explain + optional practice exercises
21
+ 2. **User wants to refine/update** a specific topic's roadmap → research + restructure with full rigor
22
+
23
+ Both scenarios follow the same core flow: research → analyze → produce structured output.
24
+
25
+ ## Directory Structure
26
+
27
+ ```
28
+ .omnilearn/<skill>/
29
+ ├── roadmap.md
30
+ ├── SkillPreferences.md
31
+ ├── progress-index.md
32
+ ├── runs/
33
+ │ └── YYYY-MM-DD-HHMMSS-refine-<topic>/
34
+ │ ├── agent-log.md
35
+ │ ├── research-findings.md ← Research output
36
+ │ ├── refinement-plan.md ← What changes are needed
37
+ │ └── updated-topic-roadmap.md ← Draft of updated topic roadmap
38
+ └── topics/
39
+ └── <topic>/
40
+ ├── topic-roadmap.md ← Will be updated if refined
41
+ ├── assignments/ ← May be added to if needed
42
+ └── runs/
43
+ ```
44
+
45
+ ## MANDATORY TOOLS
46
+
47
+ | Tool | When | Why |
48
+ |------|------|-----|
49
+ | `google_search` / `websearch_web_search_exa` | Research | Topic research, answer questions, validate changes |
50
+ | `context7_query_docs` | Tech topics | Official documentation for precise answers |
51
+ | `task(category="unspecified-high", background)` | Heavy work | Research, analysis, topic updates |
52
+ | `read`, `write`, `edit`, `bash`, `grep`, `glob` | All phases | File operations |
53
+
54
+ ## Phase 0: INTENT GATE — Parse Input
55
+
56
+ ### 0.1 Parse Input
57
+
58
+ Extract skill, topic, and the user's question/request:
59
+ - "omnilearn-refine Rust ownership I'm confused about borrowing rules"
60
+ → skill: `Rust`, topic: `ownership`, request: "confused about borrowing rules" (QUESTION)
61
+ - "omnilearn-refine Python decorators Can you add more depth?"
62
+ → skill: `Python`, topic: `decorators`, request: "add more depth" (REFINE)
63
+ - "omnilearn-refine React hooks The explanation is too shallow"
64
+ → skill: `React`, topic: `hooks`, request: "explanation too shallow" (REFINE)
65
+
66
+ If topic is ambiguous or missing, ask:
67
+ > "Which topic in {skill} would you like to look at? Available topics: {list}"
68
+
69
+ ### 0.2 Determine Intent Type
70
+
71
+ Classify the request as either:
72
+ - **QUESTION** — user has a doubt, confusion, or needs explanation
73
+ - **REFINE** — user wants the topic roadmap improved, expanded, or restructured
74
+
75
+ **Rule of thumb:** If the user says "I'm confused", "I don't understand", "explain", "how does X work" → QUESTION. If they say "add more", "this is too shallow", "restructure", "improve" → REFINE.
76
+
77
+ ### 0.3 Validate Existence
78
+
79
+ ```bash
80
+ OMNILEARN_CONFIG="$HOME/.config/opencode/omnilearn.json"
81
+
82
+ if [ ! -f "$OMNILEARN_CONFIG" ]; then
83
+ echo "OmniLearn is not configured yet."
84
+ echo ""
85
+ echo "Run this first:"
86
+ echo " /omnilearn-init"
87
+ exit 1
88
+ fi
89
+
90
+ LEARNING_DIR=$(grep -o '"learningDirectory"[[:space:]]*:[[:space:]]*"[^"]*"' "$OMNILEARN_CONFIG" | sed 's/"learningDirectory"[[:space:]]*:[[:space:]]*"//' | sed 's/"$//')
91
+ OMNILEARN_DIR="$LEARNING_DIR/.omnilearn"
92
+ SKILL_DIR="$OMNILEARN_DIR/<skill>"
93
+ TOPIC_DIR="$SKILL_DIR/topics/<topic>"
94
+ TOPIC_ROADMAP="$TOPIC_DIR/topic-roadmap.md"
95
+ CURRENT_RUN="$SKILL_DIR/runs/$(date +%s)-refine-<topic>"
96
+ GLOBAL_PREFS="$OMNILEARN_DIR/UserPreferences.md"
97
+
98
+ if [ ! -d "$SKILL_DIR" ]; then
99
+ echo "Skill '{skill}' not found. Create a roadmap first: /omnilearn-roadmap {skill}"
100
+ exit 1
101
+ fi
102
+
103
+ if [ ! -d "$TOPIC_DIR" ] || [ ! -f "$TOPIC_ROADMAP" ]; then
104
+ echo "Topic '{topic}' not found or doesn't have a topic roadmap yet."
105
+ echo "Start learning it first: /omnilearn-start {skill} (then choose {topic})"
106
+ exit 1
107
+ fi
108
+
109
+ mkdir -p "$CURRENT_RUN"
110
+ ```
111
+
112
+ ### 0.4 Read Existing Files
113
+
114
+ Read:
115
+ - `UserPreferences.md` (if exists) — user's learning style, experience
116
+ - `SkillPreferences.md` — per-skill context
117
+ - `topic-roadmap.md` — the current topic structure
118
+ - Any existing assignments for context on what the user has done
119
+
120
+ ## Phase 1: QUESTION FLOW — User Has a Doubt
121
+
122
+ Use this flow when intent is **QUESTION**.
123
+
124
+ ### 1.1 Generate a Diagnostic Task (Not Just an Explanation)
125
+
126
+ **Rule: The user learns by DOING. When they ask a question, give them a focused micro-exercise that isolates the confusing concept.** Understanding comes from solving, not reading.
127
+
128
+ ```typescript
129
+ task(category="unspecified-high", run_in_background=false, prompt="
130
+ 1. TASK: Create a focused micro-exercise that tests the user's understanding of '{concept}' in '{skill}'. The user is confused about: '{user_request}'.
131
+ 2. EXPECTED OUTCOME: A self-contained micro-exercise (5-15 min) that isolates the specific concept and lets the user figure it out by coding/building.
132
+
133
+ 3. REQUIRED TOOLS: google_search, websearch_web_search_exa, context7_resolve-library-id, context7_query_docs, read, write
134
+
135
+ 4. MUST DO:
136
+ - Read the current topic-roadmap.md to understand what's been covered: {TOPIC_ROADMAP}
137
+ - Read any existing assignments to understand context: {TOPIC_DIR}/assignments/ (list only, read specifics if needed)
138
+ - Research the concept online to find the MOST COMMON confusion points
139
+ - Design a micro-exercise that:
140
+ * ISOLATES the confusing concept — removes unrelated complexity
141
+ * Is a real-world-ish scenario (NOT 'write a function that...' — frame it as solving a concrete problem)
142
+ * Can be solved in 5-15 minutes
143
+ * Requires the user to WRITE CODE / BUILD SOMETHING / PRODUCE OUTPUT
144
+ * Has a CLEAR RIGHT ANSWER that they can verify
145
+ - Include in the exercise brief:
146
+ * A short problem scenario (1-2 sentences, real-world framing)
147
+ * What to build/do
148
+ * Success criteria (how they know it's correct)
149
+ * A hint ONLY if they get stuck (hidden section at bottom)
150
+ - Save to: {CURRENT_RUN}/interaction-diagnostic-task.md
151
+ - The file should contain: task description + any starter code + verification steps
152
+
153
+ 5. MUST NOT DO:
154
+ - Do NOT write a long explanation — the task IS the teaching tool
155
+ - Do NOT give away the solution to any existing assignment
156
+ - Do NOT make the exercise too complex — isolate ONE concept only
157
+ - Do NOT skip the hands-on component — user must produce something
158
+
159
+ 6. CONTEXT:
160
+ - Skill: {skill}
161
+ - Topic: {topic}
162
+ - User's question: {user_request}
163
+ - User experience level: {from preferences}
164
+ ")
165
+ ```
166
+
167
+ ### 1.2 Present the Diagnostic Task
168
+
169
+ ```markdown
170
+ ┌──────────────────────────────────────────────────────────────────┐
171
+ │ 🎯 Let's Figure This Out By Doing │
172
+ ├──────────────────────────────────────────────────────────────────┤
173
+ │ Topic: {skill}/{topic} │
174
+ │ │
175
+ │ The best way to understand this is to work through it. │
176
+ │ Here's a focused exercise: │
177
+ │ │
178
+ │ 📝 {CURRENT_RUN}/interaction-diagnostic-task.md │
179
+ │ │
180
+ │ It should take 5-15 minutes. Try solving it, then we'll │
181
+ │ discuss what clicked. │
182
+ │ │
183
+ │ Questions while you work? I'm here. │
184
+ └──────────────────────────────────────────────────────────────────┘
185
+ ```
186
+
187
+ ### 1.3 Follow Up After the Task
188
+
189
+ When the user completes the micro-exercise:
190
+ 1. Verify their solution (check output, run any verification code).
191
+ 2. Discuss what they learned from solving it.
192
+ 3. Connect it back to the original concept they were confused about.
193
+ 4. If they're still confused, generate a SECOND diagnostic task with a different angle.
194
+ 5. **Only resort to a direct explanation after 2 failed task attempts** — and even then, keep it minimal with a follow-up task.
195
+
196
+ ### 1.4 Log the Interaction
197
+
198
+ Save a record of the interaction (question + task + outcome) to:
199
+ - `{CURRENT_RUN}/agent-log.md` — what happened, what was created, outcome
200
+ - Update `topic-progress.md` if the interaction revealed something about the user's learning (e.g., "struggled with X concept, resolved through Y practice task")
201
+
202
+ ## Phase 2: REFINE FLOW — User Wants Topic Roadmap Improved
203
+
204
+ Use this flow when intent is **REFINE**.
205
+
206
+ ### 2.1 Research the Current Topic + Requested Changes
207
+
208
+ ```typescript
209
+ task(category="unspecified-high", run_in_background=true, prompt="
210
+ 1. TASK: Analyze the current '{topic}' topic roadmap and the user's refinement request for '{skill}'.
211
+ 2. EXPECTED OUTCOME: A detailed analysis of what needs to change in the topic roadmap.
212
+
213
+ 3. REQUIRED TOOLS: read, write, grep
214
+
215
+ 4. MUST DO:
216
+ - Read the full topic-roadmap.md: {TOPIC_ROADMAP}
217
+ - Read the main skill roadmap for context: {SKILL_DIR}/roadmap.md
218
+ - Read the skill preferences: {SKILL_DIR}/SkillPreferences.md
219
+ - Analyze the user's request: '{user_request}'
220
+ - Identify exactly what's needed:
221
+ * Is the current depth insufficient? → what's missing
222
+ * Is the structure wrong? → what order makes more sense
223
+ * Are there missing subtopics? → what should be added
224
+ * Are prerequisites not clear? → what's missing
225
+ - Produce a detailed analysis saved to: {CURRENT_RUN}/refinement-plan.md
226
+ - Format: For each change, specify: What, Why, Where in the structure
227
+
228
+ 5. MUST NOT DO:
229
+ - Do NOT make any actual changes to files — analysis only
230
+ - Do NOT discard existing content — note what should be kept vs changed
231
+
232
+ 6. CONTEXT:
233
+ - Skill: {skill}
234
+ - Topic: {topic}
235
+ - User request: {user_request}
236
+ ")
237
+ ```
238
+
239
+ ### 2.2 Online Research for Refinement
240
+
241
+ ```typescript
242
+ task(category="unspecified-high", run_in_background=true, prompt="
243
+ 1. TASK: Research online to find better ways to structure and teach '{topic}' in '{skill}'.
244
+ 2. EXPECTED OUTCOME: A research document with web-sourced findings about best practices for teaching/learning this topic.
245
+
246
+ 3. REQUIRED TOOLS: google_search, websearch_web_search_exa, context7_resolve-library-id, context7_query_docs, read, write
247
+
248
+ 4. MUST DO:
249
+ - Analyze the user's refinement request: '{user_request}'
250
+ - Use web search extensively to find:
251
+ * Alternative structures and progressions for this topic
252
+ * Common curriculum approaches from reputable sources
253
+ * Best practices for teaching this specific topic
254
+ * Deeper coverage of subtopics the user mentioned
255
+ * Real-world applications and project ideas
256
+ - For tech topics, use context7 for official docs
257
+ - For each finding, document: source, key insight, relevance to the refinement
258
+ - Save to: {CURRENT_RUN}/research-findings.md
259
+
260
+ 5. MUST NOT DO:
261
+ - Do NOT make any changes to files — research only
262
+ - Do NOT skip research even if you're familiar with the topic
263
+ ")
264
+ ```
265
+
266
+ ### 2.3 Collect Both Results
267
+
268
+ Wait for both to complete. Read the analysis and research files.
269
+
270
+ ### 2.4 Spawn Topic Roadmap Update Subagent
271
+
272
+ ```typescript
273
+ task(category="unspecified-high", run_in_background=false, timeout=300000, prompt="
274
+ 1. TASK: Update the '{topic}' topic-roadmap.md based on the refinement analysis and online research.
275
+ 2. EXPECTED OUTCOME: An updated topic-roadmap.md that addresses the user's concerns.
276
+
277
+ 3. REQUIRED TOOLS: google_search, websearch_web_search_exa, read, write
278
+
279
+ 4. MUST DO:
280
+ - Read the refinement analysis: {CURRENT_RUN}/refinement-plan.md
281
+ - Read the online research: {CURRENT_RUN}/research-findings.md
282
+ - Read the current topic roadmap: {TOPIC_ROADMAP}
283
+ - Read existing assignments to understand what exists: {TOPIC_DIR}/assignments/ (just list — read only what's needed)
284
+ - Update the topic-roadmap.md at: {TOPIC_ROADMAP}
285
+ - Preserve ALL existing structure that's still valid
286
+ - Add/modify based on the research
287
+ - Keep the same format as the original
288
+ - Write to: {TOPIC_ROADMAP}
289
+
290
+ 5. MUST NOT DO:
291
+ - Do NOT delete or modify assignment files — only the topic-roadmap.md
292
+ - Do NOT remove completed subtopics if they've been studied
293
+ - Do NOT create new assignments (that's /omnilearn-start's job)
294
+ - Do NOT change the overall structure format
295
+
296
+ 6. CONTEXT:
297
+ - Skill: {skill}
298
+ - Topic: {topic}
299
+ - User request: {user_request}
300
+ ")
301
+ ```
302
+
303
+ ### 2.5 Verify the Updated Roadmap
304
+
305
+ Read the updated topic-roadmap.md and verify:
306
+ - All existing content worth keeping is preserved
307
+ - New content addresses the user's concerns
308
+ - Structure is clear and logical
309
+ - Prerequisites are documented
310
+ - Learning objectives are clear
311
+
312
+ If anything is wrong, spawn a fix via continuation.
313
+
314
+ ## Phase 3: UPDATE PREFERENCES & LOG
315
+
316
+ ### 3.1 Update UserPreferences.md
317
+
318
+ If the interaction reveals new user preferences:
319
+ - User struggles with certain types of concepts → note learning style insight
320
+ - User asks for specific depth/approach → update preferences
321
+ - User shows interest in specific applications → note career/focus interests
322
+
323
+ ### 3.2 Update SkillPreferences.md
324
+
325
+ Record the refinement/question session in the skill preferences.
326
+
327
+ ### 3.3 Write Agent Log
328
+
329
+ Write to `$CURRENT_RUN/agent-log.md`:
330
+ - Whether this was a QUESTION or REFINE session
331
+ - What the user asked
332
+ - What research was conducted
333
+ - What files were created or modified
334
+ - Key decisions made
335
+ - Any changes to user preferences
336
+
337
+ ## Phase 4: PRESENT TO USER
338
+
339
+ ### 4.1 For Question Flow
340
+
341
+ ```markdown
342
+ ┌──────────────────────────────────────────────────────────────────┐
343
+ │ ✅ Question Answered │
344
+ ├──────────────────────────────────────────────────────────────────┤
345
+ │ Topic: {skill}/{topic} │
346
+ │ │
347
+ │ Full explanation saved to: │
348
+ │ {CURRENT_RUN}/interaction-question.md │
349
+ │ │
350
+ │ Want more practice on this concept? I can create exercises. │
351
+ │ Ready to get back to learning? Use /omnilearn-start {skill} │
352
+ └──────────────────────────────────────────────────────────────────┘
353
+ ```
354
+
355
+ ### 4.2 For Refine Flow
356
+
357
+ ```markdown
358
+ ┌──────────────────────────────────────────────────────────────────┐
359
+ │ ✅ Topic Roadmap Refined │
360
+ ├──────────────────────────────────────────────────────────────────┤
361
+ │ {skill}/{topic} — topic roadmap updated │
362
+ │ │
363
+ │ Changes made: │
364
+ │ • {change 1} │
365
+ │ • {change 2} │
366
+ │ • {change 3} │
367
+ │ │
368
+ │ 📍 Updated: {TOPIC_ROADMAP} │
369
+ │ │
370
+ │ Previous version automatically archived in the run log. │
371
+ │ │
372
+ │ Next: Use /omnilearn-start {skill} to continue learning. │
373
+ │ Any feedback on these changes? │
374
+ └──────────────────────────────────────────────────────────────────┘
375
+ ```
376
+
377
+ ## Phase 5: GIT COMMIT
378
+
379
+ ```bash
380
+ if git rev-parse --git-dir > /dev/null 2>&1; then
381
+ git add "$OMNILEARN_DIR/"
382
+ git commit -m "omnilearn: refine topic '{topic}' in {skill}
383
+
384
+ - {summary of what was done}
385
+ - Updated topic roadmap / provided explanations
386
+ "
387
+ fi
388
+ ```
389
+
390
+ If no git repo: ask if user wants to initialize one (same pattern).
391
+
392
+ ## Quality Gates
393
+
394
+ | Check | Phase | Action if Failed |
395
+ |-------|-------|-----------------|
396
+ | Skill folder exists | 0 | Tell user to create roadmap first |
397
+ | Topic folder + roadmap exists | 0 | Tell user to start learning first |
398
+ | Intent correctly classified (QUESTION vs REFINE) | 0 | Re-classify, ask user if unsure |
399
+ | Research subagent completed (QUESTION) | 1 | Re-spawn with better instructions |
400
+ | Analysis + research subagents completed (REFINE) | 2 | Re-spawn |
401
+ | Topic roadmap updated with proper structure (REFINE) | 2 | Fix via continuation |
402
+ | Existing assignments not modified (REFINE) | 2 | Revert if accidentally changed |
403
+ | Agent log written | 3 | Write it |
404
+ | Git commit attempted | 5 | Ask user if they want to skip |
405
+
406
+ ## Error Recovery
407
+
408
+ | Situation | Action |
409
+ |-----------|--------|
410
+ | Topic not found | Suggest available topics from the skill roadmap |
411
+ | User's question is too vague | Ask clarifying questions before researching |
412
+ | Research yields poor results | Try alternative search queries, broaden scope |
413
+ | Refinement accidentally modifies assignments | Revert: `git checkout .omnilearn/{skill}/topics/{topic}/assignments/` |
414
+ | User wants to undo refinement | Archive current, restore from git or previous file in runs/ |
415
+ | User has multiple questions | Answer the most foundational one first, then the dependent ones |
416
+
417
+ ## What You MUST Do
418
+
419
+ - ✅ **Classify intent first** — QUESTION or REFINE, they have different flows
420
+ - ✅ **Read existing topic-roadmap.md** before doing anything
421
+ - ✅ **Research online** — don't rely on internal knowledge alone
422
+ - ✅ **Keep explanations practical** — examples, code, analogies
423
+ - ✅ **Preserve existing assignments** — never modify learning materials
424
+ - ✅ **Log everything** — interaction files for questions, agent logs for sessions
425
+ - ✅ **Update preferences** when you learn something new about the user
426
+ - ✅ **Git commit after changes**
427
+
428
+ ## What You MUST NOT Do
429
+
430
+ - ❌ Do NOT modify assignment files during refinement — only the topic-roadmap.md
431
+ - ❌ Do NOT skip web research — even for topics you're confident about
432
+ - ❌ Do NOT give away assignment solutions when answering questions
433
+ - ❌ Do NOT proceed with ambiguous requests — ask clarifying questions first
434
+ - ❌ Do NOT push to remote without explicit user approval