claude-everything-workflow 0.1.9 → 0.2.3

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 (152) hide show
  1. package/AGENTS.md +20 -20
  2. package/CLAUDE.md +1 -5
  3. package/README.md +151 -113
  4. package/agents/e2e-runner.md +8 -141
  5. package/agents/harness-optimizer.md +3 -2
  6. package/commands/code-review.md +10 -15
  7. package/commands/learn.md +97 -0
  8. package/commands/pr.md +5 -6
  9. package/commands/to-spec.md +11 -0
  10. package/commands/verify.md +7 -11
  11. package/harness/manifest.json +346 -0
  12. package/hooks/check-code-size.js +33 -12
  13. package/hooks/check-console-log.js +72 -24
  14. package/package.json +10 -2
  15. package/rules/01-base.md +9 -49
  16. package/rules/02-code-size.md +5 -20
  17. package/rules/03-architecture.md +9 -61
  18. package/rules/04-error-handling.md +4 -26
  19. package/rules/05-git-workflow.md +12 -39
  20. package/rules/06-comments.md +3 -43
  21. package/rules/07-forbidden.md +8 -31
  22. package/rules/08-specialty-rules-index.md +18 -0
  23. package/rules/09-first-principles-adversarial-testing.md +6 -18
  24. package/rules/common/agent-orchestration.md +8 -47
  25. package/rules/common/context-hygiene.md +9 -72
  26. package/rules/common/harness-engineering.md +11 -38
  27. package/rules/common/hooks.md +13 -82
  28. package/rules/common/performance.md +8 -71
  29. package/rules/common/pr-automation.md +7 -68
  30. package/rules/common/skills-learning.md +12 -36
  31. package/rules/common/testing.md +16 -59
  32. package/scripts/cleanup-retired-skills.js +214 -0
  33. package/scripts/install-rules.js +100 -0
  34. package/scripts/install.ps1 +99 -87
  35. package/scripts/install.sh +77 -78
  36. package/scripts/learning/review-confidence.js +1 -4
  37. package/scripts/legacy-common-rule-hashes.json +78 -0
  38. package/scripts/merge-claude-settings.cjs +75 -0
  39. package/scripts/retired-skill-files.json +54 -0
  40. package/scripts/upstream-capability-baseline.json +27 -0
  41. package/scripts/upstream-capability-map.json +155 -0
  42. package/scripts/verify/core.js +91 -0
  43. package/scripts/verify/grilling-spec-gate-checks.js +266 -0
  44. package/scripts/verify/install-rules.test.js +156 -0
  45. package/scripts/verify/metadata-checks.js +747 -0
  46. package/scripts/verify/repository-checks.js +409 -0
  47. package/scripts/verify/runtime-checks.js +593 -0
  48. package/scripts/verify/skill-invocation.test.js +86 -0
  49. package/scripts/verify/skill-manifest-checks.js +197 -0
  50. package/scripts/verify/skill-manifest-checks.test.js +123 -0
  51. package/scripts/verify/workflow-checks.js +685 -0
  52. package/scripts/verify/workflow-ownership-fixtures.js +371 -0
  53. package/scripts/verify/workflow-ownership.js +780 -0
  54. package/scripts/verify-harness.js +18 -1075
  55. package/scripts/verify-upstream-capability-map.js +118 -0
  56. package/skills/README.md +28 -16
  57. package/skills/code-review/SKILL.md +63 -0
  58. package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
  59. package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
  60. package/skills/codebase-design/SKILL.md +63 -0
  61. package/skills/codebase-design/references/deepening.md +27 -0
  62. package/skills/codebase-design/references/design-it-twice.md +17 -0
  63. package/skills/continuous-learning-v2/SKILL.md +8 -8
  64. package/skills/continuous-learning-v2/config.json +0 -4
  65. package/skills/domain-modeling/SKILL.md +101 -0
  66. package/skills/e2e-testing/SKILL.md +20 -310
  67. package/skills/e2e-testing/references/playwright-patterns.md +324 -0
  68. package/skills/feature-acceptance/SKILL.md +89 -0
  69. package/skills/grilling/SKILL.md +83 -0
  70. package/skills/handoff/SKILL.md +55 -0
  71. package/skills/handoff/agents/openai.yaml +2 -0
  72. package/skills/implement/SKILL.md +48 -0
  73. package/skills/implement/references/ticket-delivery.md +43 -0
  74. package/skills/improve-codebase-architecture/SKILL.md +47 -0
  75. package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
  76. package/skills/iterative-retrieval/SKILL.md +10 -1
  77. package/skills/learn/README.md +2 -2
  78. package/skills/prototype/SKILL.md +50 -0
  79. package/skills/prototype/references/logic.md +28 -0
  80. package/skills/prototype/references/ui.md +30 -0
  81. package/skills/resolving-merge-conflicts/SKILL.md +27 -0
  82. package/skills/spec-gate/SKILL.md +149 -0
  83. package/skills/spec-gate/agents/openai.yaml +4 -0
  84. package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
  85. package/skills/subagent-driven-development/SKILL.md +95 -414
  86. package/skills/systematic-debugging/SKILL.md +11 -49
  87. package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
  88. package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
  89. package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
  90. package/skills/test-driven-development/SKILL.md +24 -4
  91. package/skills/to-tickets/SKILL.md +96 -0
  92. package/skills/triage/SKILL.md +53 -0
  93. package/skills/triage/agents/openai.yaml +2 -0
  94. package/skills/triage/references/agent-brief.md +32 -0
  95. package/skills/triage/references/out-of-scope.md +14 -0
  96. package/skills/using-git-worktrees/SKILL.md +8 -5
  97. package/skills/using-superpowers/SKILL.md +76 -43
  98. package/skills/using-superpowers/references/process-outcomes.md +41 -0
  99. package/skills/verification-before-completion/SKILL.md +5 -4
  100. package/skills/visual-companion/SKILL.md +62 -0
  101. package/skills/visual-companion/agents/openai.yaml +4 -0
  102. package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
  103. package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
  104. package/skills/visual-companion/scripts/pages.cjs +28 -0
  105. package/skills/visual-companion/scripts/server-utils.cjs +82 -0
  106. package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
  107. package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
  108. package/skills/visual-companion/scripts/websocket.cjs +86 -0
  109. package/agents/architect.md +0 -59
  110. package/agents/code-reviewer.md +0 -57
  111. package/agents/planner.md +0 -124
  112. package/agents/tdd-guide.md +0 -101
  113. package/commands/e2e.md +0 -28
  114. package/commands/evolve.md +0 -42
  115. package/commands/harness-audit.md +0 -27
  116. package/commands/instinct-status.md +0 -38
  117. package/commands/learn-eval.md +0 -91
  118. package/commands/projects.md +0 -27
  119. package/commands/promote.md +0 -29
  120. package/commands/prune.md +0 -46
  121. package/commands/tdd.md +0 -27
  122. package/homunculus/instincts/personal/always-test-first.md +0 -28
  123. package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
  124. package/rules/08-ecc-integration.md +0 -46
  125. package/rules/common/implementation.md +0 -25
  126. package/rules/common/security.md +0 -19
  127. package/skills/brainstorming/SKILL.md +0 -185
  128. package/skills/brainstorming/agents/openai.yaml +0 -3
  129. package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  130. package/skills/context-budget/SKILL.md +0 -59
  131. package/skills/discover-unknowns-zh/SKILL.md +0 -112
  132. package/skills/discover-unknowns-zh/agents/openai.yaml +0 -4
  133. package/skills/discover-unknowns-zh/references/prompt-patterns.md +0 -144
  134. package/skills/documentation-lookup/SKILL.md +0 -90
  135. package/skills/executing-plans/SKILL.md +0 -66
  136. package/skills/find-skills/SKILL.md +0 -142
  137. package/skills/skill-creator/LICENSE.txt +0 -202
  138. package/skills/skill-creator/SKILL.md +0 -356
  139. package/skills/skill-creator/references/output-patterns.md +0 -82
  140. package/skills/skill-creator/references/workflows.md +0 -28
  141. package/skills/skill-creator/scripts/init_skill.py +0 -303
  142. package/skills/skill-creator/scripts/package_skill.py +0 -110
  143. package/skills/skill-creator/scripts/quick_validate.py +0 -95
  144. package/skills/subagent-driven-development/implementer-prompt.md +0 -139
  145. package/skills/subagent-driven-development/scripts/review-package +0 -44
  146. package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
  147. package/skills/subagent-driven-development/scripts/task-brief +0 -40
  148. package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
  149. package/skills/writing-plans/SKILL.md +0 -206
  150. package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
  151. /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
  152. /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
@@ -1,33 +1,36 @@
1
1
  ---
2
2
  name: using-superpowers
3
- description: "Use when starting or routing a non-trivial task in this workflow harness, when the user references Superpowers, or when deciding which skill, command, rule, or agent should govern the work. Establishes skill invocation discipline: check relevant process skills before acting, follow user/project instructions first, and verify before completion."
3
+ description: Route non-trivial tasks through direct, decision, or formal lanes, then return for verification.
4
4
  ---
5
5
 
6
6
  # Using Superpowers
7
7
 
8
- This is the workflow router for the local Superpowers-inspired harness. It keeps action disciplined while respecting this repository's Chinese communication rules and Git boundaries.
8
+ Own routing and continuation. Skills return outcomes here instead of selecting one another.
9
9
 
10
10
  ## Priority
11
11
 
12
- Follow instructions in this order:
13
-
14
- 1. User instructions, including direct requests, `AGENTS.md`, `CLAUDE.md`, and repo-local rules.
15
- 2. Applicable skills, commands, agents, and hooks from this repository.
16
- 3. Default agent behavior.
17
-
18
- If a skill conflicts with explicit User instructions or project instructions, follow the user/project instruction and state the conflict if it affects the outcome.
12
+ User instructions, `AGENTS.md`, `CLAUDE.md`, and repository rules take precedence over Skills,
13
+ commands, agents, and hooks, which take precedence over default behavior.
19
14
 
20
15
  ## Skill Invocation Rule
21
16
 
22
- Before taking action on a non-trivial task:
17
+ Classify intent, discoverable facts, user-owned decisions, and risk; select the shortest applicable path
18
+ below and read only its Skill. Briefly announce the selection, then act. Do not load a chain of Skills
19
+ in anticipation of later stages. Reuse a Skill already read in this task unless it changed or context
20
+ was lost; returning here means applying the routing decision, not reading this file again.
23
21
 
24
- 1. Decide whether a process skill applies.
25
- 2. Load the applicable skill before exploration, implementation, clarification, or final claims.
26
- 3. Announce briefly which skill is being used and why.
27
- 4. Follow the skill's gate, checklist, and verification requirements.
28
- 5. If the skill is not a fit after reading it, say so briefly and continue with the smallest suitable workflow.
22
+ Expected TDD RED stays in the current implementation loop. Do not reroute it as a reported bug.
23
+ An explicit request may use ordinary language or a native `/name` or `$name` invocation.
24
+ For handoff, triage and improve-codebase-architecture,
25
+ require the corresponding user request; complexity or a router match alone is insufficient.
26
+ Do not ask users to repeat an already clear request using command syntax. Skill selection never
27
+ expands authorization for publishing, external writes, or other consequential actions.
29
28
 
30
- Do not rely on memory of a skill. Skills evolve; use the current `SKILL.md` content.
29
+ ## Three Lanes
30
+
31
+ The three lanes are: direct (clear low-risk task), needs-decision (grilling inline), and formal-spec
32
+ (explicit formal Spec or high-risk boundary). File count, new features, and ordinary complexity affect
33
+ verification intensity, not the lane. Resolve only consequential user decisions that tools cannot discover.
31
34
 
32
35
  ## Routing
33
36
 
@@ -35,40 +38,70 @@ Use process skills before implementation skills:
35
38
 
36
39
  ```text
37
40
  Task arrives
38
- -> unclear / high-risk / multi-file? -> brainstorming
39
- -> approved spec, no plan? -> writing-plans
40
- -> approved plan + SDD/commit approved? -> subagent-driven-development
41
- -> approved plan, no commit approval? -> executing-plans
42
- -> bug / failing test / unexpected result -> systematic-debugging
43
- -> behavior change with test path? -> test-driven-development
44
- -> dirty worktree / risky branch work? -> using-git-worktrees
45
- -> completion / fixed / ready claim? -> verification-before-completion
46
- -> external skill learning or edit? -> skill-creator + skills-learning
41
+ -> explicit workflow advice? -> workflow advice mode
42
+ -> explicit documented grilling request? -> grilling explicit + domain-modeling persistent mode
43
+ -> explicit grilling request? -> grilling explicit
44
+ -> explicit handoff or fresh session or prototype branch?
45
+ -> skills/handoff/SKILL.md
46
+ -> explicit triage request? -> skills/triage/SKILL.md
47
+ -> explicit TDD request? -> skills/test-driven-development/SKILL.md
48
+ -> explicit E2E or Playwright request? -> skills/e2e-testing/SKILL.md + agents/e2e-runner.md
49
+ -> explicit harness audit? -> agents/harness-optimizer.md
50
+ -> explicit architecture-health audit? -> skills/improve-codebase-architecture/SKILL.md
51
+ -> merge or rebase conflict? -> skills/resolving-merge-conflicts/SKILL.md
52
+ -> reported bug or unexplained/repeated failure? -> skills/systematic-debugging/SKILL.md
53
+ -> discoverable fact? -> inspect it; do not ask
54
+ -> external engineering fact or documentation question? -> inspect primary sources directly; cite the answer
55
+ -> systematic evidence or blind-spot gap? -> iterative-retrieval
56
+ -> explicit prototype or runnable design question? -> skills/prototype/SKILL.md
57
+ -> unresolved user-owned decision? -> skills/grilling/SKILL.md (grilling inline)
58
+ high-risk or explicit formal Spec context? -> resume_target: spec-gate
59
+ -> explicit formal Spec or high-risk boundary? -> spec-gate
60
+ -> delivery request in defined scope? -> select delivery topology
61
+ -> durable multi-session/tracker graph? -> skills/to-tickets/SKILL.md
62
+ -> independent frontier tickets with no overlapping write surface?
63
+ -> skills/subagent-driven-development/SKILL.md
64
+ -> otherwise -> skills/implement/SKILL.md
65
+ -> behavior change with a test path? -> test-driven-development
66
+ -> new feature or other Git-rule isolation need? -> skills/using-git-worktrees/SKILL.md
67
+ -> completion, fixed, or ready claim? -> verification-before-completion
68
+ -> skill discovery or install request? -> use available host tooling for the explicit request
69
+ -> external skill learning or edit? -> rules/common/skills-learning.md
70
+ -> otherwise -> shortest applicable loop
47
71
  ```
48
72
 
49
- - Complex, ambiguous, architectural, integration, high-risk, cross-file, or behavior-changing work: use `skills/brainstorming/SKILL.md` first.
50
- - Approved spec that needs an implementation plan: use `skills/writing-plans/SKILL.md`.
51
- - Approved plan with independent tasks and approved commit/PR/SDD handling: use `skills/subagent-driven-development/SKILL.md`.
52
- - Approved plan without commit handling or with tightly coupled tasks: use `skills/executing-plans/SKILL.md`.
53
- - Bug, failing test, flaky behavior, or unexpected result: use `skills/systematic-debugging/SKILL.md` before proposing a fix.
54
- - Behavior-changing implementation with a viable test path: use `skills/test-driven-development/SKILL.md`.
55
- - Risky branch work, dirty worktree, parallel effort, or PR cleanup: consider `skills/using-git-worktrees/SKILL.md`.
56
- - Completion, fixed, passing, ready, or PR-readiness claims: use `skills/verification-before-completion/SKILL.md`.
57
- - External skill learning or skill edits: use `skills/skill-creator/SKILL.md` and `rules/common/skills-learning.md`.
73
+ A high-risk boundary is a costly-to-reverse architecture or service boundary, public-contract compatibility, authentication or authorization boundary, persistent data/schema migration, or irreversible external side effect. Record this classification before grilling so its handoff can resume `spec-gate`.
74
+
75
+ ### Workflow advice mode
76
+
77
+ 只返回推荐入口与原因、前置条件、需要补齐的用户决策或 Spec/tickets/map/handoff,以及直到
78
+ 审查和验证的闭环路径。不要调用下一 Skill、写文件或修改 tracker。
79
+
80
+ ### Agent-selected Delivery Topology
81
+
82
+ 用户要求完成一个定义明确的交付范围后,router 自行选择 `implement`、`to-tickets` 或
83
+ `subagent-driven-development`;选择依据是持续性、依赖图、写入面和验证成本,而不是用户是否记得某个
84
+ Skill 名称。开始时用一行说明所选拓扑及理由,然后继续执行。
85
+
86
+ - 一个可在当前上下文完成的连贯范围,使用 `implement`。
87
+ - 需要跨会话、tracker 或可恢复依赖图时,使用 `to-tickets`。这仍必须展示 ticket 的行为、验收标准与
88
+ blocker,并在发布前获得用户对 ticket contract 的批准。
89
+ - 只有至少两张已批准、无 blocker、写入面不重叠的 frontier tickets,才使用 SDD。不能安全并行时选择
90
+ 串行 `implement`,不要为了使用 subagent 人为拆票。
58
91
 
59
- Then apply domain skills such as documentation lookup, E2E testing, or workflow engineering as needed.
92
+ 用户的交付授权覆盖已批准范围内的本地实现与拓扑选择,不覆盖新的产品范围、未决用户决策、外部 tracker
93
+ mutation、commit、push、PR 或不可逆副作用。新的 frontier 只有仍在该授权范围内时才能由 router 再次选择
94
+ 执行拓扑。
60
95
 
61
- ## Red Flags
96
+ ## Process Outcomes
62
97
 
63
- Stop and check skills before continuing if you think:
98
+ Only when processing a grilling/Spec outcome or preparing a cross-session handoff, read
99
+ [references/process-outcomes.md](references/process-outcomes.md). Follow the matching outcome before
100
+ continuing; a self-reviewed Spec is not user approval. Ordinary direct delivery does not load this reference.
64
101
 
65
- - "This is just a quick code change."
66
- - "I need to inspect files before deciding."
67
- - "I remember what this skill says."
68
- - "The user asked for the outcome, so the workflow gate can be skipped."
69
- - "The verification should pass."
102
+ ## Compatibility Alias
70
103
 
71
- These are usually signs that a process skill should shape the next step.
104
+ For one release cycle, interpret a user explicitly asking for the old name `brainstorming` as a formal Spec request. Explain that the entry moved to `/to-spec`; route through the same optional grilling and `spec-gate` path. Do not expose an old Skill shim or a second protocol source.
72
105
 
73
106
  ## Completion
74
107
 
@@ -0,0 +1,41 @@
1
+ # Process Outcomes
2
+
3
+ Read only for a grilling/Spec outcome or a cross-session handoff. Routing belongs to
4
+ `skills/using-superpowers/SKILL.md`; this reference owns the outcome handling details.
5
+
6
+ ## Grilling handoff
7
+
8
+ Read `Risk classification` and `Resume target`. A non-formal task returns to direct or another narrow
9
+ process. A high-risk/formal task with `resume_target: spec-gate` enters a fresh Spec Gate call.
10
+
11
+ ## Spec Gate ready
12
+
13
+ `READY_FOR_USER_REVIEW` means the local artifact passed self-review but is not approved. Present the
14
+ path and wait for explicit approval. Approval returns to the router, which selects a delivery topology
15
+ from the approved scope without waiting for the user to name the next Skill.
16
+
17
+ ## Spec Gate blocked
18
+
19
+ `BLOCKED_BY_UNRESOLVED_DECISION` is terminal for the current call chain:
20
+
21
+ 1. Stop without drafting, guessing, or invoking another Skill.
22
+ 2. Present a decision map: confirmed decisions, unresolved decision, and blocking point.
23
+ 3. Let the user choose to continue clarification, reduce scope, or exit the formal flow.
24
+ 4. Only an explicit choice to continue starts a new grilling session.
25
+ 5. After that session completes, route again into a new Spec Gate; do not resume the old call stack.
26
+
27
+ If the same confirmed `decision_id` blocks again with unchanged evidence, report a `Spec Gate contract conflict`.
28
+ Do not repeat the question. Only reversal evidence or an invalidated premise can reopen it.
29
+
30
+ ## Spec Gate not applicable
31
+
32
+ `NOT_APPLICABLE` returns to the router. Select the shortest applicable path without asking the
33
+ originating Skill to recommend a successor.
34
+
35
+ ## Cross-session handoff
36
+
37
+ When a prototype detour needs isolation or the current context is leaving its reliable reasoning zone,
38
+ recommend a handoff and wait for the user's request or acceptance before creating the temporary
39
+ document. A clear natural-language request is sufficient; do not require command syntax.
40
+ The handoff ends the current flow; a fresh session references the returned path and enters the router.
41
+ Do not substitute handoff for durable Specs, ADRs, tickets, or verification evidence.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: verification-before-completion
3
- description: Use before claiming work is complete, fixed, passing, ready for PR, or moving to the next task. Requires fresh verification evidence from this turn, with exact commands, results, skipped checks, and remaining risk.
3
+ description: Before claiming done, fixed, passing, or ready, run fresh checks and report skipped items and risks.
4
4
  ---
5
5
 
6
6
  # Verification Before Completion
@@ -14,7 +14,8 @@ Core rule: do not say work is complete, fixed, passing, or ready unless fresh ve
14
14
  Before making a completion claim:
15
15
 
16
16
  1. Identify the smallest command or manual check that proves the claim.
17
- 2. Run the full relevant command now, unless the environment makes it impossible.
17
+ 2. Run the relevant command unless this turn already has evidence for the final unchanged state.
18
+ Reuse that evidence; rerun only after new changes, failures, or unresolved concerns.
18
19
  3. Read the output and exit code.
19
20
  4. Compare the result against the exact claim.
20
21
  5. Report the claim only with evidence.
@@ -31,7 +32,7 @@ If verification cannot run, say that it was not run and explain the remaining ri
31
32
  | Bug is fixed | Fresh reproduction or regression test showing the original symptom no longer occurs |
32
33
  | Task is complete | Spec, plan, or user request checklist verified against the changed files |
33
34
  | Ready for `/pr` | `/verify` or equivalent checks with skipped checks and risks stated |
34
- | Agent work is done | Independent inspection of the diff and required verification, not only the agent report |
35
+ | Delegated agent work is done | Controller checks the returned diff and required verification; review depth follows `code-review`, and a worker report alone is insufficient |
35
36
 
36
37
  ## Red Flags
37
38
 
@@ -51,7 +52,7 @@ Stop and verify before using language like:
51
52
  If verification fails:
52
53
 
53
54
  1. State the exact failing command and result.
54
- 2. Use `skills/systematic-debugging/SKILL.md` before changing code.
55
+ 2. Apply the graded entry in `skills/systematic-debugging/SKILL.md`; expected TDD RED is not a verification defect.
55
56
  3. Re-run the relevant verification after the fix.
56
57
 
57
58
  If verification is partial:
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: visual-companion
3
+ description: Use only with consent when a local visual companion materially improves a design decision.
4
+ ---
5
+
6
+ # Visual Companion
7
+
8
+ Use the browser as a visual aid, not as a workflow mode or a second requirements engine.
9
+
10
+ ## Boundary
11
+
12
+ Use this Skill for UI mockups, architecture diagrams, visual hierarchy, spatial relationships, and side-by-side visual comparisons. Keep requirements, scope, technical trade-offs, text options, and discoverable facts in the terminal.
13
+
14
+ A task being visual, complex, or design-related is not sufficient. Use the companion only when seeing the content materially improves understanding over concise text.
15
+
16
+ ## Consent Gate
17
+
18
+ Obtain explicit user consent before starting the local server or opening a browser URL. The consent request must state what will be shown and that a local authenticated URL will open.
19
+
20
+ Without user consent, continue with text or static in-conversation visuals. Do not treat prior use in another task as current consent.
21
+
22
+ ## Ownership
23
+
24
+ - `grilling owns the decision loop` when browser feedback selects a consequential user-owned option.
25
+ - Spec Gate may show an already resolved design, support artifact review, or render a diagram with no new decision.
26
+ - Visual Companion does not own continuation, routing, requirements interviews, or approval gates.
27
+ - Return browser events and terminal feedback to the currently routed Skill.
28
+
29
+ ## Workflow
30
+
31
+ 1. Decide whether the next item is materially clearer when seen.
32
+ 2. Obtain user consent if the server is not already approved for this task.
33
+ 3. Read `references/guide.md` completely before starting or operating the companion.
34
+ 4. Start the server with `scripts/start-server.sh`, preserving the returned complete URL and state paths.
35
+ 5. Write one fresh visual screen, describe it briefly in the terminal, and wait for user feedback.
36
+ 6. Merge terminal feedback with authenticated browser events.
37
+ 7. Return the result to grilling, Spec Gate, or the current caller.
38
+ 8. Stop or leave a waiting screen when visual work ends.
39
+
40
+ ## Safety Invariants
41
+
42
+ - Always share the complete URL including `?key=`; never expose a bare host and port.
43
+ - Keep session key, HTTP/WebSocket authorization, restrictive response headers, owner-only state files, and same-origin checks enabled.
44
+ - Preserve the default four-hour idle timeout and same-port restart behavior.
45
+ - Do not bind a non-loopback host unless the user needs remote access and understands the exposure.
46
+ - Treat `.superpowers/brainstorm/` as local runtime state; do not stage or commit it.
47
+ - Fall back to the terminal when the server or browser is unavailable.
48
+
49
+ ## Outputs
50
+
51
+ Return only:
52
+
53
+ ```text
54
+ Visual result:
55
+ - screen shown
56
+ - terminal feedback
57
+ - relevant browser events
58
+ - confirmed visual choice, if any
59
+ - unresolved decision owner
60
+ ```
61
+
62
+ Do not infer approval from a click without reconciling it with the user's terminal response.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Visual Companion"
3
+ short_description: "在本地安全浏览器中展示视觉方案与图示"
4
+ default_prompt: "使用 $visual-companion 展示适合视觉比较的方案,并在启动前征得同意。"
@@ -1,6 +1,6 @@
1
1
  # Visual Companion Guide
2
2
 
3
- Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
3
+ Browser-based Visual Companion for showing mockups, diagrams, and options after explicit user consent.
4
4
 
5
5
  ## When to Use
6
6
 
@@ -2,10 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <title>Superpowers Brainstorming</title>
5
+ <title>Superpowers Visual Companion</title>
6
6
  <style>
7
7
  /*
8
- * BRAINSTORM COMPANION FRAME TEMPLATE
8
+ * VISUAL COMPANION FRAME TEMPLATE
9
9
  *
10
10
  * This template provides a consistent frame with:
11
11
  * - OS-aware light/dark theming
@@ -63,15 +63,30 @@
63
63
  }
64
64
 
65
65
  /* ===== FRAME STRUCTURE ===== */
66
- .brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
67
- .brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
68
- .brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
66
+ .brand {
67
+ display: flex; align-items: center; min-width: 0; overflow: hidden;
68
+ color: var(--text-secondary); line-height: 1;
69
+ }
70
+ .brand a {
71
+ color: inherit; text-decoration: none; display: flex; align-items: center;
72
+ gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1;
73
+ }
74
+ .brand-copy {
75
+ display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis;
76
+ white-space: nowrap; line-height: 1; transform: translateY(-1px);
77
+ }
69
78
  .brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
70
79
  @media (prefers-color-scheme: dark) {
71
80
  .brand-logo { filter: none; }
72
81
  }
73
- .status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
74
- .status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
82
+ .status {
83
+ font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex;
84
+ align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1;
85
+ }
86
+ .status::before {
87
+ content: ''; width: 6px; height: 6px;
88
+ background: var(--status-color, var(--success)); border-radius: 50%;
89
+ }
75
90
 
76
91
  .main { flex: 1; overflow-y: auto; }
77
92
  #frame-content { padding: 2rem; min-height: 100%; }
@@ -103,7 +118,10 @@
103
118
  h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
104
119
  .subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
105
120
  .section { margin-bottom: 2rem; }
106
- .label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
121
+ .label {
122
+ font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase;
123
+ letter-spacing: 0.05em; margin-bottom: 0.5rem;
124
+ }
107
125
 
108
126
  /* ===== OPTIONS (for A/B/C choices) ===== */
109
127
  .options { display: flex; flex-direction: column; gap: 0.75rem; }
@@ -145,7 +163,10 @@
145
163
  }
146
164
  .card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
147
165
  .card.selected { border-color: var(--selected-border); border-width: 2px; }
148
- .card-image { background: var(--bg-tertiary); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
166
+ .card-image {
167
+ background: var(--bg-tertiary); aspect-ratio: 16/10;
168
+ display: flex; align-items: center; justify-content: center;
169
+ }
149
170
  .card-body { padding: 1rem; }
150
171
  .card-body h3 { margin-bottom: 0.25rem; }
151
172
  .card-body p { color: var(--text-secondary); font-size: 0.85rem; }
@@ -190,11 +211,20 @@
190
211
  }
191
212
 
192
213
  /* ===== INLINE MOCKUP ELEMENTS ===== */
193
- .mock-nav { background: var(--accent); color: white; padding: 0.75rem 1rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
214
+ .mock-nav {
215
+ background: var(--accent); color: white; padding: 0.75rem 1rem;
216
+ display: flex; gap: 1.5rem; font-size: 0.9rem;
217
+ }
194
218
  .mock-sidebar { background: var(--bg-tertiary); padding: 1rem; min-width: 180px; }
195
219
  .mock-content { padding: 1.5rem; flex: 1; }
196
- .mock-button { background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
197
- .mock-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; width: 100%; }
220
+ .mock-button {
221
+ background: var(--accent); color: white; border: none;
222
+ padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem;
223
+ }
224
+ .mock-input {
225
+ background: var(--bg-primary); border: 1px solid var(--border);
226
+ border-radius: 6px; padding: 0.5rem; width: 100%;
227
+ }
198
228
  </style>
199
229
  </head>
200
230
  <body>
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const FORBIDDEN_PAGE = `<!DOCTYPE html>
4
+ <html>
5
+ <head><meta charset="utf-8"><title>Session key required</title>
6
+ <style>body { font-family: system-ui, sans-serif; padding: 2rem; max-width: 800px; margin: 0 auto; }
7
+ h1 { color: #333; } p { color: #666; } code { background: #f0f0f0; padding: 0.1em 0.3em;
8
+ border-radius: 4px; }</style>
9
+ </head>
10
+ <body><h1>Session key required</h1>
11
+ <p>This page needs the full URL your coding agent gave you, including the
12
+ <code>?key=&hellip;</code> part. Copy the complete URL and open it again.</p></body></html>`;
13
+
14
+ function bootstrapPage(key) {
15
+ const jsonKey = JSON.stringify(String(key));
16
+ return `<!DOCTYPE html>
17
+ <html>
18
+ <head><meta charset="utf-8"><title>Opening Brainstorm Companion</title></head>
19
+ <body>
20
+ <script>
21
+ try { sessionStorage.setItem('brainstorm-session-key', ${jsonKey}); } catch (e) {}
22
+ location.replace('/');
23
+ </script>
24
+ </body>
25
+ </html>`;
26
+ }
27
+
28
+ module.exports = { FORBIDDEN_PAGE, bootstrapPage };
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+
5
+ function urlHostForHttp(host) {
6
+ const normalized = String(host);
7
+ if (normalized.startsWith('[') && normalized.endsWith(']')) return normalized;
8
+ return normalized.includes(':') ? '[' + normalized + ']' : normalized;
9
+ }
10
+
11
+ function browserLauncherForPlatform(url, options = {}) {
12
+ const platform = options.platform || process.platform;
13
+ const osRelease = options.osRelease || require('os').release();
14
+ const env = options.env || process.env;
15
+ const isWSL = platform === 'linux' && /microsoft/i.test(osRelease);
16
+
17
+ if (platform === 'darwin') return { bin: 'open', args: [url] };
18
+ if (platform === 'win32' || isWSL) {
19
+ return { bin: 'rundll32.exe', args: ['url.dll,FileProtocolHandler', url] };
20
+ }
21
+ if (env.DISPLAY || env.WAYLAND_DISPLAY) return { bin: 'xdg-open', args: [url] };
22
+ return null;
23
+ }
24
+
25
+ function timingSafeEqualStr(left, right) {
26
+ const leftBuffer = Buffer.from(String(left));
27
+ const rightBuffer = Buffer.from(String(right));
28
+ if (leftBuffer.length !== rightBuffer.length) return false;
29
+ return crypto.timingSafeEqual(leftBuffer, rightBuffer);
30
+ }
31
+
32
+ function parseCookies(header) {
33
+ const output = {};
34
+ if (!header) return output;
35
+ for (const part of header.split(';')) {
36
+ const separator = part.indexOf('=');
37
+ if (separator < 0) continue;
38
+ output[part.slice(0, separator).trim()] = part.slice(separator + 1).trim();
39
+ }
40
+ return output;
41
+ }
42
+
43
+ function pathnameOf(url) {
44
+ const queryIndex = url.indexOf('?');
45
+ return queryIndex >= 0 ? url.slice(0, queryIndex) : url;
46
+ }
47
+
48
+ function queryKey(url) {
49
+ const queryIndex = url.indexOf('?');
50
+ if (queryIndex < 0) return null;
51
+ return new URLSearchParams(url.slice(queryIndex + 1)).get('key');
52
+ }
53
+
54
+ function securityHeaders(headers = {}) {
55
+ return {
56
+ 'Referrer-Policy': 'no-referrer',
57
+ 'Cache-Control': 'no-store',
58
+ 'X-Frame-Options': 'DENY',
59
+ 'Content-Security-Policy': "frame-ancestors 'none'",
60
+ 'Cross-Origin-Resource-Policy': 'same-origin',
61
+ ...headers,
62
+ };
63
+ }
64
+
65
+ function isAllowedWebSocketOrigin(req) {
66
+ const origin = req.headers.origin;
67
+ if (!origin) return true;
68
+ const host = req.headers.host;
69
+ if (!host) return false;
70
+ return origin === 'http://' + host;
71
+ }
72
+
73
+ module.exports = {
74
+ urlHostForHttp,
75
+ browserLauncherForPlatform,
76
+ timingSafeEqualStr,
77
+ parseCookies,
78
+ pathnameOf,
79
+ queryKey,
80
+ securityHeaders,
81
+ isAllowedWebSocketOrigin,
82
+ };