Skip to content

Commit d9257db

Browse files
jesseturner21claude
andcommitted
fix(import): map STM_ONLY memory to zero strategies
STM_ONLY memories incorrectly received a SEMANTIC strategy in the import flow, while the CLI create flow and starter toolkit both deploy STM_ONLY with zero strategies. This mismatch caused drift/errors during reconciliation. Constraint: Must match CLI create flow which maps shortTerm to strategies: [] Rejected: Keep SEMANTIC for STM_ONLY | causes reconciliation drift with deployed resources Confidence: high Scope-risk: narrow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 66a44f0 commit d9257db

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/cli/commands/import/__tests__/import-memory.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ import { describe, expect, it } from 'vitest';
3030
function toMemorySpec(mem: ParsedStarterToolkitMemory): Memory {
3131
const strategies: Memory['strategies'] = [];
3232

33-
if (mem.mode === 'STM_ONLY' || mem.mode === 'STM_AND_LTM') {
34-
strategies.push({ type: 'SEMANTIC' });
35-
}
3633
if (mem.mode === 'STM_AND_LTM') {
34+
strategies.push({ type: 'SEMANTIC' });
3735
strategies.push({ type: 'SUMMARIZATION' });
3836
strategies.push({ type: 'USER_PREFERENCE' });
3937
}
@@ -389,8 +387,7 @@ describe('toMemorySpec', () => {
389387
expect(result.type).toBe('AgentCoreMemory');
390388
expect(result.name).toBe('stm_memory');
391389
expect(result.eventExpiryDuration).toBe(14);
392-
expect(result.strategies).toHaveLength(1);
393-
expect(result.strategies[0]!.type).toBe('SEMANTIC');
390+
expect(result.strategies).toHaveLength(0);
394391
});
395392

396393
it('NO_MEMORY mode produces empty strategies', () => {
@@ -553,8 +550,7 @@ describe('Memory Merge Logic', () => {
553550
// The new memory should be added
554551
const newMem = merged.find(m => m.name === 'new_memory')!;
555552
expect(newMem.eventExpiryDuration).toBe(14);
556-
expect(newMem.strategies).toHaveLength(1);
557-
expect(newMem.strategies[0]!.type).toBe('SEMANTIC');
553+
expect(newMem.strategies).toHaveLength(0);
558554
});
559555

560556
it('adds all memories when project has none', () => {
@@ -587,7 +583,7 @@ describe('Memory Merge Logic', () => {
587583
expect(merged[0]!.name).toBe('memory_one');
588584
expect(merged[0]!.strategies).toHaveLength(3);
589585
expect(merged[1]!.name).toBe('memory_two');
590-
expect(merged[1]!.strategies).toHaveLength(1);
586+
expect(merged[1]!.strategies).toHaveLength(0);
591587
});
592588
});
593589

src/cli/commands/import/__tests__/merge-logic.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ function toAgentEnvSpec(agent: ParsedStarterToolkitConfig['agents'][0]): AgentEn
3333

3434
function toMemorySpec(mem: ParsedStarterToolkitConfig['memories'][0]): Memory {
3535
const strategies: Memory['strategies'] = [];
36-
if (mem.mode === 'STM_ONLY' || mem.mode === 'STM_AND_LTM') {
37-
strategies.push({ type: 'SEMANTIC' });
38-
}
3936
if (mem.mode === 'STM_AND_LTM') {
37+
strategies.push({ type: 'SEMANTIC' });
4038
strategies.push({ type: 'SUMMARIZATION' });
4139
strategies.push({ type: 'USER_PREFERENCE' });
4240
}

src/cli/commands/import/actions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ function toAgentEnvSpec(agent: ParsedStarterToolkitConfig['agents'][0]): AgentEn
7171
function toMemorySpec(mem: ParsedStarterToolkitConfig['memories'][0]): Memory {
7272
const strategies: Memory['strategies'] = [];
7373

74-
if (mem.mode === 'STM_ONLY' || mem.mode === 'STM_AND_LTM') {
75-
strategies.push({ type: 'SEMANTIC' });
76-
}
7774
if (mem.mode === 'STM_AND_LTM') {
75+
strategies.push({ type: 'SEMANTIC' });
7876
strategies.push({ type: 'SUMMARIZATION' });
7977
strategies.push({ type: 'USER_PREFERENCE' });
8078
}

0 commit comments

Comments
 (0)