diff --git a/src/config/schema.test.ts b/src/config/schema.test.ts index 4a64cfaf..8a83fcd7 100644 --- a/src/config/schema.test.ts +++ b/src/config/schema.test.ts @@ -7,6 +7,7 @@ import { CategoryConfigSchema, ExperimentalConfigSchema, GitMasterConfigSchema, + HookNameSchema, OhMyOpenCodeConfigSchema, } from "./schema" @@ -393,6 +394,19 @@ describe("BuiltinCategoryNameSchema", () => { }) }) +describe("HookNameSchema", () => { + test("rejects removed beast-mode-system hook name", () => { + //#given + const input = "beast-mode-system" + + //#when + const result = HookNameSchema.safeParse(input) + + //#then + expect(result.success).toBe(false) + }) +}) + describe("Sisyphus-Junior agent override", () => { test("schema accepts agents['Sisyphus-Junior'] and retains the key after parsing", () => { // given diff --git a/src/config/schema/hooks.ts b/src/config/schema/hooks.ts index 834aede4..8a7ecfdf 100644 --- a/src/config/schema/hooks.ts +++ b/src/config/schema/hooks.ts @@ -25,7 +25,6 @@ export const HookNameSchema = z.enum([ "interactive-bash-session", "thinking-block-validator", - "beast-mode-system", "ralph-loop", "category-skill-reminder", diff --git a/src/hooks/beast-mode-system/hook.test.ts b/src/hooks/beast-mode-system/hook.test.ts deleted file mode 100644 index a2a73f38..00000000 --- a/src/hooks/beast-mode-system/hook.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, test } from "bun:test" -import { clearSessionModel, setSessionModel } from "../../shared/session-model-state" -import { createBeastModeSystemHook, BEAST_MODE_SYSTEM_PROMPT } from "./hook" - -describe("beast-mode-system hook", () => { - test("injects beast mode prompt for copilot gpt-4.1", async () => { - //#given - const sessionID = "ses_beast" - setSessionModel(sessionID, { providerID: "github-copilot", modelID: "gpt-4.1" }) - const hook = createBeastModeSystemHook() - const output = { system: [] as string[] } - - //#when - await hook["experimental.chat.system.transform"]?.({ sessionID }, output) - - //#then - expect(output.system[0]).toContain("Beast Mode") - expect(output.system[0]).toContain(BEAST_MODE_SYSTEM_PROMPT.trim().slice(0, 20)) - - clearSessionModel(sessionID) - }) - - test("does not inject for other models", async () => { - //#given - const sessionID = "ses_no_beast" - setSessionModel(sessionID, { providerID: "anthropic", modelID: "gpt-5.3-codex" }) - const hook = createBeastModeSystemHook() - const output = { system: [] as string[] } - - //#when - await hook["experimental.chat.system.transform"]?.({ sessionID }, output) - - //#then - expect(output.system.length).toBe(0) - - clearSessionModel(sessionID) - }) - - test("avoids duplicate insertion", async () => { - //#given - const sessionID = "ses_dupe" - setSessionModel(sessionID, { providerID: "github-copilot", modelID: "gpt-4.1" }) - const hook = createBeastModeSystemHook() - const output = { system: [BEAST_MODE_SYSTEM_PROMPT] } - - //#when - await hook["experimental.chat.system.transform"]?.({ sessionID }, output) - - //#then - expect(output.system.length).toBe(1) - - clearSessionModel(sessionID) - }) -}) diff --git a/src/hooks/beast-mode-system/hook.ts b/src/hooks/beast-mode-system/hook.ts deleted file mode 100644 index f4e5cdd1..00000000 --- a/src/hooks/beast-mode-system/hook.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { getSessionModel } from "../../shared/session-model-state" - -export const BEAST_MODE_SYSTEM_PROMPT = `Beast Mode (Copilot GPT-4.1) - -You are an autonomous coding agent. Execute the task end-to-end. -- Make a brief plan, then act. -- Prefer concrete edits and verification over speculation. -- Run relevant tests when feasible. -- Do not ask the user to perform actions you can do yourself. -- If blocked, state exactly what is needed to proceed. -- Keep responses concise and actionable.` - -function isBeastModeModel(model: { providerID: string; modelID: string } | undefined): boolean { - return model?.providerID === "github-copilot" && model.modelID === "gpt-4.1" -} - -export function createBeastModeSystemHook() { - return { - "experimental.chat.system.transform": async ( - input: { sessionID: string }, - output: { system: string[] }, - ): Promise => { - const model = getSessionModel(input.sessionID) - if (!isBeastModeModel(model)) return - - if (output.system.some((entry) => entry.includes("Beast Mode"))) return - - output.system.unshift(BEAST_MODE_SYSTEM_PROMPT) - }, - } -} diff --git a/src/hooks/beast-mode-system/index.ts b/src/hooks/beast-mode-system/index.ts deleted file mode 100644 index 3bd956f2..00000000 --- a/src/hooks/beast-mode-system/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { createBeastModeSystemHook, BEAST_MODE_SYSTEM_PROMPT } from "./hook" diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 1785ec18..f992b0d7 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -49,5 +49,4 @@ export { createTasksTodowriteDisablerHook } from "./tasks-todowrite-disabler"; export { createRuntimeFallbackHook, type RuntimeFallbackHook, type RuntimeFallbackOptions } from "./runtime-fallback"; export { createWriteExistingFileGuardHook } from "./write-existing-file-guard"; export { createHashlineReadEnhancerHook } from "./hashline-read-enhancer"; -export { createBeastModeSystemHook, BEAST_MODE_SYSTEM_PROMPT } from "./beast-mode-system"; export { createJsonErrorRecoveryHook, JSON_ERROR_TOOL_EXCLUDE_LIST, JSON_ERROR_PATTERNS, JSON_ERROR_REMINDER } from "./json-error-recovery"; diff --git a/src/plugin-interface.ts b/src/plugin-interface.ts index 3815ec61..634b08d2 100644 --- a/src/plugin-interface.ts +++ b/src/plugin-interface.ts @@ -50,9 +50,7 @@ export function createPluginInterface(args: { hooks, }), - "experimental.chat.system.transform": createSystemTransformHandler({ - hooks, - }), + "experimental.chat.system.transform": createSystemTransformHandler(), config: managers.configHandler, diff --git a/src/plugin/hooks/create-transform-hooks.ts b/src/plugin/hooks/create-transform-hooks.ts index 6a380118..d593efae 100644 --- a/src/plugin/hooks/create-transform-hooks.ts +++ b/src/plugin/hooks/create-transform-hooks.ts @@ -5,7 +5,6 @@ import { createClaudeCodeHooksHook, createKeywordDetectorHook, createThinkingBlockValidatorHook, - createBeastModeSystemHook, } from "../../hooks" import { contextCollector, @@ -18,7 +17,6 @@ export type TransformHooks = { keywordDetector: ReturnType | null contextInjectorMessagesTransform: ReturnType thinkingBlockValidator: ReturnType | null - beastModeSystem: ReturnType | null } export function createTransformHooks(args: { @@ -65,19 +63,10 @@ export function createTransformHooks(args: { ) : null - const beastModeSystem = isHookEnabled("beast-mode-system") - ? safeCreateHook( - "beast-mode-system", - () => createBeastModeSystemHook(), - { enabled: safeHookEnabled }, - ) - : null - return { claudeCodeHooks, keywordDetector, contextInjectorMessagesTransform, thinkingBlockValidator, - beastModeSystem, } } diff --git a/src/plugin/system-transform.ts b/src/plugin/system-transform.ts index b8bc8c60..37dafd4f 100644 --- a/src/plugin/system-transform.ts +++ b/src/plugin/system-transform.ts @@ -1,12 +1,6 @@ -import type { CreatedHooks } from "../create-hooks" - -export function createSystemTransformHandler(args: { - hooks: CreatedHooks -}): (input: { sessionID: string }, output: { system: string[] }) => Promise { - return async (input, output): Promise => { - await args.hooks.beastModeSystem?.["experimental.chat.system.transform"]?.( - input, - output, - ) - } +export function createSystemTransformHandler(): ( + input: { sessionID: string }, + output: { system: string[] }, +) => Promise { + return async (): Promise => {} }