agy-superpowers 5.1.9 → 5.2.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.
- package/package.json +1 -1
- package/template/agent/rules/file-length-policy.md +64 -0
- package/template/agent/skills/brainstorming/scripts/server.cjs +1 -1
- package/template/agent/skills/brainstorming/scripts/start-server.sh +5 -2
- package/template/agent/skills/brainstorming/scripts/stop-server.sh +4 -4
- package/template/agent/skills/brainstorming/visual-companion.md +2 -2
- package/template/agent/skills/writing-skills/testing-skills-with-subagents.md +1 -1
- package/template/agent/workflows/update-superpowers.md +3 -3
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: File length policy — apply when creating or editing files in .agent/rules/
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
priority: critical
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> **⚠️ CRITICAL PRIORITY — This rule overrides all other instructions about file editing.**
|
|
8
|
+
> Check file length BEFORE writing. No exceptions.
|
|
9
|
+
|
|
10
|
+
<HARD-GATE>
|
|
11
|
+
Do NOT write, append, or edit any file in `.agent/rules/` until you have checked its current character count.
|
|
12
|
+
If adding content would push the file past 12,000 characters, you MUST create a new file instead.
|
|
13
|
+
This gate applies exclusively to `.agent/rules/` files.
|
|
14
|
+
</HARD-GATE>
|
|
15
|
+
|
|
16
|
+
# File Length Policy
|
|
17
|
+
|
|
18
|
+
## Hard Limit: 12,000 Characters Per File
|
|
19
|
+
|
|
20
|
+
Every file in `.agent/rules/` has a **hard character limit of 12,000 characters**.
|
|
21
|
+
|
|
22
|
+
Before writing or appending to any `.agent/rules/` file, check the current file size:
|
|
23
|
+
- If the current content **plus** the new content will exceed 12,000 characters → **do NOT add to the existing file**
|
|
24
|
+
- Instead → **create a new file** following the naming convention below
|
|
25
|
+
|
|
26
|
+
## When Content Overflows: Create a New File
|
|
27
|
+
|
|
28
|
+
### Naming Convention
|
|
29
|
+
|
|
30
|
+
Split content into numbered parts:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
original-file.md ← Part 1 (keep as-is, trim if needed)
|
|
34
|
+
original-file-part2.md ← Part 2 (new file for overflow)
|
|
35
|
+
original-file-part3.md ← Part 3 (continue if needed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Cross-Reference Between Parts
|
|
39
|
+
|
|
40
|
+
At the **bottom** of the original file, add:
|
|
41
|
+
```
|
|
42
|
+
## See Also
|
|
43
|
+
- [Continued in original-file-part2.md](./original-file-part2.md)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
At the **top** of the new file, add:
|
|
47
|
+
```
|
|
48
|
+
<!-- Part 2 of original-file.md -->
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Why This Matters
|
|
52
|
+
|
|
53
|
+
LLM context windows process rules most reliably when individual files stay concise. Files over 12,000 characters risk:
|
|
54
|
+
- Partial truncation during loading
|
|
55
|
+
- Reduced rule adherence near the end of the file
|
|
56
|
+
- Harder human maintenance
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
| Situation | Action |
|
|
61
|
+
|---|---|
|
|
62
|
+
| Adding 500 chars to a 11,800-char file | Create `filename-part2.md` for the new content |
|
|
63
|
+
| Adding 200 chars to a 5,000-char file | Safe — append directly |
|
|
64
|
+
| Refactoring a 15,000-char existing file | Split into two files immediately |
|
|
@@ -76,7 +76,7 @@ function decodeFrame(buffer) {
|
|
|
76
76
|
const PORT = process.env.BRAINSTORM_PORT || (49152 + Math.floor(Math.random() * 16383));
|
|
77
77
|
const HOST = process.env.BRAINSTORM_HOST || '127.0.0.1';
|
|
78
78
|
const URL_HOST = process.env.BRAINSTORM_URL_HOST || (HOST === '127.0.0.1' ? 'localhost' : HOST);
|
|
79
|
-
const SESSION_DIR = process.env.BRAINSTORM_DIR || '
|
|
79
|
+
const SESSION_DIR = process.env.BRAINSTORM_DIR || path.resolve(__dirname, '..', '..', '..', 'tmp', 'brainstorm');
|
|
80
80
|
const CONTENT_DIR = path.join(SESSION_DIR, 'content');
|
|
81
81
|
const STATE_DIR = path.join(SESSION_DIR, 'state');
|
|
82
82
|
let ownerPid = process.env.BRAINSTORM_OWNER_PID ? Number(process.env.BRAINSTORM_OWNER_PID) : null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
#
|
|
8
8
|
# Options:
|
|
9
9
|
# --project-dir <path> Store session files under <path>/.superpowers/brainstorm/
|
|
10
|
-
# instead of /tmp
|
|
10
|
+
# instead of .agent/tmp/. Files persist after server stops.
|
|
11
11
|
# --host <bind-host> Host/interface to bind (default: 127.0.0.1).
|
|
12
12
|
# Use 0.0.0.0 in remote/containerized environments.
|
|
13
13
|
# --url-host <host> Hostname shown in returned URL JSON.
|
|
@@ -77,10 +77,13 @@ fi
|
|
|
77
77
|
# Generate unique session directory
|
|
78
78
|
SESSION_ID="$$-$(date +%s)"
|
|
79
79
|
|
|
80
|
+
# SCRIPT_DIR is .agent/skills/brainstorming/scripts — walk up to .agent/
|
|
81
|
+
AGENT_DIR="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
82
|
+
|
|
80
83
|
if [[ -n "$PROJECT_DIR" ]]; then
|
|
81
84
|
SESSION_DIR="${PROJECT_DIR}/.superpowers/brainstorm/${SESSION_ID}"
|
|
82
85
|
else
|
|
83
|
-
SESSION_DIR="/tmp/brainstorm-${SESSION_ID}"
|
|
86
|
+
SESSION_DIR="${AGENT_DIR}/tmp/brainstorm-${SESSION_ID}"
|
|
84
87
|
fi
|
|
85
88
|
|
|
86
89
|
STATE_DIR="${SESSION_DIR}/state"
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# Usage: stop-server.sh <session_dir>
|
|
4
4
|
#
|
|
5
5
|
# Kills the server process. Only deletes session directory if it's
|
|
6
|
-
#
|
|
7
|
-
# kept so mockups can be reviewed later.
|
|
6
|
+
# ephemeral (/tmp or .agent/tmp). Persistent directories (.superpowers/)
|
|
7
|
+
# are kept so mockups can be reviewed later.
|
|
8
8
|
|
|
9
9
|
SESSION_DIR="$1"
|
|
10
10
|
|
|
@@ -45,8 +45,8 @@ if [[ -f "$PID_FILE" ]]; then
|
|
|
45
45
|
|
|
46
46
|
rm -f "$PID_FILE" "${STATE_DIR}/server.log"
|
|
47
47
|
|
|
48
|
-
# Only delete ephemeral /tmp
|
|
49
|
-
if [[ "$SESSION_DIR" == /tmp/* ]]; then
|
|
48
|
+
# Only delete ephemeral directories (/tmp or .agent/tmp)
|
|
49
|
+
if [[ "$SESSION_DIR" == /tmp/* ]] || [[ "$SESSION_DIR" == */.agent/tmp/* ]]; then
|
|
50
50
|
rm -rf "$SESSION_DIR"
|
|
51
51
|
fi
|
|
52
52
|
|
|
@@ -45,7 +45,7 @@ Save `screen_dir` and `state_dir` from the response. Tell user to open the URL.
|
|
|
45
45
|
|
|
46
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
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
|
|
48
|
+
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `.agent/tmp/` and get cleaned up on server stop. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
49
49
|
|
|
50
50
|
**Launching the server by platform:**
|
|
51
51
|
|
|
@@ -256,7 +256,7 @@ If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser
|
|
|
256
256
|
scripts/stop-server.sh $SESSION_DIR
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only
|
|
259
|
+
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only ephemeral sessions (`.agent/tmp/`) get deleted on stop.
|
|
260
260
|
|
|
261
261
|
## Reference
|
|
262
262
|
|
|
@@ -145,7 +145,7 @@ Forces explicit choice.
|
|
|
145
145
|
|
|
146
146
|
1. **Concrete options** - Force A/B/C choice, not open-ended
|
|
147
147
|
2. **Real constraints** - Specific times, actual consequences
|
|
148
|
-
3. **Real file paths** -
|
|
148
|
+
3. **Real file paths** - `.agent/tmp/payment-system` not "a project"
|
|
149
149
|
4. **Make agent act** - "What do you do?" not "What should you do?"
|
|
150
150
|
5. **No easy outs** - Can't defer to "I'd ask your human partner" without choosing
|
|
151
151
|
|
|
@@ -8,13 +8,13 @@ This workflow has two phases:
|
|
|
8
8
|
|
|
9
9
|
// turbo
|
|
10
10
|
1. Preserve user config (if exists):
|
|
11
|
-
`[ -f .agent/config.yml ] && cp .agent/config.yml /tmp/agent-config-backup.yml && echo "Config backed up" || echo "No config to backup"`
|
|
11
|
+
`mkdir -p .agent/tmp && [ -f .agent/config.yml ] && cp .agent/config.yml .agent/tmp/agent-config-backup.yml && echo "Config backed up" || echo "No config to backup"`
|
|
12
12
|
|
|
13
13
|
// turbo
|
|
14
14
|
2. Run the update script:
|
|
15
15
|
`bash .agent/.shared/update-superpowers.sh`
|
|
16
16
|
|
|
17
|
-
- If output ends with "Already up to date" → restore config if backed up (`[ -f /tmp/agent-config-backup.yml ] && cp /tmp/agent-config-backup.yml .agent/config.yml`), then **STOP**. Nothing to do.
|
|
17
|
+
- If output ends with "Already up to date" → restore config if backed up (`[ -f .agent/tmp/agent-config-backup.yml ] && cp .agent/tmp/agent-config-backup.yml .agent/config.yml`), then **STOP**. Nothing to do.
|
|
18
18
|
- If clone fails → restore config if backed up, then **STOP**. Report the error to the user.
|
|
19
19
|
- On success the script prints `SCRIPT_DONE:<new-tag>` — note the new tag and continue.
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ This workflow has two phases:
|
|
|
24
24
|
|
|
25
25
|
// turbo
|
|
26
26
|
4. Restore user config:
|
|
27
|
-
`[ -f /tmp/agent-config-backup.yml ] && cp /tmp/agent-config-backup.yml .agent/config.yml && echo "Config restored" || echo "No config to restore"`
|
|
27
|
+
`[ -f .agent/tmp/agent-config-backup.yml ] && cp .agent/tmp/agent-config-backup.yml .agent/config.yml && echo "Config restored" || echo "No config to restore"`
|
|
28
28
|
|
|
29
29
|
5. **Phase 2 — Update skill list in rules**
|
|
30
30
|
|