@llblab/pi-kit 0.3.2 → 0.5.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.
- package/AGENTS.md +3 -3
- package/BACKLOG.md +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +19 -10
- package/node_modules/@llblab/pi-actors/AGENTS.md +1 -0
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +6 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +16 -6
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +3 -3
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +6 -4
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +85 -18
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +2 -6
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +2 -31
- package/node_modules/@llblab/pi-actors/docs/recipe-library.md +1 -1
- package/node_modules/@llblab/pi-actors/package.json +1 -1
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +16 -6
- package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +3 -3
- package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +6 -4
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +85 -18
- package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +2 -6
- package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +2 -31
- package/node_modules/@llblab/pi-clean-room/AGENTS.md +5 -0
- package/node_modules/@llblab/pi-clean-room/BACKLOG.md +3 -0
- package/node_modules/@llblab/pi-clean-room/CHANGELOG.md +15 -0
- package/node_modules/@llblab/pi-clean-room/README.md +61 -0
- package/node_modules/@llblab/pi-clean-room/banner.jpg +0 -0
- package/node_modules/@llblab/pi-clean-room/index.ts +178 -0
- package/node_modules/@llblab/pi-clean-room/package.json +53 -0
- package/node_modules/@llblab/pi-grow-loop/AGENTS.md +1 -1
- package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +4 -0
- package/node_modules/@llblab/pi-grow-loop/package.json +1 -1
- package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +3 -17
- package/node_modules/@llblab/pi-state-flow/AGENTS.md +28 -0
- package/node_modules/@llblab/pi-state-flow/BACKLOG.md +3 -0
- package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +79 -0
- package/node_modules/@llblab/pi-state-flow/README.md +197 -0
- package/node_modules/@llblab/pi-state-flow/index.ts +4 -0
- package/node_modules/@llblab/pi-state-flow/lib/context.ts +88 -0
- package/node_modules/@llblab/pi-state-flow/lib/episode.ts +29 -0
- package/node_modules/@llblab/pi-state-flow/lib/extension.ts +238 -0
- package/node_modules/@llblab/pi-state-flow/lib/json.ts +78 -0
- package/node_modules/@llblab/pi-state-flow/lib/recovery.ts +38 -0
- package/node_modules/@llblab/pi-state-flow/lib/session.ts +49 -0
- package/node_modules/@llblab/pi-state-flow/lib/skills.ts +58 -0
- package/node_modules/@llblab/pi-state-flow/lib/snapshot.ts +103 -0
- package/node_modules/@llblab/pi-state-flow/lib/state.ts +20 -0
- package/node_modules/@llblab/pi-state-flow/lib/status.ts +16 -0
- package/node_modules/@llblab/pi-state-flow/lib/terminal.ts +148 -0
- package/node_modules/@llblab/pi-state-flow/lib/transition.ts +47 -0
- package/node_modules/@llblab/pi-state-flow/lib/validation.ts +27 -0
- package/node_modules/@llblab/pi-state-flow/package.json +55 -0
- package/node_modules/@llblab/pi-telegram/BACKLOG.md +3 -0
- package/node_modules/@llblab/pi-telegram/CHANGELOG.md +18 -0
- package/node_modules/@llblab/pi-telegram/README.md +2 -2
- package/node_modules/@llblab/pi-telegram/docs/README.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/architecture.md +5 -3
- package/node_modules/@llblab/pi-telegram/docs/compact-matrix-literal.md +39 -11
- package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +2 -2
- package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +17 -5
- package/node_modules/@llblab/pi-telegram/docs/outbound.md +6 -4
- package/node_modules/@llblab/pi-telegram/docs/public-api.md +1 -1
- package/node_modules/@llblab/pi-telegram/index.ts +13 -1
- package/node_modules/@llblab/pi-telegram/lib/bindings.ts +12 -3
- package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +29 -18
- package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +15 -6
- package/node_modules/@llblab/pi-telegram/lib/bus.ts +11 -4
- package/node_modules/@llblab/pi-telegram/lib/keyboard.ts +5 -3
- package/node_modules/@llblab/pi-telegram/lib/outbound-buttons.ts +72 -15
- package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +81 -9
- package/node_modules/@llblab/pi-telegram/lib/outbound.ts +2 -0
- package/node_modules/@llblab/pi-telegram/lib/replies.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/routing.ts +89 -32
- package/node_modules/@llblab/pi-telegram/lib/sync.ts +74 -15
- package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +32 -1
- package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +17 -0
- package/node_modules/@llblab/pi-telegram/lib/threads.ts +123 -15
- package/node_modules/@llblab/pi-telegram/package.json +1 -1
- package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/SKILL.md +4 -2
- package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/references/layout-and-state.md +4 -2
- package/node_modules/@llblab/pi-telegram/skills/generative-apps/SKILL.md +4 -3
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +19 -8
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/references/diagnosis.md +4 -2
- package/node_modules/@llblab/skills/abcd-context/AGENTS.md +40 -0
- package/node_modules/@llblab/skills/abcd-context/BACKLOG.md +3 -0
- package/node_modules/@llblab/skills/abcd-context/CHANGELOG.md +19 -0
- package/node_modules/@llblab/skills/abcd-context/README.md +30 -0
- package/node_modules/@llblab/skills/abcd-context/SKILL.md +122 -0
- package/node_modules/@llblab/skills/abcd-context/docs/README.md +9 -0
- package/node_modules/@llblab/skills/abcd-context/docs/protocols.md +199 -0
- package/node_modules/@llblab/skills/abcd-context/docs/templates.md +194 -0
- package/node_modules/@llblab/skills/abcd-context/docs/validation-design.md +117 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/AGENTS.md +10 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/BACKLOG.md +5 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/CHANGELOG.md +5 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/README.md +10 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/README.md +7 -0
- package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/overview.md +3 -0
- package/node_modules/@llblab/skills/abcd-context/recipes/validate-context.json +7 -0
- package/node_modules/@llblab/skills/abcd-context/scripts/_self-test.mjs +244 -0
- package/node_modules/@llblab/skills/abcd-context/scripts/validate-context.mjs +497 -0
- package/node_modules/@llblab/skills/brain-storm/AGENTS.md +5 -0
- package/node_modules/@llblab/skills/brain-storm/SKILL.md +321 -0
- package/node_modules/@llblab/skills/coding-contract/SKILL.md +228 -0
- package/node_modules/@llblab/skills/domain-dag/AGENTS.md +6 -0
- package/node_modules/@llblab/skills/domain-dag/SKILL.md +257 -0
- package/node_modules/@llblab/skills/domain-dag/domain-dag.json +9 -0
- package/node_modules/@llblab/skills/domain-dag/recipes/validate-domain-dag.json +7 -0
- package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.mjs +771 -0
- package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.sh +4 -0
- package/node_modules/@llblab/skills/edge-tts/AGENTS.md +19 -0
- package/node_modules/@llblab/skills/edge-tts/SKILL.md +56 -0
- package/node_modules/@llblab/skills/edge-tts/recipes/say-edge.json +9 -0
- package/node_modules/@llblab/skills/edge-tts/scripts/say.mjs +1548 -0
- package/node_modules/@llblab/skills/edge-tts/scripts/say.sh +4 -0
- package/node_modules/@llblab/skills/extra-self/SKILL.md +229 -0
- package/node_modules/@llblab/skills/frontend-design/SKILL.md +78 -0
- package/node_modules/@llblab/skills/groq-stt/AGENTS.md +15 -0
- package/node_modules/@llblab/skills/groq-stt/SKILL.md +35 -0
- package/node_modules/@llblab/skills/groq-stt/recipes/transcribe-groq.json +10 -0
- package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.mjs +190 -0
- package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.sh +4 -0
- package/node_modules/@llblab/skills/mistral-stt/AGENTS.md +15 -0
- package/node_modules/@llblab/skills/mistral-stt/SKILL.md +35 -0
- package/node_modules/@llblab/skills/mistral-stt/recipes/transcribe-mistral.json +10 -0
- package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.mjs +191 -0
- package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.sh +4 -0
- package/node_modules/@llblab/skills/package.json +46 -0
- package/node_modules/@llblab/skills/re-review/SKILL.md +318 -0
- package/node_modules/@llblab/skills/release-flow/SKILL.md +456 -0
- package/node_modules/@llblab/skills/show-me/SKILL.md +144 -0
- package/package.json +20 -8
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +0 -143
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +0 -143
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { readFile, stat } from "node:fs/promises";
|
|
4
|
+
import { basename } from "node:path";
|
|
5
|
+
import { argv, env, stderr, stdout } from "node:process";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
|
|
8
|
+
// --- Constants ---
|
|
9
|
+
|
|
10
|
+
const API_KEY = env.MISTRAL_API_KEY;
|
|
11
|
+
const DEFAULTS = {
|
|
12
|
+
model: "voxtral-mini-latest",
|
|
13
|
+
endpoint: "https://api.mistral.ai/v1/audio/transcriptions",
|
|
14
|
+
};
|
|
15
|
+
const CLI_FLAGS = new Map([
|
|
16
|
+
["--help", "help"],
|
|
17
|
+
["-h", "help"],
|
|
18
|
+
]);
|
|
19
|
+
const CLI_VALUES = new Map([
|
|
20
|
+
["--file", "file"],
|
|
21
|
+
["-f", "file"],
|
|
22
|
+
["--lang", "language"],
|
|
23
|
+
["--language", "language"],
|
|
24
|
+
["-l", "language"],
|
|
25
|
+
["--model", "model"],
|
|
26
|
+
["-m", "model"],
|
|
27
|
+
["--diarize", "diarize"],
|
|
28
|
+
["-d", "diarize"],
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
// --- CLI ---
|
|
32
|
+
|
|
33
|
+
function usage() {
|
|
34
|
+
return [
|
|
35
|
+
"Usage:",
|
|
36
|
+
` MISTRAL_API_KEY=xxx ${argv[1]} audio.ogg [language] [model] [diarize]`,
|
|
37
|
+
` MISTRAL_API_KEY=xxx ${argv[1]} --file audio.ogg [--lang ru] [--model ${DEFAULTS.model}] [--diarize true]`,
|
|
38
|
+
"",
|
|
39
|
+
"Outputs only transcription text on stdout.",
|
|
40
|
+
].join("\n");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function parseArgs(args) {
|
|
44
|
+
const options = {
|
|
45
|
+
file: "",
|
|
46
|
+
language: "",
|
|
47
|
+
model: DEFAULTS.model,
|
|
48
|
+
diarize: false,
|
|
49
|
+
help: false,
|
|
50
|
+
};
|
|
51
|
+
const positional = [];
|
|
52
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
53
|
+
const arg = args[index];
|
|
54
|
+
if (CLI_FLAGS.has(arg)) {
|
|
55
|
+
options[CLI_FLAGS.get(arg)] = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (CLI_VALUES.has(arg)) {
|
|
59
|
+
const key = CLI_VALUES.get(arg);
|
|
60
|
+
const value = args[index + 1];
|
|
61
|
+
if (!value || value.startsWith("--"))
|
|
62
|
+
throw new Error(`Missing value for ${arg}`);
|
|
63
|
+
options[key] = value;
|
|
64
|
+
index += 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (arg.startsWith("--")) throw new Error(`Unknown option: ${arg}`);
|
|
68
|
+
positional.push(arg);
|
|
69
|
+
}
|
|
70
|
+
options.file ||= positional[0] ?? "";
|
|
71
|
+
options.language ||= positional[1] ?? "";
|
|
72
|
+
options.model =
|
|
73
|
+
options.model === DEFAULTS.model
|
|
74
|
+
? (positional[2] ?? options.model)
|
|
75
|
+
: options.model;
|
|
76
|
+
const diarize =
|
|
77
|
+
options.diarize === false ? (positional[3] ?? false) : options.diarize;
|
|
78
|
+
if (![true, false, "true", "false"].includes(diarize))
|
|
79
|
+
throw new Error("diarize must be true or false");
|
|
80
|
+
options.diarize = diarize === true || diarize === "true";
|
|
81
|
+
return options;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function assertReadableFile(file) {
|
|
85
|
+
try {
|
|
86
|
+
const info = await stat(file);
|
|
87
|
+
if (!info.isFile()) throw new Error("not a file");
|
|
88
|
+
} catch {
|
|
89
|
+
throw new Error(`Audio file not found: ${file}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function createAudioBlob(buffer, file) {
|
|
94
|
+
return new Blob([buffer], { type: guessMimeType(file) });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function guessMimeType(file) {
|
|
98
|
+
const lower = file.toLowerCase();
|
|
99
|
+
if (lower.endsWith(".ogg") || lower.endsWith(".oga")) return "audio/ogg";
|
|
100
|
+
if (lower.endsWith(".mp3")) return "audio/mpeg";
|
|
101
|
+
if (lower.endsWith(".wav")) return "audio/wav";
|
|
102
|
+
if (lower.endsWith(".m4a") || lower.endsWith(".mp4")) return "audio/mp4";
|
|
103
|
+
if (lower.endsWith(".webm")) return "audio/webm";
|
|
104
|
+
if (lower.endsWith(".flac")) return "audio/flac";
|
|
105
|
+
return "application/octet-stream";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function formatTime(seconds) {
|
|
109
|
+
const safeSeconds = Number.isFinite(Number(seconds)) ? Number(seconds) : 0;
|
|
110
|
+
const hours = Math.floor(safeSeconds / 3600)
|
|
111
|
+
.toString()
|
|
112
|
+
.padStart(2, "0");
|
|
113
|
+
const minutes = Math.floor((safeSeconds % 3600) / 60)
|
|
114
|
+
.toString()
|
|
115
|
+
.padStart(2, "0");
|
|
116
|
+
const wholeSeconds = Math.floor(safeSeconds % 60)
|
|
117
|
+
.toString()
|
|
118
|
+
.padStart(2, "0");
|
|
119
|
+
return `${hours}:${minutes}:${wholeSeconds}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function formatDiarizedSegments(segments) {
|
|
123
|
+
return segments
|
|
124
|
+
.map((segment) => {
|
|
125
|
+
const text = (segment.text ?? "").trim();
|
|
126
|
+
if (!text) return "";
|
|
127
|
+
const speaker = segment.speaker_id ?? "Unknown speaker";
|
|
128
|
+
return `[${formatTime(segment.start)}|${speaker}] ${text}`;
|
|
129
|
+
})
|
|
130
|
+
.filter(Boolean)
|
|
131
|
+
.join("\n");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function transcribe({ file, language, model, diarize }) {
|
|
135
|
+
await assertReadableFile(file);
|
|
136
|
+
if (!API_KEY) throw new Error("MISTRAL_API_KEY is required");
|
|
137
|
+
const audio = await readFile(file);
|
|
138
|
+
const form = new FormData();
|
|
139
|
+
form.append("file", createAudioBlob(audio, file), basename(file));
|
|
140
|
+
form.append("model", model);
|
|
141
|
+
form.append("response_format", "json");
|
|
142
|
+
if (language) form.append("language", language);
|
|
143
|
+
if (diarize) {
|
|
144
|
+
form.append("diarize", "true");
|
|
145
|
+
form.append("timestamp_granularities", "segment");
|
|
146
|
+
}
|
|
147
|
+
const response = await fetch(DEFAULTS.endpoint, {
|
|
148
|
+
method: "POST",
|
|
149
|
+
headers: { Authorization: `Bearer ${API_KEY}` },
|
|
150
|
+
body: form,
|
|
151
|
+
});
|
|
152
|
+
if (!response.ok) {
|
|
153
|
+
const details = await response.text().catch(() => response.statusText);
|
|
154
|
+
throw new Error(`Mistral API error: ${response.status} ${details}`.trim());
|
|
155
|
+
}
|
|
156
|
+
const data = await response.json();
|
|
157
|
+
if (diarize && Array.isArray(data.segments))
|
|
158
|
+
return formatDiarizedSegments(data.segments) || data.text || "";
|
|
159
|
+
return data.text ?? "";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function isDirectCliEntrypoint(metaUrl, entryPath) {
|
|
163
|
+
if (!entryPath) return false;
|
|
164
|
+
try {
|
|
165
|
+
return realpathSync(fileURLToPath(metaUrl)) === realpathSync(entryPath);
|
|
166
|
+
} catch {
|
|
167
|
+
return metaUrl === pathToFileURL(entryPath).href;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async function main() {
|
|
172
|
+
const options = parseArgs(argv.slice(2));
|
|
173
|
+
if (options.help) {
|
|
174
|
+
stdout.write(`${usage()}\n`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (!options.file) throw new Error(usage());
|
|
178
|
+
const text = await transcribe(options);
|
|
179
|
+
stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (isDirectCliEntrypoint(import.meta.url, argv[1])) {
|
|
183
|
+
try {
|
|
184
|
+
await main();
|
|
185
|
+
} catch (error) {
|
|
186
|
+
stderr.write(`${error.message}\n`);
|
|
187
|
+
process.exitCode = 2;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { formatDiarizedSegments, parseArgs };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@llblab/skills",
|
|
3
|
+
"version": "1.14.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Dream Skills",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"skills",
|
|
8
|
+
"ai",
|
|
9
|
+
"agent",
|
|
10
|
+
"tts",
|
|
11
|
+
"stt"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/llblab/skills/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/llblab/skills.git"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"validate": "npm audit --omit=dev && npm pack --dry-run"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"abcd-context/",
|
|
26
|
+
"brain-storm/",
|
|
27
|
+
"coding-contract/",
|
|
28
|
+
"domain-dag/",
|
|
29
|
+
"edge-tts/",
|
|
30
|
+
"extra-self/",
|
|
31
|
+
"frontend-design/",
|
|
32
|
+
"groq-stt/",
|
|
33
|
+
"mistral-stt/",
|
|
34
|
+
"re-review/",
|
|
35
|
+
"release-flow/",
|
|
36
|
+
"show-me/"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"pi": {
|
|
42
|
+
"skills": [
|
|
43
|
+
"./"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: re-review
|
|
3
|
+
description: Evidence-grounded review for code, diffs, PRs, documents, plans, specs, and architecture. Use for evidence review, review, code review, quick review, sanity check, quality check, architecture review, production readiness, security review, scaling review, document review, over-engineering review, simplification review, what can be deleted, bloat, evaluate, or check.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Re-Review
|
|
7
|
+
|
|
8
|
+
One careful reviewer. Fast when scope is small, deep when risk is high, decision-grade when architecture is the target. For high-stakes or ambiguous work, the reviewer can temporarily simulate multiple independent lenses, then synthesize only evidence-backed claims.
|
|
9
|
+
|
|
10
|
+
## Boundaries
|
|
11
|
+
|
|
12
|
+
This skill may read code, tests, diffs, docs, logs, configs, local validation output, cited sources, and user-provided evidence.
|
|
13
|
+
This skill may run non-destructive inspection commands, linters, tests, and diff commands.
|
|
14
|
+
This skill may write a review document only when the user explicitly asks for a file artifact.
|
|
15
|
+
This skill must not edit implementation, rewrite tests, commit, push, publish, deploy, or post external comments.
|
|
16
|
+
This is a review, not a fix. Findings first; remediation starts only after the user asks.
|
|
17
|
+
|
|
18
|
+
## Modes
|
|
19
|
+
|
|
20
|
+
- **Quick** — Sanity check for small diffs. One pass, strongest 1-5 findings, no broad scan.
|
|
21
|
+
- **Focused** — Default mode for diffs, PRs, files, documents, plans, specs, and modules.
|
|
22
|
+
- **Architecture** — Platform, directory, scaling readiness, migration, CTO handoff, or production readiness. Use the 90/10 architecture lens.
|
|
23
|
+
- **High-stakes** — Security, money, auth, data loss, privacy, migrations, or irreversible decisions.
|
|
24
|
+
- **Verification** — Re-review prior findings, review comments, or requested changes against a revised artifact or diff.
|
|
25
|
+
- **Multi-lens** — Optional pattern for high-risk or broad reviews: run 3-5 independent cognitive lenses before synthesis.
|
|
26
|
+
- **Fact-check** — Verify specific claims against provided or inspectable evidence, sources, logs, docs, or code.
|
|
27
|
+
|
|
28
|
+
If the mode is ambiguous and no safe default exists, ask the user to choose Quick, Focused, Architecture, or Verification.
|
|
29
|
+
|
|
30
|
+
## Phase 1: Scope
|
|
31
|
+
|
|
32
|
+
**Entry**: The user asked for a review or provided a target.
|
|
33
|
+
|
|
34
|
+
Determine target and mode:
|
|
35
|
+
|
|
36
|
+
- No target means current branch diff.
|
|
37
|
+
- PR URL or number means PR diff.
|
|
38
|
+
- File path means that file plus call sites and tests.
|
|
39
|
+
- Directory path means architecture or module review.
|
|
40
|
+
- Markdown plan, spec, brainstorm, or ADR means document review.
|
|
41
|
+
|
|
42
|
+
Gather minimum context:
|
|
43
|
+
|
|
44
|
+
1. Read project instructions such as `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, or `GEMINI.md` when present.
|
|
45
|
+
2. Inspect git status and diff when reviewing current work.
|
|
46
|
+
3. Read implementation and tests together when code is in scope.
|
|
47
|
+
4. Read related docs, plans, schemas, routes, configs, and call sites when they affect correctness.
|
|
48
|
+
5. Identify risk areas such as auth, secrets, validation, money, migrations, concurrency, privacy, and external APIs.
|
|
49
|
+
6. For architecture mode, identify team constraints, target scale, deployment shape, and critical flows.
|
|
50
|
+
7. For verification mode, identify the original findings or requested changes, the claimed fixes, and the revised artifact or diff.
|
|
51
|
+
8. For multi-lens mode, choose only lenses that fit the risk: security, correctness, tests, architecture, operations, UX, economics, migration, or devil's advocate.
|
|
52
|
+
|
|
53
|
+
**Exit**: Scope, mode, conventions, and risk areas are known.
|
|
54
|
+
|
|
55
|
+
## Phase 2: Inspect
|
|
56
|
+
|
|
57
|
+
**Entry**: Scope is known.
|
|
58
|
+
|
|
59
|
+
Review from evidence, not impressions.
|
|
60
|
+
|
|
61
|
+
For code, inspect:
|
|
62
|
+
|
|
63
|
+
- Correctness, edge cases, invariants, state transitions, and error handling.
|
|
64
|
+
- Security, auth, authorization, input validation, secrets, injection, CSRF, SSRF, and rate limits.
|
|
65
|
+
- Tests, meaningful assertions, negative paths, integration seams, fixtures, and false confidence.
|
|
66
|
+
- Simplicity, YAGNI, one-use abstractions, dead branches, duplicated logic, and misleading names.
|
|
67
|
+
- Maintainability, dependency direction, coupling, ownership, public contracts, and migration safety.
|
|
68
|
+
- Performance, N plus one behavior, blocking work, memory growth, query shape, and hot paths.
|
|
69
|
+
|
|
70
|
+
When the request centers on simplification or over-engineering, apply a minimum-sufficient-change, deletion-first lens after tracing the real flow: remove unnecessary work, inline one-use indirection, reuse an established local path, prefer standard-library or native capabilities, and use an already-installed dependency before proposing custom machinery. Report each surviving finding as the exact cut plus its simpler replacement. Do not flag complexity that demonstrably pays for safety, correctness, operability, accessibility, or an explicit requirement.
|
|
71
|
+
|
|
72
|
+
For documents, inspect:
|
|
73
|
+
|
|
74
|
+
- Why the decision exists, not only what will be done.
|
|
75
|
+
- Scope, non-goals, constraints, acceptance criteria, and rejection criteria.
|
|
76
|
+
- Risks, trade-offs, migration plan, rollback plan, and open questions.
|
|
77
|
+
- Whether an autonomous implementer could start safely from the document.
|
|
78
|
+
- Whether subjective work has references, anti-references, and preview gates.
|
|
79
|
+
- Whether factual claims trace to evidence and disclose uncertainty.
|
|
80
|
+
|
|
81
|
+
For mode-specific inspection, use the owning section:
|
|
82
|
+
|
|
83
|
+
- Architecture → [Architecture 90/10 Lens](#architecture-9010-lens).
|
|
84
|
+
- Verification → [Verification Re-Review Lens](#verification-re-review-lens).
|
|
85
|
+
- Fact-checking → [Evidence and Fact-Check Lens](#evidence-and-fact-check-lens).
|
|
86
|
+
|
|
87
|
+
**Exit**: Candidate findings exist with supporting evidence.
|
|
88
|
+
|
|
89
|
+
## Architecture 90/10 Lens
|
|
90
|
+
|
|
91
|
+
Use this when Architecture mode is active. Do enough to make decisions without turning the review into a full consulting engagement.
|
|
92
|
+
|
|
93
|
+
1. Map entrypoints, runtimes, stores, queues, external services, auth boundaries, deployment, and ownership from code, configs, and docs.
|
|
94
|
+
2. Verify claims against implementation. Docs are leads, not truth.
|
|
95
|
+
3. Trace the top three critical flows end-to-end.
|
|
96
|
+
4. For each critical flow, identify persisted state, lost state, retry path, and manual recovery.
|
|
97
|
+
5. Find bottlenecks and single points of failure: connection pools, queues, synchronous external calls, hot queries, and CPU work.
|
|
98
|
+
6. Check minimum production readiness: errors, alerts, logs, backups, rollback, admin path, CI, and environment separation.
|
|
99
|
+
7. Convert major choices into ADR candidates with 2-4 options and one recommended minimum.
|
|
100
|
+
8. Sequence work into the first safe slice, next slices, and external gates.
|
|
101
|
+
|
|
102
|
+
## Evidence and Fact-Check Lens
|
|
103
|
+
|
|
104
|
+
Use this when the review depends on external sources, citations, claims, logs, measurements, or research-like evidence.
|
|
105
|
+
|
|
106
|
+
Rules:
|
|
107
|
+
|
|
108
|
+
1. Identify each material claim's exact scope and implied confidence; require traceable evidence or an explicit uncertainty label.
|
|
109
|
+
2. Primary sources beat summaries; independent corroboration beats repeated copies of the same claim.
|
|
110
|
+
3. Assess source quality, recency, and conflicts of interest: peer-reviewed or official records, reputable primary data, reproducible logs, then gray literature or commentary.
|
|
111
|
+
4. Disclose contradictions and plausible alternative explanations; do not average them away.
|
|
112
|
+
5. A source can prove existence without proving interpretation; check what the evidence actually supports.
|
|
113
|
+
6. Gray zone is not verified. If required evidence is missing, say `Not verified` or `Not checkable` and name the missing evidence.
|
|
114
|
+
|
|
115
|
+
Useful output statuses:
|
|
116
|
+
|
|
117
|
+
- **Supported** — Evidence directly supports the claim.
|
|
118
|
+
- **Partially supported** — Evidence supports a narrower claim or leaves a material gap.
|
|
119
|
+
- **Contradicted** — Evidence conflicts with the claim.
|
|
120
|
+
- **Not verified** — Evidence was sought but does not establish the claim.
|
|
121
|
+
- **Not checkable** — Evidence is unavailable in the current scope.
|
|
122
|
+
|
|
123
|
+
For claim-heavy documents, include an evidence map only for material claims; do not turn small reviews into bibliography work.
|
|
124
|
+
|
|
125
|
+
## Verification Re-Review Lens
|
|
126
|
+
|
|
127
|
+
Use this when the user asks whether fixes, revisions, or responses addressed earlier findings.
|
|
128
|
+
|
|
129
|
+
Build a compact traceability matrix using one bullet per original item:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
- **[VR-1] Original item**: <finding or requested change>
|
|
133
|
+
- Claimed fix: <summary or none>
|
|
134
|
+
- Evidence checked: <files, lines, commands, quoted text>
|
|
135
|
+
- Status: <Verified | Partially verified | Not verified | Obsolete | Not checkable>
|
|
136
|
+
- Residual risk: <remaining concern or none>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Allowed statuses:
|
|
140
|
+
|
|
141
|
+
- **Verified** — The failure scenario is addressed with supporting evidence.
|
|
142
|
+
- **Partially verified** — Some evidence supports the fix, but a gap remains.
|
|
143
|
+
- **Not verified** — The claimed fix is absent or does not address the issue.
|
|
144
|
+
- **Obsolete** — The original item no longer applies because the surrounding design changed.
|
|
145
|
+
- **Not checkable** — Required evidence is unavailable; explain exactly what is missing.
|
|
146
|
+
|
|
147
|
+
Independently inspect the revised artifact, not only the response or summary; check both the original failure scenario and regressions introduced by the revision.
|
|
148
|
+
|
|
149
|
+
## Multi-Lens Review Pattern
|
|
150
|
+
|
|
151
|
+
Use this only when risk or breadth justifies it. Choose the smallest useful lens set.
|
|
152
|
+
|
|
153
|
+
Common lenses:
|
|
154
|
+
|
|
155
|
+
- **Correctness** — Invariants, edge cases, state transitions, and data contracts.
|
|
156
|
+
- **Security** — Auth, authorization, secrets, injection, privacy, and abuse paths.
|
|
157
|
+
- **Tests** — Meaningful assertions, negative paths, integration seams, and false confidence.
|
|
158
|
+
- **Architecture** — Ownership, dependency direction, public contracts, migration safety, and operability.
|
|
159
|
+
- **Operations** — Logs, alerts, recovery, rollback, background work, queues, and manual intervention.
|
|
160
|
+
- **UX / Operator UX** — Error clarity, affordances, defaults, and human recovery paths.
|
|
161
|
+
- **Economics** — Cost, latency, quota, support burden, and operational leverage.
|
|
162
|
+
- **Devil's Advocate** — Strongest counter-argument, hidden assumptions, cherry-picking, overgeneralization, and "so what?" test.
|
|
163
|
+
|
|
164
|
+
Rules:
|
|
165
|
+
|
|
166
|
+
1. Lenses inspect independently before synthesis.
|
|
167
|
+
2. Duplicate findings are merged, not counted as stronger unless the evidence differs.
|
|
168
|
+
3. Synthesis cannot fabricate claims; every final finding must trace to evidence or a lens note.
|
|
169
|
+
4. Devil's Advocate critical issues cannot be silently downgraded; either preserve them or explain why evidence disproves them.
|
|
170
|
+
5. Disclose confidence and blind spots when scope, time, tooling, or missing files limit the review.
|
|
171
|
+
|
|
172
|
+
## Artifact Mode
|
|
173
|
+
|
|
174
|
+
Use artifact mode when the user asks for a file, the review is a handoff, or findings exceed what fits cleanly in chat.
|
|
175
|
+
Do not write artifacts by default. If useful but not requested, offer it.
|
|
176
|
+
|
|
177
|
+
Default paths:
|
|
178
|
+
|
|
179
|
+
- Focused review: `docs/reviews/YYYY-MM-DD-<slug>.md`
|
|
180
|
+
- Architecture review: `docs/reviews/YYYY-MM-DD-architecture-<slug>.md`
|
|
181
|
+
- Existing project convention wins over defaults.
|
|
182
|
+
|
|
183
|
+
Artifact structure:
|
|
184
|
+
|
|
185
|
+
```markdown
|
|
186
|
+
# Review: <scope>
|
|
187
|
+
|
|
188
|
+
Date: <YYYY-MM-DD>
|
|
189
|
+
Mode: <Quick | Focused | Architecture | High-stakes>
|
|
190
|
+
Verdict: <verdict>
|
|
191
|
+
|
|
192
|
+
## Executive Summary
|
|
193
|
+
|
|
194
|
+
...
|
|
195
|
+
|
|
196
|
+
## Evidence Map
|
|
197
|
+
|
|
198
|
+
...
|
|
199
|
+
|
|
200
|
+
## Findings
|
|
201
|
+
|
|
202
|
+
...
|
|
203
|
+
|
|
204
|
+
## Architecture Addendum
|
|
205
|
+
|
|
206
|
+
...
|
|
207
|
+
|
|
208
|
+
## ADR Candidates
|
|
209
|
+
|
|
210
|
+
...
|
|
211
|
+
|
|
212
|
+
## Execution Order
|
|
213
|
+
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
## Appendix
|
|
217
|
+
|
|
218
|
+
Checked files and commands.
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
When writing an artifact, include checked files, commands, assumptions, uncertainty, and evidence type for major claims.
|
|
222
|
+
|
|
223
|
+
## Phase 3: Challenge
|
|
224
|
+
|
|
225
|
+
**Entry**: Candidate findings exist.
|
|
226
|
+
|
|
227
|
+
Challenge every finding:
|
|
228
|
+
|
|
229
|
+
1. Is this a real failure, risk, or decision gap rather than a preference?
|
|
230
|
+
2. What concrete scenario triggers the problem?
|
|
231
|
+
3. What evidence proves it?
|
|
232
|
+
4. What would disprove it?
|
|
233
|
+
5. Is severity honest?
|
|
234
|
+
6. Can the intended team operate the suggested solution within its constraints?
|
|
235
|
+
|
|
236
|
+
Drop findings that cannot survive this challenge.
|
|
237
|
+
Mark uncertainty explicitly instead of pretending confidence.
|
|
238
|
+
For high-stakes reviews, perform an independent second pass or subagent pass when available, then reconcile disagreements against evidence.
|
|
239
|
+
|
|
240
|
+
**Exit**: Findings are verified, deduplicated, and severity-ranked.
|
|
241
|
+
|
|
242
|
+
## Phase 4: Report
|
|
243
|
+
|
|
244
|
+
**Entry**: Findings are verified.
|
|
245
|
+
|
|
246
|
+
Report only useful signal. Put the most important issues first.
|
|
247
|
+
|
|
248
|
+
```markdown
|
|
249
|
+
## Review: <scope>
|
|
250
|
+
|
|
251
|
+
### Verdict
|
|
252
|
+
|
|
253
|
+
APPROVE / APPROVE WITH NOTES / REQUEST CHANGES / READY /
|
|
254
|
+
NEEDS REFINEMENT / FIT WITH GAPS / NOT READY
|
|
255
|
+
|
|
256
|
+
### Critical Issues
|
|
257
|
+
|
|
258
|
+
- **[CRIT-1]** path#line — Finding. Evidence. Failure scenario. Suggested direction.
|
|
259
|
+
|
|
260
|
+
### Suggestions
|
|
261
|
+
|
|
262
|
+
- **[SUG-1]** path#line — Improvement. Trade-off if ignored.
|
|
263
|
+
|
|
264
|
+
### Observations
|
|
265
|
+
|
|
266
|
+
- **[OBS-1]** Useful context that does not block shipping.
|
|
267
|
+
|
|
268
|
+
### Document Gaps
|
|
269
|
+
|
|
270
|
+
- **[GAP-1]** Missing contract or unclear criterion. Why it matters.
|
|
271
|
+
|
|
272
|
+
### Architecture Addendum
|
|
273
|
+
|
|
274
|
+
- System map, ADR candidates, failure modes, production readiness, risks, and execution order when architecture is in scope.
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Omit empty sections.
|
|
278
|
+
If no issues are found, say so clearly and name what was checked.
|
|
279
|
+
Do not invent problems to look useful.
|
|
280
|
+
|
|
281
|
+
**Exit**: Review delivered with a clear verdict.
|
|
282
|
+
|
|
283
|
+
## Phase 5: Handoff
|
|
284
|
+
|
|
285
|
+
**Entry**: Review has been delivered.
|
|
286
|
+
|
|
287
|
+
Offer the next step without doing it automatically:
|
|
288
|
+
|
|
289
|
+
- Address findings.
|
|
290
|
+
- Discuss or challenge a finding.
|
|
291
|
+
- Create a fix plan.
|
|
292
|
+
- Capture a recurring pattern in project context.
|
|
293
|
+
- Stop.
|
|
294
|
+
|
|
295
|
+
If the user asks to fix issues, exit review mode and switch to the normal coding contract.
|
|
296
|
+
|
|
297
|
+
## Example
|
|
298
|
+
|
|
299
|
+
Strong finding:
|
|
300
|
+
|
|
301
|
+
```markdown
|
|
302
|
+
- **[CRIT-1]** `src/auth/session.ts#42` — Expired sessions are accepted because `expiresAt` is parsed but never compared. A replayed cookie remains valid until signing key rotation. Check expiry before returning the session.
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Weak finding:
|
|
306
|
+
|
|
307
|
+
```markdown
|
|
308
|
+
- Auth looks risky.
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Severity Rules
|
|
312
|
+
|
|
313
|
+
- **Critical** — Likely bug, vulnerability, data loss, broken invariant, failed migration, or release blocker.
|
|
314
|
+
- **Suggestion** — Real improvement with a trade-off, but not a blocker.
|
|
315
|
+
- **Observation** — Useful context, pattern, or small hygiene note.
|
|
316
|
+
|
|
317
|
+
Nits belong only in Observations and only when they prevent confusion.
|
|
318
|
+
Do not mix style preferences with release blockers.
|