# EM Planner Execution Progress

## Current State

- Current stage: 10 - generic control adaptation, plugin packaging, and final rolling gate
- Stage status: Completed
- Current branch: `trajplanner`
- Last checkpoint commit: `4058230` (last Stage 10 functional commit; this file is the final Stage 10 checkpoint)
- Protocol design baseline: `554c84f`
- Implementation-plan baseline: `8dd8ff0`

## Historical Stage 8 Current State

- Current stage: 8 — complete trajectory publication and pure one-shot planning service
- Stage status: Completed
- Current branch: `trajplanner`
- Last checkpoint commit: `019b896` (last Stage 8 functional commit; this file is the Stage 8 checkpoint)
- Protocol design baseline: `554c84f`
- Implementation-plan baseline: `8dd8ff0`

## Completed Tasks

| Stage | Plan | Tasks | Commits | Verification |
|---:|---|---|---|---|
| 10 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 4 - Generic Control Adapter | `aa51ae2` | RED: `executor` exited 1 with missing `TrajectoryControlAdapter` and `IVehicleStateProvider`. GREEN: `PASS executor` verifies exact forward/reverse signed-velocity and yaw-rate mapping, telemetry preservation, zero holds, one-shot direction requests, no lateral body command, and no in-place rotation. |
| 10 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 5 - Plugin Output and License Packaging | `3c84e36` | RED: `plugin-package` exited 1 because `Publish-ClumsyPilotPlugin.ps1` was absent. GREEN: `PASS plugin-package` verifies build-output metadata, managed `ClumsyPilot.dll`, x64/hash-checked `osqp.dll`, the exact three-license tree, and repeat publication with no stale staging directory. |
| 10 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 6 - Rolling End-to-End and Final Gate | `4058230` | RED: `em-all` exited 2 because its command route did not exist. GREEN: `PASS rolling-end-to-end` and `PASS rolling-execution-tail` cover forward/reverse publication, supersession, unsafe-tracking reset, gear dwell, goal stop, and failure continuation to a non-extrapolated zero-speed tail. |
| 9 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 1 - Cycle Identity, Scheduling Decision, and Stale-Result Suppression | `d75380c` | RED: the authorized inherited coordinator draft threw `ObjectDisposedException` when a completed current cycle was followed by another cycle. GREEN: `coordinator` printed `PASS coordinator`; the exact 100-run planned loop completed with exit 0 and 100 PASS lines. |
| 9 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 2 - Safe Previous-Trajectory Handoff | `55119de` | RED: `coordinator` exited 1 with missing `TrajectoryHandoffSelector` contracts. GREEN: `PASS coordinator` covers forward/reverse same-segment interpolation, age/tracking/terminal/segment/direction/beyond-trajectory/gear-boundary rejection, no cross-boundary interpolation, and coordinator consumption of its immutable published trajectory. |
| 9 | `2026-08-03-em-planner-rolling-execution-implementation.md` | Task 3 - Gear-Switch State Machine and Trajectory Executor | `de402e6` | RED: `executor` exited 1 with missing gear-switch and execution-state types. GREEN: `PASS executor` covers forward-to-reverse and reverse-to-forward zero-speed dwell, one-shot request, confirmation, and Goal/RollingSafetyStop completion. |

## Historical Completed Tasks

| Stage | Plan | Tasks | Commits | Verification |
|---:|---|---|---|---|
| 1 | `2026-08-03-em-planner-foundation-implementation.md` | Task 1 — Verification Host and Immutable Contracts | `e12eb31` | RED: `foundation` failed with missing `VehicleMotionState`/`EmTrajectoryPoint`; GREEN: `foundation` printed `PASS foundation` with exit 0. |
| 1 | `2026-08-03-em-planner-foundation-implementation.md` | Task 2 — Configuration, Diagnostics, and Request Validation | `b326431` | RED: `foundation` failed with missing configuration/validation types; GREEN: `foundation` printed `PASS foundation` twice with byte-identical stdout and exit 0. |
| 1 | `2026-08-03-em-planner-foundation-implementation.md` | Task 3 — Direction Segmentation and Exact Boundary Anchors | `e492e16` | RED: `segmentation` failed with missing `ReferencePathSegmenter`; GREEN: `foundation` and `segmentation` each printed their PASS line with exit 0. |
| 2 | `2026-08-03-em-planner-foundation-implementation.md` | Task 4 — Reverse-Safe Frenet Projection and Reconstruction | `06687e2` | RED: `frenet` failed with missing Frenet types including `FrenetProjector`; GREEN: `PASS frenet` with forward/reverse sign, yaw-wrap, bounded U-branch, singular-denominator, and reconstruction checks. |
| 2 | `2026-08-03-em-planner-foundation-implementation.md` | Task 5 — Topology-Preserving Static Corridor | `2d252ff` | RED: `corridor` failed with missing static-corridor types; GREEN: `PASS corridor`, followed by `all-foundation` with all four PASS lines. |
| 2 | `2026-08-03-em-planner-foundation-implementation.md` | Task 6 — Foundation Documentation and Gate | `aa62d6b` | RED: Foundation README was absent; GREEN: README contract scan passed. Placeholder/format scans passed, `all-foundation` passed twice with identical four-line stdout, and the normal-project baseline contained only legacy `auto_avoidance` errors. |
| 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 1 — Solver-Neutral Sparse QP Contracts | `104081e` | RED: `optimization` failed with missing `SparseTripletBuilder`; GREEN: `PASS optimization` covered deterministic CSC canonicalization, duplicate summation, zero dropping, upper-triangular Hessians, QP validation, and defensive copies. |
| 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 2 — Reproducible OSQP 1.0.0 Native Package | `2abb465` | RED: the planned package script was absent; GREEN: the fixed-tag build printed `OSQP v1.0.0 win-x64 package ready`. The package contains the pinned DLL, license files, version/build flags, and lowercase SHA-256 manifest; `dumpbin` verified x64 and the four required exports. |
| 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 3 — Absolute-Path Native Loader and ABI Structures | `39c1708` | RED: `osqp-loader` failed with missing `OsqpNativeLoader`; GREEN: `PASS osqp-loader` verified missing/corrupt DLL diagnostics, real `1.0.0` loading from a copied plugin directory, and one stable handle across 16 parallel first-use calls. |
| 4 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 4 — OSQP Solve Lifecycle and Status Mapping | `a957fda` | RED: `osqp-loader` failed with missing `OsqpNativeSolver`; GREEN: fixed bounded, equality, infeasible and one-tick time-limit QPs pass inside a copied clean-plugin process. Status values 1–11 map to the planner-neutral contract, with finite metrics and captured native status. Twenty exact `osqp` solve/cleanup cycles printed `PASS osqp-solve` and `PASS osqp-loader` on every iteration. |
| 4 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 5 — Backend Completion Gate | `61dfa79` | RED: `osqp` was rejected by the verification-host command parser; GREEN: it runs the full solver/loader group. README now records the pinned package, deployment layout, absolute-load rule, ownership and status mapping. `dumpbin /dependents` found only Windows/runtime DLLs; an externally located working directory still loaded a copied clean plugin bundle and solved the micro QPs. |
| 5 | `2026-08-03-em-planner-lateral-ls-implementation.md` | Task 1 — Variable Layout and Exact Discrete Lateral Dynamics | `c225b17` | RED: `lateral-model` failed to build with missing `LateralVariableLayout`; GREEN: `PASS lateral-model` covered contiguous `4N-1` indices, range checks, unequal-S exact integration, station/corridor/start validation, defensive copies, and the lateral result publication contract. |
| 5 | `2026-08-03-em-planner-lateral-ls-implementation.md` | Task 2 — Normalized Objective and Linear Hard Constraints | `f703d41` | RED: `lateral-model` failed to build with missing `LateralObjectiveBuilder`; GREEN: `PASS lateral-model` inspected normalized P/q coefficients with `1e-12` comparisons, exact integration equalities, finite hard bounds, goal/gear versus rolling terminal behavior, empty-intersection early failure, and the solver-neutral fake-QP boundary. |
| 5 | `2026-08-03-em-planner-lateral-ls-implementation.md` | Task 3 — Nonlinear Geometry Evaluation and Independent Validation | `0c48a7d` | RED: `lateral-model` failed to build with missing `LateralGeometryEvaluator`; GREEN: `PASS lateral-model` covered straight and constant-curvature references in forward/reverse, full Frenet curvature, actual strictly increasing PathS, curvature/yaw-rate signs, and rejection of denominator, curvature, non-finite, and independently recomputed world-geometry violations. |
| 6 | `2026-08-03-em-planner-lateral-ls-implementation.md` | Task 4 — Sequential Convex Outer Loop and Feasible-Candidate Fallback | `f19df53` | RED: `lateral-integration` failed to build with missing `SequentialConvexOptimizer` and `LateralPlanner`; GREEN: `PASS lateral-integration` scripted validation-before-fallback, invalid-vector rejection, `SolvedInaccurate` residual/geometry rejection, 0.05 m trust centering, complete-primal warm starts, five-call cap, cancellation, timeout and facade behavior. |
| 6 | `2026-08-03-em-planner-lateral-ls-implementation.md` | Task 5 — Real-OSQP Lateral Scenarios and Gate | `4d83ed2` | RED: `lateral-all` reached the real forward scenario but rejected the empty initial warm start; the subsequent loader diagnosis confirmed the host output bundle intentionally lacks `osqp.dll`. GREEN: the solver-neutral full initial primal and a clean copied plugin-bundle probe produced `PASS lateral-model`, `PASS lateral-integration`, and `PASS lateral-real-osqp` for deterministic forward/reverse straight, gentle curve, seed-connected obstacle narrowing, gear-switch, and rolling scenarios. |

| 7 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 1 — Speed Envelope over Actual PathS | `62ea9db`, correction `25742ab` | RED: `longitudinal-model` first failed with missing longitudinal input/speed-envelope types; the sparse stopping chord and then the discrete jerk-release tail checks also failed before refinement. GREEN: `PASS longitudinal-model` proves actual strictly increasing LS `PathS` consumption, finite curvature/curvature-rate/stopping limits, stopping-distance precheck, dense actual-PathS stations, and discrete deceleration/jerk tail stations. |
| 7 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 2 — Time-Knot Layout, Dynamics, Objective, and Hard Constraints | `c01d0d5` | RED: `longitudinal-model` failed with missing ST candidate/layout/constraint types. GREEN: `PASS longitudinal-model` inspects normalized objective coefficients, solver-neutral `QuadraticProgram` assembly, exact constant-jerk dynamics, monotonic progress, finite physical bounds, exact start state, and hard terminal `s_N`/`u_N`. |
| 7 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 3 — Longitudinal Outer Loop and Strict Validation | `510bf97` | RED: `longitudinal-integration` failed first with missing optimizer/validator/facade types; focused checks then exposed invalid fallback acceptance, sparse envelope probes, noncanonical endpoints, and loss of a strictly validated initial seed on immediate timeout. GREEN: `PASS longitudinal-integration` covers scripted statuses, strict residual/physical validation, deep-copy last-feasible fallback, complete-primal warm starts, the five-iteration cap, cancellation, and deterministic real OSQP forward/reverse/curvature/jerk-stop/short/zero-start scenarios in a clean copied plugin bundle. |
| 8 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 4 — Complete Trajectory Assembly and Redundant-Field Consistency | `1d58864` | RED: `trajectory` exited 1 with CS0246 for missing `EmTrajectoryAssembler`. GREEN: `trajectory` exited 0 with `PASS trajectory`, checking forward/reverse signed speed, all redundant field identities, unwrapped yaw interpolation, exact terminal anchor, and the `0.20 s` / `0.05 s` hold tail. |
| 8 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 5 — Independent World-Space Publication Validator | `7410654` | RED: `trajectory` exited 1 with missing `EmTrajectoryValidationFailure` / validator contracts. GREEN: `trajectory` exited 0 with `PASS trajectory`, rejecting deterministic mutations for non-finite values, timing/PathS/direction/field inconsistencies, every configured physical limit, terminal anchor/speed/yaw-rate failures, pose and `0.025 m` swept collisions, segment overflow, and reverse-specific speed limits. |
| 8 | `2026-08-03-em-planner-longitudinal-st-implementation.md` | Task 6 — Pure One-Shot EmPlanningService | `019b896` | RED: `em-planning-service` exited 1 with CS0246 for missing `EmPlanningService`. GREEN: `em-core-all` exited 0 twice in the required four-line order; the service checks cover forward/reverse/gear/goal/rolling success, deterministic output, request IDs, invalid/stale/direction/projection/corridor/stopping/LS/ST/solver/timeout/cancellation/publication-validation failures, and debug-sink exception isolation. |

## Current Verification

- Commands: entry regressions `coordinator`, `executor`, `em-core-all`, `trajectory`, `lateral-all`, `optimization`, `osqp`, and `all-foundation`; Task 4 `executor`; Task 5 `plugin-package`; final `em-all` and `git diff --check`, all from the repository root.
- Result: every entry regression exited 0. The final post-commit `em-all` exited 0 with foundation, OSQP, lateral, longitudinal, trajectory, facade, coordinator, executor, plugin packaging, rolling end-to-end, and rolling-tail PASS lines; `git diff --check` exited 0.
- RED/GREEN: Task 4 RED `executor` exit 1 (missing generic adapter/provider), GREEN exit 0. Task 5 RED `plugin-package` exit 1 (missing script), GREEN exit 0. Task 6 RED `em-all` exit 2 (unregistered command), GREEN exit 0; the Task 5 output metadata required test-only clean-bundle copy fixtures to omit host-output `osqp.dll` before their existing explicit pinned-DLL copy.
- Verified commits: `aa51ae2`, `3c84e36`, `4058230`.

## Historical Current Verification

- Commands:
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- longitudinal-model`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- longitudinal-integration`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- lateral-integration`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- lateral-all`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- lateral-model`
  - `1..20 | ForEach-Object { dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp; if ($LASTEXITCODE -ne 0) { throw "OSQP verification failed on iteration $_" } }`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp-loader`
  - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation`
  - `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe /dependents ClumsyPilot/ThirdParty/OSQP/win-x64/osqp.dll`
  - Clean copied plugin bundle: run `EMPlannerVerificationHost.exe osqp-probe` from a separate working directory.
  - `git diff --check`
- Result: The Stage 5 `lateral-model` gate exited 0 after all three Task commits. It proves the `4N-1` layout, exact unequal-station dynamics, immutable lateral inputs/results, normalized OSQP-convention P/q assembly, finite hard corridor/derivative/trust/denominator bounds, terminal distinction, full forward/reverse world reconstruction, actual PathS, and independent validation. `optimization`, `osqp`, and all four `all-foundation` groups exited 0. The dependency list remains `KERNEL32.dll`, `VCRUNTIME140.dll`, and API-set CRT DLLs only—no MKL, CUDA or external QDLDL. `git diff --check` had no whitespace diagnostics; immediately before this checkpoint update the staging area was empty and no Stage 5 scope files were uncommitted.
- Result: Stage 6 exit commands all exited 0 at `4d83ed2`: `lateral-integration`; `lateral-all` (model, scripted SQP, and clean-plugin real OSQP groups); `optimization`; `osqp`; `all-foundation`; and `git diff --check`. The real OSQP gate runs every fixed scenario twice and compares status, point count, and all lateral-path numeric fields within `1e-10`; the obstacle scenario stays in the negative, seed-connected corridor interval. The LS implementation remains dependent only on `IQpSolver`/`QuadraticProgram`; no LS P/Invoke, UI, hardware object, or current-working-directory dependency was added.
- Result: Stage 7 exit commands all exited 0 from the repository root at `510bf97`: `longitudinal-model`; `longitudinal-integration`; `lateral-integration`; `lateral-all`; `optimization`; `osqp`; `all-foundation`; and `git diff --check`. ST consumes only actual LS `PathS` and reaches OSQP only through `IQpSolver`/`QuadraticProgram`; no ST P/Invoke, UI, hardware object, or current-working-directory dependency was added. The jerk-stop case retains only the independently validated initial seed when OSQP reaches its 4000-iteration limit; the timed-out solver vector is not accepted.
- Baseline note: invoking the pre-existing `lateral-all` test from the `ClumsyPilot` subdirectory fails its pinned-DLL lookup because that Stage 6 test constructs the source path from `Directory.GetCurrentDirectory()`. Running the documented command from the repository root exits 0. Stage 7 does not modify or bypass the completed LS test.
- Normal-project baseline: the historical checkpoint recorded exit 1 from legacy `auto_avoidance/MultiWheelAutoAvoidance.cs` references to `NetTopologySuite` and `OpenCvSharp`. At the Stage 7 final read-only audit that source path is absent from both the working tree and the tracked `HEAD` tree, so `dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore` exits 0 with only two unrelated obsolete-API warnings. Stage 7 issued no delete/clean command and made no legacy-module change; preserve the observed workspace and do not recreate, delete, hide, or otherwise alter legacy functionality merely to change this baseline.
- Verified commits: `104081e`, `2abb465`, `39c1708`, `a957fda`, `61dfa79`, `c225b17`, `f703d41`, `0c48a7d`, `f5c69c2`, `f19df53`, `4d83ed2`, `62ea9db`, `c01d0d5`, `25742ab`, and `510bf97`
- Result: Stage 8 exit commands all exited 0 from the repository root at `019b896`: `em-core-all` twice (each printed `PASS longitudinal-model`, `PASS longitudinal-integration`, `PASS trajectory`, `PASS em-planning-service` in order); then `longitudinal-model`, `longitudinal-integration`, `trajectory`, `lateral-all`, `optimization`, `osqp`, `all-foundation`, and `git diff --check`. The trajectory gate independently verifies physical world-space publication and the service consumes only request snapshots through `IQpSolver` / `QuadraticProgram`; no Stage 8 production P/Invoke, UI, hardware, current-working-directory, dynamic-obstacle, rolling-execution, or controller dependency was added.
- Stage 8 RED commands and exits: Task 4 `trajectory` exit 1 (missing `EmTrajectoryAssembler`); Task 5 `trajectory` exit 1 (missing validator contracts); Task 6 `em-planning-service` exit 1 (missing `EmPlanningService`). Task 4/5 GREEN command was `trajectory` exit 0 / `PASS trajectory`; Task 6 GREEN command was `em-core-all` exit 0 twice with the required four PASS lines.

## Preserved Workspace State

- The initially untracked Task 1 coordinator draft was explicitly authorized for Stage 9 ownership and committed as `d75380c`.
- Every captured user-baseline status entry remains untouched and unstaged: the final `git status --short` set has the same 125 entries as Stage 10 entry, with no additions or losses.
- The `lateral-all` fixture still resolves its explicitly copied pinned OSQP DLL from the repository-root current directory. Build-output `osqp.dll` is omitted only from the temporary clean-bundle host copy before that existing explicit copy; no LS/ST/OSQP/facade production behavior changed.
- Existing baseline noise remains the two obsolete-API warnings and CRLF advisories on user-owned dirty files; `git diff --check` exits 0.

## Historical Preserved Workspace State

- The workspace continues to contain the same unrelated Map, CoarsePath, PathSmoothing, project-file, report, and documentation changes captured at Stage 6 entry. They belong to the user and remain untouched and unstaged.
- Use explicit file paths for every `git add`; never stage the whole workspace.
- The existing user hunk in `ClumsyPilot/ClumsyPilot.csproj` remains preserved. Do not clean, rewrite, or stage it.
- The historical legacy `auto_avoidance/MultiWheelAutoAvoidance.cs` dependency failure is not reproducible in the Stage 7 final workspace because that untracked/unversioned source path is absent. Do not recreate, delete, bypass, or otherwise alter legacy functionality to manufacture a different baseline.
- Remaining observed baseline noise: the first fresh Stage 8 core build printed the existing `Lidar2dDetect2LegTray.LegWidth` and `MultiWheelChassis.GetSteerWheels()` obsolete-API warnings; `git diff --check` emits CRLF conversion advisories for user-owned dirty files but exits 0. Neither is an EM Planner regression.

## Decisions Needed

- None. Stage 10 completed within scope; it is the final planned EM Planner stage.

## Historical Decisions Needed

- None. Stage 7 completed within scope.

## Prior Stage 7 Entry Record

- Stage: 7 — ST model and longitudinal optimization
- Readiness: Ready for Stage 7 entry checks after this checkpoint is committed.
- Plan: `docs/superpowers/plans/2026-08-03-em-planner-longitudinal-st-implementation.md`
- Tasks:
  - Task 1 — Speed Envelope over Actual PathS
  - Task 2 — Time-Knot Layout, Dynamics, Objective, and Hard Constraints
  - Task 3 — Longitudinal Outer Loop and Strict Validation
- Entry checks:
  - Confirm branch `trajplanner`, `a957fda`, `61dfa79`, `c225b17`, `f703d41`, `0c48a7d`, `f5c69c2`, `f19df53`, and `4d83ed2` are ancestors of `HEAD`, and the Stage 6 progress checkpoint is present.
  - Capture `git status --short` before editing and preserve every unrelated user change.
  - Read the two EM Planner design documents, this progress file, and the longitudinal-ST implementation plan in full.
  - Run `lateral-integration`, `lateral-all`, `optimization`, `osqp`, and `all-foundation` before Task 1.
  - ST must consume actual, strictly increasing LS `PathS` and keep the OSQP boundary solver-neutral through `IQpSolver`.
- Exit gate:
  - Tasks 1–3 each have an independent commit and their prescribed RED/GREEN evidence.
  - The actual-PathS speed envelope, stopping precheck, ST dynamics/QP, and strict longitudinal validation pass.
  - The Stage 7 plan's full exit gate and `git diff --check` pass; the staging area is empty; a Stage 7 progress checkpoint is committed alone.

## Prior Stage 7 Window Prompt (Historical)

```text
请继续 ParkingRobot 仓库的 EM Planner 多窗口实施。

工作目录：D:\Users\Desktop\项目\prakrobot\ParkingRobot

本窗口只执行阶段 7：ST 模型与纵向优化。唯一授权范围是：
`docs/superpowers/plans/2026-08-03-em-planner-longitudinal-st-implementation.md` 的 Task 1、Task 2、Task 3。
不要开始轨迹发布、单次规划服务、滚动执行、控制适配、动态障碍物或任何后续阶段。

开始前必须完整读取：
1. `docs/superpowers/specs/2026-08-03-em-planner-ls-st-design.md`
2. `docs/superpowers/specs/2026-08-03-em-planner-windowed-execution-design.md`
3. `docs/superpowers/progress/em-planner-progress.md`
4. `docs/superpowers/plans/2026-08-03-em-planner-longitudinal-st-implementation.md`

使用 `executing-plans`、`test-driven-development` 和 `verification-before-completion`；不要使用子代理。只在 `trajplanner` 上工作。Stage 4–6 提交必须可从 `HEAD` 追溯：`a957fda`、`61dfa79`、`c225b17`、`f703d41`、`0c48a7d`、`f5c69c2`、`f19df53` 和 `4d83ed2`；随后是本进度文件的独立 Stage 6 checkpoint。若这些提交、进度记录或入口验证任一不一致，停止实施并先报告事实，不要猜测或重做已提交工作。

开始 Task 1 前：
- 保存完整 `git status --short` 基线，确认暂存区为空；工作区已有大量与 EM 无关的 Map、CoarsePath、PathSmoothing、报告、文档、项目文件和未跟踪修改，必须完整保留。
- 不得使用 `git add .`、`git add -A`、`git reset --hard`、`git checkout --` 或任何清理命令；每次只用显式路径暂存计划指定文件。
- 运行以下隔离入口验证，并确认全部退出码为 0：
  ```powershell
  dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- lateral-integration
  dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- lateral-all
  dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization
  dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp
  dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation
  ```
- `ClumsyPilot.csproj` 中有既有用户 hunk；正常项目构建仍会因旧 `auto_avoidance/MultiWheelAutoAvoidance.cs` 缺少 `NetTopologySuite` 与 `OpenCvSharp` 失败。不要修改、删除、屏蔽或绕过该旧模块，也不要把它当成 EM 回归。

实施约束：
- 严格逐任务 TDD：先增加该任务的最小失败检查，观察其因缺少目标行为而失败，再写最小生产代码，并运行计划指定 GREEN 验证。
- Task 1、2、3 各自形成独立功能提交；提交前用 `git diff --cached --check` 和 `git diff-tree` 核对文件集合。
- ST 只能消费 LS 输出的实际、严格递增 `PathS`，并且只能通过既有 solver-neutral `IQpSolver`/`QuadraticProgram` 边界使用 OSQP；不能向 ST 引入 P/Invoke、当前工作目录依赖、UI 或硬件对象。
- 不修改无关的 Map、CoarsePath、PathSmoothing、旧 `auto_avoidance`、已完成 LS 或 OSQP 后端；不实现轨迹发布、滚动执行、控制适配或动态障碍物。

阶段结束条件：
- 仅在 Task 1–3 均有独立提交、各自 RED/GREEN 证据和该计划全部出口验证通过后，运行 Stage 7 规定的 LS/ST/优化/OSQP/Foundation 回归及 `git diff --check`。
- 检查暂存区为空、用户的起始 `git status --short` 修改仍被保留；然后只更新并单独提交 `docs/superpowers/progress/em-planner-progress.md`。
- 最终报告必须给出实际提交、命令/退出码、未处理基线问题，并提供阶段 8（仅轨迹发布与单次规划服务 Task 4–6）的精确下一窗口提示词。
```

## Next Stage

- None. Stage 10 is the final approved stage; no Stage 11 implementation work or prompt is generated.

## Historical Stage 9 Next Stage

- Stage: 9 — rolling coordination and gear-switch execution
- Readiness: Ready after this Stage 8 progress checkpoint is committed.
- Plan: `docs/superpowers/plans/2026-08-03-em-planner-rolling-execution-implementation.md`
- Authorized tasks only:
  - Task 1 — Cycle Identity, Scheduling Decision, and Stale-Result Suppression
  - Task 2 — Safe Previous-Trajectory Handoff
  - Task 3 — Gear-Switch State Machine and Trajectory Executor
- Explicit exclusions: generic control adaptation, plugin packaging, dynamic obstacles, UI/hardware integration beyond the approved execution boundary, and Stage 10 work.

## Historical Stage 10 Window Prompt

```text
请继续 ParkingRobot 仓库的 EM Planner 多窗口实施。

工作目录：D:\Users\Desktop\项目\prakrobot\ParkingRobot

本窗口只执行阶段 10：通用控制适配、插件发布与最终滚动验收。唯一授权范围是：
docs/superpowers/plans/2026-08-03-em-planner-rolling-execution-implementation.md 的 Task 4、Task 5、Task 6。
不要开始动态障碍物、UI/硬件集成，或任何未在该计划中的后续工作。

开始前必须完整读取：
1. docs/superpowers/specs/2026-08-03-em-planner-ls-st-design.md
2. docs/superpowers/specs/2026-08-03-em-planner-windowed-execution-design.md
3. docs/superpowers/progress/em-planner-progress.md
4. docs/superpowers/plans/2026-08-03-em-planner-rolling-execution-implementation.md

使用 executing-plans、test-driven-development 和 verification-before-completion；不要使用子代理。只在 trajplanner 上工作。

开始 Task 4 前：
- 确认 d75380c、55119de、de402e6 以及紧随其后的 Stage 9 进度 checkpoint 均可从 HEAD 追溯。
- 保存完整 git status --short 基线，确认暂存区为空，并保留所有既有用户修改。
- 从仓库根目录运行并确认退出码为 0：coordinator、executor、em-core-all、trajectory、lateral-all、optimization、osqp、all-foundation。
- 不使用 git add .、git add -A、清理命令或破坏性 Git 命令；每次仅显式暂存计划指定文件。
- Stage 6 lateral-all 测试夹具依赖仓库根目录的当前工作目录定位固定 OSQP DLL；不要修改已完成 LS/ST/OSQP/发布门面来改变该基线。

执行要求：
- 严格逐任务 TDD；Task 4-6 各自独立提交，提交前运行 git diff --cached --check，并用 git diff-tree 核对范围。
- Task 4 只能产生通用控制命令，不能引用 MultiVehicleScriptVx、MultiVehicleScriptVy、MultiVehicleScriptVth、UI 或硬件对象。
- Task 5 只能按计划输出并验证 ClumsyPilot.dll、osqp.dll 与许可证目录；不得重写现有 csproj 用户 hunk。
- Task 6 只添加计划要求的端到端证据和 README 所有权/部署说明；不实现动态障碍物、UI 或硬件集成。

阶段结束时：
- 仅在 Task 4-6 均有独立 RED/GREEN 证据和计划规定的最终出口验证后，运行 em-all 和 git diff --check。
- 确认暂存区为空、起始用户修改仍保留；只更新并单独提交 docs/superpowers/progress/em-planner-progress.md。
- 返回提交、RED/GREEN 证据、命令/退出码和未处理基线问题；Stage 10 是最终阶段，不生成 Stage 11 实施提示词。
```

## Historical Stage 9 Next-Window Prompt

```text
请继续 ParkingRobot 仓库的 EM Planner 多窗口实施。

工作目录：D:\Users\Desktop\项目\prakrobot\ParkingRobot

本窗口只执行阶段 9：滚动协调与换向执行。唯一授权范围是：
docs/superpowers/plans/2026-08-03-em-planner-rolling-execution-implementation.md 的 Task 1、Task 2、Task 3。
不要开始通用控制适配、插件最终发布、动态障碍物、UI/硬件集成或任何 Stage 10 工作。

开始前必须完整读取：
1. docs/superpowers/specs/2026-08-03-em-planner-ls-st-design.md
2. docs/superpowers/specs/2026-08-03-em-planner-windowed-execution-design.md
3. docs/superpowers/progress/em-planner-progress.md
4. docs/superpowers/plans/2026-08-03-em-planner-rolling-execution-implementation.md

使用 executing-plans、test-driven-development 和 verification-before-completion；不要使用子代理。只在 trajplanner 上工作。

开始 Task 1 前：
- 确认 1d58864、7410654、019b896 以及紧随其后的 Stage 8 进度 checkpoint 均可从 HEAD 追溯。
- 保存完整 git status --short 基线，确认暂存区为空，并保留所有既有用户修改。
- 从仓库根目录运行并确认退出码为 0：em-core-all、trajectory、lateral-all、optimization、osqp、all-foundation。
- 不使用 git add .、git add -A、清理命令或破坏性 Git 命令；每次仅显式暂存计划指定文件。
- Stage 6 lateral-all 测试夹具依赖仓库根目录的当前工作目录定位固定 OSQP DLL；不要修改已完成 LS/ST/OSQP/发布门面来改变该基线。

执行要求：
- 严格逐任务 TDD；Task 1–3 各自独立提交，提交前运行 git diff --cached --check，并用 git diff-tree 核对范围。
- 保持单次 EmPlanningService 纯请求边界：协调器只能消费其不可变结果，不能把 UI、硬件或当前工作目录依赖回灌到核心。
- 不修改无关 Map、CoarsePath、PathSmoothing、旧 auto_avoidance、已完成 Foundation/OSQP/LS/ST/Trajectory/Validation/Facade 文件；不实现动态障碍或控制适配。

阶段结束时：
- 仅在 Task 1–3 均有独立 RED/GREEN 证据和阶段出口验证后，运行计划规定的回归和 git diff --check。
- 确认暂存区为空、起始用户修改仍保留；只更新并单独提交 docs/superpowers/progress/em-planner-progress.md。
- 返回提交、RED/GREEN 证据、命令/退出码、未处理基线问题，并给出 Stage 10 的精确下一窗口提示词。
```
