Build log · December 4, 2026

OpenInstinct on Trigger.dev: an iMessage agent that waits for your OK

OpenInstinct is an open source assistant that lives in your iMessage thread and does chores on real websites in a cloud browser, asking before it buys anything. It runs on Vercel's Eve agent framework and a once-a-minute cron. I asked Claude Code to rebuild it on Trigger.dev, wire it up to real services and deploy it. That took about 45 minutes and 14 prompts. Every prompt is below, word for word, with every error, wrong turn and mistake, written up as product feedback for the Trigger.dev team.

Colin Lowenberg Agent: Claude Code (Opus 5.5) Trigger.dev SDK 4.9.2 December 4, 2026, about 45 minutes
The openinstinct.sh home page: Your personal agent should be yours, above three phones showing an iMessage thread with OpenInstinct
openinstinct.sh, the original by Merit Systems (MIT). This post is about a rebuild of it on Trigger.dev; the rebuild's own deployment is private.

For the Trigger.dev team

  1. Waitpoints replaced most of an agent framework. Approvals, questions and per-chat ordering came down to wait.createToken, wait.forToken and a concurrencyKey. Document the edge cases: two waits in one run, and a token whose run has died.
  2. Keep the project ref out of source by default. It sits in trigger.config.ts, so it went to GitHub with the first commit, and the repo had to go private again.
  3. Let env set read a secret without putting it on the command line, and let runs get print a run's output and metadata.

All feedback from this project · Feedback across all seven projects

Where it stands: the tasks are deployed to Trigger.dev production (third version) and the webhook and vault server is on Vercel. Real model calls, a real cloud browser and a real database were tested end to end through a test task. The iMessage provider (Linq) isn't connected yet, so nobody can text it. The GitHub repo is private while its history is cleaned of deployment details.

The project

OpenInstinct is an agent you text. Ask it to book tickets or order groceries and it opens a Kernel cloud browser, logs in with credentials from an encrypted vault the model never sees, and texts you a screenshot and an "APPROVE" request before paying. It remembers facts about you, keeps notes on ongoing chores, and runs jobs on a schedule you set by text.

The original has three moving parts on Vercel: Eve (Vercel's durable agent framework) for the coordinator and browser sub-agent, a Next.js workspace, and a cron that runs every minute and claims due jobs from a lease table. The agent part, about 13,500 lines, is what moved. The web workspace didn't.

Before and after

Before (Eve + Vercel)After (Trigger.dev)
Scheduled jobsA Vercel cron every minute (which needs a paid Vercel plan), plus job and lease tables to claim due work and stop two runs taking the same jobOne Trigger.dev schedule per recurring job (externalId = job id), a delayed run for each one-off. No polling, no leases
Waiting for "APPROVE" or a one-time codeEve session interactionsA waitpoint token: the run is checkpointed for up to 24 hours and costs nothing while it waits. Your next text completes the token
Two texts arriving at onceEve's per-session lockingA queue with concurrencyLimit: 1 and concurrencyKey: threadId: one turn at a time per conversation, conversations in parallel
The browser sub-agentAn Eve subagent called from a workflow toolIts own task, called with triggerAndWait. It has its own retries and a queue limit of 20 browsers, and a taskId resumes the same transcript and browser
Seeing what happenedFunction logsOne run per message with a trace, duration and cost; the coordinator run links to its browser run
Models and web dataVercel AI Gateway, plus web_searchAISA: one key for the models (Anthropic-compatible) and paid data APIs over MCP, with a price quote before each call and an approval above AISA's auto-run limit
CodeAbout 13,500 lines of agent codeAbout 2,300 lines of TypeScript, plus tests. The workspace UI, Google tools and evals weren't ported

Every prompt, in order

These are all my messages to the agent. Some are answers to its multiple-choice questions; the $ lines are commands I ran myself in the app's command box. My phone number, the project ref and my Vercel team name are left out.

  1. build openinstinct on trigger.dev https://openinstinct.sh/ trigger.dev
  2. Yes, wire it upTo "provision the services and deploy it for real?" after the code was written and tested offline.
  3. trigger project: proj_[redacted]Sent while the agent was working.
  4. Postgres: Neon via Vercel (Recommended)
    Kernel: Kernel via Vercel (Recommended)
    AI Gateway: use AISA.one to route models with an AISA_API_KEY instead of vercel, we should also add the ability to connect to aisa:
    Linq: No Linq yetAnswers to four questions at once. The third I typed into "Other".
  5. $ ./node_modules/.bin/trigger env set AISA_API_KEY -e prod --secretThe agent's suggestion. Error: "Missing value. Only --secret-proxy can be used without one." I ran it twice.
  6. $ vercel env add TRIGGER_SECRET_KEY production --sensitive --scope [team]This one worked: it prompts for the value.
  7. it's next to impossible to open .env.local in this folder, how would i do that?
  8. $ read -rs "AISA_API_KEY?AISA key: " && echo && ./node_modules/.bin/trigger env set AISA_API_KEY "$AISA_API_KEY" -e prod --secret && echo "AISA_API_KEY=$AISA_API_KEY" >> .env.local && unset AISA_API_KEYThe agent's second suggestion. The app's command box isn't interactive, so it printed "AISA key:" and went no further. In the end I pasted the key into .env.local myself and the agent copied it across without printing it.
  9. I'll send my number
  10. [my phone number]For the allowlist: only listed numbers are served.
  11. yesTo "commit this?"
  12. push to github, you can make arepo
  13. can we make it public? do all those things you suggested
  14. we don't want to expose my deployment details, maybe we can hide them somehow?Sent just after the repo went public.
  15. let's write a blog post with a step-by-step instructions that we followed converting the site to trigger.dev, showing the improvements, and including every prompt i've said to you, and document all the pitfalls and confusion and errors and mistakes, that way we can have good product feedback for the trigger.dev founders let's update our blog post with a step-by-step including every prompt i've said to you, and document all the pitfalls and confusion and errors and mistakes, that way we can have good product feedback for the trigger.dev founders let's add a prompt to the blog post that will help other setup their migration to trigger. i'll use it on another project to test it / commit the blog post to this repo : https://github.com/opencolin/trigger-blog / and publish it as a github pagePasted, which is why the middle repeats. This post is the result.

Step 1: Read the original and map it

From prompt 1 alone, the agent read the OpenInstinct repo and its docs, then the Trigger.dev docs and skills that ship inside the installed SDK package. It wrote a mapping before any code. The key decisions:

Step 2: Build the tasks

Six tasks: inbound-message (routes each text), agent-turn (the coordinator), browser-worker (Kernel plus Playwright plus the vault), scheduled-job and scheduled-once, and browser-janitor (every 30 minutes, closes browsers left open). A seventh, test-chat, came later.

The whole approval mechanism is this function. The order matters: the token is saved on the thread before the question is sent, so an instant reply can't arrive before there's anything to answer.

export async function askAndWait(threadId, kind, prompt, timeout = "24h") {
  const token = await wait.createToken({ timeout, tags: [`thread:${threadId}`, `kind:${kind}`] });
  await setPending(threadId, { tokenId: token.id, kind });
  try {
    await sendText(threadId, prompt);
    const result = await wait.forToken<Reply>(token);
    return result.ok ? result.output.text : null;
  } finally {
    await setPending(threadId, null);
  }
}

The other half is in inbound-message. If the thread has a token that is still waiting, the text answers it. Otherwise the text starts a new turn, queued behind any other turn in the same conversation:

if (thread.pendingTokenId) {
  const token = await wait.retrieveToken(thread.pendingTokenId).catch(() => null);
  if (token?.status === "WAITING") {
    await wait.completeToken(thread.pendingTokenId, { text });
    return { routed: "answered" };
  }
  await setPending(thread.id, null); // stale: timed out, or the run died
}
await agentTurn.trigger(
  { threadId: thread.id, userId: user.id, mode: "message", text },
  { concurrencyKey: thread.id },
);

Two things the docs didn't settle, so the agent chose the safe option. It runs the model's tool calls one at a time (toolCallConcurrency: 1), so a run never has two waits open. And it checks the token's status before completing it, so a token left behind by a dead run starts a fresh turn instead of swallowing the message.

The vault: logins and cards are encrypted (AES-256-GCM, a key per item, bound to the user). A Playwright script running in the Kernel browser fills the form and returns only a count. The filled fields are masked in screenshots, and any secret that shows up in tool output is redacted before the model or the database sees it. Eleven tests cover the encryption, the autofill script against real forms, redaction and the signed links.

Step 3: Provision the services

Prompt 2 started the real wiring. The agent asked four questions at once (prompt 4). My answers changed the plan in one place: models and web data go through AISA instead of Vercel's AI Gateway, which added three tools that search AISA's data APIs, show their inputs, and quote before running.

Step 4: Deploy

trigger deploy --env prod worked the first time and printed version 20261204.1. The web server took four tries on Vercel, each a different error:

  1. Deployed as "Other": every route was a 404. Fix: "framework": "hono" in vercel.json.
  2. "No entrypoint found which imports hono". Fix: an src/index.ts that imports Hono itself, not only a router from another file.
  3. Vercel used pnpm 10 on a pnpm 11 lockfile. Fix: packageManager in package.json.
  4. TypeScript 7: "Cannot find type definition file for 'node'". Fix: remove types from tsconfig.json.

Step 5: Test without iMessage

With no Linq line yet, the agent added a test-chat task. It sends a message as if it came from a phone number, on a thread marked as a test, and the replies are recorded on the run instead of texted. It then started runs itself:

npx trigger.dev tasks trigger test-chat --env prod \
  --payload '{"phone":"+1555…","text":"hey, what can you do?"}' --wait

In the first posts the agent couldn't start runs from the CLI at all. With 4.9.2's tasks trigger --wait it could, and it prints the output of the run it started. But that run only routes the message. The agent's replies are recorded on a different run (the agent-turn it triggered), and runs get prints status and timing, not output or metadata. So the agent read the replies from the database.

TestTurnResult
First message7.07 sA short intro; saved my name to its profile memory. Run cost shown: $0.0003
Open a page in the browser9.31 sA Kernel browser, two screenshots, the browser closed afterwards
My own number, after adding it to the allowlist3.76 s"loud and clear! what can i help you with?"
After the security fixes (version 3)5.90 sCompleted
Image link, then the same link with a forged token200, then 404
web_fetch to a cloud metadata address, localhost and file:All refused

One false alarm: the browser worker reported "no h1" on example.com. Kernel's browser had been served a different page, not the one the agent expected. Not a bug.

Step 6: Review the security

Before publishing, a separate reviewer agent read the code with no context from the build. It found six real problems, all now fixed and tested:

  1. web_fetch could reach private addresses (SSRF). Now it resolves DNS, refuses private ranges and checks each redirect.
  2. The "same site" check for filling logins parsed hosts loosely. Now it's an exact origin match.
  3. Screenshot masking failed open: if the mask script errored, the screenshot went out anyway. Now it doesn't.
  4. An approval could be replayed for a second purchase. Now it's bound to a hash of what was approved and used once.
  5. Image links could fetch another user's screenshots by id. Now they're scoped to the user.
  6. Cards could be filled without an approved purchase. Now they need an approval naming that merchant.

The tests covered what the code was supposed to do. None of them caught these.

Step 7: Publish, then un-publish

The agent committed, created the GitHub repo, added an MIT license that keeps Merit Systems' copyright, and made it public (prompts 11 to 13). Then prompt 14: I didn't want my deployment details out there. Checking showed three leaks:

The agent set the repo back to private and moved the ref into an environment variable (process.env.TRIGGER_PROJECT_REF, from a gitignored .env). It also prepared a fresh single-commit history with my GitHub noreply address. Force-pushing that and deleting the notes ref are waiting for my OK.

Pitfalls, confusion, errors and mistakes

Feedback for Trigger.dev

High The project ref lives in source

trigger.config.ts holds project: "proj_…", and every example writes it there. It's not a secret, but it's the one deployment detail that's guaranteed to be in the first commit, so it went public with the repo. The agent had to invent the process.env.TRIGGER_PROJECT_REF ?? "proj_your_project_ref" pattern and remember to load .env before each CLI command.

Ask: read TRIGGER_PROJECT_REF when project is missing, have init write it to .env, and mention it in an "open-sourcing your project" note.

High Waitpoints: the edge cases aren't written down

Waitpoint tokens did the job of Eve's whole interaction system, and that's the headline of this build. But the agent had to guess three things: whether one run can wait on two tokens at once (AI SDK runs tool calls in parallel by default); whether a run waiting on a concurrencyLimit: 1 queue keeps its slot; and what happens to a token when its run is cancelled or crashes. It chose the safe answer each time, at the cost of parallel tools and an extra status check on every message.

Ask: one docs section on these three. Ideally, a token whose run has ended reports that, instead of waiting until it times out.

Medium env set needs the secret on the command line

trigger env set NAME -e prod --secret with no value fails with "Missing value. Only --secret-proxy can be used without one." The only way in is as an argument, which lands in shell history, or from a variable the user has to set first. Vercel's env add prompts for the value, and that one worked first time (prompt 6). env set -e dev isn't accepted either ("expected prod|staging|preview|production"); dev reads .env, which the help doesn't say.

Ask: prompt for the value when it's missing and stdin is a terminal, accept --value-stdin, and say in --help where dev variables come from.

Medium runs get doesn't show what a run returned

tasks trigger --wait prints the output of the run it starts, which is great. Anything further down (a child run, or the metadata a run records as it goes) can't be read from the CLI, so every check of the agent's replies went through the database. For an agent that records its replies in metadata, that's the whole result.

Ask: runs get --output and --metadata, and a way to list a run's child runs.

Low Smaller things

  • The UndefinedVar Docker warnings ($SSL_CERT_FILE, $REQUESTS_CA_BUNDLE, $PIP_CERT) again, on a project with no Python.

Worked well Worth keeping

tasks trigger --payload … --wait, which finally let the agent test without me; waitpoint tokens with tags and timeouts; schedules.create with externalId, so user-made jobs map one to one; triggerAndWait for the browser sub-agent; concurrencyKey for per-conversation order; the docs and skills shipped inside the SDK package; and a first deploy that just worked.

Not Trigger.dev, but it cost time

  1. Vercel's Hono support took four deploys (Step 4). Each error was clear on its own, but there was always one more.
  2. Kernel's Marketplace install needed its terms accepted in a browser, the one provisioning step the agent couldn't do from the CLI.
  3. Dotfiles are hard to open. .env.local doesn't show in Finder (prompt 7). open -e .env.local, Cmd+Shift+. in Finder, or the app's file pane all work.
  4. vercel env pull overwrites .env.local, which held the local keys. The agent pulled to .env.vercel instead.
  5. AISA's model list needs a key, so the model id came from AISA's public docs.
  6. pnpm 11 blocks build scripts by default, so esbuild didn't install until it was allowed in pnpm-workspace.yaml.

Mistakes the agent made

  1. Gave me a command that couldn't work: env set with no value (prompt 5), which I ran twice.
  2. Then gave me an interactive one (read -rs, prompt 8) for a command box that can't take input. A file to edit was the answer all along.
  3. Published before checking what was in the history. The project ref and my email went public with the first push, and the repo had to go private again.
  4. Shipped six security bugs in the first version, caught by the review in Step 6, not by its own tests.
  5. Tried to wait with sleep, which the app blocks, before switching to its Monitor tool.

Confusion

Still open at the time of writing

A prompt you can reuse

The earlier posts' prompt was for moving cron jobs. This one also covers agents and anything that waits on a person, and adds what this run taught: keep the project ref out of source, a test task that stands in for the real channel, starting runs from the CLI, a security review before publishing, and checking the history before a repo goes public. It's also at migration-prompt.txt.

Move [PROJECT] onto Trigger.dev (v4 SDK): its background jobs, schedules, and any agent loop that waits
on people or runs longer than a web request. Keep the live site working the whole time. Follow these steps
in order and stop where a step says to. I may be on my phone: put every question and its choices in your
message as plain text, and give every command I should run in its own code block.

0. Look before you plan. Change nothing.
   - Confirm which repository and which deployed project I mean. If the folder has no jobs, schedules or
     agent loops, say so and ask; don't plan for the wrong repo.
   - Read the installed Trigger.dev docs and skills that ship in node_modules (and trigger.dev/docs/llms.txt)
     instead of remembering the API. Check the CLI version: `npx trigger.dev --version`.
   - Find where production keeps its data and prove it persists (row counts only).

1. Plan; change nothing yet.
   - List every piece of background work: cron functions (`crons` in vercel.json), GitHub Actions that
     fetch or commit data, polling loops and lease tables, queues, webhooks that do slow work inline,
     "durable" workflow or agent frameworks, and anything that waits for a human (approvals, one-time
     codes, replies).
   - For each one, give its Trigger.dev shape:
     a fixed schedule -> schedules.task({ cron })
     a schedule users create -> schedules.create({ externalId, deduplicationKey }) per job
     "do this later, once" -> a delayed run (trigger with { delay }), cancelled with runs.cancel
     wait for a person -> wait.createToken + wait.forToken, completed by the task that receives the reply
     a sub-job whose result you need -> childTask.triggerAndWait
     one-at-a-time per user or conversation -> a queue with concurrencyLimit: 1 plus a concurrencyKey
   - Say what stays where it is. Trigger.dev runs tasks, not the website or the webhook endpoint; those
     stay on the web host and start tasks with tasks.trigger and an idempotency key from the event.
   - Read Trigger.dev's current pricing and limits, and say what this project needs.
   - Stop and show me the plan as a table: old piece -> new piece -> file.

2. Build it.
   - Work on a branch. Reuse the existing logic: move it into tasks, don't rewrite it.
   - Put the project ref in an environment variable, not in the source:
     project: process.env.TRIGGER_PROJECT_REF ?? "proj_your_project_ref" in trigger.config.ts, with the
     real value in a gitignored .env. Commit a .env.example with placeholders only.
   - When a run waits on a token: create the token and save its id BEFORE you send the question, so a fast
     reply can't arrive first. Clear it in a finally block. The task that receives replies checks
     wait.retrieveToken(id).status === "WAITING" before completing it, and treats anything else as stale.
   - If an AI SDK loop calls tools that wait, run tools one at a time (toolCallConcurrency: 1) so a run
     never has two waits open.
   - Add a test task that stands in for the real channel (SMS, Slack, email): it takes the same payload the
     webhook would and records replies in run metadata instead of sending them. Then the whole flow can be
     tested before the channel is connected.
   - Write unit tests for the parts that guard money, secrets and other people's data.

3. Provision. I make the accounts and click any terms; you do the rest from the CLI where you can.
   - Ask me which provider to use for each service, with your recommendation first.
   - Never ask me to paste a secret into chat. Have me put it in the gitignored .env file myself, then copy
     it into Trigger.dev without printing it:
     npx trigger.dev env set NAME "$VALUE" -e prod --secret
     (env set needs the value on the command line, and has no dev environment: dev reads .env).
   - Don't give me interactive shell commands (read -s, prompts) to run inside the agent app's command box:
     they hang. Give me a file to edit instead, or a command for a real terminal.
   - Tell me how to open hidden dotfiles if I need to edit one (open -e .env, or Cmd+Shift+. in Finder).

4. Deploy and test.
   - `npx trigger.dev whoami`, then `npx trigger.dev deploy --env prod`. Report the version it printed.
   - Start runs yourself: npx trigger.dev tasks trigger <task-id> --env prod --payload '{...}' --wait
   - `runs get` shows status, not output or metadata, so check results where the task wrote them (the
     database, or metadata you can read some other way). Never read the CLI's stored token.
   - Run at least: the happy path, a path that waits for a human, a refused input (for example a sender who
     isn't allowed), and one real external call (browser, model, API). Give me duration and cost per run.
   - Deploy the web part separately and check each route returns what it should. A forged or expired link
     must fail.

5. Review before anyone else sees it.
   - Have a separate reviewer (a subagent with only the code) look for: SSRF in anything that fetches URLs,
     cross-user access by id, approvals that can be replayed or reused for a different amount, secrets in
     logs, screenshots or stored transcripts, and fail-open checks. Fix what it finds, add tests, redeploy,
     and run the tests from step 4 again.

6. Publish only when I say so, and keep deployment details out.
   - Before making a repo public, search the whole history (not just the working tree) for project refs,
     URLs of my deployments, team names, phone numbers, emails and keys. Check git notes and other refs too.
   - Commit with my GitHub noreply address, not a personal one.
   - If history has anything private, tell me and propose a fresh single-commit history. Don't force-push
     or change visibility without asking.
   - Add a LICENSE that keeps the original authors' copyright if the project is based on theirs.

Throughout:
- Never print or commit secrets, database addresses, account or project IDs, or my personal details.
- Don't describe dashboard screens you haven't seen as fact; ask for a screenshot.
- At every stop, say what you verified, what you didn't, and what still needs me.