@mnemonik/scanner
v5.6.2
Published
Automatic codebase indexing daemon for Mnemonik
Readme
@mnemonik/scanner
Automatic codebase indexing daemon for Mnemonik — persistent memory for AI coding assistants.
The scanner watches your project directories for code changes and indexes them so your AI assistant can find relevant files, functions, and patterns when you need them.
Installation
npm install -g @mnemonik/scannerQuick Start
mnemonik-scanner start --key <your-api-key> --roots ~/ProjectsYour API key is available on the Mnemonik dashboard. The --roots flag specifies which directories to scan for projects (comma-separated).
Configuration is saved to ~/.mnemonik/scanner.json after first run. Subsequent starts need no arguments:
mnemonik-scanner startHow It Works
- The daemon walks your
--rootsdirectories looking for.mnemonik.jsonfiles (created automatically by your IDE's Mnemonik integration) - For each discovered project, it scans source files and pushes code chunks to the Mnemonik API
- It watches for file changes and incrementally updates the index
- Every 5 minutes, it re-scans roots to discover new projects, handle folder renames, and drop deleted projects
Commands
| Command | Description |
|---------|-------------|
| mnemonik-scanner start [options] | Start the daemon |
| mnemonik-scanner stop | Stop the running daemon |
| mnemonik-scanner status | Show daemon status and watched projects |
| mnemonik-scanner log | Show recent log output |
| mnemonik-scanner help | Show usage information |
Start Options
| Option | Description |
|--------|-------------|
| --key <api-key> | Mnemonik API key (or set MNEMONIK_API_KEY env var) |
| --server <url> | Server URL (default: https://api.mnemonik.dev) |
| --roots <dirs> | Comma-separated directories to scan for projects |
Configuration
The daemon saves its configuration to ~/.mnemonik/scanner.json with 0600 permissions (owner read/write only).
You can also set the API key via the MNEMONIK_API_KEY environment variable, which takes precedence over the config file and is never written to disk.
Files
| Path | Purpose |
|------|---------|
| ~/.mnemonik/scanner.json | Persistent configuration |
| ~/.mnemonik/daemon.pid | PID file for the running daemon |
| ~/.mnemonik/scanner.log | Log file (rotated at 5MB) |
What Gets Indexed
The scanner indexes code chunks (functions, classes, modules) from these file types:
.ts .tsx .js .jsx .py .rs .go .java .c .cpp .h .cs .rb .php .swift .kt .md
It respects .gitignore and skips common directories (node_modules, .git, dist, build, etc.). Only code structure is indexed — binary files and non-code assets are ignored.
Resource Usage
The daemon is designed to run continuously with minimal impact:
- Memory: Capped at 256MB
- CPU: Event-driven (idle when no files change)
- Disk: Log rotation at 5MB
- Network: Only changed files are pushed (hash-based diffing)
Requirements
- Node.js 20 or later
- A Mnemonik account and API key (sign up)
License
Proprietary. See mnemonik.ai/terms for details.
