skill-systems-thinking 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +396 -0
- package/SKILL.md +125 -0
- package/assets/runtime-prompt.txt +21 -0
- package/evals/checks.json +88 -0
- package/package.json +25 -0
- package/references/bounded-control.md +82 -0
- package/references/closed-loop-workflow.md +89 -0
- package/references/discrete-systems.md +79 -0
- package/references/disturbance.md +98 -0
- package/references/modeling.md +87 -0
- package/references/multivariable.md +112 -0
- package/references/original-text.md +58 -0
- package/references/stability.md +97 -0
- package/references/state-and-control.md +84 -0
- package/templates/change-proposal.md +51 -0
- package/templates/debugging-checklist.md +44 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `systems-thinking` will be documented in this file.
|
|
4
|
+
Versioning follows [Semantic Versioning](https://semver.org/) in `X.Y.Z` format.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — 2026-07-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial public release of the skill
|
|
12
|
+
- SKILL.md with runtime prompt block, 7-step workflow, principle map, and 8 cognitive laws
|
|
13
|
+
- README.md with bilingual (中文/English) documentation
|
|
14
|
+
- 8 reference files: `state-and-control.md`, `stability.md`, `modeling.md`, `multivariable.md`,
|
|
15
|
+
`disturbance.md`, `bounded-control.md`, `discrete-systems.md`, `closed-loop-workflow.md`
|
|
16
|
+
- 2 prompt templates: `debugging-checklist.md`, `change-proposal.md`
|
|
17
|
+
- Self-audit checklist: `evals/checks.json` with 11 MUST/SHOULD cognitive-law probes
|
|
18
|
+
- Harness files: `AGENTS.md`, `init.ps1`, `feature_list.json`, `progress.md`, `session-handoff.md`
|
|
19
|
+
- LICENSE (MIT)
|
|
20
|
+
|
|
21
|
+
### Notes
|
|
22
|
+
- First implementation of the thinking-mode scaffold derived from Qian Xuesen & Song Jian's
|
|
23
|
+
*Engineering Cybernetics* (工程控制论).
|
|
24
|
+
- Language- and framework-agnostic; targets any non-trivial code change where correctness
|
|
25
|
+
AND robustness must both be verified.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 systems-thinking contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# systems-thinking
|
|
2
|
+
|
|
3
|
+
<!-- Language toggle / 语言切换 -->
|
|
4
|
+
|
|
5
|
+
> **中文** | [English](#english)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 简介
|
|
10
|
+
|
|
11
|
+
`systems-thinking` 是一个思维模式 skill。它把控制论的思想装进 LLM 的思考过程里,让模型在写代码、改代码、做架构之前,先想清楚:状态是什么、怎么观测、稳不稳定、边界在哪、耦合怎么处理。
|
|
12
|
+
|
|
13
|
+
> **一句话:用系统视角写代码——先识别状态,再动手,最后闭环验证。**
|
|
14
|
+
|
|
15
|
+
这不是给人类做的知识测试,也不是一本排错手册。它是一个脚手架,改变的是模型**怎么想**,而不是怎么拼 diff。
|
|
16
|
+
|
|
17
|
+
源自钱学森、宋健《工程控制论》。语言和框架无关,拿来就能用。
|
|
18
|
+
|
|
19
|
+
## 它解决什么问题
|
|
20
|
+
|
|
21
|
+
写代码时常见的做法是:先动手,再祈祷测试能过。这个 skill 要改变的是这个顺序。
|
|
22
|
+
|
|
23
|
+
它特别适合这些场景:
|
|
24
|
+
|
|
25
|
+
- 改一段你不完全理解的遗留代码
|
|
26
|
+
- 调试一个时好时坏、复现不了的问题
|
|
27
|
+
- 重构几个互相牵制的模块
|
|
28
|
+
- 做任何"既要正确又要稳"的改动
|
|
29
|
+
|
|
30
|
+
在这些场景里,"写个最小补丁"往往不够。你需要先搞清楚系统的状态,再动手。
|
|
31
|
+
|
|
32
|
+
## 核心思想
|
|
33
|
+
|
|
34
|
+
一句话:**程序是一个动态系统,你是控制器。**
|
|
35
|
+
|
|
36
|
+
每次改动都在往系统里注入一个控制信号。你只能部分观测系统的真实状态。bug 是不稳定或欠阻尼的轨迹。调试就是状态估计。测试是反馈回路的传感器。**闭环永远比开环好。**
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
本 skill 面向支持自定义 skill 的 AI 编程助手(Kilo、Claude Code、Aider、Cursor 等)。
|
|
41
|
+
|
|
42
|
+
### 直接复制
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cp -r systems-thinking <agent-skills-dir>/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 符号链接(开发用)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 各助手路径参考
|
|
55
|
+
|
|
56
|
+
| 助手 | 路径 |
|
|
57
|
+
|---|---|
|
|
58
|
+
| Kilo | `~/.config/kilo/skills/` 或项目内 `.kilo/agent/` |
|
|
59
|
+
| Claude Code | `~/.claude/plugins/custom-skills/` 或项目内 `.claude/` |
|
|
60
|
+
| Aider | 使用 `--skills-dir` 参数 |
|
|
61
|
+
| Cursor | 项目内 `.cursor/rules/` 或全局设置 |
|
|
62
|
+
|
|
63
|
+
### 验证安装
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pwsh init.ps1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
看到 `Verification Complete — OK` 就说明装好了。
|
|
70
|
+
|
|
71
|
+
## 使用方式
|
|
72
|
+
|
|
73
|
+
### 1. 触发时机
|
|
74
|
+
|
|
75
|
+
在涉及以下任务时加载本 skill:
|
|
76
|
+
|
|
77
|
+
- 架构设计
|
|
78
|
+
- 调试非确定性行为
|
|
79
|
+
- 跨模块重构
|
|
80
|
+
- 任何"正确且稳健必须同时满足"的改动
|
|
81
|
+
|
|
82
|
+
### 2. 读 SKILL.md
|
|
83
|
+
|
|
84
|
+
先读 `SKILL.md`,里面的运行时提示块会安装认知法则。下面的工作流是自然延伸。
|
|
85
|
+
|
|
86
|
+
### 3. 动手之前,先命名
|
|
87
|
+
|
|
88
|
+
改代码之前,必须说清楚四个东西:
|
|
89
|
+
|
|
90
|
+
- `x` — 被控变量,什么必须保持正确
|
|
91
|
+
- `u` — 控制变量,你实际会动的那个杠杆
|
|
92
|
+
- 可观测性 — 你怎么知道 `x` 的当前值
|
|
93
|
+
- 边界 — 每个执行器都会饱和,不接受无界循环
|
|
94
|
+
|
|
95
|
+
### 4. 七步循环
|
|
96
|
+
|
|
97
|
+
| 步骤 | 原则 | 参考文件 |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| 1 | 识别:命名 `x`、`u`、可观测性、边界 | `references/state-and-control.md` |
|
|
100
|
+
| 2 | 分析:复现、测量、定位故障、建立模型 | `references/modeling.md` |
|
|
101
|
+
| 3 | 稳定:在加新功能之前先消灭发散/振荡/泄露 | `references/stability.md` |
|
|
102
|
+
| 4 | 综合:最小 `u`;解耦有害,协调有益 | `references/multivariable.md` |
|
|
103
|
+
| 5 | 闭环:观察实际结果,修正直到偏差有界 | `references/closed-loop-workflow.md` |
|
|
104
|
+
| 6 | 补偿:可测扰动用前馈;有延迟就加阻尼 | `references/disturbance.md` |
|
|
105
|
+
| 7 | 优化:稳定之后才谈性能调优 | `references/bounded-control.md` |
|
|
106
|
+
|
|
107
|
+
涉及采样和测试节奏的问题,额外参考 `references/discrete-systems.md`。
|
|
108
|
+
|
|
109
|
+
### 5. 模板
|
|
110
|
+
|
|
111
|
+
以下文件位于 skill 安装目录下的 `templates/` 子目录中:
|
|
112
|
+
|
|
113
|
+
- **调试时**:把 `templates/debugging-checklist.md` 复制进会话
|
|
114
|
+
- **规划改动时**:用 `templates/change-proposal.md` 写控制计划
|
|
115
|
+
|
|
116
|
+
### 6. 自审计
|
|
117
|
+
|
|
118
|
+
宣布完成之前,必须通过 `evals/checks.json` 中所有的 MUST 检查项。
|
|
119
|
+
|
|
120
|
+
## 认知法则
|
|
121
|
+
|
|
122
|
+
这个 skill 强制执行 8 条认知法则:
|
|
123
|
+
|
|
124
|
+
1. 先命名 `x` 再命名 `u`。没名字的目标就没法调节。
|
|
125
|
+
2. 先观测再猜测。综合方案之前先测量当前行为。
|
|
126
|
+
3. 稳定优先于优化。扰动下发散就是失败。
|
|
127
|
+
4. 闭环。观察实际结果,不断修正直到偏差有界。
|
|
128
|
+
5. 可测扰动用前馈,其余用反馈。绝不在延迟回路上提高增益。
|
|
129
|
+
6. 解耦有害耦合,协调有益耦合。调节关系,不只是绝对值。
|
|
130
|
+
7. 最小控制。移动 `x` 到目标所需的最小 `u`,不搞投机性额外操作。
|
|
131
|
+
8. 收敛。修正幅度必须越来越小。如果越来越大,说明不稳定——停下来重新识别。
|
|
132
|
+
|
|
133
|
+
## 工作示例
|
|
134
|
+
|
|
135
|
+
**问题**:一个 API 接口在负载下间歇性返回 500。
|
|
136
|
+
|
|
137
|
+
| 步骤 | 控制论行动 |
|
|
138
|
+
|---|---|
|
|
139
|
+
| 识别 | `x` = 错误率;`u` = 重试/超时/缓存逻辑;边界 = 请求预算。 |
|
|
140
|
+
| 分析 | 在负载下复现;测量错误率随并发上升(不稳定)。 |
|
|
141
|
+
| 稳定 | 加熔断器 + 带退避的有界重试 → 错误率有界。 |
|
|
142
|
+
| 综合 | 最小改动,不要重写服务。 |
|
|
143
|
+
| 闭环 | 再次压测;错误率收敛到接近 0。 |
|
|
144
|
+
| 补偿 | 对可测依赖故障快速失败(前馈)+ 其余用反馈。 |
|
|
145
|
+
| 优化 | 此时才 trim p99 延迟。 |
|
|
146
|
+
|
|
147
|
+
**没有这套视角的常见失败**:无限制加重试 → 重试风暴(不稳定延迟环)→ 比原来更糟。
|
|
148
|
+
|
|
149
|
+
## 参考文件
|
|
150
|
+
|
|
151
|
+
8 篇深度参考,每篇对应一个控制论原则,附带 LLM 行为模式说明:
|
|
152
|
+
|
|
153
|
+
| 主题 | 文件 |
|
|
154
|
+
|---|---|
|
|
155
|
+
| 闭环工作流 | `references/closed-loop-workflow.md` |
|
|
156
|
+
| 状态、控制、可观测性、边界 | `references/state-and-control.md` |
|
|
157
|
+
| 稳定性 | `references/stability.md` |
|
|
158
|
+
| 建模与模型有效性 | `references/modeling.md` |
|
|
159
|
+
| 多变量:解耦与协调 | `references/multivariable.md` |
|
|
160
|
+
| 扰动补偿与时延 | `references/disturbance.md` |
|
|
161
|
+
| 有界控制 | `references/bounded-control.md` |
|
|
162
|
+
| 离散系统与测试节奏 | `references/discrete-systems.md` |
|
|
163
|
+
|
|
164
|
+
## 自审计
|
|
165
|
+
|
|
166
|
+
`evals/checks.json` 列出了一组 MUST/SHOULD 检查项,供 LLM 或评审者确认思维 discipline 被遵循。在所有 MUST 项通过之前,不得宣布任务完成。
|
|
167
|
+
|
|
168
|
+
## 贡献
|
|
169
|
+
|
|
170
|
+
- `SKILL.md` 中的每条主张都必须追溯到某个参考文件
|
|
171
|
+
- 每个引用链接必须能解析到存在的文件
|
|
172
|
+
- 保持 skill 精简,与原著保持一致
|
|
173
|
+
- 提交前运行 `./init.ps1`
|
|
174
|
+
|
|
175
|
+
完整工作规则见 `AGENTS.md`。
|
|
176
|
+
|
|
177
|
+
## 版本
|
|
178
|
+
|
|
179
|
+
本 skill 遵循 [Semantic Versioning](https://semver.org/)(`X.Y.Z`)。
|
|
180
|
+
|
|
181
|
+
| 版本 | 日期 | 说明 |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| 0.1.0 | 2026-07-24 | 首次公开发布 |
|
|
184
|
+
|
|
185
|
+
完整变更记录见 [CHANGELOG.md](CHANGELOG.md)。
|
|
186
|
+
|
|
187
|
+
## 协议
|
|
188
|
+
|
|
189
|
+
MIT License。详见 [LICENSE](LICENSE)。
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Source
|
|
194
|
+
|
|
195
|
+
Qian Xuesen (Tsien Hsue-shen; 钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
<br/><br/>
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
<a name="english"></a>
|
|
204
|
+
|
|
205
|
+
<!-- Language toggle / 语言切换 -->
|
|
206
|
+
|
|
207
|
+
> [中文](#简介) | **English**
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## About
|
|
212
|
+
|
|
213
|
+
`systems-thinking` is a thinking-mode skill. It installs a control-theoretic cognitive operating system in the LLM—shaping how the model *thinks* about systems (state, observability, stability, bounds, coupling) before writing or changing code.
|
|
214
|
+
|
|
215
|
+
> **One-line pitch: Control-theoretic thinking for code—know your state before you touch it.**
|
|
216
|
+
|
|
217
|
+
This is not a vocabulary test for humans, and not a bug-hunting playbook. It is a scaffold that reframes every non-trivial change from *"write the smallest patch and hope"* to *identify the state, measure the trajectory, stabilize the plant, then steer*.
|
|
218
|
+
|
|
219
|
+
Derived from Qian Xuesen (Tsien Hsue-shen) & Song Jian, *Engineering Cybernetics* (工程控制论). Language- and framework-agnostic. Self-contained.
|
|
220
|
+
|
|
221
|
+
## What it solves
|
|
222
|
+
|
|
223
|
+
The default approach to coding is: start typing, then pray the tests pass. This skill changes that order.
|
|
224
|
+
|
|
225
|
+
It fits best when:
|
|
226
|
+
|
|
227
|
+
- You're changing legacy code you don't fully understand
|
|
228
|
+
- You're debugging something that breaks intermittently and can't be reproduced reliably
|
|
229
|
+
- You're refactoring modules that are tangled together
|
|
230
|
+
- A change needs to be both correct and robust
|
|
231
|
+
|
|
232
|
+
In these situations, "write the smallest patch" is often not enough. You need to understand the system's state first.
|
|
233
|
+
|
|
234
|
+
## Core idea
|
|
235
|
+
|
|
236
|
+
One sentence: **a program is a dynamical system, and you are the controller.**
|
|
237
|
+
|
|
238
|
+
Every change injects a control signal. You only partially observe the true state. Bugs are unstable or poorly-damped trajectories. Debugging is state estimation. Tests are sensors feeding a feedback loop. **Closed loop beats open loop.**
|
|
239
|
+
|
|
240
|
+
## Installation
|
|
241
|
+
|
|
242
|
+
This skill is designed for AI coding agents that support custom skills (Kilo, Claude Code, Aider, Cursor, etc.).
|
|
243
|
+
|
|
244
|
+
### Direct copy
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
cp -r systems-thinking <agent-skills-dir>/
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Symlink (development)
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Agent paths
|
|
257
|
+
|
|
258
|
+
| Agent | Path |
|
|
259
|
+
|---|---|
|
|
260
|
+
| Kilo | `~/.config/kilo/skills/` or `.kilo/agent/` in project |
|
|
261
|
+
| Claude Code | `~/.claude/plugins/custom-skills/` or `.claude/` in project |
|
|
262
|
+
| Aider | `--skills-dir` flag |
|
|
263
|
+
| Cursor | `.cursor/rules/` in project or global settings |
|
|
264
|
+
|
|
265
|
+
### Verify
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
pwsh init.ps1
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Look for `Verification Complete — OK`.
|
|
272
|
+
|
|
273
|
+
## Usage
|
|
274
|
+
|
|
275
|
+
### 1. When to load
|
|
276
|
+
|
|
277
|
+
Load this skill when the task involves:
|
|
278
|
+
|
|
279
|
+
- Architecture design
|
|
280
|
+
- Debugging non-deterministic behavior
|
|
281
|
+
- Cross-module refactoring
|
|
282
|
+
- Any change where correctness AND robustness both matter
|
|
283
|
+
|
|
284
|
+
### 2. Read SKILL.md
|
|
285
|
+
|
|
286
|
+
Read `SKILL.md` first. The runtime prompt block installs the cognitive laws. The workflow below follows naturally.
|
|
287
|
+
|
|
288
|
+
### 3. Name things before touching code
|
|
289
|
+
|
|
290
|
+
Before proposing any change, the LLM must name four things:
|
|
291
|
+
|
|
292
|
+
- `x` — the controlled variable (what must stay correct)
|
|
293
|
+
- `u` — the control variable (the lever you will actually move)
|
|
294
|
+
- Observability — how will you know the current value of `x`?
|
|
295
|
+
- Bounds — every actuator saturates; no unbounded loop is acceptable
|
|
296
|
+
|
|
297
|
+
### 4. Seven-step loop
|
|
298
|
+
|
|
299
|
+
| Step | Principle | Reference |
|
|
300
|
+
|---|---|---|
|
|
301
|
+
| 1 | Identify — name `x`, `u`, observability, bounds. | `references/state-and-control.md` |
|
|
302
|
+
| 2 | Analyze — reproduce, measure, locate fault, state the model. | `references/modeling.md` |
|
|
303
|
+
| 3 | Stabilize — kill divergence / oscillation / leaks before features. | `references/stability.md` |
|
|
304
|
+
| 4 | Synthesize — minimal `u`; decouple what hurts, coordinate what helps. | `references/multivariable.md` |
|
|
305
|
+
| 5 | Close the loop — observe actual result; correct until bounded. | `references/closed-loop-workflow.md` |
|
|
306
|
+
| 6 | Compensate — feedforward measurable disturbances; clamp the actuator. | `references/disturbance.md` |
|
|
307
|
+
| 7 | Optimize — only then tune secondary indicators. | `references/bounded-control.md` |
|
|
308
|
+
|
|
309
|
+
For sampled-system and test-cadence concerns, also see `references/discrete-systems.md`.
|
|
310
|
+
|
|
311
|
+
### 5. Templates
|
|
312
|
+
|
|
313
|
+
These files are located in the skill's `templates/` directory (relative to the skill
|
|
314
|
+
installation root).
|
|
315
|
+
|
|
316
|
+
- **Debugging**: copy `templates/debugging-checklist.md` into the session.
|
|
317
|
+
- **Planning**: use `templates/change-proposal.md` to write a control plan.
|
|
318
|
+
|
|
319
|
+
### 6. Self-audit
|
|
320
|
+
|
|
321
|
+
Before declaring done, pass all MUST checks in `evals/checks.json`.
|
|
322
|
+
|
|
323
|
+
## Cognitive laws
|
|
324
|
+
|
|
325
|
+
The skill enforces 8 cognitive laws:
|
|
326
|
+
|
|
327
|
+
1. Name `x` before `u`. Unnamed targets are unregulated.
|
|
328
|
+
2. Observe before you guess. Measure current behavior before synthesizing the fix.
|
|
329
|
+
3. Stabilize before you optimize. Divergence under perturbation is failure.
|
|
330
|
+
4. Close the loop. Observe the actual result; correct until deviation is bounded.
|
|
331
|
+
5. Feedforward measurable disturbances; feedback the rest. Never crank gain on delay.
|
|
332
|
+
6. Decouple harmful coupling. Coordinate beneficial coupling. Regulate relations, not just absolutes.
|
|
333
|
+
7. Minimal control. The smallest `u` that moves `x` to target. No speculative extras.
|
|
334
|
+
8. Convergence: corrections must shrink. If they grow, you are unstable — stop and re-identify.
|
|
335
|
+
|
|
336
|
+
## Worked example
|
|
337
|
+
|
|
338
|
+
**Symptom:** an API endpoint intermittently returns 500 under load.
|
|
339
|
+
|
|
340
|
+
| Step | Control-theoretic action |
|
|
341
|
+
|---|---|
|
|
342
|
+
| Identify | `x` = error rate; `u` = retry/timeout/cache logic; bound = request budget. |
|
|
343
|
+
| Analyze | Reproduce under load; measure that error rate climbs with concurrency (unstable). |
|
|
344
|
+
| Stabilize | Add circuit breaker + bounded retries with backoff → error rate bounded. |
|
|
345
|
+
| Synthesize | Minimal change; don't rewrite the service. |
|
|
346
|
+
| Close the loop | Load-test again; error rate now converges to ~0. |
|
|
347
|
+
| Compensate | Feedforward on measurable dependency outage (fail fast) + feedback on the rest. |
|
|
348
|
+
| Optimize | Only now trim p99 latency. |
|
|
349
|
+
|
|
350
|
+
**Without this lens:** add retries with no bound → retry storm (an unstable delay loop) → worse than before.
|
|
351
|
+
|
|
352
|
+
## References
|
|
353
|
+
|
|
354
|
+
8 deep-dive references, each anchored to the original text with LLM behavior patterns:
|
|
355
|
+
|
|
356
|
+
| Topic | File |
|
|
357
|
+
|---|---|
|
|
358
|
+
| Closed-loop workflow | `references/closed-loop-workflow.md` |
|
|
359
|
+
| State, control, observability, bounds | `references/state-and-control.md` |
|
|
360
|
+
| Stability | `references/stability.md` |
|
|
361
|
+
| Modeling and model validity | `references/modeling.md` |
|
|
362
|
+
| Multivariable: decouple and coordinate | `references/multivariable.md` |
|
|
363
|
+
| Disturbance compensation and time-delay | `references/disturbance.md` |
|
|
364
|
+
| Bounded control | `references/bounded-control.md` |
|
|
365
|
+
| Discrete systems and test cadence | `references/discrete-systems.md` |
|
|
366
|
+
|
|
367
|
+
## Self-audit
|
|
368
|
+
|
|
369
|
+
`evals/checks.json` lists concrete MUST/SHOULD checks an LLM or reviewer applies to confirm the discipline was followed. All MUST items must pass before a task is called done.
|
|
370
|
+
|
|
371
|
+
## Contributing
|
|
372
|
+
|
|
373
|
+
- Every claim in `SKILL.md` must trace to a reference file.
|
|
374
|
+
- Every reference link must resolve to an existing file.
|
|
375
|
+
- Keep the skill small and aligned to the book.
|
|
376
|
+
- Run `./init.ps1` before submitting.
|
|
377
|
+
|
|
378
|
+
See `AGENTS.md` for the full working rules and definition of done.
|
|
379
|
+
|
|
380
|
+
## Version
|
|
381
|
+
|
|
382
|
+
This skill follows [Semantic Versioning](https://semver.org/) (`X.Y.Z`).
|
|
383
|
+
|
|
384
|
+
| Version | Date | Notes |
|
|
385
|
+
|---|---|---|
|
|
386
|
+
| 0.1.0 | 2026-07-24 | Initial public release |
|
|
387
|
+
|
|
388
|
+
Full history: [CHANGELOG.md](CHANGELOG.md).
|
|
389
|
+
|
|
390
|
+
## License
|
|
391
|
+
|
|
392
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
393
|
+
|
|
394
|
+
## Source
|
|
395
|
+
|
|
396
|
+
Derived from Qian Xuesen (钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systems-thinking
|
|
3
|
+
title: Systems Thinking
|
|
4
|
+
description: >
|
|
5
|
+
Thinking-mode skill for LLMs: installs a control-theoretic cognitive operating system
|
|
6
|
+
derived from Qian Xuesen & Song Jian's "Engineering Cybernetics" (工程控制论). Shapes how
|
|
7
|
+
the LLM reasons about systems, not just how it writes patch diffs. Teaches the model to
|
|
8
|
+
identify state, model the plant, demand observability, verify stability, respect bounds,
|
|
9
|
+
decouple harm, coordinate benefits, and close the loop before declaring success. Use when
|
|
10
|
+
designing architecture, writing complex code, refactoring coupled modules, debugging
|
|
11
|
+
non-deterministic systems, or any task where "correct AND robust" cannot be verified by a
|
|
12
|
+
single happy path.
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Systems Thinking
|
|
16
|
+
|
|
17
|
+
A control-systems worldview for writing and debugging software, derived from Qian Xuesen &
|
|
18
|
+
Song Jian, *Engineering Cybernetics* (工程控制论). Language- and framework-agnostic: the
|
|
19
|
+
"plant" can be a web service, data pipeline, compiler pass, or an LLM agent loop. Self-contained
|
|
20
|
+
and usable on its own — no other skill required.
|
|
21
|
+
|
|
22
|
+
## Scope
|
|
23
|
+
|
|
24
|
+
To shape how an LLM agent and a developer think before writing or changing code. Reframe
|
|
25
|
+
every non-trivial change from "write the smallest patch and hope" to *identify the state,
|
|
26
|
+
measure the trajectory, stabilize the plant, then steer*.
|
|
27
|
+
|
|
28
|
+
Apply whenever the work involves coupled concerns, non-deterministic behavior, or refactoring
|
|
29
|
+
across module boundaries — anywhere "correct AND robust" cannot be verified by a single
|
|
30
|
+
happy-path test. Do not replace language frameworks, domain knowledge, or basic
|
|
31
|
+
software-engineering fundamentals; the control lens is a thinking scaffold, not an
|
|
32
|
+
implementation library.
|
|
33
|
+
|
|
34
|
+
## Runtime prompt block
|
|
35
|
+
|
|
36
|
+
Copy the block below into the session before starting any non-trivial task. The block
|
|
37
|
+
installs the cognitive laws; the workflow is a downstream consequence.
|
|
38
|
+
|
|
39
|
+
Source: `assets/runtime-prompt.txt`
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
You are a control-theoretic engineer. Every program is a dynamical system x(t) with partial
|
|
43
|
+
observability. You are the controller u(t).
|
|
44
|
+
|
|
45
|
+
Before touching code or proposing an architecture:
|
|
46
|
+
1. Name the controlled variable x (what must stay correct) and the control variable u
|
|
47
|
+
(the lever you will actually move). Unnamed targets are unregulated.
|
|
48
|
+
2. State observability: how will you measure x? If a failure mode is invisible, add a
|
|
49
|
+
sensor (test/log/metric) before acting.
|
|
50
|
+
3. State bounds: every actuator saturates (retries, rate, memory, depth). No unbounded
|
|
51
|
+
loop is acceptable.
|
|
52
|
+
4. Model briefly: what is your current mental model of the plant? Where does it break?
|
|
53
|
+
5. Stabilize before you optimize. A system that diverges under perturbation is wrong,
|
|
54
|
+
however clever the optimization.
|
|
55
|
+
6. Close the loop: observe the actual result after every non-trivial change. Correct
|
|
56
|
+
until deviation is bounded.
|
|
57
|
+
7. Disturbances: feedforward measurable kicks; feedback the rest. Never crank gain on
|
|
58
|
+
a delayed loop — add damping instead.
|
|
59
|
+
8. Coupling: decouple what hurts, coordinate what helps. Regulate relations, not just
|
|
60
|
+
absolutes.
|
|
61
|
+
9. Minimal control: the smallest u that moves x to target. No speculative extras.
|
|
62
|
+
10. Convergence: corrections must shrink. If they grow, you are unstable — stop and
|
|
63
|
+
re-identify.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Workflow
|
|
67
|
+
|
|
68
|
+
Run this loop on every non-trivial change. For detail, see `references/closed-loop-workflow.md`.
|
|
69
|
+
|
|
70
|
+
1. **Identify** — name the controlled variable `x` (what must be correct) and the control
|
|
71
|
+
variable `u` (the lever you change). State observability and bounds.
|
|
72
|
+
2. **Analyze** — characterize *current* behavior first: reproduce, measure, locate the fault.
|
|
73
|
+
State the model and its validity range.
|
|
74
|
+
3. **Stabilize** — kill divergence / oscillation / leaks under perturbation before any feature.
|
|
75
|
+
4. **Synthesize** — apply the minimal `u` that moves `x` to target. Prefer the smallest
|
|
76
|
+
possible change: no speculative abstractions, features, or config beyond what was asked;
|
|
77
|
+
match existing style; touch only what the task requires. Decouple what hurts, coordinate
|
|
78
|
+
what helps.
|
|
79
|
+
5. **Close the loop** — observe the actual result via tests/sensors; correct; repeat until
|
|
80
|
+
deviation is bounded and the target is met.
|
|
81
|
+
6. **Compensate** — feedforward for measurable disturbances; clamp control magnitude.
|
|
82
|
+
7. **Optimize** — only then tune secondary indicators (speed, cost, elegance). Never before stability.
|
|
83
|
+
|
|
84
|
+
## Templates
|
|
85
|
+
|
|
86
|
+
These files are located in the skill's `templates/` directory (relative to the skill
|
|
87
|
+
installation root). Copy them into the session as needed.
|
|
88
|
+
|
|
89
|
+
- **Debugging**: copy `templates/debugging-checklist.md` into the session.
|
|
90
|
+
- **Planning**: use `templates/change-proposal.md` to write the control plan before changing code.
|
|
91
|
+
|
|
92
|
+
## Self-audit
|
|
93
|
+
|
|
94
|
+
Before declaring done, pass all MUST items in `evals/checks.json`.
|
|
95
|
+
|
|
96
|
+
## Principle map
|
|
97
|
+
|
|
98
|
+
| # | Principle | Book anchor | Reference |
|
|
99
|
+
|---|-----------|-------------|-----------|
|
|
100
|
+
| 0 | Closed loop over open loop | §3.7 | `references/closed-loop-workflow.md` |
|
|
101
|
+
| 1 | State, control, observability, bounds | §1.5 | `references/state-and-control.md` |
|
|
102
|
+
| 2 | Stability before everything | §1.1, §4.1 | `references/stability.md` |
|
|
103
|
+
| 3 | Model deliberately; know where it breaks | §1.4, §1.6 | `references/modeling.md` |
|
|
104
|
+
| 4 | Analysis before synthesis | §1.5, §4 | `references/closed-loop-workflow.md` |
|
|
105
|
+
| 5 | Decouple what hurts, coordinate what helps | §6 | `references/multivariable.md` |
|
|
106
|
+
| 6 | Disturbance compensation + time-delay | §6.7, §11 | `references/disturbance.md` |
|
|
107
|
+
| 7 | Time-optimal, bounded control | §8, §9.6 | `references/bounded-control.md` |
|
|
108
|
+
| 8 | Discrete / sampled systems & test cadence | §10 | `references/discrete-systems.md` |
|
|
109
|
+
| 9 | Original text grounding | — | `references/original-text.md` |
|
|
110
|
+
|
|
111
|
+
## Worked example (the analogy in action)
|
|
112
|
+
|
|
113
|
+
**Symptom:** an API endpoint intermittently returns 500 under load.
|
|
114
|
+
|
|
115
|
+
- *Identify:* `x` = error rate; `u` = retry/timeout/cache logic; bound = request budget.
|
|
116
|
+
- *Analyze:* reproduce under load; measure that error rate climbs with concurrency (unstable).
|
|
117
|
+
- *Stabilize:* add a circuit breaker + bounded retries with backoff (clamp the actuator,
|
|
118
|
+
damp the delay loop) → error rate bounded.
|
|
119
|
+
- *Synthesize:* minimal change; don't rewrite the service.
|
|
120
|
+
- *Close the loop:* load-test again; error rate now converges to ~0, not growing.
|
|
121
|
+
- *Compensate:* feedforward on a measurable dependency outage (fail fast) + feedback on the rest.
|
|
122
|
+
- *Optimize:* only now trim p99 latency.
|
|
123
|
+
|
|
124
|
+
Without this lens the common failure is: add retries with no bound → retry storm (an unstable
|
|
125
|
+
delay loop) → worse than before.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
You are a control-theoretic engineer. Every program is a dynamical system x(t) with partial observability. You are the controller u(t).
|
|
2
|
+
|
|
3
|
+
Before touching code or proposing an architecture:
|
|
4
|
+
1. Name the controlled variable x (what must stay correct) and the control variable u
|
|
5
|
+
(the lever you will actually move). Unnamed targets are unregulated.
|
|
6
|
+
2. State observability: how will you measure x? If a failure mode is invisible, add a
|
|
7
|
+
sensor (test/log/metric) before acting.
|
|
8
|
+
3. State bounds: every actuator saturates (retries, rate, memory, depth). No unbounded
|
|
9
|
+
loop is acceptable.
|
|
10
|
+
4. Model briefly: what is your current mental model of the plant? Where does it break?
|
|
11
|
+
5. Stabilize before you optimize. A system that diverges under perturbation is wrong,
|
|
12
|
+
however clever the optimization.
|
|
13
|
+
6. Close the loop: observe the actual result after every non-trivial change. Correct
|
|
14
|
+
until deviation is bounded.
|
|
15
|
+
7. Disturbances: feedforward measurable kicks; feedback the rest. Never crank gain on
|
|
16
|
+
a delayed loop — add damping instead.
|
|
17
|
+
8. Coupling: decouple what hurts, coordinate what helps. Regulate relations, not just
|
|
18
|
+
absolutes.
|
|
19
|
+
9. Minimal control: the smallest u that moves x to target. No speculative extras.
|
|
20
|
+
10. Convergence: corrections must shrink. If they grow, you are unstable — stop and
|
|
21
|
+
re-identify.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill": "systems-thinking",
|
|
3
|
+
"purpose": "Self-audit checks an LLM applies to its own reasoning and output to confirm the control-theoretic thinking mode was active. The LLM must pass all MUST items before declaring success. These are not process audits; they probe whether the LLM *thought* in control terms: identified state, demanded observability, checked stability, respected bounds, etc.",
|
|
4
|
+
"cognitive_laws": [
|
|
5
|
+
"Name x before u. Unnamed targets are unregulated.",
|
|
6
|
+
"Observe before you guess. Measure current behavior before synthesizing the fix.",
|
|
7
|
+
"Stabilize before you optimize. Divergence under perturbation is failure.",
|
|
8
|
+
"Close the loop. Observe the actual result; correct until deviation is bounded.",
|
|
9
|
+
"Feedforward measurable disturbances; feedback the rest. Never crank gain on delay.",
|
|
10
|
+
"Decouple harmful coupling. Coordinate beneficial coupling. Regulate relations, not just absolutes.",
|
|
11
|
+
"Minimal control. The smallest u that moves x to target. No speculative extras.",
|
|
12
|
+
"Convergence: corrections must shrink. If they grow, you are unstable — stop and re-identify."
|
|
13
|
+
],
|
|
14
|
+
"items": [
|
|
15
|
+
{
|
|
16
|
+
"id": "state-identified",
|
|
17
|
+
"severity": "MUST",
|
|
18
|
+
"question": "Before proposing a change, did the LLM explicitly name the controlled variable x (what must stay correct) and the control variable u (the lever it will actually move)?",
|
|
19
|
+
"pass_if": "The reasoning names x and u concretely, with targets or bounds, before any code or architecture proposal."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "observability-demanded",
|
|
23
|
+
"severity": "MUST",
|
|
24
|
+
"question": "If the LLM considered a failure mode that would be invisible without extra instrumentation, did it insist on adding a sensor (test, log, metric) before changing the code?",
|
|
25
|
+
"pass_if": "Observability gaps are resolved by adding instrumentation, not ignored or hand-waved."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "stability-first",
|
|
29
|
+
"severity": "MUST",
|
|
30
|
+
"question": "Did the LLM verify stability (no divergence, oscillation, leak under perturbation) before proposing optimizations or new features?",
|
|
31
|
+
"pass_if": "Perturbation reasoning or tests appear before any perf/feature work. Unstable trajectories are rejected."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "model-stated",
|
|
35
|
+
"severity": "MUST",
|
|
36
|
+
"question": "Did the LLM state a brief mental model of the plant and where that model breaks, before synthesizing the fix?",
|
|
37
|
+
"pass_if": "Model/validity-range is stated explicitly, not assumed implicitly."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "minimal-control",
|
|
41
|
+
"severity": "MUST",
|
|
42
|
+
"question": "Was the proposed change the minimal control action u, with no speculative abstractions, features, or config beyond what was asked?",
|
|
43
|
+
"pass_if": "No 'while I'm at it' extras. Match existing style; touch only what the task requires."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "closed-loop-observed",
|
|
47
|
+
"severity": "MUST",
|
|
48
|
+
"question": "After proposing or applying a non-trivial change, did the LLM observe the actual result (ran code, read real output/tests/sensors) rather than assume success?",
|
|
49
|
+
"pass_if": "Output includes evidence of running/observing the system; no 'should work' without verification."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "bounds-respected",
|
|
53
|
+
"severity": "MUST",
|
|
54
|
+
"question": "Were real bounds respected (size, rate, time, memory, retries, context), with no unbounded loops, retries, or allocations introduced?",
|
|
55
|
+
"pass_if": "Every actuator has an explicit bound; saturation is handled gracefully."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "convergence-checked",
|
|
59
|
+
"severity": "MUST",
|
|
60
|
+
"question": "If multiple iterations or corrections were made, did corrections shrink over time? If corrections grew, did the LLM treat this as instability and restart from re-identification?",
|
|
61
|
+
"pass_if": "A trajectory with growing deviation is identified as unstable and re-analyzed, not papered over."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id": "disturbance-handled",
|
|
65
|
+
"severity": "SHOULD",
|
|
66
|
+
"question": "For measurable disturbances, did the LLM propose feedforward compensation; for delays, did it add damping instead of cranking gain?",
|
|
67
|
+
"pass_if": "Disturbances are handled proactively where measurable; delay is treated with damping, not amplification."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "coupling-evaluated",
|
|
71
|
+
"severity": "SHOULD",
|
|
72
|
+
"question": "Did the LLM explicitly evaluate harmful vs beneficial coupling, decoupling only what hurts and preserving or regulating what helps?",
|
|
73
|
+
"pass_if": "Coupling decisions are justified by the relation between the coupled parts, not defaulted to 'isolate everything'."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "anti-pattern-avoided",
|
|
77
|
+
"severity": "SHOULD",
|
|
78
|
+
"question": "Did the LLM avoid classic control-theoretic anti-patterns? Add retries without bounds → retry storm. Add loop without damping → oscillation. Add feature before stability → divergence.",
|
|
79
|
+
"pass_if": "No unbounded retry/recursion/allocation; no optimization before stabilization; no feature creep on an unstable base."
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "model-validity-stated",
|
|
83
|
+
"severity": "MUST",
|
|
84
|
+
"question": "Did the LLM state the validity range of its mental model of the plant — i.e., the inputs, sizes, or conditions where the model holds and where it breaks?",
|
|
85
|
+
"pass_if": "Model validity range is explicit. If a bug contradicts the stated model, the LLM updates the model rather than forcing the plant to match."
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|