The Guardian
Mission Role & Focus
The Guardian specializes in functional validation, establishing automated test loops that allow the agent to verify its own business logic and self-correct until all criteria pass.
The Target Feature
Add "Upvoting" (incrementing votes, which automatically ranks the topic list by vote count descending) and "Archiving" (moving presented topics to a separate view).
The Agent Friction
Implementing multi-state logic (e.g., preventing archived topics from being upvoted, or maintaining sorting orders across updates) often leads to subtle regression bugs. Verifying these behaviors manually via browser clicks is slow and prone to human oversight.
Explorer Setup & Pointers
- The Test Runner: The boilerplate project is pre-configured with Vitest (
pnpm testto run tests once). - Write Failing Cases First (TDD): Create a new test file (e.g.,
src/components/backlog/backlog.test.tsxor similar) containing failing assertions describing the exact rules (e.g., sorting logic, archiving state changes, and voting boundaries). - Spec-First Test Directives: In your OpenSpec design or task list, explicitly require the agent to run the test suite and self-correct until the tests pass. For example:
- "Run
pnpm testafter implementing the state hooks. If any tests fail, inspect the console errors and refactor the code until they are 100% green."
- "Run
- Self-Correcting Hooks: Explore writing a local linter/verifier rule (e.g., in
.claude/rules/or.agent/rules/) that triggers the test suite on every code edit.
Mission Objectives
- Write failing test cases detailing business logic boundaries before generating the implementation.
- Propose the change using
/opsx:propose backlog-logicand link the implementation task explicitly to the Vitest suite. - Observe how the agent runs the test loop, parses compiler/runtime failures, and self-corrects the code in a closed loop.
- Discuss in the Show-and-Tell how test-driven engineering shifts the developer's role from manual tester to specifier and boundary-definer.