@gw-tools/autonomous-workflow-agent 2.2.0 → 2.3.0

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.
package/README.md CHANGED
@@ -168,9 +168,52 @@ type ToolName = 'Read' | 'Write' | 'Edit' | 'Bash' | 'Glob' | 'Grep' | 'WebSearc
168
168
  ## Requirements
169
169
 
170
170
  - **Git** with worktree support (Git 2.5+)
171
- - **[gw CLI](https://github.com/mthines/gw-tools)** for worktree management
171
+ - **[gw CLI](https://github.com/mthines/gw-tools)** for worktree management (v0.20+)
172
172
  - **Node.js** project (npm/pnpm/yarn)
173
173
 
174
+ ## Compatibility
175
+
176
+ | Dependency | Minimum Version | Notes |
177
+ | --------------- | --------------- | ------------------------- |
178
+ | Git | 2.5+ | Worktree support required |
179
+ | gw CLI | 0.20+ | Earlier versions may work |
180
+ | Claude Code SDK | 1.x | Tested with v1.0.x |
181
+ | Node.js | 18+ | For running the agent |
182
+
183
+ ## Performance Characteristics
184
+
185
+ Realistic expectations for agent behavior:
186
+
187
+ | Metric | Typical Range | Notes |
188
+ | ------------------- | ------------- | ---------------------------------- |
189
+ | Agent turns | 15-80 | Depends on task complexity |
190
+ | Files changed | 3-20 | Soft limit at 20, hard limit at 50 |
191
+ | Test iterations | 2-8 | Escalates to user at 7+ |
192
+ | Commits per feature | 3-10 | Logical, incremental commits |
193
+ | Success rate (Lite) | ~90% | Simple fixes, 1-3 files |
194
+ | Success rate (Full) | ~75% | Complex features, 4+ files |
195
+
196
+ **Note:** These are estimates based on typical usage. Actual performance varies by codebase complexity, test suite speed, and task clarity.
197
+
198
+ ## Model Selection
199
+
200
+ The agent defaults to **Sonnet** which handles ~80% of tasks effectively. Consider **Opus** for:
201
+
202
+ | Use Opus When | Stick with Sonnet When |
203
+ | -------------------------------------------------- | --------------------------------- |
204
+ | Architectural changes (new patterns, abstractions) | Bug fixes and small features |
205
+ | Complex multi-system integrations | Single-system changes |
206
+ | Ambiguous requirements needing inference | Clear, well-defined requirements |
207
+ | Large refactoring (10+ files) | Focused changes (1-5 files) |
208
+ | Novel problem domains | Familiar patterns in the codebase |
209
+
210
+ ````typescript
211
+ // Override model for complex tasks
212
+ const myAgent = {
213
+ ...autonomousWorkflowAgent,
214
+ model: 'opus',
215
+ };
216
+
174
217
  ### Installing gw CLI
175
218
 
176
219
  This agent uses the `gw` CLI under the hood to manage Git worktrees. The CLI handles:
@@ -181,6 +224,37 @@ This agent uses the `gw` CLI under the hood to manage Git worktrees. The CLI han
181
224
  - Navigating between worktrees (`gw cd`)
182
225
  - Cleaning up merged worktrees (`gw clean`)
183
226
 
227
+ ### Secret Handling in Worktrees
228
+
229
+ When the agent creates a new worktree, `gw` automatically copies configured files from your default branch (usually `main`). This ensures secrets and environment files are available without committing them to git.
230
+
231
+ **Setup (one-time):**
232
+
233
+ ```bash
234
+ # Configure which files to auto-copy
235
+ gw init --auto-copy-files .env,secrets/,.env.local
236
+
237
+ # Ensure secrets exist in your main worktree first
238
+ cd main
239
+ cp .env.example .env
240
+ # Edit .env with your actual secrets
241
+ ````
242
+
243
+ **How it works:**
244
+
245
+ 1. Secrets are stored in your `main` worktree (the source)
246
+ 2. When `gw checkout` creates a new worktree, it copies `autoCopyFiles` from `main`
247
+ 3. Worktree secrets are independent—changes don't affect other worktrees
248
+ 4. Use `gw sync <worktree>` to update secrets in existing worktrees
249
+
250
+ **Security notes:**
251
+
252
+ - `.env` files are never committed (ensure they're in `.gitignore`)
253
+ - Each worktree gets its own copy—no shared state
254
+ - The agent never reads or logs secret values
255
+
256
+ 📖 **Full details:** [gw-tools secret handling](https://github.com/mthines/gw-tools/tree/main/packages/gw-tool#initial-setup-secrets-in-the-default-branch)
257
+
184
258
  ```bash
185
259
  # Via npm
186
260
  npm install -g @gw-tools/gw
@@ -240,6 +314,48 @@ Traditional AI coding assistants modify your working directory directly. This me
240
314
 
241
315
  With worktrees, the agent works in a completely separate directory. Your main checkout stays clean, and you can review the agent's work when it's ready.
242
316
 
317
+ ## Observability
318
+
319
+ ### Watching Agent Progress
320
+
321
+ For Full Mode tasks, the agent maintains progress artifacts you can monitor:
322
+
323
+ ```bash
324
+ # Watch real-time progress (Full Mode)
325
+ tail -f .gw/<branch>/task.md
326
+
327
+ # Check the implementation plan
328
+ cat .gw/<branch>/plan.md
329
+
330
+ # After completion, review the walkthrough
331
+ cat .gw/<branch>/walkthrough.md
332
+ ```
333
+
334
+ ### Claude Code Hooks (Optional)
335
+
336
+ Get notifications when the agent completes significant actions:
337
+
338
+ ```json
339
+ // ~/.claude/settings.json
340
+ {
341
+ "hooks": {
342
+ "postToolUse": {
343
+ "Bash": "echo \"gw action completed\" | tee -a /tmp/agent.log"
344
+ }
345
+ }
346
+ }
347
+ ```
348
+
349
+ **Platform-specific notifications:**
350
+
351
+ ```bash
352
+ # macOS
353
+ osascript -e 'display notification "Agent completed action" with title "gw"'
354
+
355
+ # Linux (requires libnotify)
356
+ notify-send "gw" "Agent completed action"
357
+ ```
358
+
243
359
  ## Troubleshooting
244
360
 
245
361
  ### "gw: command not found"
@@ -254,12 +370,65 @@ The agent includes "smart detection" to reuse existing worktrees. If you're seei
254
370
 
255
371
  The agent will iterate up to 20 times on test failures. If it's still stuck, it will stop and ask for help. Check the `task.md` file in `.gw/<branch>/` for iteration history.
256
372
 
373
+ ### Agent issued an invalid gw command
374
+
375
+ If the agent hallucinates a `gw` command that doesn't exist:
376
+
377
+ 1. Check `.gw/<branch>/task.md` for what the agent was trying to do
378
+ 2. Look at the error message for the actual command attempted
379
+ 3. Manually run the correct command or guide the agent
380
+
381
+ Common hallucinations:
382
+
383
+ - `gw create` → should be `gw checkout` or `gw add`
384
+ - `gw switch` → should be `gw cd`
385
+ - `gw delete` → should be `gw remove`
386
+
387
+ ### Agent stuck in a loop
388
+
389
+ If the agent keeps trying the same fix repeatedly:
390
+
391
+ 1. Check `.gw/<branch>/task.md` for iteration history
392
+ 2. Look for repeated "Attempt N" entries with similar fixes
393
+ 3. Interrupt and provide guidance: "Try a different approach—the issue is X"
394
+
395
+ The agent has built-in loop detection and will ask for help after 7+ similar attempts, but you can intervene earlier.
396
+
397
+ ### Agent created wrong worktree name
398
+
399
+ The agent uses smart worktree detection. If it created a worktree with an unexpected name:
400
+
401
+ ```bash
402
+ # List all worktrees
403
+ gw list
404
+
405
+ # Navigate to the correct one
406
+ gw cd <branch-name>
407
+
408
+ # Or remove and recreate
409
+ gw remove <wrong-branch>
410
+ ```
411
+
412
+ ### Secrets missing in new worktree
413
+
414
+ If `.env` or other secrets weren't copied:
415
+
416
+ 1. Verify `autoCopyFiles` is configured: `cat .gw/config.json`
417
+ 2. Ensure secrets exist in your `main` worktree
418
+ 3. Manually sync: `gw sync <worktree> .env`
419
+
257
420
  ## Related
258
421
 
259
422
  - **[gw-tools](https://github.com/mthines/gw-tools)** — Git worktree workflow CLI
260
- - **[Skill Documentation](https://github.com/mthines/gw-tools/tree/main/skills/autonomous-workflow)** — Full 26-file skill with all rules and templates
423
+ - **[Skill Documentation](https://github.com/mthines/gw-tools/tree/main/skills/autonomous-workflow)** — Full skill with all rules and templates
261
424
  - **[Claude Code SDK](https://github.com/anthropics/claude-code-sdk)** — Official SDK for building Claude agents
262
425
 
426
+ ## Community & Support
427
+
428
+ - **Issues & Feature Requests:** [github.com/mthines/gw-tools/issues](https://github.com/mthines/gw-tools/issues)
429
+ - **Questions & Discussions:** Open an issue with the `question` label
430
+ - **Share your experience:** We'd love to hear how you're using the agent—open an issue with the `show-and-tell` label
431
+
263
432
  ## Contributing
264
433
 
265
434
  Issues and PRs welcome at [github.com/mthines/gw-tools](https://github.com/mthines/gw-tools).
@@ -528,3 +528,54 @@ Update `task.md` whenever:
528
528
  | Remove worktree | `gw remove <branch-name>` |
529
529
  | Create draft PR | `gh pr create --draft` |
530
530
  | Check PR status | `gh pr view <num> --json state` |
531
+
532
+ ---
533
+
534
+ ## Troubleshooting
535
+
536
+ ### Self-Diagnosis Checklist
537
+
538
+ When encountering issues, check these in order:
539
+
540
+ 1. **Read `.gw/{branch}/task.md`** — Contains iteration history, decisions, and blockers
541
+ 2. **Read `.gw/{branch}/plan.md`** — Original plan for comparison
542
+ 3. **Check `gw list`** — Verify you're in the correct worktree
543
+ 4. **Run `git status`** — Check for uncommitted changes or conflicts
544
+
545
+ ### Common Issues & Recovery
546
+
547
+ | Issue | Check | Recovery |
548
+ | ------------------ | --------------------------- | ------------------------------------- |
549
+ | Wrong worktree | `gw list`, `pwd` | `gw cd <correct-branch>` |
550
+ | Command not found | `which gw` | `npm install -g @gw-tools/gw` |
551
+ | Secrets missing | `cat .gw/config.json` | `gw sync <branch> .env` |
552
+ | Stuck in loop | `task.md` iteration history | Try alternative approach, ask user |
553
+ | Tests keep failing | `task.md` test results | Focus on ONE failure, escalate at 7+ |
554
+ | Build fails | Error message | Fix types/imports, check dependencies |
555
+
556
+ ### When to Escalate to User
557
+
558
+ Escalate immediately when:
559
+
560
+ 1. Same error repeating after 3+ attempts with different fixes
561
+ 2. Requirements become ambiguous mid-implementation
562
+ 3. Scope creep detected (task growing beyond original plan)
563
+ 4. Fundamental architectural question arises
564
+ 5. Hard limits approached (50+ files, 20+ test iterations)
565
+
566
+ **Format for escalation:**
567
+
568
+ ```
569
+ BLOCKED: [Brief description]
570
+
571
+ What I tried:
572
+ 1. [Attempt 1]
573
+ 2. [Attempt 2]
574
+ 3. [Attempt 3]
575
+
576
+ Current state:
577
+ - [Relevant context]
578
+
579
+ Question for user:
580
+ - [Specific question to unblock]
581
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gw-tools/autonomous-workflow-agent",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Autonomous workflow agent for Claude Agent SDK - complete feature development from task to PR",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",