How to Configure Excluded Tags to Prevent Note Auto-Loading in Claudian
Claudian automatically excludes notes from chat sessions when they contain tags listed in the Excluded Tags setting, which you can configure via the Settings UI or by editing the plugin's JSON configuration directly.
The Claudian plugin for Obsidian automatically attaches your currently active note to new chat sessions unless specifically configured otherwise. To prevent sensitive or draft notes from being auto-loaded, you can configure excluded tags that block automatic attachment. This guide explains how to set up these exclusions using the plugin's settings interface and underlying source code.
How Excluded Tags Work in Claudian
The exclusion system operates through four distinct stages defined in the source code:
-
Settings Storage – The excluded tags array lives in
plugin.settings.excludedTagsas defined insrc/features/settings/ClaudianSettings.ts(lines 136-148) and persists in the plugin's JSON settings file. -
UI Configuration – The Settings tab renders a textarea where each line represents one excluded tag.
-
Tag Detection – When a file opens or a session starts,
FileContextManager.autoAttachActiveFile()invokesFileContextManager.hasExcludedTag()(located insrc/features/chat/ui/FileContext.ts, lines 60-84). This method queries the ObsidianmetadataCacheto readcache.frontmatter?.tagsandcache.tags, strips leading#characters, and returns true if any file tag matches the excluded list. -
Attachment Prevention – If
hasExcludedTag()returns true, the note is skipped during auto-attachment, though manual attachment remains available through the chip UI.
Configuring Excluded Tags in Settings
Using the Settings UI
In src/features/settings/ClaudianSettings.ts (lines 136-148), the plugin exposes a textarea interface for tag management:
// Settings UI implementation in ClaudianSettings.ts
new Setting(containerEl)
.setName(t('settings.excludedTags.name'))
.setDesc(t('settings.excludedTags.desc'))
.addTextArea((text) => {
// One tag per line (e.g., "private", "draft", "system")
text.setPlaceholder('system\nprivate\ndraft')
.setValue(this.plugin.settings.excludedTags.join('\n'))
.onChange(async (value) => {
this.plugin.settings.excludedTags = value
.split(/\r?\n/)
.map(s => s.trim().replace(/^#/, '')) // strip whitespace & leading #
.filter(s => s.length > 0);
await this.plugin.saveSettings();
});
});
Enter one tag per line. The handler automatically strips whitespace and leading # characters before saving to plugin.settings.excludedTags.
Editing the JSON Configuration Directly
You can also modify the plugin's data.json directly in your Obsidian vault:
{
"excludedTags": ["system", "private", "draft"]
}
This array corresponds to the excludedTags: string[] type defined in src/core/types/settings.ts and is persisted via saveSettings() in src/main.ts.
Tag Detection Logic in the Source Code
The automatic attachment prevention relies on two key methods in src/features/chat/ui/FileContext.ts:
hasExcludedTag() (lines 60-84) performs the validation by:
- Retrieving cached metadata via
app.metadataCache.getFileCache(file) - Checking both
frontmatter.tagsand inlinetagsarrays - Normalizing tags by removing leading
#characters - Comparing against
plugin.settings.excludedTags
autoAttachActiveFile() calls this validation before attaching any file. If the active note carries an excluded tag, the method returns early, leaving the chat context empty until you manually select a file.
Applying Excluded Tags to Your Notes
Once configured, apply excluded tags to specific notes using standard Obsidian syntax.
Front Matter Tags
Add tags to the YAML front matter:
---
tags: [private, research]
---
Inline Tags
Use inline tags anywhere in the note body:
# My Note
#private <!-- inline tag -->
When FileContextManager.hasExcludedTag() processes this file, it detects the private tag and prevents autoAttachActiveFile() from attaching it to new chat sessions.
Summary
- Excluded tags prevent automatic note attachment in Claudian when configured in
plugin.settings.excludedTags - Configure tags via the Settings UI textarea (
ClaudianSettings.tslines 136-148) or by editing the JSON settings file directly - The
hasExcludedTag()method inFileContext.ts(lines 60-84) checks both front matter and inline tags against your exclusion list - Tag matching occurs during
autoAttachActiveFile()execution, which skips attachment if excluded tags are found - Manual attachment remains available through the chip UI even for excluded notes
Frequently Asked Questions
Where are excluded tags stored in Claudian?
Excluded tags persist in the plugin's JSON settings file as the excludedTags string array, defined in src/core/types/settings.ts and managed through ClaudianSettings.ts (lines 136-148). The array is accessed at runtime via plugin.settings.excludedTags and saved via the saveSettings() method.
Can I use nested tags like #work/confidential?
Yes. The hasExcludedTag() method in FileContext.ts strips the leading # character but preserves the full tag path. Include the complete nested tag (e.g., work/confidential) in your Excluded Tags settings, one per line, and the detection logic will match it against the cached metadata.
Does configuring excluded tags prevent manual attachment?
No. The exclusion logic only affects autoAttachActiveFile() in FileContext.ts. If a note carries an excluded tag, it will not auto-load into new chat sessions, but you can still manually attach it using the chip UI in the chat interface.
What happens if I add an excluded tag to a note that's already attached?
The exclusion check runs during the auto-attachment phase when files become active or sessions start. If a note is already attached to a chat and you later add an excluded tag, the current attachment remains until you switch files or start a new session, at which point the new tag will prevent re-attachment.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →