claude-code-session-manager 0.27.0 → 0.29.0
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/.claude-plugin/marketplace.json +21 -0
- package/dist/assets/{TiptapBody-BsNr6F0B.js → TiptapBody-DyiZVN0v.js} +1 -1
- package/dist/assets/index-DMIi9YZH.css +32 -0
- package/dist/assets/{index-DU1pkhIQ.js → index-qS7GdCsL.js} +391 -389
- package/dist/index.html +2 -2
- package/package.json +3 -1
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +19 -0
- package/plugins/session-manager-dev/skills/develop/SKILL.md +112 -0
- package/plugins/session-manager-dev/skills/develop/standards.md +67 -0
- package/plugins/session-manager-dev/skills/explain-to-me/SKILL.md +192 -0
- package/plugins/session-manager-dev/skills/explain-to-me/assets/style-reference.html +163 -0
- package/plugins/session-manager-dev/skills/local-project-health/SKILL.md +58 -0
- package/plugins/session-manager-dev/skills/my-feedback/SKILL.md +132 -0
- package/plugins/session-manager-dev/skills/optimize-kpi/SKILL.md +289 -0
- package/plugins/session-manager-dev/skills/prd/SKILL.md +134 -0
- package/plugins/session-manager-dev/skills/process-feedback/SKILL.md +183 -0
- package/plugins/session-manager-dev/skills/project-status/SKILL.md +244 -0
- package/plugins/session-manager-dev/skills/requesting-code-review/SKILL.md +105 -0
- package/plugins/session-manager-dev/skills/requesting-code-review/code-reviewer.md +146 -0
- package/plugins/session-manager-dev/skills/security-review/SKILL.md +105 -0
- package/src/main/__tests__/scheduler-autofix-select.test.cjs +95 -0
- package/src/main/__tests__/scheduler-autopromote.test.cjs +33 -0
- package/src/main/index.cjs +7 -0
- package/src/main/ipcSchemas.cjs +10 -0
- package/src/main/lib/credentials.cjs +96 -11
- package/src/main/pluginInstall.cjs +114 -32
- package/src/main/scheduler.cjs +109 -5
- package/src/main/seedDevPlugin.cjs +95 -0
- package/src/main/templates/PRD_AUTHORING.md +316 -0
- package/src/main/usage.cjs +34 -1
- package/src/preload/api.d.ts +8 -2
- package/dist/assets/index-Dwb94Uxm.css +0 -32
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: local-project-health
|
|
3
|
+
description: >-
|
|
4
|
+
Run the CURRENT project's own definition of "health" and report one rollup.
|
|
5
|
+
Each project defines health differently (a trading bot tracks circuit-breakers
|
|
6
|
+
+ benchmark alpha; a web app tracks uptime + error rate), so this skill runs
|
|
7
|
+
the project-supplied health entrypoint rather than imposing a generic check.
|
|
8
|
+
Use whenever the user asks "is this project healthy?", "/local-project-health",
|
|
9
|
+
"system health", "is everything running / green", or wants a one-shot status
|
|
10
|
+
rollup for the repo they're in. Keywords: health, status, healthcheck, is it
|
|
11
|
+
up, are we green, rollup, system health, project health.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Local project health
|
|
15
|
+
|
|
16
|
+
Report a single health verdict for the project in the current working directory
|
|
17
|
+
by running **that project's own** health definition. Health is project-specific
|
|
18
|
+
by design — do not invent generic checks.
|
|
19
|
+
|
|
20
|
+
## Procedure
|
|
21
|
+
|
|
22
|
+
1. **Find the project's health entrypoint**, checking these paths in order
|
|
23
|
+
(first hit wins):
|
|
24
|
+
- `scripts/health.sh`
|
|
25
|
+
- `.claude/health.sh`
|
|
26
|
+
- `bin/health.sh`
|
|
27
|
+
- `Makefile` / `justfile` target named `health`
|
|
28
|
+
|
|
29
|
+
2. **If an entrypoint exists**, run it from the repo root and relay its output:
|
|
30
|
+
- `bash scripts/health.sh` (or the path found / `make health` / `just health`).
|
|
31
|
+
- These scripts are designed to print a human rollup and exit 0/1/2
|
|
32
|
+
(GREEN/YELLOW-or-UNKNOWN/RED). Show the user the rollup verbatim, then add a
|
|
33
|
+
one-line plain-English verdict leading with the overall color and the worst
|
|
34
|
+
layer (e.g. "🟡 YELLOW — performance is the drag: −3 pts vs SPY").
|
|
35
|
+
- If the script persists a structured artifact (e.g.
|
|
36
|
+
`data/system_health.json`), mention where it landed.
|
|
37
|
+
- If it exits non-zero, that is expected for YELLOW/RED — it is NOT a skill
|
|
38
|
+
failure. Only treat a *crash* (missing interpreter, traceback, unbound var)
|
|
39
|
+
as a failure to debug.
|
|
40
|
+
|
|
41
|
+
3. **If NO entrypoint exists**, do not guess at health with ad-hoc commands.
|
|
42
|
+
Instead:
|
|
43
|
+
- Read `CLAUDE.md`, `README*`, and skim the repo to infer what "health" means
|
|
44
|
+
for THIS project (what it monitors, what would constitute degraded/broken).
|
|
45
|
+
- Propose a concrete `scripts/health.sh` that collapses those project-specific
|
|
46
|
+
layers into one GREEN/YELLOW/RED rollup (terminal output + a persisted
|
|
47
|
+
`*.json` artifact), reusing the project's existing CLIs/artifacts rather
|
|
48
|
+
than re-deriving thresholds.
|
|
49
|
+
- Offer to create it. Once created, it becomes the convention this skill runs
|
|
50
|
+
on every future invocation.
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
- The contract is the **convention path**, not a shared implementation: every
|
|
55
|
+
project owns its own `scripts/health.sh`. This skill is just the launcher +
|
|
56
|
+
interpreter of the result.
|
|
57
|
+
- Keep the relayed summary tight: overall color first, then the offending
|
|
58
|
+
layer(s), then where the full report is. Lead with the answer.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: my-feedback
|
|
3
|
+
description: >-
|
|
4
|
+
File a feedback/enhancement request FROM the current project INTO another
|
|
5
|
+
project's inbound feedback folder, following that project's own README
|
|
6
|
+
convention. The cross-project complement of /process-feedback (which works the
|
|
7
|
+
*current* project's inbox). Use whenever the user says "/my-feedback to X",
|
|
8
|
+
"send feedback to X", "file a feedback item to X", "request an enhancement
|
|
9
|
+
from X", "drop a note in X's feedback folder", or "ask X to add/fix Y". The
|
|
10
|
+
target project MUST be named — error if it is missing. Keywords: feedback,
|
|
11
|
+
cross-project request, enhancement request, upstream, downstream, service
|
|
12
|
+
boundary, file feedback, request a feature, inter-service.
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# my-feedback
|
|
16
|
+
|
|
17
|
+
**Role:** the *outbound* end of the agent↔agent channel — it files a request into another
|
|
18
|
+
project's intake, where their `/process-feedback` picks it up and (if codeable) runs it
|
|
19
|
+
through their `/develop` pipeline. It is the send side; `/process-feedback` is the receive
|
|
20
|
+
side. **Never** cross the service boundary to fix the other project's code yourself — the
|
|
21
|
+
deliverable is an auditable request, not a patch.
|
|
22
|
+
|
|
23
|
+
Write one actionable feedback file into **another** project's intake folder, so
|
|
24
|
+
the team that owns the boundary can act on it via their `/process-feedback`. The
|
|
25
|
+
current project is the **From**; the named project is the **To**.
|
|
26
|
+
|
|
27
|
+
This is the send side of the same channel `/process-feedback` reads. Respect the
|
|
28
|
+
service boundary: you are *requesting* a change in their code, never reaching
|
|
29
|
+
across to make it yourself.
|
|
30
|
+
|
|
31
|
+
## 0. Resolve the target — error if missing
|
|
32
|
+
|
|
33
|
+
The invocation is `/my-feedback to <<project>>` (or "send feedback to
|
|
34
|
+
<<project>>"). **`<<project>>` is required.**
|
|
35
|
+
|
|
36
|
+
- **If no target project is named, STOP and error.** Do not guess, do not file
|
|
37
|
+
into the current project. Print: *"Name the target project: `/my-feedback to
|
|
38
|
+
<project>`."* Then list candidate sibling projects that have an intake folder:
|
|
39
|
+
```bash
|
|
40
|
+
for d in ~/Projects/*/; do
|
|
41
|
+
[ -d "$d/feedback" ] && echo " - $(basename "$d") (feedback/)"
|
|
42
|
+
[ -d "$d/external-feedback" ] && echo " - $(basename "$d") (external-feedback/)"
|
|
43
|
+
done
|
|
44
|
+
```
|
|
45
|
+
and stop.
|
|
46
|
+
- Resolve the path: `~/Projects/<project>/feedback/` (some projects
|
|
47
|
+
use `external-feedback/` — check both). Fuzzy-match a near miss to a real
|
|
48
|
+
directory, but confirm the resolved name before writing.
|
|
49
|
+
- **If the target has no feedback/external-feedback folder, STOP.** Don't invent
|
|
50
|
+
one — say the project doesn't accept feedback this way and ask how to proceed
|
|
51
|
+
(it may take requests via issues, a different folder, or not at all).
|
|
52
|
+
|
|
53
|
+
## 1. Read the target's README FIRST — it is the authority
|
|
54
|
+
|
|
55
|
+
**Every project's feedback folder has its own `README.md`, and the convention is
|
|
56
|
+
unique per project** (file-naming scheme, required sections, the status-log
|
|
57
|
+
table, the closing ritual). Read it before writing anything:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cat ~/Projects/<project>/feedback/README.md
|
|
61
|
+
ls ~/Projects/<project>/feedback/ # open items + numbering
|
|
62
|
+
ls ~/Projects/<project>/feedback/processed/ 2>/dev/null # closed examples to match
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Read one **processed** example end-to-end to copy the house format exactly — the
|
|
66
|
+
processed files are the calibrated bar. If the README and an example disagree,
|
|
67
|
+
the example wins (it's what actually got accepted).
|
|
68
|
+
|
|
69
|
+
## 2. Name the file by their convention
|
|
70
|
+
|
|
71
|
+
Most intakes use `YYYY-MM-DD-NN-short-slug.md` (today's date, next free `NN` for
|
|
72
|
+
the day — check existing files so you don't collide). Use the **target's** scheme
|
|
73
|
+
if it differs. The "From" is the **current project** — derive it from the cwd
|
|
74
|
+
basename, not an assumption.
|
|
75
|
+
|
|
76
|
+
## 3. Write to the bar — make it closeable without a back-and-forth
|
|
77
|
+
|
|
78
|
+
These hold across every intake (and most READMEs say the same):
|
|
79
|
+
|
|
80
|
+
- **Cite real `file:line` from the target's current `src/`** — verify by `grep`,
|
|
81
|
+
not memory. "You spawn a process per call — `_burrow_mcp.py:75`" beats "your
|
|
82
|
+
transport seems slow." Quote the offending code, then name the contract/PRD it
|
|
83
|
+
violates so the gap is self-evident.
|
|
84
|
+
- **Lead with the cost already paid.** A concrete incident ("the silent 11-day
|
|
85
|
+
mentions hole", "shorted into earnings on a stale zero") earns priority over a
|
|
86
|
+
hypothetical. Tie it to money/correctness, not taste.
|
|
87
|
+
- **Give a copy-pasteable Fix _and_ the deps to unblock it** (env var, new tool,
|
|
88
|
+
rate bucket). Don't leave the closer to discover side-asks.
|
|
89
|
+
- **Separate "must change" from "nice."** Credit what's already right so the file
|
|
90
|
+
reads as calibrated, not a pile-on.
|
|
91
|
+
- **Name the symptom and hypothesize the cause, but don't confidently assign the
|
|
92
|
+
fix's home.** A wrong attribution stalls; "frozen at 06-08 (evidence) — maybe
|
|
93
|
+
scoring, maybe upstream gather" closes faster.
|
|
94
|
+
- **Flag third-service dependencies up front.** If an ask needs *another*
|
|
95
|
+
project's tool/contract to land, say so — the closer forwards it on day one
|
|
96
|
+
instead of discovering it mid-fix. (You can also file the dependent half
|
|
97
|
+
directly into that third project with another `/my-feedback` pass.)
|
|
98
|
+
- **End with concrete Asks + the target's closing ritual** (the README usually
|
|
99
|
+
specifies marking ✅ and appending `## RESOLUTION`). State what "done" looks
|
|
100
|
+
like, with an acceptance test per ask.
|
|
101
|
+
- **One file = one coherent thread, scoped to the boundary.** Don't smuggle in
|
|
102
|
+
unrelated requests.
|
|
103
|
+
|
|
104
|
+
Anti-patterns that stall: vague severity ("seems slow"), no reproduction, fixes
|
|
105
|
+
that assume internals the other team can't see, asks with no acceptance test.
|
|
106
|
+
|
|
107
|
+
## 4. Register and hand off
|
|
108
|
+
|
|
109
|
+
- If the README keeps a **status-log table**, add a row for the new item (open/🆕)
|
|
110
|
+
using their exact column format. This is usually required — the log is the
|
|
111
|
+
durable index.
|
|
112
|
+
- **Don't commit or push into the target repo unless the user asks.** The file in
|
|
113
|
+
their tree is the deliverable; their team picks it up via `/process-feedback`.
|
|
114
|
+
If you do commit, commit in the **target** repo only, and never touch their
|
|
115
|
+
source — just the feedback file + README log row.
|
|
116
|
+
- Report back: the file path written, the From→To, priority, and the one-line
|
|
117
|
+
ask — so the user can relay or follow up.
|
|
118
|
+
|
|
119
|
+
## Tips
|
|
120
|
+
|
|
121
|
+
- **You're the sender, not the fixer.** Resist editing the target's code to
|
|
122
|
+
"just fix it" — that violates the boundary the channel exists to protect. The
|
|
123
|
+
whole point is an auditable request the owner acts on.
|
|
124
|
+
- **Mirror their tone.** A terse intake wants terse; a structured one wants every
|
|
125
|
+
section. Match the processed examples.
|
|
126
|
+
- **Reuse evidence you already have.** If this session surfaced the incident
|
|
127
|
+
(logs, audit rows, live tool output), quote it verbatim — freshly-gathered
|
|
128
|
+
`file:line` and timestamps are exactly what makes a file closeable.
|
|
129
|
+
- **Stale-claim guard.** Feedback captures the world when written; note the
|
|
130
|
+
as-of timestamp on live data you cite, so the closer knows what to re-verify.
|
|
131
|
+
- **If the right home is a third project,** file there too rather than overloading
|
|
132
|
+
one team with an ask they can only forward.
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: optimize-kpi
|
|
3
|
+
description: >-
|
|
4
|
+
Project-agnostic North-Star-KPI optimization cycle. Reads the current project's
|
|
5
|
+
declared North-Star KPI from its CLAUDE.md, measures it, audits real
|
|
6
|
+
consumption/usage telemetry + operational logs, grades the prior iteration's
|
|
7
|
+
filed lever, then fans out 3 INDEPENDENT recommender agents (Opus 4.8, max
|
|
8
|
+
thinking) that each diagnose the gap and propose the single
|
|
9
|
+
highest-leverage improvement — every recommendation grounded in usage + logs,
|
|
10
|
+
not the scorecard alone; one consolidator agent merges them into ONE feedback
|
|
11
|
+
item filed into this project's own feedback inbox plus a ranked backlog.
|
|
12
|
+
Implementation is NEVER done inline — it always goes through the scheduler via
|
|
13
|
+
/process-feedback → /develop. Use whenever the user says "/optimize-kpi",
|
|
14
|
+
"optimize the KPI", "improve our north-star metric", or runs the daily KPI
|
|
15
|
+
optimization loop. Keywords: optimize, KPI, north-star, metric, coverage,
|
|
16
|
+
recommenders, consolidate, feedback, scheduler, attribution.
|
|
17
|
+
model: opus
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# /optimize-kpi — measure → grade last lever → 3 recommenders → consolidate → file → scheduler
|
|
21
|
+
|
|
22
|
+
You are the optimization driver for **whatever this project has declared as its
|
|
23
|
+
North-Star KPI**. You do not implement code. Each run is one closed iteration of a
|
|
24
|
+
*converging* loop: **discover the KPI → measure + validate → grade the prior
|
|
25
|
+
lever → fan out 3 independent recommenders → consolidate into one feedback item +
|
|
26
|
+
backlog → hand off to the scheduler → log**.
|
|
27
|
+
|
|
28
|
+
**Non-negotiable: never implement, review, commit, publish, or reboot inline.**
|
|
29
|
+
The single consolidated recommendation is filed into this project's own feedback
|
|
30
|
+
inbox and dispatched through **`/process-feedback` → `/develop`**, which queues
|
|
31
|
+
PRDs onto the session-manager scheduler and tracks them to done. Bypassing the
|
|
32
|
+
scheduler is the one thing this skill must not do.
|
|
33
|
+
|
|
34
|
+
**Autonomy contract.** This skill is usually driven headless by a cron with
|
|
35
|
+
`--dangerously-skip-permissions`, so it must run to completion without human
|
|
36
|
+
input. **Never call `AskUserQuestion` or otherwise block on a prompt in loop
|
|
37
|
+
mode.** If a decision genuinely needs the operator, take the reversible default,
|
|
38
|
+
record the open question as a `> NOTE:` line in the feedback item, and continue —
|
|
39
|
+
do not stall the loop. (Interactive, user-invoked runs may ask; detect this by
|
|
40
|
+
whether a human is in the turn.)
|
|
41
|
+
|
|
42
|
+
## Step 0 — Discover the project's North-Star KPI (do not assume)
|
|
43
|
+
|
|
44
|
+
The KPI lives in the project's mission statement: read `./CLAUDE.md` and find the
|
|
45
|
+
section whose heading names the **North-Star KPI** (e.g. `## Objective &
|
|
46
|
+
North-Star KPI`). That section is the authority. Extract, by reading it and the
|
|
47
|
+
files it points to:
|
|
48
|
+
|
|
49
|
+
- **The KPI statement** — what is being optimized, the target (usually 100% / a
|
|
50
|
+
ceiling), and the precise definition doc it links (e.g. `docs/<kpi>.md`).
|
|
51
|
+
- **The measurement command** — the scorecard/metric script it names (e.g.
|
|
52
|
+
`scripts/coverage_scorecard.py`). Prefer a `--json` form and a `--trend N`
|
|
53
|
+
form if they exist.
|
|
54
|
+
- **The driving pipeline(s)** — which scheduled job(s) actually move the metric
|
|
55
|
+
(the gatherer/worker named in the KPI section or registry). You need this for
|
|
56
|
+
the validity gate in Step 1.
|
|
57
|
+
- **The usage / consumption audit** — how the project's *outputs* are consumed
|
|
58
|
+
and the operational logs that show whether the machine is healthy. The CLAUDE.md
|
|
59
|
+
observability/telemetry pointer names them (e.g. a usage-audit script over a
|
|
60
|
+
request log, a metrics endpoint, the run-history DB, `data/logs/`). Capture the
|
|
61
|
+
exact audit command(s). If the project exposes **no** consumption telemetry at
|
|
62
|
+
all, that itself is a finding — recommend adding it.
|
|
63
|
+
- **The levers** — the files the section names as the knobs (tiers/config,
|
|
64
|
+
selection, throughput/cadence/registry, etc.).
|
|
65
|
+
- **The feedback intake** — `feedback/` (or `external-feedback/`) at the repo
|
|
66
|
+
root, and its `README.md` convention.
|
|
67
|
+
|
|
68
|
+
**If CLAUDE.md declares no North-Star KPI section, STOP** and tell the user this
|
|
69
|
+
project hasn't declared one — the KPI belongs in CLAUDE.md's mission statement
|
|
70
|
+
(that's the convention this skill reads), and ask them to add it before running.
|
|
71
|
+
|
|
72
|
+
Capture the discovered KPI statement, measurement command, driving pipeline,
|
|
73
|
+
lever files, and intake path — you pass all of them verbatim into the recommender
|
|
74
|
+
agents so they work from the project's own definition, not your guess.
|
|
75
|
+
|
|
76
|
+
## Step 1 — Measure + validity gate (don't tune a corpse)
|
|
77
|
+
|
|
78
|
+
Run the discovered measurement command in both its snapshot and trend forms (e.g.
|
|
79
|
+
`<scorecard> --json` and `<scorecard> --trend 14`). Read the JSON outputs. Record:
|
|
80
|
+
today's KPI value, any floor/SLO breaches, per-segment breakdown, the
|
|
81
|
+
worst-performing units, and the trend direction over the last several days. This
|
|
82
|
+
evidence block is the shared input every recommender receives.
|
|
83
|
+
|
|
84
|
+
**Validity gate — before diagnosing, prove the metric is real.** A low KPI has
|
|
85
|
+
two very different causes: a *mis-set knob* (a tuning problem) or *the driving
|
|
86
|
+
pipeline didn't run / is wedged* (an ops problem). Confirm the Step-0 driving
|
|
87
|
+
pipeline actually produced work in the measurement window — check the
|
|
88
|
+
orchestrator/run history (last successful run, duration, whether it hung to its
|
|
89
|
+
max-duration cap or held a lock). If the pipeline **did not run a healthy cycle
|
|
90
|
+
in the window**, the metric is an artifact:
|
|
91
|
+
|
|
92
|
+
- Do **not** run the recommender fan-out. A selection/tiering "fix" against a
|
|
93
|
+
dead pipeline is noise.
|
|
94
|
+
- File a single feedback item whose Ask is **"restore the driving pipeline"**
|
|
95
|
+
(cite the stuck/missing runs), hand it to the scheduler (Step 5), log it, and
|
|
96
|
+
stop the iteration there.
|
|
97
|
+
|
|
98
|
+
Only when the metric reflects a pipeline that genuinely ran do you proceed to the
|
|
99
|
+
tuning loop.
|
|
100
|
+
|
|
101
|
+
## Step 1b — Audit usage + logs (MANDATORY evidence, not optional)
|
|
102
|
+
|
|
103
|
+
The scorecard says *how high* the KPI is; it never says *why*. The why lives in
|
|
104
|
+
how the project's outputs are actually consumed and what the logs are screaming.
|
|
105
|
+
**This step is required every run — a recommendation that cites only the
|
|
106
|
+
scorecard is rejected in Step 4.**
|
|
107
|
+
|
|
108
|
+
- **Usage / consumption audit.** Run the Step-0 usage-audit command (for a
|
|
109
|
+
contract/MCP project, the per-consumer + per-tool telemetry; for others, the
|
|
110
|
+
request/access log or metrics endpoint). Extract: who the consumers are, the
|
|
111
|
+
call distribution across outputs, **dark outputs** (shipped but never consumed),
|
|
112
|
+
**error hotspots** (esp. a write/auth path failing silently), and **latency/SLO
|
|
113
|
+
breaches**. Consumption shape tells you what's load-bearing vs dead weight — you
|
|
114
|
+
do not optimize what nobody reads, and a silently-failing consumer is often the
|
|
115
|
+
real KPI gap.
|
|
116
|
+
- **Operational-log audit.** Scan the run history + `data/logs/` (or the
|
|
117
|
+
project's log sink) for failed/stuck runs, repeated errors, max-duration
|
|
118
|
+
overruns, and lock contention in the measurement window. These are frequently
|
|
119
|
+
the *direct* root cause of a depressed KPI (e.g. the gatherer hitting its
|
|
120
|
+
duration cap → fewer units visited → coverage falls) — and they're invisible to
|
|
121
|
+
the scorecard.
|
|
122
|
+
|
|
123
|
+
Produce a compact **usage+log evidence block** alongside the Step-1 scorecard
|
|
124
|
+
block. Both are handed to every recommender. If the audit surfaces an ops failure
|
|
125
|
+
that is *itself* the dominant KPI cause (a dead consumer, a crashing pipeline),
|
|
126
|
+
treat it like the validity gate: the recommendation is "fix that," and you may
|
|
127
|
+
skip the tuning fan-out.
|
|
128
|
+
|
|
129
|
+
## Step 2 — Grade the prior lever + read in-flight work (close the loop)
|
|
130
|
+
|
|
131
|
+
Before proposing anything new, find out what the *last* iteration did and whether
|
|
132
|
+
it worked. Open-loop optimizers don't converge — this step is what makes the loop
|
|
133
|
+
learn.
|
|
134
|
+
|
|
135
|
+
- **Read the optimization log** (`docs/kpi-optimization-log.md`, if present) for
|
|
136
|
+
the last filed lever, its predicted effect, and its measure-by date.
|
|
137
|
+
- **Check whether it shipped:** look at the feedback folder (is last run's item
|
|
138
|
+
✅/archived?) and the scheduler's PRD history for the ids it queued. Status:
|
|
139
|
+
*not yet queued* / *queued, running* / *shipped on `<date>`* / *failed*.
|
|
140
|
+
- **Grade it against the metric:** if it shipped, compare the KPI/breach numbers
|
|
141
|
+
before vs after its ship date using the Step-1 trend. Did it move the metric in
|
|
142
|
+
the predicted direction and magnitude? Record `helped` / `no-effect` /
|
|
143
|
+
`regressed` / `too-early-to-tell`.
|
|
144
|
+
- **Build the in-flight + cooldown set:** list every lever currently *queued or
|
|
145
|
+
awaiting its first post-ship measurement*. These are **off-limits this run** —
|
|
146
|
+
do not let the recommenders or consolidator re-file a lever that is already in
|
|
147
|
+
flight or whose effect hasn't been measured yet (cooldown). Re-filing the same
|
|
148
|
+
ask stacks duplicate PRDs on the scheduler and never learns.
|
|
149
|
+
|
|
150
|
+
Carry forward into Step 3: `{last lever, its grade, why it under/over-performed,
|
|
151
|
+
the in-flight/cooldown lever set}`.
|
|
152
|
+
|
|
153
|
+
## Step 3 — Fan out 3 INDEPENDENT recommenders (parallel)
|
|
154
|
+
|
|
155
|
+
Spawn **3 Agent calls in a single message** so they run concurrently and blind to
|
|
156
|
+
each other. Each is a peer doing the full diagnosis independently — divergence is
|
|
157
|
+
the point; do not coordinate them. (Default panel = 3; you may scale to 4–5 when
|
|
158
|
+
the gap is large and token budget allows, or drop to 2 for a tiny gap — note the
|
|
159
|
+
choice.)
|
|
160
|
+
|
|
161
|
+
- **Model:** `opus` (Opus 4.8) with **failover to `sonnet`** — launch each agent
|
|
162
|
+
with `model: opus`; if an agent dies on a model/availability error, re-spawn
|
|
163
|
+
that one with `model: sonnet`. A **mixed panel** (some opus, some sonnet) is
|
|
164
|
+
fine — don't block waiting for a uniform fleet. (Fable is not GA and only
|
|
165
|
+
causes availability failures — do not use it.) Instruct each to think at
|
|
166
|
+
**maximum depth** before answering.
|
|
167
|
+
- **Prompt (identical for all 3, vary only an angle hint):** give each the KPI
|
|
168
|
+
statement, the definition doc path, the Step-1 scorecard block, the **Step-1b
|
|
169
|
+
usage+log evidence block**, the **Step-2 prior-lever grade + in-flight/cooldown
|
|
170
|
+
set**, the lever files, and the project's standing design directives from the
|
|
171
|
+
KPI section. Ask each to:
|
|
172
|
+
1. Diagnose *why* the KPI is below target — name the single root cause with the
|
|
173
|
+
highest expected KPI delta. **Ground the diagnosis in the usage+log evidence,
|
|
174
|
+
not the scorecard alone:** cite the specific consumer behaviour, dark output,
|
|
175
|
+
error hotspot, or failing/over-running run that supports the root cause. A
|
|
176
|
+
diagnosis with no usage/log citation is not acceptable. Account for the prior
|
|
177
|
+
lever's result: if it under-performed, say why and whether to escalate or
|
|
178
|
+
abandon it.
|
|
179
|
+
2. Propose ONE concrete, highest-leverage change as numbered implementation
|
|
180
|
+
steps an executor could follow without further design: exact file(s), the
|
|
181
|
+
change, the lever value, the **expected KPI/breach delta as a falsifiable
|
|
182
|
+
numeric target with a measure-by horizon** (e.g. "floor breaches 82→<40
|
|
183
|
+
within 2 days"), and how the next measurement run will confirm it. Quality
|
|
184
|
+
bar / service contracts stay fixed — never raise the KPI by lowering a
|
|
185
|
+
quality gate. **Must not** be a lever in the in-flight/cooldown set.
|
|
186
|
+
3. State assumptions and the one risk that would make it backfire.
|
|
187
|
+
Give each a different framing nudge so they don't converge: e.g. agent 1
|
|
188
|
+
"selection/throughput first", agent 2 "tiering/cadence/targets-achievability
|
|
189
|
+
first", agent 3 "consolidation/architecture first". The nudge biases the lens,
|
|
190
|
+
not the conclusion — each still considers all levers.
|
|
191
|
+
- **Output:** each agent **writes its recommendation to a temp file** and returns
|
|
192
|
+
the path. Use a per-run temp dir derived from the project + date, e.g.
|
|
193
|
+
`downloads/optimize-kpi/<YYYY-MM-DD>/agent-{1,2,3}.md` (create it; fall back to
|
|
194
|
+
`/tmp/optimize-kpi-<date>/` if `downloads/` doesn't exist). One file per agent,
|
|
195
|
+
full reasoning + the numbered steps. (Old per-run dirs are disposable — GC dirs
|
|
196
|
+
older than ~14 days when you create today's.)
|
|
197
|
+
|
|
198
|
+
## Step 4 — Consolidate into ONE recommendation + a ranked backlog (single agent)
|
|
199
|
+
|
|
200
|
+
Spawn **one** consolidator agent (same `opus`→`sonnet` failover, max thinking).
|
|
201
|
+
Give it the 3 temp files **and** the Step-2 in-flight/cooldown set. It must:
|
|
202
|
+
|
|
203
|
+
- Read all three, dedupe overlapping ideas, and **score** the distinct proposals
|
|
204
|
+
by expected KPI delta × achievability × reversibility.
|
|
205
|
+
- **Reject any proposal not grounded in the usage+log evidence** — a root cause
|
|
206
|
+
citing only the scorecard is not eligible. The winning lever must trace to an
|
|
207
|
+
observed consumer behaviour, dark output, error hotspot, or failing/over-running
|
|
208
|
+
run.
|
|
209
|
+
- **Drop any proposal that collides with the in-flight/cooldown set** (already
|
|
210
|
+
queued or awaiting measurement) — those are not eligible this run.
|
|
211
|
+
- **Pick the single highest-leverage *eligible* lever** to change this iteration
|
|
212
|
+
(resist bundling — one lever per iteration), grafting the best supporting ideas
|
|
213
|
+
from the runners-up into the plan where they strengthen it.
|
|
214
|
+
- Verify targets are achievable for real throughput — if a proposal sets targets
|
|
215
|
+
the system can't meet, say so and adjust rather than let the KPI lie.
|
|
216
|
+
- **Route the lever by ownership first.** If the winning lever's root cause
|
|
217
|
+
belongs to an **upstream/downstream service** — the data source hasn't gathered
|
|
218
|
+
the inputs, an upstream contract drifted, a consumer needs a change — the
|
|
219
|
+
deliverable is a **cross-project filing via `/my-feedback <project>`** into THAT
|
|
220
|
+
service's intake, not a this-project item this repo can't action. (Canonical
|
|
221
|
+
case: signal-builder's sellable-KPI binding constraint is frequently the
|
|
222
|
+
`acquisition` cohort — tickers Burrow simply hasn't gathered — which is filed to
|
|
223
|
+
`burrow`, per this project's CLAUDE.md North-Star section.) A this-project-owned
|
|
224
|
+
lever is filed here (next bullet); a **mixed** lever splits — the local half here
|
|
225
|
+
via `/develop`, the upstream half via `/my-feedback`, each cross-referencing the
|
|
226
|
+
other. Leaving an upstream-owned lever buried as a local item it can't fix is the
|
|
227
|
+
failure mode this rule exists to prevent.
|
|
228
|
+
- **Write ONE consolidated feedback item** (for the this-project-owned half) into
|
|
229
|
+
this project's intake folder, named by the folder README's convention
|
|
230
|
+
(`feedback/<YYYY-MM-DD>-NN-kpi-optimization.md`, next free `NN`), with: title,
|
|
231
|
+
**From:** `optimize-kpi loop`, date (PT), priority + why, **TL;DR**, **Evidence**
|
|
232
|
+
(cite the Step-1 scorecard numbers, the **Step-1b usage+log findings** the root
|
|
233
|
+
cause rests on, *and* the Step-2 prior-lever grade), **Why it matters**
|
|
234
|
+
(expected KPI gain), and **Ask** (the numbered implementation steps from the
|
|
235
|
+
winning proposal). The Ask **must** carry a falsifiable acceptance test: the
|
|
236
|
+
numeric success criterion + measure-by date the next run will grade it against.
|
|
237
|
+
Note which of the 3 agents it drew from and why it rejected the others.
|
|
238
|
+
- **Write/refresh a ranked backlog** at `docs/kpi-optimization-backlog.md`: the
|
|
239
|
+
eligible-but-not-chosen levers, ranked, each with its one-line rationale and
|
|
240
|
+
expected delta. The next iteration reads this first and can pull the next-best
|
|
241
|
+
lever without re-deriving from scratch. Remove entries that shipped or went
|
|
242
|
+
stale.
|
|
243
|
+
|
|
244
|
+
The consolidator writes the feedback file + backlog; it does **not** touch
|
|
245
|
+
project source.
|
|
246
|
+
|
|
247
|
+
## Step 5 — Hand off to the scheduler (do NOT implement)
|
|
248
|
+
|
|
249
|
+
Dispatch the consolidated item through the scheduler pipeline:
|
|
250
|
+
|
|
251
|
+
- Invoke **`/process-feedback`**, scoped to the one file you just wrote (name it
|
|
252
|
+
explicitly — never let it sweep unrelated open items). `/process-feedback`
|
|
253
|
+
evaluates it and queues the codeable work as PRDs via **`/develop`** onto the
|
|
254
|
+
session-manager scheduler, then tracks those PRDs to completion.
|
|
255
|
+
- This skill does **not** edit code, run `/code-review`/`/security-review`, bump
|
|
256
|
+
`VERSION`, commit, or reboot anything. All of that happens as the scheduled
|
|
257
|
+
PRDs run headlessly. Your job ends at "filed + dispatched + tracked".
|
|
258
|
+
|
|
259
|
+
## Step 6 — Log the iteration
|
|
260
|
+
|
|
261
|
+
Append one line to `docs/kpi-optimization-log.md` (create if missing):
|
|
262
|
+
`<date> | KPI <today> (trend <dir>) | breaches <n> | prior lever: <one-line> → <helped|no-effect|regressed|too-early> | lever filed: <one-line> (target: <numeric>, by <date>) | feedback: <file> | PRDs: <ids or "queued">`.
|
|
263
|
+
This is the running record — and the input Step 2 grades next time.
|
|
264
|
+
|
|
265
|
+
## Stop conditions
|
|
266
|
+
|
|
267
|
+
- **No KPI declared** (Step 0) → STOP, ask the user to add it to CLAUDE.md.
|
|
268
|
+
- **Validity gate fails** (Step 1) → file the "restore the driving pipeline" item,
|
|
269
|
+
hand off, log, and stop the iteration — skip the tuning fan-out entirely.
|
|
270
|
+
- **Step-1b audit finds an ops failure that is itself the dominant KPI cause**
|
|
271
|
+
(a dead/failing consumer, a crashing or max-duration-overrunning pipeline) →
|
|
272
|
+
file *that* fix and skip the tuning fan-out; it outranks any tuning lever.
|
|
273
|
+
- **KPI already at/above target** with zero breaches for 2 consecutive days →
|
|
274
|
+
file a *consolidation / quality-hardening* recommendation instead of a coverage
|
|
275
|
+
one (move toward the architecture end-state the KPI section describes).
|
|
276
|
+
- **Everything eligible is in-flight/cooldown** (Step 2 leaves no eligible lever)
|
|
277
|
+
→ do not invent a duplicate. Log "no eligible lever — N in flight" and stop;
|
|
278
|
+
next run grades them.
|
|
279
|
+
- **Measurement, the agents, or `/process-feedback` fail** → STOP, leave the tree
|
|
280
|
+
untouched (you never modified source anyway), and report what broke. Never file
|
|
281
|
+
a recommendation built on a failed measurement.
|
|
282
|
+
|
|
283
|
+
## Scheduling
|
|
284
|
+
|
|
285
|
+
Typically run as a daily `/loop` (the project may install a cron that drives this
|
|
286
|
+
skill headless). Each firing runs Steps 0–6 once. Because implementation is
|
|
287
|
+
delegated to the scheduler, this skill stays fast and side-effect-light: its only
|
|
288
|
+
writes to the repo are the temp recommender files, the one feedback item, the
|
|
289
|
+
backlog, and the log line.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prd
|
|
3
|
+
description: >-
|
|
4
|
+
Write a PRD for the session-manager scheduler queue (the right place for
|
|
5
|
+
token-budget-managed work). Use this whenever the user says "make this a PRD",
|
|
6
|
+
"queue this up", "add to the scheduler", or asks for a PRD without specifying a
|
|
7
|
+
target location. Keywords: prd, queue, scheduler, scheduled-plans, token budget.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /prd — author one scheduler PRD
|
|
11
|
+
|
|
12
|
+
**Role:** `/prd` is the single authority on one PRD's *structure, location, and scope sizing*. It does not own the engineering rules (that's `standards.md`) and does not decompose a large ask into multiple PRDs (that's `/develop`). Never restate rules that live in `standards.md` — reference and append them.
|
|
13
|
+
|
|
14
|
+
You are writing a PRD that will be executed by the user's session-manager scheduler — a system that runs `claude -p <prd-body> --dangerously-skip-permissions` jobs around 5-hour token-window resets, with auto-pause on rate-limit and auto-resume.
|
|
15
|
+
|
|
16
|
+
## Canonical location — non-negotiable
|
|
17
|
+
|
|
18
|
+
PRDs MUST be written to:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
~/.claude/session-manager/scheduled-plans/prds/<NN>-<kebab-slug>.md
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Anywhere else doesn't get scheduled.** If you write to `data/prds/`, `docs/prds/`, or the project root, the scheduler will not see it and the user loses their token-budget-managed execution. There is exactly one queue for all projects — that's intentional, because the 5-hour token budget is global across all of the user's Claude work. The `~` expands to `os.homedir()` so the same convention works for any user on any machine.
|
|
25
|
+
|
|
26
|
+
## Filename rules
|
|
27
|
+
|
|
28
|
+
- `NN` is the **parallel group** (2-digit zero-padded). Jobs in the same group run in parallel up to a concurrency cap; groups run serially. Pick `NN` by reading the existing files in `~/.claude/session-manager/scheduled-plans/prds/` and choosing:
|
|
29
|
+
- The same `NN` as a sibling that's logically independent and can run in parallel.
|
|
30
|
+
- The next unused `NN` if this PRD has a hard dependency on prior work landing first.
|
|
31
|
+
- `<kebab-slug>` is a short, descriptive kebab-case identifier (e.g. `voice-commands-send-cancel`, `ticker-velocity-mcp`). Keep under 60 chars.
|
|
32
|
+
|
|
33
|
+
Compute the current max `NN` **deterministically** before writing — do NOT eyeball the `ls` or narrow the pattern (a grep like `'^10[0-9]'` silently misses `110+` and overwrites/mis-groups a PRD):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
ls ~/.claude/session-manager/scheduled-plans/prds/ | grep -oE '^[0-9]+' | sort -n | uniq | tail -5
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The last line is the highest in use; the next free group is **max+1**. Use that for an independent/dependent PRD, or reuse a specific sibling's `NN` only when you deliberately want it in that parallel group. Verify your chosen filename doesn't already exist before writing.
|
|
40
|
+
|
|
41
|
+
## Required frontmatter
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
---
|
|
45
|
+
title: <one-line human-readable title>
|
|
46
|
+
cwd: <path to target project — where claude -p will run>
|
|
47
|
+
estimateMinutes: <integer wall-clock estimate>
|
|
48
|
+
---
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`cwd` is critical. Without it the job runs in the scheduler's default cwd (session-manager). Always set it to the path of the project the work targets. **Write it as `~/Projects/<repo>`** — the parser expands `~` to `os.homedir()` at ingest, so the same PRD works on Linux and macOS. Avoid hardcoding an absolute home path (`/home/<you>/Projects/<repo>`); it breaks on any machine with a different home directory.
|
|
52
|
+
|
|
53
|
+
## Required body sections (in this order)
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Goal
|
|
57
|
+
|
|
58
|
+
<2-4 sentences. What the executor will build and why it matters. NO "as a user I want to" framing. Concrete: name the function, the file, the user-visible change.>
|
|
59
|
+
|
|
60
|
+
# Acceptance criteria
|
|
61
|
+
|
|
62
|
+
- [ ] <each line is a verifiable check the executor can run after building>
|
|
63
|
+
- [ ] <include explicit file paths, function names, expected behavior>
|
|
64
|
+
- [ ] a bounded test command passes, e.g. `timeout 300 npm run typecheck` / `pytest -x` / `cargo check` (the run-before-done / never-end-on-red rule lives in standards.md → Execution discipline; the AC just has to name the command).
|
|
65
|
+
|
|
66
|
+
# Implementation notes
|
|
67
|
+
|
|
68
|
+
<file paths the executor will need to read first; the architectural pattern to follow; any non-obvious constraints. Be specific. Quote function signatures if it saves the executor a Read call.>
|
|
69
|
+
|
|
70
|
+
# Out of scope
|
|
71
|
+
|
|
72
|
+
<short bulleted list of what NOT to build, to prevent scope creep>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Self-containment is load-bearing
|
|
76
|
+
|
|
77
|
+
The executor (`claude -p`) starts with NO conversation context — only this PRD body and the project files. So:
|
|
78
|
+
|
|
79
|
+
- Include exact file paths (`src/main/index.cjs:142`).
|
|
80
|
+
- Quote function signatures or relevant code blocks if the executor would have to grep for them.
|
|
81
|
+
- Name the libraries / patterns to use (e.g. "use the existing `validatePath` helper in `config.cjs`").
|
|
82
|
+
- Don't reference "the conversation we just had" or "the design we discussed."
|
|
83
|
+
- If the PRD depends on another PRD's output, say so in `# Implementation notes` AND give it a higher `NN` so it queues after.
|
|
84
|
+
|
|
85
|
+
## Scope sizing — keep it SMALL (data-driven, 2026-06)
|
|
86
|
+
|
|
87
|
+
Across 400+ real runs the median PRD finishes in **~7 minutes**, p90 **~21 min**, p99 **~66 min** — yet authored `estimateMinutes` ran **5–8× too high**. Oversized scoping is the root problem: it anchors PRDs too big and pushes them into the rare >60-min tail where ~100% of true hangs live (deploy poll-loops, unbounded e2e suites).
|
|
88
|
+
|
|
89
|
+
- **Target ~15 minutes of wall-clock work per PRD. Hard ceiling ~30 min — if you project more, SPLIT** into sequential `NN` PRDs and document the dependency in each.
|
|
90
|
+
- Set `estimateMinutes` realistically: **p50≈8, p90≈21**. Don't write 60/90 — it's almost always wrong and it hides real outliers.
|
|
91
|
+
- Each execution costs ~$0.50–$2; the 5-hour token window is global. Smaller PRDs = smaller blast radius when a run is rate-limited, timed out, or killed.
|
|
92
|
+
- **`rateLimited` exit-1 is NOT a failure** — it's the scheduler's designed auto-pause; the job auto-resumes at the next window reset. Don't add retry logic for it.
|
|
93
|
+
|
|
94
|
+
## Execution discipline — append it, don't restate it
|
|
95
|
+
|
|
96
|
+
The runtime rules (bound every command, verify-before-done, fail-loud, stay-in-AC,
|
|
97
|
+
negative-assertion-exits-0) have a single home: the **Execution discipline** section of
|
|
98
|
+
`~/.claude/skills/develop/standards.md`. Don't paraphrase them here — they drift.
|
|
99
|
+
|
|
100
|
+
Long hangs — not bad code — are the dominant *real* failure (the watchdog only fires at 4
|
|
101
|
+
hours, so an unbounded command burns hours), so these rules are load-bearing and MUST reach
|
|
102
|
+
the headless executor in the PRD body:
|
|
103
|
+
|
|
104
|
+
- If this PRD is being authored **via `/develop`**, that skill already appends `standards.md`
|
|
105
|
+
verbatim — nothing to do here.
|
|
106
|
+
- If you are authoring a PRD **directly** (`/prd` alone), **append the Execution discipline
|
|
107
|
+
section from `standards.md` to the PRD body** (under an `## Execution discipline` heading)
|
|
108
|
+
before queueing. That is the only way the bounded-command / verify-before-done rules reach
|
|
109
|
+
`claude -p`.
|
|
110
|
+
|
|
111
|
+
The one rule worth echoing inline because it shapes the AC: **wrap every test/build/deploy/poll
|
|
112
|
+
command in a hard timeout** (`timeout 300 npm run typecheck`, `timeout 120 npx playwright test
|
|
113
|
+
one.spec.ts` — shard e2e to one spec, never a full suite; `curl --max-time 15`; bound any
|
|
114
|
+
`until/while`). Never queue a publish that polls an endpoint until a condition — the #1 hang
|
|
115
|
+
offender (PRD_AUTHORING §1/§5).
|
|
116
|
+
|
|
117
|
+
## Workflow
|
|
118
|
+
|
|
119
|
+
1. Read existing PRDs in `~/.claude/session-manager/scheduled-plans/prds/` to pick `NN`.
|
|
120
|
+
2. Write the file with the structure above.
|
|
121
|
+
3. Confirm to the user:
|
|
122
|
+
- The filename (so they can see it queued).
|
|
123
|
+
- The chosen `parallelGroup` (NN) and the rationale (parallel-with-X / serial-after-Y).
|
|
124
|
+
- The chosen `cwd` (so they can correct if it's wrong).
|
|
125
|
+
- Estimated wall time + a token-cost ballpark.
|
|
126
|
+
4. Tell the user the PRD will fire when the scheduler's policy says — they can click "Run now" in the SchedulePanel to execute immediately, or wait for `when-available` polling.
|
|
127
|
+
|
|
128
|
+
## What NOT to do
|
|
129
|
+
|
|
130
|
+
- Don't write the PRD to `data/prds/`, `docs/prds/`, the project's own folder, or anywhere outside the canonical path. The user has explicitly flagged this as a recurring problem.
|
|
131
|
+
- Don't combine multiple unrelated features into one PRD. Each PRD is one focused, completable unit.
|
|
132
|
+
- Don't add a parallelGroup field to the frontmatter — the scheduler reads the filename prefix.
|
|
133
|
+
- Don't leave `cwd` unset hoping for the default. Be explicit.
|
|
134
|
+
- Don't write the PRD body inline in the chat for review *before* writing the file. Write the file directly, then confirm. The user wants the PRD queued, not draft-reviewed in chat.
|