AgentSkillsCN

cognitive-architecture

设计并实现 AI 代理的“大脑”。在定义代理记忆策略(短期/长期)、构建 RAG 流水线(知识检索),或设计状态管理系统时,可使用此技能。

SKILL.md
--- frontmatter
name: "cognitive-architecture"
description: 'Design and implement the "brain" of AI agents. Use when defining agent memory strategy (short/long-term), building RAG pipelines (knowledge retrieval), or designing state management systems.'
metadata:
  author: "AgentX"
  version: "1.0.0"
  created: "2026-02-11"
  updated: "2026-02-11"
compatibility:
  model_providers: ["azure-openai", "openai", "anthropic"]
  vector_stores: ["azure-ai-search", "cosmos-db-mongo", "qdrant", "chroma"]

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

  1. Cognitive Components
  2. RAG Patterns
  3. Memory Architectures
  4. References

Cognitive Components

A complete agent "brain" consists of three layers:

  1. Context (Short-term Memory): The active context window (conversation history).
  2. Knowledge (Long-term Memory/RAG): Static facts retrieved from vector stores or databases.
  3. State (Episodic Memory): Structured data about the user or task progress persisted indefinitely.

Scripts

ScriptPurposeUsage
scaffold-cognitive.pyScaffold RAG pipeline and/or Memory system modulespython 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

PatternDescriptionFile
RAG PipelineStandard for ingesting and retrieving knowledge.pattern-rag-pipeline.md
Memory SystemSchema for short-term and long-term memory.pattern-memory-systems.md

Troubleshooting

IssueSolution
HallucinationsIncrease retrieval "groundedness" threshold or reduce top_k.
Context Window OverflowImplement "Summarization" strategy for conversation history.
Slow RetrievalUse "Hybrid Search" (Keyword + Semantic) with filtered metadata.