Text your codebase. A small worker that bridges Photon Spectrum (iMessage) to Cursor Cloud Agents: allowlisted senders text a question, the service runs a read-only Cursor cloud agent against your GitHub repo, and the answer comes back over iMessage.
Ask things like "how exactly do we implement search ranking?" or "how would I add feature X?" from your phone, and get an answer researched against the actual code on your default branch.
iPhone --iMessage--> Spectrum Cloud --gRPC--> this worker --SDK--> Cursor Cloud Agent
(clones your repo,
explores, answers)
spectrum-ts(cloud mode, gRPC) streams incoming iMessages. No inbound HTTP, no webhooks, no Mac hardware.- Senders not in
ALLOWED_PHONE_NUMBERSare silently ignored. - The first question from a sender creates a Cursor cloud agent on the repo; follow-up texts resume the same agent, so conversation context is preserved per sender.
- Texting
reset(ornew) starts a fresh thread. - One in-flight question per sender; messages sent mid-run queue up as the next follow-up.
- The sender-to-agent map persists to
STATE_FILE(JSON) when set, so threads survive restarts. - Agents are instructed to be read-only and to answer in plain text. No PRs are created.
- A Photon account with a Spectrum project (Free or Pro plan works). Grab the project id and secret from the dashboard.
- A Cursor account with:
- an API key (dashboard -> Integrations),
- the Cursor GitHub App granted access to your repo,
- storage-enabled privacy mode (cloud agents require it; Settings -> Privacy).
| Variable | Required | Description |
|---|---|---|
PHOTON_PROJECT_ID |
yes | Photon project id (dashboard -> Settings) |
PHOTON_PROJECT_SECRET |
yes | Photon project secret |
CURSOR_API_KEY |
yes | Cursor API key with access to the repo |
ALLOWED_PHONE_NUMBERS |
yes | Comma-separated E.164 numbers and/or emails allowed to use the agent |
REPO_URL |
yes | GitHub repo the agent answers questions about |
CURSOR_MODEL |
no | Model id for the cloud agent (default composer-2.5) |
STATE_FILE |
no | Path for the persisted thread map, e.g. /data/state.json |
On Photon's shared line pool (Free/Pro plans) the project cannot start conversations — each person must text their assigned line first. To onboard someone:
npx tsx src/onboard.ts +14125551234This registers them as a shared Spectrum user and prints the phone number they should
text (plus a deep link you can send them). Then add their number to
ALLOWED_PHONE_NUMBERS and restart the service.
npm install
cp .env.example .env # fill in values
set -a && source .env && set +a
npm run devThen text the Spectrum line from an allowlisted phone. Verify:
- You get the "On it" ack, then an answer (first question takes a couple of minutes).
- A follow-up question keeps context from the previous answer.
- Texting
resetstarts a new thread. - Texting from a non-allowlisted number is ignored (check logs).
npm run typecheck and npm run lint must pass.
- Create a new Railway service from your fork of this repo. Railway builds with the
Dockerfileautomatically. - Do not add a public domain — the service only makes outbound connections.
- Add a volume (e.g. mounted at
/data) and setSTATE_FILE=/data/state.jsonso conversation threads survive deploys. - Set the environment variables from the table above.
- Deploy and watch logs for
[imessage-agent] listening.
Any other always-on Node 22+ host (Fly.io, Render, a VPS) works the same way.
- Photon Free/Pro plans use a shared line pool: each sender may see the agent texting from a different phone number. A dedicated number requires the Business plan.
- Each question costs Cursor usage (billed to the API key's account). Expect 30s-2min of latency per answer while the agent explores the repo.
- Treat
ALLOWED_PHONE_NUMBERSas the security boundary: anyone on it can ask questions about your private code.
MIT