@arvorco/relentless 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.claude/commands/relentless.convert.md +25 -0
  2. package/.claude/skills/analyze/SKILL.md +113 -40
  3. package/.claude/skills/analyze/templates/analysis-report.md +138 -0
  4. package/.claude/skills/checklist/SKILL.md +143 -51
  5. package/.claude/skills/checklist/templates/checklist.md +43 -11
  6. package/.claude/skills/clarify/SKILL.md +70 -11
  7. package/.claude/skills/constitution/SKILL.md +61 -3
  8. package/.claude/skills/constitution/templates/constitution.md +241 -160
  9. package/.claude/skills/constitution/templates/prompt.md +150 -20
  10. package/.claude/skills/convert/SKILL.md +248 -0
  11. package/.claude/skills/implement/SKILL.md +82 -34
  12. package/.claude/skills/plan/SKILL.md +136 -27
  13. package/.claude/skills/plan/templates/plan.md +92 -9
  14. package/.claude/skills/specify/SKILL.md +110 -19
  15. package/.claude/skills/specify/templates/spec.md +40 -5
  16. package/.claude/skills/tasks/SKILL.md +75 -1
  17. package/.claude/skills/tasks/templates/tasks.md +5 -4
  18. package/CHANGELOG.md +63 -1
  19. package/MANUAL.md +40 -0
  20. package/README.md +262 -10
  21. package/bin/relentless.ts +292 -5
  22. package/package.json +2 -2
  23. package/relentless/config.json +46 -2
  24. package/relentless/constitution.md +2 -2
  25. package/relentless/prompt.md +97 -18
  26. package/src/agents/amp.ts +53 -13
  27. package/src/agents/claude.ts +70 -15
  28. package/src/agents/codex.ts +73 -14
  29. package/src/agents/droid.ts +68 -14
  30. package/src/agents/exec.ts +96 -0
  31. package/src/agents/gemini.ts +59 -16
  32. package/src/agents/opencode.ts +188 -9
  33. package/src/cli/fallback-order.ts +210 -0
  34. package/src/cli/index.ts +63 -0
  35. package/src/cli/mode-flag.ts +198 -0
  36. package/src/cli/review-flags.ts +192 -0
  37. package/src/config/loader.ts +16 -1
  38. package/src/config/schema.ts +157 -2
  39. package/src/execution/runner.ts +144 -21
  40. package/src/init/scaffolder.ts +285 -25
  41. package/src/prd/parser.ts +92 -1
  42. package/src/prd/types.ts +136 -0
  43. package/src/review/index.ts +92 -0
  44. package/src/review/prompt.ts +293 -0
  45. package/src/review/runner.ts +337 -0
  46. package/src/review/tasks/docs.ts +529 -0
  47. package/src/review/tasks/index.ts +80 -0
  48. package/src/review/tasks/lint.ts +436 -0
  49. package/src/review/tasks/quality.ts +760 -0
  50. package/src/review/tasks/security.ts +452 -0
  51. package/src/review/tasks/test.ts +456 -0
  52. package/src/review/tasks/typecheck.ts +323 -0
  53. package/src/review/types.ts +139 -0
  54. package/src/routing/cascade.ts +310 -0
  55. package/src/routing/classifier.ts +338 -0
  56. package/src/routing/estimate.ts +270 -0
  57. package/src/routing/fallback.ts +512 -0
  58. package/src/routing/index.ts +124 -0
  59. package/src/routing/registry.ts +501 -0
  60. package/src/routing/report.ts +570 -0
  61. package/src/routing/router.ts +287 -0
  62. package/src/tui/App.tsx +2 -0
  63. package/src/tui/TUIRunner.tsx +103 -8
  64. package/src/tui/components/CurrentStory.tsx +23 -1
  65. package/src/tui/hooks/useTUI.ts +1 -0
  66. package/src/tui/types.ts +9 -0
package/MANUAL.md ADDED
@@ -0,0 +1,40 @@
1
+ # Manual
2
+
3
+ ## Introduction
4
+
5
+ Relentless is a universal AI agent orchestrator that automates software development by running AI coding agents in a loop until all tasks are complete. It provides structured workflows for specification, planning, testing, and quality enforcement across multiple AI platforms including Claude, Amp, OpenCode, Codex, Droid, and Gemini. The system handles complexity classification, cost optimization through smart model routing, automatic fallback on rate limits, and maintains progress through git commits and persistent state files.
6
+
7
+ ## Quickstart
8
+
9
+ - Read the README.md to understand the project overview and installation steps
10
+ - Review the constitution.md file to learn about project governance principles
11
+ - Explore the features directory to see existing example specifications and plans
12
+ - Check the documentation in docs/ for detailed setup guides and agent-specific instructions
13
+ - Review example test cases in the tests/ directory to understand testing patterns
14
+
15
+ ## Usage Examples
16
+
17
+ - Authenticate users securely by implementing OAuth2 with proper token storage and refresh mechanisms
18
+ - Migrate existing authentication systems by replacing hardcoded credentials with OAuth2 flows and updating authorization endpoints
19
+
20
+ ## Troubleshooting
21
+
22
+ - Tasks are not starting despite configuration being correct
23
+ - Agent stops mid-task without completing
24
+ - Multiple agents hitting rate limits simultaneously
25
+ - Progress file is not updating after iterations complete
26
+ - Tests are failing but implementation appears correct
27
+ - Concurrent tasks are conflicting or overwriting each other
28
+
29
+ ## Glossary
30
+
31
+ - Auto Mode: Smart routing system that selects optimal models based on task complexity and cost settings
32
+ - Escalation: Automatic retry with more capable models when tasks fail with smaller models
33
+ - Fallback: Switching to alternative AI agents when current agent hits rate limits or becomes unavailable
34
+ - Harness: The adapter layer that connects Relentless to specific AI agents like Claude, Amp, or Codex
35
+ - Smoke Test: Simple validation tasks that verify basic functionality without requiring complex logic changes
36
+ - Mode: Cost optimization preset that determines which models are used for different complexity levels
37
+
38
+ ## Support
39
+
40
+ For questions, bug reports, or feature requests, please use the GitHub Issues page at https://github.com/ArvorCo/Relentless/issues. This is the primary support channel for the Relentless project where you can search existing discussions or create new issues to get help from the community and maintainers.
package/README.md CHANGED
@@ -10,7 +10,9 @@
10
10
  [![GitHub](https://img.shields.io/badge/GitHub-ArvorCo%2FRelentless-blue?logo=github)](https://github.com/ArvorCo/Relentless)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
12
 
13
- [Quick Start](#quick-start) · [Why Relentless?](#from-ralph-to-relentless) · [Supported Agents](#supported-agents) · [Documentation](#cli-reference)
13
+ **🆕 Smart Auto Mode: Save 50-75% on AI costs by routing tasks to the right model**
14
+
15
+ [Quick Start](#quick-start) · [Auto Mode](#auto-mode) · [Why Relentless?](#from-ralph-to-relentless) · [Supported Agents](#supported-agents) · [Documentation](#cli-reference)
14
16
 
15
17
  </div>
16
18
 
@@ -98,6 +100,26 @@ cd your-project
98
100
  relentless init
99
101
  ```
100
102
 
103
+ After upgrading Relentless, rerun `/relentless.constitution` to refresh `relentless/prompt.md` with the latest instructions (including spec/plan/tasks awareness).
104
+
105
+ ### Upgrading from Previous Versions
106
+
107
+ If you have Relentless installed from before v0.4.0:
108
+
109
+ 1. Update the package:
110
+ ```bash
111
+ bun install -g @arvorco/relentless
112
+ # or: npm install -g @arvorco/relentless
113
+ ```
114
+
115
+ 2. **Important:** Re-run the constitution command to get updated templates:
116
+ ```bash
117
+ /relentless.constitution
118
+ ```
119
+
120
+ This will detect changes and offer upgrade options for your
121
+ constitution.md and prompt.md files.
122
+
101
123
  ### 3. Create a Feature
102
124
 
103
125
  **With Claude Code, Amp, or OpenCode** (recommended):
@@ -105,11 +127,11 @@ relentless init
105
127
  # Create constitution + personalized prompt (do this once per project)
106
128
  /relentless.constitution
107
129
 
108
- # Create feature
130
+ # Create feature (tasks now auto-generates prd.json!)
109
131
  /relentless.specify Add user authentication with OAuth2
110
132
  /relentless.plan I'm using React, TypeScript, PostgreSQL
111
- /relentless.tasks
112
- /relentless.checklist
133
+ /relentless.tasks # Auto-converts to prd.json
134
+ /relentless.analyze # Validate consistency
113
135
  ```
114
136
 
115
137
  **With Codex, Droid, or Gemini** (manual workflow):
@@ -117,12 +139,13 @@ relentless init
117
139
  relentless features create user-auth
118
140
  # Then prompt your agent to create spec.md, plan.md, tasks.md
119
141
  # Or reference .claude/skills/*/SKILL.md for format
142
+ relentless convert relentless/features/001-user-auth/tasks.md --feature 001-user-auth
120
143
  ```
121
144
 
122
145
  ### 4. Run
123
146
 
124
147
  ```bash
125
- relentless convert relentless/features/001-user-auth/tasks.md --feature 001-user-auth
148
+ # Auto mode is now the default (use --agent <harness> to opt out)
126
149
  relentless run --feature 001-user-auth --tui
127
150
  ```
128
151
 
@@ -130,6 +153,147 @@ Watch the beautiful TUI as your agent works through each task, commits code, and
130
153
 
131
154
  ---
132
155
 
156
+ ## CLI Reference
157
+
158
+ ### Run Command
159
+
160
+ ```bash
161
+ relentless run --feature <name> [options]
162
+ ```
163
+
164
+ Options:
165
+ - `--agent <harness>`: Force a specific harness (`auto`, `claude`, `amp`, `opencode`, `codex`, `droid`, `gemini`).
166
+ - `--mode <mode>`: Auto mode cost tier (`free`, `cheap`, `good`, `genius`).
167
+ - `--fallback-order <list>`: Comma-separated harness order for auto fallback.
168
+ - `--max-iterations <n>`: Limit loop iterations (default: 20).
169
+ - `--skip-review`: Skip final review phase.
170
+ - `--review-mode <mode>`: Review quality tier (`free`, `cheap`, `good`, `genius`).
171
+ - `--dry-run`: Show routing and planning without executing agents.
172
+ - `--tui`: Run the interactive terminal UI.
173
+ - `--dir <path>`: Working directory for the run.
174
+
175
+ ### Estimate Command
176
+
177
+ ```bash
178
+ relentless estimate --feature <name> [--mode <mode>] [--compare]
179
+ ```
180
+
181
+ Options:
182
+ - `--mode <mode>`: Cost tier for estimation (`free`, `cheap`, `good`, `genius`).
183
+ - `--compare`: Compare all modes side by side.
184
+
185
+ ### Other Useful Commands
186
+
187
+ ```bash
188
+ relentless init
189
+ relentless convert <tasks.md> --feature <name>
190
+ relentless agents list
191
+ relentless agents doctor
192
+ ```
193
+
194
+ ## Auto Mode
195
+
196
+ **Smart routing saves 50-75% on AI costs** by matching task complexity to the right model.
197
+ Auto mode is now enabled by default and becomes the default agent. If you want to force a specific harness, pass `--agent` explicitly.
198
+
199
+ Auto Mode is designed to keep you productive: simple tasks run fast on cheaper models, while hard problems automatically route to stronger models (or escalate when needed). That means fewer reruns, lower spend, and faster end-to-end throughput on real features.
200
+
201
+ ### Default Behavior
202
+
203
+ - `relentless run` uses auto routing unless you pass `--agent <harness>`
204
+ - Auto mode uses your `relentless/config.json` defaults for `defaultMode`, fallback order, and model overrides
205
+ - You can still lock a harness per run (e.g., `--agent codex`)
206
+
207
+ ### Four Cost Modes
208
+
209
+ | Mode | Model Selection | Best For |
210
+ |------|-----------------|----------|
211
+ | **free** | OpenCode free models | Maximum savings, simple tasks |
212
+ | **cheap** | Haiku 4.5, Gemini Flash, GPT-5.2 (reasoning-effort low) | Good balance, most tasks |
213
+ | **good** | Sonnet 4.5 (default) | Quality-focused development |
214
+ | **genius** | Opus 4.5, GPT-5.2 (reasoning-effort xhigh) | Complex architecture, critical tasks |
215
+
216
+ Notes:
217
+ - Droid has no free-tier models, so it only appears in paid modes.
218
+
219
+ ### Cost Savings Example
220
+
221
+ Running a 10-story feature with mixed complexity:
222
+
223
+ | Mode | Estimated Cost | Savings |
224
+ |------|----------------|---------|
225
+ | genius | $2.50 | — |
226
+ | good | $1.20 | 52% |
227
+ | cheap | $0.60 | 76% |
228
+ | free | $0.00 | 100% |
229
+
230
+ ### Usage
231
+
232
+ ```bash
233
+ # Run with specific mode (auto routing)
234
+ relentless run --feature my-feature --mode cheap
235
+
236
+ # Force a specific harness (disables auto routing)
237
+ relentless run --feature my-feature --agent claude
238
+
239
+ # Override fallback order (auto mode only)
240
+ relentless run --feature my-feature --fallback-order opencode,droid,claude
241
+
242
+ # Skip final review (not recommended)
243
+ relentless run --feature my-feature --skip-review
244
+
245
+ # Custom review mode
246
+ relentless run --feature my-feature --review-mode genius
247
+
248
+ # Tune idle timeout (milliseconds) for stuck/quiet harnesses
249
+ RELENTLESS_EXECUTION_TIMEOUT_MS=120000 relentless run --feature my-feature
250
+ ```
251
+
252
+ ### How It Works
253
+
254
+ 1. **Classification**: Each task is analyzed for complexity (simple, medium, complex, expert)
255
+ 2. **Routing**: Task is assigned to the optimal model for its complexity and selected mode
256
+ 3. **Execution**: Agent attempts the task with the assigned model
257
+ 4. **Escalation**: If the task fails, automatically escalate to a more capable model
258
+ 5. **Reporting**: Final cost report shows actual vs estimated costs
259
+
260
+ ### Escalation Path
261
+
262
+ When a smaller model fails, Relentless automatically escalates:
263
+
264
+ ```
265
+ haiku-4.5 → sonnet-4.5 → opus-4.5
266
+ glm-4.7 → haiku-4.5 → sonnet-4.5
267
+ gpt-5.2-low → gpt-5.2-medium → gpt-5.2-high → gpt-5.2-xhigh (maps to `--model gpt-5.2 -c reasoning_effort="low|medium|high|xhigh"` in Codex CLI)
268
+ ```
269
+
270
+ The system tracks costs across all attempts and reports total spend.
271
+
272
+ ### Configuration (relentless/config.json)
273
+
274
+ ```json
275
+ {
276
+ "defaultAgent": "auto",
277
+ "autoMode": {
278
+ "enabled": true,
279
+ "defaultMode": "good",
280
+ "fallbackOrder": ["claude", "codex", "droid", "opencode", "amp", "gemini"],
281
+ "modeModels": {
282
+ "simple": "haiku-4.5",
283
+ "medium": "sonnet-4.5",
284
+ "complex": "opus-4.5",
285
+ "expert": "opus-4.5"
286
+ }
287
+ }
288
+ }
289
+ ```
290
+
291
+ Notes:
292
+ - `defaultAgent: "auto"` makes auto routing the default; set to `claude`, `codex`, etc. to opt out.
293
+ - `autoMode.enabled` only affects auto routing; it does not force auto unless `defaultAgent` is `auto`.
294
+
295
+ ---
296
+
133
297
  ## Key Features
134
298
 
135
299
  ### 🔄 Universal Agent Orchestration
@@ -141,11 +305,11 @@ No more vague PRDs. Interactive `/relentless.specify` creates comprehensive spec
141
305
  ### 🧪 Quality Enforcement
142
306
  TDD is not optional. E2E tests are not optional. Every story must pass typecheck. Constitution rules (MUST/SHOULD) are enforced. Checklists are loaded into agent prompts.
143
307
 
144
- ### 💰 Cost-Aware Routing
145
- Why use GPT-5-Pro or Opus 4.5 to rename a variable? Route tasks by complexity. Save money. Ship faster.
308
+ ### 💰 Smart Auto Mode — Save 50-75%
309
+ Why use GPT-5-Pro or Opus 4.5 to rename a variable? Four cost modes (free, cheap, good, genius) route tasks by complexity. Automatic escalation when smaller models fail. Save money. Ship faster.
146
310
 
147
311
  ### 📊 Beautiful TUI
148
- Real-time progress bars, dynamic story grid that adapts to terminal size, priority badges, phase indicators, research markers. Know exactly what's happening.
312
+ Real-time progress bars, dynamic story grid that adapts to terminal size, priority badges, phase indicators, research markers. Auto mode now shows the current routing decision and idle time per story.
149
313
 
150
314
  ### 🔀 Dependency Management
151
315
  Stories can depend on other stories. Relentless validates, detects circular dependencies, and executes in the correct order.
@@ -168,6 +332,13 @@ Stories can depend on other stories. Relentless validates, detects circular depe
168
332
 
169
333
  All agents get skills/instructions installed automatically via `relentless init`.
170
334
 
335
+ ### Harness Tips
336
+
337
+ - OpenCode: we enable `--print-logs` by default to keep output flowing.
338
+ - Codex: GPT-5.2 reasoning tiers map to `--model gpt-5.2 -c reasoning_effort="low|medium|high|xhigh"`.
339
+ - Droid: supports `--reasoning-effort` and `--auto` autonomy levels; use `--agent droid` to force it.
340
+ - Gemini: non-interactive runs use `--prompt`; set `GEMINI_API_KEY` (or Vertex/GCA flags) for auth.
341
+
171
342
  ```bash
172
343
  # Check what's installed
173
344
  relentless agents list
@@ -209,6 +380,23 @@ your-project/
209
380
 
210
381
  ## The Workflow
211
382
 
383
+ Relentless uses a simplified 5-step SpecKit workflow:
384
+
385
+ | Step | Command | Output |
386
+ |------|---------|--------|
387
+ | 1. Specify | `/relentless.specify` | spec.md |
388
+ | 2. Plan | `/relentless.plan` | plan.md |
389
+ | 3. Tasks | `/relentless.tasks` | tasks.md + prd.json (auto) |
390
+ | 4. Analyze | `/relentless.analyze` | Validation report |
391
+ | 5. Implement | `relentless run --tui` | Working code |
392
+
393
+ **Optional:** `/relentless.checklist` (between tasks and analyze)
394
+ - Generates validation checklist with quality gates
395
+ - Recommended for complex features
396
+
397
+ > **Note:** The `tasks` command now auto-runs `convert`.
398
+ > Manual `relentless convert` is only needed if you edit tasks.md by hand.
399
+
212
400
  ```
213
401
  ┌─────────────────────────────────────────────────────────────┐
214
402
  │ │
@@ -218,9 +406,9 @@ your-project/
218
406
  │ ↓ │
219
407
  │ /relentless.plan → Technical architecture │
220
408
  │ ↓ │
221
- │ /relentless.tasks → Dependency-ordered stories
409
+ │ /relentless.tasks → Stories + prd.json (auto)
222
410
  │ ↓ │
223
- │ /relentless.checklist Quality validation items
411
+ │ /relentless.analyze Validate consistency
224
412
  │ ↓ │
225
413
  │ relentless run --tui → Agent loops until complete │
226
414
  │ ↓ │
@@ -240,6 +428,12 @@ relentless init # Initialize project
240
428
  relentless run --feature <name> --tui # Run orchestration
241
429
  relentless status --feature <name> # Show progress
242
430
  relentless reset <story-id> --feature <name> # Re-run a story
431
+
432
+ # Auto Mode options
433
+ relentless run --feature <name> --mode <free|cheap|good|genius>
434
+ relentless run --feature <name> --fallback-order claude,opencode,amp
435
+ relentless run --feature <name> --skip-review
436
+ relentless run --feature <name> --review-mode <free|cheap|good|genius>
243
437
  ```
244
438
 
245
439
  ### Feature Management
@@ -295,6 +489,34 @@ relentless agents doctor # Health check
295
489
  "dangerouslyAllowAll": true
296
490
  }
297
491
  },
492
+ "autoMode": {
493
+ "enabled": true,
494
+ "defaultMode": "good",
495
+ "fallbackOrder": ["claude", "codex", "droid", "opencode", "amp", "gemini"],
496
+ "modeModels": {
497
+ "simple": "haiku-4.5",
498
+ "medium": "sonnet-4.5",
499
+ "complex": "opus-4.5",
500
+ "expert": "opus-4.5"
501
+ },
502
+ "review": {
503
+ "promptUser": true,
504
+ "defaultMode": "good",
505
+ "microTasks": ["typecheck", "lint", "test", "security", "quality", "docs"],
506
+ "maxRetries": 3
507
+ },
508
+ "escalation": {
509
+ "enabled": true,
510
+ "maxAttempts": 3,
511
+ "escalationPath": {
512
+ "haiku-4.5": "sonnet-4.5",
513
+ "sonnet-4.5": "opus-4.5",
514
+ "gpt-5.2-low": "gpt-5.2-medium",
515
+ "gpt-5.2-medium": "gpt-5.2-high",
516
+ "gpt-5.2-high": "gpt-5.2-xhigh"
517
+ }
518
+ }
519
+ },
298
520
  "fallback": {
299
521
  "enabled": true,
300
522
  "priority": ["claude", "amp", "opencode", "codex", "gemini"],
@@ -312,6 +534,18 @@ relentless agents doctor # Health check
312
534
  }
313
535
  ```
314
536
 
537
+ ### Auto Mode Settings
538
+
539
+ | Setting | Description | Default |
540
+ |---------|-------------|---------|
541
+ | `autoMode.enabled` | Enable smart routing | `true` |
542
+ | `autoMode.defaultMode` | Default cost mode | `"good"` |
543
+ | `autoMode.fallbackOrder` | Harness priority order | `["claude", "codex", ...]` |
544
+ | `autoMode.modeModels` | Model per complexity | See above |
545
+ | `autoMode.escalation.enabled` | Enable auto-escalation | `true` |
546
+ | `autoMode.escalation.maxAttempts` | Max escalation attempts | `3` |
547
+ | `autoMode.review.microTasks` | Review checks to run | `["typecheck", "lint", ...]` |
548
+
315
549
  ---
316
550
 
317
551
  ## How It Works
@@ -373,6 +607,24 @@ Make criteria **verifiable**:
373
607
  | PRD not found | `relentless convert <file> --feature <name>` |
374
608
  | Max iterations reached | Increase `--max-iterations` or split stories |
375
609
  | Skills not found | `relentless init --force` to reinstall |
610
+ | High escalation rate | Tasks may be underclassified; try `--mode good` |
611
+ | All harnesses rate limited | Wait for reset or add API keys for more harnesses |
612
+ | Cost higher than expected | Check escalation history in `prd.json` |
613
+ | Free mode failing | Some tasks require paid models; try `--mode cheap` |
614
+
615
+ ### Auto Mode FAQ
616
+
617
+ **Q: Why did my task use Opus when I set `--mode cheap`?**
618
+ A: Cheap mode assigns initial models, but escalation can upgrade to more capable models if the task fails repeatedly. Check `prd.json` for escalation history.
619
+
620
+ **Q: How accurate are cost estimates?**
621
+ A: Estimates include a 12% buffer for potential escalation. Actual costs may be lower if tasks succeed on first try.
622
+
623
+ **Q: Can I disable escalation?**
624
+ A: Yes, set `autoMode.escalation.enabled: false` in config. Tasks will fail instead of escalating.
625
+
626
+ **Q: Which mode should I use?**
627
+ A: Start with `good` (default). Use `cheap` for well-defined tasks. Use `genius` for complex architecture. Use `free` only for experimentation.
376
628
 
377
629
  ---
378
630