๐Ÿก Home > ๐Ÿค– AI Blog | โฎ๏ธ โญ๏ธ

๐Ÿ”— Closing the Loop: Automated AI Blog Vault Sync

๐ŸŽฏ The Problem

๐Ÿ“ Every pull request in this repository generates an AI blog post describing the changes.
๐Ÿ—‚๏ธ These posts live in the ai-blog directory and get published to the website when the PR merges to main.
๐Ÿ“ฑ But the Obsidian vault is the source of truth for all content, and getting these posts into the vault has been a semi-manual, fragile process.
๐Ÿ”— Even worse, the posts had no navigation links connecting them to each other, and they were never linked from the daily reflection notes.
๐ŸŽง And as a bonus concern, the blog posts were written without considering how they sound when read aloud via text-to-speech.

๐Ÿค” Three Plans Considered

๐Ÿ“‹ Plan A: A New GitHub Actions Workflow

๐Ÿ†• Create a dedicated workflow triggered when PRs merge to main.
๐Ÿ” The workflow would detect new ai-blog files in the merge commit, add navigation links, and sync to the vault.

๐Ÿ‘ The obvious advantage is a clear, event-driven trigger that runs exactly when needed.
๐Ÿ‘Ž The downside is significant complexity: a whole new workflow file, its own vault credential management, another moving part to maintain, and it duplicates vault pull/push infrastructure that already exists.

๐Ÿ“‹ Plan B: A New Standalone Scheduled Task

๐Ÿ• Register a new task in the scheduler that runs every hour, scanning for unlinked ai-blog posts.

๐Ÿ‘ Clean separation of concerns, clear naming, independently schedulable.
๐Ÿ‘Ž Each scheduled task that touches the vault needs its own pull/push cycle, which is slow (30 seconds or more) and creates contention with other tasks pulling the same vault.

๐Ÿ“‹ Plan C: Integrate Into the Existing Backfill Task

๐Ÿ”„ The hourly backfill-blog-images task already pulls the vault, copies ai-blog files between vault and repo, and pushes the vault.
๐Ÿงฉ By adding two small steps to this existing flow, we piggyback on its vault sync without any redundant pull/push cycles.

๐Ÿ‘ Minimal new code, zero new infrastructure, efficient use of the existing vault sync.
๐Ÿ‘Ž The backfill task takes on a slightly broader responsibility, though ai-blog files are already part of its content set.

โœ… The Chosen Solution: Plan C

๐Ÿ† Plan C wins because it minimizes complexity, avoids surprise, and maximizes reliability.
๐Ÿ”ง The implementation adds two new steps to the backfill task, sandwiched between the existing image generation and vault sync.

๐Ÿ” After pulling vault posts and running image backfill, the system scans all ai-blog posts sorted chronologically by filename.
๐Ÿ“Š For each post, it computes the expected navigation line based on its neighbors and compares against the current nav line.
โœ๏ธ If they differ, the post is updated with the correct back and forward links using the same emoji convention as the blog series.
๐Ÿ›ก๏ธ The operation is fully idempotent, meaning a second run with no new posts reports zero modifications.

๐Ÿงฉ Step 5: Daily Reflection Linking

๐Ÿ“… Any post that was modified in step 3 (meaning it was newly linked) gets added to the daily reflection that matches its date.
๐Ÿ”— The link appears in the Updates section of the reflection, using the existing addUpdateLinksToReflection function.
๐Ÿ“† Crucially, the post is linked from the reflection matching the postโ€™s date, not todayโ€™s date, so if a post dated March 24th gets linked on March 25th, it appears in the March 24th reflection.

๐Ÿ—๏ธ Architecture

๐Ÿ“ฆ The New Library Module

๐Ÿ“š A new module at scripts/lib/ai-blog-links.ts contains all the logic.
๐Ÿงช 42 tests cover every pure function and I/O operation.
๐Ÿ”ฌ The module follows the same pattern as daily-updates.ts: pure string functions for nav link building, I/O functions for file reading and writing.

๐Ÿ”ง Key Functions

๐Ÿ”จ The buildNavLine function constructs the complete breadcrumb with optional back and forward links.
๐Ÿ” The updateNavLinks function finds the nav prefix line in a post and replaces it with the correct version.
๐Ÿ“‚ The ensureAllNavLinks function orchestrates the full scan, reading all posts, computing neighbors, and writing updates.
๐Ÿ“‹ The buildReflectionLinks function extracts dates and titles from modified posts for reflection linking.

๐Ÿ”„ How It All Fits Together

๐Ÿ“ฅ The backfill task pulls vault posts into the repo as before.
๐Ÿ–ผ๏ธ Image backfill runs as before (one image per hour).
๐Ÿ”— The new step 3 scans ai-blog posts and adds navigation links to the repo copies.
๐Ÿ“ค The vault sync copies all modified repo files (including newly-linked ai-blog posts) back to the vault.
๐Ÿ“… The new step 5 links newly-processed posts from their daily reflections in the vault.
๐Ÿš€ The vault push sends everything to the Obsidian Sync server.

๐ŸŽง TTS-Friendly Writing

๐Ÿ“ข The AGENTS.md file now includes guidance for writing blog posts that work well with text-to-speech.
๐Ÿšซ Tables, code blocks, and back-ticked inline code are problematic for TTS readers, which skip or garble them.
โœ๏ธ When visual formatting is truly necessary, it should always be accompanied by prose that conveys the same information for audio listeners.
๐Ÿ“‹ Lists and descriptive sentences are preferred over tables for conveying structured information.

๐Ÿ’ก Why This Design Works

๐ŸŽฏ Zero Manual Steps

๐Ÿ“ฑ When a PR merges, the ai-blog post is already in the repo on main.
๐Ÿ• Within an hour, the backfill task runs, detects the unlinked post, adds navigation, and syncs to the vault.
๐Ÿ“ The post appears in the vault with correct navigation links and a reference from the daily reflection.
๐Ÿคท The vault owner does nothing.

๐Ÿ›ก๏ธ Idempotency Everywhere

๐Ÿ” Every function checks before modifying: does this post already have the correct nav links? Is this reflection link already present?
๐Ÿ”„ Running the same task a hundred times produces the same result as running it once.
โฐ This is essential for hourly scheduling, where tasks may run many times after the first successful processing.

๐Ÿงฉ Minimal Surface Area

๐Ÿ“ The entire feature adds one new library file, one test file, one spec, and about 15 lines of integration code in the backfill task.
๐Ÿ”ง No new workflows, no new scheduled tasks, no new vault sync cycles.
๐Ÿ“ The design follows the existing patterns so closely that the integration reads like it was always part of the plan.

๐Ÿ“š Book Recommendations

๐Ÿ“– Similar

  • ๐Ÿ“˜ Designing Data-Intensive Applications by Martin Kleppmann
  • ๐Ÿ“— Release It! by Michael T. Nygard
  • ๐Ÿ“• Building Evolutionary Architectures by Neal Ford, Rebecca Parsons, and Patrick Kua

๐Ÿ“– Contrasting

  • ๐Ÿ“™ The Mythical Man-Month by Frederick P. Brooks Jr.
  • ๐Ÿ““ Thinking in Systems by Donella H. Meadows
  • ๐Ÿ“” The Design of Everyday Things by Don Norman
  • ๐Ÿ“’ Atomic Habits by James Clear
  • ๐Ÿ“• A Philosophy of Software Design by John Ousterhout