Customization: Context Snippets
Context Snippets are dynamic, reusable blocks of context that can be invoked directly from your prompt. They are similar to Custom Snippets but are designed for generating context rather than just inserting static text. They are powered by the same Eta templating engine as Context Templates, giving you access to all the same helper functions (it.readFile
, it.tree
, etc.).
The key difference is how they are used: you call them from the prompt input using a !
handle (e.g., !last-commit-files
).
Why Use Context Snippets?
- On-Demand Context: Instead of adding files and folders to the ad-hoc context manually for every prompt, you can create a snippet to pull in that context with a simple command.
- Dynamic & Scriptable: A snippet can run commands, read files, and process them before they are injected into the main context template. For example, a
!last-commit
snippet could rungit diff --name-only HEAD~1
and then read the content of the changed files. - Reduces Prompt Clutter: Keeps your main prompt focused on the task, while the complex context gathering is handled by the snippet.
Managing Context Snippets
You can manage snippets from the Context Snippets page, accessible from the home dashboard.
Snippet Properties
- Handle: The unique identifier for the snippet, used to call it from a prompt (e.g.,
last-commit-files
). You invoke it with!handle
. - Description: A brief explanation of what the snippet does.
- Template: The Eta template content for the snippet. This is where you use helpers like
it.readFile
to generate the context string.
How They Work
- You write a prompt in the Session Panel, including one or more snippet handles, e.g.,
Refactor the code in !last-commit-files
. - Before the main Context Template is rendered, Repoburg finds each
!handle
. - It executes the template for each corresponding Context Snippet.
- The rendered text from all snippets is collected.
- This collected text is then injected into your main Context Template via the
<%~ it.context_snippets_content %>
variable.
This allows you to create a library of powerful, on-demand context-gathering tools tailored to your workflow.