Environment:23blocks OS Ai maestro Node js Filesystem
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Persistence |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Node.js runtime with filesystem-based persistence for agent registry, AMP message storage, and per-agent configuration directories.
Description
AI Maestro uses the Node.js filesystem as its primary persistence layer for agent state. The agent registry lives at `~/.aimaestro/agents/registry.json` — a single JSON file read and written synchronously for CRUD operations. Per-agent directories under `~/.aimaestro/agents/{agentId}/` store CozoDB databases, AMP keypairs, inbox/sent message stores, and backup ZIPs. The filesystem is the source of truth for agent identity and state; tmux sessions are optional properties discovered and linked to registry agents, never the reverse.
AMP message storage uses a file-per-message layout under `~/.agent-messaging/agents/{name}/`. Team, project, meeting, and schedule registries are all file-based JSON stores. No external database is required for the core registry and messaging subsystems — only CozoDB (a separate embedded per-agent store) handles memory and search.
Usage
Use this environment for all core AI Maestro operations: agent CRUD, session persistence, AMP inbox/sent storage, agent export/import (ZIP), and team/project/schedule registries. The `~/.aimaestro` directory tree must be writable and on a filesystem that preserves POSIX permissions.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | tmux and node-pty require a POSIX system |
| Runtime | Node.js >= 18 | tsx runtime; ESM modules (.mjs) throughout |
| Disk | Writable `~/.aimaestro/` | Must survive process restarts; place on a persistent volume |
| Memory | 2GB min (PM2 max) | `max_memory_restart: '2G'` in ecosystem.config.js |
Dependencies
System Packages
- `node` >= 18
- `tmux` (for agent sessions)
- `pm2` (production process manager)
Node Packages
- `fs` / `path` / `os` (Node builtins)
- `uuid` >= 13.0.0
- `archiver` >= 7.0.1 (agent ZIP export)
- `yauzl` >= 3.2.0 (agent ZIP import)
- `gray-matter` >= 4.0.3 (frontmatter parsing)
Credentials
The following environment variables may be set:
- `HOSTNAME`: Override server bind address (default `0.0.0.0`; the machine's own hostname is treated as unset)
- `ANTHROPIC_API_KEY`: For Claude-based memory consolidation (optional)
- `MAESTRO_MODE`: Set to `headless` for API-only mode
Quick Install
# Node.js 18+ and tmux are prerequisites
yarn install
yarn dev # dev server on http://localhost:23000
Code Evidence
Registry file location from `lib/agent-registry.ts:14-16`:
const AIMAESTRO_DIR = path.join(os.homedir(), '.aimaestro')
const AGENTS_DIR = path.join(AIMAESTRO_DIR, 'agents')
const REGISTRY_FILE = path.join(AGENTS_DIR, 'registry.json')
Per-agent CozoDB path from `lib/cozo-db.ts:62-64`:
const aiMaestroDir = path.join(os.homedir(), '.aimaestro', 'agents', config.agentId)
this.dbPath = path.join(aiMaestroDir, 'agent.db')
PM2 memory limit from `ecosystem.config.js:10`:
max_memory_restart: '2G',
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `EACCES: permission denied` on `~/.aimaestro/` | Directory not writable | `chown` the directory to the server user |
| `registry.json` is empty or corrupt | Process killed mid-write | Restore from backup or recreate from agent directories |
| `HOSTNAME` causes server unreachable on localhost | Docker/K8s sets `HOSTNAME` to machine name | Treated as unset automatically; use `HOSTNAME=localhost` explicitly |
Compatibility Notes
- Linux: Primary target; tmux, node-pty, and ONNX all work natively.
- macOS: Supported for development; node-pty and tmux work via Homebrew.
- Windows: Not supported; tmux and node-pty require WSL2.
- The `~/.aimaestro` directory should be on a persistent volume — ephemeral containers lose agent state on restart.