amness 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +237 -2
- package/dist/cli/acpcli.d.ts +7 -0
- package/dist/cli/acpcli.js +14 -0
- package/dist/cli/amness.d.ts +2 -0
- package/dist/cli/amness.js +694 -0
- package/dist/cli/benchcli.d.ts +5 -0
- package/dist/cli/benchcli.js +160 -0
- package/dist/cli/config.d.ts +79 -0
- package/dist/cli/config.js +111 -0
- package/dist/cli/demo.d.ts +13 -0
- package/dist/cli/demo.js +44 -0
- package/dist/cli/detect.d.ts +2 -0
- package/dist/cli/detect.js +20 -0
- package/dist/cli/evalcli.d.ts +15 -0
- package/dist/cli/evalcli.js +198 -0
- package/dist/cli/format.d.ts +5 -0
- package/dist/cli/format.js +55 -0
- package/dist/cli/headless.d.ts +2 -0
- package/dist/cli/headless.js +169 -0
- package/dist/cli/keystore.d.ts +9 -0
- package/dist/cli/keystore.js +108 -0
- package/dist/cli/model.d.ts +11 -0
- package/dist/cli/model.js +19 -0
- package/dist/cli/plugincli.d.ts +2 -0
- package/dist/cli/plugincli.js +176 -0
- package/dist/cli/schedulecli.d.ts +2 -0
- package/dist/cli/schedulecli.js +66 -0
- package/dist/cli/state.d.ts +11 -0
- package/dist/cli/state.js +19 -0
- package/dist/cli/tui/ansi.d.ts +38 -0
- package/dist/cli/tui/ansi.js +142 -0
- package/dist/cli/tui/app.d.ts +328 -0
- package/dist/cli/tui/app.js +1358 -0
- package/dist/cli/tui/blocks.d.ts +151 -0
- package/dist/cli/tui/blocks.js +128 -0
- package/dist/cli/tui/brand.d.ts +9 -0
- package/dist/cli/tui/brand.js +16 -0
- package/dist/cli/tui/canvas.d.ts +92 -0
- package/dist/cli/tui/canvas.js +199 -0
- package/dist/cli/tui/cards.d.ts +44 -0
- package/dist/cli/tui/cards.js +215 -0
- package/dist/cli/tui/clipboard.d.ts +5 -0
- package/dist/cli/tui/clipboard.js +29 -0
- package/dist/cli/tui/commands.d.ts +10 -0
- package/dist/cli/tui/commands.js +650 -0
- package/dist/cli/tui/complete.d.ts +39 -0
- package/dist/cli/tui/complete.js +113 -0
- package/dist/cli/tui/custom.d.ts +9 -0
- package/dist/cli/tui/custom.js +34 -0
- package/dist/cli/tui/diffview.d.ts +25 -0
- package/dist/cli/tui/diffview.js +130 -0
- package/dist/cli/tui/editor.d.ts +60 -0
- package/dist/cli/tui/editor.js +230 -0
- package/dist/cli/tui/full.d.ts +86 -0
- package/dist/cli/tui/full.js +630 -0
- package/dist/cli/tui/keys.d.ts +31 -0
- package/dist/cli/tui/keys.js +134 -0
- package/dist/cli/tui/markdown.d.ts +37 -0
- package/dist/cli/tui/markdown.js +155 -0
- package/dist/cli/tui/mentions.d.ts +15 -0
- package/dist/cli/tui/mentions.js +48 -0
- package/dist/cli/tui/modal.d.ts +26 -0
- package/dist/cli/tui/modal.js +107 -0
- package/dist/cli/tui/overlays.d.ts +98 -0
- package/dist/cli/tui/overlays.js +237 -0
- package/dist/cli/tui/pager.d.ts +15 -0
- package/dist/cli/tui/pager.js +66 -0
- package/dist/cli/tui/pricing.d.ts +9 -0
- package/dist/cli/tui/pricing.js +23 -0
- package/dist/cli/tui/rich.d.ts +16 -0
- package/dist/cli/tui/rich.js +72 -0
- package/dist/cli/tui/screen.d.ts +30 -0
- package/dist/cli/tui/screen.js +62 -0
- package/dist/cli/tui/session.d.ts +77 -0
- package/dist/cli/tui/session.js +103 -0
- package/dist/cli/tui/sidebar.d.ts +84 -0
- package/dist/cli/tui/sidebar.js +114 -0
- package/dist/cli/tui/text.d.ts +15 -0
- package/dist/cli/tui/text.js +94 -0
- package/dist/cli/tui/theme.d.ts +59 -0
- package/dist/cli/tui/theme.js +148 -0
- package/dist/cli/tui/themes.d.ts +56 -0
- package/dist/cli/tui/themes.js +80 -0
- package/dist/cli/tui/tokens.d.ts +39 -0
- package/dist/cli/tui/tokens.js +71 -0
- package/dist/cli/tui/view.d.ts +60 -0
- package/dist/cli/tui/view.js +178 -0
- package/dist/cli/ui.d.ts +34 -0
- package/dist/cli/ui.js +224 -0
- package/dist/src/acp.d.ts +28 -0
- package/dist/src/acp.js +111 -0
- package/dist/src/agents.d.ts +23 -0
- package/dist/src/agents.js +71 -0
- package/dist/src/anthropic.d.ts +30 -0
- package/dist/src/anthropic.js +91 -0
- package/dist/src/approver.d.ts +15 -0
- package/dist/src/approver.js +40 -0
- package/dist/src/bench.d.ts +67 -0
- package/dist/src/bench.js +201 -0
- package/dist/src/bundle.d.ts +36 -0
- package/dist/src/bundle.js +55 -0
- package/dist/src/chaos.d.ts +15 -0
- package/dist/src/chaos.js +26 -0
- package/dist/src/code.d.ts +187 -0
- package/dist/src/code.js +590 -0
- package/dist/src/codeindex.d.ts +65 -0
- package/dist/src/codeindex.js +300 -0
- package/dist/src/deep.d.ts +62 -0
- package/dist/src/deep.js +177 -0
- package/dist/src/diff.d.ts +8 -0
- package/dist/src/diff.js +74 -0
- package/dist/src/dynamic.d.ts +42 -0
- package/dist/src/dynamic.js +133 -0
- package/dist/src/embed.d.ts +8 -0
- package/dist/src/embed.js +25 -0
- package/dist/src/evalcases.d.ts +11 -0
- package/dist/src/evalcases.js +196 -0
- package/dist/src/evals.d.ts +197 -0
- package/dist/src/evals.js +340 -0
- package/dist/src/gitflow.d.ts +27 -0
- package/dist/src/gitflow.js +56 -0
- package/dist/src/grade.d.ts +42 -0
- package/dist/src/grade.js +96 -0
- package/dist/src/guidance.d.ts +15 -0
- package/dist/src/guidance.js +68 -0
- package/dist/src/hardcases.d.ts +2 -0
- package/dist/src/hardcases.js +94 -0
- package/dist/src/harness.d.ts +411 -0
- package/dist/src/harness.js +725 -0
- package/dist/src/hooks.d.ts +44 -0
- package/dist/src/hooks.js +116 -0
- package/dist/src/images.d.ts +13 -0
- package/dist/src/images.js +27 -0
- package/dist/src/index.d.ts +57 -0
- package/dist/src/index.js +57 -0
- package/dist/src/ledger.d.ts +58 -0
- package/dist/src/ledger.js +78 -0
- package/dist/src/live.d.ts +16 -0
- package/dist/src/live.js +80 -0
- package/dist/src/lsp.d.ts +31 -0
- package/dist/src/lsp.js +147 -0
- package/dist/src/memory.d.ts +128 -0
- package/dist/src/memory.js +390 -0
- package/dist/src/metrics.d.ts +3 -0
- package/dist/src/metrics.js +42 -0
- package/dist/src/mining.d.ts +49 -0
- package/dist/src/mining.js +126 -0
- package/dist/src/openai.d.ts +50 -0
- package/dist/src/openai.js +307 -0
- package/dist/src/parallel.d.ts +66 -0
- package/dist/src/parallel.js +135 -0
- package/dist/src/patch.d.ts +45 -0
- package/dist/src/patch.js +219 -0
- package/dist/src/permissions.d.ts +46 -0
- package/dist/src/permissions.js +245 -0
- package/dist/src/plugins.d.ts +148 -0
- package/dist/src/plugins.js +225 -0
- package/dist/src/pluginscan.d.ts +8 -0
- package/dist/src/pluginscan.js +20 -0
- package/dist/src/procs.d.ts +41 -0
- package/dist/src/procs.js +94 -0
- package/dist/src/profiles.d.ts +36 -0
- package/dist/src/profiles.js +61 -0
- package/dist/src/progress.d.ts +29 -0
- package/dist/src/progress.js +75 -0
- package/dist/src/prompts.d.ts +10 -0
- package/dist/src/prompts.js +28 -0
- package/dist/src/ratelimit.d.ts +34 -0
- package/dist/src/ratelimit.js +116 -0
- package/dist/src/replay.d.ts +25 -0
- package/dist/src/replay.js +99 -0
- package/dist/src/review.d.ts +20 -0
- package/dist/src/review.js +49 -0
- package/dist/src/route.d.ts +9 -0
- package/dist/src/route.js +30 -0
- package/dist/src/router.d.ts +61 -0
- package/dist/src/router.js +126 -0
- package/dist/src/sandbox.d.ts +13 -0
- package/dist/src/sandbox.js +68 -0
- package/dist/src/schedule.d.ts +20 -0
- package/dist/src/schedule.js +59 -0
- package/dist/src/schema.d.ts +13 -0
- package/dist/src/schema.js +36 -0
- package/dist/src/secrets.d.ts +10 -0
- package/dist/src/secrets.js +41 -0
- package/dist/src/shell.d.ts +34 -0
- package/dist/src/shell.js +95 -0
- package/dist/src/skills.d.ts +20 -0
- package/dist/src/skills.js +112 -0
- package/dist/src/snapshot.d.ts +20 -0
- package/dist/src/snapshot.js +93 -0
- package/dist/src/stats.d.ts +24 -0
- package/dist/src/stats.js +62 -0
- package/dist/src/strategies.d.ts +16 -0
- package/dist/src/strategies.js +35 -0
- package/dist/src/suites.d.ts +30 -0
- package/dist/src/suites.js +112 -0
- package/dist/src/trace.d.ts +63 -0
- package/dist/src/trace.js +153 -0
- package/dist/src/tune.d.ts +38 -0
- package/dist/src/tune.js +49 -0
- package/dist/src/web.d.ts +19 -0
- package/dist/src/web.js +56 -0
- package/dist/src/worktree.d.ts +24 -0
- package/dist/src/worktree.js +85 -0
- package/docs/agent-loop.md +222 -0
- package/docs/architecture.md +228 -0
- package/docs/bench.md +292 -0
- package/docs/budgets.md +185 -0
- package/docs/build-your-own-harness.md +424 -0
- package/docs/cookbook.md +375 -0
- package/docs/development.md +150 -0
- package/docs/evaluation.md +450 -0
- package/docs/features.md +1320 -0
- package/docs/getting-started.md +205 -0
- package/docs/headless.md +188 -0
- package/docs/images/approval.png +0 -0
- package/docs/images/chat.png +0 -0
- package/docs/images/daylight.png +0 -0
- package/docs/images/loop.png +0 -0
- package/docs/images/palette.png +0 -0
- package/docs/images/running.png +0 -0
- package/docs/images/subagent-done.png +0 -0
- package/docs/images/subagent-running.png +0 -0
- package/docs/images/welcome.png +0 -0
- package/docs/index.md +25 -0
- package/docs/library.md +267 -0
- package/docs/plugins.md +691 -0
- package/docs/providers.md +175 -0
- package/docs/safety.md +250 -0
- package/docs/usage.md +348 -0
- package/docs/why.md +155 -0
- package/docs/writing-guide.md +39 -0
- package/package.json +66 -4
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
This tutorial takes you from zero to a first useful session: you ask a question, change a file, undo the change, and make the agent prove its work.
|
|
4
|
+
|
|
5
|
+
In this page you will learn:
|
|
6
|
+
|
|
7
|
+
- how to install Amness and set an API key or a local model
|
|
8
|
+
- how to ask a question and ask for a change
|
|
9
|
+
- how to read, approve and undo a diff
|
|
10
|
+
- how to make the agent prove its work and save a memory note
|
|
11
|
+
|
|
12
|
+
You need Node.js 22.18 or newer, git, and a terminal. A *diff* is a view of the lines that a change adds and removes.
|
|
13
|
+
|
|
14
|
+
## 1. Install Amness
|
|
15
|
+
|
|
16
|
+
Amness is a package on npm. You install it with one command.
|
|
17
|
+
|
|
18
|
+
1. Install it. The `-g` flag makes the `amness` command available in every folder.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g amness
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This also installs the Anthropic SDK, which the Claude models use. It is an optional dependency, so Amness still installs if the SDK cannot. If you see "Claude support needs the SDK", run `npm install -g @anthropic-ai/sdk`.
|
|
25
|
+
|
|
26
|
+
You can also run Amness once without installing it: `npx amness`.
|
|
27
|
+
|
|
28
|
+
2. Check that the command works.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
amness --version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You see a version number, for example `0.1.0`.
|
|
35
|
+
|
|
36
|
+
To update later, run `npm install -g amness@latest`.
|
|
37
|
+
|
|
38
|
+
**Run the latest `main` from source.** Use this if you want a change that is not released yet, or if you want to work on Amness itself:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/amirsdream/Amness.git && cd Amness && npm install
|
|
42
|
+
npm link
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`npm link` makes the `amness` command point at your clone, so `git pull` updates it.
|
|
46
|
+
|
|
47
|
+
Amness is developed on macOS and Linux. The tests also run on Windows, but Windows has **no OS sandbox** for shell commands.
|
|
48
|
+
|
|
49
|
+
## 2. Set an API key or choose a local model
|
|
50
|
+
|
|
51
|
+
A *provider* is the service that runs the model. Choose one way.
|
|
52
|
+
|
|
53
|
+
**Option A: a cloud provider.** Set the key in your terminal. Use the key for the provider that you want.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For OpenAI, use `OPENAI_API_KEY=sk-...` instead. OpenAI is the default provider. If you set only an Anthropic key, run `/provider` in the chat and choose Claude.
|
|
60
|
+
|
|
61
|
+
**Option B: a local model.** Install Ollama, then download a model that supports tool calling.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
ollama pull qwen2.5-coder:7b
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Start Amness, run `/provider`, and choose "Ollama (local)". You need no key. Small local models can be weak at tool calling. See [Providers and models](providers.md).
|
|
68
|
+
|
|
69
|
+
You can also do nothing now. On the first start, Amness asks you to pick a provider and paste a key. It saves the key in your system's secure store (the macOS Keychain, the Linux keyring, or Windows DPAPI) and tells you which one. See [Safety](safety.md) for the details and for servers that have no keyring.
|
|
70
|
+
|
|
71
|
+
## 3. Start in a project
|
|
72
|
+
|
|
73
|
+
Go to a project that is under git, then start the chat.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
cd ~/your-project
|
|
77
|
+
amness
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You see the full-screen chat: a header, a transcript, a sidebar and an input box.
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
The default mode is `default`. In this mode Amness asks before it edits a file or runs a risky command.
|
|
85
|
+
|
|
86
|
+
## 4. Ask a question
|
|
87
|
+
|
|
88
|
+
Type a question and press `Enter`. Use `@` to attach a file.
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
❯ what does @package.json say about how to run the tests?
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The agent reads files and answers. Reads and searches collapse into one row, for example "Explored · 2 files read". Click the row to see the details. Nothing changes in your project, because a question only reads files.
|
|
95
|
+
|
|
96
|
+
## 5. Ask for a change
|
|
97
|
+
|
|
98
|
+
Now ask for a small change.
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
❯ add a short "Contributing" section to the README
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The agent works. The status line shows what it does, and the sidebar shows its progress.
|
|
105
|
+
|
|
106
|
+
## 6. Read and approve the diff
|
|
107
|
+
|
|
108
|
+
Before Amness edits a file, it stops and shows a window with the exact diff. Green lines are added. Red lines are removed.
|
|
109
|
+
|
|
110
|
+

|
|
111
|
+
|
|
112
|
+
1. Read the diff.
|
|
113
|
+
2. Choose "Yes" to apply this one edit. Choose "No, and tell Amness what to do instead" (or press `Esc`) to refuse and give a different instruction.
|
|
114
|
+
3. Choose "Yes, and accept all edits this session" only if you trust the task. Edits then apply without asking.
|
|
115
|
+
|
|
116
|
+
For shell commands, Amness shows the command and asks "Run this command?". Read-only commands such as `ls` and `git status` never ask.
|
|
117
|
+
|
|
118
|
+
## 7. Undo the change
|
|
119
|
+
|
|
120
|
+
If you do not like the result, undo the whole turn. This reverts the files and the conversation.
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
❯ /undo
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
You see a line such as `rewound the conversation to before turn 2 · restored 1 file(s)`. Use `/diff` to review all changes of the session before you decide. Use `/rewind` to go back to an earlier turn.
|
|
127
|
+
|
|
128
|
+
Amness also tries to undo changes made by shell commands. Some commands cannot be undone. In that case Amness lists them.
|
|
129
|
+
|
|
130
|
+
## 8. Make the agent prove its work
|
|
131
|
+
|
|
132
|
+
By default, an agent can say "done" when the work is not done. A *verify command* is a command that must pass before the agent may finish. If it fails, Amness rejects the finish and the agent must try again.
|
|
133
|
+
|
|
134
|
+
1. Choose a command that tests your project. Amness picks one for you when it finds `npm test`, `cargo test`, `go test ./...` or `pytest -q`. Type `/status` and look at the `verify` line.
|
|
135
|
+
2. Set or change it in the chat.
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
❯ /verify npm test
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
You see `verify gate → npm test`.
|
|
142
|
+
3. Ask for a change that touches the code.
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
❯ the date parser fails on leap days, fix it
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
4. Watch the end of the turn. If the command fails, you see a note such as "finish rejected by verification" and the agent continues. If it passes, the agent finishes.
|
|
149
|
+
|
|
150
|
+
For a run without a chat, the flag is `--verify`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
amness run --verify "npm test" "fix the failing test"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The `--verify` flag belongs to `amness run`. In the chat, use `/verify`. See [Headless and CI](headless.md).
|
|
157
|
+
|
|
158
|
+
You can also set `/check <cmd>`, a fast command (for example a type check) that runs after every edit.
|
|
159
|
+
|
|
160
|
+
## 9. Save a memory note
|
|
161
|
+
|
|
162
|
+
A *memory note* is a short text file that the agent can read in later sessions. Start a line with `#` to save one.
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
❯ # run tests with npm test, never with npx jest
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
You see "remembered" and the note name. Type `/memory` to list your notes. Notes live in `.amness/memory` in your project.
|
|
169
|
+
|
|
170
|
+
## 10. Go further
|
|
171
|
+
|
|
172
|
+
Two more screens help you understand what the agent does. Subagents are helpers that the agent starts for large searches. You see one card while it runs and a summary when it ends.
|
|
173
|
+
|
|
174
|
+

|
|
175
|
+
|
|
176
|
+

|
|
177
|
+
|
|
178
|
+
Type `/loop` to see every model turn, its tools and timings.
|
|
179
|
+
|
|
180
|
+

|
|
181
|
+
|
|
182
|
+
Type `/tokens` to see how full the context is and what the session costs. Costs are estimates.
|
|
183
|
+
|
|
184
|
+
When you finish, type `/exit` or press `Ctrl+C` twice. Your conversation is saved. Next time, run `amness -c` to continue it.
|
|
185
|
+
|
|
186
|
+
## If something goes wrong
|
|
187
|
+
|
|
188
|
+
| What you see | What it means | What to do |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| The first start asks for a provider and key, or a message says "no API key" | Amness has no key for the provider. In `amness run`, the message is `no API key for <provider>. Set ANTHROPIC_API_KEY or OPENAI_API_KEY or run amness settings`. | Set the key (step 2), or run `/provider`. For a local model, choose Ollama. |
|
|
191
|
+
| "check your key with /provider" | The provider rejected the key (401 or 403). | Run `/provider` and enter the key again. |
|
|
192
|
+
| "rate limited by the provider: waiting 12s, then retrying" | The provider has limits on requests and tokens each minute. Amness waits and retries for you. | Wait. If it happens often, set a lower `"maxConcurrent"` in `~/.amness/config.json`. Quota and billing errors are not retried. |
|
|
193
|
+
| "token budget exhausted" or a line starting with `stopped:` and a budget message | The turn used its token cap (300,000 by default). Amness asks the model to wrap up at 50, 75 and 90 percent and writes a final report. | Read the report. Send a message to continue, ask a smaller question, or raise the cap with `/budget 500k`. |
|
|
194
|
+
| "denied: ..." | A permission rule or the safety floor refused the command. In `amness run`, risky commands are denied unless you pass `--yes`. | Read the reason. Use `/policy` to see why. Allow the command with `/permissions allow sh(npm test*)`, or in `amness run` pass `--yes` in a safe place. |
|
|
195
|
+
| "finish rejected by verification" | Your verify command failed. | This is the gate working. Let the agent fix the problem, or check that the command is right with `/verify`. |
|
|
196
|
+
| "interrupted. Your progress is kept" | You pressed `Esc` or `Ctrl+C`. | Send a message to continue. |
|
|
197
|
+
|
|
198
|
+
## Next steps
|
|
199
|
+
|
|
200
|
+
- [Using the chat](usage.md): all keys, modes and slash commands.
|
|
201
|
+
- [Providers and models](providers.md): OpenAI, Claude and local models.
|
|
202
|
+
- [Headless and CI](headless.md): run Amness in scripts.
|
|
203
|
+
- [Safety and privacy](safety.md): what the permission system protects.
|
|
204
|
+
- [Budgets and subagents](budgets.md): why runs stop and how to control cost.
|
|
205
|
+
- [Features in depth](features.md): worktrees, pull requests, hooks, skills and more.
|
package/docs/headless.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Headless and CI
|
|
2
|
+
|
|
3
|
+
*Headless* means that Amness runs one task without a chat window, so you can use it in scripts and in CI (continuous integration, the system that tests your code on each change).
|
|
4
|
+
|
|
5
|
+
In this page you will learn:
|
|
6
|
+
|
|
7
|
+
- how to run one task with `amness run`
|
|
8
|
+
- how to make the agent prove its work with `--verify`
|
|
9
|
+
- how to read the JSON output and the exit codes
|
|
10
|
+
- how to run several attempts or several parts at once
|
|
11
|
+
|
|
12
|
+
## Run one task
|
|
13
|
+
|
|
14
|
+
**What it is.** `amness run` runs a single task and then exits. It needs no terminal. `amness -p "task"` and `amness --print "task"` do the same.
|
|
15
|
+
|
|
16
|
+
**Why you would use it.** You can call Amness from a script, a scheduled job or a CI step.
|
|
17
|
+
|
|
18
|
+
**How to use it.**
|
|
19
|
+
|
|
20
|
+
1. Set a key for your provider (see [Providers and models](providers.md)).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. Run a task with a check command. The agent cannot finish until the command exits with code 0.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
amness run --verify "npm test" --json "fix the failing test"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. Read the result. Without `--json`, the final text of the agent goes to stdout and the progress goes to stderr.
|
|
33
|
+
|
|
34
|
+
**Example.** With `--json`, each event is one JSON line, and the last line is the result:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{"kind":"result","finished":true,"text":"...","steps":8,"tokens":15200}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The values are an example. The field `stopped` is missing when the run ends normally. When the run stops early, it is `budget`, `maxSteps`, `aborted`, `stuck` or `blocked`. If a model call fails, the last line is `{"kind":"error","message":"..."}`.
|
|
41
|
+
|
|
42
|
+
**Exit codes.**
|
|
43
|
+
|
|
44
|
+
| Code | Meaning |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `0` | The agent finished. |
|
|
47
|
+
| `1` | The agent did not finish, or an error happened. |
|
|
48
|
+
| `2` | Usage or configuration error (for example no task, or no API key). |
|
|
49
|
+
|
|
50
|
+
**Limits and common problems.**
|
|
51
|
+
|
|
52
|
+
- If you give no task and no `--bundle`, Amness prints the usage text and exits with 2.
|
|
53
|
+
- If there is no API key, Amness says so and exits with 2. Set `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`.
|
|
54
|
+
- Without `--verify`, nothing proves the work. The agent only says it is done.
|
|
55
|
+
|
|
56
|
+
## Flags
|
|
57
|
+
|
|
58
|
+
| Flag | What it does |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `--cwd <dir>` | The workspace. The default is `.`. |
|
|
61
|
+
| `--verify <cmd>` | A command that must exit 0 before the agent may finish. |
|
|
62
|
+
| `--check <cmd>` | A fast command that runs after every edit. The agent sees failures at once. |
|
|
63
|
+
| `--trust-project` | Runs this project's `.amness/hooks.json` and plugins, and honours its allow rules. They run code, so they are off by default in headless runs. `--trust-hooks` is an older name for the same flag. |
|
|
64
|
+
| `--sandbox <mode>` | Runs shell commands under an OS sandbox: `workspace` (write only in the project and temp folders) or `strict` (also no network). The same limits apply as in the chat: **Windows has no OS sandbox**. |
|
|
65
|
+
| `--provider`, `--model`, `--base-url`, `--effort`, `--api` | Model selection. `--effort` accepts `none`, `low`, `medium`, `high`, `xhigh` or `max`. `--api` accepts `auto`, `responses` or `chat`. |
|
|
66
|
+
| `--yes` | Approves risky commands automatically. The default is to deny them. |
|
|
67
|
+
| `--json` | Prints one JSON event per line on stdout, then a final `{"kind":"result"}` line. |
|
|
68
|
+
| `--bundle <file>` | Continues from a portable session bundle. You can omit the task. |
|
|
69
|
+
| `--export <file>` | Writes a portable session bundle when the run ends. |
|
|
70
|
+
| `--live [port]` | Serves the browser live view. The address goes to stderr. |
|
|
71
|
+
| `--review` | An independent reviewer writes acceptance criteria and checks the work. It costs extra model calls. |
|
|
72
|
+
| `--approval-reviewer` | A second model approves clearly safe risky calls. Without `--yes`, calls that it does not clear are still denied. |
|
|
73
|
+
| `--image <file>` | Shows the model a picture. You can repeat it, up to 4 times. Allowed: png, jpg, gif, webp, up to 5 MB each. It needs a vision model. |
|
|
74
|
+
| `--best-of <n>` | Tries the task up to n times in separate git worktrees. See below. |
|
|
75
|
+
| `--parts <file.json>` | Runs independent parts at the same time. See below. |
|
|
76
|
+
| `--trace <file>` | Writes a JSONL trace of every loop event. Set `AMNESS_OTLP=<collector url>` to export with OpenTelemetry. |
|
|
77
|
+
| `--max-tokens <n>` | A hard token cap. The default is 300,000 (or the value in your config). |
|
|
78
|
+
| `--no-memory` | Turns memory off. |
|
|
79
|
+
|
|
80
|
+
`amness eval` has its own flags. See [Evaluating the harness](evaluation.md).
|
|
81
|
+
|
|
82
|
+
## Make a run safe in CI
|
|
83
|
+
|
|
84
|
+
**Why you would use it.** In CI nobody can answer a question, so Amness must decide alone.
|
|
85
|
+
|
|
86
|
+
**How it behaves.**
|
|
87
|
+
|
|
88
|
+
1. Risky commands are **denied** by default. The agent gets the message "non-interactive run: risky commands are denied unless --yes is passed".
|
|
89
|
+
2. Project hooks, plugins and allow rules are **ignored** unless you pass `--trust-project`. Amness prints a note when it ignores them.
|
|
90
|
+
3. Pass `--yes` only in a container or a throwaway checkout with your work committed. The shell is not sandboxed unless you add `--sandbox workspace` or `--sandbox strict`.
|
|
91
|
+
|
|
92
|
+
**Example.**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
amness run --sandbox workspace --verify "npm test" "make the date parser handle leap days"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Limits and common problems.**
|
|
99
|
+
|
|
100
|
+
- `--yes` approves risky commands. The safety floor still applies (for example, no force-push to main). See [Safety and privacy](safety.md).
|
|
101
|
+
- The run ends with exit code 1 when the token cap is reached. The last text then starts with `stopped:`. Raise `--max-tokens` or give a smaller task. See [Budgets and subagents](budgets.md).
|
|
102
|
+
|
|
103
|
+
## Try the task several times with `--best-of`
|
|
104
|
+
|
|
105
|
+
**What it is.** Amness tries the task up to n times, each in its own git worktree (a separate copy of your repository). It stops at the first attempt that passes `--verify`, and it applies that result.
|
|
106
|
+
|
|
107
|
+
**Why you would use it.** One attempt can fail by chance, and a second attempt may pass.
|
|
108
|
+
|
|
109
|
+
**How to use it.**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
amness run --best-of 3 --verify "npm test" "make the flaky test deterministic"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
You see one line on stderr for each attempt, for example `attempt 1: failed verify (41200 tokens)`. At the end Amness says which attempt won, or that no attempt passed.
|
|
116
|
+
|
|
117
|
+
**Limits and common problems.**
|
|
118
|
+
|
|
119
|
+
- `--verify` is required, and so is a git repository with at least one commit. Otherwise Amness exits with 2.
|
|
120
|
+
- Each attempt gets the token cap divided by n.
|
|
121
|
+
- Exit code is 0 only if an attempt won and Amness applied it.
|
|
122
|
+
- It is implemented and unit-tested. It is **not shown yet to help on real work**.
|
|
123
|
+
|
|
124
|
+
## Run independent parts with `--parts`
|
|
125
|
+
|
|
126
|
+
**What it is.** You give a JSON file with a list of tasks. Amness runs them at the same time in worktrees and merges them one at a time. Each merge must pass `--verify`.
|
|
127
|
+
|
|
128
|
+
**How to use it.**
|
|
129
|
+
|
|
130
|
+
1. Write the file.
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
[
|
|
134
|
+
{"name": "docs", "task": "update the README install section"},
|
|
135
|
+
{"name": "tests", "task": "add a test for the date parser"}
|
|
136
|
+
]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
2. Run it.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
amness run --parts parts.json --verify "npm test"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Limits and common problems.**
|
|
146
|
+
|
|
147
|
+
- Amness reports conflicts and does not apply them.
|
|
148
|
+
- The exit code is 0 only when every part is `merged`.
|
|
149
|
+
- The same requirements as `--best-of` apply (`--verify`, a git repository). It is **not shown yet to help on real work**.
|
|
150
|
+
|
|
151
|
+
## Continue a run elsewhere
|
|
152
|
+
|
|
153
|
+
**How to use it.**
|
|
154
|
+
|
|
155
|
+
1. Write a bundle at the end of a run.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
amness run --export bundle.json "start the refactor"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
2. Continue on any machine or model.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
amness run --bundle bundle.json "continue"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Docker and GitHub Actions
|
|
168
|
+
|
|
169
|
+
- A `Dockerfile` is included: `docker build -t amness .`, then `docker run -it --rm -v "$PWD":/work -e ANTHROPIC_API_KEY amness`. CI builds the image and runs `--version` and a self-test in it (see [Development](development.md)).
|
|
170
|
+
- **Keys in Docker.** Inside a container Amness never saves a key to disk. Pass it in one of two ways:
|
|
171
|
+
- an environment variable: `-e ANTHROPIC_API_KEY` (with no value, Docker copies it from your shell, so it is not typed on the command line);
|
|
172
|
+
- a Docker secret, which is mounted as a file: `-e ANTHROPIC_API_KEY_FILE=/run/secrets/anthropic`. `OPENAI_API_KEY_FILE` and `TAVILY_API_KEY_FILE` work the same way.
|
|
173
|
+
|
|
174
|
+
The image sets `AMNESS_KEYSTORE=none`. Amness also detects `/.dockerenv` and Kubernetes on its own. If you type a key into the chat in a container, it is used for that session only.
|
|
175
|
+
- The repository has a GitHub Action in `action.yml`. Its inputs are `task`, `verify`, `provider`, `model`, `max-tokens` and `comment`. See [Features: Scheduled runs and the GitHub Action](features.md#scheduled-runs-and-the-github-action).
|
|
176
|
+
|
|
177
|
+
## Related pages
|
|
178
|
+
|
|
179
|
+
- [Using the chat](usage.md)
|
|
180
|
+
- [Providers and models](providers.md)
|
|
181
|
+
- [Safety and privacy](safety.md)
|
|
182
|
+
- [Evaluating the harness](evaluation.md)
|
|
183
|
+
|
|
184
|
+
## Next steps
|
|
185
|
+
|
|
186
|
+
- [Getting started](getting-started.md)
|
|
187
|
+
- [Budgets and subagents](budgets.md)
|
|
188
|
+
- [Features in depth](features.md)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Amness documentation
|
|
2
|
+
|
|
3
|
+
These pages explain how to install, use, extend and trust Amness. Start with "Getting started" if you are new.
|
|
4
|
+
|
|
5
|
+
| Page | What is in it |
|
|
6
|
+
|---|---|
|
|
7
|
+
| [Getting started](getting-started.md) | Install Amness, set a key, and finish your first task |
|
|
8
|
+
| [Using the chat](usage.md) | The interface, keys, permission modes, slash commands, themes and copying |
|
|
9
|
+
| [Features in depth](features.md) | Permissions, sandbox, hooks, skills, subagents, routing, memory, tracing, replay and undo |
|
|
10
|
+
| [Plugins](plugins.md) | Change the agent with code: loop rules, guardrails, tools, graders and variants you can evaluate |
|
|
11
|
+
| [Build your own harness](build-your-own-harness.md) | A tutorial: from one small rule to a custom harness that you measure |
|
|
12
|
+
| [Cookbook](cookbook.md) | Short recipes for common jobs |
|
|
13
|
+
| [Evaluating the harness](evaluation.md) | `amness eval`: measure a change with statistics, ablations, benchmarks and an injection suite |
|
|
14
|
+
| [Compare coding agents](bench.md) | `amness bench`: run Amness, Claude Code, Codex or any tool on the same tasks, with a Windows setup |
|
|
15
|
+
| [Budgets and subagents](budgets.md) | Why runs ran out of budget, what vendors and papers say, and what Amness does about it |
|
|
16
|
+
| [The agent loop](agent-loop.md) | Staged compaction, guards, the claims ledger, cache behavior and sources |
|
|
17
|
+
| [Architecture](architecture.md) | The layers, the files, and how the full-screen interface draws |
|
|
18
|
+
| [Providers and models](providers.md) | OpenAI, Claude, and local models (Ollama, LM Studio, vLLM), and how requests are made |
|
|
19
|
+
| [Headless and CI](headless.md) | `amness run`, flags, JSON events, exit codes and Docker |
|
|
20
|
+
| [Use it as a library](library.md) | Use `createCodeAgent`, `createHarness`, tools and models in your own TypeScript code |
|
|
21
|
+
| [Safety and privacy](safety.md) | What leaves your machine, what protects you, and what does not |
|
|
22
|
+
| [Why: what Amness checks](why.md) | The mechanical agent failures that Amness guards against, with examples |
|
|
23
|
+
| [Development and limitations](development.md) | Run the tests, find your way around the code, add a feature, and see the known limits |
|
|
24
|
+
| [How we write the documentation](writing-guide.md) | The rules for writing these pages in plain English (CEFR level B1) |
|
|
25
|
+
| [Roadmap](../ROADMAP.md) | What is done and what is next |
|