Skip to content

Commit 4cadd97

Browse files
dcramercodex
andcommitted
Refactor Google skill with progressive disclosure references
Co-Authored-By: GPT-5 Codex <codex@openai.com>
1 parent 1012ec0 commit 4cadd97

4 files changed

Lines changed: 170 additions & 11 deletions

File tree

src/ash/integrations/skills/capabilities/google/SKILL.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ input_schema:
2424

2525
Manage Gmail and Google Calendar through host-managed capabilities.
2626

27+
Use progressive disclosure:
28+
29+
- Read `references/gmail-workflows.md` when handling summaries, inbox triage, day-at-a-glance planning, or Gmail query choices.
30+
- Read `references/auth-and-failures.md` when auth is incomplete/expired or capability commands fail.
31+
- Read `references/output-templates.md` when producing summary/day-plan output sections.
32+
2733
## Security Contract
2834

2935
- Use `ash-sb capability` for every Gmail/Calendar operation.
@@ -71,7 +77,7 @@ If user intent is setup-only, stop after successful auth confirmation.
7177

7278
Use only capability operations and explicit JSON input.
7379

74-
Common email/calendar commands:
80+
Core commands:
7581

7682
```bash
7783
ash-sb capability invoke -c gog.email -o list_messages --input-json '{"folder":"inbox","limit":20}'
@@ -96,11 +102,7 @@ When user asks for summaries (for example "summarize my emails", "what did I mis
96102

97103
1. Gather candidate messages with `search_messages` (preferred) or `list_messages`.
98104
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`
105+
3. Summarize using the section template in `references/output-templates.md`.
104106
4. Keep each bullet tied to a concrete message subject/sender so the user can act on it.
105107

106108
Do not summarize from snippets alone when full content can be fetched.
@@ -111,11 +113,7 @@ When user asks for a day overview:
111113

112114
1. Pull today/near-term calendar with `list_events`.
113115
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`
116+
3. Render the response with the day-at-a-glance template in `references/output-templates.md`.
119117
4. If there are no events or no high-signal email, say that explicitly instead of leaving sections blank.
120118

121119
Use Google calendar + Google email only for this view.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Auth and Failure Handling
2+
3+
Use this reference when capability auth is missing, expired, or command execution fails.
4+
5+
## Auth Flow Handling
6+
7+
1. Run `ash-sb capability list`.
8+
2. For any required capability with `Authenticated: no`, run `auth begin`.
9+
3. Complete with the appropriate flow:
10+
- `device_code`: show URL + code, then poll.
11+
- `authorization_code`: ask for callback URL or code, then `auth complete`.
12+
13+
If user intent is setup-only, stop after auth succeeds.
14+
15+
## Callback URL vs Code
16+
17+
If user provides a callback URL (`http://localhost/?code=...`), pass it with `--callback-url`.
18+
If user provides only a code value, pass it with `--code`.
19+
20+
Never ask for OAuth secrets.
21+
22+
## Expired/Invalid Flow Recovery
23+
24+
If `auth complete` reports invalid/expired flow:
25+
26+
1. Tell the user their previous auth flow expired or no longer matches active state.
27+
2. Start a fresh auth flow.
28+
3. Ask them to complete promptly and provide the new callback URL/code.
29+
30+
## Capability Availability Errors
31+
32+
If capability is missing entirely:
33+
34+
- Tell user to enable `[skills.google]`.
35+
- Stop rather than guessing alternatives.
36+
37+
## Operation Failures
38+
39+
On failure:
40+
41+
1. Report the command error clearly.
42+
2. Do not claim success.
43+
3. Do not invent fallback data.
44+
4. Stop unless user asks for troubleshooting.
45+
46+
## Mutating Action Safety
47+
48+
Before mutating operations:
49+
50+
- `send_message`: confirm recipient, subject intent, and body intent when ambiguous.
51+
- `create_event`: confirm title, date/time, and duration/end time when ambiguous.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Gmail Workflows
2+
3+
Use this reference when the user asks for inbox triage, email summaries, or a day-at-a-glance view.
4+
5+
## Query Recipes
6+
7+
Use `search_messages` with focused Gmail query syntax.
8+
9+
| Goal | Query |
10+
|------|-------|
11+
| Unread in last day | `is:unread newer_than:1d` |
12+
| Unread in last week | `is:unread newer_than:7d` |
13+
| Important/unread | `is:important is:unread` |
14+
| From a person/domain | `from:alice@example.com` or `from:@example.com` |
15+
| Time-sensitive subjects | `subject:(urgent OR asap OR today)` |
16+
| Action requests | `("can you" OR "please review" OR "action required") newer_than:7d` |
17+
18+
Prefer a narrow query first, then broaden if needed.
19+
20+
## Summarize Emails Workflow
21+
22+
1. Run `search_messages` (or `list_messages` when folder-based scope is requested).
23+
2. Select top candidates by recency + urgency language + sender relevance.
24+
3. Run `get_message` for each selected message before summarizing.
25+
4. Summarize with actionable bullets tied to sender and subject.
26+
27+
Do not rely on snippets when full message content is available.
28+
29+
## Day-At-A-Glance Workflow (Email Portion)
30+
31+
1. Start with `search_messages` default query: `is:unread newer_than:1d`.
32+
2. If results are sparse, broaden to `newer_than:2d` or remove `is:unread`.
33+
3. Pull full content for top 3-8 messages with `get_message`.
34+
4. Prioritize messages that imply deadlines, asks, or pending replies.
35+
36+
## Thread Usage
37+
38+
Use `get_thread` when:
39+
40+
- The user asks for context on a conversation.
41+
- A message implies prior back-and-forth and reply context matters.
42+
- You need to summarize the evolution of a decision.
43+
44+
Use `get_message` when:
45+
46+
- The user asks about one specific email.
47+
- You only need the latest message content.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Output Templates
2+
3+
Use these templates to keep responses concise and actionable.
4+
5+
## Email Summary Template
6+
7+
```
8+
Top priorities
9+
- <sender> — <subject>: <1-line why this matters now>
10+
11+
Needs reply
12+
- <sender> — <subject>: <what reply is needed and by when if known>
13+
14+
FYI
15+
- <sender> — <subject>: <short informational summary>
16+
17+
Suggested next actions
18+
- <concrete next step 1>
19+
- <concrete next step 2>
20+
```
21+
22+
Guidelines:
23+
24+
- Use sender + subject in each bullet.
25+
- Prefer short, decision-focused language.
26+
- If a section has no items, write `- None`.
27+
28+
## Day-At-A-Glance Template
29+
30+
```
31+
Today's schedule
32+
- <time range>: <event title> (<location/meeting link if available>)
33+
34+
Email priorities
35+
- <sender> — <subject>: <action needed>
36+
37+
Conflicts / follow-ups
38+
- <scheduling conflict or follow-up item>
39+
40+
Recommended next steps
41+
- <step 1>
42+
- <step 2>
43+
```
44+
45+
Guidelines:
46+
47+
- Keep chronology clear in schedule section.
48+
- Highlight time-sensitive asks.
49+
- If no events or no high-signal email, state that explicitly.
50+
51+
## Mutation Confirmation Template
52+
53+
For successful sends/creates:
54+
55+
```
56+
Sent: "<subject>" to <recipient>
57+
```
58+
59+
```
60+
Created: <event title> — <day/time range>
61+
```
62+
63+
Do not append unrelated listings unless user requests them.

0 commit comments

Comments
 (0)