Skip to content

fix(brainstorming): keep the companion's project files out of git - #2770

Open
magrathean-uk wants to merge 1 commit into
obra:devfrom
magrathean-uk:fix/brainstorm-self-ignore
Open

magrathean-uk wants to merge 1 commit into
obra:devfrom
magrathean-uk:fix/brainstorm-self-ignore

Conversation

@magrathean-uk

Copy link
Copy Markdown

Who is submitting this PR? (required)

Field Value
Your model + version Claude Opus 5.5 (claude-opus-5-5)
Harness + version Claude Code 2.1.334 (terminal CLI)
All plugins installed codex@openai-codex; two private, unpublished workstation plugins (storage-placement and ops helpers); a local status-bar theme mod; Claude Code's built-in plugins. Superpowers itself was not installed as a plugin: the change was made and tested in a git clone of this repo.
Human partner who reviewed this diff @magrathean-uk (see the Human review box at the bottom)

What your human partner asked you to do, in their words:

copy all these repos to here, on each, start a PR and one issue. find something what is meaningful, not been tackled, not been thought of.

A lead agent then ran a discovery pass over this repo, picked this item, and briefed me to implement it.

Human-authored summary (required, under 200 words)

I asked my agent to look through Superpowers and find an issue nobody had picked up yet.

Turns out the brainstorm visual companion stores its session key and other working files inside .superpowers/brainstorm/, without anything telling Git to ignore them. A simple git add -A can end up committing the session key without the user even realising it.

The fix follows the same approach already used by sdd-workspace for .superpowers/sdd/. It creates a .gitignore containing * if one doesn't already exist, leaving any existing configuration untouched.

Pretty small change overall, one script modification and two test cases.

What problem are you trying to solve?

visual-companion.md tells the agent to start the companion with --project-dir <project root>. start-server.sh then creates <root>/.superpowers/brainstorm/, and the server writes the session key (.last-token), the port (.last-port) and, per session, state/server-info (which holds the full ?key= URL), server.log, server.pid and server-instance-id, plus the mockups under content/. Nothing marks any of it ignored. The only guard is one line of prose: "Remind the user to add .superpowers/ to .gitignore if it's not already there." So an agent that runs git add -A or git commit -a later in the session stages all of it, key included.

This was found by reading the code and reproduced with the documented start command; no agent session that committed these files was observed directly. It does happen in practice: on 3 December 2026 GitHub code search for path:.superpowers/brainstorm returned 34,272 files in public repositories, 1,452 of them named server.log.

Reproduction on dev (d4b6d3b), macOS, bash 5.3, Node 26, in a fresh git repo:

$ bash skills/brainstorming/scripts/start-server.sh --project-dir /tmp/example --background
$ git -C /tmp/example status --porcelain --untracked-files=all
?? .superpowers/brainstorm/.last-port
?? .superpowers/brainstorm/.last-token
?? .superpowers/brainstorm/76354-1796284070/state/server-info
?? .superpowers/brainstorm/76354-1796284070/state/server-instance-id
?? .superpowers/brainstorm/76354-1796284070/state/server.log
?? .superpowers/brainstorm/76354-1796284070/state/server.pid
$ git -C /tmp/example check-ignore .superpowers/brainstorm/.last-token; echo $?
1

With this branch, the same steps print nothing for git status, and check-ignore prints the path and exits 0.

What does this PR change?

When --project-dir is given, start-server.sh writes .superpowers/brainstorm/.gitignore containing * if no file exists there yet. This is the same create-only, self-ignoring file sdd-workspace already writes for .superpowers/sdd/. /tmp sessions are unchanged. Two cases are added to tests/brainstorm-server/start-server.test.sh.

Is this change appropriate for the core library?

Yes. It is plugin infrastructure that every user of the visual companion runs, it adds no dependency, and it brings brainstorm in line with what SDD already does for the same directory tree. It does not touch the project's own .gitignore or any tracked file.

What alternatives did you consider?

Trade-off: ignored mockups no longer show in git status, the same trade-off SDD accepted for its workspace. A repo that wants to commit mockups can put its own .gitignore there; the create-only check leaves it in place.

Does this PR contain multiple unrelated changes?

No. One script change and its test.

Existing PRs

Environments tested

Harness (e.g. Claude Code, Cursor) Harness version Model Model version/ID
Claude Code (agent ran the scripts and test suites in bash on macOS; no brainstorming session was run in the harness) 2.1.334 Claude Opus 5.5 claude-opus-5-5

New harness support (required if this PR adds a new harness)

Not applicable: no harness is added.

Evaluation

  • Initial prompt: the request quoted above; the problem was found by reading start-server.sh and server.cjs, not from a failing session.
  • No skill text changed, so no eval sessions were run. Before/after evidence is the reproduction above and the new test, which fails on dev (9 passed, 1 failed, listing the untracked .last-token, server-instance-id and server.pid) and passes on this branch (10 passed, 0 failed).
  • Suites run on this branch (macOS, Node 26.13.1, bash 5.3): start-server.test.sh 10/10, stop-server.test.sh 7/7, windows-lifecycle.test.sh 9 passed and 3 skipped, ws-protocol.test.js 32/32, server.test.js 34/34, lifecycle.test.js 13/13, auth.test.js 20/20, helper.test.js 15/15, browser-launcher.test.js 3/3, and scripts/lint-shell.sh on both files exits 0. branding.test.js fails 3 of 7 cases on an unmodified dev checkout too; this PR does not touch it.
  • This change was written with Claude Code (Claude Opus 5.5) and verified only by the commands above.

Rigor

  • If this is a skills change: I used superpowers:writing-skills and
    completed adversarial pressure testing (paste results below). Not a skills change.
  • This change was tested adversarially, not just on the happy path. Covered: an existing .gitignore with custom content is left byte-identical; relative --project-dir still passes the existing cases. Not covered: Windows Git Bash.
  • I did not modify carefully-tuned content (Red Flags table,
    rationalizations, "human partner" language) without extensive evals
    showing the change is an improvement

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

🤖 Generated with Claude Code

With --project-dir, start-server.sh puts the session key (.last-token),
the port, server logs, the PID and later the mockups under
<project>/.superpowers/brainstorm/, and nothing marks them ignored, so
an agent's `git add -A` stages them. Write the same create-only,
self-ignoring .gitignore that sdd-workspace writes for .superpowers/sdd/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@danishkumar26 danishkumar26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@/home/ubuntu/.hermes/cache/scratch/review-2770.md

@danishkumar26

Copy link
Copy Markdown

What this change does:
When the brainstorm companion server starts with --project-dir, it now writes a create-only self-ignoring .gitignore (*) into /.superpowers/brainstorm/, so session files - the .last-token key, logs, pid, mockups - stay out of git status and cannot be committed by git add -A. An existing .gitignore in that folder is left untouched. Two new cases in tests/brainstorm-server/start-server.test.sh cover both behaviors using a temp git repo and a fake node binary.

Nice to have:

  1. The test touches .last-token itself and runs the script with a node stub that exits immediately, so server.cjs never writes a real token. The ignore rule is exercised; the script's own token-writing path is not. One test with a real node would close the gap.

Verdict: Ship.

Not checked: runtime behavior with a real Node server. Cross-fork CI cannot run on the author fork, so no checks are reported.

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.

2 participants