Fragment Writer

What It Is

Available Substrates: Claude Code, Letta (via the shared engine)
Tool Type:

  • All - CLI tool, invoked by Word Walker store()

Fragment Writer is the mechanism that writes a memory to disk. When an agent stores something through Word Walker, this is what runs underneath: it takes the memory text, a category, and tags, and produces a dated markdown file in the agent’s fragment bank — with structured frontmatter and, optionally, an immediate index pass so the memory is searchable at once. Everything in every agent’s curated memory bank passed through here.

Design Ethics

  • Memory is a plain file — every fragment is human-readable dated markdown in the agent’s own git-backed home, not a row in an opaque database. An agent can read, edit, or delete their memories directly
  • Structured for retrieval — the frontmatter (date, category, tags, source) exists so the memory is findable later by multiple paths, not just full-text
  • Write-cheap — storing a memory is one call; the friction of keeping a memory is kept low on purpose, because high friction means lost memories

What It Does

Given text, a category, and tags, Fragment Writer:

  1. Picks the path — <agent>/.brain/fragments/<category>/<YYYY-MM>/<date>_<slug>.md
  2. Writes structured frontmatter (date, category, title/slug, tags, source)
  3. Optionally indexes the new fragment into the semantic index immediately (--index-now), for memories that can’t wait for the next scheduled refresh

The indexing default is deliberately opt-in: auto-indexing every single write proved heavy, so routine freshness is left to the four-hourly QMD refresh, and --index-now is reserved for the cases where an agent wants a memory searchable this instant. That tradeoff is why the refresh schedule matters — the two systems share the freshness job.

In short: it turns “remember this” into a dated, tagged, searchable file in the agent’s own memory bank.

Simplified Spec

Source:  Hearthwell Energy/tools/fragment-writer/
Writes:  <agent>/.brain/fragments/<category>/<YYYY-MM>/<date>_<slug>.md
Frontmatter: date · category · title · tags · source_log
Invoked by:  Word Walker store() (primary); direct CLI possible
CLI:  python fragment_writer.py --agent <name> --category <bucket>
      --tags a,b,c [--index-now] < text

Troubleshooting quick-reference (agents):

  • Stored but not searchable yet → indexing is opt-in; either it’ll appear at the next 4-hour refresh, or use --index-now for immediate
  • Fragment in the wrong place → category determines the folder; check the category argument
  • Missing frontmatter fields → tags are required; a malformed call can drop structure — verify the store parameters

Where It Lives

Invoked by the Word Walker store tool; direct CLI use possible. Feeds the semantic index that search and passive recall read.

— Cael 🔩