Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,11 +55,11 @@ Built on top of the MIT-licensed [opencode](https://github.com/anomalyco/opencod

### 📌 Stable on `main`

#### Hooks API (22 events × 5 execution types)
#### Hooks API (27 events × 5 execution types)

Full Claude Code hooks protocol compatibility: `command`, `mcp`, `http`, `prompt`, `agent` hook types with 17 hook events including `PreToolUse`, `PostToolUse`, `SessionStart`, `PermissionRequest`, `WorktreeCreate`, and more.
Full Claude Code hooks protocol compatibility: `command`, `mcp`, `http`, `prompt`, `agent` hook types with 27 hook events including `PreToolUse`, `PostToolUse`, `SessionStart`, `PermissionRequest`, `WorktreeCreate`, and more.

See [hooks reference](./packages/opencode/src/session/prompt/hooks-reference.md).
See [hooks reference](./packages/core/src/plugin/skill/configure-hooks.md).

#### Goal Auto-Loop

Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/session/prompt.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -1456,12 +1456,11 @@ export const layer = Layer.effect(

yield* plugin.trigger("experimental.chat.messages.transform", {}, { messages: msgs })

const [skills, env, instructions, mcpInstructions, hooksDocs, goalDocs, modelMsgs] = yield* Effect.all([
const [skills, env, instructions, mcpInstructions, goalDocs, modelMsgs] = yield* Effect.all([
sys.skills(agent),
sys.environment(model),
instruction.system().pipe(Effect.orDie),
sys.mcp(agent, session.permission),
sys.hooks(),
sys.goal(sessionID),
MessageV2.toModelMessagesEffect(msgs, model),
])
Expand All@@ -1470,7 +1469,6 @@ export const layer = Layer.effect(
...instructions,
...(mcpInstructions ? [mcpInstructions] : []),
...(skills ? [skills] : []),
...hooksDocs,
...goalDocs,
]
const format = lastUser.format ?? { type: "text" as const }
Expand Down
37 changes: 0 additions & 37 deletions packages/opencode/src/session/prompt/hooks.txt

This file was deleted.

6 changes: 0 additions & 6 deletions packages/opencode/src/session/system.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import PROMPT_KIMI from "./prompt/kimi.txt"

import PROMPT_CODEX from "./prompt/codex.txt"
import PROMPT_TRINITY from "./prompt/trinity.txt"
import PROMPT_HOOKS from "./prompt/hooks.txt"
import PROMPT_GOAL from "./prompt/goal.txt"
import type { Provider } from "@/provider/provider"
import type { Agent } from "@/agent/agent"
Expand DownExpand Up@@ -48,7 +47,6 @@ export interface Interface {
readonly environment: (model: Provider.Model) => Effect.Effect<string[]>
readonly skills: (agent: Agent.Info) => Effect.Effect<string | undefined>
readonly mcp: (agent: Agent.Info, permission?: PermissionV1.Ruleset) => Effect.Effect<string | undefined>
readonly hooks: () => Effect.Effect<string[]>
readonly goal: (sessionID: SessionID) => Effect.Effect<string[]>
}

Expand DownExpand Up@@ -139,10 +137,6 @@ export const layer = Layer.effect(
].join("\n")
}),

hooks: Effect.fn("SystemPrompt.hooks")(function* () {
return [PROMPT_HOOKS]
}),

goal: Effect.fn("SystemPrompt.goal")(function* (sessionID: SessionID) {
// No Goal service wired into this entry point → degrade to a terse note.
if (!goalSvc) return ["No autonomous goal is active for this session."]
Expand Down
Loading