Skip to content

Commit af82ace

Browse files
authored
Merge pull request #1 from basecamp/agent-skill
Add embedded agent skill with hey skill install command
2 parents 4a69020 + 41e81dc commit af82ace

6 files changed

Lines changed: 334 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ hey journal read # read today's entry (or pass YYYY-MM-DD)
116116
hey journal write --content "..." # write today's entry (or omit --content for $EDITOR)
117117
```
118118

119+
## Agent Skill
120+
121+
hey-cli ships with an embedded agent skill so your agent can interact with HEY on your behalf.
122+
123+
```bash
124+
hey skill install # install the skill globally for your agent
125+
```
126+
119127
## Development
120128

121129
```bash

‎internal/cmd/root.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func Execute() {
8585
rootCmd.AddCommand(newTimetrackCommand().cmd)
8686
rootCmd.AddCommand(newJournalCommand().cmd)
8787
rootCmd.AddCommand(newTuiCommand().cmd)
88+
rootCmd.AddCommand(newSkillCommand().cmd)
8889

8990
err := rootCmd.Execute()
9091
if err != nil {

‎internal/cmd/skill.go‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
8+
"hey-cli/skills"
9+
)
10+
11+
type skillCommand struct {
12+
cmd *cobra.Command
13+
}
14+
15+
func newSkillCommand() *skillCommand {
16+
sc := &skillCommand{}
17+
sc.cmd = &cobra.Command{
18+
Use: "skill",
19+
Short: "Manage the embedded agent skill",
20+
Long: "Print or install the SKILL.md embedded in this binary.",
21+
RunE: func(cmd *cobra.Command, args []string) error {
22+
data, err := skills.FS.ReadFile("hey/SKILL.md")
23+
if err != nil {
24+
return fmt.Errorf("reading embedded skill: %w", err)
25+
}
26+
_, err = fmt.Fprint(cmd.OutOrStdout(), string(data))
27+
return err
28+
},
29+
}
30+
sc.cmd.AddCommand(newSkillInstallCommand())
31+
return sc
32+
}

‎internal/cmd/skill_install.go‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"path/filepath"
7+
8+
"github.com/spf13/cobra"
9+
10+
"hey-cli/skills"
11+
)
12+
13+
func newSkillInstallCommand() *cobra.Command {
14+
return &cobra.Command{
15+
Use: "install",
16+
Short: "Install the hey skill globally for Claude",
17+
Long: "Copies the embedded SKILL.md to ~/.agents/skills/hey/ and creates a symlink in ~/.claude/skills/hey.",
18+
RunE: runSkillInstall,
19+
}
20+
}
21+
22+
func runSkillInstall(cmd *cobra.Command, args []string) error {
23+
home, err := os.UserHomeDir()
24+
if err != nil {
25+
return fmt.Errorf("getting home directory: %w", err)
26+
}
27+
28+
skillDir := filepath.Join(home, ".agents", "skills", "hey")
29+
skillFile := filepath.Join(skillDir, "SKILL.md")
30+
symlinkDir := filepath.Join(home, ".claude", "skills")
31+
symlinkPath := filepath.Join(symlinkDir, "hey")
32+
33+
// Read embedded SKILL.md
34+
data, err := skills.FS.ReadFile("hey/SKILL.md")
35+
if err != nil {
36+
return fmt.Errorf("reading embedded skill: %w", err)
37+
}
38+
39+
// Create skill directory and write file
40+
if err := os.MkdirAll(skillDir, 0o755); err != nil {
41+
return fmt.Errorf("creating skill directory: %w", err)
42+
}
43+
if err := os.WriteFile(skillFile, data, 0o644); err != nil {
44+
return fmt.Errorf("writing skill file: %w", err)
45+
}
46+
47+
// Create symlink directory and symlink
48+
if err := os.MkdirAll(symlinkDir, 0o755); err != nil {
49+
return fmt.Errorf("creating symlink directory: %w", err)
50+
}
51+
// Remove existing symlink/file if present
52+
os.Remove(symlinkPath)
53+
if err := os.Symlink(filepath.Join("..", "..", ".agents", "skills", "hey"), symlinkPath); err != nil {
54+
return fmt.Errorf("creating symlink: %w", err)
55+
}
56+
57+
fmt.Fprintln(cmd.OutOrStdout(), "Installed hey skill to ~/.agents/skills/hey/SKILL.md")
58+
fmt.Fprintln(cmd.OutOrStdout(), "Symlinked ~/.claude/skills/hey → ../../.agents/skills/hey")
59+
return nil
60+
}

‎skills/embed.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Package skills embeds the skill files in the binary.
2+
package skills
3+
4+
import "embed"
5+
6+
//go:embed hey
7+
var FS embed.FS

‎skills/hey/SKILL.md‎

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
---
2+
name: hey
3+
description: |
4+
Interact with HEY email via the HEY CLI. Read and send emails, manage boxes,
5+
calendars, todos, habits, time tracking, and journal entries. Use for ANY
6+
HEY-related question or action.
7+
triggers:
8+
# Direct invocations
9+
- hey
10+
- /hey
11+
# Email actions
12+
- hey boxes
13+
- hey box
14+
- hey topic
15+
- hey reply
16+
- hey compose
17+
- hey drafts
18+
# Calendar actions
19+
- hey calendars
20+
- hey recordings
21+
# Todos
22+
- hey todo
23+
# Habits
24+
- hey habit
25+
# Time tracking
26+
- hey timetrack
27+
# Journal
28+
- hey journal
29+
# Auth
30+
- hey auth
31+
# Common actions
32+
- check my email
33+
- read email
34+
- send email
35+
- reply to email
36+
- compose email
37+
- list mailboxes
38+
- check calendar
39+
- add todo
40+
- complete todo
41+
- track time
42+
- write journal
43+
# Questions
44+
- can I hey
45+
- how do I hey
46+
- what's in hey
47+
- what hey
48+
- does hey
49+
# My work
50+
- my emails
51+
- my inbox
52+
- my imbox
53+
- my todos
54+
- my calendar
55+
- my journal
56+
# URLs
57+
- hey.com
58+
invocable: true
59+
argument-hint: "[command] [args...]"
60+
---
61+
62+
# /hey - HEY Email Workflow Command
63+
64+
CLI for HEY email: mailboxes, email threads, replies, compose, calendars, todos, habits, time tracking, and journal entries.
65+
66+
## Agent Invariants
67+
68+
**MUST follow these rules:**
69+
70+
1. **Always use `--json`** for structured, predictable output
71+
2. **Authentication required** for all data commands — run `hey auth login` first
72+
3. **HTML output** is available via `--html` for commands that return HTML content
73+
74+
## Quick Reference
75+
76+
| Task | Command |
77+
|------|---------|
78+
| List mailboxes | `hey boxes --json` |
79+
| List emails in a box | `hey box imbox --json` |
80+
| Read email thread | `hey topic 123 --json` |
81+
| Reply to email | `hey reply 123 -m "Thanks!"` |
82+
| Compose email | `hey compose --to user@example.com --subject "Hello"` |
83+
| List drafts | `hey drafts --json` |
84+
| List calendars | `hey calendars --json` |
85+
| List calendar events | `hey recordings 123 --json` |
86+
| List todos | `hey todo list --json` |
87+
| Add todo | `hey todo add "Buy milk"` |
88+
| Complete todo | `hey todo complete 123` |
89+
| Uncomplete todo | `hey todo uncomplete 123` |
90+
| Delete todo | `hey todo delete 123` |
91+
| Complete habit | `hey habit complete` |
92+
| Uncomplete habit | `hey habit uncomplete` |
93+
| Start time tracking | `hey timetrack start` |
94+
| Stop time tracking | `hey timetrack stop` |
95+
| Current timer | `hey timetrack current --json` |
96+
| List time entries | `hey timetrack list --json` |
97+
| List journal entries | `hey journal list --json` |
98+
| Read journal entry | `hey journal read 2024-03-15 --json` |
99+
| Write journal entry | `hey journal write -m "Today was great"` |
100+
| Check auth status | `hey auth status` |
101+
| Print access token | `hey auth token` |
102+
| Launch TUI | `hey` |
103+
104+
## Decision Trees
105+
106+
### Reading Email
107+
108+
```
109+
Want to read email?
110+
├── Which mailbox? → hey boxes --json
111+
├── List emails in box? → hey box <name|id> --json
112+
├── Read full thread? → hey topic <id> --json
113+
└── Launch interactive UI? → hey (no args, launches TUI)
114+
```
115+
116+
### Sending Email
117+
118+
```
119+
Want to send email?
120+
├── Reply to thread? → hey reply <topic_id> -m "message"
121+
│ └── Open editor? → hey reply <topic_id> (omit -m to open $EDITOR)
122+
├── Compose new? → hey compose --to <email> --subject "Subject"
123+
│ └── With body? → hey compose --to <email> --subject "Subject" -m "Body"
124+
└── Check drafts? → hey drafts --json
125+
```
126+
127+
### Managing Todos
128+
129+
```
130+
Want to manage todos?
131+
├── List todos? → hey todo list --json
132+
├── Add todo? → hey todo add "Task description"
133+
├── Complete? → hey todo complete <id>
134+
├── Uncomplete? → hey todo uncomplete <id>
135+
└── Delete? → hey todo delete <id>
136+
```
137+
138+
## Resource Reference
139+
140+
### Email - Boxes
141+
142+
```bash
143+
hey boxes --json # List all mailboxes
144+
hey box imbox --json # List emails in Imbox (by name)
145+
hey box 123 --json # List emails in box (by ID)
146+
```
147+
148+
Box names: `imbox`, `the_feed`, `paper_trail`, `set_aside`, `reply_later`, `screened_out`
149+
150+
**Response format:** `hey box` returns `{"box": {...}, "postings": [...]}`. Each posting has: `id`, `name` (subject), `seen` (read status), `created_at`, `contacts`, `summary`, `app_url`.
151+
152+
### Email - Topics
153+
154+
```bash
155+
hey topic 123 --json # Read full email thread
156+
hey topic 123 --html # Read with raw HTML content
157+
```
158+
159+
### Email - Reply & Compose
160+
161+
```bash
162+
hey reply 123 -m "Thanks!" # Reply with inline message
163+
hey reply 123 # Reply via $EDITOR
164+
hey compose --to user@example.com --subject "Hello" # Compose new
165+
hey compose --to user@example.com --subject "Hi" -m "Body" # With body
166+
```
167+
168+
### Drafts
169+
170+
```bash
171+
hey drafts --json # List drafts
172+
```
173+
174+
### Calendars
175+
176+
```bash
177+
hey calendars --json # List calendars (returns array of {id, name, kind})
178+
hey recordings 123 --json # List events in calendar
179+
```
180+
181+
**Response format:** `hey recordings` returns `{"Calendar::Event": [...]}`. Each event has: `id`, `title`, `starts_at`, `ends_at`, `all_day`, `recurring`, `starts_at_time_zone`. Access events via `.["Calendar::Event"]` in jq.
182+
183+
### Todos
184+
185+
```bash
186+
hey todo list --json # List all todos
187+
hey todo add "Task description" # Add a todo
188+
hey todo complete 123 # Mark complete
189+
hey todo uncomplete 123 # Mark incomplete
190+
hey todo delete 123 # Delete a todo
191+
```
192+
193+
### Habits
194+
195+
```bash
196+
hey habit complete # Mark habit complete for today
197+
hey habit uncomplete # Unmark habit for today
198+
```
199+
200+
### Time Tracking
201+
202+
```bash
203+
hey timetrack start # Start timer
204+
hey timetrack stop # Stop timer
205+
hey timetrack current --json # Show current timer
206+
hey timetrack list --json # List time entries
207+
```
208+
209+
### Journal
210+
211+
```bash
212+
hey journal list --json # List journal entries
213+
hey journal read 2024-03-15 --json # Read entry by date
214+
hey journal write -m "Today's entry" # Write entry inline
215+
hey journal write # Write entry via $EDITOR
216+
```
217+
218+
### Authentication
219+
220+
```bash
221+
hey auth login # Log in (browser-based OAuth)
222+
hey auth status # Check if authenticated
223+
hey auth logout # Log out
224+
```
225+
226+
If a command fails with an auth error, run `hey auth status` to check, then `hey auth login` to re-authenticate.

0 commit comments

Comments
 (0)