@stackflo-labs/n8n-nodes-retainr 0.1.1 → 0.2.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 stackflo-labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @stackflo-labs/n8n-nodes-retainr
2
+
3
+ [n8n](https://n8n.io/) community node for [retainr.dev](https://retainr.dev) — the AI agent memory persistence API.
4
+
5
+ Give your n8n AI agents **long-term memory** that persists across workflow runs. Store facts, preferences, and context, then retrieve them with semantic search — so your agents remember what matters.
6
+
7
+ ## Features
8
+
9
+ | Operation | Description |
10
+ |-----------|-------------|
11
+ | **Store** | Save a memory with scope, tags, metadata, TTL, and deduplication |
12
+ | **Search** | Semantic similarity search across stored memories |
13
+ | **Get Context** | Retrieve pre-formatted memory context ready for LLM system prompts |
14
+ | **List** | Browse memories with filters (scope, user, session, tags) |
15
+ | **Delete** | Remove memories by filter criteria |
16
+ | **Get Workspace Info** | View plan usage, API keys, and workspace details |
17
+
18
+ ## Installation
19
+
20
+ ### n8n Cloud & Desktop
21
+
22
+ 1. Go to **Settings > Community Nodes**
23
+ 2. Search for `@stackflo-labs/n8n-nodes-retainr`
24
+ 3. Click **Install**
25
+
26
+ ### Self-hosted n8n
27
+
28
+ ```bash
29
+ cd ~/.n8n
30
+ npm install @stackflo-labs/n8n-nodes-retainr
31
+ ```
32
+
33
+ Then restart n8n.
34
+
35
+ ## Setup
36
+
37
+ 1. Sign up at [retainr.dev](https://retainr.dev) and get your API key
38
+ 2. In n8n, go to **Credentials > New > Retainr API**
39
+ 3. Paste your API key (`rec_live_...`)
40
+ 4. The default Base URL (`https://api.retainr.dev`) works out of the box
41
+
42
+ ## Usage Examples
43
+
44
+ ### Store a memory after a conversation
45
+
46
+ 1. Add the **Retainr** node after your AI Agent
47
+ 2. Set **Resource** to `Memory`, **Operation** to `Store`
48
+ 3. Map the conversation summary to the **Content** field
49
+ 4. Set **Scope** to `User` and provide the **User ID**
50
+
51
+ ### Inject memory context into an LLM prompt
52
+
53
+ 1. Add a **Retainr** node before your AI Agent
54
+ 2. Set **Operation** to `Get Context`
55
+ 3. Use the incoming message as the **Query**
56
+ 4. Pass the `context` output into your LLM's system prompt
57
+
58
+ ### Deduplicate similar memories
59
+
60
+ Use the **Dedup Threshold** field (e.g., `0.95`) when storing. If a sufficiently similar memory already exists, it will be updated instead of duplicated.
61
+
62
+ ## Memory Scopes
63
+
64
+ | Scope | Use case |
65
+ |-------|----------|
66
+ | `session` | Single workflow run — requires `session_id` |
67
+ | `user` | Persists across runs for one user — requires `user_id` |
68
+ | `agent` | Shared across users for one agent — requires `agent_id` |
69
+ | `global` | Shared across the entire workspace |
70
+
71
+ ## AI Agent Tool
72
+
73
+ This node has `usableAsTool` enabled — you can use it directly as a tool inside n8n's **AI Agent** node, letting the agent decide when to store or recall memories autonomously.
74
+
75
+ ## API Documentation
76
+
77
+ Full API reference: [retainr.dev/docs/api](https://retainr.dev/docs/api)
78
+
79
+ ## License
80
+
81
+ [MIT](LICENSE)
@@ -1,7 +1,9 @@
1
- import type { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class RetainrApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
7
9
  }
@@ -14,16 +14,31 @@ class RetainrApi {
14
14
  typeOptions: { password: true },
15
15
  default: '',
16
16
  placeholder: 'rec_live_...',
17
- description: 'Your retainr.dev API key. Get one at https://retainr.dev/dashboard',
17
+ description: 'Your retainr.dev API key. Create one at https://retainr.dev/dashboard.',
18
18
  },
19
19
  {
20
20
  displayName: 'Base URL',
21
21
  name: 'baseUrl',
22
22
  type: 'string',
23
23
  default: 'https://api.retainr.dev',
24
- description: 'Leave as default unless using a self-hosted instance',
24
+ description: 'API base URL. Only change this if you run a self-hosted instance.',
25
25
  },
26
26
  ];
27
+ this.authenticate = {
28
+ type: 'generic',
29
+ properties: {
30
+ headers: {
31
+ Authorization: '=Bearer {{$credentials.apiKey}}',
32
+ },
33
+ },
34
+ };
35
+ this.test = {
36
+ request: {
37
+ baseURL: '={{$credentials.baseUrl}}',
38
+ url: '/v1/workspace',
39
+ method: 'GET',
40
+ },
41
+ };
27
42
  }
28
43
  }
29
44
  exports.RetainrApi = RetainrApi;
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Retainr implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }