---
name: llm-lora-writing-style lesson 02
description: >-
  Agent recipe for lesson 02: clean your local writing, format pairs, split
  train and validation, and keep secrets out of the bake.
---
# Prepare your writing data

**Lesson id:** `02`  
**One-line goal:** Produce a local train and validation JSONL plus held-out review prompts.

## On-device job

Private writing never needs a network. Anything left in the JSONL can survive in the baked `.aimodel`.

## Prerequisites

Lesson 01. Writing you own or have permission to use.

## Inputs

Raw local drafts, a secret policy, and a single example schema.

## Outputs and artifacts

`data/clean/train.jsonl`, `data/clean/val.jsonl`, review prompts, and a source list kept outside the export.

## Executable steps

1. Create the `uv` project before formatting.
2. Copy owned writing into `data/raw`. Clean into `data/clean/all.jsonl`.
3. Use one schema (`instruction`, optional `input`, `response`).
4. Split with a fixed seed. Keep validation separate.
5. Scan for secrets. Write review prompts that are not in the JSONL.

## Constraints

Keep your writing local. No CUDA, quizzes, Mermaid, or em dashes.

## Failure modes

Raw mailbox training, duplicate splits, mixed keys, no unseen review prompts.

## Key concepts

- Strip secrets, tokens, and third-party private detail before training.
- Format rows the same way every time, then split train and val.
- Write review prompts outside the JSONL.
- A small focused set beats a giant dump for style.

## Takeaways

- Never point the trainer at raw uncleaned writing.
- Near-duplicate train and val rows reward memorization.
- Keep the corpus on the machine. No network is required.

## Done when

Train and val JSONL exist, the secret scan is acceptable, review prompts are held out, and your writing has not been uploaded.

**Human lesson:** [Prepare your writing data](02-data-prep.html)
