memory-skill

Generates session memory, vector memory, and RAG patterns for AI agent platforms.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/tendercoconut174/ai-agent-platform --skill memory-skill-tendercoconut174
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: memory-skill
Source: https://github.com/tendercoconut174/ai-agent-platform/tree/main/.cursor/skills/memory-skill
Command: npx skills add https://github.com/tendercoconut174/ai-agent-platform --skill memory-skill-tendercoconut174

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building conversational AI agents requires persistent session memory, conversation history storage, and retrieval patterns, but implementing these correctly with database fallbacks and clean architecture is error-prone. This Skill provides the established patterns and design rules for session management, vector memory, and RAG in an AI agent platform. ## Core Features & Use Cases - Session Management: Implements PostgreSQL-backed session storage with SQLAlchemy ORM models (Session, MessageHistory) and automatic in-memory fallback when the database is unavailable. - Conversation History: Provides key functions like get_or_create_session, add_message, and get_history for managing multi-turn dialogue context. - Vector Memory & RAG Planning: Outlines the planned approach for embeddings, semantic search with pgvector, and retrieval-augmented generation with chunking and citation. - Use Case: When adding conversation history to a FastAPI gateway service, use this Skill to generate the session manager with PostgreSQL persistence, graceful in-memory fallback, and 50,000-character content truncation. ## Quick Start Use the memory skill to implement session management with PostgreSQL persistence and in-memory fallback for the gateway service.

Frequently Asked Questions about memory-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement session management for an AI chat agent?▼

Implement session management with a session manager module providing get_or_create_session, add_message, and get_history functions. Store sessions and message history in PostgreSQL using SQLAlchemy models, with an in-memory dict fallback when the database is unavailable.

How to store conversation history in PostgreSQL with SQLAlchemy?▼

Define Session and MessageHistory ORM models with a one-to-many relationship, storing role, content, and content_type per message. Use a sessions table and message_history table, truncating content to 50,000 characters before storage.

What is the RAG pattern for AI agents?▼

RAG involves chunking documents with overlap, embedding chunks into a vector store, retrieving top-k results by similarity at query time, injecting retrieved context into the agent prompt, and citing sources in the output.

Should agents query the database directly for conversation context?▼

No, agents should access conversation context through injected messages rather than querying the database directly. This keeps services stateless, with all state held in PostgreSQL or Redis.

What happens when PostgreSQL is unavailable for session storage?▼

The session manager falls back to in-memory dictionaries when PostgreSQL is unavailable. Database availability is checked once at startup and cached, so the service continues operating without persistent storage.