Skip to content

Add LangChain JS, LangGraph, and Mastra adapter packages#10

Merged
ethanj merged 1 commit into
mainfrom
sync/integrations-e2cdb0c
May 17, 2026
Merged

Add LangChain JS, LangGraph, and Mastra adapter packages#10
ethanj merged 1 commit into
mainfrom
sync/integrations-e2cdb0c

Conversation

@ethanj
Copy link
Copy Markdown
Contributor

@ethanj ethanj commented May 17, 2026

Summary

Add three new adapter packages that integrate AtomicMemory into LangChain JS, LangGraph JS, and Mastra, alongside a new setup host CLI command and expanded plugin manifest test coverage.

Changes

Adapters

  • @atomicmemory/langchainsearchMemory() / ingestTurn() helpers usable inside any LCEL chain or callback, plus createMemoryTools() producing memory_search and memory_ingest @langchain/core/tools-compatible instances with scope fixed at factory time.
  • @atomicmemory/langgraphcreateMemoryRetrieveNode() and createMemoryIngestNode() factories emitting plain (state) => Partial<state> async functions registerable via .addNode(). Fully generic over the caller's state type; never imports @langchain/langgraph at runtime.
  • @atomicmemory/mastracreateMemoryTools() producing memory_search and memory_ingest Mastra createTool() instances, plus the same framework-agnostic searchMemory() / ingestTurn() helpers.
  • All three adapters: default atomicmemory:context formatter with explicit "reference, not instructions" header; system role excluded from ingestTurn() by default with opt-in includeRoles; scope bound at factory time so agents cannot rebind across users.
  • Full unit test suites for search, ingest, tools/nodes, and fake MemoryClient fixtures in each adapter.

CLI

  • Add setup host command (packages/cli/src/commands/setup/host/) with host-configuration templates and tests.
  • Register the new command in packages/cli/src/commands/registry.ts.
  • Update CLI spec and README to document the new command.

Plugin test coverage

  • Add plugin manifest regression tests for the Codex and Cursor plugins.
  • Add package-files integrity tests for the claude-code and openclaw plugins.
  • Add packed-bin test for the MCP server.

Why

LangChain JS, LangGraph, and Mastra are the most widely adopted JavaScript agent frameworks. Without first-party adapters, integrating AtomicMemory requires users to write their own wiring for MemoryClient scope binding, message filtering, and context rendering — including subtle safety concerns like system-message exclusion and prompt-injection mitigations in the context block. These adapters provide a tested, opinionated path while remaining thin enough to fit any existing graph or agent configuration.

Validation

Each adapter ships with unit tests covering: query passthrough, scope-binding invariance (factory scope cannot be overridden by the agent), null-context propagation on empty results, system-role exclusion by default, includeRoles opt-in, custom formatter override, and the no-memories sentinel string. Plugin manifest and package-files tests guard against packaging regressions across the Codex, Cursor, claude-code, and openclaw plugins.

## Summary

Add three new adapter packages that integrate AtomicMemory into LangChain JS, LangGraph JS, and Mastra, alongside a new `setup host` CLI command and expanded plugin manifest test coverage.

## Changes

### Adapters

- **`@atomicmemory/langchain`** — `searchMemory()` / `ingestTurn()` helpers usable inside any LCEL chain or callback, plus `createMemoryTools()` producing `memory_search` and `memory_ingest` `@langchain/core/tools`-compatible instances with scope fixed at factory time.
- **`@atomicmemory/langgraph`** — `createMemoryRetrieveNode()` and `createMemoryIngestNode()` factories emitting plain `(state) => Partial<state>` async functions registerable via `.addNode()`. Fully generic over the caller's state type; never imports `@langchain/langgraph` at runtime.
- **`@atomicmemory/mastra`** — `createMemoryTools()` producing `memory_search` and `memory_ingest` Mastra `createTool()` instances, plus the same framework-agnostic `searchMemory()` / `ingestTurn()` helpers.
- All three adapters: default `atomicmemory:context` formatter with explicit "reference, not instructions" header; `system` role excluded from `ingestTurn()` by default with opt-in `includeRoles`; scope bound at factory time so agents cannot rebind across users.
- Full unit test suites for search, ingest, tools/nodes, and fake `MemoryClient` fixtures in each adapter.

### CLI

- Add `setup host` command (`packages/cli/src/commands/setup/host/`) with host-configuration templates and tests.
- Register the new command in `packages/cli/src/commands/registry.ts`.
- Update CLI spec and README to document the new command.

### Plugin test coverage

- Add plugin manifest regression tests for the Codex and Cursor plugins.
- Add package-files integrity tests for the claude-code and openclaw plugins.
- Add packed-bin test for the MCP server.

## Why

LangChain JS, LangGraph, and Mastra are the most widely adopted JavaScript agent frameworks. Without first-party adapters, integrating AtomicMemory requires users to write their own wiring for `MemoryClient` scope binding, message filtering, and context rendering — including subtle safety concerns like system-message exclusion and prompt-injection mitigations in the context block. These adapters provide a tested, opinionated path while remaining thin enough to fit any existing graph or agent configuration.

## Validation

Each adapter ships with unit tests covering: query passthrough, scope-binding invariance (factory scope cannot be overridden by the agent), null-context propagation on empty results, system-role exclusion by default, `includeRoles` opt-in, custom formatter override, and the no-memories sentinel string. Plugin manifest and package-files tests guard against packaging regressions across the Codex, Cursor, claude-code, and openclaw plugins.
@ethanj ethanj merged commit 2a61647 into main May 17, 2026
2 checks passed
@ethanj ethanj deleted the sync/integrations-e2cdb0c branch May 17, 2026 08:37
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