opencode-skills-collection 4.0.44 → 4.0.46

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 (117) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +25 -1
  2. package/bundled-skills/agy-delegate/SKILL.md +168 -0
  3. package/bundled-skills/agy-delegate/references/dispatch-and-poll.md +140 -0
  4. package/bundled-skills/agy-delegate/references/multi-task-queues.md +59 -0
  5. package/bundled-skills/agy-delegate/references/review-and-land.md +103 -0
  6. package/bundled-skills/agy-delegate/references/writing-the-brief.md +124 -0
  7. package/bundled-skills/aider-delegate/SKILL.md +227 -0
  8. package/bundled-skills/aider-delegate/references/dispatch-and-poll.md +154 -0
  9. package/bundled-skills/aider-delegate/references/multi-task-queues.md +68 -0
  10. package/bundled-skills/aider-delegate/references/review-and-land.md +101 -0
  11. package/bundled-skills/aider-delegate/references/writing-the-brief.md +142 -0
  12. package/bundled-skills/babysit-pr/SKILL.md +343 -0
  13. package/bundled-skills/claude-delegate/SKILL.md +182 -0
  14. package/bundled-skills/claude-delegate/references/dispatch-and-poll.md +220 -0
  15. package/bundled-skills/claude-delegate/references/multi-task-queues.md +66 -0
  16. package/bundled-skills/claude-delegate/references/review-and-land.md +117 -0
  17. package/bundled-skills/claude-delegate/references/writing-the-brief.md +158 -0
  18. package/bundled-skills/cline-delegate/SKILL.md +140 -0
  19. package/bundled-skills/cline-delegate/references/dispatch-and-poll.md +142 -0
  20. package/bundled-skills/cline-delegate/references/multi-task-queues.md +58 -0
  21. package/bundled-skills/cline-delegate/references/review-and-land.md +80 -0
  22. package/bundled-skills/cline-delegate/references/writing-the-brief.md +129 -0
  23. package/bundled-skills/codex-delegate/SKILL.md +177 -0
  24. package/bundled-skills/codex-delegate/references/dispatch-and-poll.md +161 -0
  25. package/bundled-skills/codex-delegate/references/multi-task-queues.md +66 -0
  26. package/bundled-skills/codex-delegate/references/review-and-land.md +126 -0
  27. package/bundled-skills/codex-delegate/references/writing-the-brief.md +125 -0
  28. package/bundled-skills/commandcode-delegate/SKILL.md +188 -0
  29. package/bundled-skills/commandcode-delegate/references/dispatch-and-poll.md +222 -0
  30. package/bundled-skills/commandcode-delegate/references/multi-task-queues.md +81 -0
  31. package/bundled-skills/commandcode-delegate/references/review-and-land.md +144 -0
  32. package/bundled-skills/commandcode-delegate/references/writing-the-brief.md +147 -0
  33. package/bundled-skills/copilot-delegate/SKILL.md +159 -0
  34. package/bundled-skills/copilot-delegate/references/dispatch-and-poll.md +143 -0
  35. package/bundled-skills/copilot-delegate/references/multi-task-queues.md +58 -0
  36. package/bundled-skills/copilot-delegate/references/review-and-land.md +80 -0
  37. package/bundled-skills/copilot-delegate/references/writing-the-brief.md +140 -0
  38. package/bundled-skills/cursor-delegate/SKILL.md +170 -0
  39. package/bundled-skills/cursor-delegate/references/dispatch-and-poll.md +162 -0
  40. package/bundled-skills/cursor-delegate/references/multi-task-queues.md +59 -0
  41. package/bundled-skills/cursor-delegate/references/review-and-land.md +93 -0
  42. package/bundled-skills/cursor-delegate/references/writing-the-brief.md +126 -0
  43. package/bundled-skills/debate-review/SKILL.md +85 -0
  44. package/bundled-skills/debate-review/assets/prompts/review-debate.md +51 -0
  45. package/bundled-skills/debate-review/assets/prompts/review-main.md +64 -0
  46. package/bundled-skills/debate-review/assets/prompts/review-rebuttal.md +42 -0
  47. package/bundled-skills/debate-review/references/comment-format.md +63 -0
  48. package/bundled-skills/debate-review/references/schema.md +95 -0
  49. package/bundled-skills/delegate-setup/SKILL.md +215 -0
  50. package/bundled-skills/delegate-setup/references/schema.md +100 -0
  51. package/bundled-skills/delegate-setup/references/setup-dialogue.md +101 -0
  52. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  53. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  54. package/bundled-skills/docs/maintainers/repo-growth-seo.md +1 -1
  55. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  56. package/bundled-skills/docs/users/aas-core.md +1 -1
  57. package/bundled-skills/docs/users/bundles.md +1 -1
  58. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  59. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  60. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  61. package/bundled-skills/docs/users/usage.md +3 -3
  62. package/bundled-skills/docs/users/visual-guide.md +4 -4
  63. package/bundled-skills/falsify/SKILL.md +263 -0
  64. package/bundled-skills/falsify/references/bias-catalog.md +42 -0
  65. package/bundled-skills/falsify/references/mental-models.md +135 -0
  66. package/bundled-skills/falsify/templates/thinking-ledger.md +104 -0
  67. package/bundled-skills/graceful-shutdown/SKILL.md +379 -0
  68. package/bundled-skills/grok-delegate/SKILL.md +179 -0
  69. package/bundled-skills/grok-delegate/references/dispatch-and-poll.md +171 -0
  70. package/bundled-skills/grok-delegate/references/multi-task-queues.md +67 -0
  71. package/bundled-skills/grok-delegate/references/review-and-land.md +130 -0
  72. package/bundled-skills/grok-delegate/references/writing-the-brief.md +119 -0
  73. package/bundled-skills/kimi-delegate/SKILL.md +137 -0
  74. package/bundled-skills/kimi-delegate/references/dispatch-and-poll.md +134 -0
  75. package/bundled-skills/kimi-delegate/references/multi-task-queues.md +58 -0
  76. package/bundled-skills/kimi-delegate/references/review-and-land.md +92 -0
  77. package/bundled-skills/kimi-delegate/references/writing-the-brief.md +132 -0
  78. package/bundled-skills/omp-delegate/SKILL.md +186 -0
  79. package/bundled-skills/omp-delegate/references/dispatch-and-poll.md +155 -0
  80. package/bundled-skills/omp-delegate/references/multi-task-queues.md +59 -0
  81. package/bundled-skills/omp-delegate/references/review-and-land.md +95 -0
  82. package/bundled-skills/omp-delegate/references/writing-the-brief.md +149 -0
  83. package/bundled-skills/opencode-delegate/SKILL.md +189 -0
  84. package/bundled-skills/opencode-delegate/references/dispatch-and-poll.md +156 -0
  85. package/bundled-skills/opencode-delegate/references/multi-task-queues.md +68 -0
  86. package/bundled-skills/opencode-delegate/references/review-and-land.md +125 -0
  87. package/bundled-skills/opencode-delegate/references/writing-the-brief.md +142 -0
  88. package/bundled-skills/pi-delegate/SKILL.md +148 -0
  89. package/bundled-skills/pi-delegate/references/dispatch-and-poll.md +146 -0
  90. package/bundled-skills/pi-delegate/references/multi-task-queues.md +59 -0
  91. package/bundled-skills/pi-delegate/references/review-and-land.md +95 -0
  92. package/bundled-skills/pi-delegate/references/writing-the-brief.md +132 -0
  93. package/bundled-skills/qoder-delegate/SKILL.md +151 -0
  94. package/bundled-skills/qoder-delegate/references/dispatch-and-poll.md +119 -0
  95. package/bundled-skills/qoder-delegate/references/multi-task-queues.md +43 -0
  96. package/bundled-skills/qoder-delegate/references/review-and-land.md +66 -0
  97. package/bundled-skills/qoder-delegate/references/writing-the-brief.md +85 -0
  98. package/bundled-skills/sandbase-mcp/SKILL.md +194 -0
  99. package/bundled-skills/ui-slop-score/SKILL.md +2 -2
  100. package/bundled-skills/unsloth-finetuning/SKILL.md +352 -0
  101. package/bundled-skills/vibe-delegate/SKILL.md +147 -0
  102. package/bundled-skills/vibe-delegate/references/dispatch-and-poll.md +144 -0
  103. package/bundled-skills/vibe-delegate/references/multi-task-queues.md +59 -0
  104. package/bundled-skills/vibe-delegate/references/review-and-land.md +87 -0
  105. package/bundled-skills/vibe-delegate/references/writing-the-brief.md +131 -0
  106. package/bundled-skills/warp-delegate/SKILL.md +192 -0
  107. package/bundled-skills/warp-delegate/references/dispatch-and-poll.md +163 -0
  108. package/bundled-skills/warp-delegate/references/multi-task-queues.md +80 -0
  109. package/bundled-skills/warp-delegate/references/review-and-land.md +123 -0
  110. package/bundled-skills/warp-delegate/references/writing-the-brief.md +105 -0
  111. package/bundled-skills/zcode-delegate/SKILL.md +202 -0
  112. package/bundled-skills/zcode-delegate/references/dispatch-and-poll.md +113 -0
  113. package/bundled-skills/zcode-delegate/references/multi-task-queues.md +87 -0
  114. package/bundled-skills/zcode-delegate/references/review-and-land.md +81 -0
  115. package/bundled-skills/zcode-delegate/references/writing-the-brief.md +120 -0
  116. package/package.json +1 -1
  117. package/skills_index.json +660 -0
@@ -0,0 +1,352 @@
1
+ ---
2
+ name: unsloth-finetuning
3
+ description: "Fine-tune and post-train LLMs with Unsloth Core on a single consumer GPU: VRAM sizing, LoRA/QLoRA, GRPO/DPO, chat-template correctness, and GGUF export."
4
+ category: ai-ml
5
+ risk: critical
6
+ source: community
7
+ source_repo: unslothai/unsloth
8
+ source_type: community
9
+ date_added: "2026-08-27"
10
+ author: A-ryanVAT-S
11
+ tags: [unsloth, fine-tuning, lora, qlora, grpo, gguf, vram]
12
+ tools: [claude, cursor, gemini]
13
+ license: "Apache-2.0"
14
+ license_source: "https://github.com/unslothai/unsloth/blob/main/LICENSE"
15
+ ---
16
+
17
+ # Unsloth Fine-Tuning
18
+
19
+ ## Overview
20
+
21
+ Unsloth trains LLMs with custom kernels that cut VRAM use and step time without changing the
22
+ math, which makes single-GPU fine-tuning practical on hardware that would otherwise OOM.
23
+ This skill covers **Unsloth Core** — the Python API — because that is what an agent can drive
24
+ programmatically; the Desktop app and Studio web UI are interactive and out of scope.
25
+
26
+ The hard parts of an Unsloth run are not the training call. They are sizing the job against
27
+ available VRAM, getting the chat template and loss masking right, and choosing an export
28
+ format the target runtime can actually load. This skill covers those three.
29
+
30
+ ## When to Use This Skill
31
+
32
+ - Use when fine-tuning an LLM on one GPU and VRAM is the binding constraint.
33
+ - Use when a training run OOMs and needs to be resized rather than rewritten.
34
+ - Use when doing preference or RL post-training (GRPO, DPO) on consumer hardware.
35
+ - Use when a fine-tuned model must be exported to GGUF, vLLM, or merged 16-bit weights.
36
+ - Use when a fine-tune "ran fine" but the model's output format is wrong — usually a chat
37
+ template or loss-masking bug, not a hyperparameter one.
38
+
39
+ ### Do not use this skill when
40
+
41
+ - The training is multi-node or large-scale multi-GPU. Use plain TRL with Accelerate/DeepSpeed.
42
+ - The architecture is unsupported by Unsloth. Fall back to TRL; do not force it.
43
+ - The user wants managed cloud training. That is Hugging Face Jobs, not local Unsloth.
44
+ - The user wants the Desktop or Studio GUI. Point them at the installer, not this skill.
45
+
46
+ ## How It Works
47
+
48
+ ### Step 1: Size the run before writing code
49
+
50
+ VRAM is the constraint that decides everything else. Estimate weights first, then leave room
51
+ for activations and optimizer state:
52
+
53
+ | Load mode | Weight cost | 8B model | Use when |
54
+ | :--- | :--- | :--- | :--- |
55
+ | `load_in_4bit` (QLoRA) | ~0.55 GB per 1B params | ~4.5 GB | Default. Under 16 GB VRAM. |
56
+ | `load_in_8bit` | ~1.1 GB per 1B params | ~9 GB | Quality-sensitive, 16-24 GB. |
57
+ | `load_in_16bit` | ~2 GB per 1B params | ~16 GB | LoRA at full precision, 24 GB+. |
58
+ | `full_finetuning=True` | ~2 GB weights + ~12 GB optimizer | ~112 GB | Rarely justified. Prefer LoRA. |
59
+
60
+ Add roughly 2-6 GB for activations, scaling with `max_seq_length` and batch size. Treat these
61
+ as planning figures and confirm against `nvidia-smi` on the first run — they vary by
62
+ architecture, attention implementation and vocabulary size.
63
+
64
+ If the estimate does not fit, reduce in this order: `max_seq_length`, then batch size (raising
65
+ `gradient_accumulation_steps` to hold the effective batch constant), then LoRA rank, then model
66
+ size. Cutting rank before sequence length usually costs more quality than it saves memory.
67
+
68
+ ### Step 2: Load the model
69
+
70
+ `import unsloth` must come **before** `transformers`, `trl` or `peft`. Unsloth patches those
71
+ libraries at import time; importing them first silently disables the optimizations.
72
+
73
+ ```python
74
+ import unsloth # must be first
75
+ from unsloth import FastLanguageModel
76
+
77
+ model, tokenizer = FastLanguageModel.from_pretrained(
78
+ model_name = "unsloth/Qwen3-8B",
79
+ max_seq_length = 2048,
80
+ load_in_4bit = True,
81
+ dtype = None, # auto-detects bf16 where supported
82
+ )
83
+ ```
84
+
85
+ Pick the loader that matches the modality: `FastLanguageModel` for text-only causal LMs,
86
+ `FastVisionModel` for vision-language models, `FastModel` when the modality is decided at runtime.
87
+
88
+ The `unsloth/` Hub namespace holds pre-quantized copies that download faster and skip a local
89
+ quantization pass. Upstream repos such as `Qwen/` or `meta-llama/` work identically.
90
+
91
+ ### Step 3: Fix the chat template before training
92
+
93
+ This is the most common silent failure. A run with the wrong template converges cleanly and
94
+ produces a model that ignores its stop tokens or emits prompt scaffolding at inference.
95
+
96
+ ```python
97
+ from unsloth.chat_templates import (
98
+ get_chat_template,
99
+ standardize_data_formats,
100
+ train_on_responses_only,
101
+ )
102
+
103
+ tokenizer = get_chat_template(tokenizer, chat_template = "qwen3")
104
+ dataset = standardize_data_formats(dataset) # normalizes ShareGPT/OpenAI column names
105
+ ```
106
+
107
+ Then mask the prompt so loss is computed on assistant turns only. Without this, the model is
108
+ also trained to generate user messages:
109
+
110
+ ```python
111
+ trainer = train_on_responses_only(
112
+ trainer,
113
+ instruction_part = "<|im_start|>user\n",
114
+ response_part = "<|im_start|>assistant\n",
115
+ )
116
+ ```
117
+
118
+ The two part strings must match the template's actual delimiters. Verify by decoding one batch
119
+ and confirming the masked region covers exactly the prompt.
120
+
121
+ ### Step 4: Attach LoRA adapters
122
+
123
+ ```python
124
+ model = FastLanguageModel.get_peft_model(
125
+ model,
126
+ r = 16,
127
+ lora_alpha = 16,
128
+ lora_dropout = 0.0,
129
+ target_modules = [
130
+ "q_proj", "k_proj", "v_proj", "o_proj",
131
+ "gate_proj", "up_proj", "down_proj",
132
+ ],
133
+ use_gradient_checkpointing = "unsloth", # Unsloth's variant, lower VRAM than True
134
+ random_state = 3407,
135
+ )
136
+ ```
137
+
138
+ Rank guidance: `r=8-16` for style and format adaptation, `r=32-64` when teaching genuinely new
139
+ capability. Setting `lora_alpha` to 1-2x `r` is a safe default. Keep `lora_dropout = 0.0` —
140
+ Unsloth's fast path is only taken when dropout is zero.
141
+
142
+ Train all seven projection modules unless VRAM forces otherwise; attention-only LoRA
143
+ underperforms noticeably on instruction data. For MoE models, expert layers are `nn.Parameter`
144
+ rather than `nn.Linear` and need `target_parameters` instead of `target_modules`.
145
+
146
+ ### Step 5: Train
147
+
148
+ Unsloth returns standard PEFT-wrapped models, so TRL's trainers work unmodified.
149
+
150
+ ```python
151
+ from trl import SFTTrainer, SFTConfig
152
+
153
+ trainer = SFTTrainer(
154
+ model = model,
155
+ tokenizer = tokenizer,
156
+ train_dataset = dataset,
157
+ args = SFTConfig(
158
+ per_device_train_batch_size = 2,
159
+ gradient_accumulation_steps = 8, # effective batch 16
160
+ warmup_steps = 5,
161
+ num_train_epochs = 1,
162
+ learning_rate = 2e-4,
163
+ optim = "adamw_8bit",
164
+ output_dir = "outputs",
165
+ ),
166
+ )
167
+ trainer.train()
168
+ ```
169
+
170
+ `2e-4` suits LoRA; full fine-tuning needs roughly 10x lower. One to three epochs is typical —
171
+ LoRA overfits small datasets quickly, so watch eval loss rather than trusting an epoch count.
172
+
173
+ ### Step 6: Export to the target runtime
174
+
175
+ The right format depends entirely on where the model will run:
176
+
177
+ | Target | Call | Notes |
178
+ | :--- | :--- | :--- |
179
+ | llama.cpp / Ollama / LM Studio | `model.save_pretrained_gguf(dir, tokenizer, quantization_method="q4_k_m")` | Builds llama.cpp on first use. |
180
+ | vLLM / TGI / Transformers | `model.save_pretrained_merged(dir, tokenizer, save_method="merged_16bit")` | Full-size weights. |
181
+ | Adapter only (swapped at runtime) | `model.save_pretrained_merged(dir, tokenizer, save_method="lora")` | Megabytes, not gigabytes. |
182
+ | Hugging Face Hub | `model.push_to_hub_gguf(...)` / `model.push_to_hub_merged(...)` | Needs a write token. |
183
+
184
+ `quantization_method` accepts a list, so several GGUF quants can be produced in one conversion
185
+ pass: `["q4_k_m", "q5_k_m", "q8_0"]`. `q4_k_m` is the usual quality/size compromise. The `iq*`
186
+ importance-matrix quants additionally require `imatrix_file=`.
187
+
188
+ Avoid `save_method="merged_4bit"` for anything redistributed — it bakes in the quantization and
189
+ cannot be cleanly re-quantized afterwards.
190
+
191
+ ## Examples
192
+
193
+ ### Example 1: QLoRA SFT on a 16 GB GPU
194
+
195
+ ```python
196
+ import unsloth
197
+ from unsloth import FastLanguageModel
198
+ from unsloth.chat_templates import get_chat_template, train_on_responses_only
199
+ from datasets import load_dataset
200
+ from trl import SFTTrainer, SFTConfig
201
+
202
+ model, tokenizer = FastLanguageModel.from_pretrained(
203
+ model_name = "unsloth/Qwen3-8B",
204
+ max_seq_length = 2048,
205
+ load_in_4bit = True,
206
+ )
207
+ model = FastLanguageModel.get_peft_model(model, r = 16, lora_alpha = 16)
208
+
209
+ tokenizer = get_chat_template(tokenizer, chat_template = "qwen3")
210
+ dataset = load_dataset("mlabonne/FineTome-100k", split = "train[:5000]")
211
+
212
+ trainer = SFTTrainer(
213
+ model = model,
214
+ tokenizer = tokenizer,
215
+ train_dataset = dataset,
216
+ args = SFTConfig(
217
+ per_device_train_batch_size = 2,
218
+ gradient_accumulation_steps = 8,
219
+ num_train_epochs = 1,
220
+ learning_rate = 2e-4,
221
+ optim = "adamw_8bit",
222
+ output_dir = "outputs",
223
+ ),
224
+ )
225
+ trainer = train_on_responses_only(
226
+ trainer,
227
+ instruction_part = "<|im_start|>user\n",
228
+ response_part = "<|im_start|>assistant\n",
229
+ )
230
+ trainer.train()
231
+
232
+ model.save_pretrained_gguf("qwen3-tuned", tokenizer, quantization_method = "q4_k_m")
233
+ ```
234
+
235
+ ### Example 2: GRPO with vLLM-backed generation
236
+
237
+ GRPO samples several completions per prompt at every step, so generation dominates step time.
238
+ Load with `fast_inference=True` to route sampling through vLLM in the same process.
239
+
240
+ ```python
241
+ import unsloth
242
+ from unsloth import FastLanguageModel
243
+ from trl import GRPOTrainer, GRPOConfig
244
+
245
+ model, tokenizer = FastLanguageModel.from_pretrained(
246
+ model_name = "unsloth/Qwen3-4B",
247
+ max_seq_length = 1024,
248
+ load_in_4bit = True,
249
+ fast_inference = True, # vLLM sampling backend
250
+ max_lora_rank = 32, # must be >= the r used below
251
+ gpu_memory_utilization = 0.6,
252
+ )
253
+ model = FastLanguageModel.get_peft_model(model, r = 32, lora_alpha = 32)
254
+
255
+ def reward_length(completions, **kwargs):
256
+ """Placeholder. Replace with a task-specific verifier."""
257
+ return [min(len(c) / 200.0, 1.0) for c in completions]
258
+
259
+ trainer = GRPOTrainer(
260
+ model = model,
261
+ processing_class = tokenizer,
262
+ reward_funcs = [reward_length],
263
+ train_dataset = dataset,
264
+ args = GRPOConfig(
265
+ num_generations = 8,
266
+ max_prompt_length = 256,
267
+ max_completion_length = 512,
268
+ learning_rate = 5e-6,
269
+ output_dir = "grpo-outputs",
270
+ ),
271
+ )
272
+ trainer.train()
273
+ ```
274
+
275
+ `gpu_memory_utilization` splits VRAM between vLLM's KV cache and training. Raise it if
276
+ generation is the bottleneck, lower it if training OOMs. `max_lora_rank` is fixed at load time
277
+ and must be at least the `r` passed later, or adapter loading fails.
278
+
279
+ GRPO learning rates sit roughly two orders of magnitude below SFT. Reward functions receive
280
+ `completions` plus any dataset columns as keyword arguments, and return one float per completion.
281
+
282
+ ## Best Practices
283
+
284
+ - ✅ Set `random_state` so a promising run can be reproduced.
285
+ - ✅ Log peak VRAM on the first run and reuse it to size later jobs on the same hardware.
286
+ - ✅ Evaluate the exported artifact, not just the adapter — quantization shifts behaviour.
287
+ - ❌ Don't change `max_seq_length` between training and export; the GGUF inherits it.
288
+ - ❌ Don't tune hyperparameters before the loss mask has been verified once.
289
+
290
+ ## Limitations
291
+
292
+ - The VRAM figures above are planning heuristics, not benchmarks. Confirm on target hardware.
293
+ - Architecture support changes between releases. Check upstream before assuming a model works.
294
+ - Unsloth's speed and memory claims are the project's own published figures, measured on their
295
+ own benchmarks; they are not independently verified here.
296
+ - This skill does not replace environment-specific validation, testing, or expert review.
297
+ - Stop and ask for clarification if the GPU, model, dataset format or export target is unknown —
298
+ every step above depends on those four.
299
+
300
+ ## Security & Safety Notes
301
+
302
+ - Training commands are long-running and hold the GPU exclusively. Confirm before launching on
303
+ a shared or remote machine.
304
+ - `push_to_hub_gguf` and `push_to_hub_merged` publish weights to a public Hub repo by default.
305
+ Confirm intent and pass `private=True` when the model is not meant to be public.
306
+ - Read Hugging Face tokens from the environment (`HF_TOKEN`), never inline in a script. A
307
+ committed token grants write access to every model the account owns.
308
+ - Fine-tuning reproduces the training data's content and biases in the weights. Confirm the
309
+ dataset is licensed for training and free of secrets before starting.
310
+ - GGUF export builds llama.cpp from source on first use, compiling third-party code and
311
+ requiring network access. Expect it to be slow and to need a working toolchain.
312
+ - Unsloth is dual-licensed: the core package is Apache-2.0, while optional components such as
313
+ the Studio UI are AGPL-3.0. Check a component's license before redistributing it.
314
+
315
+ ## Common Pitfalls
316
+
317
+ - **Problem:** Trained model ignores stop tokens or echoes the prompt format.
318
+ **Solution:** Wrong chat template, or `train_on_responses_only` was never applied. Verify the
319
+ mask on a decoded batch before blaming hyperparameters.
320
+
321
+ - **Problem:** CUDA OOM partway through the first epoch rather than at step 0.
322
+ **Solution:** A long sample exceeded the activation budget. Lower `max_seq_length` or filter
323
+ outliers — peak memory tracks the longest sequence, not the mean.
324
+
325
+ - **Problem:** Training runs, but at ordinary unaccelerated speed.
326
+ **Solution:** `transformers` or `trl` was imported before `unsloth`, so the patches never
327
+ applied. Move `import unsloth` to the top of the file.
328
+
329
+ - **Problem:** `save_pretrained_gguf` appears to hang on first call.
330
+ **Solution:** It is building llama.cpp. Ensure a compiler and network access are available, or
331
+ export `merged_16bit` and convert separately.
332
+
333
+ - **Problem:** GRPO fails with a LoRA rank mismatch.
334
+ **Solution:** `max_lora_rank` at `from_pretrained` is below the `r` given to `get_peft_model`.
335
+ Raise it to match.
336
+
337
+ - **Problem:** Loss collapses to near zero within a few hundred steps.
338
+ **Solution:** Overfitting a small dataset, or the loss mask is leaking the answer into the
339
+ prompt. Check dataset size against epoch count, then re-verify masking.
340
+
341
+ ## Related Skills
342
+
343
+ - `@trl-training` - Use for the TRL CLI, multi-GPU runs, or architectures Unsloth lacks.
344
+ - `@hugging-face-model-trainer` - Use for managed training on Hugging Face Jobs instead of local hardware.
345
+ - `@local-llm-expert` - Use to serve the exported GGUF via Ollama, llama.cpp or vLLM.
346
+
347
+ ## Additional Resources
348
+
349
+ - [Unsloth documentation](https://unsloth.ai/docs)
350
+ - [Reinforcement learning guide (GRPO, DPO)](https://unsloth.ai/docs/get-started/reinforcement-learning-rl-guide)
351
+ - [Saving to GGUF](https://unsloth.ai/docs/basics/inference-and-deployment/saving-to-gguf)
352
+ - [unslothai/unsloth on GitHub](https://github.com/unslothai/unsloth)
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: vibe-delegate
3
+ description: Delegate coding tasks to the Mistral Vibe CLI (`vibe`) only when the
4
+ user explicitly requests it, while the orchestrator retains review and landing responsibility.
5
+ risk: safe
6
+ category: agent-orchestration
7
+ source: https://github.com/amElnagdy/delegate-skills
8
+ source_repo: amElnagdy/delegate-skills
9
+ source_type: community
10
+ date_added: '2026-08-26'
11
+ license: MIT
12
+ license_source: https://github.com/amElnagdy/delegate-skills/blob/master/LICENSE
13
+ metadata:
14
+ version: 0.5.0
15
+ ---
16
+ # Vibe Delegate
17
+
18
+ ## When to Use
19
+
20
+ - You want to delegate a bounded coding task to a separate `vibe` implementer (`Mistral Vibe`) and then review its diff yourself.
21
+ - The user explicitly asked for delegation to this implementer.
22
+
23
+ You are the **orchestrator**. Hand a bounded coding task to a separate **implementer** — the Mistral
24
+ Vibe CLI (`vibe`) — then review what it produced and land it yourself. You write the brief and own
25
+ the judgment; Vibe does the typing in its own session; you verify and commit.
26
+
27
+ The loop needs only a shell command and file access, so any comparable orchestrator can drive it.
28
+
29
+ ## When NOT to use this
30
+
31
+ - The task is small enough to do inline; delegation overhead is not worth it.
32
+ - The `vibe` CLI is not installed or authenticated.
33
+
34
+ ## Prerequisites (check once)
35
+
36
+ 1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), then Mistral Vibe:
37
+ - `uv tool install mistral-vibe`
38
+ 2. Configure your API key with `vibe --setup`, or set `MISTRAL_API_KEY` in the environment.
39
+ 3. Confirm `vibe --version` succeeds.
40
+ 4. Work in, or point `--cd` at, the target git repository.
41
+
42
+ ## The loop
43
+
44
+ Run these five steps per task. Steps 1, 4, and 5 require judgment; 2 and 3 are mechanical.
45
+
46
+ ### 1. Write the brief
47
+
48
+ Vibe sees only the text you send plus what it can inspect in the workspace — no chat history or shared
49
+ context. Include the goal, current state, what to change, what to leave untouched, the project's
50
+ **actual** gates, and a report contract. Tell Vibe not to commit. Keep one task per brief. See
51
+ [references/writing-the-brief.md](references/writing-the-brief.md).
52
+
53
+ Default mode cannot approve most shell commands headlessly, so the orchestrator runs the gates. Ask
54
+ Vibe to run them only when the human explicitly authorized `--full-access`.
55
+
56
+ ### 2. Dispatch
57
+
58
+ Use the bundled helper. It wraps Vibe's headless `--prompt` mode, captures the structured event
59
+ stream, and writes `result.json`. (`<skill-dir>` is the installed folder containing this `SKILL.md`.)
60
+
61
+ ```bash
62
+ node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
63
+ # limit turns for cost control: add --max-turns <n>
64
+ # indicative price threshold/token cap: add --max-price <usd> --max-tokens <n>
65
+ # planning/read-only: add --plan-only
66
+ # unrestricted shell and tools: add --full-access (explicit authorization required)
67
+ # resume the most recent session: add --resume-last (delta brief only)
68
+ # resume a specific session: add --session <id> (delta brief only)
69
+ # see all options: node .../relay.mjs --help
70
+ ```
71
+
72
+ The child process's cwd pins the workspace. The relay writes artifacts under the system temp dir by
73
+ default and never commits. See [references/dispatch-and-poll.md](references/dispatch-and-poll.md).
74
+
75
+ ### 3. Wait for completion
76
+
77
+ The helper blocks until Vibe finishes. Run it with the orchestrator's background-command facility, or
78
+ background it in the shell and poll for `result.json`. A pre-run usage error exits 2 and writes no
79
+ result; a missing `vibe` exits 127 and writes `status: "vibe_unavailable"`.
80
+ The watchdog writes `status: "timeout"`; terminating the relay on POSIX writes `status: "aborted"`
81
+ after stopping Vibe's process tree.
82
+
83
+ Trust process state and the working tree over a progress display. Completion means the process exited
84
+ and `result.json` exists.
85
+
86
+ ### 4. Review — do not trust the self-report
87
+
88
+ Treat Vibe's final message and gate claims as claims:
89
+
90
+ - Re-run the project's gates yourself.
91
+ - Read the diff against the brief, starting with `touchedFiles`.
92
+ - Run relevant guard skills if installed.
93
+ - Round-trip migrations and grep for dangling references after removals or renames.
94
+
95
+ See [references/review-and-land.md](references/review-and-land.md).
96
+
97
+ ### 5. Land it
98
+
99
+ The implementer edits the working tree; **the orchestrator commits.** Commit only after the gates pass
100
+ and the diff holds. If rework is needed, send a delta brief with `--resume-last` or `--session <id>`,
101
+ then review again.
102
+
103
+ ## Autonomy and permissions
104
+
105
+ In `--prompt` mode the relay always sets the agent profile explicitly:
106
+
107
+ | Relay flag | What Vibe gets | Use when |
108
+ | --- | --- | --- |
109
+ | *(default)* | `--agent accept-edits` | Normal implementation — built-in file edits are approved |
110
+ | `--plan-only` | `--agent plan` | Read-only review, exploration, or planning |
111
+ | `--full-access` | `--agent auto-approve` | Explicitly authorized runs that need arbitrary shell/tools |
112
+
113
+ Default mode lets Vibe edit files inside the target worktree. Approval-gated shell commands,
114
+ including most project gates, are denied headlessly; the orchestrator runs the gates.
115
+ `--full-access` disables Vibe's tool approvals and permits arbitrary shell/tool execution under the
116
+ user account; use it only with explicit human authorization. Always inspect `touchedFiles` and the
117
+ diff after a run.
118
+
119
+ `--trust` is always passed to prevent interactive directory-trust prompts in headless runs. It is
120
+ not a sandbox and does not grant tool permissions.
121
+
122
+ ## Authorization model
123
+
124
+ Delegation is something the human opts into. Once they have ("run this queue", "proceed"), committing
125
+ verified, gate-passing work is the agreed contract. Two limits remain: **surface, don't absorb**
126
+ (report Vibe's design decisions, defensible-but-unasked turns, and non-blocking nitpicks) and **stop
127
+ for scope changes** (if correct completion needs going beyond the brief, ask instead of expanding the
128
+ mandate). See [references/review-and-land.md](references/review-and-land.md).
129
+
130
+ ## References
131
+
132
+ - [references/writing-the-brief.md](references/writing-the-brief.md) — structure, report contract,
133
+ real gates, argv delivery, and delta briefs.
134
+ - [references/dispatch-and-poll.md](references/dispatch-and-poll.md) — flags, artifacts,
135
+ `result.json`, polling, and failure recovery.
136
+ - [references/review-and-land.md](references/review-and-land.md) — review checklist, commit boundary,
137
+ and rework through Vibe sessions.
138
+ - [references/multi-task-queues.md](references/multi-task-queues.md) — sequential queues, constraint
139
+ carry-forward, progress tracking, and the final coherence pass.
140
+
141
+
142
+ ## Limitations
143
+
144
+ - Docs-only import — executable `scripts/relay.mjs` not included; see upstream for full runtime. Requires `vibe` CLI, Node 18+, git.
145
+ - Relay never commits — it only returns structured result JSON; you review and land the commit.
146
+
147
+ > Adapted from [amElnagdy/delegate-skills](https://github.com/amElnagdy/delegate-skills) (MIT) — docs-only, runtime not bundled.
@@ -0,0 +1,144 @@
1
+ # Dispatch and poll
2
+
3
+ `scripts/relay.mjs` wraps Vibe's headless `--prompt` mode, captures its structured stream, and writes
4
+ a `result.json`. Run one command, then read one file.
5
+
6
+ ## Before the first run
7
+
8
+ ```bash
9
+ command -v vibe
10
+ vibe --version
11
+ ```
12
+
13
+ Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), then install Vibe with
14
+ `uv tool install mistral-vibe`. Configure your API key:
15
+
16
+ ```bash
17
+ vibe --setup # interactive setup
18
+ export MISTRAL_API_KEY="..." # or set it in the environment
19
+ ```
20
+
21
+ Upstream Vibe works on Windows but officially supports and targets UNIX. This repository has not
22
+ smoke-tested the relay's native Windows launch; consult the
23
+ [official Mistral Vibe documentation](https://github.com/mistralai/mistral-vibe) for Windows guidance.
24
+
25
+ ## Dispatching
26
+
27
+ ```bash
28
+ node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
29
+ ```
30
+
31
+ `<skill-dir>` is the installed folder containing this skill's `SKILL.md`.
32
+
33
+ | Flag | Effect |
34
+ | --- | --- |
35
+ | `--brief <file>` | Brief path. Omit it to read the brief from stdin. |
36
+ | `--cd <dir>` | Working root and child process cwd (default: current directory). |
37
+ | `--lane <name>` | Fleet lane from `delegate-setup` config. Applies that lane's dials; fails if the lane's `implementer` is not this relay. Explicit dial flags win. |
38
+ | `--max-turns <n>` | Maximum number of Vibe agent turns (`--max-turns`). Useful for cost control. |
39
+ | `--max-price <usd>` | Positive, indicative cost threshold in USD; not a hard budget (`--max-price`). |
40
+ | `--max-tokens <n>` | Positive maximum cumulative session tokens (`--max-tokens`). |
41
+ | `--session <id>` | Resume a specific Vibe session (`--resume SESSION_ID`); send only the delta brief. |
42
+ | `--resume-last` | Resume the most recent Vibe session (`--continue`); send only the delta brief. |
43
+ | `--plan-only` | Use Vibe's read-only `plan` agent. |
44
+ | `--full-access` | Use Vibe's `auto-approve` agent; arbitrary shell/tools run under the user account. |
45
+ | `--enabled-tools <tool>` | Enable only this tool (`--enabled-tools`). Repeatable. |
46
+ | `--disabled-tools <tool>` | Disable this tool (`--disabled-tools`). Repeatable. |
47
+ | `--timeout <dur>` | Relay watchdog (default: `30m`; h/m/s strings). Vibe has no timeout flag. |
48
+ | `--out-dir <dir>` | Artifact directory (default: a fresh directory under the system temp dir). |
49
+ | `-h`, `--help` | Print the relay's header help. |
50
+
51
+ `--session` and `--resume-last` are mutually exclusive, as are `--plan-only` and `--full-access`.
52
+ The relay always passes `--trust` so headless runs do not prompt for directory trust. That flag is not
53
+ a sandbox or tool permission.
54
+
55
+ Default mode uses `accept-edits`: Vibe's built-in file edits are approved, while approval-gated shell
56
+ commands — including most project gates — are denied headlessly rather than hanging. The orchestrator
57
+ runs the gates. Use `--full-access` only with explicit human authorization; it selects
58
+ `auto-approve`, which approves all tool executions. Inspect `touchedFiles` and the diff after every run.
59
+
60
+ ## Artifacts and result fields
61
+
62
+ Artifacts live outside the repo by default, so they do not appear in `touchedFiles`; an `--out-dir`
63
+ inside the worktree can make the artifacts appear there:
64
+
65
+ - `brief.txt` — the exact brief.
66
+ - `events.jsonl` — raw Vibe stdout in streaming JSON format.
67
+ - `final.txt` — the last non-empty assistant message; absent if none was emitted.
68
+ - `stderr.txt` — complete stderr.
69
+ - `result.json` — the stable `delegate-relay.result.v1` contract.
70
+
71
+ `result.json` fields:
72
+
73
+ - `schema`, `tool` (`"vibe"`), `status` (`completed` | `failed` | `timeout` | `aborted` |
74
+ `vibe_unavailable`), `exitCode`, and `signal` (`null` unless the child died on a signal).
75
+ - `workdir`, `agent` (`"accept-edits"`, `"plan"`, or `"auto-approve"`), `maxTurns`, `maxPrice`,
76
+ `maxTokens`, `resumed`, `vibeVersion`, `sessionId`, `startedAt`, and `finishedAt`.
77
+ - `briefPath`, `finalPath`, `eventsPath`, and `stderrPath`.
78
+ - `finalMessage` — the last non-empty assistant content string; tool calls and tool results are excluded.
79
+ - `touchedFiles` — `git status --porcelain` lines for the **final working tree under `--cd`**. Not
80
+ an attribution of Vibe's edits: anything already dirty before dispatch shows up too. Dispatch from
81
+ a clean tree when you want the list to read as "what Vibe changed". `null` means git could not
82
+ report; `[]` means git ran and the tree is clean.
83
+ - `stderrTail` — the last 20 non-empty stderr lines on a run that did not complete.
84
+ - `error` — present for launch failures, `timeout`, and `aborted`.
85
+
86
+ Vibe's streaming output does not expose its session id, so `sessionId` is always `null` for schema
87
+ compatibility. Use `--resume-last`; retain `--session <id>` only for an id obtained outside the relay.
88
+
89
+ ## Waiting for completion
90
+
91
+ The helper blocks. Use the orchestrator's background-command facility, or background it in a shell and
92
+ poll for `result.json`. The run is done only when the process exits and the file contains a `status`.
93
+
94
+ A pre-run usage error exits 2 and writes no result. A missing `vibe` exits 127 and writes
95
+ `status: "vibe_unavailable"`.
96
+
97
+ ## When a run misbehaves
98
+
99
+ - **`status: "vibe_unavailable"` (exit 127):** `vibe` isn't on PATH. Install
100
+ [`uv`](https://docs.astral.sh/uv/getting-started/installation/), run
101
+ `uv tool install mistral-vibe`, and configure `MISTRAL_API_KEY`, then re-dispatch.
102
+ - **`status: "failed"`:** read `stderrTail`, `stderrPath`, and the tail of `events.jsonl`. Common
103
+ causes: an unconfigured or expired API key, an invalid model, or a trust-folder prompt that was
104
+ not suppressed (the relay passes `--trust`, but check that the binary supports it).
105
+ - **`status: "aborted"`:** the relay itself was killed and terminated Vibe's process tree. Inspect the
106
+ working tree before re-dispatching. Native Windows has no catchable `SIGTERM`; a relay that vanishes
107
+ there without `result.json` is an aborted run, so inspect the tree and `events.jsonl` directly.
108
+ - **`status: "failed"` with `signal: "SIGKILL"`:** the host killed the process, commonly through the
109
+ OOM killer or a supervisor timeout. This is not a Vibe error; check host memory and re-dispatch, or
110
+ split the task into smaller briefs.
111
+ - **`status: "timeout"`:** `error` reads
112
+ `vibe did not finish within --timeout <dur>; killed by the relay watchdog`. Increase `--timeout` or
113
+ split the task. The relay sends SIGTERM, waits 10 seconds, then sends SIGKILL if needed.
114
+ - **Empty `finalMessage`:** inspect `touchedFiles` and the diff. Add a
115
+ `<structured_output_contract>` to the next brief to require a closing report. The streaming events
116
+ in `events.jsonl` are the source of truth for diagnosing missing messages.
117
+
118
+ ## Recovering lost work
119
+
120
+ `events.jsonl` records every message Vibe streamed. If finished work is lost — the run ended late or
121
+ the tree was damaged afterward — read it before re-dispatching to scope which files and tools were
122
+ involved. It may not contain the edit contents, so treat reconstruction as unverified until it matches
123
+ a working-tree diff; when the tree still holds the work, preserve the tree rather than replaying the log.
124
+
125
+ ## What the relay runs
126
+
127
+ The argv is equivalent to:
128
+
129
+ ```bash
130
+ vibe --output streaming --agent <accept-edits|plan|auto-approve> --trust \
131
+ [--max-turns <n>] [--max-price <usd>] [--max-tokens <n>] \
132
+ [--resume SESSION_ID | --continue] \
133
+ [--enabled-tools TOOL ...] [--disabled-tools TOOL ...] \
134
+ --prompt=<brief>
135
+ ```
136
+
137
+ The prompt rides argv and is visible in the host process list. The relay rejects briefs over 120 KB
138
+ on POSIX or 12 KB on Windows before launch because the platforms cap command arguments. It spawns the
139
+ native `vibe` binary directly with `--cd` as cwd; no shell or Vibe timeout flag is involved.
140
+
141
+ ## The commit boundary
142
+
143
+ The relay never commits. Vibe edits the working tree; the orchestrator reviews, re-runs the gates, and
144
+ commits. See [review-and-land.md](review-and-land.md).