refactor(hooks): rename sisyphus-gpt-hephaestus-reminder to no-sisyphus-gpt

Shorter hook name, disableable via disabled_hooks config, migration added
for backward compatibility. Also forces agent switch to Hephaestus on
Sisyphus + GPT detection. Docs updated with new hook name.
This commit is contained in:
YeonGyu-Kim
2026-02-18 16:33:16 +09:00
parent a49e05fd56
commit a60a153d19
11 changed files with 57 additions and 26 deletions

View File

@@ -91,7 +91,7 @@
"delegate-task-retry",
"prometheus-md-only",
"sisyphus-junior-notepad",
"sisyphus-gpt-hephaestus-reminder",
"no-sisyphus-gpt",
"start-work",
"atlas",
"unstable-agent-babysitter",

View File

@@ -973,7 +973,7 @@ Disable specific built-in hooks via `disabled_hooks` in `~/.config/opencode/oh-m
}
```
Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`, `auto-slash-command`, `sisyphus-junior-notepad`, `start-work`
Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`, `auto-slash-command`, `sisyphus-junior-notepad`, `no-sisyphus-gpt`, `start-work`
**Note on `directory-agents-injector`**: This hook is **automatically disabled** when running on OpenCode 1.1.37+ because OpenCode now has native support for dynamically resolving AGENTS.md files from subdirectories (PR #10678). This prevents duplicate AGENTS.md injection. For older OpenCode versions, the hook remains active to provide the same functionality.

View File

@@ -37,7 +37,7 @@ export const HookNameSchema = z.enum([
"delegate-task-retry",
"prometheus-md-only",
"sisyphus-junior-notepad",
"sisyphus-gpt-hephaestus-reminder",
"no-sisyphus-gpt",
"start-work",
"atlas",
"unstable-agent-babysitter",

View File

@@ -27,7 +27,7 @@ export { createInteractiveBashSessionHook } from "./interactive-bash-session";
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
export { createCategorySkillReminderHook } from "./category-skill-reminder";
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
export { createSisyphusGptHephaestusReminderHook } from "./sisyphus-gpt-hephaestus-reminder";
export { createNoSisyphusGptHook } from "./no-sisyphus-gpt";
export { createAutoSlashCommandHook } from "./auto-slash-command";
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
export { createJsonErrorRecoveryHook } from "./json-error-recovery";

View File

@@ -1,8 +1,8 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { isGptModel } from "../../agents/types"
import { getSessionAgent } from "../../features/claude-code-session-state"
import { getSessionAgent, updateSessionAgent } from "../../features/claude-code-session-state"
import { log } from "../../shared"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import { getAgentConfigKey, getAgentDisplayName } from "../../shared/agent-display-names"
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
const TOAST_MESSAGE = [
@@ -11,6 +11,7 @@ const TOAST_MESSAGE = [
"You are literally burning money.",
"Use Hephaestus for GPT models instead.",
].join("\n")
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
function showToast(ctx: PluginInput, sessionID: string): void {
ctx.client.tui.showToast({
@@ -21,19 +22,21 @@ function showToast(ctx: PluginInput, sessionID: string): void {
duration: 10000,
},
}).catch((error) => {
log("[sisyphus-gpt-hephaestus-reminder] Failed to show toast", {
log("[no-sisyphus-gpt] Failed to show toast", {
sessionID,
error,
})
})
}
export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
export function createNoSisyphusGptHook(ctx: PluginInput) {
return {
"chat.message": async (input: {
sessionID: string
agent?: string
model?: { providerID: string; modelID: string }
}, output?: {
message?: { agent?: string; [key: string]: unknown }
}): Promise<void> => {
const rawAgent = input.agent ?? getSessionAgent(input.sessionID) ?? ""
const agentKey = getAgentConfigKey(rawAgent)
@@ -41,6 +44,11 @@ export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
if (agentKey === "sisyphus" && modelID && isGptModel(modelID)) {
showToast(ctx, input.sessionID)
input.agent = HEPHAESTUS_DISPLAY
if (output?.message) {
output.message.agent = HEPHAESTUS_DISPLAY
}
updateSessionAgent(input.sessionID, HEPHAESTUS_DISPLAY)
}
},
}

View File

@@ -1,33 +1,45 @@
import { describe, expect, spyOn, test } from "bun:test"
import { _resetForTesting, updateSessionAgent } from "../../features/claude-code-session-state"
import { getAgentDisplayName } from "../../shared/agent-display-names"
import { createSisyphusGptHephaestusReminderHook } from "./index"
import { createNoSisyphusGptHook } from "./index"
const SISYPHUS_DISPLAY = getAgentDisplayName("sisyphus")
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
describe("sisyphus-gpt-hephaestus-reminder hook", () => {
function createOutput() {
return {
message: {},
parts: [],
}
}
describe("no-sisyphus-gpt hook", () => {
test("shows toast on every chat.message when sisyphus uses gpt model", async () => {
// given - sisyphus (display name) with gpt model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output1 = createOutput()
const output2 = createOutput()
// when - chat.message is called repeatedly with display name
await hook["chat.message"]?.({
sessionID: "ses_1",
agent: SISYPHUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
})
}, output1)
await hook["chat.message"]?.({
sessionID: "ses_1",
agent: SISYPHUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
})
}, output2)
// then - toast is shown for every message
expect(showToast).toHaveBeenCalledTimes(2)
expect(output1.message.agent).toBe(HEPHAESTUS_DISPLAY)
expect(output2.message.agent).toBe(HEPHAESTUS_DISPLAY)
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
body: {
title: "NEVER Use Sisyphus with GPT",
@@ -40,37 +52,43 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
test("does not show toast for non-gpt model", async () => {
// given - sisyphus with claude model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs
await hook["chat.message"]?.({
sessionID: "ses_2",
agent: SISYPHUS_DISPLAY,
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
})
}, output)
// then - no toast
expect(showToast).toHaveBeenCalledTimes(0)
expect(output.message.agent).toBeUndefined()
})
test("does not show toast for non-sisyphus agent", async () => {
// given - hephaestus with gpt model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs
await hook["chat.message"]?.({
sessionID: "ses_3",
agent: HEPHAESTUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.2" },
})
}, output)
// then - no toast
expect(showToast).toHaveBeenCalledTimes(0)
expect(output.message.agent).toBeUndefined()
})
test("uses session agent fallback when input agent is missing", async () => {
@@ -78,17 +96,20 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
_resetForTesting()
updateSessionAgent("ses_4", SISYPHUS_DISPLAY)
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs without input.agent
await hook["chat.message"]?.({
sessionID: "ses_4",
model: { providerID: "openai", modelID: "gpt-5.2" },
})
}, output)
// then - toast shown via session-agent fallback
expect(showToast).toHaveBeenCalledTimes(1)
expect(output.message.agent).toBe(HEPHAESTUS_DISPLAY)
})
})

View File

@@ -0,0 +1 @@
export { createNoSisyphusGptHook } from "./hook"

View File

@@ -1 +0,0 @@
export { createSisyphusGptHephaestusReminderHook } from "./hook"

View File

@@ -81,7 +81,7 @@ export function createChatMessageHandler(args: {
await hooks.keywordDetector?.["chat.message"]?.(input, output)
await hooks.claudeCodeHooks?.["chat.message"]?.(input, output)
await hooks.autoSlashCommand?.["chat.message"]?.(input, output)
await hooks.sisyphusGptHephaestusReminder?.["chat.message"]?.(input)
await hooks.noSisyphusGpt?.["chat.message"]?.(input, output)
if (hooks.startWork && isStartWorkHookOutput(output)) {
await hooks.startWork["chat.message"]?.(input, output)
}

View File

@@ -20,7 +20,7 @@ import {
createStartWorkHook,
createPrometheusMdOnlyHook,
createSisyphusJuniorNotepadHook,
createSisyphusGptHephaestusReminderHook,
createNoSisyphusGptHook,
createQuestionLabelTruncatorHook,
createPreemptiveCompactionHook,
} from "../../hooks"
@@ -51,7 +51,7 @@ export type SessionHooks = {
startWork: ReturnType<typeof createStartWorkHook> | null
prometheusMdOnly: ReturnType<typeof createPrometheusMdOnlyHook> | null
sisyphusJuniorNotepad: ReturnType<typeof createSisyphusJuniorNotepadHook> | null
sisyphusGptHephaestusReminder: ReturnType<typeof createSisyphusGptHephaestusReminderHook> | null
noSisyphusGpt: ReturnType<typeof createNoSisyphusGptHook> | null
questionLabelTruncator: ReturnType<typeof createQuestionLabelTruncatorHook>
taskResumeInfo: ReturnType<typeof createTaskResumeInfoHook>
anthropicEffort: ReturnType<typeof createAnthropicEffortHook> | null
@@ -158,8 +158,8 @@ export function createSessionHooks(args: {
? safeHook("sisyphus-junior-notepad", () => createSisyphusJuniorNotepadHook(ctx))
: null
const sisyphusGptHephaestusReminder = isHookEnabled("sisyphus-gpt-hephaestus-reminder")
? safeHook("sisyphus-gpt-hephaestus-reminder", () => createSisyphusGptHephaestusReminderHook(ctx))
const noSisyphusGpt = isHookEnabled("no-sisyphus-gpt")
? safeHook("no-sisyphus-gpt", () => createNoSisyphusGptHook(ctx))
: null
const questionLabelTruncator = createQuestionLabelTruncatorHook()
@@ -187,7 +187,7 @@ export function createSessionHooks(args: {
startWork,
prometheusMdOnly,
sisyphusJuniorNotepad,
sisyphusGptHephaestusReminder,
noSisyphusGpt,
questionLabelTruncator,
taskResumeInfo,
anthropicEffort,

View File

@@ -5,6 +5,8 @@ export const HOOK_NAME_MAP: Record<string, string | null> = {
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
"sisyphus-orchestrator": "atlas",
"sisyphus-gpt-hephaestus-reminder": "no-sisyphus-gpt",
// Removed hooks (v3.0.0) - will be filtered out and user warned
"empty-message-sanitizer": null,
}