rag-mcp: Instructions file for Codex

AGENTS.md

rag-mcp AGENTS.md is an instructions file for Codex, OpenCode from MasihMoafi/rag-mcp. It costs 621 tokens per session, scanned A, original, MIT.

Repository instructions for a local hybrid search engine used by coding agents and document tools. It searches selected files or folders with keyword and optional vector matching, then returns source passages with citations.

In plain words
What is it for?
It is for finding relevant, cited passages in local code and documents without uploading them or searching outside the chosen scope.
Why use it?
It avoids either opening files one by one or putting an entire repository into the agent's context, while showing where answers came from.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is MasihMoafi/rag-mcp's own configuration. It tells Codex and OpenCode how to work on rag-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything rag-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to MasihMoafi/rag-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/MasihMoafi/rag-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/MasihMoafi/rag-mcp

Made for: Codex, OpenCode.

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-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/masihmoafi/rag-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/masihmoafi/rag-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/masihmoafi/rag-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/masihmoafi/rag-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rag-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/masihmoafi/rag-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/masihmoafi/rag-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 621 This file is loaded in full into every session.
When invoked 621 The same file — it is already loaded in full.
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.00621 $0.00621
Opus 5.5 $0.00248 $0.00248
Sonnet 5.5 $0.00124 $0.00124
Haiku 4.5 $0.00062 $0.00062

Measured today against content hash 678b06c52d12, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rag-mcp AGENTS.md 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 today.

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.

AGENTS.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

rag-mcp agent rules

rag-mcp is a scoped hybrid-search engine for agents and document work, shipped as the rag command and a stdio MCP server. It indexes locally, combines BM25 with optional vector retrieval and reranking, and returns cited passages or a short answer grounded in them.

Thesis

A coding agent should not have to choose between opening files one at a time and dumping a whole repository into context. Scoped, cited search is the middle path: every query names an explicit file, folder or workspace, and the result must identify the source passages it used.

Non-goals

  • Unscoped search across a machine or repository.
  • A hosted index or a requirement to upload source documents.
  • Broad architectural rewrites without an explicit maintainer request.

Start here

  • User promises, install paths and configuration: README.md.
  • Contribution workflow: CONTRIBUTING.md.
  • Verification standard: docs/VERIFYING.md.
  • Optional environment variables: docs/ENVIRONMENT.md.
  • Evaluation layout and paid-run guardrails: evals/paidrun.py and evals/experiments/.
  • If .agents/AGENTS.local.md exists, read it before acting. It is maintainer-local, untracked and must never be committed.

Rules

  • Start public branches from origin/main unless the task names another reviewed base.
  • This repository is public. Never commit credentials, private corpora, personal paths, real user indexes, session logs or machine-specific state.
  • Every test or experiment that writes rag state must isolate all four stores: RAG_MCP_CONFIG, RAG_MCP_DATA_DIR, RAG_MCP_WORKSPACE_DIR and RAG_MCP_TRACE_DIR.
  • Use one workspace store per concurrent job. Rag intentionally does not wait for another process holding that store's execution lock.
  • Do not place an isolated store inside a git-ignored folder of the repository; rag correctly skips git-ignored input there and appears to find no documents.
  • Paid or batch provider runs go through evals/paidrun.py, with its smoke gate, explicit confirmation, spend cap, isolated stores and lock. Never use a real provider key for ordinary offline verification.
  • Treat evals/experiments/ as evidence. Do not delete, regenerate or re-score recorded runs without preserving their inputs, outputs and provenance.
  • Do not broadly refactor rag/core.py unless the maintainer asks. Interface adapters such as rag/server.py, rag/cli.py and rag/companion.py still need small, test-covered changes.
  • Source files and indexes stay local. Hosted embedding, reranking, contextual retrieval and answer synthesis send only the configured query, chunks or evidence to their providers; document that boundary when changing it.

Read the full file on GitHub · 60 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. today First seen · 60 lines · 621 tokens per session scan A 678b06c52d12

Subscribe to this mod's changes

rag-mcp AGENTS.md is an instructions file published in the GitHub repository MasihMoafi/rag-mcp (9 stars, last pushed today), licensed MIT. It adds 621 tokens to every session, about $0.0025 per session on Opus 5.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-12-01.

Related

rag-mcp AGENTS.md compared with instructions from other repositories

rag-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rag-mcp AGENTS.mdMasihMoafi/rag-mcpInstructions file9todayMITA621Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA9,887GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file144ktodayMITA7,230Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file150ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA3,303GitHub Copilot
deno copilot-instructions.mddenoland/denoInstructions file109kyesterdayMITA3,077GitHub Copilot