Skip to content
Back to skills

Chess

ASecurity

Run or record a Chinese chess (象棋, Xiangqi) match between two models. Use for `/chess <red-model> vs <black-model>` and requests to set up a San Session Group showmatch, adjust its board or clean spectator view, or save game checkpoints. Not for Western chess or standalone position analysis.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
ai-agentspythonrustgo

Works with

  • terminal
  • cli

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add yanmxa/skills --skill chess --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Chess?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Chess
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yanmxa-chess/badge)](https://www.skillsdirectory.com/skills/yanmxa-chess)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: chess
description: Run or record a Chinese chess (象棋, Xiangqi) match between two models. Use for `/chess <red-model> vs <black-model>` and requests to set up a San Session Group showmatch, adjust its board or clean spectator view, or save game checkpoints. Not for Western chess or standalone position analysis.
argument-hint: "<red-model> vs <black-model>"
---

# Chess (Xiangqi)

## Usage

```text
/chess GPT-6.2-Sol vs GPT-6.1-Sol
/chess openai/gpt-6.2-sol vs openai/gpt-6.1-sol
/chess 6.1 Sol xhigh 为红方,6.2 Sol xhigh 为黑方
```

The model left of `vs` plays Red and moves first; the model right of `vs` plays Black. Resolve display names through San's connected model catalog; a qualified `provider/model` disambiguates. If either side is missing or ambiguous, ask for that side only. The referee defaults to Red's model as a separate session unless explicitly specified. A complete matchup requests a new, uncapped game: prepare and start after both models pass preflight, then continue until an engine result or a genuinely obvious draw confirmed by the real referee. Resume requests have the same uncapped default. Respect explicit demo, capped, setup-only or dry-run scope; the user can stop at any time.

Use three independent San sessions. The red and black sessions choose moves and talk only to the referee through `SendMessage`; the referee alone operates the browser board. The board rules decide legality and whether there is a formal result. An early demo stop is not a draw or win.

## Set up

Requires San with Session Groups, Python 3.8+ on a POSIX host, tmux, and Ego Lite (`ego-browser`). A dry run only describes the workflow; it does not start services or sessions.

1. Resolve each model by provider, model ID, and auth method through San's connected catalog. A `provider/model` can still exist under more than one auth method: use an explicitly requested route, prefer a shared connected route when unambiguous, or ask. Use a standard 32-piece start unless this is a short relay demo. Verify the effective reasoning effort in each session and record it in `run.json`. If the installed San cannot set an explicitly requested effort without writing global preferences, report the blocker and ask before using a different effort; do not use `/think` as a session-only override on versions where it persists globally. For a serious head-to-head, offer a second game with colors swapped; one game is not a model benchmark.
2. Put the run in a new durable directory, e.g. `~/Documents/San/Xiangqi/<date>-<match>`. Use the scripts relative to this `SKILL.md`. Example (model IDs are examples, not implicit defaults):

   ```sh
   python3 "$SKILL/scripts/match.py" prepare "$RUN" \
     --red openai/gpt-6.2-sol --red-auth subscription \
     --black openai/gpt-6.1-sol --black-auth subscription --setup standard
   python3 "$SKILL/scripts/match.py" serve "$RUN"
   python3 "$SKILL/scripts/match.py" tmux "$RUN"
   ```

   Run `serve` in a managed background service; it listens only on localhost. Probe the actual board URL in `run.json`. A `--referee provider/model` override is optional. The launcher keeps model settings in three new working directories; do not change global provider defaults. It uses the tmux session **`chess`**: reuse it if present, create it only if absent (unless the user explicitly supplies `--session`). Each run gets a short unique window/group such as `xq-a1b2c3d4`; dates and model names belong in the durable directory and `run.json`, not the visible session/group name. Other windows are preserved. Re-running `tmux` for the same run reuses its verified role panes, never starts duplicate model sessions or replaces a foreign window.
3. In each of the three ready TUI panes, join the unique same group, using `run.json`'s group and the respective role: `/group join <group> --as referee`, `--as red`, `--as black`. Trust only the exact isolated folders created for this match after checking any prompt. Use `/group members` to check membership and `/group hold off` before starting; do not dump the full `/group` help into all three panes. Send each pane only its setup from [roles.md](references/roles.md), without repeating the whole skill or operator checklist; verify all three answer ready. An actual short inference is required: a model name can appear in a status bar even when the account rejects calls. Do not silently replace a missing model or start with a failed preflight.
4. Use Ego Lite (`ego-browser skill` for the installed guide) to open the exact `board_url` in a named match TaskSpace; keep its ID. Do not reload a board in play. Verify the board with `board.py --run "$RUN" --space "$SPACE" state`, then use `publish` for the spectator page and `mark opening` for the opening screenshot. In a separate **uncontrolled** user tab/window, open `watch_url` for the clean recording feed. It stays in sync automatically; it does not take over the referee browser. Ego Lite's own agent-control bubble is browser UI, not something the web page can hide. The referee action uses the same UI buttons without native pointer labels.

## Terminal presentation

- Referee spans the top **35%**; Red and Black are equal-width below. Keep subtle dividers, no duplicate border labels, and no tmux status bar.
- Follow the actual attached terminal with `window-size latest`. Detached startup dimensions are only a fallback. Never force `window-size manual` or widen the tmux window beyond the client to make logs fit: that crops the right-hand player.
- Once attached, compare `tmux list-clients` dimensions with the match window, and inspect pane widths. Both lower panes should differ by at most one column. To repair only the layout, without recreating sessions, changing group membership, or touching the board:
  ```sh
  python3 "$SKILL/scripts/match.py" layout "$RUN"
  ```
  This also works with older runs whose window is named `match`. If the terminal is still too narrow, suggest enlarging the actual terminal; do not fake extra columns.
- Diagnose the surface shown in the user's screenshot first: terminal pane clipping is not a reason to redesign or reload the browser board. A skill/interface update is not authorization to start or resume play.
- On requested cleanup, close only this run's board/spectator tabs, managed server and role panes. Preserve archives and unrelated windows; do not kill the shared `chess` session while it contains other runs or user windows.

## Run the match

- Load [roles.md](references/roles.md) for role instructions, `PLAY`/`MOVE` formats and the resume/finish procedure. Start only when the user requests play and both actual models passed preflight. A skill build, visual redesign, or spectator query is not itself a start command.
- Put step number, side and move in the visible subjects. Example: `第 8 步 · 黑方行棋 · 上一步 h0→h6` and `第 8 步 · 黑方 · 馬 h9→g7`. The terminal may show only this title. The body carries the exact FEN and legal coordinates or the selected move and one brief Chinese explanation. Do not substitute public claims about a turn for model output or expose hidden reasoning.
- Validate sender, live ply, side and legal list against the board; reject stale, duplicate or illegal moves. If `state` shows `ledger_status` other than `synced`, stop requests and inspect recovery below. The referee does not select a move. From the accepted move's returned state, dispatch one request to the other player unless an engine terminal result, a confirmed obvious draw under the criteria below, or an explicit stop/cap ends play. Coordinates are `a0` at Red's bottom left.
- There is no automatic 20-ply pause, footage quota, or periodic user-confirmation requirement. For explicitly requested demos, honor any stated cap; if a demo needs a cap, agree on it before play rather than silently imposing one. A checkpoint alone does not interrupt an uncapped match.
- An obvious draw requires the real referee to confirm objective grounds from the verified position and history (for example, neither side has any legal route to win, including by Xiangqi stalemate, or a demonstrably locked position with no possible progress). Mere material imbalance, low material, a near-even evaluation, or a short repetition is insufficient; if uncertain, continue. If the engine still says `in-progress`, report `referee-assessed obvious draw (engine: in-progress)` with those grounds, never a formal engine draw, and do not alter the engine result or ledger to manufacture one.

## Record key points and finish

The bridge appends each verified move (time, side, move, FEN, public note, outcome) to `events.jsonl` in the run. Do not record acknowledgments, rejected duplicates, or hidden reasoning as moves. In addition, record a small set of human-useful points: opening, a visible tactical turn (first capture/check or meaningful exchange), pause or model issue, and final verdict. Note the step, what changed, and whether it is a referee assessment or engine result. Use `mark <label>` on a stable ply for a clean screenshot; don't screenshot every move. Preserve existing archives and make a second one after a resumed finish.

For a requested stop, explicit cap, or confirmed referee-assessed obvious draw, prevent future moves first (`touch "$RUN/paused"` and use referee `/group hold on`). Let any already accepted click settle; verify the actual displayed ply, then ask the real referee to evaluate without making or requesting another move. Use `archive <label>` to save the current image and position with complete move list. Include a short `result.md` in the run only as the match deliverable: roles, last accepted move, key moments, and either the actual engine result, an explicitly labeled referee-assessed obvious draw with objective grounds and `engine: in-progress`, or `已暂停,未判胜负` (`演示结束,未判胜负` for a demo). A later user-authorized resume defaults to uncapped play, must recheck the saved board and handle at most one still-valid pending move; don't overwrite the earlier snapshot. See [roles.md](references/roles.md).

## Recover a board

After an accidental reload or a closed tab, keep the run paused (`touch "$RUN/paused"`, referee `/group hold on`). Keep the original run directory, restart its `serve` if needed, and reopen the exact `board_url` from `run.json` in Ego Lite. Use that TaskSpace ID:

```sh
python3 "$SKILL/scripts/board.py" --run "$RUN" --space "$SPACE" state
python3 "$SKILL/scripts/board.py" --run "$RUN" --space "$SPACE" restore
```

If an attempted click has an uncertain result, pause and run `state` **before reopening or reloading**. If it reports `pending_ply`, run `restore` on the same live board. It records the pending move only if the full move history and resulting position match the saved intent; it does not click or dispatch another move. If the intent cannot be verified, leave the run paused and report the blockage. Do not reset, retry the click, or edit the journal to proceed. Only `type: "move"` entries in `events.jsonl` count as accepted moves.

When there is no pending intent, `restore` replays only accepted moves from the original start, checks each FEN and result, and republishes the spectator view. It preserves notes and repetition history, does not duplicate entries, and neither sends `PLAY` nor unpauses the match. An unrecorded live move, different history, or damaged ledger is not overwritten. Do not load only the last FEN. Recovery requires compatible board assets and does not modify earlier archives. Resume dispatch only on user request, following [roles.md](references/roles.md).

Return the run location, screenshots, ledger and result. Distinguish actual end-to-end play, a fixture/UI rehearsal, and any blocked phase. The bundled board uses a simplified local rules profile: threefold repetition is a draw and the engine does not assign fault for perpetual check or chase. Report the actual local engine result, not tournament adjudication. No public chess account or external match server is required.

Files in this skill

  • SKILL.md11.8 KB
  • assets/board/LICENSE1.3 KB
  • assets/board/app.js9.3 KB
  • assets/board/index.html4.9 KB
  • assets/board/view.css9.3 KB
  • assets/board/watch.html1.9 KB
  • assets/board/wood-grain.svg498 B
  • assets/board/xiangqi.js42.2 KB
  • evals/evals.json2.5 KB
  • references/roles.md6.6 KB
  • scripts/board.py20.3 KB
  • scripts/match.py7.1 KB
  • scripts/test_board.py8.9 KB
  • scripts/test_match.py8.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.