feat(memory): add experimental qmd search backend
This commit is contained in:
@@ -459,6 +459,9 @@ describe('configSchema — memory injection strategy', () => {
|
||||
const result = configSchema.parse(minimalConfig);
|
||||
expect(result.memory.injection_strategy).toBe('all');
|
||||
expect(result.memory.max_injection_tokens).toBe(2000);
|
||||
expect(result.memory.qmd.enabled).toBe(false);
|
||||
expect(result.memory.qmd.top_k).toBe(8);
|
||||
expect(result.memory.qmd.min_score).toBe(0.15);
|
||||
});
|
||||
|
||||
it('accepts adaptive memory injection settings', () => {
|
||||
@@ -472,6 +475,22 @@ describe('configSchema — memory injection strategy', () => {
|
||||
expect(result.memory.injection_strategy).toBe('adaptive');
|
||||
expect(result.memory.max_injection_tokens).toBe(1200);
|
||||
});
|
||||
|
||||
it('accepts qmd backend settings', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
memory: {
|
||||
qmd: {
|
||||
enabled: true,
|
||||
top_k: 12,
|
||||
min_score: 0.2,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(result.memory.qmd.enabled).toBe(true);
|
||||
expect(result.memory.qmd.top_k).toBe(12);
|
||||
expect(result.memory.qmd.min_score).toBe(0.2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — compaction importance threshold', () => {
|
||||
|
||||
@@ -313,6 +313,15 @@ const embeddingSchema = z.object({
|
||||
hybrid_weight: z.number().min(0).max(1).default(0.7),
|
||||
}).default({});
|
||||
|
||||
const qmdSchema = z.object({
|
||||
/** Enable experimental QMD (query markdown database) memory search backend. */
|
||||
enabled: z.boolean().default(false),
|
||||
/** Maximum number of QMD results returned by memory.search. */
|
||||
top_k: z.number().min(1).max(50).default(8),
|
||||
/** Minimum relevance score (0-1) for QMD matches. */
|
||||
min_score: z.number().min(0).max(1).default(0.15),
|
||||
}).default({});
|
||||
|
||||
const memorySchema = z.object({
|
||||
enabled: z.boolean().default(true),
|
||||
dir: z.string().optional(), // Default: ~/.local/share/flynn/memory
|
||||
@@ -321,6 +330,7 @@ const memorySchema = z.object({
|
||||
max_injection_tokens: z.number().min(100).max(10000).default(2000),
|
||||
max_context_tokens: z.number().min(100).max(10000).default(2000),
|
||||
embedding: embeddingSchema,
|
||||
qmd: qmdSchema,
|
||||
}).default({});
|
||||
|
||||
const compactionSchema = z.object({
|
||||
@@ -593,6 +603,7 @@ export type HeartbeatConfig = z.infer<typeof heartbeatSchema>;
|
||||
export type HeartbeatCheck = z.infer<typeof heartbeatCheckSchema>;
|
||||
export type EmbeddingConfig = z.infer<typeof embeddingSchema>;
|
||||
export type EmbeddingProvider = z.infer<typeof embeddingProviderSchema>;
|
||||
export type QmdConfig = z.infer<typeof qmdSchema>;
|
||||
export type GcalConfig = z.infer<typeof gcalSchema>;
|
||||
export type GdocsConfig = z.infer<typeof gdocsSchema>;
|
||||
export type GdriveConfig = z.infer<typeof gdriveSchema>;
|
||||
|
||||
Reference in New Issue
Block a user