Skip to main content

FUSE filesystem for Knowledge Graph - mount your knowledge graph as a filesystem

Project description

Knowledge Graph FUSE Driver

Mount the knowledge graph as a filesystem. Browse ontologies, search concepts by creating directories, read documents — all through your file manager or terminal.

Installation

Prerequisites

System FUSE library (required):

sudo pacman -S fuse3       # Arch
sudo apt install fuse3     # Debian/Ubuntu
sudo dnf install fuse3     # Fedora

kg CLI (for authentication setup):

npm install -g @aaronsb/kg-cli

Install kg-fuse

pipx install kg-fuse

Quick Start

# 1. Authenticate with the knowledge graph
kg login
kg oauth create

# 2. Set up a FUSE mount (interactive — detects auth, validates path, offers autostart)
kg-fuse init /mnt/knowledge

# 3. Mount
kg-fuse mount

That's it. Browse /mnt/knowledge/ in your file manager or terminal.

Commands

kg-fuse                          Status of running mounts + help summary
kg-fuse init [mountpoint]        Interactive setup: detect auth, configure mount, offer autostart
kg-fuse mount                    Fork daemons for ALL configured mounts
kg-fuse mount /mnt/knowledge     Fork daemon for just this one
kg-fuse mount /mnt/knowledge -f  Run in foreground (for debugging)
kg-fuse unmount                  Kill all kg-fuse daemons, clean unmount
kg-fuse unmount /mnt/knowledge   Kill just this one
kg-fuse status                   Same as bare kg-fuse
kg-fuse config                   Show configuration with masked secrets
kg-fuse repair                   Detect and fix orphaned mounts, stale PIDs, bad config
kg-fuse update                   Self-update via pipx

Bare kg-fuse with no arguments shows mount status, daemon process info, API connectivity, and other FUSE mounts on the system.

Configuration

File layout

File Owner Purpose
~/.config/kg/config.json kg CLI Auth credentials, API URL (kg-fuse reads only)
~/.config/kg/fuse.json kg-fuse Mount definitions, per-mount preferences
~/.local/share/kg-fuse/mounts/<id>/queries.toml kg-fuse Saved query directories per mount
~/.local/state/kg-fuse/<id>.pid kg-fuse Daemon PID files

kg-fuse never writes to kg CLI's config.json — it only reads auth credentials from it. This isolates failures: a bug in kg-fuse can only damage fuse.json, never your kg CLI config.

Credential resolution

Priority (highest to lowest):

  1. CLI flags (--client-id, --client-secret)
  2. fuse.json auth_client_id → lookup in config.json auth
  3. config.json auth section directly
  4. Error with guidance to run kg login + kg oauth create

Example fuse.json

{
  "auth_client_id": "kg-cli-admin-ba93368c",
  "mounts": {
    "/mnt/knowledge": {
      "tags": { "enabled": true, "threshold": 0.5 },
      "cache": { "epoch_check_interval": 5.0, "content_cache_max": 52428800 },
      "jobs": { "hide_jobs": false }
    }
  }
}

Filesystem Structure

/mnt/knowledge/
├── ontology/                   # System-managed ontology listing
│   ├── ontology-a/
│   │   ├── documents/          # Source documents (read-only, write to ingest)
│   │   │   ├── doc1.md
│   │   │   └── image.png
│   │   └── my-query/           # User query scoped to this ontology
│   │       ├── concept1.concept.md
│   │       ├── concept2.concept.md
│   │       ├── images/         # Image evidence from matching concepts
│   │       └── .meta/          # Query control plane
│   └── ontology-b/
│       └── documents/
└── my-global-query/            # User query across all ontologies
    └── *.concept.md

Query directories

Create a directory → it becomes a semantic search:

mkdir /mnt/knowledge/ontology/my-ontology/leadership
ls /mnt/knowledge/ontology/my-ontology/leadership/
# → concept files matching "leadership" within that ontology

mkdir /mnt/knowledge/machine-learning
ls /mnt/knowledge/machine-learning/
# → concept files matching "machine learning" across all ontologies

Query control plane (.meta)

Each query directory has a .meta/ subdirectory for tuning:

cat .meta/threshold     # Read current threshold (0.0-1.0)
echo 0.3 > .meta/threshold  # Lower threshold for broader matches
echo 100 > .meta/limit      # Increase result limit
echo "noise" >> .meta/exclude   # Filter out a term
echo "AI" >> .meta/union        # Broaden with additional term

Write: Ingest documents

cp report.pdf /mnt/knowledge/ontology/my-ontology/documents/
# File enters the ingestion pipeline → extracts concepts → links to graph

Autostart

kg-fuse init offers to set up autostart:

  • Systemd (preferred): installs a user service at ~/.config/systemd/user/kg-fuse.service
  • Shell RC (fallback): adds kg-fuse mount to .bash_profile, .zshrc, or fish config

Manage systemd service:

systemctl --user status kg-fuse
systemctl --user restart kg-fuse
journalctl --user -u kg-fuse -f

Safety

kg-fuse includes several safety checks:

  • Mountpoint validation: refuses system paths (/home, /etc, etc.) and non-empty directories
  • FUSE collision detection: checks for existing FUSE mounts (rclone, SSHFS, etc.) at the target path
  • Config isolation: kg-fuse writes only to fuse.json, never to kg CLI's config.json
  • Atomic config writes: fuse.json updates use temp file + rename for crash safety
  • PID verification: before killing a daemon, verifies it's actually a kg-fuse process via /proc/cmdline
  • Orphan recovery: kg-fuse repair detects dead mounts ("transport endpoint not connected") and cleans up
  • RC file safety: shell config changes use delimited blocks with backups

Debug Mode

kg-fuse mount /mnt/knowledge -f --debug

Runs in foreground with verbose logging. Daemon logs are also available at:

~/.local/share/kg-fuse/mounts/<mount-id>/daemon.log

Architecture

The FUSE driver is an independent Python client that:

  • Authenticates via OAuth (shared credentials with kg CLI)
  • Makes HTTP requests to the knowledge graph API
  • Uses epoch-gated caching for directory listings (background refresh, not fixed TTL)
  • Persists user query directories in client-side TOML files
  • Runs as a daemonized process per mount point

See ADR-715 for design rationale.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kg_fuse-0.13.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kg_fuse-0.13.0-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

Details for the file kg_fuse-0.13.0.tar.gz.

File metadata

  • Download URL: kg_fuse-0.13.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for kg_fuse-0.13.0.tar.gz
Algorithm Hash digest
SHA256 11fc0e98158fb02ef08aa3ee226522f370f81add5c6f3e46a769b16116235ef5
MD5 c34362e07680360b5432d95c94b7901f
BLAKE2b-256 d334c2f84cdd87f7da91b2058007a30a7d33835a6594ba8795d82ce4a86e7d5d

See more details on using hashes here.

File details

Details for the file kg_fuse-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: kg_fuse-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 71.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for kg_fuse-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d27dbf4c39c39d8edd251de83e26b8351c77059bb3c0a78920b314d06ef0b024
MD5 5364264f73dcfc219fdc2a54f8412f71
BLAKE2b-256 f48c785205127476a1f3ecc90cce9c7a598f010f397d0070bf65c2af5a882d54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page