---
name: review
description: "Review implemented code for Akka SDK best practices, and optionally against spec, plan, and constitution."
---
## User Input
You **MUST** consider the user input before proceeding (if not empty).
## Before anything else
This command keeps a run in the idea's record when the akka CLI has one: the
`akka_run_start` MCP tool is available, or the output of `akka specify run start
--help` contains `--station`. A CLI without it predates the idea record. With
such a CLI, say so once and carry this command out as before: skip every step
marked **Idea record**, and open no run.
**Idea record: a console run.** Call the `akka_run_context` MCP tool first when
it is available: it answers `{ console, idea, station, run, spec, topic,
questions, sentBack }`, and `console: true` means the console started this command. Only
without that tool, the console started it when `AKKA_RUN_ID` is set in its
environment, or when the command has no shell to run the akka CLI in. The
console has already opened the run and enforced the rules for it, so in a
console run the run is open from the first step: its id is the `run`
`akka_run_context` answered. Any stop before the normal close, such as a
mode-check refusal, a missing argument, or a check that needs a tool this run
lacks, closes it with `akka_run_close`, that `run`, `outcome: failed` and the
reason. So in a console run: the feature is `akka_run_context`'s `spec` (for
`/akka:discover`, the topic is its `topic`), and the command never searches for
one; skip every step that finds, adopts, starts or links an idea, and never ask
a person a question: wherever this command would ask one, it closes the run with
`outcome: waiting` and `question` set to the question (`--outcome waiting
--question "<question>"` on the CLI); the owner answers in the console, and the
re-run reads the answer from `akka_run_context`'s `questions` (`{station, run,
question, answer}`) and does not ask it again; run the mode check with `--idea`
set to the `idea` `akka_run_context` answered, and skip it when it cannot run
here or no idea is known; open the run by calling `akka_run_start` with
`command` and `args` only, no `idea` and no `station`, and the CLI joins the
console's run; close it as usual; and skip the carry-on step, because the
console moves the idea on. A run with no shell for the akka CLI that
`akka_run_context` answers `console: false` for is not a console run and keeps
no record: open no run, ask nothing about ideas or lanes, and carry the command
out as before the idea record, skipping every step marked **Idea record**.
**Idea record: a station sent back to.** When `akka_run_context` answers
`sentBack` (`{ from, reason, by, at }`), the idea was sent back to this station
from `from`, and `reason` says why. Work on that reason first: read it as the
instruction for this run from `by`, change this station's outputs where the
reason points, and keep what it does not touch. `sentBack` is `null` when no
send-back opened this station's visit.
**Idea record: review in a console run.** Use only the tools the console grants
this run. Skip the optional runtime verification, and say so in one line.
**Idea record: find the idea.** On a laptop run, find the feature this command
works on first: in feature review mode, the feature it reviews, found with
`akka_sdd_list_specs` as step 1 below does; a full review works on no feature,
so it opens no run. Its idea is the one in `akka specify idea list --json` whose
`spec` is the feature's folder name (`NNN-name`); an idea is never found from
the git branch. When that idea has `derived: true`, it has no record yet: adopt
it with `akka specify ideas adopt --idea <id>`, then use it. When no idea has
it, read the mode with `akka specify mode`. In À la carte mode, open no run: say
in one line that this run is not recorded, and continue. In Enforced mode, stop:
the project's specs and topics get their ideas once with `akka specify ideas
adopt`, and this command runs after that. Pass the idea's id as `idea` to the
run start.
**Idea record: open the run.** On a laptop run, call the `akka_run_start` MCP
tool with `station: review`, `command: /akka:review`, `idea` set to the idea
found above and `args` set to the user input. Where the tool is not available,
run `akka specify run start --station review --command /akka:review --idea <id>
--args "<the user input>" --json`, with the input quoted as one argument. A run
is never started without its idea. It answers JSON: `recorded`, and for a
recorded run its `idea` and `run.id`. Keep both: the last steps use them.
- When it answers `recorded: false`, continue without a run, and say in one line
that this run is not recorded, with its `reason`.
- A refusal by rule is an error whose JSON is `{refused, message, remedy}`,
`refused` naming the rule: `paused`, `limit`, `shipped`, `dropped`,
`approval`, `order`, `no-idea-enforced`, `idea-unresolved` or `console-run`. Print `message` and `remedy` verbatim and stop.
- Any other error, one without `refused` (such as no login), does not stop the
command: continue without a run, and say in one line that this run is not
recorded.
**Idea record: a run that fails is closed too.** Once the run is open, every way
the command ends closes it. When the work fails (a build or tests fail, or a
step stops the command early), call `akka_run_close` with `run`, `outcome:
failed` and `error` set to what failed, in one line, then stop. Where the tool
is not available, run `akka specify run close --run <id> --outcome failed
--error "<what failed>"`. When the person stops the command, close the run with
`outcome: stopped`. This holds in a console run too. The close step below is for
the work's normal end.
## Review Modes
This review supports two modes:
- **Full review** (default): Reviews the entire project against Akka SDK best
practices. Runs the complete checklist below. Use this when no specific
feature is mentioned, or when the user explicitly asks for a project-wide
review.
- **Feature review**: Reviews the implementation of a specific feature against
its spec, plan, and constitution, in addition to the best practices
checklist. Activated when the user names a feature, or when SDD artifacts
(spec, plan, tasks) exist and the user doesn't explicitly ask for a general
review.
## Outline
### Steps 1-4: SDD alignment (feature review mode only)
Skip these steps entirely in full review mode.
1. **Setup**: Call `akka_sdd_list_specs` to find the target feature. Load the
spec, plan, tasks, and checklist.
2. **Load context**: Read the constitution using `akka_sdd_constitution`.
Understand what patterns and rules must be followed.
3. **Review implementation against spec**:
- Are all functional requirements implemented?
- Are all acceptance criteria met?
- Are there deviations from the spec? If so, are they justified?
4. **Review implementation against constitution**:
- Apply project-specific principles and rules from the constitution
- Check that architectural decisions align with documented rationale
### Step 5: Akka SDK best practices checklist (always runs)
Load the review checklist. First check if a project-level checklist exists at
`.akka/review-checklist.md` — if it does, use that (read the file directly).
If not, fall back to `akka_sdd_get_template` with template name
`review-checklist` to use the plugin default. Walk through every check. For
each check, report PASS, WARN (acceptable deviation with reason), or FAIL
(must fix). For WARN and FAIL items, cite the specific file(s) and line(s).
Some sections are conditional. Before walking Section R (Multi-Region
Readiness), apply the **Section R gating** rules under Report Format to decide
whether it runs at all, and state that decision in the report.
### Step 6: Runtime verification (optional, either mode)
If the service is running locally (via `/akka:build`), use backoffice tools
with `local=true` to verify that the implementation behaves correctly at
runtime — not just in code:
- `akka_backoffice_list_components` with `local=true` to confirm all
expected components are registered
- `akka_backoffice_list_events` to verify entities emit the expected events
after commands (compare against spec's event definitions)
- `akka_backoffice_get_workflow` to verify workflow steps execute in the
expected order with correct state transitions
- `akka_backoffice_query_view` to confirm views produce correct query results
- `akka_backoffice_list_agent_interactions` to review agent tool calls,
guardrails, and response quality
- If the service serves a web UI, use `akka_browser_navigate` and
`akka_browser_screenshot` to capture UI state for visual review
### Step 7: Report
- **Mode**: state whether this was a full review or a feature review
- **Multi-region**: state whether Section R ran and why: multi-region
confirmed (naming the signal and the primary selection mode), or skipped
as single-region
- Overall assessment: approved / approved with issues / needs rework
- Issues found, grouped by severity (CRITICAL first, then RECOMMENDED,
then DESIGN)
- Checklist pass rate per section
- If feature review: spec alignment summary (requirements met vs gaps)
- Recommendations
### Step 8: Close the run
If a run was opened, call the `akka_run_close` MCP tool with `run` set to its id, `outcome: ok`,
and no outputs: the review's findings are in the report, not in a file. Where the
tool is not available, run `akka specify run close --run <id> --outcome ok`. On an error,
print its message; the report stands. After the close, run `git status --porcelain -- .akka/record/` and end the final message with one line naming the files it lists, such as "Record files to commit with your work: .akka/record/<id>/…". This command does not commit the record. When git is not available, the line says the record is in `.akka/record/<id>/`.
### Step 9: Carry on or stop
In a console run, skip this step: the console moves the idea on. If a run was
opened, run `akka specify idea next --idea <idea> --from review --json`, where
`<idea>` is the `idea` the run start returned. It answers `{ go, next, reason
}`. When `go` is true, carry on into `next.command` in this conversation,
following its own instructions. Otherwise stop, print `reason`, and name
`next.command` when there is one. Without a run, stop and name the next command.
## How to Work
- Use file search, grep, and read tools to gather evidence — do NOT assume
compliance without checking code
- Check a representative sample (3-5 files per category) for pattern-based
checks
- For one-of-a-kind checks (e.g., "does `definition()` exist"), grep the
whole codebase
- Be specific: reference file paths and line numbers for every finding
- Every issue must cite the rule it violates (e.g., "violates A3")
- CRITICAL findings are reported as FAIL; RECOMMENDED findings are reported
as WARN; DESIGN findings are reported as OBSERVATION
- For DESIGN checks, read the domain model, entity state shapes, event types,
workflow steps, and component interaction patterns holistically — these
cannot be checked mechanically
- For component-selection checks (Q14-Q19), compare the implemented components
against the Component Architecture table in plan.md (if present) and the
"Choosing a component type" section of `akka-context/sdk/components/index.html.md`
- Acknowledge good patterns and practices, not just problems
## Report Format
### Section Scores
```
Section | Pass/Total | Severity
A. Serialization & State | N/3 | CRITICAL
B. Endpoints & Security | N/2 | CRITICAL
C. Workflows | N/3 | CRITICAL
D. Agents | N/1 | CRITICAL
E. Views | N/4 | CRITICAL
F. Error Handling | N/2 | CRITICAL
G. Payload & State Size | N/4 | CRITICAL
H. Code Quality & Safety | N/4 | CRITICAL
I. PII & Data Sanitization | N/4 | CRITICAL
J. Serialization Conventions | N/4 | RECOMMENDED
K. Architecture & Conventions | N/8 | RECOMMENDED
L. Endpoint Conventions | N/6 | RECOMMENDED
M. Workflow & Agent Conventions | N/10 | RECOMMENDED
N. Consumer & Idempotency | N/9 | RECOMMENDED
O. Testing Conventions | N/7 | RECOMMENDED
P. Error Handling Conventions | N/3 | RECOMMENDED
Q. Design Review | N/19 | DESIGN
R. Multi-Region Readiness | N/15 | MIXED (optional)
TOTAL CRITICAL | N/32
TOTAL RECOMMENDED | N/52
TOTAL DESIGN | N/24
```
Note: Skip sections that don't apply (e.g., no gRPC endpoints, no workflows).
Only count applicable checks in the total.
Section R (Multi-Region Readiness) mixes severities. Score each R item by its
own `[CRITICAL]` / `[RECOMMENDED]` / `[DESIGN]` tag. Do not assume a fixed ID
range: a project-level checklist may reorder or edit the checks.
**Section R gating.** Section R is optional. Run it only when multi-region
deployment is confirmed by at least one of:
- the user input asks for it, for example with `multi-region`
- the `akka://regions` resource lists more than one region for the project
- a project descriptor in the repository lists more than one region under
`spec.regions`
- the constitution or a feature spec requires the service to run, or to be
deployable, in more than one region
A service descriptor with a `replication` block supports these signals but does
not confirm multi-region deployment on its own. If signals conflict (for
example a spec requires two regions while the project descriptor lists one),
run Section R and state the conflict.
If none of those holds, do NOT run Section R. Emit its row as
`R. Multi-Region Readiness | N/A | not evaluated, single region` and exclude
its checks from all three totals. Never infer multi-region deployment from the
code alone, and never report an R finding as FAIL on a project whose region
topology you could not confirm: a single-region service is not at risk from
any of them.
When Section R runs, state the primary selection mode it was reviewed against
(`request-region`, `pinned-region`, or both when descriptors differ) and where
it came from (a service descriptor, or the `request-region` default). An R item
that does not apply to the reviewed mode or code (for example R12 under
`request-region`) is N/A and excluded from the counts. A DESIGN item counts as
passed when it raises no observation. Report a handler that violates both an R
item and a check in another section (for example R6 and K8) once, under the
item with the higher severity, and name the other.
The totals above describe the bundled default checklist. If the checklist you
loaded differs (a project-level `.akka/review-checklist.md`, or an older
template served by `akka_sdd_get_template`), derive the per-section and total
counts from the checklist you actually loaded, and score only the sections it
contains.
### Findings
Report CRITICAL findings first, then RECOMMENDED, then DESIGN. For each:
```
[ID] FAIL/WARN/OBSERVATION — Description
Severity: CRITICAL / RECOMMENDED / DESIGN
File: path/to/file.java, Line: N
Evidence: <code snippet or grep result>
Fix/Suggestion: <specific remediation or design alternative>
```
DESIGN items are reported as OBSERVATION with reasoning about the trade-off,
not as simple pass/fail. Explain what the current design implies for
performance or maintainability and suggest alternatives if appropriate.
### All Findings
List ALL findings, not just a top N. Group by severity: all CRITICAL (FAIL)
first, then all RECOMMENDED (WARN), then all DESIGN (OBSERVATION). Within
each severity group, order by impact.
## Customizing the Review Checklist
The review checklist can be customized per project. To create a project-level
copy that you can modify:
1. Copy the default checklist: `cp` the plugin template to
`.akka/review-checklist.md`
2. Edit `.akka/review-checklist.md` to add, remove, or modify checks as needed
3. Future reviews will automatically use your project-level checklist instead
of the plugin default
If `.akka/review-checklist.md` does not exist, the plugin's built-in checklist
is used.
## Done When
- [ ] The review mode was decided and stated up front: **Full review** (no feature named / project-wide requested) or **Feature review** (feature name given, or SDD artifacts exist and no explicit full-review request).
- [ ] In feature review mode: FEATURE_DIR was resolved via `akka_sdd_list_specs`; `spec.md`, `plan.md`, `tasks.md`, and every file under `checklists/` were loaded; the constitution was loaded via `akka_sdd_constitution`; the implementation was assessed for functional-requirement and acceptance-criterion coverage with any deviations either justified or flagged.
- [ ] The best-practices checklist was loaded from `.akka/review-checklist.md` if present, else from `akka_sdd_get_template` with template name `review-checklist`; every check was walked and marked PASS / WARN / FAIL, with WARN and FAIL items citing the exact file path and line number.
- [ ] Runtime verification via backoffice tools (`akka_backoffice_list_components`, `akka_backoffice_list_events`, `akka_backoffice_get_workflow`, `akka_backoffice_query_view`, `akka_backoffice_list_agent_interactions`) was performed with `local=true` if the service is running — or explicitly noted as skipped because the service is not running.
- [ ] Evidence was gathered by grep and file reads, not assumption — every finding cites a specific file path, line number, and the rule it violates (e.g. "violates A3"); CRITICAL findings are FAIL, RECOMMENDED are WARN, DESIGN are OBSERVATION.
- [ ] The Section Scores table was emitted with pass/total counts per section, applicable checks only, followed by TOTAL CRITICAL / RECOMMENDED / DESIGN, with counts derived from the checklist actually loaded, not assumed from this document.
- [ ] Section R applicability was decided by the gating rules and stated explicitly: either multi-region was confirmed (naming the signal: the user input, `akka://regions`, a constitution or spec, or a service descriptor) together with the primary selection mode reviewed against, or the section was skipped as single-region with its checks excluded from all totals.
- [ ] ALL findings were listed (not a top-N), grouped CRITICAL → RECOMMENDED → DESIGN, and within each group ordered by impact.
- [ ] The final report explicitly states the review mode, an overall assessment (`approved` / `approved with issues` / `needs rework`), per-section pass rates, spec-alignment summary (feature review only), and recommendations.
- [ ] Good patterns observed were acknowledged, not only problems.
- [ ] The run was opened at the `review` station with `akka_run_start` before any other step and closed with `akka_run_close` at the end, or the CLI was reported as predating the idea record.
- [ ] With a run, the command carried on into `next.command` only when `akka specify idea next` answered `go: true`; otherwise it stopped, printed the reason and named the next command.