This skill describes the @civic/openclaw-google plugin, which lets agents use gog (the Google Workspace CLI) without the user having to create a Google Cloud project, configure OAuth credentials, or manage tokens. Civic acts as an OAuth proxy — it provides the OAuth client, stores tokens encrypted server-side, refreshes them automatically, and the plugin requests only the scope each command actually needs.
Privacy and security
- - What is sent to Civic: The plugin sends the
gog command prefix (e.g. gog gmail send) over HTTPS to app.civic.com for scope resolution. The proxy reads only the command prefix to determine which OAuth scope is needed — command arguments (email addresses, search queries, file names) are not logged, stored, or used by the proxy. - CIVIC_TOKEN: This is the user's own API key from their Civic account at app.civic.com. It authenticates the user to their own account and is never shared. It is sent as a Bearer token over HTTPS.
- Token handling: OAuth access tokens are short-lived (~1 hour), stored encrypted (AES-256) on Civic's servers, and refreshed automatically. The agent never sees OAuth client secrets or refresh tokens.
- Source code: The plugin is open source at https://github.com/civicteam/openclaw-google and published on npm as
@civic/openclaw-google.
Setup
- 1. Install the plugin:
CODEBLOCK0
- 2. Install gog (the Google CLI):
CODEBLOCK1
- 3. Set your Civic API token in the gateway environment:
CIVIC_TOKEN=<your-token-from-app.civic.com>
Get your token from app.civic.com -> Settings -> API Keys.
- 4. Restart the gateway.
How it works
- 1. Agent calls INLINECODE6
- Plugin intercepts the
exec tool call via a before_tool_call hook - Plugin sends the command prefix to the Civic proxy for scope resolution
- Proxy matches
gog gmail -> gmail.readonly scope - If authorized: returns a short-lived access token, plugin sets
GOG_ACCESS_TOKEN env var, gog runs - If not yet authorized: blocks the tool call and surfaces an auth URL for the user to consent
- After first consent per scope, all future calls work automatically
Supported services and scope mapping
The plugin maps each gog subcommand to the narrowest OAuth scope required. Write operations get specific scopes; unrecognized subcommands fall back to read-only.
Gmail
- -
gog gmail send — gmail.send - INLINECODE15 ,
gog gmail drafts — gmail.compose - INLINECODE17 ,
archive, read, unread, batch — gmail.modify - INLINECODE22 (catch-all) — gmail.readonly
Calendar
- -
gog calendar create, update, delete, respond, subscribe — calendar.events - INLINECODE28 (catch-all) — calendar.readonly
Drive
- -
gog drive upload, create, update, delete, move, rename, share, copy, import — drive.file - INLINECODE38 — drive (full access, required for ownership transfer)
- INLINECODE39 (catch-all) — drive.readonly
Docs
- -
gog docs create, edit, append — documents - INLINECODE43 ,
delete, import — documents + drive.file - INLINECODE46 — documents.readonly + drive.file
- INLINECODE47 (catch-all) — documents.readonly + drive.readonly
Sheets
- -
gog sheets write, append, delete, insert, format, merge, freeze, resize — spreadsheets - INLINECODE56 — spreadsheets + drive.file
- INLINECODE57 (catch-all) — spreadsheets.readonly + drive.readonly
Slides
- -
gog slides create, copy — presentations + drive.file - INLINECODE60 ,
update, duplicate, delete — presentations - INLINECODE64 (catch-all) — presentations.readonly + drive.readonly
Tasks
- -
gog tasks add, done, delete, move, update — tasks - INLINECODE70 (catch-all) — tasks.readonly
Contacts
- -
gog contacts create, update, delete, merge, batch — contacts - INLINECODE76 (catch-all) — contacts.readonly
Chat
- -
gog chat send — chat.messages.create - INLINECODE78 — chat.spaces
- INLINECODE79 — chat.messages
- INLINECODE80 (catch-all) — chat.spaces.readonly + chat.messages.readonly
Forms
- -
gog forms create, update, delete — forms.body - INLINECODE84 (catch-all) — forms.body.readonly + forms.responses.readonly
Apps Script
- -
gog appscript run — script.projects - INLINECODE86 — script.deployments
- INLINECODE87 (catch-all) — script.projects.readonly + drive.readonly
Troubleshooting
- - "No CIVIC_TOKEN configured" — Set
CIVIC_TOKEN in your gateway environment. Get it from app.civic.com -> Settings -> API Keys. - Auth URL keeps appearing — The user needs to click the authorization link and complete the Google consent screen. Each scope requires separate consent.
- Token errors after working previously — The user may have revoked access in their Google account settings. Re-authorize by triggering any
gog command.
Custom proxy URL
For local development, set OPENCLAW_PROXY_URL in the gateway environment:
CODEBLOCK3
技能名称: civic-google
详细描述:
该技能描述了 @civic/openclaw-google 插件,它允许智能体使用 gog(Google Workspace CLI),而用户无需创建 Google Cloud 项目、配置 OAuth 凭据或管理令牌。Civic 充当 OAuth 代理——它提供 OAuth 客户端,在服务器端加密存储令牌,自动刷新令牌,并且插件仅请求每个命令实际所需的作用域。
隐私与安全
- - 发送给 Civic 的内容: 插件通过 HTTPS 将 gog 命令前缀(例如 gog gmail send)发送到 app.civic.com 进行作用域解析。代理仅读取命令前缀以确定所需的 OAuth 作用域——命令参数(电子邮件地址、搜索查询、文件名)不会被代理记录、存储或使用。
- CIVIC_TOKEN: 这是用户从 app.civic.com 上的 Civic 账户获取的专属 API 密钥。它用于验证用户身份以访问其自己的账户,且绝不会被共享。它作为 Bearer 令牌通过 HTTPS 发送。
- 令牌处理: OAuth 访问令牌有效期短(约 1 小时),在 Civic 服务器上加密存储(AES-256),并自动刷新。智能体永远不会看到 OAuth 客户端密钥或刷新令牌。
- 源代码: 该插件在 https://github.com/civicteam/openclaw-google 开源,并以 @civic/openclaw-google 发布在 npm 上。
设置
- 1. 安装插件:
bash
openclaw plugins install @civic/openclaw-google
- 2. 安装 gog(Google CLI):
bash
brew install gog
- 3. 在网关环境中设置您的 Civic API 令牌:
bash
CIVIC_TOKEN=
从 app.civic.com -> 设置 -> API 密钥获取您的令牌。
- 4. 重启网关。
工作原理
- 1. 智能体调用 gog gmail search newerthan:1d
- 插件通过 beforetoolcall 钩子拦截 exec 工具调用
- 插件将命令前缀发送到 Civic 代理进行作用域解析
- 代理匹配 gog gmail -> gmail.readonly 作用域
- 如果已授权:返回一个短期访问令牌,插件设置 GOGACCESS_TOKEN 环境变量,gog 运行
- 如果尚未授权:阻止工具调用并显示一个授权 URL 供用户同意
- 每个作用域首次同意后,所有后续调用将自动进行
支持的服务和作用域映射
该插件将每个 gog 子命令映射到所需的最窄 OAuth 作用域。写操作获取特定作用域;无法识别的子命令回退到只读。
Gmail
- - gog gmail send — gmail.send
- gog gmail draft、gog gmail drafts — gmail.compose
- gog gmail trash、archive、read、unread、batch — gmail.modify
- gog gmail(通用)— gmail.readonly
日历
- - gog calendar create、update、delete、respond、subscribe — calendar.events
- gog calendar(通用)— calendar.readonly
云端硬盘
- - gog drive upload、create、update、delete、move、rename、share、copy、import — drive.file
- gog drive transfer — drive(完全访问,所有权转移必需)
- gog drive(通用)— drive.readonly
文档
- - gog docs create、edit、append — documents
- gog docs copy、delete、import — documents + drive.file
- gog docs export — documents.readonly + drive.file
- gog docs(通用)— documents.readonly + drive.readonly
表格
- - gog sheets write、append、delete、insert、format、merge、freeze、resize — spreadsheets
- gog sheets create — spreadsheets + drive.file
- gog sheets(通用)— spreadsheets.readonly + drive.readonly
幻灯片
- - gog slides create、copy — presentations + drive.file
- gog slides edit、update、duplicate、delete — presentations
- gog slides(通用)— presentations.readonly + drive.readonly
任务
- - gog tasks add、done、delete、move、update — tasks
- gog tasks(通用)— tasks.readonly
联系人
- - gog contacts create、update、delete、merge、batch — contacts
- gog contacts(通用)— contacts.readonly
聊天
- - gog chat send — chat.messages.create
- gog chat create — chat.spaces
- gog chat delete — chat.messages
- gog chat(通用)— chat.spaces.readonly + chat.messages.readonly
表单
- - gog forms create、update、delete — forms.body
- gog forms(通用)— forms.body.readonly + forms.responses.readonly
Apps Script
- - gog appscript run — script.projects
- gog appscript deploy — script.deployments
- gog appscript(通用)— script.projects.readonly + drive.readonly
故障排除
- - 未配置 CIVICTOKEN — 在网关环境中设置 CIVICTOKEN。从 app.civic.com -> 设置 -> API 密钥获取。
- 授权 URL 持续出现 — 用户需要点击授权链接并完成 Google 同意屏幕。每个作用域需要单独同意。
- 之前工作正常后出现令牌错误 — 用户可能在 Google 账户设置中撤销了访问权限。通过触发任意 gog 命令重新授权。
自定义代理 URL
对于本地开发,在网关环境中设置 OPENCLAWPROXYURL:
bash
OPENCLAWPROXYURL=http://localhost:3013/openclaw