---
name: voice-init
description: "Set up the voice corpus: create the directory tree and copy starter rules.md and voice.md templates. Run once before anything else. Use when the user says \"set up my voice\", \"initialize my voice corpus\", \"init voice\", \"start the voice thing\", or when another voice skill reports that ~/.claude/voice (or $VOICE_HOME) doesn't exist yet. Also invocable as /skill:voice-init [home], where home optionally overrides the corpus root (default ~/.claude/voice/)."
---

You are setting up the user's voice corpus.

The invocation argument (appended below as `User: <args>`) is an optional `home` path overriding the corpus root.

## Step 1: Resolve the corpus root

In order of precedence:
1. The `home` argument if passed.
2. `$VOICE_HOME` if set in the environment.
3. Default: `~/.claude/voice/`.

State the resolved path to the user.

## Step 2: Create the directory tree

```
$VOICE_HOME/
  rules.md                      (canonical rules; user-edited)
  voice.md                      (style guide; generated by /skill:voice-distill)
  manifest.md                   (what's been ingested, when)
  corpus/
    emails/                     (Gmail/sent, populated by /skill:voice-pull-emails)
    blog/                       (populated by /skill:voice-pull-blog)
    github_prs/                 (populated by scripts/pull_pr_descriptions.sh and pull_review_comments.sh)
    slack/                      (manual export)
  scripts/
    pull_pr_descriptions.sh     (copy from package)
    pull_review_comments.sh     (copy from package)
```

Use `mkdir -p` for each directory.

## Step 3: Copy templates

This skill lives at `<package>/skills/voice-init/SKILL.md`. The templates and scripts are two levels up, at `<package>/templates/` and `<package>/scripts/`. Resolve those paths relative to this skill file's directory (`../../templates/` and `../../scripts/`).

Copy these into `$VOICE_HOME`:

- `../../templates/rules.md` → `$VOICE_HOME/rules.md` (only if it doesn't already exist; do not overwrite user edits)
- `../../templates/voice.md` → `$VOICE_HOME/voice.md` (only if it doesn't already exist)
- `../../templates/.gitignore` → `$VOICE_HOME/.gitignore` (only if it doesn't exist)

Copy these into `$VOICE_HOME/scripts/` (always overwrite, so script bug fixes propagate):

- `../../scripts/pull_pr_descriptions.sh`
- `../../scripts/pull_review_comments.sh`

`chmod +x` both scripts.

If you can't resolve the package path, tell the user the manual `cp` commands and continue.

## Step 4: Write the manifest

Create `$VOICE_HOME/manifest.md` with this initial content:

```markdown
# Voice corpus manifest

Initialized: <today's date>
Corpus root: <resolved $VOICE_HOME>

## Sources

| Source         | Status        | Last refreshed | Count | Notes |
| -------------- | ------------- | -------------- | ----- | ----- |
| emails         | not pulled    |                | 0     |       |
| blog           | not pulled    |                | 0     |       |
| github_prs     | not pulled    |                | 0     |       |
| slack          | not pulled    |                | 0     |       |

## Refresh strategy

Update each source weekly or when significant new writing accumulates. After any refresh, re-run `/skill:voice-distill` to regenerate `voice.md`.
```

## Step 5: Tell the user what to do next

Print:

```
Voice corpus initialized at <path>.

Next steps:
1. Edit rules.md with your hard writing rules (no em dashes, no "going forward", etc.).
2. Populate the corpus:
   - /skill:voice-pull-emails         (recent sent emails via Gmail MCP)
   - /skill:voice-pull-blog <url>     (your blog or any URL)
   - bash scripts/pull_pr_descriptions.sh <github_user>
   - bash scripts/pull_review_comments.sh <github_user>
3. /skill:voice-distill               (build voice.md from corpus)
4. /skill:voice <register> <topic>    (start drafting)
```

Stop. Do not run any pull commands.
