Skip to content

Add Write tool to sidebar agent and improve error visibility#584

Open
1aifanatic wants to merge 3 commits intogarrytan:mainfrom
1aifanatic:contribution-3-sidebar-agent
Open

Add Write tool to sidebar agent and improve error visibility#584
1aifanatic wants to merge 3 commits intogarrytan:mainfrom
1aifanatic:contribution-3-sidebar-agent

Conversation

@1aifanatic
Copy link
Copy Markdown

Summary

Fixes two issues with the sidebar agent: (1) missing Write tool prevents file creation, and (2) errors are invisible when Claude fails or returns empty.

Changes

  1. Add Write tool support:

    • Adds 'Write' to --allowedTools list in sidebar-agent.ts
    • Users can now create files (CSVs, logs, etc.) via sidebar agent
  2. Improve error visibility:

    • Captures stderr output instead of discarding it
    • Includes stderr in error messages for spawn errors and timeouts
    • Helps debug issues when Claude errors or returns empty output

Motivation

Previously, users asking to `write this to a CSV'' would silently fail because Write wasn't in allowedTools. And when the sidebar agent errored, users would just see a green dot forever with no indication of what went wrong.

Testing

  • TypeScript compiles without errors
  • Follows existing error handling patterns in the codebase

Closes TODOS.md item: Sidebar agent needs Write tool + better error visibility

Adds a new bin/gstack-open-url script that opens URLs in the default
browser across macOS, Linux, and Windows platforms.

- Uses 'open' on macOS
- Uses 'xdg-open' on Linux
- Uses 'start' on Windows
- Supports GSTACK_OPEN_CMD env override for custom handlers

This fixes the hardcoded 'open' command that only worked on macOS,
enabling the Boil the Lake and Search Before Building intro flows
to work on all supported platforms.

Closes TODOS.md item: Cross-platform URL open helper
Adds the first-time Search Before Building intro flow, similar to
the existing Boil the Lake intro.

Changes:
- Add generateSearchIntro() function that introduces the Search Before
  Building principle with a link to the essay
- Add SEARCH_INTRO preamble variable that checks for .search-intro-seen
- Update generateLakeIntro() to use the new gstack-open-url helper for
  cross-platform URL opening
- Add generateSearchIntro() to tier >= 3 preamble sections

This creates a consistent pattern for first-time principle introductions
and enables cross-platform browser opening for both intros.

Closes TODOS.md item: First-time Search Before Building intro
Fixes two issues with the sidebar agent:

1. Add Write tool support:
   - Adds 'Write' to --allowedTools list
   - Users can now create files (CSVs, logs, etc.) via sidebar agent

2. Improve error visibility:
   - Capture stderr output instead of ignoring it
   - Include stderr in error messages for spawn errors and timeouts
   - This helps debug issues when Claude errors or returns empty output

Previously, users asking to write files would silently fail, and
errors were invisible. Now both issues are surfaced properly.

Closes TODOS.md item: Sidebar agent needs Write tool + better error visibility
garrytan added a commit that referenced this pull request Mar 29, 2026
Tests-first for all fixes in this PR wave:
- #594 discoverability: gstack tag in descriptions, 120-char first line
- #573 feature signals: ship/SKILL.md Step 4 detection
- #510 context warnings: no preemptive warnings in generated files
- #474 Safety Net: no find -delete in generated files
- #467 telemetry: JSONL writes gated by _TEL conditional
- #584 sidebar: Write in allowedTools, stderr capture
- #578 relink: prefixed/flat symlinks, cleanup, error, config hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
garrytan added a commit that referenced this pull request Mar 29, 2026
…584)

Add Write to sidebar allowedTools (both sidebar-agent.ts and server.ts).
Write doesn't expand attack surface beyond what Bash already provides.
Replace empty stderr handler with buffer capture for better error
diagnostics. New bin/gstack-open-url for cross-platform URL opening.

Does NOT include Search Before Building intro flow (deferred).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24601 pushed a commit to 24601/gastack that referenced this pull request Mar 29, 2026
Tests-first for all fixes in this PR wave:
- garrytan#594 discoverability: gstack tag in descriptions, 120-char first line
- garrytan#573 feature signals: ship/SKILL.md Step 4 detection
- garrytan#510 context warnings: no preemptive warnings in generated files
- garrytan#474 Safety Net: no find -delete in generated files
- garrytan#467 telemetry: JSONL writes gated by _TEL conditional
- garrytan#584 sidebar: Write in allowedTools, stderr capture
- garrytan#578 relink: prefixed/flat symlinks, cleanup, error, config hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24601 pushed a commit to 24601/gastack that referenced this pull request Mar 29, 2026
…arrytan#584)

Add Write to sidebar allowedTools (both sidebar-agent.ts and server.ts).
Write doesn't expand attack surface beyond what Bash already provides.
Replace empty stderr handler with buffer capture for better error
diagnostics. New bin/gstack-open-url for cross-platform URL opening.

Does NOT include Search Before Building intro flow (deferred).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
garrytan added a commit that referenced this pull request Mar 30, 2026
…y (v0.13.5.0) (#641)

* test: add 16 failing tests for 6 community fixes

Tests-first for all fixes in this PR wave:
- #594 discoverability: gstack tag in descriptions, 120-char first line
- #573 feature signals: ship/SKILL.md Step 4 detection
- #510 context warnings: no preemptive warnings in generated files
- #474 Safety Net: no find -delete in generated files
- #467 telemetry: JSONL writes gated by _TEL conditional
- #584 sidebar: Write in allowedTools, stderr capture
- #578 relink: prefixed/flat symlinks, cleanup, error, config hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: replace find -delete with find -exec rm for Safety Net (#474)

-delete is a non-POSIX extension that fails on Safety Net environments.
-exec rm {} + is POSIX-compliant and works everywhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: gate local JSONL writes by telemetry setting (#467)

When telemetry is off, nothing is written anywhere — not just remote,
but local JSONL too. Clean trust contract: off means off everywhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove preemptive context warnings from plan-eng-review (#510)

The system handles context compaction automatically. Preemptive warnings
waste tokens and create false urgency. Skills should not warn about
context limits — just describe the compression priority order.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add (gstack) tag to skill descriptions for discoverability (#594)

Every SKILL.md.tmpl description now contains "gstack" on the last line,
making skills findable in Claude Code's command palette. First-line hooks
stay under 120 chars. Split ship description to fix wrapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: auto-relink skill symlinks on prefix config change (#578)

New bin/gstack-relink creates prefixed (gstack-*) or flat symlinks
based on skill_prefix config. gstack-config auto-triggers relink
when skill_prefix changes. Setup guards against recursive calls
with GSTACK_SETUP_RUNNING env var.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add feature signal detection to version bump heuristic (#573)

/ship Step 4 now checks for feature signals (new routes, migrations,
test+source pairs, feat/ branches) when deciding version bumps.
PATCH requires no feature signals. MINOR asks the user if any signal
is detected or 500+ lines changed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: sidebar Write tool, stderr capture, cross-platform URL opener (#584)

Add Write to sidebar allowedTools (both sidebar-agent.ts and server.ts).
Write doesn't expand attack surface beyond what Bash already provides.
Replace empty stderr handler with buffer capture for better error
diagnostics. New bin/gstack-open-url for cross-platform URL opening.

Does NOT include Search Before Building intro flow (deferred).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update sidebar-security test for Write tool addition

The fallback allowedTools string now includes Write, matching the
sidebar-agent.ts change from commit 68dc957.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump version and changelog (v0.13.5.0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: prevent gstack-relink from double-prefixing gstack-upgrade

gstack-relink now checks if a skill directory is already named gstack-*
before prepending the prefix. Previously, setting skill_prefix=true would
create gstack-gstack-upgrade, breaking the /gstack-upgrade command.

Matches setup script behavior (setup:260) which already has this guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: add double-prefix fix to changelog

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove .factory/ from git tracking and add to .gitignore

Generated Factory Droid skills are build output, same as .agents/.
They should not be committed to the repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant