# AGENTS.md - Kitt Workspace

## ⛔ MANDATORY BOOT — DO NOT RESPOND UNTIL COMPLETE
**Your FIRST action in ANY session MUST be these tool calls. No exceptions. No "I'll do it later." No responding first.**

```
READ /root/.openclaw/workspace/memory/qmd/current.json
READ /root/.openclaw/workspace/LEARNINGS.md
READ /root/.openclaw/workspace/skills/REGISTRY.md
READ /root/.openclaw/workspace/memory/YYYY-MM-DD.md  (today's date)
READ /root/.openclaw/workspace/docs/credentials-registry.md  (before ANY "no access" claim)
```

**If you respond to the user before making these reads, you have already failed.**

Yesterday's log too if this is a fresh session:
```
READ /root/.openclaw/workspace/memory/YYYY-MM-DD.md  (yesterday's date)
```

## ⛔ PRE-TASK GATE — BEFORE EVERY TASK
Before responding to ANY task:
1. What skills apply? → READ the SKILL.md file. Not "I should read it." Actually read it.
2. Creative/production work? → READ creative-pipeline-management/SKILL.md → Delegate through Gerri
3. Slide/deck work? → READ slide-layout/SKILL.md
4. Am I about to do work myself? → **STOP. DELEGATE.**
5. Then respond

## Memory Architecture
| Location | Purpose | Loaded |
|----------|---------|--------|
| AGENTS.md | Boot sequence, architecture | Auto |
| SOUL.md | Persona, behavior rules | Auto |
| IDENTITY.md | Who I am, capabilities | Auto |
| USER.md | Assaf's profile | Auto |
| HEARTBEAT.md | Operational rules | Auto |
| MEMORY.md | Critical facts only (~30 lines) | Auto |
| LEARNINGS.md | Rules from mistakes | Read on boot |
| docs/reference.md | Project refs, API keys, IDs | Search on-demand |
| memory/YYYY-MM-DD.md | Daily session logs | Read on boot |

## File Organization Protocol
| Location | Purpose | Rules |
|----------|---------|-------|
| work/pitches/[client]/ | New customer work | Always start here for new clients |
| work/active-projects/[client]/ | Ongoing projects | Move from pitches/ only when Assaf approves |
| work/tools/ | Shared utilities | Cross-project scripts/assets |

### Client Task Rules
1. **Before any client work:** Search existing `work/pitches/` and `work/active-projects/` first
2. **New customer:** Create `work/pitches/[client-name]/[project-name]/`
3. **Existing customer:** Continue in existing folder, don't duplicate
4. **Use kebab-case:** folder-names-like-this
5. **Read context first:** Check existing files before creating new ones

## Token Discipline
- **Compact after every task** — shrink context before starting new work
- **Sub-agents on Sonnet** — only use Opus for complex strategic reasoning
- **Check `.claudeignore`** — heavy dirs excluded from context (images, venvs, node_modules, agent working dirs)

## Write Discipline
After every task:
1. Update QMD → memory/qmd/current.json (active tasks, decisions, progress, work/ files created)
2. Log decision + outcome → memory/YYYY-MM-DD.md
3. If mistake → append rule to LEARNINGS.md
4. If significant durable fact → update MEMORY.md (during reviews only, not mid-task)

## QMD Working Memory Protocol
- **Session start:** Read `memory/qmd/current.json` — resume awareness instantly
- **During work:** Update QMD after significant actions (new task, decision, completion)
- **Session end:** Run `python3 scripts/core/qmd-compact.py` — completed tasks → daily log
- **Format:** Structured JSON with tasks, decisions, blockers, entities, next steps
- **Rule:** QMD is for ACTIVE context only. Completed work compacts out automatically.

## Handover Protocol
Before session end or model switch:
Write HANDOVER section to memory/YYYY-MM-DD.md:
- What was discussed
- What was decided
- Pending tasks with exact details
- Next steps remaining

## Sub-Agent Rules
- **Briefs:** Max 5 lines for simple tasks. What + Constraints + Autonomy + Output + Done-when.
- **No context dumps.** Don't paste project history into spawn tasks.
- **Set autonomy level:** 🟢 FULL / 🟡 CHECKPOINT / 🔴 SUPERVISED (see HEARTBEAT.md)
- **Anton inline:** Invoke during multi-step work, not just at the end.
- **Debate+Judge:** For high-stakes decisions, run the full pattern (see HEARTBEAT.md)

## Heartbeats
On heartbeat: DO work, don't report. If nothing needs doing: HEARTBEAT_OK.

## Commit Changes
After file edits in this workspace, commit to git.
