Get the FREE Ultimate OpenClaw Setup Guide →

AOC Orchestrator

Scanned
npx machina-cli add skill magnusrodseth/aoc-2025/aoc-orchestrator --openclaw
Files (1)
SKILL.md
5.7 KB

AOC Orchestrator

Purpose

This skill is the main coordinator for the automated Advent of Code workflow. It orchestrates the entire process from puzzle fetching to submission, managing the execution of other specialized skills and handling the overall workflow state.

When to Use This Skill

  • Automatically triggered by cron/launchd on puzzle unlock days (December 1-12, 2025)
  • Can be manually invoked for testing or re-running specific days
  • Used when the user wants to execute the full end-to-end workflow

Workflow Steps

0. Pre-flight Check: Is This Day Already Solved?

CRITICAL: This MUST be the first step. Do not proceed if the puzzle is already complete.

  1. Run aoc calendar --year 2025 to see progress (completed days show decorations/artwork)
  2. Check if report exists: puzzles/day<DD>/report.md - if it shows both parts completed, EXIT
  3. Check state file if it exists: state/day<DD>.json

If both parts are already solved: DO NOT proceed. Report "Day X is already complete! Nothing to do." and EXIT.

1. Initialization (only if not already complete)

# Check current date and determine which day to solve
# Verify session cookie is configured

2. Invoke Puzzle Fetcher Skill

  • Download puzzle description and input
  • Parse examples and expected outputs
  • Extract part 1 and part 2 requirements

3. Invoke TDD Solver Skill - Part 1

  • Generate test cases from examples
  • Implement solution using TDD
  • Verify all tests pass
  • Generate answer from real input

4. Invoke Submission Handler Skill - Part 1

  • Submit part 1 answer
  • Parse response
  • Handle success/failure

5. If Part 1 Succeeds, Invoke TDD Solver Skill - Part 2

  • Parse part 2 requirements
  • Generate new test cases
  • Extend or rewrite solution for part 2
  • Verify all tests pass

6. Invoke Submission Handler Skill - Part 2

  • Submit part 2 answer
  • Handle final results

Error Handling

Puzzle Not Yet Available

If puzzle unlock time not reached:
  - Log: "Puzzle for day X not yet available"
  - Exit gracefully
  - Next cron execution will retry

Already Solved

If day already has both stars:
  - Log: "Day X already completed"
  - Exit gracefully
  - No further action needed

Network Errors

If network request fails:
  - Log error details
  - Retry up to 3 times with exponential backoff
  - If still failing, exit and alert

Compilation Errors

If Rust code fails to compile:
  - Log compiler errors
  - Attempt to fix based on error messages
  - Retry compilation
  - Max 5 fix attempts per part

State Management

Track workflow state in state/day{day}.json:

{
  "day": 1,
  "year": 2025,
  "status": "in_progress",
  "part1": {
    "status": "completed",
    "answer": 24000,
    "submitted_at": "2025-12-01T05:01:23Z",
    "attempts": 1
  },
  "part2": {
    "status": "in_progress",
    "answer": null,
    "submitted_at": null,
    "attempts": 0
  },
  "started_at": "2025-12-01T05:00:15Z",
  "completed_at": null
}

Success Criteria

  • ✅ Both part 1 and part 2 answers accepted
  • ✅ All tests passing
  • ✅ Code compiles without warnings
  • ✅ Solution completes in < 15 seconds
  • ✅ State file updated correctly

Logging

Log all actions to logs/day{day}.log:

[2025-12-01 05:00:15] INFO: Starting orchestration for Day 1
[2025-12-01 05:00:16] INFO: Invoking puzzle-fetcher skill
[2025-12-01 05:00:18] INFO: Puzzle downloaded successfully
[2025-12-01 05:00:18] INFO: Invoking tdd-solver skill for Part 1
[2025-12-01 05:02:45] INFO: Part 1 solution implemented, all tests pass
[2025-12-01 05:02:46] INFO: Invoking submission-handler for Part 1
[2025-12-01 05:02:47] SUCCESS: Part 1 answer accepted!
[2025-12-01 05:02:48] INFO: Invoking tdd-solver skill for Part 2
...

Command Interface

When invoked manually:

# Run for today's puzzle
cargo run --bin aoc-orchestrator

# Run for specific day
cargo run --bin aoc-orchestrator -- --day 5

# Dry run (no submission)
cargo run --bin aoc-orchestrator -- --day 1 --dry-run

# Force re-run even if already solved
cargo run --bin aoc-orchestrator -- --day 1 --force

# Verbose debugging
cargo run --bin aoc-orchestrator -- --day 1 --debug

Integration with Other Skills

Calling Puzzle Fetcher

// Pseudo-code showing skill invocation
let puzzle_data = invoke_skill("puzzle-fetcher", {
    "day": day_number,
    "year": 2025
})?;

Calling TDD Solver

let solution = invoke_skill("tdd-solver", {
    "day": day_number,
    "part": 1,
    "examples": puzzle_data.examples,
    "input": puzzle_data.input
})?;

Calling Submission Handler

let result = invoke_skill("submission-handler", {
    "day": day_number,
    "part": 1,
    "answer": solution.answer
})?;

Performance Metrics

Track and report:

  • Total time from start to completion
  • Time per phase (fetch, solve part1, submit part1, solve part2, submit part2)
  • Number of test iterations required
  • Number of submission attempts
  • Compilation time

Post-Completion Actions

After both parts completed successfully:

  • Generate solution summary
  • Run cargo fmt to format code
  • Run cargo clippy to check for issues
  • Optionally commit to git with message: "Solve Day {day} - {puzzle_title}"
  • Update calendar status file

Failure Recovery

If workflow fails mid-execution:

  • Save current state to state file
  • Next invocation should resume from last successful step
  • Don't re-fetch puzzle if already downloaded
  • Don't re-solve part 1 if already accepted

Source

git clone https://github.com/magnusrodseth/aoc-2025/blob/main/.claude/skills/aoc-orchestrator/SKILL.mdView on GitHub

Overview

The AOC Orchestrator is the central coordinator for the automated Advent of Code workflow. It orchestrates puzzle fetching, TDD-based solving, and submission for daily AoC challenges, while managing the overall workflow state. Use it to run the full end-to-end solving pipeline or to trigger solving for a specific day on request.

How This Skill Works

The orchestrator sequentially invokes specialized skills for puzzle fetching, TDD-based solving (Part 1 and Part 2), and submission handling, all while performing pre-flight checks to avoid re-solving completed days. It maintains state in state/day{day}.json and logs actions to logs/day{day}.log, with error handling and retries as defined in the workflow.

When to Use It

  • Automatically triggered by cron/launchd on puzzle unlock days (December 1-12, 2025)
  • Manually invoked for testing or re-running a specific day
  • Used when you want to execute the full end-to-end workflow
  • When debugging failures in puzzle fetch, TDD solving, or submission
  • For CI-like scenarios to validate the complete AoC solving pipeline

Quick Start

  1. Step 1: Ensure the environment is ready and the session cookie is configured
  2. Step 2: Trigger the orchestrator to solve a target day (e.g., Day 5) and monitor progress
  3. Step 3: Check logs at logs/day{day}.log and verify state/day{day}.json for completion

Best Practices

  • Always perform the pre-flight check to ensure the day is not already solved before proceeding
  • Configure and verify the session cookie before running the orchestrator
  • Run the full end-to-end flow in a controlled environment before production use
  • Monitor logs at logs/day{day}.log and verify state updates in state/day{day}.json
  • Implement robust error handling with exponential backoff and retry policies

Example Use Cases

  • Trigger automatic orchestration for Day 1 on puzzle unlock to fetch, solve, and submit part 1 and 2
  • Manually test Day 3 workflow to confirm the end-to-end pipeline without affecting other days
  • Run end-to-end solving for Day 5 after configuring required secrets and network access
  • Re-run Day 2 after a failed submission to verify fixes and re-submit automatically
  • Use in CI to validate the complete AoC solving pipeline across multiple days with logs and state checks

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers