← How the benchmark works
diff --git a/openspec/config.yaml b/openspec/config.yaml
index 2805cb671454f2a67816aaaafdb898888e7f11c6..9ae32e371f0d0a711a7d690c0b05aa79aac2a528 100644
--- a/openspec/config.yaml
+++ b/openspec/config.yaml
@@ -1,32 +1,47 @@
schema: spec-driven
# Project context (optional)
-# Add only constraints that should guide OpenSpec artifacts and workflows.
-# Include constraints an agent cannot infer by reading the code.
-# Keep general project documentation and discoverable codebase facts out.
-# Example:
-# context: |
-# Designs and tasks must cover Windows, macOS, and Linux
-# Write all artifacts in Spanish
+context: |
+ order-service: TypeScript library (ESM, Node 22.18+ runs .ts directly, no runtime dependencies, no build step).
+ Public API is src/index.ts; createShop() wires the shop. Tests: `npm test` (node --test "test/*.test.ts",
+ node:test + node:assert/strict). tsconfig is strict, NodeNext, erasableSyntaxOnly: no enums, namespaces or
+ parameter properties; relative imports use the `.ts` extension; use `import type` for types.
+ README.md "Business rules" is the source of truth: when code and README disagree, the README is right.
+ Specs, designs and tasks must be consistent with those rules; a change that alters a rule must say so
+ explicitly and include the README update.
+ Domain invariants every artifact must preserve:
+ - All amounts are integer euro cents; percentages are applied to cents and rounded half up (use src/money.ts
+ helpers such as percentOf, divideHalfUp), never floating-point money.
+ - Dates are YYYY-MM-DD calendar days; "from … to …" periods include both days.
+ - SKUs are case-insensitive, trimmed, shown upper case; coupon codes are case-insensitive.
+ - Placing an order is all-or-nothing (price, reserve stock, use coupon); cancelling returns units and a
+ single-use coupon; shipped orders cannot be cancelled and cancelled orders cannot be shipped.
+ - Cancellation window: up to and including day 14 after placement. Orders numbered ORD-0001…; invoices per
+ year (2026/0001…).
+ - Discount order: volume discount (10+ units, 10% of line) → coupon on subtotal → total discounts capped at
+ 50% of gross. Free shipping at goods >= €50.00 after discounts, before VAT. VAT per line, rounded half up
+ per line; shipping VAT 22%.
+ - Errors are ShopError subclasses with stable `code` values (src/errors.ts); new failure modes extend them.
+ Code style: small modules per domain area, JSDoc comment on exported items, readonly types.
-# Per-artifact rules (optional)
-# Add custom rules for specific artifacts.
-# Example:
-# rules:
-# proposal:
-# - Keep proposals under 500 words
-# - Always state what is out of scope
-# tasks:
-# - Break tasks into chunks of max 2 hours
+rules:
+ proposal:
+ - State which README business rules are affected, or that none are
+ - Always state what is out of scope
+ specs:
+ - Express requirements in terms of the README rules, with concrete cent amounts and YYYY-MM-DD dates in scenarios
+ - Include boundary scenarios (rounding at 0.5 cent, day 14 of cancellation, 10 units, €50.00, 5 units low stock, coupon first/last day)
+ design:
+ - Keep money in integer cents and reuse src/money.ts; do not introduce dependencies
+ tasks:
+ - Each behaviour change includes a task for a test in test/*.test.ts and a final task running `npm test`
+ - Include a task to update README business rules if a rule changes
-# Per-operation guidance (optional)
-# Add advisory guidance for how apply and archive work should be conducted.
-# This is separate from artifact rules above.
-# Example:
-# operations:
-# apply:
-# guidance:
-# - Keep test summaries concise
-# archive:
-# guidance:
-# - Summarize the archive outcome before finishing
+operations:
+ apply:
+ guidance:
+ - Change only what the tasks require; run `npm test` before marking tasks complete
+ - Never edit tests to fit code when they disagree with the README rules; the README wins
+ archive:
+ guidance:
+ - Summarize the archive outcome before finishing