{"id":"59033504-2a37-455e-ad80-4dc839f5c3aa","entityType":"agent","slug":"clawhub-imcaptor-go-next-move","name":"go-next-move","canonicalUrl":"https://www.xpersona.co/agent/clawhub-imcaptor-go-next-move","canonicalPath":"/agent/clawhub-imcaptor-go-next-move","generatedAt":"2026-10-10T11:50:59.349Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":null},"description":"从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Skill: go-next-move Owner: imcaptor Summary: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Tags: go:0.0.7, katago:0.0.7, latest:0.1.2, weiqi:0.0.7 Version history: v0.1.2 | 2026-07-31T23:07:02.436Z | user Add opt-in host-agent recognition retry and candidate label capture for improving board recognition. v0.1.1 | 2026-07-31T02:18:05.892Z | user Impr","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s178hy5hbjg5ryc7pqsdnj05e984xz9f:go-next-move","sourceUrl":"https://clawhub.ai/imcaptor/go-next-move","homepage":"https://clawhub.ai/imcaptor/skills/go-next-move","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/imcaptor/go-next-move","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/imcaptor/skills/go-next-move","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":64,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Skill: go-next-move Owner: imcaptor Summary: "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":null},"stars":null,"forks":null,"downloads":1542,"packageName":null,"latestVersion":"0.1.2","tractionLabel":"1.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T08:58:28.095Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T08:58:28.120Z","lastCrawledAt":"2026-10-10T08:58:28.095Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T08:58:28.095Z","lastVerifiedAt":null,"highlights":[{"version":"0.1.2","createdAt":"2026-07-31T23:07:02.436Z","changelog":"Add opt-in host-agent recognition retry and candidate label capture for improving board recognition.","fileCount":20,"zipByteSize":42527},{"version":"0.1.1","createdAt":"2026-07-31T02:18:05.892Z","changelog":"Improve wood-board recognition for skewed and incomplete boards, muted black stones, and board-frame artifacts.","fileCount":19,"zipByteSize":38796},{"version":"0.1.0","createdAt":"2026-07-31T01:58:18.979Z","changelog":"Improve wood-board recognition for skewed and incomplete boards, muted black stones, and board-frame artifacts.","fileCount":19,"zipByteSize":38626},{"version":"0.0.16","createdAt":"2026-07-16T04:23:53.542Z","changelog":"Separate delivery adapters from the shared core; publish a minimal verified Skill bundle with allowlisted files and hardened build validation.","fileCount":19,"zipByteSize":36323},{"version":"0.0.15","createdAt":"2026-07-06T04:59:11.560Z","changelog":"Update board recognition logic from latest main","fileCount":50,"zipByteSize":214166},{"version":"0.0.14","createdAt":"2026-07-06T03:03:54.532Z","changelog":"Fix FastAPI multipart upload settings and preserve the Chinese ClawHub display name.","fileCount":45,"zipByteSize":207626},{"version":"0.0.13","createdAt":"2026-07-06T03:03:13.652Z","changelog":"Fix FastAPI multipart upload settings so Feishu/H5 analysis requests preserve side to move, strength level, and coordinate style.","fileCount":45,"zipByteSize":207803},{"version":"0.0.12","createdAt":"2026-07-01T06:46:18.280Z","changelog":"Localize the skill summary and opening documentation for Chinese Go users.","fileCount":16,"zipByteSize":51102}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s178hy5hbjg5ryc7pqsdnj05e984xz9f:go-next-move","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T11:50:59.344Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-imcaptor-go-next-move/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":null},"readme":"Skill: go-next-move\n\nOwner: imcaptor\n\nSummary: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\n\nTags: go:0.0.7, katago:0.0.7, latest:0.1.2, weiqi:0.0.7\n\nVersion history:\n\nv0.1.2 | 2026-07-31T23:07:02.436Z | user\n\nAdd opt-in host-agent recognition retry and candidate label capture for improving board recognition.\n\nv0.1.1 | 2026-07-31T02:18:05.892Z | user\n\nImprove wood-board recognition for skewed and incomplete boards, muted black stones, and board-frame artifacts.\n\nv0.1.0 | 2026-07-31T01:58:18.979Z | user\n\nImprove wood-board recognition for skewed and incomplete boards, muted black stones, and board-frame artifacts.\n\nv0.0.16 | 2026-07-16T04:23:53.542Z | user\n\nSeparate delivery adapters from the shared core; publish a minimal verified Skill bundle with allowlisted files and hardened build validation.\n\nv0.0.15 | 2026-07-06T04:59:11.560Z | user\n\nUpdate board recognition logic from latest main\n\nv0.0.14 | 2026-07-06T03:03:54.532Z | user\n\nFix FastAPI multipart upload settings and preserve the Chinese ClawHub display name.\n\nv0.0.13 | 2026-07-06T03:03:13.652Z | user\n\nFix FastAPI multipart upload settings so Feishu/H5 analysis requests preserve side to move, strength level, and coordinate style.\n\nv0.0.12 | 2026-07-01T06:46:18.280Z | user\n\nLocalize the skill summary and opening documentation for Chinese Go users.\n\nv0.0.11 | 2026-07-01T06:43:11.704Z | user\n\nUse a Chinese Clawhub display name while keeping English documentation linked from the Chinese README.\n\nv0.0.10 | 2026-07-01T06:35:50.063Z | user\n\nRemove deprecated webserver, tunnel, and link-token entrypoint; keep CLI skill and Feishu bot usage.\n\nv0.0.9 | 2026-06-15T10:36:25.155Z | user\n\n修正显示名；内容同 0.0.8（新增可选 HTTP 交互模式 + 隧道，改进白子识别）。\n\nv0.0.8 | 2026-06-15T10:35:04.383Z | user\n\n新增可选 HTTP 交互模式（常驻网页服务 + Cloudflare 隧道 + 一次性签发 5 小时 token 链接 + OpenClaw 宿主桥接模板），不影响原有 CLI/LLM 用法；改进暖光/竹制棋盘的白子识别。\n\nv0.0.7 | 2026-06-08T04:01:47.836Z | user\n\nAdd optional sequential A-S coordinates including I while preserving GTP as the default and keeping KataGo communication in standard GTP coordinates. User move input, recommendations, candidate moves, PVs, and explanations now consistently follow the selected coordinate style.\n\nv0.0.6 | 2026-06-04T00:50:24.189Z | user\n\nHighlight numbered move overlays with alternating ring colors\n\nv0.0.5 | 2026-06-03T01:52:46.716Z | user\n\nAdd no-capture move overlay continuation for numbered AI/user move history and follow-up recommendations.\n\nv0.0.4 | 2026-06-02T12:37:39.344Z | user\n\nAdd detailed move rationale and technical parameters including winrate, score lead, visits, PV, and candidate comparisons.\n\nv0.0.3 | 2026-06-02T09:08:21.711Z | user\n\nFix edge white stone recognition for partially clipped board-edge stones such as N1.\n\nv0.0.1 | 2026-06-02T08:15:12.776Z | user\n\nInitial release: image/ASCII Go board recognition, KataGo next-move analysis, strength levels, source-photo result overlay, and move rationale.\n\nArchive index:\n\nArchive v0.1.2: 20 files, 42527 bytes\n\nFiles: config/gtp_skill.cfg (366b), requirements.txt (47b), scripts/_vendor/go_next_move_core/__init__.py (326b), scripts/_vendor/go_next_move_core/analysis.py (49990b), scripts/_vendor/go_next_move_core/board_profiles/__init__.py (1000b), scripts/_vendor/go_next_move_core/board_profiles/common.py (3624b), scripts/_vendor/go_next_move_core/board_profiles/white_plastic_or_paper.py (4055b), scripts/_vendor/go_next_move_core/board_profiles/wood.py (3042b), scripts/_vendor/go_next_move_core/cli.py (8274b), scripts/_vendor/go_next_move_core/coordinates.py (568b), scripts/_vendor/go_next_move_core/katago_protocol.py (3328b), scripts/_vendor/go_next_move_core/katago.py (3721b), scripts/_vendor/go_next_move_core/recognition_labels.py (3898b), scripts/_vendor/go_next_move_core/recognition.py (32669b), scripts/_vendor/go_next_move_core/resources/__init__.py (60b), scripts/_vendor/go_next_move_core/resources/analysis.cfg (390b), scripts/next_move.py (818b), skill-card.md (2501b), SKILL.md (9961b), _meta.json (131b)\n\nFile v0.1.2:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\nversion: 0.1.2\nmetadata: {\"openclaw\":{\"requires\":{\"bins\":[\"python3\",\"katago\"]}}}\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## 安装与数据边界\n\n此 Skill 需要 Python 3.10 或更高版本。安装已锁定版本的 Python 依赖：\n\n```bash\npython3 -m pip install -r {baseDir}/requirements.txt\n```\n\n这个 Skill 只在本机运行：读取用户明确指定的棋盘图片或文本，启动本地 `katago` 子进程，并只向用户指定的结果路径、系统临时目录或本机识别标注目录写入文件。它不调用 H5、微信、飞书或其他远程 API，也不读取账号凭据或保存用户身份、完整分析历史。\n\n普通图片识别只使用本地 OpenCV。只有用户明确表示识别不准确时，才允许宿主智能体直接用自身视觉 LLM 复核原图；Skill 不得为此再调用 `codex exec` 或其他嵌套 LLM。复核产生的候选棋盘、原 OpenCV 棋盘和差异点会作为本地候选标注保存，默认目录为 `~/.go-next-move/recognition-labels`，可用 `GO_NEXT_MOVE_RECOGNITION_LABEL_DIR` 或 `--recognition-label-dir` 修改。候选标注不是人工确认的 ground truth。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n## 用户认为识别错误时的重试\n\n仅当用户明确指出识别结果与真实棋盘不符时，使用下面的纠错流程：\n\n1. 宿主智能体直接查看用户的原始棋盘图片，逐一复核 19×19 共 361 个交叉点。不要调用本地 Codex CLI，也不要让语言模型代替 KataGo 选择下一手。\n2. 生成严格的 19 行 `board_ascii`：每行 19 个字符，`X` 为黑子、`O` 为白子、`.` 为空点；从照片上边缘到下边缘排列，不得把待推荐落点写进棋盘。\n3. 将这 19 行写入系统临时文件，然后以原始图片为输入，通过 `--board-override-file` 传给脚本。脚本会严格校验数组、保留原图的棋盘几何、用修正棋盘调用 KataGo、生成修正后的原图结果，并保存本地候选标注。\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/original-board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --board-override-file /tmp/go-agent-board.txt \\\n  --source-result-image /tmp/go-agent-corrected-result.jpg\n```\n\n如需指定标注库目录，再加：\n\n```bash\n--recognition-label-dir /path/to/recognition-labels\n```\n\n返回 JSON 中的 `recognition_retry` 包含 `detector_board_ascii`、智能体提供的 `board_ascii`、`changed_points`、`label_id` 和 `label_path`。向用户展示修正后的结果图，并明确这是 LLM 候选标注；若图上棋子仍与实物不符，不要宣称修正成功，也不要采纳该次 KataGo 推荐。\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n- optional `recognition_retry` metadata when `--board-override-file` is used\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- In the Skill entry point, recognition retry uses the current host agent's visual LLM directly. Never spawn a nested Codex process for this path.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.1.2:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.1.2\",\n  \"publishedAt\": 1785539222436\n}\n\nFile v0.1.2:scripts/_vendor/go_next_move_core/resources/analysis.cfg\n\n# Project defaults for using KataGo's JSON analysis engine.\n# Load after KataGo's bundled analysis_example.cfg so these values override it.\n\n# The runner directs KataGo file logs to the system temp directory.\nlogAllRequests = false\nlogAllResponses = false\n\nmaxVisits = 400\nnumAnalysisThreads = 1\nnumSearchThreadsPerAnalysisThread = 8\nanalysisPVLen = 8\nreportAnalysisWinratesAs = SIDETOMOVE\n\nFile v0.1.2:skill-card.md\n\n## Description:\n\nAnalyzes Go/Weiqi board photos or 19x19 text boards with local KataGo and recommends the next move at beginner, intermediate, advanced, or all strength levels.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[imcaptor](https://clawhub.ai/user/imcaptor)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nGo players and agent developers use this skill to convert board photos or board_ascii text into level-adjusted KataGo next-move recommendations. It returns enough engine data and visual overlays for the user to review the recognized board and compare candidate moves.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill runs local Python/OpenCV code and starts a local KataGo subprocess.\n\nMitigation: Install and run it only in an environment where local Python, OpenCV, and KataGo execution is acceptable.\n\nRisk: Correction retries may save local copies of board photos and candidate labels in the recognition-label directory.\n\nMitigation: Avoid sensitive photos, set a controlled recognition-label directory, or delete the directory when retention is not desired.\n\nRisk: Incorrect board recognition can make the recommended move unreliable.\n\nMitigation: Compare the source overlay or result image with the physical board and correct the board before relying on the recommendation.\n\nRisk: Captures, ko/state ambiguity, or an unknown side to move can invalidate continuation analysis.\n\nMitigation: Ask for the side to move and re-shoot or reset the board after captures or ambiguous game-state changes.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/imcaptor/skills/go-next-move)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, JSON, files, guidance]\n\n**Output Format:** [Markdown guidance with shell commands plus JSON analysis results and optional image-file paths from the local analyzer]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires local python3 and katago; may write result images, overlays, temporary files, and local recognition-label bundles when correction retry is used.]\n\n## Skill Version(s):\n\n0.1.2 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v0.1.2:config/gtp_skill.cfg\n\n# Project defaults for using KataGo as a next-move advisor.\n# Load after KataGo's bundled gtp_example.cfg so these values override it.\n\nrules = chinese\n\nmaxVisits = 400\nnumSearchThreads = 8\nponderingEnabled = false\n\nlogDir = /tmp/go-next-move-katago-gtp-logs\nlogAllGTPCommunication = false\nlogSearchInfo = false\nlogSearchInfoForChosenMove = false\nlogToStderr = true\n\nFile v0.1.2:requirements.txt\n\nnumpy==2.2.6\nopencv-python-headless==4.10.0.84\n\nArchive v0.1.1: 19 files, 38796 bytes\n\nFiles: config/gtp_skill.cfg (366b), requirements.txt (47b), scripts/_vendor/go_next_move_core/__init__.py (326b), scripts/_vendor/go_next_move_core/analysis.py (49016b), scripts/_vendor/go_next_move_core/board_profiles/__init__.py (1000b), scripts/_vendor/go_next_move_core/board_profiles/common.py (3624b), scripts/_vendor/go_next_move_core/board_profiles/white_plastic_or_paper.py (4055b), scripts/_vendor/go_next_move_core/board_profiles/wood.py (3042b), scripts/_vendor/go_next_move_core/cli.py (4787b), scripts/_vendor/go_next_move_core/coordinates.py (568b), scripts/_vendor/go_next_move_core/katago_protocol.py (3328b), scripts/_vendor/go_next_move_core/katago.py (3721b), scripts/_vendor/go_next_move_core/recognition.py (32669b), scripts/_vendor/go_next_move_core/resources/__init__.py (60b), scripts/_vendor/go_next_move_core/resources/analysis.cfg (390b), scripts/next_move.py (818b), skill-card.md (2549b), SKILL.md (7726b), _meta.json (131b)\n\nFile v0.1.1:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\nversion: 0.1.1\nmetadata: {\"openclaw\":{\"requires\":{\"bins\":[\"python3\",\"katago\"]}}}\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## 安装与数据边界\n\n此 Skill 需要 Python 3.10 或更高版本。安装已锁定版本的 Python 依赖：\n\n```bash\npython3 -m pip install -r {baseDir}/requirements.txt\n```\n\n这个 Skill 只在本机运行：读取用户明确指定的棋盘图片或文本，启动本地 `katago` 子进程，并只向用户指定的结果路径或系统临时目录写入图片。它不调用 H5、微信、飞书或其他远程 API，不读取账号凭据，不保存用户身份、分析历史或反馈数据。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.1.1:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.1.1\",\n  \"publishedAt\": 1785464285892\n}\n\nFile v0.1.1:scripts/_vendor/go_next_move_core/resources/analysis.cfg\n\n# Project defaults for using KataGo's JSON analysis engine.\n# Load after KataGo's bundled analysis_example.cfg so these values override it.\n\n# The runner directs KataGo file logs to the system temp directory.\nlogAllRequests = false\nlogAllResponses = false\n\nmaxVisits = 400\nnumAnalysisThreads = 1\nnumSearchThreadsPerAnalysisThread = 8\nanalysisPVLen = 8\nreportAnalysisWinratesAs = SIDETOMOVE\n\nFile v0.1.1:skill-card.md\n\n## Description: <br>\nAnalyzes Go or Weiqi board photos or text board positions, then uses a local KataGo setup to recommend the next move at beginner, intermediate, or advanced strength. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[imcaptor](https://clawhub.ai/user/imcaptor) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and Go players use this skill to turn a board photo or a 19x19 text board into an auditable next-move recommendation, including candidate moves and analysis details. It is useful when the user wants a move calibrated to a requested playing-strength level rather than only KataGo's strongest move. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Board recognition errors or an incorrect side-to-move can make the recommended move unreliable. <br>\nMitigation: Review the generated source overlay or rendered board, confirm the side to move, and treat the recommendation as unreliable until the board is corrected when recognition looks wrong. <br>\nRisk: The skill runs local analysis and may create result images or temporary KataGo logs from user-provided board inputs. <br>\nMitigation: Use it only with intended local board images or text files, and review generated overlays and output paths before sharing or retaining results. <br>\nRisk: No-capture continuation overlays can become invalid when captures, ko, state ambiguity, or occupied overlay points are involved. <br>\nMitigation: Re-shoot or reset the board and analyze a fresh position when captures or ambiguous board state are present. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/imcaptor/skills/go-next-move) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, JSON, Files, Guidance] <br>\n**Output Format:** [Markdown guidance with shell commands, JSON analysis output, and optional generated image file paths] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Requires local Python 3 and KataGo binaries; may create result images and temporary KataGo logs.] <br>\n\n## Skill Version(s): <br>\n0.1.1 (source: server release evidence and SKILL.md frontmatter) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v0.1.1:config/gtp_skill.cfg\n\n# Project defaults for using KataGo as a next-move advisor.\n# Load after KataGo's bundled gtp_example.cfg so these values override it.\n\nrules = chinese\n\nmaxVisits = 400\nnumSearchThreads = 8\nponderingEnabled = false\n\nlogDir = /tmp/go-next-move-katago-gtp-logs\nlogAllGTPCommunication = false\nlogSearchInfo = false\nlogSearchInfoForChosenMove = false\nlogToStderr = true\n\nFile v0.1.1:requirements.txt\n\nnumpy==2.2.6\nopencv-python-headless==4.10.0.84\n\nArchive v0.1.0: 19 files, 38626 bytes\n\nFiles: config/gtp_skill.cfg (366b), requirements.txt (47b), scripts/_vendor/go_next_move_core/__init__.py (326b), scripts/_vendor/go_next_move_core/analysis.py (49016b), scripts/_vendor/go_next_move_core/board_profiles/__init__.py (1000b), scripts/_vendor/go_next_move_core/board_profiles/common.py (3624b), scripts/_vendor/go_next_move_core/board_profiles/white_plastic_or_paper.py (4055b), scripts/_vendor/go_next_move_core/board_profiles/wood.py (3042b), scripts/_vendor/go_next_move_core/cli.py (4787b), scripts/_vendor/go_next_move_core/coordinates.py (568b), scripts/_vendor/go_next_move_core/katago_protocol.py (3328b), scripts/_vendor/go_next_move_core/katago.py (3721b), scripts/_vendor/go_next_move_core/recognition.py (32669b), scripts/_vendor/go_next_move_core/resources/__init__.py (60b), scripts/_vendor/go_next_move_core/resources/analysis.cfg (390b), scripts/next_move.py (818b), skill-card.md (2165b), SKILL.md (7726b), _meta.json (131b)\n\nFile v0.1.0:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\nversion: 0.1.0\nmetadata: {\"openclaw\":{\"requires\":{\"bins\":[\"python3\",\"katago\"]}}}\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## 安装与数据边界\n\n此 Skill 需要 Python 3.10 或更高版本。安装已锁定版本的 Python 依赖：\n\n```bash\npython3 -m pip install -r {baseDir}/requirements.txt\n```\n\n这个 Skill 只在本机运行：读取用户明确指定的棋盘图片或文本，启动本地 `katago` 子进程，并只向用户指定的结果路径或系统临时目录写入图片。它不调用 H5、微信、飞书或其他远程 API，不读取账号凭据，不保存用户身份、分析历史或反馈数据。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.1.0\",\n  \"publishedAt\": 1785463098979\n}\n\nFile v0.1.0:scripts/_vendor/go_next_move_core/resources/analysis.cfg\n\n# Project defaults for using KataGo's JSON analysis engine.\n# Load after KataGo's bundled analysis_example.cfg so these values override it.\n\n# The runner directs KataGo file logs to the system temp directory.\nlogAllRequests = false\nlogAllResponses = false\n\nmaxVisits = 400\nnumAnalysisThreads = 1\nnumSearchThreadsPerAnalysisThread = 8\nanalysisPVLen = 8\nreportAnalysisWinratesAs = SIDETOMOVE\n\nFile v0.1.0:skill-card.md\n\n## Description: <br>\nAnalyzes a Go/Weiqi board photo or 19x19 text board with local KataGo and recommends the next move at beginner, intermediate, or advanced strength. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[imcaptor](https://clawhub.ai/user/imcaptor) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nGo players, coaches, and agents use this skill to turn a board photo or 19x19 ASCII position into an auditable next-move recommendation with candidate comparisons and overlay images. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Board photos or text positions may be sensitive, and generated overlays can be written to temporary or user-specified paths. <br>\nMitigation: Provide only intended board inputs and choose output paths deliberately when working with private games or sensitive images. <br>\nRisk: Recommendations depend on correct board recognition, the side to move, and a usable local KataGo setup. <br>\nMitigation: Verify the source overlay and side to move before trusting the recommendation; re-shoot or reset the board when captures, ko state, or recognition uncertainty make the position ambiguous. <br>\n\n\n## Reference(s): <br>\n- [Go Next Move Skill on ClawHub](https://clawhub.ai/imcaptor/skills/go-next-move) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [guidance, shell commands, configuration, JSON, files] <br>\n**Output Format:** [Markdown guidance with shell commands and JSON result data; optional board overlay image files.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Uses a local KataGo binary and may write recognition or recommendation overlays to user-specified paths or the system temporary directory.] <br>\n\n## Skill Version(s): <br>\n0.1.0 (source: frontmatter and server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v0.1.0:config/gtp_skill.cfg\n\n# Project defaults for using KataGo as a next-move advisor.\n# Load after KataGo's bundled gtp_example.cfg so these values override it.\n\nrules = chinese\n\nmaxVisits = 400\nnumSearchThreads = 8\nponderingEnabled = false\n\nlogDir = /tmp/go-next-move-katago-gtp-logs\nlogAllGTPCommunication = false\nlogSearchInfo = false\nlogSearchInfoForChosenMove = false\nlogToStderr = true\n\nFile v0.1.0:requirements.txt\n\nnumpy==2.2.6\nopencv-python-headless==4.10.0.84\n\nArchive v0.0.16: 19 files, 36323 bytes\n\nFiles: config/gtp_skill.cfg (366b), requirements.txt (47b), scripts/_vendor/go_next_move_core/__init__.py (326b), scripts/_vendor/go_next_move_core/analysis.py (49016b), scripts/_vendor/go_next_move_core/board_profiles/__init__.py (1000b), scripts/_vendor/go_next_move_core/board_profiles/common.py (3647b), scripts/_vendor/go_next_move_core/board_profiles/white_plastic_or_paper.py (4055b), scripts/_vendor/go_next_move_core/board_profiles/wood.py (2502b), scripts/_vendor/go_next_move_core/cli.py (4787b), scripts/_vendor/go_next_move_core/coordinates.py (568b), scripts/_vendor/go_next_move_core/katago_protocol.py (3328b), scripts/_vendor/go_next_move_core/katago.py (3721b), scripts/_vendor/go_next_move_core/recognition.py (23593b), scripts/_vendor/go_next_move_core/resources/__init__.py (60b), scripts/_vendor/go_next_move_core/resources/analysis.cfg (390b), scripts/next_move.py (818b), skill-card.md (2437b), SKILL.md (7726b), _meta.json (132b)\n\nFile v0.0.16:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\nversion: 0.1.0\nmetadata: {\"openclaw\":{\"requires\":{\"bins\":[\"python3\",\"katago\"]}}}\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## 安装与数据边界\n\n此 Skill 需要 Python 3.10 或更高版本。安装已锁定版本的 Python 依赖：\n\n```bash\npython3 -m pip install -r {baseDir}/requirements.txt\n```\n\n这个 Skill 只在本机运行：读取用户明确指定的棋盘图片或文本，启动本地 `katago` 子进程，并只向用户指定的结果路径或系统临时目录写入图片。它不调用 H5、微信、飞书或其他远程 API，不读取账号凭据，不保存用户身份、分析历史或反馈数据。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.0.16:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.0.16\",\n  \"publishedAt\": 1784175833542\n}\n\nFile v0.0.16:scripts/_vendor/go_next_move_core/resources/analysis.cfg\n\n# Project defaults for using KataGo's JSON analysis engine.\n# Load after KataGo's bundled analysis_example.cfg so these values override it.\n\n# The runner directs KataGo file logs to the system temp directory.\nlogAllRequests = false\nlogAllResponses = false\n\nmaxVisits = 400\nnumAnalysisThreads = 1\nnumSearchThreadsPerAnalysisThread = 8\nanalysisPVLen = 8\nreportAnalysisWinratesAs = SIDETOMOVE\n\nFile v0.0.16:skill-card.md\n\n## Description: <br>\nAnalyzes a Go/Weiqi board photo or text board, runs local KataGo analysis, and recommends the next move at beginner, intermediate, advanced, or all strength levels. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[imcaptor](https://clawhub.ai/user/imcaptor) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nGo players, reviewers, and agents assisting them use this skill to convert a photographed or ASCII 19x19 board into a KataGo-backed next-move recommendation with candidate comparisons, engine metrics, and recognition overlays. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill runs a local KataGo subprocess and reads or writes files selected for analysis and image output. <br>\nMitigation: Use explicit, non-sensitive board inputs and choose output paths carefully, especially in shared workspaces. <br>\nRisk: Photo recognition errors or an uncertain side to move can make the recommendation unreliable. <br>\nMitigation: Review the generated recognition overlay, provide the side to move, and treat recommendations as unreliable until the board state is corrected. <br>\nRisk: No-capture continuation overlays do not model captures, ko, or ambiguous state changes. <br>\nMitigation: Re-shoot or reset the board after captures or state ambiguity before requesting the next analysis. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/imcaptor/skills/go-next-move) <br>\n- [Publisher profile](https://clawhub.ai/user/imcaptor) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, JSON, shell commands, files, guidance] <br>\n**Output Format:** [Markdown response with a recommended move, KataGo metrics, candidate comparisons, JSON helper output, and optional generated image file paths.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May write recognition and recommendation images to user-selected paths or a system temporary directory.] <br>\n\n## Skill Version(s): <br>\n0.0.16 (source: server release metadata; artifact frontmatter reports 0.1.0) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v0.0.16:config/gtp_skill.cfg\n\n# Project defaults for using KataGo as a next-move advisor.\n# Load after KataGo's bundled gtp_example.cfg so these values override it.\n\nrules = chinese\n\nmaxVisits = 400\nnumSearchThreads = 8\nponderingEnabled = false\n\nlogDir = /tmp/go-next-move-katago-gtp-logs\nlogAllGTPCommunication = false\nlogSearchInfo = false\nlogSearchInfoForChosenMove = false\nlogToStderr = true\n\nFile v0.0.16:requirements.txt\n\nnumpy==2.2.6\nopencv-python-headless==4.10.0.84\n\nArchive v0.0.15: 50 files, 214166 bytes\n\nFiles: api/__init__.py (33b), api/app.py (29866b), api/requirements.txt (33b), config/index.ts (649b), CONTEXT.md (2031b), docs/h5-miniapp-issues.md (10322b), docs/h5-miniapp-plan.md (9638b), integrations/feishu/feishu_image_bot.py (41514b), integrations/feishu/README.md (6162b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), LOCAL_RUNTIME_NOTES.md (1384b), package-lock.json (479930b), package.json (1160b), playwright.config.ts (418b), project.config.json (292b), README.en.md (11133b), README.md (12980b), scripts/board_profiles/__init__.py (1000b), scripts/board_profiles/common.py (3647b), scripts/board_profiles/white_plastic_or_paper.py (4055b), scripts/board_profiles/wood.py (2463b), scripts/go_board_recognition.py (23617b), scripts/next_move.py (51040b), scripts/requirements.txt (51b), scripts/resident_katago.py (5159b), skill-card.md (2600b), SKILL.md (7577b), src/app.config.ts (135b), src/app.css (124b), src/app.tsx (115b), src/index.html (289b), src/lib/api.ts (3489b), src/lib/board.ts (1956b), src/lib/config.ts (1630b), src/lib/visitor.ts (701b), src/pages/index/index.config.ts (78b), src/pages/index/index.css (5322b), src/pages/index/index.tsx (14281b), tests/e2e/h5-browser.spec.ts (6195b), tests/frontend/board.test.ts (1155b), tests/frontend/visitor.test.ts (3738b), tests/test_api.py (15413b), tests/test_coordinates.py (9146b), tests/test_feishu_bot.py (12502b), tests/test_go_board_recognition.py (6624b), tsconfig.json (358b), vitest.config.ts (138b), _meta.json (132b)\n\nFile v0.0.15:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config katago/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor photo input, the tool should surface the combined original-photo result by default. It is the verification/result image: existing white stones are marked with black `W`, existing black stones are marked with white `B`, and the recommended move is drawn as a new stone with the numbered label `1`. This makes recognition mistakes easier to spot and leaves room for future multi-step labels. Use `--result-image` only when you explicitly want the clean warped-board rendering.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.0.15:integrations/feishu/README.md\n\n# 围棋下一手推荐飞书图片机器人\n\n## 围棋高参（飞书机器人）\n\n你可以直接使用围棋高参飞书机器人，无需本地部署：\n\nhttps://applink.feishu.cn/T97DbgVIGt1W\n\n![围棋高参二维码](./weiqi-gaocan-qr.png)\n\n## 使用流程\n\n这是 Go Next Move skill 的可选飞书入口，不会替换或修改原有 CLI skill。\n\n机器人使用飞书长连接模式：iMac 主动连出到飞书，不需要公网 webhook 服务或公网隧道。实际识别和 KataGo 分析由本机 FastAPI 服务完成；飞书机器人只负责收图、调用 `http://127.0.0.1:8000`、再把结果发回飞书。\n\n运行更新边界：\n\n- 飞书机器人依赖 FastAPI 服务；它不是识别/推荐/绘图执行者。\n- 修改识别、推荐、结果图绘制、API 或 KataGo 相关代码后，只需要重启 FastAPI。不要因此重启飞书机器人。\n- 只有修改 `integrations/feishu/feishu_image_bot.py`、飞书配置、环境变量，或飞书长连接异常时，才重启飞书机器人。\n\n1. 先发送一次设置消息，例如：\n\n```text\n设置 黑 中级\n```\n\n2. 之后直接发送棋盘照片。机器人会下载图片，调用本机 FastAPI 服务，再回复推荐落点和结果图。\n\n设置按飞书用户 ID 保存在本地 JSON 文件中，默认路径是 `~/.go-next-move/feishu-settings.json`。只发送部分设置时会保留其他旧值；例如 `设置 白` 只会修改轮到白棋下。\n\n## 命令\n\n```text\n设置 黑 中级\n设置 白 高级\n设置 白\n设置 高级\n设置 black beginner\n当前设置\n上报\n帮助\n```\n\n支持的行棋方：\n\n- `黑`, `黑棋`, `black`, `b`\n- `白`, `白棋`, `white`, `w`\n\n支持的推荐强度：\n\n- `初级`, `beginner`\n- `中级`, `intermediate`\n- `高级`, `advanced`\n\n如果最近一次识别图或结果图有问题，发送 `上报`、`报错`、`识别错` 或 `反馈`。配置了 `FEISHU_FEEDBACK_DIR` 后，机器人会把当前会话最近一次成功分析的数据保存到该目录下，包含 `input.jpg`、`output.jpg` 和 `metadata.json`。\n\n## 部署\n\n安装依赖：\n\n```bash\npython3 -m pip install -r scripts/requirements.txt\npython3 -m pip install -r integrations/feishu/requirements.txt\n```\n\n创建一个飞书应用，并启用机器人长连接模式。\n\n需要开通的飞书权限：\n\n- `im:message.p2p_msg:readonly`：接收发给机器人的私聊消息。\n- `im:message.group_at_msg:readonly`：接收群聊中 @ 机器人的消息。\n- `im:message.group_at_msg.include_bot:readonly`：接收包含机器人消息的群聊 @ 消息。\n- `im:message`：读取消息事件所需的消息元数据和内容。\n- `im:message:send_as_bot`：以机器人身份发送回复。\n- `im:resource`：下载收到的图片，并上传输出的标注结果图。\n\n修改权限或事件订阅后，需要发布新的应用版本，并在租户内升级或安装该版本；只改开发配置不会立即生效。\n\n可以在飞书控制台导入下面的权限 JSON：\n\n```json\n{\n  \"scopes\": {\n    \"tenant\": [\n      \"im:message\",\n      \"im:message.group_at_msg.include_bot:readonly\",\n      \"im:message.group_at_msg:readonly\",\n      \"im:message.p2p_msg:readonly\",\n      \"im:message:send_as_bot\",\n      \"im:resource\"\n    ],\n    \"user\": [\n      \"im:resource\"\n    ]\n  }\n}\n```\n\n需要订阅的事件：\n\n- `im.message.receive_v1`：接收用户发来的消息。\n\n运行：\n\n```bash\ncat > .env.feishu <<'EOF'\nFEISHU_APP_ID=cli_xxx\nFEISHU_APP_SECRET=xxx\nGO_NEXT_MOVE_API_BASE_URL=http://127.0.0.1:8000\nFEISHU_FEEDBACK_DIR=/path/to/local/feedback-data\nEOF\n\npython3 integrations/feishu/feishu_image_bot.py\n```\n\nKataGo 相关环境变量应配置给 FastAPI 服务，而不是飞书机器人：\n\n```bash\nKATAGO_PATH=/path/to/katago \\\nKATAGO_MODEL=/path/to/model.bin.gz \\\nKATAGO_ANALYSIS_CONFIG=/path/to/analysis_example.cfg \\\nKATAGO_SKILL_CONFIG=katago/analysis_skill.cfg \\\npython3 -m uvicorn api.app:create_app --factory --host 0.0.0.0 --port 8000\n```\n\n### macOS launchd 性能设置\n\n如果用 `launchd` 常驻运行飞书机器人，不要把 plist 的 `ProcessType`\n设为 `Background`。macOS 会降低后台任务的 CPU/QoS，OpenCV 的棋盘候选\ngrid fitting 会明显变慢；实测同一张 1080x1920 棋盘图的识别时间可能从约\n1 秒放大到约 6 秒。\n\n建议使用 `Interactive`，或直接省略 `ProcessType`：\n\n```xml\n<key>ProcessType</key>\n<string>Interactive</string>\n```\n\n重启后可以检查：\n\n```bash\nlaunchctl print gui/$(id -u)/com.wanghongbao.go-next-move.feishu-bot\n```\n\n输出里应看到 `spawn type = interactive`，而不是 `background`。\n\n常用选项：\n\n```bash\npython3 integrations/feishu/feishu_image_bot.py \\\n  --level intermediate \\\n  --side-to-move black \\\n  --api-base-url http://127.0.0.1:8000 \\\n  --feedback-dir /path/to/local/feedback-data \\\n  --settings-path ~/.go-next-move/feishu-settings.json\n```\n\n`--api-base-url` 默认读取 `GO_NEXT_MOVE_API_BASE_URL`，未设置时使用 `http://127.0.0.1:8000`。\n\n`--feedback-dir` 默认读取 `FEISHU_FEEDBACK_DIR`；不配置时会关闭显式错误样本上报。\n\n如果机器人能收到图片消息，但分析时报 API 连接失败，请先确认 FastAPI 正在运行，并且 `GO_NEXT_MOVE_API_BASE_URL` 指向同一台机器上的服务，例如 `http://127.0.0.1:8000`。如果 FastAPI 日志里显示找不到 KataGo，再把 `KATAGO_PATH`、`KATAGO_MODEL` 等变量配置到 FastAPI 启动命令里。\n\n## 注意事项\n\n- 机器人使用现有 OpenCV 图片识别链路，不经过 LLM。\n- 如果棋盘识别不准，请发送更清晰的照片。该集成保持原有“一张照片分析一步”的行为，暂不支持提子状态修正或多手 overlay。\n- 群聊通常需要 @ 机器人，具体取决于飞书应用的事件和权限设置。机器人自身没有强制要求 @，因为图片消息通常不方便同时携带文本。\n- 如果本地日志只有 WebSocket `ping`/`pong`，而飞书事件日志为空，请优先检查私聊权限 `im:message.p2p_msg:readonly` 和群聊 @ 权限 `im:message.group_at_msg:readonly`。这种现象通常表示飞书没有权限为应用生成消息事件，而不是 Python 进程异常。\n\nFile v0.0.15:README.md\n\n# 围棋下一手推荐 Skill\n\n[English README](README.en.md)\n\n这是一个用于围棋 / Weiqi 的下一手推荐工具。它可以从棋盘图片或文本棋盘中识别当前局面，调用本地 KataGo 分析候选点，并按指定的**落子强度级别**选择下一手。\n\n这里的 `初级`、`中级`、`高级` 指的是推荐手的强度，不是解释的深浅。这样可以在不同水平的对局里，让 AI 给出更适合对手水平的下一手，帮助对局更接近势均力敌。\n\n## 功能\n\n- 将 19 路围棋棋盘图片识别成 `board_ascii` 二维棋盘。\n- 支持直接输入已有的 `board_ascii` 文本棋盘。\n- 使用本地 KataGo 进行下一手分析。\n- 输出 JSON，包含当前级别推荐手、三档级别推荐、候选手和根节点评估。\n- H5 和飞书默认使用图片坐标轴对应的连续坐标，也支持切换到 GTP 坐标。\n- 可选生成识别校验图，方便人工检查棋子识别是否准确。\n- 支持在不重新拍照的情况下追加“AI 推荐”和“人工录入”的无提子落子历史，并在结果图上连续编号。\n\n## 推荐部署方式：飞书图片机器人\n\n推荐优先使用[飞书图片机器人部署方式](./integrations/feishu/README.md)。它通过飞书长连接接收棋盘照片，再调用本机 FastAPI 服务完成识别和 KataGo 分析；不需要公网 webhook 服务或隧道，KataGo 模型也只由 FastAPI 加载一份。\n\n已可直接体验的围棋高参飞书机器人（无须自行部署）：[https://applink.feishu.cn/T97DbgVIGt1W](https://applink.feishu.cn/T97DbgVIGt1W)\n\n## 环境要求\n\n- Python 3.10+\n- 本地已安装 KataGo\n- KataGo 模型文件\n- Python 依赖：\n\n```bash\npython3 -m pip install -r scripts/requirements.txt\n```\n\nH5 / 小程序 API 服务还需要：\n\n```bash\npython3 -m pip install -r api/requirements.txt\nnpm install\n```\n\n本地开发常用命令：\n\n```bash\nuvicorn api.app:create_app --factory --host 127.0.0.1 --port 8000\nnpm run dev:h5\nnpm run build:h5\nnpm run build:weapp\nnpm run test:api\nnpm run test:frontend\nnpm run test:e2e\n```\n\nH5 + 飞书同时运行时，推荐把 FastAPI 作为唯一分析入口。最终在 iMac 上常驻 4 个进程：\n\n1. H5 页面服务。\n2. FastAPI 服务。\n3. FastAPI 启动并持有的 KataGo analysis 子进程。\n4. 飞书长连接机器人。\n\nKataGo 模型只由 FastAPI 加载一份，飞书机器人通过本机 `localhost` 调 FastAPI。\n\nH5 / 飞书服务运行更新边界：\n\n- 识别、推荐、结果图绘制、KataGo 配置等后端逻辑都在 FastAPI 进程里；更新这些代码后只需要重启 FastAPI，FastAPI 会重新持有 KataGo analysis 子进程。\n- 飞书机器人只是长连接消息收发器和 HTTP 客户端，通过 `GO_NEXT_MOVE_API_BASE_URL` 调 FastAPI；除非修改 `integrations/feishu/feishu_image_bot.py`、飞书配置或长连接状态异常，不要因为后端识别/绘图改动重启飞书机器人。\n- 直接使用本仓库 skill/CLI 时是调用脚本本身，不需要 FastAPI 或飞书机器人。\n\n```bash\n# 1. FastAPI，负责唯一的识别/分析/历史入口，并持有常驻 KataGo\nKATAGO_PATH=/path/to/katago \\\nKATAGO_MODEL=/path/to/model.bin.gz \\\nKATAGO_ANALYSIS_CONFIG=/path/to/analysis_example.cfg \\\nKATAGO_SKILL_CONFIG=katago/analysis_skill.cfg \\\npython3 -m uvicorn api.app:create_app --factory --host 0.0.0.0 --port 8000\n```\n\n```bash\n# 2. H5 页面服务。开发期可直接 watch；手机访问 http://iMac局域网IP:10086/\nnpm run dev:h5 -- --host 0.0.0.0\n```\n\n```bash\n# 3. 飞书机器人，只收发飞书消息，不再自己启动 KataGo\nGO_NEXT_MOVE_API_BASE_URL=http://127.0.0.1:8000 \\\npython3 integrations/feishu/feishu_image_bot.py\n```\n\n本项目首先在 macOS + Homebrew KataGo 下测试：\n\n```bash\nbrew install katago\nkatago version\n```\n\n脚本默认使用 Homebrew 自带模型路径：\n\n```text\n/opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz\n```\n\n如果你的模型在其他位置，运行时传入：\n\n```bash\n--model /path/to/model.bin.gz\n```\n\n## 图片输入\n\n示例输入：\n\n![围棋棋盘照片输入](./docs/examples/input-board.jpg)\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\n`--source-overlay` 会在原照片上标出识别到的棋子和棋盘边界，适合给用户检查识别是否正确。对照片输入来说，工具默认也会生成一张合并后的原图结果：已有白子用黑色 `W` 标记，已有黑子用白色 `B` 标记；新推荐落点会画出对应颜色的新棋子，并在新棋子上写序号 `1`。如果你还想要干净棋盘图，可以显式传 `--result-image`；`--overlay` 是透视矫正后的棋盘裁切图，主要用于调试。\n\n示例输出：\n\n| 识别校验图 | 原图推荐结果 |\n| --- | --- |\n| ![识别校验图，标出棋盘边界和识别到的棋子](./docs/examples/recognition-overlay.jpg) | ![原照片上的下一手推荐结果](./docs/examples/recommendation-source-result.jpg) |\n\n| 透视矫正后的识别校验 | 干净棋盘结果图 |\n| --- | --- |\n| ![透视矫正后的棋盘识别校验图](./docs/examples/recognition-warped-overlay.jpg) | ![干净棋盘上的下一手推荐结果](./docs/examples/recommendation-clean-board.jpg) |\n\n上面的示例来自 `./docs/examples/input-board.jpg`。在该局面中以白棋行棋、`--level all --visits 80` 运行时，示例结果推荐白棋走 `L5`。实际推荐会随模型、访问数和配置略有变化。\n\n## 坐标格式\n\nH5 和飞书默认使用包含 `I` 的连续坐标，匹配图片上的 `A-S` 坐标轴：\n\n```bash\n--coordinate-style sequential\n```\n\n命令行脚本仍可显式使用标准 GTP 坐标，列字母跳过 `I`：\n\n```bash\n--coordinate-style gtp\n```\n\n如果实体棋盘使用包含 `I` 的连续字母 `A-S`，请传：\n\n```bash\n--coordinate-style sequential\n```\n\n例如，同一个第 9 列落点在 GTP 格式中是 `J4`，在连续字母格式中是 `I4`；第 19 列分别是 `T4` 和 `S4`。KataGo 通信始终使用 GTP 坐标，但 `--move-overlay` 输入、JSON 输出、推荐说明和主变化会统一采用所选格式。一次调用不要混用两种格式。\n\n## 无提子连续推理\n\n如果拍照后没有发生提子，可以把后续已确认落子作为 overlay 追加进去。原始图片识别状态会保留在 `base_board_ascii`，追加落子保存在 `move_overlays`，实际送入 KataGo 的合成局面保存在 `board_ascii`。\n\n参数格式：\n\n```text\n--move-overlay source:color:move:label\n```\n\n- `source`：`ai` 或 `user`\n- `color`：`B` / `black` / `黑`，或 `W` / `white` / `白`\n- `move`：所选坐标格式中的落点，例如 `Q4`\n- `label`：图片上显示的手数序号\n\n示例：白棋第一手是 AI 推荐，黑棋第二手是人工录入，然后继续推白棋第三手：\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --coordinate-style sequential \\\n  --move-overlay ai:W:I4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\n脚本会检查这些追加落点在合成过程中必须为空；如果目标点已有棋子，说明坐标、识别或局面状态不一致。发生提子时不要用追加历史，重新拍照重置棋盘，只推理一步。\n\n如果自动识别棋盘不准，可以手动传四个棋盘角点：\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --corners \"74,76 1100,53 1118,1031 72,1034\"\n```\n\n如果传入的是四个最外侧网格交叉点，而不是木质棋盘边角，再加：\n\n```bash\n--grid-corners\n```\n\n## 文本棋盘输入\n\n`board_ascii` 每行表示棋盘一行：\n\n```text\n...................\n...................\n...................\n...X...............\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...............O...\n...................\n...................\n...................\n```\n\n字符含义：\n\n- `X` 或 `B`：黑棋\n- `O` 或 `W`：白棋\n- `.`：空点\n\n运行：\n\n```bash\npython3 scripts/next_move.py board_ascii.txt \\\n  --input ascii \\\n  --side-to-move black \\\n  --level beginner \\\n  --result-image /tmp/go-next-result.jpg\n```\n\n也可以从 stdin 输入：\n\n```bash\ncat board_ascii.txt | python3 scripts/next_move.py \\\n  --input ascii \\\n  --side-to-move white \\\n  --level all\n```\n\n## 落子强度级别\n\n- `beginner` / `初级`：选择一个能下但刻意更温和的 KataGo 候选手。\n- `intermediate` / `中级`：选择一个接近最优的稳健候选手，但不总是第一推荐。\n- `advanced` / `高级`：选择 KataGo 搜索排序第一的最强候选手。\n- `all` / `全部`：同时返回三档级别推荐，方便比较。\n\n当前分级策略使用候选手排序、相对最强手的目数损失和胜率损失来选择。这是第一版实用策略，不是严格校准过的段位模型。\n\n## 输出\n\n脚本输出 JSON。重要字段：\n\n- `recommendation`：按 `--level` 选出的推荐手\n- `coordinate_style`：本次输入和输出使用的坐标格式\n- `base_board_ascii`：原始图片或文本输入识别出的棋盘，不包含拍照后的追加落子\n- `move_overlays`：已确认的拍照后落子历史，例如 AI 推荐和人工录入\n- `display_move_overlays`：用于结果图绘制的落子序号，包含已确认历史和本次新推荐\n- `reason.summary`：一句话推荐结论\n- `reason.explanation`：为什么这么走，包含强度选择、搜索访问数、胜率/目差、主变化和候选手取舍\n- `reason.technical_parameters`：技术参数，包含根节点评估、推荐手评估、搜索第一候选、胜率、目差、访问数、prior、LCB、PV 等\n- `reason.comparison_candidates`：前几个替代候选手，以及相对推荐手/搜索第一候选的损失\n- `recommendations_by_level`：初级、中级、高级三档推荐\n- `candidate_moves`：KataGo 候选手，包含 visits、winrate、score lead 和 PV\n- `root_info`：KataGo 根节点评估\n- `board_ascii`：实际送入 KataGo 的棋盘\n- `recognition`：图片识别元数据，仅图片输入时存在\n- `result_image`：带推荐落点标记的结果图路径，仅在你显式传入 `--result-image` 时存在\n- `source_result_image`：照片输入时默认生成的原照片合并图路径，已有棋子用 B/W 文字标记，推荐落点用带序号 `1` 的新棋子标记\n- `recognition.source_overlay`：原照片识别校验图路径，仅传入 `--source-overlay` 时存在\n\n输出形状示例：\n\n```json\n{\n  \"requested_level\": \"intermediate\",\n  \"recommendation\": {\n    \"move\": \"Q4\",\n    \"strength_level\": \"intermediate\",\n    \"score_loss_vs_best\": 0.8,\n    \"winrate_loss_vs_best\": 0.03\n  },\n  \"reason\": {\n    \"summary\": \"建议白棋走 Q4。这是按中级强度选择的近似最优候选手。主变化参考：Q4 -> D16 -> C17。\",\n    \"explanation\": [\n      \"选择依据：中级强度：优先选择接近最优、但不一定是第一推荐的稳健候选手。\",\n      \"局面评估：胜率 54.2%，预估目差 +1.6。\"\n    ],\n    \"main_variation\": [\"Q4\", \"D16\", \"C17\"],\n    \"technical_parameters\": {\n      \"engine\": \"KataGo\",\n      \"rules\": \"Chinese\",\n      \"recommended_move\": {\n        \"move\": \"Q4\",\n        \"visits\": 138,\n        \"winrate_percent\": \"54.2%\",\n        \"score_lead_points\": \"+1.6\",\n        \"score_loss_vs_best\": 0.8\n      }\n    }\n  },\n  \"recommendations_by_level\": {\n    \"beginner\": {},\n    \"intermediate\": {},\n    \"advanced\": {}\n  }\n}\n```\n\n## 只做棋盘识别\n\n如果只想把图片转成二维棋盘：\n\n```bash\npython3 scripts/go_board_recognition.py /path/to/board.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg\n```\n\n识别校验图会标出棋盘边界和识别到的黑白棋，效果可参考上面的 `识别校验图`。\n\n## 注意\n\n- 单张棋盘图片通常无法判断轮到谁下，所以必须传 `--side-to-move`。\n- 图片模糊、倾斜、裁切、有覆盖标记时，识别可能出错。重要局面建议检查 `--overlay` 输出。\n- `--move-overlay` 只适合无提子连续推理；有提子、打劫或任何局面不一致时，重新拍照重置。\n- 白棋识别不只看亮度，还会检查中心低饱和和中心/外环对比，以减少亮木纹或反光空点被误判成白子的情况。\n- 如果想要最强推荐，用 `--level advanced`，并适当增大 `--visits`。\n\n## License\n\n本项目使用 [Creative Commons Attribution-NonCommercial 4.0 International](LICENSE) 许可。你可以复制、分享、修改和再发布，但需要保留署名，且不能用于商业用途。\n\nFile v0.0.15:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.0.15\",\n  \"publishedAt\": 1783313951560\n}\n\nFile v0.0.15:scripts/requirements.txt\n\nnumpy>=1.26\nopencv-python-headless>=4.8\npillow>=10\n\nFile v0.0.15:CONTEXT.md\n\n# Go Next Move\n\nThis context describes the product language for Go next-move recommendation across Feishu, H5, and mini program entry points.\n\n## Language\n\n**Analysis Session**:\nA user's work item that starts from one uploaded board position and may contain one or more recommendation steps.\n_Avoid_: Record, history item\n\n**Analysis Step**:\nOne recommendation result within an analysis session, including the side to move, strength level, generated images, and engine result for that moment.\n_Avoid_: Sub-record, run\n\n**Visitor**:\nAn anonymous H5 user identified by a browser-stored visitor id.\n_Avoid_: Guest account, temporary user\n\n**Identity**:\nA platform-provided user identifier connected to an internal user.\n_Avoid_: Account provider, login source\n\n**Strength Level**:\nThe user-facing recommendation strength: beginner, intermediate, or advanced.\n_Avoid_: Rank, explanation depth, difficulty\n\n**Continuation**:\nA no-capture virtual follow-up from an existing analysis session, used to understand a recommendation by exploring later moves on the digital board.\n_Avoid_: Full game record, SGF editing\n\n**Digital Board**:\nThe rendered 19x19 board derived from recognized board state and continuation overlays.\n_Avoid_: Original photo, board editor\n\n**Source Result Image**:\nThe original uploaded board photo annotated with recognized stones and the recommended move.\n_Avoid_: Overlay, clean board image\n\n## Service Runtime Notes\n\nThese notes apply to the H5/Feishu service deployment, not to the direct CLI skill path.\n\nIn the service deployment, FastAPI owns recognition, recommendation, result-image drawing, and the resident KataGo analysis process. Feishu is a long-connection message adapter and HTTP client that calls FastAPI through `GO_NEXT_MOVE_API_BASE_URL`.\n\nWhen changing recognition, recommendation, result-image drawing, API, or KataGo-related code for the service, restart FastAPI only. Do not restart the Feishu bot unless the bot code/configuration itself changed or the Feishu long connection is unhealthy.\n\nFile v0.0.15:docs/h5-miniapp-issues.md\n\n# H5 and Mini Program Issue Breakdown\n\nThese issues are drafted as vertical slices from `docs/h5-miniapp-plan.md` and have been published to GitHub.\n\nParent PRD: [#17](https://github.com/imcaptor/go-next-move-skill/issues/17)\n\nPublished slices:\n\n- [#18](https://github.com/imcaptor/go-next-move-skill/issues/18): Scaffold FastAPI and Taro walking skeleton.\n- [#19](https://github.com/imcaptor/go-next-move-skill/issues/19): Collapse move strength to three levels across CLI and Feishu.\n- [#20](https://github.com/imcaptor/go-next-move-skill/issues/20): Add FastAPI synchronous analysis endpoint with local persistence.\n- [#21](https://github.com/imcaptor/go-next-move-skill/issues/21): Build H5 upload-to-result flow.\n- [#22](https://github.com/imcaptor/go-next-move-skill/issues/22): Add recent session history and cleanup.\n- [#23](https://github.com/imcaptor/go-next-move-skill/issues/23): Add rate limits, feedback reporting, and minimal admin review.\n- [#24](https://github.com/imcaptor/go-next-move-skill/issues/24): Add digital-board continuation for no-capture follow-ups.\n- [#25](https://github.com/imcaptor/go-next-move-skill/issues/25): Add WeChat mini program build and identity.\n\n## 0. Scaffold the FastAPI and Taro walking skeleton\n\n**Blocked by**: None\n\n**User stories covered**:\n\n- As a developer, I can run the backend and H5 frontend locally before product features are built.\n- As an operator, I can verify that the iMac-hosted service is alive through a simple endpoint.\n- As a tester, I can open the H5 app in an ordinary browser, so that automated tests do not depend on WeChat.\n\n### What to build\n\nCreate the minimal project structure and development loop for the H5/mini program product: a FastAPI app with health/config endpoints, a Taro + React client that can build for H5, local environment configuration, and documentation for running both pieces locally. The H5 shell must work in an ordinary browser as well as WeChat's in-app browser. This issue should avoid implementing photo analysis, history, admin, or continuation behavior.\n\n### Acceptance criteria\n\n- [ ] FastAPI app starts locally and exposes a health endpoint.\n- [ ] Taro + React app starts locally as H5 and renders an app shell.\n- [ ] Client can call the backend health endpoint through configured API base URL.\n- [ ] H5 app shell works in an ordinary browser without WeChat APIs.\n- [ ] Local configuration is documented without committing secrets.\n- [ ] Project scripts or documented commands cover backend dev, frontend dev, and basic smoke checks.\n\n## 1. Collapse move strength to three levels across CLI and Feishu\n\n**Blocked by**: None\n\n**User stories covered**:\n\n- As a user, I can choose beginner, intermediate, or advanced without seeing an obsolete expert level.\n- As an operator, I get predictable KataGo visit budgets for each product strength level.\n\n### What to build\n\nRemove the public `expert` / `特级` strength level and make the product use exactly three levels everywhere: beginner at 100 visits, intermediate at 250 visits, and advanced at 400 visits. CLI behavior, Feishu commands, Feishu help text, README documentation, and tests should all agree.\n\n### Acceptance criteria\n\n- [ ] CLI rejects or no longer advertises `expert` / `特级`.\n- [ ] Feishu commands and help text only show beginner, intermediate, and advanced.\n- [ ] Feishu visit budgets are 100, 250, and 400.\n- [ ] `--level all` returns only the three supported levels.\n- [ ] README and tests are updated to the three-level model.\n\n## 2. Add a FastAPI synchronous analysis endpoint with local persistence\n\n**Blocked by**: Issue 0, Issue 1\n\n**User stories covered**:\n\n- As an H5 visitor, I can upload a board photo and receive a recommendation from the backend.\n- As an operator, I can keep recent analysis data and images on the iMac for debugging and history.\n\n### What to build\n\nAdd a FastAPI service that accepts a board image, side to move, strength level, and coordinate style, runs the existing recognition and KataGo analysis synchronously, stores the original image, generated images, result JSON, and first analysis step locally, and returns a structured response.\n\n### Acceptance criteria\n\n- [ ] `POST /api/analyses` accepts image upload plus settings and returns a completed first step.\n- [ ] The service stores analysis session and step metadata in SQLite.\n- [ ] The service stores original and generated images under local storage.\n- [ ] Responses expose recommendation, source result image reference, elapsed time, settings, candidate summary, and step/session ids.\n- [ ] Errors from recognition, KataGo, invalid settings, or timeouts return structured user-facing failures.\n\n## 3. Build the H5 upload-to-result flow\n\n**Blocked by**: Issue 0, Issue 2\n\n**User stories covered**:\n\n- As a WeChat H5 visitor, I can open the page, upload or take a photo, and see where to play.\n- As a normal browser visitor, I can open the same H5 page for testing and use a random anonymous id.\n- As a visitor, I can use the product without creating an account.\n\n### What to build\n\nCreate the Taro + React H5 flow for anonymous visitors: random visitor id creation/persistence, settings selection, photo upload, loading state, synchronous API call, and result page rendering with source result image and structured recommendation details. The flow must work in both WeChat's in-app browser and ordinary browsers used for development and automated testing.\n\n### Acceptance criteria\n\n- [ ] H5 stores and reuses a visitor id.\n- [ ] Ordinary browser visits generate and persist a random visitor id without requiring WeChat APIs.\n- [ ] Home page supports photo upload or camera capture in mobile WeChat.\n- [ ] Home page supports fixture/manual image upload in ordinary browsers for testing.\n- [ ] User can set side to move, strength level, and coordinate style before analysis.\n- [ ] Result page shows recommendation coordinate, source result image, elapsed time, search budget, and settings.\n- [ ] Details section shows candidate/technical information without crowding the first screen.\n- [ ] The flow handles backend errors and timeouts gracefully.\n\n## 4. Add recent session history and cleanup\n\n**Blocked by**: Issue 2, Issue 3\n\n**User stories covered**:\n\n- As a visitor, I can return to recent analyses from the same browser.\n- As an operator, old anonymous images do not grow forever on disk.\n\n### What to build\n\nExpose recent analysis sessions through the API and H5 UI, model history as sessions with steps, and add scheduled cleanup that keeps the latest 20 sessions per visitor/user and deletes anonymous sessions after 30 days without access or update.\n\n### Acceptance criteria\n\n- [ ] `GET /api/analyses` returns recent sessions for the current visitor/user.\n- [ ] `GET /api/analyses/{session_id}` returns a session with its steps.\n- [ ] H5 history page lists recent sessions rather than individual steps.\n- [ ] Cleanup runs every 2 hours while the service is running.\n- [ ] Cleanup deletes database rows and image files together.\n- [ ] Anonymous sessions expire after 30 days without access or update.\n\n## 5. Add rate limits, feedback reporting, and minimal admin review\n\n**Blocked by**: Issue 2, Issue 4\n\n**User stories covered**:\n\n- As an operator, I can prevent accidental or abusive KataGo usage.\n- As a user, I can report recognition or result issues.\n- As an operator, I can inspect recent analyses and reported samples.\n\n### What to build\n\nAdd visitor/IP/user rate limits, a feedback endpoint for analysis steps, and a minimal password-protected admin surface showing recent analyses, feedback samples, daily call counts, storage usage, and a manual cleanup action.\n\n### Acceptance criteria\n\n- [ ] Anonymous visitors are limited to 30 analyses per day.\n- [ ] IP addresses are limited to 60 analyses per hour.\n- [ ] Mini program users are limited to 50 analyses per day once identity exists.\n- [ ] Continuation requests count against analysis limits.\n- [ ] Users can report a specific session step.\n- [ ] Admin can view recent analyses, feedback samples, daily counts, and storage usage.\n- [ ] Admin can trigger cleanup manually.\n\n## 6. Add digital-board continuation for no-capture follow-ups\n\n**Blocked by**: Issue 2, Issue 3, Issue 4\n\n**User stories covered**:\n\n- As a user who does not understand a recommendation, I can explore a few virtual follow-up moves.\n- As a user, I can interact on a precise digital board while still checking the original source result image.\n\n### What to build\n\nAdd continuation as a session-detail workflow. Render a Canvas digital board from recognized board state and overlays, let the user confirm the AI move and select an opponent move, create a new analysis step synchronously, and display numbered overlays for follow-up recommendations. Keep continuation explicitly limited to no-capture explanation.\n\n### Acceptance criteria\n\n- [ ] Digital board renders recognized stones, coordinate labels, and numbered overlays.\n- [ ] User can select only empty points.\n- [ ] User can undo the latest continuation input.\n- [ ] `POST /api/analyses/{session_id}/steps` creates a new step in the existing session.\n- [ ] Continuation preserves the original source result image for verification.\n- [ ] UI tells the user to retake a photo after captures or recognition mismatch.\n\n## 7. Add WeChat mini program build and identity\n\n**Blocked by**: Issue 3, Issue 4, Issue 5\n\n**User stories covered**:\n\n- As a WeChat mini program user, I can use the same upload, result, history, and feedback behavior with WeChat identity.\n- As an operator, H5 anonymous usage and mini program logged-in usage share one backend model.\n\n### What to build\n\nEnable the Taro client to build as a WeChat mini program, add WeChat login identity mapping, configure API/image access for the mini program environment, and verify that upload, result, history, feedback, and rate limits work with `user_id`.\n\n### Acceptance criteria\n\n- [ ] Taro mini program build succeeds.\n- [ ] Mini program login maps WeChat identity to internal `user_id`.\n- [ ] Mini program can upload photos and display result images through configured HTTPS endpoints.\n- [ ] Mini program history uses the same session/step model.\n- [ ] Mini program user rate limit is 50 analyses per day.\n- [ ] H5-specific anonymous visitor behavior does not leak into mini program users.\n\nFile v0.0.15:docs/h5-miniapp-plan.md\n\n# H5 and Mini Program Plan\n\n## Goal\n\nBuild a lower-friction H5 and WeChat mini program entry point for Go Next Move while keeping feature behavior aligned with the Feishu image bot. The first public product should let a user upload or take a board photo, choose side and strength, receive a marked recommendation image, review recent analysis history, and optionally continue a short no-capture virtual line on a digital board.\n\nThe product should use one shared backend and one cross-platform frontend codebase, compiled separately for H5 and the WeChat mini program.\n\n## Non-Goals\n\n- Do not build a full Go game editor or SGF product.\n- Do not support captures during continuation.\n- Do not build a heavy account system for H5 before the mini program exists.\n- Do not make result sharing a primary workflow.\n- Do not expose KataGo engine parameters beyond the product-level strength choices.\n\n## Entry Points\n\n### H5\n\nH5 is the first launch target because it avoids mini program review and can be distributed in WeChat while the domain备案 is in progress. It must also work in a normal desktop or mobile browser so development and automated tests do not depend on WeChat.\n\nH5 users are anonymous visitors. On first visit, the browser client should create or request a random `visitor_id` and persist it in cookie or local storage. That id is the visitor's unique marker for history, rate limits, and feedback until a stronger identity exists. H5 does not require login in the first version.\n\nAnonymous H5 history expires after 30 days without access or update.\n\n### WeChat Mini Program\n\nThe mini program should use WeChat login and map the platform identity to an internal `user_id`. It should share the same backend APIs and product behavior as H5.\n\n### Feishu\n\nFeishu remains a supported image-bot entry point. Product behavior should be aligned where practical, but H5 and the mini program may provide richer UI because they are not constrained by chat messages.\n\n## Product Scope\n\n### Main Flow\n\n1. User opens H5 or the mini program.\n2. User uploads or takes a board photo.\n3. User chooses side to move, strength level, and coordinate style.\n4. Backend analyzes the position synchronously.\n5. UI shows the recommendation coordinate, source result image, elapsed time, and current settings.\n6. User can report a recognition/result issue, view details, start a continuation, or analyze another photo.\n\n### Strength Levels\n\nThe product has exactly three strength levels:\n\n- Beginner: 100 visits.\n- Intermediate: 250 visits. This is the default.\n- Advanced: 400 visits.\n\nThe previous `expert` / `特级` level should be removed from Feishu, CLI documentation, and new product UI. There is no need to preserve compatibility because the product has not been publicly launched.\n\n### Settings\n\nVisible user settings:\n\n- Side to move: black or white.\n- Strength level: beginner, intermediate, advanced.\n- Coordinate style: sequential A-S by default, or GTP.\n\nHidden defaults:\n\n- Chinese rules.\n- Komi 7.5.\n\n### Result Page\n\nThe first screen should prioritize:\n\n1. Recommended side and coordinate.\n2. Source result image for visual verification.\n3. Strength, coordinate style, elapsed time, and search budget.\n4. Actions: analyze another photo, view details, continue a few moves, report an issue.\n\nFeishu's text reply should be converted into structured UI rather than copied as one large text block. Candidate comparison, winrate, score lead, visits, PV, and technical details belong in a details section or drawer.\n\n### Continuation\n\nContinuation is an explanation aid, not the main play flow. It helps users understand a recommendation by exploring a few no-capture follow-up moves.\n\nBehavior:\n\n- The original source result image remains available for visual verification.\n- The interaction surface is the digital board, not the original photo.\n- The user can confirm the AI recommendation and select the opponent's next move on the digital board.\n- The system adds numbered overlays and returns the next recommendation.\n- The user can undo the latest continuation input.\n- If a capture happens, the user must take a new photo.\n- If recognition looks wrong, the user should not continue from that session.\n\nThe digital board should support rendering `board_ascii`, rendering numbered overlays, highlighting the latest recommendation, selecting an empty point, undoing the latest user input, and showing coordinates.\n\n## History\n\nHistory should be modeled as analysis sessions with child steps.\n\n- Keep the latest 20 analysis sessions per visitor or user.\n- Each session stores the original photo and original recognized board.\n- Each step stores side to move, strength level, move overlays, recommendation result, generated result image, elapsed time, and feedback state.\n- Continuation creates a new step in the same session rather than overwriting the original step.\n- The history list shows sessions, not every step as a separate top-level item.\n\nCleanup:\n\n- A cleanup thread runs every 2 hours.\n- For every visitor or user, keep only the latest 20 sessions.\n- Anonymous H5 sessions older than 30 days since last access/update are deleted.\n- Image files are deleted with their database records.\n\n## Rate Limits\n\nThe first version should include basic cost protection:\n\n- Anonymous H5 visitor: 30 analyses per day.\n- IP address: 60 analyses per hour.\n- Mini program user: 50 analyses per day.\n- Continuation counts as an analysis because it calls KataGo.\n- Admin or whitelist bypass should be possible.\n\n## Backend\n\nUse Python FastAPI because the existing recognition and analysis pipeline is already Python-based.\n\nFirst-version deployment runs on the local iMac and exposes the service through frp. The same iMac runs KataGo with the existing Metal setup.\n\nSuggested local paths:\n\n- SQLite database: `~/.go-next-move/app.sqlite3`.\n- Stored images: `~/.go-next-move/storage/`.\n\nThe first version can use local SQLite and local file storage. Object storage and a managed database can be added later if traffic requires them.\n\n### API Sketch\n\nCore user-facing endpoints:\n\n- `POST /api/analyses`: create an analysis session from an uploaded photo and return the first step result synchronously.\n- `GET /api/analyses`: list recent sessions.\n- `GET /api/analyses/{session_id}`: fetch a session and its steps.\n- `POST /api/analyses/{session_id}/steps`: create a continuation step.\n- `POST /api/analyses/{session_id}/steps/{step_id}/feedback`: report recognition or result issues.\n- `GET /api/images/{image_id}`: return an authorized image.\n\nAdmin endpoints:\n\n- `GET /admin`: recent operational summary.\n- `GET /admin/analyses`: recent analyses.\n- `GET /admin/feedback`: reported samples.\n- `POST /admin/cleanup`: run cleanup manually.\n\n### Synchronous Analysis\n\nThe first version should use synchronous requests with a loading state. Current analysis usually completes in 3-4 seconds, so an async job system is not necessary yet.\n\nGuardrails:\n\n- Frontend shows a loading state while the request is in flight.\n- Backend and frontend timeouts should allow roughly 20-30 seconds.\n- Failures return clear user-facing error states.\n- If timeouts or concurrency become a real problem, the API can evolve to queued asynchronous jobs later.\n\n## Frontend\n\nUse Taro + React for one source codebase compiled to H5 and WeChat mini program.\n\nPages:\n\n- Home / photo upload.\n- Result / session detail.\n- History.\n- Continuation digital board.\n- Settings.\n- Feedback entry.\n\nThe H5 build must run in ordinary browsers as well as WeChat's in-app browser. Ordinary browser support is required for local development, QA, and automated end-to-end tests. Browser-only testing should be able to create a random anonymous visitor id, upload a fixture image, and verify the result flow without WeChat APIs.\n\nThe admin UI can live outside the mini program package. It can be a small web-only route or simple FastAPI-rendered HTML.\n\n### Canvas Board\n\nImplement the digital board with Canvas.\n\nRequirements:\n\n- 19x19 responsive square board.\n- Sequential A-S coordinate labels by default.\n- Optional GTP coordinate labels.\n- Stone rendering from recognized board state.\n- Numbered overlays for AI and user continuation moves.\n- Latest recommendation highlight.\n- Empty-point hit testing.\n- Undo latest continuation input.\n\n## Admin\n\nBuild a minimal admin surface for early operations:\n\n- Recent analysis list.\n- Feedback and recognition-error samples.\n- Daily call counts.\n- Current storage usage.\n- Manual cleanup action.\n- Simple administrator password protection.\n\n## Deployment\n\nInitial deployment:\n\n- iMac runs FastAPI and KataGo.\n- frp exposes the local service through a public server.\n- Domain binds to the frp endpoint after备案 is ready.\n- H5 launches first.\n- Mini program submission follows after domain, HTTPS, and WeChat request-domain setup are ready.\n\n## Open Questions\n\n- Whether the admin UI should be React web or server-rendered HTML.\n- Exact maximum continuation steps per session.\n- Whether mini program history should expire or only be capped by session count.\n- Whether Feishu should later call the same FastAPI service instead of invoking the script directly.\n\n## First Implementation Slices\n\nThe first build should be split into vertical slices that each prove a user-visible path end to end:\n\n0. FastAPI and Taro walking skeleton.\n1. Three-level strength model across CLI and Feishu.\n2. FastAPI synchronous photo analysis endpoint with local persistence.\n3. H5 upload-to-result flow.\n4. Recent session history and cleanup.\n5. Feedback reporting and admin review.\n6. Digital board continuation.\n7. WeChat mini program build and identity.\n\nFile v0.0.15:LOCAL_RUNTIME_NOTES.md\n\n# Local Runtime Notes\n\nThe launchd Feishu bot does not run from this `Documents` checkout.\nmacOS privacy controls can block background LaunchAgents from reading files\nunder `~/Documents`, which previously caused the process to appear alive while\nit never entered the bot code.\n\nRuntime copy used by launchd:\n\n```bash\n/Users/wanghongbao/.go-next-move/runtime/go-next-move-skill\n```\n\nAfter pulling or editing code in this checkout, sync the runtime copy:\n\n```bash\nrsync -a --delete \\\n  --exclude '.git/' \\\n  --exclude '__pycache__/' \\\n  --exclude '*.pyc' \\\n  --exclude 'latest-*.jpg' \\\n  /Users/wanghongbao/Documents/go-next-move-skill/ \\\n  /Users/wanghongbao/.go-next-move/runtime/go-next-move-skill/\n```\n\nRestart the launchd bot:\n\n```bash\nlaunchctl bootout gui/501/com.wanghongbao.go-next-move.feishu-bot 2>/dev/null || true\nlaunchctl bootstrap gui/501 ~/Library/LaunchAgents/com.wanghongbao.go-next-move.feishu-bot.plist\n```\n\nCheck status and logs:\n\n```bash\nlaunchctl print gui/501/com.wanghongbao.go-next-move.feishu-bot\ntail -n 120 ~/.go-next-move/feishu-bot.err.log ~/.go-next-move/feishu-bot.out.log\n```\n\nDuplicate replies:\n\nFeishu may redeliver old events after reconnects. The bot now stores processed\nmessage ids in:\n\n```bash\n~/.go-next-move/feishu-processed-messages.json\n```\n\nThis prevents the same Feishu `message_id` from being handled again after a\nrestart or reconnect.\n\nFile v0.0.15:README.en.md\n\n# Go Next Move Skill\n\nAnalyze a Go / Weiqi board position from an image or a text board, ask KataGo for candidate moves, and choose a next move at a requested playing-strength level.\n\nThe key idea is that `beginner`, `intermediate`, and `advanced` control **move strength**, not explanation depth. This can be used to make AI-assisted games more balanced against opponents of different levels.\n\n## Features\n\n- Recognize a 19x19 Go board image into `board_ascii`.\n- Accept an existing `board_ascii` position from a text file or stdin.\n- Use local KataGo for next-move analysis.\n- Return JSON with the selected move, all level-based recommendations, candidate moves, and root evaluation.\n- H5 and Feishu default to sequential coordinates that match the image axis, with an option for GTP coordinates.\n- Optionally write a board recognition overlay image for visual checking.\n- Continue a no-capture sequence without re-shooting by adding numbered AI-recommended and user-entered move overlays.\n\n## Recommended Feishu Image Bot\n\nFor repeated photo analysis, prefer the [Feishu image bot](./integrations/feishu/README.md). It uses Feishu's long-connection bot mode: the machine running KataGo connects out to Feishu, receives board photos, and replies with the recommended move and marked result image. It does not require a public webhook service or tunnel.\n\nYou can try the hosted Weiqi advisor bot here: [https://applink.feishu.cn/T97DbgVIGt1W](https://applink.feishu.cn/T97DbgVIGt1W)\n\n## Requirements\n\n- Python 3.10+\n- KataGo installed locally\n- A KataGo model file\n- Python packages:\n\n```bash\npython3 -m pip install -r scripts/requirements.txt\n```\n\nThis project was first tested on macOS with Homebrew KataGo:\n\n```bash\nbrew install katago\nkatago version\n```\n\nThe scripts default to Homebrew's bundled model path:\n\n```text\n/opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz\n```\n\nIf your model is elsewhere, pass `--model /path/to/model.bin.gz`.\n\n## Image Input\n\nExample input:\n\n![Go board photo input](./docs/examples/input-board.jpg)\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\n`--source-overlay` marks detected stones and board corners on the original photo, which is the best user-facing recognition check. For photo input, the tool also generates a combined original-photo result by default: existing white stones are marked with black `W`, existing black stones are marked with white `B`, and the recommended move is drawn as a new stone with the numbered label `1`. If you also want a clean board image, pass `--result-image` explicitly. `--overlay` writes a warped/cropped board view for debugging.\n\nExample outputs:\n\n| Recognition check | Source-photo recommendation |\n| --- | --- |\n| ![Recognition overlay with board boundary and detected stones](./docs/examples/recognition-overlay.jpg) | ![Recommended move drawn on the original photo](./docs/examples/recommendation-source-result.jpg) |\n\n| Warped recognition check | Clean board result |\n| --- | --- |\n| ![Warped board recognition overlay](./docs/examples/recognition-warped-overlay.jpg) | ![Recommended move drawn on a clean board](./docs/examples/recommendation-clean-board.jpg) |\n\nThese images are generated from `./docs/examples/input-board.jpg`. With white to move and `--level all --visits 80`, this example recommends `L5`. Exact recommendations can vary with the model, visit count, and configuration.\n\n## Coordinate Styles\n\nH5 and Feishu default to sequential coordinates, matching physical board image axes labeled `A-S` including `I`:\n\n```bash\n--coordinate-style sequential\n```\n\nThe command-line script can still explicitly use standard GTP coordinates, whose column letters skip `I`:\n\n```bash\n--coordinate-style gtp\n```\n\nFor a physical board labeled with sequential `A-S` letters including `I`, use:\n\n```bash\n--coordinate-style sequential\n```\n\nFor example, the same ninth-column point is `J4` in GTP style and `I4` in sequential style; the nineteenth column is `T4` and `S4`, respectively. KataGo communication always uses GTP coordinates, while `--move-overlay` input, JSON output, recommendation text, and principal variations consistently use the selected style. Do not mix styles within one invocation.\n\n## No-Capture Continuation\n\nWhen no captures have happened after the photo, confirmed follow-up moves can be added as overlays. The original recognized position stays in `base_board_ascii`, confirmed post-photo moves are stored in `move_overlays`, and the composed position sent to KataGo is stored in `board_ascii`.\n\nFormat:\n\n```text\n--move-overlay source:color:move:label\n```\n\n- `source`: `ai` or `user`\n- `color`: `B` / `black`, or `W` / `white`\n- `move`: coordinate in the selected style, for example `Q4`\n- `label`: move number drawn on the result image\n\nExample: white move 1 was AI-recommended, black move 2 was entered manually, then ask for white move 3:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --coordinate-style sequential \\\n  --move-overlay ai:W:I4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nEach overlay target must be empty while composing the board. If the point is occupied, the script stops because coordinates, recognition, or state are inconsistent. When captures happen, re-shoot/reset the board and analyze one move from the new photo.\n\nIf board detection needs help, pass four board corners:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --corners \"74,76 1100,53 1118,1031 72,1034\"\n```\n\nIf those points are the four outer grid intersections rather than the wooden board corners, add:\n\n```bash\n--grid-corners\n```\n\n## ASCII Input\n\n`board_ascii` is one row per board line:\n\n```text\n...................\n...................\n...................\n...X...............\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...............O...\n...................\n...................\n...................\n```\n\nCharacters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nRun:\n\n```bash\npython3 scripts/next_move.py board_ascii.txt \\\n  --input ascii \\\n  --side-to-move black \\\n  --level beginner \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nOr from stdin:\n\n```bash\ncat board_ascii.txt | python3 scripts/next_move.py \\\n  --input ascii \\\n  --side-to-move white \\\n  --level all\n```\n\n## Playing-Strength Levels\n\n- `beginner`: choose a plausible but intentionally softer KataGo candidate.\n- `intermediate`: choose a solid near-top candidate, not always the best move.\n- `advanced`: choose KataGo's top searched candidate.\n- `all`: return all three level recommendations for comparison.\n\nThe current selection policy uses candidate rank plus score and winrate loss from KataGo's best move. It is a practical first pass, not a calibrated rank model.\n\n## Output\n\nThe script prints JSON. Important fields:\n\n- `recommendation`: the move selected for `--level`\n- `coordinate_style`: the coordinate style used for input and output\n- `base_board_ascii`: the original recognized/input board, without post-photo move overlays\n- `move_overlays`: confirmed post-photo move history, such as AI recommendations and user-entered moves\n- `display_move_overlays`: numbered moves drawn on the result image, including confirmed history and the new recommendation\n- `reason.summary`: one-sentence recommendation\n- `reason.explanation`: why this move was selected, including level policy, visits, winrate/score lead, main line, and tradeoffs\n- `reason.technical_parameters`: engine parameters and evaluations, including root evaluation, selected move, top search move, winrate, score lead, visits, prior, LCB, and PV\n- `reason.comparison_candidates`: nearby alternatives and their loss vs the recommendation or top search move\n- `recommendations_by_level`: beginner, intermediate, and advanced choices\n- `candidate_moves`: KataGo candidates with visits, winrate, score lead, and PV\n- `root_info`: KataGo root evaluation\n- `board_ascii`: the position that was analyzed\n- `recognition`: image recognition metadata, present only for image input\n- `result_image`: path to the generated recommendation image, present only when you explicitly pass `--result-image`\n- `source_result_image`: default combined original-photo image path for photo input, with existing stones marked by B/W text and the recommended move drawn as a numbered stone\n- `recognition.source_overlay`: path to the source-photo recognition check, present only when `--source-overlay` is passed\n\nExample shape:\n\n```json\n{\n  \"requested_level\": \"intermediate\",\n  \"recommendation\": {\n    \"move\": \"Q4\",\n    \"strength_level\": \"intermediate\",\n    \"score_loss_vs_best\": 0.8,\n    \"winrate_loss_vs_best\": 0.03\n  },\n  \"reason\": {\n    \"summary\": \"Recommended move for white: Q4. This is a near-best candidate selected for intermediate strength. Main line: Q4 -> D16 -> C17.\",\n    \"explanation\": [\n      \"Selection basis: intermediate strength chooses a solid near-top candidate, not always the best move.\",\n      \"Position evaluation: winrate 54.2%, score lead +1.6.\"\n    ],\n    \"main_variation\": [\"Q4\", \"D16\", \"C17\"],\n    \"technical_parameters\": {\n      \"engine\": \"KataGo\",\n      \"rules\": \"Chinese\",\n      \"recommended_move\": {\n        \"move\": \"Q4\",\n        \"visits\": 138,\n        \"winrate_percent\": \"54.2%\",\n        \"score_lead_points\": \"+1.6\",\n        \"score_loss_vs_best\": 0.8\n      }\n    }\n  },\n  \"recommendations_by_level\": {\n    \"beginner\": {},\n    \"intermediate\": {},\n    \"advanced\": {}\n  }\n}\n```\n\n## Board Recognition Only\n\nTo only convert an image into a 2D board:\n\n```bash\npython3 scripts/go_board_recognition.py /path/to/board.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg\n```\n\nThe recognition check marks the board boundary and detected stones, as shown in the `Recognition check` example above.\n\n## Notes\n\n- A board image usually does not prove whose turn it is, so `--side-to-move` is required.\n- `--move-overlay` is only for no-capture continuation. If captures, ko, or any state mismatch occurs, re-shoot/reset.\n- Image recognition can be wrong on blurry, skewed, cropped, or heavily annotated boards. Check the overlay when accuracy matters.\n- White-stone recognition checks more than brightness: it also requires low-saturation center evidence and center/ring contrast to reduce false positives from bright wood grain or glare.\n- For high-strength play, use `--level advanced` with a larger `--visits` value.\n\n## License\n\nThis project is licensed under [Creative Commons Attribution-NonCommercial 4.0 International](LICENSE). You may copy, share, modify, and redistribute it with attribution, but commercial use is not allowed.\n\nFile v0.0.15:skill-card.md\n\n## Description: <br>\nAnalyzes a Go or Weiqi board from a photo or text board, uses local KataGo analysis, and recommends the next move at beginner, intermediate, or advanced playing strength. <br>\n\nThis skill is for research and development only. <br>\n\n## Publisher: <br>\n[imcaptor](https://clawhub.ai/user/imcaptor) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nGo players and developers use this skill to analyze a 19x19 board position, verify board recognition from images, and receive KataGo-backed move recommendations calibrated to a requested playing-strength level. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Uploaded board photos, generated images, feedback samples, and user identifiers may be retained or exposed when the API or bot is deployed as a service. <br>\nMitigation: Define retention and deletion rules, store feedback data in controlled locations, and run the service locally or behind trusted access controls. <br>\nRisk: Weak service defaults or broad bot access can expose analysis endpoints and message/image data. <br>\nMitigation: Set a strong GO_NEXT_MOVE_ADMIN_PASSWORD, keep GO_NEXT_MOVE_API_BASE_URL on localhost or HTTPS to a trusted host, and limit Feishu permissions to documented scopes. <br>\nRisk: Board recognition errors or missing side-to-move context can make move recommendations unreliable. <br>\nMitigation: Require side-to-move confirmation, show recognition/result overlays, and treat recommendations as unreliable until the board state is corrected when recognition looks wrong. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/imcaptor/skills/go-next-move) <br>\n- [README.en.md](artifact/README.en.md) <br>\n- [Feishu image bot README](artifact/integrations/feishu/README.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance] <br>\n**Output Format:** [Markdown guidance with shell commands and JSON output descriptions] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May produce move coordinates, candidate comparisons, KataGo evaluation data, board-recognition metadata, and generated result-image paths.] <br>\n\n## Skill Version(s): <br>\n0.0.15 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v0.0.15:package.json\n\n{\n  \"name\": \"go-next-move-skill\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev:h5\": \"taro build --type h5 --watch\",\n    \"build:h5\": \"taro build --type h5\",\n    \"build:weapp\": \"taro build --type weapp\",\n    \"test:frontend\": \"vitest run\",\n    \"test:e2e\": \"playwright test\",\n    \"test:api\": \"python3 -m unittest tests.test_api\",\n    \"test:python\": \"python3 -m unittest discover -s tests\"\n  },\n  \"dependencies\": {\n    \"@babel/runtime\": \"^7.28.4\",\n    \"@tarojs/components\": \"4.2.0\",\n    \"@tarojs/helper\": \"4.2.0\",\n    \"@tarojs/plugin-framework-react\": \"4.2.0\",\n    \"@tarojs/plugin-platform-h5\": \"4.2.0\",\n    \"@tarojs/plugin-platform-weapp\": \"4.2.0\",\n    \"@tarojs/react\": \"4.2.0\",\n    \"@tarojs/runtime\": \"4.2.0\",\n    \"@tarojs/shared\": \"4.2.0\",\n    \"@tarojs/taro\": \"4.2.0\",\n    \"@tarojs/vite-runner\": \"^4.2.0\",\n    \"react\": \"^18.3.1\",\n    \"react-dom\": \"^18.3.1\"\n  },\n  \"devDependencies\": {\n    \"@babel/plugin-proposal-decorators\": \"^7.29.7\",\n    \"@playwright/test\": \"^1.61.1\",\n    \"@tarojs/cli\": \"^4.2.0\",\n    \"@types/react\": \"^18.3.27\",\n    \"@types/react-dom\": \"^18.3.7\",\n    \"@vitejs/plugin-react\": \"^4.7.0\",\n    \"typescript\": \"^5.9.3\",\n    \"vitest\": \"^4.0.16\"\n  }\n}\n\nArchive v0.0.14: 45 files, 207626 bytes\n\nFiles: api/__init__.py (33b), api/app.py (29866b), api/requirements.txt (33b), config/index.ts (649b), CONTEXT.md (2031b), docs/h5-miniapp-issues.md (10322b), docs/h5-miniapp-plan.md (9638b), integrations/feishu/feishu_image_bot.py (41514b), integrations/feishu/README.md (6162b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), package-lock.json (479930b), package.json (1160b), playwright.config.ts (418b), project.config.json (292b), README.en.md (11133b), README.md (12980b), scripts/go_board_recognition.py (23213b), scripts/next_move.py (46598b), scripts/requirements.txt (51b), scripts/resident_katago.py (5159b), skill-card.md (2813b), SKILL.md (7577b), src/app.config.ts (135b), src/app.css (124b), src/app.tsx (115b), src/index.html (289b), src/lib/api.ts (3489b), src/lib/board.ts (1956b), src/lib/config.ts (1630b), src/lib/visitor.ts (701b), src/pages/index/index.config.ts (78b), src/pages/index/index.css (5322b), src/pages/index/index.tsx (13860b), tests/e2e/h5-browser.spec.ts (6195b), tests/frontend/board.test.ts (1155b), tests/frontend/visitor.test.ts (3738b), tests/test_api.py (15413b), tests/test_coordinates.py (9146b), tests/test_feishu_bot.py (12502b), tests/test_go_board_recognition.py (3019b), tsconfig.json (358b), vitest.config.ts (138b), _meta.json (132b)\n\nFile v0.0.14:SKILL.md\n\n---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config katago/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor photo input, the tool should surface the combined original-photo result by default. It is the verification/result image: existing white stones are marked with black `W`, existing black stones are marked with white `B`, and the recommended move is drawn as a new stone with the numbered label `1`. This makes recognition mistakes easier to spot and leaves room for future multi-step labels. Use `--result-image` only when you explicitly want the clean warped-board rendering.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the original recognized board in `base_board_ascii`, stores confirmed post-photo moves in `move_overlays`, sends the composed board in `board_ascii` to KataGo, and draws all confirmed moves plus the new recommendation in `display_move_overlays`. Do not use this mode after captures; re-shoot/reset the board and analyze one move from the new photo.\n\nCoordinates default to standard GTP letters, which skip `I`. When the user's physical board uses sequential `A-S` letters including `I`, pass `--coordinate-style sequential`. Use that same style for every `--move-overlay`; the returned recommendation, candidate moves, PVs, explanations, and numbered overlays will use it consistently. KataGo communication remains GTP internally.\n\nFor an already recognized board:\n\n```bash\npython3 scripts/next_move.py /path/to/board_ascii.txt \\\n  --input ascii \\\n  --side-to-move white \\\n  --level beginner\n```\n\n`board_ascii` is 19 rows of 19 characters:\n\n- `X` or `B`: black stone\n- `O` or `W`: white stone\n- `.`: empty point\n\nThe script returns JSON containing:\n\n- `board_ascii`\n- `coordinate_style`\n- `base_board_ascii`\n- `move_overlays`\n- `display_move_overlays`\n- `recommendation`\n- `reason`\n- `recommendations_by_level`\n- `candidate_moves`\n- `root_info`\n- optional `result_image` when `--result-image` is passed\n- default `source_result_image` for photo input, or optional `source_result_image` when `--source-result-image` is passed explicitly\n- optional `recognition` metadata when input is an image\n\n## Playing-Strength Levels\n\nThe level controls move strength, not explanation depth.\n\n- Beginner: choose a plausible but intentionally softer move from KataGo's candidates. It should usually be playable, but may lose several points compared with the best move.\n- Intermediate: choose a solid near-top candidate. It should be close to the best move but not always the engine's first choice.\n- Advanced: choose KataGo's top searched candidate.\n\nUse `--level all` when the caller wants all three recommendations at once. Use `recommendation` for the selected level and `recommendations_by_level` to compare the three outputs.\n\nThe current script chooses levels by candidate rank plus score/winrate loss from KataGo's best move. These thresholds are a practical first pass, not calibrated ranks. The next improvement should tune them with real game examples.\n\n## User-Facing Response\n\nWhen answering a user, include:\n\n1. The recommended coordinate.\n2. The generated `source_result_image` for photo input, or `result_image` for ASCII input.\n3. Why this move was chosen, using `reason.summary` plus the bullet-like items in `reason.explanation`.\n4. Technical parameters from `reason.technical_parameters`, especially winrate, score lead, visits, score loss vs best, and PV.\n5. Candidate comparison from `reason.comparison_candidates` when there are meaningful alternatives.\n6. The `recognition.source_overlay` image when available.\n7. A recognition caveat if the rendered board or source overlay does not match the real photo.\n\nDo not only return the coordinate. The user-facing answer should always include enough engine data to audit the recommendation: winrate, score lead, visits, and whether the chosen move is the top KataGo move or a deliberately softer level-based move.\n\nDo not invent tactical explanations that are not supported by KataGo data or visible board context. If recognition looks wrong, say the recommendation is not reliable until the board is corrected.\n\n## Notes\n\n- Do not rely on the language model alone for high-strength move choice.\n- Use KataGo for candidate moves; use the requested level to choose the playing strength of the move.\n- A board photo usually does not prove whose turn it is. Ask or require the side to move unless the surrounding context makes it clear.\n- Use `--move-overlay` only for no-capture continuation. If there are captures, ko/state ambiguity, or an overlay point is occupied, ask the user to re-shoot/reset the board and analyze one move.\n- If board recognition is uncertain, surface the uncertainty before giving a move recommendation.\n- White-stone classification includes center low-saturation and center/ring contrast checks to reduce false positives from glare or bright wood grain.\n\nFile v0.0.14:integrations/feishu/README.md\n\n# 围棋下一手推荐飞书图片机器人\n\n## 围棋高参（飞书机器人）\n\n你可以直接使用围棋高参飞书机器人，无需本地部署：\n\nhttps://applink.feishu.cn/T97DbgVIGt1W\n\n![围棋高参二维码](./weiqi-gaocan-qr.png)\n\n## 使用流程\n\n这是 Go Next Move skill 的可选飞书入口，不会替换或修改原有 CLI skill。\n\n机器人使用飞书长连接模式：iMac 主动连出到飞书，不需要公网 webhook 服务或公网隧道。实际识别和 KataGo 分析由本机 FastAPI 服务完成；飞书机器人只负责收图、调用 `http://127.0.0.1:8000`、再把结果发回飞书。\n\n运行更新边界：\n\n- 飞书机器人依赖 FastAPI 服务；它不是识别/推荐/绘图执行者。\n- 修改识别、推荐、结果图绘制、API 或 KataGo 相关代码后，只需要重启 FastAPI。不要因此重启飞书机器人。\n- 只有修改 `integrations/feishu/feishu_image_bot.py`、飞书配置、环境变量，或飞书长连接异常时，才重启飞书机器人。\n\n1. 先发送一次设置消息，例如：\n\n```text\n设置 黑 中级\n```\n\n2. 之后直接发送棋盘照片。机器人会下载图片，调用本机 FastAPI 服务，再回复推荐落点和结果图。\n\n设置按飞书用户 ID 保存在本地 JSON 文件中，默认路径是 `~/.go-next-move/feishu-settings.json`。只发送部分设置时会保留其他旧值；例如 `设置 白` 只会修改轮到白棋下。\n\n## 命令\n\n```text\n设置 黑 中级\n设置 白 高级\n设置 白\n设置 高级\n设置 black beginner\n当前设置\n上报\n帮助\n```\n\n支持的行棋方：\n\n- `黑`, `黑棋`, `black`, `b`\n- `白`, `白棋`, `white`, `w`\n\n支持的推荐强度：\n\n- `初级`, `beginner`\n- `中级`, `intermediate`\n- `高级`, `advanced`\n\n如果最近一次识别图或结果图有问题，发送 `上报`、`报错`、`识别错` 或 `反馈`。配置了 `FEISHU_FEEDBACK_DIR` 后，机器人会把当前会话最近一次成功分析的数据保存到该目录下，包含 `input.jpg`、`output.jpg` 和 `metadata.json`。\n\n## 部署\n\n安装依赖：\n\n```bash\npython3 -m pip install -r scripts/requirements.txt\npython3 -m pip install -r integrations/feishu/requirements.txt\n```\n\n创建一个飞书应用，并启用机器人长连接模式。\n\n需要开通的飞书权限：\n\n- `im:message.p2p_msg:readonly`：接收发给机器人的私聊消息。\n- `im:message.group_at_msg:readonly`：接收群聊中 @ 机器人的消息。\n- `im:message.group_at_msg.include_bot:readonly`：接收包含机器人消息的群聊 @ 消息。\n- `im:message`：读取消息事件所需的消息元数据和内容。\n- `im:message:send_as_bot`：以机器人身份发送回复。\n- `im:resource`：下载收到的图片，并上传输出的标注结果图。\n\n修改权限或事件订阅后，需要发布新的应用版本，并在租户内升级或安装该版本；只改开发配置不会立即生效。\n\n可以在飞书控制台导入下面的权限 JSON：\n\n```json\n{\n  \"scopes\": {\n    \"tenant\": [\n      \"im:message\",\n      \"im:message.group_at_msg.include_bot:readonly\",\n      \"im:message.group_at_msg:readonly\",\n      \"im:message.p2p_msg:readonly\",\n      \"im:message:send_as_bot\",\n      \"im:resource\"\n    ],\n    \"user\": [\n      \"im:resource\"\n    ]\n  }\n}\n```\n\n需要订阅的事件：\n\n- `im.message.receive_v1`：接收用户发来的消息。\n\n运行：\n\n```bash\ncat > .env.feishu <<'EOF'\nFEISHU_APP_ID=cli_xxx\nFEISHU_APP_SECRET=xxx\nGO_NEXT_MOVE_API_BASE_URL=http://127.0.0.1:8000\nFEISHU_FEEDBACK_DIR=/path/to/local/feedback-data\nEOF\n\npython3 integrations/feishu/feishu_image_bot.py\n```\n\nKataGo 相关环境变量应配置给 FastAPI 服务，而不是飞书机器人：\n\n```bash\nKATAGO_PATH=/path/to/katago \\\nKATAGO_MODEL=/path/to/model.bin.gz \\\nKATAGO_ANALYSIS_CONFIG=/path/to/analysis_example.cfg \\\nKATAGO_SKILL_CONFIG=katago/analysis_skill.cfg \\\npython3 -m uvicorn api.app:create_app --factory --host 0.0.0.0 --port 8000\n```\n\n### macOS launchd 性能设置\n\n如果用 `launchd` 常驻运行飞书机器人，不要把 plist 的 `ProcessType`\n设为 `Background`。macOS 会降低后台任务的 CPU/QoS，OpenCV 的棋盘候选\ngrid fitting 会明显变慢；实测同一张 1080x1920 棋盘图的识别时间可能从约\n1 秒放大到约 6 秒。\n\n建议使用 `Interactive`，或直接省略 `ProcessType`：\n\n```xml\n<key>ProcessType</key>\n<string>Interactive</string>\n```\n\n重启后可以检查：\n\n```bash\nlaunchctl print gui/$(id -u)/com.wanghongbao.go-next-move.feishu-bot\n```\n\n输出里应看到 `spawn type = interactive`，而不是 `background`。\n\n常用选项：\n\n```bash\npython3 integrations/feishu/feishu_image_bot.py \\\n  --level intermediate \\\n  --side-to-move black \\\n  --api-base-url http://127.0.0.1:8000 \\\n  --feedback-dir /path/to/local/feedback-data \\\n  --settings-path ~/.go-next-move/feishu-settings.json\n```\n\n`--api-base-url` 默认读取 `GO_NEXT_MOVE_API_BASE_URL`，未设置时使用 `http://127.0.0.1:8000`。\n\n`--feedback-dir` 默认读取 `FEISHU_FEEDBACK_DIR`；不配置时会关闭显式错误样本上报。\n\n如果机器人能收到图片消息，但分析时报 API 连接失败，请先确认 FastAPI 正在运行，并且 `GO_NEXT_MOVE_API_BASE_URL` 指向同一台机器上的服务，例如 `http://127.0.0.1:8000`。如果 FastAPI 日志里显示找不到 KataGo，再把 `KATAGO_PATH`、`KATAGO_MODEL` 等变量配置到 FastAPI 启动命令里。\n\n## 注意事项\n\n- 机器人使用现有 OpenCV 图片识别链路，不经过 LLM。\n- 如果棋盘识别不准，请发送更清晰的照片。该集成保持原有“一张照片分析一步”的行为，暂不支持提子状态修正或多手 overlay。\n- 群聊通常需要 @ 机器人，具体取决于飞书应用的事件和权限设置。机器人自身没有强制要求 @，因为图片消息通常不方便同时携带文本。\n- 如果本地日志只有 WebSocket `ping`/`pong`，而飞书事件日志为空，请优先检查私聊权限 `im:message.p2p_msg:readonly` 和群聊 @ 权限 `im:message.group_at_msg:readonly`。这种现象通常表示飞书没有权限为应用生成消息事件，而不是 Python 进程异常。\n\nFile v0.0.14:README.md\n\n# 围棋下一手推荐 Skill\n\n[English README](README.en.md)\n\n这是一个用于围棋 / Weiqi 的下一手推荐工具。它可以从棋盘图片或文本棋盘中识别当前局面，调用本地 KataGo 分析候选点，并按指定的**落子强度级别**选择下一手。\n\n这里的 `初级`、`中级`、`高级` 指的是推荐手的强度，不是解释的深浅。这样可以在不同水平的对局里，让 AI 给出更适合对手水平的下一手，帮助对局更接近势均力敌。\n\n## 功能\n\n- 将 19 路围棋棋盘图片识别成 `board_ascii` 二维棋盘。\n- 支持直接输入已有的 `board_ascii` 文本棋盘。\n- 使用本地 KataGo 进行下一手分析。\n- 输出 JSON，包含当前级别推荐手、三档级别推荐、候选手和根节点评估。\n- H5 和飞书默认使用图片坐标轴对应的连续坐标，也支持切换到 GTP 坐标。\n- 可选生成识别校验图，方便人工检查棋子识别是否准确。\n- 支持在不重新拍照的情况下追加“AI 推荐”和“人工录入”的无提子落子历史，并在结果图上连续编号。\n\n## 推荐部署方式：飞书图片机器人\n\n推荐优先使用[飞书图片机器人部署方式](./integrations/feishu/README.md)。它通过飞书长连接接收棋盘照片，再调用本机 FastAPI 服务完成识别和 KataGo 分析；不需要公网 webhook 服务或隧道，KataGo 模型也只由 FastAPI 加载一份。\n\n已可直接体验的围棋高参飞书机器人（无须自行部署）：[https://applink.feishu.cn/T97DbgVIGt1W](https://applink.feishu.cn/T97DbgVIGt1W)\n\n## 环境要求\n\n- Python 3.10+\n- 本地已安装 KataGo\n- KataGo 模型文件\n- Python 依赖：\n\n```bash\npython3 -m pip install -r scripts/requirements.txt\n```\n\nH5 / 小程序 API 服务还需要：\n\n```bash\npython3 -m pip install -r api/requirements.txt\nnpm install\n```\n\n本地开发常用命令：\n\n```bash\nuvicorn api.app:create_app --factory --host 127.0.0.1 --port 8000\nnpm run dev:h5\nnpm run build:h5\nnpm run build:weapp\nnpm run test:api\nnpm run test:frontend\nnpm run test:e2e\n```\n\nH5 + 飞书同时运行时，推荐把 FastAPI 作为唯一分析入口。最终在 iMac 上常驻 4 个进程：\n\n1. H5 页面服务。\n2. FastAPI 服务。\n3. FastAPI 启动并持有的 KataGo analysis 子进程。\n4. 飞书长连接机器人。\n\nKataGo 模型只由 FastAPI 加载一份，飞书机器人通过本机 `localhost` 调 FastAPI。\n\nH5 / 飞书服务运行更新边界：\n\n- 识别、推荐、结果图绘制、KataGo 配置等后端逻辑都在 FastAPI 进程里；更新这些代码后只需要重启 FastAPI，FastAPI 会重新持有 KataGo analysis 子进程。\n- 飞书机器人只是长连接消息收发器和 HTTP 客户端，通过 `GO_NEXT_MOVE_API_BASE_URL` 调 FastAPI；除非修改 `integrations/feishu/feishu_image_bot.py`、飞书配置或长连接状态异常，不要因为后端识别/绘图改动重启飞书机器人。\n- 直接使用本仓库 skill/CLI 时是调用脚本本身，不需要 FastAPI 或飞书机器人。\n\n```bash\n# 1. FastAPI，负责唯一的识别/分析/历史入口，并持有常驻 KataGo\nKATAGO_PATH=/path/to/katago \\\nKATAGO_MODEL=/path/to/model.bin.gz \\\nKATAGO_ANALYSIS_CONFIG=/path/to/analysis_example.cfg \\\nKATAGO_SKILL_CONFIG=katago/analysis_skill.cfg \\\npython3 -m uvicorn api.app:create_app --factory --host 0.0.0.0 --port 8000\n```\n\n```bash\n# 2. H5 页面服务。开发期可直接 watch；手机访问 http://iMac局域网IP:10086/\nnpm run dev:h5 -- --host 0.0.0.0\n```\n\n```bash\n# 3. 飞书机器人，只收发飞书消息，不再自己启动 KataGo\nGO_NEXT_MOVE_API_BASE_URL=http://127.0.0.1:8000 \\\npython3 integrations/feishu/feishu_image_bot.py\n```\n\n本项目首先在 macOS + Homebrew KataGo 下测试：\n\n```bash\nbrew install katago\nkatago version\n```\n\n脚本默认使用 Homebrew 自带模型路径：\n\n```text\n/opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz\n```\n\n如果你的模型在其他位置，运行时传入：\n\n```bash\n--model /path/to/model.bin.gz\n```\n\n## 图片输入\n\n示例输入：\n\n![围棋棋盘照片输入](./docs/examples/input-board.jpg)\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\n`--source-overlay` 会在原照片上标出识别到的棋子和棋盘边界，适合给用户检查识别是否正确。对照片输入来说，工具默认也会生成一张合并后的原图结果：已有白子用黑色 `W` 标记，已有黑子用白色 `B` 标记；新推荐落点会画出对应颜色的新棋子，并在新棋子上写序号 `1`。如果你还想要干净棋盘图，可以显式传 `--result-image`；`--overlay` 是透视矫正后的棋盘裁切图，主要用于调试。\n\n示例输出：\n\n| 识别校验图 | 原图推荐结果 |\n| --- | --- |\n| ![识别校验图，标出棋盘边界和识别到的棋子](./docs/examples/recognition-overlay.jpg) | ![原照片上的下一手推荐结果](./docs/examples/recommendation-source-result.jpg) |\n\n| 透视矫正后的识别校验 | 干净棋盘结果图 |\n| --- | --- |\n| ![透视矫正后的棋盘识别校验图](./docs/examples/recognition-warped-overlay.jpg) | ![干净棋盘上的下一手推荐结果](./docs/examples/recommendation-clean-board.jpg) |\n\n上面的示例来自 `./docs/examples/input-board.jpg`。在该局面中以白棋行棋、`--level all --visits 80` 运行时，示例结果推荐白棋走 `L5`。实际推荐会随模型、访问数和配置略有变化。\n\n## 坐标格式\n\nH5 和飞书默认使用包含 `I` 的连续坐标，匹配图片上的 `A-S` 坐标轴：\n\n```bash\n--coordinate-style sequential\n```\n\n命令行脚本仍可显式使用标准 GTP 坐标，列字母跳过 `I`：\n\n```bash\n--coordinate-style gtp\n```\n\n如果实体棋盘使用包含 `I` 的连续字母 `A-S`，请传：\n\n```bash\n--coordinate-style sequential\n```\n\n例如，同一个第 9 列落点在 GTP 格式中是 `J4`，在连续字母格式中是 `I4`；第 19 列分别是 `T4` 和 `S4`。KataGo 通信始终使用 GTP 坐标，但 `--move-overlay` 输入、JSON 输出、推荐说明和主变化会统一采用所选格式。一次调用不要混用两种格式。\n\n## 无提子连续推理\n\n如果拍照后没有发生提子，可以把后续已确认落子作为 overlay 追加进去。原始图片识别状态会保留在 `base_board_ascii`，追加落子保存在 `move_overlays`，实际送入 KataGo 的合成局面保存在 `board_ascii`。\n\n参数格式：\n\n```text\n--move-overlay source:color:move:label\n```\n\n- `source`：`ai` 或 `user`\n- `color`：`B` / `black` / `黑`，或 `W` / `white` / `白`\n- `move`：所选坐标格式中的落点，例如 `Q4`\n- `label`：图片上显示的手数序号\n\n示例：白棋第一手是 AI 推荐，黑棋第二手是人工录入，然后继续推白棋第三手：\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --coordinate-style sequential \\\n  --move-overlay ai:W:I4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\n脚本会检查这些追加落点在合成过程中必须为空；如果目标点已有棋子，说明坐标、识别或局面状态不一致。发生提子时不要用追加历史，重新拍照重置棋盘，只推理一步。\n\n如果自动识别棋盘不准，可以手动传四个棋盘角点：\n\n```bash\npython3 scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --corners \"74,76 1100,53 1118,1031 72,1034\"\n```\n\n如果传入的是四个最外侧网格交叉点，而不是木质棋盘边角，再加：\n\n```bash\n--grid-corners\n```\n\n## 文本棋盘输入\n\n`board_ascii` 每行表示棋盘一行：\n\n```text\n...................\n...................\n...................\n...X...............\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...................\n...............O...\n...................\n...................\n...................\n```\n\n字符含义：\n\n- `X` 或 `B`：黑棋\n- `O` 或 `W`：白棋\n- `.`：空点\n\n运行：\n\n```bash\npython3 scripts/next_move.py board_ascii.txt \\\n  --input ascii \\\n  --side-to-move black \\\n  --level beginner \\\n  --result-image /tmp/go-next-result.jpg\n```\n\n也可以从 stdin 输入：\n\n```bash\ncat board_ascii.txt | python3 scripts/next_move.py \\\n  --input ascii \\\n  --side-to-move white \\\n  --level all\n```\n\n## 落子强度级别\n\n- `beginner` / `初级`：选择一个能下但刻意更温和的 KataGo 候选手。\n- `intermediate` / `中级`：选择一个接近最优的稳健候选手，但不总是第一推荐。\n- `advanced` / `高级`：选择 KataGo 搜索排序第一的最强候选手。\n- `all` / `全部`：同时返回三档级别推荐，方便比较。\n\n当前分级策略使用候选手排序、相对最强手的目数损失和胜率损失来选择。这是第一版实用策略，不是严格校准过的段位模型。\n\n## 输出\n\n脚本输出 JSON。重要字段：\n\n- `recommendation`：按 `--level` 选出的推荐手\n- `coordinate_style`：本次输入和输出使用的坐标格式\n- `base_board_ascii`：原始图片或文本输入识别出的棋盘，不包含拍照后的追加落子\n- `move_overlays`：已确认的拍照后落子历史，例如 AI 推荐和人工录入\n- `display_move_overlays`：用于结果图绘制的落子序号，包含已确认历史和本次新推荐\n- `reason.summary`：一句话推荐结论\n- `reason.explanation`：为什么这么走，包含强度选择、搜索访问数、胜率/目差、主变化和候选手取舍\n- `reason.technical_parameters`：技术参数，包含根节点评估、推荐手评估、搜索第一候选、胜率、目差、访问数、prior、LCB、PV 等\n- `reason.comparison_candidates`：前几个替代候选手，以及相对推荐手/搜索第一候选的损失\n- `recommendations_by_level`：初级、中级、高级三档推荐\n- `candidate_moves`：KataGo 候选手，包含 visits、winrate、score lead 和 PV\n- `root_info`：KataGo 根节点评估\n- `board_ascii`：实际送入 KataGo 的棋盘\n- `recognition`：图片识别元数据，仅图片输入时存在\n- `result_image`：带推荐落点标记的结果图路径，仅在你显式传入 `--result-image` 时存在\n- `source_result_image`：照片输入时默认生成的原照片合并图路径，已有棋子用 B/W 文字标记，推荐落点用带序号 `1` 的新棋子标记\n- `recognition.source_overlay`：原照片识别校验图路径，仅传入 `--source-overlay` 时存在\n\n输出形状示例：\n\n```json\n{\n  \"requested_level\": \"intermediate\",\n  \"recommendation\": {\n    \"move\": \"Q4\",\n    \"strength_level\": \"intermediate\",\n    \"score_loss_vs_best\": 0.8,\n    \"winrate_loss_vs_best\": 0.03\n  },\n  \"reason\": {\n    \"summary\": \"建议白棋走 Q4。这是按中级强度选择的近似最优候选手。主变化参考：Q4 -> D16 -> C17。\",\n    \"explanation\": [\n      \"选择依据：中级强度：优先选择接近最优、但不一定是第一推荐的稳健候选手。\",\n      \"局面评估：胜率 54.2%，预估目差 +1.6。\"\n    ],\n    \"main_variation\": [\"Q4\", \"D16\", \"C17\"],\n    \"technical_parameters\": {\n      \"engine\": \"KataGo\",\n      \"rules\": \"Chinese\",\n      \"recommended_move\": {\n        \"move\": \"Q4\",\n        \"visits\": 138,\n        \"winrate_percent\": \"54.2%\",\n        \"score_lead_points\": \"+1.6\",\n        \"score_loss_vs_best\": 0.8\n      }\n    }\n  },\n  \"recommendations_by_level\": {\n    \"beginner\": {},\n    \"intermediate\": {},\n    \"advanced\": {}\n  }\n}\n```\n\n## 只做棋盘识别\n\n如果只想把图片转成二维棋盘：\n\n```bash\npython3 scripts/go_board_recognition.py /path/to/board.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg\n```\n\n识别校验图会标出棋盘边界和识别到的黑白棋，效果可参考上面的 `识别校验图`。\n\n## 注意\n\n- 单张棋盘图片通常无法判断轮到谁下，所以必须传 `--side-to-move`。\n- 图片模糊、倾斜、裁切、有覆盖标记时，识别可能出错。重要局面建议检查 `--overlay` 输出。\n- `--move-overlay` 只适合无提子连续推理；有提子、打劫或任何局面不一致时，重新拍照重置。\n- 白棋识别不只看亮度，还会检查中心低饱和和中心/外环对比，以减少亮木纹或反光空点被误判成白子的情况。\n- 如果想要最强推荐，用 `--level advanced`，并适当增大 `--visits`。\n\n## License\n\n本项目使用 [Creative Commons Attribution-NonCommercial 4.0 International](LICENSE) 许可。你可以复制、分享、修改和再发布，但需要保留署名，且不能用于商业用途。\n\nFile v0.0.14:_meta.json\n\n{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.0.14\",\n  \"publishedAt\": 1783307034532\n}\n\nFile v0.0.14:scripts/requirements.txt\n\nnumpy>=1.26\nopencv-python-headless>=4.8\npillow>=10\n\nFile v0.0.14:CONTEXT.md\n\n# Go Next Move\n\nThis context describes the product language for Go next-move recommendation across Feishu, H5, and mini program entry points.\n\n## Language\n\n**Analysis Session**:\nA user's work item that starts from one uploaded board position and may contain one or more recommendation steps.\n_Avoid_: Record, history item\n\n**Analysis Step**:\nOne recommendation result within an analysis session, including the side to move, strength level, generated images, and engine result for that moment.\n_Avoid_: Sub-record, run\n\n**Visitor**:\nAn anonymous H5 user identified by a browser-stored visitor id.\n_Avoid_: Guest account, temporary user\n\n**Identity**:\nA platform-provided user identifier connected to an internal user.\n_Avoid_: Account provider, login source\n\n**Strength Level**:\nThe user-facing recommendation strength: beginner, intermediate, or advanced.\n_Avoid_: Rank, explanation depth, difficulty\n\n**Continuation**:\nA no-capture virtual follow-up from an existing analysis session, used to understand a recommendation by exploring later moves on the digital board.\n_Avoid_: Full game record, SGF editing\n\n**Digital Board**:\nThe rendered 19x19 board derived from recognized board state and continuation overlays.\n_Avoid_: Original photo, board editor\n\n**Source Result Image**:\nThe original uploaded board photo annotated with recognized stones and the recommended move.\n_Avoid_: Overlay, clean board image\n\n## Service Runtime Notes\n\nThese notes apply to the H5/Feishu service deployment, not to the direct CLI skill path.\n\nIn the service deployment, FastAPI owns recognition, recommendation, result-image drawing, and the resident KataGo analysis process. Feishu is a long-connection message adapter and HTTP client that calls FastAPI through `GO_NEXT_MOVE_API_BASE_URL`.\n\nWhen changing recognition, recommendation, result-image drawing, API, or KataGo-related code for the service, restart FastAPI only. Do not restart the Feishu bot unless the bot code/configuration itself changed or the Feishu long connection is unhealthy.\n\nFile v0.0.14:docs/h5-miniapp-issues.md\n\n# H5 and Mini Program Issue Breakdown\n\nThese issues are drafted as vertical slices from `docs/h5-miniapp-plan.md` and have been published to GitHub.\n\nParent PRD: [#17](https://github.com/imcaptor/go-next-move-skill/issues/17)\n\nPublished slices:\n\n- [#18](https://github.com/imcaptor/go-next-move-skill/issues/18): Scaffold FastAPI and Taro walking skeleton.\n- [#19](https://github.com/imcaptor/go-next-move-skill/issues/19): Collapse move strength to three levels across CLI and Feishu.\n- [#20](https://github.com/imcaptor/go-next-move-skill/issues/20): Add FastAPI synchronous analysis endpoint with local persistence.\n- [#21](https://github.com/imcaptor/go-next-move-skill/issues/21): Build H5 upload-to-result flow.\n- [#22](https://github.com/imcaptor/go-next-move-skill/issues/22): Add recent session history and cleanup.\n- [#23](https://github.com/imcaptor/go-next-move-skill/issues/23): Add rate limits, feedback reporting, and minimal admin review.\n- [#24](https://github.com/imcaptor/go-next-move-skill/issues/24): Add digital-board continuation for no-capture follow-ups.\n- [#25](https://github.com/imcaptor/go-next-move-skill/issues/25): Add WeChat mini program build and identity.\n\n## 0. Scaffold the FastAPI and Taro walking skeleton\n\n**Blocked by**: None\n\n**User stories covered**:\n\n- As a developer, I can run the backend and H5 frontend locally before product features are built.\n- As an operator, I can verify that the iMac-hosted service is alive through a simple endpoint.\n- As a tester, I can open the H5 app in an ordinary browser, so that automated tests do not depend on WeChat.\n\n### What to build\n\nCreate the minimal project structure and development loop for the H5/mini program product: a FastAPI app with health/config endpoints, a Taro + React client that can build for H5, local environment configuration, and documentation for running both pieces locally. The H5 shell must work in an ordinary browser as well as WeChat's in-app browser. This issue should avoid implementing photo analysis, history, admin, or continuation behavior.\n\n### Acceptance criteria\n\n- [ ] FastAPI app starts locally and exposes a health endpoint.\n- [ ] Taro + React app starts locally as H5 and renders an app shell.\n- [ ] Client can call the backend health endpoint through configured API base URL.\n- [ ] H5 app shell works in an ordinary browser without WeChat APIs.\n- [ ] Local configuration is documented without committing secrets.\n- [ ] Project scripts or documented commands cover backend dev, frontend dev, and basic smoke checks.\n\n## 1. Collapse move strength to three levels across CLI and Feishu\n\n**Blocked by**: None\n\n**User stories covered**:\n\n- As a user, I can choose beginner, intermediate, or advanced without seeing an obsolete expert level.\n- As an operator, I get predictable KataGo visit budgets for each product strength level.\n\n### What to build\n\nRemove the public `expert` / `特级` strength level and make the product use exactly three levels everywhere: beginner at 100 visits, intermediate at 250 visits, and advanced at 400 visits. CLI behavior, Feishu commands, Feishu help text, README documentation, and tests should all agree.\n\n### Acceptance criteria\n\n- [ ] CLI rejects or no longer advertises `expert` / `特级`.\n- [ ] Feishu commands and help text only show beginner, intermediate, and advanced.\n- [ ] Feishu visit budgets are 100, 250, and 400.\n- [ ] `--level all` returns only the three supported levels.\n- [ ] README and tests are updated to the three-level model.\n\n## 2. Add a FastAPI synchronous analysis endpoint with local persistence\n\n**Blocked by**: Issue 0, Issue 1\n\n**User stories covered**:\n\n- As an H5 visitor, I can upload a board photo and receive a recommendation from the backend.\n- As an operator, I can keep recent analysis data and images on the iMac for debugging and history.\n\n### What to build\n\nAdd a FastAPI service that accepts a board image, side to move, strength level, and coordinate style, runs the existing recognition and KataGo analysis synchronously, stores the original image, generated images, result JSON, and first analysis step locally, and returns a structured response.\n\n### Acceptance criteria\n\n- [ ] `POST /api/analyses` accepts image upload plus settings and returns a completed first step.\n- [ ] The service stores analysis session and step metadata in SQLite.\n- [ ] The service stores original and generated images under local storage.\n- [ ] Responses expose recommendation, source result image reference, elapsed time, settings, candidate summary, and step/session ids.\n- [ ] Errors from recognition, KataGo, invalid settings, or timeouts return structured user-facing failures.\n\n## 3. Build the H5 upload-to-result flow\n\n**Blocked by**: Issue 0, Issue 2\n\n**User stories covered**:\n\n- As a WeChat H5 visitor, I can open the page, upload or take a photo, and see where to play.\n- As a normal browser visitor, I can open the same H5 page for testing and use a random anonymous id.\n- As a visitor, I can use the product without creating an account.\n\n### What to build\n\nCreate the Taro + React H5 flow for anonymous visitors: random visitor id creation/persistence, settings selection, photo upload, loading state, synchronous API call, and result page rendering with source result image and structured recommendation details. The flow must work in both WeChat's in-app browser and ordinary browsers used for development and automated testing.\n\n### Acceptance criteria\n\n- [ ] H5 stores and reuses a visitor id.\n- [ ] Ordinary browser visits generate and persist a random visitor id without requiring WeChat APIs.\n- [ ] Home page supports photo upload or camera capture in mobile WeChat.\n- [ ] Home page supports fixture/manual image upload in ordinary browsers for testing.\n- [ ] User can set side to move, strength level, and coordinate style before analysis.\n- [ ] Result page shows recommendation coordinate, source result image, elapsed time, search budget, and settings.\n- [ ] Details section shows candidate/technical information without crowding the first screen.\n- [ ] The flow handles backend errors and timeouts gracefully.\n\n## 4. Add recent session history and cleanup\n\n**Blocked by**: Issue 2, Issue 3\n\n**User stories covered**:\n\n- As a visitor, I can return to recent analyses from the same browser.\n- As an operator, old anonymous images do not grow forever on disk.\n\n### What to build\n\nExpose recent analysis sessions through the API and H5 UI, model history as sessions with steps, and add scheduled cleanup that keeps the latest 20 sessions per visitor/user and deletes anonymous sessions after 30 days without access or update.\n\n### Acceptance criteria\n\n- [ ] `GET /api/analyses` returns recent sessions for the current visitor/user.\n- [ ] `GET /api/analyses/{session_id}` returns a session with its steps.\n- [ ] H5 history page lists recent sessions rather than individual steps.\n- [ ] Cleanup runs every 2 hours while the service is running.\n- [ ] Cleanup deletes database rows and image files together.\n- [ ] Anonymous sessions expire after 30 days without access or update.\n\n## 5. Add rate limits, feedback reporting, and minimal admin review\n\n**Blocked by**: Issue 2, Issue 4\n\n**User stories covered**:\n\n- As an operator, I can prevent accidental or abusive KataGo usage.\n- As a user, I can report recognition or result issues.\n- As an operator, I can inspect recent analyses and reported samples.\n\n### What to build\n\nAdd visitor/IP/user rate limits, a feedback endpoint for analysis steps, and a minimal password-protected admin surface showing recent analyses, feedback samples, daily call counts, storage usage, and a manual cleanup action.\n\n### Acceptance criteria\n\n- [ ] Anonymous visitors are limited to 30 analyses per day.\n- [ ] IP addresses are limited to 60 analyses per hour.\n- [ ] Mini program users are limited to 50 analyses per day once identity exists.\n- [ ] Continuation requests count against analysis limits.\n- [ ] Users can report a specific session step.\n- [ ] Admin can view recent analyses, feedback samples, daily counts, and storage usage.\n- [ ] Admin can trigger cleanup manually.\n\n## 6. Add digital-board continuation for no-capture follow-ups\n\n**Blocked by**: Issue 2, Issue 3, Issue 4\n\n**User stories covered**:\n\n- As a user who does not understand a recommendation, I can explore a few virtual follow-up moves.\n- As a user, I can interact on a precise digital board while still checking the original source result image.\n\n### What to build\n\nAdd continuation as a session-detail workflow. Render a Canvas digital board from recognized board state and overlays, let the user confirm the AI move and select an opponent move, create a new analysis step synchronously, and display numbered overlays for follow-up recommendations. Keep continuation explicitly limited to no-capture explanation.\n\n### Acceptance criteria\n\n- [ ] Digital board renders recognized stones, coordinate labels, and numbered overlays.\n- [ ] User can select only empty points.\n- [ ] User can undo the latest continuation input.\n- [ ] `POST /api/analyses/{session_id}/steps` creates a new step in the existing session.\n- [ ] Continuation preserves the original source result image for verification.\n- [ ] UI tells the user to retake a photo after captures or recognition mismatch.\n\n## 7. Add WeChat mini program build and identity\n\n**Blocked by**: Issue 3, Issue 4, Issue 5\n\n**User stories covered**:\n\n- As a WeChat mini program user, I can use the same upload, result, history, and feedback behavior with WeChat identity.\n- As an operator, H5 anonymous usage and mini program logged-in usage share one backend model.\n\n### What to build\n\nEnable the Taro client to build as a WeChat mini program, add WeChat login identity mapping, configure API/image access for the mini program environment, and verify that upload, result, history, feedback, and rate limits work with `user_id`.\n\n### Acceptance criteria\n\n- [ ] Taro mini program build succeeds.\n- [ ] Mini program login maps WeChat identity to internal `user_id`.\n- [ ] Mini program can upload photos and display result images through configured HTTPS endpoints.\n- [ ] Mini program history uses the same session/step model.\n- [ ] Mini program user rate limit is 50 analyses per day.\n- [ ] H5-specific anonymous visitor behavior does not leak into mini program users.\n\nFile v0.0.14:docs/h5-miniapp-plan.md\n\n# H5 and Mini Program Plan\n\n## Goal\n\nBuild a lower-friction H5 and WeChat mini program entry point for Go Next Move while keeping feature behavior aligned with the Feishu image bot. The first public product should let a user upload or take a board photo, choose side and strength, receive a marked recommendation image, review recent analysis history, and optionally continue a short no-capture virtual line on a digital board.\n\nThe product should use one shared backend and one cross-platform frontend codebase, compiled separately for H5 and the WeChat mini program.\n\n## Non-Goals\n\n- Do not build a full Go game editor or SGF product.\n- Do not support captures during continuation.\n- Do not build a heavy account system for H5 before the mini program exists.\n- Do not make result sharing a primary workflow.\n- Do not expose KataGo engine parameters beyond the product-level strength choices.\n\n## Entry Points\n\n### H5\n\nH5 is the first launch target because it avoids mini program review and can be distributed in WeChat while the domain备案 is in progress. It must also work in a normal desktop or mobile browser so development and automated tests do not depend on WeChat.\n\nH5 users are anonymous visitors. On first visit, the browser client should create or request a random `visitor_id` and persist it in cookie or local storage. That id is the visitor's unique marker for history, rate limits, and feedback until a stronger identity exists. H5 does not require login in the first version.\n\nAnonymous H5 history expires after 30 days without access or update.\n\n### WeChat Mini Program\n\nThe mini program should use WeChat login and map the platform identity to an internal `user_id`. It should share the same backend APIs and product behavior as H5.\n\n### Feishu\n\nFeishu remains a supported image-bot entry point. Product behavior should be aligned where practical, but H5 and the mini program may provide richer UI because they are not constrained by chat messages.\n\n## Product Scope\n\n### Main Flow\n\n1. User opens H5 or the mini program.\n2. User uploads or takes a board photo.\n3. User chooses side to move, strength level, and coordinate style.\n4. Backend analyzes the position synchronously.\n5. UI shows the recommendation coordinate, source result image, elapsed time, and current settings.\n6. User can report a recognition/result issue, view details, start a continuation, or analyze another photo.\n\n### Strength Levels\n\nThe product has exactly three strength levels:\n\n- Beginner: 100 visits.\n- Intermediate: 250 visits. This is the default.\n- Advanced: 400 visits.\n\nThe previous `expert` / `特级` level should be removed from Feishu, CLI documentation, and new product UI. There is no need to preserve compatibility because the product has not been publicly launched.\n\n### Settings\n\nVisible user settings:\n\n- Side to move: black or white.\n- Strength level: beginner, intermediate, advanced.\n- Coordinate style: sequential A-S by default, or GTP.\n\nHidden defaults:\n\n- Chinese rules.\n- Komi 7.5.\n\n### Result Page\n\nThe first screen should prioritize:\n\n1. Recommended side and coordinate.\n2. Source result image for visual verification.\n3. Strength, coordinate style, elapsed time, and search budget.\n4. Actions: analyze another photo, view details, continue a few moves, report an issue.\n\nFeishu's text reply should be converted into structured UI rather than copied as one large text block. Candidate comparison, winrate, score lead, visits, PV, and technical details belong in a details section or drawer.\n\n### Continuation\n\nContinuation is an explanation aid, not the main play flow. It helps users understand a recommendation by exploring a few no-capture follow-up moves.\n\nBehavior:\n\n- The original source result image remains available for visual verification.\n- The interaction surface is the digital board, not the original photo.\n- The user can confirm the AI recommendation and select the opponent's next move on the digital board.\n- The system adds numbered overlays and returns the next recommendation.\n- The user can undo the latest continuation input.\n- If a capture happens, the user must take a new photo.\n- If recognition looks wrong, the user should not continue from that session.\n\nThe digital board should support rendering `board_ascii`, rendering numbered overlays, highlighting the latest recommendation, selecting an empty point, undoing the latest user input, and showing coordinates.\n\n## History\n\nHistory should be modeled as analysis sessions with child steps.\n\n- Keep the latest 20 analysis sessions per visitor or user.\n- Each session stores the original photo and original recognized board.\n- Each step stores side to move, strength level, move overlays, recommendation result, generated result image, elapsed time, and feedback state.\n- Continuation creates a new step in the same session rather than overwriting the original step.\n- The history list shows sessions, not every step as a separate top-level item.\n\nCleanup:\n\n- A cleanup thread runs every 2 hours.\n- For every visitor or user, keep only the latest 20 sessions.\n- Anonymous H5 sessions older than 30 days since last access/update are deleted.\n- Image files are deleted with their database records.\n\n## Rate Limits\n\nThe first version should include basic cost protection:\n\n- Anonymous H5 visitor: 30 analyses per day.\n- IP address: 60 analyses per hour.\n- Mini program user: 50 analyses per day.\n- Continuation counts as an analysis because it calls KataGo.\n- Admin or whitelist bypass should be possible.\n\n## Backend\n\nUse Python FastAPI because the existing recognition and analysis pipeline is already Python-based.\n\nFirst-version deployment runs on the local iMac and exposes the service through frp. The same iMac runs KataGo with the existing Metal setup.\n\nSuggested local paths:\n\n- SQLite database: `~/.go-next-move/app.sqlite3`.\n- Stored images: `~/.go-next-move/storage/`.\n\nThe first version can use local SQLite and local file storage. Object storage and a managed database can be added later if traffic requires them.\n\n### API Sketch\n\nCore user-facing endpoints:\n\n- `POST /api/analyses`: create an analysis session from an uploaded photo and return the first step result synchronously.\n- `GET /api/analyses`: list recent sessions.\n- `GET /api/analyses/{session_id}`: fetch a session and its steps.\n- `POST /api/analyses/{session_id}/steps`: create a continuation step.\n- `POST /api/analyses/{session_id}/steps/{step_id}/feedback`: report recognition or result issues.\n- `GET /api/images/{image_id}`: return an authorized image.\n\nAdmin endpoints:\n\n- `GET /admin`: recent operational summary.\n- `GET /admin/analyses`: recent analyses.\n- `GET /admin/feedback`: reported samples.\n- `POST /admin/cleanup`: run cleanup manually.\n\n### Synchronous Analysis\n\nThe first version should use synchronous requests with a loading state. Current analysis usually completes in 3-4 seconds, so an async job system is not necessary yet.\n\nGuardrails:\n\n- Frontend shows a loading state while the request is in flight.\n- Backend and frontend timeouts should allow roughly 20-30 seconds.\n- Failures return clear user-facing error states.\n- If timeouts or concurrency become a real problem, the API can evolve to queued asynchronous jobs later.\n\n## Frontend\n\nUse Taro + React for one source codebase compiled to H5 and WeChat mini program.\n\nPages:\n\n- Home / photo upload.\n- Result / session detail.\n- History.\n- Continuation digital board.\n- Settings.\n- Feedback entry.\n\nThe H5 build must run in ordinary browsers as well as WeChat's in-app browser. Ordinary browser support is required for local development, QA, and automated end-to-end tests. Browser-only testing should be able to create a random anonymous visitor id, upload a fixture image, and verify the result flow without WeChat APIs.\n\nThe admin UI can live outside the mini program package. It can be a small web-only route or simple FastAPI-rendered HTML.\n\n### Canvas Board\n\nImplement the digital board with Canvas.\n\nRequirements:\n\n- 19x19 responsive square board.\n- Sequential A-S coordinate labels by default.\n- Optional GTP coordinate labels.\n- Stone rendering from recognized board state.\n- Numbered overlays for AI and user continuation moves.\n- Latest recommendation highlight.\n- Empty-point hit testing.\n- Undo latest continu\n\nArchive v0.0.13: 45 files, 207803 bytes\n\nFiles: api/__init__.py (33b), api/app.py (29866b), api/requirements.txt (33b), config/index.ts (649b), CONTEXT.md (2031b), docs/h5-miniapp-issues.md (10322b), docs/h5-miniapp-plan.md (9638b), integrations/feishu/feishu_image_bot.py (41514b), integrations/feishu/README.md (6162b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), package-lock.json (479930b), package.json (1160b), playwright.config.ts (418b), project.config.json (292b), README.en.md (11133b), README.md (12980b), scripts/go_board_recognition.py (23213b), scripts/next_move.py (46598b), scripts/requirements.txt (51b), scripts/resident_katago.py (5159b), skill-card.md (2886b), SKILL.md (7577b), src/app.config.ts (135b), src/app.css (124b), src/app.tsx (115b), src/index.html (289b), src/lib/api.ts (3489b), src/lib/board.ts (1956b), src/lib/config.ts (1630b), src/lib/visitor.ts (701b), src/pages/index/index.config.ts (78b), src/pages/index/index.css (5322b), src/pages/index/index.tsx (13860b), tests/e2e/h5-browser.spec.ts (6195b), tests/frontend/board.test.ts (1155b), tests/frontend/visitor.test.ts (3738b), tests/test_api.py (15413b), tests/test_coordinates.py (9146b), tests/test_feishu_bot.py (12502b), tests/test_go_board_recognition.py (3019b), tsconfig.json (358b), vitest.config.ts (138b), _meta.json (132b)\n\nArchive v0.0.12: 16 files, 51102 bytes\n\nFiles: integrations/feishu/feishu_image_bot.py (38672b), integrations/feishu/README.md (5812b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), README.en.md (10950b), README.md (10902b), scripts/go_board_recognition.py (23213b), scripts/next_move.py (40478b), scripts/requirements.txt (51b), skill-card.md (2677b), SKILL.md (7577b), tests/test_coordinates.py (6194b), tests/test_feishu_bot.py (6649b), tests/test_go_board_recognition.py (2539b), _meta.json (132b)\n\nArchive v0.0.11: 16 files, 50696 bytes\n\nFiles: integrations/feishu/feishu_image_bot.py (38672b), integrations/feishu/README.md (5812b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), README.en.md (10950b), README.md (10902b), scripts/go_board_recognition.py (23213b), scripts/next_move.py (40478b), scripts/requirements.txt (51b), skill-card.md (2735b), SKILL.md (7664b), tests/test_coordinates.py (6194b), tests/test_feishu_bot.py (6649b), tests/test_go_board_recognition.py (2539b), _meta.json (132b)\n\nArchive v0.0.10: 16 files, 50652 bytes\n\nFiles: integrations/feishu/feishu_image_bot.py (38672b), integrations/feishu/README.md (5812b), integrations/feishu/requirements.txt (133b), katago/analysis_skill.cfg (400b), katago/gtp_skill.cfg (344b), README.en.md (10950b), README.md (10902b), scripts/go_board_recognition.py (23213b), scripts/next_move.py (40478b), scripts/requirements.txt (51b), skill-card.md (2613b), SKILL.md (7664b), tests/test_coordinates.py (6194b), tests/test_feishu_bot.py (6649b), tests/test_go_board_recognition.py (2539b), _meta.json (132b)","readmeExcerpt":"Skill: go-next-move Owner: imcaptor Summary: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Tags: go:0.0.7, katago:0.0.7, latest:0.1.2, weiqi:0.0.7 Version history: v0.1.2 | 2026-07-31T23:07:02.436Z | user Add opt-in host-agent recognition retry and candidate label capture for improving board recognition. v0.1.1 | 2026-07-31T02:18:05.892Z | user Impr","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python3 -m pip install -r {baseDir}/requirements.txt"},{"language":"bash","snippet":"katago version"},{"language":"text","snippet":"Using Metal backend"},{"language":"bash","snippet":"katago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg"},{"language":"gtp","snippet":"boardsize 19\nkomi 7.5\nclear_board\ngenmove b"},{"language":"bash","snippet":"python3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: go-next-move\ndescription: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。\nversion: 0.1.2\nmetadata: {\"openclaw\":{\"requires\":{\"bins\":[\"python3\",\"katago\"]}}}\n---\n\n# 围棋下一手推荐\n\n## 当前范围\n\n这个 skill 是独立于 `count-go-black-stones` 的围棋落点推荐层。\n\n预期流程：\n\n1. 将棋盘照片转换成 19 路局面。\n2. 在可能时询问或推断轮到黑棋还是白棋行棋。\n3. 使用中国规则和固定访问数预算，将局面发送给 KataGo。\n4. 根据用户请求的落子强度返回推荐手。\n5. 附带候选手和足够的分析数据，方便解释或复核选择。\n6. 对于无提子的连续推演，保留原始识别棋盘，并在询问下一手前叠加带编号的 AI/用户落子。\n\n## 安装与数据边界\n\n此 Skill 需要 Python 3.10 或更高版本。安装已锁定版本的 Python 依赖：\n\n```bash\npython3 -m pip install -r {baseDir}/requirements.txt\n```\n\n这个 Skill 只在本机运行：读取用户明确指定的棋盘图片或文本，启动本地 `katago` 子进程，并只向用户指定的结果路径、系统临时目录或本机识别标注目录写入文件。它不调用 H5、微信、飞书或其他远程 API，也不读取账号凭据或保存用户身份、完整分析历史。\n\n普通图片识别只使用本地 OpenCV。只有用户明确表示识别不准确时，才允许宿主智能体直接用自身视觉 LLM 复核原图；Skill 不得为此再调用 `codex exec` 或其他嵌套 LLM。复核产生的候选棋盘、原 OpenCV 棋盘和差异点会作为本地候选标注保存，默认目录为 `~/.go-next-move/recognition-labels`，可用 `GO_NEXT_MOVE_RECOGNITION_LABEL_DIR` 或 `--recognition-label-dir` 修改。候选标注不是人工确认的 ground truth。\n\n## Local KataGo Defaults\n\nKataGo is installed through Homebrew and verified on this machine:\n\n```bash\nkatago version\n```\n\nExpected important line:\n\n```text\nUsing Metal backend\n```\n\nUse this project config after KataGo's bundled GTP config:\n\n```bash\nkatago gtp \\\n  -model /opt/homebrew/share/katago/g170e-b20c256x2-s5303129600-d1228401921.bin.gz \\\n  -config /opt/homebrew/share/katago/configs/gtp_example.cfg \\\n  -config {baseDir}/config/gtp_skill.cfg\n```\n\nSet komi through GTP, not the config file:\n\n```gtp\nboardsize 19\nkomi 7.5\nclear_board\ngenmove b\n```\n\nFor scripted next-move analysis, prefer the JSON analysis engine:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move black \\\n  --level intermediate \\\n  --visits 400 \\\n  --overlay /tmp/go-next-overlay.jpg \\\n  --source-overlay /tmp/go-source-overlay.jpg \\\n  --source-result-image /tmp/go-source-result.jpg \\\n  --result-image /tmp/go-next-result.jpg\n```\n\nFor photo input, the default user-facing image should be the combined original-photo result. It marks existing white stones with black `W`, existing black stones with white `B`, and the recommended move as a numbered stone so the user can compare the recognition against the real board at a glance. Use `--result-image` only when you explicitly want the clean warped-board rendering with a red ring/dot.\n\nUse `--source-overlay` for user-facing recognition verification. It marks detected stones on the original photo. `--overlay` is a warped/cropped board view for debugging and may not look like the original photo.\n\nFor no-capture continuation, pass confirmed post-photo moves with repeatable `--move-overlay source:color:move:label` arguments:\n\n```bash\npython3 {baseDir}/scripts/next_move.py /path/to/board.jpg \\\n  --input image \\\n  --side-to-move white \\\n  --level intermediate \\\n  --move-overlay ai:W:Q4:1 \\\n  --move-overlay user:B:D16:2 \\\n  --source-result-image /tmp/go-step-3.jpg\n```\n\nThis preserves the origin"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn71n8dv2mq173pr5mdkk9x0k184w6x3\",\n  \"slug\": \"go-next-move\",\n  \"version\": \"0.1.2\",\n  \"publishedAt\": 1785539222436\n}"},{"path":"scripts/_vendor/go_next_move_core/resources/analysis.cfg","content":"# Project defaults for using KataGo's JSON analysis engine.\n# Load after KataGo's bundled analysis_example.cfg so these values override it.\n\n# The runner directs KataGo file logs to the system temp directory.\nlogAllRequests = false\nlogAllResponses = false\n\nmaxVisits = 400\nnumAnalysisThreads = 1\nnumSearchThreadsPerAnalysisThread = 8\nanalysisPVLen = 8\nreportAnalysisWinratesAs = SIDETOMOVE"},{"path":"skill-card.md","content":"## Description:\n\nAnalyzes Go/Weiqi board photos or 19x19 text boards with local KataGo and recommends the next move at beginner, intermediate, advanced, or all strength levels.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[imcaptor](https://clawhub.ai/user/imcaptor)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nGo players and agent developers use this skill to convert board photos or board_ascii text into level-adjusted KataGo next-move recommendations. It returns enough engine data and visual overlays for the user to review the recognized board and compare candidate moves.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill runs local Python/OpenCV code and starts a local KataGo subprocess.\n\nMitigation: Install and run it only in an environment where local Python, OpenCV, and KataGo execution is acceptable.\n\nRisk: Correction retries may save local copies of board photos and candidate labels in the recognition-label directory.\n\nMitigation: Avoid sensitive photos, set a controlled recognition-label directory, or delete the directory when retention is not desired.\n\nRisk: Incorrect board recognition can make the recommended move unreliable.\n\nMitigation: Compare the source overlay or result image with the physical board and correct the board before relying on the recommendation.\n\nRisk: Captures, ko/state ambiguity, or an unknown side to move can invalidate continuation analysis.\n\nMitigation: Ask for the side to move and re-shoot or reset the board after captures or ambiguous game-state changes.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/imcaptor/skills/go-next-move)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, JSON, files, guidance]\n\n**Output Format:** [Markdown guidance with shell commands plus JSON analysis results and optional image-file paths from the local analyzer]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires local python3 and katago; may write result images, overlays, temporary files, and local recognition-label bundles when correction retry is used.]\n\n## Skill Version(s):\n\n0.1.2 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."},{"path":"config/gtp_skill.cfg","content":"# Project defaults for using KataGo as a next-move advisor.\n# Load after KataGo's bundled gtp_example.cfg so these values override it.\n\nrules = chinese\n\nmaxVisits = 400\nnumSearchThreads = 8\nponderingEnabled = false\n\nlogDir = /tmp/go-next-move-katago-gtp-logs\nlogAllGTPCommunication = false\nlogSearchInfo = false\nlogSearchInfoForChosenMove = false\nlogToStderr = true"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Skill: go-next-move Owner: imcaptor Summary: 从围棋/Weiqi 棋盘照片或文本棋盘分析当前局面，调用本地 KataGo 按初级、中级、高级强度推荐下一手。适用于用户询问黑棋或白棋下一手应下哪里、希望按对手水平选择落点，或想在不改变棋盘的情况下获得更均衡的 AI 辅助建议。 Tags: go:0.0.7, katago:0.0.7, latest:0.1.2, weiqi:0.0.7 Version history: v0.1.2 | 2026-07-31T23:07:02.436Z | user Add opt-in host-agent recognition retry and candidate label capture for improving board recognition. v0.1.1 | 2026-07-31T02:18:05.892Z | user Impr","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1143,"uniquenessScore":53,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T08:58:28.120Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:50:59.349Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}