feat(memory): add CUSTOM strategy type to agentcore-cli (#677)#694
Open
aidandaly24 wants to merge 5 commits intoaws:mainfrom
Open
feat(memory): add CUSTOM strategy type to agentcore-cli (#677)#694aidandaly24 wants to merge 5 commits intoaws:mainfrom
aidandaly24 wants to merge 5 commits intoaws:mainfrom
Conversation
Enable self-managed (CUSTOM) memory strategy in the CLI, aligning with the CDK constructs which already support customMemoryStrategy via CloudFormation. Changes: - Add CUSTOM to MemoryStrategyTypeSchema enum and validation - Add CUSTOM description to TUI wizard strategy picker - Update CLI help text, LLM-compacted types, and AGENTS.md - Add documentation for self-managed strategy in docs/ - Update tests: flip rejection tests to acceptance, add new cases - Regenerate asset snapshots Constraint: CDK already maps CUSTOM → customMemoryStrategy in CFN Rejected: New SELF_MANAGED type | cross-layer naming inconsistency with CDK Confidence: high Scope-risk: narrow
Eliminates source-of-truth drift by deriving the valid strategies array and CLI help text from MemoryStrategyTypeSchema.options instead of maintaining hand-written duplicates. Constraint: MemoryStrategyTypeSchema is the single source of truth Confidence: high Scope-risk: narrow
Without this, selecting CUSTOM as the only strategy would render an empty retrieval_config dict with no guidance. Now both HTTP and A2A Strands templates include a CUSTOM Handlebars block with a TODO comment guiding users to add their own namespace and retrieval config. Constraint: CUSTOM is self-managed — no default namespaces to vend Rejected: Auto-generating a placeholder namespace | would mislead users into thinking it works out of the box Confidence: high Scope-risk: narrow
…ories to new agents Add 'custom' as a 4th MemoryOption in the create/add-agent wizards, completing CUSTOM strategy support across all CLI flows. When adding an agent to a project with existing memories, the template now references all existing memories instead of always creating new ones. - Add 'custom' to MemoryOption type, MEMORY_OPTIONS array, and all validation/help text across create and add-agent commands - Add 'custom' case to mapGenerateInputToMemories (CUSTOM strategy, no default namespaces) and getMemoryLabel in wizard UI - Add mapExistingMemoriesToProviders() to convert project Memory[] to MemoryProviderRenderConfig[] for template rendering - Update mapGenerateConfigToRenderConfig to accept existing memories and merge them with new memory providers (deduped by name) - Update writeAgentToProject to skip adding duplicate memories - Wire existing project.memories through both add-agent paths (AgentPrimitive CLI + useAddAgent TUI hook) Constraint: Strands Agent takes a single session_manager, so session.py references memoryProviders[0] as the primary memory Rejected: Multi-select wizard for memory | template only supports one session_manager, all memory env vars already available at runtime Confidence: high Scope-risk: moderate
Add 18 new tests to schema-mapper.test.ts covering: - mapGenerateInputToMemories with 'custom' MemoryOption - mapGenerateConfigToResources with custom memory - mapGenerateConfigToRenderConfig with existingMemories parameter (dedup logic, hasMemory from existing, combining existing + new) - mapExistingMemoriesToProviders (CUSTOM, empty strategies, multiple) Also fix docs/configuration.md missing EPISODIC strategy row. Constraint: CUSTOM strategy has no default namespaces or reflectionNamespaces Constraint: Dedup operates on provider name, not strategy type Confidence: high Scope-risk: narrow
59f7804 to
7dc39dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
CUSTOMas a 5th memory strategy type across schema, CLI, TUI, docs, and tests. This enables users to configure self-managed memory strategies with user-controlled extraction logic, closing the gap between the CDK (which already supportedCUSTOM) and the CLI.Closes #677
Changes
CUSTOMtoMemoryStrategyTypeSchemaZod enum (single source of truth)CUSTOMdescription to TUI strategy selection screen'custom'as a newMemoryOptionin the project create wizardCUSTOMintentionally has no default namespaces inDEFAULT_STRATEGY_NAMESPACES(usesPartial<Record>for type safety)CUSTOMblock to session.py Handlebars templates (HTTP and MCP)mapExistingMemoriesToProvidersfor dedup when adding agents to projects with existing memoriesmemory.md,commands.md,configuration.md) andAGENTS.mddocs/configuration.mdTUI Screenshots
Strategy selection — all 5 strategies visible (including new CUSTOM):
CUSTOM strategy selected:
Confirmation screen with CUSTOM strategy:
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsTest results:
New test coverage includes:
mapGenerateInputToMemories('custom')— single CUSTOM strategy, no namespaces/reflectionNamespacesmapGenerateConfigToResourceswithmemory: 'custom'mapExistingMemoriesToProviders— CUSTOM strategy, empty strategies, multiple memoriesmapGenerateConfigToRenderConfigwithexistingMemories— dedup logic, hasMemory from existing, combining existing + new custom memoryChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.