All posts
  • tooling
  • automation
  • agents

One agent to rule them all, and in Telegram bind them

These days, a lot of our work on Ambre starts with a message in Telegram. We ask Ambre’s agent a question from our phones, and half a minute later the answer is there. If the answer is “this is a bug”, it offers to file a ticket. One press later, other agents build the fix, review it and merge it.

The setup is heavily inspired by Anthropic’s AI-native SDLC Playbook and Tobi Lütke’s episode of The Knowledge Project on how Shopify runs on agents. But our first attempt looked nothing like it.

First, we built Office

Back in April we put our tickets on autopilot. The next step felt obvious: give every project its own team of AI employees. So we built Office, a small 3D office you could walk around in. Each room was a project, and each employee had their own role, their own memories and their own way of working. You walked up to someone, talked to them and handed them work.

A room in Office: an engineer, a reviewer and a product manager at their desks, with a meeting table, a vision whiteboard and an empty desk to hire someone new

It was fun for about a week. Then I realised what I’d actually built for myself — a job as a manager. To get anything done I had to know who owned what, walk to the right room, find the right person, explain the context, and then go back and check on them later. I spent my days coordinating the people working on Ambre instead of working on Ambre. I absolutely hated it.

So we threw Office out and started from the other end.

The idea

One agent represents the product, and that’s the only one we talk to. Agents still do the work behind it, but we never have to find them, brief them or chase them.

That gives us two very different kinds of agents:

  • The Ambre agent answers questions and suggests work. It can read almost everything and change almost nothing.
  • The working agents pick up tickets and write code. They only ever see work a human approved, and everything they do goes through a PR and CI.

Talking to the Ambre agent

The Ambre agent lives in a private Telegram chat. It knows Ambre by looking things up live — our repositories, issues and CI, Sentry, Mixpanel, RevenueCat, App Store Connect, our Supabase database, our feature flags in Atelier (our in-house feature flag tool, more on that in a future post) and the support inbox. It doesn’t keep a copy of any of it.

We mostly ask it for three things:

  • Answers. “Why did signups drop yesterday?” or “What’s crashing in the latest build?” It reads the data and replies.
  • Fixes. When it finds something worth fixing, it suggests a ticket with a File it button. Only Sofia or I can press it.
  • Releases. Ask it to submit a build and it replies with a Run button for our App Store submission workflow. One press creates the new version in App Store Connect, uploads the store listing and metadata, and submits the build for review on every platform we ship — iPhone, iPad and Apple Watch, Mac, Apple TV and Vision Pro.

It also speaks first once a day. Every morning a health report on the live App Store version lands in our team chat, and if something looks off, there’s a suggested ticket right under it.

Every one of these follows the same rule: the agent suggests, and a human press makes it happen.

Doing the work

Pressing File it puts a ticket on our project board. Moving it to To Do — or pressing File in To Do to do both at once — starts the working agents. They run on our self-hosted build Macs, so iOS tickets can actually build. There are three of them, each a separate Claude Code run with fresh context:

  1. The builder reads the ticket, does the work and opens a PR. It’s told never to push to main or merge.
  2. The reviewer reads the PR cold and comments on what matters. Its token can comment but not push, so it can’t quietly change what it’s reviewing.
  3. The finisher reads the review, decides which findings it agrees with, fixes those, and calls whether the PR is ready.

None of them merges. If the finisher says the PR is ready, a plain workflow step waits for CI and merges it. Red CI, or no CI, leaves the PR for us. Either way, the chat hears back with a link to the PR: either it’s fixed and merged, or it needs one of us.

That’s the part Office never gave me. The work reports back to where I asked for it, so there’s nobody to chase.

Why the Ambre agent can’t fix things itself

It would be simpler to let the agent we talk to just fix things. We deliberately don’t. Sentry, Mixpanel and the support inbox are full of text written by strangers, and we don’t want a cleverly worded crash report to turn into a code change. So:

  • It can only read. No shell, no files, just a set of read tools, and almost every credential behind them is read-only. App Store Connect doesn’t offer a read-only key, so there the tools themselves only ever read. And it can close a Sentry issue when we ask, which always leaves a comment.
  • It can’t press its own buttons. It holds nothing that can file a ticket, move the board, start a release or touch code. The buttons only work when one of us presses them.
  • Every job gets its own key. The chat side has a GitHub App that can only file issues, update the board and start workflows. The runners have a second one, and every job mints a short-lived token from it with just the permissions that job needs — read-only for answers.
  • No agent can change the checks. Neither App can edit workflows, so no agent can rewrite the checks it’s measured against. And in every code repository the agents work in, main requires CI to pass, so a direct push gets rejected, not just discouraged. The exceptions are two data repositories that bots commit to throughout the day.

How it works

The chat side is a small Cloudflare Worker. When a message arrives, it checks who’s asking (only our two accounts get in), acknowledges right away, starts a GitHub Actions run, and posts the answer once the run has it. Answers run on GitHub’s Linux runners and take about 25 to 40 seconds, most of which is waiting for a runner to start.

Telegram bots can’t read chat history, so the agent brings its own. Every answer replies to its question and carries the thread in a collapsed quote, so replying to an answer gives the agent the whole conversation. On top of that, the Worker keeps each chat’s last 40 messages, so a new message that doesn’t reply to anything still comes with what was said just before. It’s the only thing the Worker stores. Everything Telegram-specific sits behind one adapter, so adding another chat app means writing a new adapter, not a rewrite.

Claude only ever runs as Claude Code on a runner, using the subscription of whoever asked or moved the ticket. Scheduled jobs run on mine. The Worker holds no Claude credentials and we don’t have an API key. That costs us most of those 25 to 40 seconds per answer, and in return Sofia and I each pay for our own questions on our own plan.

Learning in the open

In Office, every employee had their own memories, so what one learned, the others never knew. Our agent learns too, but in the open.

Every night the Ambre agent rereads the day’s questions, answers and ticket reviews, and opens a PR with what it learned — new lessons in a LESSONS.md file and new or better skills. The PR merges itself once CI passes. The agent reads the lessons with every question and opens a skill when one fits. We don’t review lessons. If one is wrong, we correct the agent in the chat, and the next dream knows that our correction beats what it wrote. The day’s conversations are kept privately for two days for this.

Our app repository has the same habit. A nightly dream updates the instructions and skills our coding agents read, and merges the same way, except changes to safety, privacy or git rules, which wait for a human.

And no agent gets private memory. If an agent learned something, it goes in a file every human and agent can read.

What we borrowed

Most of this isn’t our idea.

From the AI-native SDLC Playbook:

  • Intent first. The playbook captures work as a short, version-controlled intent.md. Our agent’s design lives in one, and most decisions in this post trace back to a line in it.
  • Knowledge lives in the repo. Institutional knowledge goes in CLAUDE.md, skills and hooks, reviewed like code. Our no-private-memory rule takes it one step further.
  • Claude in the review loop. Claude reviews every PR. Ours is a separate agent with fresh context, and a third one acts on its findings.
  • Gates where judgment is needed. Actions wait for a person, and the agent can’t write to whatever the gate reads. Our gates are buttons and a board move.
  • Least privilege in CI. Headless claude -p, short-lived scoped tokens, output arriving as a PR, no way to push to main.
  • Closing the loop. Production signals turn into new work. That’s our morning health report.

From Tobi Lütke and Shopify’s River:

  • An agent that lives in chat. River lives in Shopify’s Slack, ours lives in Telegram. Asking it should feel like asking a colleague — not like walking around Office looking for the right one.
  • Conversations become PRs. Tobi estimates up to half of Shopify’s pull requests start as conversations that River turns into code. That’s our flow: a question, an answer, a ticket, a PR.
  • Dreaming. River rereads its day overnight and improves its own skills and instructions. This part of the episode is what got me to set up ours. It does the same, under the same name, with a PR in between.
  • Machines can’t take responsibility. Only humans can be accountable for a call. That’s why our agent suggests and we press.
  • No slop grenades. Shopify’s name for handing a colleague agent output you never actually read. Here, a second agent reviews every PR, a third acts on the review, and CI has the final say.

Where we went our own way

  • We auto-merge. The playbook has a human approve every merge. We let the pipeline merge when the finisher says the PR is ready and CI is green, even in repositories that deploy from main. For two people, human-speed review was a real bottleneck, so our human decision moved earlier — to the press that starts the work.
  • A private chat, not open channels. River works in open channels so the whole company learns by watching. With two of us, there’s nobody else to learn by watching, so a private chat is all we need.
  • Claude decides when something’s wrong. In the playbook, problems are caught by deterministic checks, like a metric drifting outside its normal range, and only then does Claude dig in. We skipped the checks. Every morning Claude reads the numbers for the live version and decides for itself whether anything looks off. It works at our size, but if it starts raising false alarms, deterministic checks are the first thing we’d add.

Before you try this in a bigger team

This works for us because we’re two people who read every message. Here are some things to keep in mind before setting this up in a larger organisation:

  • Merging without human review. For us, a bad merge gets noticed within the day. In a bigger team, the playbook’s human approval exists for good reasons — the agent that wrote the code shouldn’t be the one approving it, and the approval leaves a record of who signed off.
  • Agents with a shell on machines that stick around. Our build Macs aren’t wiped between jobs. A bigger team should run agents in throwaway, sandboxed environments with a network allowlist.
  • Some rules are prompts. Credentials and branch rules enforce part of the boundaries above. Others, like the builder never merging, start as instructions in a prompt and are only backed by the pipeline afterwards.
  • The agent can read everything, including user data. That’s fine when only two of us can use the chat. With more people asking, that access might need a second look.
  • Lessons merge themselves. Both nightly dreams merge on green CI. That’s fast, and it’s also a way for a bad lesson to land without anyone reading it.

For us, it’s the right trade. It’s cheap, it’s small enough to understand completely, and every rough edge shows up quickly in a chat we both read. Right now, that’s exactly what we want — a place to see what works and what doesn’t, before we decide what’s worth making stricter.

Closing thoughts

Talking directly to your product feels like magic. I ask Ambre a question in Telegram and it answers like someone who knows every corner of it. Sending it a voice memo on the go and getting a reply back feels like something out of a futuristic movie.

I absolutely love working this way.

Written by

César Pinto Castillo