Commit Graph

50 Commits

Author SHA1 Message Date
Jesse Vincent
f076bd3431 Fix owner-PID false positive when owner runs as different user
ownerAlive() treated EPERM (permission denied) the same as ESRCH
(process not found), causing the server to self-terminate within 60s
whenever the owner process ran as a different user. This affected WSL
(owner is a Windows process), Tailscale SSH, and any cross-user
scenario.

The fix: `return e.code === 'EPERM'` — if we get permission denied,
the process is alive; we just can't signal it.

Tested on Linux via Tailscale SSH with a root-owned grandparent PID:
- Server survives past the 60s lifecycle check (EPERM = alive)
- Server still shuts down when owner genuinely dies (ESRCH = dead)

Fixes #879
2026-03-25 11:03:53 -07:00
Jesse Vincent
9e3ed213a0 Separate brainstorm server content and state into peer directories
The session directory now contains two peers: content/ (HTML served to
the browser) and state/ (events, server-info, pid, log). Previously
all files shared a single directory, making server state and user
interaction data accessible over the /files/ HTTP route.

Also fixes stale test assertion ("Waiting for Claude" → "Waiting for
the agent").

Reported-By: 吉田仁
2026-03-25 11:03:53 -07:00
Jesse Vincent
9e6e077d33 Revert "Move brainstorm server metadata to .meta/ subdirectory"
This reverts commit ab500dade6.
2026-03-25 11:03:53 -07:00
Jesse Vincent
151cfb16a0 Move brainstorm server metadata to .meta/ subdirectory
Metadata files (.server-info, .events, .server.pid, .server.log,
.server-stopped) were stored in the same directory served over HTTP,
making them accessible via the /files/ route. They now live in a .meta/
subdirectory that is not web-accessible.

Also fixes a stale test assertion ("Waiting for Claude" → "Waiting for
the agent").

Reported-By: 吉田仁
2026-03-25 11:03:53 -07:00
Jesse Vincent
3f80f1c769 Reapply "Replace subagent review loops with lightweight inline self-review"
This reverts commit b045fa3950.
2026-03-25 11:03:53 -07:00
Jesse Vincent
4ae1a3d6a6 Revert "Replace subagent review loops with lightweight inline self-review"
This reverts commit bf8f7572eb.
2026-03-25 11:03:53 -07:00
Jesse Vincent
e6221a48c5 Replace subagent review loops with lightweight inline self-review
The subagent review loop (dispatching a fresh agent to review plans/specs)
doubled execution time (~25 min overhead) without measurably improving plan
quality. Regression testing across 5 versions (v3.6.0 through v5.0.4) with
5 trials each showed identical plan sizes, task counts, and quality scores
regardless of whether the review loop ran.

Changes:
- writing-plans: Replace subagent Plan Review Loop with inline Self-Review
  checklist (spec coverage, placeholder scan, type consistency)
- writing-plans: Add explicit "No Placeholders" section listing plan failures
  (TBD, vague descriptions, undefined references, "similar to Task N")
- brainstorming: Replace subagent Spec Review Loop with inline Spec Self-Review
  (placeholder scan, internal consistency, scope check, ambiguity check)
- Both skills now use "look at it with fresh eyes" framing

Testing: 5 trials with the new skill show self-review catches 3-5 real bugs
per run (spawn positions, API mismatches, seed bugs, grid indexing) in ~30s
instead of ~25 min. Remaining defects are comparable to the subagent approach.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:03:53 -07:00
sarbojitrana
3128a2c3cd fix : resolve ESM/CommonJS module confict in brainstorming server 2026-03-17 14:34:16 -07:00
jesse
f34ee479b7 fix: Windows brainstorm server lifecycle, restore execution choice
- Skip OWNER_PID monitoring on Windows/MSYS2 where the PID namespace is
  invisible to Node.js, preventing server self-termination after 60s (#770)
- Document run_in_background: true for Claude Code on Windows (#767)
- Restore user choice between subagent-driven and inline execution after
  plan writing; subagent-driven is recommended but no longer mandatory
- Add Windows lifecycle test script verified on Windows 11 VM
- Note #723 (stop-server.sh reliability) as already fixed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 04:09:36 +00:00
savvyinsight
61a64d7098 fix: verify server actually stopped in stop-server.sh 2026-03-16 17:24:01 -07:00
Jesse Vincent
a4c48714bc Use generic "the agent" instead of "Claude" in brainstorm server 2026-03-16 15:57:27 -07:00
Jesse Vincent
2c6a8a352d Tone down review loops: single-pass plan review, raise issue bar
- Remove chunk-based plan review in favor of single whole-plan review
- Add Calibration sections to both reviewer prompts so only serious
  issues block approval
- Reduce max review iterations from 5 to 3
- Streamline reviewer checklists (spec: 7→5, plan: 7→4 categories)
2026-03-16 15:57:23 -07:00
jesse
addfe8511a fix: use portable shebang #!/usr/bin/env bash in all shell scripts
Replace #!/bin/bash with #!/usr/bin/env bash in 13 scripts. The
hardcoded path fails on NixOS, FreeBSD, and macOS with Homebrew bash.
#!/usr/bin/env bash is the portable POSIX-friendly alternative.

Tested on Linux and Windows (Git Bash + CMD). macOS is the primary
beneficiary since Homebrew installs bash to /opt/homebrew/bin/bash.

Based on #700, closes #700.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:38:04 +00:00
jesse
c6a2b1b576 fix: auto-foreground brainstorm server on Windows/Git Bash
Windows/Git Bash reaps nohup background processes, causing the brainstorm
server to die silently after launch. Auto-detect Windows via OSTYPE
(msys/cygwin/mingw) and MSYSTEM env vars, switching to foreground mode
automatically. Tested on Windows 11 from CMD, PowerShell, and Git Bash —
all route through Git Bash and hit the same issue.

Based on #740, fixes #737. Also adds CHANGELOG.md documenting the fix and
a known OWNER_PID/WINPID mismatch on the main branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:30:35 +00:00
Jesse Vincent
9ccce3bf07 Add context isolation principle to all delegation skills
Subagents should never inherit the parent session's context or history.
The dispatcher constructs exactly what each subagent needs, keeping
both sides focused: the subagent on its task, the controller on
coordination.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:47:56 -07:00
Jesse Vincent
b484bae134 Fix owner PID tracking: resolve grandparent to get actual harness PID
$PPID inside start-server.sh is the ephemeral shell the harness spawns
to run the script — it dies immediately when the script exits, causing
the server to shut down after ~60s. Now resolves grandparent PID via
`ps -o ppid= -p $PPID` to get the actual harness process (e.g. claude).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:47:47 -07:00
Jesse Vincent
ec99b7c4a4 Exit server when owner process dies (harness-agnostic cleanup)
start-server.sh passes $PPID as BRAINSTORM_OWNER_PID to the server.
The server checks every 60s if the owner process is still alive
(kill -0). If it's gone, the server shuts down immediately —
deletes .server-info, writes .server-stopped, exits cleanly.
Works across all harnesses (CC, Codex, Gemini CLI) since it
tracks the shell process that launched the script, which dies
when the harness dies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:39:04 -07:00
Jesse Vincent
263e3268f4 Auto-exit server after 30 minutes idle, add liveness check to skill
Server tracks activity (HTTP requests, WebSocket messages, file
changes) and exits after 30 minutes of inactivity. On exit, deletes
.server-info and writes .server-stopped with reason. Visual companion
guide now instructs agents to check .server-info before each screen
push and restart if needed. Works on all harnesses, not just CC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:32:09 -07:00
Drew Ritter
85cab6eff0 (fix): declare encoding meta on viz brainstorm server pages 2026-03-11 16:22:29 -07:00
Jesse Vincent
7619570679 Remove vendored node_modules, swap to zero-dep server.js
Delete 717 files: index.js, package.json, package-lock.json, and
the entire node_modules directory (express, ws, chokidar + deps).
Update start-server.sh to use server.js. Remove gitignore exception.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:17:52 -07:00
Jesse Vincent
8d9b94eb8d Add HTTP server, WebSocket handling, and file watching to server.js
Complete zero-dep brainstorm server. Uses knownFiles set to
distinguish new screens from updates (macOS fs.watch reports
'rename' for both). All 56 tests pass (31 unit + 25 integration).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:17:14 -07:00
Jesse Vincent
7f6380dd91 Add WebSocket protocol layer for zero-dep brainstorm server
Implements RFC 6455 handshake, frame encoding/decoding for text
frames. All 31 unit tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:15:19 -07:00
Jesse Vincent
9d2b886211 Fix brainstorming skill: add spec review loop to checklist and flow diagram
The spec review loop (dispatch spec-document-reviewer subagent, iterate
until approved) existed in the prose "After the Design" section but was
missing from both the checklist and the process flow diagram. Since agents
follow the diagram and checklist more reliably than prose, the spec review
step was being skipped entirely.

Added step 7 (spec review loop) to the checklist and a corresponding
"Spec review loop" → "Spec review passed?" node pair to the dot graph.

Tested with claude --plugin-dir and claude-session-driver: worker now
correctly dispatches the spec-document-reviewer subagent after writing
the design doc and before presenting to the user for review.

Fixes #677.
2026-03-10 18:40:49 -07:00
Jesse Vincent
e02842e024 Remove fsevents from bundled deps (macOS-only native binary)
fsevents is an optional chokidar dependency that only works on macOS.
Chokidar falls back gracefully without it on all platforms.
2026-03-09 21:37:04 -07:00
Jesse Vincent
7446c842d8 Bundle brainstorm server dependencies instead of requiring npm install
Vendor node_modules into the repo so the brainstorm server works
immediately on fresh plugin installs without needing npm at runtime.
2026-03-09 21:36:37 -07:00
Jesse Vincent
5e2a89e985 Auto-install brainstorm server dependencies on first run
start-server.sh now runs npm install if node_modules is missing.
Fixes broken server when superpowers is installed as a plugin (node_modules
are in .gitignore and not included in the clone).
2026-03-09 21:35:33 -07:00
Jesse Vincent
7f8edd9c12 Write server-info to file so agents can find URL after background launch
The server now writes its startup JSON to $SCREEN_DIR/.server-info.
Agents that launch the server via background execution (where stdout is
hidden) can read this file to get the URL, port, and screen_dir.
2026-03-09 20:46:34 -07:00
Jesse Vincent
81acbcd51e Replace Codex-specific server guidance with per-platform launch instructions
The visual companion docs now give concrete launch commands per platform:
Claude Code (default mode), Codex (auto-foreground via CODEX_CI), Gemini CLI
(--foreground with is_background), and a fallback for other environments.
2026-03-09 20:32:41 -07:00
Jesse Vincent
419889b0d3 Move brainstorm-server into skill directory per agentskills spec
Moves lib/brainstorm-server/ → skills/brainstorming/scripts/ so the
brainstorming skill uses relative paths (scripts/start-server.sh) instead
of ${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/. This follows the
agentskills.io specification for portable, cross-platform skills.

Updates visual-companion.md references and test paths. All tests pass.
2026-03-09 19:43:48 -07:00
Jesse Vincent
ec3f7f1027 fix(brainstorming): add user review gate between spec and writing-plans
After the spec review loop passes, the skill now asks the user to review
the written spec file before invoking writing-plans. This prevents the
agent from racing ahead to implementation planning without giving the
user a chance to read and adjust the written document.

Fixes #565
2026-03-09 18:16:22 -07:00
Jesse Vincent
8c01ac8051 Fix stale docs/plans path in brainstorming checklist 2026-03-08 14:57:11 -07:00
Jesse Vincent
aba2542f5e Broaden visual companion offer language beyond design-specific use cases 2026-03-08 12:25:44 -07:00
Jesse Vincent
d48b14e5ac Add project-level scope assessment to brainstorming pipeline
Brainstorming now assesses whether a project is too large for a single
spec and helps decompose into sub-projects. Scope check is inline in
the understanding phase (testing showed it was skipped as a separate step).
Spec reviewer also checks scope. Writing-plans has a backstop.
2026-03-06 14:48:48 -08:00
Jesse Vincent
daa3fb2322 Add architecture guidance and capability-aware escalation to skills
Add design-for-isolation and working-in-existing-codebases guidance to
brainstorming. Add file size awareness and escalation prompts to SDD
implementer and code quality reviewer. Writing-plans gets architecture
section sizing guidance. Spec and plan reviewers get architecture and
file size checks.
2026-03-06 14:48:48 -08:00
Jesse Vincent
ee14caeadd feat: add spec document reviewer prompt template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-06 14:26:09 -08:00
Jesse Vincent
866f2bdb47 Add visual companion integration to brainstorming skill
Brainstorming skill now offers an optional browser-based visual companion
for questions involving visual decisions (mockups, layouts, diagrams).
The companion is a tool, not a mode — each question is evaluated for
whether browser or terminal is more appropriate.

Includes visual-companion.md progressive disclosure guide with server
workflow, screen authoring patterns, and feedback collection.

Co-Authored-By: Drew Ritter <drew@ritter.dev>
2026-03-06 13:01:31 -08:00
Jesse Vincent
7f2ee614b6 Enforce brainstorming workflow with hard gates and process flow
The brainstorming skill described a process but didn't enforce it. Models
would skip the design phase and jump straight to implementation skills
like frontend-design, or collapse the entire brainstorming process into
a single text block.

Changes to brainstorming skill:
- Add HARD-GATE: no implementation until design is approved
- Add explicit checklist that maps to task items
- Add graphviz process flow with writing-plans as terminal state
- Add anti-pattern callout for "too simple to need a design"
- Scale design sections by section complexity, not project complexity
- Make writing-plans the only valid next skill after brainstorming

Changes to using-superpowers skill:
- Add EnterPlanMode intercept to workflow graph
- Route plan mode attempts through brainstorming skill instead

Tested with claude -p --plugin-dir across three variants (no skill,
original skill, updated skill) to verify behavioral compliance.
2026-02-12 10:51:12 -08:00
Jesse Vincent
612fbcdd01 Tweak the brainstorming skill to try to improve triggering 2025-12-17 16:44:52 -08:00
Jesse Vincent
3f725ff0d4 Strengthen brainstorming skill trigger and add skill priority guidance
- Update brainstorming description to use imperative "You MUST use this"
- Clarify trigger: "before any creative work - creating features, building
  components, adding functionality, or modifying behavior"
- Add Skill Priority section to using-superpowers to ensure process skills
  (brainstorming, debugging) are invoked before implementation skills
2025-12-17 16:44:51 -08:00
Jesse Vincent
8e38ab86dc Simplify brainstorming skill to match original vision
Remove heavyweight 6-phase process with formal checklists and return to
conversational approach:
- Natural dialogue instead of structured phases
- One question at a time without rigid progression
- 200-300 word design sections with validation
- Keep documentation and implementation handoff
- Remove AskUserQuestion tool requirements and complex flowcharts

This aligns with the original spec: help turn ideas into designs through
collaborative questioning, then present design in small sections.
2025-10-30 20:21:28 -07:00
Jesse Vincent
e3208f1d93 Apply writing clarity improvements to brainstorming skill
Applied Strunk's "Elements of Style" principles:
- Rule 13: Omitted needless words (removed "already", "genuinely", etc.)
- Rule 11: Converted negative to positive form ("don't ask" → "ask only when")
- Rule 10: Used active voice where appropriate
- Rule 15: Improved parallel construction in lists
- General: Made language more direct and concrete

Changes maintain the skill's functionality while improving readability.
2025-10-28 11:07:55 -07:00
Jesse Vincent
1d21ee842d Refine brainstorming skill for proactive research 2025-10-28 10:59:47 -07:00
Jesse Vincent
79436abffa Update all superpowers skill references to use namespace prefix
Skills are now namespaced as superpowers:<name> when referenced.
Updated all REQUIRED SUB-SKILL, RECOMMENDED SUB-SKILL, and
REQUIRED BACKGROUND references to use the superpowers: prefix.

Also added -design suffix to brainstorming skill's design document
filename to distinguish from implementation plan documents.

Files updated:
- brainstorming: Added -design suffix, updated skill references
- executing-plans: Updated finishing-a-development-branch reference
- subagent-driven-development: Updated finishing-a-development-branch reference
- systematic-debugging: Updated root-cause-tracing and test-driven-development references
- testing-skills-with-subagents: Updated test-driven-development reference
- writing-plans: Updated executing-plans and subagent-driven-development references
- writing-skills: Updated test-driven-development, systematic-debugging, and testing-skills-with-subagents references
2025-10-18 10:38:54 -07:00
Jesse Vincent
9597f088c4 Add design documentation phase to brainstorming skill
The old brainstorming command included writing the design document
before handing off to implementation planning. This was lost when
the command was converted to a skill.

Added Phase 4: Design Documentation to write the validated design
to docs/plans/YYYY-MM-DD-<topic>.md before proceeding to worktree
setup and planning.

Tested with subagent to verify design document is written and
committed even under time pressure.
2025-10-18 10:19:14 -07:00
Jesse Vincent
4d8db812ae Add AskUserQuestion tool guidance to brainstorming skill
- Add explicit guidance to use AskUserQuestion in Phase 1 (Understanding)
- Add explicit guidance to use AskUserQuestion in Phase 2 (Exploration)
- Add concrete examples showing how to structure questions with options
- Add "Question Patterns" section explaining when to use AskUserQuestion vs open-ended
- Update Quick Reference table to include Tool Usage column
- Update Key Principles to mention structured choices with AskUserQuestion

Benefits:
- Makes it clear when to use structured vs open-ended questions
- Provides concrete examples for effective use of AskUserQuestion
- Helps present options with clear trade-offs
- 156 lines (well under 500-line Anthropic recommendation)
2025-10-17 10:48:50 -07:00
Jesse Vincent
141953a4be Improve skill cross-references for clarity and compliance
Update all skill references to use explicit requirement markers:
- REQUIRED BACKGROUND: For prerequisite understanding
- REQUIRED SUB-SKILL: For mandatory workflow dependencies
- Complementary skills: For optional but helpful related skills

Changes:
- Remove old path format (skills/collaboration/X → X)
- Add explicit "REQUIRED" markers to make dependencies clear
- Update Integration sections with categorized skill relationships
- Fix non-existent skill references
- Update cross-reference documentation in writing-skills

This makes it immediately clear which skills MUST be used vs optional references,
helping Claude understand and comply with skill dependencies.
2025-10-17 10:18:50 -07:00
Jesse Vincent
9e82a51f34 Align brainstorming skill with Anthropic best practices
- Fix description: correct grammar and use third-person voice
- Add Quick Reference table for easy scanning
- Add copyable checklist for tracking progress through phases
- Add decision flowchart for when to revisit earlier phases
- Convert "Remember" section to structured Key Principles table
- Remove references to non-existent related skills

Follows Anthropic patterns:
- Workflow with checklist format
- Quick reference table at top
- Appropriate use of flowchart for decision points
- Scannable table format for principles
- 108 lines (well under 500-line recommendation)
2025-10-17 10:13:14 -07:00
Jesse Vincent
48410c7f19 Standardize skill frontmatter names to lowercase and kebab-case
- Update all 20 skill frontmatter names to match their directory names in lowercase
- Fix defense-in-depth name (was Defense-in-Depth-Validation)
- Fix receiving-code-review name (was Code-Review-Reception)
- Update all skill announcements and cross-references to use lowercase names
- Update commands redirects to reference lowercase skill names

Ensures consistent naming: skill directory names, frontmatter names, and documentation
references all use lowercase kebab-case format (e.g., brainstorming, test-driven-development)
2025-10-17 09:40:36 -07:00
Jesse Vincent
d6ca4d6213 oops 2025-10-16 13:21:16 -07:00
Jesse Vincent
9c9547cc04 Now that skills are a first-class thing in Claude Code, restore them to the primary plugin 2025-10-16 07:19:00 -07:00