Skip to content

Template Reference

The bodies of the files you author for Polytoken (facets, subagents, and skills) are templates. The frontmatter schema for each file type is at the bottom of the page.

Templates catch typos at render time: referencing a variable that does not exist raises an error rather than rendering blank, so a broken prompt never reaches the model. Guard optional values with the functions below or with a conditional.

VariableTypeHolds
model_namestringThe active model’s name.
model_variantstringThe model family, for example claude, openai, or gemini.
model_idstringThe provider the model runs through, for example anthropic or openai.
max_tool_batch_sizenumberHow many counted tool calls the model may issue in a turn.
supports_visionbooleanWhether the model accepts images.
can_read_imagesbooleanWhether image reading is turned on for this model.
VariableTypeHolds
facet_namestringThe active facet’s name. Absent in a subagent template.
subagent_namestringThe subagent’s name. Present only in a subagent template.
project_pathstringThe project’s root directory.
cwdstringThe current working directory.
session_idstringThe current session’s identifier.
current_datestringToday’s date.
is_non_interactivebooleanWhether the current run has no human in the loop.
promptstringThe prompt that started this turn. Absent in an AGENTS.md template.
VariableTypeHolds
available_toolslistThe names of every tool the model can use this turn.
available_undeferred_toolslistThe tools whose full definitions Polytoken includes in the prompt this turn.
available_deferred_toolslistThe tools the model reaches through tool search.
tool_librarylistEach tool, with its name, description, and an example.
available_mcp_serverslistThe names of the connected MCP servers.
available_subagentslistEach subagent, with its name and description.
available_skillslistEach skill, with its name and description.
VariableTypeHolds
project_varsobjectProject-local variables from .polytoken/project_vars.yaml.
auto_drain_notificationsbooleanWhether Polytoken delivers finished background work as soon as it is ready.
plan_integration_enabledbooleanWhether plan handoff activates a saved-session goal. When false, no goal lifecycle is active and goal-related instructions are omitted from facet prompts.
source_controlstringThe project’s source control system: git, jj, sl, or none. Detected from the project root. Does not change when the working directory moves or for subagents.

The per-row notes above mark which variables a given template omits.

Put project-specific template data in .polytoken/project_vars.yaml. You can omit the file. When Polytoken cannot use the file because the file is invalid or fails a safety check, Polytoken logs a warning and starts project_vars as an empty object. When the file is absent, project_vars starts as an empty object without a warning. Write a YAML mapping at the top level.

team:
name: Core Platform
escalation: "#polytoken-core"
features:
reviewer_prompt: true

Templates can read nested values with dot or bracket syntax:

Team: {{ project_vars.team.name }}
Escalation: {{ project_vars["team"]["escalation"] }}

When a template renders an object or list directly, Polytoken emits JSON. Prefer reading the scalar value you need.

If a project_vars path is missing, Polytoken logs a warning and renders an empty value instead of failing the template. This lenient missing-key behavior is specific to project_vars; other missing template variables still fail under strict rendering. Polytoken caps missing-path warnings per render and logs a suppression warning after the cap. Guard optional extension points with a conditional:

{% if project_vars.features.reviewer_prompt %}
Use the project reviewer prompt.
{% endif %}

Polytoken reads project_vars.yaml as raw project data, not as config. Polytoken does not merge the file with global config, and environment variable syntax such as ${TOKEN} stays literal. YAML scalar coercion still applies, so quote values such as "yes" or "on" when you intend strings. Treat project_vars.yaml as trusted prompt input, like AGENTS.md or a skill body. Do not put secrets in project_vars.yaml; templates can render these values into model prompts.

The shipped plan facet reads project_vars.plan_facet.plan_spec_override when Polytoken renders the facet prompt. When the value contains text, Polytoken uses that text instead of the shipped handoff-plan format. Polytoken does not merge the value with the shipped format, so write the complete plan-format instructions in the value.

plan_facet:
plan_spec_override: |
## Plan artifact specification
Write a handoff plan with these sections:
- Goal
- Implementation steps
- Acceptance criteria
- Validation

The override changes only the plan format. The shipped plan facet still keeps its read-only planning behavior and its handoff workflow. To replace the whole facet, write .polytoken/facets/plan.md instead.

The override is literal text. Polytoken does not render the value as another template pass, so the model sees MiniJinja syntax inside the value as written. Use a YAML block scalar for multi-line instructions.

These functions are available in every template:

FunctionReturnsEffect
has_tool(name)booleanWhether a tool with that name is available this turn.
get_tool(name)objectThe named tool’s library entry, or an empty object if the tool is unavailable.
has_mcp(name)booleanWhether an MCP server with that name is connected.
is_model_variant(variant)booleanWhether the active model belongs to that family.
has_skill(name)booleanWhether a skill with that name is available.

One function is available in facet and subagent templates when Polytoken renders system-prompt text:

FunctionReturnsEffect
transclude(uri)stringIncludes a prompt fragment. The uri can be a polytoken:// shipped-resource address or a project file path. File paths resolve relative to the directory of the file that contains the transclude() call, and the included file renders as a template with the current context. File paths are confined to the calling file’s directory subtree: ../ escapes are rejected, mirroring the @file resolution rules. Using a file path inside a shipped polytoken:// resource is an error, because shipped resources have no filesystem location.

The frontmatter of each authored file type has its own set of legal keys. The tables below are generated from the same schemas that parse your files.

JSON Schema: JSON | YAML

NameTypeDescription
namestringDisplay name of the facet.
polytoken.modelstringModel this facet uses, overriding the session default.
polytoken.autonomous_hintstringHint text Polytoken shows when suggesting this facet for autonomous use.
polytoken.auto_facet_hintstringBackwards-compatible alias of autonomous_hint.
polytoken.compaction_hintstringGuidance Polytoken uses when summarizing the conversation during compaction. When set, this text helps the summarization preserve the context most relevant to this facet’s purpose, so the compacted summary retains what matters for the facet’s work.
polytoken.colorstringAccent color for the facet, used in the sidebar and indicators.
polytoken.color_lightstringAccent color for the facet on light backgrounds.
polytoken.color_darkstringAccent color for the facet on dark backgrounds.
polytoken.fallback_modelsstring listModels Polytoken tries, in order, if the primary model is unavailable.
polytoken.toolsstring listTools this facet exposes, as tool names or tag! groups (for example tag!ALL).
polytoken.tools_denystring listTools to exclude after tools expands. Applied last.
polytoken.undeferred_toolsstring listTools to always send in full, even under native-deferred tool loading.
polytoken.facet_transitionsmapRules for switching to other facets from this one, keyed by target facet name.
polytoken.skills_allowstring listSkills this facet can invoke, as skill names or tag! groups.
polytoken.skills_denystring listSkills to exclude from skills_allow.

JSON Schema: JSON | YAML

NameTypeDescription
namestringDisplay name of the subagent.
descriptionstringShort summary of what the subagent does.
polytoken.modelstringModel this subagent uses, overriding the session default.
polytoken.autonomous_hintstringHint text Polytoken shows when suggesting this subagent.
polytoken.auto_facet_hintstringBackwards-compatible alias of autonomous_hint.
polytoken.fallback_modelsstring listModels Polytoken tries, in order, if the primary model is unavailable.
polytoken.toolsstring listTools this subagent can use, as tool names or tag! groups.
polytoken.tools_denystring listTools to exclude after tools expands.
polytoken.undeferred_toolsstring listTools to always send in full, even under native-deferred tool loading.
polytoken.allow_subagent_spawnbooleanWhether this subagent may spawn its own subagents.
polytoken.exit_tool_schemaJSON Schema objectCustom schema for the subagent’s exit tool, replacing the default.
polytoken.skills_allowstring listSkills this subagent can invoke, as skill names or tag! groups.
polytoken.skills_denystring listSkills to exclude from skills_allow.
polytoken.inherit_toolsbooleanWhether this subagent inherits the caller’s tools instead of using tools.

JSON Schema: JSON | YAML

NameTypeDescription
namestringDisplay name of the skill. Must match the skill’s directory name.
descriptionstringShort summary of what the skill does. Required.
licensestringLicense identifier for the skill.
compatibilitystringCompatibility information for the skill.
metadatamapFree-form metadata as key-value pairs.
polytoken.disable_model_invocationbooleanWhen true, the model cannot invoke this skill on its own; only explicit references load it.
polytoken.tagsstring listTags that group this skill for tag! references.

JSON Schema: JSON | YAML

NameTypeDescription
polytokentrueSet to true to let Polytoken render this file as a template. Omit it to include the file verbatim.