ctxmedic 0.8.0 → 0.10.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 +4 -0
- package/dist/index.js +51 -1
- package/package.json +2 -1
- package/schema.json +491 -0
package/README.md
CHANGED
|
@@ -53,6 +53,7 @@ npx ctxmedic checkup
|
|
|
53
53
|
| `ctxmedic savings` | FinOps only: spend, run rate, cache hit ratio, savings. |
|
|
54
54
|
| `ctxmedic consult [--ai]` | Interactive appointment: your priorities, budget and main tool shape the treatment plan. `--ai` asks local Ollama or your own Anthropic/OpenAI key for a second opinion. |
|
|
55
55
|
| `ctxmedic history` | Health Score over time. |
|
|
56
|
+
| `ctxmedic rules [path]` | Every rule with its effective level and the options `ctxmedic.config.json` changed. `--json`. |
|
|
56
57
|
| `ctxmedic ui` | Local Web UI on `127.0.0.1`: dashboard, diagnoses, FinOps, config graph. |
|
|
57
58
|
|
|
58
59
|
Common options: `--days 30`, `--no-finops`, `--no-global`.
|
|
@@ -108,6 +109,9 @@ their severity or thresholds, or ignore paths, add `ctxmedic.config.json`:
|
|
|
108
109
|
{ "rules": { "INFO_UNSUPPORTED_SYNTAX": "off", "WARN_CONTEXT_BLOAT": ["on", { "tokens": 6000 }] } }
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
Add `"$schema": "./node_modules/ctxmedic/schema.json"` for autocomplete of rule
|
|
113
|
+
ids and options in your editor ([details](docs/rules/README.md#configuring-rules)).
|
|
114
|
+
|
|
111
115
|
To silence a rule for one Markdown file: `<!-- ctxmedic-disable WARN_CONTEXT_BLOAT -- reason -->`.
|
|
112
116
|
|
|
113
117
|
## What ctxmedic reads and writes
|
package/dist/index.js
CHANGED
|
@@ -919,6 +919,33 @@ var ConfigError = class extends Error {
|
|
|
919
919
|
};
|
|
920
920
|
var levelOf = (e) => e === void 0 ? "on" : typeof e === "string" ? e : e[0];
|
|
921
921
|
var optionsOf = (e) => Array.isArray(e) && e[1] || {};
|
|
922
|
+
var RuleInfo = z5.object({
|
|
923
|
+
id: RuleId,
|
|
924
|
+
/** "config": reads config files; "session-logs": a FIN_* detector that reads session logs. */
|
|
925
|
+
source: z5.enum(["config", "session-logs"]),
|
|
926
|
+
level: RuleLevel,
|
|
927
|
+
type: z5.enum(["problem", "suggestion"]),
|
|
928
|
+
fixable: z5.boolean(),
|
|
929
|
+
description: z5.string(),
|
|
930
|
+
docs: z5.string(),
|
|
931
|
+
/** Effective options, defaults included. */
|
|
932
|
+
options: z5.record(z5.string(), z5.unknown()),
|
|
933
|
+
/** Options the config set to a value other than the default. */
|
|
934
|
+
changed: z5.record(z5.string(), z5.unknown())
|
|
935
|
+
});
|
|
936
|
+
function describeRules(config) {
|
|
937
|
+
const all = [
|
|
938
|
+
...rules.map((r) => [r.id, r.meta, "config"]),
|
|
939
|
+
...Object.entries(finopsMeta).map(([id, meta2]) => [id, meta2, "session-logs"])
|
|
940
|
+
];
|
|
941
|
+
return all.map(([id, meta2, source]) => {
|
|
942
|
+
const entry = config.rules[id];
|
|
943
|
+
const options = meta2.options?.parse(optionsOf(entry)) ?? {};
|
|
944
|
+
const defaults = meta2.options?.parse({}) ?? {};
|
|
945
|
+
const changed = Object.fromEntries(Object.entries(options).filter(([k, v]) => JSON.stringify(v) !== JSON.stringify(defaults[k])));
|
|
946
|
+
return RuleInfo.parse({ id, source, level: levelOf(entry), type: meta2.type, fixable: meta2.fixable, description: meta2.description, docs: meta2.docs, options, changed });
|
|
947
|
+
});
|
|
948
|
+
}
|
|
922
949
|
function loadConfig(root) {
|
|
923
950
|
const file2 = path9.join(root, CONFIG_FILE);
|
|
924
951
|
if (!fs6.existsSync(file2)) return CtxmedicConfig.parse({});
|
|
@@ -1522,6 +1549,8 @@ var en = {
|
|
|
1522
1549
|
},
|
|
1523
1550
|
cli: {
|
|
1524
1551
|
noBackups: "No backups in .ctxmedic/backups: nothing to restore.",
|
|
1552
|
+
rulesColumns: { rule: "Rule", level: "Level", type: "Type", fix: "Fix", changed: "Changed options" },
|
|
1553
|
+
rulesHint: (configFile) => `Levels and options come from ${configFile}. Docs: docs/rules/<RULE>.md`,
|
|
1525
1554
|
restoreHint: "Undo a fix: ctxmedic restore <backup> (or latest)",
|
|
1526
1555
|
restored: (id) => `Restored backup ${id}`,
|
|
1527
1556
|
noAutoFix: "No auto-fix: follow the prescription by hand.",
|
|
@@ -1697,7 +1726,7 @@ var harnesses = [
|
|
|
1697
1726
|
];
|
|
1698
1727
|
|
|
1699
1728
|
// ../clinical/src/engine.ts
|
|
1700
|
-
var VERSION = true ? "0.
|
|
1729
|
+
var VERSION = true ? "0.10.0" : "0.0.0-dev";
|
|
1701
1730
|
var TRIAGE = { critical: "resuscitation", warning: "therapy", info: "preventive" };
|
|
1702
1731
|
var ORDER = ["resuscitation", "therapy", "preventive"];
|
|
1703
1732
|
var human = (k) => k.replace(/([A-Z])/g, " $1").replace(/^./, (c) => c.toUpperCase());
|
|
@@ -2172,6 +2201,18 @@ function history(visits) {
|
|
|
2172
2201
|
if (!visits.length) return pc.dim("No visits yet. Run `ctxmedic checkup`.");
|
|
2173
2202
|
return visits.slice(-20).map((v) => `${v.at.slice(0, 16).replace("T", " ")} ${bar(v.healthScore)} ${String(v.healthScore).padStart(3)} \u{1F534}${v.counts.resuscitation} \u{1F7E1}${v.counts.therapy} \u{1F7E2}${v.counts.preventive} ${pc.dim(v.root)}${scanFlags(v)}`).join("\n");
|
|
2174
2203
|
}
|
|
2204
|
+
function rules2(list, lang, configFile) {
|
|
2205
|
+
const m = messages(lang).cli;
|
|
2206
|
+
const c = m.rulesColumns;
|
|
2207
|
+
const w = Math.max(c.rule.length, ...list.map((r) => r.id.length)) + 2;
|
|
2208
|
+
const row = (a2, b, d2, e, f) => `${a2.padEnd(w)}${b.padEnd(10)}${d2.padEnd(12)}${e.padEnd(5)}${f}`.trimEnd();
|
|
2209
|
+
const lines2 = list.map((r) => {
|
|
2210
|
+
const changed = Object.entries(r.changed).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(" ");
|
|
2211
|
+
const line = row(r.id, r.level, r.type, r.fixable ? "\u2714" : "", changed);
|
|
2212
|
+
return r.level === "off" ? pc.dim(line) : line;
|
|
2213
|
+
});
|
|
2214
|
+
return [pc.bold(row(c.rule, c.level, c.type, c.fix, c.changed)), ...lines2, "", pc.dim(m.rulesHint(configFile))].join("\n");
|
|
2215
|
+
}
|
|
2175
2216
|
|
|
2176
2217
|
// src/index.ts
|
|
2177
2218
|
var common = (cmd) => cmd.option("--lang <lang>", "interface language (only en for now)").option("--days <n>", "how many days of session logs to analyze", "30").option("--no-finops", "skip session-log (cost) analysis").option("--no-global", "skip global configs in the home directory");
|
|
@@ -2227,6 +2268,15 @@ ${m.restoreHint}`));
|
|
|
2227
2268
|
for (const line of r.restored) console.log(pc2.dim(` ${line}`));
|
|
2228
2269
|
console.log(`${r.dryRun ? pc2.yellow("dry-run") : pc2.green("\u2714")} ${m.restored(r.id)}: ${r.title}`);
|
|
2229
2270
|
});
|
|
2271
|
+
program.command("rules [path]").description("list rules with their effective level and options from ctxmedic.config.json").option("--lang <lang>", "interface language (only en for now)").option("--json", "print the rules as JSON").action((dir, o2) => {
|
|
2272
|
+
let list;
|
|
2273
|
+
try {
|
|
2274
|
+
list = describeRules(loadConfig(path16.resolve(dir ?? ".")));
|
|
2275
|
+
} catch (e) {
|
|
2276
|
+
fail(e);
|
|
2277
|
+
}
|
|
2278
|
+
console.log(o2.json ? JSON.stringify(list, null, 2) : rules2(list, resolveLang(o2.lang), CONFIG_FILE));
|
|
2279
|
+
});
|
|
2230
2280
|
common(program.command("savings [path]").description("FinOps: token spend, cache hit ratio and savings prescriptions")).option("--json", "print the FinOps report as JSON").action(async (dir, o2) => {
|
|
2231
2281
|
const c = ctx(dir, o2);
|
|
2232
2282
|
const ex = await examine(c.root, harnesses, { global: c.global }).catch(fail);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctxmedic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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
|
+
}
|