Repository navigation
Conversation
New game offers the user's default agent by name when it can answer on its own. Each of its turns runs the harness's one-shot mode with the position, the moves so far and the legal moves, in an empty folder of its own, and plays the last legal move the answer names. An answer without one is asked about once more; after that, or when the agent fails or takes too long, the reason is shown and the game waits for Ask again, undo or a new game. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
[Medium impact] The change reaches the chess-game workflow and calls the user's selected local agent. Fix the wrong-move cases and the unrequested agent retry before merging. FindingsSummaryAdds the default Omarchy agent as a third opponent.
Acknowledged scope:
|
| const auto match = found.next(); | ||
| for (auto candidate : legal) if (coordinates(candidate) == match.captured(1).toLower() && match.capturedStart() > best) { best = match.capturedStart(); *move = candidate; } | ||
| } | ||
| if (best >= 0) return true; |
There was a problem hiding this comment.
| const QRegularExpression written("(?<![A-Za-z0-9])" + QRegularExpression::escape(san) + "(?![A-Za-z0-9=])"); | ||
| for (auto found = written.globalMatch(answer); found.hasNext();) { | ||
| const auto match = found.next(); | ||
| if (match.capturedStart() > best) { best = match.capturedStart(); *move = candidate; } |
There was a problem hiding this comment.
When both castles are legal, answering O-O-O selects O-O. The shorter pattern matches the start of O-O-O because its boundary allows -. legal() lists the short castle first, and the strict position comparison prevents the full match from replacing it. Match the whole castle name and add a test with both castles legal.
| if (m_agent) { | ||
| // The agent answers in its own time, in a process of its own; its move or its failure comes back as a signal. | ||
| m_agentPlayer.ask(position(),m_notation); | ||
| emit changed(); |
There was a problem hiding this comment.
scheduleComputer() can ask a stalled agent again without the player choosing “Ask again.” Each applied move leaves a timer behind. If the player moves within 420 ms of the previous agent move, two timers can remain: the first starts the next request, and the second restarts it if it fails quickly.
That restart leaves m_agentStalled set, so a successful answer does not clear the stalled UI. Stop here when m_agentStalled is true, or discard timers from older turns.
New game gains a third opponent: the user's default Omarchy agent, offered by name ("Play against Claude Code") when one is chosen and can answer on its own.
How it works
~/.config/omarchy/defaults/agent, whereomarchy default agentwrites it, each time the dialog opens.claude -p,codex exec,opencode runand so on. Fifteen harnesses are mapped (claude, codex, opencode, kilo, pi, omp, grok, crush, copilot, cursor-agent, agy, qwen, kimi, amp, ori). The others aren't offered.e7e5) or as the game writes it (Nf6).Testing
bin/testpasses. New tests cover the command table, the prompt and answer parsing, and a full game loop against scripted stand-ins: a good answer, nonsense twice, a failing exit, a timeout, cancelling mid-thought, and save/restore. The window test checks the dialog offers the agent.One live check:
claude -pwith the app's prompt answerede7e5in under four seconds. Only Claude Code was tried live; the other fourteen commands come from each harness's documented one-shot flag and are untested here.Not in this PR
omarchy agent ask, so apps don't each keep a copy.🤖 Generated with Claude Code