fix(hooks): prevent start-work false trigger from command description

- Remove 'Start Sisyphus work session' text check, keep only <session-context> tag
- Update interactive_bash description with WARNING: TMUX ONLY emphasis
- Update tests to use <session-context> wrapper
This commit is contained in:
justsisyphus 2026-01-16 14:01:29 +09:00
parent d00c2e7439
commit 1ecb2bafdf
3 changed files with 25 additions and 29 deletions

View File

@ -93,7 +93,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when // #when
@ -114,7 +114,7 @@ describe("start-work hook", () => {
parts: [ parts: [
{ {
type: "text", type: "text",
text: "Start Sisyphus work session\nSession: $SESSION_ID", text: "<session-context>Session: $SESSION_ID</session-context>",
}, },
], ],
} }
@ -137,7 +137,7 @@ describe("start-work hook", () => {
parts: [ parts: [
{ {
type: "text", type: "text",
text: "Start Sisyphus work session\nTime: $TIMESTAMP", text: "<session-context>Time: $TIMESTAMP</session-context>",
}, },
], ],
} }
@ -168,7 +168,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when // #when
@ -196,7 +196,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when // #when
@ -224,7 +224,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when // #when
@ -265,10 +265,9 @@ describe("start-work hook", () => {
parts: [ parts: [
{ {
type: "text", type: "text",
text: `Start Sisyphus work session text: `<session-context>
<user-request> <user-request>new-plan</user-request>
new-plan </session-context>`,
</user-request>`,
}, },
], ],
} }
@ -298,10 +297,9 @@ new-plan
parts: [ parts: [
{ {
type: "text", type: "text",
text: `Start Sisyphus work session text: `<session-context>
<user-request> <user-request>my-feature-plan ultrawork</user-request>
my-feature-plan ultrawork </session-context>`,
</user-request>`,
}, },
], ],
} }
@ -330,10 +328,9 @@ my-feature-plan ultrawork
parts: [ parts: [
{ {
type: "text", type: "text",
text: `Start Sisyphus work session text: `<session-context>
<user-request> <user-request>api-refactor ulw</user-request>
api-refactor ulw </session-context>`,
</user-request>`,
}, },
], ],
} }
@ -362,10 +359,9 @@ api-refactor ulw
parts: [ parts: [
{ {
type: "text", type: "text",
text: `Start Sisyphus work session text: `<session-context>
<user-request> <user-request>feature-implementation</user-request>
feature-implementation </session-context>`,
</user-request>`,
}, },
], ],
} }
@ -389,7 +385,7 @@ feature-implementation
const hook = createStartWorkHook(createMockPluginInput()) const hook = createStartWorkHook(createMockPluginInput())
const output = { const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }], parts: [{ type: "text", text: "<session-context></session-context>" }],
} }
// #when - start-work command is processed // #when - start-work command is processed

View File

@ -59,9 +59,9 @@ export function createStartWorkHook(ctx: PluginInput) {
.join("\n") .join("\n")
.trim() || "" .trim() || ""
const isStartWorkCommand = // Only trigger on actual command execution (contains <session-context> tag)
promptText.includes("Start Sisyphus work session") || // NOT on description text like "Start Sisyphus work session from Prometheus plan"
promptText.includes("<session-context>") const isStartWorkCommand = promptText.includes("<session-context>")
if (!isStartWorkCommand) { if (!isStartWorkCommand) {
return return

View File

@ -11,8 +11,8 @@ export const BLOCKED_TMUX_SUBCOMMANDS = [
"pipep", "pipep",
] ]
export const INTERACTIVE_BASH_DESCRIPTION = `Execute tmux commands. Use "omo-{name}" session pattern. export const INTERACTIVE_BASH_DESCRIPTION = `WARNING: This is TMUX ONLY. Pass tmux subcommands directly (without 'tmux' prefix).
For: server processes, long-running tasks, background jobs, interactive CLI tools. Examples: new-session -d -s omo-dev, send-keys -t omo-dev "vim" Enter
Blocked (use bash instead): capture-pane, save-buffer, show-buffer, pipe-pane.` For TUI apps needing ongoing interaction (vim, htop, pudb). One-shot commands use Bash with &.`