[claude] LoRA trajectory export and fine-tune launcher (#1103) #1117

Merged
claude merged 1 commits from claude/issue-1103 into main 2026-03-23 18:15:46 +00:00

1 Commits

Author SHA1 Message Date
Alexander Whitestone
97c0d06204 feat: add LoRA trajectory export and fine-tune launcher scripts (AutoLoRA Step 4)
Some checks failed
Tests / lint (pull_request) Failing after 16s
Tests / test (pull_request) Has been skipped
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>
2026-03-23 14:14:58 -04:00