mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-15 23:31:04 +00:00
1.3 KiB
1.3 KiB
INT-002 — Hook System Implementation
Intent
Implement a hook system that intercepts tool execution in Roo Code to enforce intent selection and validate AI-generated code before execution.
Scope (owned_scope)
src/core/hooks/**src/core/assistant-message/presentAssistantMessage.tssrc/core/tools/**.orchestration/**
Constraints
- Must integrate with existing
presentAssistantMessage()function without breaking current tool execution flow. - Pre-hooks must run before
tool.handle()is called. - Post-hooks must run after
tool.execute()completes but before result is returned. - Hook system must be non-blocking for non-destructive tools (read-only operations).
- Must maintain backward compatibility with existing tools.
Acceptance Criteria
HookEngineclass exists insrc/core/hooks/HookEngine.ts.- Pre-hook validates intent selection for destructive tools (
write_to_file,edit_file,execute_command, etc.). - Pre-hook enforces scope validation (file path must be within intent's
owned_scope). - Post-hook logs trace entries to
.orchestration/agent_trace.jsonlfor mutating actions. presentAssistantMessage()integratesHookEnginewith Pre-Hook and Post-Hook calls.- All existing tests pass after hook integration.