Skip to content

trilogy-group/ai-coe-mem

Repository files navigation

MemMachine Substack Agent

A chat-based agent for analyzing Substack RSS feeds using MemMachine as the AI memory layer.

Overview

This agent ingests Substack posts, extracts topics using OpenAI, stores them in MemMachine's episodic memory, and provides a question-answering interface with citations.

Status: 🚧 Under active development

Features

  • ✅ RSS feed ingestion from Substack
  • ✅ Content extraction and cleaning
  • ✅ Topic extraction using OpenAI
  • ✅ Episodic memory storage via MemMachine REST API
  • ✅ Question answering with citations
  • ✅ FastAPI REST API

Prerequisites

  • Python 3.12+
  • MemMachine running at http://localhost:8080 (default)
  • OpenAI API key

Quick Start

1. Clone and Setup

git clone https://github.com/trilogy-group/ai-coe-mem.git
cd ai-coe-mem

# Install dependencies
make setup

# Edit .env with your OpenAI API key
nano .env

2. Configure Environment

Copy .env.example to .env and configure:

# Application settings
APP_PORT=8088
FEED_URL=https://trilogyai.substack.com
MEM_GROUP_ID=feed:trilogyai

# MemMachine REST API URL
MEMMACHINE_BASE_URL=http://localhost:8080

# OpenAI API Key (required)
OPENAI_API_KEY=sk-your-actual-key-here

3. Run the Application

make run

The API will be available at http://localhost:8088

API Endpoints

Health Check

curl http://localhost:8088/health

Root Information

curl http://localhost:8088/

Coming Soon

  • POST /ingest - Ingest posts from RSS feed
  • GET /overview - Get overview of topics and trends
  • POST /ask - Ask questions about the feed

Development

Project Structure

ai-coe-mem/
├── app/
│   ├── main.py              # FastAPI application
│   ├── settings.py          # Configuration
│   ├── mem/                 # MemMachine integration
│   ├── ingest/              # RSS ingestion (coming soon)
│   ├── analysis/            # Topic analysis (coming soon)
│   ├── agent/               # Q&A agent (coming soon)
│   └── web/                 # API routers (coming soon)
├── tests/                   # Test suite
├── requirements.txt         # Python dependencies
├── Makefile                 # Automation commands
└── README.md

Running Tests

make test

MemMachine Integration

This agent uses MemMachine's REST API for memory operations:

  • Episodic Memory: Stores full post content with metadata
  • Query API: Retrieves relevant posts for answering questions

Dependencies

Key dependencies:

  • FastAPI: Web framework
  • httpx: HTTP client for MemMachine REST API
  • OpenAI: Topic extraction and narrative generation
  • feedparser: RSS parsing
  • trafilatura: Content extraction

See requirements.txt for complete list.

Status & Roadmap

✅ Completed

  • Project structure
  • MemMachine REST API client
  • FastAPI application skeleton
  • Configuration management
  • Episodic memory integration

🚧 In Progress

  • RSS ingestion pipeline
  • Topic extraction with OpenAI
  • API routers (ingest, overview, ask)
  • Q&A agent with citations

Note: This is a work in progress. The core infrastructure is in place, and we're actively implementing the business logic.

About

AI Center of Excellence Memory POC

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors