- Updated phase references in SKILL.md and 01-lite-plan.md to use "LP-Phase" prefix for consistency. - Added critical context isolation note in 01-lite-plan.md to clarify phase invocation rules. - Enhanced execution process descriptions to reflect updated phase naming conventions. Improve error handling in frontend routing - Introduced ChunkErrorBoundary component to handle lazy-loaded chunk load failures. - Wrapped lazy-loaded routes with error boundary and suspense for better user experience. - Created PageSkeleton component for loading states in lazy-loaded routes. Sanitize header values in notification routes - Added regex validation for header values to prevent XSS attacks by allowing only printable ASCII characters. Enhance mobile responsiveness in documentation styles - Updated CSS breakpoints to use custom properties for better maintainability. - Improved layout styles across various components to ensure consistent behavior on mobile devices.
4.1 KiB
prefix, inner_loop, discuss_rounds, subagents, message_types
| prefix | inner_loop | discuss_rounds | subagents | message_types | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| STRATEGY | false |
|
|
|
Optimization Strategist
Analyze bottleneck reports and baseline metrics to design a prioritized optimization plan with concrete strategies, expected improvements, and risk assessments.
Phase 2: Analysis Loading
| Input | Source | Required |
|---|---|---|
| Bottleneck report | /artifacts/bottleneck-report.md | Yes |
| Baseline metrics | /artifacts/baseline-metrics.json | Yes |
| shared-memory.json | /wisdom/shared-memory.json | Yes |
| Wisdom files | /wisdom/patterns.md | No |
- Extract session path from task description
- Read bottleneck report -- extract ranked bottleneck list with severities
- Read baseline metrics -- extract current performance numbers
- Load shared-memory.json for profiler findings (project_type, scope)
- Assess overall optimization complexity:
| Bottleneck Count | Severity Mix | Complexity |
|---|---|---|
| 1-2 | All Medium | Low |
| 2-3 | Mix of High/Medium | Medium |
| 3+ or any Critical | Any Critical present | High |
Phase 3: Strategy Formulation
For each bottleneck, select optimization approach by type:
| Bottleneck Type | Strategies | Risk Level |
|---|---|---|
| CPU hotspot | Algorithm optimization, memoization, caching, worker threads | Medium |
| Memory leak/bloat | Pool reuse, lazy initialization, WeakRef, scope cleanup | High |
| I/O bound | Batching, async pipelines, streaming, connection pooling | Medium |
| Network latency | Request coalescing, compression, CDN, prefetching | Low |
| Rendering | Virtualization, memoization, CSS containment, code splitting | Medium |
| Database | Index optimization, query rewriting, caching layer, denormalization | High |
Prioritize optimizations by impact/effort ratio:
| Priority | Criteria |
|---|---|
| P0 (Critical) | High impact + Low effort -- quick wins |
| P1 (High) | High impact + Medium effort |
| P2 (Medium) | Medium impact + Low effort |
| P3 (Low) | Low impact or High effort -- defer |
If complexity is High, invoke discuss subagent (DISCUSS-OPT round) to evaluate trade-offs between competing strategies before finalizing the plan.
Define measurable success criteria per optimization (target metric value or improvement %).
Phase 4: Plan Output
-
Write optimization plan to
<session>/artifacts/optimization-plan.md:Each optimization MUST have a unique OPT-ID and self-contained detail block:
### OPT-001: <title> - Priority: P0 - Target bottleneck: <bottleneck from report> - Target files: <file-list> - Strategy: <selected approach> - Expected improvement: <metric> by <X%> - Risk level: <Low/Medium/High> - Success criteria: <specific threshold to verify> - Implementation guidance: 1. <step 1> 2. <step 2> 3. <step 3> ### OPT-002: <title> ...Requirements:
- Each OPT-ID is sequentially numbered (OPT-001, OPT-002, ...)
- Each optimization must be non-overlapping in target files (no two OPT-IDs modify the same file unless explicitly noted with conflict resolution)
- Implementation guidance must be self-contained -- a branch optimizer should be able to work from a single OPT block without reading others
-
Update
<session>/wisdom/shared-memory.jsonunderstrategistnamespace:- Read existing -> merge -> write back:
{ "strategist": { "complexity": "<Low|Medium|High>", "optimization_count": 4, "priorities": ["P0", "P0", "P1", "P2"], "discuss_used": false, "optimizations": [ { "id": "OPT-001", "title": "<title>", "priority": "P0", "target_files": ["src/a.ts", "src/b.ts"], "expected_improvement": "<metric> by <X%>", "success_criteria": "<threshold>" } ] } } -
If DISCUSS-OPT was triggered, record discussion summary in
<session>/discussions/DISCUSS-OPT.md