Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add DevelopersGlobal/ai-agent-skills --skill rag-and-memorygit clone --depth 1 https://github.com/DevelopersGlobal/ai-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/developersglobal/ai-agent-skills/rag-and-memory)<a href="https://agentmods.dev/skills/developersglobal/ai-agent-skills/rag-and-memory"><img src="https://agentmods.dev/badge/skills/developersglobal/ai-agent-skills/rag-and-memory.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00036 | $0.01172 |
| Opus 5 | $0.00018 | $0.00586 |
| Sonnet 5 | $0.00007 | $0.00234 |
| Haiku 4.5 | $0.00004 | $0.00117 |
Grade A, and why
rag-and-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Overview
RAG and memory systems are how AI agents work with knowledge that exceeds their context window. Done well: agents give accurate, grounded answers. Done poorly: context overflow, hallucination from stale retrieval, and performance degradation.
This skill covers the design principles and failure modes of RAG and memory architectures for production AI systems.
When to Use
- Building any AI system that needs to access external knowledge
- When agent context windows are being exceeded
- When agents need to remember information across sessions
- When building Q&A, document analysis, or knowledge base systems
Process
Step 1: Choose the Right Memory Architecture
- Identify what the agent needs to remember:
- Ephemeral: Within a single session (use in-context memory)
- Session-persistent: Across a user's sessions (use external key-value store)
- Knowledge base: Organizational or domain knowledge (use vector DB + RAG)
- Procedural: How to do tasks (encode in SKILL.md / system prompt)
- Match the memory type to the store:
| Memory Type | Recommended Store |
|---|---|
| In-session facts | Context window (summarized) |
| User preferences | Key-value store (Redis, DynamoDB) |
| Document corpus | Vector database (Pinecone, Weaviate, pgvector) |
| Long-term facts | Structured DB + caching |
Verify: Each type of information the agent needs has a defined storage mechanism.
Step 2: Design the RAG Pipeline
- Chunking strategy: Break documents into chunks at semantic boundaries (paragraphs, sections) — not arbitrary character counts.
- Embedding model: Match the embedding model to your query type. Use the same model for indexing and retrieval.
- Retrieval: Retrieve top-K most semantically similar chunks. K = 3–7 is usually optimal.
- Re-ranking: After retrieval, re-rank by relevance using a cross-encoder. Top K becomes top 3–5 for the prompt.
- Context injection: Inject retrieved chunks into the prompt with clear source citations.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 112 lines · 36 tokens per session scan A b5bf31ea1972
rag-and-memory is a skill published in the GitHub repository DevelopersGlobal/ai-agent-skills (65 stars, last pushed 4mo ago), licensed MIT. It adds 36 tokens to every session and 1,172 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
context-engineering
Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.
karpathy-llm-wiki
Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.
vector-db-rag-expert
Expert guide for high-performance Vector Databases, RAG architectures, pgvector HNSW indexing, hybrid search (Dense + BM25), and semantic chunking / Panduan ahli Vector DB, arsitektur RAG, pgvector HNSW, dan hybrid search.
ai-llm-integration-expert
Expert guide for integrating Large Language Models (LLMs), Model Context Protocol (MCP), RAG architecture, vector databases, and AI agents / Panduan ahli untuk integrasi LLM, Model Context Protocol (MCP), arsitektur RAG, vector database, dan agen AI.
Add graph-backed memory and context retrieval to agent workflows
Use Cognee to ingest project knowledge into graph and vector memory so agents can retrieve durable context across sessions and workflows.
supamem
Project-agnostic dual-memory tooling — semantic + structural memory for AI coding agents.