mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-03 15:43:11 +08:00
Refactor workflow-lite-planex documentation to standardize phase naming and improve clarity
- 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.
This commit is contained in:
@@ -15,15 +15,30 @@ Run benchmarks comparing before/after optimization metrics. Validate that improv
|
||||
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Baseline metrics | <session>/artifacts/baseline-metrics.json | Yes |
|
||||
| Optimization plan | <session>/artifacts/optimization-plan.md | Yes |
|
||||
| Baseline metrics | <session>/artifacts/baseline-metrics.json (shared) | Yes |
|
||||
| Optimization plan / detail | Varies by mode (see below) | Yes |
|
||||
| shared-memory.json | <session>/wisdom/shared-memory.json | Yes |
|
||||
|
||||
1. Extract session path from task description
|
||||
2. Read baseline metrics -- extract pre-optimization performance numbers
|
||||
3. Read optimization plan -- extract success criteria and target thresholds
|
||||
4. Load shared-memory.json for project type and optimization scope
|
||||
5. Detect available benchmark tools from project:
|
||||
2. **Detect branch/pipeline context** from task description:
|
||||
|
||||
| Task Description Field | Value | Context |
|
||||
|----------------------|-------|---------|
|
||||
| `BranchId: B{NN}` | Present | Fan-out branch -- benchmark only this branch's metrics |
|
||||
| `PipelineId: {P}` | Present | Independent pipeline -- use pipeline-scoped baseline |
|
||||
| Neither present | - | Single mode -- full benchmark |
|
||||
|
||||
3. **Load baseline metrics**:
|
||||
- Single / Fan-out: Read `<session>/artifacts/baseline-metrics.json` (shared baseline)
|
||||
- Independent: Read `<session>/artifacts/pipelines/{P}/baseline-metrics.json`
|
||||
|
||||
4. **Load optimization context**:
|
||||
- Single: Read `<session>/artifacts/optimization-plan.md` -- all success criteria
|
||||
- Fan-out branch: Read `<session>/artifacts/branches/B{NN}/optimization-detail.md` -- only this branch's criteria
|
||||
- Independent: Read `<session>/artifacts/pipelines/{P}/optimization-plan.md`
|
||||
|
||||
5. Load shared-memory.json for project type and optimization scope
|
||||
6. Detect available benchmark tools from project:
|
||||
|
||||
| Signal | Benchmark Tool | Method |
|
||||
|--------|---------------|--------|
|
||||
@@ -34,7 +49,10 @@ Run benchmarks comparing before/after optimization metrics. Validate that improv
|
||||
| Makefile with bench target | Custom benchmarks | make bench |
|
||||
| No tooling detected | Manual measurement | Timed execution via Bash |
|
||||
|
||||
6. Get changed files scope from shared-memory (optimizer namespace)
|
||||
7. Get changed files scope from shared-memory:
|
||||
- Single: `optimizer` namespace
|
||||
- Fan-out: `optimizer.B{NN}` namespace
|
||||
- Independent: `optimizer.{P}` namespace
|
||||
|
||||
## Phase 3: Benchmark Execution
|
||||
|
||||
@@ -60,6 +78,10 @@ Run benchmarks matching detected project type:
|
||||
- Collect post-optimization metrics matching baseline format
|
||||
- Calculate improvement percentages per metric
|
||||
|
||||
**Branch-scoped benchmarking** (fan-out mode):
|
||||
- Only benchmark metrics relevant to this branch's optimization (from optimization-detail.md)
|
||||
- Still check for regressions across all metrics (not just branch-specific ones)
|
||||
|
||||
## Phase 4: Result Analysis
|
||||
|
||||
Compare against baseline and plan criteria:
|
||||
@@ -73,13 +95,16 @@ Compare against baseline and plan criteria:
|
||||
| Regression detected | Any unrelated metric degrades > 5% | FAIL -> fix_required |
|
||||
| Plan criteria not met | Any criterion not satisfied | FAIL -> fix_required |
|
||||
|
||||
1. Write benchmark results to `<session>/artifacts/benchmark-results.json`:
|
||||
- Per-metric: name, baseline value, current value, improvement %, verdict
|
||||
- Overall verdict: PASS / WARN / FAIL
|
||||
- Regression details (if any)
|
||||
1. Write benchmark results to output path:
|
||||
- Single: `<session>/artifacts/benchmark-results.json`
|
||||
- Fan-out: `<session>/artifacts/branches/B{NN}/benchmark-results.json`
|
||||
- Independent: `<session>/artifacts/pipelines/{P}/benchmark-results.json`
|
||||
- Content: Per-metric: name, baseline value, current value, improvement %, verdict; Overall verdict: PASS / WARN / FAIL; Regression details (if any)
|
||||
|
||||
2. Update `<session>/wisdom/shared-memory.json` under `benchmarker` namespace:
|
||||
- Read existing -> merge `{ "benchmarker": { verdict, improvements, regressions } }` -> write back
|
||||
2. Update `<session>/wisdom/shared-memory.json` under scoped namespace:
|
||||
- Single: merge `{ "benchmarker": { verdict, improvements, regressions } }`
|
||||
- Fan-out: merge `{ "benchmarker.B{NN}": { verdict, improvements, regressions } }`
|
||||
- Independent: merge `{ "benchmarker.{P}": { verdict, improvements, regressions } }`
|
||||
|
||||
3. If verdict is FAIL, include detailed feedback in message for FIX task creation:
|
||||
- Which metrics failed, by how much, suggested investigation areas
|
||||
|
||||
@@ -24,17 +24,36 @@ Implement optimization changes following the strategy plan. For FIX tasks, apply
|
||||
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Optimization plan | <session>/artifacts/optimization-plan.md | Yes (IMPL) |
|
||||
| Optimization plan | <session>/artifacts/optimization-plan.md | Yes (IMPL, no branch) |
|
||||
| Branch optimization detail | <session>/artifacts/branches/B{NN}/optimization-detail.md | Yes (IMPL with branch) |
|
||||
| Pipeline optimization plan | <session>/artifacts/pipelines/{P}/optimization-plan.md | Yes (IMPL with pipeline) |
|
||||
| Review/bench feedback | From task description | Yes (FIX) |
|
||||
| shared-memory.json | <session>/wisdom/shared-memory.json | Yes |
|
||||
| Wisdom files | <session>/wisdom/patterns.md | No |
|
||||
| Context accumulator | From prior IMPL/FIX tasks | Yes (inner loop) |
|
||||
|
||||
1. Extract session path and task mode (IMPL or FIX) from task description
|
||||
2. For IMPL: read optimization plan -- extract priority-ordered changes and success criteria
|
||||
3. For FIX: parse review/benchmark feedback for specific issues to address
|
||||
4. Use `explore` subagent to load implementation context for target files
|
||||
5. For inner loop: load context_accumulator from prior IMPL/FIX tasks to avoid re-reading
|
||||
2. **Detect branch/pipeline context** from task description:
|
||||
|
||||
| Task Description Field | Value | Context |
|
||||
|----------------------|-------|---------|
|
||||
| `BranchId: B{NN}` | Present | Fan-out branch -- load single optimization detail |
|
||||
| `PipelineId: {P}` | Present | Independent pipeline -- load pipeline-scoped plan |
|
||||
| Neither present | - | Single mode -- load full optimization plan |
|
||||
|
||||
3. **Load optimization context by mode**:
|
||||
- **Single mode (no branch)**: Read `<session>/artifacts/optimization-plan.md` -- extract ALL priority-ordered changes
|
||||
- **Fan-out branch**: Read `<session>/artifacts/branches/B{NN}/optimization-detail.md` -- extract ONLY this branch's optimization (single OPT-ID)
|
||||
- **Independent pipeline**: Read `<session>/artifacts/pipelines/{P}/optimization-plan.md` -- extract this pipeline's plan
|
||||
|
||||
4. For FIX: parse review/benchmark feedback for specific issues to address
|
||||
5. Use `explore` subagent to load implementation context for target files
|
||||
6. For inner loop (single mode only): load context_accumulator from prior IMPL/FIX tasks
|
||||
|
||||
**Shared-memory namespace**:
|
||||
- Single: write to `optimizer` namespace
|
||||
- Fan-out: write to `optimizer.B{NN}` namespace
|
||||
- Independent: write to `optimizer.{P}` namespace
|
||||
|
||||
## Phase 3: Code Implementation
|
||||
|
||||
@@ -46,7 +65,9 @@ Implementation backend selection:
|
||||
| Direct | Single-file changes or targeted fixes | Inline Edit/Write tools |
|
||||
|
||||
For IMPL tasks:
|
||||
- Apply optimizations in plan priority order (P0 first, then P1, etc.)
|
||||
- **Single mode**: Apply optimizations in plan priority order (P0 first, then P1, etc.)
|
||||
- **Fan-out branch**: Apply ONLY this branch's single optimization (from optimization-detail.md)
|
||||
- **Independent pipeline**: Apply this pipeline's optimizations in priority order
|
||||
- Follow implementation guidance from plan (target files, patterns)
|
||||
- Preserve existing behavior -- optimization must not break functionality
|
||||
|
||||
@@ -71,6 +92,11 @@ General rules:
|
||||
|
||||
If validation fails, attempt auto-fix (max 2 attempts) before reporting error.
|
||||
|
||||
Append to context_accumulator for next IMPL/FIX task:
|
||||
Append to context_accumulator for next IMPL/FIX task (single/inner-loop mode only):
|
||||
- Files modified, optimizations applied, validation results
|
||||
- Any discovered patterns or caveats for subsequent iterations
|
||||
|
||||
**Branch output paths**:
|
||||
- Single: write artifacts to `<session>/artifacts/`
|
||||
- Fan-out: write artifacts to `<session>/artifacts/branches/B{NN}/`
|
||||
- Independent: write artifacts to `<session>/artifacts/pipelines/{P}/`
|
||||
|
||||
@@ -19,15 +19,34 @@ Review optimization code changes for correctness, side effects, regression risks
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Optimization code changes | From IMPL task artifacts / git diff | Yes |
|
||||
| Optimization plan | <session>/artifacts/optimization-plan.md | Yes |
|
||||
| Benchmark results | <session>/artifacts/benchmark-results.json | No |
|
||||
| Optimization plan / detail | Varies by mode (see below) | Yes |
|
||||
| Benchmark results | Varies by mode (see below) | No |
|
||||
| shared-memory.json | <session>/wisdom/shared-memory.json | Yes |
|
||||
|
||||
1. Extract session path from task description
|
||||
2. Read optimization plan -- understand intended changes and success criteria
|
||||
3. Load shared-memory.json for optimizer namespace (files modified, patterns applied)
|
||||
4. Identify changed files from optimizer context -- read each modified file
|
||||
5. If benchmark results available, read for cross-reference with code quality
|
||||
2. **Detect branch/pipeline context** from task description:
|
||||
|
||||
| Task Description Field | Value | Context |
|
||||
|----------------------|-------|---------|
|
||||
| `BranchId: B{NN}` | Present | Fan-out branch -- review only this branch's changes |
|
||||
| `PipelineId: {P}` | Present | Independent pipeline -- review pipeline-scoped changes |
|
||||
| Neither present | - | Single mode -- review all optimization changes |
|
||||
|
||||
3. **Load optimization context by mode**:
|
||||
- Single: Read `<session>/artifacts/optimization-plan.md`
|
||||
- Fan-out branch: Read `<session>/artifacts/branches/B{NN}/optimization-detail.md`
|
||||
- Independent: Read `<session>/artifacts/pipelines/{P}/optimization-plan.md`
|
||||
|
||||
4. Load shared-memory.json for scoped optimizer namespace:
|
||||
- Single: `optimizer` namespace
|
||||
- Fan-out: `optimizer.B{NN}` namespace
|
||||
- Independent: `optimizer.{P}` namespace
|
||||
|
||||
5. Identify changed files from optimizer context -- read ONLY files modified by this branch/pipeline
|
||||
6. If benchmark results available, read from scoped path:
|
||||
- Single: `<session>/artifacts/benchmark-results.json`
|
||||
- Fan-out: `<session>/artifacts/branches/B{NN}/benchmark-results.json`
|
||||
- Independent: `<session>/artifacts/pipelines/{P}/benchmark-results.json`
|
||||
|
||||
## Phase 3: Multi-Dimension Review
|
||||
|
||||
@@ -58,12 +77,15 @@ Classify overall verdict based on findings:
|
||||
| REVISE | Has High findings, no Critical | Send fix_required with detailed feedback |
|
||||
| REJECT | Has Critical findings or fundamental approach flaw | Send fix_required + flag for strategist escalation |
|
||||
|
||||
1. Write review report to `<session>/artifacts/review-report.md`:
|
||||
- Per-dimension findings with severity, file:line, description
|
||||
- Overall verdict with rationale
|
||||
- Specific fix instructions for REVISE/REJECT verdicts
|
||||
1. Write review report to scoped output path:
|
||||
- Single: `<session>/artifacts/review-report.md`
|
||||
- Fan-out: `<session>/artifacts/branches/B{NN}/review-report.md`
|
||||
- Independent: `<session>/artifacts/pipelines/{P}/review-report.md`
|
||||
- Content: Per-dimension findings with severity, file:line, description; Overall verdict with rationale; Specific fix instructions for REVISE/REJECT verdicts
|
||||
|
||||
2. Update `<session>/wisdom/shared-memory.json` under `reviewer` namespace:
|
||||
- Read existing -> merge `{ "reviewer": { verdict, finding_count, critical_count, dimensions_reviewed } }` -> write back
|
||||
2. Update `<session>/wisdom/shared-memory.json` under scoped namespace:
|
||||
- Single: merge `{ "reviewer": { verdict, finding_count, critical_count, dimensions_reviewed } }`
|
||||
- Fan-out: merge `{ "reviewer.B{NN}": { verdict, finding_count, critical_count, dimensions_reviewed } }`
|
||||
- Independent: merge `{ "reviewer.{P}": { verdict, finding_count, critical_count, dimensions_reviewed } }`
|
||||
|
||||
3. If DISCUSS-REVIEW was triggered, record discussion summary in `<session>/discussions/DISCUSS-REVIEW.md`
|
||||
3. If DISCUSS-REVIEW was triggered, record discussion summary in `<session>/discussions/DISCUSS-REVIEW.md` (or `DISCUSS-REVIEW-B{NN}.md` for branch-scoped discussions)
|
||||
|
||||
@@ -62,12 +62,53 @@ Define measurable success criteria per optimization (target metric value or impr
|
||||
## Phase 4: Plan Output
|
||||
|
||||
1. Write optimization plan to `<session>/artifacts/optimization-plan.md`:
|
||||
- Priority-ordered list of optimizations
|
||||
- Per optimization: target bottleneck, strategy, expected improvement %, risk level
|
||||
- Success criteria: specific metric thresholds to verify
|
||||
- Implementation guidance: files to modify, patterns to apply
|
||||
|
||||
Each optimization MUST have a unique OPT-ID and self-contained detail block:
|
||||
|
||||
```markdown
|
||||
### 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
|
||||
|
||||
2. Update `<session>/wisdom/shared-memory.json` under `strategist` namespace:
|
||||
- Read existing -> merge `{ "strategist": { complexity, optimization_count, priorities, discuss_used } }` -> write back
|
||||
- Read existing -> merge -> write back:
|
||||
```json
|
||||
{
|
||||
"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>"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. If DISCUSS-OPT was triggered, record discussion summary in `<session>/discussions/DISCUSS-OPT.md`
|
||||
|
||||
Reference in New Issue
Block a user