pi-continuous-learning 0.6.0 → 0.8.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 (93) hide show
  1. package/README.md +78 -0
  2. package/dist/agents-md.d.ts +23 -2
  3. package/dist/agents-md.d.ts.map +1 -1
  4. package/dist/agents-md.js +58 -3
  5. package/dist/agents-md.js.map +1 -1
  6. package/dist/analysis-event-log.d.ts +50 -0
  7. package/dist/analysis-event-log.d.ts.map +1 -0
  8. package/dist/analysis-event-log.js +120 -0
  9. package/dist/analysis-event-log.js.map +1 -0
  10. package/dist/analysis-notification.d.ts +20 -0
  11. package/dist/analysis-notification.d.ts.map +1 -0
  12. package/dist/analysis-notification.js +63 -0
  13. package/dist/analysis-notification.js.map +1 -0
  14. package/dist/cli/analyze-single-shot.d.ts +20 -2
  15. package/dist/cli/analyze-single-shot.d.ts.map +1 -1
  16. package/dist/cli/analyze-single-shot.js +109 -5
  17. package/dist/cli/analyze-single-shot.js.map +1 -1
  18. package/dist/cli/analyze.js +132 -16
  19. package/dist/cli/analyze.js.map +1 -1
  20. package/dist/command-scaffold.d.ts +25 -0
  21. package/dist/command-scaffold.d.ts.map +1 -0
  22. package/dist/command-scaffold.js +77 -0
  23. package/dist/command-scaffold.js.map +1 -0
  24. package/dist/confidence.d.ts +12 -1
  25. package/dist/confidence.d.ts.map +1 -1
  26. package/dist/confidence.js +37 -9
  27. package/dist/confidence.js.map +1 -1
  28. package/dist/config.d.ts +16 -0
  29. package/dist/config.d.ts.map +1 -1
  30. package/dist/config.js +31 -0
  31. package/dist/config.js.map +1 -1
  32. package/dist/graduation.d.ts +63 -0
  33. package/dist/graduation.d.ts.map +1 -0
  34. package/dist/graduation.js +155 -0
  35. package/dist/graduation.js.map +1 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +7 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/instinct-cleanup.d.ts +57 -0
  40. package/dist/instinct-cleanup.d.ts.map +1 -0
  41. package/dist/instinct-cleanup.js +150 -0
  42. package/dist/instinct-cleanup.js.map +1 -0
  43. package/dist/instinct-graduate.d.ts +43 -0
  44. package/dist/instinct-graduate.d.ts.map +1 -0
  45. package/dist/instinct-graduate.js +253 -0
  46. package/dist/instinct-graduate.js.map +1 -0
  47. package/dist/instinct-parser.d.ts.map +1 -1
  48. package/dist/instinct-parser.js +18 -0
  49. package/dist/instinct-parser.js.map +1 -1
  50. package/dist/instinct-tools.d.ts.map +1 -1
  51. package/dist/instinct-tools.js +19 -0
  52. package/dist/instinct-tools.js.map +1 -1
  53. package/dist/instinct-validator.d.ts +61 -0
  54. package/dist/instinct-validator.d.ts.map +1 -0
  55. package/dist/instinct-validator.js +235 -0
  56. package/dist/instinct-validator.js.map +1 -0
  57. package/dist/observation-signal.d.ts +34 -0
  58. package/dist/observation-signal.d.ts.map +1 -0
  59. package/dist/observation-signal.js +66 -0
  60. package/dist/observation-signal.js.map +1 -0
  61. package/dist/prompts/analyzer-system-single-shot.d.ts.map +1 -1
  62. package/dist/prompts/analyzer-system-single-shot.js +82 -3
  63. package/dist/prompts/analyzer-system-single-shot.js.map +1 -1
  64. package/dist/prompts/analyzer-user-single-shot.d.ts.map +1 -1
  65. package/dist/prompts/analyzer-user-single-shot.js +5 -3
  66. package/dist/prompts/analyzer-user-single-shot.js.map +1 -1
  67. package/dist/skill-scaffold.d.ts +23 -0
  68. package/dist/skill-scaffold.d.ts.map +1 -0
  69. package/dist/skill-scaffold.js +62 -0
  70. package/dist/skill-scaffold.js.map +1 -0
  71. package/dist/types.d.ts +9 -0
  72. package/dist/types.d.ts.map +1 -1
  73. package/package.json +1 -1
  74. package/src/agents-md.ts +73 -3
  75. package/src/analysis-event-log.ts +171 -0
  76. package/src/analysis-notification.ts +79 -0
  77. package/src/cli/analyze-single-shot.ts +131 -5
  78. package/src/cli/analyze.ts +157 -15
  79. package/src/command-scaffold.ts +105 -0
  80. package/src/confidence.ts +35 -8
  81. package/src/config.ts +40 -0
  82. package/src/graduation.ts +243 -0
  83. package/src/index.ts +16 -0
  84. package/src/instinct-cleanup.ts +204 -0
  85. package/src/instinct-graduate.ts +377 -0
  86. package/src/instinct-parser.ts +18 -0
  87. package/src/instinct-tools.ts +26 -0
  88. package/src/instinct-validator.ts +287 -0
  89. package/src/observation-signal.ts +80 -0
  90. package/src/prompts/analyzer-system-single-shot.ts +82 -3
  91. package/src/prompts/analyzer-user-single-shot.ts +11 -2
  92. package/src/skill-scaffold.ts +90 -0
  93. package/src/types.ts +11 -0
package/README.md CHANGED
@@ -57,6 +57,7 @@ To analyze observations and create/update instincts, you need to run the analyze
57
57
  | `/instinct-export` | Export instincts to a JSON file (filterable by scope/domain) |
58
58
  | `/instinct-import <path>` | Import instincts from a JSON file |
59
59
  | `/instinct-promote [id]` | Promote project instincts to global scope |
60
+ | `/instinct-graduate` | Graduate mature instincts to AGENTS.md, skills, or commands |
60
61
  | `/instinct-projects` | List all known projects and their instinct counts |
61
62
 
62
63
  ### LLM Tools
@@ -244,6 +245,46 @@ inactive_count: 12
244
245
  Always search with grep to find relevant context before editing files.
245
246
  ```
246
247
 
248
+ Graduated instincts include additional fields:
249
+
250
+ ```yaml
251
+ ---
252
+ id: grep-before-edit
253
+ # ...other fields...
254
+ graduated_to: agents-md
255
+ graduated_at: "2026-03-27T12:00:00.000Z"
256
+ ---
257
+ ```
258
+
259
+ ## Instinct Quality Control
260
+
261
+ Every instinct write (from the LLM tools or the background analyzer) is validated and deduplicated before being saved.
262
+
263
+ ### Content Validation
264
+
265
+ | Rule | Details |
266
+ |---|---|
267
+ | Non-empty fields | `action` and `trigger` cannot be `undefined`, `null`, `"null"`, `"none"`, or empty |
268
+ | Minimum length | Both fields must be >= 10 characters |
269
+ | Known domain | `domain` must be in the known set: `git`, `testing`, `debugging`, `workflow`, `typescript`, `javascript`, `python`, `go`, `css`, `design`, `security`, `performance`, `documentation`, `react`, `node`, `database`, `api`, `devops`, `architecture`, or `other` |
270
+ | Verb heuristic | `action` should start with an imperative verb - a warning is logged but the write is not rejected |
271
+
272
+ ### Semantic Deduplication
273
+
274
+ Before a new instinct is created, a Jaccard similarity check runs against all existing instincts. Tokenize `trigger + action`, compute `|intersection| / |union|`, and block the write if any existing instinct scores >= 0.6.
275
+
276
+ This prevents near-duplicate instincts from accumulating. When a similar instinct exists, the LLM is told to update the existing one instead.
277
+
278
+ ### Analyzer Quality Tiers
279
+
280
+ The background analyzer is instructed to classify patterns before recording them:
281
+
282
+ - **Project Conventions** (Tier 1): Project-specific patterns like "use Result<T,E> for errors in this codebase" → record as project-scoped instinct
283
+ - **Workflow Patterns** (Tier 2): Universal multi-step workflows → record as global-scoped instinct
284
+ - **Generic Agent Behavior** (Tier 3): Read-before-edit, clarify-before-implement, check-errors-after-tool-calls → **skip entirely**, these are fundamental behaviors not learned patterns
285
+
286
+ The analyzer also checks AGENTS.md content before creating instincts - if a pattern is already covered by AGENTS.md, it is skipped.
287
+
247
288
  ## Confidence Scoring
248
289
 
249
290
  Confidence comes from two sources:
@@ -263,6 +304,39 @@ Confidence comes from two sources:
263
304
 
264
305
  This means an instinct observed 20 times but consistently contradicted in practice will lose confidence. Frequency alone doesn't equal correctness.
265
306
 
307
+ ## Instinct Graduation
308
+
309
+ Instincts are designed to be short-lived - they should graduate into permanent knowledge within a few weeks. The graduation pipeline (`/instinct-graduate`) handles this lifecycle:
310
+
311
+ ```
312
+ Observation -> Instinct (days) -> AGENTS.md / Skill / Command (1-2 weeks)
313
+ ```
314
+
315
+ ### Graduation Targets
316
+
317
+ | Target | When | What happens |
318
+ |--------|------|--------------|
319
+ | **AGENTS.md** | Single mature instinct | Appended as a guideline entry to your project or global AGENTS.md |
320
+ | **Skill** | 3+ related instincts in the same domain | Scaffolded into a `SKILL.md` file |
321
+ | **Command** | 3+ workflow instincts in the same domain | Scaffolded into a slash command specification |
322
+
323
+ ### Maturity Criteria
324
+
325
+ An instinct qualifies for graduation when all of these are met:
326
+ - Age >= 7 days
327
+ - Confidence >= 0.75
328
+ - Confirmed >= 3 times
329
+ - Contradicted <= 1 time
330
+ - Not a duplicate of existing AGENTS.md content
331
+
332
+ ### TTL Enforcement
333
+
334
+ Instincts that don't graduate within 28 days are subject to TTL enforcement:
335
+ - **Confidence < 0.3**: Deleted outright
336
+ - **Confidence >= 0.3**: Aggressively decayed (confidence halved, flagged for removal)
337
+
338
+ Graduated instincts are tracked with `graduated_to` and `graduated_at` fields so they aren't left as duplicates of the knowledge they graduated into.
339
+
266
340
  ## Updating
267
341
 
268
342
  ```bash
@@ -296,12 +370,16 @@ Only include the fields you want to change — missing fields use the defaults a
296
370
 
297
371
  | Field | Default | Description |
298
372
  |-------|---------|-------------|
373
+ | `run_interval_minutes` | 5 | How often the analyzer is expected to run (informational, used for decay calculations) |
299
374
  | `min_observations_to_analyze` | 20 | Minimum observations before analysis triggers |
300
375
  | `min_confidence` | 0.5 | Instincts below this are not injected into prompts |
301
376
  | `max_instincts` | 20 | Maximum instincts injected per turn |
302
377
  | `max_injection_chars` | 4000 | Character budget for the injection block (~1000 tokens) |
303
378
  | `model` | `claude-haiku-4-5` | Model for the background analyzer (lightweight models recommended to minimize cost) |
304
379
  | `timeout_seconds` | 120 | Per-project timeout for the analyzer LLM session |
380
+ | `active_hours_start` | 8 | Hour (0-23) at which the active observation window starts |
381
+ | `active_hours_end` | 23 | Hour (0-23) at which the active observation window ends |
382
+ | `max_idle_seconds` | 1800 | Seconds of inactivity before a session is considered idle |
305
383
  | `log_path` | `~/.pi/continuous-learning/analyzer.log` | Path to the analyzer log file |
306
384
 
307
385
  ## Storage
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Utility for reading AGENTS.md files.
3
- * Provides a safe wrapper around filesystem access that returns null on any failure.
2
+ * Utility for reading and writing AGENTS.md files.
3
+ * Provides safe wrappers around filesystem access.
4
4
  */
5
+ import type { Instinct } from "./types.js";
5
6
  /**
6
7
  * Reads an AGENTS.md file and returns its content.
7
8
  * Returns null if the file does not exist or cannot be read.
@@ -9,4 +10,24 @@
9
10
  * @param filePath - Absolute path to the AGENTS.md file
10
11
  */
11
12
  export declare function readAgentsMd(filePath: string): string | null;
13
+ /**
14
+ * Formats an instinct as an AGENTS.md section entry.
15
+ * Produces a markdown block with the instinct title as heading and
16
+ * trigger/action as content.
17
+ */
18
+ export declare function formatInstinctAsAgentsMdEntry(instinct: Instinct): string;
19
+ /**
20
+ * Generates a complete AGENTS.md diff showing proposed additions.
21
+ * Returns the full new content that would result from appending the entries.
22
+ */
23
+ export declare function generateAgentsMdDiff(currentContent: string | null, instincts: Instinct[]): string;
24
+ /**
25
+ * Appends graduated instinct entries to an AGENTS.md file.
26
+ * Creates the file and parent directories if they don't exist.
27
+ *
28
+ * @param filePath - Absolute path to AGENTS.md
29
+ * @param instincts - Instincts to append as entries
30
+ * @returns The new file content that was written
31
+ */
32
+ export declare function appendToAgentsMd(filePath: string, instincts: Instinct[]): string;
12
33
  //# sourceMappingURL=agents-md.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md.d.ts","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5D"}
1
+ {"version":3,"file":"agents-md.d.ts","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5D;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAUxE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,SAAS,EAAE,QAAQ,EAAE,GACpB,MAAM,CAmBR;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,QAAQ,EAAE,GACpB,MAAM,CAUR"}
package/dist/agents-md.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
- * Utility for reading AGENTS.md files.
3
- * Provides a safe wrapper around filesystem access that returns null on any failure.
2
+ * Utility for reading and writing AGENTS.md files.
3
+ * Provides safe wrappers around filesystem access.
4
4
  */
5
- import { existsSync, readFileSync } from "node:fs";
5
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
6
+ import { dirname } from "node:path";
6
7
  /**
7
8
  * Reads an AGENTS.md file and returns its content.
8
9
  * Returns null if the file does not exist or cannot be read.
@@ -20,4 +21,58 @@ export function readAgentsMd(filePath) {
20
21
  return null;
21
22
  }
22
23
  }
24
+ /**
25
+ * Formats an instinct as an AGENTS.md section entry.
26
+ * Produces a markdown block with the instinct title as heading and
27
+ * trigger/action as content.
28
+ */
29
+ export function formatInstinctAsAgentsMdEntry(instinct) {
30
+ const lines = [
31
+ `### ${instinct.title}`,
32
+ "",
33
+ `**When:** ${instinct.trigger}`,
34
+ "",
35
+ instinct.action,
36
+ "",
37
+ ];
38
+ return lines.join("\n");
39
+ }
40
+ /**
41
+ * Generates a complete AGENTS.md diff showing proposed additions.
42
+ * Returns the full new content that would result from appending the entries.
43
+ */
44
+ export function generateAgentsMdDiff(currentContent, instincts) {
45
+ const entries = instincts.map(formatInstinctAsAgentsMdEntry);
46
+ const graduatedSection = [
47
+ "",
48
+ "## Graduated Instincts",
49
+ "",
50
+ ...entries,
51
+ ].join("\n");
52
+ if (currentContent === null || currentContent.trim().length === 0) {
53
+ return `# Project Guidelines\n${graduatedSection}\n`;
54
+ }
55
+ // If the section already exists, append to it; otherwise add a new section
56
+ if (currentContent.includes("## Graduated Instincts")) {
57
+ return `${currentContent.trimEnd()}\n\n${entries.join("\n")}\n`;
58
+ }
59
+ return `${currentContent.trimEnd()}\n${graduatedSection}\n`;
60
+ }
61
+ /**
62
+ * Appends graduated instinct entries to an AGENTS.md file.
63
+ * Creates the file and parent directories if they don't exist.
64
+ *
65
+ * @param filePath - Absolute path to AGENTS.md
66
+ * @param instincts - Instincts to append as entries
67
+ * @returns The new file content that was written
68
+ */
69
+ export function appendToAgentsMd(filePath, instincts) {
70
+ if (instincts.length === 0)
71
+ return readAgentsMd(filePath) ?? "";
72
+ const currentContent = readAgentsMd(filePath);
73
+ const newContent = generateAgentsMdDiff(currentContent, instincts);
74
+ mkdirSync(dirname(filePath), { recursive: true });
75
+ writeFileSync(filePath, newContent, "utf-8");
76
+ return newContent;
77
+ }
23
78
  //# sourceMappingURL=agents-md.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC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;QAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEhE,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,oBAAoB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAEnE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Append-only analysis event log with atomic rename for safe consumption.
3
+ *
4
+ * The background analyzer appends events to `analysis-events.jsonl`.
5
+ * The extension consumes events by atomically renaming the file to
6
+ * `.consumed`, reading it, then deleting it. On POSIX, rename is atomic -
7
+ * any in-flight appends follow the inode to the renamed file.
8
+ *
9
+ * Multiple analyzer runs can append before the extension reads. No events
10
+ * are lost because each run only appends; the file is never truncated by
11
+ * the analyzer.
12
+ */
13
+ export interface InstinctChangeSummary {
14
+ readonly id: string;
15
+ readonly title: string;
16
+ readonly scope: "project" | "global";
17
+ readonly trigger?: string;
18
+ readonly action?: string;
19
+ readonly confidence_delta?: number;
20
+ }
21
+ export interface AnalysisEvent {
22
+ readonly timestamp: string;
23
+ readonly project_id: string;
24
+ readonly project_name: string;
25
+ readonly created: readonly InstinctChangeSummary[];
26
+ readonly updated: readonly InstinctChangeSummary[];
27
+ readonly deleted: readonly InstinctChangeSummary[];
28
+ }
29
+ export declare function getEventsPath(projectId: string, baseDir?: string): string;
30
+ export declare function getConsumedPath(projectId: string, baseDir?: string): string;
31
+ /**
32
+ * Appends an analysis event to the project's event log.
33
+ * Skips writing if nothing changed (all arrays empty).
34
+ * Creates the parent directory if needed.
35
+ */
36
+ export declare function appendAnalysisEvent(event: AnalysisEvent, baseDir?: string): void;
37
+ /**
38
+ * Atomically consumes all pending analysis events for a project.
39
+ *
40
+ * Strategy:
41
+ * 1. Check for orphaned `.consumed` file from a prior crash - read it first
42
+ * 2. Rename `analysis-events.jsonl` to `.consumed` (atomic on POSIX)
43
+ * 3. Read and parse all lines from `.consumed`
44
+ * 4. Delete `.consumed`
45
+ *
46
+ * Returns an empty array if no events exist or rename fails (e.g. file
47
+ * doesn't exist, or another consumer raced us).
48
+ */
49
+ export declare function consumeAnalysisEvents(projectId: string, baseDir?: string): readonly AnalysisEvent[];
50
+ //# sourceMappingURL=analysis-event-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-event-log.d.ts","sourceRoot":"","sources":["../src/analysis-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD;AAMD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3E;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAYhF;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,SAAS,aAAa,EAAE,CA8B1B"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Append-only analysis event log with atomic rename for safe consumption.
3
+ *
4
+ * The background analyzer appends events to `analysis-events.jsonl`.
5
+ * The extension consumes events by atomically renaming the file to
6
+ * `.consumed`, reading it, then deleting it. On POSIX, rename is atomic -
7
+ * any in-flight appends follow the inode to the renamed file.
8
+ *
9
+ * Multiple analyzer runs can append before the extension reads. No events
10
+ * are lost because each run only appends; the file is never truncated by
11
+ * the analyzer.
12
+ */
13
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, } from "node:fs";
14
+ import { dirname, join } from "node:path";
15
+ import { getProjectDir } from "./storage.js";
16
+ // ---------------------------------------------------------------------------
17
+ // Constants
18
+ // ---------------------------------------------------------------------------
19
+ const EVENTS_FILENAME = "analysis-events.jsonl";
20
+ const CONSUMED_FILENAME = "analysis-events.consumed";
21
+ // ---------------------------------------------------------------------------
22
+ // Paths
23
+ // ---------------------------------------------------------------------------
24
+ export function getEventsPath(projectId, baseDir) {
25
+ return join(getProjectDir(projectId, baseDir), EVENTS_FILENAME);
26
+ }
27
+ export function getConsumedPath(projectId, baseDir) {
28
+ return join(getProjectDir(projectId, baseDir), CONSUMED_FILENAME);
29
+ }
30
+ // ---------------------------------------------------------------------------
31
+ // Write (analyzer side)
32
+ // ---------------------------------------------------------------------------
33
+ /**
34
+ * Appends an analysis event to the project's event log.
35
+ * Skips writing if nothing changed (all arrays empty).
36
+ * Creates the parent directory if needed.
37
+ */
38
+ export function appendAnalysisEvent(event, baseDir) {
39
+ if (event.created.length === 0 &&
40
+ event.updated.length === 0 &&
41
+ event.deleted.length === 0) {
42
+ return;
43
+ }
44
+ const eventsPath = getEventsPath(event.project_id, baseDir);
45
+ mkdirSync(dirname(eventsPath), { recursive: true });
46
+ appendFileSync(eventsPath, JSON.stringify(event) + "\n", "utf-8");
47
+ }
48
+ // ---------------------------------------------------------------------------
49
+ // Read and clear (extension side)
50
+ // ---------------------------------------------------------------------------
51
+ /**
52
+ * Atomically consumes all pending analysis events for a project.
53
+ *
54
+ * Strategy:
55
+ * 1. Check for orphaned `.consumed` file from a prior crash - read it first
56
+ * 2. Rename `analysis-events.jsonl` to `.consumed` (atomic on POSIX)
57
+ * 3. Read and parse all lines from `.consumed`
58
+ * 4. Delete `.consumed`
59
+ *
60
+ * Returns an empty array if no events exist or rename fails (e.g. file
61
+ * doesn't exist, or another consumer raced us).
62
+ */
63
+ export function consumeAnalysisEvents(projectId, baseDir) {
64
+ const eventsPath = getEventsPath(projectId, baseDir);
65
+ const consumedPath = getConsumedPath(projectId, baseDir);
66
+ const allEvents = [];
67
+ // Step 1: recover orphaned consumed file from prior crash
68
+ if (existsSync(consumedPath)) {
69
+ allEvents.push(...parseEventsFile(consumedPath));
70
+ safeUnlink(consumedPath);
71
+ }
72
+ // Step 2: atomically rename the events file
73
+ if (existsSync(eventsPath)) {
74
+ try {
75
+ renameSync(eventsPath, consumedPath);
76
+ }
77
+ catch {
78
+ // Rename failed (race with another consumer, or OS issue).
79
+ // Return whatever we recovered from step 1.
80
+ return allEvents;
81
+ }
82
+ // Step 3: read the renamed file
83
+ allEvents.push(...parseEventsFile(consumedPath));
84
+ // Step 4: delete consumed file
85
+ safeUnlink(consumedPath);
86
+ }
87
+ return allEvents;
88
+ }
89
+ // ---------------------------------------------------------------------------
90
+ // Helpers
91
+ // ---------------------------------------------------------------------------
92
+ function parseEventsFile(filePath) {
93
+ const events = [];
94
+ try {
95
+ const content = readFileSync(filePath, "utf-8");
96
+ const lines = content.split("\n").filter((line) => line.trim().length > 0);
97
+ for (const line of lines) {
98
+ try {
99
+ events.push(JSON.parse(line));
100
+ }
101
+ catch {
102
+ // Skip malformed lines - don't lose other events
103
+ }
104
+ }
105
+ }
106
+ catch {
107
+ // File read failed - return empty
108
+ }
109
+ return events;
110
+ }
111
+ function safeUnlink(filePath) {
112
+ try {
113
+ if (existsSync(filePath))
114
+ unlinkSync(filePath);
115
+ }
116
+ catch {
117
+ // Best effort cleanup
118
+ }
119
+ }
120
+ //# sourceMappingURL=analysis-event-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-event-log.js","sourceRoot":"","sources":["../src/analysis-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAwBrD,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,OAAgB;IAC/D,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,OAAgB;IACjE,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC;AAED,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,UAAU,m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,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QAEjD,+BAA+B;QAC/B,UAAU,CAAC,YAAY,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE3E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAC,CAAC;YACjD,CAAC;YAAC,MAAM,CAAC;gBACP,iDAAiD;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,kCAAkC;IACpC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB;IAClC,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,QAAQ,CAAC;YAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Extension-side notification for analysis events.
3
+ *
4
+ * On `before_agent_start`, consumes pending analysis events and shows
5
+ * a brief one-line notification summarizing instinct changes since the
6
+ * last session interaction.
7
+ */
8
+ import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
9
+ import { type AnalysisEvent } from "./analysis-event-log.js";
10
+ /**
11
+ * Aggregates multiple analysis events into a single summary line.
12
+ * Returns null when no changes occurred.
13
+ */
14
+ export declare function formatNotification(events: readonly AnalysisEvent[]): string | null;
15
+ /**
16
+ * Checks for pending analysis events and shows a notification if any exist.
17
+ * Safe to call on every `before_agent_start` - no-ops when there's nothing.
18
+ */
19
+ export declare function checkAnalysisNotifications(ctx: ExtensionContext, projectId: string | null, baseDir?: string): void;
20
+ //# sourceMappingURL=analysis-notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-notification.d.ts","sourceRoot":"","sources":["../src/analysis-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAMjC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,GAAG,IAAI,CAiClF;AAMD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CASN"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Extension-side notification for analysis events.
3
+ *
4
+ * On `before_agent_start`, consumes pending analysis events and shows
5
+ * a brief one-line notification summarizing instinct changes since the
6
+ * last session interaction.
7
+ */
8
+ import { consumeAnalysisEvents, } from "./analysis-event-log.js";
9
+ // ---------------------------------------------------------------------------
10
+ // Formatting
11
+ // ---------------------------------------------------------------------------
12
+ /**
13
+ * Aggregates multiple analysis events into a single summary line.
14
+ * Returns null when no changes occurred.
15
+ */
16
+ export function formatNotification(events) {
17
+ if (events.length === 0)
18
+ return null;
19
+ let created = 0;
20
+ let updated = 0;
21
+ let deleted = 0;
22
+ const createdIds = [];
23
+ for (const event of events) {
24
+ created += event.created.length;
25
+ updated += event.updated.length;
26
+ deleted += event.deleted.length;
27
+ for (const c of event.created) {
28
+ createdIds.push(c.id);
29
+ }
30
+ }
31
+ if (created === 0 && updated === 0 && deleted === 0)
32
+ return null;
33
+ const parts = [];
34
+ if (created > 0) {
35
+ const idList = createdIds.slice(0, 3).join(", ");
36
+ const suffix = createdIds.length > 3 ? ", ..." : "";
37
+ parts.push(`+${created} new (${idList}${suffix})`);
38
+ }
39
+ if (updated > 0) {
40
+ parts.push(`${updated} updated`);
41
+ }
42
+ if (deleted > 0) {
43
+ parts.push(`${deleted} deleted`);
44
+ }
45
+ return `[instincts] Background analysis: ${parts.join(", ")}`;
46
+ }
47
+ // ---------------------------------------------------------------------------
48
+ // Handler
49
+ // ---------------------------------------------------------------------------
50
+ /**
51
+ * Checks for pending analysis events and shows a notification if any exist.
52
+ * Safe to call on every `before_agent_start` - no-ops when there's nothing.
53
+ */
54
+ export function checkAnalysisNotifications(ctx, projectId, baseDir) {
55
+ if (!projectId)
56
+ return;
57
+ const events = consumeAnalysisEvents(projectId, baseDir);
58
+ const message = formatNotification(events);
59
+ if (message) {
60
+ ctx.ui.notify(message, "info");
61
+ }
62
+ }
63
+ //# sourceMappingURL=analysis-notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-notification.js","sourceRoot":"","sources":["../src/analysis-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAgC;IACjE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK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GAAqB,EACrB,SAAwB,EACxB,OAAgB;IAEhB,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -21,6 +21,7 @@ export interface InstinctChangePayload {
21
21
  contradicted_count?: number;
22
22
  inactive_count?: number;
23
23
  evidence?: string[];
24
+ last_confirmed_session?: string;
24
25
  }
25
26
  export interface InstinctChange {
26
27
  action: "create" | "update" | "delete";
@@ -41,11 +42,28 @@ export interface SingleShotResult {
41
42
  export declare function parseChanges(raw: string): InstinctChange[];
42
43
  /**
43
44
  * Builds a full Instinct from a create/update change.
44
- * Returns null for delete changes or changes with missing instinct data.
45
+ * Returns null for delete changes, changes with missing instinct data,
46
+ * invalid fields, or semantically duplicate actions.
47
+ *
48
+ * @param change - The change to apply
49
+ * @param existing - The existing instinct with this ID, if any
50
+ * @param projectId - Project ID for scoping
51
+ * @param allInstincts - All current instincts, used for dedup check on creates
52
+ */
53
+ export declare function buildInstinctFromChange(change: InstinctChange, existing: Instinct | null, projectId: string, allInstincts?: Instinct[]): Instinct | null;
54
+ /**
55
+ * Formats existing instincts as a compact JSON array for inline context.
56
+ * Reduces token usage by ~70% compared to full YAML+markdown serialization.
57
+ * Includes only the fields the analyzer needs to make decisions.
58
+ */
59
+ export declare function formatInstinctsCompact(instincts: Instinct[]): string;
60
+ /**
61
+ * Estimates the token count of a text string using a chars/token heuristic.
45
62
  */
46
- export declare function buildInstinctFromChange(change: InstinctChange, existing: Instinct | null, projectId: string): Instinct | null;
63
+ export declare function estimateTokens(text: string): number;
47
64
  /**
48
65
  * Formats existing instincts as serialized markdown blocks for inline context.
66
+ * @deprecated Use formatInstinctsCompact for lower token usage.
49
67
  */
50
68
  export declare function formatInstinctsForPrompt(instincts: Instinct[]): string;
51
69
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"analyze-single-shot.d.ts","sourceRoot":"","sources":["../../src/cli/analyze-single-shot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAA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