Add LangChain JS, LangGraph, and Mastra adapter packages#10
Merged
Conversation
## 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add three new adapter packages that integrate AtomicMemory into LangChain JS, LangGraph JS, and Mastra, alongside a new
setup hostCLI command and expanded plugin manifest test coverage.Changes
Adapters
@atomicmemory/langchain—searchMemory()/ingestTurn()helpers usable inside any LCEL chain or callback, pluscreateMemoryTools()producingmemory_searchandmemory_ingest@langchain/core/tools-compatible instances with scope fixed at factory time.@atomicmemory/langgraph—createMemoryRetrieveNode()andcreateMemoryIngestNode()factories emitting plain(state) => Partial<state>async functions registerable via.addNode(). Fully generic over the caller's state type; never imports@langchain/langgraphat runtime.@atomicmemory/mastra—createMemoryTools()producingmemory_searchandmemory_ingestMastracreateTool()instances, plus the same framework-agnosticsearchMemory()/ingestTurn()helpers.atomicmemory:contextformatter with explicit "reference, not instructions" header;systemrole excluded fromingestTurn()by default with opt-inincludeRoles; scope bound at factory time so agents cannot rebind across users.MemoryClientfixtures in each adapter.CLI
setup hostcommand (packages/cli/src/commands/setup/host/) with host-configuration templates and tests.packages/cli/src/commands/registry.ts.Plugin test coverage
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
MemoryClientscope 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,
includeRolesopt-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.