feat(project): add project add memory - #2025
Open
notgitika wants to merge 12 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor #2025 +/- ##
============================================
+ Coverage 97.14% 97.16% +0.02%
============================================
Files 382 383 +1
Lines 22884 23120 +236
============================================
+ Hits 22231 22465 +234
- Misses 653 655 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Hweinstock
reviewed
Aug 18, 2026
notgitika
force-pushed
the
feat/project-add-memory
branch
from
August 19, 2026 01:27
d114ff9 to
a332f9b
Compare
Contributor
Author
|
My agent ran focused testing for
The testing surfaced and we fixed empty shorthand entries, recursive unsupported-field stripping (including |
nborges-aws
reviewed
Aug 19, 2026
Registers a `memory` leaf under `project add`, following the same SDK-union -> flat project-schema conversion pattern as `project add harness`. A memory scaffolds no files, so the command only appends an entry to `spec.memories` in agentcore.json; the L3 CDK turns that into an `AWS::BedrockAgentCore::Memory` at deploy time. Flags: --name, --event-expiry-duration, --strategies, --indexed-keys, --stream-delivery-resources, --encryption-key-arn, --execution-role-arn, --tags. --strategies accepts two forms: a comma-separated list of strategy types expanded with the CLI's default namespace templates, or a JSON MemoryStrategyInput[] mirroring the CreateMemory API for strategies that need explicit names, descriptions, or namespaces. clientToken is excluded (it is CreateMemory idempotency and this command makes no API call), and description is excluded until the L3 CDK schema supports it.
Stores an optional memory description in agentcore.json, matching the CreateMemory API's description field (max 4096 characters). The generated CDK app pins @aws/agentcore-cdk 0.1.0-alpha.45, whose MemorySchema is a non-strict z.object with no description field, so the key is stripped at synth rather than rejected until aws/agentcore-l3-cdk-constructs#325 ships and that pin is bumped. The flag help text says so.
The CDK's memory schema already models CUSTOM (@aws/agentcore-cdk
0.1.0-alpha.45 maps it to CFN customMemoryStrategy), so the CLI's four-type
enum was the outlier. A customMemoryStrategy in the --strategies JSON now
converts to { type: 'CUSTOM', name, description, namespaceTemplates }.
The shorthand form still takes managed types only: CUSTOM has no default
namespaces to expand. An extraction configuration or memoryRecordSchema is
rejected rather than dropped, since the CDK schema carries neither.
Also names the offending field in the memory validation error.
Reverts 87be86e. I added CUSTOM because the CDK schema already had it in MemoryStrategyTypeSchema, which turns out to be the argument PR aws#694 made -- and aws#713 reverted a day later. The CLI has removed CUSTOM twice on purpose. Offering the type without somewhere to put its extraction configuration is aws#241 ("select custom memory strategy, note there is no option to add prompts"); aws#266 removed it as a P0 to stop users picking an unsupported option, aws#694/aws#696 added it back with semanticOverride, and aws#713 reverted both as premature. aws#676 tracks doing it properly. The CDK keeping CUSTOM in its enum without a configuration field is the same hole, not a licence. So both forms are rejected again, now with an error that says why and points at aws#676. The one thing kept from the reverted commit: memory validation errors name the offending field, since issue.path was being dropped.
The one-line flag description is enough; the deploy-time caveat lives in the PR discussion rather than in help output.
notgitika
force-pushed
the
feat/project-add-memory
branch
from
August 20, 2026 04:48
6d965bf to
4a06960
Compare
nborges-aws
reviewed
Aug 20, 2026
| flag( | ||
| "event-expiry-duration", | ||
| "how long raw events are retained, in days (3-365)", | ||
| z.number().int().min(3).max(365).default(DEFAULT_EVENT_EXPIRY_DURATION), |
Contributor
There was a problem hiding this comment.
Is 3 day min here correct? I thought min was 7 in CDK
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.
This PR adds
agentcore project add memory, which validates and appends a memory resource tospec.memoriesinagentcore.json. Memory resources do not scaffold any application files and are deployed through the generated CDK application.Example:
To maintain parity with the xisting CLI functionality, while also adding more configurability and customization,
--strategiessupports 2 input types:MemoryStrategyInput[]for explicit names, descriptions, and namespaces (there is a parameter help in--helpfor ease of understanding for the user)The command also supports expiry duration, indexed keys, stream delivery, encryption and execution roles, descriptions, and tags (description is a new optional field. Here is the CDK PR for it https://github.com/aws/agentcore-l3-cdk-constructs/pull/325 )
Callouts:
Validation
I tested it myself e2e with different combinations, flags, strategy conversions and validation failures. It all works well. I also tested it with
agetncore project buildTODO: check compatibility with
harnessresource