agentleFS
UKGovernmentBEISUKGovernmentBEIS/control-arena/CLAUDE.md

control-arena

CLAUDE.md262 starsChanged 12 months agoMITView on GitHub

This repository contains code for control-arena, an open source library for AI Control experiments built on top of Inspect AI. It is built by the UK AI Security Institute. Code can be found in control_arena/. Docs can be found in docs/. Also see README.md and CONTRIBUTING.md for more information.

We split this CLAUDE.md into the rules it gives an agent

13 rules. About 0 are common, 4 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run python code: uv run path/to/script.py

    line 15
  2. Very specific:

    Run all tests: uv run pytest or uv run pytest -m "not skip_ci and no long_running"

    line 16
  3. Very specific:

    Run a single test: uv run pytest tests/path/to/test_file.py::test_function_name -v

    line 17
  4. Very specific:

    Formatting: Follow Google style convention.

    line 24
  5. Distinctive:

    Imports: Use isort order (enforced by ruff).

    line 25
  6. Distinctive:

    Naming: Use snake_case for variables, functions, methods.

    line 27
  7. Distinctive:

    Error Handling: Use appropriate exception types.

    line 31
  8. Distinctive:

    String Formatting: Don't wrap lines manually unless they should explicitly be separated by a line break.

    line 33
  9. Very specific:

    Use anyio.sleep() instead of asyncio.sleep()

    line 35
  10. Very specific:

    Use from control_arena._async_utils import gather instead of asyncio.gather() / asyncio.create_task()

    line 36
  11. Very specific:

    Use from control_arena._async_utils import run_sync instead of asyncio.run() for sync-to-async entry points

    line 39
  12. Very specific:

    Use anyio.open_process() instead of asyncio.create_subprocess_exec() (and catch anyio.EndOfStream when reading from process streams)

    line 40
  13. Very specific:

    Commit messages: Use Conventional Commits -- <type>: <description>.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Repository Overview

This repository contains code for control-arena, an open source library for AI Control experiments built on top of Inspect AI. It is built by the UK AI Security Institute.

Code can be found in control_arena/. Docs can be found in docs/. Also see README.md and CONTRIBUTING.md for more information.

Build/Lint/Test Commands

  • Run python code: uv run path/to/script.py
  • Run all tests: uv run pytest or uv run pytest -m "not skip_ci and no long_running"
  • Run a single test: uv run pytest tests/path/to/test_file.py::test_function_name -v
  • Format code: uv run ruff format
  • Lint code: uv run ruff check --fix
  • Type check: uv run pyright

Code Style Guidelines

  • Formatting: Follow Google style convention. Use ruff for formatting. Try to follow ruff styles directly when writing code. You can see what rules we have enabled in pyproject.toml.
  • Imports: Use isort order (enforced by ruff). Imports must be at the top of the file, unless there is a very good reason otherwise.
  • Types: Strict typing is required. All functions must have type annotations
  • Naming: Use snake_case for variables, functions, methods; PascalCase for classes
  • Docstrings: Google-style docstrings required for public APIs. These will be used for automatic documentation generation and so should be clear, easy to understand and complete.
  • Documentation: This project uses Quarto for documentation. See docs/ for examples. When adding new public APIs we may need to update the docs, including the automated API reference section in docs/reference/. Lists within .qmd files must be separated by a blank line from anything above, otherwise they will not render properly.
  • Spelling: This project is built by the UK AI Security Institute, so use UK English spelling where relevant.
  • Error Handling: Use appropriate exception types; include context in error messages. Use if / raise rather than assert for runtime checks.
  • Testing: Write tests with pytest; maintain high coverage. No need to mark async tests with pytest.mark.asyncio as this is configured automatically. Use pytest.mark.skip_ci for tests that should not run in CI (e.g. because they call LLMs), and pytest.mark.long_running for tests that take a long time to run.
  • String Formatting: Don't wrap lines manually unless they should explicitly be separated by a line break. Instead, put strings (e.g. docstrings) on one line so that they can be wrapped automatically by whatever editor is being used.
  • Async Code: This project supports both asyncio and trio backends via anyio (configured by the INSPECT_ASYNC_BACKEND environment variable). Do not use asyncio primitives directly. Instead:
    • Use anyio.sleep() instead of asyncio.sleep()
    • Use from control_arena._async_utils import gather instead of asyncio.gather() / asyncio.create_task()
    • Use from control_arena._async_utils import gather_with_exceptions instead of asyncio.gather(*coros, return_exceptions=True)
    • Use from control_arena._async_utils import as_completed_with_exceptions instead of asyncio.as_completed()
    • Use from control_arena._async_utils import run_sync instead of asyncio.run() for sync-to-async entry points
    • Use anyio.open_process() instead of asyncio.create_subprocess_exec() (and catch anyio.EndOfStream when reading from process streams)
    • Use anyio.to_thread.run_sync() instead of loop.run_in_executor()
    • Use anyio.fail_after() instead of asyncio.wait_for()
    • Use anyio.Semaphore() instead of asyncio.Semaphore()
    • See control_arena/_async_utils.py for available utilities

Git Conventions

  • Branch naming: <username>/<type>/<description> in kebab-case (e.g. alice/feat/add-new-setting, bob/fix/monitor-timeout)
  • Commit messages: Use Conventional Commits -- <type>: <description>. Common types: feat, fix, docs, refactor, chore, test. Use ! for breaking changes (e.g. feat!: Change sample ID format).

Respect existing code patterns when modifying files. Run linting before committing changes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.