Request a demo
How it works

Playbooks, guards and memory: giving the agent your project's context

How InsightWorker decides which project playbooks to load for a message, how guards check the files it writes, and what it remembers between sessions, with examples and a checklist for setting up a project.

November 13, 2026 · 7 min read · All articles

A general-purpose agent knows a lot about SQL and nothing about your warehouse. The difference between a useful answer and a plausible one is usually context: which database is production, what the naming conventions are, what must never be touched. InsightWorker keeps that context in your project, in plain files, and loads only what each message needs.

Setting up a project

In a project folder, /init creates .insightworker/ with a playbooks/project.md to edit, and folders for guards and apps. Everything there is text you can review and commit with the project.

Playbooks: three ways to be loaded

A playbook is markdown with a small front-matter header. Its scope decides when it is loaded:

  • always: every conversation. Keep these short: the systems, the rules, the people to ask.
  • auto: when the message overlaps the playbook's description. The match is simple and predictable: at least two words longer than three letters from the description must appear in the message. Write descriptions as lists of the words people actually use.
  • on-demand: when the message mentions @name, for long references such as a runbook.
---
name: project
scope: always
---
# Claims data platform
- Warehouse: Oracle ADW, schema CLAIMS_DW. Staging: PostgreSQL.
- Orchestration: Airflow; DAG ids start with etl_.
- Never run DDL in production. Ask before writing to any table.
---
name: database-conventions
scope: auto
description: database schema naming conventions oracle postgres tables columns
---
Tables are singular snake_case. Surrogate keys are <table>_id ...

With these two, "describe the claim table's columns in postgres" loads both (the words columns and postgres match); "why did etl_claims fail?" loads only the project playbook, and adding @runbook pulls in a runbook playbook as well.

Guards: checks on what the agent writes

Guards are YAML files in .insightworker/guards/. Each has a trigger, an optional file pattern, an action and a severity. file_create and file_save fire when the agent's file tool writes a file, and /guard run <name> runs a guard by hand. A command action runs a shell command (stopped after 30 seconds) and prints its output; a prompt action asks the agent to review the file in the same session. The severity (info, warn or block) labels the report. /guard init writes an example and /guards lists them.

name: sql-check
description: Review SQL files for common issues
trigger: file_save
filePattern: "**/*.sql"
severity: warn
enabled: true
action:
  type: prompt
  value: "Review {filePath} for syntax errors and missing WHERE clauses on UPDATE/DELETE."

Memory

The worker keeps a memory/MEMORY.md in the workspace for facts worth carrying between sessions, and a dated log per day. /memory shows what is there. Because it is a file, you can read it, correct it or delete it; nothing is remembered that you cannot see.

Skills

Separately from your project's files, InsightWorker ships domain skills: packaged know-how for tasks such as pipeline triage, DAG review and run diagnosis, stored-procedure review, document OCR, policy comparison, insurance intake and email drafting. /skills lists what is installed.

Context is not permission. A playbook that says "never run DDL in production" tells the model what you want; it does not stop a tool call, and a guard reports rather than blocks. Use database users and file permissions with the rights you intend, and remember that a prompt guard's review runs with tool permissions approved automatically.

A checklist for a new project

  1. Run /init and write project.md: systems, environments, rules, owners. Ten lines is plenty.
  2. Add one auto playbook per recurring topic, with a description made of the words people use for it.
  3. Put long references (runbooks, mapping tables) in on-demand playbooks.
  4. Add a guard for the file types the agent will write most (SQL, DAGs, configs), preferably a command guard that runs your existing linter.
  5. Commit .insightworker/ with the project so everyone gets the same context.

Related: the anatomy of an app, whose plan.md plays the same role for one task.

Build one app for your team

Bring one repetitive task your team does every week. We will build it with you as an InsightWorker app, on your model provider, and run it from the CLI, a browser or a schedule.

Request a demo