do-issue
Drive a Linear ticket end-to-end through Penca's kata-task-graph + /loop-drain workflow. One human gate (plan approval at Step 3); everything else — red-tests, implementation, pre-PR cleanup passes, PR open, post-open subagent review — runs autonomously via the drain loop, driven by an explicit blocked-by graph emitted at Step 2.
- License 许可
- Apache-2.0
- 所属仓库
- penca-io/penca
- 最近更新
- 2026-08-01
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- do-issue
- description
- Drive a Linear ticket end-to-end through Penca's kata-task-graph + /loop-drain workflow. One human gate (plan approval at Step 3); everything else — red-tests, implementation, pre-PR cleanup passes, PR open, post-open subagent review — runs autonomously via the drain loop, driven by an explicit blocked-by graph emitted at Step 2.
- allowed-tools
- Agent Bash Edit Glob Grep Read Skill Write
- argument-hint
- <Linear issue URL or CHA-NN>
02 资源文件 1
- 脚本kata_plan_html.py18.7 KB
03 SKILL.md 正文
Do a Linear issue
Drive a Linear ticket end-to-end. The workflow is encoded as a kata task graph emitted at Step 2 and consumed by a /loop drain that runs from Step 4 to PR merge. Graph nodes: red-tests, implementation work, three orchestration tasks (orch:run-cleanup, orch:open-pr, orch:spawn-review). Edges: kata --blocked-by links. The drain is a uniform consumer — it claims whatever kata ready returns and dispatches by task kind.
One human gate: Step 3 plan approval (user flips plan-draft → approved). Everything else is mechanism-bound — the dependency graph encodes the workflow, not the prose. Roborev findings, /review-pr findings, and cleanup-pass candidates all enqueue with --label approved and join the drain automatically, dynamically extending downstream orch:* tasks' --blocked-by so PR open waits on them.
Ticket: "$ARGUMENTS"
When to use this skill
Use for any Linear ticket where:
- A reader has to make a non-obvious design decision (multiple files, new RPC, schema change, behavior change), OR
- The acceptance criteria list more than one behavioral test.
Skip this skill for typo fixes, one-line config tweaks, dependency bumps, or any change where writing a plan would be longer than the diff. Those go straight to a branch + commit.
Refactor tickets hand off to /clean-code-refactor after Step 1. If the digested ticket is a refactor (label = refactor, or the description's core ask is "rework X to shape Y" with no behavior change), invoke /clean-code-refactor once Step 1 is complete. That skill's Assess → Plan → Execute loop replaces Steps 2–5 here; this skill retains Step 1 (status + digest) and Step 6 (post-merge cleanup).
If the user invokes this on something trivial, say so and ask before continuing.
Why kata, not Linear comments
Linear is the golden source of truth for issues. Intra-task chatter — plan items, red-phase tasks, implementation steps, roborev findings, PR-review follow-ups — does not belong there. Linear MCP round-trips dominated turn latency on the old flow.
kata (local-first SQLite issue tracker) is the per-ticket task queue:
- Tasks scoped by a
cha-NNNlabel sourced from the Linear ticket identifier. - Task kind expressed via additional labels:
red-test,impl,orch:run-cleanup,orch:open-pr,orch:spawn-review. Source markers on late-arriving findings:roborev,review-pr,cleanup-pass,agent-discovered. - Workflow encoded as a kata
--blocked-bygraph at Step 2; the drain consumer at Step 5 just respects it. - Roborev /
/review-pr/ cleanup-pass enqueuers all auto-approve their findings (--label approved) and dynamically extend in-flightorch:*tasks'--blocked-byso PR open waits on inbound work.
Linear writes stay minimal: state="In Progress" plus a "Picked up by <hostname>" comment at the start (Step 1), a plan-visualization comment at the Step-3 approval gate, and state="In Review" + PR URL when the orch:open-pr task runs. Everything else is local.
Methodology rules (apply throughout)
Reasoning effort
Run Step 1 (investigate / digest the ticket) and Step 2 (plan — emit the kata task graph) at xhigh reasoning effort, every time — regardless of the session's default. These two phases fix the mechanism-bound contract the rest of the workflow drains blind: once tasks are approved, red-tests, implementation, cleanup, and PR open execute against the graph without re-deriving intent, so the upfront reasoning budget is where it pays off. The /plan-reviewer iteration (still Step 2) runs at xhigh too. The autonomous drain (Steps 4–6) and routine kata bookkeeping run at the session default.
Mechanism-bound plans
Every implementation kata task must name symbols/files to change AND symbols the new code path must invoke. Goal-only tasks get rejected by /plan-reviewer. The rule prevents silent substitution of one mechanism for another at implementation time.
Three valid responses
When you find a problem (plan gap, test infeasibility, drain blocker, perf regression), the only valid responses are:
- Execute — propose / apply the concrete fix.
- Clarify — ask for missing context before proceeding.
- Challenge — push back on the premise if it's structurally wrong.
There is no fourth option of silently substituting an alternative and writing a commit message that paints the substitution as the spec'd work.
Conventional commits
Format: <type>(<scope>): <description>. Types: feat, fix, refactor, perf, test, docs, build, chore. Scopes are defined in linear/labels.toml (agent, lifecycle, query, proto, …) — omit when a change spans multiple areas. Description: lowercase, imperative mood, no period, under 72 chars. Footer: CHA-XX reference required.
Commit scope: one commit = one logical change. A single kata task may close with many commits (kata close --commit is repeatable) when one logical change naturally splits — e.g. substantive change + a follow-up chore: cargo fmt fixup. (style is not an allowed commit type — the commit-msg hook rejects it; use chore for fmt fixups. scripts/check_commit_msg.py validates the scope against the section names in linear/labels.toml, which are bounded contexts, not crate names — code in crates/penca-datafusion commits under query/schema/sql, never datafusion. Omit the scope entirely when a change spans areas. A rejected commit message aborts the commit, so a kata close --commit $(git rev-parse HEAD) chained after it records the previous SHA.)
Read the conventions up front
Read docs/style-guide.md, docs/development-methodology-guide.md, and .claude/skills/code-comments/SKILL.md in full at the start of this skill — they are required inputs for every planning, implementation, and commit step, loaded preemptively (not on demand). docs/algorithms.md and README.md stay on demand within the relevant step.
code-comments/SKILL.md is the commenting standard every comment you write is measured against — comment WHY not WHAT, and default to not writing a comment. It is loaded here as proactive implementer guidance so comments are good the first time; it is deliberately not an orch:run-cleanup pass and is never auto-invoked by the drain (unlike /clean-code-refactor and /tracing-instrument). The point is that knowing the standard up front means no comment-cleanup pass is ever needed.
kata invocation shape
Cheat sheet for the kata calls this skill makes:
-
kata create --label cha-NNN --label plan-draft --label <kind> [--label <source>] --priority N [--blocked-by <ref>] -- "<title>"— create a task.<kind>is one ofred-test,impl,orch:run-cleanup,orch:open-pr,orch:spawn-review.<source>(optional) marks late-arriving findings:roborev,review-pr,cleanup-pass,agent-discovered. Priority is 0..4 with 0 = highest (direct numeric pass-through from Linear: Urgent=1 → kata 1, None=0 → kata 0). -
--jsonshapes differ per subcommand — this is the single biggest footgun in this skill. Every row below was verified by running the installed CLI on throwaway tasks (2026-07-29). Verify this way, not by reading kata's source:kata versionreportsdevwith an unknown commit, so the installed binary is not necessarily the tagged release in the module cache — a source-read ofListIssues/ReadyIssuessuggests repeated--labelAND-intersects, and the running binary demonstrably does not.subcommand wrapper qualified_idlabelskata list --json{kata_api_version, issues: [...]}✅ penca#9y1b✅ ["approved", …](plain strings)kata ready --json{kata_api_version, issues: [...]}❌ null ❌ null kata create --json{kata_api_version, issue: {...}, event, changed}❌ absent (use .issue.short_id)— kata show --json{kata_api_version, issue, labels, links, comments}under .issue✅ but as objects — .labels[].labelConsequences you must code around: a
jq 'select(.labels | index("approved"))'post-filter onkata readyoutput evaluatesnull | index(...)→ null and silently drops every row, so the drain looks empty when work is ready. And.issues[0].qualified_idoffready(or.qualified_idoffcreate) yields empty, silently breaking any downstreamkata claim/--blocked-bywiring. Build refs aspenca#<short_id>from.issue.short_id(create) or.issues[].short_id(ready). -
kata list --label cha-NNN --label approved --json— read the approved set. Use.issues[]in jq. Repeated--labelflags do NOT AND-intersect (the second--labelis silently dropped, despite--helpclaiming "repeatable, AND logic"), so always confirm the second label client-side:jq '.issues[] | select(.labels | index("approved"))'. This works here becauselistis the one query that returnslabels. -
kata ready --unowned --label cha-NNN --json— surfaces tasks that are not blocked and not claimed. It cannot filter onapproved(nolabelsin its output, and the second--labelis dropped anyway), so intersect the two queries rather than post-filteringready:# approved set (labels only exist on `list`) ∩ ready set (blockers/ownership only known to `ready`) comm -12 \ <(kata list --label cha-NNN --json | jq -r '.issues[] | select(.labels | index("approved")) | .short_id' | sort) \ <(kata ready --unowned --label cha-NNN --json | jq -r '.issues[]?.short_id' | sort)Skipping the intersection breaks the Step-3 gate in one of two ways: post-filtering
readyon.labelssurfaces nothing, and not filtering at all surfaces unapprovedplan-drafttasks. The human-readablekata ready --label cha-NNN(no--json) is reliable when you just need to eyeball what's ready — the--jsonshape is the unreliable part, not the readiness computation. -
kata claim <ref>— atomic claim. If a previous loop tick abandoned a claim (session restart, crash),kata claim --force <ref>is the recovery path (kata has no TTL-based auto-release). -
kata close <ref> --done --commit <sha> --message "<text>"— close the task.--donerequires both a--message(≥40 chars after normalization, describing scope + how it was verified) and typed evidence.--commit <sha>is the evidence for code tasks (repeatable). Orchestration tasks produce no commit but still need evidence — use--reviewed <path>(cleanup walk, repeatable),--pr <url>and/or--test "just check"(PR open).--donewith neither message nor evidence is rejected mid-drain. (--wontfixis the opposite — it rejects evidence; close challenged/duplicate findings with--wontfix --message "<justification>".) -
kata edit <ref> --blocked-by <other-ref>— additive, repeatable. The dynamic-blocker mechanism — roborev //review-pr/ cleanup-pass enqueuers all extend in-flightorch:*tasks via this call. -
kata create --idempotency-key <key> -- ...— idempotent create. Re-running with the same key + identical content is a no-op (changed:false). Re-running with the same key + different content errors withidempotency_mismatch; the caller must use stable content per key (the roborev hook does —<short-sha>:<finding-index>is content-stable per review). -
Issue refs are
<project>#<short_id>(e.g.penca#p6yp) — the canonical form, and what TUI shows.kataalso accepts ULIDs and numeric ids, but a bare numeric id is rejected by--blocked-byand friends ("…looks like a legacy issue number; use a short_id"). Onlykata list --jsonemitsqualified_iddirectly; everywhere else assemble it fromshort_idper the shape table above. -
kata edit <ref> --body "$(cat /tmp/body.md)"—kata edithas no--body-file/--body-stdin; those arekata create-only flags. -
kata delete --force --confirm "DELETE <qualified_id>"— the help text says"DELETE <short_id>"but the daemon checks against<qualified_id>(DELETE penca#p6yp). Same shape forkata purge --confirm "PURGE <qualified_id>".
Step 1: Mark In Progress, pull main, and digest the ticket
First action, before anything else: move the ticket to "In Progress" via the Linear MCP tool with id="$ARGUMENTS" and state="In Progress". This signals to the rest of the team that work has started and prevents another contributor from picking up the same ticket. Do this even before reading the description — if the ticket turns out to be trivial / not skill-appropriate, you can move it back, but the cost of an accidental status flip is far lower than the cost of duplicated work.
Immediately after the status flip, run hostname -f and post a comment on the ticket via the Linear MCP save_comment tool with issueId="$ARGUMENTS" and body="Picked up by <hostname>" (substitute the actual hostname -f output). This records which VM/agent claimed the ticket, so a human can find the running session.
Then, pull main to ensure that the local code checkout is up to date.
Aside from the plan-visualization comment at the Step-3 gate, these are the only Linear writes until the orch:open-pr task runs in Step 5.
Then fetch the full ticket:
Use the Linear MCP `get_issue` tool with id="$ARGUMENTS" and includeRelations=true.
Use the Linear MCP `list_comments` tool with issueId="$ARGUMENTS".
Read:
- Title, description, acceptance criteria
blockedBy— confirm every blocker is closed; if not, stop and tell the userrelatedTo— read related ticket descriptions if they're load-bearing for the design- Comments — prior design discussion lives there
If the description points at PRs, ADRs, or code paths, read those too.
Then grep the codebase for the ticket id (e.g. rg -n 'CHA-XX' from the repo root). Past contributors leave durable hints in source as FIXME(CHA-XX), TODO(CHA-XX), ADR back-references, test xfails, and commit-message footers. Read every hit before drafting the plan — these often name the exact symbols/files the new code path must touch.
Graph context — bounded neighborhood traversal + cross-reference verification
A single-ticket digest misses where the ticket sits in the broader Linear graph — and that context is what lets you scope and plan the ticket well, not merely catch errors. Knowing it's the v1 of a planned v2, that a sibling is already building a piece of it, or that it's gated on an in-flight enabler should shape where you draw the ticket's boundary, what you build now versus defer, and how you sequence the work. The same traversal also surfaces the highest-value plan-time objections (a sibling already built this; a cited reference is stale) that otherwise only land at the human review gate. The agent already has MCP read access to the whole graph; the gap is process, not access. So before drafting the plan, traverse a bounded neighborhood — 1–2 hops only — gather that context, and verify the ticket's own cross-references against the live graph.
Traverse from the target ticket over:
blockedBy/blocks/relatedTo/parent+children/ epic — already present in theget_issue ... includeRelations=truepayload fetched above.- Every
CHA-NNNmentioned in the ticket body — descriptions cite siblings in prose, not only via typed relations. Extract them withrg -o 'CHA-[0-9]+'over the description and dedupe against the relation set.
For each neighbor, fetch its current title / status / scope via the Linear MCP get_issue tool — the live record, not the target ticket's paraphrase of it. These are reads; they do not add to the skill's Linear-write budget.
Then:
- Verify the ticket's own cross-references against live state. For each
CHA-NNNthe ticket asserts something about, confirm the claim matches that neighbor's actual current scope/status. A contradicted or stale reference — e.g. a ticket citing "CHA-385's row_uuid index" when the index work is actually CHA-412 and CHA-385 is unrelated identity rework (the motivating CHA-406 case) — is flagged, never silently propagated. - Record the result as the
## Graph contextsection emitted in Step 2 (see below).
Scope guardrail (load-bearing). This context shapes how you scope the ticket's own intent (boundary, build-vs-defer, sequencing) and lets you verify its cross-references — but it is never license to expand scope onto neighbor work. More graph context is the primary scope-creep vector, so counter it explicitly: neighbor work becomes a plan note or a follow-up ticket, and is never folded into this PR. Keep the traversal to the ~1–2 hop neighborhood; do not load the whole graph (noise, attention dilution, and the same scope-creep risk), and do not stand up a searchable-Linear mirror — that is a separate, deferred idea.
No Linear comments are read or written during the rest of the flow. Teammate edits made after Step 1 are surfaced when the In-Review write fires inside the orch:open-pr task.
Step 2: Emit the workflow as a kata task graph
Resume guard — skip emit if the graph already exists
Re-invoking /do-issue $ARGUMENTS is the resume path; there is no separate --resume flag. First check whether a prior invocation already emitted this ticket's graph:
existing=$(kata list --label cha-NNN --json | jq '.issues | length')
If existing > 0, the graph is already in kata. Skip the rest of Step 2 and proceed to Step 3. Print the existing task set (kata list --label cha-NNN --json | jq -r '.issues[] | "\(.qualified_id) [\(.labels | join(","))] \(.title)"') so the user can confirm what's there before the gate check. Re-emitting on top would either produce idempotency-mismatch errors (different body) or silent no-ops (identical body) — neither is the right resume behavior.
Domain-specific pre-plan audits — fires when relevant
Some Penca domains have spec-undocumented behaviors that bite plans repeatedly if not audited up front.
Flight SQL — driver wire-action audit
Fires when the ticket changes any of:
crates/penca-sql-server/src/flight_sql/or anything itsdo_*/do_action_*handlers call into (dml.rs,set.rs,tx.rs,session.rs).- A user-visible JDBC / ODBC / ADBC behavior — error wording, returned schema, transaction semantics, prepared-statement metadata.
- A
SchemaProvider/CatalogProvider/TableProvidermethod that DataFusion's planner consults during SQL planning.
Required before drafting kata tasks — and the mapping must be cited, not asserted. For each user-level driver call the ticket affects (Statement.execute("CREATE TABLE …"), cursor.execute(SELECT …), cursor.execute_update(…), PreparedStatement.executeQuery(…), etc.), open the driver source and write down the exact Flight SQL action sequence it invokes, with a file:symbol/file:line citation of the source you actually read for each driver. A mapping with no citation is a guess; guesses are what this audit exists to stop.
- ADBC — the Python
adbc_driver_managerDB-API layer decides prepare-vs-not before the Go/Cadbc-driver-flightsqlever runs:dbapi.py::Cursor._prepare_executecallsself._stmt.prepare()unconditionally (it only skips onNotSupportedError, which the Flight SQL driver does not raise). Socursor.execute(SELECT)— whichPencaClient.execute_queryuses — takes the prepared path (ActionCreatePreparedStatement→get_flight_info_prepared_statement→DoGet(CommandPreparedStatementQuery)), even for a bare no-param SELECT. Only the low-levelstmt.execute_updatepath (PencaClient.execute_update) skips prepare →DoPutStatementUpdate. Source: installedadbc_driver_manager/dbapi.py; repopackages/penca-client/src/penca_client/client.py. Upstream: https://github.com/apache/arrow-adbc. - JDBC — Apache
flight-sql-jdbc-driver(Java). A plainStatement.execute(SELECT)→CommandStatementQuery→get_flight_info_statement; thePreparedStatement/ DML path →ActionCreatePreparedStatement. Underjava/flight/flight-sql-jdbc-driver/in https://github.com/apache/arrow. - ODBC — whichever bridge applies.
The trap to internalize (CHA-355): for the same SELECT, ADBC lands on the CommandPreparedStatementQuery DoGet arm while JDBC lands on the CommandStatementQuery arm — the two query paths do not converge on one server handler. A plan that wires behavior onto only one DoGet/GetFlightInfo arm silently excludes one driver.
Map each action to the corresponding server entry-point handler in crates/penca-sql-server/src/flight_sql/service.rs. Record the cited per-driver mapping (query and update paths) in the body of one planning kata task (the one that owns the cross-driver helper). If the entry-points diverge, the plan must include a task that introduces a shared helper called from every entry-point (or wires every divergent arm), plus at least one driver-parametrized acceptance test. See .claude/memory/feedback_flight_sql_driver_parity.md.
Emit the task graph
The workflow is five layers of kata tasks, with the dependency chain expressed via --blocked-by. All emitted as --label plan-draft for Step 3 review.
Layer 1 — red-test tasks (--label red-test). One per acceptance criterion / test that must fail before implementation begins. No --blocked-by; these are the entry point of the graph. Body must name:
- The test file path(s) (
tests/integration/...). - The test invocation filter used to validate auto-close (
just integration-test --test-arg <filter>) — the loop runs only the scoped tests to validate, not the full suite. - The expected failure mode (which assertion fires; what error class). This is what auto-close validation checks for.
Layer 2 — implementation tasks (--label impl). One per commit-sized change. Each --blocked-by the red-test task it satisfies. Body names:
- Symbols/files to change.
- Symbols the new code path must invoke (the mechanism-bound rule).
- Mechanism non-goals when relevant.
- Which red-test task the change satisfies.
Layer 3 — orch:run-cleanup (single task, --label orch:run-cleanup, priority 4). --blocked-by every Layer 2 task. Body:
Invoke
/clean-code-refactor --in-cleanup-context cha-NNNand/tracing-instrument --in-cleanup-context cha-NNN. Scope = touched files (git diff --name-only $(git merge-base origin/main HEAD)..HEAD), read in full. Each cleanup-pass skill runs its Phase-1 walk and/plan-reviewergate, then auto-flipsplan-draft→approvedon the candidate tasks it emitted (no human TUI step). Phase-2 drain is the outer/do-issueloop's job — this orchestration task closes once both walks have emitted their (possibly empty) candidate sets and extended this task's downstreamorch:open-prblocker chain.
Layer 4 — orch:open-pr (single task, --label orch:open-pr, priority 4). --blocked-by Layer 3. Body:
Run
just check; must exit 0.gh pr create --base main --title "CHA-XX | <short>"using the PR body template (see Step 5). Linear MCPsave_issuewithstate="In Review"andlinks=[{url, title}]— the last Linear write of the flow.
Layer 5 — orch:spawn-review (single task, --label orch:spawn-review, priority 4). --blocked-by Layer 4. Body:
Spawn an Opus subagent with fresh context to run
/review-pr <PR#>at xhigh thinking budget. The subagent enqueues its findings with--label approved --label review-prand does NOT extend any orch task. The Step-5 dispatch closes this task, drains the findings, then — if any findings were enqueued — creates a neworch:spawn-reviewtask--blocked-byevery finding. The loop iteratively re-reviews after each fix wave until a subagent run returns zero new findings; the PR is then ready for human merge.
Each task body includes the standard mechanism-bound fields where relevant.
For tickets that cross bounded contexts or introduce a new RPC/microservice, invoke /software-architect to produce a design framing before emitting tasks.
Map priority through from Linear: Linear-Urgent (1) → kata 1, Linear-High (2) → kata 2, etc. Linear-None (0) is rare; map to kata 4 (lowest). Orchestration tasks always priority 4 — the drain consumer breaks priority ties in favor of red-tests, impl, and findings before orchestration.
The ## Graph context plan section
Alongside the task graph, the plan carries a ## Graph context section built from the Step-1 neighborhood traversal. It names:
- Roadmap position — is this the v1 of a planned v2? What does it enable, and what does it block?
- Already built vs in-flight — what in the neighborhood is done or under review, so the plan does not rebuild a sibling's work.
- Stale / contradicted cross-references — any reference the live graph contradicts, optionally corrected in place or spun into a follow-up ticket (never silently propagated).
When a neighbor already covers a piece of the work, the relevant kata task body carries a one-line neighbor note — e.g. > Neighbor note: CHA-412 (In Review) already builds the cold-tier index — position only, do not rebuild. That note is the per-task expression of the Step-1 scope guardrail: the neighborhood positions the work, it does not enlarge it.
/plan-reviewer gate — mandatory for correctness-invariant plans
After all tasks are emitted but before flipping any task out of plan-draft, invoke /plan-reviewer. It reads the task set with kata list --label cha-NNN --label plan-draft --json + kata show <ref> --json per task and audits:
- Mechanism-bound rule per implementation task.
- Dependency-graph sanity: no cycles, every Layer-2 task
--blocked-byat least one Layer-1 task, Layers 3/4/5 chained in order,orch:run-cleanupblocked-by every Layer-2 task. - Domain-specific invariants (Flight SQL audit, multi-step SQL ordering, watermark/clamp/grace invariants, advisory locks).
Address every REVISE item via kata edit <ref> --body "$(cat <body-file>)" (kata edit has no --body-file/--body-stdin — those are kata create-only flags), then re-invoke; iterate until APPROVED. If you reach a fourth iteration without convergence, halt and surface the unresolved item to the user.
For purely mechanical tickets (single function rename, one-line config tweak, doc-only edit with no behavioral effect), /plan-reviewer is optional.
Step 3: STOP — plan approval
Resume guard — skip the gate if the plan is already approved
plan_draft=$(kata list --label cha-NNN --label plan-draft --json | jq '.issues | length')
approved=$(kata list --label cha-NNN --label approved --json | jq '.issues | length')
If plan_draft == 0 and approved > 0, the user already approved on a prior invocation. Skip the gate and proceed to Step 4. Print the approved count so the user has visibility, then move on without asking.
The gate (first-time invocation)
This is the only human gate in the workflow. Do not proceed past this gate without the user flipping plan-draft → approved on every task in the graph (all five layers).
Surface the plan as an HTML visualization
Before prompting for approval, generate a visual of the emitted graph and post it to the Linear ticket, so the approver can review the DAG + task summaries at a glance instead of reading kata tui / raw task bodies:
- Generate — run the committed generator over the ticket's slug:
It is pure-stdlib and deterministic (same kata state → byte-identical HTML): a Mermaid blocked-by DAG color-coded by layer (red-test → impl → orch) plus per-task cards.python3 .claude/skills/do-issue/kata_plan_html.py cha-NNN -o /tmp/cha-NNN_plan.html - Upload — Linear MCP
prepare_attachment_upload→ signedPUTto GCS (send the returned signed headers verbatim, 60s expiry) → keep the returnedassetUrl. Do not useattachmentCreate: API-created attachment entities do not render in the Linear issue UI — the reliable surface is a markdown link in a comment (Linear re-signs the asset URL on view). - Surface — Linear MCP
save_commentposting a markdown link to the asset, e.g.📊 [plan-visualization](<assetUrl>). - Resume — on re-invocation, find the prior plan-visualization comment and update it in place (one comment, edited via
save_commentwith the existing comment id) rather than posting a new one — per the self-sufficient-resume-comment convention.
Plan visualization is a standard part of the gate, not an optional nicety. The generator is pure-stdlib and deterministic and the upload path is well-trodden, so it should never fail in normal operation. If generation or upload does fail, do not silently fall back and proceed — flag it loudly: surface the exact error to the user as a prominent, blocking failure and fix the visualizer, because a broken plan visualization is a defect, not a step to skip. (kata tui is the human's raw view of the plan only while that failure is being investigated.)
Surface the ## Graph context section (from Step 1's neighborhood traversal) in the plan-visualization comment body and in the plan summary you present at the gate, so the approver sees the roadmap position and any flagged stale cross-references at a glance without opening each task. This rides the existing Step-3 plan-visualization comment — it is not a new Linear-write category.
Tell the user the task set is ready and point them at kata tui (and the plan-visualization comment) to review. Approval is mechanism-bound: the user removes the plan-draft label and adds approved to each task they're keeping. Edits and deletions happen in the TUI before that. The drain consumer in Step 5 gates on --label approved; nothing flagged plan-draft will surface.
Or offer to flip them all in one shot. After printing the TUI approval flow, also ask: "or I can approve all tasks for you now — say the word." If the user takes that path, iterate the plan-draft set and swap the label on each:
kata list --label cha-NNN --label plan-draft --json | jq -r '.issues[].qualified_id' | while read ref; do
kata label rm "$ref" plan-draft
kata label add "$ref" approved
done
The gate is unchanged — implementation only proceeds once tasks carry approved; whether the user did that themselves or asked the agent to do it doesn't matter.
Confirm the approval count:
kata list --label cha-NNN --label approved --json | jq '.issues | length'
The count should equal the layer-1-through-5 task count emitted at Step 2.
If the user wants to discuss before approving, do that — but no implementation step starts until at least one task carries the approved label.
Step 4: Create the branch
Use the Linear-generated branch name from the ticket payload (the gitBranchName field returned by get_issue). The checkout is resume-safe — branch reuse is the right call when the loop dropped out and came back:
BRANCH="nhobin219/cha-NN-description"
if git rev-parse --verify "$BRANCH" >/dev/null 2>&1; then
git checkout "$BRANCH"
else
git checkout -b "$BRANCH"
fi
If git status is dirty before either checkout, stop and surface it — unexpected uncommitted state on a fresh VM means something is off, and on a resume run it means a prior tick left work mid-flight that the agent shouldn't blindly clobber.
Step 5: Drain — the /loop consumer (runs until PR merge)
From here to PR merge, the workflow runs as a /loop drain with no human gates. The loop processes whatever kata ready --unowned --label cha-NNN --label approved surfaces and dispatches by task kind. Roborev / cleanup-pass / /review-pr findings auto-approve as they arrive and join the queue. Orchestration tasks unblock in sequence — orch:run-cleanup after all Layer-2 tasks close, orch:open-pr after orch:run-cleanup, orch:spawn-review after orch:open-pr. The loop exits when the queue is empty, roborev is quiet, and gh pr view --json state reports MERGED.
Start the loop
Invoke /loop with no interval (self-paced via ScheduleWakeup) and a prompt that runs the drain step below. Document for the user: the loop is session-bound — if Claude Code closes mid-ticket, the loop dies and they re-invoke /do-issue $ARGUMENTS to resume. The drain consumer is idempotent — it picks up wherever the kata graph left off.
Drain step — what each loop tick does
A single tick processes as many ready tasks as it can in one model invocation, then schedules the next wakeup based on what we're waiting on.
# Inner loop within one tick — process while there's ready work.
while true; do
# `ready` knows blockers/ownership but carries no labels; `list` carries labels
# but not readiness. Intersect them — see the --json shape table in the cheat sheet.
short=$(comm -12 \
<(kata list --label cha-NNN --json | jq -r '.issues[] | select(.labels | index("approved")) | .short_id' | sort) \
<(kata ready --unowned --label cha-NNN --json | jq -r '.issues[]?.short_id' | sort) \
| head -1)
[ -z "$short" ] && break
ref="penca#$short"
kata claim "$ref"
# ... dispatch on task kind (see below) ...
done
# Nothing ready right now. Pick next wakeup cadence.
#
# Tight (~10s): anything could still enqueue work — roborev review in
# flight, any orch:* task still open (cleanup-pass walks or the review
# subagent may still enqueue findings), or no PR open yet.
# Long (~45s): PR is open, no roborev in flight, no open orch:* tasks —
# the only state change that matters is the human merging the PR.
# Exit: PR merged — proceed to Step 6.
pr_state=$(gh pr view --json state -q .state 2>/dev/null || echo "NOT_OPEN")
[ "$pr_state" = "MERGED" ] && exit # Workflow complete.
# Parse the COUNTS off the Jobs line. A bare `grep -qE 'queued|running'` is always
# true: the header reads "Daemon: running" and the Jobs line spells out both words
# even at "0 queued, 0 running" — a wait-loop built on it never terminates.
# No `Jobs:` line at all means the daemon is down or unreachable ("Daemon not
# running…"), which is NOT idle — report `unknown` so the sweep blocks instead of
# declaring itself clean without ever having queried a queue. `unknown` groups
# with busy below: it keeps the loop alive on the tight cadence (a daemon restart
# resolves itself) and never lets the drain reach "ready for merge" on an
# uncertified sweep. Do NOT turn it into a bare `exit` — a tick that ends with no
# ScheduleWakeup and no stop just dies, stalling the ticket while looking idle.
# If it stays `unknown` across several ticks the daemon is genuinely down: say so
# via SendUserMessage (plain text between tool calls does not render mid-loop —
# see .claude/memory/feedback_send_user_message_mid_loop.md) and stop the loop
# deliberately with ScheduleWakeup(stop: true).
roborev_busy=$(roborev status 2>&1 \
| awk '/^Jobs:/ { print ($2 + $4 > 0) ? 1 : 0; found=1 } END { if (!found) print "unknown" }')
open_orch=$(kata list --label cha-NNN --status open --json 2>/dev/null \
| jq '[.issues[]? | .labels[] | select(startswith("orch:"))] | length')
if [ "$roborev_busy" = "unknown" ] || [ "$roborev_busy" = "1" ] \
|| [ "$open_orch" -gt 0 ] || [ "$pr_state" = "NOT_OPEN" ]; then
exit # ScheduleWakeup ~10s — work could appear soon.
else
exit # ScheduleWakeup ~45s — waiting on human merge.
fi
Cache-TTL note: both cadences stay well under the 5-minute prompt-cache window, so every tick rides a warm cache regardless of which branch fires. Don't widen the long-wait cadence past ~270s without a reason — you'd pay a cache miss for no benefit (the only state change you're polling for is the human merge, and 45s vs. 270s isn't materially different for a hour-scale event but is materially worse for cache).
Dispatch by task kind
For the claimed <ref>, read its labels via kata show <ref> --json | jq -r '.labels[]' and dispatch:
red-test — auto-close after self-verification:
- Write the failing tests per the task body (typically
tests/integration/...). - Run the scoped test command from the body (
just integration-test --test-arg <filter>). - Self-verify: each new test must FAIL (exit non-zero) AND the failure message must match the task's expected failure mode — not a compile error, not a runtime error in unrelated code. If the body lists multiple tests, every one must fail correctly.
- Commit:
test(scope): add acceptance tests for <ticket title>, footerCHA-XX. kata close <ref> --done --commit <sha> --message "<≥40 chars: scope + verification>". Implementation tasks blocked-by this red-test unblock.
If self-verification fails (test errored instead of failing for the right reason, or didn't fail at all), kata claim --force <ref> release is not the answer — leave the task claimed, post a brief diagnostic via kata comment <ref> --body "<what failed>", and exit the tick. The user surfaces it via kata tui or in the next session.
impl — implement, commit, close:
- Read the task body's symbols/files + invocation list.
- Implement. Inner-loop TDD in
tests/tdd/(gitignored, run viajust tdd) until green.tests/tdd/is wiped beforeorch:run-cleanupruns — it's a dev tool, not a deliverable. Comment to thecode-commentsstandard as you write: WHY not WHAT, default to no comment,TODO(CHA-NNN)never bare — good comments now mean no comment-cleanup later. - Re-run the scoped integration test from the satisfied red-test's body and confirm it flips green.
- Commit:
<type>(<scope>): <description>, footerCHA-XX. kata close <ref> --done --commit <sha> --message "<≥40 chars: scope + verification>".
Each commit triggers the post-commit hook → roborev post-commit → async review → on completion, scripts/roborev-kata-hook.sh enqueues findings with --label approved and extends every in-flight orch:* task's --blocked-by to include the new findings. Findings drain via priority (severity-mapped: critical/high → 1, medium → 2, low → 3) before orchestration tasks (priority 4). review_min_severity = 'medium' (set by just init-agent-tools) means Lows never reach the queue.
Consolidate before draining a backlog of findings. Reviews are per-commit and isolated: roborev sees one diff, with no memory of earlier reviews and no view of the current tree. So a nit raised against commit 1 is re-raised against commits 2 and 3 for code that never changed, and a finding a later commit already fixed stays open. Both are queue volume that no diff will ever retire.
When more than ~3 roborev findings are open at once, run the consolidation pass before working any of them:
roborev compact --wait # verifies open findings against the CURRENT tree,
# merges duplicates, closes the superseded originals
Then re-read the queue — findings whose roborev jobs compact closed should be closed in kata too (kata close <ref> --wontfix --message "superseded by roborev compact: <reason>"). Working the list before consolidating means implementing the same finding two or three times and fixing things already fixed.
When the finding rate is the problem, fix the calibration, not the findings. If a whole class of finding keeps arriving and keeps getting closed --wontfix, that is a guidelines gap, not a work queue. Run roborev insights (it mines review history for "noise candidates" — findings consistently dismissed without a code change), fold the result into scripts/roborev-review-guidelines.md, and re-apply with just init-agent-tools. Do this at orch:run-cleanup time, not mid-drain.
orch:run-cleanup — invoke cleanup-pass skills, close:
- Compute the touched-files scope:
git diff --name-only $(git merge-base origin/main HEAD)..HEAD. - Invoke
/clean-code-refactorwith--in-cleanup-context cha-NNNand the touched-files scope. The skill walks, emits candidate tasks (--label approved --label cleanup-pass), runs its/plan-reviewergate, auto-flips labels, and returns. Each new task extendsorch:open-pr's--blocked-by. - Invoke
/tracing-instrumentwith the same flag and scope. Same flow. kata close <ref> --done --reviewed <touched paths> --message "<≥40 chars: cleanup scope + outcome>"(orch task, no commit —--reviewedis the evidence).
Why touched files (not just diff) for both cleanup passes: a diff can change the boundary map without editing the boundary callsite. A new wrapper fn can demote a previously-public fn to an internal helper (its existing #[instrument] is now double-span noise); the symmetric case promotes a previously-internal helper to the boundary via a new caller path. Diff-only walks miss both flips. For refactor candidates, the touched-files window is what lets the walk spot extract-helper opportunities where a new function shares logic with an existing one in the same file. /plan-reviewer drops candidates that aren't related to the boundary / extract-helper shift the way it drops any out-of-scope candidate.
orch:open-pr — gate, open PR, Linear In Review, close:
- Run
just check. Must exit 0. If it fails:- fmt diff →
cargo fmt --all, commit aschore: cargo fmt(styleis not an allowed commit type). - clippy / cargo check error → fix the underlying issue (no
#[allow]without justification); commit asfix:or amend. - ruff / ty / blank-lines → analogous on the Python side.
Re-run
just checkuntil green.
- fmt diff →
gh pr create --base main --title "CHA-XX | <short description>"with body:
## Summary
<one or two bullets on what changed and why>
## Acceptance
<list of integration tests added during the red-test drain; reviewer checks they are now green — or, for doc-only tickets, the baseline/post-edit grep counts>
Closes CHA-XX
Include Closes CHA-XX so merge auto-transitions the Linear issue.
- Linear MCP
save_issuewithstate="In Review"andlinks=[{url: "<PR URL>", title: "PR #<n>"}]. The last Linear write of the entire flow. kata close <ref> --done --pr <url> --test "just check" --message "<≥40 chars: PR opened + gate result>"(orch task, no commit —--pr/--testare the evidence).
orch:spawn-review — spawn the review subagent, close current task, possibly re-arm the loop:
- Snapshot the open review-pr finding set before spawning, so step 4 can tell which findings are new:
pre_findings=$(kata list --label cha-NNN --status open --json \ | jq -r '.issues[] | select(.labels | index("review-pr")) | .qualified_id' | sort) - Spawn via the
Agenttool with:subagent_type="general-purpose"model="opus"(current Opus 4.7)- prompt instructing the subagent to run
/review-pr <PR#>at xhigh thinking budget and to read the PR diff + Linear ticket itself rather than inherit the main session's framing. Tell the subagent NOT to extend anyorch:*task's--blocked-by— this dispatch step owns the loop-arming decision; the subagent only enqueues findings undercha-NNNwith--label approved --label review-pr.
- Close the current
orch:spawn-reviewwithkata close <ref> --done --pr <url> --message "<≥40 chars: review round + new-finding count>"— regardless of whether new findings landed (orch task, no commit —--pris the evidence). Each round's task is single-shot. - Diff the finding set to identify what the just-completed subagent added:
post_findings=$(kata list --label cha-NNN --status open --json \ | jq -r '.issues[] | select(.labels | index("review-pr")) | .qualified_id' | sort) new_findings=$(comm -13 <(echo "$pre_findings") <(echo "$post_findings")) n=$(echo "$new_findings" | grep -c .) - Arm the next round if and only if
n > 0:if [ "$n" -gt 0 ]; then round=$(kata list --label cha-NNN --label orch:spawn-review --json \ | jq '.issues | length') # how many spawn-review tasks ever existed under this slug next="penca#$(kata create --label cha-NNN --label approved --label orch:spawn-review \ --priority 4 --json -- "orch:spawn-review (round $((round + 1))) — re-review after findings close" \ | jq -r '.issue.short_id')" # `create --json` has NO .qualified_id — see the shape table echo "$new_findings" | while read f; do [ -n "$f" ] && kata edit "$next" --blocked-by "$f" >/dev/null done fi- Round-numbered title (
round 2,round 3, …) keeps the iteration visible inkata tui. - The new task is blocked-by every finding from this round; the drain claims+processes findings first (as impl-like tasks), then unblocks+claims the new
orch:spawn-review, spawning another subagent for a fresh-eyes pass on the fixes. - Termination: when a subagent run returns 0 new findings, no new
orch:spawn-reviewis armed. The drain proceeds to "wait for human merge" (long-cadence wakeup). - Final roborev sweep before reporting ready-for-merge. The loop's exit is gated on
MERGED, which the agent never reaches (the human merges — nevergh pr merge), so in practice the loop is stopped by hand at "ready for merge." Roborev reviews lag each commit by seconds-to-minutes, so the last commits (review fixes, the PR-open commit) may still be under review when the queue looks empty. Before declaring ready-for-merge, pollroborev statusuntil the Jobs line reports 0 queued and 0 running (parse the counts — see theroborev_busyawk above; agrepfor the words matches even when idle), then drain the ready∩approved intersection one more time — and checkkata list --label cha-NNN --status openfor findings that landed after a cleanup pass. Use the intersection form from the tick loop above, never a.labelspost-filter onkata readyoutput:ready --jsoncarries nolabels, so the filter silently matches nothing and the sweep looks clean when it isn't. Do not assume quiet from an emptykata ready; verify roborev directly. This same discipline applies to any post-PR commits the human later asks for (merge-conflict resolution, follow-up edits): every commit fires roborev, so re-sweep after them too. See.claude/memory/feedback_poll_roborev_after_any_commits.md.
- Round-numbered title (
The pre/post diff (not the absolute count) is what determines whether to re-arm — a subagent run that surfaces no NEW findings (even if old ones are still open and being drained) doesn't trigger another round. This is the right shape because the open findings are already going to drive a re-review via the existing orch:spawn-review chain: when they close, the LAST-armed orch:spawn-review unblocks and fires.
The project default is no subagents; this invocation is the explicit in-session exception. Fresh-eyes review is the one place fan-out earns its keep — the main session's context is anchored to the design decisions it just made, which is exactly the framing a reviewer needs to be free of. Do not also run /review-pr yourself in the main session.
Source-labeled findings (roborev, review-pr, cleanup-pass, agent-discovered) — triage first, then either implement-commit-close or close --wontfix. Priority drives them ahead of orchestration tasks.
Findings are input to your judgment, not a work queue to execute. Every commit fires roborev, so a fix commit spawns a review of the fix; draining uncritically is how a ticket converges slowly or not at all. Three checks before touching code:
- Is it already superseded? Reviews lag commits — a finding filed against commit N is frequently fixed by commit N+1 before you claim it. Verify the cited line still says what the finding quotes. If it doesn't, close it
--done --commit <superseding-sha>, not--wontfix: the fix landed, so the superseding sha is real evidence and stays queryable in the event log, whereas--wontfixrejects evidence and would bury it in prose. - Was it already adjudicated this drain? Roborev re-reviews every new commit, so a finding you declined can resurface against the fix commit, and a pendulum pair ("this doc is too long" → "this doc dropped the load-bearing fact") can oscillate. Before acting, check the closed set —
kata list --label cha-NNN --status closed --json— for the same claim. Re-raised and still declined: close--wontfixciting the earlier ref.--wontfixis correct here precisely because it rejects typed evidence: no work was done, so there is none to attach, and asserting otherwise would be a false completion record. Check 1's case is the opposite — work did land, so it has evidence and must carry it. Re-raised because your fix overshot: fix it, and say which earlier finding you were answering. - Is it worth doing? Judge the finding on its merits, exactly as you would a human reviewer's comment.
Fix it when it is a correctness or safety issue at any severity; a gate break (fmt, clippy, lint); a factually wrong claim in a comment, doc, or commit message (wrong line reference, retired rationale, invented figure, a doc contradicting the code beside it); a stale reference the live graph disproves; or a cheap consistency fix that makes a rule uniform across siblings.
Close --wontfix when the finding asks for a distinction that does not exist in production (disambiguating callers where only one is reachable); proposes churn whose only benefit is uniformity for its own sake; asks for a test whose cost is disproportionate to what it pins (an integration test needing deliberately corrupted state to induce one log line) — though check first whether a pure function inside the mechanism is trivially unit-testable, which is the case most often missed; re-opens a decision the ticket already settled deliberately; or reverses a change an earlier finding in this same drain explicitly asked for.
The --wontfix message is a review response, not a dismissal — state the reasoning a reviewer would need to disagree with you. "Not worth it" is not a justification; "disambiguates two callers, only one of which has a production caller, and the previous round asked for this text to be unified" is.
Halt and surface instead of deciding when a finding overturns an approved-plan non-goal or a stated design decision. That is a course-changing issue, and the user owns it — do not silently expand scope, and do not silently ship the flaw either. Mechanically: leave the task claimed, record the verdict and what it contradicts via kata comment <ref> --body "<verdict>" — the body goes in the flag, since comment takes the ref as its only positional. Not kata edit --body (replaces rather than appends, destroying the finding text the human needs to read) and not kata edit --comment (a post-mutation hook, rejected without a mutation flag) — then ScheduleWakeup with stop: true to end the drain, and surface the decision with a recommendation. Do NOT release the claim — an unclaimed blocked finding looks like available work to the next tick.
Doc-only tickets
When the ticket touches only Markdown / docs / skill files with no executable surface, substitute a deterministic grep-based acceptance set:
- At Step 2, each
red-testtask body lists N specificrgcommands the rewritten file(s) must satisfy after the edit. Each must currently fail on the unedited file (the red baseline) and pass after. - The loop's
red-testprocessing runs the grep set instead ofjust integration-test. Baseline counts are captured by the body's commands; the matchingimpltask confirms post-edit counts. - Auto-close validation: every grep returns the expected exit / count from the body.
The PR body's ## Acceptance section pastes baseline-vs-post counts.
Optional pre-cleanup advisory passes
Before orch:run-cleanup would unblock (i.e., while Layer-2 tasks are still draining), a focused advisory pass can be useful:
/code-quality-reviewer— structural + type-idiom audit. Run before perf work./perf-engineer— measurement-driven perf analysis./software-architect— design revalidation for tickets that crossed bounded contexts in the plan.
These produce structured findings; address Critical/Important items as new impl tasks (--label cha-NNN --label approved --label impl --label agent-discovered) blocked-by orch:run-cleanup (so cleanup waits on them, not the reverse). For most tickets these are skippable — orch:run-cleanup's /clean-code-refactor walk already covers structural concerns on the diff.
Mid-drain kata tasks (agent-discovered)
If the agent finds work that wasn't in the plan, emit it as kata create --label cha-NNN --label approved --label impl --label agent-discovered --priority N -- "<title>", with --blocked-by set on orch:run-cleanup so the new work blocks PR open. Auto-approve here is the same contract roborev/cleanup-pass/review-pr findings use; agent-discovered is just the source marker.
Late-arriving findings — dynamic blocked-by extension
When scripts/roborev-kata-hook.sh, /review-pr, or a cleanup-pass invocation enqueues a new finding under cha-NNN, it also extends every still-open orch:* task's --blocked-by to include the new finding's qualified-id. The pattern (used by all three enqueuers):
new_finding_ref=$(kata create ... --json | jq -r '.qualified_id')
for orch_label in orch:run-cleanup orch:open-pr orch:spawn-review; do
orch_ref=$(kata list --label cha-NNN --label "$orch_label" --status open --json | jq -r '.issues[0].qualified_id // empty')
[ -n "$orch_ref" ] && kata edit "$orch_ref" --blocked-by "$new_finding_ref"
done
This guarantees PR open waits on all inbound findings — without it, a high-severity roborev finding could land seconds after the PR opens. The roborev hook implements this; the /review-pr skill implements this; the cleanup-pass skills implement this when invoked in in-cleanup-context mode.
Robustness — claim recovery on session restart
If the user closes Claude Code mid-tick and re-invokes /do-issue $ARGUMENTS, the first drain check may find tasks claimed by an absent owner. Recovery: at loop start, run
kata list --label cha-NNN --status open --owned --json | jq -r '.issues[].qualified_id' | while read ref; do
kata claim --force "$ref" 2>/dev/null
# Then decide: did the previous claim leave work in flight? Inspect via git status / git log.
# If a commit exists for this task already, close it. Otherwise re-do the dispatch.
done
In practice, the safer move is to leave any claimed task alone and surface them to the user — the agent can't safely tell whether a prior commit is "for this task" without strong heuristics. Better to leave the human in the loop on resume.
Step 6: Cleanup after merge
After the PR merges (gh pr view --json state -q .state returns MERGED), sync main, drain the local agent-state for this ticket via the just clean-agent-tools recipe, then delete the local branch:
git checkout main
git pull
just clean-agent-tools cha-XX "nhobin219/cha-XX-description"
git branch -d "nhobin219/cha-XX-description"
The recipe closes any roborev jobs left open for the branch and soft-deletes the closed kata tasks under the cha-XX label. Soft-delete preserves the kata event log so kata restore can resurrect any task if a follow-up ticket needs to reference it.
If any cha-NNN tasks remain open after the drain finished (orphaned plan-draft from rejected candidates, abandoned claims), they're skipped by the closed-status filter and surface in kata list --label cha-NNN for ad-hoc triage. Don't bulk-delete the open set — those represent unresolved work and need eyes on them.
The VM itself is disposable; no per-branch teardown beyond the above is needed.
If the ticket revealed a recurring pitfall, the right concept to add to a docs page, or a tool gap, mention it to the user — those are candidates for follow-up Linear tickets, not for sneaking into this PR's scope.
04 同仓库更多 Skills
tracing-instrument
Add structured `tracing`-crate instrumentation (spans + events + fields) to Penca Rust code — one combined plan emitted as kata tasks under `cha-NNN plan-draft` and gated once by `/plan-reviewer`, then one branch carrying every site as its own commit drained from the approved kata queue, gated once by `just check` at PR open. Scope is the `tracing` crate only (logs-as-events + spans); metrics and OpenTelemetry are out of scope. Use for observability tickets, ad-hoc instrumentation passes on a crate, or as the `/do-issue` `orch:run-cleanup` cleanup-context pass.
test
Run the test suite with pytest
software-architect
High-level architecture analysis for Penca design questions — bounded contexts, microservice boundaries, cross-service interfaces, storage tier separations (hot vs cold), CQRS-shaped splits, design-stamina trade-offs, and incremental-replacement strategies. Use when a Linear ticket needs design framing, when an existing plan has a structural concern, or when a proposed change crosses bounded-context boundaries. Advisory — does not edit code.
save-memory
Save or update a memory entry. Always targets the **current repo root's** `.claude/memory/`, resolved via `git rev-parse --show-toplevel`; never the runtime `~/.claude/projects/<slug>/memory/` path.
review-pr
Review a Penca PR against project conventions and architecture
plan-reviewer
Audit a Penca `/do-issue` plan — a set of kata tasks under `cha-NNN plan-draft` — for the mechanism-bound rule + dependency-graph sanity. Use after `/do-issue` Step 2 emits the task set and before the user flips `plan-draft` → `approved`. Checks that every task names symbols/files to change AND symbols the new code path must invoke, has mechanism non-goals where relevant, avoids parallel-path workarounds, and that every implementation task is `--blocked-by` at least one red-test task with no cycles in the graph.