Templates
The dctx Template System (DTS) defines the text dctx pack prints. dctx 1.3.1 ships two built-in templates; both are shown here with their real output on the sample project.
Which template pack uses
dctx pack renders the default template; --tree-stamps=on selects the stamped one, the 1.0.0 text. legacy_output.rs
dctx template build <PATH> parses and validates a template file and prints its compiled plan; with --output PATH it writes the plan. dctx template list lists explicit compiled plans. The 1.1.0 pack command has no option that selects a compiled plan, so this page shows no third, custom template.
$ dctx template build default.dctx_templatetemplate source_version=1 plan_bytes=2191 digest=5fdd4d1fd3ef127241bc661a6057dad7cf812b0081eec51e58b2bf09f3b802fb views=1 retention=stdout$ dctx template build stamped.dctx_templatetemplate source_version=1 plan_bytes=2243 digest=e55e481eef9bec67a82232802068e28037389d0bdd1efbce5e3dcda73a327364 views=1 retention=stdout
What changes between them
This file defines how the LLM context is formatted. The only difference is the tree entry and its instruction line: the default leaves out MOD and SIZE, because a timestamp changes on a bare touch and a size on every edit, and either breaks the byte-stable prefix a prompt cache reuses. The tree of the sample, word by word (default to stamped; the MOD digits are replaced with … since they are file times):
[D] (ID:ROOT)(ID:ROOT, MOD:…)
[F] .env (ID:F001)(ID:F001, MOD:…, SIZE:29)
[F] .gitignore (ID:F002)(ID:F002, MOD:…, SIZE:8)
[F] Cargo.toml (ID:F003)(ID:F003, MOD:…, SIZE:185)
[F] README.md (ID:F004)(ID:F004, MOD:…, SIZE:473)
[F] config.toml (ID:F005)(ID:F005, MOD:…, SIZE:78)
[D] src (ID:D006)(ID:D006, MOD:…)
[F] src/main.rs (ID:F007)(ID:F007, MOD:…, SIZE:331)
[F] src/store.rs (ID:F008)(ID:F008, MOD:…, SIZE:698)
[F] src/util.rs (ID:F009)(ID:F009, MOD:…, SIZE:404)
[D] tools (ID:D010)(ID:D010, MOD:…)
[F] tools/report.py (ID:F011)(ID:F011, MOD:…, SIZE:484)
[D] web (ID:D012)(ID:D012, MOD:…)
[F] web/app.ts (ID:F013)(ID:F013, MOD:…, SIZE:596)
[F] web/format.ts (ID:F014)(ID:F014, MOD:…, SIZE:350)default.dctx_template
# ==============================================================================
# DCTX TEMPLATE DEFINITION V1
# ==============================================================================
# This file defines how the LLM context is formatted.
# It consists of three sections: [VARIABLES], [PARTIALS], and [LAYOUT].
#
# SYNTAX GUIDE:
# - {{VAR_NAME}} : Inserts a configuration variable defined in [VARIABLES].
# - {{{DATA_FIELD}}} : Inserts dynamic data from the project (e.g., file content).
#
# ==============================================================================
[VARIABLES]
# --- 1. Syntactic Markers (Granular Control) ---
# Defines the exact characters used to wrap tags.
# Allows handling XML, HTML, or Custom formats safely.
start_marker_open = "<"
start_marker_close = ">"
end_marker_open = "</"
end_marker_close = ">"
# --- 2. Semantic Marker Names ---
# Defines the keywords used inside the tags.
instr_marker = "INSTRUCTIONS"
tree_start_marker = "DIRECTORY_TREE"
tree_end_marker = "DIRECTORY_TREE"
file_start_marker = "FILE_CONTENT_START"
file_end_marker = "FILE_CONTENT_END"
# --- 3. Attribute Keys ---
# Used inside tags to denote properties.
attr_id = "ID"
attr_path = "PATH"
attr_size = "SIZE"
attr_lines = "LINES"
attr_mod = "MOD"
# --- 4. Branding & Header Config ---
folder_denotation_marker = "DIRECTORY"
# --- 5. Instructions Block Text ---
# This text explains the format to the LLM. It references the variables above
# to ensure the instructions always match the actual format used.
# Use '\n' for new lines.
instructions_text = "1. Manifest: The {{start_marker_open}}{{tree_start_marker}}{{start_marker_close}} section lists all files.\n - Each entry: [TYPE] RELATIVE_PATH ({{attr_id}}:UNIQUE_ID)\n - TYPE is [D] for directory, [F] for file.\n2. Content Access: To read a specific file:\n - Find its UNIQUE_ID from the directory tree.\n - Search for the marker: {{start_marker_open}}{{file_start_marker}} {{attr_id}}="UNIQUE_ID"{{start_marker_close}}\n - The content is between this marker and {{end_marker_open}}{{file_end_marker}} {{attr_id}}="UNIQUE_ID"{{end_marker_close}}"
# ==============================================================================
# [PARTIALS]
# Defines the look of repeated elements (Tree items and Files).
# ==============================================================================
# --- Tree Entry Partial ---
# Context: 'node' object
# Available Data: {{{node.type_char}}}, {{{node.path}}}, {{{node.id}}}, {{{node.mod}}}, {{{node.size}}}
# The default entry leaves {{{node.mod}}} and {{{node.size_part}}} out: a timestamp or a size changes on an edit or a touch
# and would break the byte-stable prefix of the page. Custom templates may still use {{attr_mod}}, {{{node.mod}}},
# {{{node.size}}} and {{{node.size_part}}}; `--tree-stamps=on` selects the stamped built-in (the 1.0.0 text).
[PARTIAL:TREE_ENTRY]
{{{node.type_char}}} {{{node.path}}} ({{attr_id}}:{{{node.id}}})
# --- File Block Partial ---
# Context: 'file' object
# Available Data: {{{file.id}}}, {{{file.path}}}, {{{file.lines}}}, {{{file.size}}}, {{{file.content}}}
[PARTIAL:FILE_BLOCK]
{{start_marker_open}}{{file_start_marker}} {{attr_id}}="{{{file.id}}}" {{attr_path}}="{{{file.path}}}" {{attr_lines}}="{{{file.lines}}}"{{start_marker_close}}
{{{file.content}}}
{{end_marker_open}}{{file_end_marker}} {{attr_id}}="{{{file.id}}}"{{end_marker_close}}
# ==============================================================================
# [LAYOUT]
# The master structure of the final output file.
# Note: The Version Header (e.g. [DCTX_SNAPSHOT_V1]) is hardcoded in the binary
# and NOT included here.
# ==============================================================================
[LAYOUT]
[{{folder_denotation_marker}}:{{{project}}}]
{{start_marker_open}}{{instr_marker}}{{start_marker_close}}
{{instructions_text}}
{{end_marker_open}}{{instr_marker}}{{end_marker_close}}
{{start_marker_open}}{{tree_start_marker}}{{start_marker_close}}
{{{comp.tree}}}
{{end_marker_open}}{{tree_end_marker}}{{end_marker_close}}
{{{comp.files}}}
Output: dctx pack .
$ dctx pack .[DCTX_LLM_CONTEXT_SNAPSHOT_V1][DIRECTORY:kiosk]<INSTRUCTIONS>1. Manifest: The <DIRECTORY_TREE> section lists all files. - Each entry: [TYPE] RELATIVE_PATH (ID:UNIQUE_ID) - TYPE is [D] for directory, [F] for file.2. Content Access: To read a specific file: - Find its UNIQUE_ID from the directory tree. - Search for the marker: <FILE_CONTENT_START ID="UNIQUE_ID"> - The content is between this marker and </FILE_CONTENT_END ID="UNIQUE_ID"></INSTRUCTIONS><DIRECTORY_TREE>[D] (ID:ROOT) [F] .env (ID:F001) [F] .gitignore (ID:F002) [F] Cargo.toml (ID:F003) [F] README.md (ID:F004) [F] config.toml (ID:F005) [D] src (ID:D006) [F] src/main.rs (ID:F007) [F] src/store.rs (ID:F008) [F] src/util.rs (ID:F009) [D] tools (ID:D010) [F] tools/report.py (ID:F011) [D] web (ID:D012) [F] web/app.ts (ID:F013) [F] web/format.ts (ID:F014)</DIRECTORY_TREE><FILE_CONTENT_START ID="F001" PATH=".env" LINES="0">[Content omitted by pattern rules]</FILE_CONTENT_END ID="F001"><FILE_CONTENT_START ID="F002" PATH=".gitignore" LINES="2">target/</FILE_CONTENT_END ID="F002"><FILE_CONTENT_START ID="F003" PATH="Cargo.toml" LINES="9">[package]name = "kiosk"version = "0.1.0"edition = "2021"description = "A tiny order kiosk: the sample project for the dctx website examples."license = "Apache-2.0"[dependencies]</FILE_CONTENT_END ID="F003"><FILE_CONTENT_START ID="F004" PATH="README.md" LINES="19"># kioskA tiny order kiosk. It is the example project that every command on the dctx website runs on.## Run cargo run -- adaprints `Hello, Ada!` and saves order 1 to `orders/1.tsv`.## OrdersEach order is one tab-separated line: id, item, quantity and a checksum of the item name.`python3 tools/report.py orders/` sums the quantities.## Configuration`config.toml` holds the currency and the screen title. Secrets live in `.env`, which is never committed.</FILE_CONTENT_END ID="F004"><FILE_CONTENT_START ID="F005" PATH="config.toml" LINES="7">[screen]title = "kiosk example"currency = "EUR"[orders]folder = "orders"</FILE_CONTENT_END ID="F005"><FILE_CONTENT_START ID="F007" PATH="src/main.rs" LINES="11">//! kiosk: greet a customer, take one order, save it.mod store;mod util;fn main() { let name = std::env::args().nth(1).unwrap_or_else(|| "guest".to_string()); println!("{}", util::greet(&name)); let order = store::Order { id: 1, item: "coffee".to_string(), qty: 2 }; store::save(&order).expect("save order");}</FILE_CONTENT_END ID="F007"><FILE_CONTENT_START ID="F008" PATH="src/store.rs" LINES="25">use std::io;/// One order as the kiosk records it.pub struct Order { pub id: u32, pub item: String, pub qty: u32,}/// Write the order to orders/<id>.tsv.pub fn save(order: &Order) -> io::Result<()> { std::fs::create_dir_all("orders")?; std::fs::write(format!("orders/{}.tsv", order.id), encode(order))}/// One tab-separated line with a checksum of the item name.fn encode(order: &Order) -> String { format!("{}\t{}\t{}\t{:08x}\n", order.id, order.item, order.qty, checksum(&order.item))}/// FNV-1a over the bytes of the text.fn checksum(text: &str) -> u32 { text.bytes().fold(0x811c9dc5, |hash, byte| (hash ^ u32::from(byte)).wrapping_mul(0x0100_0193))}</FILE_CONTENT_END ID="F008"><FILE_CONTENT_START ID="F009" PATH="src/util.rs" LINES="14">/// The greeting shown on the kiosk screen.pub fn greet(name: &str) -> String { format!("Hello, {}!", title_case(name))}/// Upper-case the first letter of a name, leave the rest as typed.pub fn title_case(name: &str) -> String { let mut chars = name.chars(); match chars.next() { Some(first) => first.to_uppercase().chain(chars).collect(), None => String::new(), }}</FILE_CONTENT_END ID="F009"><FILE_CONTENT_START ID="F011" PATH="tools/report.py" LINES="19">"""Sum the quantities of every saved order: python3 tools/report.py orders/"""import sysfrom pathlib import Pathdef read_orders(folder): for path in sorted(Path(folder).glob("*.tsv")): order_id, item, qty, _checksum = path.read_text().rstrip("\n").split("\t") yield order_id, item, int(qty)def main(folder="orders"): total = sum(qty for _, _, qty in read_orders(folder)) print(f"{total} items")if __name__ == "__main__": main(*sys.argv[1:])</FILE_CONTENT_END ID="F011"><FILE_CONTENT_START ID="F013" PATH="web/app.ts" LINES="20">import { formatName, formatPrice } from "./format";interface Line { item: string; cents: number; qty: number;}/** The greeting banner of the kiosk web screen. */export function renderGreeting(name: string): string { return `Hello, ${formatName(name)}!`;}/** One receipt line per order line, then the total. */export function renderReceipt(lines: Line[]): string[] { const rows = lines.map((l) => `${l.qty} x ${l.item} ${formatPrice(l.cents * l.qty)}`); const total = lines.reduce((sum, l) => sum + l.cents * l.qty, 0); return [...rows, `total ${formatPrice(total)}`];}</FILE_CONTENT_END ID="F013"><FILE_CONTENT_START ID="F014" PATH="web/format.ts" LINES="10">/** Price in cents to a display string, e.g. 250 -> "2.50 EUR". */export function formatPrice(cents: number, currency = "EUR"): string { return `${(cents / 100).toFixed(2)} ${currency}`;}/** The customer's name as the screen shows it. */export function formatName(name: string): string { return name.trim() === "" ? "guest" : name.trim();}</FILE_CONTENT_END ID="F014">pack bytes=5545 files=11 retention=stdout version=V1
stamped.dctx_template
# ==============================================================================
# DCTX TEMPLATE DEFINITION V1
# ==============================================================================
# This file defines how the LLM context is formatted.
# It consists of three sections: [VARIABLES], [PARTIALS], and [LAYOUT].
#
# SYNTAX GUIDE:
# - {{VAR_NAME}} : Inserts a configuration variable defined in [VARIABLES].
# - {{{DATA_FIELD}}} : Inserts dynamic data from the project (e.g., file content).
#
# ==============================================================================
[VARIABLES]
# --- 1. Syntactic Markers (Granular Control) ---
# Defines the exact characters used to wrap tags.
# Allows handling XML, HTML, or Custom formats safely.
start_marker_open = "<"
start_marker_close = ">"
end_marker_open = "</"
end_marker_close = ">"
# --- 2. Semantic Marker Names ---
# Defines the keywords used inside the tags.
instr_marker = "INSTRUCTIONS"
tree_start_marker = "DIRECTORY_TREE"
tree_end_marker = "DIRECTORY_TREE"
file_start_marker = "FILE_CONTENT_START"
file_end_marker = "FILE_CONTENT_END"
# --- 3. Attribute Keys ---
# Used inside tags to denote properties.
attr_id = "ID"
attr_path = "PATH"
attr_size = "SIZE"
attr_lines = "LINES"
attr_mod = "MOD"
# --- 4. Branding & Header Config ---
folder_denotation_marker = "DIRECTORY"
# --- 5. Instructions Block Text ---
# This text explains the format to the LLM. It references the variables above
# to ensure the instructions always match the actual format used.
# Use '\n' for new lines.
instructions_text = "1. Manifest: The {{start_marker_open}}{{tree_start_marker}}{{start_marker_close}} section lists all files.\n - Each entry: [TYPE] RELATIVE_PATH ({{attr_id}}:UNIQUE_ID, {{attr_mod}}:TIMESTAMP)\n - TYPE is [D] for directory, [F] for file.\n2. Content Access: To read a specific file:\n - Find its UNIQUE_ID from the directory tree.\n - Search for the marker: {{start_marker_open}}{{file_start_marker}} {{attr_id}}="UNIQUE_ID"{{start_marker_close}}\n - The content is between this marker and {{end_marker_open}}{{file_end_marker}} {{attr_id}}="UNIQUE_ID"{{end_marker_close}}"
# ==============================================================================
# [PARTIALS]
# Defines the look of repeated elements (Tree items and Files).
# ==============================================================================
# --- Tree Entry Partial ---
# Context: 'node' object
# Available Data: {{{node.type_char}}}, {{{node.path}}}, {{{node.id}}}, {{{node.mod}}}, {{{node.size}}}
[PARTIAL:TREE_ENTRY]
{{{node.type_char}}} {{{node.path}}} ({{attr_id}}:{{{node.id}}}, {{attr_mod}}:{{{node.mod}}}{{{node.size_part}}})
# --- File Block Partial ---
# Context: 'file' object
# Available Data: {{{file.id}}}, {{{file.path}}}, {{{file.lines}}}, {{{file.size}}}, {{{file.content}}}
[PARTIAL:FILE_BLOCK]
{{start_marker_open}}{{file_start_marker}} {{attr_id}}="{{{file.id}}}" {{attr_path}}="{{{file.path}}}" {{attr_lines}}="{{{file.lines}}}"{{start_marker_close}}
{{{file.content}}}
{{end_marker_open}}{{file_end_marker}} {{attr_id}}="{{{file.id}}}"{{end_marker_close}}
# ==============================================================================
# [LAYOUT]
# The master structure of the final output file.
# Note: The Version Header (e.g. [DCTX_SNAPSHOT_V1]) is hardcoded in the binary
# and NOT included here.
# ==============================================================================
[LAYOUT]
[{{folder_denotation_marker}}:{{{project}}}]
{{start_marker_open}}{{instr_marker}}{{start_marker_close}}
{{instructions_text}}
{{end_marker_open}}{{instr_marker}}{{end_marker_close}}
{{start_marker_open}}{{tree_start_marker}}{{start_marker_close}}
{{{comp.tree}}}
{{end_marker_open}}{{tree_end_marker}}{{end_marker_close}}
{{{comp.files}}}
Output: dctx pack . --tree-stamps=on
$ dctx pack . --tree-stamps=on[DCTX_LLM_CONTEXT_SNAPSHOT_V1][DIRECTORY:kiosk]<INSTRUCTIONS>1. Manifest: The <DIRECTORY_TREE> section lists all files. - Each entry: [TYPE] RELATIVE_PATH (ID:UNIQUE_ID, MOD:TIMESTAMP) - TYPE is [D] for directory, [F] for file.2. Content Access: To read a specific file: - Find its UNIQUE_ID from the directory tree. - Search for the marker: <FILE_CONTENT_START ID="UNIQUE_ID"> - The content is between this marker and </FILE_CONTENT_END ID="UNIQUE_ID"></INSTRUCTIONS><DIRECTORY_TREE>[D] (ID:ROOT, MOD:…) [F] .env (ID:F001, MOD:…, SIZE:29) [F] .gitignore (ID:F002, MOD:…, SIZE:8) [F] Cargo.toml (ID:F003, MOD:…, SIZE:185) [F] README.md (ID:F004, MOD:…, SIZE:473) [F] config.toml (ID:F005, MOD:…, SIZE:78) [D] src (ID:D006, MOD:…) [F] src/main.rs (ID:F007, MOD:…, SIZE:331) [F] src/store.rs (ID:F008, MOD:…, SIZE:698) [F] src/util.rs (ID:F009, MOD:…, SIZE:404) [D] tools (ID:D010, MOD:…) [F] tools/report.py (ID:F011, MOD:…, SIZE:484) [D] web (ID:D012, MOD:…) [F] web/app.ts (ID:F013, MOD:…, SIZE:596) [F] web/format.ts (ID:F014, MOD:…, SIZE:350)</DIRECTORY_TREE><FILE_CONTENT_START ID="F001" PATH=".env" LINES="0">[Content omitted by pattern rules]</FILE_CONTENT_END ID="F001"><FILE_CONTENT_START ID="F002" PATH=".gitignore" LINES="2">target/</FILE_CONTENT_END ID="F002"><FILE_CONTENT_START ID="F003" PATH="Cargo.toml" LINES="9">[package]name = "kiosk"version = "0.1.0"edition = "2021"description = "A tiny order kiosk: the sample project for the dctx website examples."license = "Apache-2.0"[dependencies]</FILE_CONTENT_END ID="F003"><FILE_CONTENT_START ID="F004" PATH="README.md" LINES="19"># kioskA tiny order kiosk. It is the example project that every command on the dctx website runs on.## Run cargo run -- adaprints `Hello, Ada!` and saves order 1 to `orders/1.tsv`.## OrdersEach order is one tab-separated line: id, item, quantity and a checksum of the item name.`python3 tools/report.py orders/` sums the quantities.## Configuration`config.toml` holds the currency and the screen title. Secrets live in `.env`, which is never committed.</FILE_CONTENT_END ID="F004"><FILE_CONTENT_START ID="F005" PATH="config.toml" LINES="7">[screen]title = "kiosk example"currency = "EUR"[orders]folder = "orders"</FILE_CONTENT_END ID="F005"><FILE_CONTENT_START ID="F007" PATH="src/main.rs" LINES="11">//! kiosk: greet a customer, take one order, save it.mod store;mod util;fn main() { let name = std::env::args().nth(1).unwrap_or_else(|| "guest".to_string()); println!("{}", util::greet(&name)); let order = store::Order { id: 1, item: "coffee".to_string(), qty: 2 }; store::save(&order).expect("save order");}</FILE_CONTENT_END ID="F007"><FILE_CONTENT_START ID="F008" PATH="src/store.rs" LINES="25">use std::io;/// One order as the kiosk records it.pub struct Order { pub id: u32, pub item: String, pub qty: u32,}/// Write the order to orders/<id>.tsv.pub fn save(order: &Order) -> io::Result<()> { std::fs::create_dir_all("orders")?; std::fs::write(format!("orders/{}.tsv", order.id), encode(order))}/// One tab-separated line with a checksum of the item name.fn encode(order: &Order) -> String { format!("{}\t{}\t{}\t{:08x}\n", order.id, order.item, order.qty, checksum(&order.item))}/// FNV-1a over the bytes of the text.fn checksum(text: &str) -> u32 { text.bytes().fold(0x811c9dc5, |hash, byte| (hash ^ u32::from(byte)).wrapping_mul(0x0100_0193))}</FILE_CONTENT_END ID="F008"><FILE_CONTENT_START ID="F009" PATH="src/util.rs" LINES="14">/// The greeting shown on the kiosk screen.pub fn greet(name: &str) -> String { format!("Hello, {}!", title_case(name))}/// Upper-case the first letter of a name, leave the rest as typed.pub fn title_case(name: &str) -> String { let mut chars = name.chars(); match chars.next() { Some(first) => first.to_uppercase().chain(chars).collect(), None => String::new(), }}</FILE_CONTENT_END ID="F009"><FILE_CONTENT_START ID="F011" PATH="tools/report.py" LINES="19">"""Sum the quantities of every saved order: python3 tools/report.py orders/"""import sysfrom pathlib import Pathdef read_orders(folder): for path in sorted(Path(folder).glob("*.tsv")): order_id, item, qty, _checksum = path.read_text().rstrip("\n").split("\t") yield order_id, item, int(qty)def main(folder="orders"): total = sum(qty for _, _, qty in read_orders(folder)) print(f"{total} items")if __name__ == "__main__": main(*sys.argv[1:])</FILE_CONTENT_END ID="F011"><FILE_CONTENT_START ID="F013" PATH="web/app.ts" LINES="20">import { formatName, formatPrice } from "./format";interface Line { item: string; cents: number; qty: number;}/** The greeting banner of the kiosk web screen. */export function renderGreeting(name: string): string { return `Hello, ${formatName(name)}!`;}/** One receipt line per order line, then the total. */export function renderReceipt(lines: Line[]): string[] { const rows = lines.map((l) => `${l.qty} x ${l.item} ${formatPrice(l.cents * l.qty)}`); const total = lines.reduce((sum, l) => sum + l.cents * l.qty, 0); return [...rows, `total ${formatPrice(total)}`];}</FILE_CONTENT_END ID="F013"><FILE_CONTENT_START ID="F014" PATH="web/format.ts" LINES="10">/** Price in cents to a display string, e.g. 250 -> "2.50 EUR". */export function formatPrice(cents: number, currency = "EUR"): string { return `${(cents / 100).toFixed(2)} ${currency}`;}/** The customer's name as the screen shows it. */export function formatName(name: string): string { return name.trim() === "" ? "guest" : name.trim();}</FILE_CONTENT_END ID="F014">pack bytes=5951 files=11 retention=stdout version=V1
Syntax
From ADR-003, sections 1, 3, 4 and 5. The contract of the source and the compiled plan is DTS v2.
1. Decision: Explicit Marker Definition#
To ensure future compatibility with non-HTML-like syntax, the templating language separates "Opening" and "Closing" logic for tags into four distinct definitions:
* start_marker_open (Default: <)
* start_marker_close (Default: >)
* end_marker_open (Default: </)
* end_marker_close (Default: >)
This allows users to redefine tags completely, e.g., to [SECTION] ... [/SECTION] or {{#SECTION}} ... {{/SECTION}}.
3. Decision: Two-Pass Rendering Engine#
The rendering engine operates in two distinct passes to separate Configuration from Data.
- Pass 1 (Config Resolution): Occurs during the "Template Build" phase. Resolves all
{{VAR}}placeholders within the[VARIABLES]section. - Pass 2 (Data Injection): Occurs during runtime. Injects
{{{DATA}}}into the pre-compiled Partial structures ([PARTIALS]section) and assembles the[LAYOUT].
4. Template File Structure#
The file format uses a custom INI-like syntax with three specific sections:
1. [VARIABLES]: Key-Value pairs for static strings.
2. [PARTIALS]: Definitions for repeated elements (TREE_ENTRY, FILE_BLOCK).
3. [LAYOUT]: The global document structure.
5. Available Data Variables (Runtime)#
These variables are populated by the Rust core:
* {{{node.id}}}: Optimized incremental ID (e.g., 1, 2, 10).
* {{{node.path}}}: Relative path.
* {{{node.type_char}}}: [D] or [F].
* {{{node.mod}}}: Unix timestamp in milliseconds. Available to custom templates. The built-in default template does not print it since 1.0.1, because a timestamp changes on a bare touch and breaks the byte-stable prefix of the page; --tree-stamps=on selects the built-in stamped template (the 1.0.0 text, MOD: and SIZE: on every tree line, MOD in the instructions). The default entry also leaves out {{{node.size_part}}}, since a size changes on every ordinary edit; {{{node.size}}} and {{{node.size_part}}} stay available to custom templates.
* {{{node.size}}}: File size in bytes.
* {{{file.lines}}}: Line count of the file.
* {{{file.content}}}: Actual file content.