self-replicating-agent-tdd

self-replicating-agent-tdd is a skill for Claude Code, Codex from humanerd-drew/opencode-drewgent. It costs 57 tokens per session (3,683 once invoked), scanned A, original, MIT.

A development guide for building an AI agent that can split difficult tasks into smaller tasks, run them through child agents, and combine their results. It uses test-driven development (TDD), meaning tests are written and checked as the system is built.

In plain words
What is it for?
Use it when developing or testing a branching agent system, integrating that behavior into an agent loop, and checking its command-line and end-to-end behavior.
Why use it?
It provides a planned way to handle complex work with several parallel agents while checking that the branching and result-merging logic works.

Skill for Claude CodeCodex

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/humanerd-drew/opencode-drewgent/self-replicating-agent-tdd
Any agent
npx skills add humanerd-drew/opencode-drewgent --skill self-replicating-agent-tdd
Clone the repo
git clone --depth 1 https://github.com/humanerd-drew/opencode-drewgent

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 self-replicating-agent-tdd

README.md
[![agentmods](https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/self-replicating-agent-tdd.svg)](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/self-replicating-agent-tdd)
Your own site
<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/self-replicating-agent-tdd"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/self-replicating-agent-tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,683 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.00057 $0.03683
Opus 5 $0.00028 $0.01842
Sonnet 5 $0.00011 $0.00737
Haiku 4.5 $0.00006 $0.00368

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

Security

Grade A, and why

self-replicating-agent-tdd 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 4d 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.

@action/skills/agent-architecture/self-replicating-agent-tdd/SKILL.md · 324 lines

How it starts

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

TDD-PDCA: Self-Replicating Branching Agent for {{AGENT_NAME}}

Goal

{{AGENT_NAME}} (단일 에이전트)이 복잡한 문제를 감지 → 스스로 서브에이전트를 분기 (branch) → 병렬 추론 → 결과를 부모가 수렴 → 최종 응답 형성.


현재 상태 (Baseline) — Updated 2026-05-10

Phase 1 (COMPLETE): SelfBranchDecider class with 17 passing tests. Phase 2 (COMPLETE): Integrated into run_agent.py loop. Phase 3 (COMPLETE): Structural bugs fixed + integration tests written. 23 tests passing.

PDCA Progress

Phase Goal Status
Phase 1 score_complexity + should_branch + plan_branches + integrate_results COMPLETE
Phase 2 Hook into run_agent.py _execute_tool_calls_concurrent at api_call_count==1 COMPLETE
Phase 3 Fix structural bugs (tool_name, _already_branching, decider caching) + integration tests COMPLETE
Phase 4 End-to-end test + CLI indicator + child agent propagation COMPLETE

Phase 3 — Bug Fixes (COMPLETE)

# Bug Location Fix
1 tool_name missing from tool result messages (sequential) run_agent.py:7719 Added tool_name to tool_msg dict
2 tool_name missing from concurrent path interrupt skip run_agent.py:7003 Added tool_name to interrupt skip_msg
3 _already_branching check-only (never set) run_agent.py:7289 Added self._already_branching = True before execute
4 SelfBranchDecider recreated every call run_agent.py:7839 Cached as self._branch_decider
5 original_user_message not passed in concurrent path run_agent.py:6877 Added to _execute_tool_calls() signature and all call sites

Phase 4 — Integration (COMPLETE)

# Item Location
A CLI visual indicator on branching run_agent.py:7291-7293⚡ Self-branch triggered message
B _already_branching propagates to child agents delegate_tool.py:322child._already_branching = getattr(parent_agent, '_already_branching', False)

Integration Tests (9 in TestSelfBranchIntegration):

  • test_execute_tool_calls_sets_tool_name_in_result_messages — sequential path tool_msg includes tool_name
  • test_should_self_branch_false_on_no_conjunction — conjunction gate blocks simple messages
  • test_should_self_branch_false_on_simple_message — no conjunction → no branch
  • test_should_self_branch_true_with_conjunction_and_complex_messages — passes when both conditions met
  • test_should_self_branch_false_when_already_branching_already_branching flag blocks re-entry
  • test_should_self_branch_false_on_child_agent_delegate_depth > 0 blocks branching in children
  • test_execute_self_branch_calls_decider_execute_branching — cached decider receives correct args
  • test_decider_cached_on_agent_instance — conjunction pass → cache set
  • test_branch_response_returned_with_branched_flag — branching result string returned

Read the full file on GitHub · 324 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. 4d ago First seen · 324 lines · 57 tokens per session scan A b0863434ef50

Subscribe to this mod's changes

self-replicating-agent-tdd is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 57 tokens to every session and 3,683 once invoked, about $0.0003 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.

Related

Other skills, from other repositories

sparc-methodology

SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) comprehensive development methodology with multi-agent orchestration.

ruvnet/RuView · 29 tokens

deep-plan

Creates detailed, sectionized, TDD-oriented implementation plans through research, stakeholder interviews, and multi-LLM review. Use when planning features that need thorough pre-implementation analysis.

piercelamb/deep-plan · 39 tokens

unbiased-review

Use when reviewing a spec, plan, or implementation produced by another session - verifies its claims against the actual repo, grades TDD and hexagonal discipline, and reports severity-ranked findings without writing the fix. Triggers on "review this spec/plan/implementation", "second opinion on", "check this design"…

karsten-s-nielsen/mad-scientist-skills · 84 tokens

add-tests

Generates tests for existing code. Analyzes the target function, method, or class to identify the happy path, error cases, and edge cases, then writes test cases following the project's testing framework and naming conventions. Invoked when the user asks to add tests, write tests, cover code, or increase coverage.

soulcodex/agentic · 67 tokens

testing

Test generation and coverage analysis. Activated when the user says "create tests", "write tests", "test this", "check coverage", "add test", "missing tests", "TDD", or wants to create or improve tests.

rtazima/claude-proj-blueprint · 49 tokens

sparc-methodology

SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) development methodology with multi-agent orchestration. Use when running a structured spec-to-code workflow or decomposing a feature through the SPARC phases.

frankxai/claude-skills-library · 49 tokens