Skip to content

Commit 6ff721e

Browse files
authored
revert: remove CUSTOM strategy and semanticOverride support (#713)
* Revert "feat: add semanticOverride support for SEMANTIC memory strategies (#678) (#696)" This reverts commit 5e0f584. * Revert "feat(memory): add CUSTOM strategy type to agentcore-cli (#677) (#694)" This reverts commit beac707. * fix: restore EPISODIC strategy to configuration.md The revert of the CUSTOM strategy commit inadvertently removed the EPISODIC row from the Memory Strategies table in configuration.md.
1 parent 48dadfd commit 6ff721e

File tree

29 files changed

+73
-596
lines changed

29 files changed

+73
-596
lines changed

docs/commands.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ agentcore add memory \
225225
--expiry 30
226226
```
227227

228-
| Flag | Description |
229-
| ---------------------- | ------------------------------------------------------------------------------------- |
230-
| `--name <name>` | Memory name |
231-
| `--strategies <types>` | Comma-separated: `SEMANTIC`, `SUMMARIZATION`, `USER_PREFERENCE`, `EPISODIC`, `CUSTOM` |
232-
| `--expiry <days>` | Event expiry duration in days (default: 30, min: 7, max: 365) |
233-
| `--json` | JSON output |
228+
| Flag | Description |
229+
| ---------------------- | --------------------------------------------------------------------------- |
230+
| `--name <name>` | Memory name |
231+
| `--strategies <types>` | Comma-separated: `SEMANTIC`, `SUMMARIZATION`, `USER_PREFERENCE`, `EPISODIC` |
232+
| `--expiry <days>` | Event expiry duration in days (default: 30, min: 7, max: 365) |
233+
| `--json` | JSON output |
234234

235235
### add gateway
236236

docs/configuration.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,12 @@ on the next deployment.
239239

240240
### Memory Strategies
241241

242-
| Strategy | Description |
243-
| ----------------- | ----------------------------------------------------------- |
244-
| `SEMANTIC` | Vector-based similarity search for relevant context |
245-
| `SUMMARIZATION` | Compressed conversation history |
246-
| `USER_PREFERENCE` | Store user-specific preferences and settings |
247-
| `EPISODIC` | Capture and reflect on meaningful interaction episodes |
248-
| `CUSTOM` | Self-managed strategy with user-controlled extraction logic |
242+
| Strategy | Description |
243+
| ----------------- | ------------------------------------------------------ |
244+
| `SEMANTIC` | Vector-based similarity search for relevant context |
245+
| `SUMMARIZATION` | Compressed conversation history |
246+
| `USER_PREFERENCE` | Store user-specific preferences and settings |
247+
| `EPISODIC` | Capture and reflect on meaningful interaction episodes |
249248

250249
Strategy configuration:
251250

docs/memory.md

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,12 @@ conversations, enabling cross-session recall via semantic search.
168168

169169
## Memory Strategies
170170

171-
| Strategy | Description |
172-
| ----------------- | ----------------------------------------------------------- |
173-
| `SEMANTIC` | Vector-based similarity search for relevant context |
174-
| `SUMMARIZATION` | Compressed conversation history |
175-
| `USER_PREFERENCE` | Store user-specific preferences and settings |
176-
| `EPISODIC` | Capture and reflect on meaningful interaction episodes |
177-
| `CUSTOM` | Self-managed strategy with user-controlled extraction logic |
171+
| Strategy | Description |
172+
| ----------------- | ------------------------------------------------------ |
173+
| `SEMANTIC` | Vector-based similarity search for relevant context |
174+
| `SUMMARIZATION` | Compressed conversation history |
175+
| `USER_PREFERENCE` | Store user-specific preferences and settings |
176+
| `EPISODIC` | Capture and reflect on meaningful interaction episodes |
178177

179178
You can combine multiple strategies:
180179

@@ -189,36 +188,6 @@ You can combine multiple strategies:
189188
}
190189
```
191190

192-
### Self-Managed (Custom) Strategy
193-
194-
The `CUSTOM` strategy lets you control memory extraction logic externally rather than relying on built-in
195-
implementations. This is useful when you need specialized extraction pipelines or want to integrate with your own
196-
processing infrastructure.
197-
198-
**Prerequisites:** CUSTOM strategies require user-managed extraction logic and are not functional without it. You must
199-
implement your own extraction mechanism (e.g., via AWS Lambda).
200-
201-
**Key characteristics:**
202-
203-
- No default namespaces are assigned — you provide your own or omit them
204-
- Each memory supports at most one CUSTOM strategy
205-
- You are responsible for implementing the extraction logic that processes memory events
206-
207-
```json
208-
{
209-
"type": "AgentCoreMemory",
210-
"name": "MyMemory",
211-
"eventExpiryDuration": 30,
212-
"strategies": [
213-
{
214-
"type": "CUSTOM",
215-
"name": "my_custom_strategy",
216-
"description": "Custom extraction logic"
217-
}
218-
]
219-
}
220-
```
221-
222191
### Strategy Options
223192

224193
Each strategy can have optional configuration:

src/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,11 +1696,6 @@ def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[Agent
16961696
{{/if}}
16971697
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
16981698
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
1699-
{{/if}}
1700-
{{#if (includes memoryProviders.[0].strategies "CUSTOM")}}
1701-
# TODO: Add your custom namespace and retrieval config.
1702-
# Custom strategies use user-controlled extraction logic.
1703-
# Example: f"/custom/{actor_id}/data": RetrievalConfig(top_k=3, relevance_score=0.5),
17041699
{{/if}}
17051700
}
17061701
{{/if}}
@@ -3662,11 +3657,6 @@ def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[Agent
36623657
{{/if}}
36633658
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
36643659
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
3665-
{{/if}}
3666-
{{#if (includes memoryProviders.[0].strategies "CUSTOM")}}
3667-
# TODO: Add your custom namespace and retrieval config.
3668-
# Custom strategies use user-controlled extraction logic.
3669-
# Example: f"/custom/{actor_id}/data": RetrievalConfig(top_k=3, relevance_score=0.5),
36703660
{{/if}}
36713661
}
36723662
{{/if}}
@@ -4010,7 +4000,7 @@ file maps to a JSON config file and includes validation constraints as comments.
40104000
- **BuildType**: \`'CodeZip'\` | \`'Container'\`
40114001
- **NetworkMode**: \`'PUBLIC'\`
40124002
- **RuntimeVersion**: \`'PYTHON_3_10'\` | \`'PYTHON_3_11'\` | \`'PYTHON_3_12'\` | \`'PYTHON_3_13'\`
4013-
- **MemoryStrategyType**: \`'SEMANTIC'\` | \`'SUMMARIZATION'\` | \`'USER_PREFERENCE'\` | \`'EPISODIC'\` | \`'CUSTOM'\`
4003+
- **MemoryStrategyType**: \`'SEMANTIC'\` | \`'SUMMARIZATION'\` | \`'USER_PREFERENCE'\` | \`'EPISODIC'\`
40144004
40154005
### Build Types
40164006

src/assets/agents/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ file maps to a JSON config file and includes validation constraints as comments.
6363
- **BuildType**: `'CodeZip'` | `'Container'`
6464
- **NetworkMode**: `'PUBLIC'`
6565
- **RuntimeVersion**: `'PYTHON_3_10'` | `'PYTHON_3_11'` | `'PYTHON_3_12'` | `'PYTHON_3_13'`
66-
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'` | `'EPISODIC'` | `'CUSTOM'`
66+
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'` | `'EPISODIC'`
6767

6868
### Build Types
6969

src/assets/python/a2a/strands/capabilities/memory/session.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[Agent
2121
{{/if}}
2222
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
2323
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
24-
{{/if}}
25-
{{#if (includes memoryProviders.[0].strategies "CUSTOM")}}
26-
# TODO: Add your custom namespace and retrieval config.
27-
# Custom strategies use user-controlled extraction logic.
28-
# Example: f"/custom/{actor_id}/data": RetrievalConfig(top_k=3, relevance_score=0.5),
2924
{{/if}}
3025
}
3126
{{/if}}

src/assets/python/http/strands/capabilities/memory/session.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ def get_memory_session_manager(session_id: str, actor_id: str) -> Optional[Agent
2121
{{/if}}
2222
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
2323
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
24-
{{/if}}
25-
{{#if (includes memoryProviders.[0].strategies "CUSTOM")}}
26-
# TODO: Add your custom namespace and retrieval config.
27-
# Custom strategies use user-controlled extraction logic.
28-
# Example: f"/custom/{actor_id}/data": RetrievalConfig(top_k=3, relevance_score=0.5),
2924
{{/if}}
3025
}
3126
{{/if}}

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,16 @@ describe('add memory command', () => {
5151
expect(json.error.includes('INVALID'), `Error: ${json.error}`).toBeTruthy();
5252
});
5353

54-
// Issue #677: CUSTOM strategy is now supported
55-
it('creates memory with CUSTOM strategy', async () => {
56-
const memoryName = `memCustom${Date.now()}`;
54+
// Issue #235: CUSTOM strategy has been removed
55+
it('rejects CUSTOM strategy', async () => {
5756
const result = await runCLI(
58-
['add', 'memory', '--name', memoryName, '--strategies', 'CUSTOM', '--json'],
57+
['add', 'memory', '--name', 'testCustom', '--strategies', 'CUSTOM', '--json'],
5958
projectDir
6059
);
61-
expect(result.exitCode, `stdout: ${result.stdout}, stderr: ${result.stderr}`).toBe(0);
60+
expect(result.exitCode).toBe(1);
6261
const json = JSON.parse(result.stdout);
63-
expect(json.success).toBe(true);
64-
expect(json.memoryName).toBe(memoryName);
62+
expect(json.success).toBe(false);
63+
expect(json.error.includes('CUSTOM'), `Error: ${json.error}`).toBeTruthy();
6564
});
6665
});
6766

src/cli/commands/add/__tests__/validate.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -953,15 +953,17 @@ describe('validate', () => {
953953
).toEqual({ valid: true });
954954
});
955955

956-
// Issue #677: CUSTOM strategy is now supported
957-
it('accepts CUSTOM strategy', () => {
956+
// AC23: CUSTOM strategy is not supported (Issue #235)
957+
it('rejects CUSTOM strategy', () => {
958958
const result = validateAddMemoryOptions({ ...validMemoryOptions, strategies: 'CUSTOM' });
959-
expect(result.valid).toBe(true);
959+
expect(result.valid).toBe(false);
960+
expect(result.error).toContain('Invalid strategy: CUSTOM');
960961
});
961962

962-
it('accepts CUSTOM mixed with other strategies', () => {
963+
it('rejects CUSTOM even when mixed with valid strategies', () => {
963964
const result = validateAddMemoryOptions({ ...validMemoryOptions, strategies: 'SEMANTIC,CUSTOM' });
964-
expect(result.valid).toBe(true);
965+
expect(result.valid).toBe(false);
966+
expect(result.error).toContain('Invalid strategy: CUSTOM');
965967
});
966968

967969
// AC24: Each individual valid strategy should pass

src/cli/commands/add/validate.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
BuildTypeSchema,
55
GatewayExceptionLevelSchema,
66
GatewayNameSchema,
7-
MemoryStrategyTypeSchema,
87
ModelProviderSchema,
98
ProtocolModeSchema,
109
RuntimeAuthorizerTypeSchema,
@@ -34,8 +33,8 @@ export interface ValidationResult {
3433
}
3534

3635
// Constants
37-
const MEMORY_OPTIONS = ['none', 'shortTerm', 'longAndShortTerm', 'custom'] as const;
38-
const VALID_STRATEGIES: readonly string[] = MemoryStrategyTypeSchema.options;
36+
const MEMORY_OPTIONS = ['none', 'shortTerm', 'longAndShortTerm'] as const;
37+
const VALID_STRATEGIES = ['SEMANTIC', 'SUMMARIZATION', 'USER_PREFERENCE', 'EPISODIC'];
3938

4039
/**
4140
* Validate that a credential name exists in the project spec.
@@ -135,7 +134,7 @@ export function validateAddAgentOptions(options: AddAgentOptions): ValidationRes
135134
if (!MEMORY_OPTIONS.includes(options.memory as (typeof MEMORY_OPTIONS)[number])) {
136135
return {
137136
valid: false,
138-
error: `Invalid memory option: ${options.memory}. Use none, shortTerm, longAndShortTerm, or custom`,
137+
error: `Invalid memory option: ${options.memory}. Use none, shortTerm, or longAndShortTerm`,
139138
};
140139
}
141140
// Parse and validate lifecycle configuration for import path
@@ -243,7 +242,7 @@ export function validateAddAgentOptions(options: AddAgentOptions): ValidationRes
243242
if (!MEMORY_OPTIONS.includes(options.memory as (typeof MEMORY_OPTIONS)[number])) {
244243
return {
245244
valid: false,
246-
error: `Invalid memory option: ${options.memory}. Use none, shortTerm, longAndShortTerm, or custom`,
245+
error: `Invalid memory option: ${options.memory}. Use none, shortTerm, or longAndShortTerm`,
247246
};
248247
}
249248
}

0 commit comments

Comments
 (0)