baxian 0.0.1 → 0.2.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 (291) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +19 -1
  3. package/dist/agent/bootstrap-poller.d.ts +34 -0
  4. package/dist/agent/bootstrap-poller.d.ts.map +1 -0
  5. package/dist/agent/bootstrap-poller.js +93 -0
  6. package/dist/agent/bootstrap-poller.js.map +1 -0
  7. package/dist/agent/bootstrap.d.ts +39 -0
  8. package/dist/agent/bootstrap.d.ts.map +1 -0
  9. package/dist/agent/bootstrap.js +214 -0
  10. package/dist/agent/bootstrap.js.map +1 -0
  11. package/dist/agent/index.d.ts +8 -0
  12. package/dist/agent/index.d.ts.map +1 -0
  13. package/dist/agent/index.js +8 -0
  14. package/dist/agent/index.js.map +1 -0
  15. package/dist/agent/manager.d.ts +280 -0
  16. package/dist/agent/manager.d.ts.map +1 -0
  17. package/dist/agent/manager.js +3666 -0
  18. package/dist/agent/manager.js.map +1 -0
  19. package/dist/agent/marker-protocol.d.ts +12 -0
  20. package/dist/agent/marker-protocol.d.ts.map +1 -0
  21. package/dist/agent/marker-protocol.js +52 -0
  22. package/dist/agent/marker-protocol.js.map +1 -0
  23. package/dist/agent/pane-streamer-manager.d.ts +24 -0
  24. package/dist/agent/pane-streamer-manager.d.ts.map +1 -0
  25. package/dist/agent/pane-streamer-manager.js +107 -0
  26. package/dist/agent/pane-streamer-manager.js.map +1 -0
  27. package/dist/agent/pane-streamer.d.ts +97 -0
  28. package/dist/agent/pane-streamer.d.ts.map +1 -0
  29. package/dist/agent/pane-streamer.js +382 -0
  30. package/dist/agent/pane-streamer.js.map +1 -0
  31. package/dist/agent/post-approve-marker-watcher.d.ts +29 -0
  32. package/dist/agent/post-approve-marker-watcher.d.ts.map +1 -0
  33. package/dist/agent/post-approve-marker-watcher.js +160 -0
  34. package/dist/agent/post-approve-marker-watcher.js.map +1 -0
  35. package/dist/agent/preflight.d.ts +9 -0
  36. package/dist/agent/preflight.d.ts.map +1 -0
  37. package/dist/agent/preflight.js +164 -0
  38. package/dist/agent/preflight.js.map +1 -0
  39. package/dist/agent/prompt.d.ts +44 -0
  40. package/dist/agent/prompt.d.ts.map +1 -0
  41. package/dist/agent/prompt.js +252 -0
  42. package/dist/agent/prompt.js.map +1 -0
  43. package/dist/agent/repo-store.d.ts +27 -0
  44. package/dist/agent/repo-store.d.ts.map +1 -0
  45. package/dist/agent/repo-store.js +152 -0
  46. package/dist/agent/repo-store.js.map +1 -0
  47. package/dist/agent/runner.d.ts +46 -0
  48. package/dist/agent/runner.d.ts.map +1 -0
  49. package/dist/agent/runner.js +241 -0
  50. package/dist/agent/runner.js.map +1 -0
  51. package/dist/agent/spec-review-marker-watcher.d.ts +33 -0
  52. package/dist/agent/spec-review-marker-watcher.d.ts.map +1 -0
  53. package/dist/agent/spec-review-marker-watcher.js +180 -0
  54. package/dist/agent/spec-review-marker-watcher.js.map +1 -0
  55. package/dist/agent/tmux-probe-poller.d.ts +78 -0
  56. package/dist/agent/tmux-probe-poller.d.ts.map +1 -0
  57. package/dist/agent/tmux-probe-poller.js +418 -0
  58. package/dist/agent/tmux-probe-poller.js.map +1 -0
  59. package/dist/agent/tmux.d.ts +78 -0
  60. package/dist/agent/tmux.d.ts.map +1 -0
  61. package/dist/agent/tmux.js +395 -0
  62. package/dist/agent/tmux.js.map +1 -0
  63. package/dist/agent/worktree.d.ts +10 -0
  64. package/dist/agent/worktree.d.ts.map +1 -0
  65. package/dist/agent/worktree.js +41 -0
  66. package/dist/agent/worktree.js.map +1 -0
  67. package/dist/api/agents.d.ts +3 -0
  68. package/dist/api/agents.d.ts.map +1 -0
  69. package/dist/api/agents.js +29 -0
  70. package/dist/api/agents.js.map +1 -0
  71. package/dist/api/config.d.ts +5 -0
  72. package/dist/api/config.d.ts.map +1 -0
  73. package/dist/api/config.js +114 -0
  74. package/dist/api/config.js.map +1 -0
  75. package/dist/api/events.d.ts +3 -0
  76. package/dist/api/events.d.ts.map +1 -0
  77. package/dist/api/events.js +11 -0
  78. package/dist/api/events.js.map +1 -0
  79. package/dist/api/pollers.d.ts +3 -0
  80. package/dist/api/pollers.d.ts.map +1 -0
  81. package/dist/api/pollers.js +4 -0
  82. package/dist/api/pollers.js.map +1 -0
  83. package/dist/api/probe.d.ts +9 -0
  84. package/dist/api/probe.d.ts.map +1 -0
  85. package/dist/api/probe.js +87 -0
  86. package/dist/api/probe.js.map +1 -0
  87. package/dist/api/projects.d.ts +3 -0
  88. package/dist/api/projects.d.ts.map +1 -0
  89. package/dist/api/projects.js +602 -0
  90. package/dist/api/projects.js.map +1 -0
  91. package/dist/api/restart.d.ts +3 -0
  92. package/dist/api/restart.d.ts.map +1 -0
  93. package/dist/api/restart.js +20 -0
  94. package/dist/api/restart.js.map +1 -0
  95. package/dist/api/tasks.d.ts +3 -0
  96. package/dist/api/tasks.d.ts.map +1 -0
  97. package/dist/api/tasks.js +136 -0
  98. package/dist/api/tasks.js.map +1 -0
  99. package/dist/app.d.ts +51 -0
  100. package/dist/app.d.ts.map +1 -0
  101. package/dist/app.js +169 -0
  102. package/dist/app.js.map +1 -0
  103. package/dist/cli.d.ts +20 -0
  104. package/dist/cli.d.ts.map +1 -0
  105. package/dist/cli.js +319 -0
  106. package/dist/cli.js.map +1 -0
  107. package/dist/config/backup.d.ts +3 -0
  108. package/dist/config/backup.d.ts.map +1 -0
  109. package/dist/config/backup.js +44 -0
  110. package/dist/config/backup.js.map +1 -0
  111. package/dist/config/index.d.ts +5 -0
  112. package/dist/config/index.d.ts.map +1 -0
  113. package/dist/config/index.js +5 -0
  114. package/dist/config/index.js.map +1 -0
  115. package/dist/config/loader.d.ts +42 -0
  116. package/dist/config/loader.d.ts.map +1 -0
  117. package/dist/config/loader.js +197 -0
  118. package/dist/config/loader.js.map +1 -0
  119. package/dist/config/mutex.d.ts +2 -0
  120. package/dist/config/mutex.d.ts.map +1 -0
  121. package/dist/config/mutex.js +7 -0
  122. package/dist/config/mutex.js.map +1 -0
  123. package/dist/config/normalizer.d.ts +2 -0
  124. package/dist/config/normalizer.d.ts.map +1 -0
  125. package/dist/config/normalizer.js +42 -0
  126. package/dist/config/normalizer.js.map +1 -0
  127. package/dist/config/validator.d.ts +7 -0
  128. package/dist/config/validator.d.ts.map +1 -0
  129. package/dist/config/validator.js +278 -0
  130. package/dist/config/validator.js.map +1 -0
  131. package/dist/errors.d.ts +5 -0
  132. package/dist/errors.d.ts.map +1 -0
  133. package/dist/errors.js +9 -0
  134. package/dist/errors.js.map +1 -0
  135. package/dist/event/broker.d.ts +11 -0
  136. package/dist/event/broker.d.ts.map +1 -0
  137. package/dist/event/broker.js +47 -0
  138. package/dist/event/broker.js.map +1 -0
  139. package/dist/event/bus.d.ts +12 -0
  140. package/dist/event/bus.d.ts.map +1 -0
  141. package/dist/event/bus.js +35 -0
  142. package/dist/event/bus.js.map +1 -0
  143. package/dist/event/handlers.d.ts +6 -0
  144. package/dist/event/handlers.d.ts.map +1 -0
  145. package/dist/event/handlers.js +1121 -0
  146. package/dist/event/handlers.js.map +1 -0
  147. package/dist/event/index.d.ts +4 -0
  148. package/dist/event/index.d.ts.map +1 -0
  149. package/dist/event/index.js +4 -0
  150. package/dist/event/index.js.map +1 -0
  151. package/dist/event/log.d.ts +9 -0
  152. package/dist/event/log.d.ts.map +1 -0
  153. package/dist/event/log.js +43 -0
  154. package/dist/event/log.js.map +1 -0
  155. package/dist/event/publish.d.ts +37 -0
  156. package/dist/event/publish.d.ts.map +1 -0
  157. package/dist/event/publish.js +197 -0
  158. package/dist/event/publish.js.map +1 -0
  159. package/dist/event/ws.d.ts +3 -0
  160. package/dist/event/ws.d.ts.map +1 -0
  161. package/dist/event/ws.js +169 -0
  162. package/dist/event/ws.js.map +1 -0
  163. package/dist/github/index.d.ts +4 -0
  164. package/dist/github/index.d.ts.map +1 -0
  165. package/dist/github/index.js +3 -0
  166. package/dist/github/index.js.map +1 -0
  167. package/dist/github/mapper.d.ts +51 -0
  168. package/dist/github/mapper.d.ts.map +1 -0
  169. package/dist/github/mapper.js +191 -0
  170. package/dist/github/mapper.js.map +1 -0
  171. package/dist/github/poller.d.ts +64 -0
  172. package/dist/github/poller.d.ts.map +1 -0
  173. package/dist/github/poller.js +513 -0
  174. package/dist/github/poller.js.map +1 -0
  175. package/dist/github/resolver.d.ts +8 -0
  176. package/dist/github/resolver.d.ts.map +1 -0
  177. package/dist/github/resolver.js +24 -0
  178. package/dist/github/resolver.js.map +1 -0
  179. package/dist/index.d.ts +11 -0
  180. package/dist/index.d.ts.map +1 -0
  181. package/dist/index.js +310 -0
  182. package/dist/index.js.map +1 -0
  183. package/dist/lifecycle/restart-sentinel.d.ts +18 -0
  184. package/dist/lifecycle/restart-sentinel.d.ts.map +1 -0
  185. package/dist/lifecycle/restart-sentinel.js +61 -0
  186. package/dist/lifecycle/restart-sentinel.js.map +1 -0
  187. package/dist/lifecycle/restart.d.ts +21 -0
  188. package/dist/lifecycle/restart.d.ts.map +1 -0
  189. package/dist/lifecycle/restart.js +57 -0
  190. package/dist/lifecycle/restart.js.map +1 -0
  191. package/dist/shared/constants.d.ts +18 -0
  192. package/dist/shared/constants.d.ts.map +1 -0
  193. package/dist/shared/constants.js +60 -0
  194. package/dist/shared/constants.js.map +1 -0
  195. package/dist/shared/index.d.ts +3 -0
  196. package/dist/shared/index.d.ts.map +1 -0
  197. package/dist/shared/index.js +3 -0
  198. package/dist/shared/index.js.map +1 -0
  199. package/dist/shared/types.d.ts +263 -0
  200. package/dist/shared/types.d.ts.map +1 -0
  201. package/dist/shared/types.js +2 -0
  202. package/dist/shared/types.js.map +1 -0
  203. package/dist/skill/index.d.ts +2 -0
  204. package/dist/skill/index.d.ts.map +1 -0
  205. package/dist/skill/index.js +2 -0
  206. package/dist/skill/index.js.map +1 -0
  207. package/dist/skill/registry.d.ts +30 -0
  208. package/dist/skill/registry.d.ts.map +1 -0
  209. package/dist/skill/registry.js +174 -0
  210. package/dist/skill/registry.js.map +1 -0
  211. package/dist/skills/UPSTREAM.md +38 -0
  212. package/dist/skills/baxian-rules/SKILL.md +68 -0
  213. package/dist/skills/merge-sync/SKILL.md +42 -0
  214. package/dist/skills/pr-feedback/SKILL.md +117 -0
  215. package/dist/skills/pr-recheck/SKILL.md +52 -0
  216. package/dist/skills/pr-review/SKILL.md +60 -0
  217. package/dist/skills/spells/SKILL.md +41 -0
  218. package/dist/skills/task-check/SKILL.md +26 -0
  219. package/dist/state/agent-store.d.ts +21 -0
  220. package/dist/state/agent-store.d.ts.map +1 -0
  221. package/dist/state/agent-store.js +145 -0
  222. package/dist/state/agent-store.js.map +1 -0
  223. package/dist/state/error-record-store.d.ts +40 -0
  224. package/dist/state/error-record-store.d.ts.map +1 -0
  225. package/dist/state/error-record-store.js +203 -0
  226. package/dist/state/error-record-store.js.map +1 -0
  227. package/dist/state/index.d.ts +5 -0
  228. package/dist/state/index.d.ts.map +1 -0
  229. package/dist/state/index.js +5 -0
  230. package/dist/state/index.js.map +1 -0
  231. package/dist/state/init.d.ts +2 -0
  232. package/dist/state/init.d.ts.map +1 -0
  233. package/dist/state/init.js +13 -0
  234. package/dist/state/init.js.map +1 -0
  235. package/dist/state/lock.d.ts +9 -0
  236. package/dist/state/lock.d.ts.map +1 -0
  237. package/dist/state/lock.js +36 -0
  238. package/dist/state/lock.js.map +1 -0
  239. package/dist/state/post-approve-store.d.ts +23 -0
  240. package/dist/state/post-approve-store.d.ts.map +1 -0
  241. package/dist/state/post-approve-store.js +79 -0
  242. package/dist/state/post-approve-store.js.map +1 -0
  243. package/dist/state/process-lock.d.ts +24 -0
  244. package/dist/state/process-lock.d.ts.map +1 -0
  245. package/dist/state/process-lock.js +175 -0
  246. package/dist/state/process-lock.js.map +1 -0
  247. package/dist/state/snapshot.d.ts +38 -0
  248. package/dist/state/snapshot.d.ts.map +1 -0
  249. package/dist/state/snapshot.js +134 -0
  250. package/dist/state/snapshot.js.map +1 -0
  251. package/dist/state/task-store.d.ts +25 -0
  252. package/dist/state/task-store.d.ts.map +1 -0
  253. package/dist/state/task-store.js +167 -0
  254. package/dist/state/task-store.js.map +1 -0
  255. package/dist/terminal/attach.d.ts +7 -0
  256. package/dist/terminal/attach.d.ts.map +1 -0
  257. package/dist/terminal/attach.js +26 -0
  258. package/dist/terminal/attach.js.map +1 -0
  259. package/dist/terminal/index.d.ts +3 -0
  260. package/dist/terminal/index.d.ts.map +1 -0
  261. package/dist/terminal/index.js +3 -0
  262. package/dist/terminal/index.js.map +1 -0
  263. package/dist/terminal/key-sanitizer.d.ts +2 -0
  264. package/dist/terminal/key-sanitizer.d.ts.map +1 -0
  265. package/dist/terminal/key-sanitizer.js +9 -0
  266. package/dist/terminal/key-sanitizer.js.map +1 -0
  267. package/dist/terminal/stream-ws.d.ts +3 -0
  268. package/dist/terminal/stream-ws.d.ts.map +1 -0
  269. package/dist/terminal/stream-ws.js +426 -0
  270. package/dist/terminal/stream-ws.js.map +1 -0
  271. package/dist/terminal/ws-auth.d.ts +5 -0
  272. package/dist/terminal/ws-auth.d.ts.map +1 -0
  273. package/dist/terminal/ws-auth.js +45 -0
  274. package/dist/terminal/ws-auth.js.map +1 -0
  275. package/dist/timing/debounced-task.d.ts +9 -0
  276. package/dist/timing/debounced-task.d.ts.map +1 -0
  277. package/dist/timing/debounced-task.js +23 -0
  278. package/dist/timing/debounced-task.js.map +1 -0
  279. package/dist/timing/periodic-task-runner.d.ts +21 -0
  280. package/dist/timing/periodic-task-runner.d.ts.map +1 -0
  281. package/dist/timing/periodic-task-runner.js +61 -0
  282. package/dist/timing/periodic-task-runner.js.map +1 -0
  283. package/dist/web/assets/index-53CBbz4w.js +4 -0
  284. package/dist/web/assets/index-B9D6BV08.css +1 -0
  285. package/dist/web/assets/react-BG4Iuztk.js +40 -0
  286. package/dist/web/assets/router-B_Nv0oRz.js +12 -0
  287. package/dist/web/assets/xterm-CFbL2ovg.css +32 -0
  288. package/dist/web/assets/xterm-D5X2JljJ.js +9 -0
  289. package/dist/web/index.html +17 -0
  290. package/package.json +44 -5
  291. package/index.js +0 -1
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: pr-feedback
3
+ description: Use when the dev (PR author) must process review feedback, including project aliases like "pr N", qa callbacks, human comments, bot findings, threaded review comments, Fixed/Won't fix replies, follow-up issues, or recheck requests.
4
+ ---
5
+
6
+ # PR Feedback
7
+
8
+ ## Overview
9
+
10
+ Treat the pull request as the only durable source of review feedback. Fetch every review, inline comment, and conversation comment; judge each actionable item independently; then either fix it, decline it with a reason, or move out-of-scope work into a tracked issue.
11
+
12
+ ## Before You Start
13
+
14
+ Read the consuming repository's agent instructions first. In particular, find:
15
+
16
+ - Required PR feedback format.
17
+ - Required test and push rules.
18
+ - How to identify already-addressed comments.
19
+ - Whether out-of-scope feedback must become an issue.
20
+ - How to notify the qa agent after replies or new commits.
21
+ - The transport skill or script used for notification, if any.
22
+
23
+ Do not rely on another agent's chat transcript or tmux pane output. If the feedback is not in the PR, ask that it be written there before treating it as official review input.
24
+
25
+ Project-specific trigger aliases such as `pr N` are compatibility shims. The reusable concept is "process PR feedback"; do not require other projects to adopt the same alias names.
26
+
27
+ ## Fetch Feedback
28
+
29
+ **Tool selection.** Prefer the local `gh` CLI for all GitHub interactions; it is the lowest-friction, best-authenticated path on most workstations. Fall back to a GitHub MCP server or connector tool only when `gh` is missing, unauthenticated, or the required call has no `gh` equivalent. Do not start with a connector when `gh` would work.
30
+
31
+ For GitHub, collect all three surfaces:
32
+
33
+ ```bash
34
+ gh api --paginate repos/OWNER/REPO/pulls/N/reviews
35
+ gh api --paginate repos/OWNER/REPO/pulls/N/comments
36
+ gh api --paginate repos/OWNER/REPO/issues/N/comments
37
+ ```
38
+
39
+ Also fetch PR metadata and current head:
40
+
41
+ ```bash
42
+ gh pr view N --json title,body,headRefName,headRefOid,baseRefName,reviewDecision,url
43
+ ```
44
+
45
+ The required result is full PR metadata plus every review body, inline review comment, and top-level conversation comment.
46
+
47
+ ## Classify Items
48
+
49
+ Build a working list of every actionable item. Include comments from humans, review agents, and review bots. For each item, record:
50
+
51
+ - Author and comment URL or ID.
52
+ - File and line, when available.
53
+ - Current status: unresolved, already fixed, invalid, duplicate, or out of scope.
54
+ - The evidence you used to decide.
55
+
56
+ Do not batch-dismiss findings because another reviewer said the same thing. Confirm each one against the code and tests.
57
+
58
+ ## Decide and Act
59
+
60
+ For each actionable item:
61
+
62
+ 1. If it is correct and in scope, fix it.
63
+
64
+ Keep the change focused. Add or update tests for the behavior. Run the relevant local tests. Commit and push before claiming the fix is done.
65
+
66
+ 2. If it is incorrect or not appropriate for this PR, reply with a reason.
67
+
68
+ The first line must be:
69
+
70
+ ```text
71
+ Won't fix
72
+ ```
73
+
74
+ Then explain the concrete evidence. Do not use vague phrases such as "not needed" without backing.
75
+
76
+ 3. If it is real but out of scope, create a follow-up issue first.
77
+
78
+ Include enough context for a future agent to reproduce the concern, then reply to the review item with the issue link and why it is being split out.
79
+
80
+ 4. If it is already fixed by current head, verify that in the code and tests before replying.
81
+
82
+ The first line must be:
83
+
84
+ ```text
85
+ Fixed
86
+ ```
87
+
88
+ Include the commit SHA when a code change was pushed for that item.
89
+
90
+ ## Reply Rules
91
+
92
+ Reply to every actionable item. Do not silently ignore duplicates; say they are duplicates and link or reference the primary response.
93
+
94
+ Use the review platform's threaded reply for inline review comments when possible. Use a top-level PR comment only when the platform has no threaded reply surface for that item.
95
+
96
+ Never announce "fixed", "done", or "complete" before code changes are committed and pushed to the PR branch.
97
+
98
+ ## Recheck Notification
99
+
100
+ After all replies and commits are visible on the PR, follow the consuming repository's notification rule. Common patterns include:
101
+
102
+ - Dispatching `recheck N` to the qa agent.
103
+ - Requesting another review from a human or bot.
104
+ - Leaving the PR ready for manual merge.
105
+
106
+ If the project uses tmux for agent notification, use the `tmux-send` skill and the project-local routing table. Do not hardcode hostnames or session names in this skill.
107
+
108
+ ## Stop Conditions
109
+
110
+ Stop and report current state to the human when:
111
+
112
+ - The PR is approved and no actionable findings remain.
113
+ - The remaining findings have all been answered with `Won't fix`.
114
+ - The project-defined maximum review loop count is reached.
115
+ - A new human instruction changes the task.
116
+
117
+ When stopping, summarize the PR decision, unresolved items if any, and the exact next action.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: pr-recheck
3
+ description: Use when the qa agent must re-evaluate a pull request after prior review feedback, including project aliases like "recheck N", dev replies, new commits, unchanged heads, finding closure, new test coverage, approval, and dev notification.
4
+ ---
5
+
6
+ # PR Recheck
7
+
8
+ ## Overview
9
+
10
+ Recheck the PR's latest state against the previous review context. This is not a fresh blind review: it verifies whether prior findings were closed, whether the dev's replies are technically sound, and whether new changes introduced new risks.
11
+
12
+ Project-specific trigger aliases such as `recheck N` are compatibility shims. The reusable concept is "re-evaluate a PR after feedback".
13
+
14
+ ## Gather Context
15
+
16
+ Read the consuming repository's agent instructions and fetch:
17
+
18
+ - Current PR head SHA and diff.
19
+ - Previous reviews, inline comments, issue comments, and dev replies.
20
+ - Commits since the last reviewed head.
21
+ - Checks and tests relevant to changed files.
22
+
23
+ **Tool selection.** Prefer the local `gh` CLI for all GitHub interactions; it is the lowest-friction, best-authenticated path on most workstations. Fall back to a GitHub MCP server or connector tool only when `gh` is missing, unauthenticated, or the required call has no `gh` equivalent. Do not start with a connector when `gh` would work.
24
+
25
+ ```bash
26
+ gh pr view N --json headRefOid,reviewDecision,comments,reviews,files
27
+ gh pr diff N
28
+ gh api --paginate repos/OWNER/REPO/pulls/N/reviews
29
+ gh api --paginate repos/OWNER/REPO/pulls/N/comments
30
+ gh api --paginate repos/OWNER/REPO/issues/N/comments
31
+ ```
32
+
33
+ `gh pr view --json reviews` returns at most one unpaginated page; on PRs with many review rounds it silently truncates older verdicts. Always fetch the full review history via the paginated `gh api` line above before deciding any finding is "closed".
34
+
35
+ ## Decision Path
36
+
37
+ - If the head changed, review the increment since the previous reviewed head, verify every prior finding is actually closed, and check that new or changed behavior has tests.
38
+ - If the head did not change but the dev replied, judge the reply against the code and project rules. Do not accept "fixed" claims without evidence.
39
+ - If neither code nor relevant replies changed, say the head has not changed and keep the prior unresolved findings.
40
+
41
+ ## Output
42
+
43
+ Post the result to the PR. For unresolved issues, write findings with concrete evidence.
44
+
45
+ If all findings are closed and no new issues are found, emit the host's approval signal. Step 1 is the durable verdict; Step 2 is courtesy reinforcement for human readers:
46
+
47
+ 1. Submit an approving review (`gh pr review N --approve`). On hosts that block self-approval, this step will fail; fall back to the host's documented self-PR mechanism (e.g., a structured `<!-- baxian:<agent>:approve -->` marker on its own line, outside fenced blocks).
48
+ 2. Submit a `:+1:` review comment (`gh pr review N --comment --body ':+1:'`).
49
+
50
+ Each host defines its own recognized signals — check the host's agent rules. `:+1:` is not a universal verdict shorthand; only treat it as decisive if the host explicitly documents it.
51
+
52
+ After the result is visible on the PR, notify the dev using the project rule. If the project uses a qa-to-dev callback, use `review-notify` or the configured transport.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: pr-review
3
+ description: Use when the qa agent must perform a full independent pull request review, including project aliases like "review N", PR diffs, tests, prior comments, human authorization context, findings, approval, and dev notification.
4
+ ---
5
+
6
+ # PR Review
7
+
8
+ ## Overview
9
+
10
+ Review the pull request as the independent qa. Treat the PR, commits, comments, checks, issues, and repository instructions as the durable source of truth; do not rely on another agent's private transcript or summary.
11
+
12
+ Project-specific trigger aliases such as `review N` are compatibility shims. The reusable concept is "perform a full PR review".
13
+
14
+ ## Before Reviewing
15
+
16
+ Read the consuming repository's agent instructions first. Identify:
17
+
18
+ - Review scope and finding format.
19
+ - Required test-review expectations.
20
+ - Whether approval is allowed.
21
+ - How qa results must be written to the PR.
22
+ - How to notify the dev after the review.
23
+
24
+ Fetch PR metadata, current head, diff, existing reviews, inline comments, issue comments, checks, and linked issue context.
25
+
26
+ **Tool selection.** Prefer the local `gh` CLI for all GitHub interactions; it is the lowest-friction, best-authenticated path on most workstations. Fall back to a GitHub MCP server or connector tool only when `gh` is missing, unauthenticated, or the required call has no `gh` equivalent. Do not start with a connector when `gh` would work.
27
+
28
+ ```bash
29
+ gh pr view N --json title,body,headRefName,headRefOid,baseRefName,reviewDecision,url,files
30
+ gh pr diff N
31
+ gh api --paginate repos/OWNER/REPO/pulls/N/reviews
32
+ gh api --paginate repos/OWNER/REPO/pulls/N/comments
33
+ gh api --paginate repos/OWNER/REPO/issues/N/comments
34
+ ```
35
+
36
+ ## Review Scope
37
+
38
+ Prioritize findings that affect behavior or maintainability:
39
+
40
+ - Bugs, regressions, security issues, lifecycle problems, and concurrency risks.
41
+ - Missing, weak, skipped, or non-assertive tests.
42
+ - Coverage gaps for new branches, errors, edge cases, or invariants.
43
+ - Mismatches between the PR, linked issue, and repository rules.
44
+
45
+ Human authorization in the PR description, commits, or comments is input, not a bypass. Judge whether it actually covers the risk.
46
+
47
+ ## Findings
48
+
49
+ Write actionable findings to the PR, preferably as inline review comments on the smallest relevant range. Include concrete evidence and the expected fix. Avoid restating the diff as a summary.
50
+
51
+ If no findings remain, emit the host's approval signal. Step 1 is the durable verdict; Step 2 is courtesy reinforcement for human readers:
52
+
53
+ 1. Submit an approving review (`gh pr review N --approve`). On hosts that block self-approval (the qa and dev share a GitHub identity), this step will fail; in that case fall back to the host's documented self-PR mechanism (e.g., a structured `<!-- baxian:<agent>:approve -->` marker on its own line, outside fenced blocks).
54
+ 2. Submit a `:+1:` review comment (`gh pr review N --comment --body ':+1:'`).
55
+
56
+ Each host defines its own recognized signals — check the host's agent rules. `:+1:` is not a universal verdict shorthand; only treat it as decisive if the host explicitly documents it.
57
+
58
+ ## Notify Author
59
+
60
+ After the review result is durable on the PR, follow the project notification rule. If the project uses a qa-to-dev callback, use `review-notify` or the configured transport. Do not dispatch before the PR review/comment is visible.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: spells
3
+ description: Routes the shortcut trigger phrases an agent recognizes in chat — `pr N`, `review N`, `recheck N`, `merged`, `merged N`, `issue N` — to the corresponding skill in this repo. Apply when any of these phrases appears in an incoming message.
4
+ ---
5
+
6
+ # Spells
7
+
8
+ ## Overview
9
+
10
+ A spell is a short trigger phrase a human or peer agent sends in chat. Each spell is a shortcut into one of the other skills in this repo. When any of the phrases below appears in an incoming message, run the linked skill. The skill itself owns the workflow, the rules, the stop conditions, the reply format — this file is only the routing table.
11
+
12
+ Spells are recognized in natural-language input; they are not slash commands and are not parsed by the host CLI. Each spell takes at most one argument, always a single token (a PR number, an issue number) separated from the spell by one space.
13
+
14
+ ## Spell → Skill Routing
15
+
16
+ | Spell | Skill | Use when |
17
+ | ------------ | ----------------------------------------- | --------------------------------------------------------------------- |
18
+ | `pr N` | [`pr-feedback`](../pr-feedback/SKILL.md) | Process all reviewer feedback on pull request `N`. |
19
+ | `review N` | [`pr-review`](../pr-review/SKILL.md) | First-time full review of pull request `N`. |
20
+ | `recheck N` | [`pr-recheck`](../pr-recheck/SKILL.md) | Re-evaluate pull request `N` after the dev responded to findings. |
21
+ | `merged` | [`merge-sync`](../merge-sync/SKILL.md) | The PR you just pushed has been merged (see form note below). |
22
+ | `merged N` | [`merge-sync`](../merge-sync/SKILL.md) | Peer agent telling you PR `N` has been merged (see form note below). |
23
+ | `issue N` | [`issue-check`](../issue-check/SKILL.md) | Verify and handle GitHub issue `N`. |
24
+
25
+ ## `merged` vs `merged N`
26
+
27
+ This is the only spell where the form (bare vs parameterized) is part of the contract — it tells the receiver who sent it and which path inside `merge-sync` to run.
28
+
29
+ - **Bare `merged`** — human-triggered, sent to the agent that just pushed the now-merged PR. Run [`merge-sync` § Human-Originated Sync](../merge-sync/SKILL.md#human-originated-sync), which includes deleting the merged feature branch locally and dispatching `merged N` to the peer.
30
+ - **`merged N`** — peer-agent dispatched, with the PR number explicit because the peer is in a different context. Run [`merge-sync` § Peer-Originated Sync](../merge-sync/SKILL.md#peer-originated-sync), which syncs trunk and rereads changed rule sources but does not delete the current branch and does not re-dispatch.
31
+ - If a human types `merged N` by mistake, treat it as the peer path (so it does no damage) and remind the human in the reply that the bare form is what triggers full local cleanup plus peer notification.
32
+
33
+ The other spells in the table do not have this dual form.
34
+
35
+ ## Dispatch Channels
36
+
37
+ How a spell arrives depends on who sent it; the receiver's behavior is owned by the linked skill, not by the channel.
38
+
39
+ - **Human → agent**: typed into the agent's chat. No transport tooling needed.
40
+ - **Agent → peer agent**: use the [`tmux-send`](../tmux-send/SKILL.md) skill rather than calling `ssh` and `tmux send-keys` directly. Routing details (which host, which session, which spells are valid in which direction) live in the consuming project's configuration, not in this skill.
41
+ - **Bot or webhook → agent**: same as agent-to-agent — the trigger needs to land in the agent's input stream the same way a human message would; transport is project-specific.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: task-check
3
+ description: How to analyze a baxian-managed task before starting development
4
+ ---
5
+
6
+ # Task Check
7
+
8
+ Before writing any code, thoroughly read the `<task>` block in your prompt.
9
+
10
+ ## Steps
11
+ 1. Read the full title and description from the `<task>` block at the bottom of this prompt — that is the authoritative task (Phase 2 inlines the task body directly; there is no `.baxian/task.md` file to read).
12
+ 2. Understand the acceptance criteria — what does "done" look like?
13
+ 3. Plan your approach before coding: which files to modify, what tests to write.
14
+
15
+ ## What to look for
16
+ - Explicit requirements vs. implied requirements
17
+ - Edge cases mentioned in description
18
+ - References to specific files, functions, or behaviors
19
+ - Links to design docs, screenshots, or specs
20
+
21
+ ## When to ask vs. proceed
22
+ - If the task is clear enough to start, start.
23
+ - If critical information is missing **and a PR already exists**, record concerns in the PR description.
24
+ - If critical information is missing **and no PR exists yet** (initial triage), pick the most reasonable interpretation, write your assumption + concern as the first paragraph **after** the `<!-- baxian:managed -->` marker (the marker MUST stay on the very first line of the PR description per `baxian-rules` — putting text before it makes the PR look unmanaged to the platform), or create a new baxian task to track the missing info if it blocks all progress.
25
+ - Do not block on minor ambiguities — make a reasonable choice and note it in the PR description.
26
+ - Never silently proceed without recording the assumption somewhere reachable (PR description, new task, or commit message).
@@ -0,0 +1,21 @@
1
+ import type { AgentBindingFacts } from '../shared/index.js';
2
+ export type AgentStoreChangeKind = 'set' | 'delete';
3
+ export type AgentStoreListener = (kind: AgentStoreChangeKind, agentId: string) => void;
4
+ export declare const AGENT_STORE_NOOP: unique symbol;
5
+ export type AgentStoreUpdateResult = AgentBindingFacts | null | typeof AGENT_STORE_NOOP;
6
+ export declare class AgentStore {
7
+ private dir;
8
+ private listeners;
9
+ private mutex;
10
+ constructor(dir: string);
11
+ onChange(fn: AgentStoreListener): () => void;
12
+ get(id: string): Promise<AgentBindingFacts | null>;
13
+ set(state: AgentBindingFacts): Promise<void>;
14
+ /** Per-agent serialized RMW. Updater returns: binding=write, null=delete, AGENT_STORE_NOOP=skip. Non-reentrant. */
15
+ update(id: string, updater: (existing: AgentBindingFacts | null) => AgentStoreUpdateResult): Promise<void>;
16
+ list(): Promise<AgentBindingFacts[]>;
17
+ delete(id: string): Promise<void>;
18
+ private path;
19
+ private fire;
20
+ }
21
+ //# sourceMappingURL=agent-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-store.d.ts","sourceRoot":"","sources":["../../src/state/agent-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvF,eAAO,MAAM,gBAAgB,eAAyC,CAAC;AACvE,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,IAAI,GAAG,OAAO,gBAAgB,CAAC;AAExF,qBAAa,UAAU;IAIT,OAAO,CAAC,GAAG;IAHvB,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,KAAK,CAAuC;gBAEhC,GAAG,EAAE,MAAM;IAE/B,QAAQ,CAAC,EAAE,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAKtC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IASlD,GAAG,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IASlD,mHAAmH;IAC7G,MAAM,CACV,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,KAAK,sBAAsB,GACtE,OAAO,CAAC,IAAI,CAAC;IAoBV,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAoBpC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvC,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;CASb"}
@@ -0,0 +1,145 @@
1
+ import { readFile, writeFile, readdir, unlink, rename } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ export const AGENT_STORE_NOOP = Symbol.for('@baxian/agent-store-noop');
4
+ export class AgentStore {
5
+ dir;
6
+ listeners = new Set();
7
+ mutex = new Map();
8
+ constructor(dir) {
9
+ this.dir = dir;
10
+ }
11
+ onChange(fn) {
12
+ this.listeners.add(fn);
13
+ return () => this.listeners.delete(fn);
14
+ }
15
+ async get(id) {
16
+ try {
17
+ const content = await readFile(this.path(id), 'utf-8');
18
+ return normalizeBinding(JSON.parse(content), id);
19
+ }
20
+ catch {
21
+ return null;
22
+ }
23
+ }
24
+ async set(state) {
25
+ const binding = normalizeBinding(state, state.id);
26
+ const final = this.path(state.id);
27
+ const tmp = `${final}.${process.pid}.${Date.now()}.tmp`;
28
+ await writeFile(tmp, JSON.stringify(binding, null, 2) + '\n');
29
+ await rename(tmp, final);
30
+ this.fire('set', state.id);
31
+ }
32
+ /** Per-agent serialized RMW. Updater returns: binding=write, null=delete, AGENT_STORE_NOOP=skip. Non-reentrant. */
33
+ async update(id, updater) {
34
+ const prev = this.mutex.get(id) ?? Promise.resolve();
35
+ const task = prev.then(async () => {
36
+ const existing = await this.get(id);
37
+ const result = updater(existing);
38
+ if (result === AGENT_STORE_NOOP)
39
+ return;
40
+ if (result === null) {
41
+ await this.delete(id);
42
+ return;
43
+ }
44
+ await this.set(result);
45
+ });
46
+ // map 存 swallow-catch 版本以维持 mutex 链;删除前校验 still-current 防止误删后来者。
47
+ const chain = task.catch(() => undefined).finally(() => {
48
+ if (this.mutex.get(id) === chain)
49
+ this.mutex.delete(id);
50
+ });
51
+ this.mutex.set(id, chain);
52
+ return task;
53
+ }
54
+ async list() {
55
+ let files;
56
+ try {
57
+ files = await readdir(this.dir);
58
+ }
59
+ catch {
60
+ return [];
61
+ }
62
+ const states = [];
63
+ for (const file of files) {
64
+ if (!file.endsWith('.json'))
65
+ continue;
66
+ try {
67
+ const content = await readFile(join(this.dir, file), 'utf-8');
68
+ states.push(normalizeBinding(JSON.parse(content), file.replace(/\.json$/, '')));
69
+ }
70
+ catch (err) {
71
+ console.warn(`[AgentStore] skipping unreadable file ${file}:`, err);
72
+ }
73
+ }
74
+ return states;
75
+ }
76
+ async delete(id) {
77
+ try {
78
+ await unlink(this.path(id));
79
+ }
80
+ catch (err) {
81
+ // ENOENT is idempotent; other errors mean file still on disk → don't broadcast.
82
+ const code = err?.code;
83
+ if (code !== 'ENOENT') {
84
+ console.error(`[AgentStore] delete ${id} failed; not broadcasting:`, err);
85
+ return;
86
+ }
87
+ }
88
+ this.fire('delete', id);
89
+ }
90
+ path(id) {
91
+ return join(this.dir, `${id}.json`);
92
+ }
93
+ fire(kind, id) {
94
+ for (const fn of [...this.listeners]) {
95
+ try {
96
+ fn(kind, id);
97
+ }
98
+ catch (err) {
99
+ console.error(`[AgentStore] listener threw on ${kind} ${id}:`, err);
100
+ }
101
+ }
102
+ }
103
+ }
104
+ function normalizeBinding(raw, fallbackId) {
105
+ const id = typeof raw.id === 'string' ? raw.id : fallbackId;
106
+ const projectId = typeof raw.projectId === 'string' ? raw.projectId : '';
107
+ const updatedAt = typeof raw.updatedAt === 'string' ? raw.updatedAt : new Date(0).toISOString();
108
+ const binding = { id, projectId, updatedAt };
109
+ if (typeof raw.taskId === 'string')
110
+ binding.taskId = raw.taskId;
111
+ if (typeof raw.worktreePath === 'string')
112
+ binding.worktreePath = raw.worktreePath;
113
+ if (typeof raw.repoPath === 'string')
114
+ binding.repoPath = raw.repoPath;
115
+ if (typeof raw.startedAt === 'string')
116
+ binding.startedAt = raw.startedAt;
117
+ if (typeof raw.paneId === 'string')
118
+ binding.paneId = raw.paneId;
119
+ if (typeof raw.creationToken === 'string')
120
+ binding.creationToken = raw.creationToken;
121
+ if (raw.status === 'awaiting_human')
122
+ binding.status = 'awaiting_human';
123
+ if (typeof raw.awaitingPhase === 'string')
124
+ binding.awaitingPhase = raw.awaitingPhase;
125
+ if (typeof raw.awaitingReason === 'string')
126
+ binding.awaitingReason = raw.awaitingReason;
127
+ if (typeof raw.awaitingSince === 'string')
128
+ binding.awaitingSince = raw.awaitingSince;
129
+ const injected = normalizeInjectedSkills(raw.injectedSkills);
130
+ if (injected)
131
+ binding.injectedSkills = injected;
132
+ return binding;
133
+ }
134
+ function normalizeInjectedSkills(raw) {
135
+ if (!raw || typeof raw !== 'object')
136
+ return undefined;
137
+ const obj = raw;
138
+ if (typeof obj.taskId !== 'string' || typeof obj.paneId !== 'string')
139
+ return undefined;
140
+ if (!Array.isArray(obj.skills))
141
+ return undefined;
142
+ const skills = obj.skills.filter((s) => typeof s === 'string');
143
+ return { taskId: obj.taskId, paneId: obj.paneId, skills };
144
+ }
145
+ //# sourceMappingURL=agent-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-store.js","sourceRoot":"","sources":["../../src/state/agent-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAGvE,MAAM,OAAO,UAAU;IAID;IAHZ,SAAS,GAAG,IAAI,GAAG,EAAs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M,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { AgentErrorSummary } from '../shared/index.js';
2
+ export interface ErrorRecordInput {
3
+ agentId: string;
4
+ projectId: string;
5
+ taskId?: string;
6
+ operation: string;
7
+ reason: string;
8
+ message: string;
9
+ occurredAt?: string;
10
+ observation?: Record<string, unknown>;
11
+ recommendation?: string;
12
+ }
13
+ export interface ErrorRecord extends Required<Omit<ErrorRecordInput, 'taskId' | 'observation' | 'recommendation'>> {
14
+ id: string;
15
+ taskId?: string;
16
+ observation?: Record<string, unknown>;
17
+ recommendation?: string;
18
+ }
19
+ export declare class ErrorRecordStore {
20
+ private dir;
21
+ private chain;
22
+ constructor(dir: string);
23
+ append(input: ErrorRecordInput): Promise<ErrorRecord>;
24
+ latestForAgent(agentId: string): Promise<ErrorRecord | undefined>;
25
+ latestBootstrapForAgent(agentId: string): Promise<ErrorRecord | undefined>;
26
+ latestBootstrapByAgent(): Promise<Map<string, ErrorRecord>>;
27
+ purgeAgent(agentId: string): Promise<{
28
+ removed: number;
29
+ }>;
30
+ purgeBootstrapForAgent(agentId: string): Promise<{
31
+ removed: number;
32
+ }>;
33
+ sweepStaleBootstrapErrors(activeAgentIds: Set<string>): Promise<{
34
+ removed: number;
35
+ }>;
36
+ private rewriteFiltered;
37
+ toSummary(record: ErrorRecord): AgentErrorSummary;
38
+ private readAll;
39
+ }
40
+ //# sourceMappingURL=error-record-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-record-store.d.ts","sourceRoot":"","sources":["../../src/state/error-record-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,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