<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Philip Henningsson · Posts</title>
  <link href="https://philiphenningsson.com/posts/"/>
  <link rel="self" href="https://philiphenningsson.com/feed.xml"/>
  <id>https://philiphenningsson.com/posts/</id>
  <updated>2026-12-03T00:00:00Z</updated>
  <author><name>Philip Henningsson</name><uri>https://philiphenningsson.com/</uri></author>
  <entry>
    <title>The app does the maths. The model writes the answer.</title>
    <link href="https://philiphenningsson.com/posts/the-app-does-the-maths-the-model-writes-the-answer/"/>
    <id>https://philiphenningsson.com/posts/the-app-does-the-maths-the-model-writes-the-answer/</id>
    <published>2026-12-03T00:00:00Z</published>
    <updated>2026-12-03T00:00:00Z</updated>
    <summary>Seven AI services became one engine at a Swedish public housing company. Each question goes to a model by how sensitive its data is, and confidential data only reaches a model they host themselves.</summary>
    <content type="html">&lt;p&gt;A Swedish public housing company had seven separate AI services, each with its own answer to the question &amp;quot;where does our data go?&amp;quot;. I replaced them with one engine that every app on their platform calls. It took about three weeks from plan to a working engine, a chat, a standard for apps and the first app in test.&lt;/p&gt;
&lt;h2&gt;Two rules&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The app does the maths, the model writes the answer.&lt;/strong&gt; When someone asks about rents, cases or properties, the app that owns the data looks up and calculates the numbers. The model only turns them into a readable answer, and the engine checks the numbers in the answer against the app&amp;#39;s own data before it goes out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The data decides the model.&lt;/strong&gt; Every question gets a classification: confidential, internal or external. Confidential data is only ever sent to a model the company hosts on its own servers. The rest can go to OpenAI or Anthropic. If the right model isn&amp;#39;t available, the engine switches to one that is approved for that class, never to one that isn&amp;#39;t.&lt;/p&gt;
&lt;h2&gt;Where the classification comes from&lt;/h2&gt;
&lt;p&gt;Not from guessing at the prompt. Each app declares the classification of its data, and there is also a central register. The engine takes the stricter of the two. An app can&amp;#39;t talk its way down to a less careful model, and a register entry that is out of date can&amp;#39;t either.&lt;/p&gt;
&lt;h2&gt;One engine instead of seven&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;One stream for every model.&lt;/strong&gt; OpenAI, Anthropic and the self-hosted model sit behind the same interface. Models are configuration, not code, so changing one is a setting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Answers with sources.&lt;/strong&gt; Documents are searched in the same Postgres database (pgvector), and every answer shows what it is based on.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permissions follow the user.&lt;/strong&gt; The engine asks the apps as the person who asked the question, so nobody gets an answer built on data they couldn&amp;#39;t open themselves.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One place for policy.&lt;/strong&gt; Which model may see what, and what was asked, lives in one engine instead of seven.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;A standard, so the next app is built the same way&lt;/h2&gt;
&lt;p&gt;Apps connect through MCP with a small standard: the app exposes what it can calculate, the engine decides which model may phrase it. I packaged the standard, and a check for it, as a plugin for coding agents, so whoever builds the next app gets the same rules without reading a document first.&lt;/p&gt;
&lt;h2&gt;The self-hosted model&lt;/h2&gt;
&lt;p&gt;The confidential path runs on a 35B open-weights model on their own servers, set up with a tool I wrote that turns a bare GPU server into a monitored LLM service with one command. That is a post of its own.&lt;/p&gt;
&lt;h2&gt;What I&amp;#39;d tell another team&lt;/h2&gt;
&lt;p&gt;Start from the classification policy, not from the model. Once it is clear which data may go where, the architecture mostly follows.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>From issue to pull request, without giving agents the keys</title>
    <link href="https://philiphenningsson.com/posts/from-issue-to-pull-request-without-giving-agents-the-keys/"/>
    <id>https://philiphenningsson.com/posts/from-issue-to-pull-request-without-giving-agents-the-keys/</id>
    <published>2026-11-18T00:00:00Z</published>
    <updated>2026-11-18T00:00:00Z</updated>
    <summary>A self-hosted pipeline where coding agents pick up labelled issues and open pull requests that a developer reviews. Different models on real work, and credentials that expire in minutes.</summary>
    <content type="html">&lt;p&gt;Simple tasks shouldn&amp;#39;t wait for a developer to have time. They also shouldn&amp;#39;t be done by an agent nobody checks. I built a self-hosted pipeline for the team I work in that does the first without giving up the second.&lt;/p&gt;
&lt;h2&gt;The flow&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;A developer labels an issue as ready for an agent.&lt;/li&gt;
&lt;li&gt;On a schedule, the pipeline picks it up and starts an agent in its own isolated sandbox.&lt;/li&gt;
&lt;li&gt;The agent makes the change and opens a draft pull request.&lt;/li&gt;
&lt;li&gt;A developer runs the full checks and reviews it. Only a person marks it ready.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The runs are spread out in time, so agents don&amp;#39;t pile up on the same part of the code.&lt;/p&gt;
&lt;h2&gt;Labels choose the model&lt;/h2&gt;
&lt;p&gt;The label also decides which model does the work: Claude, OpenAI, or a coding model we host ourselves. That turns the pipeline into a comparison on real tasks instead of benchmarks. Every commit carries a co-author line that says which model wrote it, so the history shows it too.&lt;/p&gt;
&lt;h2&gt;Agents never hold real credentials&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Agents only get short-lived tokens from a small token broker, never a long-lived key.&lt;/li&gt;
&lt;li&gt;Commits and pull requests come from a dedicated machine account, so it is always clear what an agent did.&lt;/li&gt;
&lt;li&gt;The token that can publish releases is kept apart; agents never see it.&lt;/li&gt;
&lt;li&gt;Tokens can be rotated centrally within a minute.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The pipeline runs on its own Linux server under a separate service account, with hardened services and backups before every upgrade. Sandbox images are pinned to versions, so a run today behaves like a run last week.&lt;/p&gt;
&lt;h2&gt;Housekeeping by agents&lt;/h2&gt;
&lt;p&gt;The same setup does chores nobody wants: a weekly sweep for dead code, and daily releases.&lt;/p&gt;
&lt;h2&gt;What went wrong&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;GitHub&amp;#39;s built-in schedules started about seven hours late, so scheduled jobs moved to the server itself.&lt;/li&gt;
&lt;li&gt;A long-running user service kept old group memberships after a permission change, which looked like a permissions bug for longer than I&amp;#39;d like to admit.&lt;/li&gt;
&lt;li&gt;One provider&amp;#39;s subscription SDK had a bug in headless mode, so that provider was dropped from the pipeline for now.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Why it works&lt;/h2&gt;
&lt;p&gt;The agent does the change. A person decides it is done. Everything in between is about making that line impossible to cross by accident.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>An agent never approves its own work</title>
    <link href="https://philiphenningsson.com/posts/an-agent-never-approves-its-own-work/"/>
    <id>https://philiphenningsson.com/posts/an-agent-never-approves-its-own-work/</id>
    <published>2026-10-20T00:00:00Z</published>
    <updated>2026-10-20T00:00:00Z</updated>
    <summary>How I let coding agents build software. Six steps, a reviewer on a different model, and a person for anything sensitive. It is a handful of Markdown files.</summary>
    <content type="html">&lt;p&gt;Almost everything I ship is written by coding agents. That only works if &amp;quot;done&amp;quot; means something. An agent that reviews its own change agrees with itself, so the one rule everything else hangs on is simple: an agent never approves its own work.&lt;/p&gt;
&lt;h2&gt;Six steps&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Understand.&lt;/strong&gt; The agent restates the task and writes a few concrete examples of what should happen. I confirm them before anything is built. Those examples are the contract.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Plan.&lt;/strong&gt; A short plan: what changes, in which order, and what could break.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Build.&lt;/strong&gt; One lead agent writes and commits. Helpers can work in their own copies of the repo, but only the lead merges.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Review.&lt;/strong&gt; A reviewer on a different model, in a fresh session, checks the change against the confirmed examples. It has not seen the build conversation, so it can&amp;#39;t be talked into anything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fix.&lt;/strong&gt; The lead fixes what the reviewer found. At most three rounds, then it stops and asks me.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Done.&lt;/strong&gt; Only when the checks below pass.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;What done means&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Build, tests and lint pass.&lt;/li&gt;
&lt;li&gt;Every confirmed example passes, according to the reviewer.&lt;/li&gt;
&lt;li&gt;The reviewer approved this exact version, not an earlier one.&lt;/li&gt;
&lt;li&gt;A person approves anything sensitive.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;House rules&lt;/h2&gt;
&lt;p&gt;A few things the agents are never allowed to do, and what each one prevents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Approve their own work.&lt;/strong&gt; Prevents the most common failure: confident, wrong, and self-certified.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Weaken a test to make it pass.&lt;/strong&gt; Prevents &amp;quot;green&amp;quot; from quietly meaning less over time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Edit their own instructions during a run.&lt;/strong&gt; Prevents the rules from drifting to fit the task.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The same rule, in two other places&lt;/h2&gt;
&lt;p&gt;The workflow above is how I work at my desk. The rule holds up better when it is built into the systems around the agents, so I built it into two more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A pipeline from issue to pull request.&lt;/strong&gt; I set up a self-hosted pipeline where labelled issues are picked up on a schedule and an agent makes the change in an isolated sandbox. It can only open a draft pull request. A developer runs the checks and marks it ready, never the agent. Labels route each task to a different model, including a self-hosted one, so the team compares models on real work instead of benchmarks. Every commit says which model wrote it. The agents only ever get short-lived credentials, and they can&amp;#39;t touch releases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A platform where agents build business apps.&lt;/strong&gt; I designed its foundation around the same rule. Agents write the apps and run inside them, but they never approve, accept or release anything on a person&amp;#39;s behalf. Acceptance checks are tied to the exact version they were run on, and an agent can&amp;#39;t tick a check that belongs to a person.&lt;/p&gt;
&lt;p&gt;Same idea three times: the thing that does the work is never the thing that says it is done.&lt;/p&gt;
&lt;h2&gt;It is just Markdown&lt;/h2&gt;
&lt;p&gt;There is no platform behind the workflow. It is a handful of Markdown files installed as an agent skill. The files are not clever. The judgement is in what they forbid, and in where a person has to say yes.&lt;/p&gt;
&lt;h2&gt;Where it still falls short&lt;/h2&gt;
&lt;p&gt;The builder sees the same examples the reviewer tests against. A determined agent can satisfy the letter of an example and miss its point. The fix is holdout scenarios: cases the reviewer checks that the builder never saw. I have not built that yet.&lt;/p&gt;
</content>
  </entry>
</feed>
