ur-agent 1.11.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.
@@ -0,0 +1,133 @@
1
+ # Configuration
2
+
3
+ UR reads configuration from CLI flags, environment variables, and project or user settings files.
4
+
5
+ ## Model Provider
6
+
7
+ UR runs models strictly through the local Ollama app. The request endpoint is fixed and cannot be reconfigured from UR:
8
+
9
+ ```text
10
+ http://localhost:11434/api
11
+ ```
12
+
13
+ Any model exposed by that local Ollama app can be used, including local models and Ollama Cloud-backed models. UR does not call remote provider APIs directly and does not manage model API keys.
14
+
15
+ Model selection environment variables:
16
+
17
+ ```sh
18
+ OLLAMA_MODEL=qwen3-coder:480b-cloud
19
+ UR_MODEL=qwen3-coder:480b-cloud
20
+ ```
21
+
22
+ `OLLAMA_MODEL` selects the model name and takes precedence over `UR_MODEL`. If neither is set, UR lets its Ollama router choose from the model list advertised by the local Ollama app. If that discovery fails, the built-in fallback is `qwen3-coder:480b-cloud`. Neither variable can change the endpoint.
23
+
24
+ ## CLI Flags
25
+
26
+ Frequently used flags:
27
+
28
+ ```sh
29
+ ur --model <model>
30
+ ur --settings <file-or-json>
31
+ ur --add-dir <path>
32
+ ur --mcp-config <file-or-json>
33
+ ur --permission-mode <mode>
34
+ ur --plugin-dir <path>
35
+ ur --agents '<json>'
36
+ ```
37
+
38
+ Use `ur --help` for the complete list.
39
+
40
+ ## Settings Files
41
+
42
+ UR supports user, project, and local settings. Project-shared settings can live under `.ur/`, while local files should remain private.
43
+
44
+ Recommended Git behavior:
45
+
46
+ - Commit shared docs, skills, agents, and project settings that are safe for teammates.
47
+ - Do not commit `.ur/settings.local.json`.
48
+ - Do not commit generated `.ur/index/`, `.ur/memory/`, `.ur/cache/`, `.ur/tmp/`, or `.ur/logs/`.
49
+ - Do not commit `UR.local.md`.
50
+
51
+ ## Verifier
52
+
53
+ UR runs a lightweight verifier in the agent loop (L1) to catch false "task
54
+ done" claims, infinite tool-call loops, empty assistant turns, and project
55
+ gate failures. This is the cheap "try the implementation" pass and always
56
+ runs (outside `mode=off`).
57
+
58
+ The heavy independent `verification` subagent (L2) is **opt-in**: by default
59
+ UR never auto-spawns it after a turn. Trigger that deep second opinion
60
+ yourself with the `/verify` command when you want it. Set
61
+ `UR_VERIFIER_AUTO_SUBAGENT=1` to restore the old behaviour where the verifier
62
+ nudges the model to spawn the subagent after every mutating turn.
63
+
64
+ Behaviour is controlled by environment variables:
65
+
66
+ ```sh
67
+ # Overall mode (default: strict) — controls the L1 gates
68
+ UR_VERIFIER_MODE=strict # all L1 gates on: done-claim, loops, empty turn,
69
+ # project gates
70
+ UR_VERIFIER_MODE=loose # only empty-turn check + loop detector
71
+ UR_VERIFIER_MODE=off # disable verifier entirely
72
+
73
+ # L2 deep-verification subagent (default: off — run it manually via /verify)
74
+ UR_VERIFIER_AUTO_SUBAGENT=1 # auto-nudge the subagent after every
75
+ # mutating turn (the old default)
76
+ UR_VERIFIER_DISABLE_SUBAGENT=1 # hard-off: also unregister the verification
77
+ # agent so /verify can't spawn it either
78
+ ```
79
+
80
+ Project-specific gates live in `.ur/verify.json`:
81
+
82
+ ```json
83
+ {
84
+ "afterEdit": ["bun x tsc --noEmit", "bun test --quiet"],
85
+ "afterBash": [],
86
+ "ignorePatterns": ["**/*.md", "node_modules/**"],
87
+ "timeoutMs": 60000
88
+ }
89
+ ```
90
+
91
+ After a turn that modified files, every `afterEdit` command must exit 0
92
+ before the agent can declare the task complete. A failing command surfaces
93
+ to the model as a structured reminder with the command name and the trimmed
94
+ stdout/stderr.
95
+
96
+ Two related slash commands:
97
+
98
+ - `/verify [focus]` — manually run the deep verification subagent (e.g.
99
+ `/verify the auth flow`). This is the primary way to trigger L2; useful
100
+ before a commit.
101
+ - `/trace [n]` — print a structured view of the last `n` messages (default 8,
102
+ max 50): roles, tool calls, tool results, verifier verdicts. Useful for
103
+ debugging what the agent did during a turn.
104
+
105
+ ## MCP Servers
106
+
107
+ Use the `mcp` subcommand to manage Model Context Protocol servers:
108
+
109
+ ```sh
110
+ ur mcp list
111
+ ur mcp get <name>
112
+ ur mcp add-json <name> '<json>'
113
+ ur mcp remove <name>
114
+ ```
115
+
116
+ MCP servers may execute code or access external services. Only enable servers you trust, and keep credentials out of committed config.
117
+
118
+ ## Plugins and Skills
119
+
120
+ Plugins can add commands, tools, and skills:
121
+
122
+ ```sh
123
+ ur plugin list
124
+ ur plugin install <plugin>
125
+ ur plugin update <plugin>
126
+ ur plugin disable <plugin>
127
+ ```
128
+
129
+ Skills can be stored in `.ur/skills/` for project-specific workflows or in `~/.ur/skills/` for personal workflows.
130
+
131
+ ## Secrets
132
+
133
+ Keep secrets in environment variables, local settings, a secret manager, or your shell profile. Never commit API keys, OAuth tokens, private keys, service-account JSON, or `.env` files.
@@ -0,0 +1,69 @@
1
+ # Development Guide
2
+
3
+ ## Repository Layout
4
+
5
+ - `bin/ur.js` launches the TypeScript CLI through Bun.
6
+ - `src/entrypoints/cli.tsx` handles fast startup paths before loading the full CLI.
7
+ - `src/main.tsx` defines top-level CLI flags and subcommands.
8
+ - `src/commands.ts` registers slash commands and command modules.
9
+ - `src/tools/` contains tool implementations.
10
+ - `src/services/` contains API, MCP, analytics, sync, and runtime services.
11
+ - `src/components/` and `src/ink/` implement the terminal UI.
12
+ - `examples/` contains example prompts and workflows.
13
+ - `test/` contains Bun tests for local UR utility modules.
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ bun install
19
+ ```
20
+
21
+ ## Run
22
+
23
+ ```sh
24
+ bun run start
25
+ bun run dev
26
+ ```
27
+
28
+ `bun run start` uses `bin/ur.js`. `bun run dev` runs `src/entrypoints/cli.tsx` directly with watch mode and the Bun bundle preload.
29
+
30
+ ## Verify
31
+
32
+ ```sh
33
+ bun run typecheck
34
+ bun test
35
+ bun run bundle
36
+ bun run smoke
37
+ bun run secrets:scan
38
+ bun run release:check
39
+ npm pack --dry-run
40
+ ```
41
+
42
+ The GitHub install path uses the bundled launcher in `dist/cli.js`, so `bun run bundle` must be run before packaging or pushing a release. `bun run release:check` verifies that `package.json`, `bunfig.toml`, the bundle, docs, and `node ./bin/ur.js --version` agree.
43
+
44
+ ## Build
45
+
46
+ ```sh
47
+ bun run bundle
48
+ ```
49
+
50
+ The build output goes to `dist/cli.js`. The directory is ignored by default, but `dist/cli.js` is intentionally tracked because GitHub installs run the bundled CLI.
51
+
52
+ ## Local Command Link
53
+
54
+ From the repository root:
55
+
56
+ ```sh
57
+ bun link
58
+ ur --version
59
+ ```
60
+
61
+ ## GitHub Install
62
+
63
+ This package is configured for install without cloning:
64
+
65
+ ```sh
66
+ bun add -g github:Maitham16/UR-mapek
67
+ ```
68
+
69
+ The package exposes the global `ur` command from `bin/ur.js`. That launcher reads `package.json` for version and repository metadata, then runs `src/entrypoints/cli.tsx` with Bun.
package/docs/USAGE.md ADDED
@@ -0,0 +1,101 @@
1
+ # Usage Guide
2
+
3
+ UR is a terminal agent. Running `ur` opens an interactive session in the current directory, while `ur -p` runs one non-interactive prompt and exits.
4
+
5
+ ## Interactive Mode
6
+
7
+ ```sh
8
+ ur
9
+ ```
10
+
11
+ Use interactive mode for iterative coding, debugging, research, and repository exploration. The session can read project instructions, use tools, call slash commands, and keep resumable conversation history.
12
+
13
+ Useful options:
14
+
15
+ ```sh
16
+ ur --model qwen3-coder:480b-cloud
17
+ ur --add-dir ../other-project
18
+ ur --permission-mode ask
19
+ ur --continue
20
+ ur --resume
21
+ ```
22
+
23
+ ## Print Mode
24
+
25
+ Print mode is useful for scripts and shell pipelines:
26
+
27
+ ```sh
28
+ ur -p "write a changelog entry for the current diff"
29
+ ```
30
+
31
+ Output formats:
32
+
33
+ ```sh
34
+ ur -p --output-format text "explain src/main.tsx"
35
+ ur -p --output-format json "return a JSON summary of this repo"
36
+ ur -p --output-format stream-json "stream progress while answering"
37
+ ```
38
+
39
+ Structured output can be validated with a JSON schema:
40
+
41
+ ```sh
42
+ ur -p \
43
+ --output-format json \
44
+ --json-schema '{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]}' \
45
+ "summarize this project"
46
+ ```
47
+
48
+ ## Models
49
+
50
+ The wrapper in `bin/ur.js` honors explicit model choices in this order:
51
+
52
+ 1. `OLLAMA_MODEL`
53
+ 2. `UR_MODEL`
54
+
55
+ If neither variable is set, UR lets its Ollama router choose from the models
56
+ exposed by your local Ollama app. That list can include local models and
57
+ Ollama Cloud-backed models. If routing cannot discover a model list, the
58
+ built-in fallback is `qwen3-coder:480b-cloud`.
59
+
60
+ You can also choose the model for a single session:
61
+
62
+ ```sh
63
+ ur --model qwen3-coder:480b-cloud
64
+ ur --model qwen2.5-coder:latest
65
+ ```
66
+
67
+ UR talks only to the local Ollama app at the fixed endpoint `http://localhost:11434/api`. The endpoint cannot be changed from UR. Models exposed by that local app are valid, including Ollama Cloud-backed models. UR does not call provider APIs directly or manage model API keys.
68
+
69
+ ## Project Instructions
70
+
71
+ Add a `UR.md` file to the repository root for team-shared instructions. UR loads it as project context.
72
+
73
+ Use `UR.local.md` for private local instructions. It is ignored by `.gitignore`.
74
+
75
+ Project `.ur/` assets can hold settings, skills, agents, MCP config, and local runtime state. Commit only shared files. Keep local memory, generated indexes, logs, and local settings untracked.
76
+
77
+ ## Commands
78
+
79
+ UR includes slash commands and CLI subcommands for common workflows:
80
+
81
+ - `/help` or `ur --help` for command discovery
82
+ - `ur mcp ...` to configure MCP servers
83
+ - `ur plugin ...` to manage plugins and marketplaces
84
+ - `ur agents` to list configured agents
85
+ - `ur doctor` to inspect CLI health
86
+ - `ur update` or `ur upgrade` to check for updates
87
+
88
+ Run each command with `--help` for exact flags.
89
+
90
+ ## Permissions
91
+
92
+ By default, UR asks before sensitive tool actions. For automation, use explicit allow and deny lists:
93
+
94
+ ```sh
95
+ ur -p \
96
+ --allowed-tools "Read,Edit,Bash(git:*)" \
97
+ --disallowed-tools "Bash(rm:*)" \
98
+ "inspect the current diff"
99
+ ```
100
+
101
+ Avoid `--dangerously-skip-permissions` unless the session is inside a disposable sandbox.
@@ -0,0 +1,197 @@
1
+ # Live Validation Runbook
2
+
3
+ Use this checklist after installing or upgrading to verify the verifier
4
+ subsystem (L1/L2/L3) and the in-repo marketplace work against a real Ollama
5
+ session. Should take ~10 minutes.
6
+
7
+ You need:
8
+
9
+ - A running Ollama server (`ollama serve`) with at least one model available
10
+ in the local Ollama app. Local models and Ollama Cloud-backed models both
11
+ work because UR talks to the local app.
12
+ - This repo installed globally (`bun add -g github:Maitham16/UR-mapek`) or a
13
+ local checkout (`bun run dev`).
14
+
15
+ ## 0. Smoke
16
+
17
+ ```sh
18
+ ur --version
19
+ # expected: 1.11.0 (Ur)
20
+ ```
21
+
22
+ ## 1. Marketplace tree resolves
23
+
24
+ In a fresh interactive session:
25
+
26
+ ```sh
27
+ ur
28
+ ```
29
+
30
+ Then inside:
31
+
32
+ ```text
33
+ /plugin
34
+ ```
35
+
36
+ Expected: the plugin picker lists `ur-plugins-official` and `hello`. If the
37
+ marketplace failed to clone, you'll see no entries — fall back to
38
+ `/plugin marketplace add github:Maitham16/UR-mapek` and re-run `/plugin`.
39
+
40
+ Install `hello`:
41
+
42
+ ```text
43
+ /plugin install hello@ur-plugins-official
44
+ ```
45
+
46
+ Then run the example command:
47
+
48
+ ```text
49
+ /hello Maitham
50
+ ```
51
+
52
+ Expected: a two-sentence greeting that addresses you by name and mentions
53
+ the `ur-plugins-official` marketplace.
54
+
55
+ ## 2. L1 done-claim gate fires
56
+
57
+ Ask the agent to do something simple but DON'T let it use a tool. The
58
+ cleanest way is to prompt:
59
+
60
+ ```text
61
+ Pretend you just edited README.md to add a hello function. Tell me you did
62
+ it. Do NOT actually call any tool.
63
+ ```
64
+
65
+ Expected:
66
+
67
+ - The model tries to claim "done" without writing anything.
68
+ - A `<system-reminder>` appears (or the agent's tone changes mid-turn —
69
+ the render-time filter strips the reminder from the visible prose; you'll
70
+ see the *effect* in the next turn where the agent backs off the claim or
71
+ actually makes the Write call).
72
+ - If you have `UR_VERIFIER_MODE=off` set, the false claim goes through. Try
73
+ it both ways to confirm:
74
+
75
+ ```sh
76
+ UR_VERIFIER_MODE=off ur # gates off, false claim accepted
77
+ UR_VERIFIER_MODE=strict ur # default, false claim rejected
78
+ ```
79
+
80
+ ## 3. L1 loop detector fires
81
+
82
+ ```text
83
+ Run `ls /nonexistent-path` over and over via the Bash tool. Don't change
84
+ the arguments. Don't try anything else.
85
+ ```
86
+
87
+ Expected: after the 3rd identical Bash call, the agent receives a "stop
88
+ repeating the same call" reminder and switches strategy (or asks for
89
+ clarification).
90
+
91
+ ## 4. Project gate from `.ur/verify.json`
92
+
93
+ Create one:
94
+
95
+ ```sh
96
+ mkdir -p .ur
97
+ cat > .ur/verify.json <<'JSON'
98
+ {
99
+ "afterEdit": ["false"],
100
+ "timeoutMs": 5000
101
+ }
102
+ JSON
103
+ ```
104
+
105
+ Then in the REPL, ask for a real edit:
106
+
107
+ ```text
108
+ Append a blank line to README.md.
109
+ ```
110
+
111
+ Expected: the agent calls Write/Edit. Then the gate fires (`false` always
112
+ exits 1) and the agent receives a reminder naming the command and its
113
+ non-zero exit. The agent should either fix something and retry or surface
114
+ the failure honestly instead of declaring done.
115
+
116
+ Clean up:
117
+
118
+ ```sh
119
+ rm .ur/verify.json
120
+ ```
121
+
122
+ ## 5. L2 subagent nudge (opt-in)
123
+
124
+ The deep verification subagent does NOT fire automatically by default — deep
125
+ verification is manual (step 6). To exercise the auto-nudge, start UR with it
126
+ enabled:
127
+
128
+ ```sh
129
+ UR_VERIFIER_AUTO_SUBAGENT=1 ur
130
+ ```
131
+
132
+ Then:
133
+
134
+ ```text
135
+ Add a short docstring to the top of any one file in src/. After that,
136
+ just say "all done" with no further tool calls.
137
+ ```
138
+
139
+ Expected after the model "finishes":
140
+
141
+ - The verifier injects the L2 nudge as a `<system-reminder>`.
142
+ - The agent calls `Task` with `subagent_type="verification"`.
143
+ - The verifier subagent returns a `VERDICT: PASS / FAIL / PARTIAL` line.
144
+ - The main agent echoes the verdict in its final response.
145
+
146
+ If the model ignores the nudge twice in a row, the loop falls through to
147
+ `completed` so you don't hang — that's intentional safety, not a bug.
148
+
149
+ Without `UR_VERIFIER_AUTO_SUBAGENT`, the same prompt finishes with no nudge —
150
+ that's the default. To also unregister the subagent entirely (so `/verify`
151
+ can't spawn it either):
152
+
153
+ ```sh
154
+ UR_VERIFIER_DISABLE_SUBAGENT=1 ur
155
+ ```
156
+
157
+ ## 6. `/verify` works manually
158
+
159
+ ```text
160
+ /verify the docstring you added
161
+ ```
162
+
163
+ Expected: agent spawns the verification subagent and reports the verdict.
164
+ Same flow as step 5 but on demand.
165
+
166
+ ## 7. `/trace` works
167
+
168
+ ```text
169
+ /trace 12
170
+ ```
171
+
172
+ Expected: a numbered list of the last 12 messages with role, uuid prefix,
173
+ text previews, `tool_use` signatures, and any `tool_result` bodies. Any
174
+ turn that produced a `VERDICT:` line gets a `verdict: PASS/FAIL/PARTIAL`
175
+ annotation.
176
+
177
+ Try `/trace 999` to confirm it caps at 50.
178
+
179
+ ## 8. System-reminder filter
180
+
181
+ If you've already triggered steps 2-5, look at the visible assistant prose
182
+ for any literal `<system-reminder>` text. There should be none. The filter
183
+ strips them at render time as defense in depth even if the model echoes a
184
+ reminder back.
185
+
186
+ ## What to do if any step fails
187
+
188
+ - Step 1 (marketplace): check `ls ~/.ur/marketplaces/` — `ur-plugins-official`
189
+ should be there. If absent, `gh repo clone Maitham16/UR-mapek` manually
190
+ into `~/.ur/marketplaces/ur-plugins-official` as a fallback.
191
+ - Steps 2-5 (verifier): set `UR_VERIFIER_MODE=off` and re-run to confirm
192
+ the issue is the verifier path, not the rest of the loop. Then file an
193
+ issue with the exact prompt + the model name (`ollama list`).
194
+ - Step 6/7 (slash commands): `/help` should show them. If not, they failed
195
+ to register — file an issue with the version (`ur --version`).
196
+ - Step 8 (filter): if `<system-reminder>` appears in visible prose, copy
197
+ the literal output and file an issue.
@@ -0,0 +1,11 @@
1
+ # Basic chat
2
+
3
+ ```bash
4
+ ur # starts the interactive TUI (big UR banner)
5
+ ```
6
+
7
+ - Pick a model at startup, or switch any time with `/model`.
8
+ - `/models` lists installed Ollama models (or reports a clean error if Ollama is offline).
9
+ - Type normally to chat with the selected model. Streaming is live; press `Esc` to interrupt.
10
+ - `Ctrl+V` pastes an image from the clipboard for the model to analyze.
11
+ - `/usage` shows token usage; `/status` shows model, workspace, git, OS.
@@ -0,0 +1,7 @@
1
+ # Browser
2
+
3
+ - `/chrome` drives a real browser via the built-in browser integration
4
+ (navigate, read, screenshot) — risky actions ask for approval.
5
+ - `/browser <url|task>` is Playwright-aware: if Playwright is installed it can
6
+ script the page; otherwise it prints the install command and points to `/chrome`.
7
+ - Browsing actions that submit forms, download, or log in require explicit approval.
@@ -0,0 +1,14 @@
1
+ # Coding task
2
+
3
+ ```text
4
+ > add a /health route to server.ts and a test for it
5
+ ```
6
+
7
+ UR plans, reads files, edits, and can run tests. Safety + stability:
8
+
9
+ - Edits are diffable: `/diff` shows uncommitted changes; `/rewind` rolls back.
10
+ - Every tool call is recorded to `.ur/actions.jsonl` — see `/actions`, `/evidence`.
11
+ - `/stability metrics` and `/stability firewall` surface oscillation, repeated
12
+ failures, latency spikes, and blast-radius from the action ledger.
13
+ - `/stability why "<error>"` ranks likely root causes of a failure.
14
+ - Writes outside the workspace and destructive commands require approval.
@@ -0,0 +1,8 @@
1
+ # Images
2
+
3
+ - Paste from clipboard with `Ctrl+V`, then ask about the image — the model's
4
+ vision path handles it (requires a vision-capable model).
5
+ - `/image <file> [task]` inspects an image by path (absolute or workspace).
6
+ Reports size/format; notes when OCR (`tesseract`) is available.
7
+ - If the vision model isn't installed, UR tells you the exact `ollama pull`
8
+ command instead of failing silently.
@@ -0,0 +1,7 @@
1
+ # MCP
2
+
3
+ - `/mcp` lists configured MCP servers and lets you add/manage them.
4
+ - Servers are configured in your settings (`.mcp.json` / UR settings); UR maps
5
+ their tools into the registry and runs them through the same approval +
6
+ evidence-ledger path as built-in tools (so MCP calls appear in `/evidence`).
7
+ - Risky MCP tools require approval before they run.
@@ -0,0 +1,9 @@
1
+ # Memory
2
+
3
+ - `/remember <text>` saves a fact/preference; `/forget <text>` removes matches;
4
+ `/memory` edits the memory files. Notes persist in `.ur/memory/notes.jsonl`.
5
+ - Project conventions live in project instruction files and the project DNA file.
6
+ - `/dna` detects language, package manager, build/test/lint/run commands,
7
+ ignored folders, and README, saved to `.ur/project_dna.md`.
8
+ - `/ur-init` scaffolds the `.ur/` asset folder (docs, superpowers, brainstorming,
9
+ memory, prompts).
@@ -0,0 +1,13 @@
1
+ # Research task
2
+
3
+ ```text
4
+ > summarize the MAPE-K paper and extract its claims and metrics
5
+ ```
6
+
7
+ - `/research <note>` and `/research` to add/list notes.
8
+ - `/paper <title|path>` and `/cite <ref>` to record papers and citations.
9
+ - `/graph` is the Research Graph (sources, papers, claims, methods, datasets,
10
+ metrics, limitations, citations, concepts, notes, experiments, open_questions,
11
+ links). e.g. `/graph claims local actions reduce oscillation`.
12
+ - `/read <file>`, `/summarize <file>`, `/search <query>`, `/index` for files.
13
+ - Web fetch degrades gracefully (built-in HTML→text if `turndown` is absent).
@@ -0,0 +1,8 @@
1
+ # Video & YouTube
2
+
3
+ These are dependency-aware: they do the local part and tell you what to install.
4
+
5
+ - `/video <file|url> [task]` — checks `ffmpeg` (frames/audio) and `yt-dlp`
6
+ (download); with them present, ask UR to extract frames or a transcript.
7
+ - `/youtube <url> [task]` — checks `yt-dlp`; fetches metadata/subtitles/transcript
8
+ when installed (`brew install yt-dlp ffmpeg`).