mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-17 23:51:08 +00:00
1.9 KiB
1.9 KiB
Roo Code Hook Architecture Notes
Entry Points
- execute_command: Handles all tool execution requests from the agent.
- write_file: Performs all codebase mutations initiated by the agent.
- These are the primary points where the hook engine intercepts and enforces governance.
Hook Engine
- preHook(intentId):
- Validates the selected intent against
active_intents.yaml. - Injects intent-specific constraints and owned scope into the agent context.
- Blocks execution if no valid intent is selected.
- Validates the selected intent against
- postHook(intentId, filePath, content):
- Computes SHA-256 hash of the modified code to ensure spatial independence.
- Appends a structured entry to
.orchestration/agent_trace.jsonl, linking the change back to the business intent. - Supports multiple intents and can track simultaneous agent actions.
Orchestration Folder
- active_intents.yaml: Stores all high-level business intents, their status, constraints, and acceptance criteria.
- agent_trace.jsonl: Append-only ledger capturing all mutating actions, with intent mapping and content hashes.
- intent_map.md: Maps business intents to physical files and AST nodes for traceability and future planning.
Demo Flow
- User selects INT-001 (e.g., JWT Authentication Migration).
- preHook injects constraints and scope for the selected intent.
- Agent executes
write_fileto modify code (e.g.,src/auth/jwt.ts). - postHook records the file content hash and updates
agent_trace.jsonl. - Repeat for other intents (e.g., INT-002 Billing Refactor, INT-003 Logging Middleware) to demonstrate parallel intent handling.
Key Features Demonstrated:
- Traceability: Every code change is linked to a specific intent.
- Governance: Hooks enforce scope and constraints before code is written.
- Scalability: Multiple intents can be managed concurrently with consistent context injection and trace logging.