{"id":46569613,"url":"https://github.com/nkhoit/dcss-ai","last_synced_at":"2026-03-07T08:09:28.064Z","repository":{"id":338503538,"uuid":"1158112035","full_name":"nkhoit/dcss-ai","owner":"nkhoit","description":"Autonomous AI agent that plays Dungeon Crawl Stone Soup, learns from every death, and streams on Twitch. Built with GitHub Copilot SDK.","archived":false,"fork":false,"pushed_at":"2026-02-15T04:26:01.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-15T04:31:10.977Z","etag":null,"topics":["ai","autonomous-agent","copilot-sdk","dcss","roguelike","twitch"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nkhoit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-14T20:19:16.000Z","updated_at":"2026-02-15T04:26:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nkhoit/dcss-ai","commit_stats":null,"previous_names":["nkhoit/dcss-ai"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/nkhoit/dcss-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkhoit%2Fdcss-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkhoit%2Fdcss-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkhoit%2Fdcss-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkhoit%2Fdcss-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nkhoit","download_url":"https://codeload.github.com/nkhoit/dcss-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkhoit%2Fdcss-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","autonomous-agent","copilot-sdk","dcss","roguelike","twitch"],"created_at":"2026-03-07T08:09:27.491Z","updated_at":"2026-03-07T08:09:28.048Z","avatar_url":"https://github.com/nkhoit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dcss-ai\n\nAn autonomous AI agent that plays [Dungeon Crawl Stone Soup](https://crawl.develz.org/) (DCSS), learns from every death, and streams on Twitch.\n\nThe AI calls game tools directly — move, fight, explore, use items — through a pure-Python WebSocket connection to a local DCSS webtiles server. Each game is one LLM session; accumulated learnings persist across games in `learnings.md`.\n\nUses the GitHub Copilot SDK for LLM integration.\n\n## How It Works\n\n```\ndriver.py — Game loop (infinite: play → die → learn → repeat)\n  │\n  ├─ LLM session (one per game, provider-agnostic)\n  │   ├─ System prompt: system_prompt.md + learnings.md\n  │   ├─ 39 tools: get_state, move, auto_explore, attack, quaff, ...\n  │   └─ On death/win: write_learning() → end session → next game\n  │\n  ├─ DCSSGame (game.py) — High-level game API\n  │   └─ WebTilesConnection (webtiles.py) — Pure Python WebSocket client\n  │       └─ DCSS Webtiles Server (Docker, port 8080)\n  │\n  └─ Stream overlay (stats.json → OBS browser source)\n```\n\n**Key design choices:**\n- **One session = one game.** Fresh LLM context each run. `learnings.md` carries wisdom between games.\n- **Tools, not code generation.** The AI calls discrete game actions — no REPL, no arbitrary code.\n- **Pure Python WebSocket client.** No Rust dependencies. Handles zlib decompression, message batching, keepalive pings, More prompts, and all DCSS protocol quirks.\n- **Provider-agnostic architecture.** Currently uses GitHub Copilot SDK; provider abstraction allows adding new backends.\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.10+\n- Docker (for the DCSS server)\n\n### Setup\n\n```bash\ngit clone https://github.com/nkhoit/dcss-ai.git\ncd dcss-ai\n\n# Python environment\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\n# Start the DCSS server\ncd server \u0026\u0026 docker compose up -d\n# Verify: http://localhost:8080 should show the DCSS lobby\n```\n\n### Run with GitHub Copilot SDK\n\nRequires [Copilot CLI](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli) (authenticated, Copilot Pro+ or Enterprise):\n\n```bash\npip install github-copilot-sdk\npython -m dcss_ai.driver \\\n  --provider copilot \\\n  --model claude-sonnet-4 \\\n  --username kurobot --password kurobot123\n```\n\n### CLI Reference\n\n```\n--provider    LLM provider (default: copilot)\n--model       Model name (default: claude-sonnet-4)\n--server-url  DCSS webtiles WebSocket URL (default: ws://localhost:8080/socket)\n--username    DCSS account username (default: kurobot)\n--password    DCSS account password (default: kurobot123)\n--single      Play one game then exit\n```\n\n## Testing\n\nRequires Docker. No LLM or API keys needed — tests exercise the game API directly.\n\n```bash\n# Start server, run tests, stop server\n./run.sh server-start\n./run.sh test\n./run.sh server-stop\n```\n\nOr manually:\n```bash\npip install -r requirements.txt pytest\ndocker run -d --name dcss-webtiles -p 8080:8080 ghcr.io/nkhoit/dcss-webtiles:latest\npython -m pytest tests/test_integration.py -v\ndocker stop dcss-webtiles \u0026\u0026 docker rm dcss-webtiles\n```\n\n## Game API\n\nThe `DCSSGame` class in [`game/`](dcss_ai/game/) provides a clean Python API over the DCSS webtiles protocol — state queries (free, no turn cost) and actions (movement, combat, items, abilities).\n\n## Credits\n\n- [DCSS](https://github.com/crawl/crawl) — Dungeon Crawl Stone Soup\n- [nkhoit/dcss-webtiles](https://github.com/nkhoit/dcss-webtiles) — Docker image\n- [dcss-api](https://github.com/EricFecteau/dcss-api) — Reference for the webtiles protocol\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkhoit%2Fdcss-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnkhoit%2Fdcss-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkhoit%2Fdcss-ai/lists"}