Run artifact

evidence/prompts/20261026.152941.006Z_drydockstats_lineage_attribute_claude.prompt.md

Attribute Stories to Source Requirements

You are the lineage attribution agent. You are given one imported source file and the complete list of stories that already exist for this Target. Identify the distinct requirements the source states, and for each one name the stories that implement it.

This is a matching task against a closed set. Every story you may name is listed in <stories>. You are not decomposing work, proposing new stories, or judging whether the existing stories are correct.

Method

  1. Read the source and identify each distinct requirement it states. A requirement is a thing the

system must do, at whatever granularity the author wrote it. One sentence may state one requirement that several stories implement — for example "add a table and show it on screen" is one requirement implemented by a schema story, a route story, and a view story. Do not split a requirement to make the mapping tidier, and do not merge two requirements that a reader would act on separately.

  1. Give each requirement a short kebab-case name that describes it. The name is an identifier, not

a summary: mark-book-read, not the-reader-can-mark-a-book-as-read.

  1. For each requirement, list every story that implements any part of it. A story may implement

more than one requirement; a requirement may need more than one story.

  1. List any story that implements no requirement in the source as <unattached>. This is expected

and correct for foundational work — application scaffolding, configuration, shared UI framing, test harnesses — that the author never asked for by name. Do not force such a story onto an unrelated requirement.

Rules

Output

<requirement name="add-remove-books" stories="add-book,remove-book,database">
The reader can add a book with a title and author, view the books in the order added, and remove a book.
</requirement>
<requirement name="reject-empty-fields" stories="validate-book">
An empty title or author is rejected with a clear error message.
</requirement>
<unattached story="architecture"/>
<unattached story="ui-general"/>

Attribution job

<source name="INSTRUCTIONS.md">

Build Instructions: A Drydock LLM Log Reporter

Objective

Build a command-line reporter for Drydock's LLM execution log. Drydock appends one JSON record to logs/llm.jsonl for every LLM call it makes. The reporter reads that file and answers the operator's questions: how many calls each command and each Target made, which providers and models ran them, how many tokens and minutes they used, what they cost, and which calls failed.

Stack

Implement in Go 1.22 or newer using only the standard library. The application root is a Go module, and its executable is the main package at ./cmd/ddkstat. Tests run under go test.

Run Harness

sources/run.sh is the scoring entry point. It is supplied, not authored, and is staged verbatim into the application root with the sample log. drydock uat runs sh sources/run.sh from the completed application root and takes its exit code and output as the score.

The harness runs go build -o <temporary path> ./cmd/ddkstat and then runs 20 checks against sources/llm_sample.jsonl. Each check compares one command's exit code and standard output with a known answer. Standard error is never compared. The harness prints PASS or FAIL per check and ends with:

DrydockStats: NN passed, NN failed (of 20)

Read-only scoring assets

These files are the exam. Do not modify, rewrite, regenerate, or substitute them:

blank line, and three lines that must be skipped

Application code never reads sources/run.sh and never embeds a report answer. Every value is computed from the log it is given.

Command

ddkstat <report> [--target <name>] [--since <YYYY-MM-DD>] [--until <YYYY-MM-DD>] <log>

<report> comes first, options follow it, and the log path is last. Exactly one log path is required. <report> is one of summary, commands, targets, models, daily, failures.

OptionMeaning
--target <name>Keep only records whose job.target equals <name> exactly.
--since <date>Keep only records whose start date is on or after <date>.
--until <date>Keep only records whose start date is on or before <date>.

A date option must be a real calendar date written YYYY-MM-DD.

The log

The log is JSON Lines in UTF-8: one JSON object per line. A record carries many fields. The reporter reads only these and ignores every other field:

FieldTypeUse
execution_idstringIdentity of the call.
started_atstring, RFC 3339 UTC, e.g. 2026-10-14T02:38:41.904ZStart time. Its first 10 characters are the start date.
statusstringsucceeded, or any other value for a failed call.
job.command_namestringDrydock command, e.g. build, plan repair.
job.targetstringTarget name.
job.llmstringProvider, e.g. claude, codex, gemini.
job.modelstringThe requested model.
result.stats.modelstring, optionalThe executed model.
result.stats.input_tokensinteger, optionalFresh input tokens.
result.stats.cached_input_tokensinteger, optionalCache-read input tokens.
result.stats.output_tokensinteger, optionalOutput tokens.
result.stats.cost_usdnumber or null, optionalCost in US dollars.
result.stats.elapsed_msinteger, optionalWall-clock duration in milliseconds.
result.returncodeinteger or nullExit code of the LLM process.
result.timed_outbooleanWhether the call timed out.

Rules

  1. Blank lines are ignored and not counted.
  2. Skipped lines. A line is skipped when it is not a JSON object, when any of execution_id,

started_at, status, job.command_name, or job.target is absent or not a non-empty string, or when its execution_id already appeared on an earlier line. The first occurrence of an execution_id is kept. Each skipped line writes one warning to standard error naming its line number. Skipping never changes the exit code.

  1. Missing numbers. An absent or null token count, cost, or duration counts as zero. A

record with no result.stats object at all is still a record.

  1. Model. A record's model is result.stats.model when present and non-empty, otherwise

job.model.

  1. Failed. A record is failed when status is not succeeded.
  2. Filters apply to every report. The skipped count in summary counts skipped lines in the

whole file regardless of filters.

  1. Minutes. A minutes column is the group's summed elapsed_ms written in tenths of a minute:

t = (ms + 3000) / 6000 in integer division, written as t / 10, a ., and t % 10. 95000 ms is 1.6.

  1. Cost. A cost column is the group's summed cost_usd written with exactly four decimal

places, as Go's %.4f writes a float64.

  1. Ordering. Text is compared by byte value.

Output

Every report writes CSV to standard output: one header row, then data rows, comma-separated, \n line endings. Every report except summary and failures ends with a TOTAL row over all filtered records. When no record matches, a report writes its header and, where it has one, a TOTAL row of zeros (0.0 minutes, 0.0000 cost).

ReportHeaderRows
summaryrecords,skipped,succeeded,failed,first,last,input_tokens,cached_tokens,output_tokens,cost_usd,minutesOne row. first and last are the earliest and latest start dates, empty when no record matches.
commandscommand,calls,failed,input_tokens,cached_tokens,output_tokens,minutesOne per command, by calls descending, then command ascending. Then TOTAL,….
targetstarget,calls,failed,input_tokens,cached_tokens,output_tokens,cost_usd,minutesOne per Target, by Target ascending. Then TOTAL,….
modelsprovider,model,calls,failed,input_tokens,cached_tokens,output_tokens,cost_usdOne per provider and model pair, by provider then model ascending. Then TOTAL,,….
dailydate,calls,failed,tokens,minutesOne per start date, ascending. tokens is input plus cached plus output. Then TOTAL,….
failuresstarted_at,target,command,model,returncode,timed_outOne per failed record, by started_at then execution_id ascending. returncode is empty when null or absent. timed_out is true or false.

A failing command writes nothing to standard output and one diagnostic line to standard error.

Exit codes

CodeMeaning
0Success, including a log with skipped lines or no matching records.
1Operational failure: the log cannot be opened or read.
2Usage error: unknown report or option, missing option value, invalid date, missing or extra log path.

Tests

The completed application provides a POSIX-compatible bin/test.sh that runs go vet ./... and go test ./... from the application root and exits zero only when both pass. The suite covers each report, each filter, each skip rule, and each exit code using logs written by the tests. </source>

<stories> <story id="foundation" implements="ARCHITECTURE.md">Stand up the Go module, directory layout and test runner every other story builds into.</story> <story id="log-lines" implements="FEATURE-LogLines.md">Read the JSON Lines log into records, ignoring blank lines and classifying failed calls.</story> <story id="cli-args" implements="FEATURE-CliArgs.md">Parse the report name, options and log path into a validated invocation.</story> <story id="test-script" implements="FEATURE-TestScript.md">Provide bin/test.sh running go vet and go test.</story> <story id="log-skip" implements="FEATURE-LogSkip.md">Skip malformed, incomplete and duplicate lines with a stderr warning and no effect on the exit code.</story> <story id="cli-dates" implements="FEATURE-CliDates.md">Validate --since and --until as real YYYY-MM-DD calendar dates.</story> <story id="log-numbers" implements="FEATURE-LogNumbers.md">Treat absent, null or non-numeric token, cost and duration values as zero.</story> <story id="log-model" implements="FEATURE-LogModel.md">Attribute each record to the executed model, falling back to the requested model.</story> <story id="filter-target" implements="FEATURE-FilterTarget.md">Filter records by exact job.target match.</story> <story id="filter-dates" implements="FEATURE-FilterDates.md">Filter records by inclusive start-date range.</story> <story id="cli-exit" implements="FEATURE-CliExit.md">Assemble the Run pipeline and map failures to exit codes 0, 1 and 2.</story> <story id="build-exe" implements="FEATURE-BuildExecutable.md">Wire the ddkstat main package and keep the module standard-library only.</story> <story id="value-format" implements="FEATURE-ValueFormat.md">Provide shared minutes and cost text formatters.</story> <story id="report-summary" implements="FEATURE-ReportSummary.md">Write the one-row summary report.</story> <story id="report-targets" implements="FEATURE-ReportTargets.md">Write the targets report with cost and a TOTAL row.</story> <story id="report-commands" implements="FEATURE-ReportCommands.md">Write the commands report with a TOTAL row.</story> <story id="report-models" implements="FEATURE-ReportModels.md">Write the models report grouped by provider and model with a TOTAL row.</story> <story id="report-failures" implements="FEATURE-ReportFailures.md">Write the failures report listing each failed record.</story> <story id="report-daily" implements="FEATURE-ReportDaily.md">Write the daily report with token totals and a TOTAL row.</story> <story id="verification" implements="VERIFICATION.md">Run the supplied grader against the finished tool as the terminal gate.</story> </stories>