← Back to articles

Template Systems - Templater vs AI Agent Creation

Path: Computer Tech/Productivity/Obsidian/Template Systems - Templater vs AI Agent Creation.mdUpdated: 2/3/2026

Template Systems - Templater vs AI Agent Creation

The Problem

Obsidian templates can use Templater plugin syntax for dynamic values:

yaml
created: 2025-11-08T14:16:32-0800
slug: 62640192818

This works great when YOU create files in Obsidian, but AI agents creating files via terminal/API see these as literal text, not executable code.

How It Works

Templater Plugin (Manual Creation)

When you use it:

  1. Install Templater plugin in Obsidian
  2. Settings β†’ Templater β†’ Template folder location: _templates
  3. Create new note β†’ Select template
  4. Templater processes the 2025-11-08 tags and replaces them with actual values

Result:

yaml
created: 2025-11-08T14:15:47-0800  # βœ… Calculated!
slug: bfwqwoblqzz                   # βœ… Generated!

AI Agent Creation (Programmatic)

When AI creates files directly:

  1. AI reads template file (sees 2025-11-08)
  2. AI writes new file with that literal text
  3. Obsidian opens the file and sees 2025-11-08T14:16:32-0800 as plain text

Result:

yaml
created: 62640192818  # ❌ Not processed!
slug: for16pmt                  # ❌ Still a tag!

Why: Templater only runs when triggered by:

  • Creating new note from template in Obsidian
  • Using Templater command palette actions
  • Templater hotkeys

It does NOT run on:

  • Files created by external scripts
  • Files created by AI agents
  • Files created via terminal commands
  • Files synced from other sources

Solutions

Solution 1: AI Agents Calculate Values

How it works:

  • AI agents detect Templater syntax in templates
  • AI calculates the values themselves
  • AI writes files with actual values (not tags)

Pros: βœ… Files work immediately when created βœ… No manual processing needed βœ… Consistent results across creation methods

Cons: ❌ AI must understand Templater syntax ❌ Duplicate logic (Templater + AI both calculate dates)

Implementation: Update AGENTS.md with instructions:

When using templates from _templates/ directory:
1. Read the template file
2. Replace Templater syntax with calculated values:
   - 62640192819 β†’ current Pacific time
   - 2025-11-08T14:16:32-0800 β†’ random 11-char slug
3. Write the file with processed values

Solution 2: Dual Template System

How it works:

  • Create two versions of each template:
    • Feature Guide.md (with Templater syntax - for humans)
    • Feature Guide AI.md (with placeholder text - for AI agents)

Pros: βœ… Clear separation of concerns βœ… Each system uses optimal format βœ… No syntax parsing needed

Cons: ❌ Duplicate templates to maintain ❌ Easy to update one but forget the other ❌ More files in _templates/ directory

Example AI template:

yaml
created: YYYY-MM-DDTHH:MM:SS-0800
updated: YYYY-MM-DDTHH:MM:SS-0800
slug: random11char

AI agents recognize placeholders and replace them.

Solution 3: Post-Processing with Templater

How it works:

  1. AI creates file with Templater syntax intact
  2. Manually run Templater command on the file
  3. Templater processes the tags

Pros: βœ… Single source of truth (one template) βœ… Templater does what it's good at

Cons: ❌ Manual step required after AI creation ❌ Easy to forget ❌ File isn't "complete" until you process it

Implementation: After AI creates file:

  1. Open file in Obsidian
  2. Command Palette β†’ "Templater: Replace templates in the active file"
  3. Templater processes all 2025-11-08T14:16:32-0800 tags

Solution 4: Hybrid Templates (Recommended)

How it works:

  • Use Templater syntax in templates
  • AI agents have smart replacement rules
  • Humans can use Templater normally

Template format:

yaml
created: 62640192819
updated: 2025-11-08T14:16:32-0800
slug: 62640192819

AI agent rules (in AGENTS.md):

When reading templates, replace Templater syntax:
- 2025-11-08T14:16:32-0800 
  β†’ Current Pacific time in ISO 8601 format
  
- 62640192819 
  β†’ Generate random lowercase alphanumeric, 11 characters
  
- Leave other Templater syntax as-is if you don't understand it

Pros: βœ… Single template system βœ… Works for both humans and AI βœ… Graceful degradation (unknown syntax stays as placeholder)

Cons: ❌ AI needs explicit documentation of each Templater pattern ❌ New Templater features require AGENTS.md updates

Recommendation for midimaze

Use Solution 4 (Hybrid) with these specific rules:

1. Template Format

Keep Templater syntax in _templates/ files (already done).

2. Update AGENTS.md

Add section documenting Templater syntax replacement:

markdown
## Templater Syntax Replacement

When creating files from `_templates/` directory, replace these patterns:

| Templater Syntax | Replacement Logic |
|------------------|-------------------|
| `2025-11-08T14:16:32-0800` | Current Pacific Time (ISO 8601) |
| `2025-11-08T14:16:32-0800` | Random 11-char slug (lowercase alphanumeric) |

**Example:**
- Template has: `created: 62640192819`
- AI writes: `created: 2025-11-08T14:15:47-0800`

3. Validation

After AI creates file, check:

  • βœ… No Template Systems - Templater vs AI Agent Creation tags remain in frontmatter
  • βœ… Dates are actual timestamps
  • βœ… Slugs are 11-character random strings

Common Patterns

Date/Time Generation

Templater:

undefined

AI equivalent (bash):

bash
date +"%Y-%m-%dT%H:%M:%S-0800"

Random Slug Generation

Templater:

undefined

AI equivalent (bash):

bash
cat /dev/urandom | LC_ALL=C tr -dc 'a-z0-9' | head -c 11

File Title

Templater:

undefined

AI equivalent: Extract from filename without .md extension.

Testing Template Compatibility

Manual Test (Templater)

  1. Create new note in Obsidian
  2. Insert template
  3. Verify values are calculated

AI Test (OpenCode)

  1. AI reads template
  2. AI processes Templater syntax
  3. AI writes file with actual values
  4. Open in Obsidian and verify

Both should produce identical frontmatter structure (different values, same format).

Future Considerations

As Templater evolves or you add new template syntax:

  1. Document in AGENTS.md immediately
  2. Test with AI agent to ensure it can process
  3. Update this article with new patterns

Consider creating a "Templater Syntax Reference" section in AGENTS.md that serves as the canonical mapping between Templater code and AI replacement logic.

Related

  • Managing Long Frontmatter - Why strict frontmatter schemas matter
  • AGENTS.md - Agent instructions for template processing
  • _Nakul/5. Coding Actions/midimaze/Article Structure Patterns.md - Pattern documentation