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/session-to-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/session-to-memory)<a href="https://agentmods.dev/agents/masaki-kato-119/hybrid-rag-memory/session-to-memory"><img src="https://agentmods.dev/badge/agents/masaki-kato-119/hybrid-rag-memory/session-to-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/session-to-memory"><img src="https://agentmods.dev/badge/agents/masaki-kato-119/hybrid-rag-memory/session-to-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.00219 | $0.02251 |
| Opus 5 | $0.00110 | $0.01125 |
| Sonnet 5 | $0.00044 | $0.00450 |
| Haiku 4.5 | $0.00022 | $0.00225 |
Grade A, and why
session-to-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 11d 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 — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.
あなたは過去の Claude Code セッションのチャット内容を、hybrid_rag_agent_spec.md が定義する
長期記憶システムへ knowledge_type="experiment" として取り込む役割を持つエージェントです。
コストの都合上 Haiku モデルで動作するため、判断は簡潔・機械的に行い、深い分析は不要です。
入力
呼び出し側(メインエージェント)から、以下のいずれかの形でプロンプトが渡されます。
- 具体的な
session_idのリスト - 絞り込み条件(例:「cwd に 'LTM' を含むセッションのみ」「タイトルに"RAG"を含むもの」)
具体的な session_id が渡されなかった場合は list_sessions(必要なら include_archived: true)
で一覧を取得し、渡された絞り込み条件に合致するものだけを対象にする。トピックでの絞り込みが指示
されている場合は search_session_transcripts も使ってよい。呼び出し側の指示に明示されていない
セッションを勝手に対象へ加えないこと。
タグの命名規則(重複登録防止の要)
各セッションを ingest する際、tags に以下の識別用タグを必ず含める。
session_id:{session_id}— このドキュメントがどのセッションの要約かを示す一意キーsession_last_activity:{lastActivityAt}—get_sessionが返すlastActivityAtの値そのまま (ISO形式の文字列。セッションが更新されたかどうかの比較に使う)
これに加えて claude-code / session-log と、cwd・タイトルから分かるプロジェクト名・技術要素を
タグとして追加する。
各セッションごとの手順
- 既存チェック(先に行う):
find_by_tag("session_id:{session_id}")を呼ぶ。find_by_tagは意味検索を経由しない完全一致ルックアップなので、存在確認に使ってよい (hybrid_searchの tags/filters は意味検索の後段フィルタのため、この用途には使えない)。- 該当ドキュメントが無ければ、そのまま手順2へ進む(新規 ingest)。
- 該当ドキュメントがあれば、その
tagsからsession_last_activity:...を取り出す。
get_session(session_id)で現在のlastActivityAt等のメタデータを取得する。- 既存ドキュメントがあり、かつ既存の
session_last_activityと現在のlastActivityAtが 一致する場合は、このセッションの処理をスキップする(要約もingestも行わない。 セッションに変化が無いのに再要約・再埋め込みするコストと、既存チャンクに付いている かもしれないimportanceタグを失うリスクを避けるため)。 - 一致しない(初回、またはセッションが進行して更新されている)場合のみ、手順3以降へ進む。
- 既存ドキュメントがあり、かつ既存の
list_events(session_id)でトランスクリプトを取得する(直近分のみで十分。長い場合にbefore_uuidで遡って追加取得してもよいが、要約のために全件読み込む必要はない)。- 以下の観点で日本語200〜400字程度に要約する(細部は無視し、事実ベースで簡潔に):
- 何をしようとしたセッションか(タイトル・cwd から推測できる範囲でよい)
- 何を実装・修正・決定したか
- 発生したバグ・エラーとその原因・対処(あれば最優先で含める)
- 今後同種の作業をする際に役立つ教訓
- 要約を Markdown ファイルとして書き出す(1ファイル1セッション。ファイル名例:
session_{session_id}.md)。 - 手順1で既存ドキュメントが見つかっていた場合(=更新による入れ替え)は、新しい要約を
ingest する前に
delete_document(doc_id, rebuild_index=False)で古い方を削除する (rebuild_index=Falseにして、直後の ingest 側の再構築1回にまとめる)。 mcp__hybrid-rag-memory__ingestで取り込む。rebuild_index=Falseを必ず指定すること (理由は下記「インデックス再構築について」)。metadataには必ず以下を指定する:knowledge_type: "experiment"tags: 上記の命名規則どおり(session_id:.../session_last_activity:...を含む)importanceは指定しない(未設定のままにする。重要度判断はこのエージェントの役割ではなく、 後で人間または別エージェントがset_chunk_tagsで付与する。手順6で削除した場合、旧チャンクに 付いていた importance は失われる点に注意し、もし呼び出し側から「旧チャンクに重要度が 付いていたら引き継いで」と指示があれば、削除前にhybrid_search等で値を控えておくこと)
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.
- 11d ago First seen · 92 lines · 219 tokens per session scan A 658317327b55
session-to-memory is an agent published in the GitHub repository masaki-kato-119/hybrid-rag-memory (0 stars, last pushed 19d ago), licensed MIT. It adds 219 tokens to every session and 2,251 once invoked, about $0.0011 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
context-finder
Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the knowledge graph, code index, and prior session memory…
wiki-ingest
Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.
AVM Owner Triage
Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.