Skip to content

feat(obsidian-plugin): "New AI Session" command — scaffold session folder + apply template #30

Description

@bobthearsonist

Problem

Creating a new AI session note today is a manual ritual that has to be re-implemented everywhere it happens (Claude Code skill, manual Obsidian use, any future automation). The canonical convention is well-defined:

  • Folder: {ai_session_folder}/{YYYY-MM-DD} {topic}/
  • Summary file inside: {YYYY-MM-DD} {topic}.md populated from Templates/AISessionSummaryTemplate.md (frontmatter type: ai-session, schema: v2, context: <name>, tags: [ai-session, date/YYYY/MM/DD], plus a \``visual-notes ` codeblock for inline graph mounting)
  • Daily note cross-link: - [[{slug}]] under ## Sessions

But there's no plugin command for this. Templater's folder_templates could be configured for the AI Sessions folders, which would handle frontmatter on creation — but it wouldn't handle the parent folder, the slug computation, or the daily-note cross-link. And it would leak the convention into vault config rather than living in code.

The bridge that exists today is the obsidian-notes skill in bobthearsonist/ai-private (skills/obsidian-notes/SKILL.md) walking through the steps manually — which is fine for one consumer but doesn't scale to other entry points (mobile, manual UI use, future automations).

Proposal

Add a visual-notes:new-ai-session command (and a ribbon/palette entry) that:

  1. Prompts for topic (free text). Computes slug = {YYYY-MM-DD} {topic.toLowerCase().replace(/[\/\]/g, '-').trim()}.
  2. Resolves the active context:
    • If daily-context plugin is installed, read its contexts setting and pick a context — match against the current daily note's folder if open, else prompt with the available context IDs.
    • Otherwise fall back to a plugin setting (defaultAiSessionFolder).
  3. Creates the folder {ai_session_folder}/{slug}/ (auto-disambiguates with (2), (3) etc. on collision — propagated to both the folder name and the .md filename so they stay matched).
  4. Creates the summary file {slug}.md inside, populated from a configurable template (default: Templates/AISessionSummaryTemplate.md). Expand Templater placeholders if Templater is available; otherwise do a lightweight in-plugin substitution for <% tp.date.now(...) %> and <% tp.file.title %>. Set the frontmatter context: field to the resolved context (the current template hardcodes personal, which is wrong for any other context).
  5. Cross-links from today's daily note: append - [[{slug}]] under ## Sessions (create the heading if missing). Use the daily folder from the resolved context.
  6. Opens the new file (active leaf).

Settings

  • templatePath (default: Templates/AISessionSummaryTemplate.md)
  • defaultAiSessionFolder — fallback when daily-context isn't available
  • addDailyNoteCrossLink (default: true)
  • dailyNoteSectionHeading (default: ## Sessions)

Acceptance criteria

  • Command appears in palette as Visual Notes: New AI Session
  • Ribbon icon (optional, gated by setting)
  • Works when daily-context is installed (uses its contexts API)
  • Works when daily-context is absent (uses defaultAiSessionFolder)
  • Resolves and uses the correct context (not always 'personal')
  • Daily-note cross-link respects existing ## Sessions block; adds heading if missing
  • Collision disambiguation tested ( (2), (3), ...)
  • Opens the new file
  • Settings tab entry under the existing visual-notes settings

Out of scope

Why visual-notes is the right home

  • Already has session-related commands (extract-current-note, regenerate-current-note-force, pin/unpin-overview, delete-current-sidecar).
  • Already writes inside AI Sessions folders (sidecars).
  • The session template body includes a \``visual-notes ` codeblock — tight coupling with the renderer this plugin owns.
  • daily-context is a read-only context aggregator; bolting a write/create command onto it would expand its scope unnecessarily.

Related

  • ai-private obsidian-notes skill currently mentions template=AISessionSummaryTemplate explicitly — that line can be removed once this command lands.
  • ai-private local.yaml obsidian.contexts.<name>.ai_session_folders shape mirrors daily-context's data.json — consistent across all three places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions