mine-rules

mine-rules is a command for Claude Code from theshadow27/mcp-cli. It costs 0 tokens per session (796 once invoked), scanned B, original, MIT.

A command that reviews a saved Claude Code conversation and pulls out user feedback and practical rules. It can add those rules to a named skill or to a general memory file.

In plain words
What is it for?
Use it after a coding session to capture preferences, recurring corrections, and instructions from the conversation. Provide the conversation's ID and optionally a skill name.
Why use it?
Useful decisions and corrections can get buried in long conversations. This turns them into reusable guidance for future work.

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/theshadow27/mcp-cli/mine-rules
Clone the repo
git clone --depth 1 https://github.com/theshadow27/mcp-cli

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 mine-rules

README.md
[![agentmods](https://agentmods.dev/badge/commands/theshadow27/mcp-cli/mine-rules.svg)](https://agentmods.dev/commands/theshadow27/mcp-cli/mine-rules)
Your own site
<a href="https://agentmods.dev/commands/theshadow27/mcp-cli/mine-rules"><img src="https://agentmods.dev/badge/commands/theshadow27/mcp-cli/mine-rules.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 796 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.00796
Opus 5 $0.00000 $0.00398
Sonnet 5 $0.00000 $0.00159
Haiku 4.5 $0.00000 $0.00080

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

Security

Grade B, and why

mine-rules 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 3d 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.

find ~/.claude/projects -name "<conversation-id>.jsonl" 2>/dev/null
.claude/commands/mine-rules.md · 84 lines

How it starts

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

Mine Rules from Conversation History

Extract actionable rules and user feedback from a Claude Code conversation history to improve skills and memory.

Input

The user provides a conversation ID (UUID) and optionally a target skill name. Parse from: $ARGUMENTS

Format: <conversation-id> [skill-name]

Examples:

  • /mine-rules a47556cb-7200-4403-aae6-0988f88e5a71 manage
  • /mine-rules a47556cb-7200-4403-aae6-0988f88e5a71 (general — updates MEMORY.md)

Workflow

1. Locate the conversation

Search for the JSONL file in ~/.claude/projects/:

find ~/.claude/projects -name "<conversation-id>.jsonl" 2>/dev/null

If not found, report and stop.

2. Extract user messages

The file is JSONL (one JSON object per line). Extract all human/user messages. These are large files (often 5k-15k lines), so use bash to filter:

# Extract user message content from JSONL
cat <file> | jq -r 'select(.type == "human") | .message.content[]? | select(.type == "text") | .text' 2>/dev/null

If jq isn't available or the format differs, use grep/awk to extract lines with "role":"human" or "type":"human".

3. Analyze for rules

Scan all user messages for:

  1. Corrections — "no, don't do X" / "you should have done Y instead"
  2. Explicit rules — "always X" / "never Y" / "from now on..."
  3. Complaints about efficiency — "this wastes time" / "too slow" / "burns context"
  4. Process instructions — "the pipeline should be..." / "do X before Y"
  5. Repeated feedback — same correction given multiple times (high signal)

Focus on efficiency-related feedback — things that affect context usage, time, cost, or pipeline throughput. Skip stylistic preferences unless they affect efficiency.

4. Categorize and deduplicate

Group extracted rules by category:

  • Orchestration — how to manage sessions, polling, delegation
  • Pipeline — phase ordering, when to clear, skip, or reuse
  • Resource management — model selection, concurrency, context preservation
  • Cleanup — worktree handling, daemon discipline, session lifecycle
  • Issue discipline — when to file, label, skip

Read the full file on GitHub · 84 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. 3d ago First seen · 84 lines · 0 tokens per session scan B 76b4c007e0b1

Subscribe to this mod's changes

mine-rules is a command published in the GitHub repository theshadow27/mcp-cli (2 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 796 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.