Meta-Harness Skill: chess-puzzle-v0
You are improving a harness for chess-puzzle-v0, a multi-turn chess tactics
task built from Lichess/chess-puzzles.
Run ONE iteration of harness improvement. The outer meta-harness loop evaluates
your candidate harnesses; you do not run benchmarks yourself, do not write
outside the requested candidate harness files, and do not delegate the work.
Critical Constraints
- Write complete candidate
harness.py files only.
- Each candidate must define:
def propose_action(board: str) -> str: ...
def is_legal_action(board: str, action: str) -> bool: ...
- Optional harness surface:
SYSTEM_PROMPT = "..."
USER_PROMPT = "..."
FORMAT_RETRY_BUDGET = 1
ILLEGAL_MOVE_RETRY_BUDGET = 1
MAX_TURNS = 9
def format_observation(observation: str, **kwargs) -> str: ...
def parse_action(response: str) -> str: ...
USER_PROMPT may contain {observation}. The runner fills it.
- Each candidate should test exactly one meaningful mechanism, not a bundle of
unrelated prompt/parser/retry changes.
- Generated code must be safe under
autoharness_chess_puzzle.harness.load_harness.
- Allowed imports are only
__future__, collections, itertools, math,
random, re, and statistics.
- No shell commands, no file I/O, no network, no subprocesses, no dynamic import,
no
eval, and no exec.
Anti-Cheating Rules
The harness is a communication and validation layer. It is not allowed to solve
the puzzle.
Hard bans:
- Do not import
chess, use a chess engine, use tablebases, call Stockfish, or
implement tactical search.
- Do not implement minimax, mate search, capture/check ranking, piece-value
evaluation, move ordering, or any chess policy that chooses moves.
- Do not hardcode puzzle ids, FENs, solution lines, move sequences, ratings,
themes, URLs, dataset row positions, or exact validation examples.
- Do not infer hidden answers from metadata, file paths, split names, hashes, or
other dataset-specific artifacts.
- Do not convert a legal wrong model move into another move. A legal wrong move
is a true model failure and must remain terminal.
propose_action() must not be the primary policy. Prefer returning "".
Permitted behavior:
- Improve how visible information is presented to the model.
- Parse the model response more robustly.
- Validate legality only against the legal moves visibly listed in the
observation.
- Retry malformed or illegal moves with small, explicit verifier nudges.
Task Context
Each puzzle row contains a Lichess puzzle line. The environment applies the first
move in Moves as the trigger move before the model acts. The hidden solution is
the remaining line, Moves[1:].
At each solver turn the model sees only visible state:
- side to move
- current FEN
- ASCII board
- previous accepted solver moves
- latest opponent reply, if any
- legal moves as visible UCI/SAN rows such as
- [e2e4] SAN=e4
- verifier feedback after malformed or illegal responses
The model must emit exactly one solver move. If that move is correct, the
environment applies it. If the hidden line then contains an opponent reply, the
environment applies that reply and returns a tool/verifier response asking for
the next solver move. If the solver move is legal but not the hidden puzzle move,
the puzzle fails immediately.
There is no draw. Solved puzzles score 1; all failures score 0.
The assistant-generated token budget is 8129 total tokens per rollout by
default. Tool responses, observations, and verifier nudges are not part of this
assistant-token budget.
Harness Contract
SYSTEM_PROMPT and USER_PROMPT define the exact policy prompt used by both
Meta-Harness evaluation and GRPO/RSFT rollout.
format_observation(observation, **kwargs) may transform only the visible
observation string. Current keyword arguments include:
turn_count: number of accepted solver moves so far
side_to_move: "white" or "black"
last_opponent_move: latest opponent UCI reply, or None
max_turns: effective assistant policy-call cap for the rollout
parse_action(response) should return one UCI move such as e2e4, or a
non-UCI sentinel such as __no_move__ / __ambiguous_multiple_moves__. It may
normalize obvious formatting variants such as <move>e2e4</move>, [e2e4],
or a single bare UCI token. Reject multiple distinct moves as ambiguous.
is_legal_action(board, action) receives the visible observation string and the
parsed action. It may only check membership in the visible legal move list. It
must not reconstruct the board or search for good moves.
FORMAT_RETRY_BUDGET and ILLEGAL_MOVE_RETRY_BUDGET are small nonnegative
integers. The runner clamps each retry budget to a maximum of 10. Retries are
for malformed or illegal actions only. Legal wrong moves are not retried.
MAX_TURNS is an optional positive integer controlling the maximum number of
assistant policy calls in one puzzle rollout, including retries. The base
harness default is 9, resolved from the largest solution continuation length in
the current train/test/MH validation splits. The runner clamps generated
harness values to at most 18, exactly twice that base default. Increasing this
cap can let the model spend more retry/continuation calls, but it must not be
used to hide answer-specific logic or bypass model choice.
Useful Mechanism Axes
Focus on harness mechanisms that can help the model use visible state without
embedding chess search.
- Prompt architecture: final-only instruction, exact XML move format, no
explanation, side-to-move reminders, one-move-at-a-time framing.
- Observation formatting: compact visible board/FEN/legal move presentation,
clearer section ordering, accepted-move history, latest opponent reply, and
legal move aliases already present in the observation.
- Parser robustness: last valid
<move>...</move>, bracketed UCI, bare UCI,
promotion suffix case normalization, ambiguity rejection, and safe sentinels.
- Retry feedback: short verifier messages for malformed or illegal output,
preserving the current board and visible legal moves.
- History compaction: keep prior accepted moves and opponent replies visible in
a concise way so long puzzle lines do not drown out the current legal move set.
- Edge-case handling: promotions, castling notation only when a visible UCI/SAN
alias supports it, whitespace, Markdown fences, and repeated move mentions.
Weak mechanisms:
- Changing only punctuation, capitalization, or one adjective.
- Increasing retry budgets without changing what feedback says.
- Adding examples that look like dataset rows.
- Adding chess heuristics, even if they seem harmless.
Files To Read Before Proposing
Use the run directory artifacts to understand previous failures and accepted
harness behavior:
logs/accepted_harness.txt
harnesses/<accepted>/harness.py
logs/frontier_val.json
logs/evolution_summary.jsonl
- latest per-candidate comparison or proposal report, if present
- latest
*_policy_trace.jsonl, *_trajectories.jsonl, or validation JSON
artifacts, if present
Workflow
- Identify the current accepted harness and read it.
- Inspect recent failed and successful trajectories. Separate failures caused
by malformed output, illegal output, legal wrong moves, token budget, and
parser ambiguity.
- Choose one concrete mechanism likely to improve solved rate or reduce
avoidable malformed/illegal failures.
- Write candidate harnesses with minimal, auditable changes.
- Self-critique each candidate against the anti-cheating rules and the schema
contract before finishing.
Candidate Skeleton
import re
SYSTEM_PROMPT = """You solve chess tactics one move at a time.
Use only the visible board position and legal moves. Return exactly one UCI move
inside <move></move> tags."""
USER_PROMPT = """Solve the current chess puzzle position.
{observation}
Return exactly one move as <move>uci</move> and no explanation."""
FORMAT_RETRY_BUDGET = 1
ILLEGAL_MOVE_RETRY_BUDGET = 1
MAX_TURNS = 9
def propose_action(board: str) -> str:
return ""
def is_legal_action(board: str, action: str) -> bool:
moves = set(m.group(1).lower() for m in re.finditer(
r"\[\s*([a-h][1-8][a-h][1-8][qrbn]?)\s*\]", str(board), re.I
))
action = str(action or "").strip().lower()
return bool(re.fullmatch(r"[a-h][1-8][a-h][1-8][qrbn]?", action)) and action in moves
1---2name: meta-harness-chess-puzzle3description: Evolve prompt/parser/observation/retry harnesses for chess-puzzle-v0 without solving chess inside the harness.4---56# Meta-Harness Skill: chess-puzzle-v078You are improving a harness for `chess-puzzle-v0`, a multi-turn chess tactics9task built from `Lichess/chess-puzzles`.1011Run ONE iteration of harness improvement. The outer meta-harness loop evaluates12your candidate harnesses; you do not run benchmarks yourself, do not write13outside the requested candidate harness files, and do not delegate the work.1415## Critical Constraints1617- Write complete candidate `harness.py` files only.18- Each candidate must define:1920```python21def propose_action(board: str) -> str: ...22def is_legal_action(board: str, action: str) -> bool: ...23```2425- Optional harness surface:2627```python28SYSTEM_PROMPT = "..."29USER_PROMPT = "..."30FORMAT_RETRY_BUDGET = 131ILLEGAL_MOVE_RETRY_BUDGET = 132MAX_TURNS = 93334def format_observation(observation: str, **kwargs) -> str: ...35def parse_action(response: str) -> str: ...36```3738- `USER_PROMPT` may contain `{observation}`. The runner fills it.39- Each candidate should test exactly one meaningful mechanism, not a bundle of40 unrelated prompt/parser/retry changes.41- Generated code must be safe under42 `autoharness_chess_puzzle.harness.load_harness`.43- Allowed imports are only `__future__`, `collections`, `itertools`, `math`,44 `random`, `re`, and `statistics`.45- No shell commands, no file I/O, no network, no subprocesses, no dynamic import,46 no `eval`, and no `exec`.4748## Anti-Cheating Rules4950The harness is a communication and validation layer. It is not allowed to solve51the puzzle.5253Hard bans:5455- Do not import `chess`, use a chess engine, use tablebases, call Stockfish, or56 implement tactical search.57- Do not implement minimax, mate search, capture/check ranking, piece-value58 evaluation, move ordering, or any chess policy that chooses moves.59- Do not hardcode puzzle ids, FENs, solution lines, move sequences, ratings,60 themes, URLs, dataset row positions, or exact validation examples.61- Do not infer hidden answers from metadata, file paths, split names, hashes, or62 other dataset-specific artifacts.63- Do not convert a legal wrong model move into another move. A legal wrong move64 is a true model failure and must remain terminal.65- `propose_action()` must not be the primary policy. Prefer returning `""`.6667Permitted behavior:6869- Improve how visible information is presented to the model.70- Parse the model response more robustly.71- Validate legality only against the legal moves visibly listed in the72 observation.73- Retry malformed or illegal moves with small, explicit verifier nudges.7475## Task Context7677Each puzzle row contains a Lichess puzzle line. The environment applies the first78move in `Moves` as the trigger move before the model acts. The hidden solution is79the remaining line, `Moves[1:]`.8081At each solver turn the model sees only visible state:8283- side to move84- current FEN85- ASCII board86- previous accepted solver moves87- latest opponent reply, if any88- legal moves as visible UCI/SAN rows such as `- [e2e4] SAN=e4`89- verifier feedback after malformed or illegal responses9091The model must emit exactly one solver move. If that move is correct, the92environment applies it. If the hidden line then contains an opponent reply, the93environment applies that reply and returns a tool/verifier response asking for94the next solver move. If the solver move is legal but not the hidden puzzle move,95the puzzle fails immediately.9697There is no draw. Solved puzzles score 1; all failures score 0.9899The assistant-generated token budget is 8129 total tokens per rollout by100default. Tool responses, observations, and verifier nudges are not part of this101assistant-token budget.102103## Harness Contract104105`SYSTEM_PROMPT` and `USER_PROMPT` define the exact policy prompt used by both106Meta-Harness evaluation and GRPO/RSFT rollout.107108`format_observation(observation, **kwargs)` may transform only the visible109observation string. Current keyword arguments include:110111- `turn_count`: number of accepted solver moves so far112- `side_to_move`: `"white"` or `"black"`113- `last_opponent_move`: latest opponent UCI reply, or `None`114- `max_turns`: effective assistant policy-call cap for the rollout115116`parse_action(response)` should return one UCI move such as `e2e4`, or a117non-UCI sentinel such as `__no_move__` / `__ambiguous_multiple_moves__`. It may118normalize obvious formatting variants such as `<move>e2e4</move>`, `[e2e4]`,119or a single bare UCI token. Reject multiple distinct moves as ambiguous.120121`is_legal_action(board, action)` receives the visible observation string and the122parsed action. It may only check membership in the visible legal move list. It123must not reconstruct the board or search for good moves.124125`FORMAT_RETRY_BUDGET` and `ILLEGAL_MOVE_RETRY_BUDGET` are small nonnegative126integers. The runner clamps each retry budget to a maximum of 10. Retries are127for malformed or illegal actions only. Legal wrong moves are not retried.128129`MAX_TURNS` is an optional positive integer controlling the maximum number of130assistant policy calls in one puzzle rollout, including retries. The base131harness default is 9, resolved from the largest solution continuation length in132the current train/test/MH validation splits. The runner clamps generated133harness values to at most 18, exactly twice that base default. Increasing this134cap can let the model spend more retry/continuation calls, but it must not be135used to hide answer-specific logic or bypass model choice.136137## Useful Mechanism Axes138139Focus on harness mechanisms that can help the model use visible state without140embedding chess search.141142- Prompt architecture: final-only instruction, exact XML move format, no143 explanation, side-to-move reminders, one-move-at-a-time framing.144- Observation formatting: compact visible board/FEN/legal move presentation,145 clearer section ordering, accepted-move history, latest opponent reply, and146 legal move aliases already present in the observation.147- Parser robustness: last valid `<move>...</move>`, bracketed UCI, bare UCI,148 promotion suffix case normalization, ambiguity rejection, and safe sentinels.149- Retry feedback: short verifier messages for malformed or illegal output,150 preserving the current board and visible legal moves.151- History compaction: keep prior accepted moves and opponent replies visible in152 a concise way so long puzzle lines do not drown out the current legal move set.153- Edge-case handling: promotions, castling notation only when a visible UCI/SAN154 alias supports it, whitespace, Markdown fences, and repeated move mentions.155156Weak mechanisms:157158- Changing only punctuation, capitalization, or one adjective.159- Increasing retry budgets without changing what feedback says.160- Adding examples that look like dataset rows.161- Adding chess heuristics, even if they seem harmless.162163## Files To Read Before Proposing164165Use the run directory artifacts to understand previous failures and accepted166harness behavior:167168- `logs/accepted_harness.txt`169- `harnesses/<accepted>/harness.py`170- `logs/frontier_val.json`171- `logs/evolution_summary.jsonl`172- latest per-candidate comparison or proposal report, if present173- latest `*_policy_trace.jsonl`, `*_trajectories.jsonl`, or validation JSON174 artifacts, if present175176## Workflow1771781. Identify the current accepted harness and read it.1792. Inspect recent failed and successful trajectories. Separate failures caused180 by malformed output, illegal output, legal wrong moves, token budget, and181 parser ambiguity.1823. Choose one concrete mechanism likely to improve solved rate or reduce183 avoidable malformed/illegal failures.1844. Write candidate harnesses with minimal, auditable changes.1855. Self-critique each candidate against the anti-cheating rules and the schema186 contract before finishing.187188## Candidate Skeleton189190```python191import re192193SYSTEM_PROMPT = """You solve chess tactics one move at a time.194Use only the visible board position and legal moves. Return exactly one UCI move195inside <move></move> tags."""196197USER_PROMPT = """Solve the current chess puzzle position.198199{observation}200201Return exactly one move as <move>uci</move> and no explanation."""202203FORMAT_RETRY_BUDGET = 1204ILLEGAL_MOVE_RETRY_BUDGET = 1205MAX_TURNS = 9206207208def propose_action(board: str) -> str:209 return ""210211212def is_legal_action(board: str, action: str) -> bool:213 moves = set(m.group(1).lower() for m in re.finditer(214 r"\[\s*([a-h][1-8][a-h][1-8][qrbn]?)\s*\]", str(board), re.I215 ))216 action = str(action or "").strip().lower()217 return bool(re.fullmatch(r"[a-h][1-8][a-h][1-8][qrbn]?", action)) and action in moves218```