An Architecture for Personal AI: Combining Semantic Search and Structured Metadata Analysis
Estevão Machado

Estevão Machado @lord_magus

About: I'm a full stack web developer who likes to write clean and organized code. I read a lot of "Best Practices", "Patterns" and "Refactoring" articles and books. Currently addicted to AI development.

Location:
Brisbane, Australia
Joined:
Apr 20, 2025

An Architecture for Personal AI: Combining Semantic Search and Structured Metadata Analysis

Publish Date: Jun 28
2 1

Abstract

Digital knowledge bases, from personal journals to enterprise wikis, often suffer from a common flaw: they become write-only archives where information is difficult to retrieve and impossible to analyze systematically. Standard keyword search fails to capture context, while valuable metadata remains siloed and unqueried. This article presents a dual-system architecture that addresses these challenges by combining Retrieval-Augmented Generation (RAG) for semantic search with structured metadata analysis. We detail this architecture, present a reference implementation built with open-source tools, and explore its broader implications for the future of local-first, personal AI systems.


The Challenge: From Data Graveyard to Dynamic Intelligence

For decades, the promise of the "personal knowledge base" has been to create a second brain—a perfect, searchable repository of our thoughts, learnings, and experiences. In reality, most attempts result in a data graveyard. The core problem is twofold:

  1. Unstructured Data: The narrative content of our notes is rich with context, but traditional search tools are poor at understanding intent. A search for "productivity" might miss a key entry about "deep work" or "flow states."

  2. Structured Data: Metrics we might track—mood, project status, sleep quality, code commits—are often embedded in templates or YAML frontmatter. This data is highly valuable for trend analysis but is typically invisible to the primary search function.

A truly intelligent system must be able to query both. It needs to understand the meaning of the text and analyze the metrics surrounding it.

The Dual-System Architecture

The solution lies in a composable architecture that treats unstructured and structured data as two equally important pillars. Our proposed system consists of two core components, served via the Model Context Protocol (MCP) that allows an AI model to intelligently choose the right tool for a given query.

Component 1: Semantic Search via RAG

This component addresses the unstructured data problem using vector embeddings to create a mathematical representation of the meaning of each journal entry or document.

Function: When a user asks "What have I learned about project management?", the system doesn't just look for keywords. It searches for documents that are semantically related to the query's concept.

Technology: This is achieved using a Retrieval-Augmented Generation (RAG) pipeline, which finds relevant text chunks and provides them as context to a large language model (LLM).

Component 2: Structured Data Analysis via Frontmatter

This component unlocks the potential of metadata by enforcing a simple schema within each document's YAML frontmatter, creating a queryable time-series database.

---
date: 2025-06-29
mood: 8
anxiety: 3
weight_kg: 70
sleep_hours: 7.5
exercise_minutes: 30
---
Enter fullscreen mode Exit fullscreen mode

Function: This enables queries like "Chart my mood trends over the last quarter" or "Identify correlations between my sleep duration and anxiety levels."

Technology: A dedicated MCP server parses all frontmatter blocks, aggregates the data, and performs statistical analysis or generates visualizations.

Technical Architecture

Here's how the complete system works together:

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│                 │    │   MCP Servers    │    │  Your Journal   │
│   Rovo Dev CLI  │◄──►│  - RAG Search    │◄──►│  - .md files    │
│                 │    │  - Frontmatter   │    │  - Frontmatter  │
└─────────────────┘    └──────────────────┘    └─────────────────┘
         │                       │                       │
         │                       │                       │
         ▼                       ▼                       ▼
┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│  Conversations  │    │  Vector Database │    │   Local Files   │
│  (Cloud/Claude) │    │    (ChromaDB)    │    │    (Private)    │
└─────────────────┘    └──────────────────┘    └─────────────────┘
Enter fullscreen mode Exit fullscreen mode

Privacy Model:

  • Local: Journal files, search index, frontmatter analysis
  • ☁️ Cloud: Only your conversations with the AI

This architecture provides a robust balance of privacy and performance. User data remains on the local machine by default, with only the relevant context and queries sent to cloud APIs.

Case Study: A Reference Implementation

To validate this architectural pattern, we developed a reference implementation using the following stack:

  • CLI Interface: Atlassian's Rovo Dev, selected for its native MCP support and access to state-of-the-art Claude models
  • LLM: The Claude Sonnet 4, which exhibits strong performance in conversational analysis, complex reasoning, and tool use
  • Open-Source Backend: Our MD RAG MCP repository, featuring two Python-based MCP servers for RAG (ChromaDB) and frontmatter analysis (Pandas)

The free tier offered by Rovo Dev (20 million tokens daily) significantly lowers the barrier to entry for developers wishing to replicate this system.

System in Action: Practical Examples

The following are real queries executed on the reference implementation, demonstrating the synergy of the dual-system architecture.

Example 1: Semantic Query

Query: "What programming languages am I studying?"

AI Response:

> what programming languages am I studying?
  └── Calling query_journal: {"query": "programming languages studying learning", "n_results": 10}

  [{'source': 'topics/tech/2025_06_06_rust_wasm_browser_game_plan.md', 'date': 'Unknown date', 'text': '## Learning...


╭─ Response ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Based on your journal entries, you're currently studying two main programming languages:                             │
│                                                                                                                      │
│                                                                                                                      │
│                                                  Go (Primary Focus)                                                  │
│                                                                                                                      │
│  • Current Status: Actively learning through a 4-hour tutorial (completed nearly an hour)                            │
│  • Motivation: "I really like the lack of classes and hierarchy. I love Structs and composition. I really like       │
│    interfaces. I also like the := syntax"                                                                            │
│  • Learning Plan: learn Go → replace frontmatter MCP → replace personal website backend from Rails to Go             │
│  • Recent Progress: Working on slices, discovered Go's minimalist philosophy (only for loops, even for infinite      │
│    loops!)                                                                                                           │
│  • Practical Project Ideas: Blog with Go backend + SQLite, Go+htmx or Go+Svelte combinations                         │
│                                                                                                                      │
│                                                                                                                      │
│                                           Rust (Secondary/Evening Project)                                           │
│                                                                                                                      │
│  • Status: Started studying, has structured 16-week learning plan                                                    │
│  • Goal: Learn Rust → WASM → Guardian Heroes-style browser game                                                      │
│  • Learning Plan: Phase 1 (Weeks 1-3) covering fundamentals, ownership, borrowing                                    │
│  • Intermediate Project: Dashboard for frontmatter data analysis (before jumping to game development)                │
│  • Setup Complete: rustc 1.87.0, cargo 1.87.0, rustup 1.28.2 installed                                               │
│                                                                                                                      │
│ Current Challenge: You mentioned feeling like you've learned "everything I wanted to learn" recently, and these      │
│ languages feel "secondary" without urgent use cases. The main motivation now is avoiding doomscrolling during free   │
│ time since you don't play games anymore.                                                                             │
│                                                                                                                      │
│ Perfect example for the blog post! 🎯                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  └── Calling find_and_replace_code: {"file_path": "journal/2025/06/28.md", "find": "**RAG Query Test (9:00 PM):** Te...
Enter fullscreen mode Exit fullscreen mode

Example 2: Structured Data Visualization

Query: "Create an ASCII graph of my sleep hours in June"

AI Response:

Sleep Hours Per Night - June 2025
Average: 9.0 hours | Min: 6.0 hours | Max: 12.5 hours

12.5h ┤                                        ●                    
12h   ┤      ●                       ●                             
11h   ┤                        ●                                      
10.5h ┤          ●                           ●                       
10h   ┤                                          ●   ●   ● ●     
9.5h  ┤●                                                             
9h    ┤        ●           ● ●                               ●              
8.5h  ┤                                    ●       ●    ●  
8h    ┤  ●                         ●     ●                             
7.5h  ┤                          ●     ●                           
7h    ┤            ● ● ● ●                                           
6h    ┤    ●                                                         
      └┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─
       1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930
Enter fullscreen mode Exit fullscreen mode

Example 3: Graphical Data Analysis

The system can also generate and save graphical plots for more complex data analysis.

Query: "Create a plot graph of my historical weight loss"

AI Response:
(Generates and saves the following image)

Plot Graph of Historical Weight

Implementation Guide

The open-source repository includes automated setup scripts for multiple platforms:

Step 1: Install Rovo Dev

Follow the official Atlassian Community guide for your operating system.

Step 2: Clone and Setup

git clone https://github.com/estevaom/md-rag-mcp.git
cd md-rag-mcp

# Choose your platform:
./setup_mac_environment.sh        # macOS
./setup_ubuntu_environment.sh     # Ubuntu/Debian/WSL  
./setup_arch_environment.sh       # Arch Linux
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure MCP Integration

acli rovodev mcp  # Opens configuration file
# Copy contents from mcp.json.template
# Replace ${PROJECT_ROOT} with your absolute project path
Enter fullscreen mode Exit fullscreen mode

Step 4: Create AI Persona

Create a .agent.md file defining how the AI should interact with your journal. The repository includes guidance for creating effective therapeutic companion personas.

Step 5: Begin Journaling

acli rovodev
Enter fullscreen mode Exit fullscreen mode

Image description

Your AI companion now has full access to both semantic search and structured data analysis capabilities.

Architectural Flexibility and Alternative Tooling

The power of this approach lies in the architecture, not specific tools. The MCP protocol acts as a standardized interface, allowing components to be swapped:

Alternative AI Platforms

  • Google Gemini CLI: Free alternative with direct Gemini model access (though weaker tool-use capabilities)
  • Local LLMs: Complete privacy via Ollama + Cline/Roo Code (requires significant compute resources)
  • Cursor IDE: Excellent for development workflows, includes Claude Sonnet 4 access with subscription

Extensibility

The MCP architecture enables easy addition of new capabilities:

  • Web browsing during journaling sessions
  • Integration with external APIs
  • Custom analysis tools for specific domains

Real-World Impact: Measured Results

Since implementing this system, quantifiable improvements in journaling practice include:

Consistency Metrics

  • Daily engagement: From sporadic entries to consistent daily journaling
  • Entry depth: Average entry length increased 3x due to AI-guided reflection

Pattern Recognition Capabilities

  • Trigger identification: Automated detection of anxiety correlations previously unnoticed
  • Progress tracking: Data-driven insights into personal goal advancement
  • Historical context: AI connects current challenges with past solutions

Actionable Intelligence

  • Mood correlation analysis: "Your mood tends to drop when you skip exercise"
  • Pattern alerts: "You've written about this challenge before - here's what worked"
  • Predictive insights: "Your anxiety patterns suggest you might benefit from..."

Broader Implications: The Future of Personal AI

This system exemplifies several critical trends in applied AI:

Local-First Architecture

User data sovereignty is maintained while leveraging cloud AI capabilities. This hybrid approach provides optimal balance of privacy, performance, and functionality.

Composable Intelligence

Rather than monolithic AI solutions, the future lies in specialized, interoperable tools orchestrated to solve complex problems. Each component excels in its domain while contributing to emergent system capabilities.

Democratized Access

Open-source components combined with free-tier APIs enable individual developers to build sophisticated AI systems previously available only to large organizations.

Purpose-Built Solutions

Domain-specific AI applications outperform generic chatbots by incorporating specialized knowledge, custom workflows, and targeted optimization.

Conclusion

The dual-system architecture of combined semantic search and structured metadata analysis represents a significant advancement beyond simple note-taking or basic RAG implementations. It transforms static knowledge bases into dynamic, queryable analytics engines capable of surfacing insights invisible to traditional approaches.

By understanding both narrative content and quantitative patterns within our records, we unlock deeper self-awareness, identify hidden correlations, and build truly personal AI companions for knowledge work and self-improvement.

The open-source system detailed here serves as a practical blueprint for developers and organizations pioneering this next generation of intelligent applications. The architecture is proven, the tools are accessible, and the potential for personal transformation is profound.

The future of personal AI is not about replacing human insight—it's about augmenting our capacity for self-reflection, pattern recognition, and growth. This system provides the foundation for that future, available today.


Implementation Resources:

Tags: #AI #Architecture #PersonalAI #RAG #MCP #OpenSource #LocalFirst #KnowledgeManagement

Comments 1 total

  • Jomar Machado
    Jomar MachadoJun 28, 2025

    This article offers a remarkably insightful and timely exploration into the burgeoning field of AI journaling. The author effectively articulates the transformative potential of artificial intelligence in personal reflection, presenting a clear and compelling vision of how technology can enhance self-awareness and well-being. The piece is well-structured, engaging, and thoughtfully considers both the opportunities and nuances of this innovative trend. A highly recommended read for anyone interested in the future of personal development and AI.

Add comment