claude-recall 0.8.6 ā 0.8.8
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.
|
@@ -47,8 +47,8 @@ def should_require_search(tool_name: str, tool_input: Dict[str, Any]) -> bool:
|
|
|
47
47
|
def check_recent_search(session_id: str) -> bool:
|
|
48
48
|
"""Check if memory search was performed recently in this session."""
|
|
49
49
|
if not session_id:
|
|
50
|
-
# No session ID
|
|
51
|
-
return
|
|
50
|
+
# No session ID - strict mode: block execution
|
|
51
|
+
return False
|
|
52
52
|
|
|
53
53
|
try:
|
|
54
54
|
# Call claude-recall CLI to check recent tool usage
|
|
@@ -60,15 +60,15 @@ def check_recent_search(session_id: str) -> bool:
|
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
if result.returncode != 0:
|
|
63
|
-
# Command failed
|
|
64
|
-
return
|
|
63
|
+
# Command failed - strict mode: block execution
|
|
64
|
+
return False
|
|
65
65
|
|
|
66
66
|
# Check if mcp__claude-recall__search was called recently
|
|
67
67
|
return 'mcp__claude-recall__search' in result.stdout
|
|
68
68
|
|
|
69
69
|
except (subprocess.TimeoutExpired, FileNotFoundError, Exception):
|
|
70
|
-
#
|
|
71
|
-
return
|
|
70
|
+
# Check failed - strict mode: block execution
|
|
71
|
+
return False
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
def generate_search_query(tool_name: str, tool_input: Dict[str, Any]) -> str:
|
package/.claude/settings.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-recall",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "Persistent memory for Claude Code with fire-and-forget PubNub architecture, automatic capture, failure learning, and project scoping via MCP server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
package/scripts/postinstall.js
CHANGED
|
@@ -6,50 +6,39 @@ const os = require('os');
|
|
|
6
6
|
|
|
7
7
|
console.log('\nš Setting up Claude Recall...\n');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
// Configure MCP server in ~/.claude.json
|
|
11
|
-
const claudeConfigPath = path.join(os.homedir(), '.claude.json');
|
|
12
|
-
|
|
13
|
-
// Read or create claude config
|
|
14
|
-
let config = { mcpServers: {} };
|
|
15
|
-
if (fs.existsSync(claudeConfigPath)) {
|
|
16
|
-
const configContent = fs.readFileSync(claudeConfigPath, 'utf8');
|
|
17
|
-
config = JSON.parse(configContent);
|
|
18
|
-
if (!config.mcpServers) {
|
|
19
|
-
config.mcpServers = {};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Check if claude-recall is already configured
|
|
24
|
-
if (config.mcpServers['claude-recall']) {
|
|
25
|
-
console.log('ā ļø Claude Recall is already configured in ~/.claude.json');
|
|
26
|
-
console.log(' Updating configuration...');
|
|
27
|
-
}
|
|
9
|
+
const { execSync } = require('child_process');
|
|
28
10
|
|
|
11
|
+
try {
|
|
29
12
|
// Set up database location in user's home directory
|
|
30
13
|
const dbDir = path.join(os.homedir(), '.claude-recall');
|
|
31
|
-
|
|
14
|
+
|
|
32
15
|
// Create directory if it doesn't exist
|
|
33
16
|
if (!fs.existsSync(dbDir)) {
|
|
34
17
|
fs.mkdirSync(dbDir, { recursive: true });
|
|
35
18
|
console.log(`š Created database directory: ${dbDir}`);
|
|
36
19
|
}
|
|
37
20
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Write back the config with proper formatting
|
|
47
|
-
fs.writeFileSync(claudeConfigPath, JSON.stringify(config, null, 2));
|
|
21
|
+
// Register MCP server using official Claude CLI
|
|
22
|
+
try {
|
|
23
|
+
// Remove existing registration first (in case of update)
|
|
24
|
+
try {
|
|
25
|
+
execSync('claude mcp remove claude-recall', { stdio: 'ignore' });
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// Ignore if not registered
|
|
28
|
+
}
|
|
48
29
|
|
|
49
|
-
|
|
30
|
+
// Register using official CLI
|
|
31
|
+
execSync('claude mcp add claude-recall -- npx claude-recall mcp start', {
|
|
32
|
+
stdio: 'inherit'
|
|
33
|
+
});
|
|
34
|
+
console.log('ā
Registered Claude Recall MCP server');
|
|
35
|
+
} catch (mcpError) {
|
|
36
|
+
console.log('ā ļø Could not auto-register MCP server.');
|
|
37
|
+
console.log(' Please run manually:');
|
|
38
|
+
console.log(' claude mcp add claude-recall -- npx claude-recall mcp start');
|
|
39
|
+
}
|
|
50
40
|
|
|
51
41
|
// Update project CLAUDE.md with minimal instructions
|
|
52
|
-
const { execSync } = require('child_process');
|
|
53
42
|
try {
|
|
54
43
|
execSync('node ' + path.join(__dirname, 'postinstall-claude-md.js'), { stdio: 'inherit' });
|
|
55
44
|
} catch (error) {
|
|
@@ -121,6 +110,7 @@ try {
|
|
|
121
110
|
// Copy hook scripts from package
|
|
122
111
|
const packageHooksDir = path.join(__dirname, '../.claude/hooks');
|
|
123
112
|
const hookScripts = [
|
|
113
|
+
'pre_tool_search_enforcer.py',
|
|
124
114
|
'pubnub_pre_tool_hook.py',
|
|
125
115
|
'pubnub_prompt_hook.py'
|
|
126
116
|
];
|
|
@@ -152,8 +142,12 @@ try {
|
|
|
152
142
|
settings.hooks = {
|
|
153
143
|
PreToolUse: [
|
|
154
144
|
{
|
|
155
|
-
matcher: "Write|Edit
|
|
145
|
+
matcher: "Write|Edit",
|
|
156
146
|
hooks: [
|
|
147
|
+
{
|
|
148
|
+
type: "command",
|
|
149
|
+
command: "python3 .claude/hooks/pre_tool_search_enforcer.py"
|
|
150
|
+
},
|
|
157
151
|
{
|
|
158
152
|
type: "command",
|
|
159
153
|
command: "python3 .claude/hooks/pubnub_pre_tool_hook.py"
|
|
@@ -174,9 +168,9 @@ try {
|
|
|
174
168
|
};
|
|
175
169
|
|
|
176
170
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
177
|
-
console.log('ā
Configured
|
|
178
|
-
console.log(' ā PreToolUse:
|
|
179
|
-
console.log(' ā UserPromptSubmit:
|
|
171
|
+
console.log('ā
Configured hooks in .claude/settings.json');
|
|
172
|
+
console.log(' ā PreToolUse: Enforces memory search before Write/Edit');
|
|
173
|
+
console.log(' ā UserPromptSubmit: Captures prompts for preference extraction');
|
|
180
174
|
}
|
|
181
175
|
}
|
|
182
176
|
} catch (error) {
|