Skip to content
Draft
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
53 changes: 53 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# AGENTS.md

## Cursor Cloud specific instructions

### Product overview

Genesis Protocol is a **Rust Cargo workspace** (13 crates). The primary runnable service is the **OaaS HTTP gateway** (`genesis-protocol` binary): background simulation ticks plus REST/SSE on port **3000**. Persistence is a JSON snapshot (`world_state.json`) in the process working directory.

See `README.md` for experiment reproduction (`cargo run --release --bin run_experiments`) and `scripts/validate.sh` for deployment smoke checks.

### Toolchain (non-obvious)

- **Rust stable ≥ 1.96** is required: `Cargo.lock` pulls `getrandom` 0.4.x, which needs a recent toolchain. The image may ship an older default (e.g. 1.83); run `rustup default stable` and `source /usr/local/cargo/env` before building.
- **System packages** (one-time on a fresh VM, not in the update script): `pkg-config`, `libssl-dev`, `build-essential` — needed for `openssl-sys` / `reqwest` native TLS.

### Running the gateway locally

After `cargo build --release`:

```bash
./target/release/genesis-protocol
# or: cargo run --release --bin genesis-protocol
```

Binds `0.0.0.0:3000`. Optional `.env` from `.env.example` (Moltbook adapter only if `MOLTBOOK_API_KEY` is set).

### Lint / test / build

| Task | Command |
|------|---------|
| Build | `cargo build --release` |
| Tests | `cargo test --workspace` (7 long-run tests in `tests/long_run_validation.rs` are `#[ignore]`) |
| Lint | `cargo clippy --workspace --all-targets` (warnings only; no CI config in-repo) |

### Smoke validation

With the server listening on `localhost:3000`:

```bash
bash scripts/validate.sh hour0
```

`hour1`–`hour5` assume Docker container name `genesis-protocol` and optional Moltbook logs — skip those in pure local `cargo run` setups.

### Optional components (out of scope for default dev)

- **Docker**: `docker compose up` per `docker-compose.yml` (not required for local dev).
- **papers/**: `cd papers && npm install && npm run build-pdf` (Puppeteer PDF).
- **tts/**: `python tts/server.py` on port 8770 (FastAPI + Piper; separate Python deps).

### Background processes in Cloud Agent VMs

If `tmux` is unavailable, start the gateway with the release binary in the background and log to `/tmp/genesis-server.log`. Always pass `--bin genesis-protocol` when using `cargo run` (multiple binaries in the root package).