Template Variables
The full set of runtime variables available inside prompts and context block templates, grouped by domain.
Template variables connect static prompt design with live execution state. They are resolved at runtime so a prompt can reference the current agent, message, task, project, routine, repository, memory, and knowledge indexes instead of hardcoding them.
Two rules keep templates clean:
- Use only the variables listed here. Unlisted variables will not resolve.
- Reference selectors, don't paste bodies. For knowledge and context blocks, include the selector so the runtime resolves it — never paste a resolved document or block into prompt text.
How values render. A grouped variable like {{ self }}, {{ task }}, or {{ project }} expands to a compact XML block the model can parse. Its scalar fields like {{ task.title }} expand to a plain string. Knowledge variables expand to an XML pack index. The ### Example blocks below show what the runtime substitutes in.
Agent
| Variable | Description |
|---|---|
{{ self }} | Compact XML-like description of the executing agent |
{{ agent.slug }} | Agent slug |
{{ agent.name }} | Agent name |
{{ agent.model }} | Assigned model |
{{ agent.description }} | Agent description |
Use {{ self }} when the prompt needs the agent's full identity; use scalar fields for concise references.
Example
{{ self }} resolves to a compact element describing the executing agent:
<agent slug="research-assistant" name="Research Assistant" llm_model_name="claude-opus-4-8" description="Synthesizes source-backed research briefs"/>Chat
| Variable | Description |
|---|---|
{{ chat.message }} | The user message, for chat templates |
Task
| Variable | Description |
|---|---|
{{ task }} | Compact full task context |
{{ task.id }} | Task ID |
{{ task.title }} | Title |
{{ task.description }} | Description |
{{ task.acceptance_criteria }} | Acceptance criteria |
{{ task.tags }} | Tags |
{{ task.source }} | Source |
{{ task.status }} | Status |
{{ task.priority }} | Priority |
{{ task.type }} | Type |
{{ task.slug }} | Slug |
{{ task.complexity }} | Complexity |
Task variables belong in routine task execution templates, routine step prompts, and gate evaluation prompts.
Example
{{ task }} resolves to an XML block — identity as attributes, content as child elements:
<task id="t_8f21" slug="draft-q3-brief" status="in_progress" priority="high" type="research">
<title>Draft the Q3 market brief</title>
<description>Summarize Q3 competitive movement for the leadership review.</description>
<acceptance_criteria>Cites at least three sources; under 800 words.</acceptance_criteria>
<tags>research, leadership</tags>
<source>routine</source>
<complexity>medium</complexity>
</task>A scalar field renders as a bare string instead — {{ task.title }} → Draft the Q3 market brief.
Project
| Variable | Description |
|---|---|
{{ project }} | Compact project context |
{{ project.name }} | Name |
{{ project.slug }} | Slug |
{{ project.description }} | Description |
{{ project.context }} | Project context |
{{ project.metadata }} | Metadata |
{{ project.working_dir }} | Working directory |
Example
{{ project }} resolves to a <project> block. A <git> child appears when the project has a connected repository; {{ project.metadata }} is rendered separately, not inside this block.
<project name="Acme Web App" slug="acme-web-app">
<description>Customer-facing storefront and checkout.</description>
<working_dir>/workspace/acme-web-app</working_dir>
<context>Next.js app; payments via Stripe; team prefers small PRs.</context>
<git repo_url="https://github.com/acme/web-app" current_branch="main"/>
</project>Knowledge
| Variable | Description |
|---|---|
{{ lib.<pack_slug> }} | Library knowledge pack index |
{{ pkg.nenjo_ai.packages.knowledge.core }} | Installed package knowledge index |
Knowledge variables render a compact pack index — a discovery hint, not full source material. After seeing the index, an agent retrieves content with the knowledge tools (search_knowledge, list_knowledge_neighbors, read_knowledge_doc). See Knowledge Graphs.
Example
{{ lib.market-research }} resolves to a <knowledge_pack> index: pack metadata, a usage hint, and one <doc> per document with its title, summary, and outbound <related> edges — but no document bodies.
<knowledge_pack selector="market-research" namespace="lib" name="market-research" root="lib://market-research">
<usage>Use the knowledge tools to search, inspect metadata, expand graph neighbors, and read documents from this pack when relevant.</usage>
<doc selector="competitors.acme" id="doc_01" kind="entity">
<title>Acme Corp</title>
<summary>Profile of Acme Corp: positioning, pricing, and recent launches.</summary>
<related type="related_to" target="competitors.globex"/>
</doc>
<doc selector="reference.glossary" id="doc_02" kind="reference">
<title>Glossary</title>
<summary>Definitions of market-research terms.</summary>
</doc>
</knowledge_pack>The agent reads this index to pick selectors, then follows outbound edges and reads full documents with the knowledge tools.
Routine
| Variable | Description |
|---|---|
{{ routine }} | Routine context |
{{ routine.slug }} | Slug |
{{ routine.name }} | Name |
{{ routine.execution_id }} | Current execution run |
{{ routine.step.name }} | Current step name |
{{ routine.step.type }} | Current step type |
{{ routine.step.instructions }} | Step instructions |
{{ routine.step.metadata }} | Step metadata |
Example
{{ routine }} resolves to a <routine> block with the current <step> nested inside:
<routine slug="weekly-review" name="Weekly Review" execution_id="ex_4c19" description="Summarize the week and flag risks.">
<step name="Draft summary" type="agent">
<instructions>Summarize merged PRs and open risks for the week.</instructions>
<metadata>{"max_words":300}</metadata>
</step>
</routine>Gate
| Variable | Description |
|---|---|
{{ gate.previous_output }} | Output being evaluated |
Gate prompts combine the previous output with task acceptance criteria or step instructions.
Example
{{ gate.previous_output }} is a scalar — the prior step's output inserted as plain text, not XML:
Draft complete: 3 sources cited, 740 words. Ready for review.Heartbeat
| Variable | Description |
|---|---|
{{ heartbeat.instructions }} | User-configured instructions for this heartbeat run, if any |
{{ heartbeat.previous_output }} | Output from the last run |
{{ heartbeat.last_run_at }} | Last run timestamp |
{{ heartbeat.next_run_at }} | Next scheduled run |
Use heartbeat variables for recurring checks and maintenance loops. See Agents for heartbeat schedules.
Example
Heartbeat variables are scalars, each rendered as plain text:
{{ heartbeat.instructions }} → Check for new error reports and summarize them.
{{ heartbeat.previous_output }} → No new errors since the last run.
{{ heartbeat.last_run_at }} → 2026-06-14T08:00:00Z
{{ heartbeat.next_run_at }} → 2026-06-14T09:00:00ZGit
| Variable | Description |
|---|---|
{{ git }} | Repository context |
{{ git.current_branch }} | Current branch |
{{ git.target_branch }} | Target branch |
{{ git.work_dir }} | Local workspace path |
{{ git.repo_url }} | Repository URL |
Example
{{ git }} resolves to a <git> block — repo_url and current_branch as attributes, the rest as child elements:
<git repo_url="https://github.com/acme/web-app" current_branch="feature/checkout">
<target_branch>main</target_branch>
<work_dir>/workspace/acme-web-app</work_dir>
</git>Memory and Artifacts
| Variable | Description |
|---|---|
{{ memories }} | All in-scope memories |
{{ memories.core }} | Core memory |
{{ memories.project }} | Project memory |
{{ memories.shared }} | Shared memory |
{{ memory_profile }} | Full memory profile |
{{ memory_profile.core_focus }} | Core focus |
{{ memory_profile.project_focus }} | Project focus |
{{ memory_profile.shared_focus }} | Shared focus |
{{ artifacts }} | All artifacts |
{{ artifacts.project }} | Project artifacts |
{{ artifacts.workspace }} | Workspace artifacts |
Memory is learned context and artifacts are saved outputs — both are distinct from knowledge graphs, which remain explicit source material retrieved through knowledge tools.
Example
{{ memories }} resolves to a <memories> block grouped by tier, with each <category> holding its facts. Requesting a single tier (e.g. {{ memories.core }}) renders just that <memories-core> element.
<memories>
<memories-core>
<category name="methodology">Prefers test-driven changes and small PRs.</category>
</memories-core>
<memories-project>
<category name="decisions">Chose Stripe over PayPal for checkout (2026-05).</category>
</memories-project>
</memories>{{ memory_profile }} instead renders the configured focus lists:
<memory_profile>
<core_focus>
<item>personality</item>
<item>methodology</item>
</core_focus>
<project_focus>
<item>task_history</item>
</project_focus>
</memory_profile>Context Blocks
Context blocks render by their refs:
{{ context.methodology }}
{{ pkg.nenjo_ai.packages.context.tools.tool_usage }}
{{ pkg.nenjo_ai.packages.context.operations.write_discipline }}pkg.* is only for package-installed context blocks and package knowledge. Installed agents, abilities, domains, MCP servers, script tools, and routines are resolved as runtime resources, not prompt variables. See Context Blocks.
Global
| Variable | Description |
|---|---|
{{ global.timestamp }} | Current timestamp |
Primitives
The composable units of Nenjo — context material (template variables, context blocks, knowledge graphs, memory) and the behavioral units that use it (abilities, domains, agents).
Context Blocks
Reusable prompt-context assets referenced by stable template names and shared across agents, abilities, and domains.

