@elizaos/plugin-scratchpad 2.0.0-alpha
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 +161 -0
- package/dist/__tests__/scratchpad-plugin.test.d.ts +3 -0
- package/dist/__tests__/scratchpad-plugin.test.d.ts.map +1 -0
- package/dist/__tests__/scratchpad-service.test.d.ts +3 -0
- package/dist/__tests__/scratchpad-service.test.d.ts.map +1 -0
- package/dist/actions/append.d.ts +4 -0
- package/dist/actions/append.d.ts.map +1 -0
- package/dist/actions/delete.d.ts +4 -0
- package/dist/actions/delete.d.ts.map +1 -0
- package/dist/actions/list.d.ts +4 -0
- package/dist/actions/list.d.ts.map +1 -0
- package/dist/actions/read.d.ts +4 -0
- package/dist/actions/read.d.ts.map +1 -0
- package/dist/actions/search.d.ts +4 -0
- package/dist/actions/search.d.ts.map +1 -0
- package/dist/actions/write.d.ts +4 -0
- package/dist/actions/write.d.ts.map +1 -0
- package/dist/browser/index.browser.js +3 -0
- package/dist/browser/index.browser.js.map +10 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/build.d.ts +4 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.node.cjs +1121 -0
- package/dist/cjs/index.node.js.map +19 -0
- package/dist/generated/specs/specs.d.ts +15 -0
- package/dist/generated/specs/specs.d.ts.map +1 -0
- package/dist/index.browser.d.ts +11 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +6 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.node.js +1100 -0
- package/dist/node/index.node.js.map +19 -0
- package/dist/providers/scratchpad.d.ts +8 -0
- package/dist/providers/scratchpad.d.ts.map +1 -0
- package/dist/services/scratchpadService.d.ts +63 -0
- package/dist/services/scratchpadService.d.ts.map +1 -0
- package/dist/tests.d.ts +6 -0
- package/dist/tests.d.ts.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +99 -0
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# @elizaos/plugin-scratchpad
|
|
2
|
+
|
|
3
|
+
File-based memory storage plugin for ElizaOS. Provides persistent notes and memories that can be written, read, searched, and managed across sessions.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This plugin enables agents to maintain a persistent scratchpad of notes and memories stored as markdown files. It's inspired by the Otto memory-core extension and provides similar functionality adapted for the ElizaOS plugin architecture.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Persistent Storage**: Notes are stored as markdown files that persist across sessions
|
|
12
|
+
- **Semantic Search**: Search through entries by content with relevance scoring
|
|
13
|
+
- **CRUD Operations**: Full support for Create, Read, Update (append), and Delete
|
|
14
|
+
- **Tagging**: Organize entries with tags for better categorization
|
|
15
|
+
- **Provider Integration**: Automatic context about scratchpad state for the agent
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @elizaos/plugin-scratchpad
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Add the plugin to your agent configuration:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { scratchpadPlugin } from "@elizaos/plugin-scratchpad";
|
|
29
|
+
|
|
30
|
+
const agent = {
|
|
31
|
+
// ... other config
|
|
32
|
+
plugins: [scratchpadPlugin],
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Actions
|
|
37
|
+
|
|
38
|
+
### SCRATCHPAD_WRITE
|
|
39
|
+
|
|
40
|
+
Create a new scratchpad entry.
|
|
41
|
+
|
|
42
|
+
**Similes**: SAVE_NOTE, CREATE_NOTE, WRITE_NOTE, REMEMBER_THIS, SAVE_MEMORY, JOT_DOWN, NOTE_THIS
|
|
43
|
+
|
|
44
|
+
**Example**:
|
|
45
|
+
```
|
|
46
|
+
User: "Please save a note about the meeting tomorrow at 3pm with John"
|
|
47
|
+
Agent: "I've saved a note titled 'Meeting with John'. You can retrieve it later."
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### SCRATCHPAD_READ
|
|
51
|
+
|
|
52
|
+
Read the content of a specific scratchpad entry.
|
|
53
|
+
|
|
54
|
+
**Similes**: GET_NOTE, READ_NOTE, RETRIEVE_NOTE, GET_MEMORY, FETCH_NOTE, OPEN_NOTE
|
|
55
|
+
|
|
56
|
+
**Example**:
|
|
57
|
+
```
|
|
58
|
+
User: "Show me the note about the meeting"
|
|
59
|
+
Agent: "Here's the note 'Meeting with John': Meeting scheduled for tomorrow at 3pm..."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### SCRATCHPAD_SEARCH
|
|
63
|
+
|
|
64
|
+
Search through scratchpad entries for relevant information.
|
|
65
|
+
|
|
66
|
+
**Similes**: FIND_NOTE, SEARCH_NOTES, LOOKUP_MEMORY, FIND_MEMORY, SEARCH_MEMORY, RECALL
|
|
67
|
+
|
|
68
|
+
**Example**:
|
|
69
|
+
```
|
|
70
|
+
User: "What notes do I have about marketing?"
|
|
71
|
+
Agent: "I found 2 entries mentioning marketing: 1) 'Marketing Strategy' (85% match)..."
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### SCRATCHPAD_LIST
|
|
75
|
+
|
|
76
|
+
List all scratchpad entries with their titles and modification dates.
|
|
77
|
+
|
|
78
|
+
**Similes**: SHOW_NOTES, LIST_NOTES, ALL_NOTES, MY_NOTES, SHOW_MEMORIES
|
|
79
|
+
|
|
80
|
+
**Example**:
|
|
81
|
+
```
|
|
82
|
+
User: "Show me all my saved notes"
|
|
83
|
+
Agent: "You have 5 scratchpad entries: 1) Meeting notes (modified today)..."
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### SCRATCHPAD_APPEND
|
|
87
|
+
|
|
88
|
+
Append additional content to an existing scratchpad entry.
|
|
89
|
+
|
|
90
|
+
**Similes**: ADD_TO_NOTE, UPDATE_NOTE, APPEND_NOTE, EXTEND_NOTE, ADD_MORE
|
|
91
|
+
|
|
92
|
+
**Example**:
|
|
93
|
+
```
|
|
94
|
+
User: "Add to the meeting notes that we decided on a $50k budget"
|
|
95
|
+
Agent: "I've appended the budget decision to the meeting notes."
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### SCRATCHPAD_DELETE
|
|
99
|
+
|
|
100
|
+
Delete a scratchpad entry by its ID.
|
|
101
|
+
|
|
102
|
+
**Similes**: REMOVE_NOTE, DELETE_NOTE, FORGET_NOTE, ERASE_NOTE, REMOVE_MEMORY
|
|
103
|
+
|
|
104
|
+
**Example**:
|
|
105
|
+
```
|
|
106
|
+
User: "Delete the note about the old meeting"
|
|
107
|
+
Agent: "I've deleted the scratchpad entry 'old-meeting'."
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Provider
|
|
111
|
+
|
|
112
|
+
### scratchpad
|
|
113
|
+
|
|
114
|
+
Provides information about the user's scratchpad entries to the agent's context. This allows the agent to be aware of saved notes without explicitly querying.
|
|
115
|
+
|
|
116
|
+
The provider returns:
|
|
117
|
+
- Summary of recent entries (up to 5)
|
|
118
|
+
- Total count of entries
|
|
119
|
+
- Entry IDs and titles
|
|
120
|
+
|
|
121
|
+
## Configuration
|
|
122
|
+
|
|
123
|
+
| Parameter | Type | Default | Description |
|
|
124
|
+
|-----------|------|---------|-------------|
|
|
125
|
+
| SCRATCHPAD_BASE_PATH | string | ~/.eliza/scratchpad | Base directory for scratchpad files |
|
|
126
|
+
| SCRATCHPAD_MAX_FILE_SIZE | number | 1048576 | Maximum file size in bytes (1MB) |
|
|
127
|
+
|
|
128
|
+
## File Format
|
|
129
|
+
|
|
130
|
+
Entries are stored as markdown files with YAML frontmatter:
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
---
|
|
134
|
+
title: "Meeting with John"
|
|
135
|
+
created: 2024-01-15T10:30:00.000Z
|
|
136
|
+
modified: 2024-01-15T10:30:00.000Z
|
|
137
|
+
tags: [meeting, marketing]
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
Meeting scheduled for tomorrow at 3pm to discuss marketing strategy.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Build
|
|
147
|
+
bun run build
|
|
148
|
+
|
|
149
|
+
# Type check
|
|
150
|
+
bun run typecheck
|
|
151
|
+
|
|
152
|
+
# Lint
|
|
153
|
+
bun run lint
|
|
154
|
+
|
|
155
|
+
# Test
|
|
156
|
+
bun run test
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scratchpad-plugin.test.d.ts","sourceRoot":"","sources":["../../__tests__/scratchpad-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,eAAe,CAAC;AAG9D,eAAO,MAAM,4BAA4B,EAAE,SAkQ1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scratchpad-service.test.d.ts","sourceRoot":"","sources":["../../__tests__/scratchpad-service.test.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,eAAe,CAAC;AAG9D,eAAO,MAAM,0BAA0B,EAAE,SAgXxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../../actions/append.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AAkEvB,eAAO,MAAM,sBAAsB,EAAE,MAgGpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../actions/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AAyDvB,eAAO,MAAM,sBAAsB,EAAE,MAuFpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../actions/list.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAOZ,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,oBAAoB,EAAE,MAiElC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../actions/read.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AAiEvB,eAAO,MAAM,oBAAoB,EAAE,MAoFlC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../actions/search.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AAsDvB,eAAO,MAAM,sBAAsB,EAAE,MAgFpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../actions/write.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,eAAe,CAAC;AA6EvB,eAAO,MAAM,qBAAqB,EAAE,MAiEnC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var b={name:"scratchpad",description:"File-based memory storage (Node.js only - not available in browser).",providers:[],actions:[],async init(){console.warn("[ScratchpadPlugin] This plugin is not available in browser context.")}},m=b;export{b as scratchpadPlugin,m as default};
|
|
2
|
+
|
|
3
|
+
//# debugId=3B6C58F86231223764756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../index.browser.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Browser entry point for plugin-scratchpad\n *\n * Note: The file-based scratchpad functionality is only available in Node.js.\n * This browser entry provides a stub that throws if used in browser context.\n */\nimport type { Plugin } from \"@elizaos/core\";\n\nexport const scratchpadPlugin: Plugin = {\n name: \"scratchpad\",\n description: \"File-based memory storage (Node.js only - not available in browser).\",\n\n providers: [],\n actions: [],\n\n async init(): Promise<void> {\n console.warn(\"[ScratchpadPlugin] This plugin is not available in browser context.\");\n },\n};\n\nexport default scratchpadPlugin;\n\n// Re-export types for type-checking\nexport type {\n ScratchpadConfig,\n ScratchpadEntry,\n ScratchpadReadOptions,\n ScratchpadSearchOptions,\n ScratchpadSearchResult,\n ScratchpadWriteOptions,\n} from \"./types\";\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "AAQO,IAAM,EAA2B,CACtC,KAAM,aACN,YAAa,uEAEb,UAAW,CAAC,EACZ,QAAS,CAAC,OAEJ,KAAI,EAAkB,CAC1B,QAAQ,KAAK,qEAAqE,EAEtF,EAEe",
|
|
8
|
+
"debugId": "3B6C58F86231223764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":";AAEA,QAAA,MAAM,YAAY,UAAoB,CAAC;AAEvC,iBAAe,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA2FpC"}
|