pi-continuous-learning 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/analysis-event-log.d.ts +50 -0
  2. package/dist/analysis-event-log.d.ts.map +1 -0
  3. package/dist/analysis-event-log.js +120 -0
  4. package/dist/analysis-event-log.js.map +1 -0
  5. package/dist/analysis-notification.d.ts +20 -0
  6. package/dist/analysis-notification.d.ts.map +1 -0
  7. package/dist/analysis-notification.js +63 -0
  8. package/dist/analysis-notification.js.map +1 -0
  9. package/dist/cli/analyze-single-shot.d.ts +12 -0
  10. package/dist/cli/analyze-single-shot.d.ts.map +1 -1
  11. package/dist/cli/analyze-single-shot.js +84 -2
  12. package/dist/cli/analyze-single-shot.js.map +1 -1
  13. package/dist/cli/analyze.js +349 -21
  14. package/dist/cli/analyze.js.map +1 -1
  15. package/dist/confidence.d.ts +12 -1
  16. package/dist/confidence.d.ts.map +1 -1
  17. package/dist/confidence.js +35 -8
  18. package/dist/confidence.js.map +1 -1
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +7 -0
  21. package/dist/config.js.map +1 -1
  22. package/dist/consolidation.d.ts +43 -0
  23. package/dist/consolidation.d.ts.map +1 -0
  24. package/dist/consolidation.js +104 -0
  25. package/dist/consolidation.js.map +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +7 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/instinct-cleanup.d.ts +14 -0
  30. package/dist/instinct-cleanup.d.ts.map +1 -1
  31. package/dist/instinct-cleanup.js +59 -3
  32. package/dist/instinct-cleanup.js.map +1 -1
  33. package/dist/instinct-contradiction.d.ts +42 -0
  34. package/dist/instinct-contradiction.d.ts.map +1 -0
  35. package/dist/instinct-contradiction.js +164 -0
  36. package/dist/instinct-contradiction.js.map +1 -0
  37. package/dist/instinct-dream.d.ts +12 -0
  38. package/dist/instinct-dream.d.ts.map +1 -0
  39. package/dist/instinct-dream.js +33 -0
  40. package/dist/instinct-dream.js.map +1 -0
  41. package/dist/instinct-parser.d.ts.map +1 -1
  42. package/dist/instinct-parser.js +6 -0
  43. package/dist/instinct-parser.js.map +1 -1
  44. package/dist/observation-signal.d.ts +34 -0
  45. package/dist/observation-signal.d.ts.map +1 -0
  46. package/dist/observation-signal.js +66 -0
  47. package/dist/observation-signal.js.map +1 -0
  48. package/dist/prompts/analyzer-system-single-shot.d.ts.map +1 -1
  49. package/dist/prompts/analyzer-system-single-shot.js +57 -2
  50. package/dist/prompts/analyzer-system-single-shot.js.map +1 -1
  51. package/dist/prompts/analyzer-user-single-shot.d.ts.map +1 -1
  52. package/dist/prompts/analyzer-user-single-shot.js +5 -3
  53. package/dist/prompts/analyzer-user-single-shot.js.map +1 -1
  54. package/dist/prompts/consolidate-system.d.ts +6 -0
  55. package/dist/prompts/consolidate-system.d.ts.map +1 -0
  56. package/dist/prompts/consolidate-system.js +102 -0
  57. package/dist/prompts/consolidate-system.js.map +1 -0
  58. package/dist/prompts/consolidate-user.d.ts +19 -0
  59. package/dist/prompts/consolidate-user.d.ts.map +1 -0
  60. package/dist/prompts/consolidate-user.js +45 -0
  61. package/dist/prompts/consolidate-user.js.map +1 -0
  62. package/dist/prompts/dream-prompt.d.ts +7 -0
  63. package/dist/prompts/dream-prompt.d.ts.map +1 -0
  64. package/dist/prompts/dream-prompt.js +64 -0
  65. package/dist/prompts/dream-prompt.js.map +1 -0
  66. package/dist/prompts/evolve-prompt.d.ts.map +1 -1
  67. package/dist/prompts/evolve-prompt.js +6 -5
  68. package/dist/prompts/evolve-prompt.js.map +1 -1
  69. package/dist/types.d.ts +4 -0
  70. package/dist/types.d.ts.map +1 -1
  71. package/package.json +1 -1
  72. package/src/analysis-event-log.ts +171 -0
  73. package/src/analysis-notification.ts +79 -0
  74. package/src/cli/analyze-single-shot.ts +98 -2
  75. package/src/cli/analyze.ts +406 -20
  76. package/src/confidence.ts +33 -7
  77. package/src/config.ts +10 -0
  78. package/src/consolidation.ts +162 -0
  79. package/src/index.ts +17 -0
  80. package/src/instinct-cleanup.ts +62 -3
  81. package/src/instinct-contradiction.ts +202 -0
  82. package/src/instinct-dream.ts +62 -0
  83. package/src/instinct-parser.ts +6 -0
  84. package/src/observation-signal.ts +80 -0
  85. package/src/prompts/analyzer-system-single-shot.ts +57 -2
  86. package/src/prompts/analyzer-user-single-shot.ts +7 -2
  87. package/src/prompts/consolidate-system.ts +101 -0
  88. package/src/prompts/consolidate-user.ts +88 -0
  89. package/src/prompts/dream-prompt.ts +88 -0
  90. package/src/prompts/evolve-prompt.ts +6 -5
  91. package/src/types.ts +5 -0
@@ -88,11 +88,50 @@ Each observation may include an active_instincts field listing instinct IDs
88
88
  that were injected into the agent's system prompt before that turn.
89
89
 
90
90
  Use this to update existing instinct confidence scores:
91
- - Confirmed (+0.05): instinct was active and agent followed guidance without correction
91
+ - Confirmed: instinct was active, agent followed guidance, user did NOT correct
92
92
  - Contradicted (-0.15): instinct was active but user corrected the agent
93
93
  - Inactive (no change): instinct was injected but trigger never arose
94
94
 
95
- When updating, increment the corresponding count field and recalculate confidence.
95
+ When updating, increment the corresponding count field.
96
+
97
+ ### Confirmation confidence deltas (diminishing returns)
98
+ Do NOT apply a flat +0.05 for every confirmation. Use these tiers based on the
99
+ instinct's current confirmed_count BEFORE this update:
100
+ - 1st-3rd confirmation (confirmed_count 0-2): +0.05
101
+ - 4th-6th confirmation (confirmed_count 3-5): +0.03
102
+ - 7th+ confirmation (confirmed_count 6+): +0.01
103
+
104
+ Note: the client applies these deltas automatically from confirmed_count.
105
+ You should still set the correct confirmed_count so the client can compute it.
106
+
107
+ ### Per-session confirmation deduplication
108
+ An instinct may only be confirmed ONCE per unique session_id. Each existing
109
+ instinct includes a last_confirmed_session field (if it has been confirmed before).
110
+
111
+ Rules:
112
+ - If all observations showing this instinct active belong to the same session as
113
+ last_confirmed_session, do NOT increment confirmed_count. The instinct already
114
+ received credit for that session.
115
+ - If a NEW session_id (different from last_confirmed_session) shows the instinct
116
+ active and followed, increment confirmed_count by 1 and set last_confirmed_session
117
+ to that new session_id.
118
+ - When creating a new instinct with initial confirmed_count > 0, set
119
+ last_confirmed_session to the session_id that provided the confirmation.
120
+
121
+ ### Baseline behavior filtering
122
+ Do NOT mark an instinct as "confirmed" if the agent's behavior would be expected
123
+ baseline practice regardless of whether the instinct was injected.
124
+
125
+ Examples of baseline behavior that should NOT count as confirmation:
126
+ - Reading a file before editing it
127
+ - Running a linter or type-checker after code changes
128
+ - Using conventional commit message format
129
+ - Checking for errors after tool calls
130
+ - Clarifying ambiguous requirements before starting
131
+
132
+ Only count a confirmation when the instinct guided behavior that would plausibly
133
+ NOT have occurred without it (e.g., a project-specific workflow, a non-obvious
134
+ convention, or a recovery pattern the agent had to learn).
96
135
 
97
136
  ## Confidence Scoring Rules
98
137
 
@@ -111,6 +150,21 @@ Use project scope when the pattern is specific to this project's tech stack or c
111
150
  Use global scope when the pattern applies universally to any coding session.
112
151
  When in doubt, prefer project scope.
113
152
 
153
+ ## Contradiction Detection
154
+
155
+ Before creating or updating instincts, check existing instincts for contradictions:
156
+ two instincts with similar triggers but semantically opposing actions.
157
+
158
+ Examples of contradictory pairs:
159
+ - "When designing APIs" -> "prefer interfaces" vs "avoid interfaces, use concrete types"
160
+ - "When writing tests" -> "always mock dependencies" vs "never mock, use real implementations"
161
+ - "When handling errors" -> "throw exceptions" vs "avoid exceptions, use Result types"
162
+
163
+ When you detect a contradiction:
164
+ 1. **If observations clearly support one side**: Delete the contradicted instinct (emit a "delete" change) and optionally boost the confirmed instinct's confidence.
165
+ 2. **If evidence is ambiguous**: Delete BOTH and create a single nuanced instinct that captures the context-dependent guidance (e.g., "prefer interfaces for public APIs, concrete types for internal helpers").
166
+ 3. **Do not create a new instinct that contradicts an existing one** without resolving the conflict first.
167
+
114
168
  ## Conservativeness Rules
115
169
 
116
170
  1. Only create a new instinct with 3+ clear independent observations supporting the pattern.
@@ -120,6 +174,7 @@ When in doubt, prefer project scope.
120
174
  5. Check existing instincts (provided in the user message) for duplicates before creating. Update instead.
121
175
  6. Write actions as clear instructions starting with a verb.
122
176
  7. Be skeptical of outliers - patterns seen only in unusual circumstances should not become instincts.
177
+ 8. Before creating, verify the new instinct does not contradict any existing instinct (see Contradiction Detection above).
123
178
 
124
179
  ## Quality Tiers
125
180
 
@@ -3,7 +3,7 @@
3
3
  * Includes current instincts inline (no tool calls needed) and filtered observations.
4
4
  */
5
5
  import type { InstalledSkill, Instinct, ProjectEntry } from "../types.js";
6
- import { formatInstinctsForPrompt } from "../cli/analyze-single-shot.js";
6
+ import { formatInstinctsCompact } from "../cli/analyze-single-shot.js";
7
7
 
8
8
  export interface SingleShotPromptOptions {
9
9
  agentsMdProject?: string | null;
@@ -34,7 +34,10 @@ export function buildSingleShotUserPrompt(
34
34
  ? observationLines.join("\n")
35
35
  : "(no observations recorded yet)";
36
36
 
37
- const instinctBlock = formatInstinctsForPrompt(existingInstincts);
37
+ const instinctBlock =
38
+ existingInstincts.length > 0
39
+ ? formatInstinctsCompact(existingInstincts)
40
+ : "(no existing instincts)";
38
41
 
39
42
  const parts: string[] = [
40
43
  "## Project Context",
@@ -86,6 +89,8 @@ export function buildSingleShotUserPrompt(
86
89
  " - Generic agent behaviors (read-before-edit, clarify-before-implement) -> skip entirely",
87
90
  " - Project-specific patterns -> project-scoped instinct",
88
91
  " - Universal workflow patterns -> global-scoped instinct",
92
+ "8. Check existing instincts for contradictions (similar triggers, opposing actions).",
93
+ " Resolve by deleting the weaker instinct or merging into a nuanced one.",
89
94
  "",
90
95
  "Return ONLY the JSON object. No prose, no markdown fences."
91
96
  );
@@ -0,0 +1,101 @@
1
+ /**
2
+ * System prompt for the consolidation (dream) pass.
3
+ * Reviews the entire instinct corpus holistically - no observations needed.
4
+ */
5
+ export function buildConsolidateSystemPrompt(): string {
6
+ return `You are a coding behavior analyst performing a periodic consolidation review.
7
+ Your job is to review the entire instinct corpus holistically and produce a JSON change-set
8
+ that merges duplicates, removes stale entries, resolves contradictions, and promotes mature instincts.
9
+
10
+ ## Output Format
11
+
12
+ Return ONLY a valid JSON object (no prose, no markdown fences) with this structure:
13
+
14
+ {
15
+ "changes": [
16
+ {
17
+ "action": "create",
18
+ "instinct": {
19
+ "id": "kebab-case-id",
20
+ "title": "Short title",
21
+ "trigger": "When this should activate",
22
+ "action": "What the agent should do (verb phrase)",
23
+ "confidence": 0.5,
24
+ "domain": "typescript",
25
+ "scope": "project",
26
+ "observation_count": 3,
27
+ "confirmed_count": 0,
28
+ "contradicted_count": 0,
29
+ "inactive_count": 0,
30
+ "evidence": ["brief note 1", "brief note 2"]
31
+ }
32
+ },
33
+ {
34
+ "action": "update",
35
+ "instinct": { "...same fields as create..." }
36
+ },
37
+ {
38
+ "action": "delete",
39
+ "id": "instinct-id-to-delete",
40
+ "scope": "project"
41
+ }
42
+ ]
43
+ }
44
+
45
+ Return { "changes": [] } if no changes are needed.
46
+
47
+ ## Consolidation Tasks
48
+
49
+ Perform these analyses on the full instinct corpus:
50
+
51
+ ### 1. Merge Candidates
52
+ Find instincts with semantically similar triggers or actions, even if worded differently.
53
+ Merge them into a single stronger instinct:
54
+ - Delete both originals
55
+ - Create one merged instinct with combined evidence
56
+ - Set confidence to the higher of the two (capped at 0.9)
57
+ - Sum observation_count and confirmed_count from both
58
+
59
+ ### 2. Contradiction Resolution
60
+ Find instincts with similar triggers but opposing actions:
61
+ - "prefer X" vs "avoid X"
62
+ - "always do Y" vs "never do Y"
63
+ - "use A" vs "don't use A"
64
+
65
+ Resolution strategy:
66
+ - If one has clearly higher confidence (>0.1 difference): delete the weaker one
67
+ - If confidence is similar but one has more confirmations: keep the more confirmed one
68
+ - If evidence is truly ambiguous: delete both, create a nuanced context-dependent instinct
69
+
70
+ ### 3. Stale Instinct Detection
71
+ Flag instincts that reference patterns unlikely to still be relevant:
72
+ - Evidence references specific files or tools that may no longer exist
73
+ - Very old instincts (28+ days) with zero confirmations
74
+ - Instincts with high inactive_count relative to confirmed_count
75
+
76
+ ### 4. Promotion Candidates
77
+ Identify project-scoped instincts that should become global:
78
+ - Confidence >= 0.7
79
+ - confirmed_count >= 3
80
+ - Pattern is not project-specific (no project-specific file paths, tools, or conventions)
81
+
82
+ To promote: delete the project-scoped version and create a global-scoped version with the same data.
83
+
84
+ ### 5. AGENTS.md Deduplication
85
+ Check if any instincts are already covered by AGENTS.md guidelines.
86
+ Delete instincts that duplicate existing written guidelines.
87
+
88
+ ### 6. Quality Cleanup
89
+ - Delete instincts with confidence < 0.2
90
+ - Delete instincts flagged_for_removal
91
+ - Rewrite vague triggers or actions to be more specific (update action)
92
+
93
+ ## Conservativeness Rules
94
+
95
+ 1. Prefer fewer changes over many - only act when the improvement is clear
96
+ 2. When merging, preserve the essence of both instincts in the merged version
97
+ 3. Do not create new instincts from scratch - only merge or modify existing ones
98
+ 4. Clamping: always keep confidence in [0.1, 0.9]
99
+ 5. Write actions as clear instructions starting with a verb
100
+ 6. If unsure about a change, skip it - the next consolidation will catch it`;
101
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * User prompt builder for the consolidation (dream) pass.
3
+ * Embeds all instincts and optional AGENTS.md context.
4
+ */
5
+
6
+ import type { Instinct, InstalledSkill } from "../types.js";
7
+ import { formatInstinctsCompact } from "../cli/analyze-single-shot.js";
8
+
9
+ export interface ConsolidatePromptOptions {
10
+ agentsMdProject?: string | null;
11
+ agentsMdGlobal?: string | null;
12
+ installedSkills?: InstalledSkill[];
13
+ projectName?: string;
14
+ projectId?: string;
15
+ }
16
+
17
+ /**
18
+ * Builds the user prompt for a consolidation pass.
19
+ * Unlike the observation analyzer, this prompt contains only instincts
20
+ * and guidelines - no observations.
21
+ */
22
+ export function buildConsolidateUserPrompt(
23
+ instincts: readonly Instinct[],
24
+ options: ConsolidatePromptOptions = {}
25
+ ): string {
26
+ const {
27
+ agentsMdProject = null,
28
+ agentsMdGlobal = null,
29
+ installedSkills = [],
30
+ projectName,
31
+ projectId,
32
+ } = options;
33
+
34
+ const instinctBlock =
35
+ instincts.length > 0
36
+ ? formatInstinctsCompact([...instincts])
37
+ : "(no instincts)";
38
+
39
+ const parts: string[] = [];
40
+
41
+ if (projectId || projectName) {
42
+ parts.push("## Project Context", "");
43
+ if (projectId) parts.push(`project_id: ${projectId}`);
44
+ if (projectName) parts.push(`project_name: ${projectName}`);
45
+ parts.push("");
46
+ }
47
+
48
+ parts.push(
49
+ "## Full Instinct Corpus",
50
+ "",
51
+ instinctBlock,
52
+ "",
53
+ `Total instincts: ${instincts.length}`,
54
+ ""
55
+ );
56
+
57
+ if (agentsMdProject != null || agentsMdGlobal != null) {
58
+ parts.push("## Existing Guidelines (AGENTS.md)", "");
59
+ if (agentsMdProject != null) {
60
+ parts.push("### Project AGENTS.md", "", agentsMdProject, "");
61
+ }
62
+ if (agentsMdGlobal != null) {
63
+ parts.push("### Global AGENTS.md", "", agentsMdGlobal, "");
64
+ }
65
+ }
66
+
67
+ if (installedSkills.length > 0) {
68
+ parts.push("## Installed Skills", "");
69
+ for (const skill of installedSkills) {
70
+ parts.push(`- **${skill.name}**: ${skill.description}`);
71
+ }
72
+ parts.push("");
73
+ }
74
+
75
+ parts.push(
76
+ "## Instructions",
77
+ "",
78
+ "1. Review ALL instincts above as a complete corpus.",
79
+ "2. Identify merge candidates, contradictions, stale entries, and promotion candidates.",
80
+ "3. Check for instincts duplicated by AGENTS.md guidelines.",
81
+ "4. Return a JSON change-set with your proposed modifications.",
82
+ "5. Prefer conservative changes - only act when the improvement is clear.",
83
+ "",
84
+ "Return ONLY the JSON object. No prose, no markdown fences."
85
+ );
86
+
87
+ return parts.join("\n");
88
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Prompt builder for the interactive /instinct-dream command.
3
+ * Similar to evolve-prompt but focused on holistic consolidation tasks.
4
+ */
5
+
6
+ import type { Instinct, InstalledSkill } from "../types.js";
7
+
8
+ interface InstinctSummary {
9
+ id: string;
10
+ title: string;
11
+ trigger: string;
12
+ action: string;
13
+ confidence: number;
14
+ domain: string;
15
+ scope: string;
16
+ confirmed_count: number;
17
+ contradicted_count: number;
18
+ inactive_count: number;
19
+ }
20
+
21
+ function summarizeInstinct(i: Instinct): InstinctSummary {
22
+ return {
23
+ id: i.id,
24
+ title: i.title,
25
+ trigger: i.trigger,
26
+ action: i.action,
27
+ confidence: i.confidence,
28
+ domain: i.domain,
29
+ scope: i.scope,
30
+ confirmed_count: i.confirmed_count,
31
+ contradicted_count: i.contradicted_count,
32
+ inactive_count: i.inactive_count,
33
+ };
34
+ }
35
+
36
+ export function buildDreamPrompt(
37
+ instincts: Instinct[],
38
+ agentsMdProject?: string | null,
39
+ agentsMdGlobal?: string | null,
40
+ installedSkills?: InstalledSkill[]
41
+ ): string {
42
+ const parts: string[] = [
43
+ "Perform a holistic consolidation review of my learned instincts.",
44
+ "You have access to instinct tools (instinct_merge, instinct_delete, instinct_write) to act on your findings.",
45
+ "",
46
+ "## Full Instinct Corpus",
47
+ "",
48
+ "```json",
49
+ JSON.stringify(instincts.map(summarizeInstinct), null, 2),
50
+ "```",
51
+ "",
52
+ `Total: ${instincts.length} instincts`,
53
+ "",
54
+ "## Consolidation Tasks",
55
+ "",
56
+ "Review the entire corpus and identify:",
57
+ "",
58
+ "1. **Merge candidates**: Instincts with semantically similar triggers or actions (even if worded differently). Merge into a single, stronger instinct using instinct_merge.",
59
+ "2. **Contradictions**: Instincts with similar triggers but opposing actions. Resolve by keeping the stronger one or merging into a nuanced context-dependent instinct.",
60
+ "3. **Stale instincts**: Entries with zero confirmations, high inactive_count, or references to outdated patterns. Delete them.",
61
+ "4. **AGENTS.md duplicates**: Instincts already covered by the guidelines below. Delete them.",
62
+ "5. **Promotion candidates**: Project-scoped instincts with confidence >= 0.7 and confirmed_count >= 3 that apply universally. Promote to global scope.",
63
+ "6. **Skill shadows**: Instincts whose purpose is already served by an installed skill. Delete them.",
64
+ "7. **Quality cleanup**: Instincts with confidence < 0.2, vague triggers, or flagged_for_removal. Clean up or delete.",
65
+ "",
66
+ "Present your findings conversationally. For each suggestion, explain your reasoning and ask if I'd like you to take action using the instinct tools.",
67
+ "If the corpus looks healthy, say so briefly.",
68
+ ];
69
+
70
+ if (agentsMdProject || agentsMdGlobal) {
71
+ parts.push("", "## Current Guidelines (AGENTS.md)", "");
72
+ if (agentsMdProject) {
73
+ parts.push("### Project AGENTS.md", "", agentsMdProject, "");
74
+ }
75
+ if (agentsMdGlobal) {
76
+ parts.push("### Global AGENTS.md", "", agentsMdGlobal, "");
77
+ }
78
+ }
79
+
80
+ if (installedSkills && installedSkills.length > 0) {
81
+ parts.push("", "## Installed Skills", "");
82
+ for (const skill of installedSkills) {
83
+ parts.push(`- **${skill.name}**: ${skill.description}`);
84
+ }
85
+ }
86
+
87
+ return parts.join("\n");
88
+ }
@@ -40,11 +40,12 @@ export function buildEvolvePrompt(
40
40
  "",
41
41
  "## Analysis Tasks",
42
42
  "",
43
- "1. **Merge candidates**: Find instincts with semantically similar triggers or actions (even if worded differently). Offer to merge them using the instinct_merge tool.",
44
- "2. **Duplicates of AGENTS.md**: Flag instincts already covered by the guidelines below. Offer to delete them.",
45
- "3. **Promotion candidates**: Project-scoped instincts with confidence >= 0.7 that could become global.",
46
- "4. **Skill shadows**: Instincts whose purpose is already served by an installed skill (listed below). Offer to delete them.",
47
- "5. **Low-confidence cleanup**: Instincts with confidence < 0.3 or flagged_for_removal that should be deleted.",
43
+ "1. **Contradictions**: Find instincts with similar triggers but opposing actions (e.g., 'prefer X' vs 'avoid X', 'always do Y' vs 'never do Y'). Offer to delete the weaker one, or merge both into a nuanced context-dependent instinct.",
44
+ "2. **Merge candidates**: Find instincts with semantically similar triggers or actions (even if worded differently). Offer to merge them using the instinct_merge tool.",
45
+ "3. **Duplicates of AGENTS.md**: Flag instincts already covered by the guidelines below. Offer to delete them.",
46
+ "4. **Promotion candidates**: Project-scoped instincts with confidence >= 0.7 that could become global.",
47
+ "5. **Skill shadows**: Instincts whose purpose is already served by an installed skill (listed below). Offer to delete them.",
48
+ "6. **Low-confidence cleanup**: Instincts with confidence < 0.3 or flagged_for_removal that should be deleted.",
48
49
  "",
49
50
  "Present your findings conversationally. For each suggestion, explain your reasoning and ask if I'd like you to take action using the instinct tools.",
50
51
  "If there are no issues, say so briefly.",
package/src/types.ts CHANGED
@@ -69,6 +69,7 @@ export interface Instinct {
69
69
  flagged_for_removal?: boolean;
70
70
  graduated_to?: GraduationTarget;
71
71
  graduated_at?: string; // ISO 8601
72
+ last_confirmed_session?: string; // session ID that last provided a confirmation
72
73
  }
73
74
 
74
75
  export type GraduationTarget = "agents-md" | "skill" | "command";
@@ -113,4 +114,8 @@ export interface Config {
113
114
  max_new_instincts_per_run: number; // creation rate limit per analyzer run
114
115
  flagged_cleanup_days: number; // auto-delete flagged instincts after N days
115
116
  instinct_ttl_days: number; // auto-delete zero-confirmation instincts after N days
117
+ // Consolidation (dream) settings
118
+ dreaming_enabled: boolean; // whether automatic consolidation runs during normal analysis
119
+ consolidation_interval_days: number; // minimum days between consolidation runs
120
+ consolidation_min_sessions: number; // minimum sessions since last consolidation
116
121
  }