# Attribute Stories to Source Requirements

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

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

## Method

1. Read the source and identify each distinct requirement it states. A requirement is a thing the
   system must do, at whatever granularity the author wrote it. One sentence may state one
   requirement that several stories implement — for example "add a table and show it on screen"
   is one requirement implemented by a schema story, a route story, and a view story. Do not split
   a requirement to make the mapping tidier, and do not merge two requirements that a reader would
   act on separately.
2. Give each requirement a short kebab-case name that describes it. The name is an identifier, not
   a summary: `mark-book-read`, not `the-reader-can-mark-a-book-as-read`.
3. For each requirement, list every story that implements any part of it. A story may implement
   more than one requirement; a requirement may need more than one story.
4. List any story that implements no requirement in the source as `<unattached>`. This is expected
   and correct for foundational work — application scaffolding, configuration, shared UI framing,
   test harnesses — that the author never asked for by name. Do not force such a story onto an
   unrelated requirement.

## Rules

- Use only story ids that appear in `<stories>`. Never invent one.
- Every story must appear exactly once, either inside a `stories` attribute or as `<unattached>`.
- Quote the requirement text verbatim from the source in the tag body. Do not paraphrase it.
- Emit nothing but the tags below. No preamble, no commentary, no explanation.

## Output

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

# Attribution job

<source name="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
</source>

<stories>
  <story id="architecture" implements="ARCHITECTURE.md">Define the ledger application boundaries and technical structure.</story>
  <story id="database-schema" implements="DATABASE.md">Establish the relational ledger schema and persistence contract.</story>
  <story id="database-configuration" implements="FEATURE-Database-Configuration.md">Resolve database configuration and operational failures.</story>
  <story id="cli-dispatch" implements="FEATURE-CLI-Dispatcher.md">Provide the executable ledger command dispatcher and output contract.</story>
  <story id="cli-validation" implements="FEATURE-CLI-Validation.md">Validate command names, tables, reports, and argument counts.</story>
  <story id="account-loading" implements="FEATURE-Account-Category-Loading.md">Load and validate account and category CSV files atomically.</story>
  <story id="transaction-loading" implements="FEATURE-Transaction-Loading.md">Load and validate transaction CSV files atomically.</story>
  <story id="account-management" implements="FEATURE-Account-Management.md">Add, read, rename, and delete ledger accounts.</story>
  <story id="transaction-management" implements="FEATURE-Transaction-Management.md">Post, read, amend, and delete ledger transactions.</story>
  <story id="balance-invariant" implements="FEATURE-Balance-Invariant.md">Enforce non-negative account balances across all mutations.</story>
  <story id="transfers" implements="FEATURE-Transfers.md">Execute atomic two-row account transfers.</story>
  <story id="balance-report" implements="FEATURE-Report-Balances.md">Report balances and transaction counts by account.</story>
  <story id="category-report" implements="FEATURE-Report-Categories.md">Report transaction totals by category.</story>
  <story id="monthly-report" implements="FEATURE-Report-Monthly.md">Report transaction totals by calendar month.</story>
  <story id="project-tests" implements="FEATURE-Project-Tests.md">Provide the automated project test runner and test suite.</story>
  <story id="conformance" implements="FEATURE-Conformance.md">Pass the supplied end-to-end ledger conformance harness.</story>
</stories>
