getmnemo-anthropic 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # @ledgermem/anthropic
1
+ # getmnemo-anthropic
2
2
 
3
- LedgerMem helper for the Anthropic SDK. Wraps `messages.create` with a single
3
+ Mnemo helper for the Anthropic SDK. Wraps `messages.create` with a single
4
4
  `memory` tool (search + add), prompt caching on the system block, and
5
5
  optional extended thinking — the recommended setup for any long-lived Claude
6
6
  assistant.
@@ -8,26 +8,33 @@ assistant.
8
8
  ## Install
9
9
 
10
10
  ```bash
11
- npm install @ledgermem/anthropic @ledgermem/memory @anthropic-ai/sdk
11
+ npm install getmnemo-anthropic @anthropic-ai/sdk
12
12
  ```
13
13
 
14
+ `getmnemo` (the core SDK) is pulled in automatically as a dependency. You only
15
+ need `@anthropic-ai/sdk` because you construct the Anthropic client yourself and
16
+ pass it in.
17
+
18
+ Get your Mnemo API key and workspace ID from
19
+ [app.mnemohq.com/settings/api-keys](https://app.mnemohq.com/settings/api-keys).
20
+
14
21
  ## Quickstart (30 seconds)
15
22
 
16
23
  ```ts
17
24
  import Anthropic from "@anthropic-ai/sdk";
18
- import { LedgerMem } from "@ledgermem/memory";
19
- import { withMemoryTool } from "@ledgermem/anthropic";
25
+ import { Mnemo } from "getmnemo";
26
+ import { withMemoryTool } from "getmnemo-anthropic";
20
27
 
21
28
  const claude = new Anthropic();
22
- const ledgermem = new LedgerMem({
23
- apiKey: process.env.LEDGERMEM_API_KEY!,
24
- workspaceId: process.env.LEDGERMEM_WORKSPACE_ID!,
29
+ const memory = new Mnemo({
30
+ apiKey: process.env.GETMNEMO_API_KEY!,
31
+ workspaceId: process.env.GETMNEMO_WORKSPACE_ID!,
25
32
  });
26
33
 
27
34
  const agent = withMemoryTool({
28
35
  client: claude,
29
- ledgermem,
30
- model: "claude-sonnet-4-7",
36
+ getmnemo: memory,
37
+ model: "claude-sonnet-4-6",
31
38
  thinkingBudgetTokens: 4000,
32
39
  });
33
40
 
@@ -51,6 +58,51 @@ console.log("memory tool calls:", result.memoryToolCalls);
51
58
  - Optionally enables extended thinking with a configurable token budget.
52
59
  - Returns the final transcript so you can persist it elsewhere.
53
60
 
61
+ ## API
62
+
63
+ `withMemoryTool(options)` returns a wrapper with a single `run(input)` method.
64
+
65
+ ### `withMemoryTool(options)`
66
+
67
+ | Option | Type | Default | Description |
68
+ | --- | --- | --- | --- |
69
+ | `client` | `Anthropic` | — | An `@anthropic-ai/sdk` client (anything with `messages.create`). |
70
+ | `getmnemo` | `Mnemo` | — | A `Mnemo` instance from `getmnemo`. |
71
+ | `model` | `string` | `"claude-sonnet-4-6"` | Default model; override per call. |
72
+ | `maxTokens` | `number` | `1024` | Default `max_tokens`; override per call. |
73
+ | `searchLimit` | `number` | `5` | Default top-k for memory search (clamped to 1–50). |
74
+ | `cacheSystem` | `boolean` | `true` | Wrap the system prompt with `cache_control: { type: "ephemeral" }`. |
75
+ | `thinkingBudgetTokens` | `number` | — | Enable extended thinking with this token budget. |
76
+ | `metadata` | `Record<string, unknown>` | `{}` | Static metadata merged into every persisted memory. |
77
+ | `maxIterations` | `number` | `6` | Hard cap on tool-use loop iterations. |
78
+
79
+ ### `run(input)`
80
+
81
+ | Field | Type | Description |
82
+ | --- | --- | --- |
83
+ | `messages` | `ChatMessage[]` | Conversation so far (required). |
84
+ | `system` | `string` | Optional system prompt. |
85
+ | `model` | `string` | Per-call model override. |
86
+ | `maxTokens` | `number` | Per-call `max_tokens` override. |
87
+ | `metadata` | `Record<string, unknown>` | Per-call metadata merged into persisted memories. |
88
+
89
+ Returns:
90
+
91
+ | Field | Type | Description |
92
+ | --- | --- | --- |
93
+ | `text` | `string` | Final assistant text, concatenated across blocks. |
94
+ | `responses` | `MessagesCreateResult[]` | Every raw API response from the tool-use loop. |
95
+ | `memoryToolCalls` | `number` | How many times the memory tool ran. |
96
+ | `messages` | `ChatMessage[]` | Final messages array after the loop — store this as your transcript. |
97
+
98
+ The package also exports `MEMORY_TOOL_NAME` (the literal tool name, `"memory"`)
99
+ and the `WithMemoryTool*` / `WithMemoryRun*` types.
100
+
101
+ ## Links
102
+
103
+ - Docs: [mnemohq.com](https://mnemohq.com)
104
+ - API keys: [app.mnemohq.com/settings/api-keys](https://app.mnemohq.com/settings/api-keys)
105
+
54
106
  ## License
55
107
 
56
108
  MIT
@@ -31,7 +31,7 @@ interface ChatMessage {
31
31
  export interface WithMemoryToolOptions {
32
32
  client: AnthropicLike;
33
33
  getmnemo: Mnemo;
34
- /** Defaults to claude-sonnet-4-7. Override per call too. */
34
+ /** Defaults to claude-sonnet-4-6. Override per call too. */
35
35
  model?: string;
36
36
  /** Defaults to 1024. */
37
37
  maxTokens?: number;
@@ -8,7 +8,7 @@ export const MEMORY_TOOL_NAME = "memory";
8
8
  */
9
9
  export function withMemoryTool(options) {
10
10
  const defaults = {
11
- model: options.model ?? "claude-sonnet-4-7",
11
+ model: options.model ?? "claude-sonnet-4-6",
12
12
  maxTokens: options.maxTokens ?? 1024,
13
13
  searchLimit: options.searchLimit ?? 5,
14
14
  cacheSystem: options.cacheSystem ?? true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getmnemo-anthropic",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Mnemo helper for the Anthropic SDK — memory tool, prompt caching, and extended thinking wired together.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,10 @@
30
30
  "tool-use",
31
31
  "prompt-caching"
32
32
  ],
33
- "author": "Mnemo <founders@getmnemo.xyz>",
33
+ "author": {
34
+ "name": "Mnemo",
35
+ "url": "https://mnemohq.com"
36
+ },
34
37
  "license": "MIT",
35
38
  "repository": {
36
39
  "type": "git",
@@ -50,5 +53,5 @@
50
53
  "engines": {
51
54
  "node": ">=18.17.0"
52
55
  },
53
- "homepage": "https://getmnemo.xyz"
56
+ "homepage": "https://mnemohq.com"
54
57
  }
@@ -33,7 +33,7 @@ interface ChatMessage {
33
33
  export interface WithMemoryToolOptions {
34
34
  client: AnthropicLike;
35
35
  getmnemo: Mnemo;
36
- /** Defaults to claude-sonnet-4-7. Override per call too. */
36
+ /** Defaults to claude-sonnet-4-6. Override per call too. */
37
37
  model?: string;
38
38
  /** Defaults to 1024. */
39
39
  maxTokens?: number;
@@ -86,7 +86,7 @@ export function withMemoryTool(
86
86
  options: WithMemoryToolOptions,
87
87
  ): WithMemoryToolWrapper {
88
88
  const defaults = {
89
- model: options.model ?? "claude-sonnet-4-7",
89
+ model: options.model ?? "claude-sonnet-4-6",
90
90
  maxTokens: options.maxTokens ?? 1024,
91
91
  searchLimit: options.searchLimit ?? 5,
92
92
  cacheSystem: options.cacheSystem ?? true,