@ask-llm/plugin 0.13.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/.claude-plugin/plugin.json +20 -0
- package/.mcp.json +3 -0
- package/LICENSE +21 -0
- package/README.md +135 -0
- package/agents/antigravity-reviewer.md +139 -0
- package/agents/brainstorm-coordinator.md +305 -0
- package/agents/codex-reviewer.md +194 -0
- package/agents/codex-verifier.md +149 -0
- package/agents/fable-reviewer.md +44 -0
- package/agents/gemini-reviewer.md +130 -0
- package/agents/ollama-reviewer.md +131 -0
- package/agents/sol-reviewer.md +60 -0
- package/codex-pair-defaults.json +4 -0
- package/dist/antigravity-run.d.ts +3 -0
- package/dist/antigravity-run.d.ts.map +1 -0
- package/dist/antigravity-run.js +32 -0
- package/dist/antigravity-run.js.map +1 -0
- package/dist/codex-run.d.ts +3 -0
- package/dist/codex-run.d.ts.map +1 -0
- package/dist/codex-run.js +32 -0
- package/dist/codex-run.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/ollama-run.d.ts +3 -0
- package/dist/ollama-run.d.ts.map +1 -0
- package/dist/ollama-run.js +32 -0
- package/dist/ollama-run.js.map +1 -0
- package/dist/run.d.ts +3 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +32 -0
- package/dist/run.js.map +1 -0
- package/hooks/hooks.json +55 -0
- package/package.json +104 -0
- package/pi/extensions/codex-pair.ts +870 -0
- package/pi/extensions/index.ts +13 -0
- package/pi/extensions/provider-tools.ts +241 -0
- package/pi/tsconfig.json +10 -0
- package/prompts/review.txt +75 -0
- package/scripts/codex-pair-debounce-worker.mjs +103 -0
- package/scripts/codex-pair-log.mjs +271 -0
- package/scripts/codex-pair-prompt-drain.mjs +81 -0
- package/scripts/codex-pair-session.mjs +194 -0
- package/scripts/codex-pair-stop-gate.mjs +271 -0
- package/scripts/codex-pair-watch.mjs +1525 -0
- package/scripts/lib/broker-lifecycle.mjs +575 -0
- package/scripts/lib/broker-rpc.mjs +203 -0
- package/scripts/lib/broker-transport.mjs +407 -0
- package/scripts/lib/broker.mjs +537 -0
- package/scripts/lib/debounce-state.mjs +208 -0
- package/scripts/lib/parser.d.mts +12 -0
- package/scripts/lib/parser.mjs +229 -0
- package/scripts/lib/process.mjs +39 -0
- package/scripts/lib/prompt.d.mts +8 -0
- package/scripts/lib/prompt.mjs +41 -0
- package/scripts/lib/session-registry.mjs +162 -0
- package/scripts/lib/state.d.mts +58 -0
- package/scripts/lib/state.mjs +733 -0
- package/scripts/lib/stop-gate.mjs +134 -0
- package/skills/antigravity-review/SKILL.md +49 -0
- package/skills/brainstorm/SKILL.md +105 -0
- package/skills/brainstorm-all/SKILL.md +43 -0
- package/skills/codex-image/SKILL.md +120 -0
- package/skills/codex-pair/SKILL.md +315 -0
- package/skills/codex-pair-ack/SKILL.md +64 -0
- package/skills/codex-pair-pause/SKILL.md +62 -0
- package/skills/codex-pair-resume/SKILL.md +52 -0
- package/skills/codex-review/SKILL.md +52 -0
- package/skills/codex-verify/SKILL.md +110 -0
- package/skills/compare/SKILL.md +151 -0
- package/skills/fable-review/SKILL.md +42 -0
- package/skills/gemini-review/SKILL.md +40 -0
- package/skills/multi-review/SKILL.md +182 -0
- package/skills/ollama-review/SKILL.md +40 -0
- package/skills/sol-review/SKILL.md +41 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// scripts/lib/stop-gate.mjs
|
|
2
|
+
// Pure, I/O-free gate logic for the codex-pair Stop hook (#142, ADR-118).
|
|
3
|
+
// No workspace imports — the hook ships without node_modules.
|
|
4
|
+
|
|
5
|
+
import { isAbsolute, join, relative } from "node:path";
|
|
6
|
+
import { hashConcernBody } from "./state.mjs";
|
|
7
|
+
|
|
8
|
+
// Parse `git status --porcelain=v1 -z` into a Set of ABSOLUTE paths that are
|
|
9
|
+
// modified or untracked relative to HEAD. repoRoot = `git rev-parse
|
|
10
|
+
// --show-toplevel`. NUL mode disables git's C-style path quoting and reverses
|
|
11
|
+
// rename fields: the first record is the destination path, followed by a second
|
|
12
|
+
// source-path record. Only the destination is dirty on disk.
|
|
13
|
+
export function parseGitPorcelain(stdout, repoRoot) {
|
|
14
|
+
const dirty = new Set();
|
|
15
|
+
const records = stdout.split("\0");
|
|
16
|
+
for (let i = 0; i < records.length; i++) {
|
|
17
|
+
const record = records[i];
|
|
18
|
+
if (record.length < 4) continue;
|
|
19
|
+
const status = record.slice(0, 2);
|
|
20
|
+
const path = record.slice(3);
|
|
21
|
+
dirty.add(isAbsolute(path) ? path : join(repoRoot, path));
|
|
22
|
+
// In -z mode, rename/copy source paths are the next bare NUL record.
|
|
23
|
+
if (status.includes("R") || status.includes("C")) i++;
|
|
24
|
+
}
|
|
25
|
+
return dirty;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Verdicts that don't carry a trustworthy final-state review. `skipped`/`error`
|
|
29
|
+
// carry a `file` field, so they can be a file's latest entry → [C] fail-opens on
|
|
30
|
+
// them. `retried`/`broker_fallback` are logged WITHOUT a `file` (transient
|
|
31
|
+
// per-attempt markers), so selectLatestEntries already excludes them and the
|
|
32
|
+
// file's true latest review (concerns/none/cached) is used — they're listed here
|
|
33
|
+
// for completeness/future-proofing, not because they're currently reachable.
|
|
34
|
+
const INDETERMINATE = new Set(["skipped", "error", "retried", "broker_fallback"]);
|
|
35
|
+
|
|
36
|
+
// Reconcile latest-per-file entries against present reality, returning the
|
|
37
|
+
// unacked HIGH findings that should block turn-end.
|
|
38
|
+
// entries Map<file, latestEntry> (from selectLatestEntries)
|
|
39
|
+
// acks { [hash]: {reason, ts} } (from readAcks)
|
|
40
|
+
// existsFn (absFile) => boolean (injected fs.existsSync)
|
|
41
|
+
// gitDirty Set<absPath> | null (null = no git filter)
|
|
42
|
+
// markerDir project root for relPath ack identity
|
|
43
|
+
export function collectBlockingHighs({ entries, acks, existsFn, gitDirty, markerDir }) {
|
|
44
|
+
const blocking = [];
|
|
45
|
+
for (const [file, entry] of entries) {
|
|
46
|
+
if (!existsFn(file)) continue; // [A] deleted/renamed
|
|
47
|
+
if (INDETERMINATE.has(entry.verdict)) continue; // [C] indeterminate latest → fail-open
|
|
48
|
+
if (gitDirty && !gitDirty.has(file)) continue; // [B] clean vs HEAD
|
|
49
|
+
const highs = Array.isArray(entry.concerns?.high) ? entry.concerns.high : [];
|
|
50
|
+
for (const text of highs) {
|
|
51
|
+
const hash = hashConcernBody(`${relative(markerDir, file)}:${text}`); // [E] file-scoped
|
|
52
|
+
if (!acks[hash]) blocking.push({ file, text, hash });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return blocking;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Build the Stop-hook block reason. Short hashes (first 6) are the ack ids.
|
|
59
|
+
export function formatBlockMessage(blocking, markerDir) {
|
|
60
|
+
const lines = blocking.map((b) => {
|
|
61
|
+
const rel = relative(markerDir, b.file);
|
|
62
|
+
return ` [${b.hash}] ${rel}\n ${b.text}`;
|
|
63
|
+
});
|
|
64
|
+
return (
|
|
65
|
+
`🚫 codex-pair: ${blocking.length} unaddressed HIGH finding(s) (blockOn: HIGH). ` +
|
|
66
|
+
`Fix them, or defer each with /codex-pair-ack.\n\n` +
|
|
67
|
+
`${lines.join("\n")}\n\n` +
|
|
68
|
+
`To defer a finding (stale / pre-existing / out-of-scope), run /codex-pair-ack with its [hash] from the list above — e.g.:\n` +
|
|
69
|
+
` /codex-pair-ack ${blocking[0].hash} "<reason>"\n` +
|
|
70
|
+
`(If you fixed a finding by editing a DIFFERENT file, make a real edit to the ` +
|
|
71
|
+
`flagged file so it gets re-reviewed — an identical re-touch hits the review cache.)`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// In-flight review detection (2026-07-02 seamless-pairing design). A turn can
|
|
76
|
+
// end while a debounce worker is still settling (record.reviewedGen <
|
|
77
|
+
// record.generation) or a codex call is mid-review (fresh inflight lock) —
|
|
78
|
+
// the log-based gate would pass and the verdict would land after "done".
|
|
79
|
+
// Pure over pre-read inputs; the script does the I/O.
|
|
80
|
+
// records parsed debounce-record JSONs (malformed entries tolerated)
|
|
81
|
+
// lockMtimes mtimeMs of files under state/inflight/
|
|
82
|
+
// now clock
|
|
83
|
+
// freshMs lock age beyond which a lock is crash junk, not a live review
|
|
84
|
+
// staleMs burst age beyond which an unconsumed record is a crashed
|
|
85
|
+
// worker's orphan (sweepStaleDebounce fodder), not a live settle
|
|
86
|
+
export function collectInFlight({ records, lockMtimes, now, freshMs, staleMs = 600_000 }) {
|
|
87
|
+
const settling = [];
|
|
88
|
+
for (const r of records) {
|
|
89
|
+
if (!r || typeof r !== "object" || typeof r.file !== "string") continue;
|
|
90
|
+
if (!(typeof r.generation === "number" && typeof r.reviewedGen === "number")) continue;
|
|
91
|
+
if (r.reviewedGen >= r.generation) continue;
|
|
92
|
+
if (Number.isFinite(r.burstStartedAt) && now - r.burstStartedAt > staleMs) continue;
|
|
93
|
+
settling.push(r.file);
|
|
94
|
+
}
|
|
95
|
+
const reviewing = lockMtimes.filter((m) => Number.isFinite(m) && now - m < freshMs).length;
|
|
96
|
+
return { settling, reviewing, any: settling.length > 0 || reviewing > 0 };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Block reason for the in-flight case: tell Claude HOW to wait productively
|
|
100
|
+
// instead of just refusing the stop.
|
|
101
|
+
const MAX_SETTLING_LISTED = 5;
|
|
102
|
+
export function formatInFlightMessage({ settling, reviewing }, markerDir) {
|
|
103
|
+
const parts = [];
|
|
104
|
+
if (settling.length > 0) {
|
|
105
|
+
const listed = settling.slice(0, MAX_SETTLING_LISTED).map((f) => relative(markerDir, f));
|
|
106
|
+
const extra = settling.length > MAX_SETTLING_LISTED ? ` (+${settling.length - MAX_SETTLING_LISTED} more)` : "";
|
|
107
|
+
parts.push(`${settling.length} edited file(s) awaiting review: ${listed.join(", ")}${extra}`);
|
|
108
|
+
}
|
|
109
|
+
if (reviewing > 0) parts.push(`${reviewing} review(s) running`);
|
|
110
|
+
return (
|
|
111
|
+
`⏳ codex-pair: review(s) still in flight — ${parts.join("; ")}. ` +
|
|
112
|
+
`Verdicts land in ${join(markerDir, ".codex-pair", "log.jsonl")}. ` +
|
|
113
|
+
`Wait for them (e.g. \`sleep 45\`), read the newest entries for the files you edited, ` +
|
|
114
|
+
`address any HIGH findings, then end the turn.`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Parse log.jsonl text → Map<file, latestEntry>. Last write per file wins
|
|
119
|
+
// (the log is append-only; the final entry is the file's latest review).
|
|
120
|
+
export function selectLatestEntries(logText) {
|
|
121
|
+
const latest = new Map();
|
|
122
|
+
for (const line of logText.split("\n")) {
|
|
123
|
+
const t = line.trim();
|
|
124
|
+
if (!t) continue;
|
|
125
|
+
let entry;
|
|
126
|
+
try {
|
|
127
|
+
entry = JSON.parse(t);
|
|
128
|
+
} catch {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (entry && typeof entry.file === "string") latest.set(entry.file, entry);
|
|
132
|
+
}
|
|
133
|
+
return latest;
|
|
134
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: antigravity-review
|
|
3
|
+
description: Get a second opinion from Google Antigravity (agy) on your current code changes. Analyzes staged/unstaged diffs and returns prioritized findings. Use when the user asks to "review with Antigravity", "Antigravity code review", or "ask agy to check my code".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- PORTABLE-CONTRACT:START -->
|
|
7
|
+
## Portable contract
|
|
8
|
+
|
|
9
|
+
Gather the relevant staged, unstaged, and untracked code changes; build a bounded context brief; request an Antigravity review; verify each reported finding against source; and return only prioritized, source-supported findings. Preserve read-only intent, provider authentication errors, timeout behavior, and explicit failure disclosure.
|
|
10
|
+
<!-- PORTABLE-CONTRACT:END -->
|
|
11
|
+
|
|
12
|
+
## Host adapters
|
|
13
|
+
|
|
14
|
+
### Pi adapter
|
|
15
|
+
|
|
16
|
+
Call the native `ask-antigravity` tool and apply only the `Portable contract` section of `../../agents/antigravity-reviewer.md`; ignore that file's frontmatter and Claude Code adapter.
|
|
17
|
+
|
|
18
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:START -->
|
|
19
|
+
### Claude Code adapter
|
|
20
|
+
|
|
21
|
+
The existing detailed workflow below is the Claude Code adapter. Its Agent, MCP, hook, `CLAUDE_PLUGIN_ROOT`, and `AskUserQuestion` mechanics apply only on Claude Code; they do not override the Pi adapter above.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Antigravity Code Review
|
|
26
|
+
|
|
27
|
+
Review current code changes by delegating to the `antigravity-reviewer` agent — a subscription-backed second opinion via Google's Antigravity CLI (`agy`).
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
This skill is **experimental** and requires:
|
|
32
|
+
|
|
33
|
+
- `agy` installed and **logged in once** (run `agy` interactively to complete Google Sign-In).
|
|
34
|
+
- The Antigravity MCP server registered, e.g. `claude mcp add antigravity -- npx -y @ask-llm/antigravity-mcp`.
|
|
35
|
+
|
|
36
|
+
It is one-shot (no multi-turn) and **subscription-backed** — it uses your Google AI Pro/Ultra plan, not per-token API billing. For routine review on a paid OpenAI/Gemini setup, prefer [`codex-review`](../codex-review/SKILL.md) or [`gemini-review`](../gemini-review/SKILL.md). To compare several providers at once, use [`multi-review`](../multi-review/SKILL.md).
|
|
37
|
+
|
|
38
|
+
## Instructions
|
|
39
|
+
|
|
40
|
+
1. Gather the diff to review:
|
|
41
|
+
- Run `git diff` to get unstaged changes
|
|
42
|
+
- Run `git diff --cached` to get staged changes
|
|
43
|
+
- Combine both into a single diff
|
|
44
|
+
|
|
45
|
+
2. If the diff is empty, inform the user there are no changes to review.
|
|
46
|
+
|
|
47
|
+
3. Launch the `antigravity-reviewer` agent with the diff content. The agent handles the Antigravity prompt structure, confidence filtering, and output formatting. If the `mcp__antigravity__ask-antigravity` tool is unavailable, the agent will tell the user to register the Antigravity MCP server rather than failing silently.
|
|
48
|
+
|
|
49
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:END -->
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorm
|
|
3
|
+
description: Send a topic to multiple LLM providers concurrently after the current host model forms an independent view, then synthesize all findings. Usage /brainstorm [providers] <topic>. External providers default to antigravity,codex. Example /brainstorm antigravity,codex,ollama "review this architecture"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- PORTABLE-CONTRACT:START -->
|
|
7
|
+
## Portable contract
|
|
8
|
+
|
|
9
|
+
The current host model must form and record an independent analysis before seeing external answers. Then send the same bounded topic and Context Brief concurrently to the selected providers, cross-check claims against source where possible, and synthesize consensus, unique insights, contradictions, rejected false positives, and confidence. Report the actual host model/providers and disclose possible same-family overlap.
|
|
10
|
+
<!-- PORTABLE-CONTRACT:END -->
|
|
11
|
+
|
|
12
|
+
## Host adapters
|
|
13
|
+
|
|
14
|
+
### Pi adapter
|
|
15
|
+
|
|
16
|
+
The current Pi host model completes its independent view first, records its actual provider/model, and only then calls native `ask-multi`. Do not claim the host is Claude Opus or that the coordinator has an isolated context.
|
|
17
|
+
|
|
18
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:START -->
|
|
19
|
+
### Claude Code adapter
|
|
20
|
+
|
|
21
|
+
The existing detailed workflow below is the Claude Code adapter. Its Agent, MCP, hook, `CLAUDE_PLUGIN_ROOT`, and `AskUserQuestion` mechanics apply only on Claude Code; they do not override the Pi adapter above.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Multi-LLM Brainstorm
|
|
26
|
+
|
|
27
|
+
Consult multiple external LLM providers simultaneously on a topic while Claude Opus performs its own independent research in parallel, then synthesize the findings from all participants.
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
### Phase 1: Parse arguments
|
|
32
|
+
|
|
33
|
+
- If the first argument looks like a comma-separated provider list (e.g., `antigravity,codex` or `gemini,codex,ollama`), use those as the external providers
|
|
34
|
+
- If no provider list is given, default to `antigravity,codex`
|
|
35
|
+
- Valid external providers: `gemini`, `codex`, `ollama`, `antigravity`
|
|
36
|
+
- `antigravity` requires `agy` installed + logged in; if it's unavailable the coordinator surfaces that and continues with the other providers
|
|
37
|
+
- Everything after the provider list (or all args if no list) is the topic
|
|
38
|
+
- Claude Opus is always a participant — it's not in the provider list because it runs inside the coordinator
|
|
39
|
+
|
|
40
|
+
### Phase 2: Determine and prepare the brainstorm topic
|
|
41
|
+
|
|
42
|
+
- If the user provided a topic directly, use it
|
|
43
|
+
- If the context is about code changes, gather the relevant diff:
|
|
44
|
+
- `git status --short` first to see what's modified/added/deleted
|
|
45
|
+
- `git add -N <new-files>` for untracked files the user wants included
|
|
46
|
+
- `git diff` + `git diff --cached` combined
|
|
47
|
+
- **Filter noise**: exclude `:!docs/` `:!apps/docs/` `:!*.md` `:!yarn.lock` `:!*.lock` `:!*.png` from the pathspec — providers don't need to review your ADR/doc additions
|
|
48
|
+
- **Size-check**: if combined diff > 150KB, ask the user before sending (the providers will take 5–15 min on payloads that large)
|
|
49
|
+
- If the context is a design/plan, gather the relevant documentation or conversation context
|
|
50
|
+
- If no topic is clear, ask the user what they'd like to brainstorm about
|
|
51
|
+
- Create a compact **Context Brief** before launching the coordinator. Keep it tiny for simple topics; add detail when the request is architecture/design/security/concurrency/migration related, spans packages, references external specs, or depends on conversation context external providers cannot see.
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
## Context Brief
|
|
55
|
+
|
|
56
|
+
Intent:
|
|
57
|
+
- User request:
|
|
58
|
+
- Brainstorm mode:
|
|
59
|
+
- Providers: <list the selected providers for this run>
|
|
60
|
+
|
|
61
|
+
Scope:
|
|
62
|
+
- Changed/referenced files:
|
|
63
|
+
- Included files/docs:
|
|
64
|
+
- Excluded files/docs and reason:
|
|
65
|
+
- Diff bytes:
|
|
66
|
+
|
|
67
|
+
Repository signals:
|
|
68
|
+
- Relevant package/workspace:
|
|
69
|
+
- CLAUDE.md files read:
|
|
70
|
+
- ADRs/docs read:
|
|
71
|
+
|
|
72
|
+
Risk focus:
|
|
73
|
+
- Security:
|
|
74
|
+
- Data loss:
|
|
75
|
+
- Concurrency/state:
|
|
76
|
+
- API/contract:
|
|
77
|
+
- Tests/build:
|
|
78
|
+
|
|
79
|
+
Open questions:
|
|
80
|
+
- Items not verified before dispatch:
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Phase 3: Launch the brainstorm-coordinator agent
|
|
84
|
+
|
|
85
|
+
Launch with: the topic, the selected external providers list, the Context Brief, and any gathered context (diff/files/docs).
|
|
86
|
+
|
|
87
|
+
The coordinator handles:
|
|
88
|
+
- Phase 3B: its own Claude Opus research (reads actual files, traces code, uses WebFetch/WebSearch on referenced external docs) — runs FIRST so Claude doesn't anchor on external responses
|
|
89
|
+
- Context Brief update: after Phase 3B, records verified files/docs and unverified assumptions before external dispatch
|
|
90
|
+
- Phase 3A: external provider dispatch via a single blocking foreground Bash call (ADR-050 dispatch pattern)
|
|
91
|
+
- Phase 4: synthesis — consensus, unique insights, contradictions across all participants
|
|
92
|
+
- Verified findings (backed by Claude's file reads) are weighted higher than inferred ones
|
|
93
|
+
- Failed providers are surfaced inline with their stderr, not silently dropped
|
|
94
|
+
|
|
95
|
+
### Phase 4: Present the coordinator's synthesis
|
|
96
|
+
|
|
97
|
+
Pass through the coordinator's structured output. If the coordinator returned a partial result (some providers failed), present what landed and explicitly note what's missing — don't paraphrase or hide compromises.
|
|
98
|
+
|
|
99
|
+
## Important — verification matters
|
|
100
|
+
|
|
101
|
+
Confidence scores are not an oracle. The coordinator's Phase 3B exists specifically because external LLMs can return high-confidence findings that turn out to be factually wrong (a real example from 2026-04-17: Gemini returned 95/100-confidence claims that were contradicted by the actual `.d.ts` file). Claude's "Verified" findings carry more weight than external "Inferred" findings precisely for this reason.
|
|
102
|
+
|
|
103
|
+
If you want a code-review-specific version of this with explicit per-finding source verification, use `/multi-review` instead.
|
|
104
|
+
|
|
105
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:END -->
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorm-all
|
|
3
|
+
description: Send a topic to all external providers (Gemini, Codex, Ollama, Antigravity) concurrently after the current host model forms an independent view. Use when the user wants an all-provider brainstorm with synthesis and explicit unavailable-provider reporting.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- PORTABLE-CONTRACT:START -->
|
|
7
|
+
## Portable contract
|
|
8
|
+
|
|
9
|
+
Apply the brainstorm contract with all four external providers: Gemini, Codex, Ollama, and Antigravity. The current host model forms its independent view first; unavailable providers are reported, not silently omitted; synthesis distinguishes verified evidence from inference.
|
|
10
|
+
<!-- PORTABLE-CONTRACT:END -->
|
|
11
|
+
|
|
12
|
+
## Host adapters
|
|
13
|
+
|
|
14
|
+
### Pi adapter
|
|
15
|
+
|
|
16
|
+
Follow `/skill:brainstorm` semantics with `ask-multi` providers `gemini,codex,ollama,antigravity`, after the current Pi host model has committed its independent view.
|
|
17
|
+
|
|
18
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:START -->
|
|
19
|
+
### Claude Code adapter
|
|
20
|
+
|
|
21
|
+
The existing detailed workflow below is the Claude Code adapter. Its Agent, MCP, hook, `CLAUDE_PLUGIN_ROOT`, and `AskUserQuestion` mechanics apply only on Claude Code; they do not override the Pi adapter above.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Multi-LLM Brainstorm (All Providers)
|
|
26
|
+
|
|
27
|
+
Consult all available external LLM providers (Gemini, Codex, Ollama, Antigravity) simultaneously while Claude Opus performs its own independent research on the topic, then synthesize perspectives from all five participants.
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
1. Determine the brainstorm topic:
|
|
32
|
+
- If the user provided a topic directly, use it
|
|
33
|
+
- If the context is about code changes, gather the relevant diff with `git diff` and `git diff --cached`
|
|
34
|
+
- If the context is a design/plan, gather the relevant documentation or conversation context
|
|
35
|
+
|
|
36
|
+
2. If no topic is clear, ask the user what they'd like to brainstorm about.
|
|
37
|
+
|
|
38
|
+
3. Launch the `brainstorm-coordinator` agent with the topic, external providers set to `gemini,codex,ollama,antigravity`, and any gathered context. The coordinator will:
|
|
39
|
+
- Run its own Claude Opus research phase in parallel with the external dispatches (Phase 3B — reads actual files, traces code, uses WebFetch/WebSearch on referenced external docs)
|
|
40
|
+
- Dispatch the topic to the four external providers in parallel (Phase 3A)
|
|
41
|
+
- Synthesize all findings with Claude's verified findings weighted higher than inferred ones
|
|
42
|
+
|
|
43
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:END -->
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-image
|
|
3
|
+
description: Generate an image via OpenAI's gpt-image-2 model through the Codex CLI. Use when user asks to "generate an image", "create an image", "make a picture of", "render a graphic", "draw something", or wants visual content via Codex. Requires codex-cli >= 0.125.0 with the `image_generation` feature flag enabled (stable + on-by-default since 0.125).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- PORTABLE-CONTRACT:START -->
|
|
7
|
+
## Portable contract
|
|
8
|
+
|
|
9
|
+
Refine the requested image prompt without changing intent, select an explicit output path, invoke Codex with `sandbox: "workspace-write"` so its image tool may create the file, verify the resulting file on disk, and report the path and provider response. Surface feature, policy, timeout, and filesystem failures verbatim.
|
|
10
|
+
<!-- PORTABLE-CONTRACT:END -->
|
|
11
|
+
|
|
12
|
+
## Host adapters
|
|
13
|
+
|
|
14
|
+
### Pi adapter
|
|
15
|
+
|
|
16
|
+
Call native `ask-codex` with `sandbox: "workspace-write"`. After it returns, use Pi's read-only filesystem tools to verify the output file. Do not claim automatic inline rendering in print mode.
|
|
17
|
+
|
|
18
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:START -->
|
|
19
|
+
### Claude Code adapter
|
|
20
|
+
|
|
21
|
+
The existing detailed workflow below is the Claude Code adapter. Its Agent, MCP, hook, `CLAUDE_PLUGIN_ROOT`, and `AskUserQuestion` mechanics apply only on Claude Code; they do not override the Pi adapter above.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Codex Image Generation
|
|
26
|
+
|
|
27
|
+
Generate an image by delegating to the `ask-codex` MCP tool with a prompt-engineered template that triggers Codex's built-in `image_generation` tool. The result is saved to disk and the path is returned to the user.
|
|
28
|
+
|
|
29
|
+
## Model capabilities (gpt-image-2)
|
|
30
|
+
|
|
31
|
+
Codex's `image_generation` tool selects the image model server-side; as of 2026-04-21 that is **gpt-image-2**. Three capabilities are worth accounting for when building prompts:
|
|
32
|
+
|
|
33
|
+
- **Legible in-image text** — per OpenAI's launch materials, gpt-image-2 renders text at ~99% accuracy across many scripts, so captions, labels, and UI copy are now reliable. gpt-image-1's weak text is no longer a reason to avoid asking for it.
|
|
34
|
+
- **High resolution** — up to 4K and custom dimensions; ask for it explicitly in the prompt body when you need it. Default square renders observed in testing varied (1024×1024 and 1254×1254), so don't hard-code an expected size — read it back from the file if it matters.
|
|
35
|
+
- **Provenance + watermark** — every render embeds a C2PA provenance manifest and an invisible AI-origin watermark. Flag this to the user when the image is destined for a context sensitive to AI-generated-content metadata.
|
|
36
|
+
|
|
37
|
+
## Prerequisites
|
|
38
|
+
|
|
39
|
+
- `codex-cli` >= 0.125.0 installed and authenticated
|
|
40
|
+
- `image_generation` feature flag enabled (default: stable + true). Verify with `codex features list | grep image_generation`
|
|
41
|
+
- The `ask-codex` MCP tool available (from `@ask-llm/codex-mcp` or the `@ask-llm/mcp` orchestrator)
|
|
42
|
+
|
|
43
|
+
## Instructions
|
|
44
|
+
|
|
45
|
+
### Phase 1: Build the image prompt
|
|
46
|
+
|
|
47
|
+
Take the user's natural-language ask and prepare it for image generation. Rules:
|
|
48
|
+
|
|
49
|
+
- **Keep the user's intent intact** — do not change meaning. Refine, don't replace.
|
|
50
|
+
- **If the prompt is sparse** (e.g., "an apple") AND the surrounding conversation has design context (e.g., a LinkedIn post, an article), enrich with that context: aspect ratio, style cues, what to avoid.
|
|
51
|
+
- **If the prompt is already detailed**, send it through verbatim — the user knows what they want.
|
|
52
|
+
- **Default exclusions worth adding**: "no humanoid figures, no glowing brains, no chatbot iconography" if the topic is AI / LLM-related (these are diffusion-model failure modes and the user will almost certainly want them excluded).
|
|
53
|
+
|
|
54
|
+
If you significantly enrich the prompt, briefly tell the user what you added and let them push back before dispatching.
|
|
55
|
+
|
|
56
|
+
### Phase 2: Determine output path
|
|
57
|
+
|
|
58
|
+
Convention:
|
|
59
|
+
|
|
60
|
+
- **Default path**: `/tmp/codex-images/$(date +%Y-%m-%d)/<slug>.png` where `<slug>` is a short kebab-case derivation from the user's prompt (max 40 chars).
|
|
61
|
+
- **Override**: if the user explicitly provided an output path (absolute or relative), use that exactly.
|
|
62
|
+
- **Ensure parent directory exists** — `mkdir -p <parent>` before dispatching. Codex's image tool will fail if the directory doesn't exist.
|
|
63
|
+
|
|
64
|
+
Example slug derivation:
|
|
65
|
+
- "Generate an image of a dark terminal with two reviewers" → `dark-terminal-with-two-reviewers.png`
|
|
66
|
+
- "Make me a cat picture" → `cat-picture.png`
|
|
67
|
+
|
|
68
|
+
### Phase 3: Dispatch to ask-codex
|
|
69
|
+
|
|
70
|
+
Call the `ask-codex` MCP tool (NOT raw `codex exec` — that bypasses ADR-044 quota fallback, ADR-042 stdin handling, and ADR-047 PATH resolution). Use this prompt template:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Use your image_generation tool to create the following image and save it as a PNG file.
|
|
74
|
+
|
|
75
|
+
Image description:
|
|
76
|
+
<the user's prompt, refined per Phase 1>
|
|
77
|
+
|
|
78
|
+
Save the file to this absolute path: <path from Phase 2>
|
|
79
|
+
|
|
80
|
+
After saving, confirm the absolute path of the created file and its byte size in your reply. If image_generation fails or the file cannot be written, explain what went wrong and do not invent a fake path.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Sandbox:** pass `sandbox: "workspace-write"` on this `ask-codex` call. `ask-codex` defaults to the read-only review sandbox (ADR-136), under which Codex cannot write the PNG to disk; image generation is the sanctioned exception that needs Codex to write the output file itself.
|
|
84
|
+
|
|
85
|
+
**Default model:** let `ask-codex` use its default (`gpt-5.6-sol`). The image_generation tool is invoked by the model regardless of which Codex chat model is selected — model selection here is about the orchestrating agent, not the image model itself.
|
|
86
|
+
|
|
87
|
+
**Wall time expectation:** with gpt-image-2, simple images typically render in **under a minute** end-to-end; complex prompts or high-resolution (up to 4K) renders can take a **few minutes** because gpt-image-2's thinking mode plans layout and self-checks before generating. This is normal; do not retry assuming a hang. The first call in a session is slowest because the image_generation tool definitions aren't cached yet; subsequent calls in the same session are faster (Codex CLI prompt-caches aggressively).
|
|
88
|
+
|
|
89
|
+
### Phase 4: Verify and present
|
|
90
|
+
|
|
91
|
+
After `ask-codex` returns:
|
|
92
|
+
|
|
93
|
+
1. **Run `ls -la <path>`** to confirm the file was created. Do not trust the agent's textual claim alone.
|
|
94
|
+
2. **If file exists**: report the absolute path, byte size, and Codex's response footer (model, sessionId, usage). If the user's environment supports inline image rendering (most Claude Code clients do via the Read tool), Read the image so the user can see it.
|
|
95
|
+
3. **If file missing**: surface Codex's reply verbatim (it usually contains the failure reason — e.g., "image generation rejected the prompt for policy reasons", "feature flag disabled", "quota exceeded"). Do NOT silently retry — tell the user and let them decide.
|
|
96
|
+
|
|
97
|
+
### Phase 5: Failure modes worth catching specifically
|
|
98
|
+
|
|
99
|
+
- **`image_generation` flag disabled**: `codex features list | grep image_generation` shows `false`. Tell the user to enable it: `codex features enable image_generation` or `codex --enable image_generation [PROMPT]`.
|
|
100
|
+
- **Codex CLI version too old**: `codex --version` < 0.125.0. Tell the user to update: `npm i -g @openai/codex` (or whichever install method they use).
|
|
101
|
+
- **Prompt rejected by content policy**: Codex's reply will include policy language. Show it verbatim — do not paraphrase or apologize. Let the user revise.
|
|
102
|
+
- **Disk full / permission denied on output path**: report the path and the OS error verbatim; suggest a different `outputPath`.
|
|
103
|
+
|
|
104
|
+
## Example interaction
|
|
105
|
+
|
|
106
|
+
User: `/codex-image generate a minimalist illustration of a cat reading a book`
|
|
107
|
+
|
|
108
|
+
Phase 1 — refined prompt: *minimalist illustration of a cat reading a book, flat vector style, two-tone palette, no human figures, square framing, transparent background*
|
|
109
|
+
|
|
110
|
+
Phase 2 — output: `/tmp/codex-images/2026-04-24/cat-reading-a-book.png`
|
|
111
|
+
|
|
112
|
+
Phase 3 — `ask-codex` is called with the prompt template above.
|
|
113
|
+
|
|
114
|
+
Phase 4 — `ls -la /tmp/codex-images/2026-04-24/cat-reading-a-book.png` shows a 248KB file. Skill returns:
|
|
115
|
+
|
|
116
|
+
> Generated **/tmp/codex-images/2026-04-24/cat-reading-a-book.png** (248 KB) via gpt-image-2. Used Codex (gpt-5.6-sol) as orchestrator. Refined prompt: *minimalist illustration of a cat reading a book, flat vector style, two-tone palette, no human figures, square framing, transparent background*. Reading inline below.
|
|
117
|
+
|
|
118
|
+
[image renders]
|
|
119
|
+
|
|
120
|
+
<!-- HOST-ADAPTER:CLAUDE-CODE:END -->
|