WorkCivic Tech
Stretch
A grocery planner for CalFresh households by text: the cheapest one- or two-store plan within budget and travel range.
Built · Sep 2026 · Solo: built it from a written PRD, directing Claude Code
- test functions
- 922
- lines of Python
- 17,003
- price coverage before a store is recommended
- 80%
Try it
Stretch’s own store choice, running in your browser. Take a price away and see which store it recommends, and what it refuses to guess.
Which store?
Synthetic prices
Press a price to take it awayFive items, three stores
| Store A Pick | Store B 4 of 5 | Store C 5 of 5 | |
|---|---|---|---|
| Milk | $3.00 | $3.50 | $3.60 |
| Eggs | $3.00 | $3.50 | $3.60 |
| Rice | $3.00 | $3.50 | $3.60 |
| Beans | $3.00 | $3.50 | $3.60 |
| Steak | $20.00 | No price | $20.00 |
| Total | $32.00 | $14.00 | $34.40 |
| Ranks at | $32.00 | $34.00 | $34.40 |
Store A: $32.00 for 5 of 5 items. Store B totals less only because it has no price for steak.
TL;DR
- For a household on CalFresh, the difference between two stores can be a meal. Stretch takes a grocery list by text and replies with the cheapest plan that fits the household’s budget and how far it can travel.
- Receipt photos keep prices and spending current. A read-only link can go to a case manager. Texting DELETE erases everything.
- Built and run locally end to end, with 922 tests. Not deployed.
The problem
Price-comparison apps assume a smartphone, a car and time. A household paying with EBT often has a basic phone, a bus pass and a fixed monthly balance, and the cheapest store on paper may be the most expensive once the trip is counted.
What I built
An SMS-first service in FastAPI with an RQ job queue. A grocery list is parsed and fuzzy-matched to a product catalog; a planner picks stores; receipt photos go through OCR to update prices and the household’s spending; and a small Next.js page serves the shared plan.
Key decisions
- Decision: a store is only recommended if it can price at least 80% of the basket. Why: a cheap total built on missing items is a false saving. Trade-off: some households get no recommendation, and the reply has to say which items blocked it.
- Decision: savings count real prices only. Missing prices are estimated to rank stores, but never appear in a total or a savings figure. Why: telling someone they will save $12 on a guess is the kind of number that breaks trust. Trade-off: reported savings are conservative.
- Decision: scrub receipt text before anything is stored. Health items, card and loyalty numbers, PINs, dates of birth and addresses are stripped, in English, Spanish and Vietnamese. Why: a grocery receipt says more about a person than it looks. Trade-off: broad patterns, such as any run of seven or more digits, also remove some harmless text.
The hard part
The two-store split. Splitting a basket across two stores only helps if it beats the best single store after both trips, and comparing the two fairly is subtle. Stretch compares like with like: the cost of exactly the items the best single store can price, plus travel, against that store’s cost plus its trip. Items only the split can price count as extra coverage, never as savings.
Finding the best pair is done exactly, not greedily. Each pair’s cheapest-per-item assignment is a lower bound; pairs that can’t clear the savings threshold are dropped, and the rest are solved best-bound-first. When a store would end up with less than the minimum worth a trip, a small CP-SAT model reassigns the shared items. Ties break deterministically and the solver runs single-threaded with a fixed seed, so the same list always gets the same plan.
Results
- 922 test functions, about 17,000 lines of Python. Unit tests pass locally; the integration tests need Postgres and Redis.
- The full stack ran locally end to end: plans, baskets, receipt jobs and split plans.
- Not deployed, no CI, and the history is one squashed commit.
What I’d do next
- Add CI and a license file, then deploy behind a test number.
- Validate the price data against real receipts from a partner organization before showing anyone a savings figure.
Every number, with its source
The file, run or record each figure comes from.
| Metric | Value | Source |
|---|---|---|
| Test functions in the suite | 922 | mit37/stretch/tests/ |
| Lines of Python in the application | 17,003 | mit37/stretch/app/ |
| Share of a basket a store must price before it can be recommended | 80% | mit37/stretch/app/optimizer.py:1-10 |