ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 RichardAtCT

cc-idle

一個 Claude Code 外掛,在轉錄內容旁的窗格中執行放置型遊戲,由 Claude Code 自己的回合、工具與工作階段事件驅動。

RichardAtCT@RichardAtCT

RichardAtCT/cc-idle/tree/main/plugins/cc-idle

原貼文圖片1
已翻譯

關於這個 mod

cc-idle 是一個 Claude Code 外掛,在轉錄內容旁的窗格中執行放置型遊戲,完全由 Claude Code 自己的事件(turn.start、turn.step、tool.call、turn.complete、session.end)餵入——不需要 tmux、常駐程式或 hook 轉接層。需求:Claude Code v2.1.287 或更新版本。使用 /plugin marketplace add RichardAtCT/cc-idle,接著執行 /plugin install cc-idle@cc-idle 安裝;也可以從複製的儲存庫使用 claude --plugin-dir ./plugins/cc-idle 試玩。終端機至少有 144 欄寬時窗格會自動開啟,否則使用 /idle;/idle close 會關閉窗格,按 Esc 可把鍵盤交還提示列。遊戲內容包括購買 GPU、機架與資料中心、處理事件、聘請研究人員、執行實驗、推出新世代產品,以及突破樹。由 Haiku 驅動的董事會成員(透過你自己的 Claude Code 工作階段)會解釋機制、回答規則問題,並對重大時刻做出反應,但最多每分鐘一次。所有工作階段共用 $.store 中的一份存檔;外掛不會呼叫檔案系統、網路或程序,也不會拒絕或改寫工具呼叫、提示或回合。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add RichardAtCT/cc-idle
claude plugin install cc-idle
原文 / README

cc-idle (Claude Code mod)

CC Idle as a Claude Code mod: the game runs in a pane beside the transcript, fed by Claude Code's own events. No tmux, no daemon, no hook shims.

Requires Claude Code v2.1.287 or later.

Install

/plugin marketplace add RichardAtCT/cc-idle
/plugin install cc-idle@cc-idle

Or try it from a clone for one session: claude --plugin-dir ./plugins/cc-idle.

To pick up new commits from main inside Claude Code, refresh the marketplace, then load the new version into the running session. No restart is needed.

/plugin marketplace update cc-idle
/reload-plugins

If the new version does not appear, type /plugin, open cc-idle under the installed plugins, choose update, then run /reload-plugins again. From a shell, the same update is:

claude plugin marketplace update cc-idle && claude plugin update cc-idle@cc-idle

plugin.json sets no version on purpose. Claude Code then uses the commit SHA as the version, so every merge to main is an update. claude plugin validate warns about the missing version; ignore that warning.

Play

  • In a terminal at least 144 columns wide, the pane opens beside the transcript by itself. Anywhere else, type /idle. It works mid-turn, so you can play while Claude works. Until you have played once, a toast tells you so.
  • The first time, the pane shows a welcome that explains the game. After that, a yellow → line under the header names the next useful move when there is one.
  • /idle also gives the pane the keyboard. Esc hands it back to the prompt. /idle close closes the pane.
  • When Claude finishes a turn, asks a question or needs permission, a banner at the top of the pane says so.
  • Your Compute and generation also show on the status line, even with the pane closed.

| Key | Action | | --- | --- | | g / r / d | Buy a GPU / rack / datacenter in the focused region | | a | Acknowledge the region's incident (the post-mortem pays engineering) | | n | Next region | | h | Hire a researcher | | e | Run an experiment | | s | Ship the generation (asks y / n first) | | v | Breakthrough tree (1–6 buy, v back) | | c | Talk to the board (Enter on an empty line goes back) | | i | How to play (i back) |

The original TUI's tab and P became n and s, because a mod's hotkeys must be a single lowercase letter or digit, and Tab and the arrow keys stay Claude Code's.

The board

A board member of your lab lives in the pane. It is Haiku, run through your own Claude Code session, so each line it says is one small Haiku call on your account.

The board explains an incident unasked, then answers a rules question and a cheeky one

  • Press c to open the board, type a short line (80 characters at most) and press Enter. It answers in one line. The text field takes every key, so Enter on an empty line goes back to the game. Esc hands the keyboard to the prompt, as on every screen.
  • It knows the rules, so it doubles as help: ask "what does diminishing returns mean?" and it answers from the game's real balance numbers.
  • The first time you meet a mechanic (an incident, diminishing returns, a second region, a shippable model, Breakthroughs to spend), it explains it once, unasked. It never repeats one.
  • It also reacts by itself to big moments: a region founded, a generation shipped, a breakthrough, an incident. It does so at most once a minute, and only while the pane is in view. Unasked lines share that limit. Its last word shows under the hint on the main screen.
  • The chat stays in this session. It is not part of the shared save.

How it works

| Claude Code event | Becomes | Economy | | --- | --- | --- | | turn.start (main loop) | UserPromptSubmit | the region is hot; the turn's accrual starts | | turn.step (every model request, subagents too) | TokenUsage | output tokens → Compute, live | | tool.call succeeded | PostToolUse | Edit/Write/Bash → engineering, Read/Search/Fetch → research data | | tool.call errored | PostToolUse (failed) | an incident | | turn.complete (subagent) | SubagentStop | a training run | | turn.complete (main, answered) | Stop | milestone shipped: completion bonus and reputation | | session.end | SessionEnd | the session leaves its region |

The mod builds the same v1 envelopes the shell hooks wrote, so the engine in packages/game, its balance constants and the replay/backtest tooling are unchanged.

One economy for all your sessions. Every Claude Code session running the mod shares one save in $.store. Each session applies events locally at once, then about a second later re-reads the save, replays its queued events on top and writes it back. Every 5 seconds it picks up the other sessions' writes. Only a write that lands between another session's read and its write is lost.

What it touches. claude plugin validate plugins/cc-idle lists every call the mod makes: $.store, $.state, $.ui, $.clock, $.model.complete, $.command.register, $.session.id and $.session.cwd. Its only model calls are the board's Haiku calls. It makes no filesystem, network or process calls. It never denies or rewrites a tool call, prompt or turn: every hook passes its event on unchanged.

Developing

hooks/register.js is generated. Its sources are in packages/mod/src, bundled with the pure game engine and zod by pnpm --filter @ccidle/mod build. A mod loads no packages and has no Node, so everything it needs travels in that one file.

pnpm --filter @ccidle/mod build      # regenerate hooks/register.js
pnpm --filter @ccidle/mod test       # sync, telemetry and view unit tests (vitest)
pnpm --filter @ccidle/mod typecheck  # against the mods API types in packages/mod/types
claude plugin validate plugins/cc-idle
claude plugin test plugins/cc-idle   # hooks and pane tests in Claude Code's own test engine

packages/mod/types/claude-code.d.ts is the mods API declaration file that Claude Code 2.1.287 writes. When Claude Code updates, copy in the new one; don't edit it by hand.

更多類似作品