rtclose

rtclose is a command for Claude Code from ygtalp/rawthink-mcp. It costs 0 tokens per session (1,726 once invoked), scanned B, original, MIT.

A session-closing command that exports the conversation, extracts mentioned entities, updates memory, and produces a handoff report.

In plain words
What is it for?
Use it at the end of a session to detect the project, save its JSONL record, update MEMORY.md, and generate a report.
Why use it?
It gathers the important work from a finished session in one repeatable step instead of leaving notes and exports scattered or unfinished.

Command for Claude Code

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.

agentmods
npx agentmods add commands/ygtalp/rawthink-mcp/rtclose
Clone the repo
git clone --depth 1 https://github.com/ygtalp/rawthink-mcp

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 rtclose

README.md
[![agentmods](https://agentmods.dev/badge/commands/ygtalp/rawthink-mcp/rtclose.svg)](https://agentmods.dev/commands/ygtalp/rawthink-mcp/rtclose)
Your own site
<a href="https://agentmods.dev/commands/ygtalp/rawthink-mcp/rtclose"><img src="https://agentmods.dev/badge/commands/ygtalp/rawthink-mcp/rtclose.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,726 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
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 $0.00000 $0.01726
Opus 5 $0.00000 $0.00863
Sonnet 5 $0.00000 $0.00345
Haiku 4.5 $0.00000 $0.00173

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

Security

Grade B, and why

rtclose scanned grade B with 1 finding 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 4d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

JSONL_PATH=$(find ~/.claude/projects/ -name "*.jsonl" -newer /tmp/session_start 2>/dev/null | head -1)
.claude/commands/rtclose.md · 190 lines

How it starts

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

/rtclose — Session Close

This command closes the current session and performs:

  1. JSONL export (Python pipeline)
  2. Entity extraction (knowledge graph feeding)
  3. Handoff + MEMORY.md update
  4. Report

Argument

Optional title: /rtclose "Session Title" If not provided, generate a title from the session's main topic.


Step 0: Project Detection

Detect the project name from CWD and create a project tag:

# Get CWD
PROJECT_DIR=$(basename "$(pwd)")
PROJECT_TAG="project/$(echo "$PROJECT_DIR" | tr '[:upper:]' '[:lower:]')"

JSONL path is CWD-specific: Each project's JSONLs are under different encoded paths.

  • Encode the CWD path: replace / with -, remove : — look under ~/.claude/projects/

Export always goes to the vault: vault/ relative to the project root.

Step 1: JSONL Export (Python pipeline)

Find the session JSONL file and export:

# Detect project directory
PROJECT_DIR=$(basename "$(pwd)")
PROJECT_TAG="project/$(echo "$PROJECT_DIR" | tr '[:upper:]' '[:lower:]')"

# Find JSONL path based on CWD
# Create encoded CWD: /home/user/projects/myproject -> home-user-projects-myproject
CWD_ENCODED=$(pwd | sed 's|^/||' | sed 's|/|-|g')
JSONL_PATH=$(ls -t ~/.claude/projects/${CWD_ENCODED}/*.jsonl 2>/dev/null | head -1)

# If not found, search manually
if [ -z "$JSONL_PATH" ]; then
  echo "WARNING: JSONL not found, searching ~/.claude/projects/ ..."
  JSONL_PATH=$(find ~/.claude/projects/ -name "*.jsonl" -newer /tmp/session_start 2>/dev/null | head -1)
fi

# Export — to vault relative to project root
PYTHONUTF8=1 rawthink-export "$JSONL_PATH" \
  --title "[TITLE]" \
  --slug "[SLUG]" \
  --tags "$PROJECT_TAG,[OTHER_TAGS]" \
  --vault-dir vault \
  --reindex
  • If the user provided a title via /rtclose "Session Title", use it for [TITLE]
  • Otherwise generate a title from the session's main topic (2-5 words)
  • [SLUG] = slugify the title (lowercase, hyphen-separated)
  • [OTHER_TAGS] = extract from session content (comma-separated) — $PROJECT_TAG is added automatically
  • --reindex flag updates Qdrant. If Ollama is down or errors, retry without --reindex.
  • Parse the output as JSON — save session_id and files fields.

Read the full file on GitHub · 190 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. 4d ago First seen · 190 lines · 0 tokens per session scan B b1370bd6c5ea

Subscribe to this mod's changes

rtclose is a command published in the GitHub repository ygtalp/rawthink-mcp (0 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,726 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.