ahok-skill 1.3.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.
Files changed (141) hide show
  1. package/.prettierrc +8 -0
  2. package/Dockerfile +59 -0
  3. package/RAW_SKILL.md +219 -0
  4. package/README.md +277 -0
  5. package/SKILL.md +58 -0
  6. package/bin/opm.js +268 -0
  7. package/data/openmemory.sqlite +0 -0
  8. package/data/openmemory.sqlite-shm +0 -0
  9. package/data/openmemory.sqlite-wal +0 -0
  10. package/dist/ai/graph.js +293 -0
  11. package/dist/ai/mcp.js +397 -0
  12. package/dist/cli.js +78 -0
  13. package/dist/core/cfg.js +87 -0
  14. package/dist/core/db.js +636 -0
  15. package/dist/core/memory.js +116 -0
  16. package/dist/core/migrate.js +227 -0
  17. package/dist/core/models.js +105 -0
  18. package/dist/core/telemetry.js +57 -0
  19. package/dist/core/types.js +2 -0
  20. package/dist/core/vector/postgres.js +52 -0
  21. package/dist/core/vector/valkey.js +246 -0
  22. package/dist/core/vector_store.js +2 -0
  23. package/dist/index.js +44 -0
  24. package/dist/memory/decay.js +301 -0
  25. package/dist/memory/embed.js +675 -0
  26. package/dist/memory/hsg.js +959 -0
  27. package/dist/memory/reflect.js +131 -0
  28. package/dist/memory/user_summary.js +99 -0
  29. package/dist/migrate.js +9 -0
  30. package/dist/ops/compress.js +255 -0
  31. package/dist/ops/dynamics.js +189 -0
  32. package/dist/ops/extract.js +333 -0
  33. package/dist/ops/ingest.js +214 -0
  34. package/dist/server/index.js +109 -0
  35. package/dist/server/middleware/auth.js +137 -0
  36. package/dist/server/routes/auth.js +186 -0
  37. package/dist/server/routes/compression.js +108 -0
  38. package/dist/server/routes/dashboard.js +399 -0
  39. package/dist/server/routes/docs.js +241 -0
  40. package/dist/server/routes/dynamics.js +312 -0
  41. package/dist/server/routes/ide.js +280 -0
  42. package/dist/server/routes/index.js +33 -0
  43. package/dist/server/routes/keys.js +132 -0
  44. package/dist/server/routes/langgraph.js +61 -0
  45. package/dist/server/routes/memory.js +213 -0
  46. package/dist/server/routes/sources.js +140 -0
  47. package/dist/server/routes/system.js +63 -0
  48. package/dist/server/routes/temporal.js +293 -0
  49. package/dist/server/routes/users.js +101 -0
  50. package/dist/server/routes/vercel.js +57 -0
  51. package/dist/server/server.js +211 -0
  52. package/dist/server.js +3 -0
  53. package/dist/sources/base.js +223 -0
  54. package/dist/sources/github.js +171 -0
  55. package/dist/sources/google_drive.js +166 -0
  56. package/dist/sources/google_sheets.js +112 -0
  57. package/dist/sources/google_slides.js +139 -0
  58. package/dist/sources/index.js +34 -0
  59. package/dist/sources/notion.js +165 -0
  60. package/dist/sources/onedrive.js +143 -0
  61. package/dist/sources/web_crawler.js +166 -0
  62. package/dist/temporal_graph/index.js +20 -0
  63. package/dist/temporal_graph/query.js +240 -0
  64. package/dist/temporal_graph/store.js +116 -0
  65. package/dist/temporal_graph/timeline.js +241 -0
  66. package/dist/temporal_graph/types.js +2 -0
  67. package/dist/utils/chunking.js +60 -0
  68. package/dist/utils/index.js +31 -0
  69. package/dist/utils/keyword.js +94 -0
  70. package/dist/utils/text.js +120 -0
  71. package/nodemon.json +7 -0
  72. package/package.json +50 -0
  73. package/references/api_reference.md +66 -0
  74. package/references/examples.md +45 -0
  75. package/src/ai/graph.ts +363 -0
  76. package/src/ai/mcp.ts +494 -0
  77. package/src/cli.ts +94 -0
  78. package/src/core/cfg.ts +110 -0
  79. package/src/core/db.ts +1052 -0
  80. package/src/core/memory.ts +99 -0
  81. package/src/core/migrate.ts +302 -0
  82. package/src/core/models.ts +107 -0
  83. package/src/core/telemetry.ts +47 -0
  84. package/src/core/types.ts +130 -0
  85. package/src/core/vector/postgres.ts +61 -0
  86. package/src/core/vector/valkey.ts +261 -0
  87. package/src/core/vector_store.ts +9 -0
  88. package/src/index.ts +5 -0
  89. package/src/memory/decay.ts +427 -0
  90. package/src/memory/embed.ts +707 -0
  91. package/src/memory/hsg.ts +1245 -0
  92. package/src/memory/reflect.ts +158 -0
  93. package/src/memory/user_summary.ts +110 -0
  94. package/src/migrate.ts +8 -0
  95. package/src/ops/compress.ts +296 -0
  96. package/src/ops/dynamics.ts +272 -0
  97. package/src/ops/extract.ts +360 -0
  98. package/src/ops/ingest.ts +286 -0
  99. package/src/server/index.ts +159 -0
  100. package/src/server/middleware/auth.ts +156 -0
  101. package/src/server/routes/auth.ts +223 -0
  102. package/src/server/routes/compression.ts +106 -0
  103. package/src/server/routes/dashboard.ts +420 -0
  104. package/src/server/routes/docs.ts +380 -0
  105. package/src/server/routes/dynamics.ts +516 -0
  106. package/src/server/routes/ide.ts +283 -0
  107. package/src/server/routes/index.ts +32 -0
  108. package/src/server/routes/keys.ts +131 -0
  109. package/src/server/routes/langgraph.ts +71 -0
  110. package/src/server/routes/memory.ts +440 -0
  111. package/src/server/routes/sources.ts +111 -0
  112. package/src/server/routes/system.ts +68 -0
  113. package/src/server/routes/temporal.ts +335 -0
  114. package/src/server/routes/users.ts +111 -0
  115. package/src/server/routes/vercel.ts +55 -0
  116. package/src/server/server.js +215 -0
  117. package/src/server.ts +1 -0
  118. package/src/sources/base.ts +257 -0
  119. package/src/sources/github.ts +156 -0
  120. package/src/sources/google_drive.ts +144 -0
  121. package/src/sources/google_sheets.ts +85 -0
  122. package/src/sources/google_slides.ts +115 -0
  123. package/src/sources/index.ts +19 -0
  124. package/src/sources/notion.ts +148 -0
  125. package/src/sources/onedrive.ts +131 -0
  126. package/src/sources/web_crawler.ts +161 -0
  127. package/src/temporal_graph/index.ts +4 -0
  128. package/src/temporal_graph/query.ts +299 -0
  129. package/src/temporal_graph/store.ts +156 -0
  130. package/src/temporal_graph/timeline.ts +319 -0
  131. package/src/temporal_graph/types.ts +41 -0
  132. package/src/utils/chunking.ts +66 -0
  133. package/src/utils/index.ts +25 -0
  134. package/src/utils/keyword.ts +137 -0
  135. package/src/utils/text.ts +115 -0
  136. package/tests/test_api_workspace_management.ts +413 -0
  137. package/tests/test_bulk_delete.ts +267 -0
  138. package/tests/test_omnibus.ts +166 -0
  139. package/tests/test_workspace_management.ts +278 -0
  140. package/tests/verify.ts +104 -0
  141. package/tsconfig.json +15 -0
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "singleQuote": false,
3
+ "trailingComma": "all",
4
+ "tabWidth": 4,
5
+ "endOfLine": "auto",
6
+ "semi": true,
7
+ "bracketSpacing": true
8
+ }
package/Dockerfile ADDED
@@ -0,0 +1,59 @@
1
+ # ===== BUILD STAGE =====
2
+ FROM node:20-alpine AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies required for native module compilation,
7
+ # plus curl and bash (needed to run the Bun installation script)
8
+ RUN apk add --no-cache python3 make g++ curl bash
9
+
10
+ # Copy package manifests to install dependencies
11
+ COPY package*.json ./
12
+
13
+ # Install all dependencies (including devDependencies) using NPM
14
+ RUN npm install
15
+
16
+ # Copy source code and build the application
17
+ COPY src/ ./src/
18
+ COPY tsconfig.json ./
19
+ RUN npm run build
20
+
21
+ # Remove devDependencies to reduce image size
22
+ # (Removing all the devDependencies that we dont need in the final build)
23
+ RUN npm prune --omit=dev
24
+
25
+
26
+ # ===== PRODUCTION STAGE =====
27
+ FROM node:20-alpine AS production
28
+
29
+ WORKDIR /app
30
+
31
+ # Install timezone data for proper TZ support
32
+ RUN apk add --no-cache tzdata
33
+
34
+ # Create a dedicated non-root user for security
35
+ RUN addgroup -g 1001 -S appgroup \
36
+ && adduser -u 1001 -S appuser -G appgroup
37
+
38
+ # Copy only production artifacts from the builder stage
39
+ COPY --from=builder /app/node_modules ./node_modules/
40
+ COPY --from=builder /app/dist ./dist/
41
+ COPY package.json ./
42
+
43
+ # Create a directory for persistent data and secure file permissions
44
+ RUN mkdir -p /data \
45
+ && chown -R appuser:appgroup /data /app \
46
+ && chmod -R go-w /app
47
+
48
+ # Switch to non-root user
49
+ USER appuser
50
+
51
+ # Expose the application port
52
+ EXPOSE 8080
53
+
54
+ # Define a lightweight health check that verifies the /health endpoint
55
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
56
+ CMD node -e "require('http').get('http://localhost:8080/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
57
+
58
+ # Start the application using npm
59
+ ENTRYPOINT ["npm", "start"]
package/RAW_SKILL.md ADDED
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: ahok-memory
3
+ description: "Long-term memory storage and retrieval for AI agents. Use when: remembering user preferences, storing context, recalling past conversations, personalizing responses, building agent memory."
4
+ source: ahok-memory-cloud
5
+ api_base: https://zqmt62peqz.us-east-1.awsapprunner.com
6
+ ---
7
+
8
+ # Ahok Memory Cloud
9
+
10
+ Universal long-term memory for AI agents. Store and retrieve memories across conversations.
11
+
12
+ ## Claude Desktop Integration (MCP)
13
+
14
+ Add this to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "ahok-memory": {
20
+ "command": "npx",
21
+ "args": ["-y", "openmemory-js", "mcp"],
22
+ "env": {
23
+ "OM_API_KEY": "your-api-key-here"
24
+ }
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ Or connect to the hosted MCP endpoint:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "ahok-memory": {
36
+ "url": "https://zqmt62peqz.us-east-1.awsapprunner.com/mcp",
37
+ "headers": {
38
+ "x-api-key": "your-api-key-here"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Available MCP Tools
46
+
47
+ Once connected, Claude will have access to:
48
+
49
+ - **openmemory_query** - Search memories semantically
50
+ - **openmemory_store** - Save new memories
51
+ - **openmemory_list** - List recent memories
52
+ - **openmemory_get** - Fetch a specific memory
53
+ - **openmemory_reinforce** - Boost memory importance
54
+
55
+ ## Quick Start
56
+
57
+ ### Authentication
58
+ All requests require an API key in the `x-api-key` header.
59
+ Get your key from: https://your-dashboard-url/dashboard
60
+
61
+ ### Store a Memory
62
+
63
+ ```bash
64
+ curl -X POST https://zqmt62peqz.us-east-1.awsapprunner.com/memory/add \
65
+ -H "Content-Type: application/json" \
66
+ -H "x-api-key: YOUR_API_KEY" \
67
+ -d '{"content": "User prefers dark mode", "user_id": "user123"}'
68
+ ```
69
+
70
+ ### Recall Memories
71
+
72
+ ```bash
73
+ curl -X POST https://zqmt62peqz.us-east-1.awsapprunner.com/query \
74
+ -H "Content-Type: application/json" \
75
+ -H "x-api-key: YOUR_API_KEY" \
76
+ -d '{"query": "What are the user preferences?", "k": 5}'
77
+ ```
78
+
79
+ ## API Endpoints
80
+
81
+ ### POST /memory/add
82
+ Store a new memory.
83
+
84
+ **Request Body:**
85
+ ```json
86
+ {
87
+ "content": "The information to remember",
88
+ "user_id": "optional-user-identifier",
89
+ "tags": ["optional", "tags"],
90
+ "metadata": {"any": "json object"},
91
+ "memory_key_id": "optional-workspace-uuid"
92
+ }
93
+ ```
94
+
95
+ **Response:**
96
+ ```json
97
+ {
98
+ "id": "uuid",
99
+ "primary_sector": "semantic|procedural|episodic",
100
+ "sectors": ["semantic"],
101
+ "chunks": 1
102
+ }
103
+ ```
104
+
105
+ ### POST /query
106
+ Search memories semantically.
107
+
108
+ **Request Body:**
109
+ ```json
110
+ {
111
+ "query": "natural language search",
112
+ "k": 5,
113
+ "user_id": "optional-filter"
114
+ }
115
+ ```
116
+
117
+ **Response:**
118
+ ```json
119
+ {
120
+ "query": "natural language search",
121
+ "result": "Formatted memory results as text",
122
+ "matches": [
123
+ {"id": "uuid", "content": "...", "score": 0.95}
124
+ ]
125
+ }
126
+ ```
127
+
128
+ ### POST /memories
129
+ Simplified endpoint for storing memories (alias for /memory/add).
130
+
131
+ ### GET /memory/all
132
+ List all memories with pagination.
133
+
134
+ **Query Parameters:**
135
+ - `user_id`: Filter by user
136
+ - `l`: Limit (default 50)
137
+ - `u`: Offset (default 0)
138
+ - `key_id`: Filter by workspace
139
+
140
+ ### DELETE /memory/{id}
141
+ Delete a specific memory.
142
+
143
+ ## Memory Sectors
144
+
145
+ Memories are automatically classified into sectors:
146
+ - **semantic**: Facts, knowledge, preferences
147
+ - **procedural**: How-to, processes, workflows
148
+ - **episodic**: Events, conversations, experiences
149
+
150
+ ## Best Practices
151
+
152
+ 1. **Always include user_id** for multi-user applications
153
+ 2. **Use tags** for easier filtering and organization
154
+ 3. **Query at conversation start** to personalize responses
155
+ 4. **Store important facts** as they're shared by users
156
+ 5. **Use workspaces** to isolate memories by project/context
157
+
158
+ ## Integration Examples
159
+
160
+ ### Python
161
+ ```python
162
+ import requests
163
+
164
+ API_KEY = "your-api-key"
165
+ BASE_URL = "https://zqmt62peqz.us-east-1.awsapprunner.com"
166
+
167
+ def remember(content, user_id=None):
168
+ return requests.post(f"{BASE_URL}/memory/add",
169
+ headers={"x-api-key": API_KEY},
170
+ json={"content": content, "user_id": user_id}
171
+ ).json()
172
+
173
+ def recall(query, k=5):
174
+ return requests.post(f"{BASE_URL}/query",
175
+ headers={"x-api-key": API_KEY},
176
+ json={"query": query, "k": k}
177
+ ).json()
178
+ ```
179
+
180
+ ### JavaScript/TypeScript
181
+ ```typescript
182
+ const API_KEY = "your-api-key";
183
+ const BASE_URL = "https://zqmt62peqz.us-east-1.awsapprunner.com";
184
+
185
+ async function remember(content: string, userId?: string) {
186
+ const res = await fetch(`${BASE_URL}/memory/add`, {
187
+ method: "POST",
188
+ headers: { "Content-Type": "application/json", "x-api-key": API_KEY },
189
+ body: JSON.stringify({ content, user_id: userId })
190
+ });
191
+ return res.json();
192
+ }
193
+
194
+ async function recall(query: string, k = 5) {
195
+ const res = await fetch(`${BASE_URL}/query`, {
196
+ method: "POST",
197
+ headers: { "Content-Type": "application/json", "x-api-key": API_KEY },
198
+ body: JSON.stringify({ query, k })
199
+ });
200
+ return res.json();
201
+ }
202
+ ```
203
+
204
+ ## Claude/Anthropic Integration
205
+
206
+ When using with Claude, add this to your system prompt:
207
+
208
+ ```
209
+ You have access to long-term memory via the Ahok Memory API.
210
+
211
+ To remember something important:
212
+ POST /memory/add with {"content": "what to remember"}
213
+
214
+ To recall relevant context:
215
+ POST /query with {"query": "what to search for"}
216
+
217
+ Always check memory at the start of conversations for personalization.
218
+ Store important user preferences and facts as they're shared.
219
+ ```
package/README.md ADDED
@@ -0,0 +1,277 @@
1
+ # openmemory javascript sdk
2
+
3
+ > **real long-term memory for ai agents. not rag. not a vector db. self-hosted.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/openmemory-js.svg)](https://www.npmjs.com/package/openmemory-js)
6
+ [![license](https://img.shields.io/github/license/CaviraOSS/OpenMemory)](https://github.com/CaviraOSS/OpenMemory/blob/main/LICENSE)
7
+ [![discord](https://img.shields.io/discord/1300368230320697404?label=Discord)](https://discord.gg/P7HaRayqTh)
8
+
9
+ openmemory is a **cognitive memory engine** for llms and agents.
10
+
11
+ - 🧠 real long-term memory (not just embeddings in a table)
12
+ - 💾 self-hosted, local-first (sqlite / postgres)
13
+ - 🧩 integrations: mcp, claude desktop, cursor, windsurf
14
+ - 📥 sources: github, notion, google drive, onedrive, web crawler
15
+ - 🔍 explainable traces (see *why* something was recalled)
16
+
17
+ your model stays stateless. **your app stops being amnesiac.**
18
+
19
+ ---
20
+
21
+ ## quick start
22
+
23
+ ```bash
24
+ npm install openmemory-js
25
+ ```
26
+
27
+ ```typescript
28
+ import { Memory } from "openmemory-js"
29
+
30
+ const mem = new Memory()
31
+ await mem.add("user likes spicy food", { user_id: "u1" })
32
+ const results = await mem.search("food?", { user_id: "u1" })
33
+ ```
34
+
35
+ drop this into:
36
+
37
+ - node backends
38
+ - clis
39
+ - local tools
40
+ - anything that needs durable memory without running a separate service
41
+
42
+ **that's it.** you're now running a fully local cognitive memory engine 🎉
43
+
44
+ ---
45
+
46
+ ## 📥 sources (connectors)
47
+
48
+ ingest data from external sources directly into memory:
49
+
50
+ ```typescript
51
+ const github = await mem.source("github")
52
+ await github.connect({ token: "ghp_..." })
53
+ await github.ingest_all({ repo: "owner/repo" })
54
+ ```
55
+
56
+ available sources: `github`, `notion`, `google_drive`, `google_sheets`, `google_slides`, `onedrive`, `web_crawler`
57
+
58
+ ---
59
+
60
+ ## features
61
+
62
+ ✅ **local-first** - runs entirely on your machine, zero external dependencies
63
+ ✅ **multi-sector memory** - episodic, semantic, procedural, emotional, reflective
64
+ ✅ **temporal knowledge graph** - time-aware facts with validity periods
65
+ ✅ **memory decay** - adaptive forgetting with sector-specific rates
66
+ ✅ **waypoint graph** - associative recall paths for better retrieval
67
+ ✅ **explainable traces** - see exactly why memories were recalled
68
+ ✅ **zero config** - works out of the box with sensible defaults
69
+
70
+ ---
71
+
72
+ ## cognitive sectors
73
+
74
+ openmemory automatically classifies content into 5 cognitive sectors:
75
+
76
+ | sector | description | examples | decay rate |
77
+ |--------|-------------|----------|------------|
78
+ | **episodic** | time-bound events & experiences | "yesterday i attended a conference" | medium |
79
+ | **semantic** | timeless facts & knowledge | "paris is the capital of france" | very low |
80
+ | **procedural** | skills, procedures, how-tos | "to deploy: build, test, push" | low |
81
+ | **emotional** | feelings, sentiment, mood | "i'm excited about this project!" | high |
82
+ | **reflective** | meta-cognition, insights | "i learn best through practice" | very low |
83
+
84
+ ---
85
+
86
+ ## configuration
87
+
88
+ ### environment variables
89
+
90
+ ```bash
91
+ # database
92
+ OM_DB_PATH=./data/om.db # sqlite file path (default: ./data/openmemory.sqlite)
93
+ OM_DB_URL=sqlite://:memory: # or use in-memory db
94
+
95
+ # embeddings
96
+ OM_EMBEDDINGS=ollama # synthetic | openai | gemini | ollama
97
+ OM_OLLAMA_URL=http://localhost:11434
98
+ OM_OLLAMA_MODEL=embeddinggemma # or nomic-embed-text, mxbai-embed-large
99
+
100
+ # openai
101
+ OPENAI_API_KEY=sk-...
102
+ OM_OPENAI_MODEL=text-embedding-3-small
103
+
104
+ # gemini
105
+ GEMINI_API_KEY=AIza...
106
+
107
+ # performance tier
108
+ OM_TIER=deep # fast | smart | deep | hybrid
109
+ OM_VEC_DIM=768 # vector dimension (must match model)
110
+
111
+ # metadata backend (optional)
112
+ OM_METADATA_BACKEND=postgres # sqlite (default) | postgres
113
+ OM_PG_HOST=localhost
114
+ OM_PG_PORT=5432
115
+ OM_PG_DB=openmemory
116
+ OM_PG_USER=postgres
117
+ OM_PG_PASSWORD=...
118
+
119
+ # vector backend (optional)
120
+ OM_VECTOR_BACKEND=valkey # default uses metadata backend
121
+ OM_VALKEY_URL=redis://localhost:6379
122
+ ```
123
+
124
+ ### programmatic usage
125
+
126
+ ```typescript
127
+ import { Memory } from 'openmemory-js';
128
+
129
+ const mem = new Memory('user-123'); // optional user_id
130
+
131
+ // add memories
132
+ await mem.add(
133
+ "user prefers dark mode",
134
+ {
135
+ tags: ["preference", "ui"],
136
+ created_at: Date.now()
137
+ }
138
+ );
139
+
140
+ // search
141
+ const results = await mem.search("user settings", {
142
+ user_id: "user-123",
143
+ limit: 10,
144
+ sectors: ["semantic", "procedural"]
145
+ });
146
+
147
+ // get by id
148
+ const memory = await mem.get("uuid-here");
149
+
150
+ // wipe all data (useful for testing)
151
+ await mem.wipe();
152
+ ```
153
+
154
+ ---
155
+
156
+ ## performance tiers
157
+
158
+ - `fast` - synthetic embeddings (no api calls), instant
159
+ - `smart` - hybrid semantic + synthetic for balanced speed/accuracy
160
+ - `deep` - pure semantic embeddings for maximum accuracy
161
+ - `hybrid` - adaptive based on query complexity
162
+
163
+ ---
164
+
165
+ ## mcp server
166
+
167
+ openmemory-js includes an mcp server for integration with claude desktop, cursor, windsurf, and other mcp clients:
168
+
169
+ ```bash
170
+ npx openmemory-js serve --port 3000
171
+ ```
172
+
173
+ ### claude desktop / cursor / windsurf
174
+
175
+ ```json
176
+ {
177
+ "mcpServers": {
178
+ "openmemory": {
179
+ "command": "npx",
180
+ "args": ["openmemory-js", "serve"]
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ available mcp tools:
187
+
188
+ - `openmemory_query` - search memories
189
+ - `openmemory_store` - add new memories
190
+ - `openmemory_list` - list all memories
191
+ - `openmemory_get` - get memory by id
192
+ - `openmemory_reinforce` - reinforce a memory
193
+
194
+ ---
195
+
196
+ ## examples
197
+
198
+ ```typescript
199
+ // multi-user support
200
+ const mem = new Memory();
201
+ await mem.add("alice likes python", { user_id: "alice" });
202
+ await mem.add("bob likes rust", { user_id: "bob" });
203
+
204
+ const alicePrefs = await mem.search("what does alice like?", { user_id: "alice" });
205
+ // returns python results only
206
+
207
+ // temporal filtering
208
+ const recent = await mem.search("user activity", {
209
+ startTime: Date.now() - 86400000, // last 24 hours
210
+ endTime: Date.now()
211
+ });
212
+
213
+ // sector-specific queries
214
+ const facts = await mem.search("company info", { sectors: ["semantic"] });
215
+ const howtos = await mem.search("deployment", { sectors: ["procedural"] });
216
+ ```
217
+
218
+ ---
219
+
220
+ ## api reference
221
+
222
+ ### `new Memory(user_id?: string)`
223
+
224
+ create a new memory instance with optional default user_id.
225
+
226
+ ### `async add(content: string, metadata?: object): Promise<hsg_mem>`
227
+
228
+ store a new memory.
229
+
230
+ **parameters:**
231
+ - `content` - text content to store
232
+ - `metadata` - optional metadata object:
233
+ - `user_id` - user identifier
234
+ - `tags` - array of tag strings
235
+ - `created_at` - timestamp
236
+ - any other custom fields
237
+
238
+ **returns:** memory object with `id`, `primary_sector`, `sectors`
239
+
240
+ ### `async search(query: string, options?: object): Promise<hsg_q_result[]>`
241
+
242
+ search for relevant memories.
243
+
244
+ **parameters:**
245
+ - `query` - search text
246
+ - `options`:
247
+ - `user_id` - filter by user
248
+ - `limit` - max results (default: 10)
249
+ - `sectors` - array of sectors to search
250
+ - `startTime` - filter memories after this timestamp
251
+ - `endTime` - filter memories before this timestamp
252
+
253
+ **returns:** array of memory results with `id`, `content`, `score`, `sectors`, `salience`, `tags`, `meta`
254
+
255
+ ### `async get(id: string): Promise<memory | null>`
256
+
257
+ retrieve a memory by id.
258
+
259
+ ### `async wipe(): Promise<void>`
260
+
261
+ **⚠️ danger**: delete all memories, vectors, and waypoints. useful for testing.
262
+
263
+ ---
264
+
265
+ ## license
266
+
267
+ apache 2.0
268
+
269
+ ---
270
+
271
+ ## links
272
+
273
+ - [main repository](https://github.com/CaviraOSS/OpenMemory)
274
+ - [python sdk](https://pypi.org/project/openmemory-py/)
275
+ - [vs code extension](https://marketplace.visualstudio.com/items?itemName=Nullure.openmemory-vscode)
276
+ - [documentation](https://openmemory.cavira.app/docs/sdks/javascript)
277
+ - [discord](https://discord.gg/P7HaRayqTh)
package/SKILL.md ADDED
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: ahok-memory
3
+ description: "Universal long-term memory system for AI agents. Use when: remembering user preferences, storing persistent context, recalling past conversations, personalizing responses, or creating new agent memories that persist across sessions."
4
+ ---
5
+
6
+ # Ahok Memory Cloud
7
+
8
+ Universal long-term memory for AI agents. Store and retrieve memories across conversations.
9
+
10
+ ## Quick Start
11
+
12
+ 1. **Get API Key**: Obtain from dashboard.
13
+ 2. **Add Memory**: `POST /memory/add` with `content`.
14
+ 3. **Recall Memory**: `POST /query` with `query`.
15
+
16
+ See [references/api_reference.md](references/api_reference.md) for full API documentation.
17
+ See [references/examples.md](references/examples.md) for code integration examples.
18
+
19
+ ## Best Practices
20
+
21
+ 1. **Always include user_id** for multi-user applications to ensure proper data isolation.
22
+ 2. **Use tags** for easier filtering and organization.
23
+ 3. **Query at conversation start** to personalize responses based on past interactions.
24
+ 4. **Store important facts** as they are shared by users (e.g., preferences, project details).
25
+ 5. **Use workspaces** to isolate memories by project or context.
26
+
27
+ ## Claude Desktop Integration (MCP)
28
+
29
+ Add to `claude_desktop_config.json`:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "ahok-memory": {
35
+ "command": "npx",
36
+ "args": ["-y", "ahok-skill", "mcp"],
37
+ "env": {
38
+ "OM_API_KEY": "your-api-key-here"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ Or connect via hosted MCP:
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "ahok-memory": {
51
+ "url": "https://zqmt62peqz.us-east-1.awsapprunner.com/mcp",
52
+ "headers": {
53
+ "x-api-key": "your-api-key-here"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```