@rlabs-inc/memory 0.4.11 → 0.4.13

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.
@@ -1,107 +0,0 @@
1
- // ============================================================================
2
- // CURATION SCHEMA - Zod schemas for SDK structured outputs
3
- // Mirrors memory.ts types for JSON Schema generation
4
- // ============================================================================
5
-
6
- import { z } from 'zod'
7
-
8
- /**
9
- * All 11 canonical context types - matches memory.ts CONTEXT_TYPES
10
- */
11
- export const ContextTypeSchema = z.enum([
12
- 'technical',
13
- 'debug',
14
- 'architecture',
15
- 'decision',
16
- 'personal',
17
- 'philosophy',
18
- 'workflow',
19
- 'milestone',
20
- 'breakthrough',
21
- 'unresolved',
22
- 'state'
23
- ])
24
-
25
- /**
26
- * Temporal class - matches memory.ts TemporalClass
27
- */
28
- export const TemporalClassSchema = z.enum([
29
- 'eternal',
30
- 'long_term',
31
- 'medium_term',
32
- 'short_term',
33
- 'ephemeral'
34
- ])
35
-
36
- /**
37
- * Scope - global (shared) or project-specific
38
- */
39
- export const ScopeSchema = z.enum(['global', 'project'])
40
-
41
- /**
42
- * Single curated memory - matches memory.ts CuratedMemory
43
- * Fields marked optional have smart defaults applied by applyV4Defaults()
44
- */
45
- export const CuratedMemorySchema = z.object({
46
- // Core content (v4: two-tier structure)
47
- headline: z.string().describe('1-2 line summary WITH conclusion - always shown in retrieval'),
48
- content: z.string().describe('Full structured template (WHAT/WHERE/HOW/WHY) - expandable'),
49
- reasoning: z.string().describe('Why this memory matters for future sessions'),
50
-
51
- // Scores
52
- importance_weight: z.number().min(0).max(1).describe('0.9+ breakthrough, 0.7-0.8 important, 0.5-0.6 useful'),
53
- confidence_score: z.number().min(0).max(1).describe('How confident in this assessment'),
54
-
55
- // Classification
56
- context_type: ContextTypeSchema.describe('One of 11 canonical types'),
57
- temporal_class: TemporalClassSchema.optional().describe('Persistence duration - defaults by context_type'),
58
- scope: ScopeSchema.optional().describe('global for personal/philosophy, project for technical'),
59
-
60
- // Retrieval optimization (the secret sauce)
61
- trigger_phrases: z.array(z.string()).describe('Situational patterns: "when debugging X", "working on Y"'),
62
- semantic_tags: z.array(z.string()).describe('User-typeable concepts - avoid generic terms'),
63
-
64
- // Optional categorization
65
- domain: z.string().optional().describe('Specific area: embeddings, auth, family'),
66
- feature: z.string().optional().describe('Specific feature within domain'),
67
- related_files: z.array(z.string()).optional().describe('Source files for technical memories'),
68
-
69
- // Flags
70
- action_required: z.boolean().default(false).describe('Needs follow-up action'),
71
- problem_solution_pair: z.boolean().default(false).describe('Problem→solution pattern'),
72
- awaiting_implementation: z.boolean().optional().describe('Planned feature not yet built'),
73
- awaiting_decision: z.boolean().optional().describe('Decision point needing resolution'),
74
- })
75
-
76
- /**
77
- * Project snapshot - current state
78
- */
79
- export const ProjectSnapshotSchema = z.object({
80
- current_phase: z.string().describe('What phase is the project in'),
81
- recent_achievements: z.array(z.string()).describe('What was accomplished this session'),
82
- active_challenges: z.array(z.string()).describe('Current blockers or challenges'),
83
- next_steps: z.array(z.string()).describe('Planned next steps'),
84
- })
85
-
86
- /**
87
- * Full curation result - what the curator returns
88
- */
89
- export const CurationResultSchema = z.object({
90
- session_summary: z.string().describe('2-3 sentence overview of what happened'),
91
- interaction_tone: z.string().nullable().optional().describe('How was the interaction'),
92
- project_snapshot: ProjectSnapshotSchema.optional().describe('Current project state'),
93
- memories: z.array(CuratedMemorySchema).describe('Extracted memories from session'),
94
- })
95
-
96
- // Type exports for TypeScript inference
97
- export type ZodCuratedMemory = z.infer<typeof CuratedMemorySchema>
98
- export type ZodCurationResult = z.infer<typeof CurationResultSchema>
99
- export type ZodProjectSnapshot = z.infer<typeof ProjectSnapshotSchema>
100
-
101
- /**
102
- * Generate JSON Schema for SDK structured outputs
103
- * Use: z.toJSONSchema(CurationResultSchema)
104
- */
105
- export function getCurationJsonSchema() {
106
- return z.toJSONSchema(CurationResultSchema)
107
- }