Kevin Cojean

Forcing your agents to use TDD in OpenCode

I could not for the life of me get my agents to respect red-green test-driven development.
Every two or three prompts I'd watch them forget about it and start doing green-red approach.

Out of frustration, because I kept having to manually remind them, I decided to automate the reminder system.
Which, surprisingly, didn't seem to exist in the OpenCode ecosystem.

So I built opencode-supernudge.

Essentially what it does is every N number of turns, it automatically injects a reminder you define into it's context.

The nudge can be injected in three places:

  • primay agent conversations
  • subagent conversations
  • in your compaction prompt output
// Example configuration
{
  "prompts": ["~/prompts/tdd-reminder.md", "~/prompts/ledger.md"],
  "injection.interval": 3,
  "injection.alwaysOnFirstMessage": true,
  "injection.resetCounterOnCompaction": true,
  "enabled.normalMessage": true,
  "enabled.subagent": true,
  "enabled.compaction": true
}

The prompts array points to regular files, so you just edit them like any other config. I use it mostly to always remind my agents to use test-driven development, and also to remind them that they have to write down their findings that were not really obvious in a text file I call a ledger. But that's an implementation detail.

The plugin has been very useful so far.

It's open source on GitHub.

One of the next improvements I'll add is a way to scope the nudges to specific agent.


Published on 2026-08-25
Last updated on 2026-08-25