> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lukan.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory System

> Persistent context across sessions and projects.

Lukan has a multi-layered memory system that persists context across sessions.

## LUKAN.md (Project Guide)

Auto-generated project guide from package.json and file tree. Created with `/lukan` command or `lukan init`. Loaded into the system prompt.

## Project Memory

Per-project persistent memory stored in `.lukan/memories/MEMORY.md`. Updated automatically during compaction (at 50k tokens).

```
/memories              Show memory status
/memories activate     Activate project memory
/memories deactivate   Deactivate project memory
/memories add [text]   Update memory with optional instruction
```

## Global Memory

Stored at `~/.config/lukan/memory.md`. Always included in system prompt regardless of project. Manage with `/gmemory`.

```
/gmemory              View global memory
/gmemory show         View global memory
/gmemory add [text]   Update global memory
/gmemory clear        Clear global memory
```

Use `Alt+M` to open the memory viewer overlay in the TUI.

## Compaction

Automatic context compression at 150k tokens. Keeps the last 10 messages and generates a summary. Memory is updated at 50k tokens. Manual trigger with `/compact`.

## Memory Layers

| Layer    | Location                    | Scope                          |
| -------- | --------------------------- | ------------------------------ |
| Global   | `~/.config/lukan/memory.md` | All projects                   |
| Project  | `.lukan/memory.md`          | Specific project               |
| LUKAN.md | Project root                | Auto-generated project context |

All memory layers are combined into the system prompt automatically.
