AI Blog Generator
A context-first blog generation system with multi-agent AI pipeline, drift detection, and version control for technical writing.
Overview
The AI Blog Generator addresses the challenge of creating accurate, code-referenced technical content by implementing a context-first architecture. It pre-loads repository structure ('The Map') and user-selected files before generation, enabling the AI to write with full codebase awareness. The multi-agent pipeline (Blog Writer, Blog Refiner, Prompt Refiner) ensures high-quality output, while drift detection alerts authors when referenced code changes, maintaining documentation accuracy over time.
Technical Stack
Next.js 16 (App Router)
React 19
TypeScript
Vercel Neon Postgres with Drizzle ORM
Key Features
- Blog Writer: Primary generator using AI SDK 6 ToolLoop 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 6 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.