Skip to content

About

Text your codebase: iMessage Q&A agent powered by Photon Spectrum and Cursor Cloud Agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

iMessage Codebase Agent

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.

How it works

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_NUMBERS are 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 (or new) 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.

Prerequisites

  1. A Photon account with a Spectrum project (Free or Pro plan works). Grab the project id and secret from the dashboard.
  2. 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).

Configuration

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

Onboarding a sender

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 +14125551234

This 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.

Local development

npm install
cp .env.example .env   # fill in values
set -a && source .env && set +a
npm run dev

Then text the Spectrum line from an allowlisted phone. Verify:

  1. You get the "On it" ack, then an answer (first question takes a couple of minutes).
  2. A follow-up question keeps context from the previous answer.
  3. Texting reset starts a new thread.
  4. Texting from a non-allowlisted number is ignored (check logs).

npm run typecheck and npm run lint must pass.

Deploying on Railway

  1. Create a new Railway service from your fork of this repo. Railway builds with the Dockerfile automatically.
  2. Do not add a public domain — the service only makes outbound connections.
  3. Add a volume (e.g. mounted at /data) and set STATE_FILE=/data/state.json so conversation threads survive deploys.
  4. Set the environment variables from the table above.
  5. Deploy and watch logs for [imessage-agent] listening.

Any other always-on Node 22+ host (Fly.io, Render, a VPS) works the same way.

Notes

  • 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_NUMBERS as the security boundary: anyone on it can ask questions about your private code.

License

MIT

About

Text your codebase: iMessage Q&A agent powered by Photon Spectrum and Cursor Cloud Agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages