red-worker

A worker agent for the RED phase of test-driven development (TDD), a method where tests are written before the code they check. It receives test cases and project context, then creates tests that should initially fail.

In plain words
What is it for?
Use it to create assigned test cases from a cycle document, place them in the specified test files, and report whether the expected failing state was verified.
Why use it?
It separates test creation from implementation and confirms that the tests fail before the feature is built.

Agent

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/morodomi/dev-crew/red-worker
Clone the repo
git clone --depth 1 https://github.com/morodomi/dev-crew
Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,119 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.00044 $0.01119
Opus 5 $0.00022 $0.00560
Sonnet 5 $0.00009 $0.00224
Haiku 4.5 $0.00004 $0.00112

Measured yesterday against content hash 9ca42f17d7e2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

red-worker 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 yesterday.

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.

agents/red-worker.md · 108 lines

How it starts

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

Red Worker

REDフェーズで並列実行されるワーカーエージェント。

Input

Task toolから以下の情報を受け取る:

Field Description
test_cases 担当するテストケース(TC-XX)のリスト
cycle_doc Cycle docのパス(設計情報、Test List)
test_files 作成対象のテストファイルパス
language_plugin 使用する言語プラグイン(php, python等)

Example Input

担当テストケース: TC-01, TC-02
Cycle doc: docs/cycles/20260126_1130_feature.md
対象テストファイル: tests/auth_test.{ext}
言語プラグイン: {project_language}

Output

テスト作成完了後、以下の形式で結果を返す:

{
  "status": "success|failure",
  "test_cases": ["TC-01", "TC-02"],
  "files_created": ["tests/auth_test.{ext}"],
  "red_state_verified": true,
  "test_result": {
    "passed": false,
    "details": "All tests failed as expected (RED state)"
  },
  "errors": []
}

Context Retrieval Protocol

作業開始前に十分なコンテキストを段階的に収集する(最大3サイクル)。

十分性評価

以下が全て把握できていれば十分:

  • 対象ファイルの責務と公開インターフェース
  • 直接の依存関係(import先)
  • 既存テストパターン(同ファイル・同モジュール)

リファイン手順

  1. Cycle doc + 対象ファイル + 直接依存を読む
  2. 上記チェックリストで十分性を評価
  3. 不足があれば追加検索(Grep/Read/Glob)で補完
  4. 最大3サイクル繰り返し、超過時は不明点を明示して続行

Workflow

Step 0: Test Strategy Classification

テスト対象コードの性質を判定し、テスト戦略を選択する。

性質 判定基準 テスト戦略
決定論的 同じ入力→同じ出力。ビジネスロジック、データ変換、特徴量計算 Contract(入出力スキーマ定義)+ Property(不変量検証)優先
確率的 出力にばらつき。ML推論、確率アルゴリズム、シミュレーション Metamorphic Relation(入力変換と出力の相対関係)定義
  • 判定に迷ったら決定論的として扱う
  • バグ修正の場合: 再現テスト優先。分類はスキップ可
  • 分類結果は各TCのParadigm欄に反映する(Paradigm Selectionガイド参照)
  • 戦略の詳細・言語別ツール: red/reference.md
  1. Cycle docを読み、Test Listと設計方針を把握(存在しない場合はエラー返却)
  2. 担当テストケースの内容を確認(Paradigm欄から推奨テスト戦略を判断)
  3. Given/When/Then形式でテストコードを作成(Edit/Write)
    • 決定論的 + Contract/Property → スキーマ定義 + 不変量テストを優先
    • 確率的 + Metamorphic → 相対関係テストを優先
    • Example → 具体値によるアサーション
  4. テスト実行で失敗を確認(RED状態)
  5. 結果を返却

Verification Gate

結果 判定 アクション
テスト失敗 PASS red_state_verified: true
テスト成功 FAIL テストが無効、または実装が既に存在

Read the full file on GitHub · 108 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. yesterday First seen · 108 lines · 44 tokens per session scan A 9ca42f17d7e2

Subscribe to this mod's changes

red-worker is an agent published in the GitHub repository morodomi/dev-crew (1 stars, last pushed 3d ago), licensed MIT. It adds 44 tokens to every session and 1,119 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-08-31.