self-bench 0.3.0 → 0.3.3

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 (140) hide show
  1. package/.dockerignore +9 -0
  2. package/Dockerfile +38 -0
  3. package/Dockerfile.sandbox +24 -0
  4. package/README.md +103 -171
  5. package/biome.json +18 -0
  6. package/bun.lock +1182 -0
  7. package/compose.yaml +85 -0
  8. package/dist/agent-smoke-main.js +1 -1
  9. package/dist/api.d.ts.map +1 -1
  10. package/dist/api.js +40 -2
  11. package/dist/api.js.map +1 -1
  12. package/dist/artifacts.d.ts +0 -1
  13. package/dist/artifacts.d.ts.map +1 -1
  14. package/dist/artifacts.js +0 -3
  15. package/dist/artifacts.js.map +1 -1
  16. package/dist/build-metadata.d.ts +2 -0
  17. package/dist/build-metadata.d.ts.map +1 -0
  18. package/dist/build-metadata.js +2 -0
  19. package/dist/build-metadata.js.map +1 -0
  20. package/dist/cli.js +26 -8
  21. package/dist/cli.js.map +1 -1
  22. package/dist/codex-review.d.ts +2 -1
  23. package/dist/codex-review.d.ts.map +1 -1
  24. package/dist/codex-review.js +26 -22
  25. package/dist/codex-review.js.map +1 -1
  26. package/dist/config.d.ts +0 -1
  27. package/dist/config.d.ts.map +1 -1
  28. package/dist/config.js +0 -2
  29. package/dist/config.js.map +1 -1
  30. package/dist/contracts.d.ts +1 -1
  31. package/dist/contracts.d.ts.map +1 -1
  32. package/dist/eval-main.js +3 -3
  33. package/dist/evaluate.d.ts.map +1 -1
  34. package/dist/evaluate.js +12 -7
  35. package/dist/evaluate.js.map +1 -1
  36. package/dist/provenance.d.ts +0 -1
  37. package/dist/provenance.d.ts.map +1 -1
  38. package/dist/provenance.js.map +1 -1
  39. package/dist/reaudit-main.js +10 -7
  40. package/dist/reaudit-main.js.map +1 -1
  41. package/dist/repair-main.js +8 -5
  42. package/dist/repair-main.js.map +1 -1
  43. package/dist/review/assets/index-CZ3G759O.js +1568 -0
  44. package/dist/review/assets/index-DgSLzX8l.css +1 -0
  45. package/dist/review/assets/{mojo-Blby8dQK.js → mojo-DJz3ZmWd.js} +1 -1
  46. package/dist/review/assets/typst-BUadGCkm.js +1 -0
  47. package/dist/review/index.html +2 -2
  48. package/dist/sandbox-repair.bundle.js +8 -7
  49. package/dist/sandbox-repair.js +7 -7
  50. package/dist/sandbox-repair.js.map +1 -1
  51. package/dist/sandbox-review.bundle.js +29 -25
  52. package/dist/sandbox-review.js +5 -3
  53. package/dist/sandbox-review.js.map +1 -1
  54. package/dist/sandbox-validation-repair.bundle.js +9 -9
  55. package/dist/sandbox-validation-repair.js +11 -9
  56. package/dist/sandbox-validation-repair.js.map +1 -1
  57. package/dist/subscription-auth.d.ts +12 -1
  58. package/dist/subscription-auth.d.ts.map +1 -1
  59. package/dist/subscription-auth.js +16 -16
  60. package/dist/subscription-auth.js.map +1 -1
  61. package/dist/{activities.d.ts → temporal/activities.d.ts} +2 -3
  62. package/dist/temporal/activities.d.ts.map +1 -0
  63. package/dist/{activities.js → temporal/activities.js} +44 -33
  64. package/dist/temporal/activities.js.map +1 -0
  65. package/dist/{temporal.d.ts → temporal/connection.d.ts} +2 -2
  66. package/dist/temporal/connection.d.ts.map +1 -0
  67. package/dist/{temporal.js → temporal/connection.js} +1 -1
  68. package/dist/temporal/connection.js.map +1 -0
  69. package/dist/{worker-main.d.ts.map → temporal/worker-main.d.ts.map} +1 -1
  70. package/dist/{worker-main.js → temporal/worker-main.js} +5 -9
  71. package/dist/temporal/worker-main.js.map +1 -0
  72. package/dist/{workflow.d.ts → temporal/workflow.d.ts} +1 -1
  73. package/dist/temporal/workflow.d.ts.map +1 -0
  74. package/dist/temporal/workflow.js.map +1 -0
  75. package/dist/validate-main.js +1 -1
  76. package/docs/evaluations.md +68 -0
  77. package/docs/operations.md +169 -0
  78. package/docs/task-construction.md +94 -0
  79. package/package.json +33 -20
  80. package/scripts/verify-package.ts +57 -0
  81. package/scripts/write-build-metadata.ts +27 -0
  82. package/src/agent-smoke-main.ts +63 -0
  83. package/src/agent-smoke.ts +132 -0
  84. package/src/api-main.ts +12 -0
  85. package/src/api.ts +277 -0
  86. package/src/artifacts.ts +357 -0
  87. package/src/audit.ts +106 -0
  88. package/src/build-metadata.ts +3 -0
  89. package/src/cli.ts +359 -0
  90. package/src/codex-review.ts +229 -0
  91. package/src/config.ts +114 -0
  92. package/src/contracts.ts +204 -0
  93. package/src/coupling.ts +259 -0
  94. package/src/docker-executor.ts +115 -0
  95. package/src/eval-main.ts +92 -0
  96. package/src/evaluate.ts +298 -0
  97. package/src/github.ts +26 -0
  98. package/src/harbor-results.ts +142 -0
  99. package/src/harbor-task.ts +528 -0
  100. package/src/hash.ts +5 -0
  101. package/src/modal-auth.ts +11 -0
  102. package/src/modal-executor.ts +176 -0
  103. package/src/parallel.ts +24 -0
  104. package/src/process.ts +165 -0
  105. package/src/provenance.ts +457 -0
  106. package/src/reaudit-main.ts +195 -0
  107. package/src/repair-main.ts +206 -0
  108. package/src/repair.ts +55 -0
  109. package/src/run-wait.ts +40 -0
  110. package/src/sandbox-author.ts +19 -0
  111. package/src/sandbox-repair.ts +156 -0
  112. package/src/sandbox-review.ts +19 -0
  113. package/src/sandbox-validation-repair.ts +177 -0
  114. package/src/sandbox.ts +51 -0
  115. package/src/subscription-auth.ts +80 -0
  116. package/src/temporal/activities.ts +1241 -0
  117. package/src/temporal/connection.ts +23 -0
  118. package/src/temporal/worker-main.ts +28 -0
  119. package/src/temporal/workflow.ts +519 -0
  120. package/src/validate-main.ts +171 -0
  121. package/src/validation-repair.ts +94 -0
  122. package/tsconfig.build.json +13 -0
  123. package/tsconfig.json +21 -0
  124. package/dist/activities.d.ts.map +0 -1
  125. package/dist/activities.js.map +0 -1
  126. package/dist/extensions/review.d.ts +0 -3
  127. package/dist/extensions/review.d.ts.map +0 -1
  128. package/dist/extensions/review.js +0 -44
  129. package/dist/extensions/review.js.map +0 -1
  130. package/dist/review/assets/index-Dq-6DFzI.css +0 -1
  131. package/dist/review/assets/index-DurW_RD7.js +0 -1567
  132. package/dist/review/assets/typst-DHCkPAjA.js +0 -1
  133. package/dist/temporal.d.ts.map +0 -1
  134. package/dist/temporal.js.map +0 -1
  135. package/dist/worker-main.js.map +0 -1
  136. package/dist/workflow.d.ts.map +0 -1
  137. package/dist/workflow.js.map +0 -1
  138. package/src/extensions/review.ts +0 -54
  139. /package/dist/{worker-main.d.ts → temporal/worker-main.d.ts} +0 -0
  140. /package/dist/{workflow.js → temporal/workflow.js} +0 -0
package/.dockerignore ADDED
@@ -0,0 +1,9 @@
1
+ .git
2
+ .github
3
+ .selfbench
4
+ .venv
5
+ dist
6
+ jobs
7
+ node_modules
8
+ tests
9
+ *.md
package/Dockerfile ADDED
@@ -0,0 +1,38 @@
1
+ FROM oven/bun:1.3.14-debian AS build
2
+
3
+ WORKDIR /app
4
+ ARG SELFBENCH_BUILD_COMMIT
5
+ COPY package.json bun.lock ./
6
+ RUN bun install --frozen-lockfile
7
+ COPY biome.json tsconfig.json tsconfig.build.json ./
8
+ COPY src ./src
9
+ COPY review ./review
10
+ COPY scripts ./scripts
11
+ RUN bun run build
12
+
13
+ FROM docker:29.4.0-cli AS docker-cli
14
+
15
+ FROM node:22-bookworm
16
+
17
+ ARG HARBOR_VERSION=0.20.1.dev202608040148
18
+ RUN apt-get update \
19
+ && apt-get install -y --no-install-recommends bash ca-certificates curl gh git jq ripgrep tar \
20
+ && rm -rf /var/lib/apt/lists/* \
21
+ && curl -LsSf https://astral.sh/uv/0.11.3/install.sh | env UV_INSTALL_DIR=/usr/local/bin UV_NO_MODIFY_PATH=1 sh \
22
+ && env UV_PYTHON_INSTALL_DIR=/opt/uv-python UV_TOOL_DIR=/opt/uv-tools UV_TOOL_BIN_DIR=/usr/local/bin uv tool install --python 3.12 "harbor[modal]==${HARBOR_VERSION}" \
23
+ && chmod -R a+rX /opt/uv-python /opt/uv-tools
24
+ COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
25
+ COPY --from=docker-cli /usr/local/libexec/docker/cli-plugins /usr/local/libexec/docker/cli-plugins
26
+
27
+ ENV NODE_ENV=production
28
+ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
29
+ WORKDIR /app
30
+ RUN mkdir -p /var/lib/selfbench/artifacts && chown -R node:node /var/lib/selfbench
31
+ COPY --from=build /app/node_modules ./node_modules
32
+ COPY --from=build /app/dist ./dist
33
+ COPY src/extensions ./src/extensions
34
+ COPY src/skills ./src/skills
35
+ COPY package.json ./package.json
36
+
37
+ USER node
38
+ CMD ["node", "dist/api-main.js"]
@@ -0,0 +1,24 @@
1
+ FROM node:22-bookworm
2
+
3
+ ARG PI_VERSION=0.84.0
4
+ ARG CODEX_VERSION=0.146.1
5
+ ARG GH_VERSION=2.89.0
6
+ ARG TARGETARCH
7
+
8
+ RUN apt-get update \
9
+ && apt-get install -y --no-install-recommends bash ca-certificates curl git jq ripgrep unzip xz-utils \
10
+ && rm -rf /var/lib/apt/lists/*
11
+ RUN case "${TARGETARCH}" in \
12
+ amd64) GH_SHA256=d0422caade520530e76c1c558da47daebaa8e1203d6b7ff10ad7d6faba3490d8 ;; \
13
+ arm64) GH_SHA256=9e64a623dfc242990aa5d9b3f507111149c4282f66b68eaad1dc79eeb13b9ce5 ;; \
14
+ *) echo "unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
15
+ esac \
16
+ && curl -fsSL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${TARGETARCH}.tar.gz" -o /tmp/gh.tar.gz \
17
+ && echo "${GH_SHA256} /tmp/gh.tar.gz" | sha256sum -c - \
18
+ && tar -xzf /tmp/gh.tar.gz -C /tmp \
19
+ && mv "/tmp/gh_${GH_VERSION}_linux_${TARGETARCH}/bin/gh" /usr/local/bin/gh \
20
+ && rm -rf /tmp/gh.tar.gz "/tmp/gh_${GH_VERSION}_linux_${TARGETARCH}"
21
+ RUN npm install --global --ignore-scripts "@earendil-works/pi-coding-agent@${PI_VERSION}"
22
+ RUN npm install --global "@openai/codex@${CODEX_VERSION}"
23
+
24
+ WORKDIR /work
package/README.md CHANGED
@@ -1,254 +1,186 @@
1
- # SelfBench
1
+ # self-bench
2
2
 
3
- SelfBench turns completed GitHub changes into private [Harbor](https://harborframework.com/) evaluations for coding agents. It finds real feature requests, builds tasks from the repository's base commit, hides the tests and reference solution, and checks that each task fails without a solution and passes with one.
3
+ [![npm version](https://img.shields.io/npm/v/self-bench?color=blue&label=npm)](https://www.npmjs.com/package/self-bench)
4
+ [![CI](https://github.com/mupt-ai/self-bench/actions/workflows/ci.yml/badge.svg)](https://github.com/mupt-ai/self-bench/actions/workflows/ci.yml)
5
+ [![license](https://img.shields.io/github/license/mupt-ai/self-bench?color=green)](./LICENSE)
6
+ [![Bun](https://img.shields.io/badge/runtime-Bun-f9f1e1?logo=bun&logoColor=000)](https://bun.sh/)
7
+ [![TypeScript](https://img.shields.io/badge/lang-TypeScript-3178c6?logo=typescript&logoColor=fff)](https://www.typescriptlang.org/)
4
8
 
5
- SelfBench is a TypeScript package. Use **Bun** to install dependencies, build the package, and run the development CLI.
9
+ **self-bench builds private coding-agent benchmarks from work already completed in your repository, so you can compare coding agents and models on tasks drawn from your own codebase.**
6
10
 
7
- ## Choose your setup
11
+ It finds completed requests from local coding sessions and merged GitHub pull requests, then reconstructs each task from the commit before the change. For every accepted task, self-bench creates hidden tests and a reference solution, proves that the task fails without a solution and passes with the original implementation, and exports a native task for [Harbor](https://harborframework.com/), a runner for coding-agent evaluations.
8
12
 
9
- | Setup | Best for | Execution | State |
10
- | --- | --- | --- | --- |
11
- | Local | Trying SelfBench or small runs | Docker on your machine | Local Docker volumes |
12
- | Temporal Cloud | Large repositories, long runs, and reliable unattended execution | Modal sandboxes | Temporal Cloud + object storage |
13
+ The result is a private `.tar.gz` benchmark that you can run against multiple models:
13
14
 
14
- After a run is submitted, the workflow continues independently of the waiting CLI process. The local worker still depends on your machine and its Docker stack; Temporal Cloud is the recommended setup when a run may take hours or your laptop should not be responsible for the worker.
15
+ ```text
16
+ Your repository history
17
+
18
+ completed requests + implementations
19
+
20
+ validated Harbor tasks with hidden tests
21
+
22
+ gpt-5.6-luna vs gpt-5.6-terra vs gpt-5.6-sol
23
+ ```
15
24
 
16
- ## Prerequisites
25
+ ## Quickstart
17
26
 
18
- All setups require:
27
+ This path runs the self-bench API, worker, and [Temporal](https://temporal.io/) workflow state locally while using [Modal](https://modal.com/) for disposable task-generation and validation sandboxes.
28
+
29
+ ### Prerequisites
19
30
 
20
31
  - [Bun](https://bun.sh/) 1.3.14 or newer
21
32
  - Docker with Compose
22
- - Node.js 22 or newer (the built service images use Node)
23
- - `gh`, authenticated with access to the source repository
24
- - Pi with an authenticated `openai-codex` account
25
- - Codex CLI with an authenticated account
26
-
27
- Modal execution additionally requires a Modal account and token. Temporal Cloud execution additionally requires a Temporal Cloud namespace and a durable artifact store such as Google Cloud Storage.
28
-
29
- ## Install from source
30
-
31
- The package is not currently published to npm. Clone the repository and build it locally:
32
-
33
- ```bash
34
- git clone https://github.com/mupt-ai/self-bench.git
35
- cd self-bench
36
- bun install --frozen-lockfile
37
- bun run build
38
- ```
33
+ - [Modal](https://modal.com/) CLI, account, and token (`pip install modal`)
34
+ - [`gh`](https://cli.github.com/), authenticated with read access to the repository
35
+ - An OpenAI API key with access to `gpt-5.6-sol`, `gpt-5.6-terra`, and `gpt-5.6-luna`
36
+ - A Git checkout with a GitHub `origin` and completed work in its history
39
37
 
40
- The compiled CLI is `dist/cli.js`, and the package exposes it as `selfbench`. To use `selfbench` directly from this checkout:
38
+ Install self-bench and authenticate Modal and GitHub:
41
39
 
42
40
  ```bash
43
- bun link
44
- selfbench --help
41
+ bun add --global self-bench
42
+ modal token new
43
+ gh auth login
45
44
  ```
46
45
 
47
- During development, run the TypeScript entrypoint without linking:
46
+ Set the model and GitHub credentials used by the local worker, plus a random token that protects the local self-bench API:
48
47
 
49
48
  ```bash
50
- bun run cli -- --help
49
+ export OPENAI_API_KEY=...
50
+ export GH_TOKEN="$(gh auth token)"
51
+ export SELFBENCH_API_TOKEN="$(openssl rand -hex 24)"
51
52
  ```
52
53
 
53
- Authenticate the tools before starting a run:
54
+ ### 1. Start self-bench
54
55
 
55
56
  ```bash
56
- gh auth login
57
- # In Pi: /login -> OpenAI Codex
58
- codex login
57
+ self-bench up --backend modal
58
+ export SELFBENCH_API_URL=http://127.0.0.1:8080
59
59
  ```
60
60
 
61
- ## Quick start: local Docker
61
+ This starts Postgres, Temporal, the self-bench API, and a worker in Docker. The worker sends sandbox work to Modal; `SELFBENCH_API_URL` tells subsequent CLI commands where to reach the local API.
62
62
 
63
- This starts Postgres, Temporal, the SelfBench API, and a worker on your machine. The worker runs sandbox validation through Docker.
63
+ ### 2. Build a benchmark
64
64
 
65
65
  ```bash
66
- export SELFBENCH_API_TOKEN="$(openssl rand -hex 24)"
67
- export GH_TOKEN="$(gh auth token)"
68
-
69
- selfbench up --backend docker
70
- export SELFBENCH_API_URL=http://127.0.0.1:8080
71
-
72
- selfbench run \
66
+ self-bench run \
73
67
  --repo /absolute/path/to/your/repository \
74
- --easy-count 30 \
75
- --medium-count 30 \
68
+ --easy-count 10 \
69
+ --medium-count 10 \
76
70
  --hard-count 10 \
77
- --output ./selfbench-evals.tar.gz
71
+ --output ./self-bench-evals.tar.gz
78
72
  ```
79
73
 
80
- The `--repo` directory must be a Git checkout with a GitHub `origin`. SelfBench pins the current `HEAD`; uncommitted changes are ignored. It discovers candidate requests from sanitized local coding-session messages and merged, non-bot GitHub pull requests.
74
+ Easy, medium, and hard candidates require at least 20, 50, and 100 changed implementation lines across 1, 2, and 3 paths respectively; the counts are generation budgets, not guarantees that every candidate will pass validation.
81
75
 
82
- This quick start authors 70 candidates: 30 easy, 30 medium, and 10 hard. Counts are authoring budgets, not accepted-task guarantees. Candidates can be rejected during authoring, validation, audit, or review, and rejected candidates are not replaced.
76
+ The repository must be a Git checkout with a GitHub `origin`. self-bench pins its current `HEAD`, ignores uncommitted changes, and may take hours to author, validate, review, and export the accepted tasks. `--output` waits for completion and verifies the downloaded archive with SHA-256.
83
77
 
84
- A run may take hours. `--output` waits for the run to finish, then downloads and SHA-256-verifies the accepted tasks.
85
-
86
- ## Local commands
87
-
88
- ```bash
89
- selfbench status RUN_ID
90
- selfbench list
91
- selfbench cancel RUN_ID
92
- selfbench download RUN_ID ./selfbench-evals.tar.gz
93
- ```
94
-
95
- If you are working from source rather than using `bun link`, use the same commands through Bun:
96
-
97
- ```bash
98
- bun run cli -- status RUN_ID
99
- ```
78
+ ### 3. Compare models with Harbor
100
79
 
101
- Stop the local stack with Docker Compose:
80
+ Install Harbor and extract the generated tasks:
102
81
 
103
82
  ```bash
104
- docker compose down
105
- ```
106
-
107
- Named Docker volumes retain Temporal history and generated artifacts. Back them up before removing them if you need to resume or inspect old runs.
108
-
109
- ## Reliable setup for larger repositories
110
-
111
- For large repositories or unattended runs, use Temporal Cloud for workflow state and Modal for disposable execution sandboxes. Temporal Cloud does not host the SelfBench API or worker; deploy those separately.
112
-
113
- ```text
114
- selfbench CLI
115
- -> SelfBench API
116
- -> Temporal Cloud namespace
117
- -> persistent SelfBench worker
118
- -> Modal sandboxes
119
- -> GCS artifact storage
120
- ```
121
-
122
- The API and worker must use the same image version, Temporal namespace, task queue, artifact configuration, and `SELFBENCH_BUILD_COMMIT`. Keep the worker running on a long-lived container service; do not run it on a scale-to-zero request service. The API can run as a normal HTTP service.
83
+ uv tool install --python 3.12 'harbor[modal]==0.20.1.dev202608040148'
123
84
 
124
- ### 1. Prepare Temporal Cloud and GCS
125
-
126
- Create a Temporal Cloud namespace and obtain its address, namespace, API key, and TLS settings. Create a GCS bucket for SelfBench artifacts and give the worker/API service accounts access only to the SelfBench prefix.
127
-
128
- Set these values in the API and worker environments:
129
-
130
- ```bash
131
- SELFBENCH_TEMPORAL_ADDRESS=your-namespace.tmprl.cloud:7233
132
- SELFBENCH_TEMPORAL_NAMESPACE=your-namespace
133
- SELFBENCH_TEMPORAL_API_KEY=...
134
- SELFBENCH_TEMPORAL_TLS=true
135
- SELFBENCH_TASK_QUEUE=selfbench-production
136
- SELFBENCH_ARTIFACT_BACKEND=gcs
137
- SELFBENCH_GCS_BUCKET=your-selfbench-artifacts
138
- SELFBENCH_GCS_PREFIX=selfbench
85
+ mkdir -p ./self-bench-export ./self-bench-tasks
86
+ tar -xzf ./self-bench-evals.tar.gz -C ./self-bench-export
87
+ for archive in ./self-bench-export/tasks/*.tar.gz; do
88
+ task_id="$(basename "$archive" .tar.gz)"
89
+ mkdir -p "./self-bench-tasks/$task_id"
90
+ tar -xzf "$archive" --strip-components=1 -C "./self-bench-tasks/$task_id"
91
+ done
139
92
  ```
140
93
 
141
- Do not use the local Compose defaults (`temporal` database credentials, loopback Temporal address, or local artifact volume) in a hosted deployment.
142
-
143
- ### 2. Deploy the API
144
-
145
- Build and deploy `Dockerfile` as a service listening on port 8080. Configure:
94
+ Run Harbor's Codex agent adapter once for all three models. Harbor evaluates every extracted task at high reasoning and keeps the model results in one job directory:
146
95
 
147
96
  ```bash
148
- SELFBENCH_API_HOST=0.0.0.0
149
- SELFBENCH_API_TOKEN=use-a-secret-value
150
- SELFBENCH_ARTIFACT_BACKEND=gcs
151
- SELFBENCH_GCS_BUCKET=your-selfbench-artifacts
152
- SELFBENCH_GCS_PREFIX=selfbench
153
- SELFBENCH_TEMPORAL_ADDRESS=...
154
- SELFBENCH_TEMPORAL_NAMESPACE=...
155
- SELFBENCH_TEMPORAL_API_KEY=...
156
- SELFBENCH_TEMPORAL_TLS=true
157
- SELFBENCH_TASK_QUEUE=selfbench-production
97
+ harbor run \
98
+ --path ./self-bench-tasks \
99
+ --agent codex \
100
+ --model gpt-5.6-luna \
101
+ --model gpt-5.6-terra \
102
+ --model gpt-5.6-sol \
103
+ --ak version=0.146.1 \
104
+ --ak reasoning_effort=high \
105
+ --env modal \
106
+ --jobs-dir ./harbor-jobs \
107
+ --n-concurrent 20 \
108
+ --yes
158
109
  ```
159
110
 
160
- Then point the CLI at the API:
111
+ The evaluated agent receives the base repository and task instruction, but not the hidden tests or reference solution.
161
112
 
162
- ```bash
163
- export SELFBENCH_API_URL=https://selfbench-api.example.com
164
- export SELFBENCH_API_TOKEN=use-a-secret-value
165
- ```
113
+ See [Running self-bench evaluations](docs/evaluations.md) for running one task and using the optional resumable matrix helper.
166
114
 
167
- ### 3. Deploy the worker
115
+ ## Run management
168
116
 
169
- Run the same image with this command:
117
+ Closing the waiting CLI does not cancel a submitted workflow. If the local worker or Docker stack stops, work pauses until the worker is restarted.
170
118
 
171
119
  ```bash
172
- node dist/worker-main.js
120
+ self-bench list # find run IDs
121
+ self-bench status RUN_ID
122
+ self-bench cancel RUN_ID
123
+ self-bench download RUN_ID ./self-bench-evals.tar.gz
173
124
  ```
174
125
 
175
- Give the worker the Temporal, GCS, and task-queue settings above, plus the credentials it needs to discover, author, validate, and review tasks:
126
+ Stop the local stack with:
176
127
 
177
128
  ```bash
178
- SELFBENCH_EXECUTION_BACKEND=modal
179
- SELFBENCH_HARBOR_ENVIRONMENT=modal
180
- MODAL_TOKEN_ID=...
181
- MODAL_TOKEN_SECRET=...
182
- GH_TOKEN=...
183
- SELFBENCH_PI_AUTH_JSON=...
129
+ self-bench down
184
130
  ```
185
131
 
186
- Provide the Codex auth JSON to the worker at `/home/node/.codex/auth.json` (the default location in the production image), for example through a read-only secret mount. Alternatively, mount it elsewhere and set `CODEX_AUTH_JSON_PATH` to that file. Keep model credentials in the worker only; the API does not need them.
132
+ Named Docker volumes retain Temporal history and generated artifacts.
187
133
 
188
- ### 4. Run against the hosted service
134
+ ## Other deployments
189
135
 
190
- ```bash
191
- selfbench run \
192
- --repo /absolute/path/to/your/repository \
193
- --easy-count 2 \
194
- --medium-count 2 \
195
- --output ./selfbench-evals.tar.gz
196
- ```
136
+ The quickstart is the recommended setup: a local stack with Modal sandboxes.
197
137
 
198
- The CLI uploads only repository metadata and sanitized provenance. The worker performs discovery, authoring, sandbox validation, review, audit, and export remotely.
138
+ - **Local stack + Docker sandboxes:** use `self-bench up --backend docker` when you want all execution on your machine.
139
+ - **Temporal Cloud + Modal:** use this for persistent unattended workers and large repositories.
199
140
 
200
- ### Large-repository guidance
141
+ See [Operations and deployment](docs/operations.md) for backend configuration, credentials, persistence, object storage, and the complete Temporal Cloud deployment.
201
142
 
202
- - Prefer Modal over local Docker so the run is not tied to your laptop's CPU, memory, or Docker daemon.
203
- - Start with one or two candidates per tier to confirm credentials, provenance, and repository compatibility before increasing the budget.
204
- - Treat counts as authoring attempts, not accepted-task guarantees.
205
- - Keep the worker alive for the entire run; discovery and authoring are retryable, but a missing worker stops progress.
206
- - Keep GCS and Temporal state persistent. Do not delete the artifact prefix or Temporal namespace while runs are active.
207
- - Use a dedicated task queue for each deployment and ensure the API and worker use exactly the same value.
208
- - Use `status`, `list`, and `download` from any machine that can reach the API.
143
+ ## How tasks are validated
209
144
 
210
- ## Backend options
145
+ An accepted task must:
211
146
 
212
- The local `up` command configures one execution backend for the stack:
147
+ 1. Preserve a real human request from repository history.
148
+ 2. Start from the repository state before the completed change.
149
+ 3. Include hidden tests that fail against the base snapshot.
150
+ 4. Pass after applying the original implementation.
151
+ 5. Survive deterministic reruns and an independent model review that rejects tests tied to private details of the reference solution.
213
152
 
214
- ```bash
215
- # Local Docker sandboxes; simplest, usually one activity at a time
216
- selfbench up --backend docker
153
+ Exports contain repository snapshots, hidden tests, and reference solutions. They are sensitive and unencrypted; keep them private.
217
154
 
218
- # Modal sandboxes; better for concurrency and larger runs
219
- modal token new
220
- selfbench up --backend modal
221
- ```
155
+ See [Task construction and validation](docs/task-construction.md) for the full acceptance rules and archive format.
222
156
 
223
- For Modal, `selfbench up` uses `~/.modal.toml` by default. Override it with:
157
+ ## Development
224
158
 
225
159
  ```bash
226
- selfbench up --backend modal --modal-config /absolute/path/to/.modal.toml
160
+ git clone https://github.com/mupt-ai/self-bench.git
161
+ cd self-bench
162
+ bun install --frozen-lockfile
163
+ bun run validate
227
164
  ```
228
165
 
229
- ## Development
166
+ Run the CLI directly from source:
230
167
 
231
168
  ```bash
232
- bun install --frozen-lockfile
233
- bun run check
234
- bun run test
235
- bun run build
236
- bun run validate
169
+ bun run cli -- --help
237
170
  ```
238
171
 
239
172
  Useful development commands:
240
173
 
241
174
  ```bash
242
- bun run cli -- --help
243
175
  bun run dev:api
244
176
  bun run dev:worker
245
177
  bun run dev:review
246
178
  ```
247
179
 
248
- More detail is available in:
180
+ ## Documentation
249
181
 
250
- - [Task construction](docs/task-construction.md)
251
- - [Evaluation workflows](docs/evaluations.md)
182
+ - [Task construction and validation](docs/task-construction.md)
183
+ - [Running evaluations](docs/evaluations.md)
252
184
  - [Operations and deployment](docs/operations.md)
253
185
 
254
186
  ## License
package/biome.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.5.7/schema.json",
3
+ "files": {
4
+ "includes": ["src/**/*.ts", "tests/**/*.ts", "review/src/**/*.{ts,tsx}"]
5
+ },
6
+ "formatter": {
7
+ "enabled": true,
8
+ "indentStyle": "space",
9
+ "indentWidth": 2,
10
+ "lineWidth": 100
11
+ },
12
+ "linter": {
13
+ "enabled": true,
14
+ "rules": {
15
+ "preset": "recommended"
16
+ }
17
+ }
18
+ }