Cognitive Architecture
Purpose: Patterns for the cognitive components of AI agents: Memory, Knowledge (RAG), and Reasoning.
When to Use This Skill
- •Designing Memory Systems (Conversation history, User profiles, Entity tracking).
- •Building RAG Pipelines (Chunking, Embedding, Retrieval, Reranking).
- •Managing Agent State across sessions.
- •Selecting Vector Databases for knowledge retrieval.
Table of Contents
Cognitive Components
A complete agent "brain" consists of three layers:
- •Context (Short-term Memory): The active context window (conversation history).
- •Knowledge (Long-term Memory/RAG): Static facts retrieved from vector stores or databases.
- •State (Episodic Memory): Structured data about the user or task progress persisted indefinitely.
Scripts
| Script | Purpose | Usage |
|---|---|---|
scaffold-cognitive.py | Scaffold RAG pipeline and/or Memory system modules | python scaffold-cognitive.py --name my-agent --component all |
Options:
- •
--component rag— RAG only (ingestion + retrieval + tests) - •
--component memory— Memory only (short-term + long-term + tests) - •
--component all— Both (default) - •
--vector-store azure-ai-search— Use Azure AI Search instead of ChromaDB
Reference Patterns
| Pattern | Description | File |
|---|---|---|
| RAG Pipeline | Standard for ingesting and retrieving knowledge. | pattern-rag-pipeline.md |
| Memory System | Schema for short-term and long-term memory. | pattern-memory-systems.md |
Troubleshooting
| Issue | Solution |
|---|---|
| Hallucinations | Increase retrieval "groundedness" threshold or reduce top_k. |
| Context Window Overflow | Implement "Summarization" strategy for conversation history. |
| Slow Retrieval | Use "Hybrid Search" (Keyword + Semantic) with filtered metadata. |