Skip to content

feat: add support for LTM metadata#1281

Open
nborges-aws wants to merge 2 commits into
mainfrom
feat/LTM-metadata-support
Open

feat: add support for LTM metadata#1281
nborges-aws wants to merge 2 commits into
mainfrom
feat/LTM-metadata-support

Conversation

@nborges-aws
Copy link
Copy Markdown
Contributor

Description

Adds support for AgentCore Memory's indexed metadata keys to the CLI. Indexed keys are declared at the memory level and enable filtering LTM records on retrieval. Each key has a name and a value type (STRING, STRINGLIST, NUMBER). There is a 10 key max per memory.

Schema:

  • New IndexedKeyTypeSchema enum and IndexedKeySchema in agentcore-project.ts
  • MemorySchema gains optional indexedKeys field with 10 key max, enforced uniqueness, and a superRefine that rejects indexedKeys when no strategies are present.

Non-interactive CLI:

  • Repeatable --indexed-key <key:TYPE> flag on agentcore add memory. Accumulates into a list, parsed by a shared parseIndexedKeyArg helper in indexed-key-parser.ts

Interactive TUI:

  • New step in the agentcore add memory wizard that conditionally appears only when at least one LTM strategy is selected. Step has four sub-states: prompt → keyName → keyType → addAnother, with a tally of ✓ name (TYPE) shown above each input.
  • Inline validation matches the schema. Auto-finishes the step at the 10-key cap. Esc/back navigation walks back through previous inputs.
  • "Clear keys" option for convenience bulk removing key selections
  • Selecting a non-LTM strategy mix on the strategies step clears any previously-collected indexed keys, so a stale list never surfaces
  • "Indexed Keys" line on the confirm screen lists the saved keys.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published: depends on https://github.com/aws/agentcore-l3-cdk-constructs/pull/224

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@nborges-aws nborges-aws requested a review from a team May 16, 2026 21:43
@github-actions github-actions Bot added the size/l PR size: L label May 16, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.14.0.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-1281-tarball/aws-agentcore-0.14.0.tgz

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.53% 9220 / 21179
🔵 Statements 42.78% 9780 / 22857
🔵 Functions 40.19% 1590 / 3956
🔵 Branches 40.31% 6003 / 14891
Generated in workflow #3051 for commit 9ae5e89 by the Vitest Coverage Report Action

Copy link
Copy Markdown

@agentcore-cli-automation agentcore-cli-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature with a tight scope and good unit-test coverage on the parser/validator. A few things to address before merging:

  1. The TUI re-hydrates indexed-key state by calling setState during render — should be a useEffect to avoid Strict-Mode warnings and double-render surprises.
  2. The TUI key-name validation duplicates the regex/length rules that already live in indexed-key-parser.ts. Reuse the shared constants so they can't drift.
  3. add.memory telemetry doesn't capture anything about indexed keys. Per src/cli/telemetry/README.md new features should be instrumented (e.g. indexed_key_count / has_indexed_keys).

There's also a minor UX papercut on Esc-back from the key-type sub-step (the previously-typed key name is silently lost) — non-blocking but worth tightening up while you're in here.

Comment thread src/cli/tui/screens/memory/AddMemoryScreen.tsx Outdated
Comment thread src/cli/tui/screens/memory/AddMemoryScreen.tsx Outdated
Comment thread src/cli/tui/screens/memory/AddMemoryScreen.tsx Outdated
Comment thread src/cli/tui/hooks/useCreateMemory.ts
Comment thread src/cli/primitives/MemoryPrimitive.tsx
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 16, 2026
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels May 16, 2026
@nborges-aws nborges-aws deployed to e2e-testing May 16, 2026 23:06 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants