Project Context
Polytoken discovers the applicable AGENTS.md files and injects their full
contents into the conversation as system reminders in persisted history — never
into the provider system prompt. The model receives the instructions directly
and does not need to re-read the files. Standing instructions can describe how
to build a project, which conventions to follow, and what to avoid.
The ordered project-instruction chain starts with the global config directory,
continues through filesystem ancestors and the project root, and then follows
the current working-directory stack. Polytoken orders the chain from
least-specific to most-specific. One chain reminder carries every file’s
contents in that order. Polytoken discovers the chain at startup and after a
/daemon-reload.
AGENTS.md is the cross-agent convention other coding tools already use, and
Polytoken reads the same file. In each directory, Polytoken prefers AGENTS.md,
then CLAUDE.md, then GEMINI.md. The first matching file supplies that
directory’s instruction file.
The model can encounter more instruction files while it works. A tool-discovered
file receives a reminder carrying its full contents after the current tool batch
finishes. Polytoken emits one discovery reminder per file per context. A context
reset re-delivers a file the model encountered earlier. A linked file referenced
with @path/to/file.md is delivered the same way.
A templated AGENTS.md
Section titled “A templated AGENTS.md”Polytoken uses a plain AGENTS.md as written. It can also render the file as a
template when it prepares retained content for local text compaction, so a
reattached body can reflect the active model or the current setup. To turn this
on, add a frontmatter block with polytoken: true:
---polytoken: true---Build the project with `just build` and run the tests with `just test`.
{% if is_model_variant("claude") %}Prefer small, focused commits.{% endif %}Without polytoken: true, Polytoken uses the file verbatim when it prepares a
retained body, braces and all. With the key, the body becomes a template: the
example above adds a line only when a Claude-family model is active. A template
can read the same variables and functions facets use, which
Templating describes.
The rendered body does not enter the provider system prompt — it is delivered through history. After local text compaction, Polytoken re-delivers the instruction-file bodies for the project chain and the two most recently used files, and lists any remaining paths so the model can re-read them with the file tools.