@unifiedmemory/cli 1.0.0 → 1.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/.env.example +27 -6
- package/CHANGELOG.md +232 -0
- package/README.md +207 -132
- package/commands/init.js +246 -69
- package/commands/login.js +9 -95
- package/commands/org.js +9 -38
- package/index.js +17 -26
- package/lib/config.js +42 -24
- package/lib/jwt-utils.js +63 -0
- package/lib/mcp-server.js +1 -1
- package/lib/memory-instructions.js +72 -0
- package/lib/org-selection-ui.js +104 -0
- package/lib/provider-detector.js +69 -75
- package/lib/token-refresh.js +1 -18
- package/lib/token-storage.js +15 -2
- package/lib/welcome.js +40 -0
- package/package.json +6 -4
- package/HOOK_SETUP.md +0 -338
- package/lib/hooks.js +0 -43
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# UnifiedMemory CLI (`um`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@unifiedmemory/cli)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
Connect your AI code assistant to UnifiedMemory's knowledge vault with one command.
|
|
8
|
+
|
|
9
|
+
## What is UnifiedMemory?
|
|
10
|
+
|
|
11
|
+
UnifiedMemory is an AI-powered knowledge management system that lets your code assistant remember context across all your projects. The `um` CLI connects your local AI tools (Claude Code, Cursor, Cline, etc.) to your UnifiedMemory vault so they can access and store project knowledge automatically.
|
|
4
12
|
|
|
5
13
|
## Quick Start
|
|
6
14
|
|
|
@@ -8,52 +16,59 @@ One-command setup for AI code assistant integration with UnifiedMemory.
|
|
|
8
16
|
# Install globally
|
|
9
17
|
npm install -g @unifiedmemory/cli
|
|
10
18
|
|
|
11
|
-
# Or run directly with npx
|
|
19
|
+
# Or run directly with npx (no installation required)
|
|
12
20
|
npx @unifiedmemory/cli init
|
|
13
21
|
|
|
14
22
|
# In your project directory
|
|
23
|
+
cd your-project
|
|
15
24
|
um init
|
|
16
25
|
```
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
That's it! Your AI assistant can now access UnifiedMemory.
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
## What Does This Do?
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
2. **Project context**: `um init` creates `.um/config.json` in your project directory
|
|
24
|
-
3. **Local MCP server**: AI assistants spawn `um mcp serve` which:
|
|
25
|
-
- Reads authentication from `~/.um/auth.json`
|
|
26
|
-
- Auto-detects project context from `.um/config.json` in current directory
|
|
27
|
-
- Forwards tool calls to UnifiedMemory API with proper authentication
|
|
28
|
-
- Handles token refresh automatically
|
|
31
|
+
When you run `um init` in your project:
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
33
|
+
1. **Authenticates you** - Opens your browser to sign in with UnifiedMemory (one-time)
|
|
34
|
+
2. **Links your project** - Choose an existing project or create a new one in your vault
|
|
35
|
+
3. **Configures AI tools** - Automatically detects and configures Claude Code, Cursor, Cline, Codex CLI, or Gemini CLI
|
|
36
|
+
4. **Creates local config** - Adds a `.um/` folder to your project (auto-added to `.gitignore`)
|
|
37
|
+
|
|
38
|
+
After setup, your AI assistant will automatically:
|
|
39
|
+
- ✅ Store important code context in your UnifiedMemory vault
|
|
40
|
+
- ✅ Retrieve relevant knowledge when working on similar problems
|
|
41
|
+
- ✅ Remember decisions and patterns across sessions
|
|
42
|
+
- ✅ Switch context automatically when you change projects
|
|
43
|
+
|
|
44
|
+
## What Gets Created in Your Project?
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
your-project/
|
|
48
|
+
├── .um/
|
|
49
|
+
│ └── config.json # Project configuration (auto-ignored by git)
|
|
50
|
+
├── .gitignore # Updated to exclude .um/
|
|
51
|
+
└── .mcp.json # MCP server config (Claude Code only)
|
|
52
|
+
```
|
|
35
53
|
|
|
36
|
-
|
|
54
|
+
**Note**: Authentication tokens are stored securely in `~/.um/auth.json` on your machine, never in your project directory.
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
2. **Prompts** for project selection (create new or link existing)
|
|
40
|
-
3. **Creates** `.um/config.json` with org_id and project_id
|
|
41
|
-
4. **Configures** all detected AI tools to use local MCP server
|
|
42
|
-
5. **Ready to use** - just restart your AI assistant!
|
|
56
|
+
## Supported AI Code Assistants
|
|
43
57
|
|
|
44
|
-
|
|
58
|
+
| Tool | Status | Configuration |
|
|
59
|
+
|------|--------|--------------|
|
|
60
|
+
| **Claude Code** | ✅ Fully Supported | Project-level `.mcp.json` |
|
|
61
|
+
| **Cursor** | ✅ Fully Supported | Global `~/.cursor/mcp.json` |
|
|
62
|
+
| **Cline** | ✅ Fully Supported | Global `~/.cline/mcp.json` |
|
|
63
|
+
| **Codex CLI** | ✅ Fully Supported | Global `~/.codex/config.toml` |
|
|
64
|
+
| **Gemini CLI** | ✅ Fully Supported | Global `~/.gemini/settings.json` |
|
|
45
65
|
|
|
46
|
-
|
|
47
|
-
- ✅ Auto-detect and configure AI code assistants
|
|
48
|
-
- ✅ Local MCP server with secure token storage
|
|
49
|
-
- ✅ Multi-project support with automatic context switching
|
|
50
|
-
- ✅ Automatic .gitignore updates
|
|
51
|
-
- ✅ Supports Claude Code, Cursor, Cline, Codex CLI, and Gemini CLI
|
|
66
|
+
The CLI automatically detects which tools you have installed and configures them for you.
|
|
52
67
|
|
|
53
68
|
## Commands
|
|
54
69
|
|
|
55
70
|
### `um init`
|
|
56
|
-
|
|
71
|
+
Set up UnifiedMemory in your current project (recommended).
|
|
57
72
|
|
|
58
73
|
```bash
|
|
59
74
|
um init # Interactive setup
|
|
@@ -61,160 +76,220 @@ um init --skip-configure # Skip AI tool configuration
|
|
|
61
76
|
```
|
|
62
77
|
|
|
63
78
|
### `um login`
|
|
64
|
-
|
|
79
|
+
Sign in to UnifiedMemory. Opens your browser for authentication.
|
|
65
80
|
|
|
66
81
|
```bash
|
|
67
82
|
um login
|
|
68
83
|
```
|
|
69
84
|
|
|
70
|
-
### `um
|
|
71
|
-
|
|
85
|
+
### `um status`
|
|
86
|
+
Check your authentication status and see which project is configured.
|
|
72
87
|
|
|
73
88
|
```bash
|
|
74
|
-
um
|
|
89
|
+
um status
|
|
75
90
|
```
|
|
76
91
|
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
**Example output:**
|
|
93
|
+
```
|
|
94
|
+
📋 UnifiedMemory Status
|
|
79
95
|
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
Authentication:
|
|
97
|
+
Status: Active
|
|
98
|
+
Email: you@example.com
|
|
99
|
+
Expires: 1/7/2026
|
|
100
|
+
|
|
101
|
+
Organization Context:
|
|
102
|
+
My Organization (my-org)
|
|
103
|
+
Role: admin
|
|
104
|
+
|
|
105
|
+
Project Configuration:
|
|
106
|
+
✓ Configured: My Project (proj_xxx)
|
|
82
107
|
```
|
|
83
108
|
|
|
84
109
|
### `um org switch`
|
|
85
|
-
Switch between organizations or personal account.
|
|
110
|
+
Switch between your organizations or personal account.
|
|
86
111
|
|
|
87
112
|
```bash
|
|
88
113
|
um org switch
|
|
89
114
|
```
|
|
90
115
|
|
|
91
|
-
### `um
|
|
92
|
-
|
|
116
|
+
### `um note create`
|
|
117
|
+
Manually save a note to your vault (useful for capturing important context).
|
|
93
118
|
|
|
94
|
-
|
|
95
|
-
|
|
119
|
+
```bash
|
|
120
|
+
um note create
|
|
121
|
+
```
|
|
96
122
|
|
|
97
|
-
|
|
123
|
+
### `um mcp serve`
|
|
124
|
+
Start the MCP server (used internally by AI assistants - you don't need to run this manually).
|
|
98
125
|
|
|
99
|
-
|
|
126
|
+
## How It Works
|
|
100
127
|
|
|
101
|
-
|
|
128
|
+
UnifiedMemory uses the **Model Context Protocol (MCP)** to connect your AI assistant to your knowledge vault:
|
|
102
129
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
130
|
+
1. Your AI assistant calls `um mcp serve` in the background
|
|
131
|
+
2. The local MCP server reads your authentication from `~/.um/auth.json`
|
|
132
|
+
3. It detects which project you're in by looking for `.um/config.json`
|
|
133
|
+
4. Tool requests from your AI flow through the server to UnifiedMemory's API
|
|
134
|
+
5. Knowledge is stored and retrieved automatically based on context
|
|
108
135
|
|
|
109
|
-
|
|
136
|
+
**Security**:
|
|
137
|
+
- Authentication tokens are stored locally in your home directory, never in project files
|
|
138
|
+
- Tokens automatically refresh when they expire
|
|
139
|
+
- Each project directory has its own configuration
|
|
140
|
+
- The `.um/` folder is automatically added to `.gitignore`
|
|
110
141
|
|
|
111
|
-
|
|
142
|
+
## Multi-Project Support
|
|
112
143
|
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
"version": "1.0",
|
|
116
|
-
"org_id": "org_xxx",
|
|
117
|
-
"project_id": "proj_xxx",
|
|
118
|
-
"project_name": "My Project",
|
|
119
|
-
"api_url": "https://api.unifiedmemory.ai",
|
|
120
|
-
"created_at": "2024-12-17T...",
|
|
121
|
-
"mcp_config": {
|
|
122
|
-
"inject_headers": true,
|
|
123
|
-
"auto_context": true
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
```
|
|
144
|
+
Working on multiple projects? No problem!
|
|
127
145
|
|
|
128
|
-
|
|
146
|
+
```bash
|
|
147
|
+
cd project-1
|
|
148
|
+
um init # Links to "Project 1" in UnifiedMemory
|
|
129
149
|
|
|
130
|
-
|
|
150
|
+
cd ../project-2
|
|
151
|
+
um init # Links to "Project 2" in UnifiedMemory
|
|
152
|
+
```
|
|
131
153
|
|
|
132
|
-
The CLI automatically detects and
|
|
154
|
+
The CLI automatically detects which project you're in and switches context. Your AI assistant will use the correct vault for each project.
|
|
133
155
|
|
|
134
|
-
|
|
135
|
-
- **Cursor**: `~/.cursor/mcp.json`
|
|
136
|
-
- **Cline**: `~/.cline/mcp.json`
|
|
137
|
-
- **Codex CLI**: `~/.codex/config.toml` (TOML format)
|
|
138
|
-
- **Gemini CLI**: `~/.gemini/settings.json`
|
|
156
|
+
## Switching Organizations
|
|
139
157
|
|
|
140
|
-
|
|
158
|
+
If you're part of multiple teams:
|
|
141
159
|
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
"mcpServers": {
|
|
145
|
-
"vault": {
|
|
146
|
-
"command": "um",
|
|
147
|
-
"args": ["mcp", "serve"]
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
160
|
+
```bash
|
|
161
|
+
um org switch # Choose between organizations
|
|
151
162
|
```
|
|
152
163
|
|
|
153
|
-
|
|
164
|
+
All projects you create afterward will belong to the selected organization.
|
|
154
165
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
## Installation Options
|
|
167
|
+
|
|
168
|
+
**Option 1: Global Install (recommended)**
|
|
169
|
+
```bash
|
|
170
|
+
npm install -g @unifiedmemory/cli
|
|
171
|
+
um --version
|
|
159
172
|
```
|
|
160
173
|
|
|
161
|
-
**
|
|
174
|
+
**Option 2: Use with npx (no installation)**
|
|
175
|
+
```bash
|
|
176
|
+
npx @unifiedmemory/cli init
|
|
177
|
+
npx @unifiedmemory/cli status
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Option 3: Use with MCP directly**
|
|
181
|
+
|
|
182
|
+
Your AI assistant will call the MCP server automatically after running `um init`.
|
|
162
183
|
|
|
163
|
-
##
|
|
184
|
+
## Requirements
|
|
164
185
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
| Cline | ✅ | ✅ | JSON |
|
|
170
|
-
| Codex CLI | ✅ | ✅ | TOML |
|
|
171
|
-
| Gemini CLI | ✅ | ✅ | JSON |
|
|
186
|
+
- **Node.js**: Version 18.0.0 or higher
|
|
187
|
+
- **npm**: Latest version recommended
|
|
188
|
+
- **AI Code Assistant**: One of Claude Code, Cursor, Cline, Codex CLI, or Gemini CLI
|
|
189
|
+
- **UnifiedMemory Account**: Sign up at [unifiedmemory.ai](https://unifiedmemory.ai)
|
|
172
190
|
|
|
173
|
-
##
|
|
191
|
+
## Troubleshooting
|
|
174
192
|
|
|
193
|
+
### "Not logged in" error
|
|
175
194
|
```bash
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
cd um-cli
|
|
195
|
+
um login
|
|
196
|
+
```
|
|
179
197
|
|
|
180
|
-
|
|
181
|
-
|
|
198
|
+
### AI assistant not seeing UnifiedMemory tools
|
|
199
|
+
1. Check status: `um status`
|
|
200
|
+
2. Verify project is configured
|
|
201
|
+
3. Restart your AI assistant
|
|
202
|
+
4. Check the MCP configuration was created (`.mcp.json` or tool-specific config)
|
|
182
203
|
|
|
183
|
-
|
|
184
|
-
|
|
204
|
+
### Wrong project/organization
|
|
205
|
+
```bash
|
|
206
|
+
um org switch # Switch organization
|
|
207
|
+
cd your-project && um init # Reconfigure project
|
|
208
|
+
```
|
|
185
209
|
|
|
186
|
-
|
|
187
|
-
|
|
210
|
+
### Token expired
|
|
211
|
+
Tokens automatically refresh. If you see auth errors:
|
|
212
|
+
```bash
|
|
213
|
+
um login
|
|
188
214
|
```
|
|
189
215
|
|
|
190
|
-
|
|
216
|
+
### Missing environment variables
|
|
217
|
+
If you see "Missing required environment variables" error:
|
|
218
|
+
1. Copy `.env.example` to `.env` in the CLI installation directory
|
|
219
|
+
2. Fill in your Clerk and API credentials
|
|
220
|
+
3. See Configuration section below for details
|
|
221
|
+
|
|
222
|
+
## Configuration
|
|
223
|
+
|
|
224
|
+
The CLI requires environment variables for Clerk OAuth and API access. These should never be hardcoded in your project.
|
|
191
225
|
|
|
226
|
+
**Step 1: Create `.env` file**
|
|
227
|
+
```bash
|
|
228
|
+
# In the um-cli installation directory (find with: npm root -g)
|
|
229
|
+
cp .env.example .env
|
|
192
230
|
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
Backend: vault-product
|
|
231
|
+
|
|
232
|
+
**Step 2: Add your credentials**
|
|
233
|
+
```bash
|
|
234
|
+
# Required: Clerk OAuth Configuration
|
|
235
|
+
CLERK_CLIENT_ID=your_clerk_client_id_here
|
|
236
|
+
CLERK_DOMAIN=your-app.clerk.accounts.dev
|
|
237
|
+
|
|
238
|
+
# Required: API Configuration
|
|
239
|
+
API_ENDPOINT=https://your-api-gateway.zuplo.dev
|
|
203
240
|
```
|
|
204
241
|
|
|
205
|
-
|
|
206
|
-
- **
|
|
207
|
-
- **
|
|
208
|
-
- **Project Config**: `.um/config.json` (per-directory context)
|
|
209
|
-
- **Provider Detection**: Auto-detect 5 AI tools
|
|
210
|
-
- **MCP Server**: stdio transport proxying to HTTP gateway
|
|
211
|
-
- **Context Auto-Detection**: Project-aware based on working directory
|
|
242
|
+
Get these values from:
|
|
243
|
+
- **Clerk credentials**: [Clerk Dashboard](https://dashboard.clerk.com)
|
|
244
|
+
- **API endpoint**: Your UnifiedMemory deployment
|
|
212
245
|
|
|
213
|
-
|
|
246
|
+
**Optional configuration**:
|
|
247
|
+
```bash
|
|
248
|
+
# Customize OAuth redirect (defaults shown)
|
|
249
|
+
REDIRECT_URI=http://localhost:3333/callback
|
|
250
|
+
PORT=3333
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
See `.env.example` for the complete template with documentation.
|
|
254
|
+
|
|
255
|
+
## Privacy & Security
|
|
256
|
+
|
|
257
|
+
UnifiedMemory CLI follows security best practices to protect your credentials and data:
|
|
258
|
+
|
|
259
|
+
### Secure Token Storage
|
|
260
|
+
- **File permissions**: Tokens stored in `~/.um/auth.json` with `0600` permissions (owner read/write only)
|
|
261
|
+
- **Directory permissions**: `~/.um/` directory has `0700` permissions (owner access only)
|
|
262
|
+
- **No plaintext exposure**: Tokens are never logged to console or stored in project files
|
|
263
|
+
- **Auto-refresh**: Tokens refresh automatically before expiring
|
|
214
264
|
|
|
215
|
-
|
|
265
|
+
### Authentication Security
|
|
266
|
+
- **PKCE flow**: Uses OAuth 2.0 PKCE for secure authentication without client secrets
|
|
267
|
+
- **CSRF protection**: Cryptographically secure random state parameters
|
|
268
|
+
- **Local-first**: All authentication happens on your machine, never shared with third parties
|
|
269
|
+
|
|
270
|
+
### Project Security
|
|
271
|
+
- **No git commits**: `.um/` directory automatically added to `.gitignore`
|
|
272
|
+
- **Project isolation**: Each project has its own configuration and vault
|
|
273
|
+
- **Environment-based config**: No hardcoded credentials in source code
|
|
274
|
+
- **Minimal permissions**: CLI only requests access it needs
|
|
275
|
+
|
|
276
|
+
### What We Don't Collect
|
|
277
|
+
- ❌ No tokens in analytics
|
|
278
|
+
- ❌ No credentials in error reports
|
|
279
|
+
- ❌ No project code sent to our servers
|
|
280
|
+
- ✅ Only encrypted knowledge stored in your vault
|
|
281
|
+
|
|
282
|
+
### Security Updates
|
|
283
|
+
Security issues are taken seriously. To report a vulnerability, please email security@unifiedmemory.ai (do not use public issues).
|
|
284
|
+
|
|
285
|
+
## Learn More
|
|
286
|
+
|
|
287
|
+
- **Website**: [unifiedmemory.ai](https://unifiedmemory.ai)
|
|
288
|
+
- **Documentation**: [docs.unifiedmemory.ai](https://docs.unifiedmemory.ai)
|
|
289
|
+
- **Support**: [GitHub Issues](https://github.com/Episodic-Solutions/um-cli/issues)
|
|
290
|
+
|
|
291
|
+
## License
|
|
216
292
|
|
|
217
|
-
|
|
293
|
+
PROPRIETARY - Copyright (c) 2024-2026 Episodic Solutions Limited. All rights reserved.
|
|
218
294
|
|
|
219
|
-
|
|
220
|
-
- Documentation: https://docs.unifiedmemory.ai
|
|
295
|
+
See [LICENSE](./LICENSE) for details.
|