Skip to content

Open source CapCut alternative.

TypeScript

fix(site): skip the hosted judge on CLI turns [rebuild]

David Leea40c94d56ca
diff --git a/docs/guides/cut/ai-assistant.md b/docs/guides/cut/ai-assistant.md
index 27d42a3e..d980ee57 100644
--- a/docs/guides/cut/ai-assistant.md
+++ b/docs/guides/cut/ai-assistant.md
@@ -61,7 +61,7 @@ Every knowledge surface is defined once — the catalog file ships in the engine
| --- | --- | --- |
| System prompt | ~13K chars (~3K tokens) | Claude: replaces the Agent SDK default. Codex: prepended to the first turn (a resumed session already has it). Gemini: the instructions field, every round. |
| Tool catalog (127 tools in 19 areas) | ~140K chars (~35K tokens) whole | Claude/Codex: the MCP tool listing. Gemini: the core plus the routed areas per request. |
-| Skills library (16 docs) | ~97K chars (~24K tokens) total | The judge's pick rides the turn; list-skills and read-skill cover the rest. |
+| Skills library (16 docs) | ~97K chars (~24K tokens) total | Gemini: the judge's pick rides the turn. Claude/Codex: list-skills and read-skill. |
| Editor snapshot | Grows with the project; media list and subtitle cues capped at 60 each | Attached to the newest user message as `<editor_state>`, rebuilt fresh every turn. |
| Attachments | Metadata JSON per asset | `<attached_assets>` on the message that carried them; on the Gemini path the newest message also carries the actual payloads (frames, images, text contents). |
| Full state | Uncapped | The get-state tool — the model calls it when the snapshot is stale or truncated. |
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index cc268425..e3756a63 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -96,7 +96,7 @@ import {
useSignedIn,
} from "@/cut/lib/generate";
import { useCreditsRecheck, useOutOfCredits } from "@/cut/lib/hosted";
-import { cutChatLive, dropPiSession, foldIntoCutChat, hydratePiSession, judgeEngineSkill, readPiSession, streamCutChat, triageQueuedMessages } from "@/cut/lib/pi/cutAgent";
+import { cutChatLive, dropPiSession, foldIntoCutChat, hydratePiSession, readPiSession, streamCutChat, triageQueuedMessages } from "@/cut/lib/pi/cutAgent";
import { dueForRetriage, toolProgress } from "@/cut/lib/queueTriage";
import { registerQueueSink } from "@/cut/lib/chatQueue";
import { previewAt } from "@/cut/lib/playhead";
@@ -1108,13 +1108,10 @@ function ChatSession({
// localBackend (read after the origin resolves), which carries the
// account scope the engine requires on every data route.
prepareSendMessagesRequest: async ({ messages }) => {
- // The judge picks the turn's skill here, since the engine never
- // calls hosted models; the engine carries it on its prompt.
- const deps = productionDeps(projectId);
- const [skill] = await Promise.all([
- judgeEngineSkill(messages, deps.buildContext(), deps),
- engineReady(),
- ]);
+ // A CLI turn runs on the person's own model and calls nothing
+ // hosted on the way, so a free account keeps chatting on a local
+ // project; the model reads skills through read_skill.
+ await engineReady();
return {
api: localBackend.url("/api/cut/ai/chat"),
body: {
@@ -1122,8 +1119,7 @@ function ChatSession({
runtime: chatRuntime(),
messages,
model: currentModel(),
- context: deps.buildContext(),
- skill,
+ context: productionDeps(projectId).buildContext(),
providerSession: sessionFor(currentModel()),
},
};
diff --git a/site/src/cut/lib/pi/cutAgent.ts b/site/src/cut/lib/pi/cutAgent.ts
index 381b8dce..a3fba247 100644
--- a/site/src/cut/lib/pi/cutAgent.ts
+++ b/site/src/cut/lib/pi/cutAgent.ts
@@ -40,7 +40,6 @@ import {
} from "../queueTriage";
import {
editorSlice,
- judgeTurnState,
routeTurn,
TURN_JUDGE_QUESTIONS,
type CutJudgeSettings,
@@ -560,25 +559,6 @@ export async function judgeTurnAndAction(
return { verdict: { route, skipped: onSight }, instant };
}
-/** The skill the judge attaches to a turn the engine's own chat runs: the
- * page judges before the send and the engine carries the block on its
- * prompt. Null when no skill fits; undefined when the judge could not be
- * asked. */
-export async function judgeEngineSkill(
- messages: UIMessage[],
- context: unknown,
- deps: CutAgentDeps
-): Promise<string | null | undefined> {
- const settings = deps.judgeSettings ?? cutJudge();
- if (!settings.skillSuggestion) return undefined;
- try {
- const { answers } = await askJudge(deps.judge, judgeTurnState(messages, context), TURN_JUDGE_QUESTIONS);
- return routeTurn(answers as unknown as TurnJudgeAnswers, settings).skill;
- } catch {
- return undefined;
- }
-}
-
/** The declared catalog for a run: the core on every work turn, the routed
* areas' tools, and the escape hatch whenever something was left out. */
function toolsFor(areas: readonly string[], execTool: ExecTool, requestTools: AgentTool): AgentTool[] {
diff --git a/site/src/cut/server/http/ai.ts b/site/src/cut/server/http/ai.ts
index fd8afe1e..0332cf39 100644
--- a/site/src/cut/server/http/ai.ts
+++ b/site/src/cut/server/http/ai.ts
@@ -21,7 +21,7 @@ import {
} from "../ai/bridge";
import { rewriteCaptions, translateCaptions } from "../ai/captions";
import { writeVisualCues, type VisualFrame } from "../ai/visualSubtitles";
-import { AI_SKILL_INDEX, AI_TOOLS, attachedAssetsBlock, readSkill, skillRelevanceBlock, systemPrompt } from "../ai/catalog";
+import { AI_SKILL_INDEX, AI_TOOLS, attachedAssetsBlock, readSkill, systemPrompt } from "../ai/catalog";
import { STEP_BUDGET, stopText, turnClose, type TurnEnd } from "../../lib/turnBudget";
import { codexCommand } from "../tool-path";
import { errorMessage } from "../util";
@@ -31,9 +31,6 @@ interface ChatBody {
messages: UIMessage[];
model: string;
context?: unknown;
- /** The skill the page's judge attached to this turn: a name, null for
- * none, absent when the judge was not asked. */
- skill?: string | null;
/** Provider-native session/thread id from the previous turn, if any. */
providerSession?: string;
}
@@ -535,9 +532,7 @@ export const aiApi = {
const sessionKey = crypto.randomUUID();
const userText = lastUserText(body.messages);
const attachments = lastUserAttachments(body.messages);
- const skill =
- body.skill === undefined ? "" : `\n\n${skillRelevanceBlock(typeof body.skill === "string" ? body.skill : null)}`;
- const prompt = `${userText}${attachedAssetsBlock(attachments)}${skill}\n\n<editor_state>\n${JSON.stringify(body.context ?? {})}\n</editor_state>`;
+ const prompt = `${userText}${attachedAssetsBlock(attachments)}\n\n<editor_state>\n${JSON.stringify(body.context ?? {})}\n</editor_state>`;
return startTurnStream(projectId, body.threadId, (signal) => createUIMessageStream({
execute: async ({ writer }) => {