---
name: mental-model
description: Agent-owned expertise files that compound knowledge across sessions. Self-improve commands validate against actual codebase.
user-invocable: true
---

# Mental Model — Agent-Owned Expertise

Set up persistent agent memory using YAML expertise files that agents maintain themselves.

## How It Works

Each agent reads a personal .yaml file at startup and updates it after work:

```yaml
expertise:
  - topic: "API patterns"
    notes: "We use tRPC for type-safe API calls"
    evidence: "src/server/routers/*.ts"
    confidence: HIGH
    last_updated: "2026-05-24"
```

## Rules

1. Agents own their mental models (they write them, you don't touch them)
2. Self-improve commands validate expertise against actual codebase
3. Read-only expertise for critical domain knowledge (billing, deployment, security)
4. Mental models compound across sessions

## Self-Improve Command

```bash
# Agent scans codebase, validates expertise, updates stale entries
just self-improve-backend
```

$ARGUMENTS
