commit 1ca90779d58eb2193992d2bd437b683c1bc3339b
parent 7ab5332b31a19f2e2d6b5dd2bb2cfab27ec9806a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 20 Oct 2026 14:43:54 -0400
mcp: generate video-assist — a project and a request (or a note); the code route's request and answers
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 152 insertions(+), 3 deletions(-)
diff --git a/.claude/commands/gen.md b/.claude/commands/gen.md
@@ -48,6 +48,13 @@ each task. Use the archilyzer MCP tools only; run no script for it.
send back with `generate` again (`answers: {"items": [{"id", "label", "why", "score"}]}`, at most six words a
label); the editor reads them as a model's answer and writes `clip-suggestions.json`. Never write that file, a
clip or the manifest yourself: the labels are suggestions the operator sorts by in the clip editor.
+ **And `video-assist`** (a small change to a umtool video project in words — "make the joins 0.15 s with less
+ smear on <dir>"): `generate` with task `video-assist`, `project` and `request` (or `note`, a note on the whole
+ project). It is local in every preset but `api`; routed to code, its answer is the request — the project's look,
+ clips and declared composition params — which you answer in this session and send back with `generate` again
+ (`answers: {"ops": [{"op", "id", "key", "value"}], "reply"}`); the editor checks them as a model's and writes
+ `assist-proposals.json`. They are proposals: the operator applies them in umtool's Ask box. Never edit the
+ manifest or that file yourself.
5. `via: "api"` or `"local"` on `generate` (or `via=` in a `/sweep` request) overrides one run when the operator asks
for it. To move the balance itself, `generation_policy` with `preset` (code, balanced, api, local) or with
`task` and `route` — only when the operator asks.
diff --git a/mcp/src/generation.test.ts b/mcp/src/generation.test.ts
@@ -150,6 +150,8 @@ test("generation_policy sets a preset as its routes, and one route alone", async
frames: "api",
// The clip finder's labels (release 36 lane D).
"clips-suggest": "api",
+ // The video assistant (release 38 lane E): api only in the api preset.
+ "video-assist": "api",
},
},
},
@@ -509,3 +511,35 @@ test("generate clips-suggest: a project, not an article; routed to code, the edi
assert.match(b.text, /Nothing in the cut changed/);
assert.equal(done.sentOf("/api/ops/iterations").length, 0);
});
+
+test("generate video-assist: a project and a request (or a note); routed to code, the plan is this session's request; the answer goes back to the editor", async () => {
+ assert.ok(GENERATE_TASKS.includes("video-assist"));
+ assert.match(String((validateGenerateArgs({ task: "video-assist", article: "a" }) as { error: string }).error), /names its project/);
+ assert.match(String((validateGenerateArgs({ task: "video-assist", project: "/r/p" }) as { error: string }).error), /needs its request/);
+ assert.match(String((validateGenerateArgs({ task: "video-assist", project: "/r/p", request: "x", note: "n_abcd1234" }) as { error: string }).error), /not both/);
+ assert.match(String((validateGenerateArgs({ task: "video-assist", project: "/r/p", request: "x", scope: "everything" }) as { error: string }).error), /scope is look, clips, fx or all/);
+ assert.match(String((validateGenerateArgs({ task: "video-assist", project: "/r/p", request: "x", iteration: 2 }) as { error: string }).error), /iteration is not a video-assist job's/);
+ assert.match(String((validateGenerateArgs({ task: "sweep", article: "a", request: "x" }) as { error: string }).error), /a video-assist job's/);
+ const plan = { scope: "all", estimate: { inputTokens: 700 }, request: { system: "You adjust a video project's settings…", user: "THE REQUEST:\nno QR\n\nTHE PROJECT NOW:\n- qr = true" } };
+ const code = editor({ policy: { routes: { ...POLICY.routes, "video-assist": "code" } }, plan });
+ const a = await generateTool({ task: "video-assist", project: "/r/p", request: "no QR" }, code.deps as never);
+ assert.equal(a.isError, undefined, a.text);
+ assert.match(a.text, /^generate video-assist: routed to Claude Code \(preset balanced\) — answer this request on the project in this session \(scope all\)\./);
+ assert.match(a.text, /call generate with task "video-assist", project "\/r\/p", the same request "no QR", answers: \{"ops": \[\.\.\.\], "reply": "\.\.\."\}/);
+ assert.match(a.text, /Never write that file or the manifest yourself/);
+ assert.match(a.text, /- qr = true/);
+ assert.deepEqual(code.sentOf("/api/ops/report-draft").map((x) => x.body), [{ task: "video-assist", project: "/r/p", request: "no QR", dryRun: true }]);
+
+ const answers = { ops: [{ op: "look", id: "", key: "qr", value: false }], reply: "QR off." };
+ const done = editor({
+ markerJson: { article: "", iteration: 0, task: "video-assist", project: "/r/p", status: "done", summary: "1 edit proposed (QR code on → off) on claude-code", usd: 0, assist: { proposed: 1, refused: 0, diff: ["QR code on → off"] } },
+ });
+ const b = await generateTool({ task: "video-assist", project: "/r/p", request: "no QR", answers, wait: true }, done.deps as never);
+ assert.equal(b.isError, false, b.text);
+ assert.deepEqual(done.sentOf("/api/ops/report-draft").map((x) => x.body), [{ task: "video-assist", project: "/r/p", request: "no QR", answers }]);
+ assert.equal(done.sentOf("/api/ops/settings").length, 0, "a session's answer needs no policy read");
+ assert.match(b.text, /^generate video-assist: job job-1 ended \*\*done\*\* — 1 edit proposed \(QR code on → off\) on claude-code/);
+ assert.match(b.text, /Project: \/r\/p · 1 proposed, 0 refused\n- QR code on → off/);
+ assert.match(b.text, /Nothing in the cut changed/);
+ assert.equal(done.sentOf("/api/ops/iterations").length, 0);
+});
diff --git a/mcp/src/generation.ts b/mcp/src/generation.ts
@@ -237,7 +237,9 @@ export function validateGenerateArgs(args: Record<string, unknown>): { ok: true;
const task = trimmed(args.task);
if (!GENERATE_TASKS.includes(task)) return bad(`task is one of ${GENERATE_TASKS.join(", ")}`);
if (task === CLIPS_SUGGEST) return validateClipsSuggestArgs(args, waitSeconds);
+ if (task === VIDEO_ASSIST) return validateVideoAssistArgs(args, waitSeconds);
if (args.project !== undefined || args.answers !== undefined || args.proposals !== undefined) return bad("project, proposals and answers are a clips-suggest job's");
+ if (args.request !== undefined || args.scope !== undefined || args.note !== undefined) return bad("request, scope and note are a video-assist job's");
const article = trimmed(args.article);
if (!ARTICLE_RE.test(article)) return bad("article is an article id (a lowercase slug: a-z, 0-9, -)");
const body: Body = { task, article };
@@ -340,6 +342,98 @@ function validateClipsSuggestArgs(args: Record<string, unknown>, waitSeconds: nu
return { ok: true, request: { kind: "start", body, ...(via ? { via } : {}), wait: args.wait === true, waitSeconds } };
}
+// ─── video-assist (release 38 lane E): the video assistant, on a umtool project ───
+
+const VIDEO_ASSIST = "video-assist";
+const NOTE_RE = /^n_[a-z0-9]{4,32}$/;
+
+function validateVideoAssistArgs(args: Record<string, unknown>, waitSeconds: number): { ok: true; request: GenerateRequest } | { ok: false; error: string } {
+ const bad = (error: string) => ({ ok: false as const, error: `generate: ${error}` });
+ const project = trimmed(args.project);
+ if (!project.startsWith("/")) return bad("a video-assist job names its project: the video project's absolute directory (project)");
+ for (const k of ["article", "iteration", "copyOf", "question", "channels", "feedback", "from", "to", "cards", "entries", "force", "autonomy", "extractorModel", "proposals"] as const) {
+ if (args[k] !== undefined) return bad(`${k} is not a video-assist job's (it reads its project)`);
+ }
+ const body: Body = { task: VIDEO_ASSIST, project };
+ if (args.request !== undefined) {
+ const r = trimmed(args.request);
+ if (!r) return bad("request is what to change, in words");
+ body.request = r;
+ }
+ if (args.note !== undefined) {
+ const n = trimmed(args.note);
+ if (!NOTE_RE.test(n)) return bad("note is a note id (n_…)");
+ body.note = n;
+ }
+ if (!body.request && !body.note) return bad("a video-assist job needs its request (what to change), or the note whose text is one");
+ if (body.request && body.note) return bad("give request or note, not both");
+ if (args.scope !== undefined) {
+ const sc = trimmed(args.scope);
+ if (!["look", "clips", "fx", "all"].includes(sc)) return bad("scope is look, clips, fx or all");
+ body.scope = sc;
+ }
+ if (args.model !== undefined) {
+ const m = trimmed(args.model);
+ if (!m) return bad("model is text");
+ body.model = m;
+ }
+ if (args.maxUsd !== undefined) {
+ if (typeof args.maxUsd !== "number" || !(args.maxUsd > 0)) return bad("maxUsd is a positive number of dollars");
+ body.maxUsd = args.maxUsd;
+ }
+ if (args.answers !== undefined) {
+ if (!args.answers || typeof args.answers !== "object" || Array.isArray(args.answers)) return bad('answers is {"ops": [{"op", "id", "key", "value"}], "reply"}');
+ if (body.model) return bad("answers are this session's: no model");
+ body.answers = args.answers;
+ }
+ let via: "api" | "local" | undefined;
+ if (args.via !== undefined) {
+ const v = trimmed(args.via);
+ if (v !== "api" && v !== "local") return bad('via is "api" or "local"');
+ if (body.model || body.answers) return bad("give model, via or answers — one");
+ via = v;
+ }
+ if (args.wait !== undefined && typeof args.wait !== "boolean") return bad("wait is true or false");
+ return { ok: true, request: { kind: "start", body, ...(via ? { via } : {}), wait: args.wait === true, waitSeconds } };
+}
+
+type AssistPlanView = { scope?: string; estimate?: { inputTokens?: number }; request?: { system?: string; user?: string } };
+
+// The `code` route: this session answers the request the editor's plan names.
+export function renderVideoAssistRequest(body: Body, plan: AssistPlanView, preset: string): string {
+ const r = plan.request ?? {};
+ const said = body.note ? `note ${String(body.note)}` : `request ${JSON.stringify(String(body.request ?? ""))}`;
+ return [
+ `generate video-assist: routed to Claude Code (preset ${preset}) — answer this request on the project in this session (scope ${plan.scope ?? "all"}).`,
+ `Read the project's settings below and give the ops that carry out the request, each {"op", "id", "key", "value"}, and a one-sentence reply.`,
+ `Then call generate with task "video-assist", project "${String(body.project)}", the same ${said}${body.scope ? `, scope "${String(body.scope)}"` : ""}, answers: {"ops": [...], "reply": "..."} and wait: true — ` +
+ "the editor checks your ops exactly as a model's (a value outside its bounds is refused, with the reason) and writes assist-proposals.json. " +
+ "They are PROPOSALS: the operator applies them in umtool (the Look panel's Ask box). Never write that file or the manifest yourself.",
+ "",
+ "## The instructions",
+ r.system ?? "",
+ "",
+ "## The project",
+ r.user ?? "",
+ ].join("\n");
+}
+
+type AssistMarker = { project?: string; assist?: { proposed?: number; refused?: number; diff?: string[]; note?: string } };
+
+function videoAssistSummary(f: Extract<Followed, { kind: "ended" }>, m: Marker & AssistMarker): ToolAnswer {
+ const a = m.assist ?? {};
+ const lines = [
+ `generate video-assist: job ${f.job.id} ended **${f.job.status}** — ${m.summary ?? m.status ?? ""}`.trim(),
+ `Project: ${m.project ?? "?"} · ${a.proposed ?? 0} proposed, ${a.refused ?? 0} refused` + (m.usd ? ` · $${m.usd.toFixed(4)}` : ""),
+ ...(a.diff ?? []).map((d) => `- ${d}`),
+ "",
+ "These are proposals in assist-proposals.json: the operator applies them in umtool (the Build tab's Look panel, Ask box: Apply / Dismiss" +
+ (a.note ? `; the reply on note ${a.note} carries an Apply too` : "") +
+ "). Nothing in the cut changed.",
+ ];
+ return { text: lines.join("\n"), isError: f.job.status !== "done" };
+}
+
type SuggestPlanView = {
proposals?: number;
calls?: number;
@@ -574,6 +668,7 @@ async function summarise(
const marker = resultMarkerOf(f.tail);
if (marker?.task === "verdicts") return verdictsSummary(f, marker);
if (marker?.task === CLIPS_SUGGEST) return clipsSuggestSummary(f, marker);
+ if (marker?.task === VIDEO_ASSIST) return videoAssistSummary(f, marker as Marker & AssistMarker);
const article = marker?.article ?? hint.article;
const n = marker?.iteration ?? hint.iteration;
const task = marker?.task ?? hint.task ?? "report-draft";
@@ -662,6 +757,11 @@ export async function generateTool(
const plan = await editorPost(deps, "/api/ops/report-draft", { ...body, dryRun: true });
if (plan.kind !== "ok") return { text: describeEditorFailure("generate", plan), isError: true };
return { text: renderClipsSuggestRequest(String(body.project), (plan.body.plan ?? {}) as SuggestPlanView, p.preset) };
+ } else if (task === VIDEO_ASSIST && body.answers === undefined && p.routes[task] === "code") {
+ // The session answers it: the editor's plan is the request.
+ const plan = await editorPost(deps, "/api/ops/report-draft", { ...body, dryRun: true });
+ if (plan.kind !== "ok") return { text: describeEditorFailure("generate", plan), isError: true };
+ return { text: renderVideoAssistRequest(body, (plan.body.plan ?? {}) as AssistPlanView, p.preset) };
} else if (task === "verdicts" && p.routes[task] === "code") {
// Verdicts are not a session's to make: the bench's bar names the models.
return {
@@ -688,7 +788,7 @@ export async function generateTool(
const jobId = typeof a.body.jobId === "string" ? a.body.jobId : "";
const n = typeof a.body.iteration === "number" ? a.body.iteration : undefined;
if (!jobId) return { text: `generate: the editor accepted it and started no job (${JSON.stringify(a.body)})`, isError: true };
- const article = task === CLIPS_SUGGEST ? "" : String(body.article);
+ const article = task === CLIPS_SUGGEST || task === VIDEO_ASSIST ? "" : String(body.article);
const warnings = Array.isArray(a.body.warnings) ? (a.body.warnings as unknown[]).map(String) : [];
const head =
`generate ${task}: queued as job ${jobId}` +
@@ -800,12 +900,20 @@ export const GENERATION_TOOLS = [
project: {
type: "string",
description:
- "clips-suggest: the reactions project's absolute directory (umtool's clip finder) — labels, a why and a rank for its proposals, into clip-suggestions.json (never a clip). Routed to code: the answer is the request, which this session labels and returns as answers.",
+ "clips-suggest: the reactions project's absolute directory (umtool's clip finder) — labels, a why and a rank for its proposals, into clip-suggestions.json (never a clip). Routed to code: the answer is the request, which this session labels and returns as answers. video-assist: the video project's absolute directory (its video.manifest.json).",
},
proposals: { type: "array", items: { type: "string" }, description: "clips-suggest: only these proposal ids." },
+ request: {
+ type: "string",
+ description:
+ 'video-assist: what to change on the video project, in words ("make the joins 0.15 s with less smear") — one ask whose checked edits land in the project\'s assist-proposals.json as proposals the operator applies in umtool. Routed to code: the answer is the request, which this session answers and returns as answers.',
+ },
+ scope: { type: "string", enum: ["look", "clips", "fx", "all"], description: "video-assist: what the ask may touch (default all)." },
+ note: { type: "string", description: "video-assist: a note on the whole project (n_…) whose text is the request; the proposals are posted to it as the agent's reply." },
answers: {
type: "object",
- description: 'clips-suggest routed to code: this session\'s labels, {"items": [{"id", "label" (≤ 6 words), "why" (one sentence), "score" (1–10)}]} — read as a model\'s answer, written by the editor.',
+ description:
+ 'clips-suggest routed to code: this session\'s labels, {"items": [{"id", "label" (≤ 6 words), "why" (one sentence), "score" (1–10)}]}; video-assist routed to code: {"ops": [{"op", "id", "key", "value"}], "reply"} — read as a model\'s answer, written by the editor.',
},
wait: { type: "boolean", description: "Follow the job and return its iteration's summary (default false)." },
wait_seconds: {