Summary
AgentConfig.maxItems and AgentConfig.dryRun are accepted by the CLI (wiggum agent --max-items 5 --dry-run) and passed through to createAgentOrchestrator, but the orchestrator never reads or enforces them.
Problem / Context
Currently the agent relies entirely on the LLM to self-limit based on the system prompt mentioning "maximum number of items". This is unreliable — the model may ignore it or lose track of the count.
For dryRun, there are no guardrails preventing the agent from calling runLoop or commentOnIssue when dry-run mode is active.
Discovered during code review of #114.
Proposed Solution
maxItems
Add a counter in onStepFinish that tracks how many issues have been completed (by detecting reflectOnWork tool calls). When the count reaches maxItems, signal the agent to stop — either by:
- Injecting a "you have reached the item limit, stop now" message via
prepareStep
- Or using a custom
stopWhen condition
dryRun
Wrap execution and reporting tools with guards that return mock results when dryRun is true:
generateSpec → return { success: true, specPath: '(dry-run)' }
runLoop → return { status: 'dry-run' }
commentOnIssue → return { success: true } without calling gh
createTechDebtIssue → return { success: true } without calling gh
Files to Modify
| File |
Changes |
src/agent/orchestrator.ts |
Read maxItems/dryRun from config, implement enforcement |
src/agent/orchestrator.test.ts |
Add tests for item counting and dry-run behavior |
src/agent/tools/execution.ts |
Accept dryRun option or wrap at orchestrator level |
src/agent/tools/reporting.ts |
Accept dryRun option or wrap at orchestrator level |
Acceptance Criteria
Summary
AgentConfig.maxItemsandAgentConfig.dryRunare accepted by the CLI (wiggum agent --max-items 5 --dry-run) and passed through tocreateAgentOrchestrator, but the orchestrator never reads or enforces them.Problem / Context
Currently the agent relies entirely on the LLM to self-limit based on the system prompt mentioning "maximum number of items". This is unreliable — the model may ignore it or lose track of the count.
For
dryRun, there are no guardrails preventing the agent from callingrunLooporcommentOnIssuewhen dry-run mode is active.Discovered during code review of #114.
Proposed Solution
maxItemsAdd a counter in
onStepFinishthat tracks how many issues have been completed (by detectingreflectOnWorktool calls). When the count reachesmaxItems, signal the agent to stop — either by:prepareStepstopWhenconditiondryRunWrap execution and reporting tools with guards that return mock results when
dryRunis true:generateSpec→ return{ success: true, specPath: '(dry-run)' }runLoop→ return{ status: 'dry-run' }commentOnIssue→ return{ success: true }without callingghcreateTechDebtIssue→ return{ success: true }without callingghFiles to Modify
src/agent/orchestrator.tsmaxItems/dryRunfrom config, implement enforcementsrc/agent/orchestrator.test.tssrc/agent/tools/execution.tsdryRunoption or wrap at orchestrator levelsrc/agent/tools/reporting.tsdryRunoption or wrap at orchestrator levelAcceptance Criteria
--max-items 3stops the agent after 3 issues are reflected on--dry-runprevents anyghcalls orwiggum run/wiggum newspawns