{"id":51481493,"url":"https://github.com/shihchengwei-lab/slime-coding","last_synced_at":"2026-07-07T02:01:18.940Z","repository":{"id":365599410,"uuid":"1272869647","full_name":"shihchengwei-lab/slime-coding","owner":"shihchengwei-lab","description":"Git hook framework that enforces minimal AI coding — blocks scope creep and undeclared dependencies automatically.","archived":false,"fork":false,"pushed_at":"2026-06-28T22:11:00.000Z","size":1925,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-28T23:18:43.760Z","etag":null,"topics":["ai-coding","claude-code","developer-tools","git-hooks","prompt-engineering","shell"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shihchengwei-lab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-06-18T02:23:55.000Z","updated_at":"2026-06-28T22:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shihchengwei-lab/slime-coding","commit_stats":null,"previous_names":["shihchengwei-lab/slime-coding"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shihchengwei-lab/slime-coding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihchengwei-lab%2Fslime-coding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihchengwei-lab%2Fslime-coding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihchengwei-lab%2Fslime-coding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihchengwei-lab%2Fslime-coding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shihchengwei-lab","download_url":"https://codeload.github.com/shihchengwei-lab/slime-coding/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shihchengwei-lab%2Fslime-coding/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35211553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-coding","claude-code","developer-tools","git-hooks","prompt-engineering","shell"],"created_at":"2026-07-07T02:01:17.490Z","updated_at":"2026-07-07T02:01:18.926Z","avatar_url":"https://github.com/shihchengwei-lab.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e **This repository is archived.** Development continues in the\n\u003e [coding-agent-guardrails](https://github.com/shihchengwei-lab/coding-agent-guardrails)\n\u003e toolkit, where this tool lives at\n\u003e [`slime-coding/`](https://github.com/shihchengwei-lab/coding-agent-guardrails/tree/main/slime-coding)\n\u003e with its full commit history. Everything here stays available read-only.\n\n# Slime Coding\n\n[![CI](https://github.com/shihchengwei-lab/slime-coding/actions/workflows/ci.yml/badge.svg)](https://github.com/shihchengwei-lab/slime-coding/actions/workflows/ci.yml)\n\n**Slime Coding — 讓最聰明的 AI，跟最沒腦的黏菌學會克制。**\n\n![Slime Coding — Think more. Drift less.](assets/slime-coding.png)\n\n每天用 AI 寫 code 的人都知道：現在的問題通常不是 AI 做不出來，而是它太容易把任務往外延伸。\n\n它會加一層你沒要求的抽象、碰幾個本來不用碰的檔案、引入新套件、改掉既有資料流，甚至引用一個 repo 裡根本不存在的函數。功能最後也許能跑，但 diff 會多出一堆你沒有打算維護的東西。\n\nSlime Coding 管的是這件事：**最小語義位移**。\n\n不是最小 diff，也不是最少行數。它在意的是：只改這次需求必須改的行為，不順手移動既有架構、命名、API、資料流和責任邊界。\n\n## 它做什麼？\n\nSlime Coding 不是再寫一段「請不要過度實作」給 AI 看。那種文字只是提醒，AI 忙起來會忘。\n\n它把幾個容易失控的點接成自動關卡：\n\n- **動手前先框範圍**：AI 要先寫出這次要碰哪些檔案、要完成什麼、哪些事不做。沒框好就不能改專案程式碼。\n- **範圍外的修改會被擋**：如果 AI 順手改了不在範圍內的程式碼，收工時會被擋下來。\n- **新增套件會被擋**：AI 不能默默多加套件。要嘛說清楚為什麼留，要嘛拿掉。\n- **引用不存在的接點會被擋**：可選。你可以接型別檢查或語法檢查，讓 AI 不能靠想像中的 helper / class / API 收工。\n- **紅燈不能假裝完成**：如果你設定了測試指令，測試紅燈時 AI 不能直接收工。它要修綠，或把放棄的路記下來，避免下輪重走。\n- **commit message 會留下證據**：commit 時自動補上這次範圍、碰了哪些檔案、有沒有走廊外修改、有沒有新套件、怎麼驗證。\n\n簡單說就是：\n\n\u003e 多想一點，少偏離一點。\n\n## 什麼時候有用？\n\n適合：\n\n- 你已經每天用 Claude Code / Codex / 其他 AI coding 工具改 repo。\n- 你的 repo 已經有架構、命名、helper、測試和約定。\n- 你在意 AI 不要把一個小需求擴成一串旁支。\n- 你常遇到「功能有做完，但 diff 看起來很不對」。\n\n不太適合：\n\n- 一次性試作品。\n- 你就是想讓 AI 大幅重構。\n- 專案沒有測試、沒有型別檢查，也不在意檔案邊界。\n\n## 怎麼用？\n\n每個要套 Slime Coding 的專案，各跑一次。Claude Code 用：\n\n```bash\ngit clone \u003c這個 repo\u003e ~/slime-coding\ncd /你的專案\n~/slime-coding/install.sh .\n```\n\nCodex on Windows 用：\n\n```powershell\ngit clone \u003c這個 repo\u003e $HOME\\slime-coding\ncd \\你的專案\npowershell -ExecutionPolicy Bypass -File $HOME\\slime-coding\\install-codex.ps1 -Project .\n```\n\nClaude 安裝會做幾件事：\n\n- 把 Claude 的自動關卡接進 `.claude/settings.json`。\n- 裝 `/slime-corridor` 和 `/slime-prune` 指令。\n- 建立 `.slime/corridor.md` 和 `.slime/PRUNED.md` 範本。\n- 接上 Git commit hook，讓 commit message 自動帶證據。\n\nCodex 安裝會做幾件事：\n\n- 把自動關卡接進 `.codex/hooks.json`。\n- 把 `slime-navigate` skill 複製到 `.agents/skills/slime-navigate`。\n- 把 Slime Coding 指引插入 `AGENTS.md` 的 managed block。\n- 建立 `.slime/corridor.md` 和 `.slime/PRUNED.md` 範本。\n- 接上 Git commit hook，讓 commit message 自動帶證據。\n\n需要 `python3` 和 `git`。安裝可以重跑，會備份既有設定。\n\nClaude Code 最後還有手動一步：把 [`templates/CLAUDE.slime.md`](templates/CLAUDE.slime.md) 的內容貼進你專案的 `CLAUDE.md`，讓 AI 知道這套規則怎麼用。\nCodex 版會自動更新 `AGENTS.md`；下次啟動 Codex 或開新 run 後生效。若 Codex 提示 project hooks 尚未 trust，進 `/hooks` 檢查後信任。\n\n## Benchmark 怎麼看？\n\n這不是「AI coding 已被解決」的證明，只是一個時間點快照：在同一批任務上，裝 Slime Coding 之後，AI 有沒有更少漂移。\n\n2026-06-29，用 Ponytail-derived task pool 跑 Claude Haiku：\n\n- 19 題\n- `baseline` / `ponytail` / `slime-coding` 三組\n- 每題每組 4 次\n- 共 228 個有效樣本\n- 429 額度失敗與跑太久中斷的樣本已重跑\n- `slime-coding` 使用目前預設的嚴格版本：範圍外程式碼修改會被擋\n\n| 組別 | 通過率 | touched files | 總 LOC | vs baseline LOC | 平均 cost | 平均 tokens | 平均時間 |\n|---|---:|---:|---:|---:|---:|---:|---:|\n| baseline | 69/76 = 90.8% | 115 | 5744 | baseline | $0.0897 | 331k | 49.8s |\n| ponytail | 72/76 = 94.7% | 147 | 5055 | -12.0% | $0.1047 | 299k | 55.6s |\n| slime-coding | 76/76 = 100.0% | 107 | 4351 | -24.3% | $0.1223 | 478k | 76.6s |\n\n同一批 19 題再用 Codex CLI / `gpt-5.4-mini` 跑 baseline 與 Slime Coding，當成跨廠商 sanity check：\n\n- 2026-07-01\n- `baseline` / `slime-coding` 兩組\n- 每題每組 4 次\n- 共 152 個 clean cells\n- Codex CLI 不回報 per-run cost，所以這張表不列 cost\n\n| 組別 | 通過率 | touched files | 總 LOC | vs baseline LOC | 平均 tokens | 平均時間 |\n|---|---:|---:|---:|---:|---:|---:|\n| baseline | 76/76 = 100.0% | 122 | 7196 | baseline | 232k | 130.9s |\n| slime-coding | 76/76 = 100.0% | 104 | 5543 | -23.0% | 262k | 158.0s |\n\n直覺讀法：\n\n- Claude Haiku 那輪，Slime Coding 通過率最高，也碰最少檔案、產生最少 LOC。\n- Codex / `gpt-5.4-mini` 那輪，baseline 已經 100% 通過；Slime Coding 沒提高通過率，但仍少碰 14.8% 檔案、少寫 23.0% LOC。\n- 代價是 token、時間、cost 或 CLI runtime 通常更高。\n\n所以它不是省錢工具，也不是加速工具。它比較像一個保守的防護欄：多花一點思考成本，換比較小的改動面。\n\n完整資料在 [`benchmark/`](benchmark/)。\n\n## 限制\n\n- 它不是安全沙盒。真正的安全邊界還是權限、sandbox、CI、測試和人工 review。\n- 它不能判斷所有設計好壞，只能擋幾個明確事實：範圍外檔案、新套件、紅燈收工、型別檢查失敗。\n- 沒有測試或型別檢查的 repo，效果會打折。\n- 它會增加流程成本。benchmark 也顯示它更耗 token、時間和錢。\n\n如果你要的是「便宜、快、能跑就好」，這不是它的方向。\n\n如果你要的是「AI 可以寫，但不要把每個小需求都擴成一輪大改動」，這就是它想解的問題。\n\n## 更多細節\n\n- 概念說明：[`docs/CONCEPT.md`](docs/CONCEPT.md)\n- 機制設計：[`docs/DESIGN.md`](docs/DESIGN.md)\n- benchmark 原始資料：[`benchmark/`](benchmark/)\n- 變更紀錄：[`CHANGELOG.md`](CHANGELOG.md)\n\n## License\n\nMIT — 見 [`LICENSE`](LICENSE)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshihchengwei-lab%2Fslime-coding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshihchengwei-lab%2Fslime-coding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshihchengwei-lab%2Fslime-coding/lists"}