Skip to main content

Module hooks

Module hooks 

Source

Modules§

agents

Enums§

HookMode
Controls how hooks instruct agents to access lean-ctx functionality.

Constants§

HYBRID_AGENTS
Agents that get Hybrid mode (MCP + shell hooks) because they lack reliable deny infrastructure but do have shell hooks for command compression.
REPLACE_AGENTS
Agents with reliable shell + hook infrastructure that support Replace mode (native tools denied, lean-ctx MCP is the only path). These agents have either permissions.deny support or PreToolUse deny-hook capability.

Functions§

cursorrules_content
Compact pointer only (#578): Cursor already auto-loads the canonical full ruleset from ~/.cursor/rules/lean-ctx.mdc, so a project .cursorrules that repeats it bills the same guidance twice in every session.
from_bash_to_native_path
Convert a Unix/MSYS-style path (/c/Users/...) back to native Windows format (C:/Users/...). No-op for paths that don’t match the pattern.
generate_compact_rewrite_script
generate_rewrite_script
hybrid_rules_content
install_agent_hook
install_agent_hook_with_mode
install_agent_project_hooks
install_project_rules
install_project_rules_for_agents
Install project rules, optionally scoped to specific agents. If agents is empty, installs for all agents (legacy behavior).
kiro_steering_content
normalize_tool_path
Normalize paths from any client format to a consistent OS-native form. Delegates to core::pathutil so core crates do not depend on hooks.
recommend_hook_mode
Auto-detect the best hook mode for a given agent key.
refresh_installed_hooks
Silently refresh all hook scripts for agents that are already configured. Called after updates and on MCP server start to ensure hooks match the current binary version. Registry-driven: every Hybrid agent with a global shell hook is covered (the rest are explicitly exempted, enforced by test).
to_bash_compatible_path