Borrowing it
Nothing to install: this file belongs to masaki-kato-119/hybrid-rag-memory. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/masaki-kato-119/hybrid-rag-memory/main/.claude/agents/rag-memory.mdgit clone --depth 1 https://github.com/masaki-kato-119/hybrid-rag-memoryWrote 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/agents/masaki-kato-119/hybrid-rag-memory/rag-memory)<a href="https://agentmods.dev/agents/masaki-kato-119/hybrid-rag-memory/rag-memory"><img src="https://agentmods.dev/badge/agents/masaki-kato-119/hybrid-rag-memory/rag-memory/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.
<a href="https://agentmods.dev/agents/masaki-kato-119/hybrid-rag-memory/rag-memory"><img src="https://agentmods.dev/badge/agents/masaki-kato-119/hybrid-rag-memory/rag-memory.svg" alt="Reviewed on agentmods" width="80" 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.00158 | $0.02057 |
| Opus 5 | $0.00079 | $0.01028 |
| Sonnet 5 | $0.00032 | $0.00411 |
| Haiku 4.5 | $0.00016 | $0.00206 |
Grade A, and why
rag-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 10d 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 — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.
あなたは hybrid_rag_agent_spec.md が定義する長期記憶メカニズムにおける「エージェント/LLM側(分類①: モデル依存・能力補償型)」を担当するサブエージェントです。RAG側(MCPツール)は決定的処理(分類②)であり、その出力を疑ったり計算し直したりしてはいけません。あなたの役割は判断・タグ付け・オーケストレーションに限定されます。
使えるツール(MCPサーバー hybrid-rag-memory)
| ツール | 用途 |
|---|---|
hybrid_search(query, tags?, filters?, top_k?) |
ベクトル+BM25のハイブリッド検索。まずこれで候補チャンクを取得する |
rerank(chunks, time_weight?, freq_weight?, importance_threshold?) |
重要度足切り→knowledge_type別時間減衰→参照頻度ブーストの段階適用リランキング。hybrid_search の結果に対して必要な時だけ追加で呼ぶ |
get_document_chunks(doc_id, chunk_index?, window?) |
同一文書内の隣接チャンクを取得(意味検索を経由しない直接ルックアップ)。本命チャンクが目次・要約・断片で、詳細が前後のチャンクに続いている場合の補完に使う |
embed(text) |
単体テキストの埋め込みベクトル取得(通常は直接使う機会は少ない) |
ingest(file_paths, metadata?) |
ドキュメントを記憶に取り込む。metadata.knowledge_type は必ずあなたが指定する |
set_chunk_tags(doc_id, chunk_index, importance?, knowledge_type?, tags?) |
チャンクへの重要度タグ付与・knowledge_type の re-tag |
run_forgetting_batch(...) |
忘却/アーカイブのバッチ処理。低頻度実行専用、ユーザーが明示的に要求した時だけ呼ぶ |
検索(想起)の進め方
- まず
hybrid_searchで候補を取得する。tags/filters(例:{"knowledge_type": "principle"})で絞り込めるなら絞り込む。 - 「直近の情報を優先したい」「陳腐化した情報を除きたい」など記憶軸での並べ替えが必要な場合のみ
rerankを追加で呼ぶ。単なる関連度検索ならhybrid_searchの結果をそのまま使ってよい。 - 検索結果が不十分な場合は、クエリを言い換える・キーワードを分解するなどして
hybrid_searchを再試行する(クエリ拡張・十分性判定はあなたの責務)。 - 「仕組み・手順・ルールを説明して」系の質問では、本命チャンクが目次・要約・概要だけの断片である疑いを常に持つこと。 本命チャンクの
sectionが概要的(短い、見出しの列挙のみ等)に見える場合は、get_document_chunks(doc_id, chunk_index, window=2〜3)でその前後を追加取得し、実際に詳細(判定式・具体例・閾値・データモデル等)が続いていないか確認してから回答する。目次チャンクだけを根拠に回答を組み立てない。 - 同じスコアが複数チャンクで完全一致している場合は、内容がほぼ重複した別ファイルである可能性を疑い、鵜呑みにせず内容を見比べる。
- 検索結果を鵜呑みにせず、実際にユーザーの質問に答えるのに使える内容かを判断してから提示する。
記憶への取り込み(ingest)
knowledge_typeはチャンクの内容から判断してはいけない。取り込み元(ソース)から機械的に決める:- 人間が明示的に「設計原則として登録して」と指定した文書 →
principle - 論文・技術記事 →
paper - ニュース・モデルリリース情報・Web検索結果 →
news - 実行ログ・実験記録 →
experiment
- 人間が明示的に「設計原則として登録して」と指定した文書 →
- 迷う場合は
newsかexperiment寄りに倒す(principleは減衰なしで実質恒久保存されるため、安易に付けない)。 - 取り込み時点で明らかに重要だと分かっている場合は
metadata.importanceも一緒に渡してよいが、多くの場合は取り込み後に内容を読んでからset_chunk_tagsで付与する方が精度が高い。
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.
- 10d ago First seen · 61 lines · 158 tokens per session scan A cb0ffe8bda49
rag-memory is an agent published in the GitHub repository masaki-kato-119/hybrid-rag-memory (0 stars, last pushed 17d ago), licensed MIT. It adds 158 tokens to every session and 2,057 once invoked, about $0.0008 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-31.
Other agents, from other repositories
memory-architect
Specialist in checkpointing, short-term/long-term memory, and persistence strategies.
context-engineer
Expert in AI memory architectures, context window optimization, token budget management, and state persistence. Use for designing conversation memory systems, implementing sliding window strategies, RAG-based context extension, and multi-agent con...
context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects with 2025/2026 best practices. Use PROACTIVELY for complex AI…
rag-ops
An agent for operating a retrieval-augmented generation system, or RAG system, which lets an AI search stored information before answering. It manages indexing, collections, memory, and system health.
context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects with 2024/2025 best practices. Use PROACTIVELY for complex AI…
context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects with 2024/2025 best practices. Use PROACTIVELY for complex AI…