@adverant/nexus-memory-skill 1.3.0 → 2.1.0
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 +9 -2
- package/SKILL.md +152 -0
- package/hooks/auto-recall.sh +66 -5
- package/hooks/bead-sync.sh +596 -0
- package/hooks/episode-summary.sh +194 -176
- package/hooks/recall-memory.sh +106 -53
- package/hooks/store-memory.sh +105 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -233,10 +233,17 @@ Once installed, Nexus Memory works **automatically** with no manual intervention
|
|
|
233
233
|
| **A significant tool is used** | Tool inputs/outputs are captured (routine tools skipped) | `episode-summary.sh` |
|
|
234
234
|
| **Every 10 tool uses** | Conversation segment is summarized as an "episode" with relationships | `episode-summary.sh` |
|
|
235
235
|
|
|
236
|
-
###
|
|
236
|
+
### v2.0.0 Enhanced Memory Intelligence
|
|
237
|
+
|
|
238
|
+
Major improvements in v2.0.0:
|
|
239
|
+
- **Content Classification** — Automatically filters noise (routine commands, short content)
|
|
240
|
+
- **Entity Extraction** — Fixed bug where entities were filtered out in API responses
|
|
241
|
+
- **Facts Retrieval** — Facts are now properly queried from Neo4j knowledge graph
|
|
242
|
+
- **Token Budget Management** — Intelligent truncation to stay within context limits
|
|
243
|
+
- **Causal Chains** — Episode summaries link to previous episodes for temporal reasoning
|
|
237
244
|
|
|
238
245
|
The auto-recall now provides rich context including:
|
|
239
|
-
- **Relevant Memories** — Past fixes, decisions, and learnings
|
|
246
|
+
- **Relevant Memories** — Past fixes, decisions, and learnings (filtered for quality)
|
|
240
247
|
- **Entities Mentioned** — Knowledge graph nodes (files, functions, patterns)
|
|
241
248
|
- **Key Facts** — Extracted facts from your coding history
|
|
242
249
|
- **Recent Session Context** — Episodic memory from recent sessions
|
package/SKILL.md
CHANGED
|
@@ -528,3 +528,155 @@ Your API key may be invalid or expired.
|
|
|
528
528
|
If you see "Endpoint not found" errors, the hooks may be using outdated endpoints. Update to:
|
|
529
529
|
- Store: `/api/memory/store`
|
|
530
530
|
- Recall: `/api/memory/recall`
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Beads: Git-Backed Issue Tracking
|
|
535
|
+
|
|
536
|
+
> **Attribution**: Beads (bd) is created by [Steve Yegge](https://github.com/steveyegge).
|
|
537
|
+
> Repository: https://github.com/steveyegge/beads
|
|
538
|
+
> License: See the beads repository for license terms.
|
|
539
|
+
>
|
|
540
|
+
> This integration extends beads with GraphRAG sync capabilities for cross-device memory.
|
|
541
|
+
|
|
542
|
+
Beads (bd) integrates issue/task tracking with your memory system. Beads are stored both locally in git (`.beads/beads.jsonl`) and synced to GraphRAG as searchable memories. This enables:
|
|
543
|
+
|
|
544
|
+
- **Local git versioning** of issues (distributed, offline-capable)
|
|
545
|
+
- **Semantic search** across all issues via GraphRAG
|
|
546
|
+
- **Cross-device sync** through bidirectional GraphRAG sync
|
|
547
|
+
- **Dependency tracking** (blocks, relates, discovered-from)
|
|
548
|
+
- **Ready-work queries** (what tasks have no blockers?)
|
|
549
|
+
|
|
550
|
+
### First-Time Setup
|
|
551
|
+
|
|
552
|
+
The `bd` binary auto-installs on first use:
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
# Install bd binary (or let it auto-install)
|
|
556
|
+
~/.claude/hooks/bead-sync.sh install
|
|
557
|
+
|
|
558
|
+
# Initialize beads in your repository
|
|
559
|
+
bd init
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Core Commands
|
|
563
|
+
|
|
564
|
+
| Command | Description |
|
|
565
|
+
|---------|-------------|
|
|
566
|
+
| `bd list` | List all open beads |
|
|
567
|
+
| `bd ready` | Show beads with no blockers (ready to work) |
|
|
568
|
+
| `bd create "title" -p P1` | Create new bead with priority |
|
|
569
|
+
| `bd work <id>` | Mark bead as in-progress |
|
|
570
|
+
| `bd close <id>` | Mark bead as complete |
|
|
571
|
+
| `bd dep add <a> blocks <b>` | Create dependency (A blocks B) |
|
|
572
|
+
| `bd show <id>` | Show bead details |
|
|
573
|
+
| `bd graph` | Visualize dependency graph |
|
|
574
|
+
|
|
575
|
+
### Sync Commands
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Full bidirectional sync (push local + pull remote)
|
|
579
|
+
~/.claude/hooks/bead-sync.sh sync
|
|
580
|
+
|
|
581
|
+
# Push local beads to GraphRAG only
|
|
582
|
+
~/.claude/hooks/bead-sync.sh push
|
|
583
|
+
|
|
584
|
+
# Pull beads from GraphRAG (cross-device sync)
|
|
585
|
+
~/.claude/hooks/bead-sync.sh pull
|
|
586
|
+
|
|
587
|
+
# Search beads in GraphRAG
|
|
588
|
+
~/.claude/hooks/bead-sync.sh query "authentication bug"
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### How Beads Become Memories
|
|
592
|
+
|
|
593
|
+
Beads are automatically synced to GraphRAG with:
|
|
594
|
+
- `event_type: "bead"`
|
|
595
|
+
- `metadata.bead_id: "bd-xxxx"`
|
|
596
|
+
- `tags: ["bead", "status:open", "priority:P1", "project:my-project"]`
|
|
597
|
+
|
|
598
|
+
This integration enables:
|
|
599
|
+
- **Auto-recall** surfaces relevant beads when discussing tasks
|
|
600
|
+
- **Semantic search** finds beads by meaning, not just ID
|
|
601
|
+
- **Causal chains** link beads to related code changes
|
|
602
|
+
- **Cross-project** search works across all repositories
|
|
603
|
+
|
|
604
|
+
### Typical Workflow
|
|
605
|
+
|
|
606
|
+
1. **See what's ready**: `bd ready`
|
|
607
|
+
2. **Claim a task**: `bd work bd-a1b2`
|
|
608
|
+
3. **Do the work**: (make code changes)
|
|
609
|
+
4. **Complete**: `bd close bd-a1b2`
|
|
610
|
+
5. **Sync to memory**: `~/.claude/hooks/bead-sync.sh sync`
|
|
611
|
+
|
|
612
|
+
### Dependencies
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
# A blocks B (B can't start until A is done)
|
|
616
|
+
bd dep add bd-a1b2 blocks bd-c3d4
|
|
617
|
+
|
|
618
|
+
# A relates to B (informational link)
|
|
619
|
+
bd dep add bd-a1b2 relates bd-c3d4
|
|
620
|
+
|
|
621
|
+
# Discover new issue from existing work
|
|
622
|
+
bd create "Found bug while fixing auth" --discovered-from bd-a1b2
|
|
623
|
+
|
|
624
|
+
# See dependency graph
|
|
625
|
+
bd graph
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Priority Levels
|
|
629
|
+
|
|
630
|
+
| Priority | Meaning |
|
|
631
|
+
|----------|---------|
|
|
632
|
+
| P0 | Critical - drop everything |
|
|
633
|
+
| P1 | High - do this sprint |
|
|
634
|
+
| P2 | Medium - normal priority (default) |
|
|
635
|
+
| P3 | Low - nice to have |
|
|
636
|
+
| P4 | Backlog - someday/maybe |
|
|
637
|
+
|
|
638
|
+
### Multi-Agent Coordination (Molecules)
|
|
639
|
+
|
|
640
|
+
For coordinating work across multiple agents:
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
# Create a molecule (epic/theme)
|
|
644
|
+
bd mol create "Authentication Overhaul"
|
|
645
|
+
|
|
646
|
+
# Add beads to molecule
|
|
647
|
+
bd mol add <mol-id> bd-a1b2
|
|
648
|
+
bd mol add <mol-id> bd-c3d4
|
|
649
|
+
|
|
650
|
+
# Check molecule progress
|
|
651
|
+
bd mol status <mol-id>
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### Environment Variables
|
|
655
|
+
|
|
656
|
+
| Variable | Default | Description |
|
|
657
|
+
|----------|---------|-------------|
|
|
658
|
+
| `BD_VERSION` | `latest` | Version of bd to install |
|
|
659
|
+
| `NEXUS_VERBOSE` | `0` | Set to 1 for debug output |
|
|
660
|
+
|
|
661
|
+
### Troubleshooting
|
|
662
|
+
|
|
663
|
+
**bd command not found:**
|
|
664
|
+
```bash
|
|
665
|
+
# Install or reinstall
|
|
666
|
+
~/.claude/hooks/bead-sync.sh install
|
|
667
|
+
|
|
668
|
+
# Check installation
|
|
669
|
+
ls -la ~/.local/bin/bd
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
**Beads not syncing:**
|
|
673
|
+
```bash
|
|
674
|
+
# Check API key is set
|
|
675
|
+
echo $NEXUS_API_KEY
|
|
676
|
+
|
|
677
|
+
# Manual sync with verbose output
|
|
678
|
+
NEXUS_VERBOSE=1 ~/.claude/hooks/bead-sync.sh sync
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
**No beads in auto-recall:**
|
|
682
|
+
Make sure you've run `~/.claude/hooks/bead-sync.sh push` at least once to sync local beads to GraphRAG.
|
package/hooks/auto-recall.sh
CHANGED
|
@@ -225,19 +225,43 @@ if [[ "$MEMORY_COUNT" == "0" ]] && [[ "$ENTITY_COUNT" == "0" ]] && [[ "$FACT_COU
|
|
|
225
225
|
exit 0
|
|
226
226
|
fi
|
|
227
227
|
|
|
228
|
+
# Token budget management
|
|
229
|
+
# Estimate tokens used (4 chars ~= 1 token)
|
|
230
|
+
# Max output tokens is MAX_TOKENS (default 3000)
|
|
231
|
+
TOKENS_USED=0
|
|
232
|
+
MAX_MEMORY_TOKENS=$((MAX_TOKENS * 60 / 100)) # 60% for memories
|
|
233
|
+
MAX_ENTITY_TOKENS=$((MAX_TOKENS * 15 / 100)) # 15% for entities
|
|
234
|
+
MAX_FACT_TOKENS=$((MAX_TOKENS * 15 / 100)) # 15% for facts
|
|
235
|
+
MAX_EPISODIC_TOKENS=$((MAX_TOKENS * 10 / 100)) # 10% for episodic
|
|
236
|
+
|
|
237
|
+
log "Token budget: memories=$MAX_MEMORY_TOKENS, entities=$MAX_ENTITY_TOKENS, facts=$MAX_FACT_TOKENS"
|
|
238
|
+
|
|
228
239
|
# Format output as rich context for Claude
|
|
229
240
|
echo ""
|
|
230
241
|
echo "<nexus-memory-context>"
|
|
231
|
-
echo "The following relevant context was automatically recalled from Nexus Memory (GraphRAG):"
|
|
232
242
|
echo ""
|
|
233
243
|
|
|
234
|
-
# Output memories
|
|
244
|
+
# Output memories (with token budget)
|
|
235
245
|
if [[ "$MEMORY_COUNT" -gt 0 ]] && [[ "$MEMORY_COUNT" != "null" ]]; then
|
|
236
246
|
echo "## Relevant Memories"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
247
|
+
# Process memories with token awareness
|
|
248
|
+
MEMORY_OUTPUT=""
|
|
249
|
+
MEMORY_TOKENS=0
|
|
250
|
+
MAX_CHARS=$((MAX_MEMORY_TOKENS * 4)) # ~4 chars per token
|
|
251
|
+
|
|
252
|
+
while IFS= read -r line; do
|
|
253
|
+
LINE_LEN=${#line}
|
|
254
|
+
LINE_TOKENS=$((LINE_LEN / 4))
|
|
255
|
+
if (( MEMORY_TOKENS + LINE_TOKENS > MAX_MEMORY_TOKENS )); then
|
|
256
|
+
break
|
|
257
|
+
fi
|
|
258
|
+
echo "$line"
|
|
259
|
+
MEMORY_TOKENS=$((MEMORY_TOKENS + LINE_TOKENS))
|
|
260
|
+
done < <(echo "$MEMORIES" | jq -r '.[] |
|
|
261
|
+
"- [\(.metadata.eventType // .metadata.contentClass // "context")] \(.content | if length > 250 then .[0:250] + "..." else . end)"
|
|
262
|
+
' 2>/dev/null | head -n 8)
|
|
240
263
|
echo ""
|
|
264
|
+
log "Memory tokens used: $MEMORY_TOKENS"
|
|
241
265
|
fi
|
|
242
266
|
|
|
243
267
|
# Output entities (knowledge graph nodes)
|
|
@@ -275,6 +299,43 @@ if [[ "$EPISODIC_COUNT" -gt 0 ]] && [[ "$EPISODIC_COUNT" != "null" ]]; then
|
|
|
275
299
|
echo ""
|
|
276
300
|
fi
|
|
277
301
|
|
|
302
|
+
# Output active beads (if bd is available and initialized)
|
|
303
|
+
BD_BIN="${HOME}/.local/bin/bd"
|
|
304
|
+
BD_CMD=""
|
|
305
|
+
if [[ -x "$BD_BIN" ]]; then
|
|
306
|
+
BD_CMD="$BD_BIN"
|
|
307
|
+
elif command -v bd &> /dev/null; then
|
|
308
|
+
BD_CMD="bd"
|
|
309
|
+
fi
|
|
310
|
+
|
|
311
|
+
if [[ -n "$BD_CMD" ]]; then
|
|
312
|
+
# Check if beads is initialized in this directory
|
|
313
|
+
if [[ -d ".beads" ]] || "$BD_CMD" list &>/dev/null 2>&1; then
|
|
314
|
+
ACTIVE_BEADS=$("$BD_CMD" list --json 2>/dev/null | jq -c '[.[] | select(.status == "open" or .status == "in_progress")]' 2>/dev/null || echo "[]")
|
|
315
|
+
ACTIVE_COUNT=$(echo "$ACTIVE_BEADS" | jq 'length' 2>/dev/null || echo "0")
|
|
316
|
+
|
|
317
|
+
if [[ "$ACTIVE_COUNT" -gt 0 ]] && [[ "$ACTIVE_COUNT" != "0" ]]; then
|
|
318
|
+
echo "## Active Beads"
|
|
319
|
+
echo "$ACTIVE_BEADS" | jq -r '.[:5] | .[] |
|
|
320
|
+
"- [\(.id // .ID)] \(.title // .Title) (\(.status // .Status))"
|
|
321
|
+
' 2>/dev/null
|
|
322
|
+
echo ""
|
|
323
|
+
fi
|
|
324
|
+
|
|
325
|
+
# Show ready work (no blockers)
|
|
326
|
+
READY_BEADS=$("$BD_CMD" ready --json 2>/dev/null || echo "[]")
|
|
327
|
+
READY_COUNT=$(echo "$READY_BEADS" | jq 'length' 2>/dev/null || echo "0")
|
|
328
|
+
|
|
329
|
+
if [[ "$READY_COUNT" -gt 0 ]] && [[ "$READY_COUNT" != "0" ]]; then
|
|
330
|
+
echo "## Ready Work (No Blockers)"
|
|
331
|
+
echo "$READY_BEADS" | jq -r '.[:3] | .[] |
|
|
332
|
+
"- [\(.id // .ID)] \(.title // .Title)"
|
|
333
|
+
' 2>/dev/null
|
|
334
|
+
echo ""
|
|
335
|
+
fi
|
|
336
|
+
fi
|
|
337
|
+
fi
|
|
338
|
+
|
|
278
339
|
# Output suggested follow-ups
|
|
279
340
|
FOLLOWUP_COUNT=$(echo "$FOLLOWUPS" | jq 'length' 2>/dev/null || echo "0")
|
|
280
341
|
if [[ "$FOLLOWUP_COUNT" -gt 0 ]] && [[ "$FOLLOWUP_COUNT" != "null" ]] && [[ "$INCLUDE_FOLLOWUPS" == "true" ]]; then
|