Skip to content

Commit 1c7e323

Browse files
echobtfactorydroid
andauthored
feat(cortex-hooks): extend hooks system with async, new events, and LLM prompts (#204)
- Add new HookType events: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, Setup, SessionStart, SessionEnd - Add async execution support (async_exec flag for fire-and-forget hooks) - Add once execution support (once flag for single-execution-per-session) - Add tool name matcher for tool-related hooks - Add HookStatus enum for detailed execution status tracking - Extend HookContext with tool/agent/session context and as_env() method - Create prompt_hook.rs for LLM-based decision hooks (PromptHook, PromptHookExecutor) - Create session_env.rs for persistent session environment variables - Add semaphore-based concurrency control for hook execution - Add comprehensive tests for new functionality (32 passing tests) This implements AGENT_5 from ORCHESTRATE/AGENT_5_HOOKS.md Co-authored-by: Droid Agent <droid@factory.ai>
1 parent cb446a6 commit 1c7e323

7 files changed

Lines changed: 1390 additions & 53 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cortex-hooks/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ edition = "2021"
55
description = "Hook system for Cortex CLI (formatters, post-edit actions)"
66

77
[dependencies]
8-
tokio = { version = "1", features = ["full", "process"] }
8+
tokio = { version = "1", features = ["full", "process", "sync"] }
99
serde = { version = "1", features = ["derive"] }
1010
serde_json = "1"
1111
tracing = "0.1"
1212
thiserror = "1"
1313
glob = "0.3"
1414
lazy_static = "1.4"
15+
dirs = "5.0"
16+
async-trait = "0.1"

0 commit comments

Comments
 (0)