@withone/mem 0.1.0
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 +21 -0
- package/README.md +92 -0
- package/bin/mem +36 -0
- package/dist/cli.d.ts +28 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +656 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +94 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +461 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.ts +14 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +514 -0
- package/dist/schema.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
- package/skills/context/SKILL.md +168 -0
- package/skills/remember/SKILL.md +144 -0
- package/skills/search/SKILL.md +137 -0
- package/skills/setup/SKILL.md +162 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 One Technologies, Inc.
|
|
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,92 @@
|
|
|
1
|
+
# Mem
|
|
2
|
+
|
|
3
|
+
Memory for AI agents. Simple, fast, works anywhere.
|
|
4
|
+
|
|
5
|
+
**https://mem.now**
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @withone/mem
|
|
11
|
+
mem init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `init` wizard will:
|
|
15
|
+
1. Configure your Supabase connection
|
|
16
|
+
2. Apply the database schema
|
|
17
|
+
3. Create CLAUDE.md with instructions
|
|
18
|
+
4. Install skills for Claude Code
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Add memories
|
|
24
|
+
mem add note '{"content": "Meeting notes from today"}'
|
|
25
|
+
mem add decision '{"topic": "API Design", "content": "Using REST because...", "weight": 9}'
|
|
26
|
+
mem add preference '{"content": "Prefers TypeScript", "weight": 8}'
|
|
27
|
+
|
|
28
|
+
# Search (semantic + keyword)
|
|
29
|
+
mem search "API design"
|
|
30
|
+
mem search "meeting" -t note
|
|
31
|
+
|
|
32
|
+
# Get context at session start
|
|
33
|
+
mem context
|
|
34
|
+
mem context -n 10 -t decision,preference
|
|
35
|
+
|
|
36
|
+
# Manage relevance
|
|
37
|
+
mem weight <id> 9 # Set importance (1-10)
|
|
38
|
+
mem archive <id> # Exclude from context
|
|
39
|
+
mem flush <id> # Reset access count
|
|
40
|
+
|
|
41
|
+
# Link memories
|
|
42
|
+
mem link <id1> related_to <id2> --bi # Bidirectional
|
|
43
|
+
mem link <new> supersedes <old> # Directional
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## How It Works
|
|
47
|
+
|
|
48
|
+
**Two tables:**
|
|
49
|
+
- `mem_records` - All memories (flexible JSON)
|
|
50
|
+
- `mem_links` - Relationships between memories
|
|
51
|
+
|
|
52
|
+
**Relevance scoring:**
|
|
53
|
+
- Weight (40%) - Explicit importance you set
|
|
54
|
+
- Access (30%) - How often it's retrieved
|
|
55
|
+
- Recency (30%) - When it was last accessed
|
|
56
|
+
|
|
57
|
+
High-weight items always surface. Frequently used items rise. Old unused items fade.
|
|
58
|
+
|
|
59
|
+
**Hybrid search:**
|
|
60
|
+
- Semantic similarity (70%) - Finds conceptually related content
|
|
61
|
+
- Keyword matching (30%) - Finds exact terms
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
- Node.js 18+
|
|
66
|
+
- Supabase project (free tier works)
|
|
67
|
+
- OpenAI API key (optional, for semantic search)
|
|
68
|
+
|
|
69
|
+
## TypeScript API
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { add, search, context, link } from '@withone/mem';
|
|
73
|
+
|
|
74
|
+
// Add a memory
|
|
75
|
+
const record = await add('decision', {
|
|
76
|
+
topic: 'Database',
|
|
77
|
+
content: 'Using Supabase because...',
|
|
78
|
+
}, { weight: 9 });
|
|
79
|
+
|
|
80
|
+
// Search
|
|
81
|
+
const results = await search('database decision');
|
|
82
|
+
|
|
83
|
+
// Get startup context
|
|
84
|
+
const relevant = await context({ limit: 20 });
|
|
85
|
+
|
|
86
|
+
// Link memories
|
|
87
|
+
await link(id1, id2, 'related_to', { bidirectional: true });
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
package/bin/mem
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Recall CLI wrapper
|
|
4
|
+
# Loads .env and runs the CLI
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
# Find the project root (where package.json is)
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
12
|
+
|
|
13
|
+
# Load .env from current working directory (preferred) or project root (fallback)
|
|
14
|
+
if [ -f ".env" ]; then
|
|
15
|
+
set -a
|
|
16
|
+
source ".env"
|
|
17
|
+
set +a
|
|
18
|
+
elif [ -f "$PROJECT_ROOT/.env" ]; then
|
|
19
|
+
set -a
|
|
20
|
+
source "$PROJECT_ROOT/.env"
|
|
21
|
+
set +a
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Check for required env vars
|
|
25
|
+
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_SERVICE_KEY" ]; then
|
|
26
|
+
echo "Error: SUPABASE_URL and SUPABASE_SERVICE_KEY must be set"
|
|
27
|
+
echo ""
|
|
28
|
+
echo "Create a .env file with:"
|
|
29
|
+
echo " SUPABASE_URL=https://your-project.supabase.co"
|
|
30
|
+
echo " SUPABASE_SERVICE_KEY=your-service-key"
|
|
31
|
+
echo " OPENAI_API_KEY=your-openai-key # Optional, for embeddings"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Run the CLI
|
|
36
|
+
exec node "$PROJECT_ROOT/dist/cli.js" "$@"
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* mem - Memory for AI agents
|
|
4
|
+
* https://mem.now
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* mem <command> [args...]
|
|
8
|
+
*
|
|
9
|
+
* Commands:
|
|
10
|
+
* init Interactive setup
|
|
11
|
+
* add <type> '<json>' Add memory
|
|
12
|
+
* get <id> [--with-links] Get by ID
|
|
13
|
+
* list <type> [--filter key=val] List memories
|
|
14
|
+
* update <id> '<json>' Update
|
|
15
|
+
* delete <id> Delete
|
|
16
|
+
* link <from> <relation> <to> Create link
|
|
17
|
+
* unlink <from> <relation> <to> Remove link
|
|
18
|
+
* linked <id> [relation] Get linked
|
|
19
|
+
* search <query> [-t type] [-n N] Hybrid search
|
|
20
|
+
* context [-n N] [-t types] Startup context
|
|
21
|
+
* weight <id> <1-10> Set importance
|
|
22
|
+
* archive <id> Archive
|
|
23
|
+
* unarchive <id> Restore
|
|
24
|
+
* flush <id> Reset access
|
|
25
|
+
* migrate Apply schema
|
|
26
|
+
*/
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}
|