owflow 0.5.0 → 0.6.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 +28 -6
- package/dist/agents/bottleneck-analyzer.md +4 -0
- package/dist/agents/production-readiness-checker.md +1 -1
- package/dist/commands/work.md +2 -2
- package/dist/skills/codebase-analyzer/SKILL.md +1 -1
- package/dist/skills/diagrams-mermaid/references/reference.md +1 -1
- package/dist/skills/goal-performance/SKILL.md +126 -0
- package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +1 -1
- package/dist/skills/orchestrator-framework/references/gate-contract.md +7 -2
- package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +2 -2
- package/dist/skills/performance/SKILL.md +162 -332
- package/dist/skills/performance-analyze/SKILL.md +129 -0
- package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md +1 -95
- package/dist/skills/performance-finalize/SKILL.md +117 -0
- package/dist/skills/performance-implement/SKILL.md +114 -0
- package/dist/skills/performance-plan/SKILL.md +112 -0
- package/dist/skills/performance-spec/SKILL.md +145 -0
- package/dist/skills/performance-verify/SKILL.md +164 -0
- package/dist/templates/orchestrator-state-performance.yml +20 -9
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: owflow:performance-analyze
|
|
3
|
+
description: Performance — codebase analysis with clarifications, then static bottleneck identification via delegation. First work step of the performance workflow; continues with performance-spec.
|
|
4
|
+
argument-hint: "[task-path-or-identifier]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Analyze — Codebase & Bottleneck Analysis (codebase-analysed, bottlenecks-identified)
|
|
9
|
+
|
|
10
|
+
Work step of the performance workflow. Explores the codebase for performance context, gathers clarifications, then delegates static bottleneck identification (N+1 queries, missing indexes, O(n^2) algorithms, blocking I/O, memory leaks, caching opportunities) to the `bottleneck-analyzer` agent. State lives in `orchestrator-state.yml` — this skill reads it on entry and writes results on exit.
|
|
11
|
+
|
|
12
|
+
The performance metrics and optimization-pattern reference lives in this skill's own folder (`references/performance-optimization-guide.md`).
|
|
13
|
+
|
|
14
|
+
Related entry points: `/owflow:performance` (assisted mode), `/owflow:goal-performance` (autonomous mode). Both produce the same state; you may mix them freely.
|
|
15
|
+
|
|
16
|
+
## Entry Gate
|
|
17
|
+
|
|
18
|
+
Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
|
|
19
|
+
|
|
20
|
+
- **Path** (absolute or project-relative) to the task directory — use as-is.
|
|
21
|
+
- **Identifier** — exact directory name inside `.owflow/tasks/performance/` (e.g., `2026-10-02-api-latency`); resolve to its path.
|
|
22
|
+
- **Description** — anything else (free text) is treated as a new performance task description: ask via `question` whether to start a fresh standard task at this step (mid-pipeline bootstrap) or route through `/owflow:performance <description>`; on decline, print the blocked block and STOP.
|
|
23
|
+
- If the argument is **missing**, the path does **not exist**, or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
|
|
24
|
+
|
|
25
|
+
1. Prerequisites: none — this is the first work step. Everything else requires it.
|
|
26
|
+
2. List available performance-task identifiers (directories under `.owflow/tasks/performance/`) to resume from, if any.
|
|
27
|
+
3. Hint: `Run /owflow:performance <description> to start a task from scratch, or pass a task path/identifier to resume.`
|
|
28
|
+
|
|
29
|
+
### Prerequisites
|
|
30
|
+
|
|
31
|
+
| Required for this skill | Where verified | Produced by |
|
|
32
|
+
| -------------------------- | ----------------------------------------------- | ---------------------------- |
|
|
33
|
+
| State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:performance <desc>` |
|
|
34
|
+
| Task description recorded | `task.description` non-null in state | `/owflow:performance <desc>` |
|
|
35
|
+
|
|
36
|
+
1. **Read `orchestrator-state.yml`** from the task path. If missing → mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `codebase-analysed`): `question` — create a fresh standard performance task starting at this step, or decline → print `No performance task found at <path>. Run /owflow:performance <description> to start a task from scratch.` and STOP.
|
|
37
|
+
2. **Content check**: if `task.description` is null, ask via `question` — "What is slow or performance-constrained? Describe the symptom (endpoint, page, job), expected vs actual behavior, and any profiling data you have." — and record it in `task.description` before proceeding.
|
|
38
|
+
3. **Skip/resume (artifacts before state)**: if `codebase-analysed` is in `completed_phases`, validate `analysis/codebase-analysis.md` exists; missing → drop the slug and re-run that step. If both `codebase-analysed` and `bottlenecks-identified` are complete (validated against `analysis/performance-analysis.md`), report existing results and route to the Exit Gate. If only `codebase-analysed` is complete, skip to the bottleneck step.
|
|
39
|
+
|
|
40
|
+
## Execute
|
|
41
|
+
|
|
42
|
+
**Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md) and the [Dispatcher & Handoff Pattern](../orchestrator-framework/references/dispatcher-handoff.md).
|
|
43
|
+
|
|
44
|
+
### Codebase Analysis (`codebase-analysed`)
|
|
45
|
+
|
|
46
|
+
**Artifacts**: `analysis/codebase-analysis.md`, `analysis/clarifications.md`
|
|
47
|
+
|
|
48
|
+
> **ANTI-PATTERN — never run the codebase analysis yourself. "The codebase is small" is NOT a reason to skip delegation.**
|
|
49
|
+
>
|
|
50
|
+
> - ❌ "Let me explore the codebase myself..." — STOP. Delegate to `codebase-analyzer`.
|
|
51
|
+
> - ❌ "I'll read a few key files and summarize..." — STOP. Delegate to `codebase-analyzer`.
|
|
52
|
+
|
|
53
|
+
1. **INVOKE NOW** (Skill tool — never the Task tool; this skill spawns its own subagents): Skill tool - `codebase-analyzer`. Pass: task description (`task.description`), task_path, performance-focused guidance (database query patterns, hot code paths, I/O operations, caching layers, connection management, schema/migration files), `performance_context.project_doc_paths` from state, and any files present in `analysis/user-profiling-data/`. The analyzer adaptively selects parallel Explore agents based on complexity.
|
|
54
|
+
2. **SELF-CHECK**: Did you just invoke the Skill tool with `codebase-analyzer`? Or did you start exploring code yourself? If the latter, STOP and invoke the Skill tool.
|
|
55
|
+
3. Direct - use `question` for max 5 critical clarifying questions about performance concerns, hotspots, and optimization goals. Save to `analysis/clarifications.md`; record the outcome in `performance_context.phase_summaries.clarifications` (summary).
|
|
56
|
+
4. **State write**: append `codebase-analysed` to `completed_phases`; update `performance_context.phase_summaries.codebase_analysis` (`key_files` + summary); bump `orchestrator.updated`. On failure: append `codebase-analysed` to `failed_phases`, increment `auto_fix_attempts["codebase-analysed"]`. Then re-read state + run `verify_template` (see State Update Convention).
|
|
57
|
+
|
|
58
|
+
### Bottleneck Analysis (`bottlenecks-identified`)
|
|
59
|
+
|
|
60
|
+
**Artifacts**: `analysis/performance-analysis.md`
|
|
61
|
+
|
|
62
|
+
> **ANTI-PATTERN — never analyze bottlenecks yourself. "The patterns are obvious" is NOT a reason to skip delegation.**
|
|
63
|
+
>
|
|
64
|
+
> - ❌ "Let me analyze the bottlenecks myself..." — STOP. Delegate to `bottleneck-analyzer`.
|
|
65
|
+
> - ❌ "I'll grep for N+1 patterns..." — STOP. Delegate to `bottleneck-analyzer`.
|
|
66
|
+
|
|
67
|
+
1. **Read `references/performance-optimization-guide.md` NOW using the Read tool** — performance metrics vocabulary and optimization patterns (the reference lives in this skill's own folder). Use it to frame the context you pass to the agent and to interpret its findings.
|
|
68
|
+
2. Check `analysis/user-profiling-data/`. If empty, `question` — "Do you have profiling data to provide (flame graphs, APM screenshots, slow query logs)?" with options "Yes, let me add files to analysis/user-profiling-data/" / "No, proceed with static analysis only". If the user adds files, wait for them, then continue.
|
|
69
|
+
3. **INVOKE NOW** (Task tool — never the Skill tool; this is an agent): Task tool - `bottleneck-analyzer` subagent. Pass (Pattern 7 — accumulated context): task_path, task description, the codebase-analysis summary from `performance_context.phase_summaries.codebase_analysis`, user-data paths (if any), `performance_context.project_doc_paths`, and relevant `performance_context.phase_summaries`. Output: `analysis/performance-analysis.md`.
|
|
70
|
+
4. **Extract structured data from the result** (this gates later steps — do not summarize only): read the bottleneck count into `performance_context.bottlenecks_identified`, the P0-P3 split into `performance_context.bottleneck_priorities.p0…p3`, and `performance_context.user_data_available`; write the bottleneck list and a 1-2 sentence summary into `performance_context.phase_summaries.bottleneck_analysis`. Also set `performance_context.task_characteristics` from the findings (consumed by `specification-creator` and `implementation-planner`): `modifies_existing_code: true`; `involves_data_operations: true` when data-layer access (queries, indexes, schema) is implicated; `creates_new_entities: true` when the fix introduces new components (e.g., a cache layer); `ui_heavy: true` when hot paths are UI rendering; `has_reproducible_defect` stays `false`.
|
|
71
|
+
5. **SELF-CHECK**: Did you just invoke the Task tool with `bottleneck-analyzer`? Or did you start analyzing code yourself? If the latter, STOP and invoke the Task tool.
|
|
72
|
+
6. **State write**: append `bottlenecks-identified` to `completed_phases`; update `performance_context.bottlenecks_identified`, `performance_context.user_data_available`, `performance_context.bottleneck_priorities`, `performance_context.task_characteristics`, and `performance_context.phase_summaries.bottleneck_analysis`; bump `orchestrator.updated`. On failure: append `bottlenecks-identified` to `failed_phases`, increment `auto_fix_attempts["bottlenecks-identified"]`. Then re-read state + run `verify_template`.
|
|
73
|
+
|
|
74
|
+
## State Update Convention (per step)
|
|
75
|
+
|
|
76
|
+
Apply after EVERY step above:
|
|
77
|
+
|
|
78
|
+
1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed (`codebase-analysed`, `bottlenecks-identified`) plus that step's fields. Never batch multiple steps into one end-of-skill write.
|
|
79
|
+
2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
|
|
80
|
+
3. **Failures** — if the step fails or its retries are abandoned, do NOT append to `completed_phases`; instead append the step's slug to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`.
|
|
81
|
+
4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-performance.yml`. Fix any reported issue immediately before proceeding.
|
|
82
|
+
5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
|
|
83
|
+
|
|
84
|
+
## Recovery
|
|
85
|
+
|
|
86
|
+
| Step | Max Attempts | Strategy |
|
|
87
|
+
| ------------------------------------------- | ------------ | ----------------------------------------------------- |
|
|
88
|
+
| Codebase Analysis (`codebase-analysed`) | 2 | Expand search scope, prompt user for hints |
|
|
89
|
+
| Bottleneck Analysis (`bottlenecks-identified`) | 2 | Re-analyze with broader patterns, ask user for hotspots |
|
|
90
|
+
|
|
91
|
+
## Exit Gate
|
|
92
|
+
|
|
93
|
+
Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
|
|
94
|
+
|
|
95
|
+
### Results box
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## ✅ PERFORMANCE ANALYZE COMPLETE — <task name>
|
|
99
|
+
|
|
100
|
+
**Codebase** — [key files/modules from performance_context.phase_summaries.codebase_analysis]
|
|
101
|
+
**Bottlenecks** — [N identified: X P0 / Y P1 / Z P2 / W P3]
|
|
102
|
+
**User data** — [incorporated / static analysis only]
|
|
103
|
+
**Clarifications** — [key answers / "none needed"]
|
|
104
|
+
|
|
105
|
+
**Artifacts**
|
|
106
|
+
|
|
107
|
+
- `analysis/codebase-analysis.md`
|
|
108
|
+
- `analysis/clarifications.md`
|
|
109
|
+
- `analysis/performance-analysis.md`
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Results-acceptance question
|
|
113
|
+
|
|
114
|
+
Use `question` — "Are these results correct?" with options:
|
|
115
|
+
|
|
116
|
+
- **Accept** — analysis is good; continue.
|
|
117
|
+
- **Adjust** — re-run only the affected step (codebase analysis, clarifications, or bottleneck analysis), update state and artifacts, re-present the results box.
|
|
118
|
+
- **Discuss** — walk through a specific result (bottleneck prioritization, missing-index evidence, improvement estimates) in more depth; then re-ask.
|
|
119
|
+
- **Stop here** — print the resume command (`/owflow:performance-analyze <task-path>`) and end.
|
|
120
|
+
|
|
121
|
+
### Next steps (after Accept)
|
|
122
|
+
|
|
123
|
+
- `→ /owflow:performance-spec <task-path>` — `required` next: gathers optimization priorities, constraints, and targets, then writes the specification. Remaining after: plan → implement → verify → finalize.
|
|
124
|
+
|
|
125
|
+
**Other options**:
|
|
126
|
+
|
|
127
|
+
- `/owflow:goal-performance <task-path>` — `optional` shortcut: runs all remaining steps in one loop (spec → plan → implement → verify → finalize)
|
|
128
|
+
|
|
129
|
+
Then STOP.
|
package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md
RENAMED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# Performance Optimization Guide
|
|
2
2
|
|
|
3
|
-
Reference covering performance metrics knowledge
|
|
3
|
+
Reference covering performance metrics knowledge and optimization patterns.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
7
|
1. [Performance Metrics](#performance-metrics)
|
|
8
8
|
2. [Optimization Patterns](#optimization-patterns)
|
|
9
|
-
3. [Static Analysis Detection Patterns](#static-analysis-detection-patterns)
|
|
10
9
|
|
|
11
10
|
---
|
|
12
11
|
|
|
@@ -270,96 +269,3 @@ for (let i = 0; i < 1000000; i++) {
|
|
|
270
269
|
|
|
271
270
|
---
|
|
272
271
|
|
|
273
|
-
# Static Analysis Detection Patterns
|
|
274
|
-
|
|
275
|
-
Strategies for detecting performance bottlenecks by reading code rather than running profiling tools.
|
|
276
|
-
|
|
277
|
-
## Database Pattern Detection
|
|
278
|
-
|
|
279
|
-
### N+1 Query Detection by Framework
|
|
280
|
-
|
|
281
|
-
**Generic ORM-in-loop patterns** (Grep heuristics):
|
|
282
|
-
- Query call inside `for`/`forEach`/`map`/`while` body
|
|
283
|
-
- `await` + model method inside iteration callback
|
|
284
|
-
- Lazy-loaded relationship access inside loop
|
|
285
|
-
|
|
286
|
-
**Framework-specific indicators**:
|
|
287
|
-
|
|
288
|
-
| Framework | N+1 Pattern | Fix Pattern |
|
|
289
|
-
|-----------|-------------|-------------|
|
|
290
|
-
| Sequelize | `.findByPk()`/`.findOne()` in loop | `include: [{ model: X }]` |
|
|
291
|
-
| Prisma | `prisma.x.findUnique()` in loop | `include: { x: true }` |
|
|
292
|
-
| TypeORM | `repository.findOne()` in loop | `relations: ['x']` or QueryBuilder `.leftJoinAndSelect()` |
|
|
293
|
-
| Django | Attribute access in template `{% for %}` | `.select_related()`/`.prefetch_related()` |
|
|
294
|
-
| Rails | Association call without `.includes()` | `.includes(:association)` |
|
|
295
|
-
| SQLAlchemy | Relationship access in loop | `joinedload()`/`subqueryload()` |
|
|
296
|
-
| Hibernate | `@ManyToOne` lazy access in loop | `@Fetch(FetchMode.JOIN)` or JPQL `JOIN FETCH` |
|
|
297
|
-
|
|
298
|
-
### Missing Index Detection
|
|
299
|
-
|
|
300
|
-
**Cross-reference strategy**:
|
|
301
|
-
1. Find all index definitions in schema/migration files
|
|
302
|
-
2. Find all query patterns (WHERE, ORDER BY, JOIN columns)
|
|
303
|
-
3. Flag columns queried but not indexed
|
|
304
|
-
|
|
305
|
-
**Where to find indexes by framework**:
|
|
306
|
-
- **Rails**: `add_index` in `db/migrate/` files
|
|
307
|
-
- **Django**: `db_index=True` in model fields, `indexes` in Meta
|
|
308
|
-
- **Sequelize**: `indexes` array in model definition
|
|
309
|
-
- **Prisma**: `@@index` and `@@unique` in schema.prisma
|
|
310
|
-
- **TypeORM**: `@Index()` decorator
|
|
311
|
-
- **SQL migrations**: `CREATE INDEX` statements
|
|
312
|
-
|
|
313
|
-
### Slow Query Pattern Indicators
|
|
314
|
-
|
|
315
|
-
Patterns detectable from code without running queries:
|
|
316
|
-
- `SELECT *` on tables with many columns
|
|
317
|
-
- Missing `LIMIT`/`TOP` on queries against known-large tables
|
|
318
|
-
- `LIKE '%...'` (leading wildcard prevents index use)
|
|
319
|
-
- `OR` conditions on different columns (prevents single index use)
|
|
320
|
-
- Subqueries in WHERE that could be JOINs
|
|
321
|
-
- `DISTINCT` masking a JOIN issue
|
|
322
|
-
|
|
323
|
-
## Algorithm Pattern Detection
|
|
324
|
-
|
|
325
|
-
### Nested Loop / O(n^2) Heuristics
|
|
326
|
-
|
|
327
|
-
**Search patterns**:
|
|
328
|
-
- Nested `for`/`forEach`/`while` loops over same or related collections
|
|
329
|
-
- `.find()`/`.filter()`/`.some()`/`.includes()` inside `.map()`/`.forEach()`/`for`
|
|
330
|
-
- `.indexOf()` inside loop (linear search repeated)
|
|
331
|
-
- `.sort()` inside loop (O(n log n) per iteration)
|
|
332
|
-
|
|
333
|
-
**Fix indicators**: Can be resolved by pre-building a Map/Set/index before the loop
|
|
334
|
-
|
|
335
|
-
### Blocking I/O Patterns
|
|
336
|
-
|
|
337
|
-
**Node.js sync operations**:
|
|
338
|
-
- `readFileSync`, `writeFileSync`, `readdirSync`, `statSync`, `existsSync`
|
|
339
|
-
- `execSync`, `spawnSync`
|
|
340
|
-
- `crypto.pbkdf2Sync`, `crypto.randomBytesSync`
|
|
341
|
-
|
|
342
|
-
**Sequential awaits** (should be `Promise.all`):
|
|
343
|
-
- Multiple `await` statements on independent operations in same function
|
|
344
|
-
- Sequential HTTP/fetch calls to different endpoints
|
|
345
|
-
- Sequential database queries with no data dependency between them
|
|
346
|
-
|
|
347
|
-
## Memory Pattern Detection
|
|
348
|
-
|
|
349
|
-
**Unbounded growth indicators**:
|
|
350
|
-
- `Map`/`Set`/`Object`/`Array` in module or class scope with `.set()`/`push()` but no `.delete()`/eviction
|
|
351
|
-
- No size limit check before adding to collection
|
|
352
|
-
- No TTL or expiration mechanism
|
|
353
|
-
|
|
354
|
-
**Leak-prone patterns**:
|
|
355
|
-
- `addEventListener`/`.on()` without paired `removeEventListener`/`.off()`
|
|
356
|
-
- `setInterval` without `clearInterval` in cleanup/destroy/unmount
|
|
357
|
-
- Closures in long-lived callbacks capturing large objects
|
|
358
|
-
|
|
359
|
-
## Caching Opportunity Detection
|
|
360
|
-
|
|
361
|
-
**Indicators**:
|
|
362
|
-
- Same query/function called multiple times with same parameters in a request lifecycle
|
|
363
|
-
- Database query in a loop that could be batched and cached
|
|
364
|
-
- External API call returning reference/config data (infrequent changes)
|
|
365
|
-
- Expensive computation (sort, aggregate, transform) on data that doesn't change per-request
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: owflow:performance-finalize
|
|
3
|
+
description: Performance — terminal step. Inventories optimization results, presents the workflow results box, records task-completed only after the user accepts it, and provides commit guidance. No handoff.
|
|
4
|
+
argument-hint: "[task-path-or-identifier]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Finalize — Completion & Commit Guidance (task-completed)
|
|
9
|
+
|
|
10
|
+
Terminal step of the performance workflow. Summarizes the bottlenecks found, the optimizations applied, and the verification outcome; confirms correctness with the user; records `task-completed` only after the user accepts the results box (state is marked complete only after the gate response); and owns the commit guidance. No new analysis — finalization is inline-legal. State lives in `orchestrator-state.yml` — this skill reads it on entry and writes results on exit.
|
|
11
|
+
|
|
12
|
+
Related steps: all performance subskills (`/owflow:performance-analyze` → `/owflow:performance-spec` → `/owflow:performance-plan` → `/owflow:performance-implement` → `/owflow:performance-verify`). This is the terminal skill: its Exit-Gate acceptance is where the goal-performance wrapper's loop ends.
|
|
13
|
+
|
|
14
|
+
## Entry Gate
|
|
15
|
+
|
|
16
|
+
Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
|
|
17
|
+
|
|
18
|
+
- **Path** (absolute or project-relative) to the task directory — use as-is.
|
|
19
|
+
- **Identifier** — exact directory name inside `.owflow/tasks/performance/` (e.g., `2026-10-02-api-latency`); resolve to its path.
|
|
20
|
+
- **Description** — anything else (free text) is treated as a new performance task description: ask via `question` whether to start a fresh standard task at this step (mid-pipeline bootstrap) or route through `/owflow:performance <description>`; on decline, print the blocked block and STOP.
|
|
21
|
+
- If the argument is **missing**, the path does **not exist**, or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
|
|
22
|
+
|
|
23
|
+
1. Steps that must be completed first (in order), each with its command:
|
|
24
|
+
- Codebase & bottleneck analysis (`codebase-analysed`, `bottlenecks-identified`) → `/owflow:performance-analyze <task-path>`
|
|
25
|
+
- Requirements, specification & conditional audit (`spec-written`, `spec-audited`) → `/owflow:performance-spec <task-path>`
|
|
26
|
+
- Implementation planning (`plan-created`) → `/owflow:performance-plan <task-path>`
|
|
27
|
+
- Implementation (`implementation-done`) → `/owflow:performance-implement <task-path>`
|
|
28
|
+
- Verification & issue resolution (`options-chosen`, `verification-done`) → `/owflow:performance-verify <task-path>`
|
|
29
|
+
2. List available performance-task identifiers (directories under `.owflow/tasks/performance/`) to resume from, if any.
|
|
30
|
+
3. Hint: `Run /owflow:performance <description> to start a task from scratch, or pass a task path/identifier to resume.`
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
|
|
34
|
+
| Required for this skill | Where verified | Produced by |
|
|
35
|
+
| ----------------------- | --------------------------------------------------------------------------- | ---------------------------------------- |
|
|
36
|
+
| State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:performance <desc>` |
|
|
37
|
+
| Verification done | `verification-done` in `completed_phases` + `verification/implementation-verification.md` exists | `/owflow:performance-verify <task-path>` |
|
|
38
|
+
|
|
39
|
+
1. **Read `orchestrator-state.yml`** from the task path. If missing → mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `task-completed`): `question` — create a fresh standard performance task starting at this step, or decline → print `No performance task found at <path>. Run /owflow:performance <description> to start a task from scratch.` and STOP.
|
|
40
|
+
2. **Skip/resume**: if `task.status` is `completed`, report the existing finalization (the results box from the Finalization step below) and STOP.
|
|
41
|
+
3. **Prerequisite check (presence and content)**: `verification-done` in `completed_phases` AND `verification/implementation-verification.md` exists. If missing → print the blocked block, then STOP:
|
|
42
|
+
- Steps that must be completed first: verification (`verification-done`).
|
|
43
|
+
- `Run /owflow:performance-verify <task-path> first` (or the command for the earliest missing earlier step).
|
|
44
|
+
- If no task exists yet: `Run /owflow:performance <description> to start a task from scratch.`
|
|
45
|
+
|
|
46
|
+
## Execute
|
|
47
|
+
|
|
48
|
+
**Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md) — finalization is inline-legal (creating the summary, updating metadata, and presenting results are direct steps; no agents involved).
|
|
49
|
+
|
|
50
|
+
### Finalization (`task-completed`, inline)
|
|
51
|
+
|
|
52
|
+
1. **Inventory results** (state-only; no new files): bottlenecks from `performance_context.bottleneck_priorities` and `performance_context.phase_summaries.bottleneck_analysis`; optimizations from `performance_context.phase_summaries.implementation` and `implementation/work-log.md`; verification outcome from `verification_context.last_status` and `verification/implementation-verification.md`.
|
|
53
|
+
2. **Present the results box** (the workflow-level box — single box, not two):
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## ✅ PERFORMANCE WORKFLOW COMPLETE — <task name>
|
|
57
|
+
|
|
58
|
+
**Bottlenecks found** — [P0/P1/P2/P3 counts]
|
|
59
|
+
**Optimizations applied** — [count + key ones]
|
|
60
|
+
**Verification** — [final verdict]
|
|
61
|
+
**Estimated improvement** — [range from the analysis]
|
|
62
|
+
|
|
63
|
+
**Artifacts**
|
|
64
|
+
|
|
65
|
+
- `analysis/performance-analysis.md`
|
|
66
|
+
- `implementation/work-log.md`
|
|
67
|
+
- `verification/implementation-verification.md`
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
3. **Do NOT write `task-completed` yet** — the Exit Gate below owns the write, and it happens only after the user answers the results-acceptance question (Accept, or explicit proceed-with-issues). State is marked complete only after the gate response; writing it here would make the Adjust option a dead end (the completed task short-circuits on re-entry).
|
|
71
|
+
4. **Prepare (do not print yet) the commit guidance** (owned by this skill): a conventional commit message template referencing the task name, and the artifact set that belongs in the commit. It is printed on Accept, together with the closing guidance.
|
|
72
|
+
|
|
73
|
+
## State Update Convention (per step)
|
|
74
|
+
|
|
75
|
+
Apply after EVERY step above:
|
|
76
|
+
|
|
77
|
+
1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed (`task-completed`) plus that step's fields. `task-completed` is the one slug written **only after the user answers the Exit-Gate acceptance question (Accept, or explicit proceed-with-issues)** — never before the gate. Never batch multiple steps into one end-of-skill write.
|
|
78
|
+
2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
|
|
79
|
+
3. **Failures** — if finalization fails, do NOT append `task-completed` to `completed_phases`; instead append it to `orchestrator.failed_phases` and increment `auto_fix_attempts["task-completed"]`.
|
|
80
|
+
4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-performance.yml`. Fix any reported issue immediately before proceeding.
|
|
81
|
+
5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
|
|
82
|
+
|
|
83
|
+
## Recovery
|
|
84
|
+
|
|
85
|
+
| Step | Max Attempts | Strategy |
|
|
86
|
+
| ------------------------- | ------------ | ------------ |
|
|
87
|
+
| Completion (`task-completed`) | 0 | Summary only |
|
|
88
|
+
|
|
89
|
+
## Exit Gate
|
|
90
|
+
|
|
91
|
+
Present results, get user confirmation, then close the workflow (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill. **This acceptance is where the goal-performance wrapper's loop ends** (Accept = the wrapper proceeds to its own wrapper Exit Gate; any other option ends the loop with the standard handoff block).
|
|
92
|
+
|
|
93
|
+
### Results box
|
|
94
|
+
|
|
95
|
+
The results box from the Finalization step above IS the workflow-level results box — present it here as-is (single box, not two).
|
|
96
|
+
|
|
97
|
+
### Results-acceptance question
|
|
98
|
+
|
|
99
|
+
Use `question` — "Are these results correct?" with options:
|
|
100
|
+
|
|
101
|
+
- **Accept** — record `task-completed` (state write below), then print the closing guidance: the commit message template, the artifact set, and the next steps.
|
|
102
|
+
- **Adjust** — re-run the affected earlier step (e.g., `/owflow:performance-implement <task-path>` for additional optimizations, or `/owflow:performance-verify <task-path>` for another verification round), then re-present the results box.
|
|
103
|
+
- **Discuss** — walk through bottleneck findings, optimization rationale, and measurement caveats in more depth; then re-ask.
|
|
104
|
+
- **Stop here** — print the resume command (`/owflow:performance-finalize <task-path>`) and end.
|
|
105
|
+
|
|
106
|
+
**On Accept only**, perform the state write: append `task-completed` to `completed_phases` and set `task.status: completed`; bump `orchestrator.updated`; do NOT write a finalize slot under `performance_context.phase_summaries` (the template has no such slot — finalization is state-only). On failure: append `task-completed` to `failed_phases`, increment `auto_fix_attempts["task-completed"]`. Then re-read state + run `verify_template`. On **Adjust / Discuss / Stop here**, perform NO state write — the workflow stays resumable.
|
|
107
|
+
|
|
108
|
+
### Next steps (after Accept)
|
|
109
|
+
|
|
110
|
+
The workflow is finished; no further owflow step is required. All follow-ups are `optional` (post-completion work, none advance phases):
|
|
111
|
+
|
|
112
|
+
- Run the application and verify the improvements manually; consider profiling with runtime tools to measure actual impact; monitor production metrics after deployment.
|
|
113
|
+
- Address remaining P2/P3 bottlenecks if needed.
|
|
114
|
+
- `/owflow:standards-update "<lesson learned>"` — `optional` — captures optimization patterns as project standards; does not advance phases.
|
|
115
|
+
- Commit the changes using the provided message template; open a PR. (Manual steps outside owflow.)
|
|
116
|
+
|
|
117
|
+
Then STOP.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: owflow:performance-implement
|
|
3
|
+
description: Performance — executes the approved implementation plan via the implementation-plan-executor skill, then records implementation-done. Continues with performance-verify.
|
|
4
|
+
argument-hint: "[task-path-or-identifier]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Implement — Implementation (implementation-done)
|
|
9
|
+
|
|
10
|
+
Work step of the performance workflow. Executes the optimization plan via the `implementation-plan-executor` skill, then records the implementation outcome in state. State lives in `orchestrator-state.yml` — this skill reads it on entry and writes results on exit.
|
|
11
|
+
|
|
12
|
+
## Entry Gate
|
|
13
|
+
|
|
14
|
+
Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
|
|
15
|
+
|
|
16
|
+
- **Path** (absolute or project-relative) to the task directory — use as-is.
|
|
17
|
+
- **Identifier** — exact directory name inside `.owflow/tasks/performance/` (e.g., `2026-10-02-api-latency`); resolve to its path.
|
|
18
|
+
- **Description** — anything else (free text) is treated as a new performance task description: ask via `question` whether to start a fresh standard task at this step (mid-pipeline bootstrap) or route through `/owflow:performance <description>`; on decline, print the blocked block and STOP.
|
|
19
|
+
- If the argument is **missing**, the path does **not exist**, or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
|
|
20
|
+
|
|
21
|
+
1. Steps that must be completed first (in order), each with its command:
|
|
22
|
+
- Codebase & bottleneck analysis (`codebase-analysed`, `bottlenecks-identified`) → `/owflow:performance-analyze <task-path>`
|
|
23
|
+
- Requirements, specification & conditional audit (`spec-written`, `spec-audited`) → `/owflow:performance-spec <task-path>`
|
|
24
|
+
- Implementation planning (`plan-created`) → `/owflow:performance-plan <task-path>`
|
|
25
|
+
2. List available performance-task identifiers (directories under `.owflow/tasks/performance/`) to resume from, if any.
|
|
26
|
+
3. Hint: `Run /owflow:performance <description> to start a task from scratch, or pass a task path/identifier to resume.`
|
|
27
|
+
|
|
28
|
+
### Prerequisites
|
|
29
|
+
|
|
30
|
+
| Required for this skill | Where verified | Produced by |
|
|
31
|
+
| ----------------------- | ----------------------------------------------------------------- | -------------------------------------- |
|
|
32
|
+
| State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:performance <desc>` |
|
|
33
|
+
| Spec approved | `implementation/spec.md` exists | `/owflow:performance-spec <task-path>` |
|
|
34
|
+
| Plan approved | `implementation/implementation-plan.md` exists | `/owflow:performance-plan <task-path>` |
|
|
35
|
+
|
|
36
|
+
1. **Read `orchestrator-state.yml`** from the task path. If missing → mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `implementation-done`): `question` — create a fresh standard performance task starting at this step, or decline → print `No performance task found at <path>. Run /owflow:performance <description> to start a task from scratch.` and STOP.
|
|
37
|
+
2. **Skip/resume**: if `implementation-done` is in `completed_phases` and `implementation/work-log.md` exists, backfill `performance_context.phase_summaries.implementation` from the work-log when it is still null, report the existing results, and route to the Exit Gate. If the work-log is missing → drop `implementation-done` and re-run the implementation step.
|
|
38
|
+
3. **Prerequisite check (presence and content)**: `implementation/spec.md` AND `implementation/implementation-plan.md` exist. If missing → print the blocked block, then STOP:
|
|
39
|
+
- Steps that must be completed first: specification (`spec-written`) → implementation planning (`plan-created`).
|
|
40
|
+
- `Run /owflow:performance-spec and /owflow:performance-plan <task-path> first` (or `/owflow:performance-analyze <task-path>` for the missing earlier step).
|
|
41
|
+
- If no task exists yet: `Run /owflow:performance <description> to start a task from scratch.`
|
|
42
|
+
|
|
43
|
+
## Execute
|
|
44
|
+
|
|
45
|
+
**Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md).
|
|
46
|
+
|
|
47
|
+
### Implementation (`implementation-done`, delegated)
|
|
48
|
+
|
|
49
|
+
**Artifacts**: implemented optimizations, `implementation/work-log.md`
|
|
50
|
+
|
|
51
|
+
> **ANTI-PATTERN — never implement directly. "Simple enough to code inline" is NOT a reason to skip delegation.**
|
|
52
|
+
>
|
|
53
|
+
> - ❌ "Let me implement this directly..." — STOP. Delegate to `implementation-plan-executor`.
|
|
54
|
+
> - ❌ "This is simple enough to code inline..." — STOP. Simplicity is NOT a reason to skip delegation.
|
|
55
|
+
|
|
56
|
+
1. **INVOKE NOW** (Skill tool — never the Task tool; this skill spawns its own subagents): Skill tool - `implementation-plan-executor`. Pass: task_path, task_description, `performance_context.task_characteristics`, `performance_context.bottleneck_priorities`, and relevant `performance_context.phase_summaries` (specification, bottleneck_analysis, planning). The skill manages its own subagents, incremental tests, plan checkboxes, and `implementation/work-log.md`. Its terminal **full test-suite run** is what makes the template default `skip_test_suite: true` causally safe — do not swap this engine.
|
|
57
|
+
2. **SELF-CHECK**: Did you just invoke the Skill tool with `implementation-plan-executor`? Or did you start writing code yourself? If the latter, STOP immediately and invoke the Skill tool instead.
|
|
58
|
+
3. **Append this skill's own slug** (replaces the monolith's re-acquire / POST-IMPLEMENTATION block): after the skill returns, re-read `orchestrator-state.yml` to confirm you are the orchestrator, then append `implementation-done` to `completed_phases` and extract a 1-2 sentence summary into `performance_context.phase_summaries.implementation` from `implementation/work-log.md` (task groups completed, files changed, test results, known issues).
|
|
59
|
+
4. **State write**: bump `orchestrator.updated`. On failure: append `implementation-done` to `failed_phases`, increment `auto_fix_attempts["implementation-done"]`; partial progress stays documented in `implementation/work-log.md`. Then re-read state + run `verify_template`.
|
|
60
|
+
|
|
61
|
+
## State Update Convention (per step)
|
|
62
|
+
|
|
63
|
+
Apply after EVERY step above:
|
|
64
|
+
|
|
65
|
+
1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed (`implementation-done`) plus that step's fields. Never batch multiple steps into one end-of-skill write.
|
|
66
|
+
2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
|
|
67
|
+
3. **Failures** — if the implementation fails or its retries are abandoned, do NOT append to `completed_phases`; instead append the step's slug to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`.
|
|
68
|
+
4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-performance.yml`. Fix any reported issue immediately before proceeding.
|
|
69
|
+
5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
|
|
70
|
+
|
|
71
|
+
## Recovery
|
|
72
|
+
|
|
73
|
+
| Step | Max Attempts | Strategy |
|
|
74
|
+
| -------------------------------- | ------------ | -------------------------------------------------------------------- |
|
|
75
|
+
| Implementation (`implementation-done`) | 5 | Fix syntax, imports, tests; return to the executor for the failing group |
|
|
76
|
+
|
|
77
|
+
## Exit Gate
|
|
78
|
+
|
|
79
|
+
Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
|
|
80
|
+
|
|
81
|
+
### Results box
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
## ✅ PERFORMANCE IMPLEMENT COMPLETE — <task name>
|
|
85
|
+
|
|
86
|
+
**Task groups** — [completed / total]
|
|
87
|
+
**Files changed** — [count + key files, 1-3 lines]
|
|
88
|
+
**Tests** — [incremental + terminal full-suite results from the executor]
|
|
89
|
+
**Known issues** — [deferred items / "none"]
|
|
90
|
+
|
|
91
|
+
**Artifacts**
|
|
92
|
+
|
|
93
|
+
- implemented optimizations
|
|
94
|
+
- `implementation/work-log.md`
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Results-acceptance question
|
|
98
|
+
|
|
99
|
+
Use `question` — "Are these results correct?" with options:
|
|
100
|
+
|
|
101
|
+
- **Accept** — implementation matches the plan; continue.
|
|
102
|
+
- **Adjust** — re-work the affected task groups (fix code, re-run their tests), update state and work-log, re-present the results box.
|
|
103
|
+
- **Discuss** — walk through implementation details (decisions made, files changed, deferred items) in more depth; then re-ask.
|
|
104
|
+
- **Stop here** — print the resume command (`/owflow:performance-implement <task-path>`) and end.
|
|
105
|
+
|
|
106
|
+
### Next steps (after Accept)
|
|
107
|
+
|
|
108
|
+
- `→ /owflow:performance-verify <task-path>` — `required` before finalization: picks the additional verification checks and runs the verification pipeline. Remaining after: finalize.
|
|
109
|
+
|
|
110
|
+
**Other options**:
|
|
111
|
+
|
|
112
|
+
- `/owflow:goal-performance <task-path>` — `optional` shortcut: runs all remaining steps in one loop (verify → finalize)
|
|
113
|
+
|
|
114
|
+
Then STOP.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: owflow:performance-plan
|
|
3
|
+
description: Performance — breaks the approved specification into a grouped, dependency-ordered implementation plan via delegation, then adds an execution-flow diagram. Continues with performance-implement.
|
|
4
|
+
argument-hint: "[task-path-or-identifier]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Plan — Implementation Planning (plan-created)
|
|
9
|
+
|
|
10
|
+
Work step of the performance workflow. Breaks the approved optimization specification into grouped, dependency-ordered task groups via the `implementation-planner` agent, then adds an execution-flow diagram. State lives in `orchestrator-state.yml` — this skill reads it on entry and writes results on exit.
|
|
11
|
+
|
|
12
|
+
## Entry Gate
|
|
13
|
+
|
|
14
|
+
Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
|
|
15
|
+
|
|
16
|
+
- **Path** (absolute or project-relative) to the task directory — use as-is.
|
|
17
|
+
- **Identifier** — exact directory name inside `.owflow/tasks/performance/` (e.g., `2026-10-02-api-latency`); resolve to its path.
|
|
18
|
+
- **Description** — anything else (free text) is treated as a new performance task description: ask via `question` whether to start a fresh standard task at this step (mid-pipeline bootstrap) or route through `/owflow:performance <description>`; on decline, print the blocked block and STOP.
|
|
19
|
+
- If the argument is **missing**, the path does **not exist**, or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
|
|
20
|
+
|
|
21
|
+
1. Steps that must be completed first (in order), each with its command:
|
|
22
|
+
- Codebase & bottleneck analysis (`codebase-analysed`, `bottlenecks-identified`) → `/owflow:performance-analyze <task-path>`
|
|
23
|
+
- Requirements, specification & conditional audit (`spec-written`, `spec-audited`) → `/owflow:performance-spec <task-path>`
|
|
24
|
+
2. List available performance-task identifiers (directories under `.owflow/tasks/performance/`) to resume from, if any.
|
|
25
|
+
3. Hint: `Run /owflow:performance <description> to start a task from scratch, or pass a task path/identifier to resume.`
|
|
26
|
+
|
|
27
|
+
### Prerequisites
|
|
28
|
+
|
|
29
|
+
| Required for this skill | Where verified | Produced by |
|
|
30
|
+
| ------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------- |
|
|
31
|
+
| State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:performance <desc>` |
|
|
32
|
+
| Specification approved | `spec-written` in `completed_phases` + `implementation/spec.md` exists | `/owflow:performance-spec <task-path>` |
|
|
33
|
+
| Audit decision settled | `options.spec_audit_enabled` non-null | `/owflow:performance-spec <task-path>` |
|
|
34
|
+
|
|
35
|
+
1. **Read `orchestrator-state.yml`** from the task path. If missing → mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `plan-created`): `question` — create a fresh standard performance task starting at this step, or decline → print `No performance task found at <path>. Run /owflow:performance <description> to start a task from scratch.` and STOP.
|
|
36
|
+
2. **Skip/resume (artifacts before state)**: if `plan-created` is complete and `implementation/implementation-plan.md` exists, report the existing plan summary and route to the Exit Gate. If the file exists but its slug is missing, adopt it (append `plan-created`, backfill `performance_context.phase_summaries.planning` when still null) instead of re-running. A slug whose artifact is missing → drop the slug and re-run that step.
|
|
37
|
+
3. **Prerequisite check (presence and content)**: `spec-written` in `completed_phases` AND `implementation/spec.md` exists — the spec must be user-approved before the planner is invoked — AND `options.spec_audit_enabled` is non-null (the audit decision is settled). If missing → print the blocked block, then STOP:
|
|
38
|
+
- Steps that must be completed first: specification and its audit decision (`spec-written`, audit settled).
|
|
39
|
+
- `Run /owflow:performance-spec <task-path> first` (or `/owflow:performance-analyze <task-path>` for the missing earlier step).
|
|
40
|
+
- If no task exists yet: `Run /owflow:performance <description> to start a task from scratch.`
|
|
41
|
+
|
|
42
|
+
## Execute
|
|
43
|
+
|
|
44
|
+
**Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md) and the [Dispatcher & Handoff Pattern](../orchestrator-framework/references/dispatcher-handoff.md).
|
|
45
|
+
|
|
46
|
+
### Implementation Planning (`plan-created`, delegated)
|
|
47
|
+
|
|
48
|
+
**Artifacts**: `implementation/implementation-plan.md`
|
|
49
|
+
|
|
50
|
+
> **ANTI-PATTERN — never write the implementation plan yourself. "The optimization list is short" is NOT a reason to skip delegation.**
|
|
51
|
+
>
|
|
52
|
+
> - ❌ "Let me create the implementation plan..." — STOP. Delegate to `implementation-planner`.
|
|
53
|
+
> - ❌ "I'll break this into optimization steps..." — STOP. Delegate to `implementation-planner`.
|
|
54
|
+
|
|
55
|
+
1. **INVOKE NOW** (Task tool — never the Skill tool; this is an agent): Task tool - `implementation-planner` subagent. Pass (Pattern 7 — accumulated context): task_path, task_type="performance", task_description, spec_path (`implementation/spec.md`), `performance_context.task_characteristics`, `performance_context.bottleneck_priorities`, and relevant `performance_context.phase_summaries` (specification, bottleneck_analysis, codebase_analysis). Output: `implementation/implementation-plan.md`.
|
|
56
|
+
2. **SELF-CHECK**: Did you just invoke the Task tool with `implementation-planner`? Or did you start writing the plan yourself? If the latter, STOP and invoke the Task tool.
|
|
57
|
+
3. **Post-plan diagram refinement** (Skill, optional, content-preserving): Skill tool - `diagrams-mermaid` on `implementation/implementation-plan.md` — add one compact optimization execution flow (task-group dependency or state flow). Keep plan steps authoritative; diagrams are explanatory additions only. A declined or failed refinement is not a failure — note it in `performance_context.phase_summaries.planning`.
|
|
58
|
+
4. **State write**: append `plan-created` to `completed_phases`; set `performance_context.phase_summaries.planning` (task-group count, step count, optimization sequence); bump `orchestrator.updated`. On failure: append `plan-created` to `failed_phases`, increment `auto_fix_attempts["plan-created"]`. Then re-read state + run `verify_template`.
|
|
59
|
+
|
|
60
|
+
## State Update Convention (per step)
|
|
61
|
+
|
|
62
|
+
Apply after EVERY step above:
|
|
63
|
+
|
|
64
|
+
1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed (`plan-created`) plus that step's fields. Never batch multiple steps into one end-of-skill write.
|
|
65
|
+
2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
|
|
66
|
+
3. **Failures** — if the step fails or its retries are abandoned, do NOT append to `completed_phases`; instead append the step's slug to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`.
|
|
67
|
+
4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-performance.yml`. Fix any reported issue immediately before proceeding.
|
|
68
|
+
5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
|
|
69
|
+
|
|
70
|
+
## Recovery
|
|
71
|
+
|
|
72
|
+
| Step | Max Attempts | Strategy |
|
|
73
|
+
| ----------------------------- | ------------ | ------------------------------------------------- |
|
|
74
|
+
| Implementation Planning (`plan-created`) | 2 | Regenerate the plan with adjusted spec context |
|
|
75
|
+
|
|
76
|
+
## Exit Gate
|
|
77
|
+
|
|
78
|
+
Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
|
|
79
|
+
|
|
80
|
+
### Results box
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
## ✅ PERFORMANCE PLAN COMPLETE — <task name>
|
|
84
|
+
|
|
85
|
+
**Task groups** — [N groups / M steps]
|
|
86
|
+
**Optimization sequence** — [key dependency order]
|
|
87
|
+
**Spec** — [approved spec summary in 1 line]
|
|
88
|
+
**Diagram** — [added / skipped]
|
|
89
|
+
|
|
90
|
+
**Artifacts**
|
|
91
|
+
|
|
92
|
+
- `implementation/implementation-plan.md`
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Results-acceptance question
|
|
96
|
+
|
|
97
|
+
Use `question` — "Are these results correct?" with options:
|
|
98
|
+
|
|
99
|
+
- **Accept** — the plan is good; continue.
|
|
100
|
+
- **Adjust** — regenerate the plan with the user's corrections, update state and artifacts, re-present the results box.
|
|
101
|
+
- **Discuss** — walk through the plan's task groups, dependencies, or test strategy in more depth; then re-ask.
|
|
102
|
+
- **Stop here** — print the resume command (`/owflow:performance-plan <task-path>`) and end.
|
|
103
|
+
|
|
104
|
+
### Next steps (after Accept)
|
|
105
|
+
|
|
106
|
+
- `→ /owflow:performance-implement <task-path>` — `required` next: executes the plan via `implementation-plan-executor` (its terminal full-suite run is what keeps `skip_test_suite: true` safe). Remaining after: verify → finalize.
|
|
107
|
+
|
|
108
|
+
**Other options**:
|
|
109
|
+
|
|
110
|
+
- `/owflow:goal-performance <task-path>` — `optional` shortcut: runs all remaining steps in one loop (implement → verify → finalize)
|
|
111
|
+
|
|
112
|
+
Then STOP.
|