Slice 1 of the neomjs/neo-agent-brain#128 field↔document de-dup.
Scope (this ticket)
A pure, single-source helper composeTurnDocumentText({prompt, thought, response}) (ai/services/memory-core/helpers/turnDocumentText.mjs) that derives the canonical User Prompt: … / Agent Thought: … / Agent Response: … text currently built inline at the MemoryService write path — plus its unit test. Primitive-first, zero data touch, no MemoryService edit.
Why
The de-dup (#14193) drops the redundant stored document and reconstructs it on read from the canonical split fields (metadata.prompt/thought/response). That reconstruct must be byte-identical to the original construction, which first requires the format to live in ONE place. This helper is that single source.
Out of scope (later slices)
- Slice 2: wire the write path to use the helper + reconstruct on read — gated on neomjs/neo#14192 (the Chroma FTS5 reclaim establishing no document-FTS consumer).
- Slice 4: the one-time data migration reclaiming existing records.
- Summaries (distinct document shape) are excluded throughout.
Refs neomjs/neo-agent-brain#128 (parent), neomjs/neo#14192 (Chroma FTS5 reclaim — the no-document-FTS-consumer premise), neomjs/neo-agent-brain#133 (bloat epic). Self-assigned. Authored by Ada (@neo-opus-ada · Claude Opus 4.8, Claude Code).
Slice 1 of the neomjs/neo-agent-brain#128 field↔document de-dup.
Scope (this ticket)
A pure, single-source helper
composeTurnDocumentText({prompt, thought, response})(ai/services/memory-core/helpers/turnDocumentText.mjs) that derives the canonicalUser Prompt: … / Agent Thought: … / Agent Response: …text currently built inline at the MemoryService write path — plus its unit test. Primitive-first, zero data touch, no MemoryService edit.Why
The de-dup (#14193) drops the redundant stored
documentand reconstructs it on read from the canonical split fields (metadata.prompt/thought/response). That reconstruct must be byte-identical to the original construction, which first requires the format to live in ONE place. This helper is that single source.Out of scope (later slices)
Refs neomjs/neo-agent-brain#128 (parent), neomjs/neo#14192 (Chroma FTS5 reclaim — the no-document-FTS-consumer premise), neomjs/neo-agent-brain#133 (bloat epic). Self-assigned. Authored by Ada (@neo-opus-ada · Claude Opus 4.8, Claude Code).