mustflow 2.59.0 → 2.69.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.
Files changed (47) hide show
  1. package/README.md +1 -0
  2. package/dist/cli/commands/context.js +81 -6
  3. package/dist/cli/commands/skill.js +116 -0
  4. package/dist/cli/i18n/en.js +3 -1
  5. package/dist/cli/i18n/es.js +3 -1
  6. package/dist/cli/i18n/fr.js +3 -1
  7. package/dist/cli/i18n/hi.js +3 -1
  8. package/dist/cli/i18n/ko.js +3 -1
  9. package/dist/cli/i18n/zh.js +3 -1
  10. package/dist/cli/lib/agent-context.js +981 -8
  11. package/dist/cli/lib/command-registry.js +6 -0
  12. package/dist/cli/lib/local-index/constants.js +4 -5
  13. package/dist/cli/lib/local-index/freshness.js +5 -1
  14. package/dist/cli/lib/local-index/index.js +1 -1
  15. package/dist/cli/lib/repo-map.js +7 -1
  16. package/dist/cli/lib/validation/constants.js +3 -0
  17. package/dist/cli/lib/validation/index.js +41 -2
  18. package/dist/core/check-issues.js +5 -0
  19. package/dist/core/prompt-cache-rendering.js +19 -0
  20. package/dist/core/public-json-contracts.js +26 -0
  21. package/dist/core/quality-gaming.js +4 -0
  22. package/dist/core/skill-route-fixtures.js +173 -0
  23. package/dist/core/skill-route-resolution.js +398 -0
  24. package/dist/core/source-anchors.js +91 -5
  25. package/package.json +1 -1
  26. package/schemas/README.md +7 -2
  27. package/schemas/context-report.schema.json +442 -0
  28. package/schemas/quality-gaming-report.schema.json +1 -0
  29. package/schemas/route-fixture.schema.json +57 -0
  30. package/schemas/skill-route-report.schema.json +242 -0
  31. package/templates/default/common/.mustflow/config/commands.toml +18 -2
  32. package/templates/default/common/.mustflow/config/mustflow.toml +16 -10
  33. package/templates/default/i18n.toml +21 -9
  34. package/templates/default/locales/en/.mustflow/context/PROJECT.md +5 -3
  35. package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +13 -9
  36. package/templates/default/locales/en/.mustflow/skills/INDEX.md +4 -2
  37. package/templates/default/locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md +5 -2
  38. package/templates/default/locales/en/.mustflow/skills/quality-gaming-guard/SKILL.md +8 -6
  39. package/templates/default/locales/en/.mustflow/skills/router.toml +67 -0
  40. package/templates/default/locales/en/.mustflow/skills/routes.toml +12 -0
  41. package/templates/default/locales/en/.mustflow/skills/skill-refresh/SKILL.md +234 -0
  42. package/templates/default/locales/en/.mustflow/skills/task-instruction-authoring/SKILL.md +239 -0
  43. package/templates/default/locales/en/AGENTS.md +15 -7
  44. package/templates/default/locales/ko/.mustflow/context/PROJECT.md +4 -2
  45. package/templates/default/locales/ko/.mustflow/docs/agent-workflow.md +18 -12
  46. package/templates/default/locales/ko/AGENTS.md +8 -6
  47. package/templates/default/manifest.toml +12 -1
@@ -0,0 +1,242 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mustflow.github.io/schemas/skill-route-report.schema.json",
4
+ "title": "mustflow skill route report",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "kind",
10
+ "input",
11
+ "signals",
12
+ "selected",
13
+ "candidates",
14
+ "source_files",
15
+ "gap_notes",
16
+ "command",
17
+ "action"
18
+ ],
19
+ "properties": {
20
+ "schema_version": { "const": "1" },
21
+ "kind": { "const": "skill_route_resolution" },
22
+ "command": { "const": "skill" },
23
+ "action": { "const": "route" },
24
+ "input": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["task_text_present", "paths", "reasons", "max_candidates"],
28
+ "properties": {
29
+ "task_text_present": { "type": "boolean" },
30
+ "paths": {
31
+ "type": "array",
32
+ "items": { "type": "string" }
33
+ },
34
+ "reasons": {
35
+ "type": "array",
36
+ "items": { "type": "string" }
37
+ },
38
+ "max_candidates": {
39
+ "type": "integer",
40
+ "minimum": 1,
41
+ "maximum": 10
42
+ }
43
+ }
44
+ },
45
+ "signals": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["task_terms", "path_terms", "reasons", "read_shards"],
49
+ "properties": {
50
+ "task_terms": {
51
+ "type": "array",
52
+ "items": { "type": "string" }
53
+ },
54
+ "path_terms": {
55
+ "type": "array",
56
+ "items": { "type": "string" }
57
+ },
58
+ "reasons": {
59
+ "type": "array",
60
+ "items": { "type": "string" }
61
+ },
62
+ "read_shards": {
63
+ "type": "array",
64
+ "items": { "type": "string" }
65
+ }
66
+ }
67
+ },
68
+ "selected": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["main", "adjuncts"],
72
+ "properties": {
73
+ "main": {
74
+ "oneOf": [
75
+ { "$ref": "#/$defs/candidate" },
76
+ { "type": "null" }
77
+ ]
78
+ },
79
+ "adjuncts": {
80
+ "type": "array",
81
+ "items": { "$ref": "#/$defs/candidate" }
82
+ }
83
+ }
84
+ },
85
+ "candidates": {
86
+ "type": "array",
87
+ "items": { "$ref": "#/$defs/candidate" }
88
+ },
89
+ "read_plan": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": [
93
+ "selection_limits",
94
+ "stable_kernel",
95
+ "selected_skill_paths",
96
+ "candidate_skill_paths",
97
+ "fallback_route_metadata",
98
+ "expanded_index",
99
+ "avoid_by_default",
100
+ "notes"
101
+ ],
102
+ "properties": {
103
+ "selection_limits": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": ["candidates", "main", "adjuncts"],
107
+ "properties": {
108
+ "candidates": {
109
+ "type": "integer",
110
+ "minimum": 1,
111
+ "maximum": 10
112
+ },
113
+ "main": {
114
+ "type": "integer",
115
+ "minimum": 1,
116
+ "maximum": 1
117
+ },
118
+ "adjuncts": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "maximum": 2
122
+ }
123
+ }
124
+ },
125
+ "stable_kernel": {
126
+ "type": "array",
127
+ "items": { "type": "string" }
128
+ },
129
+ "selected_skill_paths": {
130
+ "type": "array",
131
+ "items": { "type": "string" }
132
+ },
133
+ "candidate_skill_paths": {
134
+ "type": "array",
135
+ "items": { "type": "string" }
136
+ },
137
+ "fallback_route_metadata": { "$ref": "#/$defs/readPlanFile" },
138
+ "expanded_index": { "$ref": "#/$defs/readPlanFile" },
139
+ "avoid_by_default": {
140
+ "type": "array",
141
+ "items": { "type": "string" }
142
+ },
143
+ "notes": {
144
+ "type": "array",
145
+ "items": { "type": "string" }
146
+ }
147
+ }
148
+ },
149
+ "source_files": {
150
+ "type": "array",
151
+ "items": { "type": "string" }
152
+ },
153
+ "gap_notes": {
154
+ "type": "array",
155
+ "items": { "type": "string" }
156
+ }
157
+ },
158
+ "$defs": {
159
+ "candidate": {
160
+ "type": "object",
161
+ "additionalProperties": false,
162
+ "required": [
163
+ "skill",
164
+ "skill_path",
165
+ "trigger",
166
+ "category",
167
+ "route_type",
168
+ "priority",
169
+ "applies_to_reasons",
170
+ "score",
171
+ "score_breakdown",
172
+ "selection_reasons",
173
+ "verification_intents"
174
+ ],
175
+ "properties": {
176
+ "skill": { "type": "string" },
177
+ "skill_path": { "type": "string" },
178
+ "trigger": { "type": "string" },
179
+ "category": {
180
+ "type": ["string", "null"],
181
+ "enum": [
182
+ "bug_failure",
183
+ "general_code",
184
+ "tests",
185
+ "docs_release",
186
+ "security_privacy",
187
+ "data_external",
188
+ "ui_assets",
189
+ "architecture_patterns",
190
+ "workflow_contracts",
191
+ null
192
+ ]
193
+ },
194
+ "route_type": { "type": "string" },
195
+ "priority": { "type": "integer" },
196
+ "applies_to_reasons": {
197
+ "type": "array",
198
+ "items": { "type": "string" }
199
+ },
200
+ "score": { "type": "number" },
201
+ "score_breakdown": {
202
+ "type": "object",
203
+ "additionalProperties": false,
204
+ "required": [
205
+ "reason_match",
206
+ "task_text_match",
207
+ "path_match",
208
+ "route_type_weight",
209
+ "priority_weight"
210
+ ],
211
+ "properties": {
212
+ "reason_match": { "type": "number" },
213
+ "task_text_match": { "type": "number" },
214
+ "path_match": { "type": "number" },
215
+ "route_type_weight": { "type": "number" },
216
+ "priority_weight": { "type": "number" }
217
+ }
218
+ },
219
+ "selection_reasons": {
220
+ "type": "array",
221
+ "items": { "type": "string" }
222
+ },
223
+ "verification_intents": {
224
+ "type": "array",
225
+ "items": { "type": "string" }
226
+ }
227
+ }
228
+ },
229
+ "readPlanFile": {
230
+ "type": "object",
231
+ "additionalProperties": false,
232
+ "required": ["path", "read_when"],
233
+ "properties": {
234
+ "path": { "type": "string" },
235
+ "read_when": {
236
+ "type": "array",
237
+ "items": { "type": "string" }
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
@@ -143,6 +143,22 @@ network = false
143
143
  destructive = false
144
144
  required_after = ["code_change", "behavior_change", "test_change", "public_api_change", "performance_change", "unknown_change"]
145
145
 
146
+ [intents.prompt_cache_audit]
147
+ status = "configured"
148
+ kind = "mustflow_builtin"
149
+ lifecycle = "oneshot"
150
+ run_policy = "agent_allowed"
151
+ description = "Measure prompt-cache profile sizes and configured budget status read-only."
152
+ argv = ["mf", "context", "--json", "--cache-profile", "all", "--cache-audit"]
153
+ cwd = "."
154
+ timeout_seconds = 120
155
+ stdin = "closed"
156
+ success_exit_codes = [0]
157
+ writes = []
158
+ network = false
159
+ destructive = false
160
+ required_after = ["mustflow_config_change", "mustflow_docs_change", "public_api_change", "performance_change", "unknown_change"]
161
+
146
162
  [intents.line_endings_normalize]
147
163
  status = "manual_only"
148
164
  description = "Normalize tracked text files to the repository line-ending policy."
@@ -250,8 +266,8 @@ status = "configured"
250
266
  kind = "mustflow_builtin"
251
267
  lifecycle = "oneshot"
252
268
  run_policy = "agent_allowed"
253
- description = "Create or refresh the generated mustflow SQLite local index."
254
- argv = ["mf", "index"]
269
+ description = "Create or refresh the generated mustflow SQLite local index, including bounded source anchors."
270
+ argv = ["mf", "index", "--source"]
255
271
  cwd = "."
256
272
  timeout_seconds = 300
257
273
  stdin = "closed"
@@ -8,10 +8,12 @@ read_order = [
8
8
  ".mustflow/config/commands.toml",
9
9
  ".mustflow/config/preferences.toml",
10
10
  ".mustflow/config/technology.toml",
11
- ".mustflow/skills/INDEX.md",
11
+ ".mustflow/skills/router.toml",
12
12
  ]
13
13
  optional_read_order = [
14
14
  ".mustflow/context/INDEX.md",
15
+ ".mustflow/skills/routes.toml",
16
+ ".mustflow/skills/INDEX.md",
15
17
  "REPO_MAP.md",
16
18
  ]
17
19
 
@@ -19,6 +21,8 @@ optional_read_order = [
19
21
  primary_instruction = "AGENTS.md"
20
22
  repository_map = "REPO_MAP.md"
21
23
  skill_index = ".mustflow/skills/INDEX.md"
24
+ skill_router = ".mustflow/skills/router.toml"
25
+ skill_routes = ".mustflow/skills/routes.toml"
22
26
  command_contract = ".mustflow/config/commands.toml"
23
27
  workflow_preferences = ".mustflow/config/preferences.toml"
24
28
  technology_preferences = ".mustflow/config/technology.toml"
@@ -38,6 +42,8 @@ anchor_files = [
38
42
  ".mustflow/config/commands.toml",
39
43
  ".mustflow/config/preferences.toml",
40
44
  ".mustflow/config/technology.toml",
45
+ ".mustflow/skills/router.toml",
46
+ ".mustflow/skills/routes.toml",
41
47
  ".mustflow/skills/INDEX.md",
42
48
  "README.md",
43
49
  "PROJECT.md",
@@ -130,25 +136,24 @@ stable_prefix_policy = "hash_verified"
130
136
  prefer_references_when_unchanged = true
131
137
  exclude_volatile_state_from_prefix = true
132
138
  include_content_hashes = true
133
- max_stable_prefix_kb = 96
139
+ max_stable_prefix_kb = 48
134
140
  max_task_context_kb = 48
135
141
  max_volatile_suffix_kb = 24
136
142
 
137
143
  [prompt_cache.layers.stable]
144
+ target_kb = 32
138
145
  read = [
139
146
  "AGENTS.md",
140
- ".mustflow/docs/agent-workflow.md",
141
- ".mustflow/config/mustflow.toml",
142
- ".mustflow/config/commands.toml",
143
- ".mustflow/config/technology.toml",
144
- ".mustflow/skills/INDEX.md",
147
+ ".mustflow/skills/router.toml",
145
148
  ]
146
149
 
147
150
  [prompt_cache.layers.task]
148
151
  read_policy = "task_relevant_only"
149
152
  sources = [
150
153
  ".mustflow/context/INDEX.md",
151
- "REPO_MAP.md",
154
+ "skill_route_candidates",
155
+ "route_metadata_fallback",
156
+ "repo_map_navigation",
152
157
  "matching_skill",
153
158
  "relevant_source_files",
154
159
  ]
@@ -242,7 +247,7 @@ read = [
242
247
  method = "hash_check"
243
248
  read = [
244
249
  "AGENTS.md",
245
- ".mustflow/skills/INDEX.md",
250
+ ".mustflow/skills/router.toml",
246
251
  ]
247
252
 
248
253
  [refresh.levels.full]
@@ -254,7 +259,8 @@ read = [
254
259
  ".mustflow/config/commands.toml",
255
260
  ".mustflow/config/preferences.toml",
256
261
  ".mustflow/config/technology.toml",
257
- ".mustflow/skills/INDEX.md",
262
+ ".mustflow/skills/router.toml",
263
+ ".mustflow/skills/routes.toml",
258
264
  ]
259
265
 
260
266
  [compaction]
@@ -10,8 +10,8 @@ status_values = ["current", "stale", "needs_review", "missing"]
10
10
  [documents."agents.root"]
11
11
  source = "locales/en/AGENTS.md"
12
12
  source_locale = "en"
13
- revision = 15
14
- translations.ko = { path = "locales/ko/AGENTS.md", source_revision = 15, status = "current" }
13
+ revision = 17
14
+ translations.ko = { path = "locales/ko/AGENTS.md", source_revision = 17, status = "current" }
15
15
  translations.zh = { path = "locales/zh/AGENTS.md", source_revision = 11, status = "needs_review" }
16
16
  translations.es = { path = "locales/es/AGENTS.md", source_revision = 11, status = "needs_review" }
17
17
  translations.fr = { path = "locales/fr/AGENTS.md", source_revision = 11, status = "needs_review" }
@@ -30,8 +30,8 @@ translations.hi = { path = "locales/hi/.mustflow/context/INDEX.md", source_revis
30
30
  [documents."context.project"]
31
31
  source = "locales/en/.mustflow/context/PROJECT.md"
32
32
  source_locale = "en"
33
- revision = 1
34
- translations.ko = { path = "locales/ko/.mustflow/context/PROJECT.md", source_revision = 1, status = "current" }
33
+ revision = 3
34
+ translations.ko = { path = "locales/ko/.mustflow/context/PROJECT.md", source_revision = 3, status = "current" }
35
35
  translations.zh = { path = "locales/zh/.mustflow/context/PROJECT.md", source_revision = 1, status = "needs_review" }
36
36
  translations.es = { path = "locales/es/.mustflow/context/PROJECT.md", source_revision = 1, status = "needs_review" }
37
37
  translations.fr = { path = "locales/fr/.mustflow/context/PROJECT.md", source_revision = 1, status = "needs_review" }
@@ -40,8 +40,8 @@ translations.hi = { path = "locales/hi/.mustflow/context/PROJECT.md", source_rev
40
40
  [documents."docs.agent-workflow"]
41
41
  source = "locales/en/.mustflow/docs/agent-workflow.md"
42
42
  source_locale = "en"
43
- revision = 20
44
- translations.ko = { path = "locales/ko/.mustflow/docs/agent-workflow.md", source_revision = 20, status = "current" }
43
+ revision = 23
44
+ translations.ko = { path = "locales/ko/.mustflow/docs/agent-workflow.md", source_revision = 23, status = "current" }
45
45
  translations.zh = { path = "locales/zh/.mustflow/docs/agent-workflow.md", source_revision = 18, status = "needs_review" }
46
46
  translations.es = { path = "locales/es/.mustflow/docs/agent-workflow.md", source_revision = 18, status = "needs_review" }
47
47
  translations.fr = { path = "locales/fr/.mustflow/docs/agent-workflow.md", source_revision = 18, status = "needs_review" }
@@ -62,7 +62,7 @@ translations = {}
62
62
  [documents."skills.index"]
63
63
  source = "locales/en/.mustflow/skills/INDEX.md"
64
64
  source_locale = "en"
65
- revision = 168
65
+ revision = 170
66
66
  translations = {}
67
67
 
68
68
  [documents."skill.adapter-boundary"]
@@ -122,7 +122,7 @@ translations = {}
122
122
  [documents."skill.quality-gaming-guard"]
123
123
  source = "locales/en/.mustflow/skills/quality-gaming-guard/SKILL.md"
124
124
  source_locale = "en"
125
- revision = 1
125
+ revision = 2
126
126
  translations = {}
127
127
 
128
128
  [documents."skill.module-boundary-review"]
@@ -921,12 +921,24 @@ source_locale = "en"
921
921
  revision = 3
922
922
  translations = {}
923
923
 
924
+ [documents."skill.skill-refresh"]
925
+ source = "locales/en/.mustflow/skills/skill-refresh/SKILL.md"
926
+ source_locale = "en"
927
+ revision = 1
928
+ translations = {}
929
+
924
930
  [documents."skill.skill-authoring"]
925
931
  source = "locales/en/.mustflow/skills/skill-authoring/SKILL.md"
926
932
  source_locale = "en"
927
933
  revision = 8
928
934
  translations = {}
929
935
 
936
+ [documents."skill.task-instruction-authoring"]
937
+ source = "locales/en/.mustflow/skills/task-instruction-authoring/SKILL.md"
938
+ source_locale = "en"
939
+ revision = 2
940
+ translations = {}
941
+
930
942
  [documents."skill.template-install-surface-sync"]
931
943
  source = "locales/en/.mustflow/skills/template-install-surface-sync/SKILL.md"
932
944
  source_locale = "en"
@@ -984,7 +996,7 @@ translations = {}
984
996
  [documents."skill.llm-token-cost-control-review"]
985
997
  source = "locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md"
986
998
  source_locale = "en"
987
- revision = 1
999
+ revision = 2
988
1000
  translations = {}
989
1001
 
990
1002
  [documents."skill.llm-response-latency-review"]
@@ -3,7 +3,7 @@ mustflow_doc: context.project
3
3
  kind: mustflow-context
4
4
  locale: en
5
5
  canonical: true
6
- revision: 1
6
+ revision: 3
7
7
  name: project
8
8
  authority: contextual
9
9
  lifecycle: user-editable
@@ -58,9 +58,11 @@ Unset. List paths, public APIs, generated files, migrations, secrets, or compati
58
58
  - `.mustflow/docs/agent-workflow.md`
59
59
  - `.mustflow/config/mustflow.toml`
60
60
  - `.mustflow/config/commands.toml`
61
- - `.mustflow/skills/INDEX.md`
61
+ - `.mustflow/skills/router.toml`
62
+ - `.mustflow/skills/routes.toml` only when detailed route metadata is needed
63
+ - `.mustflow/skills/INDEX.md` only when human-readable route evidence is needed
62
64
 
63
65
  ## Staleness Check
64
66
 
65
67
  - If this file conflicts with current code, tests, command contracts, or user instructions, treat it as stale and report the conflict.
66
- - Update this file only when the project direction, non-goals, or repository-wide promises change.
68
+ - Update this file only when the project direction, non-goals, or repository-wide promises change.
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: docs.agent-workflow
3
3
  locale: en
4
4
  canonical: true
5
- revision: 20
5
+ revision: 23
6
6
  lifecycle: mustflow-owned
7
7
  authority: workflow-policy
8
8
  ---
@@ -31,7 +31,9 @@ mustflow documents have specific, narrow roles. Do not move a rule into a lower-
31
31
  | `.mustflow/config/preferences.toml` | Repository-level defaults for style, language, Git suggestions, testing tendency, verification selection, and version-impact handling. | Lower-authority preferences; not permissions. | Repository-local TOML, user-customizable. |
32
32
  | `.mustflow/context/INDEX.md` | Router for task-specific context files. | Selects optional context only; not a policy manual. | mustflow-owned Markdown. |
33
33
  | `.mustflow/context/PROJECT.md` | Cautious project facts, unknowns, and domain conventions. | Contextual reference below user instructions, code, tests, commands, and configured policies. | User-editable context. |
34
- | `.mustflow/skills/INDEX.md` | Router that selects which procedure document to read for a task. | Selection contract only; procedure detail remains in `SKILL.md`. | mustflow-owned Markdown. |
34
+ | `.mustflow/skills/router.toml` | Stable compact route taxonomy and fallback rules for prompt-cache-friendly first-pass skill selection. | Selection kernel only; procedure detail remains in `SKILL.md`. | mustflow-owned TOML. |
35
+ | `.mustflow/skills/routes.toml` | Full route metadata for detailed procedure selection when the compact router is insufficient. | Selection hint only; procedure detail remains in `SKILL.md`. | mustflow-owned TOML. |
36
+ | `.mustflow/skills/INDEX.md` | Expanded human-readable route table for detailed skill selection and route maintenance. | Selection contract only; procedure detail remains in `SKILL.md`. | mustflow-owned Markdown. |
35
37
  | `.mustflow/skills/<name>/SKILL.md` | Repeatable task procedure with inputs, allowed scope, checks, and reporting format. | Procedure guidance only; cannot authorize commands or override rules. | mustflow-owned Markdown, optionally localized. |
36
38
  | `REPO_MAP.md` | Generated anchor map for broad navigation and nested repository entry points. | Generated navigation aid below current files and instructions. | Generated; refresh with the configured `repo_map` intent or `mf map`. |
37
39
 
@@ -53,10 +55,12 @@ Skills are task procedures, not autonomous tools. Activating a skill means readi
53
55
 
54
56
  At task start and before the first edit:
55
57
 
56
- 1. Read `.mustflow/skills/INDEX.md`.
57
- 2. Match the current task against the listed scenarios.
58
- 3. Read every matching `SKILL.md` before editing that part of the work.
59
- 4. If no skill applies, proceed with the smallest safe change under `AGENTS.md` and `.mustflow/config/commands.toml`.
58
+ 1. Read `.mustflow/skills/router.toml` for the stable route taxonomy, category signals, selection limits, and fallback rules.
59
+ 2. Match the current task against category signals, user intent, expected paths, discovered technology, and event signals.
60
+ 3. Read `.mustflow/skills/routes.toml` when the compact router is insufficient, the task edits skill routing, detailed route metadata is needed, or route confidence is ambiguous.
61
+ 4. Read `.mustflow/skills/INDEX.md` when full route metadata is insufficient, the task edits the expanded route table, or human-readable trigger evidence is needed.
62
+ 5. Read every matching `SKILL.md` before editing that part of the work.
63
+ 6. If no skill applies, proceed with the smallest safe change under `AGENTS.md` and `.mustflow/config/commands.toml`.
60
64
 
61
65
  Activate a skill later if new evidence changes the task type. For example, a failing configured command activates failure triage; a test contract change activates test maintenance; and a documentation or workflow change activates documentation update.
62
66
 
@@ -82,8 +86,8 @@ Prompt caching is a performance optimization, not an authority source. A cached
82
86
 
83
87
  Hosts and agent harnesses assembling model input should keep context in this order:
84
88
 
85
- 1. Stable prefix: repository rules and workflow files from `mf context --json --cache-profile stable`.
86
- 2. Task context: selected context files, matching skills, repository-map anchors, relevant source files, and `mf search --json` results with `cache_layer` set to `task`.
89
+ 1. Stable prefix: repository entrypoint rules and the compact route kernel from `mf context --json --cache-profile stable`.
90
+ 2. Task context: selected context files, workflow/configuration refresh slices, command intent definitions, full route metadata fallback, detailed skill index fallback, matching skills, repository-map anchors, relevant source files, and `mf search --json` results with `cache_layer` set to `task`.
87
91
  3. Volatile suffix: current user request, changed-file lists, command output tails, latest run receipt metadata, timestamps, and any `mf search --json` result whose `volatile` field is `true`.
88
92
 
89
93
  Before reusing a stable prefix, compare the reported content hashes with the current files. If any stable document hash changes, reread the document instead of reusing cached text. Do not place absolute local paths, run receipt timestamps, command output, changed files, or current user task text before the stable prefix.
@@ -126,7 +130,7 @@ Use `.mustflow/config/mustflow.toml` `[refresh]` to determine the refresh level:
126
130
  - `command`: reread `AGENTS.md` and `.mustflow/config/commands.toml`
127
131
  - `edit`: reread `AGENTS.md`, `.mustflow/config/mustflow.toml`, and `.mustflow/docs/agent-workflow.md` before sensitive edits
128
132
  - `report`: reread `AGENTS.md`, `.mustflow/config/mustflow.toml`, and `.mustflow/config/preferences.toml` before the final report
129
- - `skill`: reread `AGENTS.md` and `.mustflow/skills/INDEX.md`
133
+ - `skill`: reread `AGENTS.md` and `.mustflow/skills/router.toml`
130
134
  - `full`: reread the full mustflow read sequence
131
135
 
132
136
  `before_command_run` is a freshness checkpoint for the current command intent, not a requirement to reread every file before every repeated command when the command contract has not changed.
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: skills.index
3
3
  locale: en
4
4
  canonical: true
5
- revision: 168
5
+ revision: 170
6
6
  authority: router
7
7
  lifecycle: mustflow-owned
8
8
  ---
@@ -374,7 +374,7 @@ routes. Event routes stay inactive until their event occurs.
374
374
  | Quality metrics, line-count limits, complexity budgets, lint/type/test gates, or assistant-authored changes may be gamed through long-line stuffing, multiple statements per line, new suppressions, test bypass markers, type escapes, placeholder implementations, generated/vendor logic, giant config blobs, dispatch maps, or helper/util/manager/common containers | `.mustflow/skills/quality-gaming-guard/SKILL.md` | User goal, intended quality outcome behind the metric, current diff, quality gates, formatter/lint/type/test rules, generated/vendor policy, helper naming conventions, suppression baseline, and command contract entries | Real responsibility split, removal of gaming patterns, focused tests or quality-gate evidence, bounded `quality_gaming_check` command contract, and directly synchronized docs or templates | cosmetic metric compliance, line stuffing, validation suppression, test bypass, broad type escape, placeholder success, generated/vendor hiding, junk-drawer helper extraction, or legacy baseline confused with new regression | `quality_gaming_check`, `changes_status`, `changes_diff_summary`, `test_related`, `lint`, `build`, `mustflow_check` | Quality goal, gaming patterns inspected, patterns removed or intentionally left, baseline versus new-regression decision, verification, and remaining quality-gaming risk |
375
375
  | Prompts, prompt builders, system or developer messages, RAG prompt assembly, few-shot examples, structured outputs, tool-use instructions, model selection, reasoning-effort settings, eval sets, refusal or fallback handling, prompt versioning, or AI feature completion criteria are created, changed, reviewed, or reported | `.mustflow/skills/prompt-contract-quality-review/SKILL.md` | Prompt contract ledger, input ledger, authority ledger, output schema, tool policy, model/runtime ledger, RAG evidence ledger, eval ledger, changed files, and command contract entries | Prompt builders, prompt templates, schemas, validators, eval fixtures, boundary examples, tool policies, fallback states, completion definitions, docs, tests, and directly synchronized templates | prompt-as-function gap, user input treated as authority, buried RAG evidence, happy-path-only examples, JSON-parse theater, unpinned production model, hidden prompt storage, raw chain-of-thought request, guessed tool parameters, missing failure state, unbounded reasoning/token cost, or vibe-based prompt improvement claim | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | Prompt contract reviewed, function boundary, authority and source separation, eval and semantic validation status, model/runtime policy, RAG/tool/failure/completion states, verification, and remaining prompt-contract risk |
376
376
  | LLM answers, RAG responses, citations, source grounding, claim extraction, evidence IDs, answerability states, abstain behavior, retrieval thresholds, tool-backed facts, output validators, LLM judges, or hallucination-control metrics are created, changed, reviewed, or reported | `.mustflow/skills/llm-hallucination-control-review/SKILL.md` | Answer contract ledger, evidence ledger, claim ledger, tool ledger, validator ledger, eval ledger, observability ledger, changed files, and command contract entries | Answerability states, abstain states, missing-information states, source-coverage gates, claim maps, evidence-ID requirements, citation validators, retrieval thresholds, chunk metadata, tool-parameter ownership, deterministic calculators, domain validators, eval fixtures, tests, docs, route metadata, and directly synchronized templates | unsupported factual claim, fabricated citation, source ID invention, weak retrieval gate, noisy semantic-only retrieval, chunk context loss, summary-on-summary hallucination, guessed tool parameter, model arithmetic, source-priority conflict, LLM judge overtrust, low-temperature theater, missing abstain path, missing dirty eval, false citation metric gap, or unobservable grounding drift | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | Hallucination-control surface reviewed, answerability and abstain states, evidence IDs, claim map, citations, source coverage, validators, retrieval thresholds, tool ownership, evals, metrics, verification, and remaining hallucination-control risk |
377
- | LLM API calls, prompt assembly, chat history, RAG context, tool schemas, structured output schemas, model routing, reasoning settings, token budgets, provider prompt caching, app-level response caching, retries, batch or flex processing, predicted outputs, image or file inputs, or LLM cost metrics are created, changed, reviewed, or reported | `.mustflow/skills/llm-token-cost-control-review/SKILL.md` | Cost surface ledger, request ledger, cache ledger, context ledger, output ledger, routing ledger, observability ledger, changed files, and command contract entries | Request builders, prompt prefix ordering, canonical serialization, prompt hashes, cache keys, token counters, budget guards, model routers, context trimming, RAG packing, tool and schema payloads, output patch formats, retry repair paths, metrics, logs, tests, docs, route metadata, and directly synchronized templates | prompt-cache prefix drift, volatile field before stable prefix, unmeasured token count, full transcript replay, RAG chunk bloat, oversized tool or JSON schema payload, expensive model default, unbounded reasoning, no visible output after token cap, full-output regeneration, full-context retry replay, app cache key leak, predicted-output cost confusion, image or file token surprise, or per-call cost hiding cost-per-success regression | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | LLM token-cost surface reviewed, cost unit and measurement source, stable prefix and cache behavior, app cache/history/RAG/tool/schema/input choices, routing/reasoning/output/retry/Batch/Flex/prediction choices, observability, verification, and remaining token-cost risk |
377
+ | LLM API calls, prompt assembly, chat history, RAG context, tool schemas, structured output schemas, model routing, reasoning settings, token budgets, provider prompt caching, app-level response caching, retries, batch or flex processing, predicted outputs, image or file inputs, or LLM cost metrics are created, changed, reviewed, or reported | `.mustflow/skills/llm-token-cost-control-review/SKILL.md` | Cost surface ledger, request ledger, cache ledger, context ledger, output ledger, routing ledger, observability ledger, changed files, and command contract entries | Request builders, prompt prefix ordering, canonical serialization, prompt hashes, cache keys, token counters, budget guards, model routers, context trimming, RAG packing, tool and schema payloads, output patch formats, retry repair paths, metrics, logs, tests, docs, route metadata, and directly synchronized templates | prompt-cache prefix drift, volatile field before stable prefix, unmeasured token count, full transcript replay, RAG chunk bloat, oversized tool or JSON schema payload, expensive model default, unbounded reasoning, no visible output after token cap, full-output regeneration, full-context retry replay, app cache key leak, predicted-output cost confusion, image or file token surprise, or per-call cost hiding cost-per-success regression | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `prompt_cache_audit`, `docs_validate_fast`, `test_release`, `mustflow_check` | LLM token-cost surface reviewed, cost unit and measurement source, stable prefix and cache behavior, app cache/history/RAG/tool/schema/input choices, routing/reasoning/output/retry/Batch/Flex/prediction choices, observability, verification, and remaining token-cost risk |
378
378
  | LLM response latency, time to first token, first useful output, streaming, output length, LLM round trips, tool-call wait, prompt-cache latency, model routing, speculative or parallel execution, realtime continuation, priority tiers, predicted outputs, or user-perceived AI speed are created, changed, reviewed, or reported | `.mustflow/skills/llm-response-latency-review/SKILL.md` | Latency target ledger, request timeline ledger, call graph ledger, output ledger, cache ledger, routing ledger, observability ledger, changed files, and command contract entries | Streaming paths, first-useful-output contracts, request timeline metrics, call graph simplification, parallel or speculative work, model routers, fallback cascades, output caps, schema shortening, prompt-cache prefix ordering, cache keys, realtime continuation, priority-tier routing, timeout and cancellation behavior, tests, docs, route metadata, and directly synchronized templates | slow first token, useless streamed preamble, extra sequential LLM round trip, tool wait blocking first output, cache-prefix drift, unmeasured cache miss, verbose output drift, long JSON key or enum overhead, RAG chunk bloat, router escalation loop, prediction-token mismatch, priority-tier misuse, unsafe speculative work, missing cancellation, or raw prompt telemetry leak | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | LLM response-latency surface reviewed, latency unit and request timeline, round trips, parallel/tool/stream/cancel behavior, output/schema/cache/history/RAG/routing/fallback/prediction/realtime/priority choices, observability, verification, and remaining response-latency risk |
379
379
  | Autonomous or semi-autonomous LLM agents, agentic workflows, planners, executors, verifiers, tool contracts, tool-call gates, human approval or interrupt flows, durable agent state, handoffs, guardrails, loop budgets, retry policies, trace evaluation, or agent outcome metrics are created, changed, reviewed, or reported | `.mustflow/skills/agent-execution-control-review/SKILL.md` | Autonomy ledger, stage gate ledger, role separation ledger, tool contract ledger, effect ledger, state and resume ledger, memory and context ledger, handoff and guardrail ledger, loop, retry, and budget ledger, trace and eval outcome ledger, changed files, and command contract entries | Workflow-versus-agent routing, stage gates, planner/executor/verifier boundaries, tool contracts, tool argument ownership, draft/execute separation, idempotency keys, approval records, durable checkpoints, state schema versions, memory partitions, handoff filters, guardrails, loop budgets, retry classification, trace spans, eval fixtures, tests, docs, route metadata, and directly synchronized templates | unnecessary autonomous agent, one model self-certifying success, ungated bad plan, ambiguous tool contract, guessed tool argument, relative-path trap, external effect before approval, missing idempotency key, interrupt replay side effect, stale state schema, over-shared handoff, misplaced guardrail, repeated tool loop, blind retry, final-answer-only eval, or unsafe trace data | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | Agent execution-control surface reviewed, workflow-versus-agent decision, autonomy envelope, stage gates, role separation, tool contracts, approval and side-effect replay safety, state/resume/memory/handoff/guardrail/loop/retry/trace/eval checks, verification, and remaining agent execution-control risk |
380
380
  | Agent evaluation loops, trace or trajectory grading, LLM judges, verifier agents, outcome scoring, tool-call prechecks or postchecks, eval datasets, golden or dirty sets, pass@k or pass^k metrics, shadow environments, production-monitoring-to-eval pipelines, or agent regression gates are created, changed, reviewed, or reported | `.mustflow/skills/agent-eval-integrity-review/SKILL.md` | Outcome ledger, trace ledger, oracle ledger, tool-boundary ledger, dataset ledger, metric ledger, environment ledger, monitoring ledger, privacy ledger, changed files, and command contract entries | Outcome oracles, trace schemas, trajectory graders, deterministic checkers, model-judge rubrics, human-review sampling, tool prechecks and postchecks, tool-result evidence packets, eval fixtures, golden and dirty sets, shadow-environment adapters, monitoring-to-eval candidate flows, tests, docs, route metadata, and directly synchronized templates | final-answer-only scoring, LLM judge as sole oracle, reasoning claim treated as evidence, self-reflection certifying success, missing final environment state, ungraded unsafe trajectory, missing tool precheck or postcheck, brittle exact tool-order assertion, uncalibrated judge drift, pass@k masking unreliable pass^k, dirty set gating flakiness, raw trace data leak, or production failure not entering evals | `changes_status`, `changes_diff_summary`, `lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, `mustflow_check` | Agent eval-integrity surface reviewed, outcome oracle, final-state and trajectory checks, deterministic/model/human oracle split, tool boundary evidence, golden/dirty/capability/regression metrics, shadow environment, monitoring-to-eval loop, trace privacy, verification, and remaining agent eval-integrity risk |
@@ -560,7 +560,9 @@ routes. Event routes stay inactive until their event occurs.
560
560
  | GitHub issue, pull request, review thread, or maintainer-facing comment content is drafted, opened, revised, or answered | `.mustflow/skills/github-contribution-quality-gate/SKILL.md` | Target repository, intended GitHub action, repository rules and templates, duplicate search, evidence, verification level, and desired result | Issue, pull request, review reply, or comment draft plus posting gate report | maintainer time waste, duplicate report, unsupported claim, public security leak, unverified AI content, or wrong support channel | `changes_status`, `changes_diff_summary`, `mustflow_check` | Gate decision, repository rules found, duplicate and context check, evidence, missing evidence, draft, and final self-check |
561
561
  | Repository, host, user, nested-project, command-contract, preference, or generated instruction sources conflict or make safe scope unclear | `.mustflow/skills/instruction-conflict-scope-check/SKILL.md` | Conflicting instruction sources, affected scope, direct user request, command contract entries, and nearest instruction files | Workflow docs, skills, templates, tests, reports, and selected repository scope | authority drift, unsafe scope expansion, wrong repository edit, or unauthorized command | `changes_status`, `changes_diff_summary`, `docs_validate_fast`, `test_release`, `mustflow_check` | Conflicts reviewed, chosen priority rule, narrowed or skipped actions, clarification changes, and remaining authority risk |
562
562
  | `.mustflow/context/PROJECT.md` needs cautious project context | `.mustflow/skills/project-context-authoring/SKILL.md` | Supported project facts | `.mustflow/context/PROJECT.md` | authority drift | `mustflow_check` | Updated cautious context |
563
+ | Existing `SKILL.md` files or skill packages are refreshed from stale, external, vendor, runtime, or version-sensitive guidance while preserving the original behavior contract | `.mustflow/skills/skill-refresh/SKILL.md` | Target skill, current behavior contract, runtime mode, source ledger, package ledger, synchronized template surfaces, and command contract entries | Skill body, helper files, route metadata, template copy, locale metadata, profile membership, package tests, and directly tied docs | trigger drift, stale vendor claim, runtime incompatibility, copied external prose, helper-script mismatch, user-edit overwrite, non-idempotent refresh, or template drift | `changes_status`, `changes_diff_summary`, `docs_validate_fast`, `test_release`, `mustflow_check` | Skill refreshed, runtime mode, source freshness, semantic change classification, synchronized surfaces, version impact, verification, and remaining route/source/provenance/runtime risk |
563
564
  | Skill procedures or routes are created or maintained | `.mustflow/skills/skill-authoring/SKILL.md` | Repeated task evidence | `.mustflow/skills/**` | overlap and command drift | `mustflow_check`, `docs_validate` | Skill route and procedure changes |
565
+ | Work instructions for coding agents, Codex tasks, work orders, issues, PR requests, automations, implementation briefs, reviews, proofs, cleanup tasks, or operational-readiness tasks are drafted, reviewed, or improved | `.mustflow/skills/task-instruction-authoring/SKILL.md` | Target agent surface, task family, goal, scope, constraints, durable rules, risk class, verification expectations, and required output | Instruction artifacts, work-order bodies, issue bodies, templates, docs, skills, checklists, and directly synchronized workflow surfaces | vague goal, delegated product decision, missing acceptance evidence, unsafe raw command, proof theater, review blade drift, overlong one-off policy, or operational-readiness gap | `changes_status`, `changes_diff_summary`, `docs_validate_fast`, `mustflow_check` | Instruction family, missing decisions, final instruction or rubric, durable guidance decision, verification expectations, and remaining ambiguity or operational risk |
564
566
 
565
567
  When introducing a new skill, link it here and define the specific trigger and route fields.
566
568
  Avoid including raw shell commands in skill documents; instead, reference the command intent
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: skill.llm-token-cost-control-review
3
3
  locale: en
4
4
  canonical: true
5
- revision: 1
5
+ revision: 2
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: llm-token-cost-control-review
@@ -19,6 +19,7 @@ metadata:
19
19
  - build
20
20
  - test_related
21
21
  - test
22
+ - prompt_cache_audit
22
23
  - docs_validate_fast
23
24
  - test_release
24
25
  - mustflow_check
@@ -102,7 +103,8 @@ Review LLM cost as a product and systems contract, not as prompt brevity. A cost
102
103
  15. Treat predicted outputs as a latency tool unless current provider docs and usage evidence show cost behavior for the exact model and endpoint. Use `llm-response-latency-review` when the main goal is faster completion rather than cost control. Watch rejected prediction tokens or equivalent fields when exposed.
103
104
  16. Reduce image and file input before the model. Crop screenshots, downsample where acceptable, extract DOM text or OCR first, and count the actual payload tokens when the provider supports it.
104
105
  17. Instrument cost per success. Track endpoint, model, prompt version, tool version, schema version, input tokens, cached tokens, output tokens, reasoning tokens, retry count, validation failure rate, cache hit rate, and successful-task denominator.
105
- 18. Verify with the narrowest configured tests, fixtures, docs validation, release checks, and mustflow validation that cover request assembly, cache keys, budget guards, routing, retry repair, telemetry, and installed skill surfaces.
106
+ 18. When prompt-cache layout changes, run the configured prompt-cache audit intent if available and treat byte or token estimates as static layout evidence rather than provider billing proof.
107
+ 19. Verify with the narrowest configured tests, fixtures, docs validation, release checks, and mustflow validation that cover request assembly, cache keys, budget guards, routing, retry repair, telemetry, and installed skill surfaces.
106
108
 
107
109
  <!-- mustflow-section: postconditions -->
108
110
  ## Postconditions
@@ -124,6 +126,7 @@ Use configured oneshot command intents when available:
124
126
  - `build`
125
127
  - `test_related`
126
128
  - `test`
129
+ - `prompt_cache_audit`
127
130
  - `docs_validate_fast`
128
131
  - `test_release`
129
132
  - `mustflow_check`