Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to res
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-google-loops-bf5cbcc27f72 ,按照其中的说明把「google-loops」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
The connector ingests Gmail threads, calendar events, and contacts into the
brain and maintains the open-loop record behind gbrain waiting. Full
references: docs/guides/google-connect.md (setup + every error and its
fix) and docs/guides/open-loops.md (how detection works).
[SHOW USER] blocks verbatim. Setup commands print fenced
[SHOW USER] ... [/SHOW USER] blocks — numbered steps with deep links.
Pass them to the user unchanged (paraphrasing loses load-bearing detail
like "Desktop app, NOT Web application"). Batch everything into ONE
message per block.client_secret_*.json into chat, save it to a file (mode 0600) and pass
the path: gbrain google connect --client-json <path>. Env
(GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET) also works. Raw
--client-id/--client-secret flags are the last resort.--json and read
{ ok, status, next_action: { command, user_message }, error }. When
next_action.user_message is present, that IS the message to show the
user; when next_action.command is present, that is your next call.
Errors carry { code, problem, cause, fix, doc_url } — show the user
problem + fix, nothing else.gbrain google connect and
gbrain google setup are idempotent state machines — the documented fix
for most errors is "run it again."gbrain google setup --json
Handles: credential intake (prints the GCP checklist when nothing is on
file) → consent (loopback locally; auto paste-back over SSH/headless —
non-TTY flows complete via a second call:
gbrain google connect --code "<pasted-redirect-url>") → source
registration → a budgeted first sync (newest mail first; the deep backfill
resumes on later syncs automatically) → the first gbrain waiting digest.
Multiple accounts: repeat with --account work@example.com.
Already holding Google access another way (a Google CLI with its own auth,
gcloud, a credential gateway that mints tokens)? Skip OAuth and point the
source at it — no credential enters gbrain:
gbrain sources add gmail-work --kind google --account you@example.com \
--access command --token-command "<command that prints an access token>"
(--access env --token-env <VAR> reads an externally-refreshed token from
the environment instead.) Then gbrain sync --source gmail-work and
gbrain waiting work identically.
Verify health afterwards: gbrain google status --json (per-account
refresh probe) — and gbrain doctor carries a google_oauth check that
warns once a Testing-mode account goes 5+ days without a successful
refresh. An actively-syncing account gets no pre-warning before the 7-day
Testing-mode expiry — publishing to Production is the real fix.
gbrain waiting --json # the killer output: ranked people waiting
gbrain loops done <id> # user handled it
gbrain loops drop <id> # user is not going to do it
gbrain loops mute sender <email> # never track this sender again
waiting REFUSES on stale data (no successful sync in 24h) and names the
exact fix (gbrain sync --source <id>). Run the sync, then retry. Only
use --stale-ok when the user explicitly accepts stale results.text digest — reuse it.context_pack with the counterparty slug.loops done) — thread loops also self-close on the next sync when the
reply is visible in Gmail.Google sources sync like any source: autopilot and gbrain sync --all pick
them up automatically. No cron of its own. A bare un-targeted gbrain sync
does NOT reach them — use --source <id> or --all.
Every failure has a typed code with the fix attached —
docs/guides/google-connect.md#troubleshooting is the canonical table. The
three the user will actually hit:
access_denied_test_user → they forgot to add themselves as a test
user (the error carries the deep link).invalid_grant_testing_expiry (everything silently stopped ~day 7) →
their consent screen is still in Testing; publish to Production, then
gbrain google connect --reauth <email>.Commitment extraction sends recent email text (≤30 days, ≤50 threads/sweep)
to the configured chat provider. Tell the user once during setup; the off
switch is gbrain config set loops.extraction_enabled false. The
unanswered-thread detector is free and unaffected.
When relaying gbrain waiting, present per counterparty, most urgent first:
## <Counterparty> (<N> open)
- [<loop_type>] <what's owed> (<age>) — due <date if any>
> "<evidence quote>"
<Gmail deep link>
The trusted-local --json result already carries this as a paste-ready
text field — prefer relaying it over re-rendering. For setup commands,
relay [SHOW USER] blocks verbatim and error.problem + error.fix on
failures; never dump raw JSON envelopes at the user.
[SHOW USER] block. The checklists carry load-bearing
detail ("Desktop app, NOT Web application", the test-user step). Relay
verbatim, one message per block.--client-json <path>) or env vars;
secrets in argv/chat are the last resort, never the default.query/search. The open-loop
record is open_loops / gbrain waiting — search results have no
loop-state semantics and will happily surface answered threads.--stale-ok silently. Run the
named gbrain sync --source <id> first; only pass --stale-ok when the
user explicitly accepts possibly-outdated loops.gbrain loops done <id>) only
after the user says it's handled; thread loops self-close on the next sync
when the reply is visible in Gmail.