receipt-agent-cli 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.
- package/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/assets/factory-client.js +365 -0
- package/dist/assets/factory.css +2 -0
- package/dist/assets/htmx.min.js +1 -0
- package/dist/cli.js +96649 -0
- package/package.json +104 -0
- package/prompts/agent.prompts.json +6 -0
- package/prompts/factory/orchestrator.md +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Receipt contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# Receipt
|
|
2
|
+
|
|
3
|
+
Receipt is version control for agent runs.
|
|
4
|
+
|
|
5
|
+
A receipt-native framework for long-lived agents. Every message, tool call, and control decision becomes an immutable, hash-linked receipt, so agents can be replayed, forked, inspected, and verified.
|
|
6
|
+
|
|
7
|
+
- facts are immutable, hash-linked receipts
|
|
8
|
+
- state is derived by folding receipts
|
|
9
|
+
- queue and control flow are receipt-derived
|
|
10
|
+
- replay reconstructs what happened and why
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
For CLI users:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g receipt-agent-cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For repo contributors:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun install
|
|
26
|
+
bun run build # prepares web assets
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## CLI Quickstart
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
receipt start
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`receipt start` checks and configures:
|
|
36
|
+
|
|
37
|
+
- OpenAI API key (validated before setup continues)
|
|
38
|
+
- GitHub CLI authentication for `github.com` (guided browser login)
|
|
39
|
+
- AWS CLI authentication and selected account/profile (guided SSO login)
|
|
40
|
+
|
|
41
|
+
### Prerequisites (minimum versions)
|
|
42
|
+
|
|
43
|
+
- Node.js `>=20.0.0`
|
|
44
|
+
- GitHub CLI (`gh`) `>=2.81.0`
|
|
45
|
+
- AWS CLI v2 `>=2.0.0`
|
|
46
|
+
|
|
47
|
+
### Setup behavior
|
|
48
|
+
|
|
49
|
+
- `receipt start`: reruns full setup checks and reuses saved selections as defaults
|
|
50
|
+
- `receipt start --reset`: reruns setup from scratch and ignores saved selections
|
|
51
|
+
- If GitHub is not logged in, setup can run `gh auth login --hostname github.com --web` and then re-check auth.
|
|
52
|
+
- If AWS is not logged in, setup can guide `aws configure sso` then `aws sso login --profile <profile>`.
|
|
53
|
+
- Setup still accepts already-working non-SSO AWS credentials.
|
|
54
|
+
|
|
55
|
+
### Troubleshooting
|
|
56
|
+
|
|
57
|
+
| Check failed | What to run | Retry path |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `gh` missing | macOS: `brew install gh`<br/>Linux/Windows: install from [https://cli.github.com/](https://cli.github.com/) | Re-run `receipt start` |
|
|
60
|
+
| GitHub auth missing | Use guided login in setup, or run `gh auth login --hostname github.com --web` | Re-run `receipt start` |
|
|
61
|
+
| `aws` missing | macOS: `brew install awscli`<br/>Linux/Windows: install from [AWS CLI install guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) | Re-run `receipt start` |
|
|
62
|
+
| AWS auth missing | Use guided setup in CLI, or run `aws configure sso` then `aws sso login --profile <profile>` | Re-run `receipt start` |
|
|
63
|
+
| OpenAI key invalid | Enter a valid key when prompted | Stay in setup prompt and retry |
|
|
64
|
+
|
|
65
|
+
### Config and security
|
|
66
|
+
|
|
67
|
+
- Setup writes local config to `~/.receipt/config.json`.
|
|
68
|
+
- Stored values include OpenAI key, selected GitHub login, and selected AWS identity.
|
|
69
|
+
- Use `receipt start --reset` to rotate/reselect credentials and rewrite this file.
|
|
70
|
+
|
|
71
|
+
## CLI
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
receipt start # setup/recheck OpenAI key + GitHub + AWS
|
|
75
|
+
receipt new my-agent --template basic
|
|
76
|
+
receipt dev
|
|
77
|
+
receipt run theorem --problem "Prove a simple claim"
|
|
78
|
+
receipt run axiom --problem "Write a Lean proof and verify it"
|
|
79
|
+
receipt jobs
|
|
80
|
+
receipt abort <job-id>
|
|
81
|
+
receipt trace <run-id>
|
|
82
|
+
receipt replay <run-id>
|
|
83
|
+
receipt inspect <run-id>
|
|
84
|
+
receipt fork <run-id> --at 12
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`receipt start` requires:
|
|
88
|
+
|
|
89
|
+
- `OPENAI_API_KEY` (or paste during setup)
|
|
90
|
+
- `gh` installed and authenticated to `github.com`
|
|
91
|
+
- `aws` installed and authenticated
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
receipt start --openai-key "sk-..."
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Public SDK
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { defineAgent, receipt, action, assistant, tool, human, goal, merge, rebracket } from "./src/sdk/index";
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Stream model
|
|
104
|
+
|
|
105
|
+
Agent streams:
|
|
106
|
+
|
|
107
|
+
- `agents/<agentId>`
|
|
108
|
+
- `agents/<agentId>/runs/<runId>`
|
|
109
|
+
- `agents/<agentId>/runs/<runId>/branches/<branchId>`
|
|
110
|
+
- `agents/<agentId>/runs/<runId>/sub/<subRunId>`
|
|
111
|
+
|
|
112
|
+
Queue streams:
|
|
113
|
+
|
|
114
|
+
- `jobs` (index)
|
|
115
|
+
- `jobs/<jobId>` (authoritative job lifecycle)
|
|
116
|
+
|
|
117
|
+
## Architecture docs
|
|
118
|
+
|
|
119
|
+
- [architecture.md](./architecture.md)
|
|
120
|
+
- [docs/receipt-production-rfc.md](./docs/receipt-production-rfc.md)
|
|
121
|
+
- [docs/receipt-coding-runtime.md](./docs/receipt-coding-runtime.md)
|
|
122
|
+
- [docs/receipt-cli-mvp-architecture.md](./docs/receipt-cli-mvp-architecture.md)
|
|
123
|
+
- [docs/factory-on-receipt.md](./docs/factory-on-receipt.md)
|
|
124
|
+
- [docs/factory-on-another-repo.md](./docs/factory-on-another-repo.md)
|
|
125
|
+
- [docs/factory-agent-orchestration.md](./docs/factory-agent-orchestration.md)
|
|
126
|
+
- [docs/factory-profile-orchestration.md](./docs/factory-profile-orchestration.md)
|
|
127
|
+
- [docs/factory-infrastructure-engineer.md](./docs/factory-infrastructure-engineer.md)
|
|
128
|
+
- [docs/agent-framework.md](./docs/agent-framework.md)
|
|
129
|
+
- [docs/axiom-theorem-prover.md](./docs/axiom-theorem-prover.md)
|
|
130
|
+
- [docs/axiom-public-prover.md](./docs/axiom-public-prover.md)
|
|
131
|
+
- [docs/axiom-benchmark.md](./docs/axiom-benchmark.md)
|
|
132
|
+
- [docs/create-agent.md](./docs/create-agent.md)
|
|
133
|
+
- [docs/api/README.md](./docs/api/README.md)
|
|
134
|
+
- [docs/api/http.md](./docs/api/http.md)
|
|
135
|
+
- [docs/api/sse.md](./docs/api/sse.md)
|
|
136
|
+
- [docs/api/cli.md](./docs/api/cli.md)
|
|
137
|
+
- [docs/api/sdk.md](./docs/api/sdk.md)
|
|
138
|
+
- [docs/api/streams.md](./docs/api/streams.md)
|
|
139
|
+
- [docs/api/config.md](./docs/api/config.md)
|
|
140
|
+
|
|
141
|
+
## Factory and Profiles
|
|
142
|
+
|
|
143
|
+
`Factory` is the operator surface for this repo.
|
|
144
|
+
|
|
145
|
+
Use `/factory` for:
|
|
146
|
+
|
|
147
|
+
- chat and thread management
|
|
148
|
+
- starting new work through chat
|
|
149
|
+
- repo preparation and inferred validation defaults
|
|
150
|
+
- task DAG decomposition
|
|
151
|
+
- autonomous worker dispatch
|
|
152
|
+
- per-repo objective queueing and slot admission
|
|
153
|
+
- candidate review
|
|
154
|
+
- integration, validation, and promotion
|
|
155
|
+
- thread-scoped runs and job updates
|
|
156
|
+
- repo-local customization through `profiles/<id>/PROFILE.md` and `profiles/<id>/profile.json`
|
|
157
|
+
|
|
158
|
+
Use `/factory/control` for:
|
|
159
|
+
|
|
160
|
+
- advanced work details
|
|
161
|
+
- receipts, runtime control, and live output
|
|
162
|
+
- operator actions on the selected thread
|
|
163
|
+
|
|
164
|
+
`/factory/chat` remains as a compatibility redirect to `/factory`.
|
|
165
|
+
|
|
166
|
+
The older Hub UI is gone. Factory still reuses `src/adapters/hub-git.ts` internally as its Git/worktree adapter, but there is no separate `/hub` product surface.
|
|
167
|
+
|
|
168
|
+
## Multi-agent context management
|
|
169
|
+
|
|
170
|
+
In Receipt, rebracketing means dynamically changing merge parenthesization based on observed critique/patch interactions, not just trimming prompt history. This gives context management at composition-order level while preserving deterministic replay and auditability.
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## Development
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
bun run dev
|
|
177
|
+
bun run test:smoke
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Release verification commands
|
|
181
|
+
|
|
182
|
+
Use these commands for different goals:
|
|
183
|
+
|
|
184
|
+
- `bun run verify:release`: full project release confidence (runs the broader smoke lane).
|
|
185
|
+
- `npm run verify:publish`: npm publish readiness for this CLI package (build + publish-safe smoke tests + pack smoke + `npm publish --dry-run`).
|
|
186
|
+
|
|
187
|
+
If you are preparing an npm publish, prefer `npm run verify:publish`.
|
|
188
|
+
|
|
189
|
+
## Docker + Resonate
|
|
190
|
+
|
|
191
|
+
Receipt now has two Docker modes.
|
|
192
|
+
|
|
193
|
+
### Dev mode
|
|
194
|
+
|
|
195
|
+
Use dev mode for local iteration. It bind-mounts the repo, keeps runtime state under the repo-local `.receipt/` tree, and forwards the targeted host auth/config surfaces that Factory and Codex need.
|
|
196
|
+
|
|
197
|
+
Start it with:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
bun run docker:dev:up
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
or the existing alias:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
bun run docker:up
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Dev mode:
|
|
210
|
+
|
|
211
|
+
- bind-mounts the repo at `/workspace/receipt`
|
|
212
|
+
- stores shared state under:
|
|
213
|
+
- `/workspace/receipt/.receipt/data`
|
|
214
|
+
- `/workspace/receipt/.receipt/resonate`
|
|
215
|
+
- `/workspace/receipt/.receipt/home`
|
|
216
|
+
- runs the Receipt multi-process Resonate runtime in one container
|
|
217
|
+
- enables Bun watch mode for the server roles
|
|
218
|
+
- runs a Tailwind watcher for live CSS updates
|
|
219
|
+
- makes `receipt`, `bun`, `git`, `gh`, `aws`, `python3`, `jq`, and `rg` available in the container
|
|
220
|
+
|
|
221
|
+
The 80/20 auth model in dev is:
|
|
222
|
+
|
|
223
|
+
- mount AWS, GitHub, Git, and SSH config directly into the stable container home
|
|
224
|
+
- mount the key Codex auth/config files directly into `CODEX_HOME`
|
|
225
|
+
- keep `CODEX_HOME/runtime` writable for isolated Codex homes and local runtime state
|
|
226
|
+
|
|
227
|
+
That means the container sees the same login state as the host CLI:
|
|
228
|
+
|
|
229
|
+
- `/workspace/receipt/.receipt/home/.aws`
|
|
230
|
+
- `/workspace/receipt/.receipt/home/.config/gh`
|
|
231
|
+
- `/workspace/receipt/.receipt/home/.gitconfig`
|
|
232
|
+
- `/workspace/receipt/.receipt/home/.git-credentials`
|
|
233
|
+
- `/workspace/receipt/.receipt/home/.ssh`
|
|
234
|
+
- `/workspace/receipt/.receipt/home/.codex/auth.json`
|
|
235
|
+
- `/workspace/receipt/.receipt/home/.codex/config.toml`
|
|
236
|
+
- `/workspace/receipt/.receipt/home/.codex/version.json`
|
|
237
|
+
- `/workspace/receipt/.receipt/home/.codex/.codex-global-state.json`
|
|
238
|
+
|
|
239
|
+
Stop it with:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
bun run docker:dev:down
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
If you really want to remove dev volumes too:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
bun run docker:dev:reset
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Prod mode
|
|
252
|
+
|
|
253
|
+
Use prod mode for distribution and upgrades. It runs from an immutable image, does not bind-mount the repo, and only persists runtime state volumes.
|
|
254
|
+
|
|
255
|
+
Start it with:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
bun run docker:prod:up
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Prod mode persists only:
|
|
262
|
+
|
|
263
|
+
- `/workspace/receipt/.receipt/data`
|
|
264
|
+
- `/workspace/receipt/.receipt/resonate`
|
|
265
|
+
- `/workspace/receipt/.receipt/home`
|
|
266
|
+
|
|
267
|
+
It does **not** mount the entire `.receipt/` tree, so the checked-in `.receipt/bin/receipt` wrapper and `.receipt/config.json` stay inside the image.
|
|
268
|
+
|
|
269
|
+
If you publish a distributable image, set `RECEIPT_IMAGE` and pull it first:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
RECEIPT_IMAGE=ghcr.io/your-org/receipt:latest bun run docker:prod:pull
|
|
273
|
+
RECEIPT_IMAGE=ghcr.io/your-org/receipt:latest bun run docker:prod:up
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Stop prod without deleting volumes:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
bun run docker:prod:down
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
If you explicitly want to destroy prod volumes too:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
bun run docker:prod:reset
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Shared runtime details
|
|
289
|
+
|
|
290
|
+
Both Docker modes run:
|
|
291
|
+
|
|
292
|
+
- the Receipt API process
|
|
293
|
+
- the Resonate driver process
|
|
294
|
+
- the chat worker process
|
|
295
|
+
- the control worker process
|
|
296
|
+
- the codex worker process
|
|
297
|
+
- an embedded Resonate server with SQLite persistence
|
|
298
|
+
|
|
299
|
+
Both expose:
|
|
300
|
+
|
|
301
|
+
- `http://localhost:8787` for Receipt
|
|
302
|
+
- `http://localhost:8001` for Resonate HTTP
|
|
303
|
+
- `http://localhost:9090/metrics` for Resonate metrics
|
|
304
|
+
|
|
305
|
+
Both use the same internal runtime paths:
|
|
306
|
+
|
|
307
|
+
- `DATA_DIR=/workspace/receipt/.receipt/data`
|
|
308
|
+
- `RESONATE_SQLITE_PATH=/workspace/receipt/.receipt/resonate/resonate.db`
|
|
309
|
+
- `HOME=/workspace/receipt/.receipt/home`
|
|
310
|
+
- `CODEX_HOME=/workspace/receipt/.receipt/home/.codex`
|
|
311
|
+
|
|
312
|
+
Codex isolated homes are created under `${CODEX_HOME}/runtime`, not `/tmp`.
|
|
313
|
+
|
|
314
|
+
For Linux hosts, the compose service sets `seccomp=unconfined` and `apparmor=unconfined` so Codex can install its own nested Landlock/seccomp sandbox inside the container. If you remove those, `codex exec --sandbox read-only|workspace-write` may fail inside Docker.
|
|
315
|
+
|
|
316
|
+
For local non-Docker startup with the Resonate control plane, use:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
bun run start:resonate
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
That command starts both the local Resonate server and the full multi-process Receipt runtime. It uses SQLite at `.receipt/resonate/resonate.db`, so the only extra local prerequisite is that the `resonate` CLI is installed on your machine.
|
|
323
|
+
|
|
324
|
+
The canonical source entrypoints in this repo are `bun src/cli.ts`, `bun src/server.ts`, and `bun scripts/start-resonate-runtime.mjs`.
|
|
325
|
+
|
|
326
|
+
Repo-local recurring jobs can be declared in `.receipt/config.json` under `schedules`. See [docs/api/config.md](./docs/api/config.md) for the schedule schema and a recurring Factory software-improvement example.
|
|
327
|
+
|
|
328
|
+
The server auto-loads route modules from `src/agents/*.agent.ts`.
|
|
329
|
+
|
|
330
|
+
The web UI uses `chat`, `thread`, and `Work Details` terminology while the durable code, HTTP APIs, receipts, and CLI still use `objective`.
|