clawmem 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/AGENTS.md +660 -0
- package/CLAUDE.md +660 -0
- package/LICENSE +21 -0
- package/README.md +993 -0
- package/SKILL.md +717 -0
- package/bin/clawmem +75 -0
- package/package.json +72 -0
- package/src/amem.ts +797 -0
- package/src/beads.ts +263 -0
- package/src/clawmem.ts +1849 -0
- package/src/collections.ts +405 -0
- package/src/config.ts +178 -0
- package/src/consolidation.ts +123 -0
- package/src/directory-context.ts +248 -0
- package/src/errors.ts +41 -0
- package/src/formatter.ts +427 -0
- package/src/graph-traversal.ts +247 -0
- package/src/hooks/context-surfacing.ts +317 -0
- package/src/hooks/curator-nudge.ts +89 -0
- package/src/hooks/decision-extractor.ts +639 -0
- package/src/hooks/feedback-loop.ts +214 -0
- package/src/hooks/handoff-generator.ts +345 -0
- package/src/hooks/postcompact-inject.ts +226 -0
- package/src/hooks/precompact-extract.ts +314 -0
- package/src/hooks/pretool-inject.ts +79 -0
- package/src/hooks/session-bootstrap.ts +324 -0
- package/src/hooks/staleness-check.ts +130 -0
- package/src/hooks.ts +367 -0
- package/src/indexer.ts +327 -0
- package/src/intent.ts +294 -0
- package/src/limits.ts +26 -0
- package/src/llm.ts +1175 -0
- package/src/mcp.ts +2138 -0
- package/src/memory.ts +336 -0
- package/src/mmr.ts +93 -0
- package/src/observer.ts +269 -0
- package/src/openclaw/engine.ts +283 -0
- package/src/openclaw/index.ts +221 -0
- package/src/openclaw/plugin.json +83 -0
- package/src/openclaw/shell.ts +207 -0
- package/src/openclaw/tools.ts +304 -0
- package/src/profile.ts +346 -0
- package/src/promptguard.ts +218 -0
- package/src/retrieval-gate.ts +106 -0
- package/src/search-utils.ts +127 -0
- package/src/server.ts +783 -0
- package/src/splitter.ts +325 -0
- package/src/store.ts +4062 -0
- package/src/validation.ts +67 -0
- package/src/watcher.ts +58 -0
package/bin/clawmem
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# clawmem - Hybrid Agent Memory (QMD search + SAME memory layer)
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
# Find bun - prefer PATH, fallback to known locations
|
|
6
|
+
find_bun() {
|
|
7
|
+
if command -v bun &>/dev/null; then
|
|
8
|
+
local ver=$(bun --version 2>/dev/null || echo "0")
|
|
9
|
+
if [[ "$ver" =~ ^1\. ]]; then
|
|
10
|
+
command -v bun
|
|
11
|
+
return 0
|
|
12
|
+
fi
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
: "${HOME:=$(eval echo ~)}"
|
|
16
|
+
|
|
17
|
+
if [[ "${BASH_SOURCE[0]}" == */.bun/* ]]; then
|
|
18
|
+
local bun_home="${BASH_SOURCE[0]%%/.bun/*}/.bun"
|
|
19
|
+
if [[ -x "$bun_home/bin/bun" ]]; then
|
|
20
|
+
echo "$bun_home/bin/bun"
|
|
21
|
+
return 0
|
|
22
|
+
fi
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
local candidates=(
|
|
26
|
+
"$HOME/.local/share/mise/installs/bun/latest/bin/bun"
|
|
27
|
+
"$HOME/.local/share/mise/shims/bun"
|
|
28
|
+
"$HOME/.asdf/shims/bun"
|
|
29
|
+
"/opt/homebrew/bin/bun"
|
|
30
|
+
"/usr/local/bin/bun"
|
|
31
|
+
"$HOME/.bun/bin/bun"
|
|
32
|
+
)
|
|
33
|
+
for c in "${candidates[@]}"; do
|
|
34
|
+
[[ -x "$c" ]] && { echo "$c"; return 0; }
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
return 1
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Resolve symlinks to find script location
|
|
41
|
+
SOURCE="${BASH_SOURCE[0]}"
|
|
42
|
+
while [[ -L "$SOURCE" ]]; do
|
|
43
|
+
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
44
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
45
|
+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
46
|
+
done
|
|
47
|
+
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
48
|
+
|
|
49
|
+
# Load .env if present — only sets vars not already exported in shell
|
|
50
|
+
# Precedence: shell env > .env > wrapper defaults below
|
|
51
|
+
if [[ -f "$SCRIPT_DIR/../.env" ]]; then
|
|
52
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
53
|
+
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
|
54
|
+
key="${line%%=*}"
|
|
55
|
+
[[ -z "$key" || "$key" == *" "* ]] && continue
|
|
56
|
+
# Only export if not already set in environment
|
|
57
|
+
if [[ -z "${!key+x}" ]]; then
|
|
58
|
+
export "$line"
|
|
59
|
+
fi
|
|
60
|
+
done < "$SCRIPT_DIR/../.env"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# GPU inference endpoints — set these to your llama-server instances
|
|
64
|
+
# Embedding (zembed-1 recommended, --embeddings mode, -ub must match -b)
|
|
65
|
+
export CLAWMEM_EMBED_URL="${CLAWMEM_EMBED_URL:-http://localhost:8088}"
|
|
66
|
+
# LLM text generation (qmd-query-expansion-1.7B or similar, /v1/chat/completions)
|
|
67
|
+
export CLAWMEM_LLM_URL="${CLAWMEM_LLM_URL:-http://localhost:8089}"
|
|
68
|
+
# Cross-encoder reranker (zerank-2 recommended, -ub must match -b)
|
|
69
|
+
export CLAWMEM_RERANK_URL="${CLAWMEM_RERANK_URL:-http://localhost:8090}"
|
|
70
|
+
# Allow node-llama-cpp to auto-download models if no server is running.
|
|
71
|
+
# Set to "true" in remote/distributed setups to prevent surprise downloads.
|
|
72
|
+
export CLAWMEM_NO_LOCAL_MODELS="${CLAWMEM_NO_LOCAL_MODELS:-false}"
|
|
73
|
+
BUN=$(find_bun) || { echo "Error: bun not found. Install from https://bun.sh" >&2; exit 1; }
|
|
74
|
+
|
|
75
|
+
exec "$BUN" "$SCRIPT_DIR/../src/clawmem.ts" "$@"
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clawmem",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "On-device context engine and memory for AI agents. Claude Code and OpenClaw. Hooks + MCP server + hybrid RAG search.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"clawmem": "./bin/clawmem"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"src/",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"CLAUDE.md",
|
|
15
|
+
"AGENTS.md",
|
|
16
|
+
"SKILL.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "bun test",
|
|
20
|
+
"dev": "bun src/clawmem.ts",
|
|
21
|
+
"inspector": "npx @modelcontextprotocol/inspector bun src/clawmem.ts mcp"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/yoloshii/ClawMem.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/yoloshii/ClawMem/issues"
|
|
29
|
+
},
|
|
30
|
+
"author": "yoloshii",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"mcp-server",
|
|
33
|
+
"model-context-protocol",
|
|
34
|
+
"claude-code",
|
|
35
|
+
"ai-agent-memory",
|
|
36
|
+
"retrieval-augmented-generation",
|
|
37
|
+
"rag",
|
|
38
|
+
"vector-search",
|
|
39
|
+
"sqlite",
|
|
40
|
+
"bun",
|
|
41
|
+
"llama-cpp",
|
|
42
|
+
"local-first",
|
|
43
|
+
"context-engine",
|
|
44
|
+
"openclaw",
|
|
45
|
+
"mcp-tools",
|
|
46
|
+
"hybrid-search"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
50
|
+
"gray-matter": "^4.0.3",
|
|
51
|
+
"node-llama-cpp": "^3.14.5",
|
|
52
|
+
"sqlite-vec": "^0.1.7-alpha.2",
|
|
53
|
+
"yaml": "^2.8.2",
|
|
54
|
+
"zod": "^4.2.1"
|
|
55
|
+
},
|
|
56
|
+
"optionalDependencies": {
|
|
57
|
+
"sqlite-vec-darwin-arm64": "^0.1.7-alpha.2",
|
|
58
|
+
"sqlite-vec-darwin-x64": "^0.1.7-alpha.2",
|
|
59
|
+
"sqlite-vec-linux-x64": "^0.1.7-alpha.2",
|
|
60
|
+
"sqlite-vec-win32-x64": "^0.1.7-alpha.2"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/bun": "latest"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"typescript": "^5.9.3"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"bun": ">=1.0.0"
|
|
70
|
+
},
|
|
71
|
+
"license": "MIT"
|
|
72
|
+
}
|