AI Blog Generator
A context-first technical writing system that turns GitHub repositories into code-referenced blog posts with AI agents, drift detection, and version history.
Overview
The AI Blog Generator focuses on keeping generated technical writing grounded in source code. It pre-loads repository structure ('The Map') and user-selected files before generation, lets the writer agent request additional files through tools, and stores the referenced file state so authors can later compare snapshots against the current GitHub repository. The pipeline includes writer, reviewer, refiner, and prompt-refiner agents, plus diagram tokenization so refinement passes do not damage generated media.
Technical Stack
Next.js 16 (App Router)
React 19
TypeScript
PostgreSQL (Neon) & Drizzle ORM
Key Features
- Blog Writer: Primary generator using AI SDK 7 ToolLoopAgent for dynamic file reading and diagram creation.
- Blog Reviewer Agent: Automated QA step that checks formatting and auto-fixes broken links or code blocks.
- Blog Refiner Agent: Improves existing content while preserving diagram tokens via tokenization pipeline.
- Prompt Refiner Agent: Transforms rough ideas into detailed, actionable blog specifications (~150 words).
- Structured JSON output converted to Markdown with embedded diagrams and code references.
- Discovery Grid & Sequential Navigation with intelligent 'Card Wins' de-duplication logic.
- AI-powered semantic search via /api/blog/search with Gemini model cascade and text fallback.
- URL state synchronization for blog filters (search, tags, repo, sort) for deep linking.
- Performance-first rendering using Next.js Static Site Generation (SSG) with generateStaticParams.
Architectural Highlights
- Context-first architecture pre-loads 'The Map' (repo tree) and user-selected files before AI generation.
- Multi-agent pipeline with specialized agents for writing, refinement, and prompt optimization.
- Tokenization system (<<<DIAGRAM:uuid>>>) protects diagram assets during AI refinement passes.
- Drift detection comparing stored file SHAs with live GitHub state for documentation accuracy.
- Version manager with auto-pruning at 50 versions, pinning support, and protected change types.
- Inngest background jobs with Redis-backed progress tracking and atomic database transactions.
- GDPR-compliant email subscription with double opt-in, anti-enumeration, and batch notifications.
- Gemini-powered semantic search with automated model cascading and long-term caching.
- AI SDK tool system enabling agents to read files, generate diagrams, and create tags on-demand.
Project Status
- Full blog generation pipeline with multi-agent architecture (Writer + Reviewer).
- Context loading system with repository tree and file pre-loading.
- Automatic quality gates with reviewer agent auto-fixing common issues.
- Three diagram modes: AI images, Mermaid code, and hybrid selection.
- Version control with history timeline, pinning, and auto-pruning.
- Drift detection with SHA comparison and commit history.
- Monaco split-pane editor with live preview and diff viewing.
- Background job processing with real-time progress tracking.
- AI-powered semantic search with automatic fallback and deep-linkable URLs.
- Tag generation and management with AI suggestions.