@papi-ai/skills 0.1.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/README.md +53 -0
- package/bin/install.mjs +104 -0
- package/lib/manifest.d.ts +33 -0
- package/lib/manifest.mjs +102 -0
- package/manifest.json +52 -0
- package/package.json +47 -0
- package/skills/check-mcp/SKILL.md +40 -0
- package/skills/deployment-completeness-audit/SKILL.md +255 -0
- package/skills/papi-advanced/SKILL.md +28 -0
- package/skills/papi-build/SKILL.md +52 -0
- package/skills/papi-idea/SKILL.md +37 -0
- package/skills/papi-plan/SKILL.md +164 -0
- package/skills/papi-strategy/SKILL.md +28 -0
- package/skills/playwright-skill/API_REFERENCE.md +653 -0
- package/skills/playwright-skill/EXAMPLES.md +166 -0
- package/skills/playwright-skill/SKILL.md +147 -0
- package/skills/playwright-skill/lib/helpers.js +441 -0
- package/skills/playwright-skill/package.json +26 -0
- package/skills/playwright-skill/run.js +228 -0
- package/skills/pr-reviewer/SKILL.md +443 -0
- package/skills/pr-reviewer/references/gh_cli_guide.md +368 -0
- package/skills/pr-reviewer/references/review_criteria.md +345 -0
- package/skills/pr-reviewer/references/scenarios.md +71 -0
- package/skills/pr-reviewer/references/troubleshooting.md +55 -0
- package/skills/pr-reviewer/scripts/add_inline_comment.py +163 -0
- package/skills/pr-reviewer/scripts/fetch_pr_data.py +327 -0
- package/skills/pr-reviewer/scripts/generate_review_files.py +480 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment-completeness-audit
|
|
3
|
+
description: >
|
|
4
|
+
Audit the codebase for "built but not deployed" patterns — code that exists
|
|
5
|
+
but isn't wired up, deployed, or executed. Catches orphaned SQL functions,
|
|
6
|
+
unapplied migrations, env vars read but never set, fallback paths that always
|
|
7
|
+
run because the primary never activates, and dependency drift. Use when the
|
|
8
|
+
user says "deployment audit", "wired check", "completeness audit", "is anything
|
|
9
|
+
built but not deployed", or every 10 cycles as a recurring health check.
|
|
10
|
+
Read-only — reports findings only, does not fix them.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Deployment Completeness Audit
|
|
14
|
+
|
|
15
|
+
Find code that has been built but never connected, deployed, or executed. This is the highest-leverage audit class for fast-moving projects: it catches the gap between "code merged" and "feature live", which is where most silent regressions hide.
|
|
16
|
+
|
|
17
|
+
## When to Run
|
|
18
|
+
|
|
19
|
+
- Every 10 cycles as a recurring health check (alongside `/security-audit`)
|
|
20
|
+
- After major schema or adapter changes (high drift risk)
|
|
21
|
+
- When you discover one instance of "built but not deployed" — assume more exist
|
|
22
|
+
- Before a strategy review (so findings inform the next plan)
|
|
23
|
+
- When the user explicitly says "deployment audit", "wired check", "is anything built but not deployed"
|
|
24
|
+
|
|
25
|
+
## Why This Class of Bug Matters
|
|
26
|
+
|
|
27
|
+
Past PAPI incidents that match this pattern:
|
|
28
|
+
- `get_plan_context()` SQL function — code path written C49, migration written C52, never deployed. 6 weeks of fallback running silently. Discovered C242 during plumbing audit.
|
|
29
|
+
- C236-C238 handoff drift — handoffs written against imagined schema.
|
|
30
|
+
- C239-C241 grouped-branch merges — `review_submit` reported success while code never landed on main.
|
|
31
|
+
|
|
32
|
+
The common thread: **two layers drift apart silently because nothing forces them to stay in sync at PR time.** Tests pass on the wrong layer. The codebase looks complete. The fallback path covers the gap.
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
This skill is read-only. Use `Grep`, `Glob`, `Read` only. No `Bash`, no `Edit`, no `Write` other than the final report. The skill produces a findings report — humans (or follow-up cycle tasks) implement fixes.
|
|
37
|
+
|
|
38
|
+
## Steps
|
|
39
|
+
|
|
40
|
+
### 1. Orphaned SQL Assets
|
|
41
|
+
|
|
42
|
+
The most common pattern in PAPI: SQL functions called via try-catch with a fallback that always succeeds.
|
|
43
|
+
|
|
44
|
+
**Patterns to grep for:**
|
|
45
|
+
- `\.unsafe\(['"]\s*SELECT\s+\w+\(` — direct function calls via postgres.js
|
|
46
|
+
- `\.rpc\(['"][a-z_]+['"]` — Supabase RPC calls
|
|
47
|
+
- Try-catch blocks where the catch logs `not available` or `falling back`
|
|
48
|
+
- `// TODO.*deploy` or `// FIXME.*migration` near SQL strings
|
|
49
|
+
|
|
50
|
+
**For each match, verify:**
|
|
51
|
+
1. Is the function defined in any file under `supabase/migrations/`?
|
|
52
|
+
2. If yes, does the migration filename appear in `supabase_migrations.schema_migrations` table? (If you don't have DB access, flag as "deployment unverified — check via `supabase migration list --linked`".)
|
|
53
|
+
3. Read the call site's catch block — does it always log "not available" / "falling back"? That's strong evidence the function isn't deployed.
|
|
54
|
+
4. Compare the SQL function definition (in migration) to the JS fallback path — do they return the **same shape**? Same filters? Same columns? Drift here causes silent regressions even after the function is deployed.
|
|
55
|
+
|
|
56
|
+
**Severity:**
|
|
57
|
+
- P0 if the call site is in a hot path (plan, build, review) AND the function and fallback diverge in output shape — deploying would corrupt downstream consumers.
|
|
58
|
+
- P1 if function is defined but unapplied, and fallback works correctly.
|
|
59
|
+
- P2 if function exists with an applied migration but is never actually called (dead code).
|
|
60
|
+
|
|
61
|
+
### 2. Environment & Config Gates
|
|
62
|
+
|
|
63
|
+
Code paths gated by env vars or feature flags that are never set.
|
|
64
|
+
|
|
65
|
+
**For env vars:**
|
|
66
|
+
1. Grep all `process\.env\.([A-Z_]+)` reads in production code (`packages/`, `app/`, `lib/`, `src/`).
|
|
67
|
+
2. Grep all `.env*` files and any `vercel.json`, `supabase/config.toml`, deployment docs for the same names.
|
|
68
|
+
3. Flag any var read in code that isn't defined anywhere — that code path never runs.
|
|
69
|
+
4. Flag any var defined but never read — dead config.
|
|
70
|
+
|
|
71
|
+
**For feature flags:**
|
|
72
|
+
1. Grep for patterns like `FEATURE_FLAG_`, `ENABLE_`, `USE_NEW_`, `flags\.`, `featureFlags\.`.
|
|
73
|
+
2. Trace each flag to its config source. If the config always returns false (or is commented out), the gated code is dead.
|
|
74
|
+
|
|
75
|
+
**Severity:**
|
|
76
|
+
- P1 for env vars/flags gating user-facing functionality that never activates.
|
|
77
|
+
- P2 for vars that gate optional optimizations (the system works without them).
|
|
78
|
+
- P3 for legacy flags left over from completed migrations.
|
|
79
|
+
|
|
80
|
+
### 3. Unexercised Code Paths
|
|
81
|
+
|
|
82
|
+
Code that exists but the runtime never reaches.
|
|
83
|
+
|
|
84
|
+
**Patterns:**
|
|
85
|
+
- Try-catch where the catch is the de-facto primary (see Step 1, but generalize beyond SQL).
|
|
86
|
+
- Conditionals where the true branch requires conditions that never occur in production (e.g. `if (process.env.NODE_ENV === 'staging')` but the project only deploys to prod).
|
|
87
|
+
- Background jobs registered (cron schedules, queue handlers, scheduled functions) but no scheduler/runtime triggers them. Look in `supabase/functions/`, `app/api/cron/`, any `cron.json` / `vercel.json` schedules vs the handlers that exist in code.
|
|
88
|
+
- Event listeners attached but events never emitted — search for `addEventListener`, `.on(`, observer registrations, then trace whether anything calls the corresponding emitter.
|
|
89
|
+
|
|
90
|
+
**Severity:**
|
|
91
|
+
- P1 if the unexercised path is the documented behaviour (users expect it to work).
|
|
92
|
+
- P2 if it's a fallback that's silently being used in place of the primary.
|
|
93
|
+
- P3 if it's defensive code that would only fire on rare conditions.
|
|
94
|
+
|
|
95
|
+
### 4. Dependency Drift
|
|
96
|
+
|
|
97
|
+
Packages installed but unused, or imports that exist but aren't called.
|
|
98
|
+
|
|
99
|
+
**Steps:**
|
|
100
|
+
1. Read `package.json` `dependencies` (NOT `devDependencies`).
|
|
101
|
+
2. For each, grep production code (excluding `__tests__/`, `*.test.ts`, `tests/`) for any import.
|
|
102
|
+
3. Flag packages with zero production imports.
|
|
103
|
+
4. For each imported package, sample-check whether the imported symbols are actually used (i.e. an `import` statement isn't enough — the value must appear elsewhere in the file).
|
|
104
|
+
|
|
105
|
+
**Common false positives:**
|
|
106
|
+
- Type-only packages (`@types/*`) — exclude.
|
|
107
|
+
- Packages used via dynamic `require()` or `await import()` — search both forms before flagging.
|
|
108
|
+
- Build-time tooling (some packages legitimately appear only in config files).
|
|
109
|
+
|
|
110
|
+
**Severity:**
|
|
111
|
+
- P2 for unused production deps (security surface + bundle size + cost at scale).
|
|
112
|
+
- P3 for unused imports (cleanup, not urgent).
|
|
113
|
+
|
|
114
|
+
### 5. Schema/Code Parity
|
|
115
|
+
|
|
116
|
+
Database fields referenced in code that don't exist in migrations, or vice versa.
|
|
117
|
+
|
|
118
|
+
**Steps:**
|
|
119
|
+
1. Glob `supabase/migrations/*.sql`. Extract column names per table from `CREATE TABLE`, `ALTER TABLE ... ADD COLUMN`.
|
|
120
|
+
2. Read `packages/adapter-md/src/types.ts` (or equivalent type definitions).
|
|
121
|
+
3. Compare: does every field in the TypeScript types correspond to a column in migrations? Does every column have a TS field?
|
|
122
|
+
4. Flag fields in code that don't exist in DB (would cause runtime errors on certain code paths).
|
|
123
|
+
5. Flag columns in DB never read by code (dead schema).
|
|
124
|
+
|
|
125
|
+
**Also check:** Adapter-pg implementation files — do they reference column names not in any migration? Especially common after partial taxonomy migrations (e.g. `sprint_tasks` → `cycle_tasks` rename leaving stragglers).
|
|
126
|
+
|
|
127
|
+
**Severity:**
|
|
128
|
+
- P0 if code reads a column that doesn't exist (runtime crash on first call).
|
|
129
|
+
- P1 for write paths that target non-existent columns (silent data loss).
|
|
130
|
+
- P2 for dead columns (cleanup, costs storage at scale).
|
|
131
|
+
|
|
132
|
+
### 6. Multi-Adapter / Multi-Surface Drift (PAPI-specific)
|
|
133
|
+
|
|
134
|
+
PAPI has three adapters: `md`, `pg`, `proxy` (data-proxy edge function). All three must implement the same interface.
|
|
135
|
+
|
|
136
|
+
**Steps:**
|
|
137
|
+
1. Read `packages/adapter-md/src/types.ts` for the `PapiAdapter` interface.
|
|
138
|
+
2. For each method, verify implementations exist in:
|
|
139
|
+
- `packages/adapter-md/src/adapter.ts`
|
|
140
|
+
- `packages/adapter-pg/src/pg-papi-adapter.ts`
|
|
141
|
+
- `supabase/functions/data-proxy/index.ts`
|
|
142
|
+
3. Flag missing implementations.
|
|
143
|
+
4. **For methods stubbed with `return undefined` or `throw "not implemented"`** — verify the stub is intentional (look for a comment explaining why) vs accidental. An intentional stub (e.g. data-proxy returning undefined for `getPlanContextSummary` to force fallback) is correct architecture, not a bug. Flag missing or unclear comments.
|
|
144
|
+
|
|
145
|
+
**Severity:**
|
|
146
|
+
- P0 if adapters diverge in production behaviour (silent data drift between local and external users).
|
|
147
|
+
- P1 if a method is missing in one adapter and external users hit it.
|
|
148
|
+
- P2 if intentional stubs lack explanatory comments (future-proofing).
|
|
149
|
+
|
|
150
|
+
### 7. Migration File vs Applied Migration
|
|
151
|
+
|
|
152
|
+
If you can run SQL via the Supabase MCP, compare:
|
|
153
|
+
|
|
154
|
+
```sql
|
|
155
|
+
SELECT name FROM supabase_migrations.schema_migrations ORDER BY name;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
vs `ls supabase/migrations/`. Anything in the file system but not in the table is unapplied.
|
|
159
|
+
|
|
160
|
+
If you can't access the DB directly, do the inferential check:
|
|
161
|
+
- Find the most recent migration file by date.
|
|
162
|
+
- Search the dogfood log / git log / build reports for evidence it was deployed (e.g. "deployed migration X" notes).
|
|
163
|
+
- If no evidence, flag as "deployment unverified".
|
|
164
|
+
|
|
165
|
+
**Severity:**
|
|
166
|
+
- P0 if an unapplied migration is required by code that's already shipped (production bug waiting to fire).
|
|
167
|
+
- P1 if unapplied but only required by a fallback path (silent suboptimality).
|
|
168
|
+
- P2 if unapplied and unused (cleanup).
|
|
169
|
+
|
|
170
|
+
## Output Format
|
|
171
|
+
|
|
172
|
+
Save findings as a markdown report at `docs/audits/deployment-completeness-c<NNN>.md` (where NNN is current cycle). Include this frontmatter:
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
---
|
|
176
|
+
title: Deployment Completeness Audit — Cycle <NNN>
|
|
177
|
+
type: audit
|
|
178
|
+
created: <ISO date>
|
|
179
|
+
cycle: <NNN>
|
|
180
|
+
status: active
|
|
181
|
+
---
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Body structure:
|
|
185
|
+
|
|
186
|
+
```markdown
|
|
187
|
+
# Deployment Completeness Audit — Cycle <NNN>
|
|
188
|
+
|
|
189
|
+
## Summary
|
|
190
|
+
|
|
191
|
+
- P0 findings: N
|
|
192
|
+
- P1 findings: N
|
|
193
|
+
- P2 findings: N
|
|
194
|
+
- P3 findings: N
|
|
195
|
+
|
|
196
|
+
## What Was Checked
|
|
197
|
+
|
|
198
|
+
- [ ] Orphaned SQL assets
|
|
199
|
+
- [ ] Env & config gates
|
|
200
|
+
- [ ] Unexercised code paths
|
|
201
|
+
- [ ] Dependency drift
|
|
202
|
+
- [ ] Schema/code parity
|
|
203
|
+
- [ ] Multi-adapter drift
|
|
204
|
+
- [ ] Migration file vs applied
|
|
205
|
+
|
|
206
|
+
## Findings
|
|
207
|
+
|
|
208
|
+
### [P1-1] Short title
|
|
209
|
+
|
|
210
|
+
- **Pattern:** Which of the 7 categories above
|
|
211
|
+
- **Location:** `path/to/file.ts:line` (use clickable [markdown links](path/to/file.ts#Lline))
|
|
212
|
+
- **Evidence:** Concrete proof — log line, fallback always runs, env var grep returns nothing, etc.
|
|
213
|
+
- **Impact:** What's broken / wasted / risky as a result
|
|
214
|
+
- **Confidence:** HIGH / MEDIUM / LOW
|
|
215
|
+
- **Recommended fix:** One sentence. If the fix requires a parity test (e.g. SQL function vs JS fallback), say so explicitly.
|
|
216
|
+
- **Effort:** XS / S / M / L
|
|
217
|
+
|
|
218
|
+
### [P1-2] ...
|
|
219
|
+
|
|
220
|
+
## Intentional Stubs (NOT Findings)
|
|
221
|
+
|
|
222
|
+
Document any stubs/skips that look like findings but are deliberate architecture. Future audits should not re-flag these. Format:
|
|
223
|
+
|
|
224
|
+
- `path/to/file.ts:line` — what it appears to be vs why it's intentional. Add a comment to the source if missing.
|
|
225
|
+
|
|
226
|
+
## Recommended Next Actions
|
|
227
|
+
|
|
228
|
+
For each P0/P1 finding, write a one-line idea submission ready to paste into `mcp__papi__idea`. Include `doc_ref: docs/audits/deployment-completeness-c<NNN>.md` and a parity test in acceptance criteria where applicable.
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## After the Audit
|
|
232
|
+
|
|
233
|
+
1. Save the report to `docs/audits/deployment-completeness-c<NNN>.md`.
|
|
234
|
+
2. Register via `doc_register` (type=audit, status=active, cycle=current).
|
|
235
|
+
3. For each P0/P1 finding, submit an `idea` with `doc_ref` pointing to the audit and acceptance criteria including parity tests where applicable.
|
|
236
|
+
4. Add intentional stubs to a tracked list so they aren't re-flagged.
|
|
237
|
+
5. Record the audit run via `ad_hoc` (effort: S, type: research) so it appears in cycle metrics.
|
|
238
|
+
|
|
239
|
+
## Important Notes
|
|
240
|
+
|
|
241
|
+
- This skill does NOT fix issues — it reports them only.
|
|
242
|
+
- The fixes belong in cycle work, not ad-hoc — they need handoffs and parity tests.
|
|
243
|
+
- Focus on actionable findings with clear evidence. "Possibly unused" is not actionable; "fallback log line `X` fires every cycle" is.
|
|
244
|
+
- Don't re-flag intentional stubs (e.g. data-proxy `getPlanContextSummary` returning undefined to force MCP fallback for external users — this is correct architecture). Maintain the "Intentional Stubs" section in each audit so future runs reference it.
|
|
245
|
+
- If you find a P0 (production crash waiting), surface it immediately to the user — don't wait until the report is finished.
|
|
246
|
+
|
|
247
|
+
## Known Drift History (learn from these)
|
|
248
|
+
|
|
249
|
+
| Cycle | Pattern | Root Cause | Fix |
|
|
250
|
+
|-------|---------|------------|-----|
|
|
251
|
+
| C49→C242 | `get_plan_context()` SQL function called via try-catch fallback, never deployed | Migration written but never applied; SQL/JS shape drift (status filter, missing `has_handoff`) | Pending — see [docs/audits/deployment-completeness-c242.md](../../docs/audits/deployment-completeness-c242.md) |
|
|
252
|
+
| C236-C238 | Handoffs written against imagined schema | Planner lost code/schema context between cycles | "PRE-BUILD VERIFICATION" rule added to handoff template |
|
|
253
|
+
| C239-C241 | Grouped-branch tasks reported as merged but commits never on main | `review_submit` emitted fake success logs for branches without PRs | task-1485 (in-flight) |
|
|
254
|
+
|
|
255
|
+
Add new entries here on each audit so the institutional memory compounds.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: papi-advanced
|
|
3
|
+
description: Invoke for cross-project patterns, dogfood-derived workflows, or advanced cycle management.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# papi-advanced
|
|
7
|
+
|
|
8
|
+
## When to Start a New Conversation
|
|
9
|
+
|
|
10
|
+
Start a fresh window when:
|
|
11
|
+
- **After a release** — cycle is done, context is heavy. New window orients in seconds via `orient`.
|
|
12
|
+
- **After 3+ tasks built** — accumulated file reads, diffs, and discussions bloat context. Quality degrades.
|
|
13
|
+
- **Switching modes** — going from building to planning, or from strategy review to building. Each mode benefits from clean context.
|
|
14
|
+
- **After context compression fires** — if you notice earlier messages are missing, the window is getting stale. Open fresh.
|
|
15
|
+
|
|
16
|
+
Stay in the same window when:
|
|
17
|
+
- Building sequential tasks in a batch (especially XS/S tasks)
|
|
18
|
+
- Mid-task and not yet complete
|
|
19
|
+
- Having a strategic discussion that informs the next action
|
|
20
|
+
|
|
21
|
+
**Rule of thumb:** If you've been in the same window for 30+ minutes or 3+ tasks, it's time for a fresh one.
|
|
22
|
+
|
|
23
|
+
## Advanced Patterns
|
|
24
|
+
|
|
25
|
+
- **Cross-project awareness:** If running multiple PAPI projects, learnings transfer across them via shared patterns and the doc registry.
|
|
26
|
+
- **Dogfood friction:** When something feels painful in the workflow, note it — the `idea` tool turns friction into improvements.
|
|
27
|
+
- **Deferred tasks are intentional:** Tasks moved to Deferred aren't forgotten — they're parked for the right time.
|
|
28
|
+
- **Carry-forward items:** Each plan notes carry-forward from the previous cycle. Check them before planning.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: papi-build
|
|
3
|
+
description: Invoke when executing a build via build_execute. Covers branching, gestalt pre-build check, and post-build audit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# papi-build
|
|
7
|
+
|
|
8
|
+
## Post-Build Audit
|
|
9
|
+
|
|
10
|
+
After every `build_execute` (complete), audit the branch before presenting for human review. This catches bugs and convention violations early.
|
|
11
|
+
|
|
12
|
+
1. **Identify changed files:** Run `git diff origin/main --name-only` to find modified files. If no changes, report "No changes to audit" and skip.
|
|
13
|
+
2. **Review each changed file** for:
|
|
14
|
+
- Logic errors, off-by-one mistakes, incorrect conditions
|
|
15
|
+
- Unhandled edge cases (null, undefined, empty inputs)
|
|
16
|
+
- Convention violations defined in this CLAUDE.md
|
|
17
|
+
- Incorrect type narrowing or unsafe casts
|
|
18
|
+
3. **Documentation check:** If any `docs/` files describe behaviour that the change modified, flag as "Doc drift".
|
|
19
|
+
4. **Report:** For each issue: file path, severity (Bug/Convention/Doc drift), what's wrong, how to fix.
|
|
20
|
+
5. **If findings exist:** Run `review_submit` with `request-changes` and the findings. Fix before human review.
|
|
21
|
+
6. **If clean:** Present for human review — "Ready for your review — approve or request changes?"
|
|
22
|
+
|
|
23
|
+
## Housekeeping — Opt-In Deep Sweep
|
|
24
|
+
|
|
25
|
+
`orient` runs a fast cheap-checks-only path by default. The deep sweep — orphaned branches, In Review tasks with no PR, stale In Progress branches, unrecorded commits, unregistered docs — is opt-in via `deep_housekeeping: true`.
|
|
26
|
+
|
|
27
|
+
When to run with `deep_housekeeping: true`:
|
|
28
|
+
1. Before `release` — catch board/branch drift.
|
|
29
|
+
2. After a long break (>1 day since last session) — surface anything that fell off.
|
|
30
|
+
3. When you suspect drift — odd cycle counts, missing PRs.
|
|
31
|
+
|
|
32
|
+
**Don't run deep on every session start.** It pollutes early context with cross-reference output that's noise 80% of the time. The default fast path tells you what cycle you're on, what's in flight, and what to do next; that's the daily-driver shape.
|
|
33
|
+
|
|
34
|
+
If the deep sweep surfaces something fixable (orphaned branches, missing PRs), fix it silently and report after — same autonomous-plumbing rule as before.
|
|
35
|
+
|
|
36
|
+
## Context Compression Recovery
|
|
37
|
+
|
|
38
|
+
When the system compresses prior messages, immediately:
|
|
39
|
+
1. **Run `orient`** — single call for cycle state
|
|
40
|
+
2. Check your todo list for in-progress work
|
|
41
|
+
3. Run housekeeping checks
|
|
42
|
+
4. **NEVER re-build a task that is already In Review or Done.**
|
|
43
|
+
5. Continue where you left off — don't restart or re-plan
|
|
44
|
+
|
|
45
|
+
## Tool Use Discipline
|
|
46
|
+
|
|
47
|
+
Most tool errors are habit issues, not capability issues. Avoid them up front:
|
|
48
|
+
|
|
49
|
+
- **Ranged reads for large files.** Before `Read`-ing a file you haven't already touched this session, check its size. For files over ~1000 lines, or known-large surfaces (generated SQL, lockfiles, HTML reports, large templates), use `offset` + `limit` from the start instead of hitting the token ceiling.
|
|
50
|
+
- **Search-before-read for unverified paths.** If a path comes from memory or inference rather than a file you've read this session, run `Glob` or list the parent directory first. Don't `Read` paths you haven't confirmed exist.
|
|
51
|
+
- **Prefer Read/Glob/Grep over Bash for file operations.** Bash `cat`/`grep`/`find`/`ls` is the most common source of failed commands and produces unstructured output. Reserve Bash for genuinely shell-only operations (git, gh, package managers, SQL, real pipelines).
|
|
52
|
+
- **Verify-before-recommend.** Before suggesting a new task, hook, or skill, check whether it already exists: `board_view` for tasks, `doc_search` for docs, `ls .claude/hooks/` for hooks. Recommending duplicates of already-shipped work wastes a build slot.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: papi-idea
|
|
3
|
+
description: Invoke when submitting backlog ideas, registering docs, or filing research. Covers idea pipeline and doc registry conventions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# papi-idea
|
|
7
|
+
|
|
8
|
+
## Idea Pipeline (unlocked at cycle 21)
|
|
9
|
+
|
|
10
|
+
The `idea` tool is your backlog intake — not just for features, but bugs, research, and big ideas.
|
|
11
|
+
|
|
12
|
+
- When you discover something during a build, submit it via `idea` rather than stopping to fix it.
|
|
13
|
+
- Include a `Reference:` line pointing to relevant docs so the planner has context.
|
|
14
|
+
- Split large ideas into 2-3 focused submissions for better planner scoping.
|
|
15
|
+
- The backlog is the steering wheel — priority + notes shape what gets planned next.
|
|
16
|
+
|
|
17
|
+
## Doc Registry
|
|
18
|
+
|
|
19
|
+
Docs are first-class entities. When research or planning produces a stable document:
|
|
20
|
+
- Register it with `doc_register` after it's finalised.
|
|
21
|
+
- Doc summaries travel with tool context — the planner and strategy review can find relevant docs.
|
|
22
|
+
- Keep docs current — update the review header after any change.
|
|
23
|
+
|
|
24
|
+
## Documentation Maintenance
|
|
25
|
+
|
|
26
|
+
Before creating a new doc, check `docs/INDEX.md` — it may already exist. When creating or archiving docs, update the index.
|
|
27
|
+
|
|
28
|
+
After implementing any code change, check if the change affects any documentation in `docs/`. If a doc describes behaviour, architecture, or file interactions that your change modified, update the doc to stay accurate.
|
|
29
|
+
|
|
30
|
+
When updating a doc, add or update a review header immediately below the title:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
# Document Title
|
|
34
|
+
> Last reviewed: task-NNN — DD-MM-YYYY
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Replace `task-NNN` with the task ID that triggered the update, and `DD-MM-YYYY` with today's date.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: papi-plan
|
|
3
|
+
description: Invoke when starting a new PAPI cycle. Covers plan generation, board management, and cycle scoping rules.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# papi-plan
|
|
7
|
+
|
|
8
|
+
## Workflow Sequences
|
|
9
|
+
|
|
10
|
+
PAPI tools follow structured flows. The agent manages the cycle workflow automatically — the user should never need to type tool names or remember the flow. Handle the plumbing, surface the summaries.
|
|
11
|
+
|
|
12
|
+
### Cycle Workflow (auto-managed)
|
|
13
|
+
|
|
14
|
+
- **Run tools automatically** — don't ask the user to invoke MCP tools manually
|
|
15
|
+
- Before implementing: silently run `build_execute <task_id>` (start phase)
|
|
16
|
+
- After implementing: run `build_execute <task_id>` (complete phase) with report fields
|
|
17
|
+
- After build_execute completes: audit the branch changes for bugs, convention violations, and doc drift (see Post-Build Audit below)
|
|
18
|
+
- After audit with findings: *MUST* automatically run `review_submit` with verdict `request-changes` and a concise summary of the audit findings as the changes requested — the builder fixes these before the task goes to human review
|
|
19
|
+
- After audit clean: present for human review — "Ready for your review — approve or request changes?"
|
|
20
|
+
- User approves/requests changes → run `review_submit` behind the scenes
|
|
21
|
+
|
|
22
|
+
### The Cycle (main flow)
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
plan → build_list → build_execute → audit → review_list → review_submit → build_list
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
1. **plan** — Run at the start of each cycle to generate the cycle plan and populate the board.
|
|
29
|
+
Next: `build_list` to see prioritised tasks.
|
|
30
|
+
2. **build_list** — View tasks ready for execution, ordered by priority.
|
|
31
|
+
Next: `build_execute <task_id>` to start a task.
|
|
32
|
+
3. **build_execute** (start) — Creates a feature branch and marks the task In Progress. Returns the build handoff.
|
|
33
|
+
Next: Implement the task, then `build_execute <task_id>` again with report fields to complete.
|
|
34
|
+
4. **build_execute** (complete) — Submits the build report, commits, and marks the task In Review.
|
|
35
|
+
Next: Run the post-build audit automatically.
|
|
36
|
+
5. **Post-build audit** — Review branch changes for bugs, convention violations, and doc drift (see Post-Build Audit section below).
|
|
37
|
+
Next: If findings exist, run `review_submit` with `request-changes` and the audit findings. If clean, proceed to `review_list`.
|
|
38
|
+
6. **review_list** — Shows tasks pending human review (handoff-review or build-acceptance).
|
|
39
|
+
Next: `review_submit` to approve, accept, or request changes.
|
|
40
|
+
7. **review_submit** — Records the review verdict and updates task status.
|
|
41
|
+
Next: `build_list` to view next build
|
|
42
|
+
|
|
43
|
+
**DO NOT** use `review_submit` as a substitute for `review_list`. If you need to see what is pending review, always call `review_list` first. If `review_list` is unavailable in your tool set (e.g. your MCP client filters parameterless tools), STOP and tell the human their MCP integration is incomplete — never guess at the next pending task. To submit an accept verdict on a build-acceptance review, either pass `reviewer_confirmed: true` or ensure `review_list` has run in the same session within the last 15 minutes. (SUP-2026-010.)
|
|
44
|
+
|
|
45
|
+
### Strategy Review
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
strategy_review → strategy_change
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- **strategy_review** — Analyses project health, velocity, and estimation accuracy.
|
|
52
|
+
Next: `strategy_change` if the review recommends adjustments.
|
|
53
|
+
- **strategy_change** — Updates active decisions, north star, or project direction based on review findings.
|
|
54
|
+
|
|
55
|
+
### Detect Strategic Decisions in Conversation
|
|
56
|
+
|
|
57
|
+
Watch for: direction changes, architecture shifts, deprioritisation with reasoning, new principles, competitive positioning decisions.
|
|
58
|
+
|
|
59
|
+
When detected:
|
|
60
|
+
1. Flag it: "That sounds like a strategic direction change — should I run `strategy_change`?"
|
|
61
|
+
2. If confirmed, run `strategy_change` immediately.
|
|
62
|
+
3. If mid-build, finish the current task first.
|
|
63
|
+
|
|
64
|
+
### Idea Capture
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
idea → (picked up by next plan)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- **idea** — Captures a new task idea and writes it to the backlog.
|
|
71
|
+
Next: The next `plan` run will prioritise and schedule it.
|
|
72
|
+
|
|
73
|
+
### Project Bootstrap
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
setup → plan
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- **setup** — {{setup_description}}
|
|
80
|
+
Next: `plan` to run the first cycle planning session.
|
|
81
|
+
|
|
82
|
+
### Board Management
|
|
83
|
+
|
|
84
|
+
- **board_view** — Read-only view of all tasks on the board.
|
|
85
|
+
- **board_archive** — Removes completed/cancelled tasks from the board to an archive.
|
|
86
|
+
- **board_deprioritise** — Moves a task to a later phase.
|
|
87
|
+
|
|
88
|
+
### Quick Reference: Tool → Next Step
|
|
89
|
+
|
|
90
|
+
| Tool | Next Step |
|
|
91
|
+
|------|-----------|
|
|
92
|
+
| `setup` | `plan` |
|
|
93
|
+
| `plan` | `build_list` |
|
|
94
|
+
| `build_list` | `build_execute <task_id>` |
|
|
95
|
+
| `build_execute` (start) | Implement, then `build_execute` (complete) |
|
|
96
|
+
| `build_execute` (complete) | Post-build audit (automatic) |
|
|
97
|
+
| Audit (findings) | `review_submit` with `request-changes` |
|
|
98
|
+
| Audit (clean) | `review_list` |
|
|
99
|
+
| `review_list` | `review_submit` |
|
|
100
|
+
| `review_submit` (approve/accept) | `build_list` |
|
|
101
|
+
| `review_submit` (request-changes) | `build_execute` (redo) or `build_list` |
|
|
102
|
+
| `strategy_review` | `strategy_change` (if needed) |
|
|
103
|
+
| `idea` | Next `plan` picks it up |
|
|
104
|
+
|
|
105
|
+
## Process Rules
|
|
106
|
+
|
|
107
|
+
These rules come from 80+ cycles of dogfooding. They prevent the most common sources of wasted time and rework.
|
|
108
|
+
|
|
109
|
+
### Building
|
|
110
|
+
- **Verify before claiming done.** Hit the endpoint, check the rendered output, confirm the data round-trips. Never say "should work" — prove it works.
|
|
111
|
+
- **Preview frontend changes.** After any UI/styling build, provide the localhost URL so the user can visually review. Don't make them ask for it.
|
|
112
|
+
- **Debug one change at a time.** When fixing issues, make one change, verify it, then move on. Don't stack multiple untested fixes.
|
|
113
|
+
- **Test the write-read roundtrip.** Every data write path must have a verified read path. If you write to DB, confirm the read query returns what was written. This is the #1 source of silent failures.
|
|
114
|
+
- **Test after every build.** Run the project's test suite after implementing. Suggest follow-up tasks from learnings when meaningful.
|
|
115
|
+
- **Build patiently.** Validate each phase against the last. Don't rush through implementation — test through the UI, not just the API.
|
|
116
|
+
|
|
117
|
+
### Security
|
|
118
|
+
- **Audit before widening access.** Before any build that adds endpoints, modifies auth/RLS, introduces new user types, or changes access controls — review the security implications first. Fix findings before shipping.
|
|
119
|
+
- **Flag access-widening changes.** If a build touches auth, RLS policies, API keys, or user-facing access, note "Security surface reviewed" in the build report's `discovered_issues` or `architecture_notes`.
|
|
120
|
+
- **Never ship secrets.** Do not commit .env files, API keys, or credentials. Check `.gitignore` covers sensitive files before pushing.
|
|
121
|
+
- **Telemetry opt-out.** PAPI collects anonymous usage data (tool name, duration, project ID). To disable, add `"PAPI_TELEMETRY": "off"` to the `env` block in your `.mcp.json`.
|
|
122
|
+
|
|
123
|
+
### Planning & Scope
|
|
124
|
+
- **NEVER run `plan` more than once per cycle.** Adjust the cycle with `board_deprioritise` or `idea` instead.
|
|
125
|
+
- **NEVER skip cycles.** Complete and release the current cycle before running the next `plan`.
|
|
126
|
+
- **Large plan/handoff outputs:** If the prepare-phase output is too large to pass inline (>50 KB), write it to a file and pass the absolute path via `llm_response_file` instead of `llm_response`. The `plan`, `strategy_review`, and `handoff_generate` apply modes all accept `llm_response_file`. The two parameters are mutually exclusive.
|
|
127
|
+
- **Only build tasks assigned to the current cycle.** Use `build_list` — it filters to current-cycle tasks with handoffs.
|
|
128
|
+
- **Don't ask premature questions.** If the project is in early cycles, don't ask about deployment accounts, hosting providers, OAuth setup, or commercial features. Focus on building core functionality first.
|
|
129
|
+
- **Split large ideas.** If an idea has 3+ concerns, submit it as 2-3 separate ideas so the planner creates properly scoped tasks — not kitchen-sink handoffs.
|
|
130
|
+
- **Auto-release completed cycles.** When all cycle tasks are Done and reviews accepted, run `release` immediately. Forgetting causes cycle number drift and merge conflicts in the next session.
|
|
131
|
+
- **Verify cycle readiness before releasing.** Before calling `release`, run `board_view` to confirm every task in the current cycle has status Done or Cancelled. The review queue is NOT sufficient evidence — `review_list` only shows built-and-pending-review tasks; it does not show Backlog or In Progress tasks. If any task is Backlog or In Progress: (a) build it, (b) move it to the next cycle via `board_edit({ task_id, cycle: N+1 })`, or (c) cancel it via `board_edit`. Do not call `release` until the cycle has no pending work. The `release` tool enforces this server-side and will block with a task list if the check fails.
|
|
132
|
+
|
|
133
|
+
### Communication
|
|
134
|
+
- **Show task names, not just IDs.** When summarising board state or reconciliation, include task names — e.g. "task-42: Add supplier form" not just "task-42".
|
|
135
|
+
- **Surface the next command.** After each step, tell the user what comes next. Commands should be surfaced, not memorised.
|
|
136
|
+
|
|
137
|
+
### Stage Readiness
|
|
138
|
+
- **Access-widening stages require auth/security phases.** Before declaring a stage complete, check if it widens who can access the product (e.g. Alpha Distribution, Alpha Cohort). If so, auth hardening and security review must be completed first — not discovered after the fact.
|
|
139
|
+
- **Pattern:** Audit access surface → fix vulnerabilities → then widen access. Never ship access-widening without a security phase.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<!-- PAPI_ENRICHMENT_TIER_1 -->
|
|
143
|
+
|
|
144
|
+
## Batch Building (unlocked at cycle 6)
|
|
145
|
+
|
|
146
|
+
For cycles with multiple XS/S tasks, batch build them without stopping between each:
|
|
147
|
+
- Build all XS/S tasks first, then M/L tasks
|
|
148
|
+
- Group tasks touching the same module onto a shared branch where possible
|
|
149
|
+
- One commit per task for traceable history, even on shared branches
|
|
150
|
+
- After all tasks built, batch review them together
|
|
151
|
+
|
|
152
|
+
### Gestalt Pre-Build Check (multi-task cycles)
|
|
153
|
+
|
|
154
|
+
**Before `build_execute` on the first task of any multi-task cycle, read the cycle as a whole:**
|
|
155
|
+
|
|
156
|
+
1. Run `build_list` to see every task assigned to the current cycle.
|
|
157
|
+
2. Read the BUILD HANDOFFs together — not one at a time. Look for:
|
|
158
|
+
- **Shared files** across handoffs — the same path in two FILES LIKELY TOUCHED lists usually means a refactor opportunity, a shared helper to extract first, or a sequencing constraint.
|
|
159
|
+
- **Shared modules** — multiple tasks in the same module should land on a shared cycle branch (`feat/cycle-N-<module>`) so they merge together.
|
|
160
|
+
- **Design decisions implicit across tasks** — e.g. one task introduces a new field, a later task consumes it. Build the producer first.
|
|
161
|
+
- **Branching strategy** — flag tasks that need their own branch (M/L, cross-module) vs. tasks that should batch together.
|
|
162
|
+
3. Only then run `build_execute` on the first task.
|
|
163
|
+
|
|
164
|
+
This is a one-time check at the start of the cycle, not per-task. It catches scope conflicts, redundant work, and ordering hazards that an isolated handoff read can't see. Skip it for single-task cycles.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: papi-strategy
|
|
3
|
+
description: Invoke when running strategy_review or making Active Decision changes. Covers strategy review cadence and AD lifecycle.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# papi-strategy
|
|
7
|
+
|
|
8
|
+
## Strategy Reviews
|
|
9
|
+
|
|
10
|
+
Every 5 cycles, PAPI offers a strategy review — a deep analysis of velocity, estimation accuracy, active decisions, and project direction.
|
|
11
|
+
|
|
12
|
+
- **Don't skip them.** They're where compounding value comes from.
|
|
13
|
+
- Strategy reviews run in their own session — don't mix with building.
|
|
14
|
+
- Reviews produce recommendations that feed into the next plan.
|
|
15
|
+
- If the review recommends AD changes, use `strategy_change` to apply them.
|
|
16
|
+
|
|
17
|
+
## Active Decision Lifecycle
|
|
18
|
+
|
|
19
|
+
Active Decisions (ADs) track architectural and product choices with confidence levels (LOW → MEDIUM → HIGH).
|
|
20
|
+
|
|
21
|
+
- Check ADs before making architectural choices — run `health` for the AD summary.
|
|
22
|
+
- ADs are for product/architecture choices only, not process preferences.
|
|
23
|
+
- When new evidence appears, update AD confidence via `strategy_change`.
|
|
24
|
+
- Supersede rather than overwrite — old decisions stay as history.
|
|
25
|
+
- New ADs should include a `### Reversal Trigger` section: specify the signal that would invalidate the stance, the action to take (modify/supersede/abandon), and why writing it now prevents sunk-cost drift later.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<!-- PAPI_ENRICHMENT_TIER_2 -->
|