# machine-business

Claude Code plugin for business workflows: organize project-scoped inputs, produce Markdown resource records, generate business deliverables, and render styled Word documents. The current implemented deliverable is a business proposal.

## Commands

- **`/machine-business:business-init <project-slug>`** — Creates the standard project folders under `docs/inputs/<project-slug>/` and `docs/business/<project-slug>/`, including an empty `index.json`. Skill: [`skills/business-init`](skills/business-init/SKILL.md).
- **`/machine-business:process-input <project-slug> [files]`** — Transcribes audio through the `free-whisper` MCP, writes one resource `.md` per input under `docs/inputs/<project-slug>/transcriptions/`, and updates `docs/inputs/<project-slug>/index.json`. If no files are passed, raw files live in `docs/inputs/<project-slug>/raw/`. Skill: [`skills/process-input`](skills/process-input/SKILL.md).
- **`/machine-business:setup-token [token]`** — Saves your `free-whisper` API token into the global `~/.claude/settings.json` so transcription can authenticate (shared with machine-discovery). Skill: [`skills/setup-token`](skills/setup-token/SKILL.md).
- **`/machine-business:business-proposal <project-slug> [es|en]`** — Synthesizes all `ready` resource records from `docs/inputs/<project-slug>/index.json` into `docs/business/<project-slug>/proposal.md`, with a project subtitle, 4 proposal sections, key success factors, and an internal Discovery estimate. If omitted, language is resolved from the user request and defaults to Spanish when ambiguous. Ready for `/machine-business:render-docx`. Skill: [`skills/business-proposal`](skills/business-proposal/SKILL.md).
- **`/machine-business:render-docx <path.md>`** — Renders one Markdown file into a sibling `.docx` using the bundled `reference.docx` style template. Skill: [`skills/render-docx`](skills/render-docx/SKILL.md).

## Workflow

```text
/machine-business:business-init acme-demo
  -> docs/inputs/acme-demo/{raw,transcriptions}/
  -> docs/inputs/acme-demo/index.json
  -> docs/business/acme-demo/

Put raw audio/text files in:
  docs/inputs/acme-demo/raw/

/machine-business:process-input acme-demo
  -> docs/inputs/acme-demo/transcriptions/<resource-slug>.md
  -> docs/inputs/acme-demo/index.json

/machine-business:business-proposal acme-demo
  -> docs/business/acme-demo/proposal.md

/machine-business:render-docx docs/business/acme-demo/proposal.md
  -> docs/business/acme-demo/proposal.docx
```

## Input index

Each project has an input registry at `docs/inputs/<project-slug>/index.json`:

```json
{
  "project": "acme-demo",
  "inputs": [
    {
      "src": "raw/notas.md",
      "md": "transcriptions/notas.md",
      "status": "ready"
    }
  ]
}
```

Paths are relative to `docs/inputs/<project-slug>/`. The JSON stores only source paths, generated Markdown paths, and status; transcript/source text lives in the resource `.md` files.

## Setup — MCP `free-whisper`

The `process-input` skill transcribes audio through the `@the-ai-machine/free-whisper-mcp@latest` MCP server (stdio, through `npx`), declared in [`.mcp.json`](.mcp.json). The API URL is **hardcoded and public** (`https://api.transcribe.skillbase.yareytech.com`); you only provide your **token**.

The `.mcp.json` references the token as `${FREE_WHISPER_API_TOKEN}`. Its value lives in your **global** Claude Code config (`~/.claude/settings.json`, `env` block), so it survives plugin updates and is shared by `machine-business` and `machine-discovery`.

### Configure your token

1. **Generate / copy your token** at https://transcribe.skillbase.yareytech.com
2. **Save it**: run `/machine-business:setup-token <token>` (or run it without the token and paste it when asked). It writes `FREE_WHISPER_API_TOKEN` into `~/.claude/settings.json`, merging without touching your other settings.
3. **Reconnect the MCP**: run `/mcp`, select `free-whisper`, and reconnect. Reconnecting reloads its env so transcription can authenticate.

Verify with `/mcp` that `free-whisper` shows as *connected*.

### Notes

- The token is **required** and is a per-user secret. It MUST NOT be committed or written into `.mcp.json`; only the `${FREE_WHISPER_API_TOKEN}` reference lives in the repo, and its value stays in your global `~/.claude/settings.json`.
- `.mcp.json` declares the token as a `${FREE_WHISPER_API_TOKEN}` reference (not a literal). If that variable is unset — you have not run `setup-token`, or you saved the token but did not reconnect — Claude Code cannot expand it and free-whisper returns **401**. Fix: run `/machine-business:setup-token` and reconnect via `/mcp`.
- The same token works for both plugins; you configure it once.
- If it still fails, start with `claude --debug` to see the server startup log.
