/** * Note Loader — Discovers and loads Mémoire Notes from two sources: * 1. Built-in notes: existing skills/ directory (shipped with npm package) * 2. Installed notes: .memoire/notes/ in the project workspace * * Notes are cached in memory keyed by their manifest name + file mtime. * The cache is invalidated automatically when a note file changes on disk. */ import { type InstalledNote, type NoteCategory } from "./types.js"; /** * NoteLoader discovers and loads Mémoire Notes from all sources. * * ## Note Manifest Format * Each Note is a directory containing a `note.json` manifest: * ```json * { * "name": "my-note", * "version": "1.0.0", * "description": "...", * "category": "craft|research|connect|generate", * "tags": [], * "skills": [{ * "file": "my-note.md", * "name": "My Note", * "activateOn": "component-creation", * "freedomLevel": "high" * }], * "dependencies": [] * } * ``` * * ## Activation Context Matching * The `activateOn` field in each skill is matched against the `INTENT_TO_ACTIVATION` * map in `types.ts`. When the orchestrator classifies an intent, it looks up which * activation contexts apply, then activates all skills whose `activateOn` value * appears in that set. Skills with `activateOn: "always"` are always activated. * * ## Load Sources (in priority order, later overrides earlier) * 1. Built-in skills from `skills/registry.json` (adapted to Note format) * 2. Built-in Note packages from `notes/` directory in the npm package * 3. User-installed Notes from `.memoire/notes/` in the project workspace * 4. Workspace skill notes from `/skills//SKILL.md` * * ## Caching * Note manifests are cached in memory keyed by `:`. * The cache is invalidated automatically when a `note.json` file changes on disk. */ export declare class NoteLoader { private projectRoot; private _notes; private _loaded; constructor(projectRoot: string); get notes(): InstalledNote[]; get loaded(): boolean; /** * Load all notes from three sources: * 1. Legacy skills (skills/registry.json, adapted to Note format) * 2. Built-in Note packages (notes/{name}/note.json in npm package) * 3. User-installed Notes (.memoire/notes/) */ loadAll(): Promise; /** * Load built-in notes from skills/registry.json. * Adapts the legacy skill format into the Note manifest format. */ loadBuiltInNotes(): Promise; /** * Load built-in Note packages from notes/ directory in the npm package. * These are full Note directories with note.json manifests. */ loadBuiltInNotePackages(): Promise; /** * Load workspace skills from /skills//SKILL.md. * This is the ClawHub/AgentSkills compatibility path. */ loadWorkspaceSkillNotes(): Promise; /** * Load user-installed notes from .memoire/notes/ */ loadInstalledNotes(): Promise; /** * Get a specific note by name. */ getNote(name: string): InstalledNote | undefined; /** * Get notes filtered by category. */ getNotesByCategory(category: NoteCategory): InstalledNote[]; /** * Reload all notes (useful after install/remove). */ reload(): Promise; }