@adverant/nexus-memory-skill 2.3.1 → 2.3.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/hooks/auto-recall.sh +15 -2
- package/hooks/recall-memory.sh +18 -6
- package/hooks/store-memory.sh +23 -12
- package/package.json +1 -1
package/hooks/auto-recall.sh
CHANGED
|
@@ -162,8 +162,14 @@ BODY=$(echo "$RESPONSE" | sed '$d')
|
|
|
162
162
|
|
|
163
163
|
# Check for errors (silently fail - don't block conversation)
|
|
164
164
|
if [[ "$HTTP_CODE" != "200" ]]; then
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
if [[ "$VERBOSE" == "1" ]]; then
|
|
166
|
+
echo "⚠️ Auto-recall failed (HTTP $HTTP_CODE), continuing without context" >&2
|
|
167
|
+
|
|
168
|
+
if [[ "$HTTP_CODE" == "401" ]]; then
|
|
169
|
+
echo " Authentication failed - check NEXUS_API_KEY" >&2
|
|
170
|
+
fi
|
|
171
|
+
fi
|
|
172
|
+
exit 0 # Don't block conversation on recall failure
|
|
167
173
|
fi
|
|
168
174
|
|
|
169
175
|
# Validate JSON response
|
|
@@ -186,6 +192,13 @@ ENTITY_COUNT=$(echo "$ENTITIES" | jq 'length' 2>/dev/null || echo "0")
|
|
|
186
192
|
FACT_COUNT=$(echo "$FACTS" | jq 'length' 2>/dev/null || echo "0")
|
|
187
193
|
EPISODIC_COUNT=$(echo "$EPISODIC" | jq 'length' 2>/dev/null || echo "0")
|
|
188
194
|
|
|
195
|
+
# Log success in verbose mode
|
|
196
|
+
if [[ "$VERBOSE" == "1" ]]; then
|
|
197
|
+
if [[ "$MEMORY_COUNT" != "0" ]] || [[ "$ENTITY_COUNT" != "0" ]]; then
|
|
198
|
+
echo "✅ Auto-recall: $MEMORY_COUNT memories, $ENTITY_COUNT entities injected" >&2
|
|
199
|
+
fi
|
|
200
|
+
fi
|
|
201
|
+
|
|
189
202
|
log "Found $MEMORY_COUNT memories, $ENTITY_COUNT entities, $FACT_COUNT facts, $EPISODIC_COUNT episodic"
|
|
190
203
|
|
|
191
204
|
# Skip if nothing to show
|
package/hooks/recall-memory.sh
CHANGED
|
@@ -255,12 +255,22 @@ log "Response code: $HTTP_CODE"
|
|
|
255
255
|
|
|
256
256
|
# Handle API errors
|
|
257
257
|
if [[ "$HTTP_CODE" != "200" ]]; then
|
|
258
|
-
log_error "Failed to recall memories (HTTP $HTTP_CODE)"
|
|
259
258
|
if [[ "$VERBOSE" == "1" ]]; then
|
|
260
|
-
|
|
259
|
+
echo "❌ Recall failed (HTTP $HTTP_CODE)" >&2
|
|
260
|
+
|
|
261
|
+
ERROR_MSG=$(echo "$BODY" | jq -r '.error.message // .message // ""' 2>/dev/null)
|
|
262
|
+
if [[ -n "$ERROR_MSG" ]]; then
|
|
263
|
+
echo " Error: $ERROR_MSG" >&2
|
|
264
|
+
fi
|
|
265
|
+
|
|
266
|
+
if [[ "$HTTP_CODE" == "401" ]]; then
|
|
267
|
+
echo " Check: NEXUS_API_KEY environment variable" >&2
|
|
268
|
+
fi
|
|
261
269
|
fi
|
|
270
|
+
|
|
271
|
+
# Return empty response so Claude doesn't get errors
|
|
262
272
|
echo "$EMPTY_RESPONSE"
|
|
263
|
-
exit
|
|
273
|
+
exit 1 # Non-blocking error for logging
|
|
264
274
|
fi
|
|
265
275
|
|
|
266
276
|
# Validate JSON response
|
|
@@ -317,10 +327,12 @@ fi
|
|
|
317
327
|
# Output verbose info if enabled
|
|
318
328
|
if [[ "$VERBOSE" == "1" ]]; then
|
|
319
329
|
MEMORY_COUNT=$(echo "$NORMALIZED" | jq '.memories | length')
|
|
320
|
-
ENTITY_COUNT=$(echo "$NORMALIZED" | jq '.entities | length')
|
|
321
|
-
FACT_COUNT=$(echo "$NORMALIZED" | jq '.facts | length')
|
|
322
330
|
|
|
323
|
-
|
|
331
|
+
if [[ "$MEMORY_COUNT" == "0" ]]; then
|
|
332
|
+
echo "⚠️ No memories found for query" >&2
|
|
333
|
+
else
|
|
334
|
+
echo "✅ Retrieved $MEMORY_COUNT memories" >&2
|
|
335
|
+
fi
|
|
324
336
|
fi
|
|
325
337
|
|
|
326
338
|
echo "$NORMALIZED"
|
package/hooks/store-memory.sh
CHANGED
|
@@ -348,7 +348,9 @@ log "Storing memory to unified endpoint: $NEXUS_API_URL/api/memory"
|
|
|
348
348
|
# Headers: X-Company-ID, X-App-ID, X-User-ID (required for tenant context)
|
|
349
349
|
# Run async (background) with timeout
|
|
350
350
|
if [[ "$VERBOSE" == "1" ]]; then
|
|
351
|
-
#
|
|
351
|
+
# VERBOSE MODE: Synchronous with detailed output
|
|
352
|
+
log "Storing memory (sync mode)..."
|
|
353
|
+
|
|
352
354
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$NEXUS_API_URL/api/memory" \
|
|
353
355
|
-H "Content-Type: application/json" \
|
|
354
356
|
-H "Authorization: Bearer $NEXUS_API_KEY" \
|
|
@@ -356,29 +358,38 @@ if [[ "$VERBOSE" == "1" ]]; then
|
|
|
356
358
|
-H "X-App-ID: $APP_ID" \
|
|
357
359
|
-H "X-User-ID: ${USER:-unknown}" \
|
|
358
360
|
-d "$PAYLOAD" \
|
|
359
|
-
--max-time
|
|
361
|
+
--max-time 10 2>&1)
|
|
360
362
|
|
|
361
363
|
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
|
362
364
|
BODY=$(echo "$RESPONSE" | sed '$d')
|
|
363
365
|
|
|
364
|
-
log "Response code: $HTTP_CODE"
|
|
365
|
-
log "Response body: $BODY"
|
|
366
|
-
|
|
367
366
|
if [[ "$HTTP_CODE" == "200" ]] || [[ "$HTTP_CODE" == "201" ]]; then
|
|
368
|
-
# Extract and save memory ID for causal chaining
|
|
369
367
|
MEMORY_ID=$(echo "$BODY" | jq -r '.memoryId // .data.memoryId // empty' 2>/dev/null)
|
|
368
|
+
|
|
370
369
|
if [[ -n "$MEMORY_ID" ]]; then
|
|
370
|
+
echo "✅ Memory stored: $MEMORY_ID" >&2
|
|
371
371
|
save_memory_id "$MEMORY_ID"
|
|
372
|
-
|
|
372
|
+
else
|
|
373
|
+
echo "⚠️ Memory stored but no ID returned" >&2
|
|
373
374
|
fi
|
|
374
375
|
|
|
375
|
-
#
|
|
376
|
-
|
|
377
|
-
if [[ -n "$
|
|
378
|
-
|
|
376
|
+
# Show triage decision if available
|
|
377
|
+
TRIAGE=$(echo "$BODY" | jq -r '.triageDecision.contentType // ""' 2>/dev/null)
|
|
378
|
+
if [[ -n "$TRIAGE" ]] && [[ "$TRIAGE" != "null" ]]; then
|
|
379
|
+
echo " Content type: $TRIAGE" >&2
|
|
379
380
|
fi
|
|
381
|
+
|
|
382
|
+
elif [[ "$HTTP_CODE" == "401" ]]; then
|
|
383
|
+
echo "❌ Authentication failed - check NEXUS_API_KEY" >&2
|
|
384
|
+
exit 1 # Non-blocking error
|
|
385
|
+
|
|
380
386
|
else
|
|
381
|
-
|
|
387
|
+
echo "❌ Storage failed (HTTP $HTTP_CODE)" >&2
|
|
388
|
+
ERROR_MSG=$(echo "$BODY" | jq -r '.error.message // .message // ""' 2>/dev/null)
|
|
389
|
+
if [[ -n "$ERROR_MSG" ]]; then
|
|
390
|
+
echo " Error: $ERROR_MSG" >&2
|
|
391
|
+
fi
|
|
392
|
+
exit 1 # Non-blocking error
|
|
382
393
|
fi
|
|
383
394
|
else
|
|
384
395
|
# Async mode with memory ID tracking for normal operation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adverant/nexus-memory-skill",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Claude Code skill for persistent memory via Nexus GraphRAG - store and recall memories across all sessions and projects",
|
|
5
5
|
"main": "SKILL.md",
|
|
6
6
|
"type": "module",
|