After each turn, posts a short peer-review checklist above the prompt.

After each turn, posts a short peer-review checklist above the prompt.
claude plugin marketplace add kenhuangus/claude-code-mods-pack
claude plugin install peer-reflect@kenhuang-modshooks/peer-reflect.mjs 43 lines1const NOTE = { plugin: "peer-reflect", key: "note" };
2const PENDING = { plugin: "peer-reflect", key: "pendingTools" };
3export function reflect(tools) {
4 const t = tools || [];
5 const bits = ["Did we verify with a test or repro?", "Any edge cases left unchecked?"];
6 if (t.includes("Bash")) bits.push("Was the shell command least-privilege?");
7 if (t.includes("Edit") || t.includes("Write")) bits.push("Any secrets or drive-by refactors?");
8 if (t.includes("Agent")) bits.push("Was a subagent necessary, or could the parent finish it?");
9 return "PEER: " + bits.slice(0, 3).join(" · ");
10}
11export function register(on) {
12 on("session.start", async ($, e, next) => {
13 const r = await next(e);
14 await $.state.set(NOTE, { text: "PEER: waiting for first turn", turn: 0 });
15 await $.state.set(PENDING, []);
16 return r;
17 });
18 on("tool.call", async ($, e, next) => {
19 if (e.tool) {
20 const { value: pending = [] } = await $.state.get(PENDING);
21 await $.state.set(PENDING, [...pending, String(e.tool)]);
22 }
23 return next(e);
24 });
25 on("turn.complete", async ($, e, next) => {
26 const r = await next(e);
27 if (e.agentId) return r;
28 const { value: pending = [] } = await $.state.get(PENDING);
29 const { value: note } = await $.state.get(NOTE);
30 const text = reflect(pending);
31 await $.state.set(NOTE, { text, turn: (note?.turn ?? 0) + 1 });
32 await $.state.set(PENDING, []);
33 return r;
34 });
35 on("ui.render", { component: "AbovePrompt" }, async ($, e, next) => {
36 if (e.props?.hasSurvey) return next(e);
37 const { value: note } = await $.state.get(NOTE);
38 if (!note?.text) return next(e);
39 const { Box, Text } = $.ui.resolve(e);
40 return Box({ paddingX: 1, children: [Text({ color: "cyan", children: note.text })] });
41 });
42}
43types/index.d.ts 9 lines1declare module "claude-code" {
2 interface PluginState {
3 "peer-reflect": {
4 note: { text: string; turn: number };
5 pendingTools: string[];
6 };
7 }
8}
9