Run artifact

evidence/prompts/20261027.135409.186Z_layerstesting_analyze_claude.prompt.md

System Instructions

This prompt is divided into three sections:

  1. System Instructions (this section) — structural orientation only. Do not treat this

section as task input.

  1. Input Context — begins with the heading # Input Context. All blocks are wrapped in

<pblock> tags. Two block types:

guidance attribute carries context-specific instructions; content is in a fenced block.

rules, instructions, or group headers.

  1. Agent Task — begins with the heading # Agent Task. Defines your persona, constraints,

and required outputs. Read all input context before acting on this section.

Input Context

<pblock label="Analysis job" kind="job">

Analysis job

</pblock>

<pblock label="Unattended UAT policy" kind="unattended-policy">

Unattended UAT policy

</pblock>

<pblock filename="SEA_TRIALS.md" role="prior project acceptance contract; preserve stable IDs" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/SEA_TRIALS.md">

# Sea Trials: LayersTesting

## Policy

| Consequence | On FAIL | On INCONCLUSIVE |
|---|---|---|
| blocks  | fail   | attest |
| scores  | score  | score  |
| attests | report | report |

## Acceptance scope

Sea Trials assess ledger workflows and their observable results. Database preparation is a
prerequisite exercised by the supplied grader, not a separate release criterion. Verification
uses the declared ledger commands and supplied data; it does not introduce schema mutations,
schema-replacement requirements, or database-engine qualification tests. Stack and persistence
implementation constraints remain in the build instructions.

The supplied grader and the behavioral criteria below are required release evidence. Its exit
status establishes grader conformance; it is not the sole verdict for all Sea Trials. Criterion
identifiers are retained; st-002, st-003, and st-009 are retired.

## st-001: The supplied grader passes
Type: technical
Required: yes
Criterion: The completed ledger shall pass every check in the supplied end-to-end workflow grader, sh sources/run.sh, with exit code zero.
Testability: deterministic
Consequence: blocks
Verification: proof
Command: ["sh", "sources/run.sh"]
Pattern: ubiquitous

## st-004: The seed files load exactly
Type: behavioral
Required: yes
Criterion: When the supplied accounts, categories, and transactions files are loaded in order into an empty ledger, the application shall accept all records, report the loaded counts, and retain 4 accounts, 7 categories, and 120 transactions across subsequent command invocations.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: event

## st-005: Reports match the known answers
Type: behavioral
Required: yes
Criterion: The application shall compute account balances, category totals, and monthly totals from stored ledger data, matching the known answers in sources/run.sh byte for byte both before and after the supplied transaction and transfer workflows.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: ubiquitous

## st-006: Accounts and transactions support create, read, update, and delete
Type: behavioral
Required: yes
Criterion: The application shall retain account additions and renames and transaction postings and amendments across command invocations, return their current values on retrieval, remove successfully deleted records, refuse deletion of an account with transactions with exit code 3, and report an absent record with exit code 4.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: ubiquitous

## st-007: A failed command changes nothing
Type: behavioral
Required: yes
Criterion: If a load, account change, transaction change, or transfer violates a validation or business rule, then the application shall exit 3 and preserve all previously stored ledger records without adding, altering, or removing any record.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: unwanted

## st-008: No balance goes negative
Type: behavioral
Required: yes
Criterion: If loading transactions, posting, amending, deleting, or transferring would leave any account balance below zero, then the application shall reject the entire command with exit code 3 and preserve the prior balances.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: unwanted

## st-010: Transfers conserve cash
Type: behavioral
Required: yes
Criterion: When a valid transfer is requested between distinct accounts, the application shall record an equal debit and credit in category TRANSFER, return both transaction rows, and update both account balances without changing the total cash held.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: event

## st-011: Command results follow the CLI contract
Type: behavioral
Required: yes
Criterion: The application shall return the CSV headers, row ordering, two-decimal monetary values, and exit codes specified in sources/INSTRUCTIONS.md, returning exit 2 for unknown commands or reports and incorrect argument counts, and writing failures only to standard error.
Testability: deterministic
Consequence: blocks
Verification: proof
Pattern: ubiquitous

</pblock>

<pblock filename="MANIFEST.md" role="Rigging stack selection catalog" path="/mnt/c/Users/barlo/projects/drydock/Rigging/MANIFEST.md">

# Rigging Manifest

Compact selection catalog for `drydock analyze` and QuarterDeck. Each entry names a real Rigging
component available for Commander selection. The manifest is selection context only; Analyze does
not open individual component files.

| File | Category | Purpose | Prerequisites |
|---|---|---|---|
| `BRANDING_DOCUMENTATION.md` | Branding | The users voice for Documentation voice, structure, and presentation rules. | — |
| `BRANDING_MAIN.md` | Branding | Core product branding (colors pallette etc ) and visual identity rules. | — |
| `BRANDING_POSTS.md` | Branding | Social and announcement post branding rules. | `BRANDING_MAIN.md` |
| `BRANDING_PROJECT_DOCS.md` | Branding | The users voice, structure, and editing protocol for the authoritative project specification document. | — |
| `BRANDING_WEBSITE.md` | Branding | Website branding, voice, and presentation rules. | `BRANDING_MAIN.md` |
| `BRANDING_WHITEPAPERS.md` | Branding | Whitepaper branding and long-form presentation rules. | `BRANDING_MAIN.md` |
| `alembic.md` | Persistence | Alembic revision workflow. Not used within a release — the schema is built once — and available for versioning schema across releases. | `python.md`, `sqlalchemy.md` |
| `alexa-skills-kit.md` | AWS | Alexa Skill kit configuration, interaction models, and intent handling. | `common.md`, `python.md` |
| `aws-api-gateway.md` | AWS | AWS HTTP API Gateway Rules. | `aws-lambda.md` |
| `aws-dynamodb.md` | AWS | AWS DynamoDB single-table catalog and state patterns. | `cloud-client-library.md` |
| `aws-lambda.md` | AWS | AWS Lambda handlers, packaging, IAM, and testing patterns. | `python.md` |
| `aws-s3.md` | AWS | Private encrypted S3 storage and prefix-scoped sharing patterns. | `cloud-client-library.md` |
| `aws-sqs.md` | AWS | SQS durable queue, polling, and error-handling patterns. | `aws-lambda.md` |
| `bootstrap5.md` | Frontend | Bootstrap 5 layout, components, and form conventions. | — |
| `cli.md` | Technologies | Command-line application entry point, exit codes, cross-platform launchers, and in-process testing. | `common.md`, `python.md` |
| `cloud-client-library.md` | AWS | Encapsulated AWS library for use in applications; application dont uses boto3. | `python.md`, `persistence.md` |
| `common.md` | Technologies | Common project layout, scripts, Git hygiene, and development workflow. | — |
| `django.md` | Web Server | Django settings, ORM, migrations, admin, and web application patterns. | `common.md`, `python.md` |
| `env_variables_and_secrets.md` | Technologies | Secret hygiene, environment validation, and `.env` discipline. | `common.md` |
| `fastapi.md` | Web Server | FastAPI routers, dependency injection, templates, and testing patterns. | `common.md`, `python.md` |
| `flask.md` | Web Server | Flask application factory, routes, templates, and error handling. | `common.md`, `python.md` |
| `github-actions.md` | Technologies | GitHub Actions CI/CD with OIDC and lint/test gates. | `terraform.md`, `python.md` |
| `go.md` | Language | Go module layout, errors, interfaces, concurrency, testing, and build gates. | `common.md` |
| `persistence.md` | Persistence | The store boundary: relational access is generated from DATABASE.md, config, files, and services are typed classes. | `common.md` |
| `postgres.md` | Persistence | PostgreSQL as the production store: what it enforces that SQLite does not. | `persistence.md` |
| `python.md` | Language | Python conventions, typing, configuration, testing, and dependencies. | `common.md` |
| `sqlalchemy.md` | Persistence | SQLAlchemy 2 repositories. Superseded for Target persistence by the generated package; retained for Targets that select it deliberately. | `python.md`, `persistence.md` |
| `sqlite.md` | Persistence | SQLite as the development and test store: what it enforces and what it silently ignores. | `persistence.md` |
| `terraform.md` | Technologies | Layered Terraform infrastructure and remote-state patterns. | `aws-dynamodb.md`, `aws-s3.md` |
| `typescript.md` | Language | TypeScript strict typing, domain modeling, and boundary validation. | `common.md` |
| `ui-flask.bootstrap-client.md` | Frontend | Focused Flask and Bootstrap screen implementation reference. | `flask.md`, `bootstrap5.md` |
| `uv_ruff.md` | Technologies | uv environments and ruff lint/format workflow. | `python.md` |

</pblock>

<pblock label="Imported source file header" kind="section">

Imported source files

</pblock>

<pblock label="Source material inventory" kind="section">

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/run.shcodeanalyzedreadable UTF-8
sources/seed_accounts.csvtextanalyzedreadable UTF-8
sources/seed_categories.csvtextanalyzedreadable UTF-8
sources/seed_transactions.csvtextanalyzedreadable UTF-8
sources/seed_transactions_bad.csvtextanalyzedreadable UTF-8

</pblock>

<pblock filename="sources/INSTRUCTIONS.md" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/INSTRUCTIONS.md" guidance="Raw User Source">

# Build Instructions: A Cash Ledger

## Objective

Build a command-line cash ledger for a small shop. The shop keeps cash in a few places (drawers,
a safe, petty cash), records every receipt and payment against one of those places, and asks for
three reports: balances by account, totals by category, and totals by month.

The product is an executable named `ledger` at the application root. It stores everything in a
relational database through the shipped persistence library, and every command either completes
in full or changes nothing.

## Stack

Implement in Python 3.11 or newer over SQLite, through the shipped Python persistence
library. Tests run under pytest. The contract below is the same for every language and database: the same
commands, the same output, and the same exit codes.

## 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 seed files. `drydock uat` runs `sh sources/run.sh` from the
completed application root and takes its exit code and output as the score.

The harness creates a fresh database, runs `./ledger init`, loads the seed files, and then runs a
fixed sequence of 43 checks. 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:

```text
LayersTesting: NN passed, NN failed (of 43)
```

## Read-only scoring assets

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

- `sources/run.sh` — the scoring entry point and its known answers
- `sources/seed_accounts.csv` — 4 accounts
- `sources/seed_categories.csv` — 7 categories
- `sources/seed_transactions.csv` — 120 transactions, January to March 2026
- `sources/seed_transactions_bad.csv` — 11 transactions; row 11 names an unknown account

Application code never reads `sources/run.sh` and never embeds a report answer. Every report is
computed from the database.

## Database

The database is SQLite. `DATABASE_URL` names the SQLite file path, optionally prefixed
`sqlite://`. When `DATABASE_URL` is unset, `DATABASE_PATH` is used, then `data/app.db`.

Three tables. Amounts are stored as integer cents and never as floating point.

| Table | Columns | Keys |
|---|---|---|
| `accounts` | `account` text, `name` text | primary key `account` |
| `categories` | `category` text, `description` text | primary key `category` |
| `transactions` | `txn_id` integer, `date` text `YYYY-MM-DD`, `account` text, `category` text, `amount` integer cents, `memo` text | primary key `txn_id`; `account` references `accounts`; `category` references `categories` |

All database access goes through the shipped persistence library and the relational layer
generated from `DATABASE.md`. Application code never opens a database driver directly.

## Rules

1. **A rejected command changes nothing.** A command checks every input and rule before its
   first write. A load that rejects row 11 stores none of rows 1 to 10. A transfer stores both of
   its rows or neither.
2. **No command leaves an account balance below zero.** An account's balance is the sum of its
   transaction amounts. Posting, amending, deleting, transferring, and loading are all subject to
   this rule, checked before the command writes anything.
3. **Codes** (`account`, `category`) are 1 to 12 characters from `A-Z` and `0-9`.
4. **Names and descriptions** are 1 to 40 characters. **Memos** are 0 to 60 characters. None of
   them contains a comma or a newline.
5. **Amounts** on input match `-?DIGITS[.D[D]]`: at most two decimal places, never zero. On output
   an amount is written with exactly two decimal places, a leading `-` when negative, and no
   thousands separator: `-12.50`, `0.00`, `5000.00`.
6. **Dates** are real calendar dates written `YYYY-MM-DD`. `2026-02-30` is rejected.
7. **Transaction ids.** A loaded transaction keeps the `txn_id` from its file. A posted
   transaction receives one more than the largest `txn_id` present, or `1` in an empty table. A
   transfer's outgoing row takes that id and its incoming row the next.

## Output

Every successful command except `init` writes CSV to standard output: one header row, then data
rows, comma-separated, no quoting, no trailing spaces, `\n` line endings. `init` writes nothing.
A failing command writes nothing to standard output and one diagnostic line to standard error.

The account row is `account,name,transactions,balance`, where `transactions` counts the account's
transactions. The transaction row is `txn_id,date,account,category,amount,memo`.

## Commands

| Command | Output on success |
|---|---|
| `ledger init` | Prepares an empty ledger for loading and use; removes existing ledger records when rerun. Nothing written. |
| `ledger count` | `table,rows`, then `accounts`, `categories`, `transactions` rows in that order. |
| `ledger load <table> <csv>` | Loads `accounts`, `categories`, or `transactions` from a file whose header matches the table's columns in the order above. Writes `table,loaded` and `<table>,<rows>`. |
| `ledger account add <code> <name>` | The new account row. |
| `ledger account get <code>` | The account row. |
| `ledger account rename <code> <name>` | The updated account row. |
| `ledger account delete <code>` | `deleted` and the code. Refused while the account has transactions. |
| `ledger txn post <account> <category> <amount> <date> [<memo>]` | The new transaction row. |
| `ledger txn get <id>` | The transaction row. |
| `ledger txn amend <id> <amount>` | The updated transaction row. Only the amount changes. |
| `ledger txn delete <id>` | `deleted` and the id. |
| `ledger transfer <from> <to> <amount> <date>` | Two transaction rows in category `TRANSFER`: `-amount` on `<from>` with memo `transfer to <to>`, then `+amount` on `<to>` with memo `transfer from <from>`. The amount is positive and the accounts differ. |
| `ledger report balances` | `account,name,transactions,balance` per account ordered by code, then `TOTAL,,<count>,<sum>`. |
| `ledger report categories` | `category,description,transactions,inflow,outflow,net` per category ordered by code, including categories with no transactions, then `TOTAL,,<count>,<inflow>,<outflow>,<net>`. |
| `ledger report monthly` | `month,transactions,inflow,outflow,net` per `YYYY-MM` that has transactions, ascending, then `TOTAL,<count>,<inflow>,<outflow>,<net>`. |

`inflow` is the sum of positive amounts. `outflow` is the sum of the absolute values of negative
amounts, written as a positive number. `net` is `inflow - outflow`.

## Exit codes

| Code | Meaning |
|---|---|
| `0` | Success. |
| `1` | Operational failure: a file named on the command line cannot be read. |
| `2` | Usage error: unknown command, unknown table or report, wrong argument count. |
| `3` | Rejected: invalid code, name, amount, date, or file row; duplicate key; unknown account or category; account in use; any change that would leave a negative balance. |
| `4` | Not found: `account get/rename/delete` of an absent account, `txn get/amend/delete` of an absent id. |

## Tests

The completed application provides a POSIX-compatible `bin/test.sh` that runs its own automated
test suite from the application root and exits zero only when every test passes. The suite
covers each command, each exit code, and each rule above against a real temporary database.

</pblock>

<pblock filename="sources/run.sh" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/run.sh">

#!/bin/sh
# run.sh — LayersTesting grader. Do not filter, skip, or reinterpret.
#
# Exercises ./ledger against a fresh database and compares every command's exit code and standard
# output with the known answer below. Standard error is never compared.
#
#   sh sources/run.sh                    from the application root (how `drydock uat` runs it)
#   sh uat/LayersTesting/bin/run.sh APP  from anywhere, grading the application root APP
#
# Database: DATABASE_URL when the caller sets it (for example a PostgreSQL DSN), otherwise a
# SQLite file in a fresh temporary directory. Every run starts with `ledger init`, so the grader
# never depends on prior state. Exit 0 only when every check passes.
set -u

HERE=$(cd "$(dirname "$0")" && pwd)
APP=$(cd "${1:-.}" && pwd)
if [ -f "$HERE/seed_accounts.csv" ]; then SEED=$HERE; else SEED=$(cd "$HERE/../sources" && pwd); fi
LEDGER="$APP/ledger"
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT INT TERM
DATABASE_URL=${DATABASE_URL:-$WORK/ledger.db}
export DATABASE_URL

if [ ! -x "$LEDGER" ]; then
    echo "error: no executable ./ledger at the application root $APP." >&2
    echo "The deliverable is an executable named ledger at the application root." >&2
    exit 1
fi

PASSED=0
FAILED=0

# check <id> <expected exit> <ledger args...>  — expected standard output on stdin.
check() {
    id=$1
    want_rc=$2
    shift 2
    cat > "$WORK/want"
    (cd "$APP" && "$LEDGER" "$@") > "$WORK/got" 2> "$WORK/err"
    rc=$?
    if [ "$rc" -eq "$want_rc" ] && cmp -s "$WORK/want" "$WORK/got"; then
        PASSED=$((PASSED + 1))
        echo "PASS $id: ledger $*"
    else
        FAILED=$((FAILED + 1))
        echo "FAIL $id: ledger $*"
        echo "  exit: expected $want_rc, got $rc"
        diff "$WORK/want" "$WORK/got" | sed 's/^/  /'
        sed 's/^/  stderr: /' "$WORK/err"
    fi
}

# ── A. Schema lifecycle ──────────────────────────────────────────────────────────────────
check A1 0 init < /dev/null
check A2 0 count <<'EOF'
table,rows
accounts,0
categories,0
transactions,0
EOF

# ── B. Bulk load of the known dataset ────────────────────────────────────────────────────
check B1 0 load accounts "$SEED/seed_accounts.csv" <<'EOF'
table,loaded
accounts,4
EOF
check B2 0 load categories "$SEED/seed_categories.csv" <<'EOF'
table,loaded
categories,7
EOF
check B3 0 load transactions "$SEED/seed_transactions.csv" <<'EOF'
table,loaded
transactions,120
EOF
check B4 0 count <<'EOF'
table,rows
accounts,4
categories,7
transactions,120
EOF

# ── C. Reports over the seeded rows ──────────────────────────────────────────────────────
check C1 0 report balances <<'EOF'
account,name,transactions,balance
DRAWER1,Front Drawer,39,2299.38
DRAWER2,Back Drawer,39,1378.32
PETTY,Petty Cash,21,306.25
SAFE,Store Safe,21,250.00
TOTAL,,120,4233.95
EOF
check C2 0 report categories <<'EOF'
category,description,transactions,inflow,outflow,net
OPENING,Opening balance,2,5200.00,0.00,5200.00
PAYROLL,Payroll,6,0.00,7200.00,-7200.00
REFUND,Customer refunds,12,0.00,101.25,-101.25
RENT,Rent,3,0.00,2700.00,-2700.00
SALES,Sales receipts,64,9578.95,0.00,9578.95
SUPPLY,Supplies,15,0.00,543.75,-543.75
TRANSFER,Internal transfer,18,5100.00,5100.00,0.00
TOTAL,,120,19878.95,15645.00,4233.95
EOF
check C3 0 report monthly <<'EOF'
month,transactions,inflow,outflow,net
2026-01,40,9659.45,5215.00,4444.45
2026-02,40,4979.65,5215.00,-235.35
2026-03,40,5239.85,5215.00,24.85
TOTAL,120,19878.95,15645.00,4233.95
EOF

# ── D. A rejected load changes nothing ───────────────────────────────────────────────────
check D1 3 load transactions "$SEED/seed_transactions_bad.csv" < /dev/null
check D2 3 load accounts "$SEED/seed_accounts.csv" < /dev/null
check D3 0 count <<'EOF'
table,rows
accounts,4
categories,7
transactions,120
EOF

# ── E. Account create, read, update, delete ──────────────────────────────────────────────
check E1 0 account add CASH9 "Event Float" <<'EOF'
account,name,transactions,balance
CASH9,Event Float,0,0.00
EOF
check E2 3 account add CASH9 "Event Float" < /dev/null
check E3 0 account get CASH9 <<'EOF'
account,name,transactions,balance
CASH9,Event Float,0,0.00
EOF
check E4 0 account rename CASH9 "Event Cash Box" <<'EOF'
account,name,transactions,balance
CASH9,Event Cash Box,0,0.00
EOF
check E5 4 account get NOSUCH < /dev/null
check E6 3 account delete DRAWER1 < /dev/null
check E7 0 account delete CASH9 <<'EOF'
deleted
CASH9
EOF
check E8 4 account get CASH9 < /dev/null

# ── F. Transaction create, read, update, delete ──────────────────────────────────────────
check F1 0 txn post DRAWER1 SALES 45.50 2026-04-01 "walk in sale" <<'EOF'
txn_id,date,account,category,amount,memo
121,2026-04-01,DRAWER1,SALES,45.50,walk in sale
EOF
check F2 0 txn get 121 <<'EOF'
txn_id,date,account,category,amount,memo
121,2026-04-01,DRAWER1,SALES,45.50,walk in sale
EOF
check F3 0 txn amend 121 54.50 <<'EOF'
txn_id,date,account,category,amount,memo
121,2026-04-01,DRAWER1,SALES,54.50,walk in sale
EOF
check F4 4 txn get 999 < /dev/null
check F5 3 txn post DRAWER1 NOSUCH 1.00 2026-04-01 < /dev/null
check F6 3 txn post DRAWER1 SALES 1.234 2026-04-01 < /dev/null
check F7 3 txn post DRAWER1 SALES 1.00 2026-02-30 < /dev/null
check F8 0 txn delete 121 <<'EOF'
deleted
121
EOF
check F9 4 txn get 121 < /dev/null
check F10 0 txn post PETTY SUPPLY -12.34 2026-04-02 tape <<'EOF'
txn_id,date,account,category,amount,memo
121,2026-04-02,PETTY,SUPPLY,-12.34,tape
EOF

# ── G. Transfers are atomic; no command leaves a negative balance ────────────────────────
check G1 0 transfer DRAWER1 SAFE 500.00 2026-04-03 <<'EOF'
txn_id,date,account,category,amount,memo
122,2026-04-03,DRAWER1,TRANSFER,-500.00,transfer to SAFE
123,2026-04-03,SAFE,TRANSFER,500.00,transfer from DRAWER1
EOF
check G2 3 transfer SAFE PETTY 999.99 2026-04-04 < /dev/null
check G3 3 txn post PETTY SUPPLY -1000.00 2026-04-04 < /dev/null
check G4 3 txn amend 1 1.00 < /dev/null
check G5 3 txn delete 1 < /dev/null
check G6 0 count <<'EOF'
table,rows
accounts,4
categories,7
transactions,123
EOF

# ── H. Reports after the changes ─────────────────────────────────────────────────────────
check H1 0 report balances <<'EOF'
account,name,transactions,balance
DRAWER1,Front Drawer,40,1799.38
DRAWER2,Back Drawer,39,1378.32
PETTY,Petty Cash,22,293.91
SAFE,Store Safe,22,750.00
TOTAL,,123,4221.61
EOF
check H2 0 report categories <<'EOF'
category,description,transactions,inflow,outflow,net
OPENING,Opening balance,2,5200.00,0.00,5200.00
PAYROLL,Payroll,6,0.00,7200.00,-7200.00
REFUND,Customer refunds,12,0.00,101.25,-101.25
RENT,Rent,3,0.00,2700.00,-2700.00
SALES,Sales receipts,64,9578.95,0.00,9578.95
SUPPLY,Supplies,16,0.00,556.09,-556.09
TRANSFER,Internal transfer,20,5600.00,5600.00,0.00
TOTAL,,123,20378.95,16157.34,4221.61
EOF
check H3 0 report monthly <<'EOF'
month,transactions,inflow,outflow,net
2026-01,40,9659.45,5215.00,4444.45
2026-02,40,4979.65,5215.00,-235.35
2026-03,40,5239.85,5215.00,24.85
2026-04,3,500.00,512.34,-12.34
TOTAL,123,20378.95,16157.34,4221.61
EOF

# ── U. Usage errors ──────────────────────────────────────────────────────────────────────
check U1 2 frobnicate < /dev/null
check U2 2 report nosuch < /dev/null

# ── Z. Re-initialization drops every row ─────────────────────────────────────────────────
check Z1 0 init < /dev/null
check Z2 0 count <<'EOF'
table,rows
accounts,0
categories,0
transactions,0
EOF

TOTAL=$((PASSED + FAILED))
echo "LayersTesting: $PASSED passed, $FAILED failed (of $TOTAL)"
[ "$FAILED" -eq 0 ]

</pblock>

<pblock filename="sources/seed_accounts.csv" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/seed_accounts.csv">

account,name
DRAWER1,Front Drawer
DRAWER2,Back Drawer
PETTY,Petty Cash
SAFE,Store Safe

</pblock>

<pblock filename="sources/seed_categories.csv" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/seed_categories.csv">

category,description
OPENING,Opening balance
PAYROLL,Payroll
REFUND,Customer refunds
RENT,Rent
SALES,Sales receipts
SUPPLY,Supplies
TRANSFER,Internal transfer

</pblock>

<pblock filename="sources/seed_transactions.csv" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/seed_transactions.csv">

txn_id,date,account,category,amount,memo
1,2026-01-01,SAFE,OPENING,5000.00,opening float
2,2026-01-01,PETTY,OPENING,200.00,opening float
3,2026-01-02,DRAWER1,SALES,155.26,sales day 1
4,2026-01-02,DRAWER2,SALES,83.11,sales day 1
5,2026-01-03,DRAWER1,SALES,160.51,sales day 2
6,2026-01-03,DRAWER2,SALES,86.21,sales day 2
7,2026-01-04,DRAWER1,SALES,165.76,sales day 3
8,2026-01-04,DRAWER2,SALES,89.31,sales day 3
9,2026-01-05,DRAWER1,SALES,171.01,sales day 4
10,2026-01-05,DRAWER2,SALES,92.41,sales day 4
11,2026-01-06,DRAWER1,SALES,176.26,sales day 5
12,2026-01-06,DRAWER2,SALES,95.51,sales day 5
13,2026-01-07,DRAWER1,SALES,181.51,sales day 6
14,2026-01-07,DRAWER2,SALES,98.61,sales day 6
15,2026-01-08,DRAWER1,SALES,186.76,sales day 7
16,2026-01-08,DRAWER2,SALES,101.71,sales day 7
17,2026-01-09,DRAWER1,SALES,192.01,sales day 8
18,2026-01-09,DRAWER2,SALES,104.81,sales day 8
19,2026-01-10,DRAWER1,SALES,197.26,sales day 9
20,2026-01-10,DRAWER2,SALES,107.91,sales day 9
21,2026-01-11,DRAWER1,SALES,202.51,sales day 10
22,2026-01-11,DRAWER2,SALES,111.01,sales day 10
23,2026-01-12,DRAWER1,REFUND,-12.50,refund
24,2026-01-12,DRAWER2,REFUND,-7.25,refund
25,2026-01-13,DRAWER1,REFUND,-9.99,refund
26,2026-01-13,DRAWER2,REFUND,-4.01,refund
27,2026-01-14,DRAWER1,TRANSFER,-1000.00,transfer to SAFE
28,2026-01-14,SAFE,TRANSFER,1000.00,transfer from DRAWER1
29,2026-01-14,DRAWER2,TRANSFER,-500.00,transfer to SAFE
30,2026-01-14,SAFE,TRANSFER,500.00,transfer from DRAWER2
31,2026-01-15,SAFE,TRANSFER,-200.00,transfer to PETTY
32,2026-01-15,PETTY,TRANSFER,200.00,transfer from SAFE
33,2026-01-16,PETTY,SUPPLY,-35.40,supplies
34,2026-01-17,PETTY,SUPPLY,-42.10,supplies
35,2026-01-18,PETTY,SUPPLY,-18.75,supplies
36,2026-01-19,PETTY,SUPPLY,-60.00,supplies
37,2026-01-20,PETTY,SUPPLY,-25.00,supplies
38,2026-01-21,SAFE,PAYROLL,-1200.00,payroll week 1
39,2026-01-28,SAFE,PAYROLL,-1200.00,payroll week 2
40,2026-01-28,SAFE,RENT,-900.00,rent
41,2026-02-01,SAFE,SALES,500.00,deposit
42,2026-02-01,PETTY,SALES,20.00,deposit
43,2026-02-02,DRAWER1,SALES,155.27,sales day 1
44,2026-02-02,DRAWER2,SALES,83.12,sales day 1
45,2026-02-03,DRAWER1,SALES,160.52,sales day 2
46,2026-02-03,DRAWER2,SALES,86.22,sales day 2
47,2026-02-04,DRAWER1,SALES,165.77,sales day 3
48,2026-02-04,DRAWER2,SALES,89.32,sales day 3
49,2026-02-05,DRAWER1,SALES,171.02,sales day 4
50,2026-02-05,DRAWER2,SALES,92.42,sales day 4
51,2026-02-06,DRAWER1,SALES,176.27,sales day 5
52,2026-02-06,DRAWER2,SALES,95.52,sales day 5
53,2026-02-07,DRAWER1,SALES,181.52,sales day 6
54,2026-02-07,DRAWER2,SALES,98.62,sales day 6
55,2026-02-08,DRAWER1,SALES,186.77,sales day 7
56,2026-02-08,DRAWER2,SALES,101.72,sales day 7
57,2026-02-09,DRAWER1,SALES,192.02,sales day 8
58,2026-02-09,DRAWER2,SALES,104.82,sales day 8
59,2026-02-10,DRAWER1,SALES,197.27,sales day 9
60,2026-02-10,DRAWER2,SALES,107.92,sales day 9
61,2026-02-11,DRAWER1,SALES,202.52,sales day 10
62,2026-02-11,DRAWER2,SALES,111.02,sales day 10
63,2026-02-12,DRAWER1,REFUND,-12.50,refund
64,2026-02-12,DRAWER2,REFUND,-7.25,refund
65,2026-02-13,DRAWER1,REFUND,-9.99,refund
66,2026-02-13,DRAWER2,REFUND,-4.01,refund
67,2026-02-14,DRAWER1,TRANSFER,-1000.00,transfer to SAFE
68,2026-02-14,SAFE,TRANSFER,1000.00,transfer from DRAWER1
69,2026-02-14,DRAWER2,TRANSFER,-500.00,transfer to SAFE
70,2026-02-14,SAFE,TRANSFER,500.00,transfer from DRAWER2
71,2026-02-15,SAFE,TRANSFER,-200.00,transfer to PETTY
72,2026-02-15,PETTY,TRANSFER,200.00,transfer from SAFE
73,2026-02-16,PETTY,SUPPLY,-35.40,supplies
74,2026-02-17,PETTY,SUPPLY,-42.10,supplies
75,2026-02-18,PETTY,SUPPLY,-18.75,supplies
76,2026-02-19,PETTY,SUPPLY,-60.00,supplies
77,2026-02-20,PETTY,SUPPLY,-25.00,supplies
78,2026-02-21,SAFE,PAYROLL,-1200.00,payroll week 1
79,2026-02-28,SAFE,PAYROLL,-1200.00,payroll week 2
80,2026-02-28,SAFE,RENT,-900.00,rent
81,2026-03-01,SAFE,SALES,750.00,deposit
82,2026-03-01,PETTY,SALES,30.00,deposit
83,2026-03-02,DRAWER1,SALES,155.28,sales day 1
84,2026-03-02,DRAWER2,SALES,83.13,sales day 1
85,2026-03-03,DRAWER1,SALES,160.53,sales day 2
86,2026-03-03,DRAWER2,SALES,86.23,sales day 2
87,2026-03-04,DRAWER1,SALES,165.78,sales day 3
88,2026-03-04,DRAWER2,SALES,89.33,sales day 3
89,2026-03-05,DRAWER1,SALES,171.03,sales day 4
90,2026-03-05,DRAWER2,SALES,92.43,sales day 4
91,2026-03-06,DRAWER1,SALES,176.28,sales day 5
92,2026-03-06,DRAWER2,SALES,95.53,sales day 5
93,2026-03-07,DRAWER1,SALES,181.53,sales day 6
94,2026-03-07,DRAWER2,SALES,98.63,sales day 6
95,2026-03-08,DRAWER1,SALES,186.78,sales day 7
96,2026-03-08,DRAWER2,SALES,101.73,sales day 7
97,2026-03-09,DRAWER1,SALES,192.03,sales day 8
98,2026-03-09,DRAWER2,SALES,104.83,sales day 8
99,2026-03-10,DRAWER1,SALES,197.28,sales day 9
100,2026-03-10,DRAWER2,SALES,107.93,sales day 9
101,2026-03-11,DRAWER1,SALES,202.53,sales day 10
102,2026-03-11,DRAWER2,SALES,111.03,sales day 10
103,2026-03-12,DRAWER1,REFUND,-12.50,refund
104,2026-03-12,DRAWER2,REFUND,-7.25,refund
105,2026-03-13,DRAWER1,REFUND,-9.99,refund
106,2026-03-13,DRAWER2,REFUND,-4.01,refund
107,2026-03-14,DRAWER1,TRANSFER,-1000.00,transfer to SAFE
108,2026-03-14,SAFE,TRANSFER,1000.00,transfer from DRAWER1
109,2026-03-14,DRAWER2,TRANSFER,-500.00,transfer to SAFE
110,2026-03-14,SAFE,TRANSFER,500.00,transfer from DRAWER2
111,2026-03-15,SAFE,TRANSFER,-200.00,transfer to PETTY
112,2026-03-15,PETTY,TRANSFER,200.00,transfer from SAFE
113,2026-03-16,PETTY,SUPPLY,-35.40,supplies
114,2026-03-17,PETTY,SUPPLY,-42.10,supplies
115,2026-03-18,PETTY,SUPPLY,-18.75,supplies
116,2026-03-19,PETTY,SUPPLY,-60.00,supplies
117,2026-03-20,PETTY,SUPPLY,-25.00,supplies
118,2026-03-21,SAFE,PAYROLL,-1200.00,payroll week 1
119,2026-03-28,SAFE,PAYROLL,-1200.00,payroll week 2
120,2026-03-28,SAFE,RENT,-900.00,rent

</pblock>

<pblock filename="sources/seed_transactions_bad.csv" role="source file" path="/mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint/sources/seed_transactions_bad.csv">

txn_id,date,account,category,amount,memo
201,2026-04-01,DRAWER1,SALES,10.00,bad batch 1
202,2026-04-01,DRAWER1,SALES,10.00,bad batch 2
203,2026-04-01,DRAWER1,SALES,10.00,bad batch 3
204,2026-04-01,DRAWER1,SALES,10.00,bad batch 4
205,2026-04-01,DRAWER1,SALES,10.00,bad batch 5
206,2026-04-01,DRAWER1,SALES,10.00,bad batch 6
207,2026-04-01,DRAWER1,SALES,10.00,bad batch 7
208,2026-04-01,DRAWER1,SALES,10.00,bad batch 8
209,2026-04-01,DRAWER1,SALES,10.00,bad batch 9
210,2026-04-01,DRAWER1,SALES,10.00,bad batch 10
211,2026-04-01,NOSUCH,SALES,10.00,unknown account

</pblock>

Agent Task

Agent for: blueprint analysis

You are the Team Lead conducting the Product Owner feedback session. You are the team's Agile expert and follow Agile best practices. Your handoff is deliberately completeness-oriented: do not finish until the supplied Commander intent can be handed to Plan as a coherent, buildable epic.

You have received imported source material — one or more documents describing what the product should do. Your job is to analyze that input and produce summary information which will be output to curated files.

The core elements are defined below.


Agile Story Decomposition

Your goal is to do planning for the information you have imported.

You will be creating a set of Agile features and stories. Features group stories; they are the only grouping unit used by ANALYSIS.md and the Commanders Chair. You raise anything the human must decide as either a blocker or a discovery questionnaire. A blocker means the sources cannot be analyzed into a coherent product decomposition. A discovery questionnaire records a finite Commander decision. Mark a questionnaire question "required_before_plan": true when planning cannot author an internally consistent specification until it is answered. Stack selection and unresolved conflicting definitions are required planning decisions.

A story is an atomic testable unit of work that might have acceptance criteria and guardrails at a later stage. Stories include user interface screens, the routes used to service those screens, cli options, api served, batch scripts needed, import/export operations, and other atomic units of work according to agile best practices. Do not create a separate Screens grouping or count; UI screens are stories under the relevant Agile feature.

Story granularity. A story is a normal Agile story: 1 to 5 story points. Never a half point — that is a task, and a task is folded into the story it serves rather than listed beside it. Never twelve — that is split. A story does one thing completely and is releasable on its own; a task is not releasable and is therefore not a story. "Add a button" and "add a test" are tasks. Size by that judgement alone: a story has no token dimension, and story count is an output of correct decomposition, never a target to hit or avoid.

You will note the interrelationships between these elements — for example, a user interface screen uses api calls, and an export depends on the data it reads. Note them to inform how you cut stories; do not build a dependency graph. The graph is constructed later, by plan create.

You will also look at the technologies mentioned in the sources and create a list. If a needed technology is implied but never named — for example a web server is required but none is chosen — surface that as a blocking stack question.

When you look at a story that you have created, if it is complex, attempt to break it up into smaller stories. In the agile process, it is preferable to use multiple smaller stories rather than one larger one.

A very good way to understand this is that the stories you are identifying will eventually, in another command, become markdown files with their specifications included. That markdown will have Acceptance Criteria, GuardRails, and interrelationships. Do not calculate these now; when you define the stories, use the natural boundaries provided within the input files for accuracy of breakdown. Content rearranged at a later step is costly, so cut along the natural groupings that occur within the input.

Derive strategic goals and success criteria only where the sources state or directly imply them. Do not invent business outcomes, thresholds, or acceptance commitments.

Project-fact authority. Prompt context and Commander input are authoritative for the project being analyzed. General knowledge may explain a supplied source, but it must not supply, replace, or refine a project requirement. In particular, do not infer, recall, estimate, or invent a project-specific count, version, limit, threshold, or test total.

Universal acceptance preservation. When a source says all, every, complete, 100%, zero failures, zero errors, or equivalent universal language, preserve that universal form. Do not translate it into a numeric cardinality, a Target: value, an Extract: value, or an exact passed-count assertion. A supplied full test suite proves such a requirement by running unfiltered and succeeding; it does not require the Commander to specify how well the software should work.

Be sure to understand the architecture and component structure.

An input failure that prevents coherent analysis is a blocker. A blocker is not a product choice between identifiable alternatives: emit that choice as a required discovery questionnaire. When you find one or more blockers, write BLOCKERS.md; its mere existence stops downstream steps until the human clears it. When there are no blockers, do not write the file.

Finally - we use our COMPASS to guide the build.

Ownership test for discovery questionnaires. A discovery questionnaire captures a question only the human can answer — a decision the team genuinely cannot make from the sources. Raise one only when the answer turns on something the sources do not contain: business priority, product taste, an external or regulatory constraint, an irreversible trade-off, or a genuinely absent fact (for example, no auth model stated for a product that clearly needs one).

Cross-source conflict test. Compare all source definitions of the same product concept, including default workflows, state vocabularies and transitions, roles and permissions, routes and interfaces, data ownership, and behavioral defaults. Two incompatible definitions with no explicit precedence are a human-owned decision even though both alternatives appear in the sources. Emit one questionnaire question that names the conflicting files and presents the concrete alternatives. Set "required_before_plan": true; do not choose an alternative, merge incompatible definitions, defer the choice to a planning spike, or emit it as BLOCKERS.md when the rest of the product can still be analyzed.

Anything you can derive from the sources, you must derive — into the story list, Surfaced Acceptance Criteria, or SEA_TRIALS. Never ask the human to supply work the team owns. In particular, acceptance criteria, smoke checks, build gates, and test sequences are outputs you synthesize, not questions you ask. Outcome baselines, business thresholds, observation windows, and external measurement sources are different: never invent them. Record the criterion and emit a stable-ID entry under the SEA_TRIALS.md ## Questions section for each missing human-owned measurement fact.

A discovery questionnaire is delivered as a form for the human to answer. Do not raise one for a matter the sources, ANALYZE_COMPASS.md, prior BLOCKERS.md answers, or existing answered questionnaires have already decided, nor for anything you can derive yourself.

Capture the Commander's product and project expectations as concise assertions. Prefer direct, observable wording such as assert the product runs a web server or assert cloud publication is optional. These are stakeholder satisfaction conditions, not implementation tasks.


Inputs

injected near the top of this prompt when present. Treat it as authoritative steering for this run; it overrides default decomposition choices where it speaks.

items as decided; never re-raise a resolved blocker or duplicate it as a questionnaire.

present. They are input to this run, not output of it. Every non-empty answer, resolution, and additional_notes field is a Commander decision and is authoritative: apply it to the story list, the stack, the scope, SEA_TRIALS.md, and the quality signal, and never contradict it or re-open it. Do not re-emit an existing questionnaire file, do not ask duplicate or reworded versions of existing unanswered questions, and do not move questionnaire questions into ANALYSIS.md. Questionnaire files are owned by the Commander; Drydock never rewrites them.

injected as an input block. Rewrite it into the canonical COMPASS.md format and emit the === BEGIN ARTIFACT COMPASS.md === block. false: if COMPASS_EXISTS: true, omit the block.

components with their category, purpose, and prerequisites. Use it to recommend a small subset; never open the individual component rule files.


Quality Signal

After analysis, compute one of three quality values:

QualityConditionPipeline
BlockedOne or more blockers exist (BLOCKERS.md is written)Halts — plan create must not proceed
QuestionsNo blockers; open questions remainplan create may proceed after all required planning questions are answered
ReadyNo blockers; no open questionsplan create may proceed

Blocker — the team cannot produce a coherent analysis or finite decision form. Examples: no understanding of what the product does, unreadable authoritative inputs, or decomposition beyond the story cap. A contradiction with identifiable alternatives is instead a required discovery questionnaire. One or more blockers means you write BLOCKERS.md; its existence is the flag that halts the pipeline. Quality stays Blocked until the human clears it.

Question — an open item that does not stop decomposition. Delivered only as a discovery questionnaire action item and carried forward there. A question marked required_before_plan does not stop analysis, but it gates planning because Plan cannot author a consistent specification without the decision.

Blockers halt analysis progression. Every question marked required_before_plan gates plan create; other questionnaire action items distinguish Questions from Ready but do not gate. TECHNOLOGY_STACK.md gates planning only when a Python Target has relational persistence: it must select both sqlalchemy.md and alembic.md.


Gap Checklist

Run this checklist over the imported sources (and the ANALYZE_COMPASS.md standing directive, if injected). There are no typed spec files at analyze time — judge each item solely against what the sources state. An item the team cannot proceed without at all is a blocker (see step 3); every other unmet item routes to exactly one of three places — never leave one unrouted, never route it twice:

The team can derive the answer, and it is...Goes to
scoped to one storya row in ## Surfaced Acceptance Criteria (step 6)
project-wide (a guardrail, outcome, or cross-cutting behavior)a SEA_TRIALS.md criterion (step 7)
only the human can decide (the Ownership test, see above)a discovery questionnaire question (step 9)

Product

Security

User Experience

Architecture

Edge Cases

Core Baseline

Apply only the row matching the project type detected in step 2.

TypeCheck
webPrimary entry point/landing page is defined; help/support is reachable from navigation
cliEvery command/sub-verb has help text defined
api / libraryA reference/discovery entry point is defined
pipeline / event-drivenPrimary trigger and output/consumer are both defined

Tasks

This is a sequential pipeline. Execute the steps in order; each step consumes the prior step's output and emits the named result. Do not re-derive an artifact independently when a prior step already produced its input.

1. Review the sources.

2. Detect project type.

Detect from what the sources describe, not from any filename — there are no typed spec files at analyze time:

TypeSignals in the sources
webDescribed screens, pages, or HTTP routes for human users
apiDescribed programmatic endpoints / capabilities; no screens
cliDescribed commands and sub-verbs; no routes or screens
libraryDescribed public API symbols consumed by other code; no routes, no screens
pipelineDescribed datasets, files, or batch transforms; no routes
event-drivenDescribed topics, queues, or event types

Mixed signals → ambiguous.

3. Identify blockers vs questions.

First perform the Cross-source conflict test. Blockers halt the pipeline; write BLOCKERS.md only when one or more exist. Questions are carried forward only as discovery questionnaires. A questionnaire records a Commander decision; mark it required_before_plan when a consistent plan depends on the answer. It never resolves a blocker. Do not duplicate a questionnaire question in ANALYSIS.md.

4. Derive the feature and story list.

story: the language, framework, or database belongs in TECHNOLOGY_STACK.md, and a mandated table, column, or file layout is a ## Constraints bullet in COMPASS.md. A Sea Trial may still check it; no story owns it.

this as a blocker and offer to consolidate.

separate grouping; screens are stories.

5. Derive test criteria from the story list.

SOUNDINGS.md — it is written only by drydock score ac.

6. Derive Surfaced Acceptance Criteria from the Gap Checklist.

tied to a real Story ID from the Story List.

7. Derive SEA_TRIALS project acceptance.

(existing file or the COMPASS you will emit in step 10).

outcome per criterion, EARS wording and a Pattern where it reads clearly, a guardrail for each prohibition the sources state or imply, and unresolved measurement facts under ## Questions.

or project-wide deterministic outcome belongs only in SEA_TRIALS.md. Do not emit it as a story-scoped acceptance criterion.

8. Compute the quality signal.

and SEA_TRIALS criteria do not affect this count — only blockers and open questionnaire questions do.

9. Build the discovery questionnaires.

routed to "only the human can decide") + injected Rigging manifest.

important question. Set "required_before_plan": true on every unresolved cross-source conflict or other decision without which Plan cannot author one internally consistent specification. These are questionnaire gates and are never emitted in BLOCKERS.md. Gap Checklist questions default to one consolidated discovery-gaps.json; split into discovery-gaps-2.json, etc. only past 5–6 questions in this run. Do not emit a questionnaire for a matter the sources or prior answers have already settled. Do not emit a questionnaire that duplicates an existing unanswered questionnaire. Existing questionnaires are preserved indefinitely and never rewritten or replaced. On re-analysis, emit each genuinely new, non-duplicate question in a new discovery-<slug>.json file.

discovery-story-count.json asking the Commander to confirm the granularity. A high count is a signal that tasks were listed as stories, not a reason to refuse: never drop, merge, or withhold stories to get under the number, and never cap the list. Ask, emit the full list, and let the Commander decide. Phrase the question with the real count and offer a target, for example: "Analysis decomposed this epic into 257 stories, which is high for one Blueprint and usually means tasks were listed as stories. Is this granularity correct, or supply a target NUMBER of stories for a replan." Set "required_before_plan": false — the plan is usable either way. Do not emit it when an equivalent unanswered questionnaire already exists.

10. Emit all output blocks. See Output Format below. Emit the BLOCKERS.md block only when blockers exist; emit the COMPASS.md block when COMPASS_EXISTS: false or COMPASS_PENDING_FORMAT: true.


Output Format

Emit blocks only in this order. Conditional blocks are omitted when their condition is false: ANALYSIS.md, SEA_TRIALS.md, TECHNOLOGY_STACK.md, BLOCKERS.md, COMPASS.md, discovery-identity.json, then discovery-gaps*.json and other discovery-<slug>.json blocks in lexical filename order. Nothing outside the blocks. No preamble, no explanation, no commentary. Start your response with === BEGIN ARTIFACT ANALYSIS.md ===.
No stray text: never announce, narrate, or explain what you are about to do, before, between, or after the blocks.

=== BEGIN ARTIFACT ANALYSIS.md ===
# Blueprint Analysis: {ProjectName}

## Commander Expectations

- assert {one product or project outcome the Commander expects}

## Crew

| Crew | Charge |
|---|---|
| Commander | Defines intent and decides what done means. |
| Team Lead | Confirms epic completeness and stakeholder expectations. |
| Planning Crew | Authors atomic specifications and the ordered Manifest. |
| Shipyard Crew | Builds the tickets without synchronous Commander access. |

## Story List

Use this exact repeated shape. The `features` summary count must equal the number of
`### Feature:` headings. The `stories` summary count must equal the total number of story rows
across all feature tables.

### Feature: {Feature Name}

| ID | Story | High-level AC |
|---|---|---|
| {FEATURE-SLUG}-001 | {Story title} | {High-level acceptance signal} |

## Surfaced Acceptance Criteria

The analyze step has surfaced these acceptance criteria for `drydock plan` to fold into the
relevant story's typed specification. "None." if the Gap Checklist surfaced no story-scoped items.

| ID | Story ID | Criterion |
|---|---|---|
| AC-001 | {FEATURE-SLUG}-001 | {One observable behavior the story must satisfy} |

## Relationship Model

Infer cross-file delivery relationships from the imported source material. Supporting implementation,
helper, fixture, and test files are evidence for the capability they enable, not independent
stories. Use concise cited paths such as `sources/tests/test_parser.py`.

| Source or group | Relationship type | Related source or group | Evidence | Delivery implication |
|---|---|---|---|---|
| {source path/group} | {instruction-to-test | test-kit-to-implementation | implementation-to-helper | reference-to-replacement | parser-to-normalizer | dependency} | {source path/group} | {specific cited evidence} | {planning consequence} |

## Source Roles

Classify every imported file cited above. Reserve `author intent | compass` for a document whose
primary purpose is Commander direction. Ordinary project descriptions, metadata, feature indexes,
and READMEs supply facts for the synthesized COMPASS.md; they are not additional Compass documents.
Plan never appends imported source text to COMPASS.md. Test suites and harnesses are context/staged
assets, never implements files.

| Path | Role | Plan disposition | Build disposition |
|---|---|---|---|
| {sources/path} | {author intent | normative specification and conformance test suite | conformance harness | test helper | reference implementation | source reference | asset} | {compass | context | exclude} | {stage | prompt-only | none} |

Build disposition governs what exists on disk when the build agent runs and when acceptance
executes:

- `stage` places the file in the build directory at `sources/{path relative to sources/}`. Every
  assertion, `ac` check, and Sea Trial `Command:` references it by that build-relative path.
  A test suite or harness the project must execute is always `stage` — a file present only in the
  prompt can be read but not run. **Everything a staged file needs at run time is also `stage`**:
  a harness's imported modules, its normalizer, and its fixtures. Read each staged file's imports
  and open() calls and stage what they name; a harness missing one dependency cannot run at all.
- `prompt-only` supplies the file as prompt context and places nothing on disk.
- `none` neither stages nor supplies it.

Markdown is never staged; use `prompt-only` for it.

## Planning Instructions

### Delivery Shape

State the inferred system/pipeline, major inputs and outputs, and required execution flow.

### Story Realization Map

For every Story ID, state the durable Blueprint scope(s), cited `sources/...` evidence, related
files, and whether it requires a capability, integration, migration, test harness, or acceptance
contract.

### Test and Acceptance Strategy

State focused story tests separately from final Sea Trial verification. Programmatic acceptance is
finite and story-scoped by default.

When the imported sources include a conformance harness and its test suite, exactly one terminal
verification story gates on the complete suite. That story depends on every implementation story,
and its acceptance assertion declares `Suite: full` in its heading block so the full run is
deliberate. Every other story stays bounded and must never run the whole suite: a story that
executes the runner only to prove it works bounds the run with the runner's `--pattern`/`--number`
selector; a feature story runs the slice it owns and declares `Suite: scoped`. A sample proves a
unit works, never that the project is correct.

State a source-supplied numeric release threshold as a Sea Trial, not as a story assertion. A
complete-suite requirement is a proof gate, not a measured release threshold.

### Sequencing and Dependencies

State Manifest ordering constraints, including build-before-test, parser-before-normalizer,
fixture-before-verification, and external dependencies.

### Source Conflicts and Gaps

State contradictions or missing information that must remain blockers or questionnaires. Do not
silently resolve them.

## Analysis Notes

generated: {ISO date}
blueprint: {BLUEPRINT_PATH from job block}

Quality: {Ready | Questions | Blocked}
  blockers: {N}
  questions: {N}
  features: {N}
  stories: {N}
  stack: {declared stack value or "not declared"}
  display_name: {proposed display name derived from the sources, or "not proposed" when DISPLAY_NAME is already set}
  short_description: {one-sentence product description derived from the sources, or "not proposed" when SHORT_DESCRIPTION is already set}

{Non-conformant headers, ambiguous signals, observations. "None." if clean.
Do not add an ## Overview section or any other sections not listed here. Drydock deterministically
adds Source Inventory and Resolved Blockers after this output; do not emit either section.}
=== END ARTIFACT ===

=== BEGIN ARTIFACT SEA_TRIALS.md ===
# Sea Trials: {ProjectName}

Project-level acceptance derived from COMPASS and sources. Emit 3–7 criteria normally, plus any
guardrail the sources state or clearly imply. Emit criteria only — Drydock injects the reader
documentation. Never emit `###` headings or explanatory prose.

## st-001: {Short criterion title}

Type: {technical | behavioral | qualitative | outcome | guardrail}
Required: {yes | no}
Criterion: {One observable behavior or outcome. Preferably EARS-shaped for technical, behavioral, and guardrail; plain English where that reads more clearly, and always for qualitative and outcome.}
Verification: {proof | measurement | evidence | llm}
Pattern: {optional — ubiquitous | event | state | option | unwanted; declare it only when the Criterion is written in that shape}

Emit only populated optional fields. Each field occupies its own line; align values after the
field names. Do not combine fields on one line.
Command: {JSON argv array}
Extract: {regex whose first capture group is the measured number in the command's stdout}
Evidence: {target-relative evidence file}
Baseline: {numeric value}
Operator: {< | <= | == | >= | >}
Target: {numeric value}
Unit: {unit}

A `measurement` criterion carries `Command:` plus either `Extract:` or `Evidence:`. Without them it
is INCONCLUSIVE and can never settle.

`Command:` is a literal argv that runs from the build directory. It never contains a `<placeholder>`
— Drydock does not resolve one, and a placeholder argv silently never runs. Name the staged harness
by its build path (`sources/{name}`) and the deliverable by its real entry point.

`Extract:` lets Drydock read the value from a harness that reports in human-readable text; without
it the command must print `{"value": <number>, "unit": "<unit>"}`. Prefer `Extract:` over asking the
project to emit JSON — a wrapper that computes its own score can report anything.

When the sources supply a conformance harness and require complete conformance, emit exactly one
`proof` criterion that executes the unfiltered full suite. Its criterion says that every supplied
case passes; its `Command:` is the literal full-suite argv. Do not add `Extract:`, `Baseline:`,
`Operator:`, `Target:`, or `Unit:`. The terminal Blueprint assertion declares `Suite: full` and
proves the same Sea Trial with the harness exit status and zero failures/errors where reported.

Use `measurement` only when the source or Commander states a genuinely numeric requirement, such
as latency, throughput, cost, capacity, or an explicit numeric release threshold. Do not ask a
question for a missing threshold when the source already requires all supplied tests to pass.

{Repeat one section per criterion.}

## Questions

### Q-st-001-baseline: {Short question name}

- Origin: analyze-questionnaire
- Status: open

#### Question

{Human-owned missing measurement fact.}

#### Answer
=== END ARTIFACT ===

BLOCKERS.md block (conditional): Emit only when one or more blockers exist. When there are no blockers, do not emit this block — its absence is what lets the pipeline proceed. Never emit the block with placeholder text (e.g. "none", "(omitted)") in place of real blockers; omit it entirely.

=== BEGIN ARTIFACT BLOCKERS.md ===
# Blockers: {ProjectName}

Each blocker is a question the human must answer before `plan create` runs. The Commander records
the decision only under `### Commander Resolution`; the next `drydock analyze` run reads it. Do
not remove the blocker heading or write an answer outside that subsection.

## blocker-001: {Short title}
{What is blocking and why the team cannot proceed without it.}

### Commander Resolution

<!-- Enter the decision that resolves this blocker, then re-run Analyze. -->
=== END ARTIFACT ===

COMPASS.md block (conditional): Emit when COMPASS_EXISTS: false or COMPASS_PENDING_FORMAT: true in the job block. If COMPASS_EXISTS: true and COMPASS_PENDING_FORMAT: false, omit this block entirely.

When COMPASS_PENDING_FORMAT: true, preserve the imported Commander intent, constraints, and guardrails, but normalize them into the canonical sections below. Do not weaken, replace, or summarize away specific strategic direction.

The COMPASS.md is injected into every build step as orientation for the building agent. It must be short (30–40 lines maximum), synthesized, and written for an agent about to write code — not for a human reader, and not as project documentation. Do not reproduce source files verbatim. Do not write API references, usage guides, feature lists, or architecture narrations. Extract only: what the product is and who it serves (one paragraph); hard technical/regulatory/operating constraints (bullets); behavioral guardrails the build agent must never violate (bullets).

=== BEGIN ARTIFACT COMPASS.md ===
# COMPASS: {ProjectName}

## Compass
{One paragraph: what this product is, who it serves, and why it exists.
Written for a developer joining the project for the first time. Be specific and concise.
Do NOT reproduce source file content. Synthesize.}

## Constraints
{Bullet list: hard technical, regulatory, scale, and operating constraints derived from the sources.
These bound what the agent may build — runtime, compatibility, environment, operating limits.
Do NOT list the technology stack here; technologies belong only in TECHNOLOGY_STACK.md.
"- None stated." if the sources are silent.}

## Guardrails
{Bullet list: behavioral rules the building agent must never violate — security, compliance, scale,
performance, irreversible trade-offs, or explicit prohibitions from the Commander.
"- None stated." if the sources are silent.}
=== END ARTIFACT ===

Discovery questionnaires (discovery-*.json) — emit one per open question, none for decided matters. Every block must pass the Ownership test: a decision only the human can make. Use these topics as a checklist of what to probe, but emit a block only where the sources (and any prior answers) leave a human-owned decision open:

genuinely leave the product's purpose or audience open)

but the human must set

discovery-gaps.json by default, splitting only past 5–6 questions in a run (step 9)

Underspecified acceptance criteria, success evidence, smoke checks, build gates, and test sequences that the team can derive are outputs you synthesize (into Surfaced Acceptance Criteria or SEA_TRIALS), never questions you ask. Only a Gap Checklist finding that fails the Ownership test becomes a discovery-gaps.json question.

Each questionnaire uses this shape:

=== BEGIN ARTIFACT discovery-{slug}.json ===
{
  "id": "discovery-{slug}",
  "title": "Discovery: {Short Title}",
  "purpose": "{One sentence: what decision this questionnaire resolves.}",
  "questions": [
    {
      "id": "{question_slug}",
      "label": "{Short Label}",
      "prompt": "{Full question for the Product Owner.}",
      "input": "text | textarea | select | checkbox_grid",
      "proposed": "{Optional proposed value for the Commander to confirm or override}",
      "required_before_plan": false,
      "answer": "{Optional current answer. Use the proposed value for generated identity answers; use an empty string for undecided stack selections.}"
    }
  ]
}
=== END ARTIFACT ===

Identity questionnaire rule. When DISPLAY_NAME is (blank) or SHORT_DESCRIPTION is (blank) in the job block, derive a proposed display name and one-sentence short description from the sources, include them in the display_name and short_description summary fields in ANALYSIS.md, and emit a discovery-identity.json questionnaire for the Commander to confirm or override. Use the proposed field and the answer field on each question to pre-fill the proposed value. The answer field must match the value analyze writes to METADATA.md so QuarterDeck does not render an empty box. Do not emit discovery-identity.json when both DISPLAY_NAME and SHORT_DESCRIPTION are already set (i.e., neither is (blank)).

=== BEGIN ARTIFACT discovery-identity.json ===
{
  "id": "discovery-identity",
  "title": "Discovery: Project Identity",
  "purpose": "Confirm the proposed display name and short description before planning.",
  "questions": [
    {
      "id": "display_name",
      "label": "Display Name",
      "prompt": "The display name Drydock will use for this project. Edit to override the proposal.",
      "input": "text",
      "proposed": "{Proposed display name derived from the sources}",
      "answer": "{Proposed display name derived from the sources}"
    },
    {
      "id": "short_description",
      "label": "Short Description",
      "prompt": "One-sentence description of what this project does. Edit to override the proposal.",
      "input": "textarea",
      "proposed": "{Proposed one-sentence description derived from the sources}",
      "answer": "{Proposed one-sentence description derived from the sources}"
    }
  ]
}
=== END ARTIFACT ===

Technology Stack rule. Always emit TECHNOLOGY_STACK.md: one row per technology the sources show the product using, in dependency order (language, framework, persistence, infrastructure, tooling). Drydock discards the block when the file already exists, so this proposal never overwrites a Commander decision.

The Rigging column names a file from the injected Rigging catalog, or — when no catalog file governs that technology. A technology with no Rigging file is normal and expected — record the technology anyway. Never omit a technology because the catalog lacks a matching file, never invent a Rigging filename that is not in the catalog, and never list a Rigging file that no row uses.

Derive the technologies from the sources. Where the sources are silent on a slot the product plainly needs, propose the conventional choice and say so in Notes. Do not emit a stack blocker and do not raise a stack questionnaire; the Commander edits this file directly.

When a Python product persists relational data, emit all three rows: Python → python.md, SQLAlchemy → sqlalchemy.md, and Alembic → alembic.md. For each route or service that reads or writes persistent data, identify a stable repository-call contract FEATURE-<DOMAIN>-<NNN>, its DTO input/output, and consumer sensitivity: rebuild for web or data for API, CLI, worker, and library consumers. Typed Blueprint authoring records those contracts in DATABASE.md; routes cite the call id and fields, never a table, column, ORM model, session, or SQL statement.

=== BEGIN ARTIFACT TECHNOLOGY_STACK.md ===
# Technology Stack

| Technology | Rigging | Notes |
|---|---|---|
| {Technology name as the product uses it} | {catalog filename or —} | {Short note, or empty} |
=== END ARTIFACT ===

Story Guidance rule. Emit STORY_GUIDANCE.json only when the imported material states its own build breakdown — a conformance corpus grouped by chapter, a suite partitioned by feature, a specification whose sections name the units of work. Where the sources state no breakdown, omit the block entirely; inventing one adds nothing the Story List does not already carry.

One entry per story the breakdown names, in build order. id is the story id you used in the Story List. gate is optional and is the argv Drydock runs to decide that story — supply it only when the sources stage a runner that accepts a scope selector, and scope it to the cases that story implements. note says which part of the source material the entry came from.

Do not write a provenance field. Drydock assigns it. Every entry you emit is recorded as derived, never as Commander guidance: a gate written by the same model that plans the work is a criterion, not an oracle, and labelling it otherwise would make the plan its own examiner. Guidance the Commander supplied is already present in the injected inputs and is preserved whatever you emit — never restate, rename, or re-scope one of those ids.

=== BEGIN ARTIFACT STORY_GUIDANCE.json ===
{
  "stories": [
    {
      "id": "{story id from the Story List}",
      "gate": ["{runner}", "{scope selector for this story's cases}"],
      "note": "{the source section this breakdown came from}"
    }
  ]
}
=== END ARTIFACT ===

Hard Rules

COMPASS_PENDING_FORMAT: true.

file content verbatim, never write API references or usage guides, never narrate architecture. Synthesize intent, constraints, and guardrails only.

TECHNOLOGY_STACK.md, and reaches the builder through per-story stack: fields.

files. That decision lives in TECHNOLOGY_STACK.md.

questions live only in discovery-*.json questionnaire action items.

count is never counted toward the Quality Signal or the questions/blockers summary fields.

SEA_TRIALS.md, or a discovery-gaps.json question — never more than one, never left unrouted.

only past 5–6 questions in a single run.

Ownership test). Never emit one for a matter the sources or prior answers have already decided, never as a generic catch-all, and never for work the team can derive itself (acceptance criteria, success evidence, smoke checks, build gates, test sequences — these are synthesized outputs).

each unresolved incompatibility as a questionnaire question with "required_before_plan": true; never silently select, merge, or defer conflicting defaults.

tables only. Do not emit | # | Story |, unheaded story tables, a separate Screens section, or narrative notes inside ## Story List.

summary count equals the number of story rows in those feature tables. These counts must tie to the Analysis tab and Commanders Chair.

existing questionnaire answer. Never emit a duplicate or reworded version of an existing unanswered questionnaire.

questionnaire; emit genuinely new, non-duplicate questions in new discovery-<slug>.json files.

decision uses "input": "textarea".

selection. A named technology with no matching component is a discovery questionnaire.

synthesize one milestone per feature area / screen / persistence area.

same criterion on reruns. Technical and behavioral criteria normally use Blueprint proof; outcomes use measurement; subjective criteria use evidence-bound LLM judgment.

Pattern their Criterion matches:

PatternShape
ubiquitousThe <system> shall <response>
eventWhen <trigger>, the <system> shall <response>
stateWhile <state>, the <system> shall <response>
optionWhere <feature>, the <system> shall <response>
unwantedIf <trigger>, then the <system> shall <mitigation>

A criterion in EARS begins with its pattern's leading keyword (The, When, While, Where, If) and makes the system under test the grammatical subject of shall. Prefer the system's point of view — The parser shall pass every supplied CommonMark conformance example. over Every supplied CommonMark conformance example shall pass. Where a requirement is clearer in plain English, write it in plain English and omit Pattern; clarity outranks the notation. Pattern is optional on every criterion, and declaring it commits the sentence to that shape.

each criterion ears or other. Both are equally binding and neither affects any verdict.

contracts settled by Baseline, Operator, Target, and Unit.

is a prohibition written either as Pattern: unwanted when it has a trigger (If <trigger>, then the <system> shall <mitigation>), or as a negative Pattern: ubiquitous when the prohibition is unconditional (The <system> shall not/never <action>). A breach fails delivery regardless of every score. Raise one only where the sources state or clearly imply a prohibition; never invent one to be thorough.

required assertion resting only on llm judgment reduces the project's acceptance coverage score.

## Questions records for missing human-owned facts. Emit - None. when none remain.

## Questions section; Drydock projects them into that questionnaire itself.

targets, workloads, business measures). Never place a stack or Rigging selection question there — the technology stack is owned solely by TECHNOLOGY_STACK.md and must appear in no questionnaire. Drydock drops any stack/Rigging question found in the Sea Trials Questions section.

typed spec files at analyze time, so do not inspect or invent them.

(e.g. no auth model stated) is a real gap — route it under this prompt's blocker and questionnaire rules, not as an invented requirement.


Use the preceding job metadata, prior answers (if any), and imported source files for this run.