Reflection Grammar Definition (reflection/reflection-grammar.ts)

atomic-agent · src/memory/reflection/reflection-grammar.ts · typescript · MIT
ai, dev-tools, tag:gbnf, tag:reflection, tag:memory

Defines the GBNF grammar for parsing reflection completions, constraining output to SET, NOTE, or EVOLVE directives for memory handling in the agent.

// Source: https://github.com/AtomicBot-ai/atomic-agent | License: MIT | Copyright 2026 Atomic Bot
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * GBNF grammar constraining the reflection completion. The output is
 * either the literal string `NONE` (no durable content) or up to six
 * lines, each of which is a `SET`, `NOTE`, or (memory-v2 phase 3)
 * `EVOLVE` directive.
 *
 * Three-channel design:
 *  - `SET key=value`              — atomic key/value facts that flow
 *    into `ProfileStore` (rendered into every prompt via `### profile`).
 *  - `NOTE body`                  — freeform episodic observations that
 *    flow into `MemoryStore` (searchable via `memory.notes.recall`,
 *    never auto-rendered into the prompt).
 *  - `EVOLVE #<id> [tags=...]`    — phase 3

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key