---
name: coaching
description: The coaching data source skill — coaching at Alpha this school year: which struggling students got a session by the next school day, completed sessions against the target, how sessions really ended (Meet attendance), what the coach found, whether sessions left students better on their own, whether coaching adds value against similar uncoached students, and heavy users. Answers may name students (from TimeBack) and coaches.
---

# Coaching data source skill

You are reading the skill's own instructions. Everything you need to answer a question is in this folder and in the production read
API; you need no local store. The front door is `https://insights.alpha.school/skill/coaching/skill.json` (`GET /skill` on the read API
redirects there).

## Setup — once per machine

1. Credentials live in `~/.claude/coaching-api.env`, never in this folder: the base URL and one way in.
   ```
   COACHING_API_URL=<base URL of the read API, ending in /prod>
   COACHING_API_KEY=<the x-api-key issued to this person>
   ```
   or, for someone with TimeBack admin access, their TimeBack client ID and secret (or only a TimeBack access token, which they
   refresh themselves):
   ```
   COACHING_API_URL=<base URL of the read API, ending in /prod>
   TIMEBACK_CLIENT_ID=<client id>
   TIMEBACK_CLIENT_SECRET=<client secret>
   ```
   If the file is missing, ask the person for the values, write the file with mode 600, and continue.
   - **Key:** header `x-api-key: $COACHING_API_KEY` on `{URL}/<route>`.
   - **TimeBack admin:** `{URL}/timeback/<route>` with `Authorization: Basic base64(TIMEBACK_CLIENT_ID:TIMEBACK_CLIENT_SECRET)`; the API
     gets and refreshes the TimeBack token. With only `TIMEBACK_TOKEN`: `Authorization: Bearer $TIMEBACK_TOKEN`; a 401 saying it expired
     means getting a new one. The credentials need TimeBack admin access (403 otherwise). This path also serves `/people` and
     `/sessions/{id}` (names, transcripts); every call is recorded.
2. Check the pack: `python3 datasource/checks.py spec` must end with `spec: PASS (N)` (offline; needs only Python 3).
3. Check the wire: `GET {URL}/health` (no key) answers `{"status":"ok"}`; `GET {URL}/runs` with the key (or `{URL}/timeback/runs`
   with TimeBack credentials) lists every load with its reference commit, `full_run_at` and each nightly step's result.

## Verify the install

`python3 datasource/smoke.py` — recounts what the API serves from its own rows (completed sessions and endings per week from
`/sessions`, outcome results per week from `/outcomes`, the students judged on the latest days from `/ledger`) and checks the names
routes (a reader key is refused, TimeBack admin credentials are served); the last line must be `Smoke test passed. (N PASS)`. Run it after installing and whenever an answer looks wrong.

## Reading order

1. `skill.json` — what this source is for, where to route away, how to reach the wire and how to give feedback.
2. `DICTIONARY.md` §0 — the scope, what it answers and what it cannot; §§1–8 the terms; §10 the stores, column by column; §10.10 the read
   API as served (routes, parameters, shapes, paging, errors, what is not served); §14 the traps.
3. `ENABLEMENT.md` — worked compositions: Composition 0 reads the source through the API; compositions 1–9 are written against the
   reference stores, and §10.10 says which route serves each store's rows.
4. `BRAINLIFT.md` — what we believe about coaching, and why, before disagreeing with a definition. Where it and the dictionary word a term
   differently, the dictionary's definition is the one the data follows.

The scope is DICTIONARY §0, stated there once: from 2026-08-12; session counts cover every coaching session, student measures academic
coaching only.

How to answer:
- Use `ending_final` for anything about whether a session happened; `completed` means `ending_final` = completed and nothing else.
- Say the day or window every number comes from, and the night it was read from: `GET /run` (the newest entry of `/runs`) → `as_of`,
  `full_run_at`, and the `steps.<name>.at` of the step that built the store you used (sessions, ledger, outcome, dashboard); DICTIONARY §17 says which to quote.
- Names are allowed (ruling 2026-10-23): name students and coaches wherever it helps the answer. A reader key serves ids, not names:
  resolve a student's name from TimeBack (the reader's own access) and a coach's from the coaching platform. With TimeBack admin
  credentials, `/timeback/people` and `/timeback/sessions/{id}` serve them directly.
- The outcome is per session (did the student do better on their own); whether coaching adds value is the matched comparison. Neither is causal.
- If the documents and the wire disagree, the wire is the fact and the document has a defect: report it (below).

**Two words that look alike** (DICTIONARY trap 28): the ledger's "needed coaching, not reached" means no session was OFFERED by the next
school day; the dashboard's Reach section measures students COACHED (a completed session) by the next school day. They are different
numbers: always say "offered" or "coached", never "reached" alone. And `unblocked_rate` is Better after coaching (trap 27).

## Giving feedback

File a report when the documents and the wire disagree, a figure cannot be reproduced from its rule, or a question this skill
should answer cannot be. Anyone can file, with no key; the tracker is public (it holds every data source skill's reports, so name this
one: `"source": "coaching"`), and each report is fixed where the data is born.

```
FEEDBACK=https://4cnfu40x26.execute-api.us-east-1.amazonaws.com/prod/feedback
curl -s "$FEEDBACK?source=coaching&state=open"   # first: is it already reported? (the same title and body again within a day returns the first one, 200)
curl -s -X POST "$FEEDBACK" -H 'Content-Type: application/json' -d '{
  "source": "coaching",
  "title": "P2 [data] <the field or figure, and what is wrong with it>",
  "reporter": "<who or what is filing>",
  "kind": "report",
  "body": "From: <the question you were answering>\nProblem (dated evidence, counts or structure, never a person): <day, route, count, the rule it breaks>\nAsk: <the fix>\nAcceptance (a falsifiable test): <the query or recount that must pass>"
}'                                                # 201 {number, url}
curl -s "$FEEDBACK/<number>"                     # the report, its state, and its resolution once closed
```
