cw-slice

cw-slice is a skill for Claude Code, Codex from Hmbown/Codewhale. It costs 47 tokens per session (1,638 once invoked), scanned A, original, MIT.

Use before writing code for any Codewhale feature, upgrade, or refactor: find the existing owner of the behavior, bound the change to one reviewable slice, and fix the evidence bar before you start.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for codewhale. Also seen: mentions subagents; mentions AGENTS.md; built for codewhale.

About the project

Codewhale is an open-source coding agent that runs in the terminal and can read repositories, edit files, execute commands, and inspect results while pursuing a task. Developers use it with hosted providers or local models, with controls for how much access it receives.

Hmbown/Codewhale · 40,916 stars · on GitHub · codewhale.net

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 skills/hmbown/codewhale/cw-slice
Any agent
npx skills add Hmbown/Codewhale --skill cw-slice
Clone the repo
git clone --depth 1 https://github.com/Hmbown/Codewhale

Made for: Claude Code, Codex.

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 cw-slice

README.md
[![agentmods](https://agentmods.dev/badge/skills/hmbown/codewhale/cw-slice.svg)](https://agentmods.dev/skills/hmbown/codewhale/cw-slice)
Your own site
<a href="https://agentmods.dev/skills/hmbown/codewhale/cw-slice"><img src="https://agentmods.dev/badge/skills/hmbown/codewhale/cw-slice.svg" alt="Measured on agentmods" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,638 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.1 $0.00047 $0.01638
Opus 5 $0.00023 $0.00819
Sonnet 5 $0.00009 $0.00328
Haiku 4.5 $0.00005 $0.00164

Measured today against content hash e4c6d479d5d1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

cw-slice 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 today.

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.

docs/skills/cw-slice/SKILL.md · 123 lines

How it starts

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

cw-slice

The expensive mistake in this repo is not a bad implementation — it is a second implementation. A new model_*, *_config, provider_*, or "bridge" module beside the one that already does the job ships two systems and a comment that is no longer true. This skill is the ponytail ladder's rung 2 with commands attached: find the thing that already exists, then edit it.

Stage 2 of the loop: cw-orientslicecw-gatescw-dogfoodcw-landcw-handoff.

When to use

  • Any feature, upgrade, refactor, or "make X work like Y" request.
  • Before creating a new module, trait, config struct, or command.
  • When a plan or issue tells you to build something and you have not yet confirmed it does not already exist.

Workflow

  1. Walk the ladder, out loud, before opening an editor. Stop at the first rung that answers, and say which one you stopped at:

    1. Does this need to exist? → skip it.
    2. Already in this codebase? → reuse it.
    3. Stdlib does it? → use it.
    4. Native platform feature? → use it.
    5. Installed dependency? → use it.
    6. One line? → one line.
    7. Only then: the minimum that works.

    The ladder runs after reading the code, never instead of it. A short diff written without reading the call sites is a guess, not a small change.

  2. Grep for the predecessor. This is the step that gets skipped and the one that costs the most:

    grep -rn "<the concept, in the words the code would use>" crates --include='*.rs' | head -40
    ls crates
    grep -rln 'model_\|_config\|provider_' crates/*/src --include='*.rs' | head -30
    

    Search behavior and symbols, not just filenames. If you find an owner, edit it. If you are still adding a new layer, its module doc must name the predecessor it replaces — otherwise you are editing the wrong file.

  3. Check the contracts you are about to walk into. These are the ones this repo actively guards, and a guard test fails if you duplicate them:

    • One turn loop: crates/tui/src/core/engine/turn_loop.rs, guarded by crates/core/tests/single_turn_loop.rs. Do not add a second.
    • One base prompt: BASE_PROMPT in crates/tui/src/prompts/text.rs.
    • The subagent tool is agent. Do not revive agent_open / agent_eval / agent_close / delegate_to_agent.
    • The system prompt + tool catalog are a session-pinned KV-cache prefix (docs/CACHE.md). Any new session-context contributor must state its cache effect — frozen prefix vs. append-only history. Never splice a volatile fact into the prefix.
    • crates/tui/src/core/ is a module inside the TUI crate. crates/core is a different crate that runs no turns. Do not confuse them.
    • Repeatedly misidentified as dead, verify consumers before removing: tui/src/context_budget.rs, tui/src/model_registry.rs, tui/src/prompt_zones.rs, tui/src/tools/remember.rs, config/src/route/.

Read the full file on GitHub · 123 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. today First seen · 123 lines · 47 tokens per session scan A e4c6d479d5d1

Subscribe to this mod's changes

cw-slice is a skill published in the GitHub repository Hmbown/Codewhale (40,916 stars, last pushed today), licensed MIT. It adds 47 tokens to every session and 1,638 once invoked, about $0.0002 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-09-06.