@adverant/nexus-memory-skill 2.0.0 → 2.2.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/SKILL.md +291 -0
- package/hooks/auto-recall.sh +37 -0
- 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 +27 -2
- package/hooks/upload-document.sh +377 -125
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -418,6 +418,145 @@ curl -X POST "https://api.adverant.ai/fileprocess/api/process" \
|
|
|
418
418
|
|
|
419
419
|
---
|
|
420
420
|
|
|
421
|
+
## Upload Document Hook (Full Knowledge Extraction)
|
|
422
|
+
|
|
423
|
+
The `upload-document.sh` hook provides a streamlined way to upload files with **full auto-discovery and knowledge extraction** enabled by default.
|
|
424
|
+
|
|
425
|
+
### Auto-Discovery Features (All Enabled by Default)
|
|
426
|
+
|
|
427
|
+
When you upload a document, the system automatically:
|
|
428
|
+
|
|
429
|
+
| Feature | Description | Accuracy |
|
|
430
|
+
|---------|-------------|----------|
|
|
431
|
+
| **Smart File Detection** | Magic byte detection for accurate MIME type | 100% |
|
|
432
|
+
| **Intelligent Routing** | Auto-routes to MageAgent, VideoAgent, or CyberAgent | Automatic |
|
|
433
|
+
| **3-Tier OCR Cascade** | Tesseract → GPT-4o Vision → Claude Opus | Auto-escalates |
|
|
434
|
+
| **Layout Analysis** | Document structure preservation | 99.2% |
|
|
435
|
+
| **Table Extraction** | Tables converted to structured data | 97.9% |
|
|
436
|
+
| **Document DNA** | Triple-layer storage (semantic + structural + original) | Full fidelity |
|
|
437
|
+
| **Entity Extraction** | People, places, organizations → Neo4j | Automatic |
|
|
438
|
+
| **Vector Embeddings** | VoyageAI embeddings → Qdrant | Automatic |
|
|
439
|
+
|
|
440
|
+
### Basic Usage
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Upload a single file
|
|
444
|
+
~/.claude/hooks/upload-document.sh ./document.pdf
|
|
445
|
+
|
|
446
|
+
# Upload and wait for processing to complete
|
|
447
|
+
~/.claude/hooks/upload-document.sh ./book.pdf --wait
|
|
448
|
+
|
|
449
|
+
# Upload with custom tags for easier recall
|
|
450
|
+
~/.claude/hooks/upload-document.sh ./research.pdf --wait --tags=research,ai,papers
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Batch Upload (Multiple Files)
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
# Upload 3 books at once
|
|
457
|
+
~/.claude/hooks/upload-document.sh book1.pdf book2.pdf book3.pdf --batch --wait
|
|
458
|
+
|
|
459
|
+
# Upload entire directory of PDFs
|
|
460
|
+
~/.claude/hooks/upload-document.sh ./docs/*.pdf --batch --wait --tags=documentation
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Processing Options
|
|
464
|
+
|
|
465
|
+
| Flag | Description |
|
|
466
|
+
|------|-------------|
|
|
467
|
+
| `--wait` | Wait for processing to complete and show results |
|
|
468
|
+
| `--batch` | Enable batch mode for multiple files |
|
|
469
|
+
| `--tags=a,b,c` | Add custom tags for easier recall |
|
|
470
|
+
| `--no-entities` | Skip entity extraction (faster, less rich) |
|
|
471
|
+
| `--prefer-speed` | Use faster OCR (may reduce accuracy) |
|
|
472
|
+
| `--poll-interval=N` | Poll interval in seconds (default: 5) |
|
|
473
|
+
|
|
474
|
+
### Supported File Types
|
|
475
|
+
|
|
476
|
+
The upload hook supports **ALL file types** through intelligent routing:
|
|
477
|
+
|
|
478
|
+
- **Documents**: PDF, DOCX, DOC, TXT, MD, HTML, CSV, XML, JSON
|
|
479
|
+
- **Images**: JPEG, PNG, GIF, TIFF, WebP (with OCR)
|
|
480
|
+
- **Videos**: MP4, MOV, AVI, MKV, WebM, FLV
|
|
481
|
+
- **Archives**: ZIP, RAR, 7z, TAR, TAR.GZ, TAR.BZ2
|
|
482
|
+
- **Geospatial**: GeoJSON, Shapefile, GeoTIFF, KML
|
|
483
|
+
- **Point Cloud**: LAS, LAZ, PLY, PCD, E57
|
|
484
|
+
- **Code**: Any programming language
|
|
485
|
+
- **Any binary format** (routed to CyberAgent if suspicious)
|
|
486
|
+
|
|
487
|
+
### Example Output (--wait mode)
|
|
488
|
+
|
|
489
|
+
```
|
|
490
|
+
[upload-document] Uploading: research-paper.pdf (12MB)
|
|
491
|
+
Job ID: abc123-def456-ghi789
|
|
492
|
+
|
|
493
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
494
|
+
║ PROCESSING COMPLETE: research-paper.pdf
|
|
495
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
496
|
+
|
|
497
|
+
📄 Document Type: academic_paper
|
|
498
|
+
📑 Pages: 42
|
|
499
|
+
📝 Words: 15,230
|
|
500
|
+
|
|
501
|
+
🔍 Auto-Discovery Results:
|
|
502
|
+
• OCR Tier Used: tesseract (text-based PDF)
|
|
503
|
+
• Tables Found: 8
|
|
504
|
+
• Entities: 127
|
|
505
|
+
• GraphRAG: true
|
|
506
|
+
|
|
507
|
+
🏷️ Extracted Entities:
|
|
508
|
+
• Dr. Emily Chen (person)
|
|
509
|
+
• Stanford University (organization)
|
|
510
|
+
• NeurIPS 2024 (event)
|
|
511
|
+
• Transformer Architecture (concept)
|
|
512
|
+
... and 123 more
|
|
513
|
+
|
|
514
|
+
💡 To recall this content:
|
|
515
|
+
echo '{"query": "<your search>"}' | recall-memory.sh
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Recalling Uploaded Content
|
|
519
|
+
|
|
520
|
+
After upload, documents are immediately searchable:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Search by content
|
|
524
|
+
echo '{"query": "transformer architecture research"}' | ~/.claude/hooks/recall-memory.sh
|
|
525
|
+
|
|
526
|
+
# Search by entity
|
|
527
|
+
echo '{"query": "papers by Dr. Emily Chen"}' | ~/.claude/hooks/recall-memory.sh
|
|
528
|
+
|
|
529
|
+
# Search by tag
|
|
530
|
+
echo '{"query": "research papers tagged ai"}' | ~/.claude/hooks/recall-memory.sh
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Environment Variables
|
|
534
|
+
|
|
535
|
+
| Variable | Default | Description |
|
|
536
|
+
|----------|---------|-------------|
|
|
537
|
+
| `NEXUS_API_KEY` | (required) | API key for authentication |
|
|
538
|
+
| `NEXUS_API_URL` | `https://api.adverant.ai` | API endpoint |
|
|
539
|
+
| `NEXUS_COMPANY_ID` | `adverant` | Company identifier |
|
|
540
|
+
| `NEXUS_APP_ID` | `claude-code` | Application identifier |
|
|
541
|
+
| `NEXUS_VERBOSE` | `0` | Set to `1` for debug output |
|
|
542
|
+
|
|
543
|
+
### Troubleshooting
|
|
544
|
+
|
|
545
|
+
**File too large:**
|
|
546
|
+
Maximum file size is 5GB. For larger files, consider splitting or using the direct API.
|
|
547
|
+
|
|
548
|
+
**Processing takes too long:**
|
|
549
|
+
- Large PDFs with many images trigger OCR cascade
|
|
550
|
+
- Use `--prefer-speed` for faster (but less accurate) processing
|
|
551
|
+
- Increase `--poll-interval` for large batches
|
|
552
|
+
|
|
553
|
+
**Entities not extracted:**
|
|
554
|
+
- Ensure you didn't use `--no-entities`
|
|
555
|
+
- Check NEXUS_VERBOSE=1 for detailed logs
|
|
556
|
+
- Some file types don't support entity extraction
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
421
560
|
## Store Memory
|
|
422
561
|
|
|
423
562
|
```bash
|
|
@@ -528,3 +667,155 @@ Your API key may be invalid or expired.
|
|
|
528
667
|
If you see "Endpoint not found" errors, the hooks may be using outdated endpoints. Update to:
|
|
529
668
|
- Store: `/api/memory/store`
|
|
530
669
|
- Recall: `/api/memory/recall`
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
## Beads: Git-Backed Issue Tracking
|
|
674
|
+
|
|
675
|
+
> **Attribution**: Beads (bd) is created by [Steve Yegge](https://github.com/steveyegge).
|
|
676
|
+
> Repository: https://github.com/steveyegge/beads
|
|
677
|
+
> License: See the beads repository for license terms.
|
|
678
|
+
>
|
|
679
|
+
> This integration extends beads with GraphRAG sync capabilities for cross-device memory.
|
|
680
|
+
|
|
681
|
+
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:
|
|
682
|
+
|
|
683
|
+
- **Local git versioning** of issues (distributed, offline-capable)
|
|
684
|
+
- **Semantic search** across all issues via GraphRAG
|
|
685
|
+
- **Cross-device sync** through bidirectional GraphRAG sync
|
|
686
|
+
- **Dependency tracking** (blocks, relates, discovered-from)
|
|
687
|
+
- **Ready-work queries** (what tasks have no blockers?)
|
|
688
|
+
|
|
689
|
+
### First-Time Setup
|
|
690
|
+
|
|
691
|
+
The `bd` binary auto-installs on first use:
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
# Install bd binary (or let it auto-install)
|
|
695
|
+
~/.claude/hooks/bead-sync.sh install
|
|
696
|
+
|
|
697
|
+
# Initialize beads in your repository
|
|
698
|
+
bd init
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Core Commands
|
|
702
|
+
|
|
703
|
+
| Command | Description |
|
|
704
|
+
|---------|-------------|
|
|
705
|
+
| `bd list` | List all open beads |
|
|
706
|
+
| `bd ready` | Show beads with no blockers (ready to work) |
|
|
707
|
+
| `bd create "title" -p P1` | Create new bead with priority |
|
|
708
|
+
| `bd work <id>` | Mark bead as in-progress |
|
|
709
|
+
| `bd close <id>` | Mark bead as complete |
|
|
710
|
+
| `bd dep add <a> blocks <b>` | Create dependency (A blocks B) |
|
|
711
|
+
| `bd show <id>` | Show bead details |
|
|
712
|
+
| `bd graph` | Visualize dependency graph |
|
|
713
|
+
|
|
714
|
+
### Sync Commands
|
|
715
|
+
|
|
716
|
+
```bash
|
|
717
|
+
# Full bidirectional sync (push local + pull remote)
|
|
718
|
+
~/.claude/hooks/bead-sync.sh sync
|
|
719
|
+
|
|
720
|
+
# Push local beads to GraphRAG only
|
|
721
|
+
~/.claude/hooks/bead-sync.sh push
|
|
722
|
+
|
|
723
|
+
# Pull beads from GraphRAG (cross-device sync)
|
|
724
|
+
~/.claude/hooks/bead-sync.sh pull
|
|
725
|
+
|
|
726
|
+
# Search beads in GraphRAG
|
|
727
|
+
~/.claude/hooks/bead-sync.sh query "authentication bug"
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### How Beads Become Memories
|
|
731
|
+
|
|
732
|
+
Beads are automatically synced to GraphRAG with:
|
|
733
|
+
- `event_type: "bead"`
|
|
734
|
+
- `metadata.bead_id: "bd-xxxx"`
|
|
735
|
+
- `tags: ["bead", "status:open", "priority:P1", "project:my-project"]`
|
|
736
|
+
|
|
737
|
+
This integration enables:
|
|
738
|
+
- **Auto-recall** surfaces relevant beads when discussing tasks
|
|
739
|
+
- **Semantic search** finds beads by meaning, not just ID
|
|
740
|
+
- **Causal chains** link beads to related code changes
|
|
741
|
+
- **Cross-project** search works across all repositories
|
|
742
|
+
|
|
743
|
+
### Typical Workflow
|
|
744
|
+
|
|
745
|
+
1. **See what's ready**: `bd ready`
|
|
746
|
+
2. **Claim a task**: `bd work bd-a1b2`
|
|
747
|
+
3. **Do the work**: (make code changes)
|
|
748
|
+
4. **Complete**: `bd close bd-a1b2`
|
|
749
|
+
5. **Sync to memory**: `~/.claude/hooks/bead-sync.sh sync`
|
|
750
|
+
|
|
751
|
+
### Dependencies
|
|
752
|
+
|
|
753
|
+
```bash
|
|
754
|
+
# A blocks B (B can't start until A is done)
|
|
755
|
+
bd dep add bd-a1b2 blocks bd-c3d4
|
|
756
|
+
|
|
757
|
+
# A relates to B (informational link)
|
|
758
|
+
bd dep add bd-a1b2 relates bd-c3d4
|
|
759
|
+
|
|
760
|
+
# Discover new issue from existing work
|
|
761
|
+
bd create "Found bug while fixing auth" --discovered-from bd-a1b2
|
|
762
|
+
|
|
763
|
+
# See dependency graph
|
|
764
|
+
bd graph
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### Priority Levels
|
|
768
|
+
|
|
769
|
+
| Priority | Meaning |
|
|
770
|
+
|----------|---------|
|
|
771
|
+
| P0 | Critical - drop everything |
|
|
772
|
+
| P1 | High - do this sprint |
|
|
773
|
+
| P2 | Medium - normal priority (default) |
|
|
774
|
+
| P3 | Low - nice to have |
|
|
775
|
+
| P4 | Backlog - someday/maybe |
|
|
776
|
+
|
|
777
|
+
### Multi-Agent Coordination (Molecules)
|
|
778
|
+
|
|
779
|
+
For coordinating work across multiple agents:
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
# Create a molecule (epic/theme)
|
|
783
|
+
bd mol create "Authentication Overhaul"
|
|
784
|
+
|
|
785
|
+
# Add beads to molecule
|
|
786
|
+
bd mol add <mol-id> bd-a1b2
|
|
787
|
+
bd mol add <mol-id> bd-c3d4
|
|
788
|
+
|
|
789
|
+
# Check molecule progress
|
|
790
|
+
bd mol status <mol-id>
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
### Environment Variables
|
|
794
|
+
|
|
795
|
+
| Variable | Default | Description |
|
|
796
|
+
|----------|---------|-------------|
|
|
797
|
+
| `BD_VERSION` | `latest` | Version of bd to install |
|
|
798
|
+
| `NEXUS_VERBOSE` | `0` | Set to 1 for debug output |
|
|
799
|
+
|
|
800
|
+
### Troubleshooting
|
|
801
|
+
|
|
802
|
+
**bd command not found:**
|
|
803
|
+
```bash
|
|
804
|
+
# Install or reinstall
|
|
805
|
+
~/.claude/hooks/bead-sync.sh install
|
|
806
|
+
|
|
807
|
+
# Check installation
|
|
808
|
+
ls -la ~/.local/bin/bd
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
**Beads not syncing:**
|
|
812
|
+
```bash
|
|
813
|
+
# Check API key is set
|
|
814
|
+
echo $NEXUS_API_KEY
|
|
815
|
+
|
|
816
|
+
# Manual sync with verbose output
|
|
817
|
+
NEXUS_VERBOSE=1 ~/.claude/hooks/bead-sync.sh sync
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
**No beads in auto-recall:**
|
|
821
|
+
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
|
@@ -299,6 +299,43 @@ if [[ "$EPISODIC_COUNT" -gt 0 ]] && [[ "$EPISODIC_COUNT" != "null" ]]; then
|
|
|
299
299
|
echo ""
|
|
300
300
|
fi
|
|
301
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
|
+
|
|
302
339
|
# Output suggested follow-ups
|
|
303
340
|
FOLLOWUP_COUNT=$(echo "$FOLLOWUPS" | jq 'length' 2>/dev/null || echo "0")
|
|
304
341
|
if [[ "$FOLLOWUP_COUNT" -gt 0 ]] && [[ "$FOLLOWUP_COUNT" != "null" ]] && [[ "$INCLUDE_FOLLOWUPS" == "true" ]]; then
|