Show HN:OpenInstinct——开源、可自托管的 Instinct 克隆版
英文标题:🔶 Show HN: OpenInstinct – open-source, self-hostable Instinct clone
OpenInstinct 是一款可通过 iMessage 交互的个人 AI 助手,能够操作浏览器完成订票、购物和处理杂务等任务。项目支持开源部署和自托管,可一键部署到 Vercel,并使用 Kernel 云浏览器、Neon Postgres、Vercel Blob 与 Vercel AI Gateway 等服务。其核心设计强调凭证安全:密码和敏感信息在写入数据库前加密,模型不会直接接触这些秘密。开发者还可通过 Linq 接入 iMessage,通过 Google OAuth 接入 Gmail、日历和只读通讯录;不过项目明确警告其尚不适合生产环境使用。
116.7 KB
125.9 KB
925.3 KB
中文
一款能够像你一样使用浏览器的个人 iMessage 助手。
它可以替你处理杂务、预订电影票或购买日用品。你的密码、信用卡信息和上下文始终由你掌控。
它是开源的、可自托管的,并且可使用任意模型。一键部署到 Vercel 即可开始使用。
当个人 Agent 能够登录账户、预订、购买并代表你采取行动时,其价值会大得多。但你的账户和密码是通往数字王国的钥匙。OpenInstinct 运行在你自己的 Vercel 账户中。敏感信息在写入数据库前会被加密,模型永远不会看到它们。请通过阅读代码自行验证这一点!
部署按钮会配置用于云浏览器的 Kernel、用于 Postgres 的 Neon,以及用于存储浏览器图片和按用户划分记忆的私有 Vercel Blob 存储。Vercel AI Gateway 负责推理。Linq 为可选项;在 iMessage 或生产环境电话号码登录可用前,必须先完成下方配置。使用费用将计入你的 Vercel 账户。请在部署中设置其余认证变量:
BETTER_AUTH_SECRET="$(openssl rand -base64 32)"
BETTER_AUTH_URL=https://your-host
DATABASE_URL=postgresql://user:password@host/database
DATABASE_URL_UNPOOLED=postgresql://user:password@host/database
SECRET_ENCRYPTION_KEY="$(openssl rand -base64 32)"
应用数据库 schema 和版本化迁移文件位于 db/。Drizzle 应用存储使用 DATABASE_URL 执行运行时查询;其迁移命令则需要直连的 DATABASE_URL_UNPOOLED。针对新的或已升级的本地数据库启动前,请运行 pnpm db:migrate。Vercel 使用 Turbo,在构建应用前运行未缓存的迁移任务。有关接入现有数据库、加载环境变量及约束验证顺序,请参阅 db/README.md。Better Auth 保留独立的迁移路径。
请将 SECRET_ENCRYPTION_KEY 视为生产密钥材料:单独备份它;轮换该密钥需要重新加密现有值。
一键部署会自动创建并连接一个私有 Blob 存储。Vercel 会向每次部署提供 BLOB_STORE_ID 和短期有效的 VERCEL_OIDC_TOKEN,因此无需复制长期有效的 Blob 凭证。
OpenInstinct 使用该存储保存持久化的按用户划分记忆和浏览器图片。生产环境中的对话需要它,因为每次 Agent 执行前都会回忆记忆。相比之下,本地 Eve 开发使用进程本地记忆。
对于已有的 Vercel 项目,请先通过 eve link --project <your-vercel-project> --non-interactive 将其关联,然后使用一条命令创建并连接存储:
pnpm exec vercel blob create-store open-instinct-images --access private --yes --environment production --environment preview --environment development
在 Vercel 之外,请改为设置来自私有 Blob 存储的 BLOB_READ_WRITE_TOKEN。记忆提供程序会显式使用该 Token,浏览器图片捕获也使用同一存储。
将当前代码检出目录关联到你的 Vercel 项目,创建一条 Linq 线路,并附加其连接器,以便同时获得应用 Token 和入站 Webhook 触发器:
vercel link
vercel connect create linq --connection-method line --name open-instinct --json
vercel connect attach <returned-connector-uid> --project <your-vercel-project> --environment production --triggers --trigger-path /eve/v1/linq --yes
vercel env add LINQ_CONNECTOR production --value <returned-connector-uid> --yes
vercel env add LINQ_PHONE_NUMBER production --value <assigned-e164-number> --yes
vercel deploy --prod
创建命令会返回连接器 UID。运行 vercel connect open <returned-connector-uid>,从连接器仪表板复制以 E.164 格式显示的已分配线路,并将其用于 LINQ_PHONE_NUMBER。必须同时配置 LINQ_CONNECTOR 和 LINQ_PHONE_NUMBER。如果预览或开发环境也要使用 Linq,请为这些环境重复连接器附加和环境变量配置步骤。
登录前,请通过该连接器仪表板,在 Messaging Contacts 下添加每位用户的电话号码。Linq 会拒绝向未列入此白名单的联系人发送 OTP,也会丢弃来自这些联系人的入站短信。--triggers --trigger-path /eve/v1/linq 选项同样必不可少:如果附加连接器时未使用这些选项,虽然可以访问出站 Token,但入站消息不会被转发到 OpenInstinct。
Google Workspace 连接
OpenInstinct 可通过按用户范围授权的 Google OAuth 授权,使用用户的 Gmail、日历和只读通讯录。Vercel Connect 存储并刷新 Token;OpenInstinct 仅存储用于请求这些 Token 的稳定用户身份。Gmail 访问特意使用 gmail.modify,而不是具有永久删除权限的 mail.google.com scope。
-
在一个 Google Cloud 项目中,配置 OAuth 同意屏幕,并启用 Gmail API、Google Calendar API 和 People API。
-
创建 OAuth Web 凭证。将
https://connect.vercel.com/callback添加为授权重定向 URI,然后下载客户端密钥 JSON 文件。 -
Vercel 需要顶层
clientId和clientSecret键,而非 Google 下载文件中嵌套的web.client_id和web.client_secret。将下载内容转换为仓库外的临时文件,然后创建并附加连接器:vercel link google_credentials_file="$(mktemp)" jq '{clientId: .web.client_id, clientSecret: .web.client_secret}' /absolute/path/to/downloaded-client-secret.json > "$google_credentials_file" vercel connect create google --connection-method oauth --name open-instinct --data @"$google_credentials_file" rm -f "$google_credentials_file" vercel connect attach <returned-connector-uid> --project <your-vercel-project> --environment production --yes vercel env pull切勿提交任一凭证文件。
-
将
GOOGLE_CONNECTOR_UID设置为返回的 UID,并重新部署。默认值为google/open-instinct。
注意事项:
- 应为每个需要使用该连接器的 Vercel 环境分别附加连接器。生产环境的附加不会让预览环境或本地开发环境自动可用。
- Gmail 的读/修改 scope 受到限制。处于 Testing 模式的 Google OAuth 应用仅适用于列出的测试用户,且这些授权会在七天后过期。要更广泛地分发,需通过 Google 的 OAuth 验证,并且可能需要进行安全评估。
- 此处请求的 scope 也必须在 Google 同意屏幕中声明。更改 scope 或启用的 API 后,请断开并重新连接账户,以便 Google 签发包含新访问权限的授权。
- 授权与已认证的 OpenInstinct 用户绑定。只有当 iMessage 已验证的电话号码映射至同一个 Better Auth 账户时,iMessage 才能访问同一授权。
- Google 通讯录搜索使用提供商侧的延迟缓存,因此刚刚创建的联系人可能不会立即出现。
- 发送邮件和创建已确认的日历事件始终需要审批。包含参与者的日历事件会发送 Google 邀请。
需要 Docker Desktop(或其他 Docker Compose 安装)。在 .env.example 中配置非数据库变量,然后执行:
git clone https://github.com/Merit-Systems/open-instinct.git
cd open-instinct
pnpm install
pnpm dev
pnpm dev 会从 compose.yaml 启动 PostgreSQL、应用已提交的数据库迁移,并启动应用。停止开发进程时,也会停止并移除 PostgreSQL 容器;其数据会保留在 postgres-data 卷中,供下次运行使用。如果你有意使用外部托管的数据库,请改为运行 pnpm dev:app。
除此之外,本地开发使用与 Vercel 部署相同的 vault、Kernel 浏览器和 AI Gateway 路径。当 Better Auth 和 vault 加密的变量未设置时,会使用稳定的仅本地默认值;部署仍需要显式配置密钥。
警告
该软件并非面向生产环境使用。
English / 原文
A personal iMessage assistant that can use a browser like you.
It can do your chores, book you movie tickets, or handle your groceries. You stay in control of your passwords, credit cards and context.
It's Open Source, self-hostable, and can use any model. One-click deploy to Vercel and get rolling.
Personal agents are much more useful when they can sign in, book, buy and act on your behalf. But your accounts, your passwords, are the keys to your digital kingdom. OpenInstinct runs in your own Vercel account. Secrets are encrypted before they touch your database and models never see them. Verify yourself by reading the code!
The deploy button provisions Kernel for cloud browsers, Neon for Postgres, and a private Vercel Blob store for browser images and per-user memory. Vercel AI Gateway handles inference. Linq is optional and requires the setup below before iMessage or production phone sign-in is available. Usage is billed to your Vercel account. Set the remaining auth variables on the deployment:
BETTER_AUTH_SECRET="$(openssl rand -base64 32)"
BETTER_AUTH_URL=https://your-host
DATABASE_URL=postgresql://user:password@host/database
DATABASE_URL_UNPOOLED=postgresql://user:password@host/database
SECRET_ENCRYPTION_KEY="$(openssl rand -base64 32)"
The application database schema and versioned migrations live in db/. The Drizzle application store uses DATABASE_URL for runtime queries; its migration commands require the direct DATABASE_URL_UNPOOLED connection. Run pnpm db:migrate before starting against a new or upgraded local database. Vercel uses Turbo to run the uncached migration task before its application build. See db/README.md for existing-database adoption, environment loading, and constraint-validation sequencing. Better Auth retains its separate migration path.
Treat SECRET_ENCRYPTION_KEY as production key material — back it up separately; rotating it requires re-encrypting existing values.
The one-click deploy creates and connects a private Blob store automatically. Vercel supplies BLOB_STORE_ID and a short-lived VERCEL_OIDC_TOKEN to each deployment, so there is no long-lived Blob credential to copy.
OpenInstinct uses this store for persistent per-user memory and browser images. Production conversations require it because memory is recalled before each agent turn. Local Eve development uses process-local memory instead.
For an existing Vercel project, link it first with eve link --project <your-vercel-project> --non-interactive, then create and connect the store with one command:
pnpm exec vercel blob create-store open-instinct-images --access private --yes --environment production --environment preview --environment development
Outside Vercel, set BLOB_READ_WRITE_TOKEN from a private Blob store instead. The memory provider uses that token explicitly, and browser image capture uses the same store.
Link the checkout to your Vercel project, create a Linq line, and attach its connector for both app tokens and inbound webhook triggers:
vercel link
vercel connect create linq --connection-method line --name open-instinct --json
vercel connect attach <returned-connector-uid> --project <your-vercel-project> --environment production --triggers --trigger-path /eve/v1/linq --yes
vercel env add LINQ_CONNECTOR production --value <returned-connector-uid> --yes
vercel env add LINQ_PHONE_NUMBER production --value <assigned-e164-number> --yes
vercel deploy --prod
The create command returns the connector UID. Run vercel connect open <returned-connector-uid>, copy the assigned line from the connector dashboard in E.164 format, and use it for LINQ_PHONE_NUMBER. Both LINQ_CONNECTOR and LINQ_PHONE_NUMBER must be configured together. Repeat the attachment and environment-variable steps for preview or development if those environments should use Linq too.
Before signing in, use that connector dashboard to add each user's phone number under Messaging Contacts. Linq rejects OTP delivery and drops inbound texts from contacts that are not on this allowlist. The --triggers --trigger-path /eve/v1/linq options are also required: attaching a connector without them permits outbound token access but does not forward incoming messages to OpenInstinct.
Google Workspace connection
OpenInstinct can use a user's Gmail, Calendar, and read-only Contacts through a user-scoped Google OAuth grant. Vercel Connect stores and refreshes the tokens; OpenInstinct stores only the stable user identity used to request them. Gmail access deliberately uses gmail.modify, not the permanent-delete mail.google.com scope.
-
In one Google Cloud project, configure the OAuth consent screen and enable the Gmail API, Google Calendar API, and People API.
-
Create OAuth web credentials. Add
https://connect.vercel.com/callbackas an authorized redirect URI, then download the client-secret JSON. -
Vercel expects top-level
clientIdandclientSecretkeys, not Google's nestedweb.client_idandweb.client_secretdownload. Convert the download into a temporary file outside the repository, then create and attach the connector:vercel link google_credentials_file="$(mktemp)" jq '{clientId: .web.client_id, clientSecret: .web.client_secret}' /absolute/path/to/downloaded-client-secret.json > "$google_credentials_file" vercel connect create google --connection-method oauth --name open-instinct --data @"$google_credentials_file" rm -f "$google_credentials_file" vercel connect attach <returned-connector-uid> --project <your-vercel-project> --environment production --yes vercel env pull
Never commit either credential file.
- Set
GOOGLE_CONNECTOR_UIDto the returned UID and redeploy. The default isgoogle/open-instinct.
Gotchas:
- Attach the connector separately to every Vercel environment that should use it. A production attachment does not make preview or local development work.
- The Gmail read/modify scope is restricted. A Google OAuth app in Testing mode only works for listed test users, and those grants expire after seven days. Broader distribution requires Google's OAuth verification and may require a security assessment.
- The scopes requested here must also be declared on the Google consent screen. After changing scopes or enabled APIs, disconnect and reconnect the account so Google issues a grant with the new access.
- The grant is keyed to the authenticated OpenInstinct user. iMessage reaches the same grant only when its verified phone number maps to that Better Auth account.
- Google Contacts search uses a provider-side lazy cache, so a contact created moments ago may not appear immediately.
- Sending email and creating confirmed calendar events always require approval. Calendar events with attendees send Google invitations.
Docker Desktop (or another Docker Compose installation) is required. Configure the non-database variables in .env.example, then:
git clone https://github.com/Merit-Systems/open-instinct.git
cd open-instinct
pnpm install
pnpm dev
pnpm dev starts PostgreSQL from compose.yaml, applies the committed database migrations, and starts the application. Stopping the development process also stops and removes the PostgreSQL container; its data remains in the postgres-data volume for the next run. Run pnpm dev:app when intentionally using an externally managed database instead.
Local development otherwise uses the same vault, Kernel browser, and AI Gateway path as the Vercel deployment. Better Auth and vault encryption use stable local-only defaults when their variables are unset; deployments still require explicit secrets.
Warning
This is not software intended for production use.

