| name | cycle |
| description | Run a tx cycle scan — sub-agent swarm for codebase issue discovery. Use when the user explicitly mentions "cycle". Do NOT use Claude Code teams (TeamCreate/SendMessage) for this — use tx cycle CLI instead. |
| disable-model-invocation | true |
tx cycle — Sub-Agent Swarm Issue Discovery
Before running tx cycle, ask the user these questions to build the right command:
Required
- Task prompt (
--task-prompt): What area of the codebase should agents review?
- Examples: "Review core services", "Audit API endpoints", "Check error handling in packages/core"
Optional (with defaults)
-
Scan prompt (--scan-prompt): What should agents look for?
- Default: "Find bugs, anti-patterns, missing error handling, security vulnerabilities, and untested code paths."
- User might want something specific like "Find Effect-TS anti-patterns" or "Check for SQL injection"
-
Number of agents (--agents N): How many parallel scan agents per round?
- Default: 3
- More agents = broader coverage per round but higher API cost
-
Number of cycles (--cycles N): How many full cycles to run?
- Default: 1
- Each cycle runs multiple rounds until convergence
-
Max rounds (--max-rounds N): Maximum rounds per cycle before stopping?
- Default: 10 (capped to 1 if no --fix flag)
- Each round scans, deduplicates, and optionally fixes
-
Fix mode (--fix): Should a fix agent run between scan rounds?
- Default: off (scan-only)
- When enabled, issues are fixed between rounds, and scanning continues until convergence
-
Model (--model): Which LLM model for the sub-agents?
-
Score (--score N): Base priority score for new tasks created?
-
Dry run (--dry-run): Report findings without writing to the database?
-
JSON output (--json): Output results as JSON instead of human-readable?
Building the Command
Once you have the user's answers, construct and run the command:
bun apps/cli/src/cli.ts cycle \
--task-prompt "User's task prompt" \
--scan-prompt "User's scan prompt" \
--agents 3 \
--cycles 1 \
--max-rounds 10 \
--model claude-opus-4-6 \
--score 500
Add --fix if the user wants auto-fixing. Add --dry-run for a dry run. Add --json for JSON output.
How It Works
- Scan: N parallel agents scan the codebase based on the prompts
- Dedup: Findings are deduplicated against existing tx tasks (LLM-as-judge)
- Loss: Each round computes a loss score (high x3 + medium x2 + low x1)
- Convergence: When no new significant findings appear, the cycle converges
- Fix (optional): A fix agent addresses issues between rounds
- New issues are created as tx tasks with the specified priority score
Important
- This is a sub-agent swarm, NOT a Claude Code team. Do NOT use TeamCreate, SendMessage, or any built-in team tools.
- The cycle command spawns its own agents internally via
AgentService.
- Results feed back into the normal
tx ready workflow.