@ory/claude-code 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,168 +1,99 @@
1
1
  # Ory Agent Plugin: Claude Code
2
2
 
3
- [Ory](https://ory.com) bundled into [Claude Code](https://docs.anthropic.com/en/docs/claude-code): skills and slash commands that scaffold Ory authentication into your codebase, a local Ory stack you can spin up in one command, and (when pointed at an Ory project) authentication, authorization, and audit for every tool Claude runs.
3
+ Security and developer experience for [Claude Code](https://docs.anthropic.com/en/docs/claude-code), powered by [Ory](https://ory.com).
4
4
 
5
- You don't need an Ory account or any prior Ory experience to start.
5
+ **Security.** Claude runs real actions on your machine — editing files, running shell commands, calling APIs. The plugin gives every session a verifiable identity (you sign in once; Claude and any sub-agents it spawns each get their own), checks every tool call against permissions you control, and records each decision as an audit trace you can ship to your observability stack. It starts in watch mode so nothing is blocked on day one, and if Ory is ever unreachable it steps aside rather than locking you out.
6
6
 
7
- ## New to Ory?
7
+ **Developer experience.** A single command installs the plugin and walks you through connecting — choose Ory Network, a local Docker stack, or audit-only, and it wires up the project, sign-in client, login, and permissions for you. It also helps you build Ory into your own app: ask in plain language to scaffold login, registration, and recovery pages, run a local Ory, or manage identities and permissions through the bundled MCP server.
8
8
 
9
- [Ory](https://www.ory.com/docs/) is an open-source identity and access platform — it provides login, registration, sessions, social sign-in, multi-factor auth, and fine-grained permissions, so you don't have to build any of that yourself. Two things make it easy to try with no prior experience:
9
+ ## What you'll need
10
10
 
11
- - **Ory Elements** are prebuilt, themeable UI components for the auth pages (login, registration, recovery, settings). The scaffolding skills wire them into your app for you.
12
- - **The local Ory stack** is a complete Ory running on your laptop in Docker — no account, no signup, no API key. Everything in the Quickstart below works against it, fully offline.
11
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code), installed and signed in
12
+ - Node.js **22 or newer**
13
+ - [Docker](https://docs.docker.com/get-docker/) — only if you want to run Ory locally
14
+ - macOS or Linux (Windows works via WSL2)
13
15
 
14
- This plugin does two independent things, and you can use either on its own:
16
+ ## Get started
15
17
 
16
- 1. **Build auth into your app.** Have Claude scaffold Ory login, registration, social sign-in, and permissions into the project you're working on, backed by the local stack. This is the Quickstart below — it needs nothing but Docker.
17
- 2. **Govern the agent itself.** Authenticate Claude's own session and authorize every tool it runs against Ory Permissions, with a full audit trail. See [Agent security](#agent-security).
18
-
19
- If you're just exploring, do the Quickstart first.
20
-
21
- ## Prerequisites
22
-
23
- - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed and signed in
24
- - Node.js **≥ 22**
25
- - [Docker](https://docs.docker.com/get-docker/) (only needed for the local Ory stack)
26
- - macOS or Linux. Windows works via WSL2.
27
-
28
- ## Install
29
-
30
- Inside Claude Code:
31
-
32
- ```
33
- /plugin marketplace add ory/claude-plugins
34
- /plugin install ory-agent-plugin@ory
35
- ```
36
-
37
- Then confirm everything landed:
18
+ Run one command. It installs the plugin and walks you through connecting:
38
19
 
39
20
  ```bash
40
- npx -y -p @ory/claude-code ory-claude status
21
+ npx -y -p @ory/claude-code ory-claude install
41
22
  ```
42
23
 
43
- `status` is the single source of truthit prints configuration, user and agent identity, per-tool permission coverage, hook + skill registration, and a tail of recent debug logs. Unconfigured fields show inline as `(unset)`.
24
+ You'll be asked how you want to connect **press Enter for the default**:
44
25
 
45
- <details>
46
- <summary>Alternative install path (no Claude Code session required)</summary>
26
+ - **Ory Network** *(default)* — sign in, or create a free account, in your browser. The project, keys, permissions, and login are all set up for you. Nothing to configure by hand.
27
+ - **Local** run a complete Ory on your laptop with Docker. No account, no signup, no keys. Great for trying it out.
28
+ - **Audit-only** — skip Ory entirely and just log what Claude does.
29
+
30
+ That's it. Confirm everything landed with:
47
31
 
48
32
  ```bash
49
- npx -y -p @ory/claude-code ory-claude install # current project
50
- npx -y -p @ory/claude-code ory-claude install --global # all projects (user scope)
51
- npx -y -p @ory/claude-code ory-claude uninstall
33
+ npx -y -p @ory/claude-code ory-claude status
52
34
  ```
53
35
 
54
- The installer requires the `claude` CLI on `PATH`.
55
-
56
- </details>
57
-
58
- ## Quickstart
59
-
60
- From any project where you'd like Ory authentication, inside Claude Code:
36
+ `status` is your one-stop check: what's configured, who's signed in, which tools are covered by permissions, and recent activity. Anything not set up yet shows as `(unset)`.
61
37
 
62
- 1. **Start a local Ory instance.** *(~1 min. Requires Docker running.)* Ask Claude *"start the local Ory stack"* or run the slash command:
38
+ > Prefer to install from inside Claude Code? Run `/plugin marketplace add ory/claude-plugins` then `/plugin install ory-agent-plugin@ory`. That registers the plugin but skips the guided setup — run `ory-claude install` (or `configure`) in a terminal afterwards to connect. Re-run install with `--reconfigure` to change your connection later, or `--no-configure` to skip the wizard.
63
39
 
64
- ```
65
- /ory-agent-plugin:local-up
66
- ```
40
+ ## What you get
67
41
 
68
- A banner prints the seeded test user's email and password. Note them you'll log in with them in step 3.
42
+ Once connected, every tool Claude runs is governed by Orythree things happen automatically:
69
43
 
70
- 2. **Scaffold Ory into your project.** *(~5–10 min, depending on your project.)* Ask Claude *"add Ory auth to this app"*. The `ory-auth-setup` skill takes over: it installs Ory Elements, wires the SDK, generates the login / registration / recovery / verification / settings pages, and sets up session middleware. It targets the local stack from step 1, so no signup or API key is needed.
44
+ - **Who's driving.** You sign in once in your browser; Claude (and any sub-agents it spawns) each get their own identity. No tokens to copy around, and the "who acted on whose behalf" trail stays queryable later.
45
+ - **What it's allowed to do.** Before a tool runs, Ory checks whether it's permitted. It starts in **watch mode** — nothing is blocked, you just *see* what would be — so it never gets in your way on day one.
46
+ - **A record of everything.** Every decision (allowed, denied, skipped) is logged as a trace you can send to Jaeger, Honeycomb, Grafana, or just a file.
71
47
 
72
- 3. **Sign in.** Start your app, visit the login page Claude added, and sign in with the seeded credentials. You now have a real Ory session backed by a real Ory stack — locally, offline, with zero configuration.
48
+ If Ory is ever unreachable, the plugin gets out of the way and lets Claude keep working so it can't lock you out.
73
49
 
74
- 4. **Turn on Ory login for the Claude session itself.** *(Optional but recommended.)* Out of the box the plugin only governs your *app*. To also attach an Ory identity to *Claude's* session — so every tool call is attributed to you, not a fallback `session:<id>` subject — opt in to the user-login flow:
50
+ ### See what's happening
75
51
 
76
- ```bash
77
- export ORY_USER_LOGIN=true
78
- export ORY_OAUTH2_CLIENT_ID=<value printed by `local up`>
79
- ```
52
+ Everything the plugin does is observable out of the box — no configuration required:
80
53
 
81
- User login is off by default. Both exports above are printed in the `local up` banner copy them straight from there. `ORY_OAUTH2_CLIENT_ID` is required whenever `ORY_USER_LOGIN` is on: it identifies the public OAuth2 client the PKCE browser flow exchanges for a token. With both set, the next Claude session opens an Ory login in your browser; sign in with the same seeded credentials from step 1, and the token is reused on subsequent sessions until it expires. This is what makes `permissions enforce` (see [Agent security](#agent-security)) deny on the right identity later.
54
+ - **Status at a glance.** `npx -y -p @ory/claude-code ory-claude status` shows what's configured, who's signed in, how many built-in tools your permissions cover, and the most recent tool-call activity.
55
+ - **Live traces.** Every tool call is recorded as an OpenTelemetry-style span. Watch them stream as the agent works:
82
56
 
83
- That's the full Ory DX path. Stop here if you're just evaluating the plugin. Continue to [Agent security](#agent-security) when you're ready to enforce.
57
+ ```bash
58
+ npx -y -p @ory/claude-code ory-claude watch
59
+ ```
84
60
 
85
- ## What's included
61
+ Spans are also written to `~/.config/ory-agent-plugins/claude-code/ory-agent-trace.ndjson` (NDJSON, one span per line) — tail that file, or point `OTEL_EXPORTER_OTLP_ENDPOINT` at a collector to ship them straight to Jaeger, Honeycomb, or Grafana.
62
+ - **Debug log.** For a verbose play-by-play, set `ORY_AGENT_DEBUG=true`; structured logs land in `~/.config/ory-agent-plugins/claude-code/ory-agent-debug.log`.
86
63
 
87
- ### Skills for scaffolding Ory into your application
64
+ ### Ready to enforce?
88
65
 
89
- Each skill is a vetted, end-to-end playbook. Skills are model-invoked ask Claude in natural language and the matching skill takes over. New to Ory? Start with the first group.
66
+ When the watch-mode logs look right, turn on blocking with one command (setup already granted you the built-in tools):
90
67
 
91
- **Start here — add Ory auth to your app:**
92
-
93
- - **`ory-auth-setup`** *(e.g. "set up Ory auth in this project")* — full project setup. Install the Ory CLI, create an Ory Network project (or use the local one), add Ory Elements, configure the SDK, build the auth pages, wire session middleware.
94
- - **`ory-login-flow`** *(e.g. "add login and registration pages with Ory Elements")* — login, registration, recovery, verification, and settings pages with Ory Elements. Next.js App Router and React SPA variants.
95
- - **`ory-social-login`** *(e.g. "add Google sign-in via Ory")* — Google, GitHub, Apple, Microsoft, Discord, and other OIDC providers with Jsonnet data mappers.
96
- - **`ory-local-dev`** *(e.g. "run the local Ory stack")* — drive the local Ory stack from within Claude to prototype and test without a remote project.
97
-
98
- **Going further:**
99
-
100
- - **`ory-permissions-onboarding`** *(e.g. "grant me use on the Bash tool")* — walk through writing the Ory Permissions that let the plugin enforce per-tool access.
101
- - **`ory-build-integration`** *(e.g. "wire an Ory webhook into my app")* — pull the runnable subset of an `ory/integrates` template (webhook / config / http-event) into the user's own app and wire it to their Ory project — no contribution/registry concerns.
102
- - **`ory-contribute-integration`** *(e.g. "contribute a new Ory integration")* — author a brand-new integration as a contribution to `ory/integrates`, including `registry.entry.yaml`, the `Maintained by:` footer, DCO sign-off, and registry regeneration.
103
- - **`ory-e2b-sandbox`** *(e.g. "create my e2b sandbox with ory agent security")* — scaffold an [E2B](https://e2b.dev) sandbox template that boots with this plugin preinstalled and registered, so every sandbox session is gated by Ory auth, permissions, and tracing without any per-sandbox setup.
104
- - **`ory-build-agent`** *(e.g. "wire Ory into my own agent")* — drop `@ory/argus` directly into a custom agent you own (Claude Agent SDK, OpenAI Agents SDK, Mastra, Vercel AI SDK, PydanticAI, LangGraph, Mistral AI, or Salesforce Agentforce) so the user is authenticated, every tool call is authorized against Ory Permissions, and the lifecycle emits trace spans.
105
- - **`ory-temporal-worker`** *(e.g. "wire Ory into my Temporal worker")* — scaffold a [Temporal](https://temporal.io) TypeScript worker per the [official local-dev guide](https://docs.temporal.io/develop/typescript/set-up-your-local-typescript), with every Activity gated by an Ory permission check, the worker's agent identity resolved via DCR, and the full lifecycle emitting trace spans.
106
-
107
- ### Ory MCP server
108
-
109
- Bundled and registered automatically. Exposes the Ory CLI and the Ory Network REST API as MCP tools so Claude can manage identities, OAuth2 clients, projects, permissions, and configuration without ever leaving the chat. Useful for seeding test data, verifying a scaffolded integration, or running one-off admin tasks.
110
-
111
- ### Local Ory stack
112
-
113
- ```
114
- /ory-agent-plugin:local-up # start a local Ory instance in Docker
115
- /ory-agent-plugin:local-down # tear it all down
116
- /ory-agent-plugin:temporal-up # start a local Temporal dev server (for ory-temporal-worker)
68
+ ```bash
69
+ npx -y -p @ory/claude-code ory-claude permissions enforce
117
70
  ```
118
71
 
119
- `local-up` runs a complete Ory on your laptop: the Ory APIs (Identities, OAuth2, Permissions) at `http://localhost:4000`, a login UI on `:4455` (not :3000, to avoid Next.js port conflicts), and Jaeger (the trace viewer) on `:16686`. A test user identity is seeded and its credentials are printed for you. Use it to:
72
+ Now a denied tool is actually blocked and Claude shows why. Go back to watch mode anytime with `permissions observe`. Use `permissions status` to see what's covered and `permissions bootstrap` to (re-)grant the built-in tools or just ask Claude in chat, e.g. *"grant me use of the Bash tool."*
120
73
 
121
- - **Learn Ory hands-on** without signing up for a hosted project.
122
- - **Prototype** flows (login, social, MFA, recovery, permissions) against a real Ory backend.
123
- - **Test** an auth integration end-to-end before pushing anything to a real environment.
124
- - **Develop** your application against the same identity, OAuth2, and permission surfaces you'll ship with.
74
+ ## Also: add login to your own app
125
75
 
126
- ## Pointing at a real Ory project
76
+ Beyond securing Claude, the plugin helps you build Ory into whatever you're working on. Ask Claude *"add Ory login to this app"* and it scaffolds the login, registration, recovery, and settings pages (using [Ory Elements](https://github.com/ory/elements)) wired to a local Ory — no signup or keys needed. Start that local Ory with `/ory-agent-plugin:local-up` (it prints a test email + password to sign in with) and tear it down with `/ory-agent-plugin:local-down`.
127
77
 
128
- The Quickstart uses the local stack. If you have a hosted [Ory Network](https://console.ory.sh) project (Ory's managed cloud), point the plugin at it with a single configure command. **The plugin requires `--oauth2-client-id` whenever `--project-url` is provided** register the client first (see [Register the user OAuth2 client](#register-the-user-oauth2-client) below), then run:
78
+ Bundled **skills** (just ask in plain language) cover more: `ory-auth-setup`, `ory-login-flow`, `ory-social-login` (Google, GitHub, Apple…), `ory-permissions-onboarding`, and playbooks for wiring Ory into your own agents, E2B sandboxes, or Temporal workers. A built-in **Ory MCP server** lets Claude manage identities, projects, and permissions straight from chat.
129
79
 
130
- ```bash
131
- npx -y -p @ory/claude-code ory-claude configure \
132
- --project-url https://<id>.projects.oryapis.com \
133
- --oauth2-client-id <public OAuth2 client id>
134
- ```
135
-
136
- - **`--project-url`** points the plugin at your project. The **agent identity** (machine credentials for Claude's outgoing Ory API calls) is created automatically on first run via OAuth2 Dynamic Client Registration ([RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591)) against the project's `/oauth2/register` endpoint — no manual step required for that one.
137
- - **`--oauth2-client-id`** is required because the **user** PKCE browser flow (triggered by `ORY_USER_LOGIN=true`) cannot self-register — you must register a public OAuth2 client ahead of time and supply its id here. The configure command refuses to save a project URL without it, so you don't end up with a silently-broken setup later. See [Register the user OAuth2 client](#register-the-user-oauth2-client) below for the exact CLI / Console steps.
138
- - **`--api-key ory_pat_...`** is optional — pass it only if you want to override the auto-registered agent identity with a static personal access token (operator override; rarely needed).
80
+ ## Configure by hand (CI / advanced)
139
81
 
140
- If you only want audit logging (no auth or permission checks), substitute `--audit-only` the OAuth2 client id is not required in that mode:
82
+ The guided setup covers most people. For scripted or CI setups, or to point at an existing Ory Network project, configure directly. Settings are saved to `~/.config/ory-agent-plugins/config.json` and shared across all your Ory agent plugins; environment variables win when both are set.
141
83
 
142
84
  ```bash
143
- npx -y -p @ory/claude-code ory-claude configure --audit-only
85
+ npx -y -p @ory/claude-code ory-claude configure \
86
+ --project-url https://<slug>.projects.oryapis.com \
87
+ --oauth2-client-id <login client id> \
88
+ --user-login
144
89
  ```
145
90
 
146
- The same settings can be supplied via environment variables (`ORY_PROJECT_URL`, `ORY_OAUTH2_CLIENT_ID`, `ORY_AGENT_API_KEY`) env vars take precedence over the config file when both are set, which is what most CI / scripted setups want.
147
-
148
- Config is saved to `~/.config/ory-agent-plugins/config.json` and shared across every Ory agent plugin on the machine.
149
-
150
- Without any configuration the plugin still loads cleanly and runs in **pass-through mode**: skills, slash commands, and audit logging work, but no permission checks run, so nothing is ever blocked. You can stay in pass-through mode indefinitely if you only want the DX features.
151
-
152
- ### Register the user OAuth2 client
91
+ Claude's own identity registers itself automatically on first run nothing to create. The `--oauth2-client-id` is the one piece browser sign-in needs; the guided setup makes it for you, or see below to do it by hand. For logging-only with no checks, use `--audit-only`.
153
92
 
154
- If you plan to turn on `ORY_USER_LOGIN=true` (recommended — it's what attributes every tool call to *you* rather than a fallback `session:<id>` subject), your hosted Ory project needs a **public** OAuth2 client (no client secret) registered ahead of time. The local stack provisions this for you automatically; against a hosted project you have to register it once yourself.
155
-
156
- The client must list **all four** loopback ports as redirect URIs:
157
-
158
- - `http://127.0.0.1:47823/callback`
159
- - `http://127.0.0.1:47824/callback`
160
- - `http://127.0.0.1:47825/callback`
161
- - `http://127.0.0.1:47826/callback`
162
-
163
- The plugin walks the four ports at runtime so the login can survive any one of them being occupied — Ory rejects the callback if the port it lands on isn't on the registered list, so register all four.
93
+ <details>
94
+ <summary>Create the sign-in client by hand</summary>
164
95
 
165
- Create the client with the [Ory CLI](https://www.ory.com/docs/guides/cli/installation):
96
+ The guided setup normally does this. To do it yourself, create a **public** OAuth2 client (no secret) listing all four loopback URLs — the plugin tries each in turn so sign-in survives a busy port:
166
97
 
167
98
  ```bash
168
99
  ory create oauth2-client --project <project-id> \
@@ -177,103 +108,37 @@ ory create oauth2-client --project <project-id> \
177
108
  --redirect-uri http://127.0.0.1:47826/callback
178
109
  ```
179
110
 
180
- …or in the [Ory Console](https://console.ory.sh) under *OAuth2* → *Clients* → *Create client* (pick "Public client", set "Authorization Code" + "Refresh Token" grants, scopes `openid offline_access`, paste the four redirect URIs above). Then persist the issued id with the configure command (preferred — survives across sessions):
181
-
182
- ```bash
183
- npx -y -p @ory/claude-code ory-claude configure \
184
- --project-url https://<id>.projects.oryapis.com \
185
- --oauth2-client-id <client-id from the step above>
186
- ```
187
-
188
- …or set it in the environment alongside `ORY_USER_LOGIN`:
189
-
190
- ```bash
191
- export ORY_USER_LOGIN=true
192
- export ORY_OAUTH2_CLIENT_ID=<client-id from the step above>
193
- ```
194
-
195
- Headless / CI runs that already hold a session token can skip this entirely by setting `ORY_USER_SESSION_TOKEN` instead — no browser flow runs, so no OAuth2 client is needed.
196
-
197
- ## Agent security
198
-
199
- Once the plugin is pointed at an Ory project (local or hosted), Claude's session and every tool call can be governed by Ory.
200
-
201
- - **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when user login is enabled (`ORY_USER_LOGIN=true`, off by default — browser PKCE flow on first session, persisted token thereafter). The Claude process (the **agent**) gets its own OAuth2 identity, self-registered via [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) on first run. Sub-agents launched by the `Task` tool each receive their own typed identity.
202
- - **Authorization.** Before any tool runs, the plugin checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relations) against the user's subject and blocks the call on `deny`. MCP tool calls additionally get a server-level check.
203
- - **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user → agent (and agent → subagent) delegation chain is written to Ory as relations so *"agent X acting on behalf of user Y"* stays queryable after tokens expire.
204
-
205
- The plugin is **fail-open** on its own infrastructure failures (network errors, rate limits, missing config), so enforcement is only as strong as your permission grants — grant explicit `use` on the tools each user should be able to run.
111
+ Pass the resulting id to `configure --oauth2-client-id`. Running headless with a session token already? Set `ORY_USER_SESSION_TOKEN` and skip the browser step entirely.
206
112
 
207
- ### Enable enforcement
208
-
209
- With an Ory project configured, the plugin runs in **observe mode** by default: every tool call is checked against Ory Permissions, a deny is recorded as a `permission.observe_deny` audit span, and the tool runs anyway. This lets you see what *would* be blocked before turning on hard blocking. (Without a project configured, the plugin is in pass-through mode — no checks run at all.)
210
-
211
- 1. **Turn on user login.** It's off by default. In your shell:
212
-
213
- ```bash
214
- export ORY_USER_LOGIN=true
215
- export ORY_OAUTH2_CLIENT_ID=<public OAuth2 client id>
216
- ```
217
-
218
- The next Claude session opens a browser for PKCE login. Subsequent sessions reuse the persisted token until it expires.
219
-
220
- `ORY_OAUTH2_CLIENT_ID` is required when `ORY_USER_LOGIN` is on: PKCE needs a public OAuth2 client registered with the four loopback redirect URIs (`http://127.0.0.1:47823..47826/callback`) to exchange the authorization code for a token. The local stack provisions one and prints the export in its `local up` banner; for a hosted Ory project see [Register the user OAuth2 client](#register-the-user-oauth2-client) for the exact CLI / Console steps. Headless / CI runs can skip the browser flow entirely by pre-supplying `ORY_USER_SESSION_TOKEN` instead.
221
-
222
- 2. **Bootstrap permissions for the built-in tools.** One idempotent command grants the current user `use` on every tool Claude ships with (Read, Write, Bash, …):
223
-
224
- ```bash
225
- npx -y -p @ory/claude-code ory-claude permissions bootstrap
226
- ```
227
-
228
- If a user identity is already cached at install time, the installer runs this for you automatically — re-run after adding tools, switching subjects, or changing the namespace.
229
-
230
- 3. **Check coverage.** `permissions status` probes every tool in the harness's catalog and prints allowed / denied per tool:
231
-
232
- ```bash
233
- npx -y -p @ory/claude-code ory-claude permissions status
234
- ```
235
-
236
- Add permissions for any MCP server tools or custom commands by hand, or via the Ory MCP server from inside Claude (*"grant me use on the Bash tool"*).
237
-
238
- 4. **Promote to enforce.** Once the observe-mode logs look right, switch over:
239
-
240
- ```bash
241
- npx -y -p @ory/claude-code ory-claude permissions enforce
242
- ```
113
+ </details>
243
114
 
244
- Denies now block the tool call; Claude shows the denial reason and the decision is recorded as a `tool.block` trace span with `blocked: true`. Switch back any time with `permissions observe`.
115
+ With nothing configured, the plugin still loads and runs in **pass-through mode**: skills, commands, and logging work, but no checks run and nothing is blocked. Perfectly fine if you only want the app-building features.
245
116
 
246
- ## CLI reference
117
+ ## Commands
247
118
 
248
119
  ```
249
- npx -y -p @ory/claude-code ory-claude install | uninstall [--global]
250
- npx -y -p @ory/claude-code ory-claude configure [--project-url <url> --oauth2-client-id <id>] [--api-key <key>] [--audit-only]
251
- npx -y -p @ory/claude-code ory-claude agent <status|unregister> Manage the agent's OAuth2 identity
252
- npx -y -p @ory/claude-code ory-claude permissions <status|bootstrap|observe|enforce>
253
- npx -y -p @ory/claude-code ory-claude local <up|down|status|seed|logs|env|configure|reset>
254
- npx -y -p @ory/claude-code ory-claude status
120
+ ory-claude install | uninstall Install/remove; --reconfigure re-runs setup, --no-configure skips it
121
+ ory-claude status Show configuration, identities, permission coverage, recent activity
122
+ ory-claude watch Tail the live trace stream (OTel spans)
123
+ ory-claude permissions <cmd> status | bootstrap | observe (watch) | enforce (block)
124
+ ory-claude configure <flags> Point at a project by hand (--project-url, --oauth2-client-id, --user-login, --audit-only)
125
+ ory-claude agent <status|unregister> Manage Claude's own auto-created identity
126
+ ory-claude local <up|down|status|…> Run / manage a local Ory in Docker
255
127
  ```
256
128
 
257
- Highlights:
258
-
259
- - `agent status` — show the current persisted DCR identity for the agent.
260
- - `permissions observe` / `permissions enforce` — switch between "log denies, allow through" (the install default) and "block denies." `permissions bootstrap` writes `use` permissions for the harness's built-in tools so the promotion path doesn't require hand-writing relations.
261
- - `configure --audit-only` — kill switch that disables Ory entirely (no auth, no permission checks; only audit logging of tool invocations). For phased rollouts, prefer `permissions observe` over `--audit-only`.
262
- - `local seed` / `local env` — reseed the test user, or print env vars for pointing other tools at the local stack.
129
+ All prefixed with `npx -y -p @ory/claude-code`.
263
130
 
264
131
  ## Troubleshooting
265
132
 
266
- - **`/ory-agent-plugin:local-up` fails.** Make sure Docker is running and ports `4455` (login UI), `4000`, `4100`, and `16686` are free.
267
- - **PKCE login loops.** Clear persisted state with `npx -y -p @ory/claude-code ory-claude agent unregister` and retry.
268
- - **`npx` fetches an old version.** Force a fresh fetch: `npx -y -p @ory/claude-code@latest ory-claude …`.
269
- - **Hooks pinned to an old plugin version.** After a plugin upgrade, run `/plugin marketplace update ory` inside Claude Code (or re-run the npx installer) so the hook commands and MCP server pick up the new release.
270
- - **Need more signal.** Set `ORY_AGENT_DEBUG=true` and `ORY_AGENT_LOG_FILE=/tmp/ory.log` to capture structured logs.
133
+ - **`local-up` fails** make sure Docker is running and ports `4000`, `4100`, `4455`, and `16686` are free.
134
+ - **Browser sign-in loops** reset with `ory-claude agent unregister` and try again.
135
+ - **`npx` grabbed an old version** force the latest: `npx -y -p @ory/claude-code@latest ory-claude …`.
136
+ - **Hooks stuck on an old version** run `/plugin marketplace update ory` inside Claude Code, or re-run the installer.
137
+ - **Want to see what's happening** — `npx -y -p @ory/claude-code ory-claude status` for a snapshot, `npx -y -p @ory/claude-code ory-claude watch` for the live trace stream, or set `ORY_AGENT_DEBUG=true` for a verbose log. Traces and logs live under `~/.config/ory-agent-plugins/claude-code/` (see [See what's happening](#see-whats-happening)).
271
138
 
272
- ## Links
139
+ ## Learn more
273
140
 
274
- - [Ory documentation](https://www.ory.com/docs/)
275
- - [Ory Network console](https://console.ory.sh)
276
- - [Ory Elements](https://github.com/ory/elements)
141
+ - [Ory documentation](https://www.ory.com/docs/) · [Ory Console](https://console.ory.sh) · [Ory Elements](https://github.com/ory/elements)
277
142
  - [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code)
278
143
 
279
144
  ## License
package/dist/cli/main.js CHANGED
@@ -54,14 +54,19 @@ function main() {
54
54
  const [command, ...args] = process.argv.slice(2);
55
55
  switch (command) {
56
56
  case "install":
57
+ (0, argus_1.beginDeferNextSteps)();
57
58
  (0, setup_js_1.install)(args);
58
- postInstallPermissions("ory-claude", "claude-code").then(() => process.exit(0), (err) => {
59
+ (0, argus_1.runPostInstall)("ory-claude", "claude-code", args).then(() => process.exit(0), (err) => {
59
60
  console.error(err.message ?? err);
60
61
  process.exit(1);
61
62
  });
62
63
  break;
63
64
  case "uninstall":
64
65
  (0, setup_js_1.uninstall)(args);
66
+ (0, argus_1.clearCredentialsForUninstall)().then(() => process.exit(0), (err) => {
67
+ console.error(err.message ?? err);
68
+ process.exit(1);
69
+ });
65
70
  break;
66
71
  case "configure":
67
72
  (0, argus_1.runConfigureCommand)("ory-claude", args);
@@ -90,6 +95,9 @@ function main() {
90
95
  process.exit(1);
91
96
  });
92
97
  break;
98
+ case "watch":
99
+ (0, argus_1.runWatchCommand)("claude-code", args);
100
+ break;
93
101
  case "help":
94
102
  case "--help":
95
103
  case "-h":
@@ -102,12 +110,6 @@ function main() {
102
110
  process.exit(1);
103
111
  }
104
112
  }
105
- async function postInstallPermissions(binName, harness) {
106
- const bootstrapped = await (0, argus_1.maybeAutoBootstrap)(binName, harness);
107
- (0, argus_1.printPermissionsOnboardingHelp)(binName, harness, {
108
- bootstrappedAutomatically: bootstrapped,
109
- });
110
- }
111
113
  async function status() {
112
114
  await (0, argus_1.runStatusCommand)("ory-claude", "claude-code", {
113
115
  title: "Claude Code",
@@ -133,7 +135,7 @@ ory-claude — Ory plugin for Claude Code
133
135
 
134
136
  Usage:
135
137
  npx @ory/claude-code <command> [options]
136
- npx ory-claude <command> [options]
138
+ npx -y -p @ory/claude-code ory-claude <command> [options]
137
139
 
138
140
  Commands:
139
141
  install [--global] Install Ory plugin via claude CLI marketplace
@@ -142,15 +144,16 @@ Commands:
142
144
  agent <cmd> Manage the agent's OAuth2 (DCR) identity (status, unregister)
143
145
  permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
144
146
  status Show plugin status and configuration
147
+ watch [trace-file] Tail the trace stream (OTel spans) live
145
148
  local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
146
149
 
147
150
  Examples:
148
151
  npx @ory/claude-code install # Install remotely (no prior npm install needed)
149
152
  npx @ory/claude-code install --global # Install globally (user scope)
150
- npx ory-claude install # Install from local/global npm installation
151
- npx ory-claude configure --project-url https://your-project.projects.oryapis.com --api-key ory_pat_...
152
- npx ory-claude status # Check configuration
153
- npx ory-claude uninstall # Remove plugin
153
+ npx -y -p @ory/claude-code ory-claude install # Install from local/global npm installation
154
+ npx -y -p @ory/claude-code ory-claude configure --project-url https://your-project.projects.oryapis.com --api-key ory_pat_...
155
+ npx -y -p @ory/claude-code ory-claude status # Check configuration
156
+ npx -y -p @ory/claude-code ory-claude uninstall # Remove plugin
154
157
  `);
155
158
  }
156
159
  main();
package/dist/cli/setup.js CHANGED
@@ -246,10 +246,10 @@ function install(args) {
246
246
  installFromProductionMarketplace(scope);
247
247
  }
248
248
  (0, argus_1.printNextSteps)("Claude Code", fromSource
249
- ? "npx ory-claude uninstall --from-source"
249
+ ? "npx -y -p @ory/claude-code ory-claude uninstall --from-source"
250
250
  : isRemoteContext()
251
251
  ? "npx @ory/claude-code uninstall"
252
- : "npx ory-claude uninstall");
252
+ : "npx -y -p @ory/claude-code ory-claude uninstall", { binName: "ory-claude", harness: "claude-code" });
253
253
  }
254
254
  /**
255
255
  * Default production install path: register the `ory/claude-plugins` GitHub
@@ -401,7 +401,7 @@ if (require.main === module) {
401
401
  ory-claude-setup — Install or remove the Ory plugin for Claude Code
402
402
 
403
403
  Usage:
404
- npx ory-claude-setup [options]
404
+ npx -y -p @ory/claude-code ory-claude-setup [options]
405
405
 
406
406
  Options:
407
407
  --global Install to user scope (default: project scope)
@@ -418,6 +418,12 @@ install from the local monorepo checkout instead (used by the dev launcher).
418
418
  const args = process.argv.slice(2);
419
419
  if (args.includes("--uninstall")) {
420
420
  uninstall(args);
421
+ // Direct `-setup --uninstall` path: also clear stored Ory credentials.
422
+ // (The `ory-claude uninstall` command handles this itself.)
423
+ (0, argus_1.clearCredentialsForUninstall)().then(() => process.exit(0), (err) => {
424
+ console.error(err.message ?? err);
425
+ process.exit(1);
426
+ });
421
427
  }
422
428
  else {
423
429
  install(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/claude-code",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Ory plugin for Claude Code: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/ory/claude-plugins/tree/master/plugins/ory-agent-plugin",
@@ -75,7 +75,7 @@
75
75
  "!dist/**/*.tsbuildinfo"
76
76
  ],
77
77
  "dependencies": {
78
- "@ory/argus": "0.11.1"
78
+ "@ory/argus": "0.12.0"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=22"