Skip to content

feat(sdkx): tool migration wrappers + Anthropic Memory Tool#79

Merged
lIang70 merged 2 commits into
mainfrom
feat/sdkx-tool-migrations
May 8, 2026
Merged

feat(sdkx): tool migration wrappers + Anthropic Memory Tool#79
lIang70 merged 2 commits into
mainfrom
feat/sdkx-tool-migrations

Conversation

@lIang70

@lIang70 lIang70 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Phase 3 of the sdkx track: lands sdkx/tool/{knowledge,kanban,history,memory} so users can switch their imports before sdk/v0.3.0 deletes the corresponding helpers from sdk/{knowledge,kanban,history}. Public signatures stay identical, so the v0.3.0 cut becomes a pure go get -u for callers — no source edits after the import swap.

Package Strategy
sdkx/tool/knowledge Full mirror (only depends on public sdk/knowledge API).
sdkx/tool/kanban Full mirror; WithKanban/KanbanFrom forward to sdk/kanban so contexts installed on either side interoperate.
sdkx/tool/history Go type alias + delegation. The underlying tools reach into package-private helpers (archiveImpl, loadManifestImpl, SummaryDAG{store,config}) that can't be exported without growing sdk's stable surface. The alias pins the API shape now; the implementation relocates at the sdk/v0.3.0 cut.
sdkx/tool/memory Net-new Anthropic Memory Tool (memory_20250818) wrapper over workspace.Workspace. Single tool, command enum, mandatory /memories prefix, view-byte cap, str_replace ambiguity errors, path-traversal guard.

Each package ships a doc.go explaining the sdkx layering rationale and migration path. Tests cover:

  • mechanical contracts (definition names, registry registration);
  • kanban context-key interop (sdk-installed ↔ sdkx-readable, both directions);
  • history type-alias interop (var sdk Hist.ToolDeps = sdkx.ToolDeps{});
  • all 6 memory commands incl. truncation, prefix enforcement, and traversal denial.

docs/migrations/v0.3.0.md: documents sdk↔sdkx release coordination — users do a one-line import swap during v0.2.x, then a paired go get -u at v0.3.0 cut, no other source edits.

Test plan

  • make fmt clean across the workspace
  • cd sdkx && go vet ./...
  • cd sdkx && go test ./tool/... -count=1 — all four packages pass
  • kanban context-key interop test exercises both directions
  • history type-alias interop test guards against future type Foo X regression
  • memory tool: 15/15 cases incl. truncation, traversal denial, str_replace ambiguity

Notes

  • Pure additive in sdk (zero changes); no [skip-tag:sdk] needed.
  • The history package is intentionally a thin forwarding layer in v0.2.x — see commit message and the package doc.go for why path D (alias + delegation) was preferred over exporting private helpers or duplicating archive logic.

Made with Cursor

lIang70 and others added 2 commits May 8, 2026 16:47
Land sdkx/tool/{knowledge,kanban,history,memory} so users can switch
imports off the deprecated sdk/{knowledge,kanban,history} tool helpers
ahead of sdk/v0.3.0. Public signatures stay identical, so the eventual
v0.3.0 cut is a `go get -u` with no source-level changes for callers.

- knowledge: full mirror (uses only public sdk/knowledge API).
- kanban: full mirror; WithKanban/KanbanFrom forward to sdk/kanban so
  contexts installed on either side interoperate during the transition.
- history: type alias + delegation. The underlying tools reach into
  package-private archive helpers (archiveImpl, loadManifestImpl,
  SummaryDAG{store,config}) which can't be exported without growing
  sdk's stable surface. The alias pins the API shape now; the impl
  relocates at sdk/v0.3.0 cut.
- memory: net-new Anthropic Memory Tool (memory_20250818) wrapper over
  workspace.Workspace. Single tool, command enum, mandatory /memories
  prefix, str_replace ambiguity errors out, view truncation cap.

Each package ships a doc.go explaining the sdkx layering rationale and
the migration path, plus tests covering API contracts (incl. context-key
interop for kanban and the type-alias contract for history).

docs/migrations/v0.3.0.md: document the sdk↔sdkx release coordination
so users understand the two-step upgrade (import swap during v0.2.x,
then dual `go get -u` at v0.3.0 cut).

Co-authored-by: Cursor <cursoragent@cursor.com>
The first cut stripped /memories entirely when forwarding to
workspace.Workspace, which dumped Memory Tool writes at the workspace
root and would collide with peer subsystems (recall/, knowledge/,
history/) once they migrate to fs-backed storage on the same workspace.

Preserve the "memories" segment so the tool stays sandboxed in
<workspace>/memories/, peer to the other subtrees. Adds:

- TestSubtreeIsolation: pre-seeds recall/ and knowledge/ peer
  subtrees, verifies Memory Tool view doesn't leak them and writes
  don't disturb them.
- TestViewMemoriesRoot: viewing an empty /memories root succeeds
  with empty entries (List ErrNotFound is tolerated).

Doc.go updated to make the layout explicit, including the option
to wrap with workspace.NewScopedWorkspace for defensive enforcement.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lIang70
lIang70 merged commit 40c4406 into main May 8, 2026
13 checks passed
@lIang70
lIang70 deleted the feat/sdkx-tool-migrations branch May 8, 2026 09:11
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.

1 participant