ur-agent 1.65.6 → 1.65.7

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.
@@ -0,0 +1,146 @@
1
+ # 01 — Runtime Architecture
2
+
3
+ Source of truth: `src/entrypoints/cli.tsx`, `src/main.tsx`, `src/QueryEngine.ts`, `src/query.ts`,
4
+ `src/tasks/`, `src/services/`, `src/state/AppState.tsx`.
5
+
6
+ ## Process layout
7
+
8
+ ```
9
+ bin/ur.js → dist/cli.js (bundled from src/entrypoints/cli.tsx)
10
+
11
+ ├─ fast paths (no full CLI load):
12
+ │ --version → prints "<version> (UR-Nexus)"
13
+ │ a2a serve → Agent-to-Agent HTTP server (src/services/agents/a2aServer.ts)
14
+ │ --ur-in-chrome-mcp → Chrome-extension MCP server
15
+ │ --chrome-native-host → Chrome native-messaging host
16
+ │ remote-control|rc|remote|sync|bridge → BRIDGE_MODE build only (not in npm build)
17
+ │ ps|logs|attach|kill, --bg → BG_SESSIONS build only (not in npm build)
18
+ │ daemon [subcommand] → DAEMON build only (not in npm build)
19
+ │ environment-runner → BYOC_ENVIRONMENT_RUNNER build only
20
+ │ self-hosted-runner → SELF_HOSTED_RUNNER build only
21
+ │ --worktree --tmux → exec into tmux worktree before full load
22
+ │ --bare → sets UR_CODE_SIMPLE=1 (minimal mode)
23
+
24
+ └─ src/main.tsx → commander CLI → Ink REPL (src/screens/REPL)
25
+ ```
26
+
27
+ ## The interactive loop
28
+
29
+ 1. **REPL (Ink/React)** — renders the prompt, transcript, permission dialogs, spinners,
30
+ status line, and dialog launchers (`src/screens/`, `src/components/`, vendored Ink fork in
31
+ `src/ink/`). Input supports vim mode (`src/vim`), custom keybindings (`src/keybindings`),
32
+ paste/image handling, `!` shell mode, and `/` command typeahead.
33
+ Visual language: thinking blocks render dim/italic labeled "model reasoning to itself"
34
+ (left-bordered when expanded via ctrl+o); user-facing answers carry an accent-colored ⏺
35
+ marker; the live task panel (TaskListV2) is pinned in the fixed bottom region above the
36
+ prompt — visible while the agent works, statuses updating in real time (ctrl+T toggles).
37
+ 2. **Interactive controller** (`src/screens/REPL.tsx`) — owns the interactive
38
+ conversation state and calls `query()` directly after assembling the system prompt,
39
+ tools, permissions, hooks, file-state cache, and session state.
40
+ 3. **QueryEngine** (`src/QueryEngine.ts`) — owns the equivalent multi-turn lifecycle for
41
+ headless and SDK sessions. Its source explicitly reserves REPL integration for a future
42
+ phase; it is not the controller used by `REPL.tsx`.
43
+ 4. **query.ts** — the shared provider-agnostic agent loop: streams native
44
+ Anthropic/OpenAI/Gemini/Ollama/OpenAI-compatible responses, validates and dispatches tool
45
+ calls, applies permissions/hooks, and yields model/tool messages.
46
+ 5. **Context management** — auto-compaction (`src/services/compact/`), context collapse
47
+ (`src/services/contextCollapse/`), token accounting shown by `/context` and `/ctx_viz`.
48
+
49
+ ## Execution reliability contract
50
+
51
+ Every main-session system prompt, including `--bare`, receives the same compact six-step
52
+ contract from `src/constants/executionContract.ts`: scope the request, act through structured
53
+ tools, maintain an ordered plan for 3+ steps, inspect every result, run proportional
54
+ verification, and report only observed evidence. Independent calls may be batched (up to
55
+ eight); dependent read → decide → write chains remain sequential. The contract also forbids
56
+ unchanged retries, empty turns, fabricated completion, and treating untrusted tool output as
57
+ instructions.
58
+
59
+ This is enforced beyond prompt wording:
60
+
61
+ - `src/services/tools/taskListGate.ts` blocks state-changing calls once the initial
62
+ lightweight allowance is consumed unless an actionable task exists. Delegation and
63
+ subagent mutations always require a parent task. Reads remain unrestricted.
64
+ - `src/services/tools/repeatedFailureGuard.ts` tracks canonicalized failing calls, refuses
65
+ repeated identical failures, then aborts the stuck turn at a bounded threshold.
66
+ - the tool execution boundary revalidates the final input after hook rewrites; a hook cannot
67
+ rewrite an already-approved call into an unvalidated or unapproved operation.
68
+ - `src/services/verifier/` ties file/command/test completion claims to successful tool
69
+ results and issues a bounded corrective nudge when evidence is missing.
70
+ - provider adapters reject malformed, duplicate, incomplete, or non-object tool calls.
71
+ Ollama additionally recovers conservative text-form calls for weaker models and preserves
72
+ mixed text/image tool results.
73
+
74
+ ## Command types (`src/types/command.ts`)
75
+
76
+ | Type | Meaning |
77
+ |---|---|
78
+ | `prompt` | Expands to text that is sent to the model (skills, `/commit`, `/review`, …) |
79
+ | `local` | Runs TypeScript locally and prints text output (`/cost`, `/eval`, `/bg`, …) |
80
+ | `local-jsx` | Renders an interactive Ink dialog (`/config`, `/model`, `/agents`, …) |
81
+
82
+ Commands come from seven static sources merged in `src/commands.ts:getCommands()` (priority order):
83
+ bundled skills → built-in plugin skills → skill-dir commands (`.ur/skills`, `~/.ur/skills`) →
84
+ workflow commands → plugin commands → plugin skills → built-ins. Availability is filtered per
85
+ auth state (`availability: 'ur-ai' | 'console'`) and per command `isEnabled()`. Dynamic skills
86
+ are inserted before built-ins. `normalizeCommandTokens()` then makes lookup deterministic:
87
+ the first source to claim a canonical or user-facing token wins, later canonical collisions
88
+ are omitted, and only conflicting aliases are removed from otherwise distinct commands.
89
+
90
+ ## Background task types (`src/tasks/types.ts`)
91
+
92
+ | Task type | What it is |
93
+ |---|---|
94
+ | `LocalShellTask` | A backgrounded shell command (Bash tool `run_in_background`, `/tasks` list) |
95
+ | `LocalAgentTask` | An in-process subagent run (Agent tool / `/bg`-style local agents) |
96
+ | `RemoteAgentTask` | A cloud/remote agent session |
97
+ | `InProcessTeammateTask` | A teammate agent implementation registered in every build; instances are created only while agent-teams/swarm mode is enabled |
98
+ | `LocalWorkflowTask` | Reserved WORKFLOW_SCRIPTS state type; the standard npm build does not create it |
99
+ | `MonitorMcpTask` | Reserved MONITOR_TOOL state type; the standard npm build does not create it |
100
+ | `DreamTask` | Background auto-memory consolidation task; the implementation is always registered, while runs require `autoDreamEnabled` or its runtime feature configuration |
101
+
102
+ `/tasks` (alias `/bashes`) shows active states held in `AppState`. `TaskStop` can stop only
103
+ types with a registered concrete implementation; persisted unknown or source-only task
104
+ types fail with `unsupported_type` instead of pretending cleanup succeeded.
105
+
106
+ ## Services worth knowing (`src/services/`)
107
+
108
+ - `providers/` — provider registry, credentials, connection tests (see doc 05).
109
+ - `mcp/` — MCP client (stdio/SSE/HTTP), OAuth for MCP servers, tool/resource discovery.
110
+ - `lsp/` — Language Server Protocol client used by the LSP tool and `/ide` diagnostics.
111
+ - `agents/` — the multi-agent layer: a2aServer, acpServer, arena, crew, decomposer,
112
+ escalation, intentRouter, modelRouter, headlessAgent, backgroundRunner, evals, benchmarks,
113
+ goals, spec, workflows, knowledge, learning, memoryRetention (see docs 09/10).
114
+ - `verifier/` — done-detector, loop-detector, project quality gates, subagent nudges.
115
+ - `guardrails/` — declarative input/output guardrails engine (see doc 12).
116
+ - `safety/` — project shell-safety policy engine (see doc 12).
117
+ - `compact/`, `contextCollapse/`, `SessionMemory/`, `extractMemories/` — context and memory.
118
+ - `settingsSync/`, `remoteManagedSettings/`, `policyLimits/` — settings distribution and org policy.
119
+ - `analytics/`, `telemetry` (OTel) — usage metrics; disabled in `--offline`.
120
+
121
+ ## State on disk
122
+
123
+ | Path | Contents |
124
+ |---|---|
125
+ | `~/.ur/` | Global config, session registry, logs, and secure-storage data. macOS uses Keychain when available; other platforms currently use a mode-0600 file fallback |
126
+ | `~/.ur/projects/<slug>/` | Per-project session transcripts and history |
127
+ | `.ur/` (repo) | Project state: `settings.json`, `settings.local.json`, `artifacts/`, `specs/`, `workflows/`, `guardrails/`, `safety-policy.json`, `knowledge/`, `memory/`, `index/`, `tools/`, `devcontainer.json`, `automations/`, `evals/`, `context/`, `runs/`, `actions.jsonl` (stability ledger) |
128
+ | `UR.md` / `UR.local.md` | Project instruction memory (analogue of CLAUDE.md), auto-loaded each session |
129
+
130
+ ## Local web surface
131
+
132
+ The artifacts server (`/artifacts serve`) hosts everything reviewable on one
133
+ port: `/artifacts`, `/diff`, `/dashboard` (cloud tasks, background agents,
134
+ task board, learning stats), `/threads/<id>` (shared session transcripts via
135
+ `ur thread share`), and `/api/dashboard` for JSON.
136
+
137
+ ## Native/TS subsystems
138
+
139
+ - `src/native-ts/yoga-layout`, `color-diff`, `file-index` — vendored native-speed helpers.
140
+ - `src/ssh/` — SSH remote-session source used only by builds compiled with `SSH_REMOTE`;
141
+ the standard npm build does not expose `ur ssh`.
142
+ - `src/upstreamproxy/` — proxying model traffic through a configured upstream.
143
+ - `src/voice/` — voice-input subsystem. The standard npm bundle is compiled
144
+ with `VOICE_MODE`; actual use still requires UR OAuth, the runtime kill-switch
145
+ to remain enabled, microphone access, and a supported audio backend.
146
+ - `src/buddy/` — companion sprite UI (feature-gated `BUDDY`).
@@ -0,0 +1,227 @@
1
+ # 02 — CLI Reference (`ur` binary)
2
+
3
+ Source of truth: `src/entrypoints/cli.tsx` (fast paths), `src/main.tsx` (Commander program),
4
+ and the default external feature set in `scripts/bundle.mjs`. Unless a row is explicitly
5
+ labelled source-only, it is present in the standard npm build. Root `ur --help` intentionally
6
+ hides a few advanced global flags, including the system-prompt file variants, so presence in
7
+ this reference does not imply a visible root-help row.
8
+
9
+ Start interactive: `ur` — starts the Ink REPL in the current directory.
10
+ One-shot headless: `ur -p "prompt"` — prints the response and exits.
11
+
12
+ ## Global flags
13
+
14
+ | Flag | Purpose | Example |
15
+ |---|---|---|
16
+ | `-h, --help` | Show help for the root command or selected subcommand | `ur provider --help` |
17
+ | `-v, --version` | Print version (`X.Y.Z (UR-Nexus)`) | `ur --version` |
18
+ | `-d, --debug [filter]` | Debug logging with category filter | `ur -d api,hooks` |
19
+ | `--debug-file <path>` | Write debug logs to a file (implies debug) | `ur --debug-file /tmp/ur.log` |
20
+ | `--verbose` | Override verbose setting | `ur --verbose` |
21
+ | `-p, --print` | Headless print mode (skips trust dialog — only use in trusted dirs) | `ur -p "explain this repo"` |
22
+ | `--output-format <fmt>` | `text`, `json`, `stream-json` (with `-p`) | `ur -p "hi" --output-format json` |
23
+ | `--input-format <fmt>` | `text` or realtime `stream-json` input (with `-p`; stream input requires stream output) | `ur -p --input-format stream-json --output-format stream-json` |
24
+ | `--json-schema <json>` | Validate the final headless response against a JSON Schema | `ur -p --json-schema '{"type":"object"}' "Return JSON"` |
25
+ | `--max-budget-usd <amount>` | Stop a print-mode run at a positive provider-cost budget | `ur -p --max-budget-usd 1 "Review this diff"` |
26
+ | `--include-partial-messages` | Stream partial chunks (needs `-p` + `stream-json`) | — |
27
+ | `--include-hook-events` | Emit hook lifecycle events in stream output | — |
28
+ | `--replay-user-messages` | Echo stdin user messages back on stdout (stream-json in/out) | — |
29
+ | `--bare` | Minimal mode: no hooks/LSP/plugins/auto-memory/UR.md; local Ollama only; sets `UR_CODE_SIMPLE=1` | `ur --bare` |
30
+ | `--offline` | Local-first: no cloud APIs, telemetry, auto-update, remote control | `ur --offline` |
31
+ | `--model <model>` | Session model (e.g. an Ollama tag) | `ur --model qwen2.5-coder:7b` |
32
+ | `--effort <low\|medium\|high\|max>` | Override reasoning effort for this session | `ur --effort high` |
33
+ | `--fallback-model <model>` | Auto-fallback when primary is overloaded (with `-p`) | — |
34
+ | `--agent <agent>` | Run as a named agent config | `ur --agent reviewer` |
35
+ | `--agents <json>` | Define custom agents inline (JSON) | — |
36
+ | `--betas <betas...>` | Beta API headers (API-key users) | — |
37
+ | `--ollama-host <url>` | Use a specific Ollama server for this session | `ur --ollama-host http://192.168.1.10:11434` |
38
+ | `--discover-ollama` | Discover Ollama servers on the LAN at startup and pick one | `ur --discover-ollama` |
39
+ | `--allowedTools, --allowed-tools <tools...>` / `--disallowedTools, --disallowed-tools <tools...>` | Permission allow/deny rules | `ur --allowed-tools "Bash(git:*)" Edit` |
40
+ | `--tools <tools...>` | Restrict the built-in tool set (`""` = none, `default` = all) | `ur --tools Bash,Edit,Read` |
41
+ | `--dangerously-skip-permissions` | Bypass all permission checks (sandboxed envs only) | — |
42
+ | `--allow-dangerously-skip-permissions` | Make bypass *available* but not default | — |
43
+ | `--permission-mode <mode>` | Start in a permission mode (e.g. `plan`) | `ur --permission-mode plan` |
44
+ | `--mcp-config <configs...>` | Load MCP servers from JSON files/strings | `ur --mcp-config ./mcp.json` |
45
+ | `--strict-mcp-config` | Ignore all other MCP configs besides `--mcp-config` | — |
46
+ | `--mcp-debug` | Deprecated MCP diagnostics alias; use `--debug` | — |
47
+ | `--system-prompt <text>` / `--system-prompt-file <file>` | Replace the default system prompt with inline or file content (mutually exclusive) | `ur --system-prompt-file ./agent-prompt.txt` |
48
+ | `--append-system-prompt <text>` / `--append-system-prompt-file <file>` | Append inline or file content to the default system prompt (mutually exclusive) | `ur --append-system-prompt "Use the project glossary"` |
49
+ | `-c, --continue` | Continue most recent conversation in cwd | `ur -c` |
50
+ | `-r, --resume [id]` | Resume by session ID or open picker | `ur -r 6f9…` |
51
+ | `--fork-session` | New session ID when resuming | `ur -c --fork-session` |
52
+ | `--from-pr [value]` | Resume the session linked to a GitHub PR | `ur --from-pr 123` |
53
+ | `--session-id <uuid>` | Force a specific session UUID | — |
54
+ | `-n, --name <name>` | Display name for the session | `ur -n "auth refactor"` |
55
+ | `--no-session-persistence` | Don't save the session (with `-p`) | — |
56
+ | `--settings <file-or-json>` | Load extra settings | `ur --settings ./ci-settings.json` |
57
+ | `--setting-sources <sources>` | Which scopes to load: `user,project,local` | `ur --setting-sources user` |
58
+ | `--add-dir <dirs...>` | Extra directories tools may access | `ur --add-dir ../lib` |
59
+ | `--ide` | Auto-connect to the IDE if exactly one is available | `ur --ide` |
60
+ | `--chrome` / `--no-chrome` | Enable/disable UR-in-Chrome integration | — |
61
+ | `-w, --worktree [name]` | Run the session in a fresh git worktree | `ur -w feature-x` |
62
+ | `--tmux` | With `--worktree`: open it in tmux/iTerm2 panes (`--tmux=classic` forces tmux) | `ur -w x --tmux` |
63
+ | `--plugin-dir <path>` | Load plugins from a dir for this session (repeatable) | `ur --plugin-dir ./my-plugins` |
64
+ | `--disable-slash-commands` | Disable all skills/commands | — |
65
+ | `--file <specs...>` | Download file resources at startup (`file_id:relative_path`) | — |
66
+
67
+ ## Subcommands
68
+
69
+ ### Sessions & lifecycle
70
+ | Command | Purpose | Example |
71
+ |---|---|---|
72
+ | `ur update` / `ur upgrade` | Check npm for a newer UR-Nexus release (`autoUpdatesChannel` selects the channel) | `ur update` |
73
+ | `ur doctor` | Installation health check | `ur doctor` |
74
+ | `ur import-session <path>` | Validate and import a previously exported transcript | `ur import-session ./session.jsonl` |
75
+ | `ur thread [action] [id]` | Share and inspect session threads through the local review server; invalid IDs and missing transcripts exit nonzero | `ur thread share` |
76
+
77
+ ### Model / provider
78
+ | Command | Purpose | Example |
79
+ |---|---|---|
80
+ | `ur provider list` | List providers and their status | `ur provider list` |
81
+ | `ur provider status` | Connection status for all providers | — |
82
+ | `ur provider doctor [provider]` | Diagnose a provider connection | `ur provider doctor ollama` |
83
+ | `ur provider models [provider]` | List models a provider offers | `ur provider models openrouter` |
84
+ | `ur provider select-model <provider> <model...>` | Pin a model for a provider | — |
85
+ | `ur connect [action] [provider]` | Connect/store credentials (also `/connect` in REPL) | `ur connect openrouter --key sk-…` |
86
+ | `ur model-doctor [model]` | Probe a local Ollama model's agent capabilities | `ur model-doctor llama3.3` |
87
+ | `ur model-route [task...]` | Recommend best model for a task | `ur model-route "refactor auth"` |
88
+ | `ur local-first` | Report offline/no-cloud readiness | `ur local-first --json` |
89
+
90
+ ### MCP
91
+ | Command | Purpose | Example |
92
+ |---|---|---|
93
+ | `ur mcp add <name> <commandOrUrl> [args...]` | Add an MCP server (`--transport stdio\|http\|sse`, `--header`, `-s user\|project\|local`) | `ur mcp add fs -- npx @modelcontextprotocol/server-filesystem /tmp` |
94
+ | `ur mcp add-json <name> <json>` | Add from raw JSON | `ur mcp add-json db '{"command":"…"}'` |
95
+ | `ur mcp add-from-ur-desktop` | Import servers from UR Desktop | — |
96
+ | `ur mcp list / get <name> / remove <name>` | Inspect and remove servers | `ur mcp get fs` |
97
+ | `ur mcp serve` | Run UR itself as an MCP server (exposes UR tools) | `ur mcp serve` |
98
+ | `ur mcp serve-http` | Run the opt-in stateless MCP 2026 HTTP adapter with Tasks/Apps | `UR_MCP_HTTP_TOKEN=… ur mcp serve-http` |
99
+ | `ur mcp reset-project-choices` | Reset approved/rejected `.mcp.json` prompts | — |
100
+
101
+ ### Agent & automation (headless)
102
+ | Command | Purpose | Example |
103
+ |---|---|---|
104
+ | `ur exec [prompts...]` | Non-interactive runs with deterministic task planning, a live task board, bounded parallel agents, strict evidence checks, and optional per-prompt worktrees (also `/exec`); each prompt owns one shared worktree, not one worktree per planned subtask | `ur exec "fix lint" "run tests" --concurrency 2` |
105
+ | `ur bg [action] [task...]` | Detached background agents (run/fanout/list/status/logs/steer/attach/kill) | `ur bg steer <id> --message "run the regression"` |
106
+ | `ur cloud [action]` | Verified local best-of-N or managed candidates with safe-branch eligibility, sync, logs, steering, and cancellation | `ur cloud run "fix parser" --runner managed --attempts 3` |
107
+ | `ur agent-ci [action] [name]` | Policy-gated isolated CI agent and pinned GitHub workflow | `ur agent-ci init default` |
108
+ | `ur workspace [action]` | Dependency-aware multi-repository worktrees and explicit PR/rollback plans | `ur workspace validate checkout` |
109
+ | `ur task start <name>` / `run <id>` / `pr <id>` / `list` / `status <id>` | Worktree-capable background task sessions and explicit PR handoff | `ur task start rate-limiter --worktree` |
110
+ | `ur worktree [action] [id]` | List/inspect/clean agent worktrees | `ur worktree clean` |
111
+ | `ur automation [action] [name]` | Cron-style project automations (`--schedule`, `--prompt`, `run-due`, `install` launchd/systemd/cron) | `ur automation create nightly --schedule "0 3 * * *" --prompt "run tests"` |
112
+ | `ur eval [action]` | Isolated evals with redacted trajectory grading and CI gates | `ur eval gate smoke --min-pass-rate 1` |
113
+ | `ur arena [task...]` | Verified best-of-N with deterministic/model/hybrid judging | `ur arena "speed up parser" --agents 3 --judge hybrid --verify "bun test"` |
114
+ | `ur desktop-qa [action]` | Bounded Electron fixtures with masked screenshots and privacy-compatible optional video/trace evidence | `ur desktop-qa run .ur/desktop-qa/fixtures/smoke.json` |
115
+ | `ur learn playbooks [action]` | Mine, approve, run, reject, or disable evidence-backed workflows | `ur learn playbooks mine --min-runs 3` |
116
+ | `ur crew [action] [name]` | Lead + workers over a shared task board | `ur crew create fixers --goal "eliminate flaky tests"` |
117
+ | `ur agents` | List configured built-in, user, project, and flag-provided agents | `ur agents` |
118
+ | `ur ci-loop` | Run build/test in an explicit working directory, auto-fix until green | `ur ci-loop --command "npm test" --cwd ./packages/app --max-attempts 3` |
119
+ | `ur escalate [action] [task...]` | Fast model with auto-escalation to an oracle model | `ur escalate run "hard proof" --oracle gpt-5.5` |
120
+ | `ur route [task...]` | Classify task → recommend subagent/pattern | `ur route "debug flaky test"` |
121
+ | `ur spec [action] [name] [phase]` | Scaffold and advance requirements/design/task specifications with approval and proof gates | `ur spec init checkout --goal "one-click checkout"` |
122
+ | `ur goal [action] [name]` | Persist long-horizon objectives and resume their associated workflow | `ur goal add v2-launch --objective "ship v2"` |
123
+ | `ur workflow [action] [name] [stepId]` | Initialize, validate, graph, plan, run, approve, advance, complete, or reset declarative workflows | `ur workflow approve release publish` |
124
+ | `ur pattern [action] [name] [task...]` | List, inspect, install, compile, or execute PEER/DOE collaboration patterns | `ur pattern run debate "adopt tRPC?" --execute` |
125
+ | `ur skill [action] [name] [args...]` | List, inspect, run, approve/reset, initialize, verify, sign, or keygen tool-bounded skills | `ur skill run release-checklist` |
126
+ | `ur skill approve / reset / verify / sign / keygen` | Resume/reset approval-gated runs, validate provenance, Ed25519-sign a skill, or create a trusted signing key | `ur skill verify release-notes --require-trusted` |
127
+ | `ur context-pack memory verify / revalidate / search / quarantine / rollback` | Audit, resolve citations, or recover the tamper-evident project memory chain | `ur context-pack memory revalidate --json` |
128
+
129
+ ### Knowledge, verification & developer workflows
130
+ | Command | Purpose | Example |
131
+ |---|---|---|
132
+ | `ur agent-features [action]` | Report or scaffold the shipped agent feature surfaces | `ur agent-features --json` |
133
+ | `ur agent-inspect` | Reconstruct subagent prompts, tools, verdicts, failures, and usage from a transcript | `ur agent-inspect --file session.jsonl --json` |
134
+ | `ur agent-task [action]` | Summarize task/diff state and prepare an explicitly requested PR handoff | `ur agent-task status --json` |
135
+ | `ur agent-templates [action] [names...]` | List or install reusable project agent templates | `ur agent-templates install reviewer test-runner` |
136
+ | `ur artifacts [action] [id]` | Capture, review, approve, reject, and comment on durable artifacts | `ur artifacts capture-diff` |
137
+ | `ur audit [action] [file]` | Export or strictly verify the hash-chained action audit trail; empty, malformed, or tampered JSONL fails closed with a nonzero exit | `ur audit verify .ur/audit.jsonl` |
138
+ | `ur browser-qa [action] [fixture]` | Validate or run bounded browser replay fixtures | `ur browser-qa run home-page-smoke --dry-run` |
139
+ | `ur claim-ledger [action]` | Maintain claim-to-source provenance records | `ur claim-ledger validate` |
140
+ | `ur code-index [action] [query...]` | Build or query the local semantic code index | `ur code-index search "token refresh"` |
141
+ | `ur config set <key> <value...>` | Set a supported non-secret provider/model/Responses setting (`provider`, fallback/command path, model/base URL, OpenAI transport, or Responses store/compact/tool-search controls) | `ur config set openai_transport responses` |
142
+ | `ur grade-trajectory` | Grade captured agent control flow, tool order, and step budget | `ur grade-trajectory --file run.jsonl --min-score 70` |
143
+ | `ur knowledge [action] [args...]` | Manage the curated project knowledge base with provenance | `ur knowledge search auth` |
144
+ | `ur memory-integrity [action]` | Record, verify, or quarantine file-backed memory state | `ur memory-integrity verify` |
145
+ | `ur memory-suggest` | Propose durable, non-secret facts from the current session | `ur memory-suggest --help` |
146
+ | `ur recipe [action] [rest...]` | Initialize, list, and run structured-output playbooks; missing/invalid recipes and schema-invalid completed runs exit nonzero | `ur recipe list` |
147
+ | `ur repo-edit [action] [rest...]` | Index, preview, and apply rollback-safe repository edits | `ur repo-edit preview rename oldName newName` |
148
+ | `ur role-mode [action] [name]` | List or install the Architect, Code, Debug, and Ask role modes | `ur role-mode install architect` |
149
+ | `ur selftest [action]` | Run observable end-to-end drills against the shipped CLI | `ur selftest run` |
150
+ | `ur semantic-memory [action] [query...]` | Build and search the project-local lexical memory index (token overlap, not embeddings) | `ur semantic-memory search "release policy"` |
151
+ | `ur sources` | Inspect the current process's bounded in-memory untrusted-source ledger; a fresh standalone shell invocation normally has no prior-session entries | `ur sources --flagged --json` |
152
+ | `ur test-first [action]` | Detect and run compile/test/lint loops or install edit-time gates | `ur test-first detect` |
153
+ | `ur trigger [action]` | Parse GitHub/Slack mention payloads and optionally launch a bounded headless run | `ur trigger parse --file payload.json --source github` |
154
+ | `ur wiki [action]` | Generate and query the living repository wiki and prompt-injectable map; unknown actions and unavailable hook installation exit nonzero | `ur wiki generate` |
155
+
156
+ ### Servers & integration endpoints
157
+ | Command | Purpose | Example |
158
+ |---|---|---|
159
+ | `ur a2a serve` | Negotiated A2A v1 JSON-RPC/HTTP+JSON plus stable v0.3 and UR compatibility routes | `UR_A2A_TOKEN=… ur a2a serve --port 8765` |
160
+ | `ur a2a card` | Print the A2A agent card | `ur a2a card --a2a-base-url https://host` |
161
+ | `ur a2a token mint / verify <token>` | Mint/verify A2A tokens | — |
162
+ | `ur ag-ui serve` | Secure AG-UI HTTP/SSE adapter with capability discovery | `ur ag-ui serve --allow-origin https://app.example` |
163
+ | `ur acp stdio` | Native ACP v1 with durable lifecycle/replay, modes, config, commands, permissions, MCP, and streaming | `ur acp stdio` |
164
+ | `ur acp serve / stop / status` | UR HTTP compatibility API used by the bundled IDE extensions | `ur acp serve --port 9100` |
165
+ | `ur ide [action] [rest...]` | Diagnose IDE connections and manage inline-diff bundles | `ur ide doctor` |
166
+ | `ur computer [action] [rest...]` | Screenshot or, with explicit approval, control the local desktop | `ur computer screenshot` |
167
+ | `ur speak [text...]` | Read text aloud through the supported local speech backend | `ur speak "Build complete"` |
168
+ | `ur sdk [action]` | Show or scaffold the generated headless UR SDK wrapper | `ur sdk init` |
169
+
170
+ ### Safety & permission controls
171
+ | Command | Purpose | Example |
172
+ |---|---|---|
173
+ | `ur permission-profile [action] [name]` | List, activate, or clear named permission profiles | `ur permission-profile use reviewing` |
174
+ | `ur safety [action] [rest...]` | Inspect, initialize, and evaluate the project shell-safety policy | `ur safety check --command "git push" --json` |
175
+ | `ur sandbox [action] [commandArg...]` | Inspect OS sandbox support and command approval levels | `ur sandbox status --json` |
176
+
177
+ ### Auth
178
+ | Command | Purpose | Example |
179
+ |---|---|---|
180
+ | `ur auth status` | Show auth state | `ur auth status --json` |
181
+ | `ur auth chatgpt / claude / gemini / antigravity` | Subscription CLI logins (providers currently `disabled: true` in the registry) | `ur auth chatgpt --device-auth --dry-run` |
182
+ | `ur auth login` / `ur auth logout` | Hidden legacy UR account OAuth compatibility actions; provider access should use `ur connect` or `ur auth <provider>` | — |
183
+
184
+ ### Plugins
185
+ | Command | Purpose | Example |
186
+ |---|---|---|
187
+ | `ur plugin validate <path>` | Validate a plugin/marketplace manifest | `ur plugin validate ./my-plugin` |
188
+ | `ur plugin list` (`--available`, `--json`) | List installed plugins | — |
189
+ | `ur plugin doctor [--path <dir>]` | Diagnose plugin problems | — |
190
+ | `ur plugin marketplace add <source>` (`--sparse`, `--scope`) | Register a marketplace (git URL/path) | `ur plugin marketplace add github.com/acme/ur-plugins` |
191
+ | `ur plugin marketplace list / remove <name> / update [name]` | Manage marketplaces | — |
192
+ | `ur plugin install <plugin>` / `uninstall` / `enable` / `disable [-a]` / `update` (`-s user\|project\|local`) | Manage plugins | `ur plugin install fmt@acme -s project` |
193
+
194
+ ## Notes
195
+
196
+ - Any slash command that is `type: 'local'` also works from the shell as `ur <command>` when
197
+ registered in `src/main.tsx` (the list above) — e.g. `ur agent-trends --json`.
198
+ - Root adapters preserve argument boundaries by quoting Commander values and local handlers
199
+ decode them with `parseArguments`; paths and task text containing spaces are not split.
200
+ - Local-command exit codes follow a stable script contract: `0` means the requested operation
201
+ completed (including a documented dry run, list/status query, empty search result, or advisory
202
+ safety classification), `1` means execution/data/resource/verification failure, and `2` means
203
+ invalid syntax, action, or option. Workflow/spec/pattern/test-first runs, automation/trigger
204
+ children, PR creation, browser smoke checks, repository edits, and integrity validators propagate
205
+ unsuccessful outcomes instead of printing failure text with status 0. Fatal startup errors print
206
+ `Fatal startup error: …` and exit 1.
207
+
208
+ ## Source-only and nonstandard-build CLI surfaces
209
+
210
+ These implementations exist in the repository but are dead-code-eliminated from the
211
+ standard npm artifact. They must not be treated as available merely because their source
212
+ can be imported in tests:
213
+
214
+ | Build gate / audience | Source-only surface |
215
+ |---|---|
216
+ | `BG_SESSIONS` | `--bg`, `--background`, `ur ps`, `ur logs`, `ur attach`, `ur kill` |
217
+ | `BRIDGE_MODE` | `ur remote-control` and aliases `rc`, `remote`, `sync`, `bridge` |
218
+ | `DIRECT_CONNECT` | `ur server`, `ur open <cc-url>` |
219
+ | `SSH_REMOTE` | `ur ssh <host> [dir]` |
220
+ | `DAEMON` | `ur daemon` and its internal worker entrypoint |
221
+ | `BYOC_ENVIRONMENT_RUNNER` / `SELF_HOSTED_RUNNER` | `ur environment-runner`, `ur self-hosted-runner` |
222
+ | `TEMPLATES` | template-job `ur new`, `ur list`, `ur reply` fast paths |
223
+ | internal (`USER_TYPE=ant`) | `ur up`, `ur rollback`, `ur log`, `ur error`, `ur export`, and the separate `task create/list/get/update` registry |
224
+
225
+ The shipped `ur bg` command is a different, public background-agent implementation under
226
+ `src/commands/bg/`; it remains available even though the process-level `BG_SESSIONS` fast
227
+ paths are not.