Authoring metrics
Authoring cost is what a course really costs to produce. The Course Builder already records what the model cost; the authoring metrics module adds how long each stage of a build took, so a course can state its own time to produce. This page covers what is recorded today: stage times, element provenance and the per-course snapshot with its API, the export and the screens: Analytics > Authoring in the admin (Reports and analytics) and Production per course in the studio (How a course was produced). Review time and the hours-per-learner-hour figure follow in later releases (ADR 0194).
What is recorded
Section titled “What is recorded”For every Course Builder run, one row per pipeline stage in the tenant database table authoring_stage_timings:
| Column | Meaning |
|---|---|
session_id, run_id, run_kind |
the build session and run (outline, generate, apply, ingest, patch, sync, …) |
stage |
lessons, grounding, interactions, quizzes, metadata, apply, ingest, variant:<key>; the outline run has no steps and is one row named outline |
started_at, finished_at, seconds |
wall time to the millisecond. Lessons are written in parallel, so a stage is the time the author waited, not the sum of model calls |
quality |
exact (both ends recorded), coarse (whole run only, from the run row), incomplete (the run failed or was cancelled, or crashed mid-stage; the stage is closed at the end of the run) |
A stage that is retried keeps one row per attempt. Nothing about the content, the source or the author is stored.
How long it is kept
Section titled “How long it is kept”The AG-UI events the figures come from are deleted after 30 days (course-builder:prune-events,
COURSE_BUILDER_EVENTS_RETENTION_DAYS). The timing rows are not: they stay as long as the build session.
Builds from before this release
Section titled “Builds from before this release”php artisan authoring-metrics:backfill fills in earlier runs of the current tenant:
- runs whose events still exist (up to 30 days) are replayed and come out
exact; - older runs keep only their own start and finish and become one
coarserow for the whole run; - running or unfinished runs and runs without recorded times are skipped.
docker compose exec api php artisan authoring-metrics:backfill --dry-run --domain=academy.example.comdocker compose exec api php artisan authoring-metrics:backfill --domain=academy.example.com--dry-run does the work and rolls it back, so its counts are what a real run writes. --session=<id> limits it to
one build. It is safe to run again: a stage already recorded is never written twice. ulams:upgrade runs it once for
every tenant (upgrades), so after an upgrade you normally do nothing. Run it soon after the
upgrade: every day later, one more day of events is lost to the 30-day pruning and falls back to coarse.
Who wrote each element
Section titled “Who wrote each element”So that a later report can tell an AI element accepted as it was from one a person changed, the Course Blueprint (schema v3, both fields optional, older documents stay valid) records two things per module, lesson, lesson block and quiz question:
| Field | Meaning |
|---|---|
ai_hash |
sha256 of the normalised content (no ids, trimmed text, Unix line ends) when the AI produced or last revised the element. Set when an outline or the lessons and quizzes are generated, and again when an element chat edit is approved. A lesson’s hash covers the lesson itself, not its blocks and quiz, which have their own |
edited_by_author |
true once a person changed the element directly: rename, add or change the format in the outline editor, a text change absorbed from the LMS, a text change in an import. Moving or removing a lesson is not an edit of its text. An AI revision on request clears it and stores a fresh hash |
An element reads as one of: accepted unchanged (hash matches, never edited), revised by the AI on request (an element
chat edit produced the text; the version history records those as kind patch with the element id), edited by the
author (flag set, or the text no longer matches the hash), written by the author (origin: author from the start), or
unknown (produced before this release: never guessed). Nothing here is shown yet; the counts arrive with the per-course
metric. A change to only ai_hash or edited_by_author is never a difference in a version comparison, a merge or an
import.
The per-course snapshot
Section titled “The per-course snapshot”For every course built with the Course Builder the table authoring_course_metrics keeps one row, recomputed from what
was recorded; every figure has a definition and a method_version (now 1), so an export can say which definitions
produced a number.
| Figure | Definition |
|---|---|
| Generation time | wall time of the stages of runs outline, generate, apply and sync |
| AI edit time | wall time of runs patch (element chat edits) |
| Interview time | wall time of runs interview: the author answering questions, kept on its own line |
| Model time | summed latency of the model calls, for comparison: parallel lessons overlap, so it is longer than the wall time |
| Author time | null (not recorded). It is never shown as zero; recording review time is a separate, opt-in step |
| Cost | the model calls of the course in micro USD at the price the call was made at, split into build (the builder session, its element chat edits and its variants) and maintenance (Living Course proposals from sources and from learner insights). Failed calls are included because they were paid for; their number is kept. Tutor answers and learner remediation are not authoring and are not counted |
| Counts | lessons, quiz questions (and final test), blocks and blocks with at least one citation, from the applied blueprint; learner_minutes_estimate is the sum of the declared lesson minutes |
| AI elements | modules, lessons, blocks and questions the AI wrote, split into accepted unchanged, revised by the AI on request, edited by the author and unknown (written before provenance was recorded); author-written elements are counted apart |
The snapshot is recomputed after every apply, element chat edit and sync run, when a course is published, when a
Living Course proposal is applied and nightly (03:20) for courses whose builder session changed in the last two days.
php artisan authoring-metrics:recompute [--course=ID] rebuilds it by hand; ulams:upgrade runs it once per tenant. The
result is the same for the same recorded history.
Another package that makes model calls about a course adds its own subject type by implementing
Ulams\AuthoringMetrics\Contracts\SubjectCourseResolver and registering it with SubjectResolvers; the ai package
never learns about courses. Living Course does this for its proposals.
Both need a token or session with the permission authoring_metrics_read (given to the admin role by the permission
seeder, which ulams:upgrade runs), except that the author of a course’s builder session may read that one course.
Scoped personal access tokens reach them through the builder area.
| Request | Returns |
|---|---|
GET /api/admin/authoring-metrics/courses?from=&to=&course_id[]= |
the snapshots, optionally of courses created in a date range or of the listed courses |
GET /api/admin/authoring-metrics/courses/export?format=csv|jsonl |
the same rows as a file, with the same filters; one flat row per course with every figure and the method_version, only numbers, identifiers and dates, and an empty cell where author time is not recorded |
GET /api/admin/authoring-metrics/courses/{course} |
one snapshot with the time of every pipeline stage (and whether each is exact, coarse or incomplete) and the element split. 404 when the course was not built with the Course Builder |
From the CLI: ulams authoring-metrics list, get <course> and export --out file.csv. The figures are the tenant’s
own measurements; no industry figure appears anywhere.
Failure behaviour
Section titled “Failure behaviour”Recording never stops a build. If the database write fails, a warning (authoring-metrics: stage timing not recorded) goes to the log and the build continues.