Skip to content
daintreehqPublic

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

618 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daintree Decisions

Your coding agent asks. You answer on your phone. The answer is typed into the same terminal.

The sister app of Daintree. End-to-end encrypted, self-hosted on your own Cloudflare account, and works with any agent that speaks MCP.

CI npm License Deploy to Cloudflare

How it works · Set up · Security · Docs · Develop


A Claude Code session in a Daintree terminal panel calls ask_human for approval of a design change and ends its turn. A rail labelled encrypted carries the question to the phone, which shows it with its before and after screenshots, Approve chosen and a note ready to send. A second rail labelled signed carries the answer back: thirty-eight minutes later the answer block, with the choice and the note, is typed into the same terminal and the agent merges.

An agent that hits a question it should not answer alone (a product choice, an ambiguous requirement, sign-off on a design change) calls one MCP tool, ask_human, and ends its turn. Minutes or a day later you answer on your phone, and the answer is typed back into that agent's terminal, resuming the session first if it has to.

Everything runs in your own Cloudflare account. There is no Daintree-operated server, no account to create, and nothing for Daintree to read: questions, answers and screenshots are end-to-end encrypted between your computer and your phone.

How it works

Notification: a close-up of the lock screen, whose notifications say only A question needs your input. Decision: the whole phone, showing the design approval with its before and after screenshots, Approve chosen and a note in the composer. Receipt: a close-up of the same question answered, with the note under Your answer and Typed into the terminal beneath it.

  1. Your agent asks. ask_human returns at once with an id, and the agent ends its turn (or carries on with unrelated work). Nothing holds a tool call open for hours, so it works with every agent CLI, survives restarts and sleep, and never looks stuck.
  2. Your phone buzzes. The notification says only that a question is waiting. The question itself is encrypted on your computer and decrypted on your phone.
  3. You decide, with the context. The agent's question, its notes, the options it is weighing and any screenshots it attached. Add a note if the agent should know why.
  4. It lands in the right place. Your answer is signed on the phone, and typed into the exact pane that asked once that agent is idle. Tap the receipt under your answer to see each step: queued, sent, saved on your relay, received, typed.

More than yes or no

Multiple choice: a close-up of three options, the first two with a description of the trade-off. Model answer: a close-up of an answer from the decision model, labelled Model answer with the model's name, its confidence and how many earlier decisions it drew on, with Confirm answer and Overrule. Follow-ups: a close-up of an answered question's thread, with the answer, two follow-ups from the phone, each marked Typed into the terminal, and the agent's reply.

Approvals, choices and free text Options can carry a description of the trade-off. Text answers can be typed or dictated.
Screenshots that matter Agents attach before and after images. They are encrypted like everything else, open in a zoomable viewer, and Compare puts before against after.
Follow-ups Your answer is final; anything more is a follow-up in the same thread. It is typed into the agent's terminal marked as a message from you, sent from your phone or your computer, that does not change the answer. The agent can reply, and a question it asks there comes back to Needs you.
At your computer In Daintree you can answer, decline or follow up without picking up your phone. Your computer signs each one, and every device shows it as yours, made on that computer. While you are active at the computer, a new question's notification waits up to two minutes, so one you answer there never buzzes your phone.
How involved you are Choose whether agents involve you early or consult each other first and bring you a recommendation, normally or for a while. Set it on your phone or in Daintree, and agents read it before they ask. It never changes what needs you.
Photos from your phone + in the composer takes a photo or chooses up to four from your library, to go with an answer or a follow-up. Each is scaled down with its location stripped, encrypted on the phone, and handed to the agent as a file.
An optional decision model It answers low-stakes questions the way you would, from your own history, only where a workflow allows it. Its answers are always labelled "Model answer", and you can confirm or overrule them. It can never answer anything that needs you.
Deadlines A question can expire. An expired question is reported to the agent as not authorised, never as consent.
Quiet hours Silence notifications overnight. Questions and answers still sync.

Safety rules that do not bend

  • A workflow can require a human (human-required). A model, a proxy, or the agent itself can never satisfy it, and the agent cannot lower the level.
  • Only a signed answer counts as a human answer: one from a phone or tablet you paired, or one you make on the computer that set up the relay. An answer made on the computer is labelled as yours from that computer, never as a phone's. The relay cannot forge either.
  • Answers are typed into the exact pane they were asked from, or not at all. If that pane or session cannot be found, the answer waits and tells you.
  • Answers are typed as inert, delimited data. Control characters and escape sequences are stripped, and nothing in an answer can close the block or pose as a field.
  • An expired question never authorizes anything.
  • Push notifications say only "a question needs your input", or "an agent stopped" when Daintree is set to send it. Never the question.

Two phones: the six-digit pairing code to check against the same code on the computer, and a paired computer's details under Settings, Devices, with its key fingerprint in four-character groups and Copy fingerprint.

Pairing is a QR code and a six-digit code you check on both screens. Open any device under Settings → Devices for its key fingerprint, to compare against your computer. Revoking a device rotates the content key, so it cannot read anything new.

Read docs/security-claims.md for exactly what is and is not protected, including the places where plaintext necessarily exists (your computer, your phone, and the optional dictation path), and docs/threat-model.md for the attacker it is built against.

On your phone, or anywhere else

The app in a desktop browser in the dark Daintree theme, with the sidebar, the questions that need you and an open approval with its before and after screenshots and answer composer side by side.

The app is an installable PWA served by your own Worker: no app store, push notifications, an offline outbox that sends when you are back in signal, and light and dark themes. On a wide screen the sidebar, your questions and the open question sit side by side.

Under the hood

 agent ──ask_human──▶ Decisions MCP ──encrypt+sign──▶  your Cloudflare Worker  ──push──▶ your phone (PWA)
 (any CLI)           (HTTP, loopback)   outbound WSS   + Durable Object + R2    ◀─answer─  encrypted + signed
    ▲
    └── answer typed into the right terminal, when it is idle ◀── hibernatable WebSocket ───┘
  • The Decisions MCP is a plain HTTP MCP server that you can add to any agent. Inside Daintree it is wired in for you; anywhere else run decisions mcp and it prints the exact claude mcp add --transport http … line. It serves /mcp by default; --path /mcp/decisions (or path in createDecisionsMcpHandler) mounts it somewhere else, matched exactly. Its tools carry MCP annotations, so agents that gate tool calls (Codex, for one) let ask_human through without asking first. Where a WebSocket cannot stay open, decisions mcp --no-socket (or decisions listen --no-socket) polls the relay over HTTP instead (operations).
  • The relay is a Cloudflare Worker, one SQLite Durable Object, and a private R2 bucket. The desktop and phone stay connected through Cloudflare's WebSocket Hibernation API, so an idle connection costs almost nothing. It only ever stores ciphertext.
  • The crypto is WebCrypto everywhere: P-256 ECDSA and ECDH, HKDF, AES-256-GCM, with content keys in epochs that rotate when a device is revoked.
  • The protocol is versioned and written down in docs/protocol.md. Any server that implements it is a valid relay.

Set up (in about five minutes)

You need a Cloudflare account (the free plan is enough for one person), Node 22+, and a phone.

  1. Deploy. Click the button below. Cloudflare copies this repository into your account, creates the R2 bucket and Durable Object, and asks for one secret, CLAIM_SECRET: type any long random string (openssl rand -hex 32) and keep it for step 2.

    Deploy to Cloudflare

    Prefer a terminal? npx @daintreehq/decisions-cli deploy (no clone needed) deploys the relay that matches the CLI's version, generates the secret, shows it once and never saves it. More detail in docs/self-host.md.

  2. Claim it from the computer your agents run on:

    pnpm decisions setup --url https://<your-worker>.workers.dev --claim-secret-file <file containing the secret>

    Or set DECISIONS_CLAIM_SECRET; avoid putting the secret on the command line, where it shows in the process list. In Daintree this is Settings → Decisions. The claim can only happen once.

  3. Pair your phone. pnpm decisions pair shows a QR code. Scan it, then confirm the same six digits appear on both screens. On iPhone open the link in Safari, tap Share → Add to Home Screen, and open the installed app (iOS only delivers push to installed web apps).

  4. Add the MCP to your agent. pnpm decisions mcp prints the line for your agent.

  5. Test it.

    pnpm decisions ask "Does this work?" --option yes=Yes --option no=No --wait

    Answer on your phone. --wait stays until the outcome and exits with it (0 answered); --expires-in 15m sets a reply window, --planned-fallback asks for advice instead of a decision, and decisions wait <question_id> picks the wait up again later. docs/operations.md has the outcomes, exit codes and JSON records.

Important

Back up your keys: pnpm decisions recovery export --out decisions-recovery.json. If you lose every device that holds your keys, the encrypted data on Cloudflare cannot be recovered. See docs/key-recovery.md.

A 15-minute question with a planned fallback

Some questions are worth asking but not worth blocking on. Give one a deadline and say what you will do if nobody answers:

pnpm decisions --json ask "Which fixture should I use?" \
  --option mem="In memory" --option disk="On disk" \
  --expires-in 15m \
  --planned-fallback "I will use the in-memory fixture." \
  --wait

An agent does the same through ask_human with expires_in: "15m" and planned_fallback, and gets the question ID back at once. If the relay cannot be read at that moment, the call is refused with invalid_state: support-unknown; ask again once it can be reached.

  • Answered in time: the answer is the person's decision (status: human-answered with provenance: human), and its notice is written to the sink of the process that receives for this computer (in Daintree, typed into the asking terminal).
  • No answer in 15 minutes: once this computer has read the relay's expiry, the question ends as advisory-expired (exit 13, fallback_due: true). The stated plan is the agent's to carry out at its own discretion. Nothing was decided or approved. If the deadline passed before the question reached the relay, the outcome is never-published (exit 14) and fallback_due says whether the plan may go ahead; a host that does not allow the plan to go ahead reports expired (exit 12) instead.
  • A question that is not advisory, or an approval: an approval cannot carry a planned fallback, and a question without one waits for a decision. When it expires the outcome is expired (exit 12) and nothing may go ahead. An expired question never turns into consent.

To get an outcome back later by question ID, for example after a restart or a lost terminal:

pnpm decisions wait <question_id>   # waits again, with the same outcomes and exit codes
pnpm decisions get <question_id>    # says where the question stands now, without waiting

An agent connected through decisions mcp calls get_decision with the ID, or runs decisions wait <question_id> --pane mcp from its shell (decisions wait and decisions get take --pane mcp for a question asked through the MCP). The full walkthrough, with the outcomes, exit codes and JSON records, is in docs/operations.md.

Repository layout

Path What it is
worker/ Cloudflare Worker + DecisionRoom Durable Object (SQLite) + R2 attachment streaming + Web Push + dictation proxy
app/ The phone app (React + Vite PWA)
packages/protocol/ Versioned wire protocol: schemas, canonical signing, state machine, errors
packages/crypto/ WebCrypto implementation (P-256 ECDSA/ECDH, HKDF, AES-256-GCM) shared by browser, Node and Workers
packages/client/ Desktop client library: relay client, hibernatable socket, durable stores, delivery engine, HTTP MCP server
packages/cli/ The decisions command
packages/relay/ The prebuilt, checksummed Worker bundle and phone app that decisions deploy uploads
packages/decision-model/ The optional local opinion model
e2e/ End-to-end tests against a real relay, the real PWA in Chromium, and a real MCP client
tools/ Health check and the package check
docs/ Protocol, architecture, security, operations, and the Daintree integration spec

Documentation

Develop

pnpm install
pnpm build        # builds the PWA into app/dist (what the Worker serves)
pnpm build:all    # also builds the libraries and the CLI (needed for `pnpm decisions`)
pnpm pack:check   # packs every library and the CLI, installs them in a scratch project, imports and type-checks
pnpm test         # every package, including the Worker in a real workerd runtime
pnpm typecheck
pnpm dev          # wrangler dev on http://localhost:8787
pnpm release:publish --dry-run   # what a release would publish to npm, without uploading

Releases are published to npm from a v* tag; see docs/operations.md.

Every screen in this README is a real capture of the app, driven against a real relay with real encrypted questions. To regenerate the images after a UI change:

pnpm build && pnpm build:all
SCREENSHOTS_DIR=/tmp/decisions-shots pnpm --filter @daintreehq/decisions-e2e test screenshots
node e2e/scripts/readme-images.mjs /tmp/decisions-shots   # writes docs/readme/*.png

License

Apache-2.0. "Daintree" and the Daintree logo are marks of Greg Priday and are not licensed under Apache-2.0.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages