harness-evolve 1.0.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.
@@ -0,0 +1,1029 @@
1
+ import { z } from 'zod/v4';
2
+ export { handleStop } from './hooks/stop.js';
3
+ import { Command } from '@commander-js/extra-typings';
4
+
5
+ declare const configSchema: z.ZodObject<{
6
+ version: z.ZodDefault<z.ZodNumber>;
7
+ analysis: z.ZodDefault<z.ZodObject<{
8
+ threshold: z.ZodDefault<z.ZodNumber>;
9
+ enabled: z.ZodDefault<z.ZodBoolean>;
10
+ classifierThresholds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
11
+ }, z.core.$strip>>;
12
+ hooks: z.ZodDefault<z.ZodObject<{
13
+ capturePrompts: z.ZodDefault<z.ZodBoolean>;
14
+ captureTools: z.ZodDefault<z.ZodBoolean>;
15
+ capturePermissions: z.ZodDefault<z.ZodBoolean>;
16
+ captureSessions: z.ZodDefault<z.ZodBoolean>;
17
+ }, z.core.$strip>>;
18
+ scrubbing: z.ZodDefault<z.ZodObject<{
19
+ enabled: z.ZodDefault<z.ZodBoolean>;
20
+ highEntropyDetection: z.ZodDefault<z.ZodBoolean>;
21
+ customPatterns: z.ZodDefault<z.ZodArray<z.ZodObject<{
22
+ name: z.ZodString;
23
+ regex: z.ZodString;
24
+ replacement: z.ZodString;
25
+ }, z.core.$strip>>>;
26
+ }, z.core.$strip>>;
27
+ delivery: z.ZodDefault<z.ZodObject<{
28
+ stdoutInjection: z.ZodDefault<z.ZodBoolean>;
29
+ maxTokens: z.ZodDefault<z.ZodNumber>;
30
+ fullAuto: z.ZodDefault<z.ZodBoolean>;
31
+ maxRecommendationsInFile: z.ZodDefault<z.ZodNumber>;
32
+ archiveAfterDays: z.ZodDefault<z.ZodNumber>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strict>;
35
+ type Config = z.infer<typeof configSchema>;
36
+
37
+ declare const promptEntrySchema: z.ZodObject<{
38
+ timestamp: z.ZodISODateTime;
39
+ session_id: z.ZodString;
40
+ cwd: z.ZodString;
41
+ prompt: z.ZodString;
42
+ prompt_length: z.ZodNumber;
43
+ transcript_path: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ type PromptEntry = z.infer<typeof promptEntrySchema>;
46
+ declare const toolEntrySchema: z.ZodObject<{
47
+ timestamp: z.ZodISODateTime;
48
+ session_id: z.ZodString;
49
+ event: z.ZodEnum<{
50
+ pre: "pre";
51
+ post: "post";
52
+ failure: "failure";
53
+ }>;
54
+ tool_name: z.ZodString;
55
+ input_summary: z.ZodOptional<z.ZodString>;
56
+ duration_ms: z.ZodOptional<z.ZodNumber>;
57
+ success: z.ZodOptional<z.ZodBoolean>;
58
+ }, z.core.$strip>;
59
+ type ToolEntry = z.infer<typeof toolEntrySchema>;
60
+ declare const permissionEntrySchema: z.ZodObject<{
61
+ timestamp: z.ZodISODateTime;
62
+ session_id: z.ZodString;
63
+ tool_name: z.ZodString;
64
+ decision: z.ZodEnum<{
65
+ unknown: "unknown";
66
+ approved: "approved";
67
+ denied: "denied";
68
+ }>;
69
+ }, z.core.$strip>;
70
+ type PermissionEntry = z.infer<typeof permissionEntrySchema>;
71
+ declare const sessionEntrySchema: z.ZodObject<{
72
+ timestamp: z.ZodISODateTime;
73
+ session_id: z.ZodString;
74
+ event: z.ZodEnum<{
75
+ start: "start";
76
+ end: "end";
77
+ }>;
78
+ cwd: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>;
80
+ type SessionEntry = z.infer<typeof sessionEntrySchema>;
81
+
82
+ declare const counterSchema: z.ZodObject<{
83
+ total: z.ZodDefault<z.ZodNumber>;
84
+ session: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
85
+ last_analysis: z.ZodOptional<z.ZodISODateTime>;
86
+ last_updated: z.ZodISODateTime;
87
+ }, z.core.$strip>;
88
+ type Counter = z.infer<typeof counterSchema>;
89
+
90
+ declare const hookCommonSchema: z.ZodObject<{
91
+ session_id: z.ZodString;
92
+ transcript_path: z.ZodString;
93
+ cwd: z.ZodString;
94
+ permission_mode: z.ZodString;
95
+ }, z.core.$strip>;
96
+ type HookCommon = z.infer<typeof hookCommonSchema>;
97
+ declare const userPromptSubmitInputSchema: z.ZodObject<{
98
+ session_id: z.ZodString;
99
+ transcript_path: z.ZodString;
100
+ cwd: z.ZodString;
101
+ permission_mode: z.ZodString;
102
+ hook_event_name: z.ZodLiteral<"UserPromptSubmit">;
103
+ prompt: z.ZodString;
104
+ }, z.core.$strip>;
105
+ type UserPromptSubmitInput = z.infer<typeof userPromptSubmitInputSchema>;
106
+ declare const preToolUseInputSchema: z.ZodObject<{
107
+ session_id: z.ZodString;
108
+ transcript_path: z.ZodString;
109
+ cwd: z.ZodString;
110
+ permission_mode: z.ZodString;
111
+ hook_event_name: z.ZodLiteral<"PreToolUse">;
112
+ tool_name: z.ZodString;
113
+ tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
114
+ tool_use_id: z.ZodString;
115
+ }, z.core.$strip>;
116
+ type PreToolUseInput = z.infer<typeof preToolUseInputSchema>;
117
+ declare const postToolUseInputSchema: z.ZodObject<{
118
+ session_id: z.ZodString;
119
+ transcript_path: z.ZodString;
120
+ cwd: z.ZodString;
121
+ permission_mode: z.ZodString;
122
+ hook_event_name: z.ZodLiteral<"PostToolUse">;
123
+ tool_name: z.ZodString;
124
+ tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
125
+ tool_response: z.ZodOptional<z.ZodUnknown>;
126
+ tool_use_id: z.ZodString;
127
+ }, z.core.$strip>;
128
+ type PostToolUseInput = z.infer<typeof postToolUseInputSchema>;
129
+ declare const postToolUseFailureInputSchema: z.ZodObject<{
130
+ session_id: z.ZodString;
131
+ transcript_path: z.ZodString;
132
+ cwd: z.ZodString;
133
+ permission_mode: z.ZodString;
134
+ hook_event_name: z.ZodLiteral<"PostToolUseFailure">;
135
+ tool_name: z.ZodString;
136
+ tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
137
+ tool_use_id: z.ZodString;
138
+ error: z.ZodOptional<z.ZodString>;
139
+ is_interrupt: z.ZodOptional<z.ZodBoolean>;
140
+ }, z.core.$strip>;
141
+ type PostToolUseFailureInput = z.infer<typeof postToolUseFailureInputSchema>;
142
+ declare const permissionRequestInputSchema: z.ZodObject<{
143
+ session_id: z.ZodString;
144
+ transcript_path: z.ZodString;
145
+ cwd: z.ZodString;
146
+ permission_mode: z.ZodString;
147
+ hook_event_name: z.ZodLiteral<"PermissionRequest">;
148
+ tool_name: z.ZodString;
149
+ tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
150
+ permission_suggestions: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
151
+ }, z.core.$strip>;
152
+ type PermissionRequestInput = z.infer<typeof permissionRequestInputSchema>;
153
+ declare const stopInputSchema: z.ZodObject<{
154
+ session_id: z.ZodString;
155
+ transcript_path: z.ZodString;
156
+ cwd: z.ZodString;
157
+ permission_mode: z.ZodString;
158
+ hook_event_name: z.ZodLiteral<"Stop">;
159
+ stop_hook_active: z.ZodBoolean;
160
+ last_assistant_message: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>;
162
+ type StopInput = z.infer<typeof stopInputSchema>;
163
+
164
+ /**
165
+ * Read all data from a readable stream into a string buffer.
166
+ * Used for testability -- readStdin() delegates to this with process.stdin.
167
+ */
168
+ declare function readFromStream(stream: NodeJS.ReadableStream): Promise<string>;
169
+ /**
170
+ * Read all stdin data into a string buffer.
171
+ * Claude Code pipes JSON to hook stdin; this collects all chunks before parsing.
172
+ */
173
+ declare function readStdin(): Promise<string>;
174
+ /**
175
+ * Produce a concise summary of tool_input, capped at 200 characters.
176
+ * Prevents Write/Edit tool inputs (with full file content) from bloating logs.
177
+ */
178
+ declare function summarizeToolInput(toolName: string, toolInput: Record<string, unknown>): string;
179
+
180
+ declare const paths: {
181
+ readonly base: string;
182
+ readonly logs: {
183
+ readonly prompts: string;
184
+ readonly tools: string;
185
+ readonly permissions: string;
186
+ readonly sessions: string;
187
+ };
188
+ readonly analysis: string;
189
+ readonly analysisPreProcessed: string;
190
+ readonly summary: string;
191
+ readonly environmentSnapshot: string;
192
+ readonly analysisResult: string;
193
+ readonly pending: string;
194
+ readonly config: string;
195
+ readonly counter: string;
196
+ readonly recommendations: string;
197
+ readonly recommendationState: string;
198
+ readonly recommendationArchive: string;
199
+ readonly notificationFlag: string;
200
+ readonly autoApplyLog: string;
201
+ readonly outcomeHistory: string;
202
+ };
203
+ declare function ensureInit(): Promise<void>;
204
+
205
+ declare function loadConfig(): Promise<Config>;
206
+
207
+ interface ScrubPattern {
208
+ name: string;
209
+ regex: RegExp;
210
+ replacement: string;
211
+ }
212
+ declare const SCRUB_PATTERNS: ScrubPattern[];
213
+
214
+ /**
215
+ * Scrub secrets from a string using built-in patterns
216
+ * plus optional extra patterns (e.g., user-defined custom patterns).
217
+ */
218
+ declare function scrubString(input: string, extraPatterns?: ScrubPattern[]): string;
219
+ /**
220
+ * Recursively scrub all string values in an object/array structure.
221
+ * Non-string primitives (numbers, booleans, null, undefined) pass through unchanged.
222
+ */
223
+ declare function scrubObject<T>(obj: T, extraPatterns?: ScrubPattern[]): T;
224
+
225
+ declare const SCHEMA_MAP: {
226
+ readonly prompts: z.ZodObject<{
227
+ timestamp: z.ZodISODateTime;
228
+ session_id: z.ZodString;
229
+ cwd: z.ZodString;
230
+ prompt: z.ZodString;
231
+ prompt_length: z.ZodNumber;
232
+ transcript_path: z.ZodOptional<z.ZodString>;
233
+ }, z.core.$strip>;
234
+ readonly tools: z.ZodObject<{
235
+ timestamp: z.ZodISODateTime;
236
+ session_id: z.ZodString;
237
+ event: z.ZodEnum<{
238
+ pre: "pre";
239
+ post: "post";
240
+ failure: "failure";
241
+ }>;
242
+ tool_name: z.ZodString;
243
+ input_summary: z.ZodOptional<z.ZodString>;
244
+ duration_ms: z.ZodOptional<z.ZodNumber>;
245
+ success: z.ZodOptional<z.ZodBoolean>;
246
+ }, z.core.$strip>;
247
+ readonly permissions: z.ZodObject<{
248
+ timestamp: z.ZodISODateTime;
249
+ session_id: z.ZodString;
250
+ tool_name: z.ZodString;
251
+ decision: z.ZodEnum<{
252
+ unknown: "unknown";
253
+ approved: "approved";
254
+ denied: "denied";
255
+ }>;
256
+ }, z.core.$strip>;
257
+ readonly sessions: z.ZodObject<{
258
+ timestamp: z.ZodISODateTime;
259
+ session_id: z.ZodString;
260
+ event: z.ZodEnum<{
261
+ start: "start";
262
+ end: "end";
263
+ }>;
264
+ cwd: z.ZodOptional<z.ZodString>;
265
+ }, z.core.$strip>;
266
+ };
267
+ type LogType = keyof typeof SCHEMA_MAP;
268
+ /**
269
+ * Validate, scrub, and append a log entry as a JSONL line.
270
+ *
271
+ * Uses native fs.appendFile (NOT write-file-atomic) because:
272
+ * - JSONL is append-only, not replace
273
+ * - appendFile is atomic for writes <4KB on POSIX
274
+ * - write-file-atomic replaces entire file (anti-pattern for appends)
275
+ */
276
+ declare function appendLogEntry(type: LogType, rawEntry: unknown): Promise<void>;
277
+
278
+ /**
279
+ * Read the current counter state from disk.
280
+ * Returns defaults (total=0, session={}) if no counter file exists.
281
+ */
282
+ declare function readCounter(): Promise<Counter>;
283
+ /**
284
+ * Atomically increment the interaction counter with cross-process safety.
285
+ *
286
+ * Uses proper-lockfile (mkdir-based, macOS-safe) for cross-process locking
287
+ * and write-file-atomic for crash-safe writes inside the lock.
288
+ *
289
+ * Pattern: ensure-file -> lock -> read -> increment -> atomic-write -> unlock
290
+ */
291
+ declare function incrementCounter(sessionId: string): Promise<number>;
292
+ /**
293
+ * Reset the counter to zero. Used for testing and post-analysis reset.
294
+ */
295
+ declare function resetCounter(): Promise<void>;
296
+
297
+ declare const summarySchema: z.ZodObject<{
298
+ generated_at: z.ZodISODateTime;
299
+ period: z.ZodObject<{
300
+ since: z.ZodString;
301
+ until: z.ZodString;
302
+ days: z.ZodNumber;
303
+ }, z.core.$strip>;
304
+ stats: z.ZodObject<{
305
+ total_prompts: z.ZodNumber;
306
+ total_tool_uses: z.ZodNumber;
307
+ total_permissions: z.ZodNumber;
308
+ unique_sessions: z.ZodNumber;
309
+ }, z.core.$strip>;
310
+ top_repeated_prompts: z.ZodArray<z.ZodObject<{
311
+ prompt: z.ZodString;
312
+ count: z.ZodNumber;
313
+ sessions: z.ZodNumber;
314
+ }, z.core.$strip>>;
315
+ tool_frequency: z.ZodArray<z.ZodObject<{
316
+ tool_name: z.ZodString;
317
+ count: z.ZodNumber;
318
+ avg_duration_ms: z.ZodOptional<z.ZodNumber>;
319
+ }, z.core.$strip>>;
320
+ permission_patterns: z.ZodArray<z.ZodObject<{
321
+ tool_name: z.ZodString;
322
+ count: z.ZodNumber;
323
+ sessions: z.ZodNumber;
324
+ }, z.core.$strip>>;
325
+ long_prompts: z.ZodArray<z.ZodObject<{
326
+ prompt_preview: z.ZodString;
327
+ length: z.ZodNumber;
328
+ count: z.ZodNumber;
329
+ }, z.core.$strip>>;
330
+ }, z.core.$strip>;
331
+ type Summary = z.infer<typeof summarySchema>;
332
+ declare const environmentSnapshotSchema: z.ZodObject<{
333
+ generated_at: z.ZodISODateTime;
334
+ claude_code: z.ZodObject<{
335
+ version: z.ZodString;
336
+ version_known: z.ZodBoolean;
337
+ compatible: z.ZodBoolean;
338
+ }, z.core.$strip>;
339
+ settings: z.ZodObject<{
340
+ user: z.ZodNullable<z.ZodUnknown>;
341
+ project: z.ZodNullable<z.ZodUnknown>;
342
+ local: z.ZodNullable<z.ZodUnknown>;
343
+ }, z.core.$strip>;
344
+ installed_tools: z.ZodObject<{
345
+ plugins: z.ZodArray<z.ZodObject<{
346
+ name: z.ZodString;
347
+ marketplace: z.ZodString;
348
+ enabled: z.ZodBoolean;
349
+ scope: z.ZodString;
350
+ capabilities: z.ZodArray<z.ZodString>;
351
+ }, z.core.$strip>>;
352
+ skills: z.ZodArray<z.ZodObject<{
353
+ name: z.ZodString;
354
+ scope: z.ZodEnum<{
355
+ user: "user";
356
+ project: "project";
357
+ }>;
358
+ }, z.core.$strip>>;
359
+ rules: z.ZodArray<z.ZodObject<{
360
+ name: z.ZodString;
361
+ scope: z.ZodEnum<{
362
+ user: "user";
363
+ project: "project";
364
+ }>;
365
+ }, z.core.$strip>>;
366
+ hooks: z.ZodArray<z.ZodObject<{
367
+ event: z.ZodString;
368
+ scope: z.ZodEnum<{
369
+ user: "user";
370
+ project: "project";
371
+ local: "local";
372
+ }>;
373
+ type: z.ZodString;
374
+ }, z.core.$strip>>;
375
+ claude_md: z.ZodArray<z.ZodObject<{
376
+ path: z.ZodString;
377
+ exists: z.ZodBoolean;
378
+ }, z.core.$strip>>;
379
+ }, z.core.$strip>;
380
+ detected_ecosystems: z.ZodArray<z.ZodString>;
381
+ }, z.core.$strip>;
382
+ type EnvironmentSnapshot = z.infer<typeof environmentSnapshotSchema>;
383
+
384
+ /**
385
+ * Read and parse all JSONL entries from a log directory, optionally
386
+ * filtered by date range. Files are read in chronological order
387
+ * (sorted by YYYY-MM-DD filename).
388
+ *
389
+ * @param logDir - Directory containing YYYY-MM-DD.jsonl files
390
+ * @param schema - Zod schema for parsing and type inference
391
+ * @param options - Optional date range filter (inclusive boundaries)
392
+ * @returns Array of validated, typed entries
393
+ */
394
+ declare function readLogEntries<T>(logDir: string, schema: z.ZodType<T>, options?: {
395
+ since?: Date;
396
+ until?: Date;
397
+ }): Promise<T[]>;
398
+
399
+ /**
400
+ * Pre-process accumulated JSONL logs and produce a compact summary.
401
+ *
402
+ * Reads prompt, tool, and permission logs within the specified date range,
403
+ * computes frequency counts with cross-session aggregation, and writes
404
+ * the result atomically to paths.summary.
405
+ *
406
+ * @param options.since - Start of date range (defaults to 30 days ago)
407
+ * @param options.until - End of date range (defaults to now)
408
+ * @param options.topN - Max entries in top_repeated_prompts (defaults to 20)
409
+ * @returns The validated Summary object
410
+ */
411
+ declare function preProcess(options?: {
412
+ since?: Date;
413
+ until?: Date;
414
+ topN?: number;
415
+ }): Promise<Summary>;
416
+
417
+ /**
418
+ * Scan the user's environment to discover installed Claude Code tools,
419
+ * settings, version info, and ecosystem presence. Writes the snapshot
420
+ * atomically to paths.environmentSnapshot.
421
+ *
422
+ * @param cwd - Current working directory (project root)
423
+ * @param home - User home directory (defaults to process.env.HOME)
424
+ * @returns Validated EnvironmentSnapshot
425
+ */
426
+ declare function scanEnvironment(cwd: string, home?: string): Promise<EnvironmentSnapshot>;
427
+
428
+ declare const routingTargetSchema: z.ZodEnum<{
429
+ HOOK: "HOOK";
430
+ SKILL: "SKILL";
431
+ RULE: "RULE";
432
+ CLAUDE_MD: "CLAUDE_MD";
433
+ MEMORY: "MEMORY";
434
+ SETTINGS: "SETTINGS";
435
+ }>;
436
+ type RoutingTarget = z.infer<typeof routingTargetSchema>;
437
+ declare const confidenceSchema: z.ZodEnum<{
438
+ HIGH: "HIGH";
439
+ MEDIUM: "MEDIUM";
440
+ LOW: "LOW";
441
+ }>;
442
+ type Confidence = z.infer<typeof confidenceSchema>;
443
+ declare const recommendationSchema: z.ZodObject<{
444
+ id: z.ZodString;
445
+ target: z.ZodEnum<{
446
+ HOOK: "HOOK";
447
+ SKILL: "SKILL";
448
+ RULE: "RULE";
449
+ CLAUDE_MD: "CLAUDE_MD";
450
+ MEMORY: "MEMORY";
451
+ SETTINGS: "SETTINGS";
452
+ }>;
453
+ confidence: z.ZodEnum<{
454
+ HIGH: "HIGH";
455
+ MEDIUM: "MEDIUM";
456
+ LOW: "LOW";
457
+ }>;
458
+ pattern_type: z.ZodEnum<{
459
+ repeated_prompt: "repeated_prompt";
460
+ long_prompt: "long_prompt";
461
+ "permission-always-approved": "permission-always-approved";
462
+ code_correction: "code_correction";
463
+ personal_info: "personal_info";
464
+ config_drift: "config_drift";
465
+ version_update: "version_update";
466
+ ecosystem_gsd: "ecosystem_gsd";
467
+ ecosystem_cog: "ecosystem_cog";
468
+ onboarding_start_hooks: "onboarding_start_hooks";
469
+ onboarding_start_rules: "onboarding_start_rules";
470
+ onboarding_start_claudemd: "onboarding_start_claudemd";
471
+ onboarding_optimize: "onboarding_optimize";
472
+ scan_redundancy: "scan_redundancy";
473
+ scan_missing_mechanization: "scan_missing_mechanization";
474
+ scan_stale_reference: "scan_stale_reference";
475
+ }>;
476
+ title: z.ZodString;
477
+ description: z.ZodString;
478
+ evidence: z.ZodObject<{
479
+ count: z.ZodNumber;
480
+ sessions: z.ZodOptional<z.ZodNumber>;
481
+ examples: z.ZodArray<z.ZodString>;
482
+ }, z.core.$strip>;
483
+ suggested_action: z.ZodString;
484
+ ecosystem_context: z.ZodOptional<z.ZodString>;
485
+ }, z.core.$strip>;
486
+ type Recommendation = z.infer<typeof recommendationSchema>;
487
+ declare const analysisConfigSchema: z.ZodDefault<z.ZodObject<{
488
+ thresholds: z.ZodDefault<z.ZodObject<{
489
+ repeated_prompt_min_count: z.ZodDefault<z.ZodNumber>;
490
+ repeated_prompt_high_count: z.ZodDefault<z.ZodNumber>;
491
+ repeated_prompt_high_sessions: z.ZodDefault<z.ZodNumber>;
492
+ repeated_prompt_medium_sessions: z.ZodDefault<z.ZodNumber>;
493
+ long_prompt_min_words: z.ZodDefault<z.ZodNumber>;
494
+ long_prompt_min_count: z.ZodDefault<z.ZodNumber>;
495
+ long_prompt_high_words: z.ZodDefault<z.ZodNumber>;
496
+ long_prompt_high_count: z.ZodDefault<z.ZodNumber>;
497
+ permission_approval_min_count: z.ZodDefault<z.ZodNumber>;
498
+ permission_approval_min_sessions: z.ZodDefault<z.ZodNumber>;
499
+ permission_approval_high_count: z.ZodDefault<z.ZodNumber>;
500
+ permission_approval_high_sessions: z.ZodDefault<z.ZodNumber>;
501
+ code_correction_min_failure_rate: z.ZodDefault<z.ZodNumber>;
502
+ code_correction_min_failures: z.ZodDefault<z.ZodNumber>;
503
+ }, z.core.$strip>>;
504
+ max_recommendations: z.ZodDefault<z.ZodNumber>;
505
+ }, z.core.$strip>>;
506
+ type AnalysisConfig = z.infer<typeof analysisConfigSchema>;
507
+ declare const analysisResultSchema: z.ZodObject<{
508
+ generated_at: z.ZodISODateTime;
509
+ summary_period: z.ZodObject<{
510
+ since: z.ZodString;
511
+ until: z.ZodString;
512
+ days: z.ZodNumber;
513
+ }, z.core.$strip>;
514
+ recommendations: z.ZodArray<z.ZodObject<{
515
+ id: z.ZodString;
516
+ target: z.ZodEnum<{
517
+ HOOK: "HOOK";
518
+ SKILL: "SKILL";
519
+ RULE: "RULE";
520
+ CLAUDE_MD: "CLAUDE_MD";
521
+ MEMORY: "MEMORY";
522
+ SETTINGS: "SETTINGS";
523
+ }>;
524
+ confidence: z.ZodEnum<{
525
+ HIGH: "HIGH";
526
+ MEDIUM: "MEDIUM";
527
+ LOW: "LOW";
528
+ }>;
529
+ pattern_type: z.ZodEnum<{
530
+ repeated_prompt: "repeated_prompt";
531
+ long_prompt: "long_prompt";
532
+ "permission-always-approved": "permission-always-approved";
533
+ code_correction: "code_correction";
534
+ personal_info: "personal_info";
535
+ config_drift: "config_drift";
536
+ version_update: "version_update";
537
+ ecosystem_gsd: "ecosystem_gsd";
538
+ ecosystem_cog: "ecosystem_cog";
539
+ onboarding_start_hooks: "onboarding_start_hooks";
540
+ onboarding_start_rules: "onboarding_start_rules";
541
+ onboarding_start_claudemd: "onboarding_start_claudemd";
542
+ onboarding_optimize: "onboarding_optimize";
543
+ scan_redundancy: "scan_redundancy";
544
+ scan_missing_mechanization: "scan_missing_mechanization";
545
+ scan_stale_reference: "scan_stale_reference";
546
+ }>;
547
+ title: z.ZodString;
548
+ description: z.ZodString;
549
+ evidence: z.ZodObject<{
550
+ count: z.ZodNumber;
551
+ sessions: z.ZodOptional<z.ZodNumber>;
552
+ examples: z.ZodArray<z.ZodString>;
553
+ }, z.core.$strip>;
554
+ suggested_action: z.ZodString;
555
+ ecosystem_context: z.ZodOptional<z.ZodString>;
556
+ }, z.core.$strip>>;
557
+ metadata: z.ZodObject<{
558
+ classifier_count: z.ZodNumber;
559
+ patterns_evaluated: z.ZodNumber;
560
+ environment_ecosystems: z.ZodArray<z.ZodString>;
561
+ claude_code_version: z.ZodString;
562
+ }, z.core.$strip>;
563
+ }, z.core.$strip>;
564
+ type AnalysisResult = z.infer<typeof analysisResultSchema>;
565
+
566
+ declare const experienceTierSchema: z.ZodEnum<{
567
+ newcomer: "newcomer";
568
+ intermediate: "intermediate";
569
+ power_user: "power_user";
570
+ }>;
571
+ type ExperienceTier = z.infer<typeof experienceTierSchema>;
572
+ declare const experienceLevelSchema: z.ZodObject<{
573
+ tier: z.ZodEnum<{
574
+ newcomer: "newcomer";
575
+ intermediate: "intermediate";
576
+ power_user: "power_user";
577
+ }>;
578
+ score: z.ZodNumber;
579
+ breakdown: z.ZodObject<{
580
+ hooks: z.ZodNumber;
581
+ rules: z.ZodNumber;
582
+ skills: z.ZodNumber;
583
+ plugins: z.ZodNumber;
584
+ claude_md: z.ZodNumber;
585
+ ecosystems: z.ZodNumber;
586
+ }, z.core.$strip>;
587
+ }, z.core.$strip>;
588
+ type ExperienceLevel = z.infer<typeof experienceLevelSchema>;
589
+ declare const outcomeEntrySchema: z.ZodObject<{
590
+ recommendation_id: z.ZodString;
591
+ pattern_type: z.ZodString;
592
+ target: z.ZodString;
593
+ applied_at: z.ZodISODateTime;
594
+ checked_at: z.ZodISODateTime;
595
+ persisted: z.ZodBoolean;
596
+ checks_since_applied: z.ZodNumber;
597
+ outcome: z.ZodEnum<{
598
+ positive: "positive";
599
+ negative: "negative";
600
+ monitoring: "monitoring";
601
+ }>;
602
+ }, z.core.$strip>;
603
+ type OutcomeEntry = z.infer<typeof outcomeEntrySchema>;
604
+ declare const outcomeSummarySchema: z.ZodObject<{
605
+ pattern_type: z.ZodString;
606
+ total_applied: z.ZodNumber;
607
+ total_persisted: z.ZodNumber;
608
+ total_reverted: z.ZodNumber;
609
+ persistence_rate: z.ZodNumber;
610
+ }, z.core.$strip>;
611
+ type OutcomeSummary = z.infer<typeof outcomeSummarySchema>;
612
+
613
+ /**
614
+ * Adjust recommendation confidence based on historical outcome data.
615
+ * Pattern types with >30% revert rate (persistence_rate < 0.7) get
616
+ * downgraded by one tier: HIGH->MEDIUM, MEDIUM->LOW, LOW stays LOW.
617
+ */
618
+ declare function adjustConfidence(recommendations: Recommendation[], summaries: OutcomeSummary[]): Recommendation[];
619
+ /**
620
+ * Analyze a pre-processed summary and environment snapshot to produce
621
+ * structured recommendations.
622
+ *
623
+ * @param summary - Pre-processed usage summary from pre-processor
624
+ * @param snapshot - Environment snapshot from environment-scanner
625
+ * @param config - Optional analysis configuration (defaults applied if omitted)
626
+ * @param outcomeSummaries - Optional outcome summaries for confidence adjustment
627
+ * @returns Validated AnalysisResult with sorted, capped recommendations
628
+ */
629
+ declare function analyze(summary: Summary, snapshot: EnvironmentSnapshot, config?: AnalysisConfig, outcomeSummaries?: OutcomeSummary[]): AnalysisResult;
630
+
631
+ type Classifier = (summary: Summary, snapshot: EnvironmentSnapshot, config: AnalysisConfig) => Recommendation[];
632
+
633
+ /**
634
+ * Write an AnalysisResult to the analysis-result.json path atomically.
635
+ */
636
+ declare function writeAnalysisResult(result: AnalysisResult): Promise<void>;
637
+ /**
638
+ * Run the full analysis pipeline: preProcess -> scanEnvironment -> analyze -> write.
639
+ *
640
+ * @param cwd - Current working directory for environment scanning
641
+ * @returns The generated AnalysisResult
642
+ */
643
+ declare function runAnalysis(cwd: string): Promise<AnalysisResult>;
644
+ /**
645
+ * Check if analysis should be triggered and run it if conditions are met.
646
+ *
647
+ * Conditions:
648
+ * 1. analysis.enabled is true in config
649
+ * 2. counter.total >= config.analysis.threshold
650
+ * 3. Not within cooldown period since last_analysis
651
+ *
652
+ * On success: resets counter and records last_analysis timestamp.
653
+ * On failure: preserves counter data for retry at next check.
654
+ *
655
+ * @param cwd - Current working directory
656
+ * @returns true if analysis was triggered, false otherwise
657
+ */
658
+ declare function checkAndTriggerAnalysis(cwd: string): Promise<boolean>;
659
+
660
+ declare const recommendationStatusSchema: z.ZodEnum<{
661
+ pending: "pending";
662
+ applied: "applied";
663
+ dismissed: "dismissed";
664
+ }>;
665
+ type RecommendationStatus = z.infer<typeof recommendationStatusSchema>;
666
+ declare const recommendationStateEntrySchema: z.ZodObject<{
667
+ id: z.ZodString;
668
+ status: z.ZodEnum<{
669
+ pending: "pending";
670
+ applied: "applied";
671
+ dismissed: "dismissed";
672
+ }>;
673
+ updated_at: z.ZodISODateTime;
674
+ applied_details: z.ZodOptional<z.ZodString>;
675
+ }, z.core.$strip>;
676
+ type RecommendationStateEntry = z.infer<typeof recommendationStateEntrySchema>;
677
+ declare const recommendationStateSchema: z.ZodObject<{
678
+ entries: z.ZodArray<z.ZodObject<{
679
+ id: z.ZodString;
680
+ status: z.ZodEnum<{
681
+ pending: "pending";
682
+ applied: "applied";
683
+ dismissed: "dismissed";
684
+ }>;
685
+ updated_at: z.ZodISODateTime;
686
+ applied_details: z.ZodOptional<z.ZodString>;
687
+ }, z.core.$strip>>;
688
+ last_updated: z.ZodISODateTime;
689
+ }, z.core.$strip>;
690
+ type RecommendationState = z.infer<typeof recommendationStateSchema>;
691
+ declare const autoApplyLogEntrySchema: z.ZodObject<{
692
+ timestamp: z.ZodISODateTime;
693
+ recommendation_id: z.ZodString;
694
+ target: z.ZodString;
695
+ action: z.ZodString;
696
+ success: z.ZodBoolean;
697
+ details: z.ZodOptional<z.ZodString>;
698
+ backup_path: z.ZodOptional<z.ZodString>;
699
+ }, z.core.$strip>;
700
+ type AutoApplyLogEntry = z.infer<typeof autoApplyLogEntrySchema>;
701
+
702
+ /**
703
+ * Render an AnalysisResult to a markdown string grouped by confidence tier.
704
+ * Status prefixes (PENDING/APPLIED/DISMISSED) are looked up from the states map.
705
+ */
706
+ declare function renderRecommendations(result: AnalysisResult, states: Map<string, RecommendationStatus>): string;
707
+
708
+ /**
709
+ * Load the recommendation state from disk.
710
+ * Returns an empty state when the file does not exist.
711
+ */
712
+ declare function loadState(): Promise<RecommendationState>;
713
+ /**
714
+ * Save the recommendation state atomically to disk.
715
+ */
716
+ declare function saveState(state: RecommendationState): Promise<void>;
717
+ /**
718
+ * Update the status of a recommendation by ID.
719
+ * Creates a new entry if the ID is not found.
720
+ */
721
+ declare function updateStatus(id: string, status: RecommendationStatus, details?: string): Promise<void>;
722
+ /**
723
+ * Get a Map of recommendation ID to status for quick lookups.
724
+ */
725
+ declare function getStatusMap(): Promise<Map<string, RecommendationStatus>>;
726
+
727
+ interface RotatorConfig {
728
+ maxRecommendationsInFile: number;
729
+ archiveAfterDays: number;
730
+ }
731
+ /**
732
+ * Rotate old applied/dismissed recommendations to archive files.
733
+ * Pending entries are never archived regardless of age.
734
+ */
735
+ declare function rotateRecommendations(config: RotatorConfig): Promise<void>;
736
+
737
+ /**
738
+ * Build a one-line notification string referencing /evolve:apply.
739
+ * Output is always under 200 characters (well under 200 tokens).
740
+ */
741
+ declare function buildNotification(pendingCount: number): string;
742
+ /**
743
+ * Write the notification flag file with the pending recommendation count.
744
+ * The UserPromptSubmit hook reads this flag to decide whether to inject a notification.
745
+ */
746
+ declare function writeNotificationFlag(pendingCount: number): Promise<void>;
747
+ /**
748
+ * Check whether a notification flag file exists.
749
+ */
750
+ declare function hasNotificationFlag(): Promise<boolean>;
751
+ /**
752
+ * Remove the notification flag file.
753
+ * Does not throw when the flag file does not exist.
754
+ */
755
+ declare function clearNotificationFlag(): Promise<void>;
756
+ /**
757
+ * Read the pending count from the notification flag file.
758
+ * Returns 0 if the file cannot be read or parsed.
759
+ */
760
+ declare function readNotificationFlagCount(): Promise<number>;
761
+
762
+ interface ApplierOptions {
763
+ /** Override settings.json path (used in testing) */
764
+ settingsPath?: string;
765
+ /** Override rules directory (used in testing) */
766
+ rulesDir?: string;
767
+ /** Override hooks directory (used in testing) */
768
+ hooksDir?: string;
769
+ /** Override CLAUDE.md path (used in testing) */
770
+ claudeMdPath?: string;
771
+ }
772
+ interface Applier {
773
+ readonly target: string;
774
+ canApply(rec: Recommendation): boolean;
775
+ apply(rec: Recommendation, options?: ApplierOptions): Promise<AutoApplyResult>;
776
+ }
777
+
778
+ interface AutoApplyResult {
779
+ recommendation_id: string;
780
+ success: boolean;
781
+ details: string;
782
+ }
783
+ interface AutoApplyOptions extends ApplierOptions {
784
+ }
785
+ /**
786
+ * Auto-apply HIGH-confidence recommendations when fullAuto is enabled.
787
+ * Returns an empty array when fullAuto is false (default, per QUA-01).
788
+ *
789
+ * Dispatches to the appropriate Applier based on rec.target via the
790
+ * applier registry. Only processes recommendations whose target has a
791
+ * registered applier and whose applier.canApply() returns true.
792
+ */
793
+ declare function autoApplyRecommendations(recommendations: Recommendation[], options?: AutoApplyOptions): Promise<AutoApplyResult[]>;
794
+
795
+ declare function computeExperienceLevel(snapshot: EnvironmentSnapshot): ExperienceLevel;
796
+
797
+ /**
798
+ * Classify onboarding needs based on user experience tier.
799
+ *
800
+ * Newcomer (score=0): Up to 3 MEDIUM-confidence "start here" recommendations
801
+ * for missing hooks, rules, and CLAUDE.md.
802
+ *
803
+ * Power user (score>=30): 1 LOW-confidence "optimize" recommendation
804
+ * suggesting consolidation review.
805
+ *
806
+ * Intermediate (1-29): No recommendations (existing classifiers handle
807
+ * pattern-specific suggestions).
808
+ */
809
+ declare function classifyOnboarding(_summary: Summary, snapshot: EnvironmentSnapshot, _config: AnalysisConfig): Recommendation[];
810
+
811
+ /**
812
+ * Track outcomes for all applied recommendations by checking their
813
+ * persistence in the current environment snapshot.
814
+ *
815
+ * For each applied recommendation:
816
+ * 1. Check if the change still exists in the environment
817
+ * 2. Determine outcome: positive (persisted 5+ checks), negative (reverted),
818
+ * or monitoring (persisted but < 5 checks)
819
+ * 3. Append outcome entry to JSONL history
820
+ *
821
+ * @param snapshot - Current environment snapshot
822
+ * @returns Array of outcome entries for all applied recommendations
823
+ */
824
+ declare function trackOutcomes(snapshot: EnvironmentSnapshot): Promise<OutcomeEntry[]>;
825
+ /**
826
+ * Load outcome history from the JSONL file.
827
+ * Returns empty array when the file does not exist.
828
+ * Silently skips invalid or malformed lines.
829
+ */
830
+ declare function loadOutcomeHistory(): Promise<OutcomeEntry[]>;
831
+ /**
832
+ * Compute outcome summaries grouped by pattern_type.
833
+ * For each group: counts unique recommendation_ids, tallies positive
834
+ * (persisted) and negative (reverted) outcomes, and computes
835
+ * persistence_rate = persisted / total_applied.
836
+ *
837
+ * Uses the latest outcome per recommendation_id for determination.
838
+ */
839
+ declare function computeOutcomeSummaries(history: OutcomeEntry[]): OutcomeSummary[];
840
+
841
+ declare const scanContextSchema: z.ZodObject<{
842
+ generated_at: z.ZodISODateTime;
843
+ project_root: z.ZodString;
844
+ claude_md_files: z.ZodArray<z.ZodObject<{
845
+ path: z.ZodString;
846
+ scope: z.ZodEnum<{
847
+ user: "user";
848
+ project: "project";
849
+ local: "local";
850
+ }>;
851
+ content: z.ZodString;
852
+ line_count: z.ZodNumber;
853
+ headings: z.ZodArray<z.ZodString>;
854
+ references: z.ZodArray<z.ZodString>;
855
+ }, z.core.$strip>>;
856
+ rules: z.ZodArray<z.ZodObject<{
857
+ path: z.ZodString;
858
+ filename: z.ZodString;
859
+ content: z.ZodString;
860
+ frontmatter: z.ZodOptional<z.ZodObject<{
861
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
862
+ }, z.core.$strip>>;
863
+ headings: z.ZodArray<z.ZodString>;
864
+ }, z.core.$strip>>;
865
+ settings: z.ZodObject<{
866
+ user: z.ZodNullable<z.ZodUnknown>;
867
+ project: z.ZodNullable<z.ZodUnknown>;
868
+ local: z.ZodNullable<z.ZodUnknown>;
869
+ }, z.core.$strip>;
870
+ commands: z.ZodArray<z.ZodObject<{
871
+ path: z.ZodString;
872
+ name: z.ZodString;
873
+ content: z.ZodString;
874
+ }, z.core.$strip>>;
875
+ hooks_registered: z.ZodArray<z.ZodObject<{
876
+ event: z.ZodString;
877
+ scope: z.ZodEnum<{
878
+ user: "user";
879
+ project: "project";
880
+ local: "local";
881
+ }>;
882
+ type: z.ZodString;
883
+ command: z.ZodOptional<z.ZodString>;
884
+ }, z.core.$strip>>;
885
+ }, z.core.$strip>;
886
+ type ScanContext = z.infer<typeof scanContextSchema>;
887
+
888
+ type Scanner = (context: ScanContext) => Recommendation[] | Promise<Recommendation[]>;
889
+
890
+ interface ScanResult {
891
+ generated_at: string;
892
+ scan_context: ScanContext;
893
+ recommendations: Recommendation[];
894
+ }
895
+ /**
896
+ * Run a deep scan of Claude Code configuration at the given directory.
897
+ * Reads all config files into a ScanContext, then runs all registered
898
+ * scanners to detect quality issues. Returns merged recommendations.
899
+ *
900
+ * Errors in individual scanners are caught and logged, not propagated.
901
+ * An empty recommendations array means no issues detected.
902
+ */
903
+ declare function runDeepScan(cwd: string, home?: string): Promise<ScanResult>;
904
+
905
+ /**
906
+ * Build a complete ScanContext by reading all configuration sources.
907
+ * Returns a validated ScanContext or throws if validation fails.
908
+ *
909
+ * @param cwd - Project root directory
910
+ * @param home - User home directory (defaults to process.env.HOME)
911
+ */
912
+ declare function buildScanContext(cwd: string, home?: string): Promise<ScanContext>;
913
+
914
+ /**
915
+ * Scan for redundant configuration: duplicate headings across CLAUDE.md
916
+ * and rules, and duplicate rule files with matching heading sets.
917
+ */
918
+ declare function scanRedundancy(context: ScanContext): Recommendation[];
919
+
920
+ /**
921
+ * Scan for operations described in text that should be enforced via hooks.
922
+ * Skips patterns that are already covered by a registered hook for the
923
+ * corresponding event type.
924
+ */
925
+ declare function scanMechanization(context: ScanContext): Recommendation[];
926
+
927
+ /**
928
+ * Scan for stale references: broken @references in CLAUDE.md files and
929
+ * hook commands pointing to non-existent scripts.
930
+ *
931
+ * This scanner is async because it needs to check the filesystem for
932
+ * reference targets not present in the ScanContext.
933
+ */
934
+ declare function scanStaleness(context: ScanContext): Promise<Recommendation[]>;
935
+
936
+ declare const GENERATOR_VERSION = "1.0.0";
937
+ declare const generatedArtifactSchema: z.ZodObject<{
938
+ type: z.ZodEnum<{
939
+ skill: "skill";
940
+ hook: "hook";
941
+ claude_md_patch: "claude_md_patch";
942
+ }>;
943
+ filename: z.ZodString;
944
+ content: z.ZodString;
945
+ source_recommendation_id: z.ZodString;
946
+ metadata: z.ZodObject<{
947
+ generated_at: z.ZodISODateTime;
948
+ generator_version: z.ZodString;
949
+ pattern_type: z.ZodString;
950
+ }, z.core.$strip>;
951
+ }, z.core.$strip>;
952
+ type GeneratedArtifact = z.infer<typeof generatedArtifactSchema>;
953
+ interface GeneratorOptions {
954
+ projectRoot?: string;
955
+ }
956
+
957
+ /**
958
+ * Generate a skill file draft from a long_prompt SKILL recommendation.
959
+ *
960
+ * @param rec - A Recommendation object (typically from the long-prompts classifier)
961
+ * @returns GeneratedArtifact with type 'skill', or null if the recommendation
962
+ * is not applicable (wrong target or pattern_type)
963
+ */
964
+ declare function generateSkill(rec: Recommendation): GeneratedArtifact | null;
965
+
966
+ /**
967
+ * Generate a bash hook script draft from a HOOK-targeted recommendation.
968
+ *
969
+ * @param rec - A Recommendation object (from mechanization scanner or repeated-prompts classifier)
970
+ * @returns GeneratedArtifact with type 'hook', or null if the recommendation
971
+ * is not applicable (wrong target)
972
+ */
973
+ declare function generateHook(rec: Recommendation): GeneratedArtifact | null;
974
+
975
+ /**
976
+ * Generate a CLAUDE.md patch from a CLAUDE_MD-targeted recommendation.
977
+ *
978
+ * @param rec - A Recommendation object (from deep scan or analysis classifiers)
979
+ * @returns GeneratedArtifact with type 'claude_md_patch', or null if the
980
+ * recommendation is not applicable (wrong target)
981
+ */
982
+ declare function generateClaudeMdPatch(rec: Recommendation): GeneratedArtifact | null;
983
+
984
+ declare class HookApplier implements Applier {
985
+ readonly target = "HOOK";
986
+ canApply(rec: Recommendation): boolean;
987
+ apply(rec: Recommendation, options?: ApplierOptions): Promise<AutoApplyResult>;
988
+ }
989
+
990
+ declare class ClaudeMdApplier implements Applier {
991
+ readonly target = "CLAUDE_MD";
992
+ canApply(rec: Recommendation): boolean;
993
+ apply(rec: Recommendation, options?: ApplierOptions): Promise<AutoApplyResult>;
994
+ }
995
+
996
+ /**
997
+ * Register the 'scan' subcommand on a Commander.js program.
998
+ *
999
+ * Runs a full deep configuration scan (CLAUDE.md, rules, settings, hooks)
1000
+ * and outputs the results as structured JSON to stdout. The output omits
1001
+ * scan_context to keep it concise for slash command consumers.
1002
+ */
1003
+ declare function registerScanCommand(program: Command): void;
1004
+
1005
+ /**
1006
+ * Register the 'pending' subcommand on a Commander.js program.
1007
+ *
1008
+ * Reads the analysis result and recommendation state, filters to
1009
+ * recommendations that are not yet applied or dismissed, and outputs
1010
+ * the pending list as structured JSON.
1011
+ */
1012
+ declare function registerPendingCommand(program: Command): void;
1013
+ /**
1014
+ * Register the 'apply-one' subcommand on a Commander.js program.
1015
+ *
1016
+ * Loads the recommendation by ID from analysis result, finds the correct
1017
+ * applier from the registry, applies the recommendation, logs the attempt,
1018
+ * and updates the recommendation status on success.
1019
+ */
1020
+ declare function registerApplyOneCommand(program: Command): void;
1021
+ /**
1022
+ * Register the 'dismiss' subcommand on a Commander.js program.
1023
+ *
1024
+ * Permanently dismisses a recommendation by updating its status to 'dismissed'.
1025
+ * Outputs JSON confirmation with the recommendation ID and status.
1026
+ */
1027
+ declare function registerDismissCommand(program: Command): void;
1028
+
1029
+ export { type AnalysisConfig, type AnalysisResult, type AutoApplyLogEntry, type Classifier, ClaudeMdApplier, type Confidence, type Config, type Counter, type EnvironmentSnapshot, type ExperienceLevel, type ExperienceTier, GENERATOR_VERSION, type GeneratedArtifact, type GeneratorOptions, HookApplier, type HookCommon, type LogType, type OutcomeEntry, type OutcomeSummary, type PermissionEntry, type PermissionRequestInput, type PostToolUseFailureInput, type PostToolUseInput, type PreToolUseInput, type PromptEntry, type Recommendation, type RecommendationState, type RecommendationStateEntry, type RecommendationStatus, type RoutingTarget, SCRUB_PATTERNS, type ScanContext, type ScanResult, type Scanner, type ScrubPattern, type SessionEntry, type StopInput, type Summary, type ToolEntry, type UserPromptSubmitInput, adjustConfidence, analysisConfigSchema, analysisResultSchema, analyze, appendLogEntry, autoApplyLogEntrySchema, autoApplyRecommendations, buildNotification, buildScanContext, checkAndTriggerAnalysis, classifyOnboarding, clearNotificationFlag, computeExperienceLevel, computeOutcomeSummaries, confidenceSchema, configSchema, counterSchema, ensureInit, environmentSnapshotSchema, experienceLevelSchema, experienceTierSchema, generateClaudeMdPatch, generateHook, generateSkill, generatedArtifactSchema, getStatusMap, hasNotificationFlag, hookCommonSchema, incrementCounter, loadConfig, loadOutcomeHistory, loadState, outcomeEntrySchema, outcomeSummarySchema, paths, permissionEntrySchema, permissionRequestInputSchema, postToolUseFailureInputSchema, postToolUseInputSchema, preProcess, preToolUseInputSchema, promptEntrySchema, readCounter, readFromStream, readLogEntries, readNotificationFlagCount, readStdin, recommendationSchema, recommendationStateEntrySchema, recommendationStateSchema, recommendationStatusSchema, registerApplyOneCommand, registerDismissCommand, registerPendingCommand, registerScanCommand, renderRecommendations, resetCounter, rotateRecommendations, routingTargetSchema, runAnalysis, runDeepScan, saveState, scanContextSchema, scanEnvironment, scanMechanization, scanRedundancy, scanStaleness, scrubObject, scrubString, sessionEntrySchema, stopInputSchema, summarizeToolInput, summarySchema, toolEntrySchema, trackOutcomes, updateStatus, userPromptSubmitInputSchema, writeAnalysisResult, writeNotificationFlag };