Smart Context settings
Smart Context exports a selection of notes (and optionally their linked notes) into a single, easy-to-use bundle you can paste into chat.
These settings control the format of that export by applying two layers of templates:
- Context templates wrap the entire export.
- Item templates wrap each note (each "item") inside the export.
Where to find these settings in Obsidian
Open Settings -> Community plugins -> Smart Context .
Templates only change the text you copy/export. They do not change your notes on disk.
How an context is structured
When you copy a context, Smart Context outputs one text blob that conceptually looks like:
- Context Template Before
- Repeated for each item:
- Item Template Before
- Item content (the note text)
- Item Template After
- Context Template After
If you want reproducibility (stable prompts) or machine parsing, templates are the control surface.
Context templates
Context templates wrap the entire export.

Available variable
{{FILE_TREE}}- shows a hierarchical view of all files included in the export.
If you remove {{FILE_TREE}} from your Context Template Before/After, the export will not include the file tree.
Default (XML)
Template Before
<context>
{{FILE_TREE}}
Template After
</context>
Keep global wrappers short. Every extra character here repeats on every copy and costs tokens if you paste into an LLM.
Item templates
Item templates wrap each individual item (usually a note) in the export.

Available variables
{{KEY}}- full path of the item.{{TIME_AGO}}- time since the item was last modified.{{LINK_DEPTH}}- depth level of the item.
{{LINK_DEPTH}} is most useful when you export with linked notes included:
- Depth
0is typically the item you explicitly selected. - Depth
1+are items pulled in via link expansion (linked notes-of-notes, etc.).
Default (XML)
Template Before
<item loc="{{KEY}}" at="{{TIME_AGO}}" depth="{{LINK_DEPTH}}">
Template After
</item>
Template examples
Use these as starting points depending on how you use Smart Context.
1) Default (XML tags + attributes)
Context Template Before
<context>
{{FILE_TREE}}
Context Template After
</context>
Item Template Before
<item loc="{{KEY}}" at="{{TIME_AGO}}" depth="{{LINK_DEPTH}}">
Item Template After
</item>
Why this works:
- Works well with downstream tooling (split on
<item ...>boundaries). - Keeps metadata attached to each item.
- Most language models benefit from the XML format
2) Human-readable, LLM-friendly (minimal structure, low overhead)
Context Template Before
{{FILE_TREE}}
Context Template After: BLANK
Item Template Before
## {{KEY}} (updated {{TIME_AGO}})
Item Template After: BLANK
Why this works:
- Easy to skim.
- Low token overhead.
- Headings help the model segment content.
3) Diff-friendly separators (good for prompt reproducibility)
Context Template Before
{{FILE_TREE}}
====================
BEGIN CONTEXT
====================
Context Template After
====================
END CONTEXT
====================
Item Template Before
--------------------
FILE: {{KEY}}
UPDATED: {{TIME_AGO}}
DEPTH: {{LINK_DEPTH}}
--------------------
Item Template After: BLANK
Why this works:
- Easy to visually diff bundles.
- Very stable delimiters for "find the boundaries".
Troubleshooting
"My file tree is missing"
Ensure {{FILE_TREE}} is present in either Context Template Before or Context Template After.
"I included linked notes but cannot tell which were pulled in"
Add depth="{{LINK_DEPTH}}" (or an equivalent line) to your Item Template Before so the depth is visible per item.
"My export is too long / too many tokens"
- Remove or shorten heavy wrappers.
- Consider removing the file tree if you do not need it.
- Use smaller item headers (or none) if you only need raw content.
Related pages
Dataview (inline field '===================
END CONTEXT
===================='): Error:
-- PARSING FAILED --------------------------------------------------
> 1 | ===================
| ^
2 | END CONTEXT
3 | ====================
Expected one of the following:
'(', 'null', boolean, date, duration, file link, list ('[1, 2, 3]'), negated field, number, object ('{ a: 1, b: 2 }'), string, variable