claude-dev-env 1.47.0 → 1.49.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.
@@ -6,10 +6,12 @@
6
6
  - **All `*_clean_at`, `merge_state_status`, and `bugbot_down` reset on every push.**
7
7
  - **`bugbot run` comment is load-bearing.** Literal phrase exactly —
8
8
  empirically the only re-trigger Cursor Bugbot recognizes.
9
- - **All production edits go through `clean-coder`.** The lead never edits
10
- production files directly. Every fix — bugbot, bugteam, Copilot, or
11
- Claude finding spawns `Agent(subagent_type="clean-coder")` to
12
- implement. No exceptions.
9
+ - **Production edits go through `clean-coder`, except `/code-review --fix`.**
10
+ The lead never hand-edits production files. Every bugbot, bugteam,
11
+ Copilot, or Claude finding spawns `Agent(subagent_type="clean-coder")` to
12
+ implement the fix. The CODE_REVIEW phase is the one exception: `/code-review
13
+ --fix` applies its own findings to the working tree, which the next
14
+ BUGBOT/BUGTEAM cycle re-reviews after the loop resets.
13
15
  - **Adapt when reality contradicts on-disk state.** If `state.json`,
14
16
  `git`, or `gh` disagree with live PR, escalate as hard blocker per
15
17
  [stop-conditions.md](stop-conditions.md).
@@ -53,7 +53,7 @@ Capture `number`, `head.sha` (= `current_head`), owner/repo, branch.
53
53
  `python "$HOME/.claude/_shared/pr-loop/scripts/reviews_disabled.py" --reviewer bugbot`
54
54
 
55
55
  - Exit 0 (`CLAUDE_REVIEWS_DISABLED` lists `bugbot`) → set `bugbot_down = true`,
56
- `phase = BUGTEAM`, continue BUGTEAM in the same tick; skip steps a–c below.
56
+ `phase = CODE_REVIEW`, continue CODE_REVIEW in the same tick; skip steps a–c below.
57
57
  - Exit 1 → proceed to step a.
58
58
 
59
59
  Because `bugbot_down` resets on every push, this gate re-runs on every
@@ -99,9 +99,9 @@ c. Decide (four branches; match first whose predicate holds):
99
99
  null`, reset `inline_lag_streak = 0`, schedule next wakeup, return.
100
100
  - **`commit_id == current_head` AND zero unaddressed inline AND review
101
101
  body clean:** Set `bugbot_clean_at = current_head`, reset
102
- `inline_lag_streak = 0`, `phase = BUGTEAM`. Continue BUGTEAM in same
103
- tick — back-to-back convergence requires bugteam on same HEAD
104
- before next wakeup.
102
+ `inline_lag_streak = 0`, `phase = CODE_REVIEW`. Continue CODE_REVIEW
103
+ in same tick — back-to-back convergence requires code-review then
104
+ bugteam on same HEAD before next wakeup.
105
105
  - **`commit_id == current_head` with unaddressed inline findings:**
106
106
  Apply **Fix protocol**. Reset `inline_lag_streak = 0`. With
107
107
  `state.json`: clean-coder teammate pushes, replies inline, writes
@@ -113,6 +113,33 @@ c. Decide (four branches; match first whose predicate holds):
113
113
  full contract).
114
114
  Schedule next wakeup, return.
115
115
 
116
+ ### `phase == CODE_REVIEW`
117
+
118
+ Local correctness/quality pass between BUGBOT clean and BUGTEAM. Enters
119
+ after BUGBOT reports clean on `current_head` (or `bugbot_down == true`).
120
+ Runs Claude Code's built-in `/code-review --fix` on the current diff; it
121
+ produces no GitHub review artifact, so there are no code-review threads to
122
+ resolve.
123
+
124
+ a. Run Claude Code's built-in `/code-review --fix` on the current diff —
125
+ the [local diff review](https://code.claude.com/docs/en/code-review#review-a-diff-locally).
126
+ It reviews the diff and applies its findings to the working tree. Pass
127
+ no effort argument, so the review uses the session's current effort.
128
+
129
+ b. Decide (two branches; match first whose predicate holds):
130
+
131
+ - **`/code-review` applied fixes (working tree changed):** Commit the
132
+ applied fixes in one commit → push, following [Single-PR fix
133
+ workflow](fix-protocol.md#single-pr-fix-workflow). Reset
134
+ `bugbot_clean_at = null` AND `code_review_clean_at = null`. Re-trigger
135
+ bugbot (Step 3) so the new HEAD enters the queue. Set `phase = BUGBOT`,
136
+ schedule next wakeup, return. A code-review fix push requires a full
137
+ back-to-back-clean cycle on the new HEAD.
138
+ - **Clean (no changes applied):** Set
139
+ `code_review_clean_at = current_head`, `phase = BUGTEAM`. Continue
140
+ BUGTEAM in same tick — back-to-back convergence requires bugbot,
141
+ code-review, and bugteam all clean on the same HEAD.
142
+
116
143
  ### `phase == BUGTEAM`
117
144
 
118
145
  a. Run **bugteam** on current PR.
@@ -222,14 +249,14 @@ BUGBOT.
222
249
  `bugbot_down = true` and routes to BUGTEAM before any trigger flow runs,
223
250
  so the checks below are skipped.
224
251
  - [ ] **Silent-pass pre-check.** Run `python ~/.claude/skills/pr-converge/scripts/check_bugbot_ci.py --check-clean --owner <O> --repo <R> --sha <current_head>`
225
- - [ ] Exit 0 → bugbot CI completed clean with no review (silent pass); set `bugbot_clean_at = current_head`, `phase = BUGTEAM`, continue BUGTEAM same tick
252
+ - [ ] Exit 0 → bugbot CI completed clean with no review (silent pass); set `bugbot_clean_at = current_head`, `phase = CODE_REVIEW`, continue CODE_REVIEW same tick
226
253
  - [ ] Exit 1 (not a silent pass) or Exit 2 (gh CLI error — silent pass not confirmable) → continue with the trigger flow below
227
254
  - [ ] Run `python ~/.claude/skills/pr-converge/scripts/check_bugbot_ci.py --check-active --owner <O> --repo <R> --sha <current_head>`
228
255
  - [ ] Exit 0 → bugbot already queued on this commit; skip posting, wait for completion
229
256
  - [ ] Exit 1 → post trigger via `add_issue_comment(owner="OWNER", repo="REPO", issueNumber=NUMBER, body="bugbot run")`
230
257
  - [ ] Wait 8s
231
258
  - [ ] Run `python ~/.claude/skills/pr-converge/scripts/check_bugbot_ci.py --owner <O> --repo <R> --sha <current_head>`
232
- - [ ] Exit non-zero → bugbot is down; set `bugbot_down = true`, `phase = BUGTEAM`, continue BUGTEAM same tick
259
+ - [ ] Exit non-zero → bugbot is down; set `bugbot_down = true`, `phase = CODE_REVIEW`, continue CODE_REVIEW same tick
233
260
  - [ ] Exit 0 (check run present) → record `bugbot_acknowledged_at = <now ISO 8601>`, proceed to Step 4
234
261
 
235
262
  The silent-pass pre-check fires FIRST so we never re-trigger a bot that
@@ -9,9 +9,13 @@ across PRs. Both files share most of the fields below; the
9
9
  live ONLY in the single-PR `$CLAUDE_JOB_DIR/pr-converge-state.json` file
10
10
  (see those field entries below for details).
11
11
 
12
- - `phase`: `BUGBOT`, `BUGTEAM`, or `COPILOT_WAIT`. Start `BUGBOT` on first tick.
12
+ - `phase`: `BUGBOT`, `CODE_REVIEW`, `BUGTEAM`, or `COPILOT_WAIT`. Start
13
+ `BUGBOT` on first tick.
13
14
  - `bugbot_clean_at`: HEAD SHA where bugbot last reported clean, or `null`.
14
15
  Reset to `null` on every push.
16
+ - `code_review_clean_at`: HEAD SHA where the `/code-review` pass last
17
+ reported clean (no validated findings), or `null`. Reset to `null` on
18
+ every push.
15
19
  - `copilot_clean_at`: HEAD SHA where Copilot last reported clean, or `null`.
16
20
  Reset to `null` on every push.
17
21
  - `copilot_wait_count`: integer, init `0`. Consecutive COPILOT_WAIT ticks
@@ -6,8 +6,9 @@ guarantees `ScheduleWakeup` is available before any tick runs. Shared bugbot
6
6
 
7
7
  ## Calling ScheduleWakeup
8
8
 
9
- At end of every tick — across all phases (BUGBOT, BUGTEAM, COPILOT_WAIT)
10
- without distinction — call `ScheduleWakeup` unless convergence or another
9
+ At end of every tick — across all phases (BUGBOT, CODE_REVIEW, BUGTEAM,
10
+ COPILOT_WAIT) without distinction — call `ScheduleWakeup` unless convergence
11
+ or another
11
12
  stop condition already omitted pacing:
12
13
 
13
14
  - `delaySeconds: 360` — default wakeup interval. Keeps the loop advancing
@@ -65,6 +65,7 @@ Resolve the metadata used by the frontmatter and the vault path:
65
65
 
66
66
  - **Project name:** infer from conversation context
67
67
  - **Session number:** from backend detection above
68
+ - **Session ID:** the session ID of the agent authoring this log, read from the `CLAUDE_CODE_SESSION_ID` environment variable (PowerShell: `$env:CLAUDE_CODE_SESSION_ID`). This UUID names the authoring agent's own transcript file (`<session-id>.jsonl`), so the saved report points back to the exact session that produced it. When the variable is unset, use the literal `unknown`.
68
69
  - **Date:** today's date
69
70
  - **Title:** a 2–5 word summary of the session's primary outcome. Examples: "Amazon Auth Migration", "Source Loading Fix", "PR 475 Convergence". Avoid generic titles like "Bug Fixes".
70
71
 
@@ -75,6 +76,7 @@ The frontmatter contract every session report carries (inside an HTML comment, a
75
76
  type: session-report
76
77
  project: [name]
77
78
  session: [N]
79
+ session_id: [uuid]
78
80
  date: [YYYY-MM-DD]
79
81
  status: completed|in-progress|blocked
80
82
  blocked: true|false
@@ -83,7 +85,7 @@ tags: [session, [project-tag], [topic-tags]]
83
85
  -->
84
86
  ```
85
87
 
86
- Every session report carries this metadata block verbatim so vault search and the tidy step in step 5 work. **Initial values for Step 2's Write:** substitute concrete values for every placeholder — for `vault_context_retrieved`, write the literal value `false` (the safe default before Step 3's vault-MCP-tool scan completes). Step 3 then Edits this to `true` if any of the three vault MCP tools fired this session.
88
+ Every session report carries this metadata block verbatim so vault search and the tidy step in step 5 work. **Initial values for Step 2's Write:** substitute concrete values for every placeholder — for `session_id`, write the value read from `CLAUDE_CODE_SESSION_ID` in step 1 (or `unknown` when the variable is unset); for `vault_context_retrieved`, write the literal value `false` (the safe default before Step 3's vault-MCP-tool scan completes). Step 3 then Edits `vault_context_retrieved` to `true` if any of the three vault MCP tools fired this session.
87
89
 
88
90
  ## Step 2: Compose the HTML via doc-gist's shape principles
89
91
 
@@ -191,6 +193,7 @@ The primary outcome comes from the session title resolved in step 1.
191
193
  - [ ] HTML composed via doc-gist's shape principles (gallery-anchored)
192
194
  - [ ] `<!-- @publish-as-gist -->` marker present somewhere in the HTML
193
195
  - [ ] Frontmatter HTML comment present at top of `<body>`
196
+ - [ ] `session_id` frontmatter field set from `CLAUDE_CODE_SESSION_ID` (the authoring agent's own session), or `unknown` when the variable is unset
194
197
  - [ ] Opening section answers "what shipped / why / impact" for a cold reader
195
198
  - [ ] Self-contained HTML (no relative-path asset refs; avoid external dependencies)
196
199
  - [ ] Auto-publish URLs captured from step 2 and step 3 (or HTML emitted to chat when step 2 Write failed)