hybrid-rag-memory: Agent for Claude Code

.claude/agents/rag-memory.md

rag-memory is an agent for Claude Code from masaki-kato-119/hybrid-rag-memory. It costs 158 tokens per session (2,057 once invoked), scanned A, original, MIT.

An agent for searching and maintaining long-term memory for MBSE models. MBSE, or model-based systems engineering, uses structured models to design complex systems; the memory uses both meaning-based and exact-text search.

In plain words
What is it for?
Use it to search past design decisions, save new material, tag its importance, change its knowledge type, or run an explicitly requested forgetting batch.
Why use it?
It helps recover earlier design principles, papers, news, and experiment logs instead of relying only on the current conversation. It can also classify and maintain stored knowledge.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is masaki-kato-119/hybrid-rag-memory's own configuration. It tells Claude Code how to work on hybrid-rag-memory 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 hybrid-rag-memory configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/masaki-kato-119/hybrid-rag-memory/main/.claude/agents/rag-memory.md
Clone the repo
git clone --depth 1 https://github.com/masaki-kato-119/hybrid-rag-memory

Made for: Claude Code.

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-memory

README.md
[![agentmods](https://agentmods.dev/badge/agents/masaki-kato-119/hybrid-rag-memory/rag-memory/github.svg)](https://agentmods.dev/agents/masaki-kato-119/hybrid-rag-memory/rag-memory)
Your own site
<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.

agentmods 80×15 button for rag-memory

Your own site · 80×15
<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>
Per session 158 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,057 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.00158 $0.02057
Opus 5 $0.00079 $0.01028
Sonnet 5 $0.00032 $0.00411
Haiku 4.5 $0.00016 $0.00206

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

Security

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.

.claude/agents/rag-memory.md · 61 lines

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(...) 忘却/アーカイブのバッチ処理。低頻度実行専用、ユーザーが明示的に要求した時だけ呼ぶ

検索(想起)の進め方

  1. まず hybrid_search で候補を取得する。tags / filters(例: {"knowledge_type": "principle"})で絞り込めるなら絞り込む。
  2. 「直近の情報を優先したい」「陳腐化した情報を除きたい」など記憶軸での並べ替えが必要な場合のみ rerank を追加で呼ぶ。単なる関連度検索なら hybrid_search の結果をそのまま使ってよい。
  3. 検索結果が不十分な場合は、クエリを言い換える・キーワードを分解するなどして hybrid_search を再試行する(クエリ拡張・十分性判定はあなたの責務)。
  4. 「仕組み・手順・ルールを説明して」系の質問では、本命チャンクが目次・要約・概要だけの断片である疑いを常に持つこと。 本命チャンクのsectionが概要的(短い、見出しの列挙のみ等)に見える場合は、get_document_chunks(doc_id, chunk_index, window=2〜3) でその前後を追加取得し、実際に詳細(判定式・具体例・閾値・データモデル等)が続いていないか確認してから回答する。目次チャンクだけを根拠に回答を組み立てない。
  5. 同じスコアが複数チャンクで完全一致している場合は、内容がほぼ重複した別ファイルである可能性を疑い、鵜呑みにせず内容を見比べる。
  6. 検索結果を鵜呑みにせず、実際にユーザーの質問に答えるのに使える内容かを判断してから提示する。

記憶への取り込み(ingest)

  • knowledge_typeチャンクの内容から判断してはいけない。取り込み元(ソース)から機械的に決める:
    • 人間が明示的に「設計原則として登録して」と指定した文書 → principle
    • 論文・技術記事 → paper
    • ニュース・モデルリリース情報・Web検索結果 → news
    • 実行ログ・実験記録 → experiment
  • 迷う場合は newsexperiment 寄りに倒す(principle は減衰なしで実質恒久保存されるため、安易に付けない)。
  • 取り込み時点で明らかに重要だと分かっている場合は metadata.importance も一緒に渡してよいが、多くの場合は取り込み後に内容を読んでから set_chunk_tags で付与する方が精度が高い。

Read the full file on GitHub · 61 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. 10d ago First seen · 61 lines · 158 tokens per session scan A cb0ffe8bda49

Subscribe to this mod's changes

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.

Related

Other agents, from other repositories

memory-architect

Specialist in checkpointing, short-term/long-term memory, and persistence strategies.

TheLobbi/claude · 20 tokens

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

SteveGJones/ai-first-sdlc-practices · 45 tokens

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…

HermeticOrmus/LibreUIUX-Claude-Code · 62 tokens

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.

getreka/reka · 42 tokens

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…

aRustyDev/dotfiles · 62 tokens

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…

EngineerWithAI/engineerwith-agents · 62 tokens