@adverant/nexus-memory-skill 2.3.1 → 2.3.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.
@@ -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
- log "Failed to recall memories (HTTP $HTTP_CODE), continuing without context"
166
- exit 0
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
@@ -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
- log "Response: ${BODY:0:500}"
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 0
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
- log "Retrieved: $MEMORY_COUNT memories, $ENTITY_COUNT entities, $FACT_COUNT facts"
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"
@@ -268,15 +268,12 @@ if [[ -z "$CONTENT" ]] || [[ "$CONTENT" == "null" ]]; then
268
268
  exit 0
269
269
  fi
270
270
 
271
- # Classify content to determine storage value
271
+ # Content quality check moved to API level
272
+ # Hook no longer filters content locally - API will return HTTP 400 if rejected
273
+ # This ensures users see the helpful error message from the API
274
+ # Still classify for bead detection and metadata tagging
272
275
  CONTENT_CLASS=$(classify_content "$CONTENT" "$EVENT_TYPE")
273
- log "Content classification: $CONTENT_CLASS"
274
-
275
- # Skip low-value content (routine commands, noise)
276
- if [[ "$CONTENT_CLASS" == "routine" ]] || [[ "$CONTENT_CLASS" == "noise" ]]; then
277
- log "Skipping $CONTENT_CLASS content (low value)"
278
- exit 0
279
- fi
276
+ log "Content classification: $CONTENT_CLASS (advisory only, not filtering)"
280
277
 
281
278
  # Truncate very long content (max 10000 chars)
282
279
  if [[ ${#CONTENT} -gt 10000 ]]; then
@@ -348,7 +345,9 @@ log "Storing memory to unified endpoint: $NEXUS_API_URL/api/memory"
348
345
  # Headers: X-Company-ID, X-App-ID, X-User-ID (required for tenant context)
349
346
  # Run async (background) with timeout
350
347
  if [[ "$VERBOSE" == "1" ]]; then
351
- # Sync mode with output for debugging
348
+ # VERBOSE MODE: Synchronous with detailed output
349
+ log "Storing memory (sync mode)..."
350
+
352
351
  RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$NEXUS_API_URL/api/memory" \
353
352
  -H "Content-Type: application/json" \
354
353
  -H "Authorization: Bearer $NEXUS_API_KEY" \
@@ -356,29 +355,56 @@ if [[ "$VERBOSE" == "1" ]]; then
356
355
  -H "X-App-ID: $APP_ID" \
357
356
  -H "X-User-ID: ${USER:-unknown}" \
358
357
  -d "$PAYLOAD" \
359
- --max-time 5 2>&1)
358
+ --max-time 10 2>&1)
360
359
 
361
360
  HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
362
361
  BODY=$(echo "$RESPONSE" | sed '$d')
363
362
 
364
- log "Response code: $HTTP_CODE"
365
- log "Response body: $BODY"
366
-
367
363
  if [[ "$HTTP_CODE" == "200" ]] || [[ "$HTTP_CODE" == "201" ]]; then
368
- # Extract and save memory ID for causal chaining
369
364
  MEMORY_ID=$(echo "$BODY" | jq -r '.memoryId // .data.memoryId // empty' 2>/dev/null)
365
+
370
366
  if [[ -n "$MEMORY_ID" ]]; then
367
+ echo "✅ Memory stored: $MEMORY_ID" >&2
371
368
  save_memory_id "$MEMORY_ID"
372
- log "Saved memory ID for causal chain: $MEMORY_ID"
369
+ else
370
+ echo "⚠️ Memory stored but no ID returned" >&2
373
371
  fi
374
372
 
375
- # Log entity extraction results if available
376
- ENTITIES=$(echo "$BODY" | jq -r '.entities // .data.entities_extracted // empty' 2>/dev/null)
377
- if [[ -n "$ENTITIES" ]] && [[ "$ENTITIES" != "null" ]]; then
378
- log "Entities extracted: $ENTITIES"
373
+ # Show triage decision if available
374
+ TRIAGE=$(echo "$BODY" | jq -r '.triageDecision.contentType // ""' 2>/dev/null)
375
+ if [[ -n "$TRIAGE" ]] && [[ "$TRIAGE" != "null" ]]; then
376
+ echo " Content type: $TRIAGE" >&2
379
377
  fi
378
+
379
+ elif [[ "$HTTP_CODE" == "400" ]]; then
380
+ # QUALITY FILTER REJECTION - show API's error message
381
+ echo "❌ Storage rejected (HTTP 400)" >&2
382
+ ERROR_MSG=$(echo "$BODY" | jq -r '.error.message // .message // ""' 2>/dev/null)
383
+ REASON=$(echo "$BODY" | jq -r '.error.reason // ""' 2>/dev/null)
384
+
385
+ if [[ -n "$ERROR_MSG" ]]; then
386
+ echo " Error: $ERROR_MSG" >&2
387
+ fi
388
+ if [[ -n "$REASON" ]] && [[ "$REASON" != "null" ]]; then
389
+ echo " Reason: $REASON" >&2
390
+ fi
391
+ exit 1 # Non-blocking error
392
+
393
+ elif [[ "$HTTP_CODE" == "401" ]]; then
394
+ # AUTHENTICATION FAILURE - clear actionable message
395
+ echo "❌ Authentication failed (HTTP 401)" >&2
396
+ echo " Check NEXUS_API_KEY environment variable" >&2
397
+ echo " Current key prefix: ${NEXUS_API_KEY:0:10}..." >&2
398
+ exit 1 # Non-blocking error
399
+
380
400
  else
381
- log_error "Failed to store memory (HTTP $HTTP_CODE)"
401
+ # OTHER ERROR - show details
402
+ echo "❌ Storage failed (HTTP $HTTP_CODE)" >&2
403
+ ERROR_MSG=$(echo "$BODY" | jq -r '.error.message // .message // ""' 2>/dev/null)
404
+ if [[ -n "$ERROR_MSG" ]]; then
405
+ echo " Error: $ERROR_MSG" >&2
406
+ fi
407
+ exit 1 # Non-blocking error
382
408
  fi
383
409
  else
384
410
  # 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.1",
3
+ "version": "2.3.3",
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",