Melech Cost logo

Melech Cost

Community
AdirD
melech-cost

Show what coding-agent sessions cost for every worktree of the current repo — Cursor, Claude Code, and Codex — as handoff-style cards with dollars and tokens. Use when the user asks how much a repo, worktree, task, or session cost, wants a spend breakdown, or invokes `/melech-cost`.

Overview

PublisherAdirD
Repositoryagent-shell-hamelech
Skill namemelech-cost
Stars
46
Forks
5
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by AdirD on GitHub. Read the source before you install it.

Installation

Install the Melech Cost AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AdirD/agent-shell-hamelech/tree/main/skills/melech-cost
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AdirD/agent-shell-hamelech.git /tmp/agent-shell-hamelech
mkdir -p .claude/skills
cp -r /tmp/agent-shell-hamelech/skills/melech-cost .claude/skills/melech-cost
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Melech Cost in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Melech Cost on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Melech Cost is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Melech Cost

Answer "what did this repo cost me, and which task burned it?" from local agent history. One script does all the work; the agent only runs it and relays the result.

text
/melech-cost                      # every worktree of this repo, top 8 cards
/melech-cost last 10              # 10 most recent sessions across all worktrees
/melech-cost <worktree>           # one worktree, its top 10 sessions
/melech-cost since 2026-09-01     # only sessions active since a date

Run

Set COST_SCRIPT to scripts/cost.py beside this file (Python 3.9+):

bash
python3 "$COST_SCRIPT" --cwd "$PWD"                        # default view
python3 "$COST_SCRIPT" --cwd "$PWD" --latest 10            # latest 10 sessions across all worktrees
python3 "$COST_SCRIPT" --cwd "$PWD" --worktree feature-a   # focus one worktree
python3 "$COST_SCRIPT" --cwd "$PWD" --since 2026-09-01     # date filter
python3 "$COST_SCRIPT" --cwd "$PWD" --cards 20             # more cards

Relay stdout as-is. It is already Markdown: a repo header, one card per worktree, and a footnote. Do not recompute, round differently, re-sort, or add numbers the script did not print. End with the Full report: path so the user can open every worktree. Do not read the full report unless asked.

Card shape:

text
### `feature-a` · ~$321
26d ago · 22 sessions + 36 subagents · cursor, claude · mostly `gpt-5.6-sol` (79%)
~394.1M tokens read (98% cached) · ~717k written

| Age | Cost | Read / Write Tokens | Model | Agent | Session | Topic |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| 1.4d ago | **~$187** | ~250.0M / ~400k | `gpt-5.6-sol` | cursor (+20) | `c747b3dc` | Users locked out after the SSO change… |
| 2d ago | **~$51** | ~80.0M / ~150k | `claude-opus-5-5` | claude | `bf32eff9` | Fix mode keeps editing the wrong file… |

(removed) marks a worktree that no longer exists on disk but still has history. Subagent spend rolls into the session that spawned it.

How it works

Scope: this repo only, every worktree. git worktree list gives the main checkout and every live worktree, wherever it lives (Superset, Cursor, Codex, Claude Code, or a plain sibling folder). A folder that holds this repo's worktrees and no other repo's checkout also counts, so history from removed worktrees in that folder is included. The main checkout's parent folder (for example ~/code) never counts, so sibling repos stay out.

Sources and accuracy:

AgentWhereTokens
Claude Code~/.claude/projects/**/*.jsonlExact: logged per message (input, cache write, cache read, output)
Codex~/.codex/sessions/**, archived_sessions/**Exact: last token_count total per session
Cursor CLI~/.cursor/chats/*/<id>/store.dbEstimated: replays the stored ordered conversation
Cursor IDEstate.vscdb + ~/.cursor/projects/*/agent-transcriptsEstimated: replay calibrated against Cursor's own context counter

Pricing. Tokens × list price per model from references/prices.json (dated, per 1M tokens, sourced from Cursor's, Anthropic's, and OpenAI's pricing pages). The first matching rule wins. Unknown models, such as Auto, use a fallback rate, and the footnote says how much that affected. Results are API list-price value. On a subscription, part of it is covered by included usage.

Cursor replay. Cursor stores no billing counters locally, so each session is replayed call by call:

  • Every model call re-reads the prior prompt at the cached rate.
  • New context (your message and tool results since the last call) is billed at the cache-write or input rate.
  • The model's reply is billed at the output rate.
  • When the context passes the model's limit, a summary resets it.

The IDE store drops file-read and search results. The replay therefore scales each session to match Cursor's own "context tokens used" breakdown; sessions without that breakdown use the median of this run's sessions, or 2.4× if there are too few samples. Treat Cursor numbers as about ±30–40%. Hidden reasoning tokens and cache misses after idle gaps aren't visible, so they push the true number up.

What it costs to run

The script is plain local Python: no model tokens and no network. It takes about 10–40 seconds depending on history size. The only spend is the agent turn around it: about three model calls that add ~3k new tokens (this skill, the command, and the printed cards) plus ~1k output tokens, on top of re-reading whatever the chat already holds.

Where you run itOpus 5.5 / GPT-5.6 SolComposer 2.5
Inside an existing chat (~50k context)~$0.05–0.10~$0.03
As the first message of a fresh chat~$0.25 (writing the agent's own ~40k system prompt to cache)~$0.05

More --cards means more output tokens: roughly +$0.01 per 3 extra cards on frontier models.

Boundaries

  • Read-only. Cursor CLI stores are copied to a temp dir to read past SQLite locks, then deleted. The only file written is the full report in the system temp dir (or --report PATH).
  • History is private. Never upload, publish, or paste it anywhere else without explicit instruction.
  • Prices go stale. When a provider changes pricing, update prices.json and its as_of date instead of hand-adjusting printed numbers.
  • Agents without a supported local store (for example SQLite-only or encrypted histories) are not counted. Say so if the user expects them.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Melech Cost AI skill do?

Show what coding-agent sessions cost for every worktree of the current repo — Cursor, Claude Code, and Codex — as handoff-style cards with dollars and tokens. Use when the user asks how much a repo, worktree, task, or session cost, wants a spend breakdown, or invokes `/melech-cost`.

Why use Melech Cost on TypingMind?

Because you install it once and use it with any model. Melech Cost is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Melech Cost in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AdirD/agent-shell-hamelech/tree/main/skills/melech-cost. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Melech Cost?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Melech Cost?

As many as you like. As long as a model supports skills, you can use Melech Cost with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Melech Cost AI skill free?

Yes. It is published on GitHub by AdirD under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇