amness 0.0.0-stage → 0.1.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.
Files changed (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +212 -2
  3. package/dist/cli/acpcli.d.ts +7 -0
  4. package/dist/cli/acpcli.js +14 -0
  5. package/dist/cli/amness.d.ts +2 -0
  6. package/dist/cli/amness.js +693 -0
  7. package/dist/cli/benchcli.d.ts +5 -0
  8. package/dist/cli/benchcli.js +160 -0
  9. package/dist/cli/config.d.ts +79 -0
  10. package/dist/cli/config.js +54 -0
  11. package/dist/cli/demo.d.ts +13 -0
  12. package/dist/cli/demo.js +44 -0
  13. package/dist/cli/detect.d.ts +2 -0
  14. package/dist/cli/detect.js +20 -0
  15. package/dist/cli/evalcli.d.ts +15 -0
  16. package/dist/cli/evalcli.js +198 -0
  17. package/dist/cli/format.d.ts +5 -0
  18. package/dist/cli/format.js +55 -0
  19. package/dist/cli/headless.d.ts +2 -0
  20. package/dist/cli/headless.js +169 -0
  21. package/dist/cli/model.d.ts +11 -0
  22. package/dist/cli/model.js +19 -0
  23. package/dist/cli/plugincli.d.ts +2 -0
  24. package/dist/cli/plugincli.js +176 -0
  25. package/dist/cli/schedulecli.d.ts +2 -0
  26. package/dist/cli/schedulecli.js +66 -0
  27. package/dist/cli/state.d.ts +11 -0
  28. package/dist/cli/state.js +19 -0
  29. package/dist/cli/tui/ansi.d.ts +38 -0
  30. package/dist/cli/tui/ansi.js +142 -0
  31. package/dist/cli/tui/app.d.ts +328 -0
  32. package/dist/cli/tui/app.js +1358 -0
  33. package/dist/cli/tui/blocks.d.ts +151 -0
  34. package/dist/cli/tui/blocks.js +128 -0
  35. package/dist/cli/tui/brand.d.ts +9 -0
  36. package/dist/cli/tui/brand.js +16 -0
  37. package/dist/cli/tui/canvas.d.ts +92 -0
  38. package/dist/cli/tui/canvas.js +199 -0
  39. package/dist/cli/tui/cards.d.ts +44 -0
  40. package/dist/cli/tui/cards.js +215 -0
  41. package/dist/cli/tui/clipboard.d.ts +5 -0
  42. package/dist/cli/tui/clipboard.js +29 -0
  43. package/dist/cli/tui/commands.d.ts +10 -0
  44. package/dist/cli/tui/commands.js +649 -0
  45. package/dist/cli/tui/complete.d.ts +39 -0
  46. package/dist/cli/tui/complete.js +113 -0
  47. package/dist/cli/tui/custom.d.ts +9 -0
  48. package/dist/cli/tui/custom.js +34 -0
  49. package/dist/cli/tui/diffview.d.ts +25 -0
  50. package/dist/cli/tui/diffview.js +130 -0
  51. package/dist/cli/tui/editor.d.ts +60 -0
  52. package/dist/cli/tui/editor.js +230 -0
  53. package/dist/cli/tui/full.d.ts +86 -0
  54. package/dist/cli/tui/full.js +630 -0
  55. package/dist/cli/tui/keys.d.ts +31 -0
  56. package/dist/cli/tui/keys.js +134 -0
  57. package/dist/cli/tui/markdown.d.ts +37 -0
  58. package/dist/cli/tui/markdown.js +155 -0
  59. package/dist/cli/tui/mentions.d.ts +15 -0
  60. package/dist/cli/tui/mentions.js +48 -0
  61. package/dist/cli/tui/modal.d.ts +26 -0
  62. package/dist/cli/tui/modal.js +107 -0
  63. package/dist/cli/tui/overlays.d.ts +98 -0
  64. package/dist/cli/tui/overlays.js +237 -0
  65. package/dist/cli/tui/pager.d.ts +15 -0
  66. package/dist/cli/tui/pager.js +66 -0
  67. package/dist/cli/tui/pricing.d.ts +9 -0
  68. package/dist/cli/tui/pricing.js +23 -0
  69. package/dist/cli/tui/rich.d.ts +16 -0
  70. package/dist/cli/tui/rich.js +72 -0
  71. package/dist/cli/tui/screen.d.ts +30 -0
  72. package/dist/cli/tui/screen.js +62 -0
  73. package/dist/cli/tui/session.d.ts +77 -0
  74. package/dist/cli/tui/session.js +103 -0
  75. package/dist/cli/tui/sidebar.d.ts +84 -0
  76. package/dist/cli/tui/sidebar.js +114 -0
  77. package/dist/cli/tui/text.d.ts +15 -0
  78. package/dist/cli/tui/text.js +94 -0
  79. package/dist/cli/tui/theme.d.ts +59 -0
  80. package/dist/cli/tui/theme.js +148 -0
  81. package/dist/cli/tui/themes.d.ts +56 -0
  82. package/dist/cli/tui/themes.js +80 -0
  83. package/dist/cli/tui/tokens.d.ts +39 -0
  84. package/dist/cli/tui/tokens.js +71 -0
  85. package/dist/cli/tui/view.d.ts +60 -0
  86. package/dist/cli/tui/view.js +178 -0
  87. package/dist/cli/ui.d.ts +34 -0
  88. package/dist/cli/ui.js +224 -0
  89. package/dist/src/acp.d.ts +28 -0
  90. package/dist/src/acp.js +111 -0
  91. package/dist/src/agents.d.ts +23 -0
  92. package/dist/src/agents.js +71 -0
  93. package/dist/src/anthropic.d.ts +30 -0
  94. package/dist/src/anthropic.js +91 -0
  95. package/dist/src/approver.d.ts +15 -0
  96. package/dist/src/approver.js +40 -0
  97. package/dist/src/bench.d.ts +67 -0
  98. package/dist/src/bench.js +201 -0
  99. package/dist/src/bundle.d.ts +36 -0
  100. package/dist/src/bundle.js +55 -0
  101. package/dist/src/chaos.d.ts +15 -0
  102. package/dist/src/chaos.js +26 -0
  103. package/dist/src/code.d.ts +187 -0
  104. package/dist/src/code.js +590 -0
  105. package/dist/src/codeindex.d.ts +65 -0
  106. package/dist/src/codeindex.js +300 -0
  107. package/dist/src/deep.d.ts +62 -0
  108. package/dist/src/deep.js +177 -0
  109. package/dist/src/diff.d.ts +8 -0
  110. package/dist/src/diff.js +74 -0
  111. package/dist/src/dynamic.d.ts +42 -0
  112. package/dist/src/dynamic.js +133 -0
  113. package/dist/src/embed.d.ts +8 -0
  114. package/dist/src/embed.js +25 -0
  115. package/dist/src/evalcases.d.ts +11 -0
  116. package/dist/src/evalcases.js +196 -0
  117. package/dist/src/evals.d.ts +197 -0
  118. package/dist/src/evals.js +340 -0
  119. package/dist/src/gitflow.d.ts +27 -0
  120. package/dist/src/gitflow.js +56 -0
  121. package/dist/src/grade.d.ts +42 -0
  122. package/dist/src/grade.js +96 -0
  123. package/dist/src/guidance.d.ts +15 -0
  124. package/dist/src/guidance.js +68 -0
  125. package/dist/src/hardcases.d.ts +2 -0
  126. package/dist/src/hardcases.js +94 -0
  127. package/dist/src/harness.d.ts +411 -0
  128. package/dist/src/harness.js +725 -0
  129. package/dist/src/hooks.d.ts +44 -0
  130. package/dist/src/hooks.js +116 -0
  131. package/dist/src/images.d.ts +13 -0
  132. package/dist/src/images.js +27 -0
  133. package/dist/src/index.d.ts +57 -0
  134. package/dist/src/index.js +57 -0
  135. package/dist/src/ledger.d.ts +58 -0
  136. package/dist/src/ledger.js +78 -0
  137. package/dist/src/live.d.ts +16 -0
  138. package/dist/src/live.js +80 -0
  139. package/dist/src/lsp.d.ts +31 -0
  140. package/dist/src/lsp.js +147 -0
  141. package/dist/src/memory.d.ts +128 -0
  142. package/dist/src/memory.js +390 -0
  143. package/dist/src/metrics.d.ts +3 -0
  144. package/dist/src/metrics.js +42 -0
  145. package/dist/src/mining.d.ts +49 -0
  146. package/dist/src/mining.js +126 -0
  147. package/dist/src/openai.d.ts +50 -0
  148. package/dist/src/openai.js +307 -0
  149. package/dist/src/parallel.d.ts +66 -0
  150. package/dist/src/parallel.js +135 -0
  151. package/dist/src/patch.d.ts +45 -0
  152. package/dist/src/patch.js +219 -0
  153. package/dist/src/permissions.d.ts +46 -0
  154. package/dist/src/permissions.js +245 -0
  155. package/dist/src/plugins.d.ts +148 -0
  156. package/dist/src/plugins.js +225 -0
  157. package/dist/src/pluginscan.d.ts +8 -0
  158. package/dist/src/pluginscan.js +20 -0
  159. package/dist/src/procs.d.ts +41 -0
  160. package/dist/src/procs.js +94 -0
  161. package/dist/src/profiles.d.ts +36 -0
  162. package/dist/src/profiles.js +61 -0
  163. package/dist/src/progress.d.ts +29 -0
  164. package/dist/src/progress.js +75 -0
  165. package/dist/src/prompts.d.ts +10 -0
  166. package/dist/src/prompts.js +28 -0
  167. package/dist/src/ratelimit.d.ts +34 -0
  168. package/dist/src/ratelimit.js +116 -0
  169. package/dist/src/replay.d.ts +25 -0
  170. package/dist/src/replay.js +99 -0
  171. package/dist/src/review.d.ts +20 -0
  172. package/dist/src/review.js +49 -0
  173. package/dist/src/route.d.ts +9 -0
  174. package/dist/src/route.js +30 -0
  175. package/dist/src/router.d.ts +61 -0
  176. package/dist/src/router.js +126 -0
  177. package/dist/src/sandbox.d.ts +13 -0
  178. package/dist/src/sandbox.js +68 -0
  179. package/dist/src/schedule.d.ts +20 -0
  180. package/dist/src/schedule.js +59 -0
  181. package/dist/src/schema.d.ts +13 -0
  182. package/dist/src/schema.js +36 -0
  183. package/dist/src/secrets.d.ts +10 -0
  184. package/dist/src/secrets.js +41 -0
  185. package/dist/src/shell.d.ts +34 -0
  186. package/dist/src/shell.js +95 -0
  187. package/dist/src/skills.d.ts +20 -0
  188. package/dist/src/skills.js +112 -0
  189. package/dist/src/snapshot.d.ts +20 -0
  190. package/dist/src/snapshot.js +93 -0
  191. package/dist/src/stats.d.ts +24 -0
  192. package/dist/src/stats.js +62 -0
  193. package/dist/src/strategies.d.ts +16 -0
  194. package/dist/src/strategies.js +35 -0
  195. package/dist/src/suites.d.ts +30 -0
  196. package/dist/src/suites.js +112 -0
  197. package/dist/src/trace.d.ts +63 -0
  198. package/dist/src/trace.js +153 -0
  199. package/dist/src/tune.d.ts +38 -0
  200. package/dist/src/tune.js +49 -0
  201. package/dist/src/web.d.ts +19 -0
  202. package/dist/src/web.js +56 -0
  203. package/dist/src/worktree.d.ts +24 -0
  204. package/dist/src/worktree.js +85 -0
  205. package/docs/agent-loop.md +222 -0
  206. package/docs/architecture.md +228 -0
  207. package/docs/bench.md +293 -0
  208. package/docs/budgets.md +185 -0
  209. package/docs/build-your-own-harness.md +424 -0
  210. package/docs/cookbook.md +375 -0
  211. package/docs/development.md +150 -0
  212. package/docs/evaluation.md +450 -0
  213. package/docs/features.md +1320 -0
  214. package/docs/getting-started.md +196 -0
  215. package/docs/headless.md +183 -0
  216. package/docs/images/approval.png +0 -0
  217. package/docs/images/chat.png +0 -0
  218. package/docs/images/daylight.png +0 -0
  219. package/docs/images/loop.png +0 -0
  220. package/docs/images/palette.png +0 -0
  221. package/docs/images/running.png +0 -0
  222. package/docs/images/subagent-done.png +0 -0
  223. package/docs/images/subagent-running.png +0 -0
  224. package/docs/images/welcome.png +0 -0
  225. package/docs/index.md +25 -0
  226. package/docs/library.md +276 -0
  227. package/docs/plugins.md +691 -0
  228. package/docs/providers.md +175 -0
  229. package/docs/safety.md +237 -0
  230. package/docs/usage.md +348 -0
  231. package/docs/why.md +155 -0
  232. package/docs/writing-guide.md +39 -0
  233. package/package.json +72 -4
@@ -0,0 +1,175 @@
1
+ # Providers and models
2
+
3
+ A *provider* is the service that runs the model (for example OpenAI or Anthropic), and Amness works with several of them, including models on your own computer.
4
+
5
+ In this page you will learn:
6
+
7
+ - which providers Amness supports and what the defaults are
8
+ - how to set an API key and switch provider or model
9
+ - how to run a local model with Ollama or another server
10
+ - how the OpenAI "Responses" and "Chat" APIs differ, and the environment variables you can set
11
+
12
+ ## Supported providers
13
+
14
+ | Provider | Notes |
15
+ |---|---|
16
+ | **OpenAI** | The default provider. The default model is `gpt-6.1-sol`. Reasoning models use the **Responses API**. `/model` lists Sol, Astra, Terra, Luna and earlier models. |
17
+ | **Anthropic (Claude)** | Uses the native SDK adapter: streaming, adaptive thinking with `/effort`, automatic prompt caching and server-side refusal fallbacks. The default model is `claude-opus-5-5`. |
18
+ | **OpenRouter, Ollama, vLLM, LM Studio, any OpenAI-compatible server** | Use Chat Completions. Tool-calling quality depends on the model. |
19
+
20
+ The provider ids you can pass to `--provider` are `anthropic`, `openai`, `openrouter`, `ollama` and `custom`. The defaults for each id are in the table below.
21
+
22
+ | Id | Default base URL | Default model | Needs a key |
23
+ |---|---|---|---|
24
+ | `anthropic` | `https://api.anthropic.com` | `claude-opus-5-5` | yes |
25
+ | `openai` | `https://api.openai.com/v1` | `gpt-6.1-sol` | yes |
26
+ | `openrouter` | `https://openrouter.ai/api/v1` | `openai/gpt-4.1` | yes |
27
+ | `ollama` | `http://localhost:11434/v1` | `qwen2.5-coder:7b` | no |
28
+ | `custom` | `http://localhost:8000/v1` | `my-model` | no |
29
+
30
+ The model list in `/model` (with prices per million tokens as shown in the picker) is in `cli/config.ts`. Costs shown in Amness are estimates.
31
+
32
+ ## Set your API key
33
+
34
+ **What it is.** A key is a secret text that proves you can use a provider.
35
+
36
+ **Why you would use it.** Without a key, a cloud provider refuses every request.
37
+
38
+ **How to set it.**
39
+
40
+ 1. Choose one way.
41
+
42
+ - Set an environment variable before you start Amness:
43
+
44
+ ```bash
45
+ export ANTHROPIC_API_KEY=sk-ant-...
46
+ ```
47
+
48
+ or
49
+
50
+ ```bash
51
+ export OPENAI_API_KEY=sk-...
52
+ ```
53
+
54
+ - Or start `amness`. On the first start it asks for a provider and a key. The key is hidden while you type.
55
+ - Or type `/provider` in the chat, or run `amness settings`.
56
+
57
+ 2. Start the chat.
58
+
59
+ ```bash
60
+ amness
61
+ ```
62
+
63
+ **Example.** After you save a key, the setup runs a test call. You see a line like `✓ claude-opus-5-5 replied "OK" in 1.2s`. The time is an example.
64
+
65
+ **Limits and common problems.**
66
+
67
+ - Amness saves a key you type in `~/.amness/config.json` with file mode 600 (only you can read it).
68
+ - The environment variable wins over the saved file. `ANTHROPIC_API_KEY` is used when the provider is `anthropic`. `OPENAI_API_KEY` is used for **every other provider**, including `openrouter`. `OPENROUTER_API_KEY` is not read as a key.
69
+ - If the chat says "check your key with /provider", the provider answered with an authentication error (401 or 403).
70
+ - The test call checks that the model replies. It does not check that the model can call tools.
71
+
72
+ ## Switch provider, model or effort
73
+
74
+ **How to switch in the chat.**
75
+
76
+ 1. Type `/provider` and choose a provider. Amness asks for a key if it needs one.
77
+ 2. Type `/model` and choose a model, or type `/model <id>`.
78
+ 3. Type `/effort` to choose how much the model thinks before it answers. A higher effort can help on hard tasks and uses more tokens. Not every model has this setting.
79
+
80
+ **How to switch for one run.** Use flags (they also work with `amness run`):
81
+
82
+ ```bash
83
+ amness run --provider anthropic --model claude-sonnet-5-5 "explain src/index.ts"
84
+ ```
85
+
86
+ The flags `--provider`, `--model`, `--base-url`, `--effort` and `--api` are read by `amness run`. The interactive `amness` command does not read them. In the code, `amness --provider ollama` would send the extra words as your first message. Use `/provider` and `/model` in the chat. You can also set `AMNESS_MODEL` before you start.
87
+
88
+ **Other models for other jobs.** `/models explore|compact|review|cheap <model>` uses a different model of the same provider for one job. `/models fallback <model>` names a model to use when the main one is overloaded or not reachable. See [Features: Models per job and a fallback](features.md#models-per-job-and-a-fallback).
89
+
90
+ ## Run a local model
91
+
92
+ **What it is.** A local model runs on your own computer, through a server such as Ollama, LM Studio, vLLM or llama.cpp. Any server with an OpenAI-compatible `/v1` endpoint can work.
93
+
94
+ **Why you would use it.** Your code does not leave your computer, and you need no API key.
95
+
96
+ **How to use it with Ollama.**
97
+
98
+ 1. Download a model that supports tool calling.
99
+
100
+ ```bash
101
+ ollama pull qwen2.5-coder:7b
102
+ ```
103
+
104
+ 2. Choose Ollama in Amness. Use `amness settings`, or `/provider` in the chat, and pick "Ollama (local)". The base URL defaults to `http://localhost:11434/v1`.
105
+ 3. Check the model with `/status`.
106
+
107
+ For a one-shot run you can use flags. In the chat, the flags `--provider` and `--model` are not read (see above), so use `/provider` there.
108
+
109
+ ```bash
110
+ amness run --provider ollama --model qwen2.5-coder:7b "list the TODO comments in src"
111
+ ```
112
+
113
+ **How to use it with another server.**
114
+
115
+ ```bash
116
+ amness run --provider custom --base-url http://localhost:1234/v1 --model <model-name> "your task"
117
+ ```
118
+
119
+ In the chat, run `/provider`, pick "Custom OpenAI-compatible", and type the model id and the base URL when Amness asks.
120
+
121
+ **Limits and common problems.**
122
+
123
+ - Agent work needs **tool calling**, so choose a model that supports it. Small models can fail at it. Tool-calling quality varies a lot between local models.
124
+ - Small models may do better in `/mode plan`, with a token limit (`--max-tokens` in `amness run`, or `/budget` in the chat).
125
+ - Features that need an endpoint that Amness cannot assume on your computer (semantic memory, the Claude-only cache keep-alive) say so when you try them.
126
+ - `amness eval --variants ab` can show whether the guards help the model you chose. Whether they help is **not measured yet** for local models. See [Evaluating the harness](evaluation.md).
127
+ - Vision support for local models is guessed from the model name.
128
+
129
+ ## Understand the OpenAI Responses and Chat APIs
130
+
131
+ **What it is.** OpenAI has two ways to talk to a model: the *Responses API* (`/v1/responses`) and the *Chat Completions API* (`/v1/chat/completions`). The adapter `src/openai.ts` speaks both.
132
+
133
+ **Why it matters.** Since GPT-5.4, Chat Completions rejects function tools together with reasoning (`400: Function tools with reasoning_effort are not supported ... use /v1/responses`). Current reasoning models therefore need Responses.
134
+
135
+ **How to choose.** Type `/api auto`, `/api responses` or `/api chat`, or pass `--api` to `amness run`. `auto` is the default.
136
+
137
+ | Mode | What it does |
138
+ |---|---|
139
+ | `auto` | Uses Responses for reasoning models on `api.openai.com`, and Chat Completions elsewhere. It corrects itself while it runs (see below). |
140
+ | `responses` | Always uses `/v1/responses`. |
141
+ | `chat` | Always uses `/v1/chat/completions`. This is what Ollama, vLLM and most gateways use. |
142
+
143
+ In `auto` mode Amness fixes these cases for you:
144
+
145
+ - If a server says to use `/v1/responses`, Amness switches and remembers.
146
+ - If a gateway has no `/responses`, Amness goes back to chat and uses the documented `reasoning_effort: "none"` workaround.
147
+ - If a server refuses an option (reasoning summaries for an unverified organisation, an unsupported effort, or `prompt_cache_key`), Amness drops that option once. It does not fail every request.
148
+
149
+ **Privacy detail.** In Responses mode the requests are stateless (`store: false`), so nothing is kept on the server side. Amness sends encrypted reasoning items back with each tool result, so multi-step tool use keeps its reasoning. Reasoning summaries stream into the status area while the model thinks. A model switch never replays another model's reasoning.
150
+
151
+ ## Environment variables
152
+
153
+ | Variable | What it does |
154
+ |---|---|
155
+ | `OPENAI_API_KEY` | The key for every provider except `anthropic`. |
156
+ | `ANTHROPIC_API_KEY` | The key for `anthropic`. |
157
+ | `OPENAI_BASE_URL` | The base URL for non-Claude providers. |
158
+ | `AMNESS_MODEL` | The model id. It wins over the saved config. |
159
+ | `AMNESS_HOME` | The config folder. The default is `~/.amness`. |
160
+ | `AMNESS_UI` | `full` or `inline`. |
161
+ | `AMNESS_EMBED_MODEL` | The embedding model for semantic memory. The default is `text-embedding-3-small`. |
162
+ | `TAVILY_API_KEY` | Better web search for the research agent. |
163
+ | `NO_COLOR` | Turns colours off. |
164
+
165
+ ## Related pages
166
+
167
+ - [Using the chat](usage.md): the `/provider`, `/model`, `/effort`, `/api` and `/models` commands.
168
+ - [Headless and CI](headless.md): choose the provider in scripts.
169
+ - [Budgets and subagents](budgets.md): rate limits and token caps.
170
+
171
+ ## Next steps
172
+
173
+ - [Getting started](getting-started.md)
174
+ - [Using the chat](usage.md)
175
+ - [Headless and CI](headless.md)
package/docs/safety.md ADDED
@@ -0,0 +1,237 @@
1
+ # Safety and privacy
2
+
3
+ This page tells you what data leaves your machine, what stops the agent from doing harm, and what does not protect you.
4
+
5
+ In this page you will learn:
6
+
7
+ - which servers receive your data, and what you send them
8
+ - what the agent can and cannot do on your computer
9
+ - how to make Amness stricter, with exact commands
10
+ - which risks Amness does not cover
11
+
12
+ Amness is a terminal coding agent. A *model provider* is the company or server that runs the AI model, for example OpenAI or Anthropic. A *shell command* is a line of text that the agent runs in your terminal, such as `npm test`.
13
+
14
+ ## Check what leaves your machine
15
+
16
+ **What it is.** Amness sends text to the model provider you choose. It sends nothing to Amness servers. The code has no telemetry. The code makes no request to any other host than the ones in the table below (checked in `src/openai.ts`, `src/anthropic.ts`, `src/web.ts`, `src/embed.ts`, `src/trace.ts` and `src/dynamic.ts`).
17
+
18
+ **Why it matters.** Anything the model reads, the provider receives. This includes the files the agent reads and the output of commands it runs.
19
+
20
+ | What is sent | Where it goes | When |
21
+ |---|---|---|
22
+ | Your messages, tool results, file contents the agent reads, command output, memory notes, `AGENTS.md` text | The provider you configure (`https://api.openai.com/v1`, `https://api.anthropic.com`, OpenRouter, or your own `baseUrl`) | Every model request |
23
+ | Pictures you attach with `@file` | The same provider | Only when you attach them |
24
+ | Note text and your messages, to build search vectors | The `/embeddings` endpoint of your OpenAI-compatible provider | Only when `/memory embeddings on` is set. It is off by default. Claude has no such endpoint |
25
+ | Search queries | `https://api.tavily.com` if `TAVILY_API_KEY` is set, otherwise `https://html.duckduckgo.com` | Only in the research agent (`createDeepAgent`) |
26
+ | Page requests | The web page you or the research agent fetch (`fetch_url`). It refuses local and private addresses | Only in the research agent |
27
+ | A trace of loop events | The URL in `AMNESS_OTLP` | Only when you set that variable. Secrets are masked first |
28
+ | A second model call that reads a risky command | The same provider (or the model you name) | Only when `approvalReviewer` is on |
29
+ | Tool calls and tool results | An MCP server you start with `/mcp <command>`. It runs on your machine as a child process | Only when you attach one. The server can contact other hosts. Amness cannot see that |
30
+
31
+ Notes about the provider:
32
+
33
+ - OpenAI requests use `store: false` by default. This means OpenAI is asked not to keep the response. Amness replays the encrypted reasoning itself. You can turn this off with the `store` option in the library. This is the setting in the code. Amness cannot check what the provider really does.
34
+ - With `--provider ollama` or another local server, requests go to `http://localhost:11434/v1` or the `baseUrl` you set. Nothing leaves your machine unless that server forwards it.
35
+
36
+ ## Know where your keys are stored
37
+
38
+ - Keys come from the environment variables `OPENAI_API_KEY` and `ANTHROPIC_API_KEY`, or from `~/.amness/config.json`. Amness writes that file with mode 600. Only your user can read it.
39
+ - The environment variable wins over the saved key.
40
+ - Amness does not write keys into a project folder.
41
+ - Commands the agent runs do not get your Amness keys. The variables `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `TAVILY_API_KEY`, `OPENROUTER_API_KEY` and `AMNESS_OTLP` are removed from their environment (`childEnv` in `src/secrets.ts`).
42
+ - Hooks run with an even smaller environment. Any variable whose name contains `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL` or `AUTH` is removed (`scrubbedEnv` in `src/hooks.ts`).
43
+ - An MCP server gets your full environment (`loadMcp` passes `process.env`). Pass `env` and review what you start.
44
+
45
+ ## See what the agent can and cannot do
46
+
47
+ | The agent can | The agent cannot (tested in `test/permissions.test.ts`, `test/sandbox.test.ts`, `test/taint.test.ts`, `test/secrets.test.ts`) |
48
+ |---|---|
49
+ | Read and edit files inside the workspace, after it has read them | Edit a file outside the workspace with its file tools (`path escapes the workspace`) |
50
+ | Run shell commands you approve, or that a rule allows | Run `rm -rf /`, `rm -rf ~`, `mkfs`, a fork bomb, or force-push to `main` or `master`. This is the *floor*. The floor holds in every mode, also `yolo` |
51
+ | Run read-only commands such as `ls`, `cat`, `git status` without asking | Edit `.git` files with file tools |
52
+ | Start background processes with `sh_start` | Edit `.amness/hooks.json` or `.amness/permissions.json`, with file tools or with shell commands |
53
+ | Use tools from an MCP server you attached | Skip your `deny` rules |
54
+ | | Run a command that contains text copied from a web page or MCP tool result, without you approving it (the *taint check*) |
55
+ | | Show you a raw secret in tool output that matches a known pattern (it is masked) |
56
+
57
+ ### How a request is judged
58
+
59
+ Each tool call passes through these layers, in this order. The first layer that decides, wins.
60
+
61
+ 1. The *floor*: built-in refusals and built-in questions.
62
+ 2. Your `deny` rules.
63
+ 3. The *taint check*: a shell command that copies three or more words (or one very long word) from untrusted tool output needs your approval.
64
+ 4. Your `ask` rules.
65
+ 5. Your `allow` rules.
66
+ 6. The permission mode: `default`, `acceptEdits`, `plan` or `yolo`.
67
+
68
+ Some commands always ask, even in `yolo`: `curl ... | sh`, `git push --force`, and commands that decode a payload and run it.
69
+
70
+ ### What the floor does not stop
71
+
72
+ The floor and the risk list match patterns in the command text. Amness also decodes simple tricks such as `r""m`, `$'\x72m'` and `sh -c '...'`. A new trick can still get past a pattern. Treat the floor as a safety net, not as a guarantee.
73
+
74
+ ### Secret masking
75
+
76
+ Before the model sees a tool result, Amness replaces known secret formats with `[REDACTED:<kind>]`. It knows keys from Anthropic, OpenAI, GitHub, AWS, Slack, Google, Stripe and npm, private keys, JWT tokens, `Bearer` tokens, and assignments such as `PASSWORD=...`. The same masking is applied to trace files.
77
+
78
+ Masking has limits:
79
+
80
+ - It only applies to tool results. It does not touch what you type.
81
+ - It finds patterns. A secret in a format it does not know passes through.
82
+ - Masking is not applied to memory notes or `AGENTS.md` text (not verified in the memory code).
83
+
84
+ ## Make Amness stricter
85
+
86
+ ### Turn on the sandbox
87
+
88
+ **What it is.** The *sandbox* is a feature of your operating system that limits what a program can do. On macOS Amness uses Seatbelt (`sandbox-exec`). On Linux it uses Bubblewrap (`bwrap`).
89
+
90
+ **Why you would use it.** Permission prompts are a policy. The sandbox is enforcement. Even an approved command cannot write outside the project.
91
+
92
+ **How to use it.**
93
+
94
+ 1. On Linux, install Bubblewrap: `sudo apt install bubblewrap`.
95
+ 2. In the chat, run one of these:
96
+
97
+ ```text
98
+ /sandbox workspace
99
+ /sandbox strict
100
+ ```
101
+
102
+ 3. For a headless run, add the flag:
103
+
104
+ ```bash
105
+ amness run --sandbox strict "list the TODO comments"
106
+ ```
107
+
108
+ 4. To keep it for every session, put it in `~/.amness/config.json`:
109
+
110
+ ```json
111
+ { "sandbox": "strict" }
112
+ ```
113
+
114
+ **Example.** With `/sandbox strict` on, ask the agent to run `curl https://example.com`. The command fails because the network is cut. Run `/sandbox` with no argument to see the current mode.
115
+
116
+ | Mode | Writes allowed in | `.git` | Network | Your credential-looking variables |
117
+ |---|---|---|---|---|
118
+ | `off` | everywhere your user can write | writable | yes | passed on (except Amness keys) |
119
+ | `workspace` | the project, temp folders, package caches | read-only | yes | removed from the environment |
120
+ | `strict` | the project and temp folders | read-only | no | removed from the environment |
121
+
122
+ **Limits and common problems.**
123
+
124
+ - Reads are not limited. A sandboxed command can still read `~/.ssh` or any file your user can read (tested in `test/sandbox.test.ts`). In `workspace` mode it can also send data over the network.
125
+ - The sandbox covers shell commands and background processes. It does not cover the file tools (they have their own workspace check), hooks, plugins, or MCP servers.
126
+ - There is no Windows sandbox. On Windows, asking for a sandbox gives an error.
127
+ - If the sandbox is on but cannot start, Amness refuses to run the command. It never runs it unprotected without telling you. Use `/sandbox off` to turn it off on purpose.
128
+ - `strict` stops `npm install` and anything else that needs the network.
129
+ - On some Linux systems and containers, Bubblewrap is installed but the kernel does not allow it. Amness tests this when it starts.
130
+
131
+ ### Add permission rules
132
+
133
+ **What it is.** A rule says "allow", "ask" or "deny" for a tool. The syntax is `tool(pattern)`. Tools are `sh`, `edit` and `read`. In a `sh` pattern, `*` matches anything. In a path pattern, `*` stays inside one folder and `**` crosses folders.
134
+
135
+ **How to use it.**
136
+
137
+ 1. Add a rule in the chat:
138
+
139
+ ```text
140
+ /permissions deny sh(git push*)
141
+ /permissions deny edit(.env)
142
+ /permissions ask sh(git commit*)
143
+ ```
144
+
145
+ 2. Or write the file `.amness/permissions.json` (project) or `~/.amness/permissions.json` (all projects):
146
+
147
+ ```json
148
+ {
149
+ "allow": ["sh(npm test*)", "edit(src/**)"],
150
+ "ask": ["sh(git commit*)"],
151
+ "deny": ["sh(git push*)", "edit(.env)"]
152
+ }
153
+ ```
154
+
155
+ 3. Run `/permissions` to list the rules in effect.
156
+
157
+ **Example.** After the `deny` rule above, a call to `git push origin dev` is refused. The agent sees `DENIED: denied by your permission rule` and must choose another way.
158
+
159
+ **Limits and common problems.**
160
+
161
+ - `/permissions` writes to the project file. For a rule that applies to every project, edit `~/.amness/permissions.json` yourself.
162
+ - A compound command such as `npm test && git push` is split into parts. Each part is checked. A command with a subshell or backticks cannot be split, so an `allow` rule never matches it. A `deny` or `ask` rule still can.
163
+ - Project `deny` and `ask` rules always apply. Project `allow` rules apply only after you approve the project (see below).
164
+ - A rule file with a wrong format stops loading and Amness shows a message.
165
+
166
+ ### Choose a safer permission mode
167
+
168
+ Press `Shift+Tab` or run `/mode`.
169
+
170
+ | Mode | Behaviour |
171
+ |---|---|
172
+ | `plan` | Read-only. The agent investigates and shows a plan |
173
+ | `default` | Asks before edits and before shell commands that are not read-only |
174
+ | `acceptEdits` | Edits apply automatically. Shell commands still ask |
175
+ | `yolo` | No questions for ordinary edits and commands. The floor still applies. The shell is not sandboxed unless you turned the sandbox on. Use it in a container or a throwaway checkout |
176
+
177
+ Headless runs (`amness run`) deny risky commands unless you pass `--yes`. Do not use `--yes` on code you do not trust.
178
+
179
+ ### Approve project files on purpose
180
+
181
+ A cloned repository can contain `.amness/hooks.json`, `.amness/plugins/` and `allow` rules. These run code or remove prompts. Amness does not use them until you approve the exact files.
182
+
183
+ 1. In the chat, Amness asks once for hooks and rules, and once for plugins. Read the files first.
184
+ 2. If a file changes later, Amness asks again. The check compares a fingerprint of the exact content.
185
+ 3. In a headless run, project hooks, plugins and `allow` rules are off. Pass `--trust-project` to use them.
186
+
187
+ Hooks and plugins are not sandboxed. A trusted hook can do anything your user can do.
188
+
189
+ ### Reduce what is sent
190
+
191
+ - Use a local model: choose Ollama with `/provider` in the chat, or run `amness run --provider ollama --model qwen2.5-coder:7b "task"`.
192
+ - Keep semantic memory off: `/memory embeddings off`.
193
+ - Disable memory for one run: `amness run --no-memory "task"`.
194
+ - Do not set `AMNESS_OTLP` and do not pass `--trace` when you do not need them. A trace file is written locally in `--trace <file>`.
195
+ - Do not attach an MCP server you do not trust.
196
+
197
+ ### Handle untrusted text
198
+
199
+ Treat context from a repository you cloned as untrusted. Memory notes, `.amness/commands/` and `AGENTS.md` can contain *prompt injection*. This is text that tries to give the model new orders.
200
+
201
+ What Amness does:
202
+
203
+ - It wraps output of `web_search`, `fetch_url` and MCP tools with a warning that this is data, not instructions.
204
+ - It asks you before a shell command that copies text from that output (the taint check). In the library you can set `taint: "deny"` to refuse, or `"off"` to ignore. The chat and `amness run` use the default, `"ask"`. There is no command-line flag for this.
205
+ - It presents memory notes as hints to verify.
206
+
207
+ ## Know what is NOT protected
208
+
209
+ - **Shell commands without the sandbox.** The agent can do what your user can do. The prompts and the floor are the only protection.
210
+ - **Reads.** Even with the sandbox, commands can read any file your user can read.
211
+ - **The network in `workspace` mode.** A command can send data away.
212
+ - **The model provider.** Amness cannot check what a provider stores or logs.
213
+ - **Symbolic links.** The file-tool workspace check compares path text. The code does not resolve symbolic links, and no test covers it. A link inside the project that points outside may pass. Not verified.
214
+ - **Hooks, plugins and MCP servers.** They run as programs on your machine with your permissions. The sandbox does not cover them.
215
+ - **Secrets in formats Amness does not know.** They are not masked.
216
+ - **A command you approve.** If you press yes, it runs. Read the command first.
217
+ - **Windows.** There is no sandbox. The Windows test job in CI is informational only.
218
+ - **Project state.** `.amness/` holds chats, checkpoints, handoffs and memory. These can contain the text of your code and commands. Add `.amness/` to your `.gitignore`. Keep `memory/` and `commands/` only if you want to share them.
219
+ - **The browser live view** (`--live`) listens on `127.0.0.1` only, rejects foreign `Host` headers, and shows diffs as text, never as HTML. Anyone who can use your machine can still open it.
220
+
221
+ ## Related pages
222
+
223
+ - [Using the chat](usage.md) for permission modes and slash commands
224
+ - [Features in depth](features.md) for hooks, the sandbox and permissions
225
+ - [Plugins](plugins.md) for code that changes the agent
226
+ - [Headless and CI](headless.md) for `--yes`, `--sandbox` and `--trust-project`
227
+ - [Providers and models](providers.md) for local models
228
+
229
+ ## Next steps
230
+
231
+ - Try the sandbox: [Using the chat](usage.md)
232
+ - Run Amness safely in CI: [Headless and CI](headless.md)
233
+ - Read how the loop guards work: [Why: what Amness checks](why.md)
234
+
235
+ ## Which shell runs the agent's commands
236
+
237
+ Amness checks what exists on your machine. On macOS and Linux it uses `bash`, then `zsh`, then `sh`. On Windows it uses the bash that comes with Git for Windows, then PowerShell 7 (`pwsh`), then Windows PowerShell, then `cmd.exe`. The model is told which shell it has, so it writes PowerShell commands for PowerShell. Use `/shell` to see the choice and change it, or set `AMNESS_SHELL`. The safety floor blocks the same kinds of damage in each family, for example `rm -rf /` in bash and `Remove-Item -Recurse -Force C:\` in PowerShell, and it asks before `iwr ... | iex` or an encoded command. The permission rules you write are matched as text, so write them for the shell you use. The OS sandbox exists only for bash-style shells on macOS and Linux; it is not available on Windows.