pub struct ClaudeCodeHook { /* private fields */ }Expand description
Claude Code hook using Skills lifecycle
Installation:
- Creates Claude Code Skill at ~/.claude/skills/nexus-memory/SKILL.md
- Skill auto-triggers on session_end, checkpoint, completion
- Skill calls MCP tool to store memory
Lifecycle support:
- session_start: Via settings.json
SessionStarthook entry - session_end: Via skill (on_session_end trigger)
- checkpoint: Via skill (on_checkpoint trigger)
- error: Via skill (on_error trigger)
- compact: Via skill (on_completion trigger)
Implementations§
Source§impl ClaudeCodeHook
impl ClaudeCodeHook
Sourcepub const SKILL_NAME: &'static str = "nexus-memory-extraction"
pub const SKILL_NAME: &'static str = "nexus-memory-extraction"
Skill name
Sourcepub const CONFIG_DIR: &'static str = ".claude"
pub const CONFIG_DIR: &'static str = ".claude"
Config directory
Sourcepub const SKILLS_DIR: &'static str = "skills"
pub const SKILLS_DIR: &'static str = "skills"
Skills subdirectory
Sourcepub fn new_readonly() -> Self
pub fn new_readonly() -> Self
Create a new Claude Code hook without mutating user state.
Skips skill installation and session-start injection so the hook can be used for inspection/status reporting without side effects on the filesystem.
Trait Implementations§
Source§impl AgentHook for ClaudeCodeHook
impl AgentHook for ClaudeCodeHook
Source§fn install_session_start_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn install_session_start_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Install a SessionStart hook via Claude Code’s settings.json.
Claude Code natively supports the SessionStart hook event type,
which fires when a new Claude Code session begins. This writes a
hook entry that invokes nexus session start --agent claude-code.
Source§fn install_checkpoint_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn install_checkpoint_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checkpoint hooks are supported via the installed skill’s on_checkpoint trigger.
Source§fn install_compact_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn install_compact_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Compact hooks are supported via the installed skill’s on_completion trigger.
Source§fn install_error_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn install_error_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Error hooks are supported via the installed skill’s on_error trigger.
fn agent_type(&self) -> &str
fn install_session_end_hook<'life0, 'async_trait>(
&'life0 mut self,
callback: SessionEndCallback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn detect_session_activity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SessionActivity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn extract_session_context<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SessionContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_hook_installed(&self) -> bool
fn reliability_score(&self) -> f32
fn lifecycle_capabilities(&self) -> LifecycleCapabilities
fn support_tier(&self) -> SupportTier
fn uninstall_hooks<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_activity(&self)
Auto Trait Implementations§
impl !Freeze for ClaudeCodeHook
impl !RefUnwindSafe for ClaudeCodeHook
impl Send for ClaudeCodeHook
impl Sync for ClaudeCodeHook
impl Unpin for ClaudeCodeHook
impl UnsafeUnpin for ClaudeCodeHook
impl !UnwindSafe for ClaudeCodeHook
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more