@zcy2nn/agent-forge 1.0.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.
Files changed (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -0
  3. package/agent-forge.schema.json +675 -0
  4. package/dist/agents/council.d.ts +27 -0
  5. package/dist/agents/councillor.d.ts +2 -0
  6. package/dist/agents/implementer.d.ts +2 -0
  7. package/dist/agents/index.d.ts +30 -0
  8. package/dist/agents/orchestrator.d.ts +30 -0
  9. package/dist/agents/researcher.d.ts +2 -0
  10. package/dist/agents/reviewer.d.ts +2 -0
  11. package/dist/cli/config-io.d.ts +24 -0
  12. package/dist/cli/config-manager.d.ts +4 -0
  13. package/dist/cli/custom-skills.d.ts +29 -0
  14. package/dist/cli/doctor.d.ts +38 -0
  15. package/dist/cli/index.d.ts +2 -0
  16. package/dist/cli/index.js +1932 -0
  17. package/dist/cli/install.d.ts +2 -0
  18. package/dist/cli/migration.d.ts +46 -0
  19. package/dist/cli/model-key-normalization.d.ts +1 -0
  20. package/dist/cli/paths.d.ts +35 -0
  21. package/dist/cli/providers.d.ts +99 -0
  22. package/dist/cli/skills.d.ts +52 -0
  23. package/dist/cli/system.d.ts +6 -0
  24. package/dist/cli/types.d.ts +40 -0
  25. package/dist/config/agent-mcps.d.ts +15 -0
  26. package/dist/config/constants.d.ts +28 -0
  27. package/dist/config/council-schema.d.ts +127 -0
  28. package/dist/config/index.d.ts +5 -0
  29. package/dist/config/loader.d.ts +57 -0
  30. package/dist/config/runtime-preset.d.ts +12 -0
  31. package/dist/config/schema.d.ts +371 -0
  32. package/dist/config/utils.d.ts +15 -0
  33. package/dist/council/council-manager.d.ts +49 -0
  34. package/dist/council/index.d.ts +1 -0
  35. package/dist/divoom/council.gif +0 -0
  36. package/dist/divoom/designer.gif +0 -0
  37. package/dist/divoom/explorer.gif +0 -0
  38. package/dist/divoom/fixer.gif +0 -0
  39. package/dist/divoom/input.gif +0 -0
  40. package/dist/divoom/intro.gif +0 -0
  41. package/dist/divoom/librarian.gif +0 -0
  42. package/dist/divoom/manager.d.ts +57 -0
  43. package/dist/divoom/oracle.gif +0 -0
  44. package/dist/divoom/orchestrator.gif +0 -0
  45. package/dist/hooks/apply-patch/codec.d.ts +7 -0
  46. package/dist/hooks/apply-patch/errors.d.ts +25 -0
  47. package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
  48. package/dist/hooks/apply-patch/index.d.ts +15 -0
  49. package/dist/hooks/apply-patch/matching.d.ts +26 -0
  50. package/dist/hooks/apply-patch/operations.d.ts +3 -0
  51. package/dist/hooks/apply-patch/patch.d.ts +2 -0
  52. package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
  53. package/dist/hooks/apply-patch/resolution.d.ts +19 -0
  54. package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
  55. package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
  56. package/dist/hooks/apply-patch/types.d.ts +80 -0
  57. package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
  58. package/dist/hooks/auto-update-checker/checker.d.ts +32 -0
  59. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  60. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  61. package/dist/hooks/auto-update-checker/types.d.ts +22 -0
  62. package/dist/hooks/chat-headers.d.ts +16 -0
  63. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  64. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  65. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  66. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  67. package/dist/hooks/filter-available-skills/index.d.ts +32 -0
  68. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  69. package/dist/hooks/image-hook.d.ts +19 -0
  70. package/dist/hooks/index.d.ts +13 -0
  71. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  72. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  73. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  74. package/dist/hooks/post-file-tool-nudge/index.d.ts +19 -0
  75. package/dist/hooks/task-session-manager/index.d.ts +52 -0
  76. package/dist/hooks/todo-continuation/index.d.ts +53 -0
  77. package/dist/hooks/todo-continuation/todo-hygiene.d.ts +35 -0
  78. package/dist/index.d.ts +5 -0
  79. package/dist/index.js +32981 -0
  80. package/dist/interview/dashboard.d.ts +62 -0
  81. package/dist/interview/document.d.ts +25 -0
  82. package/dist/interview/helpers.d.ts +10 -0
  83. package/dist/interview/index.d.ts +1 -0
  84. package/dist/interview/manager.d.ts +35 -0
  85. package/dist/interview/parser.d.ts +11 -0
  86. package/dist/interview/prompts.d.ts +7 -0
  87. package/dist/interview/server.d.ts +13 -0
  88. package/dist/interview/service.d.ts +34 -0
  89. package/dist/interview/types.d.ts +96 -0
  90. package/dist/interview/ui.d.ts +12 -0
  91. package/dist/mcp/context7.d.ts +6 -0
  92. package/dist/mcp/grep-app.d.ts +6 -0
  93. package/dist/mcp/index.d.ts +8 -0
  94. package/dist/mcp/types.d.ts +12 -0
  95. package/dist/mcp/websearch.d.ts +9 -0
  96. package/dist/multiplexer/factory.d.ts +26 -0
  97. package/dist/multiplexer/index.d.ts +9 -0
  98. package/dist/multiplexer/session-manager.d.ts +53 -0
  99. package/dist/multiplexer/tmux/index.d.ts +22 -0
  100. package/dist/multiplexer/types.d.ts +54 -0
  101. package/dist/multiplexer/zellij/index.d.ts +34 -0
  102. package/dist/tools/ast-grep/cli.d.ts +15 -0
  103. package/dist/tools/ast-grep/constants.d.ts +25 -0
  104. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  105. package/dist/tools/ast-grep/index.d.ts +10 -0
  106. package/dist/tools/ast-grep/tools.d.ts +3 -0
  107. package/dist/tools/ast-grep/types.d.ts +30 -0
  108. package/dist/tools/ast-grep/utils.d.ts +4 -0
  109. package/dist/tools/council.d.ts +10 -0
  110. package/dist/tools/index.d.ts +6 -0
  111. package/dist/tools/preset-manager.d.ts +27 -0
  112. package/dist/tools/skill.d.ts +9 -0
  113. package/dist/tools/smartfetch/binary.d.ts +3 -0
  114. package/dist/tools/smartfetch/cache.d.ts +6 -0
  115. package/dist/tools/smartfetch/constants.d.ts +12 -0
  116. package/dist/tools/smartfetch/index.d.ts +3 -0
  117. package/dist/tools/smartfetch/network.d.ts +38 -0
  118. package/dist/tools/smartfetch/secondary-model.d.ts +28 -0
  119. package/dist/tools/smartfetch/tool.d.ts +3 -0
  120. package/dist/tools/smartfetch/types.d.ts +122 -0
  121. package/dist/tools/smartfetch/utils.d.ts +18 -0
  122. package/dist/tui-state.d.ts +15 -0
  123. package/dist/tui.d.ts +8 -0
  124. package/dist/tui.js +248 -0
  125. package/dist/utils/agent-variant.d.ts +63 -0
  126. package/dist/utils/compat.d.ts +30 -0
  127. package/dist/utils/env.d.ts +1 -0
  128. package/dist/utils/index.d.ts +9 -0
  129. package/dist/utils/internal-initiator.d.ts +6 -0
  130. package/dist/utils/logger.d.ts +8 -0
  131. package/dist/utils/polling.d.ts +21 -0
  132. package/dist/utils/session-manager.d.ts +55 -0
  133. package/dist/utils/session.d.ts +74 -0
  134. package/dist/utils/subagent-depth.d.ts +35 -0
  135. package/dist/utils/system-collapse.d.ts +6 -0
  136. package/dist/utils/task.d.ts +4 -0
  137. package/dist/utils/zip-extractor.d.ts +1 -0
  138. package/package.json +104 -0
  139. package/src/skills/brainstorming/SKILL.md +177 -0
  140. package/src/skills/brainstorming/scripts/frame-template.html +214 -0
  141. package/src/skills/brainstorming/scripts/helper.js +88 -0
  142. package/src/skills/brainstorming/scripts/server.cjs +354 -0
  143. package/src/skills/brainstorming/scripts/start-server.sh +148 -0
  144. package/src/skills/brainstorming/scripts/stop-server.sh +56 -0
  145. package/src/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  146. package/src/skills/brainstorming/visual-companion.md +279 -0
  147. package/src/skills/codemap/README.md +59 -0
  148. package/src/skills/codemap/SKILL.md +163 -0
  149. package/src/skills/codemap/codemap.md +36 -0
  150. package/src/skills/codemap/scripts/codemap.mjs +483 -0
  151. package/src/skills/codemap/scripts/codemap.test.ts +129 -0
  152. package/src/skills/codemap.md +40 -0
  153. package/src/skills/dispatching-parallel-agents/SKILL.md +193 -0
  154. package/src/skills/executing-plans/SKILL.md +78 -0
  155. package/src/skills/finishing-a-development-branch/SKILL.md +211 -0
  156. package/src/skills/receiving-code-review/SKILL.md +224 -0
  157. package/src/skills/requesting-code-review/SKILL.md +113 -0
  158. package/src/skills/requesting-code-review/code-reviewer.md +146 -0
  159. package/src/skills/simplify/README.md +19 -0
  160. package/src/skills/simplify/SKILL.md +138 -0
  161. package/src/skills/simplify/codemap.md +36 -0
  162. package/src/skills/subagent-driven-development/SKILL.md +288 -0
  163. package/src/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  164. package/src/skills/subagent-driven-development/implementer-prompt.md +113 -0
  165. package/src/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  166. package/src/skills/systematic-debugging/CREATION-LOG.md +119 -0
  167. package/src/skills/systematic-debugging/SKILL.md +308 -0
  168. package/src/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  169. package/src/skills/systematic-debugging/condition-based-waiting.md +115 -0
  170. package/src/skills/systematic-debugging/defense-in-depth.md +122 -0
  171. package/src/skills/systematic-debugging/find-polluter.sh +63 -0
  172. package/src/skills/systematic-debugging/root-cause-tracing.md +169 -0
  173. package/src/skills/systematic-debugging/test-academic.md +14 -0
  174. package/src/skills/systematic-debugging/test-pressure-1.md +58 -0
  175. package/src/skills/systematic-debugging/test-pressure-2.md +68 -0
  176. package/src/skills/systematic-debugging/test-pressure-3.md +69 -0
  177. package/src/skills/test-driven-development/SKILL.md +383 -0
  178. package/src/skills/test-driven-development/testing-anti-patterns.md +299 -0
  179. package/src/skills/using-git-worktrees/SKILL.md +226 -0
  180. package/src/skills/verification-before-completion/SKILL.md +147 -0
  181. package/src/skills/writing-plans/SKILL.md +165 -0
  182. package/src/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  183. package/src/skills/writing-skills/SKILL.md +666 -0
  184. package/src/skills/writing-skills/anthropic-best-practices.md +1150 -0
  185. package/src/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  186. package/src/skills/writing-skills/graphviz-conventions.dot +172 -0
  187. package/src/skills/writing-skills/persuasion-principles.md +187 -0
  188. package/src/skills/writing-skills/render-graphs.js +168 -0
  189. package/src/skills/writing-skills/testing-skills-with-subagents.md +384 -0
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env bash
2
+ # Start the brainstorm server and output connection info
3
+ # Usage: start-server.sh [--project-dir <path>] [--host <bind-host>] [--url-host <display-host>] [--foreground] [--background]
4
+ #
5
+ # Starts server on a random high port, outputs JSON with URL.
6
+ # Each session gets its own directory to avoid conflicts.
7
+ #
8
+ # Options:
9
+ # --project-dir <path> Store session files under <path>/.superpowers/brainstorm/
10
+ # instead of /tmp. Files persist after server stops.
11
+ # --host <bind-host> Host/interface to bind (default: 127.0.0.1).
12
+ # Use 0.0.0.0 in remote/containerized environments.
13
+ # --url-host <host> Hostname shown in returned URL JSON.
14
+ # --foreground Run server in the current terminal (no backgrounding).
15
+ # --background Force background mode (overrides auto-foreground).
16
+
17
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
18
+
19
+ # Parse arguments
20
+ PROJECT_DIR=""
21
+ FOREGROUND="false"
22
+ FORCE_BACKGROUND="false"
23
+ BIND_HOST="127.0.0.1"
24
+ URL_HOST=""
25
+ while [[ $# -gt 0 ]]; do
26
+ case "$1" in
27
+ --project-dir)
28
+ PROJECT_DIR="$2"
29
+ shift 2
30
+ ;;
31
+ --host)
32
+ BIND_HOST="$2"
33
+ shift 2
34
+ ;;
35
+ --url-host)
36
+ URL_HOST="$2"
37
+ shift 2
38
+ ;;
39
+ --foreground|--no-daemon)
40
+ FOREGROUND="true"
41
+ shift
42
+ ;;
43
+ --background|--daemon)
44
+ FORCE_BACKGROUND="true"
45
+ shift
46
+ ;;
47
+ *)
48
+ echo "{\"error\": \"Unknown argument: $1\"}"
49
+ exit 1
50
+ ;;
51
+ esac
52
+ done
53
+
54
+ if [[ -z "$URL_HOST" ]]; then
55
+ if [[ "$BIND_HOST" == "127.0.0.1" || "$BIND_HOST" == "localhost" ]]; then
56
+ URL_HOST="localhost"
57
+ else
58
+ URL_HOST="$BIND_HOST"
59
+ fi
60
+ fi
61
+
62
+ # Some environments reap detached/background processes. Auto-foreground when detected.
63
+ if [[ -n "${CODEX_CI:-}" && "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
64
+ FOREGROUND="true"
65
+ fi
66
+
67
+ # Windows/Git Bash reaps nohup background processes. Auto-foreground when detected.
68
+ if [[ "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
69
+ case "${OSTYPE:-}" in
70
+ msys*|cygwin*|mingw*) FOREGROUND="true" ;;
71
+ esac
72
+ if [[ -n "${MSYSTEM:-}" ]]; then
73
+ FOREGROUND="true"
74
+ fi
75
+ fi
76
+
77
+ # Generate unique session directory
78
+ SESSION_ID="$$-$(date +%s)"
79
+
80
+ if [[ -n "$PROJECT_DIR" ]]; then
81
+ SESSION_DIR="${PROJECT_DIR}/.superpowers/brainstorm/${SESSION_ID}"
82
+ else
83
+ SESSION_DIR="/tmp/brainstorm-${SESSION_ID}"
84
+ fi
85
+
86
+ STATE_DIR="${SESSION_DIR}/state"
87
+ PID_FILE="${STATE_DIR}/server.pid"
88
+ LOG_FILE="${STATE_DIR}/server.log"
89
+
90
+ # Create fresh session directory with content and state peers
91
+ mkdir -p "${SESSION_DIR}/content" "$STATE_DIR"
92
+
93
+ # Kill any existing server
94
+ if [[ -f "$PID_FILE" ]]; then
95
+ old_pid=$(cat "$PID_FILE")
96
+ kill "$old_pid" 2>/dev/null
97
+ rm -f "$PID_FILE"
98
+ fi
99
+
100
+ cd "$SCRIPT_DIR"
101
+
102
+ # Resolve the harness PID (grandparent of this script).
103
+ # $PPID is the ephemeral shell the harness spawned to run us — it dies
104
+ # when this script exits. The harness itself is $PPID's parent.
105
+ OWNER_PID="$(ps -o ppid= -p "$PPID" 2>/dev/null | tr -d ' ')"
106
+ if [[ -z "$OWNER_PID" || "$OWNER_PID" == "1" ]]; then
107
+ OWNER_PID="$PPID"
108
+ fi
109
+
110
+ # Foreground mode for environments that reap detached/background processes.
111
+ if [[ "$FOREGROUND" == "true" ]]; then
112
+ echo "$$" > "$PID_FILE"
113
+ env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs
114
+ exit $?
115
+ fi
116
+
117
+ # Start server, capturing output to log file
118
+ # Use nohup to survive shell exit; disown to remove from job table
119
+ nohup env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs > "$LOG_FILE" 2>&1 &
120
+ SERVER_PID=$!
121
+ disown "$SERVER_PID" 2>/dev/null
122
+ echo "$SERVER_PID" > "$PID_FILE"
123
+
124
+ # Wait for server-started message (check log file)
125
+ for i in {1..50}; do
126
+ if grep -q "server-started" "$LOG_FILE" 2>/dev/null; then
127
+ # Verify server is still alive after a short window (catches process reapers)
128
+ alive="true"
129
+ for _ in {1..20}; do
130
+ if ! kill -0 "$SERVER_PID" 2>/dev/null; then
131
+ alive="false"
132
+ break
133
+ fi
134
+ sleep 0.1
135
+ done
136
+ if [[ "$alive" != "true" ]]; then
137
+ echo "{\"error\": \"Server started but was killed. Retry in a persistent terminal with: $SCRIPT_DIR/start-server.sh${PROJECT_DIR:+ --project-dir $PROJECT_DIR} --host $BIND_HOST --url-host $URL_HOST --foreground\"}"
138
+ exit 1
139
+ fi
140
+ grep "server-started" "$LOG_FILE" | head -1
141
+ exit 0
142
+ fi
143
+ sleep 0.1
144
+ done
145
+
146
+ # Timeout - server didn't start
147
+ echo '{"error": "Server failed to start within 5 seconds"}'
148
+ exit 1
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ # Stop the brainstorm server and clean up
3
+ # Usage: stop-server.sh <session_dir>
4
+ #
5
+ # Kills the server process. Only deletes session directory if it's
6
+ # under /tmp (ephemeral). Persistent directories (.superpowers/) are
7
+ # kept so mockups can be reviewed later.
8
+
9
+ SESSION_DIR="$1"
10
+
11
+ if [[ -z "$SESSION_DIR" ]]; then
12
+ echo '{"error": "Usage: stop-server.sh <session_dir>"}'
13
+ exit 1
14
+ fi
15
+
16
+ STATE_DIR="${SESSION_DIR}/state"
17
+ PID_FILE="${STATE_DIR}/server.pid"
18
+
19
+ if [[ -f "$PID_FILE" ]]; then
20
+ pid=$(cat "$PID_FILE")
21
+
22
+ # Try to stop gracefully, fallback to force if still alive
23
+ kill "$pid" 2>/dev/null || true
24
+
25
+ # Wait for graceful shutdown (up to ~2s)
26
+ for i in {1..20}; do
27
+ if ! kill -0 "$pid" 2>/dev/null; then
28
+ break
29
+ fi
30
+ sleep 0.1
31
+ done
32
+
33
+ # If still running, escalate to SIGKILL
34
+ if kill -0 "$pid" 2>/dev/null; then
35
+ kill -9 "$pid" 2>/dev/null || true
36
+
37
+ # Give SIGKILL a moment to take effect
38
+ sleep 0.1
39
+ fi
40
+
41
+ if kill -0 "$pid" 2>/dev/null; then
42
+ echo '{"status": "failed", "error": "process still running"}'
43
+ exit 1
44
+ fi
45
+
46
+ rm -f "$PID_FILE" "${STATE_DIR}/server.log"
47
+
48
+ # Only delete ephemeral /tmp directories
49
+ if [[ "$SESSION_DIR" == /tmp/* ]]; then
50
+ rm -rf "$SESSION_DIR"
51
+ fi
52
+
53
+ echo '{"status": "stopped"}'
54
+ else
55
+ echo '{"status": "not_running"}'
56
+ fi
@@ -0,0 +1,49 @@
1
+ # Spec Document Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a spec document reviewer subagent.
4
+
5
+ **Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
6
+
7
+ **Dispatch after:** Spec document is written to docs/superpowers/specs/
8
+
9
+ ```
10
+ Task tool (general-purpose):
11
+ description: "Review spec document"
12
+ prompt: |
13
+ You are a spec document reviewer. Verify this spec is complete and ready for planning.
14
+
15
+ **Spec to review:** [SPEC_FILE_PATH]
16
+
17
+ ## What to Check
18
+
19
+ | Category | What to Look For |
20
+ |----------|------------------|
21
+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
22
+ | Consistency | Internal contradictions, conflicting requirements |
23
+ | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
24
+ | Scope | Focused enough for a single plan — not covering multiple independent subsystems |
25
+ | YAGNI | Unrequested features, over-engineering |
26
+
27
+ ## Calibration
28
+
29
+ **Only flag issues that would cause real problems during implementation planning.**
30
+ A missing section, a contradiction, or a requirement so ambiguous it could be
31
+ interpreted two different ways — those are issues. Minor wording improvements,
32
+ stylistic preferences, and "sections less detailed than others" are not.
33
+
34
+ Approve unless there are serious gaps that would lead to a flawed plan.
35
+
36
+ ## Output Format
37
+
38
+ ## Spec Review
39
+
40
+ **Status:** Approved | Issues Found
41
+
42
+ **Issues (if any):**
43
+ - [Section X]: [specific issue] - [why it matters for planning]
44
+
45
+ **Recommendations (advisory, do not block approval):**
46
+ - [suggestions for improvement]
47
+ ```
48
+
49
+ **Reviewer returns:** Status, Issues (if any), Recommendations
@@ -0,0 +1,279 @@
1
+ # Visual Companion Guide
2
+
3
+ Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
4
+
5
+ ## When to Use
6
+
7
+ Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
8
+
9
+ **Use the browser** when the content itself is visual:
10
+
11
+ - **UI mockups** — wireframes, layouts, navigation structures, component designs
12
+ - **Architecture diagrams** — system components, data flow, relationship maps
13
+ - **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
14
+ - **Design polish** — when the question is about look and feel, spacing, visual hierarchy
15
+ - **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
16
+
17
+ **Use the terminal** when the content is text or tabular:
18
+
19
+ - **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
20
+ - **Conceptual A/B/C choices** — picking between approaches described in words
21
+ - **Tradeoff lists** — pros/cons, comparison tables
22
+ - **Technical decisions** — API design, data modeling, architectural approach selection
23
+ - **Clarifying questions** — anything where the answer is words, not a visual preference
24
+
25
+ A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
26
+
27
+ ## How It Works
28
+
29
+ The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
30
+
31
+ **Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, selection indicator, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
32
+
33
+ ## Starting a Session
34
+
35
+ ```bash
36
+ # Start server with persistence (mockups saved to project)
37
+ scripts/start-server.sh --project-dir /path/to/project
38
+
39
+ # Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341",
40
+ # "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
41
+ # "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
42
+ ```
43
+
44
+ Save `screen_dir` and `state_dir` from the response. Tell user to open the URL.
45
+
46
+ **Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
47
+
48
+ **Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
49
+
50
+ **Launching the server by platform:**
51
+
52
+ **Claude Code (macOS / Linux):**
53
+ ```bash
54
+ # Default mode works — the script backgrounds the server itself
55
+ scripts/start-server.sh --project-dir /path/to/project
56
+ ```
57
+
58
+ **Claude Code (Windows):**
59
+ ```bash
60
+ # Windows auto-detects and uses foreground mode, which blocks the tool call.
61
+ # Use run_in_background: true on the Bash tool call so the server survives
62
+ # across conversation turns.
63
+ scripts/start-server.sh --project-dir /path/to/project
64
+ ```
65
+ When calling this via the Bash tool, set `run_in_background: true`. Then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
66
+
67
+ **OpenCode:**
68
+ ```bash
69
+ # OpenCode handles background processes natively.
70
+ scripts/start-server.sh --project-dir /path/to/project
71
+ ```
72
+
73
+ **Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
74
+
75
+ If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
76
+
77
+ ```bash
78
+ scripts/start-server.sh \
79
+ --project-dir /path/to/project \
80
+ --host 0.0.0.0 \
81
+ --url-host localhost
82
+ ```
83
+
84
+ Use `--url-host` to control what hostname is printed in the returned URL JSON.
85
+
86
+ ## The Loop
87
+
88
+ 1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
89
+ - Before each write, check that `$STATE_DIR/server-info` exists. If it doesn't (or `$STATE_DIR/server-stopped` exists), the server has shut down — restart it with `start-server.sh` before continuing. The server auto-exits after 30 minutes of inactivity.
90
+ - Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
91
+ - **Never reuse filenames** — each screen gets a fresh file
92
+ - Use Write tool — **never use cat/heredoc** (dumps noise into terminal)
93
+ - Server automatically serves the newest file
94
+
95
+ 2. **Tell user what to expect and end your turn:**
96
+ - Remind them of the URL (every step, not just first)
97
+ - Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
98
+ - Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
99
+
100
+ 3. **On your next turn** — after the user responds in the terminal:
101
+ - Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
102
+ - Merge with the user's terminal text to get the full picture
103
+ - The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
104
+
105
+ 4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
106
+
107
+ 5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
108
+
109
+ ```html
110
+ <!-- filename: waiting.html (or waiting-2.html, etc.) -->
111
+ <div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
112
+ <p class="subtitle">Continuing in terminal...</p>
113
+ </div>
114
+ ```
115
+
116
+ This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
117
+
118
+ 6. Repeat until done.
119
+
120
+ ## Writing Content Fragments
121
+
122
+ Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, selection indicator, and all interactive infrastructure).
123
+
124
+ **Minimal example:**
125
+
126
+ ```html
127
+ <h2>Which layout works better?</h2>
128
+ <p class="subtitle">Consider readability and visual hierarchy</p>
129
+
130
+ <div class="options">
131
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
132
+ <div class="letter">A</div>
133
+ <div class="content">
134
+ <h3>Single Column</h3>
135
+ <p>Clean, focused reading experience</p>
136
+ </div>
137
+ </div>
138
+ <div class="option" data-choice="b" onclick="toggleSelect(this)">
139
+ <div class="letter">B</div>
140
+ <div class="content">
141
+ <h3>Two Column</h3>
142
+ <p>Sidebar navigation with main content</p>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ ```
147
+
148
+ That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
149
+
150
+ ## CSS Classes Available
151
+
152
+ The frame template provides these CSS classes for your content:
153
+
154
+ ### Options (A/B/C choices)
155
+
156
+ ```html
157
+ <div class="options">
158
+ <div class="option" data-choice="a" onclick="toggleSelect(this)">
159
+ <div class="letter">A</div>
160
+ <div class="content">
161
+ <h3>Title</h3>
162
+ <p>Description</p>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ ```
167
+
168
+ **Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item. The indicator bar shows the count.
169
+
170
+ ```html
171
+ <div class="options" data-multiselect>
172
+ <!-- same option markup — users can select/deselect multiple -->
173
+ </div>
174
+ ```
175
+
176
+ ### Cards (visual designs)
177
+
178
+ ```html
179
+ <div class="cards">
180
+ <div class="card" data-choice="design1" onclick="toggleSelect(this)">
181
+ <div class="card-image"><!-- mockup content --></div>
182
+ <div class="card-body">
183
+ <h3>Name</h3>
184
+ <p>Description</p>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ ```
189
+
190
+ ### Mockup container
191
+
192
+ ```html
193
+ <div class="mockup">
194
+ <div class="mockup-header">Preview: Dashboard Layout</div>
195
+ <div class="mockup-body"><!-- your mockup HTML --></div>
196
+ </div>
197
+ ```
198
+
199
+ ### Split view (side-by-side)
200
+
201
+ ```html
202
+ <div class="split">
203
+ <div class="mockup"><!-- left --></div>
204
+ <div class="mockup"><!-- right --></div>
205
+ </div>
206
+ ```
207
+
208
+ ### Pros/Cons
209
+
210
+ ```html
211
+ <div class="pros-cons">
212
+ <div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
213
+ <div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
214
+ </div>
215
+ ```
216
+
217
+ ### Mock elements (wireframe building blocks)
218
+
219
+ ```html
220
+ <div class="mock-nav">Logo | Home | About | Contact</div>
221
+ <div style="display: flex;">
222
+ <div class="mock-sidebar">Navigation</div>
223
+ <div class="mock-content">Main content area</div>
224
+ </div>
225
+ <button class="mock-button">Action Button</button>
226
+ <input class="mock-input" placeholder="Input field">
227
+ <div class="placeholder">Placeholder area</div>
228
+ ```
229
+
230
+ ### Typography and sections
231
+
232
+ - `h2` — page title
233
+ - `h3` — section heading
234
+ - `.subtitle` — secondary text below title
235
+ - `.section` — content block with bottom margin
236
+ - `.label` — small uppercase label text
237
+
238
+ ## Browser Events Format
239
+
240
+ When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
241
+
242
+ ```jsonl
243
+ {"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
244
+ {"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
245
+ {"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
246
+ ```
247
+
248
+ The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
249
+
250
+ If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
251
+
252
+ ## Design Tips
253
+
254
+ - **Scale fidelity to the question** — wireframes for layout, polish for polish questions
255
+ - **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
256
+ - **Iterate before advancing** — if feedback changes current screen, write a new version
257
+ - **2-4 options max** per screen
258
+ - **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
259
+ - **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
260
+
261
+ ## File Naming
262
+
263
+ - Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
264
+ - Never reuse filenames — each screen must be a new file
265
+ - For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
266
+ - Server serves newest file by modification time
267
+
268
+ ## Cleaning Up
269
+
270
+ ```bash
271
+ scripts/stop-server.sh $SESSION_DIR
272
+ ```
273
+
274
+ If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
275
+
276
+ ## Reference
277
+
278
+ - Frame template (CSS reference): `scripts/frame-template.html`
279
+ - Helper script (client-side): `scripts/helper.js`
@@ -0,0 +1,59 @@
1
+ # Codemap Skill
2
+
3
+ Repository understanding and hierarchical codemap generation.
4
+
5
+ ## Overview
6
+
7
+ Codemap helps orchestrators map and understand codebases by:
8
+
9
+ 1. Selecting relevant code/config files using LLM judgment
10
+ 2. Creating `.slim/codemap.json` for change tracking
11
+ 3. Generating empty `codemap.md` templates for fixers to fill in
12
+
13
+ Legacy `.slim/cartography.json` state is migrated to `.slim/codemap.json` automatically.
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ # Initialize mapping
19
+ node codemap.mjs init --root /repo --include "src/**/*.ts" --exclude "node_modules/**"
20
+
21
+ # Check what changed
22
+ node codemap.mjs changes --root /repo
23
+
24
+ # Update hashes
25
+ node codemap.mjs update --root /repo
26
+ ```
27
+
28
+ ## Outputs
29
+
30
+ ### .slim/codemap.json
31
+
32
+ ```json
33
+ {
34
+ "metadata": {
35
+ "version": "1.0.0",
36
+ "last_run": "2026-01-25T19:00:00Z",
37
+ "include_patterns": ["src/**/*.ts"],
38
+ "exclude_patterns": ["node_modules/**"]
39
+ },
40
+ "file_hashes": {
41
+ "src/index.ts": "abc123..."
42
+ },
43
+ "folder_hashes": {
44
+ "src": "def456..."
45
+ }
46
+ }
47
+ ```
48
+
49
+ ### codemap.md (per folder)
50
+
51
+ Empty templates created in each folder for fixers to fill with:
52
+ - Responsibility
53
+ - Design patterns
54
+ - Data/control flow
55
+ - Integration points
56
+
57
+ ## Installation
58
+
59
+ Installed automatically via agent-forge installer when custom skills are enabled.