Skip to content

Commit 709a95e

Browse files
dcramercodex
andcommitted
Improve Google skill workflows and expand email capability surface
Co-Authored-By: GPT-5 Codex <codex@openai.com>
1 parent 0f1049e commit 709a95e

7 files changed

Lines changed: 652 additions & 202 deletions

File tree

specs/capabilities.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,18 @@ Capability providers are configured as bridge commands.
121121
For bundled `gog` dogfood, configure from the skill section:
122122

123123
```toml
124-
[skills.gog]
124+
[skills.google]
125125
enabled = true
126126

127-
[skills.gog.capability_provider]
127+
[skills.google.capability_provider]
128128
enabled = true
129129
namespace = "gog"
130130
command = ["gogcli", "bridge"]
131131
timeout_seconds = 30
132132
```
133133

134-
`skills.gog.enabled = true` applies default `capabilities.providers.gog` wiring.
135-
Optional `skills.gog.capability_provider` values override command/namespace/timeout.
134+
`skills.google.enabled = true` applies default `capabilities.providers.gog` wiring.
135+
Optional `skills.google.capability_provider` values override command/namespace/timeout.
136136
Explicit `[capabilities.providers.gog]` remains available for host-level overrides.
137137

138138
The host invokes the bridge with JSON over stdin/stdout for `definitions`,

specs/skills.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ Capability IDs must be namespaced (for example `gog.email`, not `email`).
139139
Provider execution details are host-owned config, not skill metadata:
140140

141141
```toml
142-
[skills.gog]
142+
[skills.google]
143143
enabled = true
144144
145-
[skills.gog.capability_provider]
145+
[skills.google.capability_provider]
146146
enabled = true
147147
namespace = "gog"
148148
command = ["gogcli", "bridge"]
@@ -167,10 +167,10 @@ allow_chat_ids = ["12345"] # Optional per-skill chat allowlist override
167167
[skills.defaults]
168168
allow_chat_ids = ["12345"] # Optional global default allowlist for all skills
169169

170-
[skills.gog]
171-
enabled = true # Enables bundled gog skill and provider auto-wiring
170+
[skills.google]
171+
enabled = true # Enables bundled google skill and provider auto-wiring
172172

173-
[skills.gog.capability_provider]
173+
[skills.google.capability_provider]
174174
enabled = true
175175
namespace = "gog"
176176
command = ["gogcli", "bridge"]
@@ -184,11 +184,11 @@ Config keys match env var names exactly (UPPER_CASE). No case conversion.
184184
`allow_chat_ids` can be set globally in `[skills.defaults]` and overridden per skill.
185185
Secret-like env var names are blocked by policy and must use host-managed capability/proxy auth.
186186

187-
`[skills.gog].enabled = true` applies default `gog` provider wiring.
188-
`[skills.gog.capability_provider]` can override provider command/namespace/timeout
187+
`[skills.google].enabled = true` applies default `gog` provider wiring.
188+
`[skills.google.capability_provider]` can override provider command/namespace/timeout
189189
from the same skill section.
190190

191-
Explicit `[skills.gog]` / `[capabilities.providers.gog]` values override preset defaults.
191+
Explicit `[skills.google]` / `[capabilities.providers.gog]` values override preset defaults.
192192

193193
### System Prompt Listing
194194

Lines changed: 67 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
description: "Set up, configure, or use Gmail and Google Calendar. Handles initial setup, authentication, sending/reading/searching emails, and managing calendar events. Use whenever the user mentions setting up Google, email, inbox, sending a message, checking their calendar, scheduling a meeting, or managing events."
2+
name: google
3+
description: "Manage Gmail and Google Calendar with capability-backed auth and operations. Use when asked to check inbox, summarize emails, give a day at a glance, send an email, review calendar events, or schedule meetings."
34
opt_in: true
45
sensitive: true
56
access:
@@ -16,7 +17,7 @@ input_schema:
1617
properties:
1718
task:
1819
type: string
19-
description: The email/calendar task to perform
20+
description: The Google email/calendar task to perform
2021
required:
2122
- task
2223
---
@@ -27,6 +28,7 @@ Manage Gmail and Google Calendar through host-managed capabilities.
2728

2829
- Use `ash-sb capability` for every Gmail/Calendar operation.
2930
- Never read or request raw OAuth access tokens, refresh tokens, or client secrets.
31+
- Do not fabricate capability results. Only report data returned by commands.
3032

3133
## Workflow
3234

@@ -38,142 +40,104 @@ On every invocation, follow these steps in order:
3840
ash-sb capability list
3941
```
4042

41-
Expected output:
43+
- If a needed capability is missing, tell the user to enable `[skills.google]` and stop.
44+
- If a needed capability is not authenticated, run auth (step 2).
45+
- If already authenticated, continue to operations (step 3).
4246

43-
```
44-
Capabilities:
45-
- gog.email: Gmail integration
46-
Available: yes
47-
Authenticated: no
48-
Operations: list_messages, get_message, send_message, ...
49-
- gog.calendar: Google Calendar integration
50-
Available: yes
51-
Authenticated: yes
52-
Operations: list_events, create_event, ...
53-
Total: 2 capability(ies)
54-
```
55-
56-
- If a needed capability is missing entirely, tell the user the google skill needs to be enabled in their Ash config (`[skills.google] enabled = true`) and stop.
57-
- If `Authenticated: no` for any needed capability, go to step 2.
58-
- If `Authenticated: yes` for all needed capabilities, skip to step 3.
59-
60-
### 2. Authenticate
61-
62-
Run this step for each capability where `Authenticated: no`. If the user's request is setup-only (e.g. "set up my email"), stop after authentication is complete — do not invoke any operations.
63-
64-
Before prompting the user again, check whether the current task already contains a pasted Google callback URL (`http://localhost/?...code=...`) or a raw auth code. If yes:
65-
66-
1. Run `ash-sb capability auth begin -c <capability>` first.
67-
2. Immediately run `ash-sb capability auth complete --flow-id <id> --callback-url '<URL>'` (or `--code '<CODE>'`).
68-
3. Re-run `ash-sb capability list` and continue to operations if authenticated.
69-
70-
Do not ask the user for another URL/code when one is already present in the task.
71-
72-
If `auth complete` fails with an invalid/expired flow error, explicitly tell the user
73-
their previous auth link/code expired (or no longer matches the active flow), then
74-
start a fresh auth flow and ask them to paste the new callback URL promptly.
47+
### 2. Authenticate (when needed)
7548

76-
**2a. Begin auth flow**
77-
78-
Use `--account work` or `--account personal` if the user specifies an account preference:
49+
For each unauthenticated capability (`gog.email`, `gog.calendar`):
7950

8051
```bash
8152
ash-sb capability auth begin -c gog.email
8253
```
8354

84-
Expected output:
85-
86-
```
87-
Started capability auth flow (flow_id=abc123)
88-
Capability: gog.email
89-
Auth URL: https://www.google.com/device
90-
Flow type: device_code
91-
User code: ABCD-EFGH
92-
Poll interval: 5s
93-
Expires: 2026-03-01T12:30:00Z
94-
```
95-
96-
**2b. Present URL and code to user**
97-
98-
Check the `Flow type` in the output:
55+
Then:
9956

100-
- If `device_code`: show the `Auth URL` and `User code` from the output. Tell the user to open the URL and enter the code. Then proceed to step 2c to poll for completion.
101-
- If `authorization_code`: show the `Auth URL` from the output and ask the user to complete the Google consent screen and provide either the authorization code or the callback URL. Then use `ash-sb capability auth complete --flow-id <id> --code '<CODE>'` (or `--callback-url '<URL>'` when the user pastes the full callback URL). Do **not** pass `-c/--capability` to `auth complete`; that option is only valid for `auth begin`.
57+
- If flow type is `device_code`: show URL + user code, then poll.
58+
- If flow type is `authorization_code`: show URL and ask user for callback URL or code, then complete.
10259

103-
**2c. Poll for completion (device code flow)**
104-
105-
After showing the user the URL and code, poll for completion:
60+
Use these commands:
10661

10762
```bash
108-
ash-sb capability auth poll --flow-id abc123 --timeout 300
63+
ash-sb capability auth poll --flow-id <id> --timeout 300
64+
ash-sb capability auth complete --flow-id <id> --callback-url '<URL>'
65+
ash-sb capability auth complete --flow-id <id> --code '<CODE>'
10966
```
11067

111-
This blocks until the user completes authorization or the timeout expires. Expected output on success:
68+
If user intent is setup-only, stop after successful auth confirmation.
11269

113-
```
114-
Capability auth completed (flow_id=abc123, account_ref=default)
115-
```
116-
117-
**2d. Repeat for additional capabilities**
70+
### 3. Perform operations
11871

119-
If multiple capabilities need auth (e.g. both `gog.email` and `gog.calendar`), repeat steps 2a–2c for each one. Each capability requires its own auth flow.
72+
Use only capability operations and explicit JSON input.
12073

121-
### 3. Perform operation
122-
123-
Run capability operations with explicit capability IDs and JSON input:
74+
Common email/calendar commands:
12475

12576
```bash
12677
ash-sb capability invoke -c gog.email -o list_messages --input-json '{"folder":"inbox","limit":20}'
127-
ash-sb capability invoke -c gog.calendar -o list_events --input-json '{"calendar":"primary","window":"7d"}'
78+
ash-sb capability invoke -c gog.email -o search_messages --input-json '{"query":"is:unread newer_than:1d","limit":20}'
79+
ash-sb capability invoke -c gog.email -o get_message --input-json '{"id":"<message_id>"}'
80+
ash-sb capability invoke -c gog.email -o get_thread --input-json '{"thread_id":"<thread_id>","limit":20}'
81+
ash-sb capability invoke -c gog.calendar -o list_events --input-json '{"calendar":"primary","window":"1d"}'
82+
ash-sb capability invoke -c gog.calendar -o create_event --input-json '{"title":"Team sync","start":"2026-03-04T18:00:00Z"}'
12883
```
12984

130-
Confirm key details before mutating operations (sending emails, creating/updating events).
85+
If the user asks a broad question and does not provide scope, use these defaults:
13186

132-
## Output Format
87+
- Email summaries: `search_messages` with `{"query":"is:unread newer_than:1d","limit":20}`
88+
- Day-at-a-glance: `list_events` with `{"calendar":"primary","window":"1d"}` plus unread/recent email query
89+
- Message deep read: run `get_message` for each item you summarize
13390

134-
Format your `complete()` output exactly as shown below. This is critical — the parent agent relays your output directly.
91+
## Behavior Playbooks
13592

136-
**Listing emails:**
93+
### Summarize Emails
13794

138-
```
139-
- From: Alice <alice@example.com> — "Quarterly review" (2 hours ago)
140-
- From: Bob <bob@example.com> — "Lunch tomorrow?" (yesterday)
141-
```
95+
When user asks for summaries (for example "summarize my emails", "what did I miss"):
14296

143-
**Listing events:**
97+
1. Gather candidate messages with `search_messages` (preferred) or `list_messages`.
98+
2. Fetch full message content with `get_message` for messages you summarize.
99+
3. Summarize using this structure:
100+
- `Top priorities`
101+
- `Needs reply`
102+
- `FYI`
103+
- `Suggested next actions`
104+
4. Keep each bullet tied to a concrete message subject/sender so the user can act on it.
144105

145-
```
146-
- Tomorrow 10am–11am: Team standup (Google Meet)
147-
- Friday 2pm–3pm: 1:1 with Alice (Room 3B)
148-
```
106+
Do not summarize from snippets alone when full content can be fetched.
149107

150-
**After mutations (send, create, update, delete):**
108+
### Day At A Glance
151109

152-
```
153-
Sent: "Re: Quarterly review" to alice@example.com
154-
```
110+
When user asks for a day overview:
155111

156-
```
157-
Created: Team lunch — Friday 12pm–1pm
158-
```
112+
1. Pull today/near-term calendar with `list_events`.
113+
2. Pull high-signal recent email using `search_messages` (for example unread/new/important) and fetch full content for top items.
114+
3. Return this structure:
115+
- `Today's schedule`
116+
- `Email priorities`
117+
- `Conflicts / follow-ups`
118+
- `Recommended next steps`
119+
4. If there are no events or no high-signal email, say that explicitly instead of leaving sections blank.
159120

160-
**Setup/auth completion:**
121+
Use Google calendar + Google email only for this view.
161122

162-
```
163-
Google email is now connected (user@gmail.com). You're all set — let me know when you want to check your inbox or send a message.
164-
```
123+
### Standard mutations
165124

166-
```
167-
Google email and calendar are now connected. You're all set to use both.
168-
```
125+
Before `send_message` or `create_event`, confirm key details if user intent is ambiguous.
126+
Required confirmation fields:
127+
128+
- Email send: recipient, subject, body intent
129+
- Event create: title, start time/date, end time or duration, timezone context if unclear
169130

170-
**Formatting rules:**
131+
## Output Rules
171132

172-
- Show dates conversationally ("2 hours ago", "tomorrow at 3pm") — never raw ISO timestamps
173-
- After mutations, do NOT re-list all items unless the user asks
174-
- Only claim success after the command produces success output
133+
- Keep timestamps conversational (for example "2 hours ago", "tomorrow at 3pm").
134+
- For summary workflows, prefer grouped bullets over raw dumps.
135+
- After mutation success, confirm the action and stop unless user asked for more.
136+
- Only claim success after command output confirms it.
137+
- For auth/setup completion, explicitly state which capability is now connected.
175138

176139
## Error Handling
177140

178-
- If a command fails, report the error message and stop
179-
- Do not attempt to fix or debug failed commands unless the user asks
141+
- If a command fails, report the error message and stop.
142+
- Do not request raw credentials or attempt unsupported workarounds.
143+
- If capability is unavailable or disabled, instruct the user to enable `[skills.google]`.

0 commit comments

Comments
 (0)