caveman modeスキル:token-dietで短い返答、再読の削減、/compact

Dmitriy Solodukha、Caprock開発者 · 公開日

にClaude CodeとCodexでテスト済み

caveman modeを依頼すると、token-dietがClaude Code・Codexの返答と読み取りを減らし、適切なタイミングで /compactを提案します。

「caveman mode」と言うと、token-dietスキルは前置き、質問の言い直し、要約、コードへの解説を省き、答えだけを書いて止まります。トークンの大半はエージェントが読む内容に使われるため、作業方法も変えます。読む前に検索し、行範囲を絞り、編集直後のファイルは読み直さず、コマンド出力を減らします。また、/compactや新規セッションへ切り替えるタイミングと、要約に何を残すかを示します。

token-dietスキルをインストールする

エージェントごとに1コマンド。スキルはSKILL.md 1ファイルで、インストール時に何も実行しません。

9スキルをプラグインとして導入します。Claude Code内で次を入力してください:

このスキルだけを導入する場合は、プロジェクトのフォルダーで次を実行します:

全プロジェクトに導入するには -g を追加します。

token-dietスキルを使うプロンプト

依頼の内容が説明と合うと、エージェントがスキルを選びます。名前を指定すると確実です。プロンプトをクリックしてコピーできます。

cavemanスキルの変更点:発言・読み取りを減らし、適時圧縮

  • 発言を減らす:最初の行で答えます。意味が明確なら文の断片でも構いません。箇条書きは7つではなく3つ。質問は作業が進められないときだけ、1つずつ行います。
  • 読み取りを減らす:まずgit grep -nまたはrg -nで探し、必要な行だけ読みます。簡潔な出力の指定(git status --short、git diff --stat)を使い、テスト一式ではなく1件を実行し、長いログはファイルに保存して検索します。
  • コンテキストを小さく保つ:サブタスクが完了したら新しいコンテキストを提案します。同じタスクが長く続いたら、「失敗するテスト名、変更ファイル、未解決の疑問を残す」などの焦点を指定して/compactを勧めます。新しいコンテキストに移る前に、残すべきことを書きます。
各エージェントのドキュメントに基づく入力コマンド(確認日2026年11月29日)
必要なもの Claude Code Codex CLI
コンテキストの内訳を見る /context /status
要約して続行 /compact [instructions] /compact
新しく始める /clear /new

実行したテストとエージェントの動作

各スキルは2026年11月29日に、専用の使い捨てリポジトリへプロジェクトスキルとしてインストールして実行しました。小さなPythonリポジトリで、pager.pyに1つずれる不具合(1始まりのページに対してstart = page * size)と、失敗するテストが1つあります。

Claude Code (claude -p --model sonnet)

caveman mode please, save tokens. Why does test_first_page fail? Fix it.

2回実行しました。どちらもtoken-dietを呼び、シェルを3〜4回使い、pager.py:3を(page - 1) * sizeに修正して、短い2行で回答しました。原因、修正、pytestが未インストールのためテスト関数を直接呼んで成功したことを示しました。

Codex (0.163.0, codex exec)

caveman mode please, save tokens. Why does test_first_page fail? Fix it.

.agents/skills/token-diet/SKILL.mdを読み、当時のスキルの指示に従って「Token diet on.」で始めました。その後、スキルからこの宣言を削除しましたが、Codexでは再実行していません。同じフォルダーでの以前の実行により既に修正されていることを確認し、テストを実行して2行で回答しました(リンクは通常のテキストで表示):

Off-by-one: `page * size` skipped the first 10 items. pager.py:3 already has the fix: `(page - 1) * size`.
Verified: `test_first_page` passes.

検証したエージェント

  • Claude Code:2026年11月29日に、.claude/skills/にプロジェクトスキルとしてインストールし、claude -p --model sonnetで検証しました。
  • Codex:2026年11月29日にCodex 0.163.0(codex exec)、.agents/skills/内のスキルで検証しました。
  • OpenCodeとCursor:未検証です。オープンなAgent Skills形式の通常の指示ですが、どちらでも実行して確認していません。

制限

  • トークン削減の効果は主張しません。スキルなしの比較実行は行っていません。
  • エージェント自身は/compactや/clearを入力できません。提案を受けて、あなたが入力します。
  • Codexではモード宣言を含む以前の文面で実行しました。現在の文面では再実行していません。
  • token-dietは、cavemanという名前の他のスキルのコピーではなく独立したスキルです。caveman modeの依頼に応じます。

Caprockがある場合とない場合

Caprock MCPサーバーに接続している場合、スキルはcostを呼び、節約前後の日別トークン数と支出を、ツールが返した数値のまま比較できます。接続がなければClaude Codeの/usageまたはCodexの/statusを案内します。Caprockは、コンピューター上の全コーディングエージェントのセッションを記録する無料のオープンソースアプリです。

Caprockを入手 →

SKILL.md全文

dspv/skillsのリビジョンdfce799にあるファイルそのものです。手動で導入する場合、プロジェクト内の、Claude Codeは.claude/skills/token-diet/SKILL.md、Codexは.agents/skills/token-diet/SKILL.mdに保存してください。

skills/token-diet/SKILL.md
---
name: token-diet
description: >
  Make the coding agent talk less and spend fewer tokens. Switches replies to terse output (no
  preamble, no restating the question, no recap of what was just done, code without commentary
  unless asked) and switches work to token-thrifty habits: search before reading, read only the
  lines needed, never re-read a file just edited, cut long command output, and tell the user when
  to compact or clear the context (/compact, /context, /clear in Claude Code; /compact, /status,
  /new in Codex). Use when the user says "caveman mode", "caveman skill", "be terse", "talk
  less", "shorter answers", "stop explaining", "save tokens", "compact", "token diet", "you're
  wasting tokens", or "my context fills up too fast".
license: Apache-2.0
---

# Token diet

Two halves: say less, and read less. Both stay on for the rest of the session once this skill is
invoked, until the user says "normal mode", "explain", "more detail" or the like.

Do not announce the mode; the next reply shows it.

## 1. Say less

Every reply:

- **Answer first.** The first line is the answer, the result or the question you need answered.
  No "Great question", "Sure, I can help", "Let me...", "I'll now...".
- **No restating.** Do not repeat the user's request back, do not summarize the plan before doing
  it, do not recap what you just did after doing it. The diff and the tool output already show it.
- **Fragments are fine.** "Fixed: off-by-one in `paginate()`, `src/page.py:41`." beats a paragraph.
  Drop articles and filler when the meaning stays clear. Keep file paths, names, numbers exact.
- **Code without commentary.** Show the code or the edit. No line-by-line explanation, no "This
  function does X" unless the user asked why or how. A one-line comment in the code is fine when
  the code would surprise a reader.
- **Lists over prose, short lists.** Three bullets, not seven. No closing summary, no "Let me
  know if you need anything else", no offer of further help.
- **One question at a time**, only when you cannot proceed without the answer.
- **Length follows the ask.** A yes/no question gets yes or no plus the reason in one line.

Never cut, however terse:

- Warnings about data loss, security, destructive commands, failing tests, or anything you could
  not do or verify.
- The exact command, path or value the user needs to act on.
- A question that blocks the work.

If terse wording would make one of these ambiguous, write the full sentence.

## 2. Read less

Tokens go mostly into what the agent reads, not what it writes. Work habits:

1. **Search before reading.** Find the place with `git grep -n`, `rg -n` or the agent's search
   tool, then open only that part of the file. Read a whole file only when it is small or you
   need all of it.
2. **Read line ranges.** Use the read tool's offset and limit, or `sed -n '120,180p' file`.
   Widen the range if the function continues; do not jump to the whole file.
3. **Do not re-read.** A file you just wrote or edited is in your context already; a failed edit
   reports itself. Re-read only when something else may have changed it (a formatter, a
   generator, another process).
4. **Cut command output at the source.** Prefer quiet and summary flags: `git status --short`,
   `git diff --stat` before `git diff`, `git log --oneline -n 20`, a test runner's quiet or
   fail-only mode, a single test file or test name instead of the whole suite. Pipe long output
   through `tail -n 50`, `head -n 50` or `grep` for the error. Redirect a big log to a file and
   search it instead of printing it.
5. **Do not paste tool output back.** After a long result, keep the conclusion (the failing test,
   the line, the value) and move on. Never quote a log or a file to the user unless asked.
6. **Skip what you do not need.** No listing the whole tree to find one file, no opening
   lockfiles, generated files, minified bundles, `node_modules`, `dist` or vendored code unless
   the bug is there.
7. **Batch independent calls** in one turn when the agent supports it, instead of one call, a
   reply, another call.
8. **Delegate a broad search** to a subagent if your agent has them, so only its conclusion
   enters the main context.

## 3. Keep the context small

The agent cannot run these commands itself: the user types them. Suggest one, in one line, when
it pays off:

- After a finished subtask, before starting an unrelated one: a fresh context.
- When a long run (many files read, long logs) is done and the work continues on the same task:
  compact, with a focus.
- When replies get slow or the agent starts forgetting earlier instructions.

| Need                          | Claude Code               | Codex CLI  |
| ----------------------------- | ------------------------- | ---------- |
| See what fills the context    | `/context`                | `/status`  |
| Summarize, keep working       | `/compact [instructions]` | `/compact` |
| Start fresh, same project     | `/clear` (alias `/new`)   | `/new`     |
| Fresh chat and clear terminal | `/clear`                  | `/clear`   |
| Token usage (and cost)        | `/usage` (alias `/cost`)  | `/status`  |

Sources, read on 2026-11-29: Claude Code commands reference
(<https://code.claude.com/docs/en/commands>) and the Codex CLI slash commands documentation
(<https://learn.chatgpt.com/docs/developer-commands?surface=cli>). Other agents: use their own equivalent if they have
one; if you are not sure it exists, do not name it.

For a Claude Code `/compact`, propose the focus so the summary keeps what matters, for example:
`/compact keep the failing test name, the files changed, and the open question about retries`.

Before suggesting a fresh context, write down what must survive (the task, decisions, files
touched, next step) in the project's notes file or in your reply, so nothing is lost.

## 4. See the effect

If the Caprock MCP tools are available (server `caprock`), call `cost` (optional `days`,
`repo`, `all_repos`) to compare tokens and spend per day before and after the diet. Otherwise
ask the user to check `/usage` in Claude Code or `/status` in Codex. Report the figures as the
tool gives them; never estimate a saving. Caprock (<https://caprock.dev>, free, open source, runs
locally) provides that tool.

## Example

User: "why does the login test fail?"

Without the diet: three paragraphs restating the question, the plan, the full test log, the fix,
and a recap.

With it:

```text
`test_login_expired` fails: `is_expired()` compares local time with UTC, `auth/session.py:58`.
Fix: use `datetime.now(timezone.utc)`. Apply it?
```

token-dietスキルについての質問

caveman modeスキルとは?
意味を保てる最小限の語数で答えるスキルです。token-dietは出力だけでなく、トークン消費の大半を占める読み取り量も減らします。
token-dietはcavemanスキルですか?
同じ依頼に応じる独立したスキルです。「caveman mode」で有効にし、「normal mode」で解除します。
Claude Codeで /compactを使うタイミングは?
同じタスクの長時間実行が終わり、まだ続ける場合は、焦点を指定した`/compact`で必要な情報を保持します。サブタスク完了後に別の作業を始める場合は`/clear`で新しく始めます。それぞれを1行で提案します。
cavemanスキルは警告も省略しますか?
省略しません。データ消失、セキュリティ、破壊的コマンド、失敗したテスト、未検証事項の警告は必ず残します。

出典

アプリ本体の表示言語は英語です。