# Metric definitions and the dashboard

The [framework](https://hamedtaheri.com/playbook/v0.2.0/framework/framework.md#numbers-and-reports) names what to measure and why. This page is for whoever builds the numbers: for each measure, the formula, the fields it reads, how often to compute it, and how it can mislead. It ends with a pattern for a local dashboard that needs no hosted service.

Most of the traps below are ones I hit on my own board in late October, when I built a dashboard for it and then had it reviewed. Four counting bugs reached a chart before a cross-check caught them. Each trap here is one of those, or one the review found.

[Back to the playbook](https://hamedtaheri.com/playbook/v0.2.0/index.html) · [Framework](https://hamedtaheri.com/playbook/v0.2.0/framework/framework.md) · [Operating rhythm](https://hamedtaheri.com/playbook/v0.2.0/reference/operating-rhythm.md) · [Workflow reference](https://hamedtaheri.com/playbook/v0.2.0/reference/workflows.md)

## Rules that apply to every number

These come from the framework and are repeated because every definition below depends on them.

- **Agent work counts under the agent,** linked to the developer who directed it. Never as the developer's own output.
- **Compare only within the same kind and risk.** Never one ranking number for people.
- **Show decision waits and blockers beside output.** A team that looks slow is often waiting on one person.
- **Developers see exactly what their manager sees.** Same views, same filters.
- **Unknown stays unknown.** A missing cost is not zero, and a missing time is not "now".
- **Name the scope on the chart:** period, repositories, people, and which sources were missing.

## Fields to record from day one

A measure is only as good as the fields under it, and most of them cannot be filled in for the past. Field names are those of the AI Coding Memory kit 1.5.0; "add" marks one the kit does not have yet.

| Field | On | Needed for | In kit 1.5.0 |
|---|---|---|---|
| `status_changed_at_ms`, set in the **same write** as every status change | task, feature, inquiry | Cycle time, decision wait, finished-in-period | Yes |
| `created_at_ms` | every record | Age, throughput, arrival rate | Yes |
| First start time (`started_at_ms`), set once on the first move to `in_progress` | task | Cycle time and work-item age without a full history | Add |
| `kind`: build, fix, investigate, review, docs, ops, routine | task | Every comparison "within the same kind"; acceptance rules differ by kind | Add (today it gets inferred from titles, which is a guess) |
| Lane: quick, task, epic | task | Which ceremonies apply; epic roll-up | Add |
| `autonomy` and a cap (`run_cap_usd`) | task | Comparing like with like; spotting work that ran without a cap | Yes, used for routines; set them on every task |
| `owner_email`, `project_key`, `parent_task_key` | task | Who acts next, scope, the leaf-task view | Yes |
| `human_review` and `awaiting_human` as status values | task | Separating PR review from other waits on a person | Add as extra status values |
| `resolution` and `verification` | task | Proof of acceptance | Yes |
| An attempt record per worker run: model, provider, cost or unknown, outcome, fix round | task | Cost per task, first-attempt acceptance, fix rounds, unpriced share | Add (my runner keeps these in local ledgers) |
| `created_at_ms` and `status_changed_at_ms` on the inquiry, plus `directed_to_email` | inquiry | Decision wait per person | Yes |
| `summary`, `next_steps`, `status`, `ended_at_ms` | AI session | Handoff rate, resumed handoffs | Yes |

The most common gap on my board was the first row: most tasks waiting on a person had no status-change time, because an earlier tool changed status without setting it. Decision wait then rested on a handful of tasks. Make the time part of the same write, and list the records missing it in a data-health view.

## The four core numbers

| Measure | Formula | Reads | Cadence | How it misleads | Guard |
|---|---|---|---|---|---|
| **Accepted outcomes** | Items moved to `done` inside the period, by kind. An epic counts once; its parts are not counted again | `status`, `status_changed_at_ms`, `kind`, `parent_task_key` | Daily, reported weekly | A bulk status update dates every task it touches to that moment. Large epics hide most of the effort (see the leaf-task view). Done without verification inflates it | Exclude bulk-update spikes or flag them; require `verification` for `done` |
| **Cost per accepted task** | All attempts, reviews, preparation and the coordinator share for accepted items, divided by accepted items | Attempt records, review ledgers, coordinator session cost | Weekly | Missing attempt costs make it look cheap. Subscription usage priced at API rates is an equivalent, not a bill. Failed attempts left out | Report unknown if any attempt is unpriced; show the unpriced share beside it; say which cost groups are in |
| **Decision wait** | Median hours accepted items spent waiting on a person (`awaiting_human`, `human_review`, or blocked by an open inquiry) | Status-change times, inquiry created and answered times | Weekly | Tasks with no status-change time drop out silently, so the median rests on the few that have one. Waiting time on still-open items is not in it | Print the count it rests on; show the oldest open waits beside it |
| **First-attempt acceptance** | Share of accepted items that needed exactly one worker attempt and no fix round | Attempt records, fix rounds | Weekly | Counting attempts from branch names (a `-fix2` suffix) and from ledgers can disagree; a regex bug on one side looks like a quality change | Compute from two sources; investigate any disagreement before publishing |

Definitions follow the [framework contract](https://hamedtaheri.com/playbook/v0.2.0/framework/contract.json) `metrics` list, which a dashboard can load directly.

## The other measures

| Area | Measure | Formula | How it misleads |
|---|---|---|---|
| Flow | Delivered | Accepted changes observed in their target environment (a deploy or release event) | Merged is not delivered; keep them as separate events |
| Flow | Cycle time | Acceptance time minus first start | Without a first-start field, it falls back to creation time and includes backlog wait |
| Flow | Work-item age | Now minus first start, for unfinished work | Abandoned tasks inflate it; cancel them instead of leaving them open |
| Flow | Throughput and arrival | Items finished per week versus items filed per week | A shrinking pile can mean work got cancelled, not done; show "closed without doing" apart |
| Quality | Review yield | Real defects found per review, deep versus normal | Counts reviewer claims, not confirmed defects, unless each is checked |
| Quality | Fix rounds | Repair rounds per accepted item | Low numbers can mean thin reviews, not good work |
| Quality | After-acceptance repairs | Reopens, reverts and follow-up fixes within 30 days | Lags by a month; label recent periods as incomplete |
| Cost | Unpriced share | Attempts without a known cost, shown as unknown | Hidden when a tool fills missing cost with zero |
| People | Human minutes | Self-reported minutes on decisions and review | An estimate; never compare people with it |
| Memory | Resumed handoffs | Handoffs resumed without restarting the task | Only measurable if sessions record `continues_session_key` or the task key |
| Ceremonies | Ceremony health | Routine occurrences done, skipped or missed | A routine with no run record looks healthy unless missing runs are counted |

## Two views the core numbers hide

**Leaf-task effort.** "An epic counts once" is right for outcomes and wrong for effort: one of my epics collected over a hundred child tasks, and the outcomes chart showed it as one. Add a second view that counts finished tasks with no children, by kind, labeled "effort, not outcomes". Never add the two together.

**Cost by group.** Spend falls into groups that are optimized differently, so every budget line should say which groups it covers:

| Group | What it is | Usual lever |
|---|---|---|
| Sessions a person drives | Interactive sessions in the editor or desktop app | Shorter sessions, routing work to briefs |
| Agents those sessions spawn | Subagents launched inside an interactive session | Ban in-session reviews; cap the rest |
| Headless runner stages | Preparation, workers, reviews, fix rounds | Model mix per stage, task size, fix-round cap |
| Other SDK or provider sessions | Codex, other providers, scripts | Usage ledgers; API-equivalent pricing labeled as such |

In my own spend for the 30 days to October 27, the sessions I drove cost more than everything the runner did, Codex included. That is why "one cap covers everything" includes the coordinator.

## Adoption and memory health

These tell you whether team memory is being used, before any productivity number means anything.

| Measure | Formula | Healthy sign |
|---|---|---|
| Active developers | People with at least one recorded session this week, over people on the team | Everyone who codes with an assistant is recorded |
| Handoff rate | Sessions ended with `summary` and `next_steps`, over sessions ended or interrupted | Most sessions end with a usable handoff |
| Interrupted share | Sessions marked `interrupted`, over all sessions | Falling over the first weeks |
| Stale claims | Tasks `in_progress` with no update for a set number of days | Few, and each released or explained at stand-up |
| Overlap-check hits | Tasks not created because an existing one matched | Counted from session summaries or a logged event; any number above zero is the memory paying for itself |
| Decision reuse | Questions answered with an existing decision or precedent, over all questions | Rising as the decision log grows |
| Data health | Records missing a field a chart depends on | Zero; listed by key so they can be fixed |

## Counting traps

- **Search caps.** GitHub search returns at most 1,000 results per query ([GitHub docs](https://docs.github.com/en/rest/search/search)), and stops silently. Split windows by creation date until each fits.
- **Worktrees.** Commits counted per checkout are counted again in every worktree. Count unique commit hashes.
- **Bulk updates.** One script that moves fifty tasks dates all fifty to that minute. Flag days with a spike.
- **Missing keys.** Records saved without a task key still exist; keep them, place them by project, and list them in data health.
- **Scope leaks.** A board is organization-wide. Restrict it at collect time to the repositories the viewer may see, not only in the page.
- **Two price tables.** When the runner and the dashboard price tokens with different tables, totals differ. Keep one table, dated.
- **Equivalent is not a bill.** Subscription usage priced at API rates is a measure of usage, not money spent.

## Build the dashboard

Mine is a local page I built in late October. The pattern needs no hosted service and no model session.

```text
collector (on demand or every 15-30 minutes)
  -> one data file + an hourly history file
  -> a small server bound to 127.0.0.1
  -> one static page
```

**Rules that kept it correct.**

- **Read-only by default.** It reads the board, GitHub, the runner's plan state and local transcripts, and writes nothing. The one write path (saving a stand-up answer to the board) is off until switched on, previews before it writes, skips a task that changed after it was shown, and never overwrites a settled decision.
- **One failing source never blanks the page.** It keeps its last good data and the header says how old it is.
- **One set of definitions on every tab.** "Finished" means `done` inside the range, wherever it appears, so two charts never disagree about the same number.
- **Every count is a button** that lists the tasks behind it.
- **A person selector:** me, everyone, or one person. The same views for everyone, which is the "developers see what their manager sees" rule in practice.
- **Spend is this machine only,** priced once per message, and labeled an estimate.
- **Local only.** Bound to the local address, a Host header check, and refresh only by a POST from the page itself.

**Views.**

| View | Answers |
|---|---|
| Overview | Alerts first: a source failing, tasks waiting on a person for more than 3 days, open tasks whose PR already merged, runner escalations this week, spend over budget. Then the headline numbers against the 7 days before |
| Task board | Is the open pile shrinking? Where does open work wait, by who acts next and for how long? Cycle time per finished task, throughput, epics, the oldest open tasks, and a data-health card |
| PRs and commits | Opened, merged and waiting; commits by author, deduplicated |
| Spend | The cost groups above, daily and monthly budget lines, month-to-date burn, rework cost |
| Runner plans | Each plan's parts, their board task, and why any part escalated |
| Framework | The four core numbers with the count each rests on |
| Stand-up and decisions | The open questions, one at a time, and a read-only register of decisions already made |

**Keep the trend in memory.** Once a week, save each core number as a `metric_snapshot` record (`metric`, `period`, `value_number`, `value_unit`, `source_ref`, `captured_at_ms`). The trend then survives a change of dashboard or tool.

## Source and limits

The definitions follow the framework contract. The traps and the dashboard pattern come from my own board and dashboard between October 20 and November 9, 2026, including an independent review of the dashboard on October 27. The dashboard is not public; the pattern is enough to build one.
