Skip to content

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:

Where to find these settings in Obsidian

Open Settings -> Community plugins -> Smart Context .

Note

Templates only change the text you copy/export. They do not change your notes on disk.


How a context is structured

When you copy a context, Smart Context outputs one text blob that is built like this:

  1. Context Template Before
  2. Repeated for each item:
    • Item Template Before
      • Item content (the note text)
      • Item Template After
  3. Context Template After

In the examples below, each template is shown as a single block to make the final output shape obvious.

To apply an example in the settings UI:

If you want reproducibility (stable prompts) or machine parsing, templates are the control surface.


Context templates

Context templates wrap the entire export.

Available variables

If you remove {{FILE_TREE}} from your Context Template Before/After, the export will not include the file tree.

Default (XML-style)

Context template (single-block representation)

<context>
{{FILE_TREE}}
{{CONTEXT_ITEMS}}
</context>
Tip

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

{{LINK_DEPTH}} is most useful when you export with linked notes included:

Default (XML-style)

Item template (single-block representation)

<item loc="{{KEY}}" at="{{TIME_AGO}}" depth="{{LINK_DEPTH}}">
{{ITEM_CONTENT}}
</item>

Template presets

Use these as starting points depending on how you use Smart Context.

1) XML-style (default)

Context template

<context>
{{FILE_TREE}}
{{CONTEXT_ITEMS}}
</context>

Item template

<item loc="{{KEY}}" at="{{TIME_AGO}}" depth="{{LINK_DEPTH}}">
{{ITEM_CONTENT}}
</item>

Why this works:

2) Markdown headings (LLM-friendly, minimal structure)

Context template

{{FILE_TREE}}
{{CONTEXT_ITEMS}}

Item template

## {{KEY}}
Updated: {{TIME_AGO}} | Depth: {{LINK_DEPTH}}
````{{EXT}}

Why this works:

3) JSON structured (tool-friendly)

Context template

{
  "context": {
{{CONTEXT_ITEMS}}
  }
}

Item template

"{{KEY}}": {
	"name": "{{ITEM_NAME}}",
	"updated": "{{TIME_AGO}}",
	"depth": {{LINK_DEPTH}},
	"content": "{{ITEM_CONTENT}}"
},

Why this works:


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"

Related pages