ctxmedic 0.8.0 → 0.9.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 CHANGED
@@ -108,6 +108,9 @@ their severity or thresholds, or ignore paths, add `ctxmedic.config.json`:
108
108
  { "rules": { "INFO_UNSUPPORTED_SYNTAX": "off", "WARN_CONTEXT_BLOAT": ["on", { "tokens": 6000 }] } }
109
109
  ```
110
110
 
111
+ Add `"$schema": "./node_modules/ctxmedic/schema.json"` for autocomplete of rule
112
+ ids and options in your editor ([details](docs/rules/README.md#configuring-rules)).
113
+
111
114
  To silence a rule for one Markdown file: `<!-- ctxmedic-disable WARN_CONTEXT_BLOAT -- reason -->`.
112
115
 
113
116
  ## What ctxmedic reads and writes
package/dist/index.js CHANGED
@@ -1697,7 +1697,7 @@ var harnesses = [
1697
1697
  ];
1698
1698
 
1699
1699
  // ../clinical/src/engine.ts
1700
- var VERSION = true ? "0.8.0" : "0.0.0-dev";
1700
+ var VERSION = true ? "0.9.0" : "0.0.0-dev";
1701
1701
  var TRIAGE = { critical: "resuscitation", warning: "therapy", info: "preventive" };
1702
1702
  var ORDER = ["resuscitation", "therapy", "preventive"];
1703
1703
  var human = (k) => k.replace(/([A-Z])/g, " $1").replace(/^./, (c) => c.toUpperCase());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctxmedic",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "The context medic for your AI coding setup: checkup, treat, savings for Claude Code, Cursor, Windsurf, Codex CLI, OpenCode, Cline and Copilot.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-MIT",
@@ -41,6 +41,7 @@
41
41
  "files": [
42
42
  "dist",
43
43
  "public",
44
+ "schema.json",
44
45
  "LICENSE",
45
46
  "NOTICE",
46
47
  "README.md"
package/schema.json ADDED
@@ -0,0 +1,491 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "$schema": {
6
+ "type": "string"
7
+ },
8
+ "rules": {
9
+ "type": "object",
10
+ "properties": {
11
+ "ERR_BROKEN_LINK": {
12
+ "anyOf": [
13
+ {
14
+ "$ref": "#/definitions/RuleLevel"
15
+ },
16
+ {
17
+ "type": "array",
18
+ "items": [
19
+ {
20
+ "$ref": "#/definitions/RuleLevel"
21
+ }
22
+ ],
23
+ "additionalItems": false,
24
+ "minItems": 1,
25
+ "maxItems": 1
26
+ },
27
+ {
28
+ "type": "array",
29
+ "items": [
30
+ {
31
+ "$ref": "#/definitions/RuleLevel"
32
+ },
33
+ {
34
+ "type": "object",
35
+ "properties": {},
36
+ "additionalProperties": false
37
+ }
38
+ ],
39
+ "additionalItems": false,
40
+ "minItems": 2,
41
+ "maxItems": 2
42
+ }
43
+ ],
44
+ "description": "Symlinked configs must point to an existing target, without loops or absolute paths. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/ERR_BROKEN_LINK.md"
45
+ },
46
+ "WARN_CONTEXT_BLOAT": {
47
+ "anyOf": [
48
+ {
49
+ "$ref": "#/definitions/RuleLevel"
50
+ },
51
+ {
52
+ "type": "array",
53
+ "items": [
54
+ {
55
+ "$ref": "#/definitions/RuleLevel"
56
+ }
57
+ ],
58
+ "additionalItems": false,
59
+ "minItems": 1,
60
+ "maxItems": 1
61
+ },
62
+ {
63
+ "type": "array",
64
+ "items": [
65
+ {
66
+ "$ref": "#/definitions/RuleLevel"
67
+ },
68
+ {
69
+ "type": "object",
70
+ "properties": {
71
+ "tokens": {
72
+ "default": 3500,
73
+ "type": "integer",
74
+ "exclusiveMinimum": 0,
75
+ "maximum": 9007199254740991
76
+ }
77
+ }
78
+ }
79
+ ],
80
+ "additionalItems": false,
81
+ "minItems": 2,
82
+ "maxItems": 2
83
+ }
84
+ ],
85
+ "description": "Limit the tokens a harness loads at session start. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/WARN_CONTEXT_BLOAT.md"
86
+ },
87
+ "WARN_DUPLICATE_RULES": {
88
+ "anyOf": [
89
+ {
90
+ "$ref": "#/definitions/RuleLevel"
91
+ },
92
+ {
93
+ "type": "array",
94
+ "items": [
95
+ {
96
+ "$ref": "#/definitions/RuleLevel"
97
+ }
98
+ ],
99
+ "additionalItems": false,
100
+ "minItems": 1,
101
+ "maxItems": 1
102
+ },
103
+ {
104
+ "type": "array",
105
+ "items": [
106
+ {
107
+ "$ref": "#/definitions/RuleLevel"
108
+ },
109
+ {
110
+ "type": "object",
111
+ "properties": {
112
+ "similarity": {
113
+ "default": 0.75,
114
+ "type": "number",
115
+ "exclusiveMinimum": 0,
116
+ "exclusiveMaximum": 1
117
+ }
118
+ }
119
+ }
120
+ ],
121
+ "additionalItems": false,
122
+ "minItems": 2,
123
+ "maxItems": 2
124
+ }
125
+ ],
126
+ "description": "Do not keep near-identical instruction files for different harnesses. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/WARN_DUPLICATE_RULES.md"
127
+ },
128
+ "ERR_INVALID_SKILL": {
129
+ "anyOf": [
130
+ {
131
+ "$ref": "#/definitions/RuleLevel"
132
+ },
133
+ {
134
+ "type": "array",
135
+ "items": [
136
+ {
137
+ "$ref": "#/definitions/RuleLevel"
138
+ }
139
+ ],
140
+ "additionalItems": false,
141
+ "minItems": 1,
142
+ "maxItems": 1
143
+ },
144
+ {
145
+ "type": "array",
146
+ "items": [
147
+ {
148
+ "$ref": "#/definitions/RuleLevel"
149
+ },
150
+ {
151
+ "type": "object",
152
+ "properties": {},
153
+ "additionalProperties": false
154
+ }
155
+ ],
156
+ "additionalItems": false,
157
+ "minItems": 2,
158
+ "maxItems": 2
159
+ }
160
+ ],
161
+ "description": "Skills need valid frontmatter, a unique name and a description with a trigger. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/ERR_INVALID_SKILL.md"
162
+ },
163
+ "CRIT_SECRET_LEAK": {
164
+ "anyOf": [
165
+ {
166
+ "$ref": "#/definitions/RuleLevel"
167
+ },
168
+ {
169
+ "type": "array",
170
+ "items": [
171
+ {
172
+ "$ref": "#/definitions/RuleLevel"
173
+ }
174
+ ],
175
+ "additionalItems": false,
176
+ "minItems": 1,
177
+ "maxItems": 1
178
+ },
179
+ {
180
+ "type": "array",
181
+ "items": [
182
+ {
183
+ "$ref": "#/definitions/RuleLevel"
184
+ },
185
+ {
186
+ "type": "object",
187
+ "properties": {},
188
+ "additionalProperties": false
189
+ }
190
+ ],
191
+ "additionalItems": false,
192
+ "minItems": 2,
193
+ "maxItems": 2
194
+ }
195
+ ],
196
+ "description": "Do not store secrets in plain text in AI configs. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/CRIT_SECRET_LEAK.md"
197
+ },
198
+ "INFO_UNSUPPORTED_SYNTAX": {
199
+ "anyOf": [
200
+ {
201
+ "$ref": "#/definitions/RuleLevel"
202
+ },
203
+ {
204
+ "type": "array",
205
+ "items": [
206
+ {
207
+ "$ref": "#/definitions/RuleLevel"
208
+ }
209
+ ],
210
+ "additionalItems": false,
211
+ "minItems": 1,
212
+ "maxItems": 1
213
+ },
214
+ {
215
+ "type": "array",
216
+ "items": [
217
+ {
218
+ "$ref": "#/definitions/RuleLevel"
219
+ },
220
+ {
221
+ "type": "object",
222
+ "properties": {},
223
+ "additionalProperties": false
224
+ }
225
+ ],
226
+ "additionalItems": false,
227
+ "minItems": 2,
228
+ "maxItems": 2
229
+ }
230
+ ],
231
+ "description": "Flag directives a harness does not understand. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/INFO_UNSUPPORTED_SYNTAX.md"
232
+ },
233
+ "FIN_BLOAT_IGNORE": {
234
+ "anyOf": [
235
+ {
236
+ "$ref": "#/definitions/RuleLevel"
237
+ },
238
+ {
239
+ "type": "array",
240
+ "items": [
241
+ {
242
+ "$ref": "#/definitions/RuleLevel"
243
+ }
244
+ ],
245
+ "additionalItems": false,
246
+ "minItems": 1,
247
+ "maxItems": 1
248
+ },
249
+ {
250
+ "type": "array",
251
+ "items": [
252
+ {
253
+ "$ref": "#/definitions/RuleLevel"
254
+ },
255
+ {
256
+ "type": "object",
257
+ "properties": {},
258
+ "additionalProperties": false
259
+ }
260
+ ],
261
+ "additionalItems": false,
262
+ "minItems": 2,
263
+ "maxItems": 2
264
+ }
265
+ ],
266
+ "description": "Keep build output and lockfiles out of the AI index with an ignore file. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/FIN_BLOAT_IGNORE.md"
267
+ },
268
+ "FIN_UNUSED_MCP": {
269
+ "anyOf": [
270
+ {
271
+ "$ref": "#/definitions/RuleLevel"
272
+ },
273
+ {
274
+ "type": "array",
275
+ "items": [
276
+ {
277
+ "$ref": "#/definitions/RuleLevel"
278
+ }
279
+ ],
280
+ "additionalItems": false,
281
+ "minItems": 1,
282
+ "maxItems": 1
283
+ },
284
+ {
285
+ "type": "array",
286
+ "items": [
287
+ {
288
+ "$ref": "#/definitions/RuleLevel"
289
+ },
290
+ {
291
+ "type": "object",
292
+ "properties": {
293
+ "schemaTokens": {
294
+ "default": 1500,
295
+ "type": "integer",
296
+ "exclusiveMinimum": 0,
297
+ "maximum": 9007199254740991
298
+ }
299
+ }
300
+ }
301
+ ],
302
+ "additionalItems": false,
303
+ "minItems": 2,
304
+ "maxItems": 2
305
+ }
306
+ ],
307
+ "description": "Remove MCP servers that are never called. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/FIN_UNUSED_MCP.md"
308
+ },
309
+ "FIN_MODEL_OVERKILL": {
310
+ "anyOf": [
311
+ {
312
+ "$ref": "#/definitions/RuleLevel"
313
+ },
314
+ {
315
+ "type": "array",
316
+ "items": [
317
+ {
318
+ "$ref": "#/definitions/RuleLevel"
319
+ }
320
+ ],
321
+ "additionalItems": false,
322
+ "minItems": 1,
323
+ "maxItems": 1
324
+ },
325
+ {
326
+ "type": "array",
327
+ "items": [
328
+ {
329
+ "$ref": "#/definitions/RuleLevel"
330
+ },
331
+ {
332
+ "type": "object",
333
+ "properties": {
334
+ "maxSteps": {
335
+ "default": 2,
336
+ "type": "integer",
337
+ "exclusiveMinimum": 0,
338
+ "maximum": 9007199254740991
339
+ },
340
+ "minSessions": {
341
+ "default": 3,
342
+ "type": "integer",
343
+ "exclusiveMinimum": 0,
344
+ "maximum": 9007199254740991
345
+ }
346
+ }
347
+ }
348
+ ],
349
+ "additionalItems": false,
350
+ "minItems": 2,
351
+ "maxItems": 2
352
+ }
353
+ ],
354
+ "description": "Route one-shot tasks to a cheaper model. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/FIN_MODEL_OVERKILL.md"
355
+ },
356
+ "FIN_CONTEXT_SNOWBALL": {
357
+ "anyOf": [
358
+ {
359
+ "$ref": "#/definitions/RuleLevel"
360
+ },
361
+ {
362
+ "type": "array",
363
+ "items": [
364
+ {
365
+ "$ref": "#/definitions/RuleLevel"
366
+ }
367
+ ],
368
+ "additionalItems": false,
369
+ "minItems": 1,
370
+ "maxItems": 1
371
+ },
372
+ {
373
+ "type": "array",
374
+ "items": [
375
+ {
376
+ "$ref": "#/definitions/RuleLevel"
377
+ },
378
+ {
379
+ "type": "object",
380
+ "properties": {
381
+ "steps": {
382
+ "default": 35,
383
+ "type": "integer",
384
+ "exclusiveMinimum": 0,
385
+ "maximum": 9007199254740991
386
+ },
387
+ "heavySteps": {
388
+ "default": 10,
389
+ "type": "integer",
390
+ "exclusiveMinimum": 0,
391
+ "maximum": 9007199254740991
392
+ }
393
+ }
394
+ }
395
+ ],
396
+ "additionalItems": false,
397
+ "minItems": 2,
398
+ "maxItems": 2
399
+ }
400
+ ],
401
+ "description": "Compact or clear long sessions. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/FIN_CONTEXT_SNOWBALL.md"
402
+ },
403
+ "FIN_CACHE_MISS": {
404
+ "anyOf": [
405
+ {
406
+ "$ref": "#/definitions/RuleLevel"
407
+ },
408
+ {
409
+ "type": "array",
410
+ "items": [
411
+ {
412
+ "$ref": "#/definitions/RuleLevel"
413
+ }
414
+ ],
415
+ "additionalItems": false,
416
+ "minItems": 1,
417
+ "maxItems": 1
418
+ },
419
+ {
420
+ "type": "array",
421
+ "items": [
422
+ {
423
+ "$ref": "#/definitions/RuleLevel"
424
+ },
425
+ {
426
+ "type": "object",
427
+ "properties": {
428
+ "minHitRatio": {
429
+ "default": 0.4,
430
+ "type": "number",
431
+ "minimum": 0,
432
+ "maximum": 1
433
+ },
434
+ "targetHitRatio": {
435
+ "default": 0.7,
436
+ "type": "number",
437
+ "minimum": 0,
438
+ "maximum": 1
439
+ },
440
+ "minTokens": {
441
+ "default": 1000000,
442
+ "type": "integer",
443
+ "exclusiveMinimum": 0,
444
+ "maximum": 9007199254740991
445
+ }
446
+ }
447
+ }
448
+ ],
449
+ "additionalItems": false,
450
+ "minItems": 2,
451
+ "maxItems": 2
452
+ }
453
+ ],
454
+ "description": "Keep the prompt cache warm. https://github.com/ponomarenko/ctxmedic/blob/main/docs/rules/FIN_CACHE_MISS.md"
455
+ }
456
+ },
457
+ "additionalProperties": false,
458
+ "description": "Rule levels and options: \"off\", \"on\", a severity, or [level, options]."
459
+ },
460
+ "ignores": {
461
+ "type": "array",
462
+ "items": {
463
+ "type": "string"
464
+ },
465
+ "description": "Globs over finding paths (project-relative, or ~/ for global files)."
466
+ }
467
+ },
468
+ "definitions": {
469
+ "RuleLevel": {
470
+ "anyOf": [
471
+ {
472
+ "type": "string",
473
+ "const": "off"
474
+ },
475
+ {
476
+ "type": "string",
477
+ "const": "on"
478
+ },
479
+ {
480
+ "type": "string",
481
+ "enum": [
482
+ "critical",
483
+ "warning",
484
+ "info"
485
+ ]
486
+ }
487
+ ],
488
+ "description": "\"off\", \"on\" (the rule picks the severity) or a severity to force"
489
+ }
490
+ }
491
+ }