claude-recall 0.28.1 → 0.28.2
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/README.md +4 -0
- package/dist/hooks/kiro-hooks.js +26 -10
- package/dist/hooks/shared.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,10 @@ claude-recall kiro setup --merge-into <agent-name>
|
|
|
105
105
|
|
|
106
106
|
This finds the agent config (workspace `.kiro/agents/` first, then `~/.kiro/agents/`; `--global` to target the global one directly), writes a timestamped backup, and appends the claude-recall pieces — MCP server, pre-approved read-only tools, and the four hooks — without touching anything the agent already had. Idempotent: re-running changes nothing. If the agent restricts tools with an explicit list, `@claude-recall` is added to it.
|
|
107
107
|
|
|
108
|
+
> **⚠️ Restart Kiro after `kiro setup` or `--merge-into`.** Hooks bind when an agent *activates* — a Kiro session that was already running keeps its old wiring and will behave as if it has no memory. Exit Kiro and start it again (or `/agent swap` away and back). Verify hooks are firing with `tail ~/.claude-recall/hook-logs/kiro.log`.
|
|
109
|
+
|
|
110
|
+
> **Tip:** export `ANTHROPIC_API_KEY` in the shell you launch Kiro from. Hooks then use Claude Haiku to classify what's worth remembering; without it a conservative regex fallback runs, which catches explicit phrasings ("remember ...", "always ...", "never ...", "I prefer ...") but misses subtler ones.
|
|
111
|
+
|
|
108
112
|
**Option B — MCP tools only (no hooks, works in Kiro's default agent).**
|
|
109
113
|
|
|
110
114
|
If you don't want a custom agent, register just the MCP server in Kiro's config instead. Create or merge into `.kiro/settings/mcp.json` (project) or `~/.kiro/settings/mcp.json` (all projects):
|
package/dist/hooks/kiro-hooks.js
CHANGED
|
@@ -90,17 +90,37 @@ function formatRulesForContext() {
|
|
|
90
90
|
+ rules.failures.length + rules.devops.length;
|
|
91
91
|
return { body: sections.join('\n\n'), total };
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Standing instruction so the agent KNOWS it has persistent memory. Without
|
|
95
|
+
* this, a session with no stored rules yet answers "I have no memory between
|
|
96
|
+
* conversations" and never calls store_memory when the user says
|
|
97
|
+
* "remember ..." — the exact failure observed on first use.
|
|
98
|
+
*/
|
|
99
|
+
const KIRO_MEMORY_DIRECTIVE = 'You have PERSISTENT MEMORY across sessions via Claude Recall (MCP server "claude-recall": ' +
|
|
100
|
+
'load_rules, store_memory, search_memory, delete_memory, save_checkpoint, load_checkpoint). ' +
|
|
101
|
+
'When the user says "remember ...", "store this", "recall ...", states a preference, or corrects you, ' +
|
|
102
|
+
'call store_memory (tell them what you will store). Use search_memory before decisions when past ' +
|
|
103
|
+
'context might apply. Memories are scoped per project and shared with the user\'s other coding agents.';
|
|
93
104
|
/**
|
|
94
105
|
* agentSpawn — runs once when a Kiro agent activates. Whatever we print is
|
|
95
106
|
* added to the agent's context, so this IS the load_rules call: rules are in
|
|
96
|
-
* context from turn one without any tool call or enforcement.
|
|
107
|
+
* context from turn one without any tool call or enforcement. The memory
|
|
108
|
+
* directive is always emitted, even with an empty database — capability
|
|
109
|
+
* awareness must not depend on having memories already.
|
|
97
110
|
*/
|
|
98
111
|
async function handleKiroAgentSpawn(_input) {
|
|
99
112
|
try {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
const parts = [KIRO_MEMORY_DIRECTIVE];
|
|
114
|
+
let total = 0;
|
|
115
|
+
try {
|
|
116
|
+
const rules = formatRulesForContext();
|
|
117
|
+
total = rules.total;
|
|
118
|
+
if (rules.body) {
|
|
119
|
+
parts.push(directives_1.LOAD_RULES_DIRECTIVE, '---', rules.body);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
(0, shared_1.hookLog)(HOOK_NAME, `agentSpawn rule load failed (directive still emitted): ${(0, shared_1.safeErrorMessage)(err)}`);
|
|
104
124
|
}
|
|
105
125
|
// Surface a pending task checkpoint the same way load_rules hints at one
|
|
106
126
|
try {
|
|
@@ -112,12 +132,8 @@ async function handleKiroAgentSpawn(_input) {
|
|
|
112
132
|
}
|
|
113
133
|
}
|
|
114
134
|
catch { /* checkpoint hint is best-effort */ }
|
|
115
|
-
if (parts.length === 0) {
|
|
116
|
-
(0, shared_1.hookLog)(HOOK_NAME, 'agentSpawn: no active rules or checkpoint — nothing injected');
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
135
|
process.stdout.write(parts.join('\n\n') + '\n');
|
|
120
|
-
(0, shared_1.hookLog)(HOOK_NAME, `agentSpawn: injected ${total} rule(s) into Kiro context`);
|
|
136
|
+
(0, shared_1.hookLog)(HOOK_NAME, `agentSpawn: injected memory directive + ${total} rule(s) into Kiro context`);
|
|
121
137
|
}
|
|
122
138
|
catch (err) {
|
|
123
139
|
// Never block agent startup
|
package/dist/hooks/shared.js
CHANGED
|
@@ -73,7 +73,11 @@ const CORRECTION_PATTERNS = [
|
|
|
73
73
|
{ regex: /\bstop\s+(doing|using|adding)\s+(.+)/i, confidence: 0.75 },
|
|
74
74
|
];
|
|
75
75
|
const PREFERENCE_PATTERNS = [
|
|
76
|
-
|
|
76
|
+
// "remember ..." is an explicit store request in any phrasing — "remember
|
|
77
|
+
// that X", "remember to X", but also "remember my favourite color is green".
|
|
78
|
+
// The interrogative/question-mark guards below keep "do you remember that
|
|
79
|
+
// config file?" out.
|
|
80
|
+
{ regex: /\bremember\s+(?:that\s+|this\s+|to\s+)?(.+)/i, confidence: 0.8 },
|
|
77
81
|
{ regex: /\bfrom\s+now\s+on[,.]?\s+(.+)/i, confidence: 0.8 },
|
|
78
82
|
{ regex: /\bgoing\s+forward[,.]?\s+(.+)/i, confidence: 0.8 },
|
|
79
83
|
{ regex: /\balways\s+(.+)/i, confidence: 0.75 },
|
package/package.json
CHANGED