nexus-memory-hooks 1.1.2

Agent hooks system for Nexus Memory System - automated memory extraction
Documentation

Nexus Hooks - Agent hooks system for automated memory extraction

This crate provides a four-layer extraction system for capturing agent session context with 95-100% reliability:

  1. Native Hooks (100%): Claude Skills, Gemini Functions, Qwen Hooks, pi-mono, oh-my-pi
  2. Session Monitor (95%): Process monitoring via sysinfo
  3. Inactivity Detector (90%): Configurable timeout detection
  4. Persistent Buffer (99%): Crash recovery from buffer

Supported Agents

  • Claude Code: Skills-based (SKILL.md format)
  • Gemini: Function Calling
  • Qwen: Hooks SubAgent
  • pi-mono: Skills-based (TypeScript/Bun)
  • oh-my-pi: Skills-based (TypeScript/Bun + Rust N-API)
  • pi-skills: Cross-compatible skills
  • CLI Agents: Amp, Droid, OpenCode, Codex (atexit/signals)

Example

use nexus_hooks::{HookFactory, AgentHook, MultiLayerExtractor};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create hook for specific agent
    let factory = HookFactory::new();
    let mut hook = factory.create_hook("claude-code")?;

    // Check if session is active
    let activity = hook.detect_session_activity().await?;
    println!("Session active: {}", activity.is_active);

    // Extract session context
    if activity.is_active {
        let context = hook.extract_session_context().await?;
        println!("Extracted context: {:?}", context);
    }

    Ok(())
}