Skip to content

Add memory changes CLI for write history - #921

Merged
jennsun merged 6 commits into
mainfrom
jennsun/memory-changes-cli
Nov 20, 2026
Merged

jennsun merged 6 commits into
mainfrom
jennsun/memory-changes-cli

Conversation

@jennsun

@jennsun jennsun commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What did you change, and why?

See CLI design and commands: https://docs.google.com/document/d/1BbV6TifUjdTdz1VydSAaphsWDuu3p7nCBKh_vO-EhRk/edit?tab=t.ddxygv1ljga2#bookmark=id.5ejewnrgocup

Memory writes can come from agent tools, Dreamer, or manual/API edits. Add CLI access to the memory changes APIs so users can inspect write provenance and retrieve immutable entry versions for comparison.

  • agentbricks memory changes list --store ...: change metadata, actor/source/literal path-prefix filters, and explicit pagination.
  • agentbricks memory changes get CHANGE_ID --store ...: header and entry versions, exact entry/path filters, and entry pagination. JSON preserves previous_change_id; users can retrieve the predecessor by entry identity even when its path changed.
  • Add help examples, the command reference, and history-inspection guidance in the bundled agent-bricks-workflow skill.

Uses the canonical /api/2.0/agents/memory-stores/{store}/changes endpoints and existing SDK authentication/error handling. Read-only; requires backend history enablement. No dependency, schema, or runtime write-path changes.

How do you know it works?

  • 111 focused tests passed (75 new history cases plus existing CLI/help tests): query mapping, validation, pagination, multi-entry responses, tombstones, predecessor lookups, literal content rendering, and API errors.
  • Package-wide Ruff lint/format and ty check passed with all extras installed.
  • Built and installed the wheel in a clean environment using published dependencies, then installed the exact published source commit from GitHub and verified help and a live read.
  • 28 live read checks passed against a preview service using a test-only route adapter: all three sources, list pagination, exact/prefix filters, predecessor retrieval, invalid tokens, and missing changes. Multi-entry detail pagination is covered offline; sampled live changes each held one entry. Canonical gateway routing awaits backend deployment; no preview routing overrides are shipped.
  • Full unit suite with all extras: 3893 passed, 25 skipped, 1 failed. The failure is stores_lookup_test.py::test_terminal_table_keeps_each_row_on_one_line_when_identifiers_fill_it, reproduced on unchanged main at e50cab5 in the same environment; the history/CLI tests pass. No existing tests were disabled or changed.

GitHub CI on 516edc6: 55 passed, 0 failed, 0 pending (tests, lint/type/format). The two automated reviewer/approval checks are skipped while this PR is draft.

@jennsun
jennsun marked this pull request as ready for review November 18, 2026 21:50
@jennsun
jennsun requested review from nihit and qinxinw-db November 18, 2026 21:58
@github-actions

Copy link
Copy Markdown
Contributor

AgentBricksReviewer

Review score: 100/100 · reviewers: 2/2 · Change risk: MODERATE · risk:medium

Summary

No findings.

Approach: The approach is sound and follows existing command, transport, authentication, error-handling, and rendering patterns. More in Details.

Risk

Adds public CLI commands and authenticated history reads through the AgentKit transport. Requests are explicitly paginated and do not mutate persistent state, making rollback straightforward. Boundary tests cover request mapping and output, but canonical gateway routing and backend compatibility remain unverified by this review.

AI approval

Review checks passed (ai-approved); not eligible for auto-approval. To unblock:

  • Split the PR to at most 500 changed lines (it has 720).

Or ask a maintainer to approve.

Details

Approach: The approach is sound and follows existing command, transport, authentication, error-handling, and rendering patterns. Keeping history-source normalization separate preserves the narrower source choices for entry creation. Explicit pagination avoids unbounded history traversal, and literal text rendering avoids interpreting memory content as Rich markup.

Review rules: REVIEW.md and integrations/agentbricks/REVIEW.md at e50cab5 · checked: BRIDGE-001–010 and AGENTBRICKS-001–003, where applicable · gaps: none.

Diff size (computed): 7 files; +720 / -0 lines (720 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 1 352 0 48.9%
Documentation 2 87 0 12.1%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 4 281 0 39.0%

Changes

Adds memory-change listing and detail commands, transport methods, help examples, CLI documentation, bundled workflow guidance, and unit tests. JSON preserves the response fields needed for predecessor lookup, including when an entry’s path changes.

The size is justified by the filter, validation, pagination, and rendering cases. No dependency changes or concrete opportunities for substantial reduction were identified.

Tests

Test-by-test assessment
Test / case Behavior protected Layer Needed? Action / rationale
integrations/agentbricks/tests/unit_tests/memory_changes_cli_test.py Filter mapping, source aliases, defaults, JSON preservation, pagination, tombstones, predecessor lookup, input validation, API failures, literal rendering, and unchanged entry-creation choices CLI through transport with SDK boundary mocked; direct transport validation keep Exercises observable command behavior and outbound requests without live dependencies. Existing assertions are not weakened.

Both Claude and Codex delivered reviews covering correctness and public API behavior; all remaining lenses were checked. Offline probes exercised request mapping, pagination, normalization, and invalid inputs. The pytest suite was not run because pytest was unavailable; the PR’s reported test and CI totals were not independently verified.

Mocked-boundary coverage is appropriate for the CLI changes. Canonical routing, backend filtering semantics, and authorization enforcement still require service-level evidence; the reported preview checks do not establish canonical gateway availability.

Scope

All seven changed files support read-only memory-history inspection. Implementation, tests, help, CLI reference, and workflow guidance serve the same outcome. No unrelated changes were found.


Automated review by AgentBricksReviewer for 516edc6 · workflow run · comment /review to re-run

@github-actions github-actions Bot added ai-approved Passed AI findings and coverage checks; not a GitHub approval risk:medium Change risk assessed by AgentBricksReviewer: medium labels Nov 18, 2026
The control-plane read API merged with a different shape from the one
this CLI was written against:

- ListMemoryChangesResponse names its list `memory_changes`, so the
  text table read from `changes` would show a store with history as
  empty.
- GetMemoryChange is keyed by the change name alone. Drop get's
  --memory-entry-id, --path, --page-size, and --page-token.
- ListMemoryChanges accepts `memory_entry_id`. Expose it as
  `changes list --memory-entry-id`, which is now how one entry's
  version history is read.

Rename the client method to get_memory_change to match the RPC, and
update the CLI reference, help examples, and workflow guidance to the
new predecessor and entry-history flow.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot removed the risk:medium Change risk assessed by AgentBricksReviewer: medium label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Automatic push review attempt 3/3 reserved. Failed attempts count toward this limit. After the limit, comment /review to request another review. Latest attempt

@github-actions github-actions Bot removed the ai-approved Passed AI findings and coverage checks; not a GitHub approval label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AgentBricksReviewer

Review score: 100/100 · reviewers: 2/2 · Change risk: MODERATE · risk:medium

Summary

No findings.

Approach: The approach is sound: a dedicated command module uses the existing private API client, authentication, rendering, and error-handling patterns. More in Details.

Risk

Adds public CLI commands and HTTP reads in integrations/agentbricks/. Authentication and error handling reuse existing infrastructure; no persistent writes, dependency changes, or migrations are introduced, so rollback is straightforward. Offline checks support the implementation, but canonical backend routing and response contracts were not independently verified.

AI approval

Review checks passed (ai-approved); not eligible for auto-approval. To unblock:

  • Split the PR to at most 500 changed lines (it has 645).

Or ask a maintainer to approve.

Details

Approach: The approach is sound: a dedicated command module uses the existing private API client, authentication, rendering, and error-handling patterns. Claude Code and Codex independently checked correctness, public API compatibility and UX, security, tests, architecture, performance, and operational safety. No materially simpler implementation was identified.

Review rules: REVIEW.md, integrations/agentbricks/REVIEW.md at trusted default-branch checkout, base e50cab552e74baf87d6cbc4a77bb9e51f50828fa · checked: BRIDGE-001–010, AGENTBRICKS-001–003, with inapplicable rules excluded · gaps: no rule-discovery gaps; pytest and live backend verification unavailable.

Diff size (computed): 7 files; +645 / -0 lines (645 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 1 293 0 45.4%
Documentation 2 91 0 14.1%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 4 261 0 40.5%

Changes

Adds read-only memory-change listing and retrieval, transport methods, CLI registration and help, command documentation, workflow guidance, and unit tests. The implementation is additive, and JSON preserves returned fields.

The size is justified by validation, output rendering, documentation, and parametrized coverage. No necessary reduction was identified.

Tests

Test-by-test assessment
Test / case Behavior protected Layer Needed? Action / rationale
integrations/agentbricks/tests/unit_tests/memory_changes_cli_test.py Query mapping, identifier/path validation, pagination options, source selection, JSON preservation, literal rendering, tombstones, and API errors Unit: CLI through client transport with SDK HTTP mocked keep Exercises parsing and request construction without mocking the new client methods. A two-page list sequence preserving filters would strengthen coverage.

The pytest suite was not executed because pytest was unavailable. Codex executed isolated, in-memory smoke checks against selected head definitions; those passed with HTTP and rendering mocked. Author-reported test totals, CI results, and live checks were not independently verified. Existing infrastructure tests plus the added unit tests provide relevant offline coverage, but do not establish deployed backend compatibility.

Scope

All seven changed files support memory-history inspection; no unrelated changes were found.

The PR description overstates detail retrieval: integrations/agentbricks/cli.md:675 explicitly documents that get has no filters or paging, matching the command definition at integrations/agentbricks/src/databricks_agentbricks/cli/memory_changes.py:128. Update the description to match the implemented scope.


Automated review by AgentBricksReviewer for 497936e · workflow run · comment /review to re-run

@github-actions github-actions Bot added ai-approved Passed AI findings and coverage checks; not a GitHub approval risk:medium Change risk assessed by AgentBricksReviewer: medium labels Nov 19, 2026
- Drop the "requires memory history to be enabled" help line; callers
  cannot toggle it. Shorten the group summary to "Inspect memory write
  history."
- Label each list reference with its kind (session:, run:, request:)
  so caller-chosen session ids and generated ids read consistently.
- Add an actor column to the list table. List responses carry no
  actor, so it is read from each listed change (one request per row,
  text output only).
- Stop printing the continuation token in text output. On a terminal
  the list offers the next page, as the store lists do; otherwise it
  says more changes are available. JSON still returns the token.
- Give an example path in the invalid-path error.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot removed risk:medium Change risk assessed by AgentBricksReviewer: medium ai-approved Passed AI findings and coverage checks; not a GitHub approval labels Nov 19, 2026

@github-actions github-actions Bot 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.

AgentBricksReviewer left 1 inline comment(s) on 22d6292. The score and summary are in the review comment.

return


@changes.command("get")

This comment was marked as outdated.

@github-actions

Copy link
Copy Markdown
Contributor

AgentBricksReviewer

Review score: 100/100 · reviewers: 2/2 · Change risk: MODERATE · risk:medium

Summary

Non-blocking notes

  • Finding — Scope clarification: The PR description claims exact entry/path filters and entry pagination for get, but…

Approach: The approach is sound and follows existing CLI, transport, validation, and rendering patterns. More in Details.

Risk

Adds public memory-history CLI commands and backend GET requests. Text listing fetches each change’s details to populate actors, increasing request volume. Changes are read-only and readily reversible, with no persistence, dependency, or write-path changes. Unit coverage is substantial, but canonical backend routing and response semantics were not independently verified.

AI approval

Review checks passed (ai-approved); not eligible for auto-approval. To unblock:

  • Split the PR to at most 500 changed lines (it has 742).

Or ask a maintainer to approve.

Details

Approach: The approach is sound and follows existing CLI, transport, validation, and rendering patterns. Actor enrichment adds a documented request per listed change; a metadata-only table would reduce requests but remove that functionality. JSON output avoids enrichment requests.

Review rules: REVIEW.md, integrations/agentbricks/REVIEW.md at default-branch checkout 43285a104ccf60b2d1f088b3e2dc7d9549288c12 · checked: BRIDGE-001–010, AGENTBRICKS-001–003, with inapplicable rules assessed · gaps: none in review-rule coverage; backend contract and full test execution remain unverified.

Diff size (computed): 7 files; +742 / -0 lines (742 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 1 356 0 48.0%
Documentation 2 93 0 12.5%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 4 293 0 39.5%

Changes

Adds history transport methods, command registration, list/detail rendering, help examples, reference documentation, bundled workflow guidance, and focused tests. Listing supports filters and explicit continuation; detail retrieval displays a whole change and its immutable entry versions.

The size is justified by validation, output-mode, pagination, and rendering coverage. No materially equivalent simplification or unnecessary production-code expansion was identified.

Tests

Test-by-test assessment
Test / case Behavior protected Layer Needed? Action / rationale
integrations/agentbricks/tests/unit_tests/memory_changes_cli_test.py Query mapping, validation, list pagination, whole-change retrieval, multiple entries, tombstones, literal rendering, and API failures CLI-to-mocked-SDK unit tests keep Exercises parsing, transport, and rendering together without live credentials; no existing coverage is weakened.

The Claude and Codex reviewers delivered reports covering both P0 lenses and all P1 lenses collectively. Six standalone offline smoke scenarios passed against head-loaded modules; these were not executions of the authored pytest suite.

Pytest, Ruff, type checking, packaging, and live API checks were not independently rerun. The PR’s reported results remain author-provided evidence. Mocked responses cannot establish canonical routing or backend detail-response semantics; those require backend contract or live-service verification.

Scope

All seven changed files support read-only memory-history inspection. No unrelated changes were found. The scope clarification above concerns the description, not a demonstrated implementation defect.


Automated review by AgentBricksReviewer for 22d6292 · workflow run · comment /review to re-run

@github-actions github-actions Bot added ai-approved Passed AI findings and coverage checks; not a GitHub approval risk:medium Change risk assessed by AgentBricksReviewer: medium labels Nov 19, 2026
When a table's other columns were too wide for the terminal, Rich
shrank the identifier column to nothing and kept the rest, so
`memory changes list` showed no Change ID on a page with long actors
and references but did on a page with short ones.

Cap the non-identifier columns ourselves, widest first, so the
identifier stays whole and every other column stays on screen,
shortened.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot removed risk:medium Change risk assessed by AgentBricksReviewer: medium ai-approved Passed AI findings and coverage checks; not a GitHub approval labels Nov 20, 2026
Answering "what did this change do?" took two `changes get` calls plus
jq and diff. With --diff, each entry version is followed by a line
diff of its content against the version named by previous_change_id:
removed lines in red, added in green, unchanged dimmed. A new entry
is all added; a delete is all removed.

Predecessors are read before anything is printed, and a predecessor
without the entry is an error, so a failed read cannot produce a
partial page or a wrong diff. --diff is text only and is rejected
with -o json.

The +N ~N -N entry counts are now green, amber, and red in both get
and list.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

Copy link
Copy Markdown
Contributor

AgentBricksReviewer

Review score: 100/100 · reviewers: 2/2 · Change risk: MODERATE · risk:medium

Summary

No findings.

Approach: The approach is sound: it extends the existing CLI and authenticated transport without introducing another client or changing write behavior. More in Details.

Risk

Adds public memory-history commands and changes shared terminal-table sizing in integrations/agentbricks. Requests are read-only and reuse existing SDK authentication and error handling; no persistence, dependency, or authorization changes were found. Unit tests cover local behavior, but were not executed during this review, and canonical backend behavior remains independently unverified. Rollback requires no state migration.

AI approval

Review checks passed (ai-approved); not eligible for auto-approval. To unblock:

  • Split the PR to at most 500 changed lines (it has 779).

Or ask a maintainer to approve.

Details

Approach: The approach is sound: it extends the existing CLI and authenticated transport without introducing another client or changing write behavior. Text listing deliberately performs one additional, sequential full-change request per row to obtain actors; JSON output avoids that enrichment. The cost is documented. Removing actor enrichment would reduce requests, but would sacrifice a documented feature rather than provide an equivalent implementation.

Review rules: REVIEW.md, integrations/agentbricks/REVIEW.md @ e50cab552e74baf87d6cbc4a77bb9e51f50828fa · checked: BRIDGE-001–010, AGENTBRICKS-001–003, with inapplicable checks assessed · gaps: no criteria gaps; runtime and deployed-backend validation not independently performed

Diff size (computed): 9 files; +779 / -0 lines (779 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 2 380 0 48.8%
Documentation 2 93 0 11.9%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 5 306 0 39.3%

Changes

The diff adds history command registration, a dedicated command module, transport methods and validation, help examples, command documentation, workflow guidance, tests, and shared table-width handling.

The size is reasonable for the new command surface and its edge-case coverage. The shared renderer change has broader reach than the history commands, but supports keeping change identifiers usable. It could be separated for independent validation, although no unrelated behavior or verified regression was found.

The PR description is stale: it promises exact-entry/path filters and pagination for changes get. At this head, implementation, documentation, and tests consistently define an unfiltered, unpaginated whole-change read. See integrations/agentbricks/cli.md:677 and integrations/agentbricks/tests/unit_tests/memory_changes_cli_test.py:138. The description should reflect that contract.

Tests

Test-by-test assessment
Test / case Behavior protected Layer Needed? Action / rationale
integrations/agentbricks/tests/unit_tests/memory_changes_cli_test.py Query mapping, validation, error exits, JSON preservation, immutable versions, literal rendering, actor enrichment, and interactive pagination CLI/transport component tests with SDK boundary mocked keep Exercises actual parsing and command behavior. Useful additions would cover actor-enrichment failure and declining continuation.
integrations/agentbricks/tests/unit_tests/stores_lookup_test.py Preserves identifiers when other terminal-table columns overflow Presentation unit test keep Appropriate regression coverage for the shared renderer. Extend to the actual six-column history table and tables without identifier columns.

Existing and added tests provide good local contract coverage, but mocked responses cannot establish the deployed API schema or routing.

The supplied diff checksum matched, and git diff --check passed between the supplied base and head. Tests, lint, typecheck, builds, and live requests were not run during this review. Test totals, live checks, and the reported pre-existing suite failure remain author-reported; the cited CI results also concern a different commit from the reviewed head.

Scope

All nine changed files support inspecting memory-write provenance and immutable entry versions. The documentation and bundled workflow guidance accompany the public CLI additions, satisfying AGENTBRICKS-001. No clearly unrelated changes, dependency changes, or write-path changes were found.

Both Claude and Codex delivered reviews covering correctness and public API compatibility. Security, tests, architecture and maintainability, performance, and operational safety were also checked; no verified code defects survived counterexample checks and head verification.


Automated review by AgentBricksReviewer for 3067a80 · workflow run · comment /review to re-run

Text output of `changes get` now always shows each entry's content as
a diff against its previous version, so seeing what a change did needs
no flag. The --diff flag is removed; JSON output is unchanged and
still makes a single request.

Rename the per-entry heading from "Entry Version" to "Entry", and
title the diff box "<path> diff". The previous change id is already in
the entry's fields, so the title no longer repeats it.

Co-authored-by: Isaac <no-reply@databricks.com>
@jennsun
jennsun merged commit 03f658b into main Nov 20, 2026
57 checks passed
@jennsun
jennsun deleted the jennsun/memory-changes-cli branch November 20, 2026 20:19
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.

2 participants