# Command-line workflows

Run `elf --help` for the command list and `elf COMMAND --help` for a command's arguments and options. If you installed Elf as a uv project dependency, use `uv run elf` from the project folder or activate its environment first.


# Work on a puzzle

| Task                                  | Command                        |
|---------------------------------------|--------------------------------|
| Create an interactive Python solution | `elf new 2025 1`               |
| Open the puzzle in a browser          | `elf open 2025 1`              |
| Save your puzzle input                | `elf input 2025 1 > day01.txt` |
| Submit 123 as the Part 1 answer       | `elf answer 2025 1 1 123`      |
| Inspect local guesses for both parts  | `elf guesses 2025 1`           |
| Check yearly progress                 | `elf status 2025`              |

`elf input`, `elf open`, and `elf guesses` accept an omitted year and day. In December they default to the current event and day, capped at the final puzzle. Outside December they select the last day of the latest event. An explicit archived year with no day selects its final puzzle. Events from 2015 through 2024 have 25 days. The reduced format introduced in 2025 has 12.

`elf answer` checks local guess history and active cooldowns before submitting. It returns exit code 0 for correct or completed answers, 2 for a cooldown, and 1 for other unsuccessful results. When a cooldown applies, use the reported retry time to decide when to submit again. Each invocation makes at most one submission.


# Export progress

`elf status` and `elf leaderboard` default to terminal tables. Use JSON for scripts, or export a leaderboard as CSV with one summary row per member.

``` sh
elf status 2025 --format json > status.json
elf leaderboard 2025 123456 --format csv > leaderboard.csv
```

Replace `123456` with the board ID from the private leaderboard page. Authenticate with your session cookie or supply the board's read-only share token through `--view-key`.


# Diagnose setup and find cached data

Use `elf doctor` to check credential configuration, the default puzzle, and cache access locally. For detailed tracebacks, run `elf --debug COMMAND` or set `ELF_DEBUG=1`.

Use `elf cache` to see the cache location and file count. Set `ELF_CACHE_DIR` to override the location. Inputs and guesses use a fingerprint of the session cookie, so a replacement cookie starts a new namespace. Guess history works offline. If several account caches contain the same puzzle, use `AOC_SESSION` or `--session` to select the account. Private leaderboard data is scoped to the event, board, and credential, and is cached for 15 minutes.
