stack/docs-mintlify/guides/getting-started/ai-integration.mdx
BilalG1 c14a9dd3d0
feat(hexclave): PR 5 — internal symbol/path/package renames + brand strings (#1547)
## Stack Auth → Hexclave rename — PR 5 (internal symbols, paths,
packages, brand strings)

PR 5 finishes the **internal / non-wire** half of the Stack→Hexclave
rename. It only touches things where nothing outside the repo depends on
the exact name: internal symbols, file/dir names, the
`@stackframe/template` package, and residual brand strings. Plan +
progress are in `HEXCLAVE-RENAME-PR5-PLAN.md`.

Every step was verified green (`pnpm typecheck` + `pnpm lint`, 28/28)
and committed as its own checkpoint, then a fan-out of review agents
audited all commits and the findings were fixed.

### What changed
- **Internal symbols** (`@hexclave/shared`, `packages/template`, apps):
`stack*`/`Stack*` → `hexclave*`/`Hexclave*` — incl.
`stackGlobalsSymbol`, the `_Stack*AppImpl` classes,
`stackAppInternalsSymbol`, `StackContext`, `getStackStripe`, etc. The
`stack*App` local-variable convention
(`stackServerApp`/`stackClientApp`/…) was renamed across 175
source/example/doc files.
- **File renames**: `hexclave-handler/provider/context.tsx`,
`backend/hexclave.tsx`, `internal-tool/hexclave.ts`,
`hexclave-app-internals.ts`.
- **Directory renames**: `lib/hexclave-app`, `hexclave-companion`,
`[...hexclave]` route segment, `skills/hexclave`,
`dashboard/src/hexclave`, and the package dirs
**`packages/{next,shared,ui,sc,cli}`** (dropping the `stack-` prefix to
match the `@hexclave/*` npm names).
- **Packages**: `@stackframe/template` → `@hexclave/template`; **deleted
`packages/init-stack`** (onboarding lives in `@hexclave/cli init`; the
published npm package is untouched).
- **Brand strings**: reworded `Stack Auth`/`Stack dashboard` prose in
code + docs-mintlify, renamed `hexclave-app.mdx`/`use-hexclave-app.mdx`
with redirects, regenerated OpenAPI, updated coupled e2e assertions;
`doctor`/`init` now prefer `hexclave.config.ts`.

### Intentionally kept (verified, not oversights)
Wire/compat identifiers (`x-stack-*` headers, `stack-*` cookies,
`STACK_*` env names, `*.stack-auth.com`, `stackauth_`, `ask_stack_auth`,
query params), public `Stack*` SDK aliases, crypto/JWT/vault
domain-separation tags, `*-brand-sentinel`s, the
`Symbol.for("StackAuth--…")` string, `_stack_sync_metadata`, Postgres
`stackframe` / docker image names, the `stack-auth-logo*.svg` (used by
the rebrand modal), and `migration.mdx` / "formerly known as Stack Auth"
notes. False positives (Phosphor `StackIcon`/`StackSimple`, `TanStack`,
`OrbStack`, `stackable`/`Stacked` charts) left alone.

### Review pass
Six review agents audited all commits. Found + fixed one real bug — a
build script (`bundle-type-definitions.ts`) hardcoded the old
`lib/stack-app` glob path (not an import, so typecheck/lint were blind),
silently emptying the dashboard AI type bundle — plus stale comments, a
dead CI env var, and stale `.gitignore`/`.dockerignore` entries.
Cross-cutting audit confirmed **zero wire-compat identifiers were
accidentally renamed**.

### ⚠️ Verification note
`typecheck` + `lint` are fully green locally. The **e2e suite was not
run** (needs a live backend+DB), so the brand-string assertion +
OpenAPI-regen changes are verified by grep/codegen only — please let CI
exercise e2e to confirm.

### Base-branch note
This branch was forked from the local-only `cl/friendly-lewin-72293f`
(not on origin, no separate PR), so this PR against `dev` also carries
that branch's ~11 preceding Hexclave-rename commits (config-file rename,
env-var dual-read, AI setup-prompt rebrand). If those should land
separately, re-parent before merge.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Finishes the internal Stack Auth → Hexclave rename and cleans up
remaining stragglers, including dev-tool and prompt copy. All changes
are internal-only; public/wire APIs remain unchanged. Re-merged `dev`
and resolved the payments create-purchase-url conflict.

- **Refactors**
- Internal symbols: stack*/Stack* → hexclave*/Hexclave* (e.g.,
`getHexclaveServerApp` via `@/hexclave`, `getHexclaveStripe`,
`hexclaveAppInternalsSymbol`, `hexclaveSchemaInfo`, Prisma
`__hexclave_*`, `data-hexclave-handler-page`, Stripe mock
`hexclavePortPrefix`).
- Files/dirs: moved to `lib/hexclave-app`; handler route
`[...hexclave]`; backend entry `src/hexclave.tsx`; dashboard internals
`hexclave-app-internals`; companion `hexclave-companion`; dropped
`stack-` prefix across package dirs
(`packages/{shared,ui,sc,cli,next}`); workflows/emulator paths now
`packages/cli`; Quetzal codegen env at `packages/next/.env.local`.
- Packages/docs: `@stackframe/template` → `@hexclave/template`; removed
`packages/init-stack`; regenerated OpenAPI and updated docs
slugs/redirects for hexclave-app/use-hexclave-app.
- Brand strings/prompts: reworded remaining “Stack” dashboard strings to
Hexclave; updated dev-tool copy and prompts; `doctor/init` now prefer
`hexclave.config.ts`. Kept all wire-compat identifiers and public
aliases (`x-stack-*`, `stack-*` cookies, `STACK_*` env,
`*.stack-auth.com`, `Stack*` SDK names).
- Rebased/merged onto latest `dev`: retained `@hexclave/template`, kept
`src` in published files, refreshed setup-prompt imports and docs JSON,
adopted 1.0.5 version bumps, and re-merged `dev` again (resolved
`create-purchase-url` with `getHexclaveStripe`).

- **Bug Fixes**
- Restored dashboard AI type bundle by pointing the glob to
`packages/template/src/lib/hexclave-app`.
- Addressed rename leftovers: updated lingering `@/stack` imports and
CSS selector, fixed schema/meta and port-prefix expansions, and aligned
emulator commands to `packages/cli`.
- CI/build: removed a dead env var and stale ignore entries; fixed
Docker by renaming `STACK_SKIP_TEMPLATE_GENERATION` →
`HEXCLAVE_SKIP_TEMPLATE_GENERATION`.

<sup>Written for commit 3c1af3bff3.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/hexclave/hexclave/pull/1547?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->
2026-06-03 18:57:09 -07:00

242 lines
11 KiB
Plaintext

---
title: Using Hexclave with AI
description: Teach your coding agent how to use Hexclave — via web fetch, an installable skill, or the Hexclave MCP server.
sidebarTitle: Using Hexclave with AI
---
import { hexclaveAgentRemindersText } from "/snippets/hexclave-agent-reminders.jsx";
<Visibility for="agents">
{hexclaveAgentRemindersText}
</Visibility>
<Note>
This page is for giving your own coding agent (Claude Code, Cursor, Codex, opencode, …) ongoing knowledge of Hexclave so it writes Hexclave code correctly.
If you would like to use Hexclave to power your own CLI, see the [CLI Authentication](/guides/apps/authentication/cli-authentication) page.
</Note>
There are three ways to give a coding agent working knowledge of Hexclave. They differ only in how the instructions reach the agent — the knowledge is the same.
<CardGroup cols={3}>
<Card title="Web Fetch" icon="wand-magic-sparkles" href="#option-1-web-fetch-recommended">
Paste a one-line prompt — your agent fetches the live skill on demand.
</Card>
<Card title="Skill" icon="sparkles" href="#option-2-skill">
Install the Hexclave `SKILL.md` file so your agent loads it automatically.
</Card>
<Card title="MCP" icon="plug" href="#option-3-mcp">
Connect your agent to the Hexclave MCP server for live docs and `ask_hexclave` search.
</Card>
</CardGroup>
## Option 1: Web fetch (recommended)
Most coding agents now support web fetch out of the box, so you can simply tell your agent to use Hexclave's skill from the internet.
To do so, paste the prompt below into your coding agent:
````markdown title="One-shot prompt"
Fetch https://skill.hexclave.com and follow it for this task.
````
The fetched `SKILL.md` indexes the entire Hexclave docs sidebar and tells the agent to pull fresh content for whichever surface you're touching (auth, orgs/teams, payments, emails, analytics, the CLI). It is purely a reference — paste it whenever you want the agent to use Hexclave knowledge.
## Option 2: Skill
Install the skill once so your agent loads it automatically every time Hexclave is relevant — no copy-paste required.
<Tabs>
<Tab title="Cli install">
The fastest way to install the Hexclave skill for a Claude Code-style agent or similar:
```sh title="Terminal"
npx -y skills add hexclave/hexclave --skill stack-auth
```
This detects your agent and installs the skill in the correct location (per-project or global) automatically. From then on, your agent picks it up whenever the conversation touches Hexclave.
</Tab>
<Tab title="Copy-paste prompt">
If your agent can't run the `npx` command above, paste the prompt below into the chat. The agent will fetch `SKILL.md` and drop it into the right location for your agent — per-project if a project-scoped agent folder exists, global otherwise.
````markdown title="Skill install prompt"
Install the Hexclave skill (`SKILL.md`) for me so you load it automatically on future Hexclave tasks. The canonical file lives at:
https://raw.githubusercontent.com/hexclave/hexclave/dev/skills/hexclave/SKILL.md
These are the same install locations the `skills` CLI (https://github.com/vercel-labs/skills) uses — match them exactly so the file is picked up the same way.
Do this in one shot using smart defaults; only stop to ask a single multiple-choice question at the end if I want to change anything.
1. **Detect the agent.** Identify which coding agent is running you (Claude Code, Codex, Cursor, opencode, Windsurf, Roo, Kilo, Amp, Antigravity, Cline, Continue, Crush, Augment, etc.). If you genuinely can't tell, default to Claude Code.
2. **Pick the default scope.** Look for an existing agent folder in the current project root: `.claude/`, `.agents/`, `.cursor/`, `.codex/`, `.opencode/`, `.windsurf/`, `.roo/`, `.kilocode/`, `.augment/`, `.continue/`, `.crush/`, etc.
- If any such folder exists → default to **project** scope.
- Otherwise → default to **global** scope.
3. **Resolve the install directory.** Write `SKILL.md` to `<skills-dir>/stack-auth/SKILL.md`, where `<skills-dir>` comes from this table (mirrors `vercel-labs/skills/src/agents.ts`):
| Agent | Project `<skills-dir>` | Global `<skills-dir>` |
| --- | --- | --- |
| Claude Code | `.claude/skills` | `~/.claude/skills` (or `$CLAUDE_CONFIG_DIR/skills`) |
| Codex | `.agents/skills` | `~/.codex/skills` (or `$CODEX_HOME/skills`) |
| Cursor | `.agents/skills` | `~/.cursor/skills` |
| opencode | `.agents/skills` | `~/.config/opencode/skills` (XDG) |
| Windsurf | `.windsurf/skills` | `~/.codeium/windsurf/skills` |
| Amp | `.agents/skills` | `~/.config/agents/skills` (XDG) |
| Antigravity | `.agents/skills` | `~/.gemini/antigravity/skills` |
| Cline | `.agents/skills` | `~/.agents/skills` |
| Roo Code | `.roo/skills` | `~/.roo/skills` |
| Kilo Code | `.kilocode/skills` | `~/.kilocode/skills` |
| Augment | `.augment/skills` | `~/.augment/skills` |
| Continue | `.continue/skills` | `~/.continue/skills` |
| Crush | `.crush/skills` | `~/.config/crush/skills` |
For any agent not listed, follow its documented skills directory or fall back to `.agents/skills` (project) / `~/.<agent>/skills` (global).
4. **Install.** Download `SKILL.md` once to a stable cache location — `~/.cache/stack-auth/SKILL.md` (or `$XDG_CACHE_HOME/stack-auth/SKILL.md`) — then create a **symlink** at `<skills-dir>/stack-auth/SKILL.md` pointing to that cached file. Create missing parent directories. If the target path already exists, replace it (overwrite the symlink, or back up and replace a regular file). Symlinking means future re-installs at additional scopes/agents reuse the same source file, and re-running the prompt after an update to the cached file picks up automatically. If the platform doesn't support symlinks (e.g. Windows without dev mode), fall back to copying the file verbatim.
5. **Confirm and offer alternatives.** Print the absolute symlink path and the cache target it points to. Then ask me a single multiple-choice question covering anything I might want to change, e.g.:
```
Installed Hexclave skill at <path> → <cache path>. Want to change anything?
a) Keep it — done
b) Also symlink at the opposite scope (<other path>)
c) Install for a different agent instead
d) Symlink into additional agents too
```
Only act on whichever letter I pick. Don't pre-ask before the first install. Additional installs just create more symlinks pointing at the same cached `SKILL.md`.
Installing the file is the only goal of this prompt — do not act on the skill's contents yet.
````
</Tab>
</Tabs>
## Option 3: MCP
The Hexclave MCP server (`https://mcp.hexclave.com/mcp`) gives your agent live access to Hexclave docs and skill via prompts, resources and an `ask_hexclave` tool that searches the docs with citations. Install it once per agent — it stays available across every project.
<Tabs>
<Tab title="One-click install">
<CardGroup cols={2}>
<Card title="Add to Cursor" icon="square-arrow-up-right" href="cursor://anysphere.cursor-deeplink/mcp/install?name=stack-auth&config=eyJ1cmwiOiJodHRwczovL21jcC5zdGFjay1hdXRoLmNvbS9tY3AifQ==">
Opens Cursor and adds `stack-auth` to your MCP config.
</Card>
<Card title="Add to VS Code" icon="square-arrow-up-right" href="https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522type%2522%253A%2522http%2522%252C%2522name%2522%253A%2522stack-auth%2522%252C%2522url%2522%253A%2522https%253A%252F%252Fmcp.hexclave.com%252Fmcp%2522%257D">
Opens VS Code and adds `stack-auth` to your MCP config.
</Card>
</CardGroup>
For the up-to-date list of one-click install buttons for every client (Cursor, VS Code, Claude Desktop, Windsurf, ChatGPT, Gemini, …), visit [`mcp.hexclave.com`](https://mcp.hexclave.com) in your browser.
</Tab>
<Tab title="Config files">
<Tabs>
<Tab title="Cursor">
Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project):
```json title="mcp.json"
{
"mcpServers": {
"stack-auth": {
"url": "https://mcp.hexclave.com/mcp"
}
}
}
```
</Tab>
<Tab title="Claude Code">
```sh title="Terminal"
claude mcp add --transport http stack-auth https://mcp.hexclave.com/mcp
```
</Tab>
<Tab title="VS Code">
```sh title="Terminal"
code --add-mcp '{"type":"http","name":"stack-auth","url":"https://mcp.hexclave.com/mcp"}'
```
</Tab>
<Tab title="Codex">
```sh title="Terminal"
codex mcp add stack-auth --url https://mcp.hexclave.com/mcp
```
Or add to `~/.codex/config.toml`:
```toml title="config.toml"
[mcp_servers.stack-auth]
url = "https://mcp.hexclave.com/mcp"
```
</Tab>
<Tab title="Windsurf">
```json title="mcp.json"
{
"mcpServers": {
"stack-auth": {
"serverUrl": "https://mcp.hexclave.com/mcp"
}
}
}
```
</Tab>
<Tab title="Gemini CLI">
Add to `~/.gemini/settings.json`:
```json title="settings.json"
{
"mcpServers": {
"stack-auth": {
"httpUrl": "https://mcp.hexclave.com/mcp",
"headers": {
"Accept": "application/json, text/event-stream"
}
}
}
}
```
</Tab>
</Tabs>
For Claude Desktop, ChatGPT, and copy-paste markdown blocks you can drop into your project README, visit [`mcp.hexclave.com`](https://mcp.hexclave.com).
</Tab>
<Tab title="Ask your agent">
If your agent can edit its own config, paste this prompt:
```markdown title="MCP install prompt"
Install the Hexclave MCP server for me. The server URL is https://mcp.hexclave.com/mcp (HTTP transport).
Detect which coding agent I'm using and add the server to the correct config file:
- Claude Code → run `claude mcp add --transport http stack-auth https://mcp.hexclave.com/mcp`
- Cursor → `~/.cursor/mcp.json`
- VS Code → run `code --add-mcp '{"type":"http","name":"stack-auth","url":"https://mcp.hexclave.com/mcp"}'`
- Codex → `~/.codex/config.toml`
- opencode → `~/.config/opencode/opencode.json`
- Gemini CLI → `~/.gemini/settings.json`
If this repo already has a project-scoped MCP config (`.cursor/mcp.json`, `.vscode/mcp.json`, `.claude.json`, `.codex/config.toml`, etc.), install it there instead of the global location.
After installing, confirm by listing the registered MCP servers.
```
</Tab>
</Tabs>
## Project vs. global scope
The install prompts above follow the same rule for picking project-vs-global scope:
| Detected in project root | Skill / MCP install scope |
| --- | --- |
| `.claude/`, `.cursor/`, `.vscode/mcp.json`, `.codex/`, `.opencode/` | **Project** (inside the existing folder) |
| None of the above | **Global** (user-level config for the detected agent) |
This keeps shared repos clean (project-scoped config lives next to the code) and keeps your personal projects ergonomic (one global install, available everywhere).