@plannotator/pi-extension 0.15.2 → 0.15.4

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.
@@ -0,0 +1,402 @@
1
+ ---
2
+ name: plannotator-compound
3
+ description: >
4
+ Analyze a user's Plannotator plan archive to extract denial patterns, feedback
5
+ taxonomy, evolution over time, and actionable prompt improvements — then produce
6
+ a polished HTML dashboard report. Use this skill when the user says things like
7
+ "/compound-planning", "analyze my plans", "plan analysis", "what are my denial
8
+ patterns", "why do my plans get denied", "compound planning report", "plan
9
+ insights", or "analyze my planning data". This is a user-invoked skill only —
10
+ do not trigger automatically. The user must explicitly request it.
11
+ ---
12
+
13
+ # Compound Planning Analysis
14
+
15
+ You are conducting a comprehensive research analysis of a user's Plannotator plan
16
+ archive. The goal: extract patterns from their denied plans and annotations, reduce
17
+ them into actionable insights, and produce an elegant HTML dashboard report.
18
+
19
+ This is a multi-phase process. Each phase must complete fully before the next begins.
20
+ Research integrity is paramount — every file must be read, no skipping.
21
+
22
+ ## Phase 0: Locate the Plans Directory
23
+
24
+ Check for `~/.plannotator/plans/`. If it exists and contains `.md` files, proceed.
25
+
26
+ If not found, ask the user:
27
+ > "I couldn't find plans at ~/.plannotator/plans/. Where is your plans directory?"
28
+
29
+ Once you have the path, verify it contains files matching `*-denied.md` and/or
30
+ `*.annotations.md`. If neither exist, inform the user there's no denial/annotation
31
+ data to analyze and stop.
32
+
33
+ ## Phase 1: Inventory
34
+
35
+ Count and report the dataset:
36
+
37
+ ```
38
+ - *-approved.md files (count)
39
+ - *-denied.md files (count)
40
+ - *.annotations.md files (count)
41
+ - *.diff.md files (count)
42
+ - Date range (earliest to latest date found in filenames)
43
+ - Total days spanned
44
+ - Revision rate: denied / (approved + denied) — this is the "X% of plans
45
+ revised before coding" stat used in dashboard section 1
46
+ ```
47
+
48
+ Also run `wc -l` across all `*-approved.md` files to get average lines per
49
+ approved plan. This tells the user whether their plans are staying lightweight
50
+ or bloating over time. You do not need to read approved plan contents — just
51
+ their line counts. If possible, break this down by time period (e.g., monthly)
52
+ to show whether plan size changed.
53
+
54
+ Dates appear in filenames in YYYY-MM-DD format, sometimes as a prefix
55
+ (2026-01-07-name-approved.md) and sometimes embedded (name-2026-03-15-approved.md).
56
+ Extract dates from all filenames.
57
+
58
+ Tell the user what you found and that you're beginning the extraction.
59
+
60
+ ## Phase 2: Map — Parallel Extraction
61
+
62
+ This is the most time-intensive phase. You must read EVERY denied plan and EVERY
63
+ annotation file. Do not skip files. Do not summarize early.
64
+
65
+ **Important:** Do NOT read approved plan files. They are counted in the inventory
66
+ for context (total volume, approval rate) but are not analyzed for feedback
67
+ patterns. Only `*-denied.md` and `*.annotations.md` files contain the feedback
68
+ data this analysis needs.
69
+
70
+ ### Batching Strategy
71
+
72
+ The approach depends on dataset size:
73
+
74
+ **Small datasets (< 40 total files):** Read all files directly — no need for
75
+ parallel agents. Just read them sequentially and proceed to Phase 3.
76
+
77
+ **Medium datasets (40-120 files):** Split into 2-4 parallel agents by file type
78
+ and/or time period.
79
+
80
+ **Large datasets (120+ files):** Split into batches of ~40-60 files per agent.
81
+ Split by the natural time boundaries in the data (months, quarters, or whatever
82
+ groupings produce balanced batches). If one time period dominates (e.g., the most
83
+ recent month has 3x the files), split that period into two batches.
84
+
85
+ Launch all extraction agents in parallel using the Agent tool with
86
+ `run_in_background: true`.
87
+
88
+ ### Output Files
89
+
90
+ Each extraction agent must write its results to a clean output file rather than
91
+ relying on the agent task output (which contains interleaved JSONL framework
92
+ logs that are difficult to parse). Instruct each agent to write to:
93
+
94
+ ```
95
+ /tmp/compound-planning/extraction-{batch-name}.md
96
+ ```
97
+
98
+ Create the `/tmp/compound-planning/` directory before launching agents. The
99
+ reduce agent in Phase 3 will read these clean files directly.
100
+
101
+ ### Extraction Prompt for Denied Plans
102
+
103
+ Each agent for denied plans receives this instruction (adapt the time period,
104
+ file glob, and output path):
105
+
106
+ ```
107
+ You are extracting structured data from denied plan files for a pattern analysis.
108
+
109
+ Directory: [PLANS DIRECTORY]
110
+ Files to read: All *-denied.md files with dates in [TIME PERIOD]
111
+ Output: Write your complete results to [OUTPUT FILE PATH]
112
+
113
+ Read EVERY matching file. For EACH file, extract:
114
+ - The plan name/topic
115
+ - The denial reason or feedback given (look for reviewer comments, annotations,
116
+ revision requests — capture the actual words used)
117
+ - What was specifically asked to change
118
+ - The type of feedback (let the content determine the category — don't force-fit
119
+ into predefined types. Common types include things like: scope concerns,
120
+ approach disagreements, missing information, process requirements, quality
121
+ concerns, UX/design issues, naming disputes, clarification requests,
122
+ testing/procedural denials — but the user's actual patterns may differ)
123
+ - Any specific phrases or recurring language from the reviewer
124
+ - The date
125
+
126
+ Do NOT skip any files. One entry per file.
127
+
128
+ Format each entry as:
129
+ **[filename]**
130
+ - Date: ...
131
+ - Topic: ...
132
+ - Denial reason: ...
133
+ - Feedback type: ...
134
+ - Specific asks: ...
135
+ - Notable phrases: ...
136
+ ---
137
+
138
+ After processing all files, write the complete results to [OUTPUT FILE PATH].
139
+ State the total file count at the end of the file.
140
+ ```
141
+
142
+ ### Extraction Prompt for Annotation Files
143
+
144
+ Annotation files have a different structure — they contain inline comments,
145
+ highlights, and feedback left on specific sections of plans. Each agent for
146
+ annotations receives this instruction:
147
+
148
+ ```
149
+ You are extracting structured data from annotation files for a pattern analysis.
150
+
151
+ Directory: [PLANS DIRECTORY]
152
+ Files to read: All *.annotations.md files with dates in [TIME PERIOD]
153
+ Output: Write your complete results to [OUTPUT FILE PATH]
154
+
155
+ Read EVERY matching file. For EACH file, extract:
156
+ - The plan name/topic it annotates
157
+ - Every individual annotation/comment made (there may be multiple per file)
158
+ - For each annotation: the quoted text, what type of feedback it is (correction,
159
+ scope concern, design preference, structural request, question, praise,
160
+ process directive, etc.), and what section of the plan was annotated
161
+ - The overall tone of the feedback
162
+
163
+ Do NOT skip any files. One entry per file.
164
+
165
+ Format each entry as:
166
+ **[filename]**
167
+ - Plan topic: ...
168
+ - Annotations found: [count]
169
+ - Annotation 1: "[quote or paraphrase]" — Type: ... — Section: ...
170
+ - Annotation 2: "[quote or paraphrase]" — Type: ... — Section: ...
171
+ - (continue for all annotations in the file)
172
+ - Overall tone: ...
173
+ ---
174
+
175
+ After processing all files, write the complete results to [OUTPUT FILE PATH].
176
+ State the total file count at the end of the file.
177
+ ```
178
+
179
+ ### While Agents Run
180
+
181
+ Track completion. As each agent finishes, note the count of files it processed.
182
+ Verify the total matches the inventory from Phase 1. If any agent's count is
183
+ short, flag it and consider re-launching for the missing files.
184
+
185
+ If an agent times out (possible with large batches — a batch of 128 files can
186
+ take 8+ minutes), re-launch it for just the unprocessed files. Check the output
187
+ file to see how far it got before timing out.
188
+
189
+ ## Phase 3: Reduce — Pattern Analysis
190
+
191
+ Once ALL extraction agents have completed (or all files have been read for small
192
+ datasets), launch a single reduction agent.
193
+
194
+ The reduction agent reads the clean extraction files from `/tmp/compound-planning/`
195
+ (not the agent task output files, which contain noisy JSONL framework logs). It
196
+ processes all extraction files together and produces the comprehensive analysis.
197
+
198
+ Give the reduction agent this prompt (adapt the file paths):
199
+
200
+ ```
201
+ You are a data scientist conducting the reduction phase of a map-reduce analysis
202
+ across a user's plan denial and annotation archive.
203
+
204
+ Read ALL extraction files at /tmp/compound-planning/extraction-*.md
205
+
206
+ These files contain structured extractions from every denied plan and annotation
207
+ file. Your job: aggregate everything, find patterns, cluster into a taxonomy,
208
+ and produce a comprehensive analysis.
209
+
210
+ Be exhaustive. Use real counts. Quote real phrases from the data. This is
211
+ research — no hand-waving, no fabrication.
212
+
213
+ Produce the following sections:
214
+ [... sections listed below ...]
215
+ ```
216
+
217
+ The reduction agent's job is to let the data speak. Do not impose a predetermined
218
+ framework — discover what's actually there. The analysis must produce:
219
+
220
+ ### 1. Denial Reason Taxonomy
221
+ Categorize every denial into a finite set of types that emerge from the data. Count
222
+ occurrences. Show percentages. Include real example quotes for each type. Aim for
223
+ 8-15 categories — enough to be specific, few enough to be scannable. Let the user's
224
+ actual feedback determine what the categories are.
225
+
226
+ ### 2. Top Feedback Patterns (ranked by frequency)
227
+ The 5-10 most recurring patterns. For each: what the reviewer consistently asks for,
228
+ 3+ example quotes from different files, and whether the pattern changed over time.
229
+
230
+ ### 3. Recurring Phrases
231
+ Exact phrases the reviewer uses repeatedly, with counts and what they signal. These
232
+ are the reviewer's vocabulary — their shorthand for what they care about.
233
+
234
+ ### 4. What the Reviewer Values (implicit preferences)
235
+ Derived from patterns — what does this specific person care about most? Quality?
236
+ Speed? Narrative? Architecture? Process? Simplicity? Rank by evidence strength.
237
+ This section should feel like a personality profile of the reviewer's standards.
238
+
239
+ ### 5. What Agents Consistently Get Wrong
240
+ The flip side — what recurring mistakes trigger denials? What should agents stop
241
+ doing for this reviewer?
242
+
243
+ ### 6. Structural Requests
244
+ What plan structure does the reviewer consistently demand? Required sections,
245
+ ordering, format preferences, level of detail expected.
246
+
247
+ ### 7. Evolution Over Time
248
+ How feedback patterns changed across the time span. Group by whatever natural time
249
+ boundaries exist in the data (weeks for short spans, months for longer ones). Did
250
+ expectations mature? Did new patterns emerge? What shifted? If the dataset spans
251
+ less than a month, note that evolution analysis is limited but still look for any
252
+ progression from early to late files.
253
+
254
+ ### 8. Actionable Prompt Instructions
255
+ The most important output. Based on all patterns: specific numbered instructions
256
+ that could be embedded in a planning prompt to prevent the most common denial
257
+ reasons. Write these as actual directives an agent could follow. Be specific to
258
+ this user's patterns — generic advice like "write good plans" is worthless. Each
259
+ instruction should trace back to a real, frequent denial pattern.
260
+
261
+ After writing the instructions, calculate what percentage of denials they would
262
+ address (count how many denials fall into categories covered by the instructions
263
+ vs total denials). Report this percentage — it will be different for every user.
264
+
265
+ ## Phase 4: Generate the HTML Dashboard
266
+
267
+ Build a single, self-contained HTML file as the final deliverable. Save it to
268
+ the user's plans directory as `compound-planning-report.html`.
269
+
270
+ Read the template at `assets/report-template.html` for the **design language
271
+ only**. The template contains example data from a previous analysis — ignore all
272
+ data values, quotes, and percentages in the template. Use only its visual design:
273
+ colors, typography, spacing, component styles, and layout patterns.
274
+
275
+ ### Design Language (from template)
276
+
277
+ - **Palette:** Light mode, warm off-white (#FDFCFB), text in slate scale, amber
278
+ for highlights/accents, emerald for positive, rose for negative, indigo for
279
+ action elements
280
+ - **Typography:** Playfair Display (serif, for narrative headings), Inter (sans,
281
+ for body/data), JetBrains Mono (mono, for code/phrases) — Google Fonts CDN
282
+ - **Layout:** Single-column, max-width 1024px, generous vertical whitespace (128px
283
+ between major sections), editorial/narrative-first aesthetic
284
+ - **Tone:** Calm, reflective, authoritative. Like a personal retrospective journal,
285
+ not a monitoring dashboard.
286
+
287
+ ### Page Frame (header + footer)
288
+
289
+ Before the 7 sections, the page has:
290
+
291
+ - **Header:** Report title on the left (Playfair Display, ~36px), project name +
292
+ date range below it in light meta text. On the right: file counts in mono
293
+ (e.g., "202 denials · 168 annotations · 71 days"). Separated from content by
294
+ a bottom border. Generous bottom padding before section 1.
295
+
296
+ - **Footer:** After section 7. Top border, centered italic Playfair Display tagline
297
+ summarizing the corpus (e.g., "Analysis of X denied plans and Y annotation files
298
+ from the Plannotator archive.").
299
+
300
+ ### Dashboard Section Order (7 sections)
301
+
302
+ The report follows this exact section order. Each section builds on the previous
303
+ one — the flow moves from "what happened" through "why" to "what to do about it":
304
+
305
+ 1. **The story in the data** — An editorial narrative paragraph (Playfair Display
306
+ serif, ~26px) that tells the headline finding in prose. Not bullet points — a
307
+ real paragraph that reads like the opening of an article. Alongside it, a KPI
308
+ sidebar with 3 key metrics (the top denial percentage, the overall revision
309
+ rate, and the number of distinct denial categories found). Use an amber inline
310
+ highlight on the most striking number in the narrative.
311
+
312
+ 2. **Why plans get denied** — The taxonomy as a ranked list. Each row: rank number
313
+ (mono), category label, a thin 4px progress bar (top item in amber-500, rest
314
+ in slate-300), percentage (mono), and for the top entries, a real italic quote
315
+ from the data below the label. Show the top 10 categories or however many the
316
+ data supports (minimum 5).
317
+
318
+ 3. **How expectations evolved** — One card per natural time period. Each card has:
319
+ the period name in serif, a theme phrase in colored uppercase (different color
320
+ per period to show progression), a description paragraph, and a stat line at
321
+ the bottom (e.g., "X denials · Y narrative requests"). If the data spans less
322
+ than 3 distinct periods, use 2 cards or even a single card with internal
323
+ progression noted.
324
+
325
+ 4. **What works vs what doesn't** — Two side-by-side cards. Left: green-tinted
326
+ (emerald-50/50 bg, emerald-100 border) with traits of plans that succeed for
327
+ this reviewer. Right: red-tinted (rose-50/50 bg, rose-100 border) with what
328
+ agents keep getting wrong. Both derived from the reduction analysis. Bulleted
329
+ with small colored dots. 5-8 items per card.
330
+
331
+ 5. **The actionable output** — The diagnostic payoff. Opens with a Playfair
332
+ Display narrative sentence stating how many prompt instructions were derived
333
+ and what estimated percentage of denials they address (use the real calculated
334
+ percentage from Phase 3, not a generic number). Then the top 3 most impactful
335
+ improvements as numbered items, each with an amber number, bold title, and
336
+ one-line description. This section bridges the analysis and the full prompt
337
+ that follows.
338
+
339
+ 6. **Your most-used phrases** — Grid of chips (2-col mobile, 3-col desktop). Each
340
+ chip: monospace quoted phrase on the left, frequency count on the right. White
341
+ bg, slate-200 border, rounded-12px. Show 9-12 of the most recurring phrases
342
+ found. These should be the reviewer's actual words — their verbal fingerprint.
343
+
344
+ 7. **The corrective prompt** — Dark panel (slate-900 bg, white text, rounded-3xl,
345
+ shadow-xl). Opens with a Playfair intro sentence about the instructions. Then
346
+ a dark code block (slate-800/80 bg, amber-200 monospace text) containing the
347
+ full numbered prompt instructions from Phase 3. Include a copy-to-clipboard
348
+ button that works (JS included). Below the code block: a gradient glow card
349
+ (indigo-to-purple blurred halo behind a white card) with a closing message
350
+ that these instructions are personal — derived from the user's own feedback,
351
+ their own language, their own standards.
352
+
353
+ ### Adaptation Rules
354
+
355
+ - If the user has < 3 months of data, reduce the evolution section to fewer cards
356
+ - If the user has no annotation files (only denials), note this in the narrative
357
+ and skip annotation-specific insights
358
+ - If fewer than 5 denial categories emerge, combine the taxonomy and patterns
359
+ sections into one
360
+ - If the dataset is very small (< 20 files), the narrative should acknowledge the
361
+ limited sample size and frame findings as preliminary
362
+ - The number of prompt instructions will vary per user — could be 8 or 20. Don't
363
+ force exactly 17. Let the data determine the count.
364
+ - The top 3 actionable items in section 5 must be the 3 that cover the largest
365
+ share of denials, not the 3 that sound most impressive
366
+
367
+ ### Key Rules
368
+
369
+ 1. Every number must come from the real analysis — no fabricated data
370
+ 2. Every quote must be a real quote from a real file
371
+ 3. The taxonomy percentages must be calculated from real counts
372
+ 4. The prompt instructions must trace back to actual denial patterns
373
+ 5. The copy button on the prompt block must work (include the JS)
374
+
375
+ After generating, open the file in the user's browser.
376
+
377
+ ## Phase 5: Summary
378
+
379
+ Tell the user:
380
+ - How many total files were analyzed (denials + annotations)
381
+ - The top 3 denial patterns found
382
+ - The estimated percentage of denials the prompt instructions would address
383
+ - The single most impactful prompt improvement
384
+ - Where the report was saved
385
+
386
+ ## Important Notes
387
+
388
+ - **Research integrity:** Every file must be read. The value of this analysis comes
389
+ from completeness. Sampling or skipping undermines the findings.
390
+ - **Real data only:** Never fabricate quotes, percentages, or patterns. If the data
391
+ doesn't show a clear pattern, say so honestly rather than inventing one.
392
+ - **Let the data lead:** The taxonomy, patterns, and instructions should emerge from
393
+ what's actually in the files. Different users will have completely different
394
+ denial patterns. A user building mobile apps will have different feedback than
395
+ one building APIs. Don't assume what the patterns will be.
396
+ - **Agent parallelization:** For large datasets, maximize parallel agents to reduce
397
+ wall-clock time. The bottleneck is the largest batch — split it.
398
+ - **Structured extraction format:** Ask extraction agents to return structured text
399
+ with consistent delimiters so the reduce agent can parse reliably.
400
+ - **The report is the artifact:** The HTML dashboard is what the user keeps. It
401
+ should be beautiful, honest, and useful. Every section should feel like it was
402
+ written about them specifically, because it was.