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

# Memory

> Persistent context across sessions

Fliiq maintains persistent memory that carries context across sessions. The agent reads and writes memory naturally using built-in memory skills — no special commands needed.

## Memory Structure

```
~/.fliiq/memory/
  MEMORY.md              # Curated memory — always loaded into prompt
  2026-02-12.md           # Daily log
  2026-02-11.md
  skills/
    fitness.md            # Skill-specific memory
    spotify.md
  jobs/
    fitness-coach.md      # Per-job memory
    email-digest.md
  people/
    alice-chen.md         # Auto-extracted: person facts + decisions
    bob-smith.md
  topics/
    project-alpha.md      # Auto-extracted: topic facts + decisions
    decisions.md          # Unscoped decisions log
  lessons/
    email-tone.md         # Auto-extracted behavioral corrections
    git-workflow.md       # Reusable procedures learned from sessions
```

## MEMORY.md

The curated memory file is loaded into every agent prompt. It contains important facts the agent should always know: your preferences, project context, key decisions, recurring patterns.

The agent updates `MEMORY.md` when it learns something worth remembering. You can also edit it directly.

## Daily Logs

Each day gets a log file (`YYYY-MM-DD.md`). The agent appends to the current day's log during sessions. Recent daily logs (last 3 days) are auto-loaded into the prompt for recency context.

## Skill Memories

When the agent works on a specific domain (fitness, language learning, a project), it creates a skill memory file in `memory/skills/`. These capture domain-specific context that doesn't belong in the general `MEMORY.md`.

## Job Memories

Each [scheduled job](/daemon/jobs) gets its own memory file at `memory/jobs/<job-name>.md`. The job executor loads this file at the start of each run, so the agent knows what it did last time. This enables progressive context — a fitness coaching job that tracks workout progression over weeks.

## Automatic Knowledge Extraction

After each conversation, Fliiq runs a post-session LLM pass to extract institutional knowledge and persist it automatically. No manual effort required.

**What gets extracted:**

* **People** — names, roles, relationships, preferences, contact details
* **Topics** — ongoing projects, recurring interests, goals, decisions made
* **Decisions** — non-trivial choices with reasoning

Each entity is stored as a structured markdown file under `memory/people/` or `memory/topics/`. On subsequent runs, Fliiq merges new facts into existing files rather than duplicating them.

**What's filtered out:** one-time tasks, ephemeral instructions, vague observations, and implementation details with no lasting value.

This means context about your projects, collaborators, and preferences accumulates automatically — the agent gets more useful the more you use it.

## Self-Improving Lessons Loop

After each conversation, a second post-session pass scans the transcript for behavioral corrections and reusable procedures, then writes or refines markdown lesson files under `memory/lessons/`. Lessons are injected into the system prompt at the start of every future session.

**What triggers a lesson:**

* You corrected style, tone, format, or verbosity ("stop doing X", "too verbose", "just give me the answer")
* You corrected the agent's workflow or approach
* A non-trivial technique or fix emerged that should be repeated
* An existing lesson turned out to be wrong or outdated (the pass refines it in place)

Lessons are class-level — they capture patterns, not session-specific artifacts. A lesson like "use prose over bullet lists in responses" carries forward; a specific error message does not.

## Session Search

Fliiq indexes conversation messages in a local SQLite FTS5 database at `.fliiq/sessions.db`. Use the `search_sessions` skill to recall past conversations:

```
"what did we decide about the auth module last week?"
"find conversations where I mentioned the deploy workflow"
```

Results include ranked snippets with session ID and timestamp. Pass `session_id` and `around_ts` to retrieve the surrounding message context for any hit.

## Memory Skills

The agent manages memory through three built-in skills:

| Skill             | Purpose                                                                                                       |
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
| `memory_read`     | Read a specific memory file                                                                                   |
| `memory_write`    | Write or update a memory file                                                                                 |
| `memory_search`   | Keyword search across all memory files                                                                        |
| `memory_edit`     | Refine an existing memory entry in place (exact find-and-replace, atomic write, rollback on threat detection) |
| `search_sessions` | FTS5 keyword search across past conversation transcripts                                                      |

These are called naturally by the agent — you don't need to instruct it to use memory. If you mention a preference or the agent learns something useful, it writes it to the appropriate memory file.

## Manual Editing

Memory files are plain markdown. You can edit them directly:

```bash theme={null}
# Edit curated memory
nano ~/.fliiq/memory/MEMORY.md

# Or from a project
nano .fliiq/memory/MEMORY.md
```
