Adds the tooling for Step 4 of the AutoLoRA Sovereignty Loop:
- scripts/export_trajectories.py: converts session JSONL logs into
mlx-lm ChatML training data, embedding tool calls as <tool_call> blocks
in assistant turns so the fine-tuned model learns structured tool use
- scripts/lora_finetune.py: wraps mlx_lm.lora/generate/fuse with
project-specific defaults, pre-flight checks, and dry-run support
- tests/scripts/test_export_trajectories.py: 20 unit tests covering
entry loading, grouping, tool-call formatting, and full export pipeline
Workflow:
python scripts/export_trajectories.py --verbose
cp ~/timmy-training-data.jsonl ~/timmy-lora-training/train.jsonl
python scripts/lora_finetune.py
python scripts/lora_finetune.py --test
python scripts/lora_finetune.py --fuse
Fixes#1103
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>