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

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
@@ -6,7 +6,8 @@
6
6
 
7
7
  ```bash
8
8
  # One-liner (global - works in all projects)
9
- curl -fsSL https://raw.githubusercontent.com/mthines/gw-tools/main/packages/autonomous-workflow-agent/agents/autonomous-workflow.md \
9
+ mkdir -p ~/.claude/agents && \
10
+ curl -fsSL https://raw.githubusercontent.com/mthines/gw-tools/main/packages/autonomous-workflow-agent/agents/autonomous-workflow.md \
10
11
  -o ~/.claude/agents/autonomous-workflow.md
11
12
  ```
12
13
 
@@ -168,9 +169,52 @@ type ToolName = 'Read' | 'Write' | 'Edit' | 'Bash' | 'Glob' | 'Grep' | 'WebSearc
168
169
  ## Requirements
169
170
 
170
171
  - **Git** with worktree support (Git 2.5+)
171
- - **[gw CLI](https://github.com/mthines/gw-tools)** for worktree management
172
+ - **[gw CLI](https://github.com/mthines/gw-tools)** for worktree management (v0.20+)
172
173
  - **Node.js** project (npm/pnpm/yarn)
173
174
 
175
+ ## Compatibility
176
+
177
+ | Dependency | Minimum Version | Notes |
178
+ | --------------- | --------------- | ------------------------- |
179
+ | Git | 2.5+ | Worktree support required |
180
+ | gw CLI | 0.20+ | Earlier versions may work |
181
+ | Claude Code SDK | 1.x | Tested with v1.0.x |
182
+ | Node.js | 18+ | For running the agent |
183
+
184
+ ## Performance Characteristics
185
+
186
+ Realistic expectations for agent behavior:
187
+
188
+ | Metric | Typical Range | Notes |
189
+ | ------------------- | ------------- | ---------------------------------- |
190
+ | Agent turns | 15-80 | Depends on task complexity |
191
+ | Files changed | 3-20 | Soft limit at 20, hard limit at 50 |
192
+ | Test iterations | 2-8 | Escalates to user at 7+ |
193
+ | Commits per feature | 3-10 | Logical, incremental commits |
194
+ | Success rate (Lite) | ~90% | Simple fixes, 1-3 files |
195
+ | Success rate (Full) | ~75% | Complex features, 4+ files |
196
+
197
+ **Note:** These are estimates based on typical usage. Actual performance varies by codebase complexity, test suite speed, and task clarity.
198
+
199
+ ## Model Selection
200
+
201
+ The agent defaults to **Sonnet** which handles ~80% of tasks effectively. Consider **Opus** for:
202
+
203
+ | Use Opus When | Stick with Sonnet When |
204
+ | -------------------------------------------------- | --------------------------------- |
205
+ | Architectural changes (new patterns, abstractions) | Bug fixes and small features |
206
+ | Complex multi-system integrations | Single-system changes |
207
+ | Ambiguous requirements needing inference | Clear, well-defined requirements |
208
+ | Large refactoring (10+ files) | Focused changes (1-5 files) |
209
+ | Novel problem domains | Familiar patterns in the codebase |
210
+
211
+ ````typescript
212
+ // Override model for complex tasks
213
+ const myAgent = {
214
+ ...autonomousWorkflowAgent,
215
+ model: 'opus',
216
+ };
217
+
174
218
  ### Installing gw CLI
175
219
 
176
220
  This agent uses the `gw` CLI under the hood to manage Git worktrees. The CLI handles:
@@ -181,6 +225,37 @@ This agent uses the `gw` CLI under the hood to manage Git worktrees. The CLI han
181
225
  - Navigating between worktrees (`gw cd`)
182
226
  - Cleaning up merged worktrees (`gw clean`)
183
227
 
228
+ ### Secret Handling in Worktrees
229
+
230
+ 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.
231
+
232
+ **Setup (one-time):**
233
+
234
+ ```bash
235
+ # Configure which files to auto-copy
236
+ gw init --auto-copy-files .env,secrets/,.env.local
237
+
238
+ # Ensure secrets exist in your main worktree first
239
+ cd main
240
+ cp .env.example .env
241
+ # Edit .env with your actual secrets
242
+ ````
243
+
244
+ **How it works:**
245
+
246
+ 1. Secrets are stored in your `main` worktree (the source)
247
+ 2. When `gw checkout` creates a new worktree, it copies `autoCopyFiles` from `main`
248
+ 3. Worktree secrets are independent—changes don't affect other worktrees
249
+ 4. Use `gw sync <worktree>` to update secrets in existing worktrees
250
+
251
+ **Security notes:**
252
+
253
+ - `.env` files are never committed (ensure they're in `.gitignore`)
254
+ - Each worktree gets its own copy—no shared state
255
+ - The agent never reads or logs secret values
256
+
257
+ 📖 **Full details:** [gw-tools secret handling](https://github.com/mthines/gw-tools/tree/main/packages/gw-tool#initial-setup-secrets-in-the-default-branch)
258
+
184
259
  ```bash
185
260
  # Via npm
186
261
  npm install -g @gw-tools/gw
@@ -240,6 +315,48 @@ Traditional AI coding assistants modify your working directory directly. This me
240
315
 
241
316
  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
317
 
318
+ ## Observability
319
+
320
+ ### Watching Agent Progress
321
+
322
+ For Full Mode tasks, the agent maintains progress artifacts you can monitor:
323
+
324
+ ```bash
325
+ # Watch real-time progress (Full Mode)
326
+ tail -f .gw/<branch>/task.md
327
+
328
+ # Check the implementation plan
329
+ cat .gw/<branch>/plan.md
330
+
331
+ # After completion, review the walkthrough
332
+ cat .gw/<branch>/walkthrough.md
333
+ ```
334
+
335
+ ### Claude Code Hooks (Optional)
336
+
337
+ Get notifications when the agent completes significant actions:
338
+
339
+ ```json
340
+ // ~/.claude/settings.json
341
+ {
342
+ "hooks": {
343
+ "postToolUse": {
344
+ "Bash": "echo \"gw action completed\" | tee -a /tmp/agent.log"
345
+ }
346
+ }
347
+ }
348
+ ```
349
+
350
+ **Platform-specific notifications:**
351
+
352
+ ```bash
353
+ # macOS
354
+ osascript -e 'display notification "Agent completed action" with title "gw"'
355
+
356
+ # Linux (requires libnotify)
357
+ notify-send "gw" "Agent completed action"
358
+ ```
359
+
243
360
  ## Troubleshooting
244
361
 
245
362
  ### "gw: command not found"
@@ -254,12 +371,65 @@ The agent includes "smart detection" to reuse existing worktrees. If you're seei
254
371
 
255
372
  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
373
 
374
+ ### Agent issued an invalid gw command
375
+
376
+ If the agent hallucinates a `gw` command that doesn't exist:
377
+
378
+ 1. Check `.gw/<branch>/task.md` for what the agent was trying to do
379
+ 2. Look at the error message for the actual command attempted
380
+ 3. Manually run the correct command or guide the agent
381
+
382
+ Common hallucinations:
383
+
384
+ - `gw create` → should be `gw checkout` or `gw add`
385
+ - `gw switch` → should be `gw cd`
386
+ - `gw delete` → should be `gw remove`
387
+
388
+ ### Agent stuck in a loop
389
+
390
+ If the agent keeps trying the same fix repeatedly:
391
+
392
+ 1. Check `.gw/<branch>/task.md` for iteration history
393
+ 2. Look for repeated "Attempt N" entries with similar fixes
394
+ 3. Interrupt and provide guidance: "Try a different approach—the issue is X"
395
+
396
+ The agent has built-in loop detection and will ask for help after 7+ similar attempts, but you can intervene earlier.
397
+
398
+ ### Agent created wrong worktree name
399
+
400
+ The agent uses smart worktree detection. If it created a worktree with an unexpected name:
401
+
402
+ ```bash
403
+ # List all worktrees
404
+ gw list
405
+
406
+ # Navigate to the correct one
407
+ gw cd <branch-name>
408
+
409
+ # Or remove and recreate
410
+ gw remove <wrong-branch>
411
+ ```
412
+
413
+ ### Secrets missing in new worktree
414
+
415
+ If `.env` or other secrets weren't copied:
416
+
417
+ 1. Verify `autoCopyFiles` is configured: `cat .gw/config.json`
418
+ 2. Ensure secrets exist in your `main` worktree
419
+ 3. Manually sync: `gw sync <worktree> .env`
420
+
257
421
  ## Related
258
422
 
259
423
  - **[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
424
+ - **[Skill Documentation](https://github.com/mthines/gw-tools/tree/main/skills/autonomous-workflow)** — Full skill with all rules and templates
261
425
  - **[Claude Code SDK](https://github.com/anthropics/claude-code-sdk)** — Official SDK for building Claude agents
262
426
 
427
+ ## Community & Support
428
+
429
+ - **Issues & Feature Requests:** [github.com/mthines/gw-tools/issues](https://github.com/mthines/gw-tools/issues)
430
+ - **Questions & Discussions:** Open an issue with the `question` label
431
+ - **Share your experience:** We'd love to hear how you're using the agent—open an issue with the `show-and-tell` label
432
+
263
433
  ## Contributing
264
434
 
265
435
  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.1",
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",