Starting Enki
Run theenki command with no arguments to launch the Terminal User Interface (TUI):
First Run: Auto-Initialization
When you runenki for the first time in a project directory, it automatically initializes the project by creating the .enki/ directory structure:
The
.enki/ directory is created in your project root. You may want to add .enki/copies/ and .enki/logs/ to your .gitignore to avoid committing temporary worker files and logs.Environment Variables
Enki uses several environment variables internally for coordination between processes:| Variable | Purpose |
|---|---|
ENKI_BIN | Path to the enki binary, injected into all spawned agent subprocesses |
ENKI_DIR | Absolute path to the project’s .enki/ directory |
ENKI_SESSION_ID | Unique session identifier scoping MCP tool results to the current session |
CLAUDECODE | Cleared on agent spawn to prevent nested-session refusal |
Project Directory Structure
Database (db.sqlite)
The SQLite database (using WAL mode for better concurrency) stores:
- Sessions: Each TUI launch creates a new session with a unique ID
- Tasks: Individual units of work with status, tier, branch info, and assignment details
- Executions: Multi-step workflows with dependency graphs (DAG)
- Merge requests: Queued, in-progress, and completed merge operations
- Task outputs: Summary text from completed workers, passed to dependent steps
- Messages: Inter-agent mail for coordination and escalation
Worker Copies (copies/)
Each worker agent runs in an isolated filesystem copy of your project at .enki/copies/<task-id>/. These copies use platform-appropriate copy-on-write techniques:
- macOS/APFS:
cp -Rc(clonefile) - Linux/btrfs:
cp --reflink=auto -a
.enki/ directory itself is excluded from copies.
Signal Files (events/)
The MCP server (running in separate agent processes) communicates with the coordinator via JSON signal files written to .enki/events/sig-*.json. The coordinator’s 3-second tick loop polls this directory, processes signals, and deletes them. This simple file-based IPC avoids the complexity of fsnotify.
Role Overrides (roles/)
Optional project-specific role configuration files in TOML format. Roles load in cascade:
- Built-in roles (bundled with enki)
- Global user roles (
~/.enki/roles/*.toml) - Project-specific roles (
.enki/roles/*.toml)
Artifacts (artifacts/)
Markdown reports produced by research and analysis workers. When a step uses a role with output = "artifact" (like researcher or code_referencer), the worker creates a markdown file at:
Logs
Main Session Log
When running the TUI, logs are written to~/.enki/logs/enki.log (not in your project directory—this is a global user location). Sessions are separated by banner lines:
Per-Agent Session Logs
Each agent session (coordinator, workers, merger agents) has its own detailed log at:Log levels:
ERROR = failures, INFO = lifecycle events (session start, task spawn, merge status), DEBUG = subprocess arguments, copy paths, prompt sizes, session kills.Exiting Enki
To exit the TUI:- Press
Ctrl+Ctwice within 5 seconds - Or type your quit command and confirm
abandoned (a database-only status that prevents orphaned work from blocking future sessions).