---
title: "Sketch a tiny harness"
lesson_id: "03"
---

# Sketch a tiny harness

- **Lesson ID:** 03
- **Goal:** Run a tiny Python harness with uv 3.11+: scoped context, fixed KPI tool, verifier, loop limit.
- **Human lesson:** [03-sketch-a-harness.html](03-sketch-a-harness.html)

## Prerequisites

- Lesson 02: six layers.
- Python 3.11+ and `uv` on a Mac or any CPU machine.

## Inputs, outputs, and artifacts

- **Inputs:** Environment setup with `uv init --python 3.11`.
- **Outputs:** `harness.py` that prints one passing KPI run and one stop.
- **Artifacts:** Standard-library Python. No CUDA. No model download.

## Agent build steps

1. Put Environment setup first. Install `uv`, create `harness-sketch`, `uv init --python 3.11`, `uv venv`, `uv run python harness.py`.
2. Show a scoped `CONTEXT` pack: who asked, period, allowed metrics, evidence source.
3. Show `calc_kpi` as fixed logic that refuses unknown metrics.
4. Show `fake_model_plan` as a stand-in the reader can swap later.
5. Loop with `MAX_STEPS`. Stop when the metric is not in the pack.
6. Verifier requires `calc_kpi` was called and the answer contains `Evidence:`.
7. Run a good question and a secret-margin question. The second verify fail is a seed golden case.
8. Say do not train anything. CPU or Mac only.

## Constraints

Keep the language simple, friendly, and literal. No quizzes, no em dashes, no CUDA, no cloud training fluff. Standard library only. Mark the model function as a stand-in.

## Key concepts

- Set up `uv` and Python 3.11+ first. Standard library only. No CUDA.
- Scoped context is an allow-list of metrics and evidence, plus who asked.
- `calc_kpi` is fixed logic. The stand-in model may call it. It may not invent the number.
- The verifier checks two things: the tool was called, and the answer cites evidence.
- `MAX_STEPS` is the orchestration limit. A missing metric stops the loop.

## Takeaways

- You can run this sketch on a Mac or any CPU with `uv run python harness.py`.
- A failing verifier is a seed for a golden case, not a reason to fine-tune.
- Swap `fake_model_plan` later. Keep the pack, the tool, the verifier, and the limit.

## Acceptance checks

- Environment setup is the first lesson section.
- The script is short, runnable, and has no extra packages.
- Verifier and loop limit are present.
- [ ] Proceed to [lesson 04 brief](04-improve-loop.llms.md).
