v0.7.12 — the corpus flywheel (sessions become training data)
Turns forge's own operating record into training signal for the model that runs
inside forge. New forge/corpus.py + forge corpus [sid|last|--all] [--out FILE]
reconstruct a session transcript at the turn level (user → action → observation →
say) and emit two harness-native signals:
- SFT examples — for every action that actually executed, {messages: ,
completion: }: the context paired with the action the model should emit.
Teaches the action protocol and the tool sequences that worked. - Preference pairs — the CORRECTION moments, the highest-value signal because they
are drawn straight from the failure modes forge already measures and repairs:
{prompt, chosen, rejected, kind}. kind=grammar is a malformed strike recovered to
valid action JSON; kind=narrate is an "I'll do it…" preamble that got bounced,
recovered to real work (the act-don't-narrate reward). chosen > rejected is the
DPO/ORPO reward.
Deterministic and stdlib-only. The per-session workspace briefing is intentionally
omitted from the reconstructed context — it isn't recoverable from a transcript and
the trainer prepends a consistent system prompt instead. --out corpus.jsonl writes
flat JSONL tagged by split (sft/pref) over one session or every recorded one.
This is turn one of the flywheel: every session forge runs is now labeled data for
the harness that produced it. 456 tests green.