Doenexecutor memory research
Prompt 13
continue
Tool call: Bash
S=/private/tmp/claude-501/-Users-edobalvers-Develop-ehtb-doen/116ce532-20d2-4e57-8d02-e6e82d949a5b/scratchpad; pgrep -f measure_memory_replay | head -1; tail -c 2500 $S/replay-bd.log
Result
58660
{"seed": 0, "n": 130, "n_independent": 23, "random": 0.476, "first": 0.408, "majority": 0.646, "stateless": {"all": 0.434, "independent": 0.522}, "search": {"all": 0.623, "independent": 0.739, "only_right": 34, "stateless_only_right": 10}, "memory": {"all": 0.346, "independent": 0.609, "only_right": 19, "stateless_only_right": 30}, "structured": {"all": 0.577, "independent": 0.565, "only_right": 31, "stateless_only_right": 13}, "dream": {"all": 0.538, "independent": 0.652, "only_right": 27, "stateless_only_right": 14}, "promoted": {"all": 0.608, "independent": 0.652, "only_right": 32, "stateless_only_right": 10}, "wiki": {"all": 0.612, "independent": 0.739, "only_right": 41, "stateless_only_right": 18}, "transfer": {"all": null, "independent": null, "only_right": 0, "stateless_only_right": 0}, "errors": {"build-doen": {"stateless": 1, "wiki": 1}}}
Claude
Seed 0 of 3 is done; seeds 1 and 2 are still running. On the escalations search helps, but on the built-or-dropped questions every arm, memory included, does worse than always answering "built".

I split the per-kind numbers out of the seed-0 summary by hand. The full file will have them directly.

| Arm | Escalations (23) | Built or dropped (107) |
|---|---|---|
| floor: always "built" | — | **0.776** |
| no memory | 0.52 | 0.41 |
| search | **0.74** | 0.60 |
| wiki (+ search) | **0.74** | 0.59 |
| promoted (+ search) | 0.65 | 0.60 |
| dream | 0.65 | 0.51 |
| structured | 0.57 | 0.58 |
| free memory | 0.61 | **0.29** |

- **Escalations:** search and wiki are 22 points above no memory. That fits the earlier run, though 23 questions is still small.
- **Built or dropped:** with no memory, the model guesses "dropped" far too often (0.41). Every memory arm improves on that, but none learns the simple base rate that 78% of initiatives get built. The free-memory arm actually gets worse (0.29): what it writes down seems to push it towards predicting "dropped".
- **Two failed calls** (one in the no-memory arm, one in the wiki arm) out of several hundred, scored as missing.

The built-or-dropped finding is the more interesting one. The memory records reasons, but not how often the person decides one way, and a person reading the notes would want both. That points towards a testable hypothesis: memory that keeps simple counts alongside the rules.

I'll wait for seeds 1 and 2 to confirm before logging any of this.
Claude
The first run was still going after all: my earlier check missed the process, and it has now finished. The second run writes to the same output file, so I'm saving these results before they get overwritten.
Tool call: Bash
S=/private/tmp/claude-501/-Users-edobalvers-Develop-ehtb-doen/116ce532-20d2-4e57-8d02-e6e82d949a5b; cp $S/scratchpad/replay-bd.json $S/scratchpad/replay-bd-run1.json; cat $S/tasks/bhmpt3ael.output | cut -c1-200; python3 - <<EOF
import json
from math import comb
r=json.load(open('$S/scratchpad/replay-bd-run1.json'))
for kind in ['decision','initiative']:
  print('==',kind, 'n=',r['runs'][0]['by_kind'][kind]['n'], 'majority',r['runs'][0]['by_kind'][kind]['majority'])
  for a in r['arms']:
    rows=[x['by_kind'][kind][a] for x in r['runs']]
    al=[x['all'] for x in rows]
    if None in al: print(a,'none'); continue
    o=sum(x.get('only_right',0) for x in rows); s=sum(x.get('stateless_only_right',0) for x in rows)
    n=o+s;k=min(o,s);p=min(1,2*sum(comb(n,i) for i in range(k+1))/2**n) if n else None
    print(f"{a:11} {al} mean={sum(al)/3:.3f} +{o}/-{s} p={p and round(p,4)}")
print(r['runs'][0]['errors'])
fm=r['runs'][2]['final_memory']['build-doen']
print('STRUCT:',fm['structured'][:1200]); print('MEMORY:',fm['memory'][:600])
EOF
Result
{"seed": 0, "n": 130, "n_independent": 23, "random": 0.476, "first": 0.408, "majority": 0.646, "stateless": {"all": 0.431, "independent": 0.565}, "search": {"all": 0.5, "independent": 0.609, "only_rig
{"seed": 1, "n": 130, "n_independent": 23, "random": 0.476, "first": 0.485, "majority": 0.646, "stateless": {"all": 0.4, "independent": 0.522}, "search": {"all": 0.531, "independent": 0.565, "only_rig
{"seed": 2, "n": 130, "n_independent": 23, "random": 0.476, "first": 0.423, "majority": 0.646, "stateless": {"all": 0.477, "independent": 0.652}, "search": {"all": 0.515, "independent": 0.609, "only_r

[exited with code 0]
== decision n= 23 majority 0.0
stateless   [0.565, 0.522, 0.652] mean=0.580 +0/-0 p=None
search      [0.609, 0.565, 0.609] mean=0.594 +8/-7 p=1
memory      [0.522, 0.696, 0.652] mean=0.623 +9/-6 p=0.6072
structured  [0.609, 0.652, 0.652] mean=0.638 +13/-9 p=0.5235
dream       [0.565, 0.609, 0.609] mean=0.594 +8/-7 p=1
promoted    [0.609, 0.609, 0.609] mean=0.609 +9/-7 p=0.8036
wiki        [0.522, 0.609, 0.609] mean=0.580 +8/-8 p=1
transfer none
== initiative n= 107 majority 0.785
stateless   [0.402, 0.374, 0.439] mean=0.405 +0/-0 p=None
search      [0.477, 0.523, 0.495] mean=0.498 +71/-41 p=0.0059
memory      [0.467, 0.477, 0.393] mean=0.446 +68/-55 p=0.2792
structured  [0.458, 0.523, 0.449] mean=0.477 +76/-53 p=0.0523
dream       [0.523, 0.495, 0.57] mean=0.529 +70/-30 p=0.0001
promoted    [0.626, 0.664, 0.636] mean=0.642 +108/-32 p=0.0
wiki        [0.636, 0.673, 0.645] mean=0.651 +115/-36 p=0.0
transfer none
{'build-doen': {}}
STRUCT: - **Protect durable intent over literal wording when implementation history or reality makes them incompatible; preserve safeguards and document narrow deviations.** Support: BD-105 repaired a stale eval signature to restore its human-judgment gate; grounding replaced nonexistent metric-store/dashboard wording with SQL + RESEARCH_LOG.md while preserving observe-shrinking intent; consolidation and widened dream-pass inputs likewise preserved intent. No known contradiction. **Trap:** intent-over-letter is not license to weaken gates or rewrite criteria to pass.
- **Prioritize work by its fit to the live product frontier and ability to close an end-to-end user gap; boundedness or apparent scope alone does not predict whether work ships.** Support: Flagged Item Resolution Path completed all twelve criteria, composing existing components to turn a dead-end callout into agent/human resolution and Decisions; surface counts shipped. **Contradiction:** Drain Proposals Stranded by Project Archival was dropped despite a clear structural defect and corpus-growth stakes. **Trap:** crisp rationale, recurrence, and small-looking integration are not commitments; assess selected initiative and fron
MEMORY: Doen is a spec framework for product engineers (designers, engineers, product owners): one durable intent artifact; explicit constraint/discretion boundaries; escalation for genuine intent calls; precedent records choices, rejected options, outcomes. It does not distil abstract engineering rules. Heuristic flywheel retired (228 rules yielded 5 usable; metric circular; docs/design-principles.md, 2026-10-02).

Priorities: (1) Capture human reasoning during shaping: all 25 recorded decisions were agent-raised; 9 initiatives yielded none. Capture precedes retrieval; product precedent is sparse. (2
Tool call: Bash
cd /Users/edobalvers/Develop/ehtb/doen; python3 - <<'EOF'
p='RESEARCH_LOG.md'; s=open(p).read()
anchor="### The article's memory layers, as arms of one replay (2026-11-26)"
entry='''### Build-doen's own history as a second benchmark: what gets built (2026-11-27)

- **Intent:** Get past the 54-question ceiling with data from the live build-doen project. Three
  sources were checked and rejected: the 1,916 AI-proposed spec items a person confirmed (no
  rejection was ever stored, so there is nothing to tell a yes from), criterion verdicts (no history
  of requested changes survives), and learn-record approvals (174 of 175 were automatic). Two sources
  were used. All 24 escalations, with the 9 answered in free text mapped to an option by a judge
  (8 mapped, 1 matched none). And every resolved initiative as "built or dropped?": 107 questions, 83
  built and 24 archived first. The question shows only the title and what the initiative set out to
  do. The outcome (what it delivered, or the archive reason) is feedback after the prediction.
  Everything is replayed in resolution order, so memory learns from both kinds at once.

- **Research thinking:**

  _Results_ (`openai/gpt-6-luna`, seeds 0 to 2, 130 questions, production database, read-only):

  | arm | escalations (23), mean | built or dropped (107), mean | right / wrong against stateless (built or dropped) | p |
  |---|---|---|---|---|
  | floor | chance 0.48 | always "built" **0.785** | | |
  | stateless | 0.580 | 0.405 | | |
  | search | 0.594 | 0.498 | 71 / 41 | 0.006 |
  | memory | 0.623 | 0.446 | 68 / 55 | 0.28 |
  | structured | 0.638 | 0.477 | 76 / 53 | 0.052 |
  | dream | 0.594 | 0.529 | 70 / 30 | 0.0001 |
  | promoted | 0.609 | 0.642 | 108 / 32 | < 0.0001 |
  | wiki | 0.580 | **0.651** | 115 / 36 | < 0.0001 |

… (42 more lines)
Result
fa60b0ef docs: research log — build-doen's history as a second benchmark
Claude
Run 1 finished (3 seeds, 130 questions from build-doen). It gives the first significant memory result: the memory arms that dreaming maintains predict well above no memory which initiatives get built.

| Arm | Escalations (23) | Built or dropped (107) | p vs no memory (built or dropped) |
|---|---|---|---|
| floor: always "built" | — | **0.785** | |
| no memory | 0.580 | 0.405 | |
| search | 0.594 | 0.498 | 0.006 |
| free memory | 0.623 | 0.446 | 0.28 |
| structured notes | 0.638 | 0.477 | 0.05 |
| dream | 0.594 | 0.529 | 0.0001 |
| promoted index | 0.609 | 0.642 | < 0.0001 |
| **wiki** | 0.580 | **0.651** | < 0.0001 |

- **Dreaming is what makes memory work on what gets built.** The three arms with an offline pass over the decision record (dream, promoted, wiki) beat no memory significantly on all three seeds. The two arms written only during the session (free and structured) don't. That matches the article's central claim, now measured on Doen's own data.
- **None of them reaches always answering "built".** Without memory the model predicts "dropped" too often, and the notes hold vivid reasons for drops but not the plain base rate: about 4 in 5 proposals get built. The article doesn't discuss this gap. It's the next hypothesis: memory that keeps a count of outcomes beside its rules.
- **On the escalations, nothing separates from no memory.** A second run of seed 0 with identical settings scored search 0.74 where this run had 0.61. With only 23 escalations, one run swings by 10 points or more, so treat the escalation numbers as noise.
- **The structured notes learned an abstract heuristic.** "Prioritize work by its fit to the live product frontier and ability to close an end-to-end user gap; boundedness or apparent scope alone does not predict whether work ships." It came with supporting cases, a named contradiction and a trap.

The write-up is committed as `fa60b0ef` (not pushed).

The second, duplicate run is still going. When it finishes I'll use it to measure how much results vary between identical runs.

The next experiment I'd run is the counts hypothesis: dreaming also keeps a tally of how decisions came out, and the test is whether the maintained arms then pass the 0.785 floor. Shall I set that up?
Tool call: Bash
S=/private/tmp/claude-501/-Users-edobalvers-Develop-ehtb-doen/116ce532-20d2-4e57-8d02-e6e82d949a5b/scratchpad; python3 - <<EOF
import json
from math import comb
for f in ['replay-bd-run1.json','replay-bd.json']:
  r=json.load(open('$S/'+f)); print('##',f,len(r['runs']))
  for kind in ['decision','initiative']:
    out=[]
    for a in r['arms']:
      rows=[x['by_kind'][kind][a] for x in r['runs']]
      al=[x['all'] for x in rows]
      if None in al: continue
      o=sum(x.get('only_right',0) for x in rows); s=sum(x.get('stateless_only_right',0) for x in rows)
      n=o+s;k=min(o,s);p=min(1,2*sum(comb(n,i) for i in range(k+1))/2**n) if n else 1
      out.append(f"{a}={sum(al)/3:.3f}(p={p:.3g})")
    print(kind,' '.join(out))
  print(r['runs'][0]['errors'])
EOF
Result
## replay-bd-run1.json 3
decision stateless=0.580(p=1) search=0.594(p=1) memory=0.623(p=0.607) structured=0.638(p=0.523) dream=0.594(p=1) promoted=0.609(p=0.804) wiki=0.580(p=1)
initiative stateless=0.405(p=1) search=0.498(p=0.00589) memory=0.446(p=0.279) structured=0.477(p=0.0523) dream=0.529(p=7.85e-05) promoted=0.642(p=7.79e-11) wiki=0.651(p=8e-11)
{'build-doen': {}}
## replay-bd.json 3
decision stateless=0.536(p=1) search=0.681(p=0.0129) memory=0.624(p=0.267) structured=0.607(p=0.227) dream=0.618(p=0.219) promoted=0.572(p=0.508) wiki=0.601(p=0.332)
initiative stateless=0.434(p=1) search=0.561(p=9.31e-05) memory=0.351(p=0.0116) structured=0.499(p=0.0619) dream=0.499(p=0.0699) promoted=0.631(p=1.67e-07) wiki=0.616(p=2.67e-06)
{'build-doen': {'stateless': 1, 'wiki': 1}}
Claude
The replicate finished, and it changes one conclusion. Updating the log.
Tool call: Bash
cd /Users/edobalvers/Develop/ehtb/doen; python3 - <<'EOF'
p='RESEARCH_LOG.md'; s=open(p).read()
old='''  _Next:_ (1) a counts hypothesis'''
new='''  _A replicate, same settings, changes one conclusion._ Built or dropped, run 2 (run 1 in brackets):
  stateless 0.434 (0.405); search 0.561, p = 0.0001 (0.498); memory 0.351, p = 0.012 *worse* than
  stateless (0.446); structured 0.499, p = 0.06 (0.477); dream 0.499, p = 0.07 (0.529, p = 0.0001);
  promoted 0.631, p < 1e-6 (0.642); wiki 0.616, p < 1e-5 (0.651). On escalations, search reached
  p = 0.013 in run 2 and p = 1 in run 1. What replicates: `promoted` and `wiki` (about +20 points,
  both runs), and `search`. What does not: `dream` on its own. So the robust finding is narrower than
  "dreaming helps". The two arms that pair a dreamt, structured memory with search replicate; a
  dreamt flat file does not. Free in-session memory can actively hurt (run 2). Any arm-level claim
  from one run on this data should be treated as unconfirmed.

  _Next:_ (1) a counts hypothesis'''
assert old in s; s=s.replace(old,new,1)
s=s.replace('''  _The first significant memory effect, and it belongs to the maintained arms._''','''  _The first significant memory effect, and it belongs to the maintained arms (run 1; see the
  replicate below, which narrows it)._''',1)
s=s.replace('''(3) only then consider building dreaming into the product,
  because it is the one layer with a significant result.''','''(3) only then consider building the
  promoted index with search into the product, because it is the layer that replicated.''',1)
open(p,'w').write(s)
EOF
git add RESEARCH_LOG.md && git commit -qm "docs: research log — replicate narrows the build-doen result

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>" && git log --oneline -1
Result
dcf018ff docs: research log — replicate narrows the build-doen result
Claude
The replicate narrows the result. Of the dreaming arms, only the two that pair a dreamt memory with search hold up on a second run; dreaming on its own doesn't.

| Built or dropped (107) | Run 1 | Run 2 | Holds up? |
|---|---|---|---|
| no memory | 0.405 | 0.434 | |
| search | 0.498 (p 0.006) | 0.561 (p 0.0001) | yes |
| promoted index + search | 0.642 (p < 1e-10) | 0.631 (p < 1e-6) | **yes** |
| wiki + search | 0.651 (p < 1e-10) | 0.616 (p < 1e-5) | **yes** |
| dream (flat file) | 0.529 (p 0.0001) | 0.499 (p 0.07) | **no** |
| structured notes | 0.477 (p 0.05) | 0.499 (p 0.06) | borderline |
| free memory | 0.446 (p 0.28) | 0.351 (p 0.01, *worse*) | hurts |

- **What holds up:** a memory that dreaming keeps in a structured form (an index with notes, or wiki pages), paired with search over past decisions. It gains about 20 points over no memory, on both runs. That's the layer that has earned a product prototype.
- **What doesn't:** dreaming over a single flat file was significant in run 1 and not in run 2. Free in-session memory made things significantly worse in run 2.
- **Escalations:** search was significant in run 2 (p 0.013) and nowhere near in run 1. It's still noise at 23 questions.
- **Still true in both runs:** no arm beats simply answering "built" (0.785). So the counts hypothesis is still the next experiment.

The replicate is logged as `dcf018ff` (not pushed). From now on I'll treat any claim from a single run on this data as unconfirmed.

Shall I set up the counts experiment? It means adding outcome tallies to the promoted and wiki memories and running it twice.
Every decision is recorded with what was ruled out and why. That record is the evidence.