noonsight 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.claude-plugin/plugin.json +14 -0
  3. package/README.md +271 -9
  4. package/dist/src/adapters/claude-code/classifier.js +138 -0
  5. package/dist/src/adapters/claude-code/code-edit.js +108 -0
  6. package/dist/src/adapters/claude-code/compat.js +31 -0
  7. package/dist/src/adapters/claude-code/definitions.js +347 -0
  8. package/dist/src/adapters/claude-code/fork.js +132 -0
  9. package/dist/src/adapters/claude-code/hook.js +652 -0
  10. package/dist/src/adapters/claude-code/install.js +186 -0
  11. package/dist/src/adapters/claude-code/launch.js +270 -0
  12. package/dist/src/adapters/claude-code/launcher.js +252 -0
  13. package/dist/src/adapters/claude-code/locations.js +115 -0
  14. package/dist/src/adapters/claude-code/managed.js +75 -0
  15. package/dist/src/adapters/claude-code/plugin-files.js +88 -0
  16. package/dist/src/adapters/claude-code/plugins.js +117 -0
  17. package/dist/src/adapters/claude-code/pointer.js +48 -0
  18. package/dist/src/adapters/claude-code/predict.js +271 -0
  19. package/dist/src/adapters/claude-code/routing.js +88 -0
  20. package/dist/src/adapters/claude-code/settings.js +189 -0
  21. package/dist/src/adapters/claude-code/subagents.js +666 -0
  22. package/dist/src/adapters/claude-code/triggers.js +88 -0
  23. package/dist/src/cli.js +157 -0
  24. package/dist/src/commands/accept.js +115 -0
  25. package/dist/src/commands/check.js +529 -0
  26. package/dist/src/commands/hook.js +73 -0
  27. package/dist/src/commands/init.js +29 -0
  28. package/dist/src/commands/install.js +370 -0
  29. package/dist/src/commands/models.js +213 -0
  30. package/dist/src/commands/receives.js +84 -0
  31. package/dist/src/commands/report.js +386 -0
  32. package/dist/src/commands/resolve.js +32 -0
  33. package/dist/src/commands/run.js +168 -0
  34. package/dist/src/commands/trust.js +70 -0
  35. package/dist/src/commands/usage.js +10 -0
  36. package/dist/src/commands/watch.js +154 -0
  37. package/dist/src/config/create.js +51 -0
  38. package/dist/src/config/json-schema.js +207 -0
  39. package/dist/src/config/load.js +758 -0
  40. package/dist/src/config/paths.js +42 -0
  41. package/dist/src/config/preset-changes.js +190 -0
  42. package/dist/src/config/project.js +354 -0
  43. package/dist/src/config/rewrite.js +112 -0
  44. package/dist/src/core/backtracking.js +330 -0
  45. package/dist/src/core/classify.js +66 -0
  46. package/dist/src/core/normalize.js +24 -0
  47. package/dist/src/core/overlap.js +39 -0
  48. package/dist/src/core/regex-sample.js +278 -0
  49. package/dist/src/core/resolve.js +201 -0
  50. package/dist/src/core/route.js +93 -0
  51. package/dist/src/core/scope.js +77 -0
  52. package/dist/src/core/triggers.js +30 -0
  53. package/dist/src/core/types.js +74 -0
  54. package/dist/src/state/agents.js +200 -0
  55. package/dist/src/state/claims.js +80 -0
  56. package/dist/src/state/files.js +84 -0
  57. package/dist/src/state/installs.js +29 -0
  58. package/dist/src/state/log.js +90 -0
  59. package/dist/src/state/node.js +35 -0
  60. package/dist/src/state/sessions.js +109 -0
  61. package/dist/src/state/triggers.js +57 -0
  62. package/dist/src/version.js +24 -0
  63. package/dist/src/watch/service.js +172 -0
  64. package/dist/src/watch/watcher.js +130 -0
  65. package/dist/src/wording.js +11 -0
  66. package/hooks/hooks.json +118 -0
  67. package/package.json +57 -7
  68. package/presets/claude/SOURCES.md +485 -0
  69. package/presets/claude/preset.json +432 -0
  70. package/presets/claude/rules/fable-5-2/code-ownership.md +1 -0
  71. package/presets/claude/rules/fable-5-2/finish-work.md +1 -0
  72. package/presets/claude/rules/fable-5-2/low-context-report.md +1 -0
  73. package/presets/claude/rules/fable-5-2/progress-updates.md +1 -0
  74. package/presets/claude/rules/haiku-5-5/carry-through.md +1 -0
  75. package/presets/claude/rules/haiku-5-5/search-recent-facts.md +1 -0
  76. package/presets/claude/rules/haiku-5-5/verify-changes.md +1 -0
  77. package/presets/claude/rules/opus-5-5/explore-before-acting.md +1 -0
  78. package/presets/claude/rules/opus-5-5/progress-updates.md +1 -0
  79. package/presets/claude/rules/opus-5-5/unattended-run.md +1 -0
  80. package/presets/claude/rules/sonnet-5-5/carry-through.md +1 -0
  81. package/presets/claude/rules/sonnet-5-5/check-current-facts.md +1 -0
  82. package/presets/claude/rules/sonnet-5-5/ideas-first.md +1 -0
  83. package/presets/claude/rules/sonnet-5-5/no-self-review-rounds.md +1 -0
  84. package/presets/claude/rules/sonnet-5-5/stay-in-scope.md +1 -0
  85. package/presets/claude/rules/sonnet-5-5/verify-changes.md +1 -0
  86. package/presets/claude/versions/1.3.0/preset.json +432 -0
  87. package/presets/claude/versions/1.3.0/rules/fable-5-2/code-ownership.md +1 -0
  88. package/presets/claude/versions/1.3.0/rules/fable-5-2/finish-work.md +1 -0
  89. package/presets/claude/versions/1.3.0/rules/fable-5-2/low-context-report.md +1 -0
  90. package/presets/claude/versions/1.3.0/rules/fable-5-2/progress-updates.md +1 -0
  91. package/presets/claude/versions/1.3.0/rules/haiku-5-5/carry-through.md +1 -0
  92. package/presets/claude/versions/1.3.0/rules/haiku-5-5/search-recent-facts.md +1 -0
  93. package/presets/claude/versions/1.3.0/rules/haiku-5-5/verify-changes.md +1 -0
  94. package/presets/claude/versions/1.3.0/rules/opus-5-5/explore-before-acting.md +1 -0
  95. package/presets/claude/versions/1.3.0/rules/opus-5-5/progress-updates.md +1 -0
  96. package/presets/claude/versions/1.3.0/rules/opus-5-5/unattended-run.md +1 -0
  97. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/carry-through.md +1 -0
  98. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/check-current-facts.md +1 -0
  99. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/ideas-first.md +1 -0
  100. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/no-self-review-rounds.md +1 -0
  101. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/stay-in-scope.md +1 -0
  102. package/presets/claude/versions/1.3.0/rules/sonnet-5-5/verify-changes.md +1 -0
  103. package/schema/noonsight-project.schema.json +394 -0
  104. package/schema/noonsight.schema.json +425 -0
  105. package/schema/preset.schema.json +194 -0
  106. package/scripts/noonsight +68 -0
  107. package/skills/accept/SKILL.md +11 -0
  108. package/skills/check/SKILL.md +11 -0
  109. package/skills/models/SKILL.md +11 -0
  110. package/skills/report/SKILL.md +11 -0
  111. package/skills/resolve/SKILL.md +12 -0
  112. package/skills/setup/SKILL.md +15 -0
  113. package/skills/trust/SKILL.md +12 -0
  114. package/skills/untrust/SKILL.md +12 -0
@@ -0,0 +1,425 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/noonsight@0/schema/noonsight.schema.json",
4
+ "title": "noonsight configuration",
5
+ "description": "The noonsight configuration. One file serves the whole machine: every Claude Code account and configuration directory reads the same file. noonsight looks for it at $NOONSIGHT_CONFIG, then ~/.config/noonsight/noonsight.json. A project can lay its own file, .noonsight/noonsight.json, over it for the sessions that run in that project, as \"projects\" permits.",
6
+ "type": "object",
7
+ "required": ["version"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "version": {
12
+ "description": "Format version of this file.",
13
+ "const": 1
14
+ },
15
+ "preset": {
16
+ "description": "The preset shipped with the package that \"use\": \"preset\" entries draw their rules from. The preset follows the installed package version.",
17
+ "type": "string",
18
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
19
+ "default": "claude"
20
+ },
21
+ "preset_version": {
22
+ "description": "The version of the preset this configuration was last checked against. noonsight check and the session-start warning report what the installed preset changed since this version; noonsight accept records the installed one. noonsight init writes it.",
23
+ "type": "string",
24
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
25
+ "x-hint": "a preset version is three numbers, such as 1.3.0"
26
+ },
27
+ "on_preset_change": {
28
+ "description": "What an installed preset that is not \"preset_version\" does. warn: sessions receive the installed preset's rules, and noonsight check and each session's start report what changed. hold: sessions keep receiving the rules of \"preset_version\", from the copy the package keeps, until noonsight accept records the installed version.",
29
+ "enum": ["warn", "hold"],
30
+ "default": "warn"
31
+ },
32
+ "models": {
33
+ "description": "The models declared active, keyed by full model identifier (for example claude-fable-5-2). A model missing from this map is undeclared.",
34
+ "type": "object",
35
+ "propertyNames": {
36
+ "pattern": "^(?:(?=.*[0-9])[a-z0-9]+(?:[-.][a-z0-9]+)*|[a-z0-9.*?-]*[*?][a-z0-9.*?-]*)$",
37
+ "x-hint": "a model key is a full lowercase model identifier with its version, such as claude-fable-5-2, or a wildcard pattern such as claude-opus-4-*"
38
+ },
39
+ "patternProperties": {
40
+ "^(?=.*[0-9])[a-z0-9]+(?:[-.][a-z0-9]+)*$": { "$ref": "#/$defs/modelEntry" },
41
+ "^[a-z0-9.*?-]*[*?][a-z0-9.*?-]*$": { "$ref": "#/$defs/wildcardEntry" }
42
+ },
43
+ "additionalProperties": false,
44
+ "default": {}
45
+ },
46
+ "all_models": {
47
+ "description": "Rules for every model, in one place: team conventions, commit style, anything that is not specific to a model. They go to every model declared under \"models\" with \"use\": \"preset\" or \"use\": \"custom\", after the preset's rules and before the model's own \"add\". A model declared with \"use\": \"none\", and a wildcard key, receive none of them. A rule id must be new for every such model.",
48
+ "type": "object",
49
+ "required": ["add"],
50
+ "additionalProperties": false,
51
+ "properties": {
52
+ "add": {
53
+ "description": "The user's own rule files, with the same keys as \"models.<id>.add\".",
54
+ "type": "array",
55
+ "minItems": 1,
56
+ "items": { "$ref": "#/$defs/userRule" }
57
+ }
58
+ }
59
+ },
60
+ "on_undeclared": {
61
+ "description": "What to do when a model has no entry in \"models\". There is deliberately no option to block.",
62
+ "enum": ["warn", "ignore"],
63
+ "default": "warn"
64
+ },
65
+ "scopes": {
66
+ "description": "Task scopes the user declares, added to the preset's scopes. A scope with the same name as a preset scope replaces only the keys given here. A session takes its scope from NOONSIGHT_SCOPE; a subagent from the scope whose matcher matches earliest in its task.",
67
+ "type": "object",
68
+ "propertyNames": {
69
+ "pattern": "^[a-z][a-z0-9-]*$",
70
+ "x-hint": "a scope name is lowercase letters, digits and hyphens, starting with a letter"
71
+ },
72
+ "additionalProperties": { "$ref": "#/$defs/scope" },
73
+ "default": {}
74
+ },
75
+ "session": {
76
+ "description": "How a session, as opposed to a subagent, is told apart.",
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "unattended_when_env": {
81
+ "description": "Environment variables that mark a session as unattended (the place \"unattended\") when any of them is set and not empty in the environment Claude Code runs in. With none set, a session is in the place \"attended\", unless it runs headless and \"headless_is_unattended\" is true.",
82
+ "type": "array",
83
+ "uniqueItems": true,
84
+ "items": {
85
+ "type": "string",
86
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
87
+ "x-hint": "an environment variable name is letters, digits and underscores, not starting with a digit"
88
+ },
89
+ "default": []
90
+ },
91
+ "headless_is_unattended": {
92
+ "description": "Whether a headless run, such as claude -p or the Agent SDK, is in the place \"unattended\": nobody can answer it mid-turn. Claude Code marks such a run in the environment of its hooks. false leaves it in the place \"attended\" unless a variable of \"unattended_when_env\" is set.",
93
+ "type": "boolean",
94
+ "default": true
95
+ }
96
+ },
97
+ "default": {}
98
+ },
99
+ "subagents": {
100
+ "description": "How the subagents a session opens get the rules for the model each one runs on.",
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "properties": {
104
+ "delivery": {
105
+ "description": "prompt: each subagent receives the rules for the model it runs on when it starts. off: subagents are left alone.",
106
+ "enum": ["prompt", "off"],
107
+ "default": "prompt"
108
+ },
109
+ "permission": {
110
+ "description": "The permission decision returned with a call whose model or effort routing changed. allow: the call runs without a permission prompt, though deny and ask rules still apply. ask: the person confirms each such call. passthrough: no decision, so the session's permission mode decides, and auto mode can deny a changed call.",
111
+ "enum": ["allow", "ask", "passthrough"],
112
+ "default": "allow"
113
+ },
114
+ "on_mismatch": {
115
+ "description": "What to do when a subagent starts on another model than the one noonsight chose its rules for. The decision log records it either way.",
116
+ "enum": ["warn", "ignore"],
117
+ "default": "warn"
118
+ }
119
+ },
120
+ "default": {}
121
+ },
122
+ "routing": {
123
+ "description": "Optional routing: choose the model and effort for a task from its scope. Off unless enabled. Whether or not a route applies, the scope and the rules are decided the same way, and the rules follow the model the task runs on.",
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "properties": {
127
+ "enabled": {
128
+ "description": "Turns routing on. With false, noonsight only delivers rules and never changes a model or an effort.",
129
+ "type": "boolean",
130
+ "default": false
131
+ },
132
+ "targets": {
133
+ "description": "Where routing acts. launcher: noonsight run adds --model and --effort to the claude command line. subagents: the agent call hook sets the call's model and effort.",
134
+ "type": "array",
135
+ "minItems": 1,
136
+ "uniqueItems": true,
137
+ "items": { "enum": ["launcher", "subagents"] },
138
+ "default": ["launcher", "subagents"]
139
+ },
140
+ "respect_explicit": {
141
+ "description": "With true, a model the caller already chose wins over the table: a --model on the claude command line, the model parameter of an agent call, or the model a subagent definition or a built-in subagent sets. An effort the caller set is kept too.",
142
+ "type": "boolean",
143
+ "default": true
144
+ },
145
+ "yield_when_env": {
146
+ "description": "Environment variables that mark a session someone else routes, such as an orchestrator's. When any of them is set and not empty, routing yields; the rules are still delivered.",
147
+ "type": "array",
148
+ "uniqueItems": true,
149
+ "items": {
150
+ "type": "string",
151
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
152
+ "x-hint": "an environment variable name is letters, digits and underscores, not starting with a digit"
153
+ },
154
+ "default": []
155
+ },
156
+ "table": {
157
+ "description": "Scope name to a row of options in order of preference. Each row replaces the preset's row for the same scope. The first option whose model is declared under \"models\" wins.",
158
+ "type": "object",
159
+ "propertyNames": {
160
+ "pattern": "^[a-z][a-z0-9-]*$",
161
+ "x-hint": "a scope name is lowercase letters, digits and hyphens, starting with a letter"
162
+ },
163
+ "additionalProperties": { "type": ["array", "object"], "$ref": "#/$defs/routeRow" },
164
+ "default": {}
165
+ },
166
+ "default": {
167
+ "description": "The row for a task with no scope, or whose scope has no row for the target. inherit leaves the model and the effort as they are.",
168
+ "type": ["string", "array", "object"],
169
+ "$ref": "#/$defs/routeRow",
170
+ "if": { "type": "string" },
171
+ "then": { "const": "inherit", "x-hint": "the only text value is \"inherit\"" },
172
+ "default": "inherit"
173
+ }
174
+ },
175
+ "default": {}
176
+ },
177
+ "classifier": {
178
+ "description": "Optional: a small model, asked through `claude -p` with the login Claude Code already has, picks the scope of a task that no explicit scope placed. Off unless a mode is set. A classification that fails, takes longer than timeout_ms, or answers outside the declared scopes gives the task no scope, and the decision log records why.",
179
+ "type": "object",
180
+ "additionalProperties": false,
181
+ "properties": {
182
+ "mode": {
183
+ "description": "off: never classify. fallback: classify a task that no explicit scope and no matcher placed. always: classify every task without an explicit scope, over the matchers; meant for comparing the two.",
184
+ "enum": ["off", "fallback", "always"],
185
+ "default": "off"
186
+ },
187
+ "model": {
188
+ "description": "The model the classifier runs on, as claude --model takes it: an alias such as haiku, or a model identifier.",
189
+ "type": "string",
190
+ "minLength": 1,
191
+ "default": "haiku"
192
+ },
193
+ "effort": {
194
+ "description": "The effort level the classifier runs at.",
195
+ "enum": ["low", "medium", "high", "xhigh", "max"],
196
+ "default": "low"
197
+ },
198
+ "timeout_ms": {
199
+ "description": "How long, in milliseconds, a classification may take before the task gets no scope. At most 8000, so that the agent call hook, which Claude Code stops after 10 seconds, still answers in time.",
200
+ "type": "integer",
201
+ "minimum": 1000,
202
+ "maximum": 8000,
203
+ "default": 8000
204
+ }
205
+ },
206
+ "default": {}
207
+ },
208
+ "projects": {
209
+ "description": "How far a project's configuration, the file .noonsight/noonsight.json a repository commits, may change this configuration for the sessions that run in that project. A project applies only once this account trusts it with noonsight trust.",
210
+ "type": "object",
211
+ "additionalProperties": false,
212
+ "properties": {
213
+ "allow": {
214
+ "description": "none: project files are ignored. add: a project only adds rules, under all_models.add and models.<id>.add, for models this file declares with \"use\": \"preset\" or \"use\": \"custom\". rules: a project also changes which rules a model receives (use, enable, disable, replaces, wildcard keys, and a rule with the id of one of this file's rules, which replaces it), and sets scopes, session and on_undeclared. all: a project also sets routing, classifier and subagents.",
215
+ "enum": ["none", "add", "rules", "all"],
216
+ "default": "add"
217
+ }
218
+ },
219
+ "default": {}
220
+ }
221
+ },
222
+ "$defs": {
223
+ "modelEntry": {
224
+ "description": "How a model gets its rules.",
225
+ "type": "object",
226
+ "required": ["use"],
227
+ "additionalProperties": false,
228
+ "properties": {
229
+ "use": {
230
+ "description": "preset: the preset's rules for this exact model. custom: only the rules in \"add\". none: decided that this model needs no rules.",
231
+ "enum": ["preset", "custom", "none"]
232
+ },
233
+ "enable": {
234
+ "description": "Preset rules, off by default, to turn on.",
235
+ "type": "array",
236
+ "uniqueItems": true,
237
+ "items": { "$ref": "#/$defs/ruleId" }
238
+ },
239
+ "disable": {
240
+ "description": "Preset rules, on by default, to turn off.",
241
+ "type": "array",
242
+ "uniqueItems": true,
243
+ "items": { "$ref": "#/$defs/ruleId" }
244
+ },
245
+ "add": {
246
+ "description": "The user's own rule files, delivered after the preset's rules and the rules of \"all_models\". A rule that replaces a preset rule is delivered in that rule's place instead.",
247
+ "type": "array",
248
+ "items": { "$ref": "#/$defs/modelRule" }
249
+ }
250
+ },
251
+ "allOf": [
252
+ {
253
+ "if": { "required": ["use"], "properties": { "use": { "const": "none" } } },
254
+ "then": {
255
+ "properties": { "use": true },
256
+ "additionalProperties": false,
257
+ "x-hint": "a model declared with \"use\": \"none\" takes no other key"
258
+ }
259
+ },
260
+ {
261
+ "if": { "required": ["use"], "properties": { "use": { "const": "custom" } } },
262
+ "then": {
263
+ "required": ["add"],
264
+ "properties": {
265
+ "use": true,
266
+ "add": {
267
+ "minItems": 1,
268
+ "items": {
269
+ "properties": { "id": true, "file": true, "scopes": true, "where": true, "triggers": true },
270
+ "additionalProperties": false,
271
+ "x-hint": "\"replaces\" names a preset rule, so it is only for a model declared with \"use\": \"preset\""
272
+ }
273
+ }
274
+ },
275
+ "additionalProperties": false,
276
+ "x-hint": "a model declared with \"use\": \"custom\" takes only \"add\", with at least one rule"
277
+ }
278
+ }
279
+ ]
280
+ },
281
+ "wildcardEntry": {
282
+ "description": "A wildcard key only declares models that need no rules. Rules always need the exact model identifier, so a new model version never inherits rules written for an earlier one.",
283
+ "type": "object",
284
+ "required": ["use"],
285
+ "additionalProperties": false,
286
+ "properties": {
287
+ "use": {
288
+ "const": "none",
289
+ "x-hint": "a wildcard key only accepts {\"use\": \"none\"}; give rules under the exact model identifier"
290
+ }
291
+ },
292
+ "x-hint": "a wildcard key only accepts {\"use\": \"none\"}; give rules under the exact model identifier"
293
+ },
294
+ "userRule": {
295
+ "type": "object",
296
+ "required": ["id", "file"],
297
+ "additionalProperties": false,
298
+ "properties": {
299
+ "id": { "$ref": "#/$defs/ruleId" },
300
+ "file": {
301
+ "description": "Path to the rule text, relative to this configuration file or absolute.",
302
+ "type": "string",
303
+ "minLength": 1
304
+ },
305
+ "scopes": {
306
+ "description": "Scopes the rule applies to, or [\"*\"] for every scope.",
307
+ "$ref": "#/$defs/ruleScopes",
308
+ "default": ["*"]
309
+ },
310
+ "where": {
311
+ "description": "Places the rule applies to: \"attended\", \"unattended\" and \"subagent\", or [\"all\"] for every place.",
312
+ "$ref": "#/$defs/ruleWhere",
313
+ "default": ["all"]
314
+ },
315
+ "triggers": {
316
+ "description": "Actions that also deliver the rule to a session whose scope is not one of the rule's scopes, once the session does one of them. code-edit: the session edited a code file the project's git already tracks. Only for a rule that is cheap when the action was not what the scopes mean, and never for a rule for every scope.",
317
+ "$ref": "#/$defs/ruleTriggers",
318
+ "default": []
319
+ }
320
+ }
321
+ },
322
+ "ruleScopes": {
323
+ "type": "array",
324
+ "minItems": 1,
325
+ "uniqueItems": true,
326
+ "items": { "$ref": "#/$defs/scopeRef" }
327
+ },
328
+ "ruleWhere": {
329
+ "type": "array",
330
+ "minItems": 1,
331
+ "uniqueItems": true,
332
+ "items": { "$ref": "#/$defs/place" }
333
+ },
334
+ "ruleTriggers": {
335
+ "type": "array",
336
+ "uniqueItems": true,
337
+ "items": { "$ref": "#/$defs/trigger" }
338
+ },
339
+ "modelRule": {
340
+ "description": "A rule of a model's own \"add\": a user rule, which may also replace one of the model's preset rules.",
341
+ "type": "object",
342
+ "required": ["id", "file"],
343
+ "additionalProperties": false,
344
+ "properties": {
345
+ "id": { "$ref": "#/$defs/userRule/properties/id" },
346
+ "file": { "$ref": "#/$defs/userRule/properties/file" },
347
+ "scopes": {
348
+ "$ref": "#/$defs/ruleScopes",
349
+ "description": "Scopes the rule applies to, or [\"*\"] for every scope. Defaults to [\"*\"], or, with \"replaces\", to the scopes of the rule it replaces."
350
+ },
351
+ "where": {
352
+ "$ref": "#/$defs/ruleWhere",
353
+ "description": "Places the rule applies to. Defaults to all three, or, with \"replaces\", to the places of the rule it replaces."
354
+ },
355
+ "triggers": {
356
+ "$ref": "#/$defs/ruleTriggers",
357
+ "description": "Actions that also deliver the rule to a session whose scope is not one of the rule's scopes, once the session does one of them; see \"triggers\" of a user rule. Defaults to none, or, with \"replaces\", to the triggers of the rule it replaces."
358
+ },
359
+ "replaces": {
360
+ "description": "The id of a preset rule of this model that this rule replaces: the preset rule is off, and this rule is delivered in its place, with its scopes, places and triggers unless this rule gives its own. An id the preset rule had before a rename still names it. Only for a model declared with \"use\": \"preset\".",
361
+ "$ref": "#/$defs/ruleId"
362
+ }
363
+ }
364
+ },
365
+ "scope": {
366
+ "type": "object",
367
+ "additionalProperties": false,
368
+ "properties": {
369
+ "description": {
370
+ "description": "What kind of task this scope covers.",
371
+ "type": "string",
372
+ "minLength": 1
373
+ },
374
+ "match": {
375
+ "description": "Regular expressions (JavaScript syntax, case-insensitive, Unicode-aware) matched against a subagent's description and task text. The scope whose matcher matches earliest wins; at the same place, the scope declared first.",
376
+ "type": "array",
377
+ "uniqueItems": true,
378
+ "items": { "type": "string", "minLength": 1 }
379
+ }
380
+ }
381
+ },
382
+ "routeRow": {
383
+ "description": "Options in order of preference: one list for every target, or an object with a list for each target it routes. A target the object leaves out falls to routing.default; an empty list means that target is not routed.",
384
+ "items": { "$ref": "#/$defs/routeOption" },
385
+ "properties": {
386
+ "launcher": { "type": "array", "items": { "$ref": "#/$defs/routeOption" } },
387
+ "subagents": { "type": "array", "items": { "$ref": "#/$defs/routeOption" } }
388
+ },
389
+ "additionalProperties": false
390
+ },
391
+ "routeOption": {
392
+ "type": "object",
393
+ "required": ["model"],
394
+ "additionalProperties": false,
395
+ "properties": {
396
+ "model": {
397
+ "description": "A model alias (fable, opus, sonnet, haiku) or a model identifier declared under \"models\". An option is used only when the model it selects is declared.",
398
+ "type": "string",
399
+ "pattern": "^[a-z0-9]+(?:[-.][a-z0-9]+)*$"
400
+ },
401
+ "effort": {
402
+ "description": "The effort level to set with the model. Left out, the effort is not changed.",
403
+ "enum": ["low", "medium", "high", "xhigh", "max"]
404
+ }
405
+ }
406
+ },
407
+ "ruleId": {
408
+ "type": "string",
409
+ "pattern": "^[a-z0-9][a-z0-9._-]*(?:/[a-z0-9][a-z0-9._-]*)*$",
410
+ "x-hint": "a rule id is lowercase segments separated by \"/\", such as team/commit-style"
411
+ },
412
+ "scopeRef": {
413
+ "type": "string",
414
+ "pattern": "^(?:\\*|[a-z][a-z0-9-]*)$"
415
+ },
416
+ "trigger": {
417
+ "description": "code-edit: the session edited, with Edit or Write, a file with a code extension that the git repository of the session's project, or of one of its worktrees, already tracks.",
418
+ "enum": ["code-edit"]
419
+ },
420
+ "place": {
421
+ "description": "attended: a session someone is watching. unattended: a session nobody is watching. subagent: a subagent's task. all: every place, listed alone. session: the earlier name of attended, still read.",
422
+ "enum": ["attended", "unattended", "subagent", "all", "session"]
423
+ }
424
+ }
425
+ }
@@ -0,0 +1,194 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/noonsight@0/schema/preset.schema.json",
4
+ "title": "noonsight preset",
5
+ "description": "A preset shipped with the package: rules per exact model identifier, each with its source.",
6
+ "type": "object",
7
+ "required": ["id", "version", "models"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
12
+ "version": {
13
+ "type": "string",
14
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
15
+ },
16
+ "claude_code": {
17
+ "description": "The Claude Code version whose own system prompts were compared with these rules, and the date of that comparison. A rule is not delivered in a place where that version already sends equivalent text.",
18
+ "type": "object",
19
+ "required": ["version", "checked"],
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
23
+ "checked": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" }
24
+ }
25
+ },
26
+ "scopes": {
27
+ "type": "object",
28
+ "propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
29
+ "additionalProperties": { "$ref": "#/$defs/scope" }
30
+ },
31
+ "routing": {
32
+ "description": "The routing table the preset suggests, used only when the user turns routing on. A user row for the same scope replaces the preset's row.",
33
+ "type": "object",
34
+ "required": ["table"],
35
+ "additionalProperties": false,
36
+ "properties": {
37
+ "table": {
38
+ "type": "object",
39
+ "propertyNames": { "pattern": "^[a-z][a-z0-9-]*$" },
40
+ "additionalProperties": { "$ref": "#/$defs/routeEntry" }
41
+ }
42
+ }
43
+ },
44
+ "models": {
45
+ "type": "object",
46
+ "propertyNames": {
47
+ "pattern": "^(?=.*[0-9])[a-z0-9]+(?:[-.][a-z0-9]+)*$",
48
+ "x-hint": "a preset declares rules by full lowercase model identifier only, such as claude-fable-5-2"
49
+ },
50
+ "additionalProperties": {
51
+ "type": "object",
52
+ "required": ["rules"],
53
+ "additionalProperties": false,
54
+ "properties": {
55
+ "rules": {
56
+ "type": "array",
57
+ "minItems": 1,
58
+ "items": { "$ref": "#/$defs/rule" }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "$defs": {
65
+ "routeEntry": {
66
+ "description": "One row of the preset's routing table, with what it rests on.",
67
+ "type": "object",
68
+ "required": ["route", "basis", "sources"],
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "route": { "type": ["array", "object"], "$ref": "#/$defs/routeRow" },
72
+ "basis": {
73
+ "description": "What the sources say that supports this row.",
74
+ "type": "string",
75
+ "minLength": 1
76
+ },
77
+ "sources": {
78
+ "type": "array",
79
+ "minItems": 1,
80
+ "items": { "$ref": "#/$defs/source" }
81
+ }
82
+ }
83
+ },
84
+ "routeRow": {
85
+ "description": "Options in order of preference: one list for every target, or an object with a list for each target.",
86
+ "items": { "$ref": "#/$defs/routeOption" },
87
+ "properties": {
88
+ "launcher": { "type": "array", "items": { "$ref": "#/$defs/routeOption" } },
89
+ "subagents": { "type": "array", "items": { "$ref": "#/$defs/routeOption" } }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "routeOption": {
94
+ "type": "object",
95
+ "required": ["model"],
96
+ "additionalProperties": false,
97
+ "properties": {
98
+ "model": {
99
+ "description": "A preset names models by alias only, since it cannot know which model identifiers a user declares.",
100
+ "enum": ["fable", "opus", "sonnet", "haiku"]
101
+ },
102
+ "effort": { "enum": ["low", "medium", "high", "xhigh", "max"] }
103
+ }
104
+ },
105
+ "rule": {
106
+ "type": "object",
107
+ "required": ["id", "file", "scopes", "where", "source", "effect", "cost"],
108
+ "additionalProperties": false,
109
+ "properties": {
110
+ "id": {
111
+ "type": "string",
112
+ "pattern": "^[a-z0-9][a-z0-9._-]*(?:/[a-z0-9][a-z0-9._-]*)*$"
113
+ },
114
+ "file": {
115
+ "description": "Path to the rule text, relative to the preset directory.",
116
+ "type": "string",
117
+ "minLength": 1
118
+ },
119
+ "scopes": {
120
+ "type": "array",
121
+ "minItems": 1,
122
+ "uniqueItems": true,
123
+ "items": { "type": "string", "pattern": "^(?:\\*|[a-z][a-z0-9-]*)$" }
124
+ },
125
+ "where": {
126
+ "type": "array",
127
+ "minItems": 1,
128
+ "uniqueItems": true,
129
+ "description": "attended: a session someone is watching. unattended: a session nobody is watching. subagent: a subagent's task. session: the earlier name of attended, which copies of earlier versions use.",
130
+ "items": { "enum": ["attended", "unattended", "subagent", "session"] }
131
+ },
132
+ "triggers": {
133
+ "description": "Actions that also deliver the rule to a session whose scope is not one of the rule's scopes (see the configuration schema). Only for a rule that is cheap when the action was not what the scopes mean; SOURCES.md says why for each.",
134
+ "type": "array",
135
+ "minItems": 1,
136
+ "uniqueItems": true,
137
+ "items": { "enum": ["code-edit"] }
138
+ },
139
+ "renamed_from": {
140
+ "description": "Every id this rule had in earlier versions of the preset, for the same model. An enable, disable or replaces entry that names one applies to this rule, and noonsight reports the rename when the preset is updated.",
141
+ "type": "array",
142
+ "minItems": 1,
143
+ "uniqueItems": true,
144
+ "items": {
145
+ "type": "string",
146
+ "pattern": "^[a-z0-9][a-z0-9._-]*(?:/[a-z0-9][a-z0-9._-]*)*$"
147
+ }
148
+ },
149
+ "enabled": {
150
+ "description": "Whether the rule is on unless the user turns it off. Rules with a high cost or a described side effect ship off.",
151
+ "type": "boolean",
152
+ "default": true
153
+ },
154
+ "source": { "$ref": "#/$defs/source" },
155
+ "effect": {
156
+ "description": "What the source reports the text changes, with its own measurements where it gives them.",
157
+ "type": "string",
158
+ "minLength": 1
159
+ },
160
+ "cost": {
161
+ "description": "What the source reports the text costs, such as more output tokens or a side effect, or that it reports no cost.",
162
+ "type": "string",
163
+ "minLength": 1
164
+ }
165
+ }
166
+ },
167
+ "source": {
168
+ "description": "Where a rule or a scope comes from: the page, the section and the date it was read.",
169
+ "type": "object",
170
+ "required": ["url", "section", "date"],
171
+ "additionalProperties": false,
172
+ "properties": {
173
+ "url": { "type": "string", "pattern": "^https://" },
174
+ "section": { "type": "string", "minLength": 1 },
175
+ "date": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" }
176
+ }
177
+ },
178
+ "scope": {
179
+ "type": "object",
180
+ "required": ["description", "source"],
181
+ "additionalProperties": false,
182
+ "properties": {
183
+ "description": { "type": "string", "minLength": 1 },
184
+ "source": { "$ref": "#/$defs/source" },
185
+ "match": {
186
+ "description": "Regular expressions (JavaScript syntax, case-insensitive, Unicode-aware) matched against a subagent's description and task text.",
187
+ "type": "array",
188
+ "uniqueItems": true,
189
+ "items": { "type": "string", "minLength": 1 }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }