Skill: domain-advisor
When to use
Use this skill when:
- The user message starts with
<advise>, or
- The user asks "What should we try next?" or similar planning questions.
Initialization
Read .codex/skills/registry.json to determine:
domain: research | unsloth | cuda
paths.reports: where to find experiment/benchmark reports
paths.experiment_log: path to experiment log
paths.troubleshooting: path to troubleshooting guide
Adapt behavior based on domain (see Domain-Specific Behavior below).
Inputs
- User goal (including constraints like run budget, hardware, time).
- Optional references to files (configs, reports, logs) mentioned in the goal.
Behavior
Understand the goal
- Parse the research/development goal and constraints.
- If unclear, ask a concise clarifying question.
Gather context
- Scan
.codex/skills/ for relevant result skills matching the task.
- Read relevant reports from the
paths.reports directory.
- Skim recent entries in
paths.experiment_log.
- If errors are mentioned, check
paths.troubleshooting for known patterns.
Propose a plan
- Design 2–5 concrete experiments/tasks, each with:
- Clear objective
- Key configuration/parameters
- Expected outcome or hypothesis
- Any relevant variation to test
- Respect constraints (budget, hardware, time).
- Reuse defaults from existing skills instead of inventing new ones.
Output format
Start with a short natural-language summary.
Provide a markdown table:
| id |
description |
key_differences |
notes |
Optionally propose file paths for configs or reports to create.
If errors were mentioned, explain how this plan avoids known failure patterns.
Logging
- When useful, append a short entry to
paths.experiment_log summarizing
the proposed plan (only with user approval).
Domain-Specific Behavior
Research Domain
When domain: research:
Focus areas:
- Hyperparameter sweeps (learning rate, batch size, epochs)
- Model architecture variations (layers, dimensions, attention heads)
- Dataset mixtures and sampling strategies
- Training dynamics (warmup, schedulers, checkpointing)
Context to gather:
training_reports/*.md - past training runs
- Model configs and their performance
- Loss curves and convergence patterns
Output emphasis:
- Parameter sweep tables with specific values
- Ablation study designs
- Baseline comparisons
Unsloth Domain
When domain: unsloth:
Focus areas:
- LoRA rank and alpha selection
- Quantization settings (4-bit, 8-bit, nf4)
- Gradient checkpointing configuration
- Fine-tuning hyperparameters for specific model families
- Memory optimization strategies
Context to gather:
training_reports/*.md - past fine-tuning runs
- Model-specific Unsloth configurations
- Memory usage patterns
Output emphasis:
- LoRA configuration recommendations
- Memory/speed tradeoffs
- Model-specific settings (Llama, Mistral, Qwen, etc.)
CUDA Domain
When domain: cuda:
Focus areas:
- Tiling strategies and block sizes
- Shared memory usage patterns
- Warp-level primitives
- Memory coalescing optimization
- Triton autotuning configurations
Context to gather:
benchmark_results/*.md - past kernel benchmarks
- Profiling data (nsight, ncu reports)
- Bandwidth and occupancy metrics
Output emphasis:
- Kernel configuration parameters
- Expected speedup estimates
- Memory access pattern recommendations
- Profiling metrics to track
Example Output
Research Example
## Experiment Plan: Attention Head Ablation
Based on previous runs in `training_reports/baseline-2025-01.md`, the 8-head
configuration achieved 92% accuracy. Testing whether fewer heads can match
this with lower compute.
| id | description | key_differences | notes |
|----|-------------|-----------------|-------|
| A1 | 4-head attention | heads=4 vs baseline 8 | Test if 4 heads sufficient |
| A2 | 6-head attention | heads=6 | Middle ground |
| A3 | 4-head + wider FFN | heads=4, ffn_dim=4096 | Compensate with FFN |
All runs use: lr=1e-4, batch_size=32, epochs=10 (from baseline config).
Unsloth Example
## Fine-tuning Plan: Llama-3 8B with Unsloth
Based on `training_reports/llama3-lora-v1.md`, rank=16 showed good results
but OOM'd at batch_size=4. Testing memory-efficient configurations.
| id | description | key_differences | notes |
|----|-------------|-----------------|-------|
| U1 | rank=8 + grad_ckpt | Lower rank, enable checkpointing | Memory baseline |
| U2 | rank=16 + 4bit | Full rank with 4-bit quantization | Quality vs memory |
| U3 | rank=32 + offload | Higher rank with CPU offload | Max quality attempt |
All runs use: alpha=32, dropout=0.05, target_modules=["q_proj", "v_proj"]
CUDA Example
## Kernel Optimization Plan: Softmax
Based on `benchmark_results/softmax-v1.md`, current implementation achieves
80% of theoretical bandwidth. Testing tiling strategies.
| id | description | key_differences | notes |
|----|-------------|-----------------|-------|
| K1 | 2D tiling | BLOCK_M=64, BLOCK_N=64 | Better L2 reuse |
| K2 | Warp reduction | Use warp shuffles | Reduce shared mem |
| K3 | Online softmax | Single-pass algorithm | Fused with attention |
Profile with: `ncu --set full` to capture memory metrics.
1---2name: domain-advisor3description: Plan experiments or development tasks using past knowledge. Adapts behavior based on project domain (research, unsloth, cuda) by reading registry.json. Triggers on <advise> or questions like "What should we try next?"4---5
6# Skill: domain-advisor
7
8## When to use
9
10Use this skill when:
11- The user message starts with `<advise>`, or
12- The user asks "What should we try next?" or similar planning questions.
13
14## Initialization
15
161. Read `.codex/skills/registry.json` to determine:
17 - `domain`: research | unsloth | cuda
18 - `paths.reports`: where to find experiment/benchmark reports
19 - `paths.experiment_log`: path to experiment log
20 - `paths.troubleshooting`: path to troubleshooting guide
21
222. Adapt behavior based on domain (see Domain-Specific Behavior below).
23
24## Inputs
25
26- User goal (including constraints like run budget, hardware, time).
27- Optional references to files (configs, reports, logs) mentioned in the goal.
28
29## Behavior
30
311. **Understand the goal**
32 - Parse the research/development goal and constraints.
33 - If unclear, ask a concise clarifying question.
34
352. **Gather context**
36 - Scan `.codex/skills/` for **relevant result skills** matching the task.
37 - Read relevant reports from the `paths.reports` directory.
38 - Skim recent entries in `paths.experiment_log`.
39 - If errors are mentioned, check `paths.troubleshooting` for known patterns.
40
413. **Propose a plan**
42 - Design **2–5 concrete experiments/tasks**, each with:
43 - Clear objective
44 - Key configuration/parameters
45 - Expected outcome or hypothesis
46 - Any relevant variation to test
47 - Respect constraints (budget, hardware, time).
48 - **Reuse defaults** from existing skills instead of inventing new ones.
49
504. **Output format**
51 - Start with a short natural-language summary.
52 - Provide a markdown table:
53
54 | id | description | key_differences | notes |
55 |----|-------------|-----------------|-------|
56
57 - Optionally propose file paths for configs or reports to create.
58 - If errors were mentioned, explain how this plan avoids known failure patterns.
59
605. **Logging**
61 - When useful, append a short entry to `paths.experiment_log` summarizing
62 the proposed plan (only with user approval).
63
64---
65
66## Domain-Specific Behavior
67
68### Research Domain
69
70When `domain: research`:
71
72**Focus areas:**
73- Hyperparameter sweeps (learning rate, batch size, epochs)
74- Model architecture variations (layers, dimensions, attention heads)
75- Dataset mixtures and sampling strategies
76- Training dynamics (warmup, schedulers, checkpointing)
77
78**Context to gather:**
79- `training_reports/*.md` - past training runs
80- Model configs and their performance
81- Loss curves and convergence patterns
82
83**Output emphasis:**
84- Parameter sweep tables with specific values
85- Ablation study designs
86- Baseline comparisons
87
88### Unsloth Domain
89
90When `domain: unsloth`:
91
92**Focus areas:**
93- LoRA rank and alpha selection
94- Quantization settings (4-bit, 8-bit, nf4)
95- Gradient checkpointing configuration
96- Fine-tuning hyperparameters for specific model families
97- Memory optimization strategies
98
99**Context to gather:**
100- `training_reports/*.md` - past fine-tuning runs
101- Model-specific Unsloth configurations
102- Memory usage patterns
103
104**Output emphasis:**
105- LoRA configuration recommendations
106- Memory/speed tradeoffs
107- Model-specific settings (Llama, Mistral, Qwen, etc.)
108
109### CUDA Domain
110
111When `domain: cuda`:
112
113**Focus areas:**
114- Tiling strategies and block sizes
115- Shared memory usage patterns
116- Warp-level primitives
117- Memory coalescing optimization
118- Triton autotuning configurations
119
120**Context to gather:**
121- `benchmark_results/*.md` - past kernel benchmarks
122- Profiling data (nsight, ncu reports)
123- Bandwidth and occupancy metrics
124
125**Output emphasis:**
126- Kernel configuration parameters
127- Expected speedup estimates
128- Memory access pattern recommendations
129- Profiling metrics to track
130
131---
132
133## Example Output
134
135### Research Example
136
137```markdown
138## Experiment Plan: Attention Head Ablation
139
140Based on previous runs in `training_reports/baseline-2025-01.md`, the 8-head
141configuration achieved 92% accuracy. Testing whether fewer heads can match
142this with lower compute.
143
144| id | description | key_differences | notes |
145|----|-------------|-----------------|-------|
146| A1 | 4-head attention | heads=4 vs baseline 8 | Test if 4 heads sufficient |
147| A2 | 6-head attention | heads=6 | Middle ground |
148| A3 | 4-head + wider FFN | heads=4, ffn_dim=4096 | Compensate with FFN |
149
150All runs use: lr=1e-4, batch_size=32, epochs=10 (from baseline config).
151```
152
153### Unsloth Example
154
155```markdown
156## Fine-tuning Plan: Llama-3 8B with Unsloth
157
158Based on `training_reports/llama3-lora-v1.md`, rank=16 showed good results
159but OOM'd at batch_size=4. Testing memory-efficient configurations.
160
161| id | description | key_differences | notes |
162|----|-------------|-----------------|-------|
163| U1 | rank=8 + grad_ckpt | Lower rank, enable checkpointing | Memory baseline |
164| U2 | rank=16 + 4bit | Full rank with 4-bit quantization | Quality vs memory |
165| U3 | rank=32 + offload | Higher rank with CPU offload | Max quality attempt |
166
167All runs use: alpha=32, dropout=0.05, target_modules=["q_proj", "v_proj"]
168```
169
170### CUDA Example
171
172```markdown
173## Kernel Optimization Plan: Softmax
174
175Based on `benchmark_results/softmax-v1.md`, current implementation achieves
17680% of theoretical bandwidth. Testing tiling strategies.
177
178| id | description | key_differences | notes |
179|----|-------------|-----------------|-------|
180| K1 | 2D tiling | BLOCK_M=64, BLOCK_N=64 | Better L2 reuse |
181| K2 | Warp reduction | Use warp shuffles | Reduce shared mem |
182| K3 | Online softmax | Single-pass algorithm | Fused with attention |
183
184Profile with: `ncu --set full` to capture memory metrics.
185```