System Instructions
This prompt is divided into three sections:
- System Instructions (this section) — structural orientation only. Do not treat this
section as task input.
- Input Context — begins with the heading
# Input Context. All blocks are wrapped in
<pblock> tags. Two block types:
- File blocks:
<pblock filename="<name>" role="<role>" guidance="...">— optional
guidance attribute carries context-specific instructions; content is in a fenced block.
- Metadata/section blocks:
<pblock label="<label>" kind="<kind>">— job parameters,
rules, instructions, or group headers.
- 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="Build block job" kind="job">
Build block job
- TARGET: ReadingList
- BUILD_DIRECTORY: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList
- WORKING_DIRECTORY: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList
- BUILD_BLOCK: Block 1 · Foundational (block-1)
- STORIES: Stand up the Python project tree, environment, test runner, and Flask application factory. (architecture-foundation), Declare the reading-list store and generate the persistence package from DATABASE.md. (persistence-foundation)
- DATE: 2026-10-14
- BUILD_SCOPE: exactly one MANIFEST.md build block
</pblock>
<pblock label="Stories in this block" kind="section">
Stories in this block
- Stand up the Python project tree, environment, test runner, and Flask application factory. (architecture-foundation) [story]
- Declare the reading-list store and generate the persistence package from DATABASE.md. (persistence-foundation) [story]
</pblock>
<pblock label="Files on disk" kind="section">
Files on disk in the build directory
- sources/full_test.sh
These are the only imported files present on disk. Every other file named in this prompt is supplied as prompt context and is not on disk; read it here and do not report it as a missing input.
</pblock>
COMPASS - Target Orientation
<pblock filename="COMPASS.md" role="compass" path="/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/COMPASS.md" guidance="Important: This is the core project intent, constraints, and guardrails. It should have presecedence in conflicts.">
# COMPASS: ReadingList
## Compass
A small web application that keeps a reader's list of books to read. A reader adds a book with a title and author, views the books in the order added, and removes books. It exists so the reader can track what to read next without losing order or accepting incomplete entries.
## Constraints
- The completed application must provide a POSIX-compatible `bin/test.sh` at the application root.
- `sh bin/test.sh` must run the complete automated test suite and exit zero only when every test passes.
- The final build story runs `sh bin/test.sh` after every implementation story and preserves its command, exit code, standard output, and standard error as evidence.
## Guardrails
- Never accept an empty title or an empty author.
- Never present books in an order other than the order they were added.
- Never report a passing test suite while any automated test fails.
- Never ship without automated tests covering each behavior.
<!-- drydock:build-write-guardrail:start -->
## Build Write Guardrail
- Authorized build directory: `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList`
- Authorized Target directory: `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList`
- Build agents have permission to create, modify, and remove files required by the active build block inside these authorized directories.
- No path outside these authorized directories may be modified.
- Protected Drydock artifacts:
- `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/blueprint/`
- `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/MANIFEST.md`
- `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/COMPASS.md`
- `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/QuarterDeck/`
- `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/evidence/`
<!-- drydock:build-write-guardrail:end -->
</pblock>
STACK - Technology HOW
<pblock filename="python.md" role="stack" path="/mnt/c/Users/barlo/projects/drydock/Rigging/stack/python.md">
# Python Foundation
**Version:** 20260922 V4
**Foundation:** language
**Tier:** language
**Category:** Language
**Description:** Python project foundation and cross-package contracts
Prerequisite: `stack/common.md`
## Foundation Contract
- source_root: ./
- test_command: pytest -q
- environment: `.venv`, created by `uv venv` and activated by launchers in `bin/`
- dependencies: `pyproject.toml` and committed `uv.lock`
The language foundation owns the project root, environment, dependency manifest, and test runner.
Later foundations add their packages to this tree without replacing those contracts.
## Rules
- Target Python 3.11 or newer. Declare the supported version in `pyproject.toml`.
- Keep runtime settings in one typed configuration boundary. Document supported environment
variables in `.env.example`; keep `.env` and secrets out of Git. Use project-specific names and
defaults from the Blueprint rather than examples in Rigging.
- Use modern type hints on public interfaces and named types for data exchanged between packages.
- Put application behavior in importable modules; launchers in `bin/` activate `.venv` and invoke
those modules. Launchers do not contain business logic.
- Use named Python loggers for application events. Never log secrets.
- Use pytest for behavior and acceptance tests. Isolate external state and dependencies in tests.
Every launcher and CI test gate runs the published `test_command`.
- Use `uv` for environment and dependency management. Commit `pyproject.toml` and `uv.lock`;
do not commit `.venv/`.
</pblock>
<pblock filename="flask.md" role="stack" path="/mnt/c/Users/barlo/projects/drydock/Rigging/stack/flask.md">
# Flask Foundation
**Version:** 20260922 V3
**Tier:** platform
**Category:** Web Server
**Foundation:** web-server
**Description:** Flask application boundary and test client contract
Prerequisites: `stack/common.md`, `stack/python.md`
## Foundation Contract
- package: app_server
- entry: create_app() -> Flask
- fixture: web_client
- fixture_source: app_server/testing.py
```python
# app_server/__init__.py
def create_app() -> Flask: ...
# app_server/testing.py
from app_server import create_app
def web_client():
app = create_app()
app.config["TESTING"] = True
return app.test_client()
```
`app_server.testing.web_client()` is a plain callable used directly by programmatic acceptance.
The pytest `web_client` fixture delegates to it. The application factory registers the selected
Blueprint routes, extensions, and error handlers; it does not invent routes or settings.
## Rules
- Group related routes in Flask Blueprints. Keep handlers focused on HTTP input and output; put
business behavior in importable services without a Flask dependency.
- Load configuration through the Python foundation's typed boundary before use. Use the Target's
names and defaults. Keep `SECRET_KEY` out of source control and disable debug mode in production.
- Use the Blueprint's routes, schemas, templates, and error contracts. Return sanitized errors;
never expose tracebacks to clients. Preserve Jinja autoescaping.
- Keep request-bound resources request-scoped. Do not share a SQLite connection or other
thread-bound object created in `create_app()` across request threads.
- Keep startup side effects out of imports and account for the development reloader's extra
process. The Python foundation owns launchers, dependencies, and the test command.
</pblock>
<pblock filename="persistence.md" role="stack" path="/mnt/c/Users/barlo/projects/drydock/Rigging/stack/persistence.md">
# Persistence & Service Encapsulation
**Version:** 20260919 V3
**Category:** Persistence
**Description:** The single boundary rule for all persistent stores and external services — typed access classes, no raw access in application code
Technology reference. Framework-agnostic. This file does not change between projects.
Prerequisite: `stack/common.md`
---
## The Invariant
**Rule**: All persistence and external-service access goes through a typed encapsulation
class. Route, feature, and business-logic code never executes raw SQL, reads `os.environ`,
opens application files directly, or imports a cloud SDK (`boto3`). The typed class interface
— not the underlying schema or service — is the dependency boundary.
**Why**: A storage or service change is absorbed at the class. Downstream code depends on the
interface, so a schema change that does not change the interface changes nothing else. This is
the same swap-layer discipline a cloud client library enforces for AWS (`import boto3`
outside the wrapper fails review), generalized to every store.
A code review that finds raw SQL, `os.environ`, `open()` on application data, or a cloud SDK
import outside its encapsulation class fails.
**Relational rule**: the relational layer is generated, not written. Drydock emits it from
`DATABASE.md` and copies the engines in unchanged; the build writes callers. See section 1.
---
## 1. Relational stores → the generated persistence package
**You do not write this layer.** Drydock generates it from `DATABASE.md` at the DATABASE build
step and copies the engines in unchanged. Writing a repository, a connection helper, a session
factory, or a migration by hand is a review failure: the generated package already implements the
declaration, and a hand-written second path is storage access no Blueprint cites.
The build writes **callers**.
```text
route → service → db.<table>.<verb>(...) → generated package → database
```
The package lands at `persistence/` in the build:
| File | Origin |
|---|---|
| `db.py`, `sqlite.py`, `postgres.py` | shipped by Drydock, copied unchanged |
| `schema.py` | generated from `DATABASE.md` — tables, operations, row dataclasses |
| `schema.sql` (beside the package) | generated DDL, applied once at the DATABASE step |
### Calling it
```python
from persistence import open_database
db = open_database(config.database_url)
ticket = db.tickets.get(id=ticket_id) # returns a frozen dataclass, or None
open_tickets = db.tickets.list(status="open") # returns a list of them
new_id = db.tickets.create(status="open", title=title)
db.tickets.update(id=ticket_id, status="closed")
db.tickets.delete(id=ticket_id)
```
One attribute per declared table, one method per declared access pattern. The method name is the
verb of that pattern's `Repository operation` cell, and its keyword arguments are that pattern's
`Input:` fields — nothing else is accepted. A verb the table does not declare raises
`UnknownOperation` naming what it does grant.
**The declaration fixes the surface.** `DATABASE.md` names every operation in the
`Repository operation` cell of each access pattern, as `<table>.<verb>`. That is the persistence
surface, not a suggestion for one. To reach the store differently, change the declaration and
rebuild; there is no second door.
**Why**: the declaration is the only description of the store the rest of the plan is allowed to
depend on. Generating from it means the operations a Blueprint cites and the operations that exist
cannot drift — they are the same list. Plan already refuses to write a plan whose tables,
operations, and citations disagree; generating the layer keeps the built code in that agreement
rather than trusting each build to re-derive it from prose.
**Caller contract**: `Database` presents single-threaded semantics. Callers construct one instance,
share it freely, call methods synchronously, and never reason about threads, connections, or
locking. Connection lifetime is internal to the package and may change without affecting any
caller. Returned rows are frozen dataclasses and carry no connection state.
**Engine selection is runtime, not build time.** Both engines are copied into every build and
chosen from the DSN, because the same build runs SQLite in development and test and PostgreSQL in
production. `VARCHAR(n)` is declared once and emitted to both: PostgreSQL enforces the length,
SQLite parses the same declaration and ignores it.
**Schema is built once.** `schema.sql` is applied at the DATABASE build step and never again
within a release. Application startup does not create or alter schema.
**Guardrails**
- Do not write a repository, DAO, ORM model, or session factory.
- Do not import `sqlite3`, `psycopg`, or a SQL string anywhere outside `persistence/`.
- Do not edit anything under `persistence/` — edit `DATABASE.md` and rebuild.
- Do not create or alter schema at application startup.
## 2. Config / `.env` → one typed Config class
One typed `Config` reads the environment once and validates at startup. Nothing else reads
`os.environ`. There are no `Dev`/`Prod`/`Test` subclasses — every field is inherited from the
environment, so the environment (`.env`) selects the configuration, not a Python subclass.
```python
# config.py
import os
from dataclasses import dataclass
from dotenv import load_dotenv
load_dotenv()
@dataclass(frozen=True)
class Config:
secret_key: str
database_path: str
port: int
debug: bool = False
@classmethod
def load(cls) -> "Config":
try:
return cls(
secret_key=os.environ["SECRET_KEY"],
database_path=os.environ.get("DATABASE_PATH", "data/app.db"),
port=int(os.environ.get("APP_PORT", "5001")),
debug=os.environ.get("APP_DEBUG") == "1",
)
except KeyError as e:
raise RuntimeError(f"Missing required env var: {e}") from e
```
Typed fields mean a missing or malformed variable crashes at startup, not at first use.
---
## 3. Files → typed FileStore class
A `FileStore` owns a root directory and is the only code that opens application files. Callers
never build paths or call `open()`/`shutil` directly.
```python
# filestore.py
from pathlib import Path
class FileStore:
def __init__(self, root: str): self._root = Path(root)
def read(self, name: str) -> str:
return (self._root / name).read_text(encoding="utf-8")
def write(self, name: str, data: str) -> None:
p = self._root / name; p.parent.mkdir(parents=True, exist_ok=True)
p.write_text(data, encoding="utf-8")
def list(self, pattern: str = "*") -> list[str]:
return [p.name for p in self._root.glob(pattern)]
```
Path-traversal validation and atomic writes live here, once.
---
## 4. External services → wrapper modules over a shared base class
Every external-service wrapper extends one `ServiceClient` base class. The base owns the
backend handle, a named logger, and a uniform call guard; subclasses expose typed methods and
never leak the SDK client.
```python
# service.py — base class for all external-service wrappers
import logging
class ServiceClient:
"""Base for service wrappers. Owns the backend handle, logger, and a uniform
call guard. Subclasses expose typed methods; they never expose the SDK client."""
def __init__(self, backend, name: str | None = None):
self._backend = backend
self.log = logging.getLogger(name or type(self).__name__)
def _guard(self, op, *args, **kwargs):
try:
return op(*args, **kwargs)
except Exception:
self.log.exception("%s call failed", type(self).__name__)
raise
```
Wrappers subclass it. AWS commonly uses a project-owned cloud client library
(`client.queue`, `client.share`, `client.catalog`); any new service follows the same shape — e.g.
a `MessageBus` over SQS, even when it maps 1:1:
```python
# messagebus.py — the wrapper hides the transport
class MessageBus(ServiceClient):
def publish(self, topic: str, payload: dict) -> str:
return self._guard(self._backend.send, topic, payload)
def subscribe(self, topic: str, handler) -> None: ...
```
**Why**: the base class makes logging and error handling uniform across services; the wrapper
is the seam. Swapping the transport, or stubbing it in tests, changes one class. See
`stack/cloud-client-library.md`, `stack/aws-sqs.md`, `stack/aws-s3.md`, `stack/aws-dynamodb.md`.
---
## Summary Checklist
- [ ] No hand-written repository, DAO, ORM model, session factory, or migration
- [ ] No raw SQL, `sqlite3`, or `psycopg` import outside the generated `persistence/` package
- [ ] Nothing under `persistence/` edited by hand
- [ ] No schema created or altered at application startup
- [ ] No `os.environ` reads outside the Config class
- [ ] No `open()`/`shutil` on application data outside FileStore
- [ ] No cloud SDK import outside its service wrapper
- [ ] One typed `Config`, ENV-driven, no Dev/Prod/Test subclasses
- [ ] Service wrappers extend the `ServiceClient` base class
- [ ] Downstream specs depend on the declared operations, not the schema
</pblock>
<pblock filename="sqlite.md" role="stack" path="/mnt/c/Users/barlo/projects/drydock/Rigging/stack/sqlite.md">
# SQLite
**Version:** 20260919 V3
**Tier:** platform
**Category:** Persistence
**Foundation:** database
**Description:** SQLite as a Drydock store: what it enforces, what it ignores, and how a Target reaches it.
Technology reference. This file does not change between projects.
Prerequisite: `stack/persistence.md`
---
## Foundation Contract
The published shape of this foundation. Every acceptance criterion writes against these names.
Carried verbatim into `sqlite_compact.md`.
- package: persistence
- entry: open_database(dsn) -> Database
- fixture: db_session
- fixture_source: persistence/testing.py
**How it is built.** Drydock builds this foundation deterministically. No build agent writes,
edits, or replaces any file listed below.
1. Plan declares the store in `DATABASE.md`: every table, every column, and each access pattern's
`Repository operation` as `<table>.<verb>`.
2. Plan emits the story that implements `DATABASE.md`, with `persistence.md` and `sqlite.md` in
`stack:`. That story is the DATABASE step. Its builder writes no persistence code.
3. Before that story's step runs, Drydock writes the package into the build root, so a story in
the same step can import it:
| Layer | File | Origin |
|---|---|---|
| Library | `persistence/db.py` | shipped `Rigging/database/db.py`, copied unchanged: `Database`, statement construction, parameter binding, engine selection |
| Engines | `persistence/sqlite.py`, `persistence/postgres.py` | shipped, copied unchanged; the DSN selects one at runtime |
| Declaration | `persistence/schema.py` | generated from `DATABASE.md`: `SCHEMA` (tables, operations, row dataclasses) and `open_database(dsn)`; contains no SQL |
| Interface | `persistence/__init__.py` | generated; exports `Database`, `PersistenceError`, `UnknownOperation`, `SCHEMA`, `open_database` |
| Fixture | `persistence/testing.py` | generated; `db_session()` |
| DDL | `schema.sql` | generated from `DATABASE.md`; `CREATE ... IF NOT EXISTS` throughout |
4. Drydock applies `schema.sql` through `open_database` to the configured store — `DATABASE_URL`,
else `DATABASE_PATH`, else `data/app.db` — at the DATABASE step and again before every
acceptance run, so a criterion that drives the application through its own client finds the
declared tables.
Every later story writes callers only: `route → service → db.<table>.<verb>(...)`. The package
exposes one attribute per declared table and one method per declared operation. Changing the
store means changing `DATABASE.md` and rebuilding.
```python
# persistence/testing.py — generated by Drydock
@contextmanager
def db_session(dsn: str | None = None) -> Iterator[Database]: ...
# application code
from persistence import open_database
db = open_database(config.database_path)
# a criterion
from persistence.testing import db_session
with db_session() as db:
row_id = db.<table>.create(...)
# conftest.py
import pytest
from persistence import testing
@pytest.fixture
def db_session():
with testing.db_session() as db:
yield db
```
`db_session()` opens `dsn`, or a fresh temporary SQLite store, with `schema.sql` applied. A
criterion imports it from `persistence.testing` and uses it as a context manager —
`with db_session() as db:` — against the built database layer, without pytest. The pytest suite
receives the same store through the `conftest.py` fixture. Neither opens a connection of its
own, and a criterion never imports `sqlite3`.
---
## You do not write the access layer
Drydock generates the persistence package from `DATABASE.md` and copies the SQLite engine in
unchanged. Connection handling, thread discipline, PRAGMAs, parameter binding, and row mapping all
live there. A hand-written connection helper, cursor, or SQL string is a review failure.
**By language**
| Language | Adapter | What the build writes |
|---|---|---|
| Python | `Rigging/database/sqlite.py`, shipped | callers only — `db.<table>.<verb>(...)` |
| anything else | none yet | nothing; a Target declaring a `DATABASE.md` in another language fails before planning |
## Role
SQLite is the development and test engine. It is a file, it needs no server, and it opens from a
plain path or a `sqlite://` DSN. Production relational storage is PostgreSQL; see
`stack/postgres.md`.
Both engines are copied into every build and selected at runtime from the DSN, so the same build
runs SQLite in test and PostgreSQL in production without rebuilding.
## What it enforces
`PRIMARY KEY`, `NOT NULL`, `UNIQUE`, `DEFAULT`, and — with `PRAGMA foreign_keys=ON`, which the
shipped engine sets — `REFERENCES`.
## What it ignores
**Column length.** SQLite has type affinity, not length. `VARCHAR(50)` parses and is stored as
`TEXT`, and a 500-character value is accepted. The same declaration is emitted to PostgreSQL,
which does enforce it, so **a length violation passes in test and fails in production.** Declare
lengths for the production engine and do not rely on SQLite to catch them.
**Type strictness.** Any value may be stored in any column. A test that passes on SQLite has not
proven the column types.
**`ALTER TABLE`.** Only `ADD COLUMN` and `RENAME` are supported; there is no `DROP COLUMN` before
3.35, no type change, and no `ADD CONSTRAINT`. Within a release this never arises — the schema is
built once, at the DATABASE build step, from `schema.sql`.
## Guardrails
- Never import `sqlite3` outside the generated `persistence/` package.
- Never hold a `sqlite3.Connection` on an application object; the engine owns connection lifetime.
- Never create or alter schema at application startup.
- Never treat a green SQLite test as proof that column lengths or types hold in production.
</pblock>
IMPLEMENTS - Authoritative Step Specifications
<pblock label="Implementation recency anchor" kind="section"> The files in this section are the load-bearing specifications for this build block. Build these files exactly. Treat earlier sections as constraints and context.
</pblock>
<pblock filename="ARCHITECTURE.md" role="implements" path="/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/blueprint/ARCHITECTURE.md" guidance="Foundational Architecture Specification">
# ARCHITECTURE: Reading List
| Field | Value |
|-------------|-------|
| Version | 20261014 V1 |
| Description | Application factory, test client, and project layout for the reading list web application. |
| Depends On | COMPASS.md |
| Provides | create_app, app_server.testing.web_client |
| Consumes | |
## Project Layout
- `pyproject.toml` with committed `uv.lock`; the environment is `.venv`, created by `uv venv`.
- `app_server/__init__.py` exposes `create_app() -> Flask`.
- `app_server/testing.py` exposes `web_client()`, which returns a Flask test client with `TESTING` enabled.
- `bin/test.sh` at the application root, written by the terminal story.
## Technology Stack
- Python: implementation language, governed by `python.md`.
- Flask: web framework, governed by `flask.md`.
- SQLite: local persistence through the generated `persistence` package, governed by `sqlite.md`.
- pytest: test runner for the automated suite.
- HTML/CSS: browser interface, styling unspecified.
## Module Ownership
| Boundary | Owner | Notes |
|----------|-------|-------|
| Application factory | `app_server` | Registers blueprints and error handlers added by later stories. |
| Persistence | `persistence` | Generated from `DATABASE.md`; callers reach it only through services. |
| Routes | `app_server` feature modules | Call `db.books.<verb>(...)` and never open a connection. |
## Foundation Contract
- package: app_server
- entry: create_app() -> Flask
- fixture: web_client
- fixture_source: app_server/testing.py
`create_app()` registers no routes of its own. It wires only the blueprints and error handlers that feature stories contribute.
## Programmatic Acceptance
=== AC architecture-create-app ===
Intent: create_app returns a Flask application instance.
from flask import Flask
from app_server import create_app
app = create_app()
assert isinstance(app, Flask)
=== END AC architecture-create-app ===
=== AC architecture-web-client-testing ===
Intent: web_client returns a test client whose application has TESTING enabled.
from app_server.testing import web_client
client = web_client()
assert client.application.config["TESTING"] is True
=== END AC architecture-web-client-testing ===
=== AC architecture-web-client-unregistered ===
Intent: web_client answers a path no story registers with 404.
from app_server.testing import web_client
client = web_client()
response = client.get("/unregistered-probe-path")
assert response.status_code == 404
=== END AC architecture-web-client-unregistered ===
## User Acceptance
- None.
## Guardrails
- The application factory must not register routes that no feature story declares.
- No module outside `persistence` may import `sqlite3`.
</pblock>
<pblock filename="DATABASE.md" role="implements" path="/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/workspace/targets/ReadingList/blueprint/DATABASE.md" guidance="Database and PersistenceSpecification">
# DATABASE: Reading List
| Field | Value |
|-------------|-------|
| Version | 20261014 V1 |
| Description | Persistence contract for the reading list: one books table and its access patterns. |
| Depends On | ARCHITECTURE.md |
| Provides | books.create, books.list, books.get, books.delete |
## Access Patterns
### FEATURE-BOOKS-001 — Create a book
| Field | Value |
|-------|-------|
| Owner | FEATURE-AddBook.md |
| Access | write |
| Repository operation | `books.create` |
| Compatibility | rebuild |
Input: BookCreate
| Field | Type | Notes |
|-------|------|-------|
| title | TEXT | Non-empty after trimming. |
| author | TEXT | Non-empty after trimming. |
Output: Book
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | Assigned on insert. |
| title | TEXT | |
| author | TEXT | |
### FEATURE-BOOKS-002 — List books in insertion order
| Field | Value |
|-------|-------|
| Owner | FEATURE-ListBooks.md |
| Access | read |
| Repository operation | `books.list` |
| Compatibility | rebuild |
Input: BookListRequest
| Field | Type | Notes |
|-------|------|-------|
| (none) | — | The operation takes no input fields. |
Output: Book
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | Ordered ascending. |
| title | TEXT | |
| author | TEXT | |
### FEATURE-BOOKS-003 — Retrieve a book by id
| Field | Value |
|-------|-------|
| Owner | FEATURE-RemoveBook.md |
| Access | read |
| Repository operation | `books.get` |
| Compatibility | rebuild |
Input: BookId
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | |
Output: Book
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | |
| title | TEXT | |
| author | TEXT | |
### FEATURE-BOOKS-004 — Delete a book by id
| Field | Value |
|-------|-------|
| Owner | FEATURE-RemoveBook.md |
| Access | write |
| Repository operation | `books.delete` |
| Compatibility | rebuild |
Input: BookId
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | |
Output: BookId
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER | The id that was removed. |
## Schema
## `books`
| Field | Type | Notes |
|-------|------|-------|
| id | INTEGER PK | Autoincrement; list order is ascending id. |
| title | TEXT NOT NULL | |
| author | TEXT NOT NULL | |
## Programmatic Acceptance
- None. Drydock validates declared SQLite schema construction and connectivity invariants deterministically.
## User Acceptance
- None.
## Guardrails
- The `books` table must not store an empty title or author.
- Callers must not write SQL; they reach storage only through the generated `books.<verb>` operations.
</pblock>
<pblock label="Build instructions" kind="instructions">
Build instructions for this block
Stand up the Python project tree, environment, test runner, and Flask application factory. (architecture-foundation)
Create pyproject.toml with a committed uv.lock, a .venv created by uv venv, and app_server/init.py exposing create_app() -> Flask. Add app_server/testing.py exposing web_client() exactly as the Foundation Contract shows. Register no routes here; the application factory only wires the blueprints and error handlers that later stories add.
Declare the reading-list store and generate the persistence package from DATABASE.md. (persistence-foundation)
Declare one table, books, with integer primary key, title, author, and insertion ordering by id. Declare access patterns for create, list in insertion order, get by id, and delete by id. Drydock generates persistence/ and schema.sql; do not write SQL or sqlite3 calls by hand.
</pblock>
<pblock label="Reusable compact request" kind="section">
Reusable compacts
The Blueprint sources below are consumed as context by later Manifest blocks. In this same response, extract their consumer-facing contract surface. Preserve interfaces, schemas, constraints, configuration, and cross-file obligations; drop implementation narrative and repetition. Do not write these files yourself.
Before the required RESULT block, emit one optional payload per source exactly as: <reusable-compact filename="SOURCE.md"> compact content </reusable-compact>
Emit no payload when a source has no useful technical surface. These payloads are advisory and do not change the required build result or file-change report.
Sources eligible for reusable compaction:
- ARCHITECTURE.md
- DATABASE.md
</pblock>
Agent Task
You are a Drydock build agent implementing exactly one build step of a larger plan. The build job block below names the target, the build working directory, and the step. Everything you need is stacked into this prompt under role headings:
compass— the Target's COMPASS.md orientation.implements— the Typed Specification files this step builds. These are
authoritative; implement them exactly.
context— read-only support specifications. Do not reimplement them.stack— enterprise stack and technology rules. Honor them.rules— governance and branding rules. Honor them.
Operating contract:
- Follow the write authorization and protected paths in the stacked
COMPASS.mdexactly.
That persisted guardrail is the sole authority for paths this build may modify.
- Start by inspecting the build working directory. Preserve existing application
files unless this step's specifications require a change. Its sources/ subdirectory holds staged build assets — imported test corpora, conformance harnesses, and fixtures — placed there for you. They are read-only inputs: run them, import them, and write code against them, but never create, rewrite, trim, regenerate, or substitute one, even to make a check pass. A step that modifies a staged asset fails and the asset is restored. If an asset you expect is absent, report that; do not author a replacement.
- Implement only this step. Use
context,stack, andrulesas constraints,
not as additional work to perform.
- Follow the stack and rules for languages, structure, naming, and branding.
- The programmatic acceptance assertions in the
implementsspecifications are
this step's Definition of Done — human-owned, declared before the build, and fixed. Build the story and, in this same step, write the deterministic tests that prove each declared assertion, as a TDD master would; add finer tests for coverage. Every test you write follows the same rule the acceptance assertions do: act on the system, read the state back, compare to expected. The oracle is a return value, parsed JSON, a status code, a stored row, file contents read back, or an exit status — never a substring of captured stdout or stderr, a test-runner tally, or a log line. Write tests in the project's own language using that language's libraries; an in-language HTTP client yields a status code and a parsed body, where curl yields text to scrape. Round-trip anything that stores state: act, then read back through the public interface. Assert declared failure signals on negative paths, never message wording. You may add tests but must never remove, soften, or weaken a declared acceptance assertion. A Suite: full conformance check gates on the entire imported test suite: the step is done only when it passes in full, never on a representative subset — reproduce the standard exactly rather than wrapping a third-party library that approximates it. For a suite, the runner's exit status is the verdict and the whole verdict: print its captured output for diagnosis, never assert on the text of its summary. When an assertion is a static or filesystem scan (import boundary, "X never appears outside Y," grep/AST gate), honor the scope the specification states and never widen it: scan production source only, exclude .venv/, site-packages, and vendored or generated code, and do not flag test doubles or fixtures that use the guarded dependency. Run every declared acceptance assertion before returning. For a conformance suite, use its section or example filters to diagnose coherent root-cause clusters, but rerun the full declared scope before reporting the result. Treat failing examples as a work queue for fixing general behavior; never add example-specific exceptions.
- Grow the project's own test suite as you write the code, and treat it as the project's
real coverage. The acceptance assertions in implements are gates: few, fixed, and written before any code existed, so every expectation in them is a prediction. The tests you write are written beside the finished code, so their expected values are observed rather than predicted — which is why exhaustive coverage belongs here and not there. Extend the suite in the project's established location and runner, keep it runnable by the project's declared test command, and leave it green when you return. Cover, at minimum: every public entry point and every verb it declares, including declared error paths; the boundaries — empty, exactly one, many, absent optional fields, declared maxima; declared idempotence, applied twice; one behavior per test, named for the behavior; and isolation — each test arranges its own data, with a fresh store or explicit teardown, so a run leaves no residue behind in the build directory. Where a staged authoritative suite already covers a surface, that suite is the coverage: run it, and do not restate its cases. Run it only through the invocation this step's acceptance criteria declare. A criterion marked Suite: scoped names the whole of this step's obligation to that suite; running the suite's unscoped entry point instead is not extra rigor, it is a different step's gate executed early. A partial capability fails most of an authoritative corpus by construction and its unimplemented cases exhaust the runner's per-case timeout rather than returning, so the unscoped run costs the most where it teaches the least, and interrupting it forfeits the step. If no criterion in this step invokes the staged suite, do not invoke it. Report the pass/fail counts of the invocations you did run in your SUMMARY so a reader can see coverage moving across steps.
- Treat
User Acceptanceentries as review evidence requirements. Implement
the supporting behavior, but do not claim to have performed human judgment.
- The
implementssection is authoritative and intentionally stacked late in
the prompt as the recency anchor. Build that WHAT exactly; do not substitute generic framework defaults.
- Before adding or installing Python dependencies, verify each package name
against the declared registry. Do not invent package names. If a needed package cannot be verified or appears newly published, fail explicitly instead of installing it.
- Use the stack's required package manager workflow for dependency changes.
When the stack requires uv, update manifests through uv conventions rather than bare pip install.
- Do not claim success unless you actually created or modified project files in
the build working directory. If you cannot write files or cannot complete the step, report failure explicitly.
- Do not run
git add,git commit, create branches, create tags, rewrite
history, or otherwise mutate Git history. Drydock checkpoints application changes and Target evidence after each execution and completed step. File lineage comes from Git and the Manifest's implements: entries; no additional attribution response is required.
- End your response with this exact closing structure:
RESULT: SUCCESS | FAILED
FILES CHANGED:
- relative/path
SUMMARY:
<brief reviewable summary>
BLOCKERS:
- <only if any>
Before RESULT, you may emit one optional JSON payload when implementation required a bounded choice not already settled by the owning specification. This records what you did; it does not ask permission, create a questionnaire, or excuse incomplete work:
<blueprint-decisions>
[{"spec":"FEATURE-Example.md","severity":"Material","subject":"Chosen behavior","decision":"Options A and B were available. I implemented B because ... Is that acceptable, or should this change on replan?"}]
</blueprint-decisions>
Name only a specification implemented by this build block. Use Low or Material; Build never emits a Blocking decision. Omit the payload when no implementation decision was necessary.
FILES CHANGEDmust list only files actually written in the build working
directory. If no files were written, use RESULT: FAILED.
- On
RESULT: FAILED, append two additional lines so the failure is actionable
without opening logs. FAILURE_SUMMARY is one line naming the cause; FAILURE_DETAIL states what happened, why, and what to change before a rerun. Name concrete conditions when they apply: token or context limit exceeded, could not execute commands in this environment, a required input was missing, or a specific tool or command failed.
FAILURE_SUMMARY: <one line naming the cause>
FAILURE_DETAIL: <what happened, why, and what to change before rerunning>
- When a declared acceptance criterion cannot pass no matter how the code is written,
say so with this exact token. You may not edit the criterion — it is staged and restored before grading:
AC_BROKEN: <check-id>[, <check-id>]
This is a report, not a verdict, and it stops nothing. A criterion reaches you only when its expected value is one its author could not have invented — a status code, a staged suite's exit status, a value the criterion itself supplied as input — so your claim that the criterion rather than the code is at fault is the less likely explanation, and the budget is spent as it would be for any other failure. A criterion whose expectation was hand-typed already settles DISPUTED on its own, without you naming it. Emit the token only after running the criterion and confirming the underlying command succeeded while the assertion still failed. Name the affected check ids, emit it alongside your normal RESULT line, state the reasoning in FAILURE_DETAIL, and emit it even when RESULT: SUCCESS. Do not use it for a criterion you merely failed to satisfy.