Template Reference
The bodies of the files you author for Polytoken (facets, subagents, and skills) are templates. The front-matter 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.
Variables
Section titled “Variables”| Variable | Type | Holds |
|---|---|---|
model_name | string | The active model’s name. |
model_variant | string | The model family, for example claude, openai, or gemini. |
model_id | string | The provider the model runs through, for example anthropic or openai. |
max_tool_batch_size | number | How many counted tool calls the model may issue in one turn. |
supports_vision | boolean | Whether the model accepts images. |
can_read_images | boolean | Whether image reading is turned on for this model. |
Environment and session
Section titled “Environment and session”| Variable | Type | Holds |
|---|---|---|
facet_name | string | The active facet’s name. Absent in a subagent template. |
subagent_name | string | The subagent’s name. Present only in a subagent template. |
project_path | string | The project’s root directory. |
cwd | string | The current working directory. |
session_id | string | The current session’s identifier. |
current_date | string | Today’s date. |
is_non_interactive | boolean | Whether the current run has no human in the loop. |
prompt | string | The prompt that started this turn. Absent in an AGENTS.md template. |
What is available
Section titled “What is available”| Variable | Type | Holds |
|---|---|---|
available_tools | list | The names of every tool the model can use this turn. |
available_undeferred_tools | list | The tools whose full definitions Polytoken includes in the prompt this turn. |
available_deferred_tools | list | The tools the model reaches through tool search. |
tool_library | list | Each tool, with its name, description, and an example. |
available_mcp_servers | list | The names of the connected MCP servers. |
available_subagents | list | Each subagent, with its name and description. |
available_skills | list | Each skill, with its name and description. |
Project and session metadata
Section titled “Project and session metadata”| Variable | Type | Holds |
|---|---|---|
project_metadata | object | Whatever you set as project metadata, passed through untyped. |
auto_drain_notifications | boolean | Whether Polytoken delivers finished background work as soon as it is ready. |
The per-row notes above mark which variables a given template omits.
Functions
Section titled “Functions”These functions are available in every template:
| Function | Returns | Effect |
|---|---|---|
has_tool(name) | boolean | Whether a tool with that name is available this turn. |
get_tool(name) | object | The named tool’s library entry, or an empty object if the tool is unavailable. |
has_mcp(name) | boolean | Whether an MCP server with that name is connected. |
is_model_variant(variant) | boolean | Whether the active model belongs to that family. |
has_skill(name) | boolean | Whether a skill with that name is available. |
One function is available only in a facet template, because a facet composes the system prompt:
| Function | Returns | Effect |
|---|---|---|
transclude(uri) | string | Includes one of Polytoken’s shipped prompt fragments by its polytoken:// address. |
Front-matter schemas
Section titled “Front-matter schemas”The front matter of each authored file type has its own set of legal keys.
Facet front matter
Section titled “Facet front matter”# TODO: add generated facet front-matter schema here.Subagent front matter
Section titled “Subagent front matter”# TODO: add generated subagent front-matter schema here.Skill front matter
Section titled “Skill front matter”# TODO: add generated skill front-matter schema here.