rulemux 0.0.1 → 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/README.md +230 -19
- package/README.zh-CN.md +227 -0
- package/bin/rulemux.js +83 -0
- package/dist/rulemux-darwin-amd64 +0 -0
- package/dist/rulemux-darwin-arm64 +0 -0
- package/dist/rulemux-linux-amd64 +0 -0
- package/dist/rulemux-linux-arm64 +0 -0
- package/dist/rulemux-windows-amd64.exe +0 -0
- package/package.json +28 -4
- package/AGENTS.md +0 -64
- package/RULES.md +0 -113
- package/docs/PROGRESS-HISTORY.md +0 -11
- package/docs/PROGRESS.md +0 -42
- package/docs/README.md +0 -113
- package/docs/design/architecture.md +0 -38
- package/docs/design/external/agent-rules-dirs.md +0 -22
- package/docs/design/features/dir-sync.md +0 -28
- package/docs/design/features/hook-injection.md +0 -35
- package/docs/design/features/verification.md +0 -16
- package/docs/design/features.md +0 -11
- package/docs/design/requirements.md +0 -43
- package/docs/worklog/docs-reorg.md +0 -71
package/README.md
CHANGED
|
@@ -1,31 +1,242 @@
|
|
|
1
1
|
# rulemux
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
3
|
+
> One set of rules, delivered to every AI coding agent.
|
|
4
|
+
> Same effect and same token cost as writing `AGENTS.md` by hand — **never fades out, never accumulates, no symlinks, free to add and remove files**.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
[中文版](README.zh-CN.md) | [Design docs](docs/design/architecture.md)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
`rulemux` 负责把这份真源同步到各家 agent 的工作区规则目录 —— 一处管理,多处生效。
|
|
8
|
+
---
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
(为什么不靠 hook 注入:见 [`docs/design/architecture.md`](docs/design/architecture.md) §二)
|
|
10
|
+
## 1. What is this
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
You maintain a set of rule documents (coding conventions, project rules, …) and want every AI
|
|
13
|
+
coding agent to read them in every workspace — with the exact same effect as if you had written
|
|
14
|
+
`AGENTS.md` yourself.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
`rulemux` takes the source files you list in a config and copies them into each agent's **native
|
|
17
|
+
workspace rules directory**. You manage them in one place; they take effect everywhere.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
- rulemux **does not own or maintain any rule content**. Your source files stay yours — rulemux
|
|
20
|
+
only copies them. Which agents / workspaces they apply to is declared in your config.
|
|
21
|
+
- **The session hook is only the courier.** It is not used to inject text. Files are really copied
|
|
22
|
+
into the directory the agent loads natively, so they enjoy static-prefix semantics: they never
|
|
23
|
+
fade out mid-conversation, and they never accumulate.
|
|
24
|
+
- Invariants: **no symlinks** (real copies only) and **free add/remove** (delete a source from the
|
|
25
|
+
config and its copy disappears on the next sync).
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
> Why not "just inject with a hook"? Hook injection lands in the dynamic part of the context: it
|
|
28
|
+
> gets summarised away on compaction (fades out) or re-appended every turn (token blow-up).
|
|
29
|
+
> See [design/architecture.md](docs/design/architecture.md) §一.
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
---
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
## 2. Supported scope
|
|
34
|
+
|
|
35
|
+
rulemux ships **one adapter per agent**, and an adapter is only installable once its rules
|
|
36
|
+
directory and hook location have been confirmed by a real canary test. Today:
|
|
37
|
+
|
|
38
|
+
| Agent | Tier | Rules directory | Status |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| **codebuddy** | Tier-1 (real copy) | `.codebuddy/rules/` | ✅ **Verified — installable** |
|
|
41
|
+
| **workbuddy** | Tier-1 (real copy) | `.codebuddy/rules/` (shared with CodeBuddy) | ✅ **Verified — installable** |
|
|
42
|
+
| claude (Claude Code) | Tier-1 | `.claude/rules/` | ⚠️ registered, **not verified yet** — cannot be installed |
|
|
43
|
+
| trae (Trae) | Tier-1 | `.trae/rules/` | ⚠️ registered, **not verified yet** — cannot be installed |
|
|
44
|
+
| codex | Tier-2 (injection) | none — injects into context | ⚠️ registered, **not verified yet** |
|
|
45
|
+
| opencode | Tier-2 (injection) | none — injects into context | ⚠️ registered, **not verified yet** |
|
|
46
|
+
|
|
47
|
+
- `rulemux init` **refuses** any agent that is not verified — it will not half-install an adapter
|
|
48
|
+
whose behaviour has not been proven. `rulemux doctor` marks unverified agents with ⚠.
|
|
49
|
+
- **Tier-2 is a deliberate downgrade** for agents that have no rules directory (they only read a
|
|
50
|
+
single `AGENTS.md`). It injects via the session hook and never touches your own `AGENTS.md`, but
|
|
51
|
+
it cannot satisfy the "never fades out" bar. See
|
|
52
|
+
[design/features/hook-injection.md](docs/design/features/hook-injection.md).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. Install
|
|
57
|
+
|
|
58
|
+
rulemux is a **single Go binary with zero third-party dependencies**.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# a) from a GitHub Release (recommended): put the binary on your PATH
|
|
62
|
+
# e.g. /usr/local/bin/rulemux (Windows: rulemux.exe)
|
|
63
|
+
|
|
64
|
+
# b) from source
|
|
65
|
+
go install github.com/cq-guojia/rulemux@latest
|
|
66
|
+
# or
|
|
67
|
+
git clone https://github.com/cq-guojia/rulemux.git && cd rulemux && go build -o rulemux .
|
|
68
|
+
|
|
69
|
+
# c) via npm (convenience channel that puts the binary on your PATH)
|
|
70
|
+
npm i -g rulemux
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
There is **no auto-update**. Upgrades are manual and handled by your package manager
|
|
74
|
+
(`go install …@latest`, Homebrew/Scoop/apt later on). This is a deliberate decision — see
|
|
75
|
+
[design/requirements.md](docs/design/requirements.md) §五.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 4. Quick start
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# 1. Install the session hook for an agent (--agent is REQUIRED)
|
|
83
|
+
rulemux init --agent codebuddy
|
|
84
|
+
# First run also writes a sample config to ~/.rulemux/config.toml
|
|
85
|
+
|
|
86
|
+
# 2. Edit ~/.rulemux/config.toml and point `path` at your real rule files
|
|
87
|
+
|
|
88
|
+
rulemux doctor # 3. Self-check: binary/PATH, agents, config validity
|
|
89
|
+
rulemux verify # 4. Canary check: drop a probe and ask the agent to recite its token
|
|
90
|
+
|
|
91
|
+
# From now on every new session triggers `rulemux sync --agent codebuddy` automatically.
|
|
92
|
+
|
|
93
|
+
rulemux uninstall --agent codebuddy # remove rulemux again (--yes skips the confirmation)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Where the hook goes:** into the **user-level host config** `~/.codebuddy/settings.json` (the same
|
|
97
|
+
place a tool like Hindsight registers itself). **Install once, and it applies to every workspace** —
|
|
98
|
+
you do *not* re-run `init` per project. When it fires, rulemux uses the current workspace (its cwd)
|
|
99
|
+
to match the `workspace` entries in your config and decides what to deliver.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 5. Configuration
|
|
104
|
+
|
|
105
|
+
Config file: `~/.rulemux/config.toml` (override with `--config <path>` on any command).
|
|
106
|
+
|
|
107
|
+
### 5.1 Each `[[source]]`
|
|
108
|
+
|
|
109
|
+
| Field | Meaning |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `path` | Source file(s), anywhere on disk. Single value or a list. A list shares the `agents`/`workspace` below. |
|
|
112
|
+
| `agents` | Which agents receive this batch. Omitted = all supported agents. |
|
|
113
|
+
| `workspace` | Which workspaces these rules apply to. Omitted / `"*"` / `"**"` / `"all"` = every workspace. Single value, a list, or a glob. |
|
|
114
|
+
|
|
115
|
+
Globbing follows the usual rules: `*` is one path segment, `**` spans segments and may appear in
|
|
116
|
+
the middle — e.g. `workspace = "/abs/**/B"` matches a directory named `B` at any depth.
|
|
117
|
+
|
|
118
|
+
```toml
|
|
119
|
+
[[source]]
|
|
120
|
+
path = ["/your/rules/a.md", "/your/rules/b.md"]
|
|
121
|
+
agents = ["codebuddy"] # omit to target every supported agent
|
|
122
|
+
# workspace is omitted => every workspace
|
|
123
|
+
# workspace = ["/path/to/proj-a", "/path/to/proj-b"]
|
|
124
|
+
# workspace = "/abs/**/B" # glob: any depth, named B
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 5.2 Bundling with "groups" (optional)
|
|
128
|
+
|
|
129
|
+
When you have many files, bundle them and reference the bundle by name.
|
|
130
|
+
|
|
131
|
+
```toml
|
|
132
|
+
# ---- File groups ---------------------------------------------------------
|
|
133
|
+
[[file_group]]
|
|
134
|
+
name = "base"
|
|
135
|
+
path = ["/your/rules/team-conventions.md", "/your/rules/style.md"]
|
|
136
|
+
|
|
137
|
+
[[file_group]]
|
|
138
|
+
name = "proj"
|
|
139
|
+
use = ["base"] # nests the base group (a list: ["base", "dev"])
|
|
140
|
+
path = ["/your/rules/project-a.md"]
|
|
141
|
+
|
|
142
|
+
# ---- Workspace groups ----------------------------------------------------
|
|
143
|
+
[[workspace_group]]
|
|
144
|
+
name = "dev"
|
|
145
|
+
workspace = ["/path/to/proj-1", "/path/to/proj-2"]
|
|
146
|
+
|
|
147
|
+
# ---- Use them ------------------------------------------------------------
|
|
148
|
+
[[source]]
|
|
149
|
+
groups = ["base", "proj"] # expands to every file in those groups
|
|
150
|
+
path = ["/your/rules/extra.md"] # mixing is allowed: groups + standalone files
|
|
151
|
+
agents = ["codebuddy"]
|
|
152
|
+
workspace_groups = ["dev"] # expands to every workspace in the group
|
|
153
|
+
workspace = ["/path/to/standalone"] # also allowed alongside workspace_groups
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Things worth knowing:
|
|
157
|
+
|
|
158
|
+
- **`use` is a list** — `use = ["dev", "qa"]` reuses several groups at once, and groups nest
|
|
159
|
+
(A pulls in B plus its own files).
|
|
160
|
+
- **Mixing is allowed**: `groups` with `path`, and `workspace_groups` with `workspace`, in the same
|
|
161
|
+
source. The result is the union.
|
|
162
|
+
- **Duplicates are harmless** — everything is deduplicated by value, so each file is processed once.
|
|
163
|
+
- File groups and workspace groups are **separate namespaces**; the same name may be used in both.
|
|
164
|
+
|
|
165
|
+
### 5.3 What sync does, and what it never touches
|
|
166
|
+
|
|
167
|
+
On every sync rulemux computes the set of prefixed files that should exist, then removes any
|
|
168
|
+
`.rulemux__*` file that is not in that set, copies/overwrites the ones that are missing or changed,
|
|
169
|
+
and skips the rest.
|
|
170
|
+
|
|
171
|
+
- Destination name: `.rulemux__` + source basename (a short hash is appended on name collisions).
|
|
172
|
+
- **Your source files are only ever read** — never modified or deleted.
|
|
173
|
+
- **Files without the `.rulemux__` prefix in the rules directory are never touched**, so your own
|
|
174
|
+
rule files stay safe.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 6. Uninstalling
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
rulemux uninstall --agent codebuddy # one agent (comma-separated for several)
|
|
182
|
+
rulemux uninstall --off # every agent (--all is the same)
|
|
183
|
+
rulemux uninstall --agent codebuddy --yes # skip the confirmation prompt
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
It removes rulemux's own hook entry (other tools' hooks in the same file are preserved) and deletes
|
|
187
|
+
the `.rulemux__*` files it previously delivered. Because the hook lives in the user-level config,
|
|
188
|
+
rulemux also **revisits every workspace recorded in its ledger** (`~/.rulemux/workspaces.json`) and
|
|
189
|
+
cleans those too — otherwise, with the hook gone, that residue could never be removed again. You are
|
|
190
|
+
shown the list of workspaces before anything is deleted.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 7. Commands
|
|
195
|
+
|
|
196
|
+
| Command | What it does |
|
|
197
|
+
|---|---|
|
|
198
|
+
| `rulemux sync [--agent <id>] [--config <path>] [--workspace <dir>]` | Sync rules (called by each agent's SessionStart hook) |
|
|
199
|
+
| `rulemux inject --agent <id> [--config <path>]` | Tier-2: print rules to stdout for hook injection |
|
|
200
|
+
| `rulemux init --agent <id[,id...]> [--config <path>] [--workspace <dir>]` | Write a sample config and install the SessionStart hook |
|
|
201
|
+
| `rulemux doctor [--config <path>] [--workspace <dir>]` | Environment self-check |
|
|
202
|
+
| `rulemux verify --agent <id> [--clean] [--workspace <dir>]` | Canary acceptance test |
|
|
203
|
+
| `rulemux uninstall --agent <id[,id...]> \| --off \| --all [--yes]` | Remove hooks and delivered files |
|
|
204
|
+
|
|
205
|
+
Run `rulemux` with no arguments for the full help.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 8. Roadmap
|
|
210
|
+
|
|
211
|
+
Ongoing work and what comes next are tracked in [docs/PROGRESS.md](docs/PROGRESS.md). In short:
|
|
212
|
+
|
|
213
|
+
- **More agents** — finish the adapters that are already registered but unverified:
|
|
214
|
+
- **Trae** (`.trae/rules/`) and **Claude Code** (`.claude/rules/`) as Tier-1;
|
|
215
|
+
- **Codex** and **OpenCode** as Tier-2 injection.
|
|
216
|
+
Each one needs its rules directory and hook location confirmed by a real canary run before it is
|
|
217
|
+
switched on. The checklist for adding an agent lives in
|
|
218
|
+
[design/features/agent-onboarding.md](docs/design/features/agent-onboarding.md).
|
|
219
|
+
- **Distribution** — GitHub Actions cross-compilation plus Release artifacts (this also feeds the
|
|
220
|
+
npm package), and publishing the npm package properly.
|
|
221
|
+
- **Verification tooling** — make the canary check repeatable per agent.
|
|
222
|
+
- Rule content transformation, templating, and automatic self-update are **explicitly out of scope**
|
|
223
|
+
([design/requirements.md](docs/design/requirements.md) §五).
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 9. License
|
|
228
|
+
|
|
229
|
+
MIT — see [LICENSE](LICENSE).
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 10. Documentation
|
|
234
|
+
|
|
235
|
+
| Want to read | Where |
|
|
25
236
|
|---|---|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
237
|
+
| What the user actually wants (requirements / acceptance) | [docs/design/requirements.md](docs/design/requirements.md) |
|
|
238
|
+
| Why it is designed this way | [docs/design/architecture.md](docs/design/architecture.md) |
|
|
239
|
+
| Feature list | [docs/design/features.md](docs/design/features.md) |
|
|
240
|
+
| Checklist for adding a new agent | [docs/design/features/agent-onboarding.md](docs/design/features/agent-onboarding.md) |
|
|
241
|
+
| Each agent's rules directory (external facts) | [docs/design/external/agent-rules-dirs.md](docs/design/external/agent-rules-dirs.md) |
|
|
242
|
+
| Current progress and open items | [docs/PROGRESS.md](docs/PROGRESS.md) |
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# rulemux
|
|
2
|
+
|
|
3
|
+
> 一份规则,投递到各家 AI coding agent。
|
|
4
|
+
> 效果与 token 与直接写 `AGENTS.md` 一致:**永不淡出、不累积、不用软链、加删文件自由**。
|
|
5
|
+
|
|
6
|
+
[English](README.md) | [设计文档](docs/design/architecture.md)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. 这是什么
|
|
11
|
+
|
|
12
|
+
你维护着一套规则文档(编码约定、项目规矩……),希望每个 AI coding agent 在每个工作区都读到它,
|
|
13
|
+
且效果和直接写进 `AGENTS.md` 一模一样。
|
|
14
|
+
|
|
15
|
+
`rulemux` 把你在配置里列出的源文件,复制进各 agent **原生的工作区规则目录** —— 一处管理,多处生效。
|
|
16
|
+
|
|
17
|
+
- rulemux **不持有、不维护任何规则内容**。源文件完全由你维护,rulemux 只负责复制;
|
|
18
|
+
「适用于哪些 agent / 哪些工作区」在你的配置里声明。
|
|
19
|
+
- **会话钩子只当「投递员」,不用来注入文本**。文件是真正拷进 agent 原生加载的目录,
|
|
20
|
+
因此享有静态前缀语义 —— 不会随对话老化淡出,也不会每轮累积。
|
|
21
|
+
- 底线:**不用软链**(一律真实拷贝)、**加删自由**(配置里删掉某源文件,下次同步它的副本即消失)。
|
|
22
|
+
|
|
23
|
+
> 为什么不直接用钩子注入?注入落在上下文的动态区,压缩时会被摘要掉(淡出),
|
|
24
|
+
> 或每轮追加(token 爆炸)。见 [`docs/design/architecture.md`](docs/design/architecture.md) §一。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 2. 支持范围
|
|
29
|
+
|
|
30
|
+
rulemux **每个 agent 一套适配器**;只有「规则目录 + 钩子落点」经真实 canary 实测坐实的 agent
|
|
31
|
+
才允许安装。当前:
|
|
32
|
+
|
|
33
|
+
| Agent | 层级 | 规则目录 | 状态 |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| **codebuddy** | Tier-1(真实拷贝) | `.codebuddy/rules/` | ✅ **已验证,可安装** |
|
|
36
|
+
| **workbuddy** | Tier-1(真实拷贝) | `.codebuddy/rules/`(与 CodeBuddy 共用) | ✅ **已验证,可安装** |
|
|
37
|
+
| claude(Claude Code) | Tier-1 | `.claude/rules/` | ⚠️ 已注册,**尚未验证**,不可安装 |
|
|
38
|
+
| trae(Trae) | Tier-1 | `.trae/rules/` | ⚠️ 已注册,**尚未验证**,不可安装 |
|
|
39
|
+
| codex | Tier-2(注入) | 无 —— 注入上下文 | ⚠️ 已注册,**尚未验证** |
|
|
40
|
+
| opencode | Tier-2(注入) | 无 —— 注入上下文 | ⚠️ 已注册,**尚未验证** |
|
|
41
|
+
|
|
42
|
+
- `rulemux init` **会拒绝**未验证的 agent —— 不会给你装一个行为未经验证的半成品。
|
|
43
|
+
`rulemux doctor` 会给未验证的 agent 标 ⚠。
|
|
44
|
+
- **Tier-2 是刻意的降级**:面向没有规则目录、只认单个 `AGENTS.md` 的 agent,走会话钩子注入,
|
|
45
|
+
且绝不碰你自己的 `AGENTS.md`;但它满足不了「永不淡出」。见
|
|
46
|
+
[`docs/design/features/hook-injection.md`](docs/design/features/hook-injection.md)。
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. 安装
|
|
51
|
+
|
|
52
|
+
rulemux 是**零第三方依赖的 Go 单二进制**。
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# a) 从 GitHub Release 取预编译产物(推荐),放到 PATH
|
|
56
|
+
# 例如 /usr/local/bin/rulemux(Windows 用 rulemux.exe)
|
|
57
|
+
|
|
58
|
+
# b) 从源码
|
|
59
|
+
go install github.com/cq-guojia/rulemux@latest
|
|
60
|
+
# 或
|
|
61
|
+
git clone https://github.com/cq-guojia/rulemux.git && cd rulemux && go build -o rulemux .
|
|
62
|
+
|
|
63
|
+
# c) 通过 npm(把二进制放进 PATH 的便捷通道)
|
|
64
|
+
npm i -g rulemux
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**没有自动更新**。升级手动、交给包管理器(`go install …@latest`,将来 Homebrew / Scoop / apt)。
|
|
68
|
+
这是刻意决策,见 [`docs/design/requirements.md`](docs/design/requirements.md) §五。
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 4. 快速开始
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 1. 为指定 agent 安装会话钩子(--agent 必填)
|
|
76
|
+
rulemux init --agent codebuddy
|
|
77
|
+
# 首次运行还会生成示例配置 ~/.rulemux/config.toml
|
|
78
|
+
|
|
79
|
+
# 2. 编辑 ~/.rulemux/config.toml,把 path 改成你真实的规则文件
|
|
80
|
+
|
|
81
|
+
rulemux doctor # 3. 自检:二进制/PATH、各 agent 状态、配置合法性
|
|
82
|
+
rulemux verify # 4. canary 验收:投放探针,开新会话让 agent 念出暗号
|
|
83
|
+
|
|
84
|
+
# 此后每次开新会话,都会自动触发 rulemux sync --agent codebuddy
|
|
85
|
+
|
|
86
|
+
rulemux uninstall --agent codebuddy # 卸载(--yes 跳过确认)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**钩子装在哪**:装进 **user 级 host 配置** `~/.codebuddy/settings.json`(与 Hindsight 的落点同类)。
|
|
90
|
+
**一次安装、对所有工作区生效**,不必每个项目再跑一次 `init`。触发时 rulemux 以当前工作区(cwd)
|
|
91
|
+
去匹配配置里的 `workspace` 条目,决定投递哪些规则。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 5. 配置说明
|
|
96
|
+
|
|
97
|
+
配置文件:`~/.rulemux/config.toml`(各命令均可用 `--config <path>` 指定其它路径)。
|
|
98
|
+
|
|
99
|
+
### 5.1 每条 `[[source]]`
|
|
100
|
+
|
|
101
|
+
| 字段 | 含义 |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `path` | 源文件,磁盘任意位置;单个值或数组。数组内文件共享下面的 `agents` / `workspace` |
|
|
104
|
+
| `agents` | 投递给哪些 agent;省略 = 全部已支持的 agent |
|
|
105
|
+
| `workspace` | 适用哪些工作区;省略 / `"*"` / `"**"` / `"all"` = 所有工作区;单个值、数组或 glob |
|
|
106
|
+
|
|
107
|
+
glob 沿用业界惯例:`*` 匹配单个路径段,`**` 跨段递归且可出现在中间 ——
|
|
108
|
+
例如 `workspace = "/abs/**/B"` 匹配任意深度下名为 `B` 的目录。
|
|
109
|
+
|
|
110
|
+
```toml
|
|
111
|
+
[[source]]
|
|
112
|
+
path = ["/你的规则/a.md", "/你的规则/b.md"]
|
|
113
|
+
agents = ["codebuddy"] # 省略则投递给全部已支持 agent
|
|
114
|
+
# workspace 省略 => 所有工作区
|
|
115
|
+
# workspace = ["/path/to/proj-a", "/path/to/proj-b"]
|
|
116
|
+
# workspace = "/abs/**/B" # glob:任意深度、名为 B
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 5.2 用「组」打包(可选)
|
|
120
|
+
|
|
121
|
+
文件多了之后,可以打包成组,按组名引用。
|
|
122
|
+
|
|
123
|
+
```toml
|
|
124
|
+
# ---- 文件组 --------------------------------------------------------------
|
|
125
|
+
[[file_group]]
|
|
126
|
+
name = "base"
|
|
127
|
+
path = ["/你的规则/team-conventions.md", "/你的规则/style.md"]
|
|
128
|
+
|
|
129
|
+
[[file_group]]
|
|
130
|
+
name = "proj"
|
|
131
|
+
use = ["base"] # 嵌套引用 base 组(数组:["base", "dev"])
|
|
132
|
+
path = ["/你的规则/project-a.md"]
|
|
133
|
+
|
|
134
|
+
# ---- 工作区分组 ----------------------------------------------------------
|
|
135
|
+
[[workspace_group]]
|
|
136
|
+
name = "dev"
|
|
137
|
+
workspace = ["/path/to/proj-1", "/path/to/proj-2"]
|
|
138
|
+
|
|
139
|
+
# ---- 引用它们 ------------------------------------------------------------
|
|
140
|
+
[[source]]
|
|
141
|
+
groups = ["base", "proj"] # 展开成这些组里的所有文件
|
|
142
|
+
path = ["/你的规则/extra.md"] # 允许混合:组 + 单独文件
|
|
143
|
+
agents = ["codebuddy"]
|
|
144
|
+
workspace_groups = ["dev"] # 展开成组内的所有工作区
|
|
145
|
+
workspace = ["/path/to/standalone"] # 也可与 workspace_groups 同时写
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
要点:
|
|
149
|
+
|
|
150
|
+
- **`use` 是数组** —— `use = ["dev", "qa"]` 一次复用多个组,且支持嵌套(A 组引入 B 组再加自己的文件)。
|
|
151
|
+
- **允许混合书写**:同一条 source 里 `groups` 可与 `path` 并存,`workspace_groups` 可与 `workspace` 并存,结果取并集。
|
|
152
|
+
- **重复无害** —— 最终按值去重,每个文件只处理一次。
|
|
153
|
+
- 文件组与工作区分组是**两套独立命名空间**,允许同名。
|
|
154
|
+
|
|
155
|
+
### 5.3 同步做了什么,以及绝不碰什么
|
|
156
|
+
|
|
157
|
+
每次同步:算出「应该存在的带前缀文件集合」,目标目录里不在这个集合中的 `.rulemux__*` 一律删除(删残留),
|
|
158
|
+
缺失或内容不一致的复制/覆盖,其余跳过。
|
|
159
|
+
|
|
160
|
+
- 目标文件名:`.rulemux__` + 源 basename(同名冲突时追加短 hash)。
|
|
161
|
+
- **源文件只被读取** —— 绝不修改、绝不删除。
|
|
162
|
+
- **规则目录里不带 `.rulemux__` 前缀的文件绝不触碰**,你自己的规则文件始终安全。
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 6. 卸载
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
rulemux uninstall --agent codebuddy # 单个 agent(逗号分隔可多个)
|
|
170
|
+
rulemux uninstall --off # 全部 agent(--all 等价)
|
|
171
|
+
rulemux uninstall --agent codebuddy --yes # 跳过交互确认
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
它会移除 rulemux 自己的钩子条目(同一文件里其它工具的钩子会保留),并删掉此前投递的 `.rulemux__*` 文件。
|
|
175
|
+
由于钩子在 user 级配置里,rulemux 还会**按账本(~/.rulemux/workspaces.json)回访所有记录过的工作区**
|
|
176
|
+
一并清理 —— 否则钩子一去,那些残留就再没机会被删掉了。删除前会把要回访的工作区列表给你确认。
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 7. 命令一览
|
|
181
|
+
|
|
182
|
+
| 命令 | 作用 |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `rulemux sync [--agent <id>] [--config <path>] [--workspace <dir>]` | 同步规则(由各 agent 的 SessionStart 钩子调用) |
|
|
185
|
+
| `rulemux inject --agent <id> [--config <path>]` | Tier-2:把规则输出到 stdout 供钩子注入 |
|
|
186
|
+
| `rulemux init --agent <id[,id...]> [--config <path>] [--workspace <dir>]` | 生成示例配置并安装 SessionStart 钩子 |
|
|
187
|
+
| `rulemux doctor [--config <path>] [--workspace <dir>]` | 环境自检 |
|
|
188
|
+
| `rulemux verify --agent <id> [--clean] [--workspace <dir>]` | canary 验收 |
|
|
189
|
+
| `rulemux uninstall --agent <id[,id...]> \| --off \| --all [--yes]` | 移除钩子与已投递文件 |
|
|
190
|
+
|
|
191
|
+
直接运行 `rulemux`(不带参数)可看完整帮助。
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 8. 后续计划
|
|
196
|
+
|
|
197
|
+
在办事项见 [`docs/PROGRESS.md`](docs/PROGRESS.md)。概要:
|
|
198
|
+
|
|
199
|
+
- **接入更多 agent** —— 补齐已注册但尚未验证的适配器:
|
|
200
|
+
- **Trae**(`.trae/rules/`)、**Claude Code**(`.claude/rules/`)走 Tier-1;
|
|
201
|
+
- **Codex**、**OpenCode** 走 Tier-2 注入。
|
|
202
|
+
每个 agent 都要先经真实 canary 坐实「规则目录 + 钩子落点」才开放。
|
|
203
|
+
接入一个新 agent 的完整清单见
|
|
204
|
+
[`docs/design/features/agent-onboarding.md`](docs/design/features/agent-onboarding.md)。
|
|
205
|
+
- **分发** —— GitHub Actions 交叉编译 + Release 产物(同时供 npm 包使用),并正式发布 npm 包。
|
|
206
|
+
- **验证工具** —— 让 canary 验收对每个 agent 可重复执行。
|
|
207
|
+
- 规则内容改写/模板渲染、以及自动自我更新,**明确不做**
|
|
208
|
+
([`docs/design/requirements.md`](docs/design/requirements.md) §五)。
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 9. 许可证
|
|
213
|
+
|
|
214
|
+
MIT —— 见 [LICENSE](LICENSE)。
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 10. 文档索引
|
|
219
|
+
|
|
220
|
+
| 想看什么 | 去哪 |
|
|
221
|
+
|---|---|
|
|
222
|
+
| 用户到底要什么(需求 / 验收标准) | [`docs/design/requirements.md`](docs/design/requirements.md) |
|
|
223
|
+
| 为什么这么设计 | [`docs/design/architecture.md`](docs/design/architecture.md) |
|
|
224
|
+
| 功能列表 | [`docs/design/features.md`](docs/design/features.md) |
|
|
225
|
+
| 接入新 agent 的清单 | [`docs/design/features/agent-onboarding.md`](docs/design/features/agent-onboarding.md) |
|
|
226
|
+
| 各家 agent 的规则目录(外部事实) | [`docs/design/external/agent-rules-dirs.md`](docs/design/external/agent-rules-dirs.md) |
|
|
227
|
+
| 当前进度与未决项 | [`docs/PROGRESS.md`](docs/PROGRESS.md) |
|
package/bin/rulemux.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// npm launcher for rulemux.
|
|
5
|
+
//
|
|
6
|
+
// rulemux itself is a single Go binary with no runtime dependencies. This shim
|
|
7
|
+
// exists only so that `npm i -g rulemux` puts a working `rulemux` command on your
|
|
8
|
+
// PATH. It resolves the real binary in this order:
|
|
9
|
+
//
|
|
10
|
+
// 1. a binary bundled for this platform in ../dist/ (produced by scripts/build-dist.sh)
|
|
11
|
+
// 2. a `rulemux` binary already on your PATH (e.g. installed from a GitHub Release)
|
|
12
|
+
// 3. otherwise: print install instructions and exit non-zero
|
|
13
|
+
//
|
|
14
|
+
// It never rewrites your arguments and always forwards the child's exit code.
|
|
15
|
+
|
|
16
|
+
const fs = require("fs");
|
|
17
|
+
const os = require("os");
|
|
18
|
+
const path = require("path");
|
|
19
|
+
const { spawnSync } = require("child_process");
|
|
20
|
+
|
|
21
|
+
function platformKey() {
|
|
22
|
+
const plat = process.platform === "win32" ? "windows" : process.platform;
|
|
23
|
+
let arch = process.arch;
|
|
24
|
+
if (arch === "x64") arch = "amd64";
|
|
25
|
+
else if (arch === "ia32") arch = "386";
|
|
26
|
+
return `${plat}-${arch}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function bundledCandidates() {
|
|
30
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
31
|
+
const key = platformKey();
|
|
32
|
+
return [
|
|
33
|
+
path.join(__dirname, "..", "dist", `rulemux-${key}${ext}`),
|
|
34
|
+
// Some cross-builds use the Go default naming; keep a couple of aliases.
|
|
35
|
+
path.join(__dirname, "..", "dist", `rulemux-${process.platform}-${process.arch}${ext}`),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function onPath() {
|
|
40
|
+
const cmd = process.platform === "win32" ? "where" : "which";
|
|
41
|
+
const r = spawnSync(cmd, ["rulemux"], { stdio: "ignore" });
|
|
42
|
+
return r.status === 0 ? "rulemux" : null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function resolve() {
|
|
46
|
+
for (const c of bundledCandidates()) {
|
|
47
|
+
if (fs.existsSync(c)) return c;
|
|
48
|
+
}
|
|
49
|
+
return onPath();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function main() {
|
|
53
|
+
const bin = resolve();
|
|
54
|
+
if (!bin) {
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
"rulemux: no rulemux binary found.\n" +
|
|
57
|
+
"\n" +
|
|
58
|
+
"Install one of these first:\n" +
|
|
59
|
+
" go install github.com/cq-guojia/rulemux@latest\n" +
|
|
60
|
+
" or download a binary from https://github.com/cq-guojia/rulemux/releases\n" +
|
|
61
|
+
" and make sure it is on your PATH.\n"
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// npm tarballs do not always preserve the executable bit; be defensive.
|
|
67
|
+
if (process.platform !== "win32" && fs.existsSync(bin)) {
|
|
68
|
+
try {
|
|
69
|
+
fs.chmodSync(bin, 0o755);
|
|
70
|
+
} catch (_) {
|
|
71
|
+
/* ignore: it may already be fine, or the fs may be read-only */
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
76
|
+
if (r.error) {
|
|
77
|
+
process.stderr.write(`rulemux: failed to run ${bin}: ${r.error.message}\n`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
process.exit(r.status === null ? 1 : r.status);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rulemux",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One set of rules, delivered to every AI coding agent: copies the rule files you declare into each agent's native workspace rules directory, with the same effect and token cost as writing AGENTS.md by hand.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/cq-guojia/rulemux.git"
|
|
9
9
|
},
|
|
10
|
+
"homepage": "https://github.com/cq-guojia/rulemux#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/cq-guojia/rulemux/issues"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"rulemux": "bin/rulemux.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"README.zh-CN.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:dist": "bash scripts/build-dist.sh",
|
|
26
|
+
"prepublishOnly": "npm run build:dist"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16"
|
|
30
|
+
},
|
|
10
31
|
"keywords": [
|
|
11
|
-
"
|
|
32
|
+
"rulemux",
|
|
12
33
|
"rules",
|
|
34
|
+
"agents",
|
|
13
35
|
"agents-md",
|
|
14
|
-
"
|
|
36
|
+
"ai-coding-agent",
|
|
15
37
|
"codebuddy",
|
|
38
|
+
"workbuddy",
|
|
39
|
+
"claude-code",
|
|
16
40
|
"trae",
|
|
17
41
|
"codex",
|
|
18
42
|
"opencode",
|
package/AGENTS.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# 本工作区的强制约定(Agent 每次会话自动遵守)
|
|
2
|
-
|
|
3
|
-
> 本工作区是 Git 仓库,由 CodeBuddy / TraeCode / Claude Code 等多个 coding agent、多台机器共用;文件随仓库提交入 Git,**从 Git 取用**。
|
|
4
|
-
> 本文件每轮全量加载 ⇒ 只写「不写就会做错」的规则;会变的事实不写。
|
|
5
|
-
|
|
6
|
-
<!-- ==== RULES BEGIN ==== -->
|
|
7
|
-
> ⚠️ 本标记区内容由程序自动注入,禁止手改(改了下轮同步即被覆盖);工作区自有规则写在下方「RULES END」标记之后。
|
|
8
|
-
|
|
9
|
-
**公用规则(强制)**:全文在同级 [`RULES.md`](RULES.md),由用户独占维护、随时会改。
|
|
10
|
-
|
|
11
|
-
- 会话开始前**必须完整读取该文件并遵守**,不要凭印象代替阅读。
|
|
12
|
-
- 本文件**不复述、不摘引、不指代**它的任何条目与序号;两边序号各自独立。
|
|
13
|
-
<!-- ==== RULES END ==== -->
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# rulemux — agent 操作守则
|
|
18
|
-
|
|
19
|
-
> 本文件只写**本仓库独有**的东西:本项目的文档落点与本项目约定。
|
|
20
|
-
> 通用规矩(写操作、git、接手入口、文档骨架)在程序注入区指向的那份公用规则文件里,**本文件不重复、不摘引、不指代**它。
|
|
21
|
-
|
|
22
|
-
## 一、本项目的文档落点(要做什么 → 先读哪份)
|
|
23
|
-
|
|
24
|
-
| 我要做 | 先读 |
|
|
25
|
-
|---|---|
|
|
26
|
-
| 这个项目是什么 / 怎么用 | 根 [`README.md`](README.md) |
|
|
27
|
-
| 现在做到哪、欠什么、下一步 | [`docs/PROGRESS.md`](docs/PROGRESS.md) |
|
|
28
|
-
| 已结案的历史 | [`docs/PROGRESS-HISTORY.md`](docs/PROGRESS-HISTORY.md) |
|
|
29
|
-
| **用户到底要什么**(需求 / 验收标准) | [`docs/design/requirements.md`](docs/design/requirements.md) |
|
|
30
|
-
| 为什么这么设计(核心原理 / 方案选型 / 命名) | [`docs/design/architecture.md`](docs/design/architecture.md) |
|
|
31
|
-
| 有哪些功能、每个干什么 | [`docs/design/features.md`](docs/design/features.md) |
|
|
32
|
-
| 改「目录同步」(一级方案) | [`docs/design/features/dir-sync.md`](docs/design/features/dir-sync.md) |
|
|
33
|
-
| 改「hook 注入」(降级方案) | [`docs/design/features/hook-injection.md`](docs/design/features/hook-injection.md) |
|
|
34
|
-
| 接某个 agent(它的规则目录长什么样) | [`docs/design/external/agent-rules-dirs.md`](docs/design/external/agent-rules-dirs.md) |
|
|
35
|
-
| 验证某个 agent 是不是真生效 | [`docs/design/features/verification.md`](docs/design/features/verification.md) |
|
|
36
|
-
| 某个功能当时怎么做的、踩过什么坑 | `docs/worklog/<工作包名>.md` |
|
|
37
|
-
| **写 / 归置任何文档** | [`docs/README.md`](docs/README.md)(唯一索引) |
|
|
38
|
-
|
|
39
|
-
## 二、本项目独有的约定
|
|
40
|
-
|
|
41
|
-
> 1–3 项 ⬜ **待补**(代码定型后再写,编号先占位以保持与通用模板同构);4–5 项现在即适用。
|
|
42
|
-
|
|
43
|
-
1. **构建与提交**:⬜ 待补(定语言 / 构建方式后写,含是否需 build 后再提交)。
|
|
44
|
-
2. **验证方式**:⬜ 待补(是否提供冒烟 / 类型检查命令)。
|
|
45
|
-
3. **远端与推送**:⬜ 待补(确认远端与协议后写)。
|
|
46
|
-
4. **凡涉及各家 agent 的规则目录 / hooks 配置,一律「先读源码与文档,再动手」,禁止靠运行时试探猜**:
|
|
47
|
-
- **要读到实现本体**(目录在哪、扩展名、读不读全部、frontmatter 语义),不是只看文档描述;结论带出处(`文件:行号` 或包版本)。
|
|
48
|
-
- **读到的结论必须回写**(这一步最容易被漏):写进 [`docs/design/external/`](docs/design/external/) —— 已有文档就补充或更正,**没有**就新建一篇(头部按外部事实类规矩写:类型 / 适用版本 / 状态 / 来源 / 配套);过程另记 `docs/worklog/<工作包>.md`。**不许只留在对话里** —— 下次没人知道,同一个点会被重复排查。
|
|
49
|
-
- **每条结论都标「适用版本」**:写清是哪个 agent、哪个版本(上游升级后据此复核)。
|
|
50
|
-
- **未核实的内容不得写成事实**:标注 🔴 未核实,并把核实任务挂进 [`docs/PROGRESS.md`](docs/PROGRESS.md) 未决项。
|
|
51
|
-
5. **文档与代码冲突时,以源码现状为准**:发现文档说法与实现不一致,先读源码确认「现在实际是什么」,按实现回改文档并向用户提示分歧;**不得凭文档猜实现**。
|
|
52
|
-
|
|
53
|
-
## 三、本项目的文档体系(细则一律见 [`docs/README.md`](docs/README.md))
|
|
54
|
-
|
|
55
|
-
| 层 | 本项目落位 | 规矩 |
|
|
56
|
-
|---|---|---|
|
|
57
|
-
| 现场·进行中 | [`docs/PROGRESS.md`](docs/PROGRESS.md) | 只装在办的事:当前状态 / 未决项 / 下一步 |
|
|
58
|
-
| 现场·已结案 | [`docs/PROGRESS-HISTORY.md`](docs/PROGRESS-HISTORY.md) | 一行一条:时间 / 完成了什么 / 过程文档;不写过程 |
|
|
59
|
-
| 叙事 | `docs/worklog/<工作包名>.md` | 一个工作包一个文件;完成即封卷,此后不改 |
|
|
60
|
-
| 定型 | `docs/design/`(需求 + 架构 + `features/` 功能文档 + `external/` 外部事实) | 改它 = 改规矩 |
|
|
61
|
-
| 样例 | `docs/examples/` | 与代码零耦合 |
|
|
62
|
-
|
|
63
|
-
- **拍板结论写进归属文档**(需求决策进需求文档、架构决策进架构文档、功能决策进功能文档……),**不另建决策文件**。
|
|
64
|
-
- 目录、命名、每类「必须写 / 不得写」、生命周期、硬规则:**全在 [`docs/README.md`](docs/README.md)**,本文件不复述。
|
package/RULES.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# RULES.md — 公用规则全文真源
|
|
2
|
-
|
|
3
|
-
> ⚠️ 本文件是**公用规则全文真源**,由**用户独占维护**、随时会改:各项目文件**不内联、不复述、不指代**它的内容,一致性由程序注入区(那段指向本文件的说明)统一保证 ⇒ 改本文件**无需**跑任何同步脚本。
|
|
4
|
-
> **写法约束**:只写「不写就会做错」的规则;**会变的事实不写**(会变的事实归各工作区自己的文档)。
|
|
5
|
-
> **最后更新**:2026-10-01。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 〇、写操作闸门(最高优先,覆盖后文所有条款)
|
|
10
|
-
|
|
11
|
-
- **凡「写」必先获批**:新建 / 修改 / 删除文件、安装或卸载任何软件 / 依赖 / 镜像 / 组件(含 MCP、skill)、执行有副作用的命令、提交 git —— **必须有用户针对该次动作的明确指令**。
|
|
12
|
-
- **「明确」= 指名动作 + 指名对象**(如「改某项目的 docs/README.md 分类表」「装 jq」)。**以下一律不算**:
|
|
13
|
-
- 用户的提问与探讨(「是不是该…」「要不要…」「能不能…」);
|
|
14
|
-
- agent 自己的建议、方案、「顺手优化」——**建议 ≠ 授权**;
|
|
15
|
-
- 模糊动词(「看看」「优化下」「处理一下」「清理」);
|
|
16
|
-
- 上一轮的旧授权——**一次指令一次授权,不自动续期**。
|
|
17
|
-
- **不确定 ⇒ 只读 + 先问**。请示三要素:**写什么、写哪、为什么**。
|
|
18
|
-
- **只读不受限**:列目录、读文件、查容器、看日志、inspect 不需要请示。
|
|
19
|
-
- **未获批前只把草案放在对话里,不落盘。**
|
|
20
|
-
- **不要另建 `CLAUDE.md` / `CODEBUDDY.md` 等副本**:规则就在本文件里,副本内容不一致会被重复注入。
|
|
21
|
-
|
|
22
|
-
### Hindsight 知识页不得自建
|
|
23
|
-
|
|
24
|
-
- **只有用户明确说「去 hindsight 建知识页 / 管理知识页」这类话,才可调用 `hindsight_capture_initiative`**;一次一授权、不追认。
|
|
25
|
-
- **不许拿知识页当工作现场**:「下一步做什么」一律以仓库现场文档(`docs/PROGRESS.md`)为准 —— 知识页不稳定,**不得用它替代、承载或追踪项目进度**。
|
|
26
|
-
- **写计划 / 方案 / 评估、头脑风暴、确认方案、开始实现,都不是授权**;工具描述 / hook / skill 里「plan 后 call this to record」一类话只是能力说明,冲突时以本节为准。
|
|
27
|
-
- 提交 / 上传文档(`hindsight_ingest_document`)不受此限;「服务端自动沉淀、会话末自动入库」也不拦;**但 agent 自发建知识页不豁免**。
|
|
28
|
-
- **调用须走代理**:`hindsight_*` 经 `mcp_get_tool_description` → `mcp_call_tool`;裸名直调只会得到「未注册」,那是调用方式错、**非故障**。
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## 一、git(用户独占,agent 不得过问)
|
|
33
|
-
|
|
34
|
-
- **没说「提交」就不提交**;也不问「要不要提交」「这个文件要不要留 / 要不要删」。
|
|
35
|
-
- **说「提交」= `commit` + `push` 一次做完**,不必再问「要不要推」。
|
|
36
|
-
- **绝不替用户决定网络层面的 workaround**:不配代理、不改 remote、不动凭证链、不换协议。推不上去就**原样报告错误**,用户自己解决。
|
|
37
|
-
- **破坏性操作**(重写历史、`--force`、删远端、`reset --hard`、`clean -f`)必须先获用户明确指令。
|
|
38
|
-
- **改 `.gitignore` 必须获用户明确指令**(一次一授权):发现「某文件没被跟踪 / 该不该加白名单」可以直接说明、提出建议,但**动手改仍需明确指令**。
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 二、协作规矩
|
|
43
|
-
|
|
44
|
-
- **给命令,不给文件**:要用户执行的脚本,直接给可粘贴的命令。
|
|
45
|
-
- **SQL 默认给「容器内可直接粘贴的整条命令」**,密码从 secret 文件读,不写明文、不让用户自己拼:
|
|
46
|
-
```
|
|
47
|
-
docker exec postgres sh -c 'PGPASSWORD="$(cat /run/secrets/postgres_password)" psql -U "$(cat /run/secrets/postgres_user)" -h 127.0.0.1 -d postgres -c "SELECT 1 AS ok;"'
|
|
48
|
-
```
|
|
49
|
-
用户**明说要「裸 SQL」**时才给纯 SQL。
|
|
50
|
-
- **⚠️ 会改数据的 SQL 必须先给醒目警示**:凡含 `UPDATE` / `DELETE` / `INSERT` / `ALTER` / `DROP` / `TRUNCATE`,或 `SET` / `ALTER SYSTEM` 等改配置、改设置的语句,**先单独写明「这条会修改数据」+ 改哪个对象、影响多少行 / 什么范围、能否回滚**,再给命令;不得混在只读查询里一带而过。
|
|
51
|
-
- **动文件前先请示**:纯只读排查不用问;新建 / 修改文件前要说清「写什么、写哪、为什么」。
|
|
52
|
-
- **少折腾**:能用一条命令解决就别给一套方案;先想「有没有更短路径」,别绕远路加组件。
|
|
53
|
-
- **先结论后证据**:先定性(能 / 不能、是不是 bug),再给证据,尽量短。
|
|
54
|
-
- **结论可追溯**:必须落到 `源码文件:行号` 或日志原文。**被质疑时先重查代码再回答。**
|
|
55
|
-
- **清单 / 对比 / 选型默认用 Markdown 表格**,不要用 JSON。
|
|
56
|
-
- **脱敏**:本机与私有部署细节(容器名、内网地址与端口、代理地址、compose 位置等)一律不入仓库,只保留抽象结论。
|
|
57
|
-
- **同一机制只解释一次**:用户不追问就不重复复述;纠错后直接给结论并执行,不再反复铺陈原理。
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 三、接手入口(所有项目统一)
|
|
62
|
-
|
|
63
|
-
任何项目都必须有这三个文件,**文件名与读取顺序固定**:
|
|
64
|
-
|
|
65
|
-
| 顺序 | 文件 | 回答什么 |
|
|
66
|
-
|---|---|---|
|
|
67
|
-
| 1 | `README.md`(项目根) | 这是个什么项目 |
|
|
68
|
-
| 2 | `docs/PROGRESS.md` | 现在做到哪、欠什么、下一步做什么 |
|
|
69
|
-
| 3 | `docs/README.md` | 这个项目的文档怎么摆、怎么写 |
|
|
70
|
-
|
|
71
|
-
- 新会话 / 新 agent 一律按此顺序进入,**不全文通读**历史文档;需要细节按 `docs/README.md` 的索引点开。
|
|
72
|
-
- 顺序和文件名**不得各项目另起**;缺哪个就地补齐。
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 四、每个项目必须有的文档槽位
|
|
77
|
-
|
|
78
|
-
**样式规范 / 方法规范 / 功能索引 / 数据库说明 / 外部事实(宿主或依赖能力)**。
|
|
79
|
-
|
|
80
|
-
- 本文件只规定「**必须有**」,**不规定叫什么名、放哪个文件** —— 由该项目的 `docs/README.md` 定。
|
|
81
|
-
- 要写样式、抽公共逻辑、改表、找功能时,**先查该项目上述对应文档**;没有、或不满足,**先向用户提**,不要另起一套。
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 五、文档分层骨架(按信息寿命分,通用)
|
|
86
|
-
|
|
87
|
-
| 层 | 装什么 | 建议落位 |
|
|
88
|
-
|---|---|---|
|
|
89
|
-
| 现场 | 现在在做什么、欠什么、下一步 | `docs/PROGRESS.md` |
|
|
90
|
-
| 叙事 | 一个工作包一个文件:过程、踩坑、定位、证据 | `docs/worklog/<工作包名>.md` |
|
|
91
|
-
| 定型 | 以后一直要遵守的:架构、数据模型、规格、事实清单 | `docs/design/*.md` |
|
|
92
|
-
| 样例 | 样例与模板(与代码零耦合) | `docs/examples/` |
|
|
93
|
-
|
|
94
|
-
> 建议落位是默认值;项目可调整,但**调整后的实际布局必须写在该项目 `docs/README.md`**。
|
|
95
|
-
|
|
96
|
-
### 标准动作
|
|
97
|
-
|
|
98
|
-
1. **开工**:新建叙事层文件,过程实时写进它。
|
|
99
|
-
2. **收尾**:该文件头部标「✅ 完成封卷」,**此后不再修改**;并把它从现场层移入该项目的**结案记录**(记法由该项目自定)。
|
|
100
|
-
3. **推进中**:就地更新现场层的「当前状态 / 未决项 / 下一步」。
|
|
101
|
-
4. **有拍板**:结论与理由写进**归属文档**(功能决策进功能文档、样式决策进样式文档……),**不另建决策文件**。
|
|
102
|
-
5. **有定型内容**:升格到定型层,原处**只留链接**。
|
|
103
|
-
6. **遗留问题**:写进现场层的未决项,**不回头改已封卷的文件**。
|
|
104
|
-
|
|
105
|
-
### 规则
|
|
106
|
-
|
|
107
|
-
1. **真源分工**:每类信息只有一个真源;README、issue、聊天记录、外部笔记都**不算真源**。
|
|
108
|
-
2. **不许两份副本**:同一结论存两处,必然有一份过期。
|
|
109
|
-
3. **现场层恒定小**:**过程日志不写进现场层**;现场层持续变大 = 失控信号。
|
|
110
|
-
4. **命名**:文档名**表角色不表时间**(不带日期前缀、不带版本号),纯 ASCII 小写 kebab-case;版本历史交给 git。
|
|
111
|
-
5. **结论可追溯**:定型层与事实清单类文档,每条结论带出处(`文件:行号` 或包版本)。
|
|
112
|
-
|
|
113
|
-
> 各项目的目录细则、类目划分、命名后缀、生命周期细节,一律写在该项目 `docs/README.md`,**本文件不管**。
|
package/docs/PROGRESS-HISTORY.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# 进度历史(已结案)
|
|
2
|
-
|
|
3
|
-
> **这是什么**:已结案事项的**一行索引** —— 什么时候、完成了什么、过程文档在哪。
|
|
4
|
-
> **过程 / 踩坑 / 注意事项一律不写在这**,要看去 `worklog/`。
|
|
5
|
-
> **在办的事**看 [`PROGRESS.md`](PROGRESS.md)。
|
|
6
|
-
> **规矩**:事项结案即从 `PROGRESS.md` 移入本文件(追加一行),见 [`README.md`](README.md)。
|
|
7
|
-
|
|
8
|
-
| 时间 | 工作包 | 完成了什么 | 过程文档 |
|
|
9
|
-
|---|---|---|---|
|
|
10
|
-
| 2026-10-06 | 项目初始化 + 文档体系重建 | 从 `dsh-task-dispatch-table` 文档模板建立 rulemux 文档体系:分类表去 dsh 化、需求草稿分解迁入 `docs/design/`、`PROGRESS` 系列重置、`AGENTS.md` 项目段改写、根 `README.md` 新建 | [worklog/docs-reorg.md](worklog/docs-reorg.md) |
|
|
11
|
-
| 2026-10-06 | 文档架构专家团评审 | 三方评审(骨架一致性 / 需求与设计落位 / 现场层与链接)后整改:分类表恢复通用模板 1–7 编号并标注不适用、新增「需求」槽位 `design/requirements.md`、架构文档只留原理与选型、外部事实剥离我方设计并标🔴未核实、实测法修 canary 假阳性、`AGENTS.md` §二 恢复编号骨架 | 本文件(结论已并入各归属文档,不另建决策文件) |
|
package/docs/PROGRESS.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# 进度(进行中)
|
|
2
|
-
|
|
3
|
-
> **这是什么**:本仓库**唯一**的在办事项真源 —— 现在做到哪、欠什么、下一步做什么。
|
|
4
|
-
> **已结案的**看 [`PROGRESS-HISTORY.md`](PROGRESS-HISTORY.md)(一行一条:时间 / 完成了什么 / 过程文档)。
|
|
5
|
-
> **文档规矩**看 [`README.md`](README.md)。
|
|
6
|
-
>
|
|
7
|
-
> 本文件**只装在办的事**;事项结案即从本文件移入 `PROGRESS-HISTORY.md`。
|
|
8
|
-
> ⚠️ README / issue / 聊天记录都不是真源。
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 一、当前状态
|
|
13
|
-
|
|
14
|
-
### 1.1 需求与方案定型 —— ⏸️ **待启动**(文档骨架已就绪)
|
|
15
|
-
|
|
16
|
-
> 定型层全部文档均标 📝 待拍板 / 🔴 未核实:
|
|
17
|
-
> [`design/requirements.md`](design/requirements.md)(产品需求与验收标准)、[`design/architecture.md`](design/architecture.md)(核心原理 / 选型 / 命名)、[`design/features.md`](design/features.md) + `features/` 三份(怎么做)、[`design/external/agent-rules-dirs.md`](design/external/agent-rules-dirs.md)(各家规则目录,**未核实**)。
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 二、未决项
|
|
22
|
-
|
|
23
|
-
| # | 问题 | 现状与影响 | 将来怎么解(方向,未定) |
|
|
24
|
-
|---|---|---|---|
|
|
25
|
-
| T0 | **需求待拍板项**:真源由谁维护、放在哪(本地目录 / 仓库 / 配置指定) | `requirements.md` §二 标 ⬜ 待拍板;不定则同步器无输入契约 | 用户拍板后写进 `requirements.md` |
|
|
26
|
-
| T1 | **Trae / CodeBuddy `.mdc` 的 frontmatter 怎么写才无条件常驻** | `.mdc` 带 frontmatter(`alwaysApply` / `globs` / `description`)。写法不对 ⇒ 规则只在命中 glob 时生效,达不到「等价 `AGENTS.md`」 | 逐家查证 frontmatter 语义(要读到实现,不猜),结论回写 `external/agent-rules-dirs.md` |
|
|
27
|
-
| T2 | **Codex(单文件)/ OpenCode(配置列表)的分支处理** | 这两家不扫描目录:Codex 只认单文件 `AGENTS.md`,OpenCode 要在 `opencode.json` 显式列 instruction 文件 | 退化为:Codex 拼接进 `AGENTS.md` 的**受管区**;OpenCode 改 `opencode.json` 列文件。需先定**受管区标记格式**,避免覆盖用户自己写的内容 |
|
|
28
|
-
| T3 | **DeepSeek Harness 的规则目录未确认** | 目录 / 扩展名 / 是否读目录全部均未知,阻塞该 agent 接入 | 查证后补进 `external/agent-rules-dirs.md` |
|
|
29
|
-
| T4 | **各 agent 实测闭环未做;`external` 表未源码级核实** | 表里除 Claude Code 外「适用版本」全空、未实测 ⇒ **不得作为实现依据** | 每家按 `features/verification.md` 跑一次(进上下文 + 压缩不丢),并补齐适用版本与出处 |
|
|
30
|
-
| T5 | **真源里删掉的文档要不要从目标目录清掉** | 「加删自由」(A5)要求删除也生效,但同步器要能区分「我方曾同步过的」与「用户自己的」 | 定方案(如落一份 manifest 记录我方同步过的文件),写进 `features/dir-sync.md` |
|
|
31
|
-
| T6 | **各 agent hooks 配置落点待查证** | `features/hook-injection.md` 表里 CodeBuddy / Codex / WorkBuddy 三项「待补」,且该表属**外部事实**,应迁入 `design/external/` | 查证后新建 `external/` 文档并标适用版本,原表改为引用 |
|
|
32
|
-
| T7 | **npm 包名占用待复核** | 「`rulemux` 未被占用」是会变化的外部事实,无核实日期与来源 | 发布前重新核实,记录日期与来源(结论不写进 architecture,只记进度) |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 三、下一步
|
|
37
|
-
|
|
38
|
-
1. **需求拍板**:确认 [`design/requirements.md`](design/requirements.md) 的待拍板项(真源位置与维护方式、支持 agent 范围、验收标准 A1–A6)。
|
|
39
|
-
2. **外部事实核实(T1 / T3 / T4 / T6)**:把各家规则目录与 hooks 配置查到源码级、补全「适用版本」,并按 [`design/features/verification.md`](design/features/verification.md) 实测闭环。
|
|
40
|
-
3. **方案拍板**:确认 [`design/architecture.md`](design/architecture.md) 的选型 —— 目录同步为主选、hook 注入为**降级**(不满足 A3 即视为该 agent 未接入成功)。
|
|
41
|
-
4. **技术选型**:定语言 / 分发方式 —— 结论**进 [`design/architecture.md`](design/architecture.md)**(属架构选型,不是代码规范)。
|
|
42
|
-
5. **落码**:按 [`design/features/dir-sync.md`](design/features/dir-sync.md) 实现目录同步。
|
package/docs/README.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# 文档规范:放在哪、怎么写
|
|
2
|
-
|
|
3
|
-
> **这份文档规定本仓库的文档规矩**:写新文档时放哪、叫什么、写什么、什么时候归档。
|
|
4
|
-
> 写文档前、归档案前先看这份。规则真源在 [`../RULES.md`](../RULES.md)(用户独占维护)。
|
|
5
|
-
> **最后更新**:2026-10-06。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 一、目录:只允许这五个层
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
docs/
|
|
13
|
-
README.md 本文件(文档规范)
|
|
14
|
-
PROGRESS.md 现场层·进行中
|
|
15
|
-
PROGRESS-HISTORY.md 现场层·已结案
|
|
16
|
-
worklog/ 叙事层:一个工作包一个文件
|
|
17
|
-
design/ 定型层(专题文档 + features/ 功能文档 + external/ 外部事实)
|
|
18
|
-
examples/ 样例与模板(与代码零耦合)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
| 层 | 落位 | 装什么 | 规矩 |
|
|
22
|
-
|---|---|---|---|
|
|
23
|
-
| **现场·进行中** | `docs/PROGRESS.md` | 「当前状态 / 未决项 / 下一步」三块 | **详细到「下一步具体要做哪一步」**;只装在办的事,结案即移出 |
|
|
24
|
-
| **现场·已结案** | `docs/PROGRESS-HISTORY.md` | 一行一条:**时间 / 完成了什么 / 过程文档在哪** | 只记结果与去向,不写过程、不写注意事项 |
|
|
25
|
-
| **叙事** | `docs/worklog/<工作包名>.md` | 一个工作包的过程:需求原话、过程、定位、踩坑、证据 | 一个工作包一个文件;**封卷后不得再改**,过程只看这里 |
|
|
26
|
-
| **定型** | `docs/design/*.md`(可分子目录) | 以后一直要遵守的东西 | 改它 = 改规矩 |
|
|
27
|
-
| **样例** | `docs/examples/*` | 样例、模板 | 与代码零耦合 |
|
|
28
|
-
|
|
29
|
-
**三者的关系**:`PROGRESS.md` 说「现在做哪一步」→ `worklog/` 说「当时怎么做的」→ 结案后 `PROGRESS.md` 里那一条搬进 `PROGRESS-HISTORY.md` 变成一行,详细过程留在 worklog 不动。
|
|
30
|
-
|
|
31
|
-
⚠️ `docs/` 之外不建文档;源码 / 脚本 / 构建产物按各自技术栈摆,不在文档体系内登记。
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 二、文档分类与落位(写之前先定类)
|
|
36
|
-
|
|
37
|
-
| # | 类 | **必须放这** | 文件名 | 写什么 |
|
|
38
|
-
|---|---|---|---|---|
|
|
39
|
-
| 1 | **进度** | `PROGRESS.md`(进行中)+ `PROGRESS-HISTORY.md`(已结案)+ `worklog/` | `worklog/<工作包名>.md` | PROGRESS:现在做哪一步、欠什么;HISTORY:结案一行(时间 / 完成了什么 / 过程文档);worklog:做的过程与踩坑 |
|
|
40
|
-
| 2 | **数据库** | `design/data-model.md` | 固定 | 表结构、DDL、字段语义、取舍 —— **本项目不适用**(无数据库),保留槽位、不建文件 |
|
|
41
|
-
| 3 | **样式** | `design/ui-foundation.md`(方案)+ `design/ui-style-guide.md`(手册) | 固定 | 方案 = 抽象清单;手册 = 使用规范 —— **本项目不适用**(无 UI),保留槽位、不建文件 |
|
|
42
|
-
| 4 | **方法** | `design/code-conventions.md`;架构(分层 / 目录 / 职责)附 `design/architecture.md` | 固定 | 通用能力分几类、各抽象在哪、哪些必须复用;架构 = 为什么这么设计(见 [`architecture.md`](design/architecture.md))。代码规范 ⬜ **待补**(代码定型后建) |
|
|
43
|
-
| 5 | **功能** | `design/features.md`(总索引)+ `design/features/<功能>.md` | `features/<功能>.md` | 有哪些功能、每个干什么、对应哪个文件、该功能的业务规则 |
|
|
44
|
-
| 6 | **外部事实** | `design/external/<主题>.md` | 按主题 | 各 agent 的工作区规则目录 / 扩展名 / 读取行为;源码级核实结果,每条标「适用版本 / 来源」 |
|
|
45
|
-
| 7 | **对外** | 根 `README.md` | 固定 | 是什么、怎么装、怎么用 |
|
|
46
|
-
| 8 | **需求** | `design/requirements.md` | 固定 | **用户要什么**:产品范围、验收标准(满足 / 不满足的判据)、明确不做清单。需求真源 |
|
|
47
|
-
|
|
48
|
-
> **类 1–7 沿用通用模板**(跨项目编号与类名一致,便于对照与移植);本项目暂无 UI / 数据库 ⇒ 类 2、3 **保留行、标注不适用**,不要删行(删行会让编号位移,跨项目对照错位)。
|
|
49
|
-
> **类 8「需求」是本项目在模板之上追加的槽位**:回答「用户到底要什么」,与类 4 的架构文档(回答「为什么这么设计」)分开 —— 需求变了改这里,方案变了改架构。
|
|
50
|
-
|
|
51
|
-
**归类规则**:先问「这条信息会过期吗」定层,再按上表定类与落位。一层一类只有一个真源文件。
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 三、命名
|
|
58
|
-
|
|
59
|
-
| 规则 | 说明 |
|
|
60
|
-
|---|---|
|
|
61
|
-
| 纯 ASCII 小写 kebab-case | `architecture.md`、`features/dir-sync.md` |
|
|
62
|
-
| **表角色,不表时间** | 不带日期、不带版本号;版本历史交给 git |
|
|
63
|
-
| 架构 vs 功能分开 | `architecture.md` = 为什么这么设计;`features/*.md` = 怎么做;两者内容不重复 |
|
|
64
|
-
| 功能类统一进 `features/` | 避免与 `worklog/` 同名混淆 |
|
|
65
|
-
| 工作包文件名 = 工作包名 | `worklog/docs-reorg.md` |
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## 四、每类文档怎么写
|
|
70
|
-
|
|
71
|
-
### 4.1 通用头(定型层文档必带)
|
|
72
|
-
|
|
73
|
-
```markdown
|
|
74
|
-
# <标题>
|
|
75
|
-
|
|
76
|
-
> **状态**:📝 待拍板 / 🔵 落码 / ✅ 完成封卷
|
|
77
|
-
> **来源**:需求出处(用户原话 / 决策编号)
|
|
78
|
-
> **配套**:相关文档链接
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### 4.2 各类的内容要求
|
|
82
|
-
|
|
83
|
-
| 类 | 必须写 | **不得写** |
|
|
84
|
-
|---|---|---|
|
|
85
|
-
| 进度(PROGRESS) | 当前状态 / 未决项 / 下一步三块;「下一步」要写到**具体做哪一步** | 已结案的内容(须移入 `PROGRESS-HISTORY.md`)、长篇历史、方案论证 |
|
|
86
|
-
| 历史(HISTORY) | 一行一条:时间 / 完成了什么 / 过程文档链接 | 过程、踩坑、注意事项(这些归 worklog) |
|
|
87
|
-
| 叙事(worklog) | 需求原话、过程、定位、踩坑、证据(出处 `文件:行号`) | 结论性规矩(应升格到定型层) |
|
|
88
|
-
| 定型(design/*) | 是什么、怎么做、边界(不做什么) | 进度、过程日志 |
|
|
89
|
-
| 需求(requirements) | 用户要什么:产品范围、验收标准(满足 / 不满足的判据)、明确不做清单 | 实现方案(归 `architecture.md`)、进度(归 `PROGRESS.md`) |
|
|
90
|
-
| 外部事实 | 头部必带「**类型 / 适用版本 / 来源**」——适用版本写清是哪个 agent、哪个版本(上游升级后据此复核);正文每条结论带出处(包版本 / `文件:行号`) | 猜测、未核实内容;写成"我们的设计" |
|
|
91
|
-
| 功能 | 功能名 / 干什么 / 对应文件 / 状态 | 实现细节(归 worklog) |
|
|
92
|
-
| 对外(根 README) | 是什么 / 怎么装 / 怎么用 | 内部设计 |
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## 五、生命周期(写完怎么办)
|
|
97
|
-
|
|
98
|
-
1. **开工**:建 `worklog/<工作包名>.md`,过程实时写进去。
|
|
99
|
-
2. **推进中**:就地更新 `PROGRESS.md` 的「当前状态 / 未决项 / 下一步」,过程日志不进现场层。
|
|
100
|
-
3. **收尾**:worklog 头部标「✅ 完成封卷」,此后不再修改;`PROGRESS.md` 里该条**移入** `PROGRESS-HISTORY.md`,只留一行(时间 / 完成了什么 / 过程文档链接)。
|
|
101
|
-
4. **有定型内容**:升格到 `design/` 对应类文件,原处只留链接。
|
|
102
|
-
5. **有遗留问题**:写进 `PROGRESS.md` 未决项,**不回头改已封卷的文件**。
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## 六、硬规则
|
|
107
|
-
|
|
108
|
-
1. **真源唯一**:每类信息只有一个真源;README / issue / 聊天记录都不是真源。
|
|
109
|
-
2. **不许两份副本**:同一结论存两处,必有一份过期。规范只在本文件,其它文档只链它。
|
|
110
|
-
3. **现场层恒定小**:`PROGRESS.md` 只装在办的事,结案即移入 `PROGRESS-HISTORY.md`;变大即失控。
|
|
111
|
-
4. **封卷不改**:叙事层文件封卷后只读;新发现写新文件。
|
|
112
|
-
5. **先归位再写**:新建文档前先按 §二 定层、定类、定落位。
|
|
113
|
-
6. **结论可追溯**:定型与外部事实类,每条结论必须带出处(`文件:行号` 或包版本)。
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# rulemux 架构:为什么这么设计
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:用户前期调研(原根 `DESIGN.md` §1 / §7,已分解迁入本文件)
|
|
5
|
-
> **配套**:[`requirements.md`](requirements.md)(用户要什么)· [`features.md`](features.md)(怎么做)· [`external/agent-rules-dirs.md`](external/agent-rules-dirs.md)(各家规则目录)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 一、核心原理:为什么必须走 harness 原生规则目录
|
|
10
|
-
|
|
11
|
-
每次 API 请求的结构是 `system`(静态前缀)+ `messages`(对话)。
|
|
12
|
-
|
|
13
|
-
1. **Prompt caching 靠前缀匹配**:`system` 的静态前缀被冻结以保缓存 ⇒ 任何每轮变化的内容都会毁掉缓存。
|
|
14
|
-
2. **hook 注入落在动态区**:`additionalContext` / `system-reminder` 属动态区——
|
|
15
|
-
- `SessionStart` 注一次 ⇒ 随对话老化、压缩时被摘要 ⇒ **淡出**;
|
|
16
|
-
- 每轮注(`UserPromptSubmit`)⇒ 追加累积 ⇒ **token 爆炸**;
|
|
17
|
-
- **无法写入冻结前缀**(这是缓存 + 信任模型的设计,不是能力缺陷)。
|
|
18
|
-
3. **结论**:要「和 `AGENTS.md` 一模一样」(永不淡出 / 不累积 / 恒定 token)= **必须走 harness 原生加载的规则文件 / 目录**(即静态前缀语义)。
|
|
19
|
-
|
|
20
|
-
> ⚠️ 由此定下铁律:**hook 只当「投递员」,不负责注入。**
|
|
21
|
-
> 验收判据见 [`requirements.md`](requirements.md) §三(A1–A3)。
|
|
22
|
-
|
|
23
|
-
## 二、方案选型
|
|
24
|
-
|
|
25
|
-
| 方案 | 定位 | 取舍理由 |
|
|
26
|
-
|---|---|---|
|
|
27
|
-
| **目录同步** | 主选 | 走 harness 原生加载 ⇒ 满足 A1–A3(等价 / 不累积 / 永不淡出);无软链;加删自由。代价:要**按各家格式分别落文件** |
|
|
28
|
-
| **hook 注入** | **降级,不主选** | 落在动态区 ⇒ **做不到 A3(永不淡出)**,`PreCompact` 只是延缓。仅在某 agent 无工作区规则目录时启用,**启用即视为该 agent 未达验收标准** |
|
|
29
|
-
|
|
30
|
-
> 两个方案的具体做法分别在 [`features/dir-sync.md`](features/dir-sync.md)、[`features/hook-injection.md`](features/hook-injection.md);本文件只记**为什么这么选**。
|
|
31
|
-
|
|
32
|
-
## 三、命名
|
|
33
|
-
|
|
34
|
-
**`rulemux`**(首选):mux = 多路复用,一份源 → 多 agent;短且有代表性。
|
|
35
|
-
|
|
36
|
-
候选(备查):`rulecast`(广播)/ `rulehub`(中央枢纽)/ `ruleseed`(播种)/ `ruleflow`;其它可用:`agentrules`、`unirules`、`ruleslot`、`rulefeed`、`rulesink`、`rulewise`、`ruleup`、`rulery`、`ruleseek`。
|
|
37
|
-
|
|
38
|
-
> npm 是否占用属**外部事实**且会变化 ⇒ 发布前重新核实,记录日期与来源(见 [`../PROGRESS.md`](../PROGRESS.md) 未决项)。
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# 各 agent 工作区规则目录(外部事实)
|
|
2
|
-
|
|
3
|
-
> **类型**:外部事实(上游 agent 侧)
|
|
4
|
-
> **适用版本**:见下表「适用版本」列;上游升级后据此复核
|
|
5
|
-
> **状态**:🔴 **未核实** —— 除 Claude Code 外均未走源码级核实,**不得作为实现依据**
|
|
6
|
-
> **来源**:前期调研(原根 `DESIGN.md` §3)
|
|
7
|
-
> **配套**:[`../features/dir-sync.md`](../features/dir-sync.md)(我方怎么适配)· [`../../PROGRESS.md`](../../PROGRESS.md)(核实任务 T4)
|
|
8
|
-
|
|
9
|
-
> ⚠️ 本文件只记**上游读取能力**(目录 / 扩展名 / 读不读全部)。
|
|
10
|
-
> 「我方据此怎么落文件」是设计,归 [`../features/dir-sync.md`](../features/dir-sync.md),**不写在这**。
|
|
11
|
-
|
|
12
|
-
| Agent | 工作区规则目录 | 扩展名 / 结构 | 读目录全部? | 适用版本 | 备注 |
|
|
13
|
-
|---|---|---|---|---|---|
|
|
14
|
-
| Claude Code | `.claude/rules/` | `.md` | ✅ 全部 | v2.0.64+ | — |
|
|
15
|
-
| Trae | `.trae/rules/` | `.mdc` | ✅ 递归读,最多 3 层 | 待补 | 需 frontmatter |
|
|
16
|
-
| CodeBuddy | `.codebuddy/rules/` | 每条规则 = 子文件夹 + `RULE.mdc` | ⚠️ 固定结构 | 待补 | 重载项目时自动扫描 |
|
|
17
|
-
| WorkBuddy | `.codebuddy/rules/`(复用 CodeBuddy 机制) | 同上 | ⚠️ 固定结构 | 待补 | — |
|
|
18
|
-
| Codex | ❌ 无目录 | 单文件 `AGENTS.md`(沿目录树向上合并,每目录最多一个) | ❌ | 待补 | — |
|
|
19
|
-
| OpenCode | ⚠️ 非目录扫描 | `AGENTS.md` + `opencode.json` 显式列 instruction 文件 | ❌ | 待补 | — |
|
|
20
|
-
| DeepSeek Harness | 待确认 | — | — | 待补 | TODO |
|
|
21
|
-
|
|
22
|
-
> ⚠️ **扩展名 / 结构各家不同** ⇒ 同步器必须**按 agent 分别落格式**,不能一个 `.md` 通吃。
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# 目录同步(一级方案)
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:原根 `DESIGN.md` §2
|
|
5
|
-
> **配套**:[`../requirements.md`](../requirements.md)(验收标准)· [`../architecture.md`](../architecture.md)(为什么选它)· [`../external/agent-rules-dirs.md`](../external/agent-rules-dirs.md)(各家目录事实)
|
|
6
|
-
|
|
7
|
-
## 干什么
|
|
8
|
-
|
|
9
|
-
hook 在会话开始触发(或独立命令)→ 对每个 agent:
|
|
10
|
-
|
|
11
|
-
1. 定位其**工作区规则目录**(见 [`../external/agent-rules-dirs.md`](../external/agent-rules-dirs.md))。
|
|
12
|
-
2. 对真源里**我方每个文档**:
|
|
13
|
-
- 目标不存在 ⇒ **copy** 过去(按该 agent 要求的结构 / 扩展名);
|
|
14
|
-
- 已存在 ⇒ 比对 **MD5**:相同跳过;不同则**覆盖**。
|
|
15
|
-
3. 其它非我方文档**一律不碰**。
|
|
16
|
-
|
|
17
|
-
## 业务规则
|
|
18
|
-
|
|
19
|
-
- **只认我方文档**:目标目录里用户自己的文档不受影响,同步器不删、不改、不挪。
|
|
20
|
-
- **不用软链**:一律真实拷贝(软链在部分 agent / 跨平台下不可靠)—— 对应验收标准 A4。
|
|
21
|
-
- **按 agent 分别落格式**:各家扩展名与结构不同,不能一个 `.md` 通吃。
|
|
22
|
-
- **无目录型 agent 退化处理**(Codex / OpenCode 不扫描目录):Codex 拼接进 `AGENTS.md` 的**受管区**;OpenCode 改 `opencode.json` 显式列文件。受管区标记格式见 [`../../PROGRESS.md`](../../PROGRESS.md) 未决项 T2。
|
|
23
|
-
- **加删自由**(A5):真源加一个文档 ⇒ 下次同步多一个;真源删掉的要不要从目标目录清掉 ⇒ 见未决项 T5。
|
|
24
|
-
|
|
25
|
-
## 边界(不做什么)
|
|
26
|
-
|
|
27
|
-
- 不做内容改写 / 模板渲染 —— 真源写什么就落什么(格式适配只动文件组织方式,不动正文)。
|
|
28
|
-
- 不做注入 —— 注入属降级方案 [`hook-injection.md`](hook-injection.md)。
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# hook 注入(降级方案,非主选)
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:原根 `DESIGN.md` §4
|
|
5
|
-
> **配套**:[`../requirements.md`](../requirements.md)(验收标准 A1–A3)· [`../architecture.md`](../architecture.md)(为什么它不能当主方案)
|
|
6
|
-
|
|
7
|
-
## 什么时候用
|
|
8
|
-
|
|
9
|
-
仅当某个 agent **不支持**工作区级规则目录(目录同步落不进去)时启用。
|
|
10
|
-
|
|
11
|
-
> ⚠️ **启用即视为该 agent 未达验收标准**:本方案做不到 A3(永不淡出),是**降级模式**,不是通过验收的替代路径。判据见 [`../requirements.md`](../requirements.md) §三。
|
|
12
|
-
|
|
13
|
-
## 怎么做
|
|
14
|
-
|
|
15
|
-
- hooks:**`SessionStart` 读一次 + `PreCompact` 压缩前再写一次**;
|
|
16
|
-
- **不挂 `UserPromptSubmit`**(每轮追加 ⇒ token 爆炸);
|
|
17
|
-
- 一个薄脚本 + 各 agent 的 hooks 配置落点。
|
|
18
|
-
|
|
19
|
-
## 已知代价
|
|
20
|
-
|
|
21
|
-
落在动态区 ⇒ 仍会随对话老化 / 被压缩摘要,`PreCompact` 只是延缓,**做不到「永不淡出」**。
|
|
22
|
-
|
|
23
|
-
## hooks 配置落点
|
|
24
|
-
|
|
25
|
-
> 下表属**外部事实**(各 agent 能力),尚未核实 ⇒ 核实后迁入 [`../external/`](../external/),并标适用版本与来源。当前核实任务见 [`../../PROGRESS.md`](../../PROGRESS.md) 未决项。
|
|
26
|
-
|
|
27
|
-
| Agent | 配置落点 |
|
|
28
|
-
|---|---|
|
|
29
|
-
| Claude Code | `.claude/settings.json` |
|
|
30
|
-
| Trae | `hooks.json` |
|
|
31
|
-
| CodeBuddy | 待补 |
|
|
32
|
-
| Codex | 待补 |
|
|
33
|
-
| WorkBuddy | 待补 |
|
|
34
|
-
|
|
35
|
-
> 各家均跟 Claude Code hooks 规范(**待核实**)。
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# 实测验证法(每个 agent 跑一次)
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:原根 `DESIGN.md` §6
|
|
5
|
-
> **配套**:[`../requirements.md`](../requirements.md)(验收标准)· [`hook-injection.md`](hook-injection.md)(验证失败后的降级)
|
|
6
|
-
|
|
7
|
-
1. 埋两个**互相独立**的随机串:`TOKEN-XYZ` 与 `TOKEN-QRS`;
|
|
8
|
-
2. 开新会话问模型:能否念出 `TOKEN-XYZ`(验证**是否进上下文**);
|
|
9
|
-
3. 跑长任务触发一次压缩,再问 `TOKEN-QRS`(验证**会不会被丢掉**)。
|
|
10
|
-
|
|
11
|
-
**两步都过才算这个 agent 闭环**:
|
|
12
|
-
|
|
13
|
-
- 念不出 `TOKEN-XYZ` ⇒ 没进上下文(同步没生效 / 该目录根本没被读);
|
|
14
|
-
- 压缩后念不出 `TOKEN-QRS` ⇒ 会淡出 ⇒ 不满足 A3,该 agent 不能走目录同步,退回 [`hook-injection.md`](hook-injection.md)(**降级,不算通过验收**)。
|
|
15
|
-
|
|
16
|
-
> ⚠️ **压缩后为什么问另一个串**:`TOKEN-XYZ` 在第 2 步已被写进对话,压缩摘要里可能仍留着它 ⇒ 念得出来也可能是**假阳性**。压缩后必须问一个**此前从未在对话中出现过**的串,才能证明「规则此刻真在上下文里」。
|
package/docs/design/features.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# 功能总索引
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:用户前期调研(原根 `DESIGN.md` §2 / §4 / §6)
|
|
5
|
-
> **配套**:[`requirements.md`](requirements.md)(用户要什么)· [`architecture.md`](architecture.md)(为什么这么设计)
|
|
6
|
-
|
|
7
|
-
| 功能 | 文档 | 干什么 | 状态 |
|
|
8
|
-
|---|---|---|---|
|
|
9
|
-
| 目录同步 | [`features/dir-sync.md`](features/dir-sync.md) | 把中央真源的每个文档同步进各 agent 的工作区规则目录(MD5 比对)—— 一级方案 | 📝 待拍板 |
|
|
10
|
-
| hook 注入 | [`features/hook-injection.md`](features/hook-injection.md) | 某 agent 无规则目录时的**降级**投递:`SessionStart` + `PreCompact` | 📝 待拍板 |
|
|
11
|
-
| 实测验证法 | [`features/verification.md`](features/verification.md) | 每接入一个 agent,验证「进没进上下文 / 会不会被压缩丢掉」 | 📝 待拍板 |
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# rulemux 产品需求(真源)
|
|
2
|
-
|
|
3
|
-
> **状态**:📝 待拍板
|
|
4
|
-
> **来源**:用户立项诉求(原根 `DESIGN.md`,已分解迁入本文件)
|
|
5
|
-
> **配套**:[`architecture.md`](architecture.md)(为什么这么设计)· [`features.md`](features.md)(怎么做)· [`../PROGRESS.md`](../PROGRESS.md)(未决项)
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 一、一句话需求
|
|
10
|
-
|
|
11
|
-
**一份中央真源规则 → 投递到各家 AI coding agent**:一处管理、多处生效,效果与 token 与直接在每个工作区写 `AGENTS.md` 一致。
|
|
12
|
-
|
|
13
|
-
## 二、产品形态
|
|
14
|
-
|
|
15
|
-
- **形态**:命令行工具(CLI)。
|
|
16
|
-
- **输入**:一份中央真源规则(一组文档)。
|
|
17
|
-
- **输出**:把真源同步进各 agent 的工作区规则目录。
|
|
18
|
-
|
|
19
|
-
> 真源由谁维护、放在哪(本地目录 / 仓库 / 配置指定)—— ⬜ **待用户拍板**。
|
|
20
|
-
|
|
21
|
-
## 三、验收标准(满足 / 不满足的判据)
|
|
22
|
-
|
|
23
|
-
| # | 标准 | 判据 |
|
|
24
|
-
|---|---|---|
|
|
25
|
-
| A1 | **效果等价** | 与直接写 `AGENTS.md` 等价 |
|
|
26
|
-
| A2 | **token 相当** | 与直接写 `AGENTS.md` 相当,不累积、不膨胀 |
|
|
27
|
-
| A3 | **永不淡出** | 不随对话老化 / 压缩而丢失 |
|
|
28
|
-
| A4 | **不用软链** | 一律真实拷贝 |
|
|
29
|
-
| A5 | **加删自由** | 真源加 / 删文档,目标目录跟着变 |
|
|
30
|
-
| A6 | **开源通用** | 不绑某一家 agent |
|
|
31
|
-
|
|
32
|
-
> ⚠️ **A1–A3 是硬指标**:任一不满足 ⇒ 判为**该 agent 未接入成功**,**不是**降级通过。
|
|
33
|
-
> 每个 agent 接完都要按 [`features/verification.md`](features/verification.md) 实测。
|
|
34
|
-
|
|
35
|
-
## 四、支持范围
|
|
36
|
-
|
|
37
|
-
Claude Code / Trae / CodeBuddy / WorkBuddy / Codex / OpenCode / DeepSeek Harness。
|
|
38
|
-
各家的工作区规则目录与读取行为见 [`external/agent-rules-dirs.md`](external/agent-rules-dirs.md) —— **该表尚未源码级核实,不得作为实现依据**。
|
|
39
|
-
|
|
40
|
-
## 五、明确不做
|
|
41
|
-
|
|
42
|
-
- **不改规则内容**:不做改写 / 模板渲染,真源写什么就落什么(格式适配只动文件组织方式,不动正文)。
|
|
43
|
-
- **不把注入当主方案**:hook 注入落在动态区,做不到 A3;只在某 agent 无工作区规则目录时作**降级模式**启用,启用即视为该 agent 未达验收标准(见 [`features/hook-injection.md`](features/hook-injection.md))。
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# 工作包:文档体系重建(rulemux 立项首包)
|
|
2
|
-
|
|
3
|
-
> **状态**:✅ **完成封卷**(2026-10-06)
|
|
4
|
-
> **需求原话**(用户):
|
|
5
|
-
> - 「这是我新建的一个我们要新做的开源项目……`DESIGN.md` 里面放的是前期调研的需求、希望实现的功能、来龙去脉,但是放得不规范,是从其他地方直接把需求挪过来的。」
|
|
6
|
-
> - 「第一步不是要去做写代码,而是要把文档先给规整起来。」
|
|
7
|
-
> - 「`docs` 这个文件夹最重要,以后所有文档都围绕它建立:需求文档 / 工作进度 / 工作交接卡 / 需求功能实现、架构等,要维护好。这是从 DeepSeek harness 插件拷贝过来的文档结构,先仔细读,结合原有文档和现在的需求看哪些不合适、要改。」
|
|
8
|
-
> - 「`RULES.md` 全区通用,不要改。」
|
|
9
|
-
> **配套**:[`../README.md`](../README.md)(文档规矩)· [`../PROGRESS.md`](../PROGRESS.md)(现场层)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## 一、诊断:旧文档体系为什么不合用
|
|
14
|
-
|
|
15
|
-
`docs/` 整拷自旧项目 `dsh-task-dispatch-table`(**DSH 宿主的 UI 插件**)。逐项查证结果:
|
|
16
|
-
|
|
17
|
-
| 文件 | 查证结果 |
|
|
18
|
-
|---|---|
|
|
19
|
-
| `docs/PROGRESS.md` / `PROGRESS-HISTORY.md` | 满篇 dsh 工作项(侧边栏 z-index、任务调度、月历视图、Office 预览…),与 rulemux **零关系** ⇒ 重置 |
|
|
20
|
-
| `docs/README.md` §二 分类表 | 含「数据库 `data-model.md`」「样式 `ui-foundation` / `ui-style-guide`」「外部事实 `dsh-capabilities` / `session-view-ui-map`」——rulemux **无 UI、无 DB、无 DSH 宿主** ⇒ 分类表改造 |
|
|
21
|
-
| `AGENTS.md` | 标题仍是 `dsh-task-dispatch-table`;§一 落点表指向一批**不存在**的文档;§二 六条约定全是 dsh 专属(dist 入库 / 冒烟 / ssh remote 直连 / DSH 宿主读源码 / 真实取数禁模拟)⇒ 项目段改写 |
|
|
22
|
-
| `docs/design/external/`、`features/`、`worklog/`、`examples/` | **全空** ⇒ 正好留给 rulemux 用 |
|
|
23
|
-
| 根 `README.md` | **不存在**(用户以为拷来了,实测根目录只有 `docs/`、`AGENTS.md`、`DESIGN.md`、`RULES.md`)⇒ doc 系统第一入口缺失,需新建 |
|
|
24
|
-
|
|
25
|
-
**结论**:旧体系只有「骨架」(分层 + 分类规矩)可复用,**内容与分类表全是另一个项目的**。
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## 二、确认过的三个岔路(用户拍板)
|
|
30
|
-
|
|
31
|
-
1. `DESIGN.md` **不原地规整** —— 按 `docs/README.md` 的分类**分解后落位**。
|
|
32
|
-
2. 根 `README.md` 按 doc 系统「对外」类格式**全重写**(实际是新建)。
|
|
33
|
-
3. `AGENTS.md` 项目段**先只放落点表**,约定类(build / 远端 / 冒烟等)等代码定了再补。
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 三、做了什么
|
|
38
|
-
|
|
39
|
-
### 3.1 `docs/README.md` 分类表去 dsh 化
|
|
40
|
-
|
|
41
|
-
- 删「数据库」「样式」两类,并写明「本项目无 UI、无数据库 ⇒ 不建」;
|
|
42
|
-
- 新增「架构」类 → `design/architecture.md`;
|
|
43
|
-
- 「功能」改为指向 `design/features.md` + `design/features/`,去掉「对应页面」措辞;
|
|
44
|
-
- 「外部事实」改造为「各 agent 的工作区规则目录」,落 `design/external/<主题>.md`;
|
|
45
|
-
- §四 写法表:「宿主升级后复核」→「上游升级后复核」、「对应页面与文件」→「对应文件」。
|
|
46
|
-
|
|
47
|
-
### 3.2 `DESIGN.md` 分解落位
|
|
48
|
-
|
|
49
|
-
| 原章节 | 落位 |
|
|
50
|
-
|---|---|
|
|
51
|
-
| §1 核心原理 + §7 命名 + 方案选型 | [`../design/architecture.md`](../design/architecture.md) |
|
|
52
|
-
| §2 一级方案:目录同步 | [`../design/features/dir-sync.md`](../design/features/dir-sync.md) |
|
|
53
|
-
| §4 备用方案:hook 注入 | [`../design/features/hook-injection.md`](../design/features/hook-injection.md) |
|
|
54
|
-
| §6 30 秒实测法 | [`../design/features/verification.md`](../design/features/verification.md) |
|
|
55
|
-
| §3 各家工作区规则目录 | [`../design/external/agent-rules-dirs.md`](../design/external/agent-rules-dirs.md)(外部事实类,带「类型 / 适用版本 / 状态 / 来源」头) |
|
|
56
|
-
| §5 未决 / TODO | [`../PROGRESS.md`](../PROGRESS.md) 未决项 T1–T4(另补 T5:删除同步) |
|
|
57
|
-
| — | 另建 [`../design/features.md`](../design/features.md) 功能总索引 |
|
|
58
|
-
|
|
59
|
-
### 3.3 现场层与项目规则文件
|
|
60
|
-
|
|
61
|
-
- `PROGRESS.md`:重置为 rulemux 真实状态(§1.1 本工作包进行中 / §1.2 方案待拍板)+ 未决项 T1–T5 + 下一步;
|
|
62
|
-
- `PROGRESS-HISTORY.md`:清空 dsh 历史,只留表头 + 一行初始化;
|
|
63
|
-
- `AGENTS.md`:标题改 `rulemux`,§一 落点表换成本项目真实文档,§二 约定留空待补;
|
|
64
|
-
- 根 `README.md`:新建(doc 系统「对外」类);
|
|
65
|
-
- 根 `DESIGN.md`:内容已全量迁移 → 删除,避免双真源(原始草稿仍在 git 历史)。
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## 四、遗留与下一步
|
|
70
|
-
|
|
71
|
-
未决项 T1–T5 与下一步清单见 [`../PROGRESS.md`](../PROGRESS.md) §二 / §三,本文件不重复。
|