Inspiration

Reading and tracking dozens of blog posts to stay current is time-consuming, and finding that one article you vaguely remember is nearly impossible. We wanted to create an AI agent that beyond just searching content it actually remembers it, understands context across posts, and can reason about trends over time. MemMachine's episodic memory architecture was the perfect foundation to build a content analyst with true long-term memory.

What it does

Our AI-powered Substack agent automatically ingests RSS feeds and creates an intelligent, queryable knowledge base with persistent memory:

  • Automatic Ingestion: Processes entire Substack feeds, extracting clean content and metadata
  • Topic Extraction: Uses OpenAI to identify and categorize topics across all posts
  • Memory-Augmented Q&A: Answers natural language questions with synthesized responses and citations from actual posts
  • Trend Analysis: Identifies trending topics (rising coverage), evergreen topics (consistent presence), and topic evolution over time using exponential decay scoring
  • RESTful API: Provides /ingest, /ask, and /overview endpoints for programmatic access

Think of it as giving ChatGPT a perfect, searchable memory of your entire content library stored in a knowledge graph.

How we built it

Backend Architecture:

  • FastAPI - High-performance async REST API server
  • MemMachine - Graph-based episodic memory for persistent storage (Neo4j + PostgreSQL)
  • OpenAI GPT-5 - Question answering and topic extraction
  • Python 3.13 - Async/await throughout for efficient I/O
  • Docker - Containerized MemMachine deployment with docker-compose

Integration Pattern:

  • RSS feed parsing with feedparser and content extraction via trafilatura
  • Direct REST API integration with MemMachine for maximum control
  • Proper handling of MemMachine's session/group/agent architecture for multi-tenant memory
  • In-memory filtering for metadata queries (MemMachine filters don't support custom metadata)

Challenges we ran into

Docker Container Networking: One challenge was MemMachine's Neo4j connection. The default configuration used localhost:7687, which failed because Docker containers use isolated networks. We identified that the configuration needed memmachine-neo4j (the container name) instead of localhost. We've suggested this as a default configuration update to the MemMachine team.

API Response Structure: MemMachine returns a nested structure {content: {episodic_memory: [short_term[], long_term[]]}} that wasn't initially documented. We had to reverse-engineer the response format by inspecting actual API calls.

Metadata Filtering: MemMachine's filter parameter in SearchQuery doesn't work for custom metadata fields—it returned 0 results when filtering by feed_id. We solved this by removing filters from the API call and implementing efficient in-memory filtering after retrieval.

Timezone-Aware Comparisons: Python's datetime comparison failed when mixing offset-naive and offset-aware datetimes from MemMachine's ISO timestamps.

Accomplishments that we're proud of

Fully Functional Memory Integration: Successfully integrated MemMachine's episodic memory via REST API with proper session management

Real-Time Q&A with Citations: The system retrieves relevant context from 20+ blog posts and generates coherent answers with accurate source citations

Trend Analysis Algorithm: Implemented exponential decay scoring (45-day half-life) to identify rising vs. evergreen topics across time windows

Production-Ready API: Clean REST endpoints with proper error handling, async operations, and comprehensive testing

Contributing Back: Identified and documented configuration improvements for the MemMachine project (localhost → container name fix)

What we learned

Memory-Augmented AI is Powerful: Having persistent, queryable episodic memory transforms an LLM from a stateless responder to a knowledgeable analyst that can reason across dozens of documents.

Graph Databases for Context: Neo4j's graph structure makes it natural to represent relationships between posts, topics, and temporal patterns—much more intuitive than vector search alone.

Async Python is Worth It: Using async/await throughout made handling multiple concurrent ingestion tasks and API calls dramatically more efficient.

What's next for AI-powered blog analyst with long-term memory

Interactive Web UI: Develop a React-based frontend that leverages our FastAPI server, featuring:

  • Live chat interface for natural language queries
  • Visual topic trend dashboards with time-series graphs
  • Feed management and ingestion controls
  • Citation cards that link directly to source articles

Website Integration: Embed the chat interface directly into the Trilogy AI Center of Excellence website, allowing visitors to instantly query our entire blog archive.

Multi-Feed Support: Extend beyond single feeds to aggregate and cross-reference content from multiple sources, enabling comparative analysis.

Profile Memory Integration: Leverage MemMachine's profile memory to learn user preferences and personalize content recommendations.

Daily Updates: Implement scheduled ingestion to automatically process new posts as they're published.

Built With

Share this project:

Updates