Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ scripts/
!scripts/spawn-parallel-worktrees.sh
!scripts/run-worker.sh
!scripts/headlesscode-answer.sh
!scripts/rsi-training/
!scripts/rsi-training/*.py
!scripts/rsi-training/requirements.lock
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_modules/
dist/
build/
*.tsbuildinfo
__pycache__/
*.py[cod]

# Logs and temp files
*.log
Expand Down
62 changes: 46 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/Capsize-Games/headlesscode/actions/workflows/ci.yml/badge.svg)](https://github.com/Capsize-Games/headlesscode/actions/workflows/ci.yml)
[![npm](https://img.shields.io/npm/v/headlesscode?logo=npm)](https://www.npmjs.com/package/headlesscode)
[![Node.js >=18](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
[![Node.js >=22.19](https://img.shields.io/badge/node-%3E%3D22.19-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](./LICENSE)

`headlesscode` runs the Zoo Code agent loop from a Node.js process, without a
Expand Down Expand Up @@ -38,7 +38,7 @@ monitoring.

## Quick start

Requires Node.js 18 or newer. Install globally or run with `npx`:
Requires Node.js 22.19 or newer. Install globally or run with `npx`:

```bash
npm install -g headlesscode
Expand Down Expand Up @@ -194,29 +194,59 @@ and each subcommand's `--help` for complete usage.

## Recursive self-improvement

`headlesscode improve` runs a bounded experiment against an external evaluator.
The supervisor creates candidate worktrees, asks the local Ollama worker to
make focused changes, runs regression and visible/hidden evaluations, and
keeps selection state outside candidate worktrees. Each generation produces a
report for human review.
`headlesscode improve --dry-run` resolves the base commit and prints planned
candidate worktrees. A real run requires PostgreSQL, a shared S3-compatible
artifact store, and at least one registered `headlesscode rsi-worker`. The
coordinator queues sanitized mutation snapshots and visible evaluation jobs;
workers run each in a fresh OpenShell guest. Fitness, paired baseline
comparison, archives, and selection stay in the coordinator. Hidden evaluation
remains disabled. A 2026-09-29 bounded run used two workers on the same local
OpenShell gateway; both candidate evaluation jobs were leased concurrently.
The run used a temporary `clamp.js` fixture and does not establish general
headlesscode improvement or multi-gateway operation. An earlier bounded run
passed visible checks but made no source change and was rejected.

```bash
npx tsx src/cli.ts improve --repo . --dry-run
npx tsx src/cli.ts improve --repo . --population 2 --generations 1
```

This loop does not yet train adapters, schedule multiple trajectories, or
provide OS-level candidate isolation. Follow-up work is tracked as:
Before starting workers, build the standard and RSI guest images on each
OpenShell gateway host that will run RSI jobs. Build the larger training image
only on gateways whose workers will accept model-training or paired
model-evaluation jobs:

```bash
docker build -f docker/OpenShell.Dockerfile -t headlesscode-openshell:local .
docker build -f docker/OpenShell-RSI.Dockerfile -t headlesscode-openshell-rsi:local .
docker build -f docker/OpenShell-RSI-Training.Dockerfile -t headlesscode-openshell-rsi-training:local .
```

The RSI Dockerfile extends `headlesscode-openshell:local` and removes the RSI
source, test files, and hidden evaluation suite from the guest image. See the [RSI design](./docs/recursive-self-improvement.md)
for worker and queue configuration.

The queue stores job state, worker registrations, leases, retries, and admission
policy in PostgreSQL; artifact bytes remain in object storage. Local integration
tests used 12 simulated workers and 100 queued jobs, including a 20 MiB artifact. Each
worker process currently runs one guest at a time and must be configured with a
unique worker ID and OpenShell gateway ID. The two-worker run observed 4.008
seconds of concurrent evaluation leases on one gateway. A local PostgreSQL/
RustFS test drained the remaining 96 jobs with 12 simulated workers in 446 ms
(215.2 jobs/s), after the initial four jobs were claimed and completed to
verify admission limits;
claims still serialize on a queue-policy row, and neither result qualifies a
multi-host deployment. Remaining work is:

| Issue | Work |
| --- | --- |
| [#3](https://github.com/Capsize-Games/headlesscode/issues/3) | OS-level candidate sandbox |
| [#4](https://github.com/Capsize-Games/headlesscode/issues/4) | Cryptographically verifiable evaluator and artifacts |
| [#5](https://github.com/Capsize-Games/headlesscode/issues/5) | Resource-aware resumable scheduler |
| [#6](https://github.com/Capsize-Games/headlesscode/issues/6) | Adaptive multi-trajectory search |
| [#7](https://github.com/Capsize-Games/headlesscode/issues/7) | Validated curriculum fixtures |
| [#8](https://github.com/Capsize-Games/headlesscode/issues/8) | Adversarial evaluation and cross-model supervision |
| [#9](https://github.com/Capsize-Games/headlesscode/issues/9) | Real LoRA or QLoRA backend |
| [#3](https://github.com/Capsize-Games/headlesscode/issues/3) | OpenShell candidate isolation is implemented; live multi-gateway qualification remains. |
| [#4](https://github.com/Capsize-Games/headlesscode/issues/4) | Content-addressed artifacts are implemented; signed evaluator provenance and hidden evaluation remain. |
| [#5](https://github.com/Capsize-Games/headlesscode/issues/5) | PostgreSQL queue, leases, retries, admission, and configured workers are implemented; live fleet qualification remains. |
| [#6](https://github.com/Capsize-Games/headlesscode/issues/6) | Bounded adaptive independent search supports an initial population plus one evidence-driven follow-up; repeated stages remain out of scope. |
| [#7](https://github.com/Capsize-Games/headlesscode/issues/7) | Fixture-backed curriculum replay and explicit promotion are implemented; wording-to-capability measurement remains unproven. |
| [#8](https://github.com/Capsize-Games/headlesscode/issues/8) | Adversarial review and bounded OpenShell break tests are implemented; live provider-backed review is unvalidated. |
| [#9](https://github.com/Capsize-Games/headlesscode/issues/9) | An OpenShell QLoRA prototype is covered by mocked job tests; the supplied GGUF is rejected before enqueue, and no live training is validated. |

See the [RSI design](./docs/recursive-self-improvement.md) and
[run progress](./docs/rsi-progress.md).
Expand Down
33 changes: 33 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
# headlesscode v1.3.0

Released 2026-09-28.

## Recursive self-improvement

- Added an OpenShell-backed RSI worker fleet with PostgreSQL job state,
resource admission, fenced leases, retries, and S3-compatible content-addressed
artifacts. Candidate mutation and visible evaluation run in separate guests
from sanitized snapshots.
- Added bounded adaptive candidate allocation, fixture-validated curriculum
proposals with explicit promotion, adversarial review, and model-candidate
provenance.
- Added a bounded QLoRA prototype with paired base/adapter evaluation. The
AirunnerDesktop Ollama-compatible worker can serve the local Qwen GGUF for
inference in RSI mutation. The GGUF is not supported as a QLoRA training
checkpoint; no live adapter training has been validated.
- Documented local load-test results and the current limits: no live
multi-host qualification, trusted hidden evaluator, or signed evaluator
provenance.
- Updated vulnerable transitive dependencies; `npm audit` reports zero
vulnerabilities.

## Verification

- `npm run typecheck`
- `npm test`
- `bash scripts/e2e/run.sh` (9 assertions passed)
- `python3 -m unittest discover -s scripts/rsi-training -p 'test_*.py'`
- OpenShell read-only checkpoint bind probe (read succeeded; write rejected by
the guest filesystem)
- `git diff --check`

# headlesscode v1.2.2

Released 2026-09-28.
Expand Down
16 changes: 16 additions & 0 deletions docker/OpenShell-RSI-Training.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Training-only extension. It is selected only by OpenShell training/model-evaluation jobs.
FROM headlesscode-openshell-rsi:local

USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-pip \
&& rm -rf /var/lib/apt/lists/*
COPY scripts/rsi-training/requirements.lock /opt/headlesscode-rsi-training/requirements.lock
RUN python3 -m pip install --break-system-packages --no-cache-dir --require-hashes -r /opt/headlesscode-rsi-training/requirements.lock
RUN python3 -c "import torch; assert torch.version.cuda is not None, 'RSI training image requires a CUDA-enabled torch wheel'"
COPY scripts/rsi-training/train_qlora.py /opt/headlesscode-rsi-training/train_qlora.py
COPY scripts/rsi-training/evaluate_adapter.py /opt/headlesscode-rsi-training/evaluate_adapter.py
RUN chmod 0555 /opt/headlesscode-rsi-training/train_qlora.py /opt/headlesscode-rsi-training/evaluate_adapter.py \
&& chmod -R a-w /opt/headlesscode-rsi-training

USER sandbox
15 changes: 15 additions & 0 deletions docker/OpenShell-RSI.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# RSI worker/evaluator runtime derived from the standard OpenShell image.
# The RSI coordinator, evaluator, and test files must stay in the supervisor
# process or candidate workspace; they are not part of this guest image.
FROM headlesscode-openshell:local

USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /opt/headlesscode/src/rsi \
&& find /opt/headlesscode/src -type d -name __tests__ -prune -exec rm -rf {} + \
&& find /opt/headlesscode/src -type f \( -name '*.test.ts' -o -name '*.spec.ts' \) -delete \
&& rm -rf /opt/headlesscode/scripts/eval-suite

USER sandbox
Loading
Loading