Adonis0123/adonis-skills / skills/agentic-review-handoff
agentic-review-handoff
VerifiedValidate pasted review findings before fixes; run same-session automatic Git review-fix-re-review with a headless Reviewer and no redundant confirmation; start fresh-eyes Git diff Review Intake; resume review-loop sessions or packets; get a DecisionConsult from another AI; or run first-principles/DDD/high-cohesion review. Requires Git and review/consult intent; ordinary implementation or commit-only requests do not start a review loop.
scripts/review-loop/sessions.mjs
View on GitHub/**
* `review-loop sessions` — list recorded reviewer channel sessions and print
* copy-ready resume commands per product (codex / grok / claude / pi).
*
* Read-only: scans `.review-handoff/runtime/<branch>/<packet>/reviewer-session.json`
* written by the adapter bookkeeping (T1). Command forms verified 2026-07-22:
* codex interactive `codex resume <id>` / headless `codex exec resume <id> "<prompt>"`
* claude interactive `claude --resume <id>` / headless `claude -p --resume <id> "<prompt>"`
* grok interactive `grok -r <id>` / headless `grok -r <id> -p "<prompt>"`
* pi interactive `pi --session-id <id>` / headless `pi -p --session-id <id> "<prompt>"`
* Note: Codex Desktop's session list hides `codex_exec`-originated sessions —
* the resume commands below are the reliable way back in.
*/
import fs from "node:fs";
import path from "node:path";
import { resolveRepoRoot } from "./repositories.mjs";
import {
assertLauncherMatchesProduct,
assertLauncherName,
} from "./adapters.mjs";
const PROMPT_PLACEHOLDER = "<prompt>";
// `cmd` is the account launcher recorded with the session (grok002, ...);
// resuming through a different account cannot find the session.
const RESUME_FORMS = {
codex: (id, cmd = "codex") => ({
interactive: `${cmd} resume ${id}`,
headless: `${cmd} exec resume ${id} "${PROMPT_PLACEHOLDER}"`,
}),
claude: (id, cmd = "claude") => ({
interactive: `${cmd} --resume ${id}`,
headless: `${cmd} -p --resume ${id} "${PROMPT_PLACEHOLDER}"`,
}),
grok: (id, cmd = "grok") => ({
interactive: `${cmd} -r ${id}`,
headless: `${cmd} -r ${id} -p "${PROMPT_PLACEHOLDER}"`,
}),
pi: (id, cmd = "pi") => ({
interactive: `${cmd} --session-id ${id}`,
headless: `${cmd} -p --session-id ${id} "${PROMPT_PLACEHOLDER}"`,
}),
};
/**
* @param {{ cwd?: string, repoRoot?: string, product?: string }} opts
*/
export function cmdSessions(opts = {}) {
const repoRoot = opts.repoRoot || resolveRepoRoot(opts.cwd || process.cwd());
const runtimeDir = path.join(repoRoot, ".review-handoff", "runtime");
/** @type {Array<Record<string, unknown>>} */
const sessions = [];
/**
* @param {string} file
* @param {Record<string, unknown>} where packetId or consultRecord
*/
const addRow = (file, where) => {
let record;
try {
record = JSON.parse(fs.readFileSync(file, "utf8"));
} catch {
return; // unreadable bookkeeping is not this command's failure
}
const { product, sessionId, updated, command } = record ?? {};
if (!product || !sessionId) return;
if (opts.product && opts.product !== product) return;
const forms = RESUME_FORMS[product];
// Rows become copy-paste commands; never echo a tampered launcher string.
let launcherOk = true;
if (command != null) {
try {
assertLauncherName(command);
assertLauncherMatchesProduct(command, product);
} catch {
launcherOk = false;
}
}
if (!launcherOk) {
sessions.push({
...where,
product,
sessionId,
updated: updated ?? null,
resume: {
interactive: null,
headless: null,
note: "invalid launcher name in session record",
},
});
return;
}
sessions.push({
...where,
product,
...(command ? { command } : {}),
sessionId,
updated: updated ?? null,
resume: forms
? forms(sessionId, command || undefined)
: {
interactive: null,
headless: null,
note: `unknown product "${product}"`,
},
});
};
const consultsDir = path.join(runtimeDir, "consults");
if (fs.existsSync(consultsDir)) {
for (const name of fs.readdirSync(consultsDir)) {
if (!name.endsWith(".session.json")) continue;
addRow(path.join(consultsDir, name), {
packetId: null,
consultRecord: path.join(
consultsDir,
name.replace(/\.session\.json$/, ".md"),
),
});
}
}
if (fs.existsSync(runtimeDir)) {
for (const branch of fs.readdirSync(runtimeDir, { withFileTypes: true })) {
if (!branch.isDirectory() || branch.name === "consults") continue;
const branchDir = path.join(runtimeDir, branch.name);
for (const packet of fs.readdirSync(branchDir, { withFileTypes: true })) {
if (!packet.isDirectory()) continue;
const file = path.join(branchDir, packet.name, "reviewer-session.json");
if (!fs.existsSync(file)) continue;
addRow(file, { packetId: `${branch.name}/${packet.name}` });
}
}
}
sessions.sort((a, b) =>
String(b.updated ?? "").localeCompare(String(a.updated ?? "")),
);
return {
ok: true,
repoRoot,
count: sessions.length,
sessions,
note:
sessions.length === 0
? "No reviewer or consult sessions recorded yet"
: `Replace ${PROMPT_PLACEHOLDER} with your follow-up question for headless form`,
};
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |