beads/internal/templates
seanmartinsmith 8870c6866d
fix(prime): describe the memory split instead of prohibiting MEMORY.md (#6111)
* fix(prime): describe the memory split instead of prohibiting MEMORY.md

The memory guidance predates harness-native auto memory, whose index file
is also named MEMORY.md and is machine-local rather than the multi-account
fragmentation case the line was written against. As written it tells agents
to file per-operator content in the shared, replicated store - the one place
it does not belong.

Rewrite the four renderings of that sentence to describe the split the two
stores actually have: durable project facts in `bd remember`, per-operator
preferences in the harness's own memory. The fragmentation warning stays,
pointed at the case where it is true.

Refs #5169

Executed-By: pc

* fix(prime): bring the codex template in line, add CHANGELOG entry

Review on #6111 found a fifth rendering of the prohibition:
internal/templates/agents/defaults/beads-section-codex.md:19 says
"do not create ad hoc memory files" without the literal MEMORY.md, so the
grep that scoped the first commit missed it. It ships through bd init for
the codex harness, the same re-introduction path the minimal template was
included for. Reword it to the same split.

Add the CHANGELOG entry under Unreleased / Changed, matching #6011.

Refs #5169

Executed-By: mac

* fix(prime): pin the memory-guidance invariant, drop the storage claim

Maintainer review fixes for the adoption of #6111, iteration 1. Both items are
non-gating (scorecard 981/approve, no blocker or major); they are taken because
the rebased branch needs a maintainer push either way.

Test Evidence Quality (minor): nothing asserted that the four renderings had
stopped prohibiting the harness's own MEMORY.md. The only pin on these bodies
was a presence check for `bd remember`, which passed identically before and
after the rewording, so re-introducing the prohibition at any one site would
have left every test green. Added negative assertions to
TestRenderSectionMinimal and TestCodexSectionBody, plus
TestPrimeMemoryGuidanceDoesNotProhibitHarnessMemory covering both the CLI and
MCP renderings. Asserting the absence of the old prohibition, rather than
pinning the new prose, keeps the guard valid under any future rewording.

The review prescribed `!strings.Contains(body, "MEMORY.md")` at every site. That
is vacuous for the Codex body, which spelled its prohibition "do not create ad
hoc memory files" and never named the file (0 occurrences at ae1a493e0), so that
site asserts both spellings.

Measured, not assumed: restoring all three rendered surfaces to their
upstream-base blobs reds exactly the new assertions -- templates 31 PASS /
2 FAIL, the Codex failure on "ad hoc memory files" and not on MEMORY.md, and
both subtests of the prime pin -- while every incumbent stays green. That same
revert was fully green before this commit.

Debuggability (nit): the full rendering ended "they aren't project knowledge and
beads doesn't store them", which states a capability (`bd remember` will in fact
persist any string handed to it) rather than the intended policy, and was the
odd one out among the four surfaces. Reworded to "so keep them out of beads"
rather than the suggested "so don't put them here": in the rendered text "here"
has no antecedent, and the nearest location named is the harness's own memory,
which would invert the sentence.

Validation: gofmt clean, go build ./... exit 0, go vet clean on both packages,
golangci-lint 2.10.1 reports 0 issues, internal/templates/agents 33P/0F/0S,
prime run-set green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 01:23:19 -07:00
..
agents fix(prime): describe the memory split instead of prohibiting MEMORY.md (#6111) 2026-09-29 01:23:19 -07:00
skills/beads Add explicit Codex skill setup (#3670) 2026-05-05 19:33:35 -07:00
agent_skill.go Add explicit Codex skill setup (#3670) 2026-05-05 19:33:35 -07:00
BUILD.bazel build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00