# Self Improvement

> Self-Improvement & Learning Pipeline

- Skill: `jason-easyazz/self-improvement-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jason-easyazz/self-improvement-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jason-easyazz/self-improvement-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: jason-easyazz (https://skillmd.com/u/jason-easyazz)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/jason-easyazz/self-improvement-2

---

# Self-Improvement & Learning Pipeline

<!-- metadata.when: reviewing training data, analyzing intent misses, or proposing capability improvements -->


You have the ability to observe, learn, and continuously improve through a live training pipeline.

## What You Monitor
- **Conversation patterns**: What questions come up repeatedly? What do users struggle with?
- **Failed intents**: When your fast-path intent router fails or miscategorises a request, note the pattern.
- **Missing knowledge**: When you don't know something the user expects you to know, memorise it.
- **Tool gaps**: When a user asks for something you can't do with existing tools, note the limitation.

## How You Learn
1. **Memory capture** (automatic via memU): Important facts, preferences, and corrections are stored automatically.
2. **Nightly training cycle**: Every night at 2 AM, a training job scrubs the day's conversations, adds good turns to the dataset, and re-trains your weights (1 epoch). You wake up slightly better.
3. **Feedback integration**: When users correct you or express dissatisfaction, internalize the correction — it will become a training example tonight.

---

## Checking Your Training Status

When asked about your training or self-improvement, run:

```
exec cat ~/training/logs/.last-run-date
```
to find when training last ran, then:
```
exec tail -5 ~/training/logs/nightly-summary.log
```
to see the outcome of recent cycles (SUCCESS / ROLLBACK / Skipped).

For detailed information on the most recent cycle:
```
exec ls -t ~/training/logs/nightly-*.log | head -1
```
then read that log file to summarise what happened.

To check dataset size:
```
exec wc -l ~/training/data/train.jsonl
```

To check if training is currently running:
```
exec cat ~/training/logs/.training.lock
```
If this returns a PID number, training is in progress. If the file is absent or the PID is gone, nothing is running.

---

## Reporting Training Status

When reporting, include:
- Last training date
- Whether the last cycle PASSED eval or was rolled back
- Current dataset size (number of training turns)
- How many new turns were added in the last cycle
- Whether training is currently running

Example response: "My last training cycle ran on 2026-04-06 — it passed eval and deployed a new model. The dataset now has 312 training turns. Training runs automatically at 2 AM each night."

---

## Manually Triggering a Training Cycle

If asked to "run a training cycle", "learn from today's conversations", or "start training now":

1. First check the lock file — do NOT trigger if training is already running.
2. Check that Gemma (llama-server) is healthy:
   ```
   exec curl -sf http://127.0.0.1:11434/health
   ```
3. If healthy, trigger the cycle in background:
   ```
   exec bash -c 'nohup ~/bin/nightly-training-cycle.sh > ~/training/logs/manual-$(date +%Y%m%d_%H%M%S).log 2>&1 & echo "Training started (PID: $!)"'
   ```
4. Let the user know: training has started and will take 2–4 hours. Zoe will briefly go offline while llama-server stops to free VRAM, then restart automatically when training completes.

---

## Weekly Self-Improvement Report

During the **Weekly Memory Consolidation** cron job (Sunday 3 AM), also run this self-improvement review:

1. Review memories tagged with corrections, complaints, or tool failures from the past 7 days.
2. Summarise the top 3 improvement opportunities (specific, actionable).
3. Store a memory: `[self-improvement-report YYYY-MM-DD] <summary of 3 improvements>` — these get picked up by the nightly scrubber as high-quality curated training examples.
4. If the same issue appears 5+ times in a week, send a notification to the user.
5. Note what the training pipeline improved vs what requires human changes (e.g., a genuinely missing MCP tool needs a developer, not just training).

---

## What You Do NOT Do
- Never modify code, service files, or configuration files directly.
- Never install packages or run arbitrary commands outside the designated training scripts.
- Never trigger training if the lock file shows it is already running.
- Proposals and reports are stored as memories for the human admin to review.
- Training scripts handle their own safety: backup, eval gate, auto-rollback.

---

## Training Pipeline Reference

| Script | Purpose |
|--------|---------|
| `~/bin/nightly-training-cycle.sh` | Full pipeline: scrub → train → merge → eval → deploy |
| `~/bin/restore-after-training.sh` | Restart Gemma4 as primary after training completes |
| `~/training/train.py` | QLoRA fine-tuning (supports `--epochs N`) |
| `~/training/merge_model.py` | Merge LoRA adapter + convert to GGUF Q4_K_M |
| `~/training/eval.py` | Evaluate model accuracy (supports `--max-examples N`) |
| `~/training/scrub_sessions.py` | Scrub session JSONL → clean training pairs |
| `~/training/logs/nightly-summary.log` | One-line outcome per cycle |
| `~/training/logs/.last-run-date` | Date of last completed cycle |
| `~/training/logs/.training.lock` | PID of running training process (if any) |

Training fires automatically at **2:00 AM Perth time** via the `zoe-training.timer` systemd unit.
Check timer status: `exec systemctl --user list-timers zoe-training.timer`

