moluoxixi-ai-rules 0.2.3 → 0.2.5

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.
Files changed (38) hide show
  1. package/README-en.md +321 -0
  2. package/README.md +268 -89
  3. package/dist/capabilities/coding.d.ts +7 -0
  4. package/dist/capabilities/coding.js +9 -0
  5. package/dist/capabilities/common.d.ts +7 -0
  6. package/dist/capabilities/common.js +9 -0
  7. package/dist/capabilities/engineering.d.ts +12 -0
  8. package/dist/capabilities/engineering.js +17 -0
  9. package/dist/capabilities/frontend.d.ts +19 -0
  10. package/dist/capabilities/frontend.js +25 -0
  11. package/dist/capabilities/index.d.ts +7 -0
  12. package/dist/capabilities/index.js +187 -0
  13. package/dist/capabilities/productivity.d.ts +14 -0
  14. package/dist/capabilities/productivity.js +18 -0
  15. package/dist/capabilities/types.d.ts +15 -0
  16. package/dist/capabilities/types.js +7 -0
  17. package/dist/constants/hosts.d.ts +1 -1
  18. package/dist/constants/hosts.js +78 -7
  19. package/dist/roles/matt/constants/skills.d.ts +1 -1
  20. package/dist/roles/matt/constants/skills.js +11 -29
  21. package/dist/roles/moluoxixi/constants/skills.d.ts +1 -1
  22. package/dist/roles/moluoxixi/constants/skills.js +11 -34
  23. package/dist/roles/trellis/constants/skills.d.ts +1 -1
  24. package/dist/roles/trellis/constants/skills.js +17 -40
  25. package/dist/scripts/lib/install.d.ts +6 -6
  26. package/dist/scripts/lib/install.js +35 -4
  27. package/dist/scripts/lib/role-packages.d.ts +4 -6
  28. package/dist/scripts/lib/role-packages.js +40 -16
  29. package/dist/scripts/lib/vendors.js +78 -2
  30. package/dist/scripts/role-packages.js +29 -14
  31. package/package.json +2 -4
  32. package/roles/matt/constants/skills.ts +11 -29
  33. package/roles/matt/role.yaml +4 -0
  34. package/roles/moluoxixi/constants/skills.ts +11 -34
  35. package/roles/moluoxixi/role.yaml +13 -3
  36. package/roles/trellis/constants/skills.ts +17 -40
  37. package/roles/trellis/role.yaml +13 -2
  38. package/README-zh.md +0 -151
package/README-en.md ADDED
@@ -0,0 +1,321 @@
1
+ # Moluoxixi AIRules
2
+
3
+ [简体中文](README.md) | English
4
+
5
+ AIRules distributes versioned role capabilities to AI coding hosts. A role is more than a prompt collection: it is an installable composition of shared skills, MCP servers, a role CLI, project workflows, agents, hooks, and runtime assets.
6
+
7
+ There are two installation layers:
8
+
9
+ - `airules install <role>` installs user-level assets. It checks out pinned vendors, composes capabilities, projects skills through `~/.agents/skills`, merges host MCP configuration, and installs declared role CLI packages.
10
+ - `init-project` installs project-level assets. It invokes the native role CLI to generate `.moluoxixi/` or `.trellis/`, then adds the AIRules knowledge and Simplified Chinese compatibility extensions.
11
+
12
+ The AIRules installer handles user-level package setup, asset distribution, and managed skill/MCP verification, but it does not dispatch agents. The initialized Moluoxixi or Trellis main workflow owns dispatch, hooks inject state and context, and skills perform semantic work and file changes.
13
+
14
+ ## `moluoxixi`
15
+
16
+ For users who want a complete AI development workflow with the native Moluoxixi CLI, project knowledge, multi-domain skills, and controlled multi-agent dispatch.
17
+
18
+ ### Install
19
+
20
+ ```bash
21
+ npm install --global moluoxixi-ai-rules
22
+ airules install moluoxixi --host all
23
+ airules verify moluoxixi --host all
24
+ ```
25
+
26
+ The role install includes Moluoxixi core and its global CLI, exposed as both commands:
27
+
28
+ ```bash
29
+ moluoxixi --version
30
+ ml --version
31
+ ```
32
+
33
+ Install the CLI package directly only when you do not want the complete role or need to repair the CLI installation:
34
+
35
+ ```bash
36
+ npm install --global @moluoxixi/airules-moluoxixi-cli
37
+ ```
38
+
39
+ ### Features
40
+
41
+ #### Installed assets
42
+
43
+ | Layer | Assets | Responsibility |
44
+ | --- | --- | --- |
45
+ | User-level role | Moluoxixi core, `moluoxixi`/`ml`, `init-project` | Native initialization, update, task, memory, workflow, and channel commands |
46
+ | Shared capabilities | `common`, `coding`, `productivity`, `frontend` | Shared and pinned external skills plus MCP servers |
47
+ | Native project | `.moluoxixi/workflow.md`, `tasks/`, `spec/`, `scripts/`, `agents/`, host configuration | Workflow state, task artifacts, project rules, and agent definitions |
48
+ | AIRules project extension | `.moluoxixi/knowledge/`, knowledge runtime and hook, `moluoxixi-knowledge` | Source change detection and traceable project knowledge |
49
+
50
+ `~/.agents/skills` is the canonical shared skill directory. Hosts that can discover it receive no duplicate private copy; AIRules creates managed projections for hosts that require one.
51
+
52
+ #### Skills
53
+
54
+ Project workflow entries become slash commands or discoverable skills according to host capabilities; the table uses their common logical names.
55
+
56
+ | Source | Skill | Purpose |
57
+ | --- | --- | --- |
58
+ | Role entry | `init-project` | Run the installed Moluoxixi CLI, then install knowledge, host hooks, and Chinese task conventions |
59
+ | Project workflow | `moluoxixi-start` | Load identity, Git state, active task, and specs, then select the task path |
60
+ | Project workflow | `moluoxixi-brainstorm` | Clarify requirements and tradeoffs and produce PRD, design, and implementation plans |
61
+ | Project workflow | `moluoxixi-before-dev` | Load current task artifacts and applicable `.moluoxixi/spec/` rules before editing |
62
+ | Project workflow | `moluoxixi-continue` | Resume the active task from its phase index |
63
+ | Project workflow | `moluoxixi-check` | Check specs, lint, types, tests, cross-layer flow, reuse, and scope |
64
+ | Project workflow | `moluoxixi-break-loop` | Analyze recurring bug causes and preserve prevention mechanisms |
65
+ | Project workflow | `moluoxixi-update-spec` | Store confirmed implementation and debugging contracts in project specs |
66
+ | Project workflow | `moluoxixi-finish-work` | Verify gates, prompt for commit, archive the task, and record the journal |
67
+ | Project workflow | `moluoxixi-channel` | Start, inspect, and coordinate live workers through `moluoxixi channel` |
68
+ | Project workflow | `moluoxixi-session-insight` | Search prior conversations through `moluoxixi mem` |
69
+ | Project workflow | `moluoxixi-spec-bootstrap` | Build or refresh project-specific coding specs from real source |
70
+ | Project workflow | `moluoxixi-meta` | Inspect and customize `.moluoxixi/`, host hooks, agents, skills, and workflow templates |
71
+ | Knowledge extension | `moluoxixi-knowledge` | Organize sources into library pages, update `index.md` and `relations.json`, then acknowledge a valid batch |
72
+ | `common` | `create-skill` | Create or revise a reusable agent skill |
73
+ | `common` | `spec-organization` | Reorganize specification directories, names, indexes, and links |
74
+ | `frontend` | `frontend-design` | Give intentional visual direction when creating or reshaping interfaces |
75
+ | `productivity` | `grill-me` | Start a rigorous interview that turns an idea into an executable plan |
76
+ | `productivity` | `grilling` | Stress-test plans, decisions, and designs |
77
+ | `productivity` | `handoff` | Compress the conversation into a document another agent can resume |
78
+ | `productivity` | `teach` | Run stateful teaching across sessions in the current repository |
79
+ | `productivity` | `to-questionnaire` | Turn unresolved decisions into a questionnaire for an informed person |
80
+ | `productivity` | `wait-what` | Restate misunderstood material in direct technical English |
81
+ | `productivity` | `writing-for-agents` | Write skills, `AGENTS.md`, and `CLAUDE.md` for agent consumption |
82
+
83
+ The `coding` capability installs the CodeGraph, Context7, and Sequential Thinking MCP servers for code relationships, library documentation, and structured reasoning. The `frontend` capability installs Playwright MCP for browser inspection and automation.
84
+
85
+ #### Agents, hooks, and dispatch
86
+
87
+ | Agent | Responsibility | Write boundary |
88
+ | --- | --- | --- |
89
+ | `moluoxixi-research` | Research source, specs, and technical options | Writes only to the active task's `research/`; read-only elsewhere |
90
+ | `moluoxixi-implement` | Implement from PRD/design/implement and run checks | May edit implementation; never commits or recursively dispatches |
91
+ | `moluoxixi-check` | Independently review diff, specs, tests, and scope | May fix mechanical issues; never commits or recursively dispatches |
92
+
93
+ The main session is the sole dispatcher. In automatic mode, research can precede the execution chain `implement -> check -> update-spec -> commit -> finish-work`. With `dispatch_mode: inline`, the main session runs `before-dev -> edit -> check` itself. `moluoxixi channel spawn --agent <name>` loads definitions from `.moluoxixi/agents/`; its supervisor bridges workers and the main session through the event log.
94
+
95
+ Hooks inject context but do not replace skills:
96
+
97
+ ```text
98
+ UserPrompt/SessionStart
99
+ -> workflow-state hook reads the active task and workflow.md
100
+ -> knowledge-hook.py calls common/knowledge.py for index + status
101
+ -> current phase, task, and impacted knowledge assets enter context
102
+ -> the main session invokes workflow or knowledge skills as needed
103
+
104
+ SubagentStart
105
+ -> subagent-context hook identifies research/implement/check
106
+ -> injects task JSONL, PRD, design, implement, and relevant specs
107
+ ```
108
+
109
+ The knowledge hook performs deterministic scanning and context injection only. `moluoxixi-knowledge` performs semantic organization. `relations.json` is the single machine-readable source of truth for each canonical asset's dependency on one or more sources; the runtime derives the reverse source-to-assets impact index.
110
+
111
+ ### Usage
112
+
113
+ For first-time full workflow and knowledge setup, ask in the target host:
114
+
115
+ ```text
116
+ Use init-project to initialize the Moluoxixi workflow in this project for Codex.
117
+ ```
118
+
119
+ A typical task moves through:
120
+
121
+ ```text
122
+ describe requirement -> start -> brainstorm -> task start
123
+ -> research when needed -> implement -> check -> update-spec
124
+ -> user-approved commit -> finish-work
125
+ ```
126
+
127
+ Put reference material in `.moluoxixi/knowledge/sources/`. On each turn the hook checks for changes; pending sources route the AI through `moluoxixi-knowledge` before the main task.
128
+
129
+ Use `init-project` only for first-time setup, adding or reconfiguring a host, or restoring extensions. It is unnecessary for shared skills or CLI-only use. Running `moluoxixi init` directly installs native project assets without the AIRules knowledge extension.
130
+
131
+ Role source: [`roles/moluoxixi`](roles/moluoxixi).
132
+
133
+ ## `matt`
134
+
135
+ For users who want Matt Pocock's engineering and productivity methods without a fixed project workflow, project agents, hooks, MCP servers, or a role CLI.
136
+
137
+ ### Install
138
+
139
+ ```bash
140
+ npm install --global moluoxixi-ai-rules
141
+ airules install matt --host all
142
+ airules verify matt --host all
143
+ ```
144
+
145
+ ### Features
146
+
147
+ #### Installed assets
148
+
149
+ `matt` composes only the `engineering` and `productivity` capabilities. It installs pinned upstream skills but creates no `.matt/` directory and has no role-owned `init-project`, agents, hooks, CLI, or MCP server.
150
+
151
+ #### Skills
152
+
153
+ | Capability | Skill | Purpose |
154
+ | --- | --- | --- |
155
+ | `engineering` | `ask-matt` | Explicit router that selects the appropriate Matt skill or flow |
156
+ | `engineering` | `code-review` | Review changes since a baseline against standards and specification |
157
+ | `engineering` | `codebase-design` | Improve module boundaries, interfaces, and testability using deep-module principles |
158
+ | `engineering` | `diagnosing-bugs` | Diagnose difficult bugs, performance problems, and regressions |
159
+ | `engineering` | `domain-modeling` | Create or revise domain models, `CONTEXT.md`, and ADRs |
160
+ | `engineering` | `grill-with-docs` | Interview a design while producing ADR and vocabulary documents |
161
+ | `engineering` | `implement` | Implement an existing specification or ticket set |
162
+ | `engineering` | `improve-codebase-architecture` | Find architectural improvement opportunities and drive decisions |
163
+ | `engineering` | `prototype` | Build a disposable prototype to answer design, state, or UI questions |
164
+ | `engineering` | `research` | Research primary sources and write repository Markdown |
165
+ | `engineering` | `resolving-merge-conflicts` | Resolve an active merge/rebase and run checks |
166
+ | `engineering` | `setup-matt-pocock-skills` | Configure issue tracking, triage labels, and domain documentation |
167
+ | `engineering` | `tdd` | Develop through red-green-refactor |
168
+ | `engineering` | `to-spec` | Convert the conversation into a specification and publish it to the issue tracker |
169
+ | `engineering` | `to-tickets` | Split a plan or spec into dependency-aware tracer-bullet tickets |
170
+ | `engineering` | `triage` | Validate and classify issues or external PRs into agent-ready briefs |
171
+ | `engineering` | `wayfinder` | Plan work larger than one agent session as a decision and ticket map |
172
+ | `engineering` | `wizard` | Generate an interactive Bash wizard for human-only credentials, consoles, or migrations |
173
+ | `productivity` | `grill-me` | Start a rigorous planning interview |
174
+ | `productivity` | `grilling` | Stress-test a plan, decision, or design |
175
+ | `productivity` | `handoff` | Produce a resumable cross-agent handoff |
176
+ | `productivity` | `teach` | Teach across sessions with recorded state |
177
+ | `productivity` | `to-questionnaire` | Turn unknowns into a questionnaire for an informed person |
178
+ | `productivity` | `wait-what` | Restate material that was not understood |
179
+ | `productivity` | `writing-for-agents` | Write agent-facing documents and skills |
180
+
181
+ #### Dispatch
182
+
183
+ `matt` has no project agent scheduler. The host discovers skills from their `SKILL.md` descriptions, and manually constrained skills are not guaranteed to trigger automatically. Explicitly request `ask-matt` when the right path is unclear.
184
+
185
+ ### Usage
186
+
187
+ No `init-project` step is required. State the engineering goal or name a skill directly:
188
+
189
+ ```text
190
+ Use ask-matt to select the right engineering workflow for this requirement.
191
+ Use diagnosing-bugs to find the cause of this performance regression.
192
+ Turn this proposal into a spec, then use to-tickets to split the work.
193
+ Implement this behavior with tdd, then run code-review.
194
+ ```
195
+
196
+ A typical extended chain is `setup-matt-pocock-skills -> to-spec -> to-tickets -> implement -> code-review`; isolated problems can invoke one skill directly. The host, repository documents, or issue tracker owns state, and AIRules creates no `.matt/` directory.
197
+
198
+ Role source: [`roles/matt`](roles/matt).
199
+
200
+ ## `trellis`
201
+
202
+ For users who want the native Trellis task-and-specification workflow together with AIRules shared skills, MCP, project knowledge, and multi-agent dispatch.
203
+
204
+ ### Install
205
+
206
+ ```bash
207
+ npm install --global moluoxixi-ai-rules
208
+ airules install trellis --host all
209
+ airules verify trellis --host all
210
+ trellis --version
211
+ ```
212
+
213
+ The role install provides the Trellis CLI and user-level capabilities but does not modify a project. `init-project` creates project-local workflow assets.
214
+
215
+ ### Features
216
+
217
+ #### Installed assets
218
+
219
+ | Layer | Assets | Responsibility |
220
+ | --- | --- | --- |
221
+ | User-level role | Trellis CLI and `init-project` | Native `init/update/upgrade/uninstall/mem/workflow/platforms/channel` commands |
222
+ | Shared capabilities | `common`, `coding`, `productivity`, `frontend` | The same shared skills, pinned external skills, and MCP servers as Moluoxixi |
223
+ | Native project | `.trellis/workflow.md`, `tasks/`, `spec/`, `scripts/`, `agents/`, host configuration | Plan/Execute/Finish state, task artifacts, specs, and agent definitions |
224
+ | AIRules project extension | `.trellis/knowledge/`, knowledge runtime and hook, `trellis-knowledge` | Source change detection and bidirectionally traceable knowledge |
225
+
226
+ #### Skills
227
+
228
+ Native Trellis projects workflow entries as commands or skills according to host capabilities; the table uses their common skill names.
229
+
230
+ | Source | Skill | Purpose |
231
+ | --- | --- | --- |
232
+ | Role entry | `init-project` | Run native `trellis init`, then add knowledge, README usage, and Chinese task conventions |
233
+ | Project workflow | `trellis-start` | Initialize a development session and select the task path |
234
+ | Project workflow | `trellis-brainstorm` | Clarify complex requirements and create PRD, design, and implementation plans |
235
+ | Project workflow | `trellis-before-dev` | Load applicable project coding guidelines before implementation |
236
+ | Project workflow | `trellis-continue` | Resume the current task from its phase index |
237
+ | Project workflow | `trellis-check` | Check specs, lint, types, tests, reuse, scope, and cross-layer consistency |
238
+ | Project workflow | `trellis-break-loop` | Analyze recurring bugs and establish prevention mechanisms |
239
+ | Project workflow | `trellis-update-spec` | Preserve confirmed contracts and coding conventions in `.trellis/spec/` |
240
+ | Project workflow | `trellis-finish-work` | Verify quality gates, archive the task, and record the journal |
241
+ | Project workflow | `trellis-channel` | Coordinate live multi-agent work through the channel runtime |
242
+ | Project workflow | `trellis-session-insight` | Search prior conversations through `trellis mem` |
243
+ | Project workflow | `trellis-spec-bootstrap` | Build or refresh specs from real source |
244
+ | Project workflow | `trellis-meta` | Inspect and customize `.trellis/`, platform hooks, agents, skills, and workflow |
245
+ | Knowledge extension | `trellis-knowledge` | Organize sources, update library/index/relations, and acknowledge a stable batch |
246
+ | `common` | `create-skill` | Create or revise a reusable agent skill |
247
+ | `common` | `spec-organization` | Reorganize project specification documents and indexes |
248
+ | `frontend` | `frontend-design` | Guide intentional frontend design and redesign |
249
+ | `productivity` | `grill-me` | Start a rigorous requirements interview |
250
+ | `productivity` | `grilling` | Stress-test plans, decisions, and designs |
251
+ | `productivity` | `handoff` | Produce a cross-agent handoff |
252
+ | `productivity` | `teach` | Teach across sessions with recorded progress |
253
+ | `productivity` | `to-questionnaire` | Turn unresolved questions into a questionnaire |
254
+ | `productivity` | `wait-what` | Restate misunderstood material |
255
+ | `productivity` | `writing-for-agents` | Write agent-facing documents and skills |
256
+
257
+ Trellis also installs the CodeGraph, Context7, Sequential Thinking, and Playwright MCP servers. Its role-owned MCP manifest is empty; these servers come from `coding` and `frontend` capabilities.
258
+
259
+ #### Agents, hooks, and dispatch
260
+
261
+ | Agent | Responsibility | Dispatch point |
262
+ | --- | --- | --- |
263
+ | `trellis-research` | Research code, specs, and technical choices, writing only task research | Plan or pre-execution research |
264
+ | `trellis-implement` | Implement from task artifacts and run baseline checks | Execute |
265
+ | `trellis-check` | Independently review implementation and repair mechanical issues | After implement, before commit |
266
+
267
+ The main session normally dispatches `trellis-implement -> trellis-check`, inserting research when needed. Subagent prompts start with `Active task`, then hooks inject context in the order `JSONL -> prd.md -> design.md -> implement.md -> spec`. Implement and check agents cannot dispatch each other or recurse. With `dispatch_mode: inline`, the main session runs `trellis-before-dev -> edit -> trellis-check`.
268
+
269
+ Plan creates and confirms the PRD and, for complex work, design and implementation artifacts before `task.py start`. Execute implements and checks. Finish runs break-loop when needed, updates specs, asks for commit approval, and runs finish-work. The channel runtime can also load `.trellis/agents/implement.md` and `check.md` as persistent workers.
270
+
271
+ The knowledge chain mirrors Moluoxixi: a host event invokes `knowledge-hook.py`; the shared scanner computes source changes, impacted assets, and relationship errors; the hook injects `<trellis-knowledge>`; `trellis-knowledge` performs organization and acknowledgement.
272
+
273
+ ### Usage
274
+
275
+ For first-time full workflow and knowledge setup, ask:
276
+
277
+ ```text
278
+ Use init-project to initialize the Trellis workflow in this project for developer wl and Codex.
279
+ ```
280
+
281
+ Use the workflow entry points during development:
282
+
283
+ ```text
284
+ Use Trellis to start this requirement: <describe the requirement>
285
+ Use Trellis to continue the current task.
286
+ Use Trellis to check the current changes.
287
+ Use Trellis to finish this work.
288
+ ```
289
+
290
+ The workflow is Plan → Execute → Finish. Put reference material in `.trellis/knowledge/sources/`; when the hook finds changes it routes through `trellis-knowledge` before the main task.
291
+
292
+ Use `init-project` only for first-time setup, adding a host, or reconfiguration. It is unnecessary when using only the role's shared skills and MCP servers.
293
+
294
+ Role source: [`roles/trellis`](roles/trellis).
295
+
296
+ ## Shared distribution
297
+
298
+ Roles declare capabilities. The registry composes vendors in declaration order, merges compatible projections, deduplicates identical projections, and rejects source or target conflicts. See [capabilities/README.md](capabilities/README.md) for the complete mapping.
299
+
300
+ ```text
301
+ role manifest
302
+ -> pinned vendor checkout / package setup
303
+ -> vendor staging
304
+ -> canonical ~/.agents/skills
305
+ -> host skill projection and MCP merge
306
+ ```
307
+
308
+ The managed shared layer reflects the currently installed role, so roles are not fully isolated environments that accumulate forever. Existing user MCP entries win same-name conflicts. `airules verify` checks managed skills, host links, and MCP server names, not project agents and hooks generated by an initializer; the native workflow checks those assets.
309
+
310
+ ## Development
311
+
312
+ ```bash
313
+ npm install
314
+ npm test
315
+ npm run typecheck
316
+ npm run lint:check
317
+ ```
318
+
319
+ ## License
320
+
321
+ MIT