Skip to content

feat(memory): add read-only event and record commands - #1895

Open
notgitika wants to merge 5 commits into
refactorfrom
feat/memory-events-records-cli
Open

feat(memory): add read-only event and record commands#1895
notgitika wants to merge 5 commits into
refactorfrom
feat/memory-events-records-cli

Conversation

@notgitika

@notgitika notgitika commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This PR adds get and list commands for memory events and records and tests for the same.
Core + handler implementation only, no-TUI so far.

bun run typecheck, format, lint and test passed (there was one un-related failure, not introduced by this commit. ran bun test src/handlers/memory/memory.test.tsx to confirm)
Smoke tested with my account.

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 3, 2026
@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.18056% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.08%. Comparing base (5d00ac0) to head (ae6a526).

Files with missing lines Patch % Lines
src/handlers/memory/metadataFilters.ts 81.66% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           refactor    #1895    +/-   ##
==========================================
  Coverage     96.08%   96.08%            
==========================================
  Files           224      231     +7     
  Lines         11282    11569   +287     
==========================================
+ Hits          10840    11116   +276     
- Misses          442      453    +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@notgitika
notgitika marked this pull request as ready for review August 3, 2026 20:34
tejaskash
tejaskash previously approved these changes Aug 3, 2026

@tejaskash tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread src/core/memory.tsx
@@ -1,3 +1,17 @@
import {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT - can this be a TS file since it doesn't contain any JSX

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah yes, I was just following the convention in the other files. I can get a follow up PR that fixes it for everything

Comment thread src/handlers/memory/event/get/index.tsx Outdated
name: "get",
description: "get an AgentCore Memory Event",
flags: [
flag("memory", "the ID of the Memory", z.string()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you check out other primitives right now we use .optional() on everything. The general standard we've set in the CLI is to make all commands optional in Commander and then check for required flags separately and throw InputValidationError. The execution order we are looking for from my understanding is:

  1. Commander parses and validates required options.
  2. The router action runs.
  3. Middleware runs.
  4. The Runtime handler runs.
    This is not meant to be forever, but until we figure out a solution for this. For example check out this PR: fix(runtime): defer invoke required flag validation #1876

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

completely forgot about this one! fixing it now

throw new InputValidationError("'--include-parent-branches' requires '--branch'");
}

const eventMetadata = parseJsonFlag<EventMetadataFilterExpression[]>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

parseJsonFlag<EventMetadataFilterExpression[]> only casts the parsed JSON. I tested --metadata-filters '{}', and it reached the SDK as {"filter":{"eventMetadata":{}}} instead of failing locally. The command contract says structured JSON should reject incorrect top-level types and invalid members, so event and record filters should use runtime schemas and test a non-array and malformed expression.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nice catch, lemme fix it

Comment thread README.md
agentcore memory get --id <memoryId>
agentcore memory get --id <memoryId> --view without_decryption
agentcore memory list --max-results 20
agentcore memory event get --memory <memoryId> --actor-id <actorId> --session-id <sessionId> --event-id <eventId>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The examples include these commands, but the command tree still shows Memory with only get and list. We should add the event and record groups there too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

interesting, I thought it did, let me check

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be lines 68-70 i believe

aidandaly24
aidandaly24 previously approved these changes Aug 3, 2026

@aidandaly24 aidandaly24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for making the updates this LGTM

z.object({ stringValue: z.string() }).strict(),
z.object({ stringListValue: z.array(z.string()) }).strict(),
z.object({ numberValue: z.number() }).strict(),
z.object({ dateTimeValue: z.coerce.date() }).strict(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we replace this with something like:

z.object({
  dateTimeValue: z.iso.datetime().transform((value) => new Date(value)),
}).strict()

Otherwise, z.coerce.date() will accept values like null and zero and resolve them to dates instead of rejecting the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants