Workflow fifth-stage self-review used after backend implementation reaches review-ready handoff and before any plugin work. This stage owns review-and-fix, self-review.md, and the gate/next decision for plugin unlock or upstream recovery; it may invoke the Java review helper when needed, but it is not itself a direct fallback helper.
This is the dedicated backend self-review stage.
It owns workflow self-review, self-review.md, and the final backend gate/next decision before plugin work, not package-level entry routing and not standalone Java compliance fallback.
It exists to separate implementation from final backend release gating.
This stage reads:
tasks/<task-name>/requirement.mdtasks/<task-name>/feasibility.mdtasks/<task-name>/plan.mdapcp-web-apiThis stage writes:
tasks/<task-name>/self-review.mdIf self-review.md already exists from a previous failed review, reopen and replace it for the current review pass.
It does not modify requirement.md or feasibility.md.
It may update plan.md only to synchronize the runtime visibility sections ## 当前状态, ## 执行计划, and ## 实施任务, or when the review finds that an upstream stage really must be reopened.
Before starting, confirm all of the following:
requirement.md exists and has gate: requirement-confirmedfeasibility.md exists and has gate: ready-for-planplan.md exists and has gate: ready-for-implementationplan.mdThis review handoff is a stage transition condition.
It is not a separate task document written before self-review.md exists.
If any precondition fails, refuse this stage and return to the only legal upstream stage.
If any precondition fails, refuse this stage and return to the only legal upstream stage. Do not use this stage to bypass unfinished implementation or upstream gate handling.
self-review.md must contain at least:
## 范围核对## 实现符合度## 偏差说明## 剩余问题## 修复记录## 阶段状态The ## 阶段状态 block must contain:
gate: ready-for-plugin or gate: review-failednext: apcp-plugin-implementation or next: apcp-web-api-implementation or next: apcp-web-api-plancodelaw-self-review is the adjacent Java review and compliance helper skill.
It may be invoked from this workflow stage to perform the detailed Java review, but it does not own self-review.md, plugin unlock, or upstream recovery routing.
requirement.md, feasibility.md, plan.md, and the implemented backend code.codelaw-self-review.self-review.md, including:
## 实现符合度## 偏差说明## 剩余问题## 修复记录## 阶段状态gate: review-failed and return next to apcp-web-api-implementation or apcp-web-api-plan.gate: ready-for-plugin and next: apcp-plugin-implementation.This stage is review-and-fix. Do not duplicate detailed CodeLaw MCP procedures here. Do not drift into unrelated feature work while repairing review findings.
Review against the whole contract, not only spot code. Check:
requirement.mdplan.md without silent driftplan.md ## 当前状态, ## 执行计划, and ## 实施任务 still reflect the real workflow state and need final closure updatesUse this only when backend work is stable enough for plugin verification:
gate: ready-for-pluginnext: apcp-plugin-implementationready-for-plugin means the plugin stage is now legally unlocked.
It does not mean this stage may enter plugin work automatically.
User confirmation is still required before apcp-plugin-implementation begins.
If the implementation no longer matches the plan, or the plan itself is no longer sufficient, first repair what can be repaired directly in this stage. Only when unresolved issues still remain after that repair pass:
gate: review-failednext back to the only correct recovery stage:
apcp-web-api-implementation when more implementation work is still requiredapcp-web-api-plan when the design itself must changeWithin this stage's own review result, review-failed normally means unresolved review findings still remain after repair.
At the workflow level, the same gate may also be used later as a forced invalidation state when backend changes resume after a previously passed review; that invalidation path must say explicitly that the old pass became stale, not that this stage just found a new unresolved review defect.
Do not allow plugin work after a failed review.
This stage completes only when self-review.md contains an explicit ## 阶段状态 block with one of these outcomes:
gate: ready-for-plugin with next: apcp-plugin-implementationgate: review-failed with next: apcp-web-api-implementation or next: apcp-web-api-planBefore finalizing either result, also close the visibility state in plan.md so its ## 当前状态, ## 执行计划, and ## 实施任务 reflect the real review outcome or rollback target.
Then apply the stage-specific transition rule:
ready-for-plugin, stop and wait for user confirmation before entering apcp-plugin-implementationreview-failed, continue automatically into the upstream stage named by nextThe review-failed branch auto-enters only the immediate upstream recovery stage named by next.
After that recovery pass finishes, routing resumes from the newly completed upstream state, and implementation may later hand off into this stage again.
This stage may then replace the previous self-review.md.
Record both findings and fixes in self-review.md.
The document decides the next legal stage, and only the review-failed branch may auto-enter it immediately.
plan.md inside self-review.mdself-review.mdgate: ready-for-plugin