pub fn build_main_session_engine(
hooks: &HooksConfig,
builtins: &BuiltinRegistry,
rt: &HookEngineCtx<'_>,
skills: &Arc<BTreeMap<String, SkillEntry>>,
goal: Option<&Arc<GoalState>>,
) -> Result<Arc<dyn HookEngine>, HookEngineBuildError>Expand description
Hook engine for the main session: automatically mounts two skill builtins on top of
the user’s [hooks] configuration (when any skill is discovered) —
skill-manifest→after_session_enter: injects the L1 manifest + always-on body;skill-triggers→before_ingest: auto-activates relevant skills based on the prompt.
This makes “auto-activation” work out of the box without requiring users to write
[[hooks.*]] manually. Both hooks have empty matchers (they match all triggers under
that event). When the skill index is empty, nothing is mounted (keeping zero
overhead), and when the user also has no [hooks] configured, it falls through to
NoopHookEngine. Sub-agent profiles do not
take this path (they still use build_engine_arc), so skill hooks do not leak into
sub-agents.