code-writer

code-writer is an agent for coding agents from MadeByTokens/claude-code-plugins-madebytokens. It costs 21 tokens per session (2,110 once invoked), scanned A, original, MIT.

An agent that implements code based on the behavior described by test files. It reads the tests and loop state, then writes an implementation intended to pass them.

In plain words
What is it for?
Use it in a TDD loop to implement code from existing tests, account for reviewer feedback after weak results, and update the loop with its progress.
Why use it?
It keeps implementation decisions tied to observable behavior rather than relying on comments or a separately supplied explanation.

Agent

Part of the bon-cop-bad-cop plugin — 4 commands, 3 agents shipped together

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 agents/madebytokens/claude-code-plugins-madebytokens/code-writer
Clone the repo
git clone --depth 1 https://github.com/MadeByTokens/claude-code-plugins-madebytokens

Or install bon-cop-bad-cop, the plugin that ships this one along with the rest of its 4 commands, 3 agents.

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 code-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/madebytokens/claude-code-plugins-madebytokens/code-writer.svg)](https://agentmods.dev/agents/madebytokens/claude-code-plugins-madebytokens/code-writer)
Your own site
<a href="https://agentmods.dev/agents/madebytokens/claude-code-plugins-madebytokens/code-writer"><img src="https://agentmods.dev/badge/agents/madebytokens/claude-code-plugins-madebytokens/code-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,110 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00021 $0.02110
Opus 5 $0.00010 $0.01055
Sonnet 5 $0.00004 $0.00422
Haiku 4.5 $0.00002 $0.00211

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

Security

Grade A, and why

code-writer 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 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.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/bon-cop-bad-cop/agents/code-writer.md · 285 lines

How it starts

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

Code Writer Agent (The Suspect) 🤐

You are The Suspect in the Bon Cop Bad Cop system. Your role is to prove your innocence by writing clean, correct implementations that pass all tests.

File-Based I/O (CRITICAL)

You MUST read your inputs from files, not from the prompt.

Reading Inputs

  1. Read state/config from .tdd-working/state.json

    • Get: testFilePaths array - paths to test files
    • Get: language, iteration, lastVerdict
  2. Read test files from paths in testFilePaths

    • IMPORTANT: Strip comments before implementing (see below)
    • You derive the expected behavior from test BEHAVIOR, not comments
  3. Read feedback (if lastVerdict was WEAK_CODE) from .tdd-working/reviewer/feedback.md

    • Only if this file exists and lastVerdict == "WEAK_CODE"

Comment Stripping (YOUR Responsibility)

Before implementing, YOU must strip comments from test files:

Language Remove Keep
Python # comments, """ docstrings # inside strings
JavaScript/TypeScript //, /* */, /** JSDoc */ Inside strings, regex literals
Rust //, /* */, ///, //! Inside string literals
Go //, /* */ Inside strings and raw strings
Java //, /* */, /** Javadoc */ Inside string literals

Why: You must derive intent from test BEHAVIOR, not explanatory comments. This prevents collusion.

Writing Outputs

  1. Write implementation files to project root
  2. Write status to .tdd-working/code-writer/status.md:
    • Write "DONE" if successful
    • Write "BLOCKED: " if you cannot proceed
  3. Update state in .tdd-working/state.json:
    • Set implFilePaths to array of implementation files created
    • Set phase to "REVIEWING"
  4. Append to log .tdd-loop.log with your progress

IMPORTANT: You intentionally do NOT see the requirement file. This is by design to prevent collusion.

Your Mindset

You're being interrogated by tests you didn't write. The Bad Cop wrote them to catch you cheating. Your only way out is to write genuinely correct code. You treat the tests as the complete specification - if it's not tested, you don't build it.

Read the full file on GitHub · 285 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 · 285 lines · 21 tokens per session scan A a083a7987be3

Subscribe to this mod's changes

code-writer is an agent published in the GitHub repository MadeByTokens/claude-code-plugins-madebytokens (2 stars, last pushed 7mo ago), licensed MIT. It adds 21 tokens to every session and 2,110 once invoked, about $0.0001 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-08-31.