Step 549: add cost reduction suggestion engine

This commit is contained in:
Bill
2026-02-17 10:18:34 -07:00
parent 6f99031596
commit da294bce81
4 changed files with 260 additions and 0 deletions

View File

@@ -9550,3 +9550,40 @@ decision flow.
- **Steps completed:** 5
- **New tests in phase plan:** 56/56 passing
- **Routing/context/cost optimization integration:** PASS
### Step 549: Suggestion Engine for Cost Reductions
**Status:** PASS (12/12 tests)
Implements cost-reduction suggestion generation for constrained orchestration,
including template substitution, batching, and context narrowing opportunities
with priority and savings estimates.
**Files added:**
- `editor/src/CostReductionSuggestionEngine.h` - cost suggestion module:
- emits template substitution recommendations when deterministic paths exist
- emits batching recommendations for compatible multi-op workloads
- emits context narrowing recommendations for wide symbol candidate sets
- computes estimated token savings and priority by budget pressure
- deterministic sorting by priority and estimated savings
- `editor/tests/step549_test.cpp` - 12 tests covering:
- suggestion emission behavior per optimization path
- no-suggestion baseline behavior
- over-budget priority amplification behavior
- savings scaling behavior by op/symbol breadth
- path eligibility thresholds for batching/context narrowing
- ordering/tiebreak behavior
- rationale presence requirements
**Files modified:**
- `editor/CMakeLists.txt` - `step549_test` target
**Verification run:**
- `cmake -S editor -B editor/build-native` - PASS
- `cmake --build editor/build-native --target step549_test step548_test` - PASS
- `./editor/build-native/step549_test` - PASS (12/12)
- `./editor/build-native/step548_test` - PASS (8/8) regression coverage
**Architecture gate check:**
- `editor/src/CostReductionSuggestionEngine.h` within header-size limit (`68` <= `600`)
- `editor/tests/step549_test.cpp` within test-file size guidance (`146` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`