oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

1# Design question — numeric/aggregate questions in memoria
2
3State your exact model id at the top of your answer.
4
5## Read first
6
7- `docs/superpowers/specs/2026-09-03-memoria-design.md` — especially §0,
8 §2 ("Never recomputes a number"), §4.1, §5, §7, §8.1, §8.2's routing
9 table (the "Numeric / aggregate" row), §13 (chunking is open)
10- `/home/paulca/amadan.net/oficina/sheets-core/docs/superpowers/specs/2026-08-30-sheets-design.md`
11 — the calc engine, cell storage, tabs, sheet structure
12- `/home/paulca/amadan.net/oficina/sheets-core/AGENTS.md` — especially
13 "Cell values are IEEE doubles end to end" and the no-content-in-logs rule
14- `/home/paulca/amadan.net/oficina/sheets-core/PRODUCT.md`
15
16## Context
17
18memoria is a per-team knowledge app indexing the team's content across
19the Oficina suite (sheets, docs, calendar, external sources) into a
20sealed hybrid BM25 + vector index, answering questions with citations. It
21never evaluates authorization itself — it asks the owning app, per person,
22per query (§4.1). It hibernates. Single Go binary, cgo-free SQLite, no GPU.
23
24## The question, from Paul (the owner), 2026-09-03
25
26He wants numeric questions to work, and gave this motivating example:
27
28> **"what's average revenue in June the last 3 years"**
29
30## The tension you must resolve
31
32§2 of the spec says:
33
34> **Never recomputes a number.** A question with an arithmetic answer
35> cites the cell; Sheets' engine is the app of record. A brain that
36> recalculates is a second calculator that disagrees with the first.
37
38And §8.2 routes the "Numeric / aggregate" class to **no model**: "Cite
39the cell or range; Sheets is the app of record."
40
41But Paul's example has no cell to cite. No cell contains "average June
42revenue over three years" — it must be *computed* from three or more
43cells that may sit in different tabs, different sheets, or different
44files (one per fiscal year). So the rule either forbids the feature Paul
45wants, or needs qualifying.
46
47## What I want
48
491. **Rule on the tension.** Options: memoria computes and shows its
50 arithmetic; memoria asks Sheets to compute (a new sibling call —
51 "evaluate this expression against these cells" — and what that costs);
52 memoria returns the constituent cells and lets the person sum them;
53 memoria writes a formula into a scratch sheet and cites it; the rule
54 narrows to "never recomputes a value a sheet already computed". Weigh
55 and rule. Say which option genuinely preserves "a second calculator
56 that disagrees with the first" and which merely evades it.
57
582. **The sibling call, if you recommend one.** memoria holds no DEK for
59 Sheets and must not gain a write path (§6.4). Specify it in the style
60 of the spec's S1–S5 table, and say what it leaks that S1–S3 do not.
61
623. **Chunking a spreadsheet** — §13's open item. A 400-token chunk of a
63 grid may be meaningless. Design it. Consider per-tab; per-region (a
64 header row plus contiguous block); per-row with headers prepended; a
65 structural summary (tab names, header rows, ranges, units) separate
66 from value chunks. What makes "revenue", "June" and "2024" findable by
67 BM25 *and* by embedding, when the literal cell is a bare number whose
68 meaning comes from a row header two columns left and a column header
69 eleven rows up?
70
714. **Retrieval shape for an aggregate.** Paul's question needs three
72 facts, one per year, each possibly in a different document, and needs
73 to know it found all three rather than two. How does top-k retrieval
74 know its recall was complete? What does it say when unsure? This
75 codebase treats "a plausible empty list, not an error" as the worst
76 available failure shape — and a plausible *wrong average* from two of
77 three years is worse still.
78
795. **What must NOT be built.** Name the version of this feature that
80 would be a mistake, so the spec can forbid it explicitly.
81
82Rule, don't survey. Cite spec sections. Be concrete about failure modes.
83Do not edit any file. 900-1200 words.
84