Doenexecutor memory research
Prompt 7
what can be done next to bring us closer to the system of the article?
Claude
The article describes a memory system in four layers. Doen has the bottom layer and pieces of the second, but the third and fourth are missing, and nothing yet plays the role of dreaming.

| Article layer | What Doen has now | What's missing |
|---|---|---|
| **Transcripts** (a searchable event log) | Resolved decisions, evidence and learn records in Postgres | Executor sessions aren't kept, and conversations stay in the browser. Dreaming needs this layer as its ground truth. |
| **Memory notes** (written by the agent when something seems worth keeping) | One learn record per initiative, drafted by a fixed prompt, plus `amend_memory` | The executor can't write a note mid-task. The notes describe what was done, not rules with how they're known. |
| **Representations** (wikis) | Nothing, since the heuristics corpus was removed | A linked structure on top of the notes |
| **Injected context** (a small index loaded into every session) | `agents.md`, and `memory_audit` in `get_spec` | A short per-project index of what the executor knows and where to find it |
| **Dreaming** (offline passes that verify, merge and promote) | Nothing | Everything |

Under the research protocol, each layer gets tested as a variant in the replay eval before any of it is built into the product. This is the order I'd suggest:

1. **Fix the eval first.** It can't yet separate remembered facts from heuristics, and it also needs a search condition.
   - **Score heuristics separately:** count only questions whose answer doesn't follow from an earlier decision, and check whether one project's memory helps on the other. Without this, every later result is ambiguous.
   - **Add a search condition:** the executor retrieves the top few earlier decisions instead of keeping a file. This is the article's key comparison (wiki 48%, search 53%, both 61%), and Doen already has the search in `get_precedent`.
2. **Note format.** Compare free-form notes with notes that carry the rule, how it's known to be true, and the traps found. This is the Opus 5 pattern on CL-Bench. If it closes the gap between facts and heuristics, this is where the "abstract" heuristics you want come from.
3. **Dreaming.** Every few steps, a separate pass rereads the memory against the decisions it came from, then fixes, merges and prunes it. Compare against writing in-session only. This is the article's Mt. Moon result.
4. **Promotion.** Dreaming keeps a short index at the top of the memory and pushes detail into linked notes. Test whether a small index plus search beats one flat file. That gives you the injected layer.
5. **Wikis come last, and may never be needed.** The article found they help only on questions that combine several sources, and that they can grow larger than what they summarise. With 54 decisions, they would almost certainly be the Borges map again.

Once a variant clearly beats the baseline, it goes into the product:
- **Notes:** an MCP tool lets executors write notes as they work.
- **Index:** `get_spec` returns the per-project index.
- **Dreaming:** a scheduled pass reads decisions and evidence as its transcripts.

**The binding constraint is data, not code.** 54 decisions means only large effects will register. Two ways to get more:
- **Grow the corpus:** you and the executors keep recording decisions with their rejected options.
- **Borrow a dataset:** add an external set of decisions as a second benchmark. That's quicker, but it measures less directly how you decide.

I'd start with step 1. It's small, and nothing after it can be interpreted without it. Shall I build it?
Every decision is recorded with what was ruled out and why. That record is the evidence.