> ## 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.

# System Prompt Architecture

> How Lukan builds and manages the system prompt.

Lukan uses a split-caching strategy for efficiency, combining multiple components into the system prompt.

## Cached Block 1 (Stable)

This block rarely changes and is cached for performance:

* Base agent instructions (or planner instructions)
* Task tracking rules
* Sub-agent instructions
* Browser/Google Workspace/tool restriction rules
* WhatsApp formatting and directory restrictions

## Cached Block 2 (Project-Specific)

This block is specific to the current project:

* Global memory (`~/.config/lukan/MEMORY.md`)
* LUKAN.md project guide
* Project memory (`.lukan/memories/MEMORY.md`)

## Dynamic Block (Per-Call)

This block changes with every request:

* Environment info (directory, platform, date, time, calendar)
* Pending reminders
* Current tasks
* Active plan content
* Available skills listing

## Prompt Generation Flow

```
1. Load Cached Block 1 (base instructions)
2. Load Cached Block 2 (project context)
3. Add Dynamic Block (current state)
4. Append recent conversation history
5. Send to model
```

## Performance Optimizations

* **Lazy loading**: Blocks are loaded only when needed
* **Incremental updates**: Only changed parts are rebuilt
* **Token budgeting**: Automatic compaction at 150k tokens
* **Memory updates**: Project memory refreshed at 50k tokens

## Viewing the Prompt

To see the current system prompt:

```bash theme={null}
lukan doctor
```

This outputs configuration and diagnostic info including the system prompt, useful for debugging and understanding what Lukan "sees".
