rag-and-memory

rag-and-memory is a skill for Claude Code, Codex from DevelopersGlobal/ai-agent-skills. It costs 36 tokens per session (1,172 once invoked), scanned A, original, MIT.

Guidance for giving an AI agent the right information from documents, databases, or earlier conversations. Retrieval-augmented generation, or RAG, means finding relevant outside information before generating an answer; memory means retaining useful state across sessions.

In plain words
What is it for?
Use it when building document question-answering, document analysis, knowledge bases, or agents that need to remember information between sessions.
Why use it?
It helps prevent overloaded context, irrelevant information, stale memories, and answers that are not grounded in the available knowledge.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building document question-answering, document analysis, knowledge bases, or agents that need to remember information between sessions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/developersglobal/ai-agent-skills/rag-and-memory
Install

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.

Any agent
npx skills add DevelopersGlobal/ai-agent-skills --skill rag-and-memory
Clone the repo
git clone --depth 1 https://github.com/DevelopersGlobal/ai-agent-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for rag-and-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/developersglobal/ai-agent-skills/rag-and-memory.svg)](https://agentmods.dev/skills/developersglobal/ai-agent-skills/rag-and-memory)
Your own site
<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>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,172 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 8d ago against content hash b5bf31ea1972, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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.

skills/rag-and-memory/SKILL.md · 112 lines

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

  1. 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)
  2. 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

  1. Chunking strategy: Break documents into chunks at semantic boundaries (paragraphs, sections) — not arbitrary character counts.
  2. Embedding model: Match the embedding model to your query type. Use the same model for indexing and retrieval.
  3. Retrieval: Retrieve top-K most semantically similar chunks. K = 3–7 is usually optimal.
  4. Re-ranking: After retrieval, re-rank by relevance using a cross-encoder. Top K becomes top 3–5 for the prompt.
  5. Context injection: Inject retrieved chunks into the prompt with clear source citations.

Read the full file on GitHub · 112 lines

Changes

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.

  1. 8d ago First seen · 112 lines · 36 tokens per session scan A b5bf31ea1972

Subscribe to this mod's changes

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.

Related

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.

addyosmani/agent-skills · 43 tokens

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'.

Astro-Han/karpathy-llm-wiki · 67 tokens

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.

roedyrustam/vibes-plug · 62 tokens

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.

roedyrustam/vibes-plug · 67 tokens

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.

agentskillexchange/skills · 34 tokens

supamem

Project-agnostic dual-memory tooling — semantic + structural memory for AI coding agents.

dzmitrys-dev/supamem · 20 tokens