spectastic Examples
Worked example · knowledge corpus · change management

As of when?

A cash-account balance is a question about time. The same trades give a different settled balance depending on the day you ask — and on the settlement rule that was in force then. When US equities moved from T+2 to T+1 on 28 May 2024, the rule changed underneath every spec that had assumed it. This example grounds a cash-snapshot spec on a settlement corpus, then supersedes the edition and re-grounds the spec with a proposeapply change.

Knowledge corpus Rust Settlement · T+1 Edition-pinned Propose → apply
▷  Show me View the corpus →
Why it's a corpus problem

A settlement cycle is a domain fact — external, dated, and changeable by a regulator. Ungrounded, a spec can only assume it (and models happily recall a rule that has since moved). Grounded, the decision cites KB-0001@edition — an id pinned to the exact edition read. That pin is not bookkeeping: a cash snapshot taken as-of 24 May 2024 must settle USD equities T+2; one taken 28 May onward, T+1. The corpus keeps both editions, so a point-in-time snapshot can ground each date against the rule that actually applied. Edition-pinning is point-in-time correctness.

The corpus

A finance-settlement pack — committed markdown, an Agent Skills folder. It holds more than this one spec needs: four documents ground a decision here; one (corporate actions) is adjacent — in the pack, waiting for a spec that needs it.

ID Document Edition Grounds
KB-0001US equities settlement cycle@2024-05-28
↳ @2017-09-05
D-001
KB-0002FX settlement risk & PvP@2022-07-08D-004
KB-0003Books of record — IBOR / ABOR / PBOR@2024-01-15D-002
KB-0004Cash-account snapshot semantics@2024-01-15D-003
KB-0005Corporate-action cash entitlements@2023-06-01not cited here

A corpus is a library, not a checklist. KB-0005 sits in the index un-cited — and that's correct: grounding is scoped to the domain facts a decision actually rests on, never a ritual where every requirement manufactures a citation.

Show me

Four USD-equity trades around the 28 May 2024 cutover. Slide the as-of date and watch two books diverge: IBOR (traded cash — every fill the front office sees) versus ABOR (settled cash — only what has actually changed hands). Each trade settles by the cycle in force on its trade date.

As of
IBOR · traded cash
every trade executed by the as-of date
ABOR · settled cash
only trades whose cash has settled

TradeCashTradedSettlesCycleAs of date

A browser illustration of the snapshot engine. The real derivation is the 001-cash-snapshot spec — a T+2 trade grounds against KB-0001@2017-09-05, a T+1 trade against KB-0001@2024-05-28. Business days here skip weekends and Memorial Day (27 May 2024).

When the rule moved

The spec was authored in the T+2 era — D-001 cited KB-0001@2017-09-05. On 28 May 2024 the corpus superseded its edition; the old pin didn't rot — it flagged.

1

The edition supersedes

The T+1 rule is committed as KB-0001@2024-05-28; the T+2 edition moves to references/superseded/ — retained, never deleted, so the old pin still resolves.

2

Validate flags the stale pin

D-001 still points at @2017-09-05 while the current edition is @2024-05-28. A corpus-staleness warning — loud, never blocking.

$ spectastic validate design.html  # D-001 still pinned to KB-0001@2017-09-05
warning Corpus citation "KB-0001@2017-09-05" is pinned to a
  superseded edition — the current edition is 2024-05-28.
  corpus-staleness
0 errors, 1 warning
3

Propose the change

/spectastic.propose writes a change with one typed delta — MODIFY the settlement requirement to T+1, effective 28 May 2024 — and an adversarial risk pass. Because a corpus is present, the critic adds a fourth angle: a live requirement that contradicts a committed domain fact.

ModifyFR-001 · settlement-date derivation

What changes: USD equity settlement T+2 → T+1, effective 28 May 2024.

FR-001 · must — The settlement date of a US-equity trade MUST be trade date + 1 business day (T+1) for trades on or after 28 May 2024; trades before that date settle T+2 per the edition then in force.
Mitigatedtarget §4 · corpus contradiction

A live requirement still asserting T+2 now contradicts the committed domain fact.

KB-0001@2024-05-28 — "US equities settlement cycle" (supersedes KB-0001@2017-09-05, T+2).

Resolved by this proposal's FR-001 modification.
4

Apply — and the pin catches up

spectastic apply patches the delta into the live spec, folds a task, appends a changelog line, flips the proposal approved → applied, and archives it. D-001 re-grounds to @2024-05-28; the staleness warning clears.

$ spectastic apply 001-cash-snapshot 2024-05-28-usd-t1-settlement --summary "USD equities T+2 → T+1"
FR-001 modified in specs/001-cash-snapshot/spec.html
  §6 folded → tasks.html (T-1000…T-1002) · changelog appended
  proposal approved → applied · moved to changes/archive/2024-05-28-usd-t1-settlement/
✓ applied

Read the decisions

The applied design, rendered by spectastic's own grounding CSS. One decision grounds a domain fact against the corpus; another stays honestly ASSUMED because it isn't one.

D-001 · Settlement date from a business-day calendar

Grounding
Context
US equities settle T+1 (one business day) under SEC Rule 15c6-1, compliance date 28 May 2024. Grounded against KB-0001@2024-05-28.
Decision
Derive the settlement date as trade date + 1 business day, applying the cycle in force on the trade date.

D-005 · Snapshot refresh interval

Grounding
Context
A cache TTL is a local product decision, not a domain fact — no corpus document governs it, and a product choice must not manufacture a citation.
Decision
Refresh snapshots on a 60-second TTL; revisit under load.

Both read as competent English. One points at a committed, hashed document; the other rests on judgment and says so. That honesty is the point — grounding grades what's grounded, and flags what isn't.

knowledge/finance-settlement/references/001-us-equities-settlement-cycle.md
--- slug: 001-us-equities-settlement-cycle origin: U.S. Securities and Exchange Commission — amendments to Rule 15c6-1 shortening the standard settlement cycle for US securities to T+1 origin-url: https://www.sec.gov/rules/final/2023/34-96930.pdf edition: 2024-05-28 license: CC0-1.0 converter: hand-authored content-hash: sha256:ac35428fc6181045c9b43e4ddc798e52209e97ca7ec03ed41c66583dee117f68 status: authoritative --- # US equities settlement cycle (T+1) The US standard settlement cycle was shortened **T+2 → T+1** under SEC Rule 15c6-1, with a **compliance date of 28 May 2024**. A standard US-equity trade settles **one business day** after its trade date … ## Editioning Prior editions are retained under `superseded/`, so `KB-0001@2017-09-05` (the T+2 rule in force before the cutover) still resolves. A trade is settled under the cycle in force **on its trade date**, not today's rule applied retroactively.

→ the T+2 edition lives on at references/superseded/…-2017.md (@2017-09-05), so a snapshot dated before the cutover still grounds cleanly. Content-hash is real (sha256 of the body).

The engine — impl/src/lib.rs · Rust, std-only
pub fn settlement_date(&self, trade_date: Date) -> Date { self.add_business_days(trade_date, standard_cycle(trade_date)) } /// Standard settlement cycle (business days) in force on the trade date. pub fn standard_cycle(trade_date: Date) -> u32 { if trade_date < T1_EFFECTIVE { 2 // T+2 — KB-0001@2017-09-05 } else { 1 // T+1 — KB-0001@2024-05-28 } } // A snapshot: IBOR counts every trade executed by the as-of date; // ABOR only those whose settlement date has already arrived. for t in book { if t.trade_date <= as_of { ibor += t.cash(); } if cal.settlement_date(t.trade_date) <= as_of { abor += t.cash(); } }
→ the cycle is read per trade date, so one codebase is correct on both sides of the cutover — the edition pins sit right in the branch. Exact i64 cents, a hand-rolled business-day calendar, no dependencies. spec 001 · FR-001, design D-001 / D-006
$ cargo test  # Rust 1.94, std-only — no build deps
running 5 tests
  ok cycle_is_edition_correct_around_the_cutover
  ok settlement_dates_span_the_double_settlement_day
  ok ibor_and_abor_diverge_then_reconcile
  ok a_buy_pays_out_and_a_sell_brings_cash_in
  ok the_t1_effective_constant_is_2024_05_28
test result: ok. 5 passed; 0 failed

The gates hold

The applied bundle — corpus, spec, design, and the archived proposal — is green. Every citation resolves to a committed, hashed document; a fabricated one is structurally impossible.

$ cd examples/settlement
$ spectastic validate 'specs/**/*.html'  # spec · design · tasks · the archived proposal
✓ no findings
 
  corpus present · every KB-NNN@edition resolved · D-001 pinned to the current edition (2024-05-28).
corpus-provenance · error

Typo the pin to an edition no committed document carries, and the build fails — a citation can't dangle.

$ spectastic validate design.html  # KB-0001@2020-01-01
error Corpus citation "KB-0001@2020-01-01" resolves to no
  committed document at that id/edition — a dead reference.
  corpus-provenance
1 error, 0 warnings

The artifacts

A self-contained bundle: the finance-settlement corpus (five documents, one superseded edition) and the 001-cash-snapshot spec, design, and applied change. Every file passes spectastic validate.

finance-settlement · corpus
Five KB documents + one superseded edition
001 · cash snapshot
The spec & design — D-001…D-004 grounded, D-005 assumed
↳ the applied change
T+2 → T+1 — the typed delta, the fourth-angle risk, the apply. Read the proposal →
▷ cargo testThe Rust engine — 5 tests, green · view impl/src/lib.rs on GitHub ↗

These are the real, rendered artifacts — the same files spectastic validate checks; the excerpts above are drawn from them.

▷  Show me View source on GitHub ↗ ← All examples