@benzotti/jedi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +615 -0
  2. package/dist/index.js +10514 -0
  3. package/framework/adapters/generic.yaml +23 -0
  4. package/framework/adapters/laravel.yaml +46 -0
  5. package/framework/adapters/nextjs.yaml +36 -0
  6. package/framework/adapters/node.yaml +29 -0
  7. package/framework/agents/jdi-architect.md +118 -0
  8. package/framework/agents/jdi-backend.md +52 -0
  9. package/framework/agents/jdi-codebase-mapper.md +59 -0
  10. package/framework/agents/jdi-committer.md +83 -0
  11. package/framework/agents/jdi-debugger.md +73 -0
  12. package/framework/agents/jdi-devops.md +46 -0
  13. package/framework/agents/jdi-executor.md +89 -0
  14. package/framework/agents/jdi-feedback-learner.md +92 -0
  15. package/framework/agents/jdi-frontend.md +51 -0
  16. package/framework/agents/jdi-head-engineering.md +30 -0
  17. package/framework/agents/jdi-phase-researcher.md +59 -0
  18. package/framework/agents/jdi-plan-checker.md +80 -0
  19. package/framework/agents/jdi-planner.md +140 -0
  20. package/framework/agents/jdi-pr-feedback.md +118 -0
  21. package/framework/agents/jdi-pr-generator.md +80 -0
  22. package/framework/agents/jdi-product-lead.md +44 -0
  23. package/framework/agents/jdi-quality.md +77 -0
  24. package/framework/agents/jdi-researcher.md +70 -0
  25. package/framework/agents/jdi-ux-designer.md +40 -0
  26. package/framework/agents/jdi-verifier.md +80 -0
  27. package/framework/commands/commit.md +20 -0
  28. package/framework/commands/create-plan.md +32 -0
  29. package/framework/commands/generate-pr.md +19 -0
  30. package/framework/commands/implement-plan.md +34 -0
  31. package/framework/commands/init.md +65 -0
  32. package/framework/commands/pr-feedback.md +20 -0
  33. package/framework/commands/pr-review.md +15 -0
  34. package/framework/commands/quick.md +17 -0
  35. package/framework/commands/status.md +13 -0
  36. package/framework/commands/worktree-remove.md +32 -0
  37. package/framework/commands/worktree.md +52 -0
  38. package/framework/components/execution/CodebaseContext.md +36 -0
  39. package/framework/components/execution/Commit.md +121 -0
  40. package/framework/components/execution/Verify.md +140 -0
  41. package/framework/components/execution/VerifyAdvanced.md +43 -0
  42. package/framework/components/meta/AgentBase.md +108 -0
  43. package/framework/components/meta/AgentTeamsOrchestration.md +71 -0
  44. package/framework/components/meta/ComplexityRouter.md +80 -0
  45. package/framework/components/meta/StateUpdate.md +191 -0
  46. package/framework/components/meta/TeamRouter.md +86 -0
  47. package/framework/components/planning/TaskBreakdown.md +83 -0
  48. package/framework/components/planning/WaveComputation.md +59 -0
  49. package/framework/components/quality/PRReview.md +196 -0
  50. package/framework/components/quality/PRReviewLocal.md +99 -0
  51. package/framework/config/jdi-config.yaml +159 -0
  52. package/framework/config/state.yaml +72 -0
  53. package/framework/config/variables.yaml +43 -0
  54. package/framework/hooks/checkpoint.md +196 -0
  55. package/framework/hooks/jdi-worktree-cleanup.md +123 -0
  56. package/framework/hooks/lint-fix-frontend.md +59 -0
  57. package/framework/hooks/on-pause.md +213 -0
  58. package/framework/hooks/pre-commit.md +143 -0
  59. package/framework/jedi.md +336 -0
  60. package/framework/learnings/backend.md +3 -0
  61. package/framework/learnings/devops.md +3 -0
  62. package/framework/learnings/frontend.md +3 -0
  63. package/framework/learnings/general.md +3 -0
  64. package/framework/learnings/testing.md +3 -0
  65. package/framework/rules/commit-rules.md +24 -0
  66. package/framework/rules/deviation-rules.md +221 -0
  67. package/framework/teams/devops.md +26 -0
  68. package/framework/teams/engineering.md +29 -0
  69. package/framework/teams/micro-management.md +26 -0
  70. package/framework/teams/product-research.md +29 -0
  71. package/framework/teams/quality-assurance.md +27 -0
  72. package/framework/templates/PLAN-TASK.md +28 -0
  73. package/framework/templates/PLAN.md +127 -0
  74. package/framework/templates/PROJECT.md +104 -0
  75. package/framework/templates/PROJECT.yaml +16 -0
  76. package/framework/templates/REQUIREMENTS.md +95 -0
  77. package/framework/templates/REQUIREMENTS.yaml +27 -0
  78. package/framework/templates/ROADMAP.md +116 -0
  79. package/framework/templates/ROADMAP.yaml +24 -0
  80. package/framework/templates/STATE.md +137 -0
  81. package/framework/templates/SUMMARY.md +201 -0
  82. package/framework/workflows/README.md +87 -0
  83. package/package.json +35 -0
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: StateUpdate
3
+ category: meta
4
+ description: Update state.yaml and STATE.md with current progress and position
5
+ params:
6
+ - name: phase
7
+ type: string
8
+ required: false
9
+ description: Phase number to set
10
+ - name: plan
11
+ type: string
12
+ required: false
13
+ description: Plan number to set
14
+ - name: task
15
+ type: string
16
+ required: false
17
+ description: Task number to set
18
+ - name: status
19
+ type: string
20
+ required: false
21
+ options: ["idle", "planning", "executing", "verifying", "complete", "blocked", "error"]
22
+ description: Current status to set
23
+ - name: fields
24
+ type: array
25
+ required: false
26
+ description: Specific YAML paths to update (e.g. ["position.status", "session.last_activity"])
27
+ ---
28
+
29
+ # StateUpdate
30
+
31
+ Update JDI state files to track current progress and position.
32
+
33
+ ## Update Pattern (applies to ALL sections)
34
+
35
+ 1. **Read** the target file with the Read tool
36
+ 2. **Modify** only the specified fields (preserve everything else)
37
+ 3. **Write** the complete file back with the Write tool
38
+
39
+ ---
40
+
41
+ ## File Paths
42
+
43
+ | File | Purpose |
44
+ |------|---------|
45
+ | `.jdi/config/state.yaml` | Runtime state (position, session, decisions, blockers) |
46
+ | `.jdi/config/variables.yaml` | Runtime variables (feature metadata, implementation tracking) |
47
+
48
+ > These are RUNTIME files in `.jdi/`, NOT templates in `.jdi/framework/config/`. If `.jdi/config/` does not exist, create it and copy templates.
49
+
50
+ ---
51
+
52
+ ## Default Behaviour
53
+
54
+ When invoked as `<JDI:StateUpdate />`: update `session.last_activity` to current ISO timestamp.
55
+
56
+ ---
57
+
58
+ <section name="Position">
59
+
60
+ ## Position Update
61
+
62
+ Update fields in `.jdi/config/state.yaml`:
63
+
64
+ ```json
65
+ {
66
+ "position": {
67
+ "phase": "{phase}",
68
+ "phase_name": "{from ROADMAP.yaml}",
69
+ "plan": "{plan}",
70
+ "plan_name": "{from PLAN.md}",
71
+ "task": "{task}",
72
+ "task_name": "{from plan}",
73
+ "status": "{status}"
74
+ }
75
+ }
76
+ ```
77
+
78
+ Names are resolved from ROADMAP.yaml and current plan index file.
79
+
80
+ ### Task Entry Schema
81
+
82
+ Each task in `current_plan.tasks` supports these fields:
83
+
84
+ ```yaml
85
+ - id: "{phase}-{plan}-T{n}"
86
+ name: "{Task Name}"
87
+ type: auto | checkpoint:human-verify | checkpoint:decision | checkpoint:human-action
88
+ wave: 1
89
+ status: pending | in_progress | complete | blocked
90
+ file: ".jdi/plans/{phase}-{plan}-{slug}.T{n}.md" # optional — present for split plans only
91
+ ```
92
+
93
+ The `file:` field points to the individual task file. When present, agents read task details from this file instead of the monolithic plan. When absent (legacy plans), task details are inline in the plan file.
94
+
95
+ </section>
96
+
97
+ ---
98
+
99
+ <section name="Decisions">
100
+
101
+ ## Record Decision
102
+
103
+ Append to `decisions` array in `state.yaml`:
104
+
105
+ ```json
106
+ {
107
+ "timestamp": "{ISO}",
108
+ "phase": "{phase}",
109
+ "decision": "{description}",
110
+ "rationale": "{why}",
111
+ "impact": "{what it affects}"
112
+ }
113
+ ```
114
+
115
+ Also append to STATE.md decisions table: `| {date} | {phase} | {decision} | {rationale} |`
116
+
117
+ </section>
118
+
119
+ ---
120
+
121
+ <section name="Blocker">
122
+
123
+ ## Record Blocker
124
+
125
+ Append to `blockers` array in `state.yaml`:
126
+
127
+ ```json
128
+ {
129
+ "timestamp": "{ISO}",
130
+ "type": "technical|external|decision",
131
+ "description": "{what's blocked}",
132
+ "impact": "{what can't proceed}",
133
+ "resolution": null
134
+ }
135
+ ```
136
+
137
+ STATE.md: Add `- [ ] **{type}**: {description}` with impact and date. When resolved: `- [x]` with resolution.
138
+
139
+ </section>
140
+
141
+ ---
142
+
143
+ <section name="Deviation">
144
+
145
+ ## Record Deviation
146
+
147
+ Append to `deviations` array in `state.yaml`:
148
+
149
+ ```json
150
+ {
151
+ "timestamp": "{ISO}",
152
+ "rule": "Rule 1|Rule 2|Rule 3|Rule 4",
153
+ "description": "{what deviated}",
154
+ "reason": "{why}",
155
+ "task": "{task context}",
156
+ "files": ["{affected files}"]
157
+ }
158
+ ```
159
+
160
+ Deviation rules: 1=Auto-fixed bug, 2=Auto-added critical functionality, 3=Auto-fixed blocking issue, 4=Asked about architectural change.
161
+
162
+ </section>
163
+
164
+ ---
165
+
166
+ <section name="QuickUpdate">
167
+
168
+ ## Quick Field Update
169
+
170
+ For single-field or few-field updates, use targeted access instead of full-file read-modify-write:
171
+
172
+ 1. Read only the relevant YAML block from state.yaml (e.g., `position:` block)
173
+ 2. Update the specific field(s)
174
+ 3. Write back only the changed block using Edit tool
175
+
176
+ Examples:
177
+ - `<JDI:StateUpdate fields="position.status" />` — read position block, update status
178
+ - `<JDI:StateUpdate fields="session.last_activity" />` — update timestamp only
179
+ - `<JDI:StateUpdate fields="progress.tasks_completed,progress.plans_completed" />` — batch update counters
180
+
181
+ This avoids reading/writing the full state file (~110 lines) for trivial updates.
182
+
183
+ </section>
184
+
185
+ ---
186
+
187
+ <section name="Session">
188
+
189
+ > **Session Management**: Update `session.last_activity` to current ISO timestamp.
190
+
191
+ </section>
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: TeamRouter
3
+ category: meta
4
+ description: Resolve which team(s) to spawn for a given command
5
+ params:
6
+ - { name: command, type: string, required: false, description: "Command to route (e.g. create-plan, implement-plan)" }
7
+ ---
8
+
9
+ # TeamRouter
10
+
11
+ ## Routing Table
12
+
13
+ | Command | Primary Team | Supporting | Pattern | Agent Loop |
14
+ |---------|-------------|------------|---------|------------|
15
+ | `create-plan` | Product & Research | — | Sequential | Yes |
16
+ | `implement-plan` | Engineering | Micro-Management | Parallel (oversight) | Yes |
17
+ | `research-phase` | Product & Research | — | Sequential | Yes |
18
+ | `pr-feedback` | Engineering | — | Sequential | Yes |
19
+ | `pr-review` | QA | Engineering | Parallel (context) | Yes |
20
+ | `commit` | Engineering | — | Direct | No |
21
+ | `generate-pr` | Engineering | — | Direct | No |
22
+ | `map-codebase` | Product & Research | — | Sequential | Yes |
23
+ | `resume` | (from state) | (from state) | Resumes previous | Yes |
24
+
25
+ ## Team Specs
26
+
27
+ | Team | Path |
28
+ |------|------|
29
+ | Engineering | `.jdi/framework/teams/engineering.md` |
30
+ | Product & Research | `.jdi/framework/teams/product-research.md` |
31
+ | Quality Assurance | `.jdi/framework/teams/quality-assurance.md` |
32
+ | DevOps | `.jdi/framework/teams/devops.md` |
33
+ | Micro-Management | `.jdi/framework/teams/micro-management.md` |
34
+
35
+ ## Resolution Algorithm
36
+
37
+ 1. Strip `/jdi:` prefix, normalise command
38
+ 2. Look up in routing table (skill names map to same command)
39
+ 3. Resolve primary + supporting team specs
40
+ 4. Determine collaboration pattern and agent loop flag
41
+ 5. Activate members based on task context
42
+
43
+ ---
44
+
45
+ <section name="MemberActivation">
46
+
47
+ ## Member Activation
48
+
49
+ Activate members based on file types in the task:
50
+
51
+ | Context | Detection | Active Members |
52
+ |---------|-----------|----------------|
53
+ | Backend | `.php` files | jdi-backend |
54
+ | Frontend | `.tsx`/`.ts` files | jdi-frontend |
55
+ | Full-stack | Both PHP + TS | jdi-backend, jdi-frontend, jdi-executor |
56
+ | Commit | Any | jdi-committer |
57
+ | PR generation | Any | jdi-pr-generator |
58
+ | Plan creation | — | jdi-planner, jdi-product-lead |
59
+ | Research | — | jdi-researcher, jdi-planner |
60
+ | PR review | — | jdi-quality, jdi-verifier |
61
+ | Oversight | During implementation | jdi-head-engineering, jdi-product-lead |
62
+
63
+ </section>
64
+
65
+ <section name="ResumeRouting">
66
+
67
+ ## Resume Routing
68
+
69
+ 1. Read `.jdi/config/state.yaml`
70
+ 2. Map status: planning→create-plan, executing→implement-plan, verifying→pr-review
71
+ 3. Route as resolved command with `resume=true, resume_from_task={position.task}`
72
+
73
+ </section>
74
+
75
+ <section name="CollaborationPatterns">
76
+
77
+ ## Collaboration Patterns
78
+
79
+ | Pattern | Used By | Description |
80
+ |---------|---------|-------------|
81
+ | Sequential | create-plan, research-phase, pr-feedback, map-codebase | Primary team executes, writes state, next team reads state to continue |
82
+ | Parallel (Oversight) | implement-plan | Engineering executes tasks; Micro-Management monitors state.yaml, flags concerns |
83
+ | Parallel (Context) | pr-review | QA reviews code; Engineering provides context and addresses findings |
84
+ | Direct | commit, generate-pr | Single agent, single Task invocation, no team coordination |
85
+
86
+ </section>
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: TaskBreakdown
3
+ category: planning
4
+ description: Break requirements or features into executable tasks
5
+ params:
6
+ - name: source
7
+ type: string
8
+ options: ["requirements", "feature", "ticket", "freeform"]
9
+ default: "freeform"
10
+ - name: depth
11
+ type: string
12
+ options: ["shallow", "standard", "deep"]
13
+ default: "standard"
14
+ - name: mode
15
+ type: string
16
+ options: ["default", "dependencies"]
17
+ default: "default"
18
+ ---
19
+
20
+ # TaskBreakdown
21
+
22
+ ## Default Behaviour
23
+
24
+ 1. **Understand the input** — what is being built, acceptance criteria, constraints
25
+ 2. **Identify components** — subsystems involved, files to touch, dependencies
26
+ 3. **Create task list** — each task is atomic (one commit), verifiable, ordered by dependency
27
+ 4. **Output structured tasks** using the format below
28
+
29
+ ---
30
+
31
+ ## Task Format
32
+
33
+ ```markdown
34
+ <task id="{N}" type="auto|checkpoint:*" tdd="true|false" wave="{W}">
35
+
36
+ ## Task {N}: {Name}
37
+
38
+ **Objective:** {What this task accomplishes}
39
+
40
+ **Files:**
41
+ - `path/to/file1.ts` - {what changes}
42
+
43
+ **Implementation:**
44
+ 1. {Step 1}
45
+ 2. {Step 2}
46
+
47
+ **Verification:**
48
+ - [ ] {Verification check}
49
+
50
+ **Done when:**
51
+ - {Specific, observable completion criteria}
52
+
53
+ </task>
54
+ ```
55
+
56
+ Task types: `auto` (execute without stopping), `checkpoint:human-verify`, `checkpoint:decision`, `checkpoint:human-action`
57
+
58
+ ---
59
+
60
+ ## Dependency Analysis (mode="dependencies")
61
+
62
+ For each task, identify:
63
+ - **Hard dependencies**: Must complete in order (e.g., types needed by implementation)
64
+ - **Soft dependencies**: Prefer order but can parallelise
65
+ - **External dependencies**: May require checkpoint
66
+
67
+ ### Wave Assignment
68
+
69
+ Tasks with no dependencies → Wave 1. Tasks depending on Wave N → Wave N+1.
70
+
71
+ ---
72
+
73
+ ## From Requirements (source="requirements")
74
+
75
+ When breaking down from REQUIREMENTS.yaml: map REQ-IDs to tasks, track which tasks satisfy which requirements, ensure every in-scope requirement has at least one task.
76
+
77
+ ---
78
+
79
+ ## Granularity
80
+
81
+ - **shallow**: 4-6 high-level tasks per feature
82
+ - **standard**: 6-10 balanced tasks (default)
83
+ - **deep**: 10-20 fine-grained tasks for complex/unfamiliar work
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: WaveComputation
3
+ category: planning
4
+ description: Compute execution waves for parallel plan processing
5
+ params:
6
+ - name: plans
7
+ type: array
8
+ required: true
9
+ - name: output
10
+ type: string
11
+ default: inline
12
+ description: Output format (inline|json)
13
+ ---
14
+
15
+ # Wave Computation
16
+
17
+ Analyses plan dependencies and groups plans into execution waves for parallel processing.
18
+
19
+ ## Algorithm
20
+
21
+ ```
22
+ 1. Build dependency graph:
23
+ For each plan P, for each requirement R in P.requires:
24
+ Find plan Q where Q.provides contains R → edge Q → P
25
+
26
+ 2. Topological sort with wave assignment:
27
+ Wave 1: Plans with no dependencies
28
+ Wave N: Plans whose dependencies are all in waves < N
29
+
30
+ 3. Output wave assignments
31
+ ```
32
+
33
+ ## Execution
34
+
35
+ ### Step 1: Extract Frontmatter
36
+
37
+ For each plan file, parse `requires`, `provides`, and current `wave` from YAML frontmatter.
38
+
39
+ ### Step 2: Build Dependency Graph
40
+
41
+ Map which plans depend on which based on requires/provides matching.
42
+
43
+ ### Step 3: Compute Waves
44
+
45
+ Assign waves based on dependency resolution. Plans in the same wave can execute in parallel.
46
+
47
+ ### Step 4: Output
48
+
49
+ **Inline**: Update each plan's frontmatter `wave` field.
50
+ **JSON**: Return wave structure for executor with wave number, plan IDs, and parallelism flag.
51
+
52
+ ## Cross-Phase Dependencies
53
+
54
+ Dependencies from previous phases (`requires.phase < current`) are assumed satisfied if that phase is complete. Verify via `.jdi/phases/{required-phase}/VERIFICATION.md`.
55
+
56
+ ## Error Handling
57
+
58
+ - **Circular dependencies**: Report error with cycle path, suggest splitting a plan
59
+ - **Missing provides**: Check if cross-phase; if not, report and suggest adding plan
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: PRReview
3
+ category: quality
4
+ description: Review pull request changes and post line comments to GitHub
5
+ params:
6
+ - name: pr_number
7
+ type: string
8
+ required: false
9
+ description: PR number to review (auto-detected if not provided)
10
+ - name: context
11
+ type: string
12
+ required: false
13
+ description: Extra context - ClickUp URL, focus areas, or specific instructions
14
+ - name: depth
15
+ type: string
16
+ required: false
17
+ options: ["quick", "standard", "thorough"]
18
+ default: "standard"
19
+ description: How deeply to analyse the changes
20
+ - name: post
21
+ type: boolean
22
+ required: false
23
+ default: true
24
+ description: Whether to post comments to GitHub (false = local review only)
25
+ ---
26
+
27
+ # PRReview
28
+
29
+ Review pull request changes with structured analysis and post line comments to GitHub.
30
+
31
+ ## Default Behaviour
32
+
33
+ When invoked as `<JDI:PRReview />`, execute steps in order:
34
+
35
+ ### Step 1: Identify PR (REQUIRED)
36
+
37
+ If PR number provided, use it. Otherwise detect:
38
+
39
+ ```bash
40
+ gh pr view --json number,url,title,headRefName,baseRefName,author --jq '.'
41
+ ```
42
+
43
+ If no PR found: report and **STOP completely**.
44
+
45
+ ### Step 2: Checkout PR Branch (REQUIRED)
46
+
47
+ ```bash
48
+ git fetch origin
49
+ gh pr checkout [pr_number]
50
+ git branch --show-current
51
+ ```
52
+
53
+ ### Step 3: Gather PR Context
54
+
55
+ ```bash
56
+ gh pr view [pr_number] --json title,body,additions,deletions,changedFiles,commits,labels
57
+ gh pr view [pr_number] --json files --jq '.files[].path'
58
+ gh pr diff [pr_number]
59
+ gh pr view [pr_number] --json commits --jq '.commits[-1].oid'
60
+ ```
61
+
62
+ ### Step 4: Understand PR Intent
63
+
64
+ 1. Read PR description — what problem is being solved?
65
+ 2. Read commit messages — what approach was taken?
66
+ 3. Identify scope — what should/shouldn't be reviewed?
67
+
68
+ If context provided:
69
+ - ClickUp URL (`app.clickup.com`): Note for requirements checking
70
+ - Focus keywords: Prioritise these areas
71
+ - Instructions: Follow during review
72
+
73
+ ### Step 5: Read Changed Files FULLY
74
+
75
+ Read each changed file in its entirety (not just the diff). **NEVER** use limit/offset.
76
+
77
+ ### Step 6: Perform Code Review
78
+
79
+ Apply <JDI:PRReview:Checklist /> to analyse each change.
80
+
81
+ ### Step 7: Categorise Findings (Internal)
82
+
83
+ Categorise using <JDI:PRReview:SeverityGuide />. Build internal list with: file path, line number, severity, title, explanation, suggested fix. Do NOT output detailed findings yet.
84
+
85
+ ### Step 8: Review Checkpoint
86
+
87
+ Output finding counts by severity, total line comments, and review state (APPROVE | REQUEST_CHANGES).
88
+
89
+ If `post="false"`: note output will go to `.jdi/reviews/PR-[number]-review.md`.
90
+
91
+ **CHECKPOINT** — Wait for user: "continue" | "list" | "cancel"
92
+
93
+ ### Step 8a: After "continue":
94
+ - `post="true"` (default): Continue to Step 9
95
+ - `post="false"`: Execute `<JDI:PRReviewLocal />`, skip to Step 11
96
+
97
+ ### Steps 9-10: Build & Submit Review (post=true only)
98
+
99
+ Use <JDI:PRReview:PostComments /> to build and submit the atomic review.
100
+
101
+ ### Step 11: Cleanup (MANDATORY)
102
+
103
+ ```bash
104
+ git checkout master && git branch --show-current
105
+ ```
106
+
107
+ Verify on `master`. Output: PR number, title, state, line comment count, URL, confirmed branch. If not on master, retry.
108
+
109
+ ---
110
+
111
+ <section name="Checklist">
112
+
113
+ ## Review Checklist
114
+
115
+ Apply during Step 6.
116
+
117
+ | Category | Checks |
118
+ |----------|--------|
119
+ | **Correctness** | Logic sound, edge cases handled, error handling, type safety, null/undefined, async |
120
+ | **Security** | No hardcoded secrets, input validated, injection prevented, XSS prevented, auth checks, no sensitive data logged |
121
+ | **Performance** | No N+1 queries, large datasets efficient, no unnecessary re-renders, caching considered, no memory leaks |
122
+ | **Architecture** | Follows patterns, separation of concerns, no circular deps, consistent APIs, appropriate scope |
123
+ | **Style** | Clear naming, readable, no dead code, comments explain "why", consistent formatting |
124
+ | **Testing** | New functionality tested, edge cases tested, meaningful tests, no flaky tests |
125
+ | **Type Safety** | Types defined, no unnecessary `any`, null/undefined typed, generics appropriate |
126
+
127
+ </section>
128
+
129
+ ---
130
+
131
+ <section name="SeverityGuide">
132
+
133
+ ## Severity Classification
134
+
135
+ Use during Step 7.
136
+
137
+ | Emoji | Severity | Description | Action |
138
+ |-------|----------|-------------|--------|
139
+ | blocker | **Blocker** | Bugs, security issues, data loss risk | Must fix before merge |
140
+ | major | **Major** | Significant issues, performance problems | Should fix before merge |
141
+ | minor | **Minor** | Code quality, maintainability | Should fix, not blocking |
142
+ | suggestion | **Suggestion** | Optional improvements | Consider for future |
143
+ | question | **Question** | Clarification needed | Needs response |
144
+ | praise | **Praise** | Good patterns worth highlighting | Positive feedback |
145
+
146
+ ### Event Logic
147
+
148
+ - Any blockers, major, or minor findings: `REQUEST_CHANGES`
149
+ - Suggestions only or no issues: `APPROVE`
150
+
151
+ </section>
152
+
153
+ ---
154
+
155
+ <section name="PostComments">
156
+
157
+ ## Post Comments to GitHub
158
+
159
+ Use during Steps 9-10.
160
+
161
+ > **CRITICAL**: Each finding MUST be a separate object in the `comments` array. The `body` field is ONLY for the summary table. All code-specific feedback goes in `comments` with exact `path` and `line`. Verify `comments` array has one entry per finding (excluding praise, which goes in summary body).
162
+
163
+ ### Get Repository Info
164
+
165
+ ```bash
166
+ gh repo view --json owner,name --jq '"\(.owner.login)/\(.name)"'
167
+ ```
168
+
169
+ ### Comment Object Format
170
+
171
+ ```json
172
+ {
173
+ "path": "[exact_file_path]",
174
+ "line": [line_number],
175
+ "side": "RIGHT",
176
+ "body": "[severity emoji] **[title]**\n\n[explanation]\n\n**Suggested fix:**\n```[language]\n[code]\n```\n\n- AI Ben"
177
+ }
178
+ ```
179
+
180
+ ### Submit Review (SINGLE ATOMIC POST)
181
+
182
+ ```bash
183
+ gh api repos/[owner]/[repo]/pulls/[pr_number]/reviews \
184
+ --input - <<'EOF'
185
+ {
186
+ "commit_id": "[latest_commit_sha]",
187
+ "event": "[APPROVE|REQUEST_CHANGES]",
188
+ "body": "## Review Summary\n\n[assessment]\n\n| Category | Count |\n|----------|-------|\n| Blockers | [N] |\n| Major | [N] |\n| Minor | [N] |\n| Suggestions | [N] |\n\n**[N] line comments below.**\n\n- AI Ben",
189
+ "comments": [ ...comment objects... ]
190
+ }
191
+ EOF
192
+ ```
193
+
194
+ **CHECKPOINT** — Wait for "post" or "cancel" before posting.
195
+
196
+ </section>