prizmkit 1.1.95 → 1.1.97
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/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/run-bugfix.sh +5 -1
- package/bundled/dev-pipeline/run-feature.sh +5 -1
- package/bundled/dev-pipeline/run-refactor.sh +5 -1
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +98 -7
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +86 -3
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +86 -3
- package/bundled/dev-pipeline/scripts/monitor-log.sh +104 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +4 -1
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +5 -2
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -2
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +3 -0
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +3 -2
- package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +76 -0
- package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +2 -0
- package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +98 -7
- package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +86 -3
- package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +86 -3
- package/bundled/dev-pipeline-windows/scripts/monitor-log.ps1 +102 -0
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +4 -1
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +5 -2
- package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +5 -2
- package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +3 -0
- package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +3 -2
- package/bundled/dev-pipeline-windows/templates/sections/log-size-awareness.md +78 -0
- package/bundled/rules/general/agent-operational-rules.md +0 -38
- package/bundled/rules/general/cohesive-modeling.md +31 -18
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/SKILL.md +2 -2
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -2
- package/bundled/skills/bug-planner/SKILL.md +1 -2
- package/bundled/skills/bug-planner/assets/bug-confirmation-template.md +3 -3
- package/bundled/skills/prizm-kit/SKILL.md +1 -1
- package/bundled/skills/prizmkit-deploy/SKILL.md +8 -8
- package/bundled/skills/prizmkit-deploy/references/database-setup.md +4 -4
- package/bundled/skills/prizmkit-deploy/references/deployment-modes.md +7 -7
- package/bundled/skills/prizmkit-deploy/references/dns-setup.md +7 -7
- package/bundled/skills/prizmkit-deploy/references/firewall-setup.md +5 -5
- package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +1 -1
- package/bundled/skills/prizmkit-deploy/references/ssl-setup.md +4 -4
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-test/SKILL.md +2 -2
- package/bundled/skills/recovery-workflow/evals/evals.json +3 -3
- package/bundled/skills-windows/bug-planner/SKILL.md +1 -2
- package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +3 -3
- package/bundled/skills-windows/prizm-kit/SKILL.md +1 -1
- package/bundled/skills-windows/prizmkit-deploy/SKILL.md +8 -8
- package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +4 -4
- package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +7 -7
- package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +7 -7
- package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +5 -5
- package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +1 -1
- package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +4 -4
- package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills-windows/prizmkit-test/SKILL.md +2 -2
- package/bundled/skills-windows/recovery-workflow/evals/evals.json +3 -3
- package/package.json +1 -1
- /package/bundled/skills/app-planner/{assets → references}/app-design-guide.md +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
# monitor-log.ps1 — Background log size monitor for AI session subagent (PowerShell)
|
|
3
|
+
#
|
|
4
|
+
# Polls session.log size, computes effective size (current - baseline),
|
|
5
|
+
# and writes a structured JSON status file. Intended to be run by a
|
|
6
|
+
# background subagent inside the AI CLI session.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# pwsh -NoProfile -File monitor-log.ps1 <session_log> <max_size> <poll_interval> <status_file> <baseline_file>
|
|
10
|
+
# powershell.exe -NoProfile -File monitor-log.ps1 <session_log> <max_size> <poll_interval> <status_file> <baseline_file>
|
|
11
|
+
#
|
|
12
|
+
# Status file format (JSON, rewritten each poll cycle):
|
|
13
|
+
# {
|
|
14
|
+
# "status": "OK" | "COMPACT_NEEDED",
|
|
15
|
+
# "total_bytes": <current session.log size>,
|
|
16
|
+
# "baseline_bytes": <size after last /compact>,
|
|
17
|
+
# "effective_bytes": <total - baseline>,
|
|
18
|
+
# "threshold_bytes": <compact threshold>,
|
|
19
|
+
# "overage_bytes": <effective - threshold, 0 if not exceeded>,
|
|
20
|
+
# "usage_pct": <effective / threshold * 100>
|
|
21
|
+
# }
|
|
22
|
+
|
|
23
|
+
param(
|
|
24
|
+
[Parameter(Mandatory=$true)] [string]$SessionLog,
|
|
25
|
+
[Parameter(Mandatory=$true)] [long]$MaxSize,
|
|
26
|
+
[Parameter(Mandatory=$true)] [int]$PollInterval,
|
|
27
|
+
[Parameter(Mandatory=$true)] [string]$StatusFile,
|
|
28
|
+
[Parameter(Mandatory=$true)] [string]$BaselineFile
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
if ($MaxSize -lt 0) {
|
|
32
|
+
Write-Error "ERROR: MaxSize must be a non-negative integer"
|
|
33
|
+
exit 1
|
|
34
|
+
}
|
|
35
|
+
if ($PollInterval -le 0) {
|
|
36
|
+
Write-Error "ERROR: PollInterval must be a positive integer"
|
|
37
|
+
exit 1
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Ensure status directory exists
|
|
41
|
+
$statusDir = Split-Path -Parent $StatusFile
|
|
42
|
+
if (-not (Test-Path $statusDir)) {
|
|
43
|
+
New-Item -ItemType Directory -Path $statusDir -Force | Out-Null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Write-Error "[monitor-log] Starting log monitor: max=$MaxSize interval=${PollInterval}s"
|
|
47
|
+
Write-Error "[monitor-log] Watching: $SessionLog"
|
|
48
|
+
|
|
49
|
+
while ($true) {
|
|
50
|
+
# Read current log size
|
|
51
|
+
if (Test-Path $SessionLog) {
|
|
52
|
+
$size = (Get-Item $SessionLog).Length
|
|
53
|
+
} else {
|
|
54
|
+
$size = 0
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Read baseline (resets after each /compact)
|
|
58
|
+
$baseline = 0
|
|
59
|
+
if (Test-Path $BaselineFile) {
|
|
60
|
+
try {
|
|
61
|
+
$baseline = [long](Get-Content $BaselineFile -Raw).Trim()
|
|
62
|
+
} catch {
|
|
63
|
+
$baseline = 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Effective size = growth since last compact
|
|
68
|
+
$effective = $size - $baseline
|
|
69
|
+
if ($effective -lt 0) {
|
|
70
|
+
$effective = 0
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Determine status (MaxSize=0 disables monitoring)
|
|
74
|
+
if ($MaxSize -gt 0 -and $effective -gt $MaxSize) {
|
|
75
|
+
$status = "COMPACT_NEEDED"
|
|
76
|
+
$overage = $effective - $MaxSize
|
|
77
|
+
Write-Error "[monitor-log] COMPACT_NEEDED: effective=$effective overage=$overage (threshold=$MaxSize)"
|
|
78
|
+
} else {
|
|
79
|
+
$status = "OK"
|
|
80
|
+
$overage = 0
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Usage percentage
|
|
84
|
+
if ($MaxSize -gt 0) {
|
|
85
|
+
$usagePct = [Math]::Floor($effective * 100 / $MaxSize)
|
|
86
|
+
} else {
|
|
87
|
+
$usagePct = 0
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Write structured JSON status
|
|
91
|
+
@{
|
|
92
|
+
status = $status
|
|
93
|
+
total_bytes = $size
|
|
94
|
+
baseline_bytes = $baseline
|
|
95
|
+
effective_bytes = $effective
|
|
96
|
+
threshold_bytes = $MaxSize
|
|
97
|
+
overage_bytes = $overage
|
|
98
|
+
usage_pct = $usagePct
|
|
99
|
+
} | ConvertTo-Json -Compress | Out-File -FilePath $StatusFile -NoNewline
|
|
100
|
+
|
|
101
|
+
Start-Sleep -Seconds $PollInterval
|
|
102
|
+
}
|
|
@@ -12,7 +12,7 @@ You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATU
|
|
|
12
12
|
|
|
13
13
|
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed.
|
|
14
14
|
|
|
15
|
-
**Tier 1 — Single Agent**: You handle everything directly. No subagents
|
|
15
|
+
**Tier 1 — Single Agent**: You handle everything directly. No normal work subagents; the log-size monitor is the only allowed persistent background subagent. No TeamCreate.
|
|
16
16
|
|
|
17
17
|
### Feature Description
|
|
18
18
|
|
|
@@ -54,6 +54,9 @@ You are running in **headless non-interactive mode** with a FINITE context windo
|
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
57
|
+
{{LOG_SIZE_AWARENESS}}
|
|
58
|
+
---
|
|
59
|
+
|
|
57
60
|
## PrizmKit Directory Convention
|
|
58
61
|
|
|
59
62
|
```
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATURE_TITLE}}".
|
|
12
12
|
|
|
13
|
-
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn subagents, wait for each to finish (run_in_background=false).
|
|
13
|
+
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn normal work subagents, wait for each to finish (run_in_background=false). The log-size monitor is the only allowed persistent background subagent.
|
|
14
14
|
|
|
15
15
|
**Tier 2 — Dual Agent**: You handle context + planning directly. Then spawn Dev and Reviewer subagents. Spawn Dev and Reviewer agents via the Agent tool.
|
|
16
16
|
|
|
@@ -60,6 +60,9 @@ You are running in **headless non-interactive mode** with a FINITE context windo
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
+
{{LOG_SIZE_AWARENESS}}
|
|
64
|
+
---
|
|
65
|
+
|
|
63
66
|
## PrizmKit Directory Convention
|
|
64
67
|
|
|
65
68
|
```
|
|
@@ -699,7 +702,7 @@ Remove-Item -Force -ErrorAction SilentlyContinue .prizmkit/specs/{{FEATURE_SLUG}
|
|
|
699
702
|
- Build context-snapshot.md FIRST; all subagents read it instead of re-reading source files
|
|
700
703
|
- context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
|
|
701
704
|
- Gate checks enforce Implementation Log and Review Notes are written before proceeding
|
|
702
|
-
- Do NOT use `run_in_background=true` when spawning subagents
|
|
705
|
+
- Do NOT use `run_in_background=true` when spawning normal work subagents; the log-size monitor is the only allowed persistent background subagent
|
|
703
706
|
- `/prizmkit-committer` is mandatory, and must not be replaced with manual git commit commands
|
|
704
707
|
- Do NOT run `git add`/`git commit` during Phase 1-5 — all changes are committed once in Phase 6
|
|
705
708
|
- If any files remain after the commit, amend the existing commit — do NOT create a follow-up commit
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATURE_TITLE}}".
|
|
12
12
|
|
|
13
|
-
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn subagents, wait for each to finish (run_in_background=false). Do NOT spawn agents in background and exit — that kills the session.
|
|
13
|
+
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn normal work subagents, wait for each to finish (run_in_background=false). The log-size monitor is the only allowed persistent background subagent. Do NOT spawn work agents in background and exit — that kills the session.
|
|
14
14
|
|
|
15
15
|
**Tier 3 — Full Team**: For complex features, use the full pipeline (Phase 0–6) with Dev + Reviewer agents spawned via the Agent tool.
|
|
16
16
|
|
|
@@ -60,6 +60,9 @@ You are running in **headless non-interactive mode** with a FINITE context windo
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
+
{{LOG_SIZE_AWARENESS}}
|
|
64
|
+
---
|
|
65
|
+
|
|
63
66
|
## PrizmKit Directory Convention
|
|
64
67
|
|
|
65
68
|
```
|
|
@@ -780,7 +783,7 @@ Remove-Item -Force -ErrorAction SilentlyContinue .prizmkit/specs/{{FEATURE_SLUG}
|
|
|
780
783
|
- Tier 3: full team — Dev (implementation) → Reviewer (review) — spawn agents directly via Agent tool
|
|
781
784
|
- context-snapshot.md is append-only: orchestrator writes Sections 1-4, Dev appends Implementation Log, Reviewer appends Review Notes
|
|
782
785
|
- Gate checks enforce Implementation Log and Review Notes are written before proceeding
|
|
783
|
-
- Do NOT use `run_in_background=true` when spawning agents
|
|
786
|
+
- Do NOT use `run_in_background=true` when spawning normal work agents; the log-size monitor is the only allowed persistent background subagent
|
|
784
787
|
- Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
|
|
785
788
|
- Do NOT run `git add`/`git commit` during Phase 1-5 — all changes are committed once in Phase 6
|
|
786
789
|
- If any files remain after the commit, amend the existing commit — do NOT create a follow-up commit
|
|
@@ -13,6 +13,8 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
|
|
|
13
13
|
|
|
14
14
|
**CRITICAL**: You MUST NOT exit until ALL work is complete and committed.
|
|
15
15
|
|
|
16
|
+
**SUBAGENT LIFECYCLE**: The log-size monitor is the only allowed persistent background subagent. Any normal work subagent must be awaited with `run_in_background=false`.
|
|
17
|
+
|
|
16
18
|
**NON-INTERACTIVE MODE**: There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input. Make decisions autonomously and move forward.
|
|
17
19
|
|
|
18
20
|
### Bug Description
|
|
@@ -51,6 +53,7 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
|
|
|
51
53
|
4. **Minimize tool output** — Capture to temp file, scan first/last lines, filter with Select-String, regex matching, or PowerShell object filtering. Never load full output.
|
|
52
54
|
5. **No intermediate commits** — All changes committed once at the end via `/prizmkit-committer`.
|
|
53
55
|
|
|
56
|
+
{{LOG_SIZE_AWARENESS}}
|
|
54
57
|
## Bug Fix Artifacts Directory
|
|
55
58
|
|
|
56
59
|
```
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}: "{{REFACTOR_TITLE}}".
|
|
14
14
|
|
|
15
|
-
**CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn subagents, you MUST **wait for each to finish** (run_in_background=false) before proceeding. Do NOT spawn
|
|
15
|
+
**CRITICAL SESSION LIFECYCLE RULE**: You MUST NOT exit until ALL work is complete and session-status.json is written. When you spawn normal work subagents, you MUST **wait for each to finish** (run_in_background=false) before proceeding. The log-size monitor is the only allowed persistent background subagent. Do NOT spawn a work agent in the background and exit — that kills the session.
|
|
16
16
|
|
|
17
17
|
**NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, NEVER use interactive prompts (e.g. "Would you like me to…"). If a skill has an interactive step (e.g. offer remediation, ask for approval), skip it and proceed autonomously. Make decisions based on the data available and move forward.
|
|
18
18
|
|
|
@@ -78,6 +78,7 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
|
|
|
78
78
|
|
|
79
79
|
## Execution Instructions
|
|
80
80
|
|
|
81
|
+
{{LOG_SIZE_AWARENESS}}
|
|
81
82
|
**YOU are the orchestrator. Execute each phase by spawning the appropriate team agent with run_in_background=false.**
|
|
82
83
|
|
|
83
84
|
**Agent spawn failure policy (all Agent tool calls)**:
|
|
@@ -336,4 +337,4 @@ Write to: `{{SESSION_STATUS_PATH}}`
|
|
|
336
337
|
- **Commit with** `refactor(<scope>):` prefix, NOT `feat:` or `fix:`
|
|
337
338
|
- **Run full retrospective** (Job 1 + Job 2) — refactoring changes code structure
|
|
338
339
|
- ALWAYS write session-status.json before exiting
|
|
339
|
-
- Do NOT use `run_in_background=true` when spawning agents
|
|
340
|
+
- Do NOT use `run_in_background=true` when spawning normal work agents; the log-size monitor is the only allowed persistent background subagent
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
## Session Log Budget Monitoring (PROACTIVE)
|
|
2
|
+
|
|
3
|
+
Your session log grows with every tool call and subagent spawn.
|
|
4
|
+
To prevent context exhaustion, **spawn a background monitoring subagent at session start**.
|
|
5
|
+
|
|
6
|
+
### How to Set Up the Monitor
|
|
7
|
+
|
|
8
|
+
1. **AS THE VERY FIRST ACTION** (before Phase 0), spawn a monitoring subagent
|
|
9
|
+
with `run_in_background: true` and this task:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Run this command and keep it running:
|
|
13
|
+
$psHost = if (Get-Command pwsh -ErrorAction SilentlyContinue) { 'pwsh' } else { 'powershell.exe' }
|
|
14
|
+
& $psHost -NoProfile -File {{LOG_MONITOR_SCRIPT}} {{SESSION_LOG_PATH}} {{MAX_LOG_SIZE}} {{LOG_MONITOR_POLL_INTERVAL}} {{LOG_MONITOR_STATUS_FILE}} {{LOG_MONITOR_BASELINE_FILE}}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The subagent MUST use `run_in_background: true`. It writes a JSON status
|
|
18
|
+
file every {{LOG_MONITOR_POLL_INTERVAL}} seconds.
|
|
19
|
+
|
|
20
|
+
2. **BEFORE EACH MAJOR PHASE** (Phase 0, 1, 2, ...), read the status:
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
if (Test-Path {{LOG_MONITOR_STATUS_FILE}}) { Get-Content {{LOG_MONITOR_STATUS_FILE}} } else { '{"status":"OK"}' }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The status file contains structured diagnostics:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"status": "OK | COMPACT_NEEDED",
|
|
31
|
+
"total_bytes": <current session.log size>,
|
|
32
|
+
"baseline_bytes": <size after last /compact>,
|
|
33
|
+
"effective_bytes": <total - baseline, incremental growth>,
|
|
34
|
+
"threshold_bytes": <{{MAX_LOG_SIZE}}>,
|
|
35
|
+
"overage_bytes": <effective - threshold, 0 when OK>,
|
|
36
|
+
"usage_pct": <effective / threshold * 100>
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Extract fields for decision-making:
|
|
41
|
+
```powershell
|
|
42
|
+
$data = Get-Content {{LOG_MONITOR_STATUS_FILE}} | ConvertFrom-Json
|
|
43
|
+
$status = $data.status
|
|
44
|
+
$effective = $data.effective_bytes
|
|
45
|
+
$overage = $data.overage_bytes
|
|
46
|
+
$usage = $data.usage_pct
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. **On COMPACT_NEEDED** (effective_bytes > {{MAX_LOG_SIZE}} bytes, {{MAX_LOG_SIZE_HUMAN}}):
|
|
50
|
+
- Check `overage_bytes` to decide urgency:
|
|
51
|
+
- **Minor overage** (< 512KB): complete the current sub-step, update durable workflow checkpoint artifacts, write baseline, `/compact`
|
|
52
|
+
- **Major overage** (>= 512KB): update durable workflow checkpoint artifacts, write baseline, `/compact` — do NOT start new work
|
|
53
|
+
- Write baseline before `/compact`:
|
|
54
|
+
```powershell
|
|
55
|
+
(Get-Item {{SESSION_LOG_PATH}}).Length | Out-File -NoNewline {{LOG_MONITOR_BASELINE_FILE}}
|
|
56
|
+
```
|
|
57
|
+
- Execute `/compact`
|
|
58
|
+
- Continue the workflow after `/compact`; re-read this status file before the next major phase
|
|
59
|
+
|
|
60
|
+
### How the Baseline Prevents Infinite Compaction Loops
|
|
61
|
+
|
|
62
|
+
- Before the first `/compact`: baseline = 0, effective = full log size → triggers when log exceeds threshold
|
|
63
|
+
- After `/compact`: baseline = current log size, effective ≈ 0 → status resets to OK
|
|
64
|
+
- The monitor only triggers again when **new** log growth since the last compact exceeds the threshold
|
|
65
|
+
- Each `/compact` resets the baseline, breaking the infinite loop
|
|
66
|
+
|
|
67
|
+
### Log Growth Reduction Tips
|
|
68
|
+
|
|
69
|
+
- **Re-read context-snapshot.md instead of source files** — already in context
|
|
70
|
+
- **Filter command output** — pipe to `Select-Object -Last 20` or `Select-String`, never full output
|
|
71
|
+
- **Limit subagent prompts** — shorter, focused prompts = shorter transcripts
|
|
72
|
+
- **Checkpoint often** — update durable workflow checkpoint artifacts before `/compact`
|
|
73
|
+
|
|
74
|
+
### What Survives
|
|
75
|
+
|
|
76
|
+
- All git commits are permanent
|
|
77
|
+
- The workflow checkpoint is preserved and auto-resumed
|
|
78
|
+
- `/compact` compresses context without losing progress
|
|
@@ -27,42 +27,4 @@ Before any Read with offset + limit:
|
|
|
27
27
|
|
|
28
28
|
Before editing a large file (>1000 lines), verify you know its current line count from the most recent tool_result. Old line counts from earlier turns may be stale if you have since edited the file.
|
|
29
29
|
|
|
30
|
-
## Consecutive Read Failures
|
|
31
30
|
|
|
32
|
-
If 3 consecutive Read calls to the same file return 'shorter than provided offset' or 'Wasted call':
|
|
33
|
-
- STOP all work on that file.
|
|
34
|
-
- Send ESCALATION with the file path, current line count, and the offsets you attempted.
|
|
35
|
-
- The orchestrator will provide the correct content.
|
|
36
|
-
|
|
37
|
-
## Test Output Hygiene
|
|
38
|
-
|
|
39
|
-
**Applies to: Dev Agent and any agent that runs tests.** Does NOT apply to Reviewer, Critic, or other agents that do not execute test commands.
|
|
40
|
-
|
|
41
|
-
When tests fail:
|
|
42
|
-
- Run the test command provided in your task assignment ONCE (e.g., `$TEST_CMD`, `npm test`, `pytest`, etc.).
|
|
43
|
-
- Capture output with `tee` (macOS/Linux) or `Tee-Object` (Windows/PowerShell) to a temp file.
|
|
44
|
-
- Then grep/Select-String that file for failure details.
|
|
45
|
-
- Never re-run the full test suite just to apply a different filter to its output.
|
|
46
|
-
|
|
47
|
-
**macOS/Linux**:
|
|
48
|
-
```bash
|
|
49
|
-
($TEST_CMD) 2>&1 | tee /tmp/test-out.txt | tail -20
|
|
50
|
-
grep -n "FAIL\|Error\|assert" /tmp/test-out.txt
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Windows/PowerShell**:
|
|
54
|
-
```powershell
|
|
55
|
-
& { {{TEST_CMD}} } 2>&1 | Tee-Object (Join-Path $env:TEMP "test-out.txt") | Select-Object -Last 20
|
|
56
|
-
Select-String -Path (Join-Path $env:TEMP "test-out.txt") -Pattern "FAIL|Error|assert"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Note: `$TEST_CMD` / `{{TEST_CMD}}` is a placeholder set by the pipeline or orchestrator. Use whatever test command is provided in your task assignment. Do NOT hardcode a specific test tool — projects vary.
|
|
60
|
-
|
|
61
|
-
## Incremental Validation
|
|
62
|
-
|
|
63
|
-
**Applies to: Dev Agent.** Does NOT apply to Reviewer, Critic, or read-only agents.
|
|
64
|
-
|
|
65
|
-
After every 3 successful Edit operations on a file:
|
|
66
|
-
- Run the relevant test command for that file once.
|
|
67
|
-
- Validate your changes compile and behave correctly.
|
|
68
|
-
- Do not defer all testing to the end.
|
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
2
|
+
description: "Model variables/fields/concepts that always appear together as a cohesive whole, not scattered fragments"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
When designing or understanding any system, if a group of variables, fields, or concepts always appear together and express the same semantic unit, they should be modeled as a single whole rather than scattered fragments:
|
|
6
6
|
|
|
7
|
-
- **Go** —
|
|
8
|
-
- **Java/Python** —
|
|
9
|
-
- **TypeScript** —
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- **Go** — define a struct
|
|
8
|
+
- **Java/Python** — define a class
|
|
9
|
+
- **TypeScript** — define an interface/type
|
|
10
|
+
- **Config** — group into a nested config block
|
|
11
|
+
- **Module partitioning** — split into an independent module
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The essence is the same principle: **highly cohesive things should be a single thing at the moment of modeling.**
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Trigger Scenarios
|
|
16
16
|
|
|
17
|
-
1.
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
20
|
-
4.
|
|
21
|
-
5.
|
|
17
|
+
1. Within a function/method parameter list, a few parameters are always passed together → extract into a parameter object
|
|
18
|
+
2. Multiple variables are always assigned, passed, and returned together → merge into a struct/class
|
|
19
|
+
3. A group of keys in a config file always appears in pairs/clusters → group into a nested config block
|
|
20
|
+
4. You find yourself repeatedly declaring the same set of fields across different files → extract a shared type/interface
|
|
21
|
+
5. Modifying one value requires synchronously modifying another → they belong to the same invariant and should be encapsulated together
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Anti-Patterns (Avoid)
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
25
|
+
- **Primitive Obsession**: using scattered string/number in place of meaningful types
|
|
26
|
+
- **Data Clumps**: the same group of data repeatedly appearing in parameter lists, return values, and variable declarations
|
|
27
|
+
- **Shotgun Surgery**: adding one field requires changing function signatures across N files
|
|
28
|
+
|
|
29
|
+
## How to Apply
|
|
30
|
+
|
|
31
|
+
- When you spot a trigger scenario, extract the cohesive group into a named unit in one pass — do not leave it for "later refactoring."
|
|
32
|
+
- Prefer immutability for the extracted unit to preserve the invariant across the codebase.
|
|
33
|
+
- Name the unit after the domain concept it represents, not the data it happens to contain (e.g., `Money`, not `AmountAndCurrency`).
|
|
34
|
+
- Apply the rule at the lowest level first (parameter object, struct), then propagate upward to interfaces and modules if the cohesion holds.
|
|
35
|
+
|
|
36
|
+
## Related Principles
|
|
37
|
+
|
|
38
|
+
- **Single Responsibility Principle** — a cohesive unit should have one reason to change.
|
|
39
|
+
- **Invariant Encapsulation** — bundle data that must satisfy a shared constraint so the constraint can be enforced in one place.
|
|
40
|
+
- **Tell, Don't Ask** — once grouped, expose behavior on the whole rather than dissecting it at call sites.
|
|
@@ -66,7 +66,7 @@ Do NOT use this skill when:
|
|
|
66
66
|
## Resource Loading Rules (Mandatory)
|
|
67
67
|
|
|
68
68
|
1. **App design reference** — always load at session start:
|
|
69
|
-
- Read `${SKILL_DIR}/
|
|
69
|
+
- Read `${SKILL_DIR}/references/app-design-guide.md` for vision templates and tech stack matrix
|
|
70
70
|
|
|
71
71
|
2. **Load on-demand references when triggered**:
|
|
72
72
|
- Architecture decisions emerged → read `${SKILL_DIR}/references/architecture-decisions.md`
|
|
@@ -218,7 +218,7 @@ Execute the planning workflow in conversation mode with mandatory checkpoints:
|
|
|
218
218
|
1.1 Confirm deliverable intent (→ Intent Confirmation — option-based)
|
|
219
219
|
1.2 **Requirement clarification** — for ANY unclear aspect of the user's vision, goals, target users, or scope, use option-based questions where possible. When common patterns exist, present them as choices. Only use open-ended questions for truly unique input (e.g., "describe your app idea"). Follow up with option-based clarifications.
|
|
220
220
|
2. Confirm constraints and tech assumptions
|
|
221
|
-
2.1 Tech stack selection — use `${SKILL_DIR}/
|
|
221
|
+
2.1 Tech stack selection — use `${SKILL_DIR}/references/app-design-guide.md` §2 decision matrix. Use `AskUserQuestion` for each major tech decision (framework, database, styling, etc.)
|
|
222
222
|
2.2 **Frontend design check** (for frontend projects) — scan for existing UI/UX design docs. If none found, use `AskUserQuestion`:
|
|
223
223
|
- Question: "No UI/UX design docs found. Would you like to establish design direction?"
|
|
224
224
|
- Options: "Establish design direction now (Recommended)", "Skip for now", "I have external designs"
|
|
@@ -32,7 +32,7 @@ Before ANY planning work, check if AI-essential project context files exist:
|
|
|
32
32
|
**If ANY are missing**, show the status table, then use `AskUserQuestion`:
|
|
33
33
|
|
|
34
34
|
**Question**: "Some AI context files are missing. These help AI understand your project — making planning much more effective. How would you like to proceed?"
|
|
35
|
-
- **Run project init first
|
|
35
|
+
- **Run project init first** — invoke `prizmkit-init` to scan your codebase and generate these files, then return to planning
|
|
36
36
|
- **Continue without init** — I'll scan the project manually during this session (less thorough)
|
|
37
37
|
- **Skip, I'll set these up later** — proceed with planning using only what's available
|
|
38
38
|
|
|
@@ -71,7 +71,7 @@ Show the summary as text, then use `AskUserQuestion`:
|
|
|
71
71
|
> **Architecture**: [e.g., monolithic, microservices, serverless]
|
|
72
72
|
|
|
73
73
|
**Question**: "Does this look correct?"
|
|
74
|
-
- **Yes, looks correct
|
|
74
|
+
- **Yes, looks correct** — proceed with planning
|
|
75
75
|
- **Mostly correct, with changes** — I'll note corrections
|
|
76
76
|
- **This is off** — let me describe the project
|
|
77
77
|
|
|
@@ -212,9 +212,8 @@ Before generating `.prizmkit/plans/bug-fix-list.json`, perform a holistic scan a
|
|
|
212
212
|
|
|
213
213
|
**Step 4 — Present review table**: Display the completeness assessment using the template in `${SKILL_DIR}/assets/bug-confirmation-template.md` (§Completeness Review Template).
|
|
214
214
|
|
|
215
|
-
For any items that need attention, ask targeted questions to fill gaps. Iterate until the user confirms all bugs are adequately described. Present
|
|
215
|
+
For any items that need attention, ask targeted questions to fill gaps. Iterate until the user confirms all bugs are adequately described. Present the prompt:
|
|
216
216
|
|
|
217
|
-
> "以上是完整性审查结果。需要补充的项目是否逐一补充?还是先跳过,之后再完善?"
|
|
218
217
|
> "Above is the completeness review. Items needing more detail — address them now, or proceed and refine later?"
|
|
219
218
|
|
|
220
219
|
Only proceed to Phase 5 after user confirms.
|
|
@@ -23,9 +23,9 @@ Present this after extracting and clarifying each bug:
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Then ask three confirmation questions:
|
|
26
|
-
1. "
|
|
27
|
-
2. "
|
|
28
|
-
3. "
|
|
26
|
+
1. "Is the description accurate? Any corrections?"
|
|
27
|
+
2. "Need to add more details? (reproduction steps, environment, related code locations, etc.)"
|
|
28
|
+
3. "Are the acceptance criteria specific enough that the pipeline can autonomously verify the fix?"
|
|
29
29
|
|
|
30
30
|
Only finalize the bug entry after user confirms all three points.
|
|
31
31
|
|
|
@@ -72,7 +72,7 @@ All three follow the same per-task flow. Detailed documentation policies (when t
|
|
|
72
72
|
| `/prizmkit-code-review` | Diagnose issues + produce Fix Instructions | "review", "check code", "is it ready to commit" |
|
|
73
73
|
| `/prizmkit-retrospective` | Sync .prizmkit/prizm-docs/ with code changes | "retrospective", "retro", "sync docs", "wrap up" |
|
|
74
74
|
| `/prizmkit-committer` | Safe git commit with Conventional Commits | "commit", "submit", "finish", "ship it" |
|
|
75
|
-
| `/prizmkit-test` | Generate + run tests, analyze coverage gaps, unified quality report | "test", "run tests", "check quality", "verify code", "
|
|
75
|
+
| `/prizmkit-test` | Generate + run tests, analyze coverage gaps, unified quality report | "test", "run tests", "check quality", "verify code", "add tests" |
|
|
76
76
|
| `/prizmkit-deploy` | Universal deployment gateway: SSH automation, cloud/Docker guided setup, status/logs/rollback | "deploy", "ship it", "go live", "rollback", "deploy status" |
|
|
77
77
|
| `/prizmkit-init` | Project bootstrap + .prizmkit/prizm-docs/ setup | "init", "initialize", "take over this project" |
|
|
78
78
|
| `/prizmkit-prizm-docs` | Doc management (init/status/rebuild/validate) | "check docs", "rebuild docs", "validate docs" |
|
|
@@ -204,14 +204,14 @@ The following sections define the SSH deployment adapter — the only fully-auto
|
|
|
204
204
|
After Discovery routes to SSH, **before** entering the configuration wizard, ask the user how they want to deploy.
|
|
205
205
|
|
|
206
206
|
**First question:**
|
|
207
|
-
> "
|
|
208
|
-
> - **A.
|
|
209
|
-
> - **B. CI/CD
|
|
207
|
+
> "How do you want to deploy to the server?"
|
|
208
|
+
> - **A. Direct Upload (quick start)** — build locally, transfer to server and start. Good for first deployment.
|
|
209
|
+
> - **B. CI/CD Auto-Deploy (recommended)** — configure GitHub Actions, then `git push` auto-deploys.
|
|
210
210
|
|
|
211
211
|
**If user chooses CI/CD, second question:**
|
|
212
|
-
> "CI/CD
|
|
213
|
-
> - **Push
|
|
214
|
-
> - **Pull
|
|
212
|
+
> "CI/CD has two modes:"
|
|
213
|
+
> - **Push mode** — GitHub Actions runner builds, SCP transfers to server. Low server load.
|
|
214
|
+
> - **Pull mode** — server pulls code and builds itself. Simpler config but requires a Deploy Key.
|
|
215
215
|
|
|
216
216
|
For detailed mode descriptions and the full Push/Pull comparison table, read `references/deployment-modes.md`.
|
|
217
217
|
|
|
@@ -306,7 +306,7 @@ After generating the workflow, verify: the first `git push` to the configured br
|
|
|
306
306
|
|
|
307
307
|
Before SSL, check if the user has a domain pointing to the server.
|
|
308
308
|
|
|
309
|
-
1. Ask: "
|
|
309
|
+
1. Ask: "Do you have a domain to bind to this project?" If no domain → skip DNS + SSL, note in deploy.md.
|
|
310
310
|
2. Check DNS: `dig +short <domain> A`. If resolved → proceed to SSL.
|
|
311
311
|
3. If not resolved: show the user DNS setup instructions. Full procedure in `references/dns-setup.md`.
|
|
312
312
|
|
|
@@ -360,7 +360,7 @@ If no previous release exists, rollback is not possible — state this clearly.
|
|
|
360
360
|
|
|
361
361
|
After a successful direct-upload deployment, proactively offer CI/CD setup:
|
|
362
362
|
|
|
363
|
-
> "
|
|
363
|
+
> "Deployment succeeded. Want me to set up CI/CD auto-deploy? After that, `git push` will auto-deploy."
|
|
364
364
|
|
|
365
365
|
If user agrees, ask push vs pull, then configure accordingly. If Pull mode: set up deploy key. If Push mode: add GitHub Actions secrets. Generate `deploy.yml` from `references/ci-cd-workflows.md`, update `deployStrategy` in config, write upgrade event to history.
|
|
366
366
|
|
|
@@ -6,9 +6,9 @@ Read this file when Discovery detected a database driver and the user wants AI-a
|
|
|
6
6
|
|
|
7
7
|
During Discovery Step 1 (Project Detection), database drivers were already scanned. If a driver was detected, ask after bootstrap tools are installed:
|
|
8
8
|
|
|
9
|
-
> "
|
|
10
|
-
> -
|
|
11
|
-
> -
|
|
9
|
+
> "Detected the project uses <PostgreSQL/MySQL/Redis>. Want me to install and configure it on the server?"
|
|
10
|
+
> - **Yes** → proceed with database installation
|
|
11
|
+
> - **No** → skip, record in deploy.md with note "database must be configured by user"
|
|
12
12
|
|
|
13
13
|
## PostgreSQL setup
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ sudo -u postgres psql -c "GRANT ALL ON DATABASE <project> TO <project>;"
|
|
|
21
21
|
|
|
22
22
|
- Generate a secure random password (32 chars, alphanumeric + symbols).
|
|
23
23
|
- Write the connection string to `.prizmkit/deploy/secrets.local.json`: `DATABASE_URL=postgresql://<project>:<password>@localhost:5432/<project>`.
|
|
24
|
-
- In deploy.md, write: "PostgreSQL
|
|
24
|
+
- In deploy.md, write: "PostgreSQL installed, connection info recorded in `.prizmkit/deploy/secrets.local.json` (not committed to git)".
|
|
25
25
|
|
|
26
26
|
## MySQL setup (future)
|
|
27
27
|
|
|
@@ -34,14 +34,14 @@ Best for: simple setup, servers with sufficient CPU/RAM, projects where build is
|
|
|
34
34
|
|
|
35
35
|
## Comparison
|
|
36
36
|
|
|
37
|
-
|
|
|
37
|
+
| Aspect | Push mode | Pull mode |
|
|
38
38
|
|------|----------|----------|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
| Deploy Key
|
|
44
|
-
|
|
|
39
|
+
| Build location | GitHub Actions runner | Server (local) |
|
|
40
|
+
| Server load | Low (runs app only) | High (build + run) |
|
|
41
|
+
| Config complexity | Medium (needs SCP transfer) | Low (SSH-triggered script only) |
|
|
42
|
+
| Best for | Low-spec servers, heavy builds | Simple setup, capable servers |
|
|
43
|
+
| Deploy Key required | No | Yes |
|
|
44
|
+
| Artifact transfer | SCP tarball | git pull (incremental) |
|
|
45
45
|
|
|
46
46
|
## Common ground between all modes
|
|
47
47
|
|
|
@@ -14,21 +14,21 @@ If not: continue below.
|
|
|
14
14
|
## Step 2 — DNS setup guidance
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
|
|
17
|
+
Domain <example.com> is not yet pointing to server <server-IP>.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Add the following record at your DNS provider (e.g., Alibaba Cloud, Cloudflare, Namecheap):
|
|
20
20
|
|
|
21
21
|
Type: A
|
|
22
22
|
Name: @
|
|
23
|
-
Value:
|
|
23
|
+
Value: <server-IP>
|
|
24
24
|
TTL: 600
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
To also support the www subdomain:
|
|
27
27
|
Type: A
|
|
28
28
|
Name: www
|
|
29
|
-
Value:
|
|
29
|
+
Value: <server-IP>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Reply "done" when configured, and I'll verify and set up the SSL certificate.
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## Step 3 — Verify after user confirmation
|
|
@@ -39,4 +39,4 @@ If not: continue below.
|
|
|
39
39
|
|
|
40
40
|
## Edge case — IP-only deployment
|
|
41
41
|
|
|
42
|
-
If user has no domain: skip DNS + SSL sections. Generate a note in deploy.md: "
|
|
42
|
+
If user has no domain: skip DNS + SSL sections. Generate a note in deploy.md: "Project accessed via IP, no domain or HTTPS configured. Recommend purchasing a domain and running `/prizmkit-deploy setup-ssl`."
|
|
@@ -5,17 +5,17 @@ Read this file when the user wants AI-assisted firewall configuration during boo
|
|
|
5
5
|
## Flow
|
|
6
6
|
|
|
7
7
|
1. After core tools are installed, ask the user:
|
|
8
|
-
> "
|
|
8
|
+
> "Want me to configure the firewall (ufw)? Only necessary ports will be opened, improving server security."
|
|
9
9
|
|
|
10
10
|
2. If user declines: skip, record to deploy config.
|
|
11
11
|
|
|
12
12
|
3. If user agrees, ask which additional ports to open (beyond SSH/HTTP/HTTPS):
|
|
13
|
-
> "
|
|
13
|
+
> "By default only SSH(22), HTTP(80), HTTPS(443) are opened. Should the blue/green preview ports (3101/3102) also be opened? If you need other ports (e.g., for remote database management), list them together."
|
|
14
14
|
|
|
15
15
|
4. Collect ports, then ask:
|
|
16
|
-
> "
|
|
17
|
-
> - **A.
|
|
18
|
-
> - **B.
|
|
16
|
+
> "Firewall rules are ready. Should I apply them directly, or will you do it yourself?"
|
|
17
|
+
> - **A. You apply them** — AI runs ufw commands
|
|
18
|
+
> - **B. I'll do it myself** — output rule list, user executes manually
|
|
19
19
|
|
|
20
20
|
## Planned rules (output before executing)
|
|
21
21
|
|