No description
Find a file
Robin Cheung, MBA ba148f8fac
Merge pull request #1 from rebots-online/codex/assess-chrome-extension-readiness-2025-09-29-at-04-43-17
Add architecture assessment and operational checklist
2025-09-29 00:43:35 -04:00
api-bridge Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
assets Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
build Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
docs Add architecture assessment and operational checklist 2025-09-29 00:43:19 -04:00
src Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
build_standalone.py Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
manifest.json Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
README.md first commit 2025-09-28 21:06:18 -04:00
warp-output-hkg-chrome-ext-21aug2025.txt Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00
warpterminalconvesation-hkg-chrome-ext-21aug2025.txt Add Chrome extension for hKG web content import 2025-09-28 21:09:48 -04:00

hKG Web Importer Chrome Extension

Overview

The hKG Web Importer is a powerful Chrome extension that seamlessly imports web content into your Hybrid Knowledge Graph (hKG) system. It intelligently handles duplicate detection while preserving valuable incremental redundancies for triangulation - a key design principle of hKG.

Key Features

  • 🔍 Smart Duplicate Detection: Checks for identical content but preserves near-duplicates for triangulation
  • 📊 Incremental Redundancy Tracking: Captures micro-adjustments and variations in content
  • 🎯 Customizable Import Options: Choose what content to import (text, images, videos, audio, metadata)
  • 🤖 AI Inference: Extract entities, relationships, summaries, and topics
  • 📸 Media Processing: OCR on images, transcription of audio/video
  • 🔗 Context Preservation: Maintains relationships between similar content
  • Quick Import: Keyboard shortcuts and context menu integration
  • 📈 Import History: Track what you've imported with similarity scores

Philosophy: Triangulation Through Redundancy

Unlike traditional systems that avoid duplicates, hKG embraces controlled redundancy. When content is similar but not identical, these variations provide valuable signals for understanding how information evolves and relates. The extension supports three duplicate handling modes:

  1. Skip only if 100% identical (Default): Import everything except exact duplicates
  2. Always import: Track all variations, even identical content with different access contexts
  3. Smart diff: Highlight changes between versions

Installation

1. Install the Chrome Extension

  1. Clone this repository or download the extension files
  2. Open Chrome and navigate to chrome://extensions/
  3. Enable "Developer mode" in the top right
  4. Click "Load unpacked"
  5. Select the hkg-chrome-extension directory
  6. The extension icon (🧠) will appear in your toolbar

2. Set Up the API Bridge Server

The API bridge connects the Chrome extension to your hKG infrastructure.

Prerequisites

# Install Python dependencies
pip install flask flask-cors psycopg2-binary qdrant-client neo4j \
            sentence-transformers numpy requests

Start the API Bridge

cd /home/robin/CascadeProjects/ihkg/hkg-chrome-extension/api-bridge
python hkg_web_api.py

The API bridge will start on port 59877 by default. You can override the port by setting HKG_API_PORT or PORT.

Configure Environment (Optional)

Create a .env file in the api-bridge directory:

POSTGRES_HOST=192.168.0.111
POSTGRES_PORT=5432
POSTGRES_DB=hkg
POSTGRES_USER=hkg_user
POSTGRES_PASSWORD=h3Lp-hKg#2024

NEO4J_URI=bolt://192.168.0.111:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=h3Lp-Ne0#2024

QDRANT_HOST=192.168.0.173
QDRANT_PORT=6333

SIMILARITY_THRESHOLD=0.85

3. Configure the Extension

  1. Click the extension icon (🧠) in Chrome
  2. Click on "Advanced Options"
  3. Set the API Endpoint (default: http://localhost:59877/import)
  4. Configure your import preferences

Usage

Quick Import

  • Keyboard Shortcut: Press Ctrl+Shift+I (configurable in Chrome settings)
  • Extension Icon: Click the 🧠 icon and click "Import to hKG"

Context Menu Import

Right-click on any:

  • Selected text
  • Image
  • Video
  • Audio
  • Link
  • Page background

Select "Import to hKG" from the context menu.

Advanced Import Options

Content Selection

  • Page Text Content: Extract all text from the page
  • Images: Include all images (with OCR option)
  • Videos: Extract video URLs and metadata
  • Audio: Include audio files
  • Links & References: Capture all hyperlinks
  • Page Metadata: Include title, description, Open Graph data
  • Selected Text Only: Import only highlighted text

Duplicate Handling

  • Similarity Threshold: Adjust the slider (50-100%) to control what's considered "similar"
  • Duplicate Modes: Choose how to handle similar content

AI Inference Options

  • Extract Entities: Identify people, places, organizations
  • Extract Relationships: Find connections between entities
  • Generate Summary: Create concise summaries
  • Detect Topics: Identify main themes
  • OCR on Images: Extract text from images
  • Transcribe Media: Convert audio/video to text

Checking for Duplicates

Click "Check Duplicates" to see if similar content already exists in your hKG:

  • Green ( Unique): No similar content found
  • Yellow (⚠ Similar): Similar content exists (shows similarity %)
  • Red (✓ Identical): Exact duplicate found

Preview Content

Click "Preview" to see what will be imported before committing.

API Endpoints

The API bridge provides several endpoints:

  • POST /import: Import content to hKG
  • POST /check-duplicates: Check for similar/identical content
  • POST /search: Search content in hKG
  • GET /stats: Get import statistics
  • GET /health: Health check

Architecture

Chrome Extension
    ├── popup.html/js (UI)
    ├── content.js (Page extraction)
    └── background.js (Service worker)
           ↓
    API Bridge (Flask)
           ↓
    hKG Infrastructure
        ├── PostgreSQL (Raw data + metadata)
        ├── Neo4j (Knowledge graph)
        └── Qdrant (Vector embeddings)

Development

Building from Source

# Install dependencies
npm install

# Build extension (if using build tools)
npm run build

# Package for distribution
npm run package

Testing

  1. Load the extension in developer mode
  2. Navigate to any webpage
  3. Try importing different types of content
  4. Check the browser console for debug messages

Debugging the API Bridge

# Run with debug logging
FLASK_ENV=development python hkg_web_api.py

# Check logs
tail -f /var/log/hkg-web-api.log

Troubleshooting

Extension Not Working

  1. Check that the API bridge is running: curl http://localhost:59877/health
  2. Verify Chrome permissions are granted
  3. Check browser console for errors (F12 → Console)

Import Failures

  1. Verify database connections (PostgreSQL, Neo4j, Qdrant)
  2. Check API bridge logs for errors
  3. Ensure the universal importer is properly configured

Duplicate Detection Issues

  1. Adjust similarity threshold in settings
  2. Check if Qdrant collection exists and has proper embeddings
  3. Verify the embedding model is loaded correctly

Advanced Configuration

Custom Tags and Context

Add custom tags and context notes to imports for better organization:

  • Custom Tags: Comma-separated tags (e.g., "research, project-x, important")
  • Context Note: Add notes about why you're importing this content

Multiple API Endpoints

You can run multiple API bridges on different high ports for different projects. The server reads HKG_API_PORT (or PORT):

# Project 1
HKG_API_PORT=59877 python hkg_web_api.py

# Project 2
HKG_API_PORT=59878 python hkg_web_api.py

Security Considerations

  • The extension only accesses the active tab when you explicitly trigger an import
  • API communication is local by default (localhost)
  • For remote API access, use HTTPS and authentication
  • Sensitive data is never logged or exposed in the extension

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

[Specify your license here]

Support

For issues or questions:

  • Check the Issues page
  • Contact: [your contact info]

Roadmap

  • Batch import multiple tabs
  • Scheduled imports for monitoring changes
  • Integration with browser bookmarks
  • Export/import settings
  • Team collaboration features
  • Advanced diff visualization
  • Mobile browser support

Remember: hKG thrives on incremental redundancies. Don't worry about importing similar content - these variations help build a richer, more nuanced knowledge graph!

hKG-chromext-sept2025