remem-mcp 0.6.2 → 0.6.3

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/dist/sdk.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  ingestDirectory,
9
9
  ingestFile,
10
10
  searchWiki
11
- } from "./chunk-ULMM6LKD.js";
11
+ } from "./chunk-WBGP7QM3.js";
12
12
  import {
13
13
  SUPPORTED_LANGUAGES,
14
14
  detectLanguage,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "remem-mcp",
3
3
  "mcpName": "io.github.tinhien11/remem-mcp",
4
- "version": "0.6.2",
4
+ "version": "0.6.3",
5
5
  "description": "Long-term memory for AI coding agents. Memory + CodeGraph + Wiki in one SQLite file. Auto-recall, auto-capture, no API key, no cloud.",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env bash
2
+ # dogfood-claude-cli.sh — dogfood remem-mcp using Claude CLI as the agent
3
+ # Claude CLI gets remem-mcp as its MCP server, then works on remem-mcp's own codebase.
4
+ # Memory persists across iterations — Claude recalls past errors/fixes from previous runs.
5
+ #
6
+ # Usage: bash scripts/dogfood-claude-cli.sh [max_iterations] [model]
7
+ # Example: bash scripts/dogfood-claude-cli.sh 3 sonnet
8
+
9
+ set -euo pipefail
10
+ cd "$(dirname "$0")/.."
11
+
12
+ MAX_ITER="${1:-3}"
13
+ MODEL="${2:-sonnet}"
14
+ REPO_DIR="$(pwd)"
15
+ TMP_DIR="/tmp/remem-dogfood"
16
+ mkdir -p "$TMP_DIR"
17
+
18
+ # MCP config — point Claude CLI at the locally built remem-mcp
19
+ MCP_CONFIG="$TMP_DIR/mcp-config.json"
20
+ cat > "$MCP_CONFIG" <<EOF
21
+ {
22
+ "mcpServers": {
23
+ "remem-mcp": {
24
+ "command": "node",
25
+ "args": ["$REPO_DIR/dist/index.js"],
26
+ "env": {
27
+ "REMEM_DB_PATH": "$HOME/.local/share/remem-mcp/memory.db",
28
+ "REMEM_GLOBAL_SESSION_KEY": "global",
29
+ "REMEM_AUTO_GLOBAL": "true"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ EOF
35
+
36
+ echo "══════════════════════════════════════════════════════════════"
37
+ echo " 🐕 DOGFOOD WITH CLAUDE CLI"
38
+ echo " Repo: $REPO_DIR"
39
+ echo " MCP: $MCP_CONFIG"
40
+ echo " Model: $MODEL"
41
+ echo " Iterations: $MAX_ITER"
42
+ echo "══════════════════════════════════════════════════════════════"
43
+ echo ""
44
+
45
+ # Build first
46
+ echo "[build] Compiling..."
47
+ npm run build 2>&1 | tail -1
48
+ echo ""
49
+
50
+ ITER=0
51
+ while [ "$ITER" -lt "$MAX_ITER" ]; do
52
+ ITER=$((ITER + 1))
53
+ echo ""
54
+ echo "────────────────────────────────────────────────────────────"
55
+ echo " ITERATION $ITER/$MAX_ITER"
56
+ echo "────────────────────────────────────────────────────────────"
57
+
58
+ # 1. Snapshot current state
59
+ echo ""
60
+ echo "[1/4] State snapshot:"
61
+ TS_ERRS=$(npx tsc --noEmit 2>&1 | grep -c "error TS" | tr -d '[:space:]' || echo "0")
62
+ TEST_OUT=$(npx vitest run 2>&1 || true)
63
+ TEST_FAILS=$(echo "$TEST_OUT" | grep -oE "[0-9]+ failed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
64
+ TEST_PASSES=$(echo "$TEST_OUT" | grep -oE "[0-9]+ passed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
65
+ [ -z "$TS_ERRS" ] && TS_ERRS=0
66
+ [ -z "$TEST_FAILS" ] && TEST_FAILS=0
67
+ [ -z "$TEST_PASSES" ] && TEST_PASSES=0
68
+ echo " TS errors: $TS_ERRS | Tests: $TEST_PASSES passed, $TEST_FAILS failed"
69
+
70
+ # 2. Capture errors to feed Claude context
71
+ ERR_FILE="$TMP_DIR/errors-iter-$ITER.txt"
72
+ {
73
+ echo "## Build errors (iteration $ITER)"
74
+ npm run build 2>&1 | grep -i "error\|fail" | head -20 || echo "none"
75
+ echo ""
76
+ echo "## TypeScript errors"
77
+ npx tsc --noEmit 2>&1 | grep "error TS" | head -20 || echo "none"
78
+ echo ""
79
+ echo "## Test failures"
80
+ echo "$TEST_OUT" | grep -B2 "FAIL\|AssertionError\|Error:" | head -30 || echo "none"
81
+ } > "$ERR_FILE" 2>&1
82
+
83
+ ERR_COUNT=$(grep -c "error\|fail\|FAIL" "$ERR_FILE" || echo "0")
84
+ echo " Error file: $ERR_FILE ($ERR_COUNT lines with errors)"
85
+
86
+ # 3. Run Claude CLI with remem-mcp as MCP server
87
+ echo ""
88
+ echo "[2/4] Launching Claude CLI (model=$MODEL)..."
89
+
90
+ PROMPT="You are working on the remem-mcp codebase (a local MCP memory server).
91
+
92
+ Current state:
93
+ - TypeScript errors: $TS_ERRS
94
+ - Test failures: $TEST_FAILS (out of $TEST_PASSES passed)
95
+
96
+ Error details from this iteration:
97
+ $(cat "$ERR_FILE")
98
+
99
+ Your tasks:
100
+ 1. Use recall to check if we've seen these errors before and how we fixed them.
101
+ 2. Fix the TypeScript errors and test failures shown above.
102
+ 3. After fixing, run \`npm run build\` and \`npx vitest run\` to verify.
103
+ 4. Use capture to store what you fixed and how, so future sessions can recall it.
104
+ 5. If everything passes, look for edge cases or potential bugs in the codebase and fix them.
105
+
106
+ Focus on real fixes, not workarounds. Check src/ for the relevant code."
107
+
108
+ claude -p "$PROMPT" \
109
+ --model "$MODEL" \
110
+ --mcp-config "$MCP_CONFIG" \
111
+ --add-dir "$REPO_DIR" \
112
+ --allowedTools "Bash(npm *),Bash(npx *),Bash(node *),Bash(git *),Bash(cat *),Bash(grep *),Bash(ls *),Bash(wc *),Bash(head *),Bash(tail *),Edit,Read,Write,Grep,Glob" \
113
+ --output-format text \
114
+ --max-turns 30 \
115
+ 2>&1 | tee "$TMP_DIR/claude-output-iter-$ITER.log" || true
116
+
117
+ echo ""
118
+ echo "[3/4] Claude CLI finished. Output saved to $TMP_DIR/claude-output-iter-$ITER.log"
119
+
120
+ # 4. Re-check state after Claude's fixes
121
+ echo ""
122
+ echo "[4/4] Post-fix state:"
123
+ TS_ERRS_AFTER=$(npx tsc --noEmit 2>&1 | grep -c "error TS" | tr -d '[:space:]' || echo "0")
124
+ TEST_OUT_AFTER=$(npx vitest run 2>&1 || true)
125
+ TEST_FAILS_AFTER=$(echo "$TEST_OUT_AFTER" | grep -oE "[0-9]+ failed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
126
+ TEST_PASSES_AFTER=$(echo "$TEST_OUT_AFTER" | grep -oE "[0-9]+ passed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
127
+ [ -z "$TS_ERRS_AFTER" ] && TS_ERRS_AFTER=0
128
+ [ -z "$TEST_FAILS_AFTER" ] && TEST_FAILS_AFTER=0
129
+ [ -z "$TEST_PASSES_AFTER" ] && TEST_PASSES_AFTER=0
130
+
131
+ echo " TS errors: $TS_ERRS → $TS_ERRS_AFTER"
132
+ echo " Test failures: $TEST_FAILS → $TEST_FAILS_AFTER"
133
+ echo " Tests passed: $TEST_PASSES → $TEST_PASSES_AFTER"
134
+
135
+ # Summary
136
+ echo ""
137
+ echo "┌──────────────────────────────────┐"
138
+ echo "│ Iteration $ITER summary:"
139
+ echo "│ TS errors: $TS_ERRS → $TS_ERRS_AFTER"
140
+ echo "│ Test fails: $TEST_FAILS → $TEST_FAILS_AFTER"
141
+ echo "│ Tests passed: $TEST_PASSES → $TEST_PASSES_AFTER"
142
+ echo "└──────────────────────────────────┘"
143
+
144
+ if [ "$TS_ERRS_AFTER" -eq 0 ] && [ "$TEST_FAILS_AFTER" -eq 0 ]; then
145
+ echo ""
146
+ echo "★★★ ALL GREEN — 0 TS errors, 0 test failures ★★★"
147
+ echo "Claude CLI + remem-mcp dogfood iteration $ITER succeeded."
148
+ break
149
+ fi
150
+ done
151
+
152
+ echo ""
153
+ echo "══════════════════════════════════════════════════════════════"
154
+ echo " DOGFOOD COMPLETE — $ITER iteration(s)"
155
+ echo " Logs: $TMP_DIR/"
156
+ echo "══════════════════════════════════════════════════════════════"
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env bash
2
+ # dogfood-codex.sh — dogfood remem-mcp using OpenAI Codex CLI as the agent
3
+ # Codex CLI gets remem-mcp as its MCP server, then works on remem-mcp's own codebase.
4
+ #
5
+ # Usage: bash scripts/dogfood-codex.sh [max_iterations] [model]
6
+ # Example: bash scripts/dogfood-codex.sh 3 gpt-5-codex
7
+
8
+ set -euo pipefail
9
+ cd "$(dirname "$0")/.."
10
+
11
+ MAX_ITER="${1:-3}"
12
+ MODEL="${2:-gpt-5.5}"
13
+ REPO_DIR="$(pwd)"
14
+ TMP_DIR="/tmp/remem-dogfood-codex"
15
+ mkdir -p "$TMP_DIR"
16
+
17
+ echo "══════════════════════════════════════════════════════════════"
18
+ echo " 🐕 DOGFOOD WITH CODEX CLI"
19
+ echo " Repo: $REPO_DIR"
20
+ echo " Model: $MODEL"
21
+ echo " Iterations: $MAX_ITER"
22
+ echo " MCP: remem-mcp (already configured via 'codex mcp list')"
23
+ echo "══════════════════════════════════════════════════════════════"
24
+ echo ""
25
+
26
+ # Build first
27
+ echo "[build] Compiling..."
28
+ npm run build 2>&1 | tail -1
29
+ echo ""
30
+
31
+ # Verify remem-mcp is configured for Codex
32
+ if ! codex mcp list 2>&1 | grep -q "remem-mcp"; then
33
+ echo "⚠ remem-mcp not configured for Codex. Adding it now..."
34
+ codex mcp add remem-mcp \
35
+ --env "REMEM_DB_PATH=$HOME/.local/share/remem-mcp/memory.db" \
36
+ --env "REMEM_GLOBAL_SESSION_KEY=global" \
37
+ --env "REMEM_AUTO_GLOBAL=true" \
38
+ -- node "$REPO_DIR/dist/index.js"
39
+ fi
40
+
41
+ ITER=0
42
+ while [ "$ITER" -lt "$MAX_ITER" ]; do
43
+ ITER=$((ITER + 1))
44
+ echo ""
45
+ echo "────────────────────────────────────────────────────────────"
46
+ echo " ITERATION $ITER/$MAX_ITER"
47
+ echo "────────────────────────────────────────────────────────────"
48
+
49
+ # 1. Snapshot current state
50
+ echo ""
51
+ echo "[1/4] State snapshot:"
52
+ TS_ERRS=$(npx tsc --noEmit 2>&1 | grep -c "error TS" | tr -d '[:space:]' || echo "0")
53
+ TEST_OUT=$(npx vitest run 2>&1 || true)
54
+ TEST_FAILS=$(echo "$TEST_OUT" | grep -oE "[0-9]+ failed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
55
+ TEST_PASSES=$(echo "$TEST_OUT" | grep -oE "[0-9]+ passed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
56
+ [ -z "$TS_ERRS" ] && TS_ERRS=0
57
+ [ -z "$TEST_FAILS" ] && TEST_FAILS=0
58
+ [ -z "$TEST_PASSES" ] && TEST_PASSES=0
59
+ echo " TS errors: $TS_ERRS | Tests: $TEST_PASSES passed, $TEST_FAILS failed"
60
+
61
+ # 2. Capture errors to feed Codex context
62
+ ERR_FILE="$TMP_DIR/errors-iter-$ITER.txt"
63
+ {
64
+ echo "## Build errors (iteration $ITER)"
65
+ npm run build 2>&1 | grep -i "error\|fail" | head -20 || echo "none"
66
+ echo ""
67
+ echo "## TypeScript errors"
68
+ npx tsc --noEmit 2>&1 | grep "error TS" | head -20 || echo "none"
69
+ echo ""
70
+ echo "## Test failures"
71
+ echo "$TEST_OUT" | grep -B2 "FAIL\|AssertionError\|Error:" | head -30 || echo "none"
72
+ } > "$ERR_FILE" 2>&1
73
+
74
+ ERR_COUNT=$(grep -c "error\|fail\|FAIL" "$ERR_FILE" 2>/dev/null || echo "0")
75
+ echo " Error file: $ERR_FILE ($ERR_COUNT lines with errors)"
76
+
77
+ # 3. Run Codex CLI
78
+ echo ""
79
+ echo "[2/4] Launching Codex CLI (model=$MODEL)..."
80
+
81
+ PROMPT="You are working on the remem-mcp codebase (a local MCP memory server at $REPO_DIR).
82
+
83
+ Current state:
84
+ - TypeScript errors: $TS_ERRS
85
+ - Test failures: $TEST_FAILS (out of $TEST_PASSES passed)
86
+
87
+ Error details from this iteration:
88
+ $(cat "$ERR_FILE")
89
+
90
+ Your tasks:
91
+ 1. Use the remem-mcp MCP tools (recall, search) to check if we've seen these errors before and how we fixed them.
92
+ 2. Fix the TypeScript errors and test failures shown above.
93
+ 3. After fixing, run \`npm run build\` and \`npx vitest run\` to verify.
94
+ 4. Use the remem-mcp capture tool to store what you fixed and how, so future sessions can recall it.
95
+ 5. If everything passes, look for edge cases or potential bugs in the codebase and fix them.
96
+
97
+ Focus on real fixes, not workarounds. Check src/ for the relevant code."
98
+
99
+ codex exec \
100
+ --model "$MODEL" \
101
+ --sandbox workspace-write \
102
+ --dangerously-bypass-approvals-and-sandbox \
103
+ "$PROMPT" \
104
+ 2>&1 | tee "$TMP_DIR/codex-output-iter-$ITER.log" || true
105
+
106
+ echo ""
107
+ echo "[3/4] Codex CLI finished. Output saved to $TMP_DIR/codex-output-iter-$ITER.log"
108
+
109
+ # 4. Re-check state after Codex's fixes
110
+ echo ""
111
+ echo "[4/4] Post-fix state:"
112
+ TS_ERRS_AFTER=$(npx tsc --noEmit 2>&1 | grep -c "error TS" | tr -d '[:space:]' || echo "0")
113
+ TEST_OUT_AFTER=$(npx vitest run 2>&1 || true)
114
+ TEST_FAILS_AFTER=$(echo "$TEST_OUT_AFTER" | grep -oE "[0-9]+ failed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
115
+ TEST_PASSES_AFTER=$(echo "$TEST_OUT_AFTER" | grep -oE "[0-9]+ passed" | head -1 | grep -oE "[0-9]+" | tr -d '[:space:]' || echo "0")
116
+ [ -z "$TS_ERRS_AFTER" ] && TS_ERRS_AFTER=0
117
+ [ -z "$TEST_FAILS_AFTER" ] && TEST_FAILS_AFTER=0
118
+ [ -z "$TEST_PASSES_AFTER" ] && TEST_PASSES_AFTER=0
119
+
120
+ echo " TS errors: $TS_ERRS → $TS_ERRS_AFTER"
121
+ echo " Test failures: $TEST_FAILS → $TEST_FAILS_AFTER"
122
+ echo " Tests passed: $TEST_PASSES → $TEST_PASSES_AFTER"
123
+
124
+ # Summary
125
+ echo ""
126
+ echo "┌──────────────────────────────────┐"
127
+ echo "│ Iteration $ITER summary:"
128
+ echo "│ TS errors: $TS_ERRS → $TS_ERRS_AFTER"
129
+ echo "│ Test fails: $TEST_FAILS → $TEST_FAILS_AFTER"
130
+ echo "│ Tests passed: $TEST_PASSES → $TEST_PASSES_AFTER"
131
+ echo "└──────────────────────────────────┘"
132
+
133
+ if [ "$TS_ERRS_AFTER" -eq 0 ] && [ "$TEST_FAILS_AFTER" -eq 0 ]; then
134
+ echo ""
135
+ echo "★★★ ALL GREEN — 0 TS errors, 0 test failures ★★★"
136
+ echo "Codex CLI + remem-mcp dogfood iteration $ITER succeeded."
137
+ break
138
+ fi
139
+ done
140
+
141
+ echo ""
142
+ echo "══════════════════════════════════════════════════════════════"
143
+ echo " DOGFOOD COMPLETE — $ITER iteration(s)"
144
+ echo " Logs: $TMP_DIR/"
145
+ echo "══════════════════════════════════════════════════════════════"