This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Implementing puzzle solutions is strictly off-limits for LLMs and AI agents — that defeats the purpose of the challenge. All LLM assistance must be purely explanatory (e.g. clarifying algorithmic concepts, explaining language features, or discussing approaches). Non-solution code such as ./x.py and other tooling is fine to write or modify.
The primary interface is ./x.py, a Python CLI (runs via uv). Inputs are auto-downloaded and decrypted by x.py when needed.
# Run a solution
./x.py run <YEAR> <DAY> <PART>
# Test all solutions
./x.py test
# Test a specific year
./x.py test <YEAR>
# Test a specific day
./x.py test <YEAR> <DAY>
# Build
cargo build --release
# Lint Rust
cargo clippy
# Lint Python
ruff check x/Tests use cargo nextest (via ./x.py test) with the fast-test profile (optimized incremental builds). The completion and ci nextest profiles in .config/nextest.toml are for generating JUnit XML and CI use respectively.
This is a Cargo workspace where each year's solutions live in their own crate (aoc-2015 through aoc-2025). The aoc crate is the runnable binary that wires everything together.
Core types (in aoc-meta):
Solutiontrait — anyFn(&str) -> RwhereR: ReturnValue(i.e.usize,isize, orResult<T, E>) automatically implements it. Input is trimmed of trailing whitespace before being passed.Problem— holds up to two&'static dyn Solutionreferences (one per part). Constructed viaProblem::solved(part1_fn, part2_fn),Problem::partially_solved(part1_fn), orProblem::unsolved().ProblemSet— array of 25Option<Problem>entries, one per day.AdventOfCode— top-level registry mappingYear→ProblemSet.
Adding a new solution:
-
Create
aoc-<YEAR>/src/<DD>.rsexporting apub const MY_PROBLEM: Problem = Problem::solved(&part1, &part2). -
Register it in
aoc-<YEAR>/src/lib.rsvia thePROBLEMS!macro:PROBLEMS! { 01 => MY_PROBLEM, // ... }
-
Add expected answers to
aoc-<YEAR>/tests/<YEAR>.rsusing theaoc_test::tests!macro:aoc_test::tests!(2025, { 1: [part1_answer, part2_answer], });
Omit the second answer if only part 1 is solved.
x/ Python CLI (managed by uv, entry point x.py):
x/run.py— invokescargo run --release --package aoc -- YEAR DAY PART <input_path>withRUSTFLAGS=-C target-cpu=nativex/test.py— invokescargo nextest run --cargo-profile=fast-test; filters by package (aoc-<YEAR>) and test name (day<N>::)x/inputs/— handles downloading, encrypting, and decrypting puzzle inputs
aoc-common provides shared utilities used across multiple years: Grid<N, T> (2D square grid with rayon parallel iterators), TryFromStr (zero-copy string parsing), and BoolExt.