Enablement

Worked compositions: the questions this source answers, step by step.

Academic Support data source skill — enablement (the Academic Support skill)

What this source is good for, which questions it answers, and worked compositions a reader can run as written, each with its pins (the dictionary entries it depends on) and its failure mode. Stores and columns: DICTIONARY.md; meanings: DICTIONARY.md; run any query with python3 datasource/cdri.py query <store> "<sql>". Window: for composition 0 the days the read API has loaded (/runs); for the reference-build compositions the reference ledger's days, unless a composition says otherwise. Names are placeholders in the examples; real output carries PII and stays local.

Capabilities — what you can answer here (the claim surface)

  1. Learning risk at a campus on a day — which students are at risk of not learning 2x, in which category, and whether anyone acted on each.
  2. What DRIs are asked, how fast they answer, and what it costs — kinds of work, first-reply and resolution readings, modeled hours.
  3. Double-routing — how often one student's problem reaches both the DRI and support, and in which order.
  4. Hand-built reports — which campuses run them, who builds them, whether any two share a generator.
  5. Incident timing — when an incident became official in the campuses, against the data's onset.
  6. Incremental refresh — what changed since the last run, per store.

Question → composition catalog

The user asks…Compose
"How many students at <campus> are at risk, and how many has nobody touched?"recon.categories on the latest as_of_date (triggers IS NOT NULL) → help_status per student, written back by the collector from the four served-by records (ex. 1)
"What do DRIs get asked, and how fast do they answer?"verdicts.verdicts_v2 group A (the DRI record's channels) asks by category, with n_replies, resolved, first_response_min; hours via truthfinder/hours.py (ex. 2)
"Do guides send the same problem to the DRI and to support?"verdicts asks × kayako case_students by student name within ±3 days (ex. 3)
"Which campuses build their own weekly report?"verdicts tracking_reporting by author × channel; slack sheet links by channel (ex. 4)
"When were campuses told about the outage, versus when it started?"slack.broadcasts first_iso vs the platform-health onset (sister) (ex. 5)
"Who was at risk yesterday, by category, campus and guide — from the raw rows?"the scheduled overnight processing (--as-of <yesterday>) → recon.categories (ex. 7)
"What is wrong for this student, in words, and what is the one thing to do?"recon.categories per subject → the deterministic sentence of composition 8
"What changed since yesterday?"cdri.py pull then store cursors; DRI log via worklog.py fetch --since (ex. 6)

When to use this source

The front door's when (skill.json) is the one statement of reach-for and route-away; it is not restated here.


Composition 0 — Read the production ledger through the read API (no reference stores)

Question. What does the served ledger say for a day — population, categories, owners, help states, one student — for a reader who holds only the documents and an API key, or TimeBack credentials with admin access? Pins. DICTIONARY §10c (the read API: routes, parameters, shapes) · §10b (every figure's predicate) · §10a (the rules). Credentials: base URL and key issued per person (header x-api-key), kept in ~/.claude/academic-support-api.env as ACADEMIC_SUPPORT_API_URL / ACADEMIC_SUPPORT_API_KEY — or, with TimeBack admin access, TIMEBACK_CLIENT_ID / TIMEBACK_CLIENT_SECRET on the same routes under /timeback (SKILL.md, Setup); never in a document.

B=$ACADEMIC_SUPPORT_API_URL; H="x-api-key: $ACADEMIC_SUPPORT_API_KEY"
# with TimeBack admin access instead: B=$ACADEMIC_SUPPORT_API_URL/timeback and, in place of -H "$H", -u "$TIMEBACK_CLIENT_ID:$TIMEBACK_CLIENT_SECRET"
curl -s "$B/runs" -H "$H"                                              # every loaded day and its stamps (shape: DICTIONARY §10c)
curl -s "$B/summary?as_of=<day>&scope=all" -H "$H"                     # the page's figures (predicates §10b, shape §10c)
curl -s "$B/health-series?scope=all" -H "$H"                           # days under the latest rules version only
curl -s "$B/students?as_of=<day>&scope=all&at_risk=true&limit=100" -H "$H"        # page 1; follow next_cursor until null (limit ≤ 100)
curl -s "$B/asks/summary?from=2026-08-12&to=<day>" -H "$H"             # what DRIs are asked (both channel groups — see §10c)
curl -s "$B/details?as_of=<day>" -H "$H"                               # served-by sources, two doors, census, freshness
curl -s "$B/tree?as_of=<day>" -H "$H"                                  # drill-down leaves; then /tree/students?as_of=&metro=&campus=&level=&guide=
curl -s "$B/slack/messages?limit=500" -H "$H"                           # the Slack store as pushed; follow next_cursor

Compose: population = roster (the page's view; runs.student_count − untagged.students = roster); share = at_risk ÷ roster; owners both ways (system_risk/investigate_risk/guide_risk overlap; owners_exclusive.system + investigate + guide = at_risk, and with none the four sum to roster); categories from classes ordered by students; a student's row from /students — subjects[] carries every ledger column of §10 under its own name, help[] the served-by records, help_status the state. Check any figure by recounting it over the /students walk (the VERIFIED RUN below is that recount, as served). Failure modes. (1) at_risk is true/false, and false is the page's view, not the complement (§10c /students). (2) Errors and their codes: §10c Errors. (3) Compare days only under one rules_version (§10c, Versions on the wire). (4) Not served by design: the one list is DICTIONARY §10c. (5) Compositions 1–8 below are tagged reference build only: they run on the reference ledger and its reference stores, which the read API does not serve; a reader holding only the API translates their predicates to the API's JSON as this composition does, and does not expect their fenced blocks to run. (6) With TimeBack credentials: 401 when the token has expired (get a new one) or TimeBack rejects the client ID and secret; 403 when the credentials lack TimeBack admin access (§10c, GET /timeback/{route}).

VERIFIED RUN — 2026-09-24, as served. Day 2026-09-23 (/runs: rules_version 2026-09-24c · reader_version 2026.09.20.3 · code_commit e34b7f5), pack 2026-09-24. The first five calls above ran verbatim with <day> = 2026-09-23, then the /students walk followed next_cursor to null and the recount agreed with /summary on the same day: distinct student_id walked = at_risk; owners_exclusive.system + investigate + guide = at_risk (none is served separately and is not part of the split); each classes.<category>.students = the students whose subjects[].triggers name that category. Shapes as §10c states them; the values are the wire's — re-run with your key. This block graduated from cold-agent runs 6–8 (the same path on 2026-09-22 and 2026-09-23, every scope in /scopes) and replaces their figures here; the traces stay in the build log, not in this document.

Composition 1 — Who is at risk at a campus on a given day, and how many of them has nobody touched? · reference build only

Pins: nine categories of learning risk (triggers; flag_kind = the lead by owner precedence (system › investigate › guide; DICTIONARY §10a step 10), a member of triggers and not necessarily its first word) · four served-by records → help_status · one ledger day per BUILT day on the reference build — weekend days included, from 2026-09-19 (the read API serves only the days /runs lists, from 2026-09-22; DICTIONARY §10c, history depth).

-- store: state
WITH at_risk AS (
  SELECT DISTINCT student_id, name, campus_id, subject, flag_kind, help_status
  FROM categories
  WHERE as_of_date = '<yesterday>' AND triggers IS NOT NULL AND brand IS NOT NULL AND modality IS NOT NULL /* the page's view: untagged students are off the page, trap 23 */
    AND campus_id = '<campus org sourcedId>'
)
SELECT flag_kind, COUNT(DISTINCT student_id) students FROM at_risk GROUP BY 1 ORDER BY 2 DESC;
SELECT coalesce(help_status,'nobody'), COUNT(DISTINCT student_id) FROM at_risk GROUP BY 1;   -- in_progress · closed_present · mentioned · nobody

Then, per at-risk student, look for a trace in the four served-by records (the DRI log wire, Kayako, the Slack corpus, GitHub issues) (run in each store; the join is by name/e-mail, see DICTIONARY §15):

-- store: slack  (a thread in a DRI channel naming the student since the school-year start — the same window the collector uses)
SELECT COUNT(*) FROM messages m JOIN channels c ON c.id = m.channel_id
WHERE m.channel_id IN (SELECT channel_id FROM scope)   -- the DRI record's 89 channels (§11; the ruled channel list), the scope the collector reads
  AND m.text LIKE '%<Full Name>%'
  AND m.iso >= '2026-08-12';
-- DRI log, LIVE through the owner's wire (no store): python3 datasources/worklog/worklog.py fetch intervention_requests --since 2026-04-03 --select   # 2026-04-03 is the log's first row: the served-by trace reads the whole log, no window (DICTIONARY §10 *Served-by records*) full_name,email,created_at,section
-- then match <Full Name> / <email> in the reader's context (a row is a touch; presence is the trace)

A student with zero in all four is unserved. The executable version is truthfinder/unserved.py --campus "<Campus>". Required labels on the output: numerator = students at risk with no trace; denominator = distinct students at risk on the named as_of_date; roster basis = the SIS seat (DICTIONARY §5 population). Output shape: one row per category with students (int), then one row per student with traces (0–4); no magnitude is published here — run it. Failure mode: counting flagged rows instead of distinct students (a student is at risk once, whatever the number of subjects); including placeholder/test accounts (exclude names matching the placeholder patterns and is_test_user); reading the April state as "now".

Composition 2 — What are DRIs asked this school year, how fast do they answer, and what does it cost? · reference build only

Pins: DRI ask · the five kinds of work (classifier category) · first reply · resolved · hours model (calibrated top-down, 2026-09-10).

-- store: verdicts
SELECT category,
       COUNT(*)                                            asks,
       ROUND(100.0 * SUM(n_replies = 0) / COUNT(*))        no_reply_pct,
       ROUND(100.0 * SUM(resolved = 'resolved') / COUNT(*)) resolved_pct,
       ROUND(100.0 * SUM(owner IN ('platform','app_vendor','records','it_hardware')) / COUNT(*)) system_owned_pct
FROM verdicts_v2
WHERE grp = 'A' AND direction = 'ask' AND category != 'not_dri_work' AND date >= '2026-08-12'
GROUP BY 1 ORDER BY 2 DESC;

Median first reply per kind needs Python (statistics.median over first_response_min), and hours come from python3 truthfinder/hours.py verdicts_v2 2026-08-12. Required labels: numerator/denominator = asks of that kind ÷ all DRI-work asks in group A within the window (group A = the DRI record's channels — academics, DRI and campus, 89 on 2026-09-22 — ruling 2026-09-24: 'an ask is anything in the DRI record's 89 channels'; before the ruling A was the academics-/dri- names alone); resolved and owner are model readings (say so); hours are modeled minutes calibrated to the 30 h/week non-coaching budget (name the calibration date). Output shape: one row per kind — asks int · no_reply_pct · resolved_pct · system_owned_pct. Failure mode: counting group-B channels (harvested history outside the DRI record's scope); treating resolved as a fact (it is a model reading); quoting modeled hours without the calibration date; comparing to pre-February windows without noting the classifier version.

Composition 3 — How often does the same student's problem reach both the DRI and support? · reference build only

Pins: the two doors · double-routed · fallback · Kayako case_students (sister store) · ±3-day window.

-- store: verdicts — the SY DRI asks with their text
SELECT key, date, channel, lower(text) txt FROM verdicts_v2
WHERE grp='A' AND direction='ask' AND category!='not_dri_work' AND date >= '2026-08-12';
-- sister store: kayako — SY tickets with a named student
SELECT c.id, c.created_at, s.full_name FROM cases c JOIN case_students s ON s.case_id = c.id
WHERE c.created_at >= '2026-08-12' AND s.full_name IS NOT NULL GROUP BY c.id;

Match in Python: a ticket is double-routed when its student's full name appears in a DRI ask's text within ±3 days; classify by order (Slack first · same day · Slack after = fallback). Required labels: numerator = DRI asks with a matching ticket; denominator = DRI-work asks in the window; identity basis = full-name text match (state its false-positive risk, trap 10). Output shape: asks int · double_routed int · slack_first · same_day · slack_after; the reading is yours to take. Failure mode: matching on first name only (false positives on common names); forgetting that a DRI relay creates the ticket in many cases (Slack-first is expected, not a defect); counting the same student twice across subjects.

Composition 4 — Which campuses run hand-built reports, how often, and do any two share one? · reference build only

Pins: push report · tracker · generator · broadcast.

-- store: verdicts — report threads by author and channel
SELECT author, COUNT(DISTINCT channel) channels, COUNT(*) threads
FROM verdicts_v2 WHERE grp='A' AND category='tracking_reporting' AND date >= '2026-08-12'
GROUP BY 1 HAVING channels >= 2 ORDER BY 2 DESC;
-- store: slack — distinct sheets linked, and whether any is shared across channels
SELECT COUNT(DISTINCT sheet) sheets, SUM(n_ch >= 2) shared FROM (
  SELECT substr(m.text, instr(m.text, 'docs.google.com/spreadsheets/d/') + 31, 44) sheet, COUNT(DISTINCT m.channel_id) n_ch
  FROM messages m WHERE m.text LIKE '%docs.google.com/spreadsheets/d/%' AND m.iso >= '2026-08-12' GROUP BY 1);

Output shape: author · channels int · threads int and sheets int · shared int; run it — the readings taken on 2026-09-17 live in the internal measurements ledger (not in the pack), not here. Failure mode: counting guides' trackers as DRI work (the author decides); treating a re-posted link as a new report.

Composition 5 — When did an incident become official in the campuses, versus when the data showed it? · reference build only

Pins: broadcast (same text to ≥3 channels within 15 min) · outage (activity to zero, platform-health source) · lead time.

-- store: slack
SELECT first_iso, last_iso, n_channels, substr(sample_text, 1, 120) text
FROM broadcasts WHERE first_iso >= '2026-09-16' ORDER BY first_iso;

Compare first_iso with the onset in activity data (edu-support's platform-health source). Output shape: one row per broadcast cluster — first_iso · last_iso · n_channels int · text; lead time = onset → first_iso, computed by the reader. Failure mode: reading the broadcast as the incident start; missing waves posted with slightly different wording (the clustering normalizes punctuation and mentions, not paraphrase).

Composition 6 — Pull only what changed since the last run · reference build only

Pins: incremental cursors (sync_state.latest_ts, pulls, work-log updated_at=gte.).

python3 datasource/cdri.py pull      # each puller is incremental and idempotent
python3 datasource/cdri.py stats     # dates held, last pulls
-- DRI log (live): python3 datasources/worklog/worklog.py fetch intervention_requests --since 2026-09-16 --select id,updated_at
-- store: state — did a new day arrive?
SELECT as_of_date, COUNT(DISTINCT student_id) FROM categories GROUP BY 1 ORDER BY 1 DESC;

Failure mode: expecting the state store to gain a day when the upstream sync is off (it re-serves the same date); re-classifying threads already in verdicts_v2 (check key first).

Composition 7 — Compute a school day's learning-risk categories from raw TimeBack (no dashboard needed) · reference build only

Question. Which students were at risk yesterday, by category, campus and guide — from the source rows, with the production rules? Pins. truthfinder/reconstruct.py (reading layer = the TimeBack skill's readers via datasource/skill_sql.mjs); datasource/timeback.py (the skill's MCP, deadline 590 s); output datasources/student_state/reconstructed.sqlite. Mastery, attempts, last gate day and chain state all come from the skill's gate sittings (sittings_<subject> parts, one relation, lifetime); the school-year-start baseline is the same relation bounded by day — no second fetch. Heavy readers (daily28, cumulative, course_xp) run in eight student shards (fetch --only <part> --shard k, one or two per foreground call). The roster is the SIS seat: fetch --only roster_truth students students_extra runs the skill's roster-truth gate (needs ~/.claude/sis-api.json) before categories.py build. Refresh after a rule change: fetch --as-of <day> --refresh --only <parts>, then categories.py build. If every call fails with HTTP 403 (Cloudflare 1010), the token expired and the refresh was unbranded — datasource/timeback.py token first; the internal assistant kit answers questions and audits but pastes at most ~30 KB a turn, so it is not a bulk transport.

the scheduled overnight processing, --as-of 2026-09-16    # the REFERENCE run (ruling 2026-09-21: it tests the definitions; the production ledger is the serverless job's, read through its API): token → roster gate → every part in dependency order (sharded parts one call each) → categories → collector → page → dictionary checks; it runs every night for yesterday
python3 datasource/cdri.py query recon "
  select campus_id, flag_kind, count(distinct student_id) students
  from categories where as_of_date='2026-09-19' and triggers is not null
  group by 1,2 order by 1,3 desc"

Required labels. "computed by the Academic Support skill under rules version <rules_version> as of <as_of>; enrollment, test assignments and roster read as of the run date". Share of students with a problem = students with a non-NULL triggers ÷ students on the page — the ledger read through the page's view (brand and modality present; DICTIONARY §10b roster), which is runs.students minus the untagged students (4 on 2026-09-22, trap 23); say which denominator you used when you quote the share. Counting flag_kind instead of triggers gives the same students. Failure modes. (1) Running for a day more than a few days back mixes old activity with today's enrollment state → churn out-of-work inflates and departed students vanish (dictionary trap 13); run for yesterday. (2) A query past the worker's 600 s ceiling is killed server-side and the client reports a deadline — the cache keeps completed signals, rerun with fetch --only <name>. (3) Calendar B campuses (late start) are counted on Calendar A school days until the per-org calendar lands: their September "time" flags are unreliable. (4) guide_name is now()-based. (5) Never serve a wire figure from this store without the query that produced it.

Composition 8 — Show a student's learning problems to a person, in words · reference build only

Question. What is wrong for this student, subject by subject, said the way their companion would say it — and what is the one thing to do? Pins. categories row per subject (triggers, flag_kind as the leading problem, oow_cause, time_cause, base_course_grades, recent_xp, recent_minutes, recent_accuracy, recent_min_per_xp, block_pct_xp, momentum) · brainlift DOK2 How learning problems are displayed · the display category is flag_kind = the lead by OWNER PRECEDENCE outofwork · stuck · wrongworkinggrade · belowmap · ignoringtest · toohard · tooeasy · unproductive · time (ruling 2026-09-22; triggers is written in the firing order and may lead with a different word).

python3 datasource/cdri.py query recon "
  select subject, flag_kind, triggers, oow_cause, time_cause, base_course_grades, recent_xp, recent_minutes, recent_accuracy,
         recent_min_per_xp, block_pct_xp, momentum, recent_pace_days
  from categories where as_of_date='<as_of>' and student_id='<id>' and eligible=1 order by subject"

Compose one sentence per subject: {course} — "is working the Grade {g} {subject} course" from base_course_grades, else "is working {course_titles}" when the course spans grades, or "has nothing assigned in {subject}" when out of work (cause from oow_cause); {recent} — "over the last two weeks averaged {recent_xp/pace days} XP and {recent_minutes/pace days} minutes a day at {recent_accuracy}% accuracy, {recent_min_per_xp} minutes per XP"; {trajectory} — from ytd_pct_xp (year to date, the subject's own clock) vs block_pct_xp (two weeks) and momentum: both read against the bar with a ±2-percentage-point band (0.98–1.02 of the bar reads as at pace): on pace and holding (both at pace, momentum flat, up or NULL) · on pace but slipping (momentum down) · behind for the year, two weeks at pace — coming back · on pace year to date, two weeks below — slipping, or 'dipped, but this week is up' when momentum is up · behind, restarting (both below, momentum up — a low or empty week before) · behind and not recovering; momentum NULL → no momentum clause; {action} — by the leading category and its owner (see the dictionary's displayed problem entry). The student's headline counts subjects per owner. Row shape (ruling 2026-09-20). fine / needs action first; per subject needing action: Problem · Fix (owner) · evidence; charts folded and uniform (terse data-series, drawn on open); help status not fixed · <in progress | closed, still present | mentioned only | no one on it> with linked records. Required labels. Say "two weeks" and "year to date" by name; state the owner in the action; never a bare number without its unit and window; the evidence the category rests on travels with the sentence — wrong working grade: hmg, kg, base_course_grades; stuck: kg, failed_attempts; below MAP: hmg, r90_floor_sy; too hard / too easy: accuracy_t4w, questions_t4w; time: the whole day's XP and minutes against day_goal (day_pct_xp, day_pct_min) with short_blocks beside it; out of work: oow_cause + the engine's last step (engine_status, engine_since, engine_message) and subject_last_gate — a missing engine record is itself the finding (never started). Difficulty and behavior categories fire on their evidence alone — no block-minutes or block-XP condition (rulings 2026-09-21 too hard, 2026-09-22 too easy). States, not problems: flag_kind = graduated (track complete) and notstarted (no MAP, placement, enrollment or work yet) carry no trigger and sit in the footer. **Clocks: none — the engine's fifteen-minute lag is the only grace; a pending test or an open placement chain excuses out of work while it is open, not for a number of days (ruling 2026-09-22). Completion: completion_basis names the ladder rung that judged each course (xp-percent · xp-earned · lessons · unknown); unknown reads as work present. Vocabulary: one dictionary — python3 datasource/surfaces.py (also run by cdri.py drift) fails when a category, state, cause, basis, verdict, stage, record or help status the code names is not defined in DICTIONARY.md, or a served column is unnamed; run it after every rule change and in the overnight build. Scope: every student figure is read within scopes (overall · metro · campus) — a school's page is index.html#scope=c:<campus id>. Audience: the page speaks to DRIs and leadership, never to the guide — owners in the third person ("for the guide", "for academics & system", "for a deep dive"); "not named anywhere" = no DRI log entry, Kayako ticket or Slack thread names the student since the school year began. A pending test is shown with the date it has been waiting since (test_pending_since, test_pending_name). Failure modes. (1) Several triggers on one subject: lead with the owner precedence, list the rest after. (2) No prior week: no momentum clause. (3) Fewer than five pace days in the window: say "too few school days to judge effort" instead of a pace. (4) A high-school student: the day goal is 180 unless the org sets its own (day_goal); the blocks are the same. (6) A student with a subject out of work: the day goal is still the whole goal — say the out-of-work subject is the system's and the short day the guide's, never redistribute. (7) A graduated subject with a pending test above the sequence top (HS Science): name the test as evidence, no category. (5) Names appear only at the queue level of the reference page; a served rendering carries the student id.

Cross-system notes

Student identity crosses to Kayako by SIS id or e-mail (case_students), to TimeBack by sourced_id, to the SIS by its own id once the wire is available; every such tie is the reader's join across two skills' contracts, never a crosswalk built here. Outage onset comes from the edu-support skill's platform-health signals; ticket resolution latency from its Kayako store; agent-hours from the ticket_support_effort skill. Recurring cross-system gaps are filed upstream (edu-support/the production build's question log (internal)).

Improvement loop

Report on this skill's feedback wire (skill.json → feedback.report; SKILL.md § Giving feedback): POST https://4cnfu40x26.execute-api.us-east-1.amazonaws.com/prod/feedback with {title, body, reporter, kind?}, the body shaped From: / Problem (dated evidence — counts or structure, never a person): / Ask: / Acceptance (a falsifiable test):; GET on the same URL lists every report with its state and resolution. cdri.py quality runs the quality checks and the dictionary-drift test on every overnight run; a recurring data_issues row (runs_seen ≥ 3) is a root-cause task, not a re-fix. Verified runs of new compositions graduate into this document; failed ones become traps in the dictionary (§20). Every change to a reader, a rule, a column, a served-by record or a rendering rule lands in DICTIONARY.md in the same commit — §10 (columns), §10a (rules), §10b/§10b-2 (figures), §10c (the wire) — and in the internal manual shared with the production engineer (ruling 2026-09-21); datasource/spec_check.py fails the drift check when it does not.