Skip to content

All case studies

Working with AI agents: rules, checks, memory

How I work with AI agents: operating rules, a pre-stage for checks, a knowledge graph and build-and-critique loops.

Result

The result is a fixed framework for working with Claude: operating rules for an agent company, a pre-stage with checks at the critical points, a shared knowledge graph, loops of building and independent critique, and a memory of lessons learned. Whether the pre-stage saves cost is being measured, not assumed. This page will only state a result once there is one.

Starting point

If you work with AI agents every day, the same questions keep coming up: Which model does a task really need? Is a command risky? Is “done” actually proven? Does the research support the claim? On top of that, knowledge about projects and decisions should be available on every device, and mistakes should not repeat.

What was built

This way of working is a project of my own. It puts work with Claude into a fixed framework of five parts.

Operating rules for agents. In Paperclip, agents work in roles as in a small company. One shared rules file is attached to every agent. It covers the sparing use of large models, short reports and three levels for escalating to me: immediately for security issues, as a decision request for approvals, batched into the daily report for everything else. The rules file reserves new agents, new services and platform updates for me; I approve exceptions individually.

Sketch of the agent company: I am at the top and decide on new agents, services and platform updates. Below are a CEO agent and worker agents, each with the same operating rules attached. Escalations reach me at three levels: immediately, as a decision request or in the daily report.

A pre-stage with checks. Before the actual work sits a fast decision model, Jev by TypeSafe. It does not generate text but short verdicts: yes or no, a choice, a level. It is connected through a custom MCP server on Cloudflare Workers, which offers checks at four points:

The pre-stage only advises. If a call fails, that is stated and work continues normally; a verdict is never invented. Whether it saves cost overall is being measured by comparing work with and without the pre-stage.

Sketch of the pre-stage: on the left, the flow from the request through risky actions and researched facts to “done”; on the right, a pre-stage check at each of these points: triage, risk, research and completion check. It answers with short verdicts and only advises.

A shared knowledge graph. Lasting facts live in one place and can be retrieved in any environment. Feedback on the pre-stage’s verdicts is logged and used to adjust its thresholds.

Sketch of the knowledge graph: chat, desktop, phone and Claude Code share one graph with projects, devices, decisions and preferences. Feedback on pre-stage verdicts is logged, and a threshold is adjusted as a result. Passwords and keys are never stored there.

Alternating build and critique. A piece of work is split into small parts. A builder builds each part, then three critics with fresh context check it: one against the brief, one against the design rules, one in comparison with a concrete reference. All three must agree. There is no fixed number of rounds. In AI film every round costs money, so a budget ceiling applies there, and I judge the audio because the critics cannot hear.

Sketch of the build-and-critique loop: a builder builds one small part, three critics with fresh context judge only the result, against the brief, the design rules and a reference. If all three pass, the next part follows; otherwise the biggest gap goes back. For films, a budget ceiling and approval are added, and I judge the audio.

Lessons learned as memory. Claude Code records feedback from projects as a short note: what happened, why, and how it will be done in future. Examples:

Sketch of a lesson learned: my feedback from a project becomes a note by Claude Code in three parts: what happened (music bed, as briefed, barely audible), why (gap to the voice larger than usual) and what to do next time (say so up front, deliver a second mix).

How it came about

See all 5 steps
  1. An agent company with operating rules

    PaperclipClaude Code

    In Paperclip, agents work in roles as in a company. Shared operating rules apply to all of them: large models only for tasks that need long reasoning, short reports, no new services or accounts without approval, clear levels for escalating to me. Facts and assumptions are labelled separately.

  2. A pre-stage before the actual work

    Jev (TypeSafe)MCPCloudflare Workers

    Before any non-trivial request, a fast decision model classifies the task and recommends model and effort. Before consequential actions it checks the risk, before “done” the evidence, before researched facts the sources. It only advises: it does not replace confirmations or real tests.

  3. Triggering checks automatically

    Claude Code hooksPython

    Hooks call the checks in Claude Code automatically and compare changes against the project's rules. If the pre-stage is unreachable, nothing is blocked. Only clearly dangerous commands lead to a confirmation prompt.

  4. Knowledge across devices

    Knowledge graphCloudflare D1

    Projects, devices, decisions and preferences live in a knowledge graph shared by chat, desktop, phone and Claude Code. Passwords and keys are never stored there. When a pre-stage verdict turns out right or wrong, that is reported back. This made it possible to adjust a threshold that triggered too many clarifying questions.

  5. Alternating build and critique

    Claude CodeSkills

    Websites and films each have their own loop. A builder builds, then three critics with no prior context check separately against the brief, the design rules and a concrete reference. They judge only the result, not the code, and only with pass or fail. For films, a budget ceiling and an approval before every paid generation are added.

Planning something similar?

Let me help you.

Request an intro call

Next case studyDigital stations and an excavation game