# Integrations

DevWorkspace can install, verify and repair three tools that the generated Claude instructions rely on. It does this with one command, never assumes success, and never overwrites your files.

```bash
npx devworkspace setup --integrations --dry-run   # see exactly what would run
npx devworkspace setup --integrations --yes       # do it
npx devworkspace integrations status              # observe the real state (runs the tools)
npx devworkspace doctor                           # core workspace + integrations, reported separately
```

Also: `devworkspace init --with-integrations --yes` (same manager), `devworkspace integrations repair --yes`, and `devworkspace integrations status --restarted` (after you restart Claude Code).

Useful flags: `--only graphify,agent-skills,ponytail` (a subset), `--scope project|user` (default project), `--json` (machine-readable result, progress goes to stderr), `--quick` (status without running the tools).

| Tool | Role | Installed as |
| --- | --- | --- |
| [Graphify](https://github.com/Graphify-Labs/graphify) | Structural code graph for navigation | `graphifyy` CLI (per-user) + project skill |
| [Agent Skills](https://github.com/addyosmani/agent-skills) | Engineering workflows (spec, plan, build, test, review, ship) | Native Claude Code plugin, else portable skills |
| [Ponytail](https://github.com/DietrichGebert/ponytail) | Quality review and simplification | Native Claude Code plugin, else portable skills |
| [OmniRoute](https://github.com/diegosouzapw/OmniRoute) | Optional model routing | Never installed; only observed |

## Statuses (what each one means)

Statuses are **observed** by looking at the machine and running the tools. `.devworkspace/state/integrations.json` only records history and is never trusted as proof.

| Status | Meaning |
| --- | --- |
| `NOT_INSTALLED` | Nothing found. |
| `PREREQUISITES_MISSING` | Cannot install automatically; the output says exactly what to install. |
| `INSTALLING` | A setup run is in progress (a leftover marker means it was interrupted; run `integrations repair --yes`). |
| `INSTALLED` | Files/config present, **not verified** (quick checks such as `devworkspace status` can never say more). |
| `VERIFIED` | The tool was run or queried and everything required for its documented capabilities checked out. |
| `DEGRADED` | Installed but incomplete or unhealthy; the warnings say what is missing (e.g. portable skills have no commands or hooks). |
| `FAILED` | The last setup attempt failed; the error and next step are shown and remembered. |
| `RESTART_REQUIRED` | Installed, but Claude Code must be restarted (or `/reload-plugins` run) to load it. Cleared by `integrations status --restarted`. |

"Full integration readiness" is stated only when every **required** integration (Graphify, Agent Skills, Ponytail) is `VERIFIED`. A missing integration never makes the core workspace unhealthy and never changes `doctor`'s exit code unless you pass `--strict` (exit 3).

Exit codes for `setup` / `integrations repair`: `0` every required integration `VERIFIED` or `RESTART_REQUIRED` (or a dry run) · `1` something `FAILED` or a prerequisite is missing · `2` approval needed (nothing risky ran) · `3` finished but not fully verified (`DEGRADED`/`INSTALLED`).

## Consent and scope

Every step has a level. Without `--yes` only **project** steps run; if any step needs more, nothing runs and the plan is printed.

| Level | Examples | Needs `--yes` |
| --- | --- | --- |
| project | `graphify install --project`, `claude plugin ... --scope project` | no |
| machine | `uv tool install graphifyy` (your user account, no administrator rights) | yes |
| user-config | any `--scope user` / `graphify install` (user-level skill) | yes |
| third-party-code | `npx skills add` (runs a registry package) | yes |

`--scope project` (default) keeps everything in the repository; `--scope user` installs for all your projects. DevWorkspace never passes `-y` to Claude Code's own plugin installer: if a marketplace wants you to approve a command, setup stops and prints it for you to run.

Setup is non-interactive. It never prompts, so it cannot hang in CI; when it needs a human it exits `2`/`1` with the exact next step.

## What happens, per tool

### Graphify

1. Reuse an existing `graphify` (PATH, `~/.local/bin`, or where uv/pipx/pip put scripts) after running `graphify --version`.
2. Otherwise pick an installer: **uv** (`uv tool install graphifyy`), else **pipx** (`pipx install graphifyy`), else the documented **`pip install --user graphifyy`** if a real Python 3.10+ exists. No separate manager is required when Python or uv is present.
3. Run `graphify install --project` (user scope: `graphify install`).
4. Verify: executable runs, project skill exists, the skill's recorded version matches the CLI, and, because Graphify's hooks call `graphify` by name, that it is on PATH. If it is not on this process's PATH the status is never a false success, and the advice depends on why: on **Windows**, DevWorkspace reads (never writes) the persistent user and machine PATH from the registry. If the folder is already there, the terminal or VS Code simply started before the change, so the status is `RESTART_REQUIRED` and the fix is to reopen the terminal or restart VS Code (no PATH edit). If it is missing from both, the status is `DEGRADED` with the folder to add. On macOS and Linux, or when the registry cannot be read, the persistent PATH is treated as unknown and the general advice is shown. Quick checks (`devworkspace status`) never query the registry.

Python detection runs `--version` on each candidate (`py -3`, `python3`, `python`). On Windows the Microsoft Store `python` shortcut exists on PATH but is not Python, and is correctly rejected.

**Graphify edits your files.** `graphify install --project` appends a section to `CLAUDE.md`, creates `.claude/CLAUDE.md` and registers Claude Code `PreToolUse` hooks in `.claude/settings.json`. It merges and is idempotent. DevWorkspace snapshots those files first and, if anything you had is missing afterwards, restores them and fails the step. Review `git diff` after setup. Building the graph itself (`/graphify .`) uses the model, so DevWorkspace does not do it. If Claude Code is already running when `setup --integrations` installs the project skill, run `/reload-plugins` in Claude Code before running `/graphify .`, otherwise Claude Code will report that `"/graphify" isn't installed in this session`.

### Agent Skills and Ponytail

1. **Native plugin** (preferred) when a Claude Code CLI ≥ 2.1.268 is available (PATH, or the binary bundled with the VS Code extension): register the marketplace (`addy-agent-skills`, `ponytail`) by HTTPS git URL, then `claude plugin install <plugin>@<marketplace> --scope project`. Already-registered marketplaces are not added again.
2. **Portable skills** otherwise, with the documented Skills CLI: `npx skills add <repo> --agent claude-code --skill '*' --copy -y --json` (copied files, telemetry opt-outs set, project scope; `-g` for user scope).
3. Verify with `claude plugin list --json` (enabled, no load errors, belongs to this project or user scope), or for portable installs by checking the skill folders.

What is reported, honestly:

| | Native plugin | Portable skills |
| --- | --- | --- |
| Skills | yes | yes |
| Slash commands | yes | **no** |
| Hooks | Ponytail: yes (needs `node` on PATH); Agent Skills: not claimed | **no** |
| Shared `references/` (Agent Skills) | yes | not installed by the Skills CLI (known upstream limitation, issue #361) → warning |
| Ponytail's always-on `AGENTS.md` ruleset | n/a | **not installed** (DevWorkspace never edits your `AGENTS.md`) |
| Resulting status | `RESTART_REQUIRED`, then `VERIFIED` | always `DEGRADED` |

A marketplace being registered does not count as the plugin being installed; the two are checked separately. A same-named skill folder you wrote yourself is never overwritten: setup stops with an explanation.

Portable installs record license/attribution in `.devworkspace/THIRD_PARTY_NOTICES.md` (both are MIT; the notice names the copyright holders).

## Where generated files live

DevWorkspace-owned data is under `.devworkspace/` (`context/`, `decisions/`, `tasks/`, `sessions/`, `analysis/`, `state/`, `local/`). Anything an agent or an external tool must find at a fixed location stays there. DevWorkspace edits only its managed sections of those files.

| Path | Owner | Why it is where it is |
| --- | --- | --- |
| `.devworkspace/**` | DevWorkspace | Portable knowledge is tracked; `local/`, `state/integrations.json`, generated prompts and `graph/` are git-ignored. |
| `.mcp.json` (Claude Code), `.codex/config.toml` (Codex) | Agent | MCP clients read these project files. Antigravity's MCP config is user-level (`~/.gemini/.../mcp_config.json`) and written only with explicit `--user`. |
| `CLAUDE.md`, `AGENTS.md`, `.claude/` | Agent | Instruction and skill discovery. |
| `graphify-out/` | **Graphify** | `graphify update`, the `/graphify` skill and its hooks hardcode the project-root `graphify-out/`. Graphify (0.9.x) has no setting to relocate it for those commands, so DevWorkspace does not move it and does not use symlinks or junctions to fake it. |

The only relocation Graphify supports is `graphify extract <path> --out .devworkspace/graph/graphify`, which writes `.devworkspace/graph/graphify/graphify-out/`. DevWorkspace reads either location (`devworkspace graph status`, MCP tools). If Graphify is not installed or Claude Code is not available, `devworkspace graph generate` can extract code structure directly into an offline fallback graph. If both exist it reads the most recently written one and `devworkspace doctor` warns; nothing is copied, moved or deleted automatically.

**Existing workspaces need no migration.** The layout above is unchanged for them; `devworkspace init` is idempotent and only appends the `graph/` ignore rule to `.devworkspace/.gitignore` without touching your lines.

## Protection, idempotency and recovery

- Before each setup run, the files tools may edit (`CLAUDE.md`, `.claude/CLAUDE.md`, `AGENTS.md`, `.claude/settings*.json`) and every existing file under `.claude/skills/` are snapshotted. After each step they are verified: text files may only gain lines, JSON may only gain keys, existing skill files must be byte-identical. Violations are restored and reported.
- Re-running is safe: verified integrations are skipped, a pending restart is not "fixed" by reinstalling, marketplaces are never added twice, `CLAUDE.md` gets one Graphify section.
- If a run fails halfway the state is kept (`FAILED`, last error) and the next run resumes from what is observed on disk. If the process was killed, the leftover marker is detected and `integrations repair --yes` finishes the job. Ctrl+C cancels the running child process.
- Child processes use argument arrays with timeouts (no shell). Windows `.cmd` shims go through a strictly validated `cmd.exe` call that rejects any argument containing shell metacharacters.
- Tool output is scrubbed (secrets, absolute paths) before it is shown or stored. Credentials are never read.
- Nothing is ever uninstalled. DevWorkspace has no `uninstall`: removing Claude Code plugins is `claude plugin uninstall`, and Graphify has `graphify uninstall`; run them yourself.

## Verified vs. assumed (as of 2026-10-09, Windows 11)

Verified **live** on a real machine: `uv tool install graphifyy` and `graphify install --project` (0.9.80 and 0.9.82, files written, merge behaviour, idempotency), `graphify --version`, discovery of uv tool bin directories, Claude Code 2.1.295 `--version`/`plugin list --json`, the failure JSON of `plugin marketplace add`, SSH vs HTTPS clone behaviour and its failure messages.
Verified with **controlled fake CLIs** (real child processes, `.cmd` shims, folders with spaces) and scripted runners: the successful native-plugin and Skills-CLI paths, restart handling, repair, cancellation, approval prompts. GitHub was unreachable from the build machine for large clones, so a **real end-to-end native plugin install and a real `npx skills add` were not completed**. Their command lines and JSON shapes follow the official documentation and the observed failure output.
**Not tested:** macOS, Linux, pipx, `pip install --user` for real, Claude Code versions other than 2.1.295.

## Limitations

- The native-plugin path depends on Claude Code cloning GitHub sources over SSH; without a GitHub SSH key it fails. The setup output then shows the documented fix (`git config --global url."https://github.com/".insteadOf git@github.com:`), which changes your global Git config and is therefore left for you to run.
- Detection of the Claude Code CLI uses PATH and the VS Code/Cursor extension folders; other installs may need to be on PATH.
- DevWorkspace cannot tell whether a running Claude Code session has loaded a plugin; `RESTART_REQUIRED` stays until you acknowledge it.
- Graphify's hooks live in the project's `.claude/settings.json`, so teammates need `graphify` installed too (setup run on their machine does it).
- OmniRoute is only observed.

## Adding an integration

Implement `IntegrationAdapter` (`src/integrations/types.ts`): `inspect(ctx, deep)` must observe reality (never read the state file as proof) and only return `VERIFIED` when `deep` and every check passed; `plan(ctx, report)` returns steps with a consent `level`, the files they may touch (`protectPaths`) and blockers with exact remediation. Register it in `ADAPTERS`, then test it with `FakeRunner` (see `tests/helpers/fakeRunner.ts`) for: installed, missing, partial, prerequisites missing, timeout, permission denied, cancellation, user-file protection and repeated runs.
