Jules — Environment setup & AGENTS.md

A clear, practical guide for repository owners to prepare environments so Jules (and other agents) run reliably. Drop this file at the root of a repo or add as a documentation page on jules-prompts.wecanuseai.com.


Goal

Make it trivial for Jules to: clone your repo, install dependencies, run tests, and produce safe, reviewable changes. This document explains when to provide environment configuration, what to include, and how to validate it.

Quick facts (what Jules does)

When you should add an environment setup

Add explicit setup instructions when your repo is non-trivial to build or test locally, for example:

If your project is simple (single npm install && npm test), Jules will often auto-detect — but an explicit script still helps reliability.

Where Jules looks for guidance

  1. AGENTS.md (root) — a predictable, agent-focused markdown file describing build/test commands, conventions, and special notes. Jules will automatically read it if present.
  2. README.md — Jules will use it for hints when AGENTS.md isn’t available.
  3. Repository Configuration in the Jules UI (Codebase → Configuration → Initial Setup) — paste the setup script/commands there and use Run and Snapshot to validate.

Use Markdown. Keep it concise and machine-friendly with explicit commands.

Suggested sections:

Minimal example (put in AGENTS.md):

# AGENTS.md

## Dev environment tips
- Install: `npm ci`
- Build: `npm run build`
- Test: `npm test -- --runInBand`

## Notes
- Use Node 18.x for local development
- Do not commit `.env` files; tests use mocked credentials

Put the commands needed to install dependencies and run tests into the Jules repo Configuration -> Initial Setup box (or provide a script file in repo and reference it). Example steps you can paste:

Why the snapshot matters: when successful, Jules will save an environment snapshot and re-use it for later tasks for faster, more reliable runs.

Example setup scripts (copy-paste and adapt)

# repo root: setup_jules.sh
set -euo pipefail
echo "--- environment checks ---"
node -v
npm -v || pnpm -v || yarn -v

# install dependencies
npm ci
# run lint and tests
npm run lint --if-present || true
npm test --if-present

Python (venv + requirements)

set -euo pipefail
python -V
python -m venv .venv
. .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
# run tests
pytest -q

Go

set -euo pipefail
go version
# ensure module cache and build
go mod download
go test ./...

Rust

set -euo pipefail
rustup --version || true
rustc --version
cargo build --all --release
cargo test --all

Java / Maven

set -euo pipefail
java -version
mvn -v
mvn -B -DskipTests=false test

Validation & Run-and-Snapshot checklist

Handling secrets safely

Troubleshooting common environment issues

If a task fails due to environment setup, Jules will report logs and an error page you can use to debug. Use the error logs to iterate on the setup script.

Best practices & advanced tips

What to add to the jules-prompts site README/page


Where I pulled authoritative guidance

This guide follows official Jules docs and the AGENTS.md recommendation. Keep your AGENTS.md small and explicit — agents read it first.