s2005/skill_state/tree/main/plugin
skill-state
實作 SKILL.state 的 Claude Code function hook 外掛:提供明確、通過 JSON-schema 驗證的執行狀態,用來限制非豁免工具呼叫,並在每個工作階段將只追加的對話歷史換成壓縮後的 frame,面向長時間執行的技能。
關於這個 mod
這個外掛會在 Claude Code 內註冊一個工具(skill_state_update)和一個指令(/skill-state)。模型不再依賴只會追加的聊天歷史,而是維護一個經過驗證的狀態物件;每次不在豁免清單中的工具呼叫,都必須由狀態更新綁定,並指名那個確切的呼叫;每個工作階段結束時,對話會被壓縮成一個 frame(objective、procedure、current state、step)加上最近幾個工作階段。指令涵蓋 start(使用 software、ctf 等內建領域,或指定設定路徑)、new(透過六個問題建立領域設定)、status、stop/resume 和 reset。hook 模組與無相依性的 lib 程式碼完全在程序內執行,不發出網路要求,也不安裝套件;讀取來自內建或使用者提供的領域設定,只有在 /skill-state new 確認後才會寫入 domains/<name>.json。執行時記錄保存在工作階段外掛狀態與外掛儲存空間中,以工作階段 id 為鍵。子代理不受影響。採用 MIT 授權。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add s2005/skill_state claude plugin install skill-state
原文 / README
skill-state
SKILL.state (arXiv:2608.26263) for Claude Code: an explicit, validated execution state that replaces append-only conversation history for long-horizon skills. It is a Claude Code function-hook plugin and needs a Claude Code build with function hooks.
While the runtime is active:
- the model keeps its state through the
skill_state_updatetool, validated against the domain's JSON schema; - every tool call outside the domain's exempt list must first be bound by a state update naming that exact call;
- at the end of each turn the conversation is replaced by a frame (objective, procedure, current state, step) followed by the last few turns.
Commands
| Command | What it does |
| ------- | ------------ |
| /skill-state start <domain\|path> | Starts a runtime from a bundled domain (software, ctf) or a domain config file. The next prompt becomes the objective. |
| /skill-state new <name> | Builds a domain config from six questions and writes it to domains/<name>.json in this plugin folder. |
| /skill-state status | Shows the domain, objective, step, pending action, state size and token usage. |
| /skill-state stop / resume | Turns gating and compaction off or back on, keeping the state. |
| /skill-state reset | Returns to the initial state at step 0. |
What the plugin runs, reads and writes
- Runs only the TypeScript hooks module
hooks/register.tsand the dependency-free code inlib/, inside Claude Code. It starts no processes and installs no packages. - Makes no network requests and sends no data anywhere.
- Reads domain config files: the bundled ones in
domains/, or a path you pass to/skill-state start. - Writes
domains/<name>.jsononly when you confirm it in/skill-state new. - Keeps the runtime record in the session's plugin state and in the plugin store, keyed by session id.
- Registers one tool,
skill_state_update, and one command,/skill-state; denies non-exempt tool calls that were not bound by a state update; and compacts the main conversation to the frame at each turn end in interactive sessions. Subagents are not affected.
Full documentation, domain config reference and development notes: https://github.com/s2005/skill_state.
License
MIT, see LICENSE.