Forge KFS: The Knowledge Fabric Service

forge knowledge-graph graphiti infrastructure  ·  March 25, 2026

Every Claude Code session accumulates decisions, patterns, and context. KFS (Knowledge Fabric Service) is the layer that captures this context, extracts the structure from it, and builds a temporal knowledge graph — so future sessions, Ralph tasks, and the dashboard can query what was decided, what was built, what was blocked, and why.

The Core Idea

Without KFS: every session starts cold. With KFS: every session is aware of the full history — every decision made, every pattern confirmed, every connection drawn between Forge components. The graph compounds with time.

Architecture

KFS is two services operating in layers:

ServicePortResponsibility
knowledge5012Supabase-backed entity/relationship store. Ingests Gmail, Calendar, Drive. Vector search.
kfs-graphiti5022Temporal graph via Graphiti + FalkorDB. Stores episodes (sessions, events) → extracts entities → builds relationships with time windows.

The graphiti layer is what makes KFS different from a plain database: every fact has a valid_at and invalid_at timestamp, so the graph can answer "what was true at this point in time" rather than just "what is true now."

The Harvest Pipeline

The harvest script reads Claude Code session JSONLs and feeds them into the graph automatically:

~/.claude/projects/*.jsonl harvest-session.py extract assistant messages POST /v1/ingest Graphiti (gpt-4o-mini) FalkorDB graph

How it works

Runs automatically every 30 minutes via forge-kfs-harvest.timer systemd unit. Processes the 5 most recent sessions. Dedup ensures no wasted work.

What the Graph Captures

Each session is ingested as an episode in the claudecc vault. Graphiti automatically extracts:

Querying the Graph

# Semantic search across all sessions
curl -X POST http://localhost:5022/v1/query \
  -H "Content-Type: application/json" \
  -d '{"query":"cascade routing decisions","group_ids":["claudecc"],"limit":5}'

# Timeline for a specific entity
curl "http://localhost:5022/v1/timeline?entity=ClawdRouter&group_id=claudecc"

# Knowledge service search (Supabase vector)
curl "http://localhost:5012/v1/search?q=who+works+on+GTM"

Vault Namespaces

group_idSourceWhat's in it
claudeccharvest-session.pyAll Claude Code session decisions/patterns
ralphralph.sh (planned)Ralph task completions, errors, patterns
jasonknowledge serviceGmail, Calendar, Drive entities
curatedmanualHand-crafted canonical facts

Second-Order Effects

What a populated graph unlocks

How to Use It Now

# Harvest the current session manually
python3 /opt/forge/scripts/kfs/harvest-session.py --recent 1

# Backfill historical sessions
python3 /opt/forge/scripts/kfs/harvest-session.py --backfill 50

# Force re-harvest a session
python3 /opt/forge/scripts/kfs/harvest-session.py --recent 1 --force

# Query what the graph knows about a topic
curl -X POST http://localhost:5022/v1/query \
  -H "Content-Type: application/json" \
  -d '{"query":"YOUR QUESTION","group_ids":["claudecc"],"limit":5}'
Current status (March 25, 2026): Graph seeded with 3 sessions, backfill of 100 sessions running. Timer installed. ClawdRouter restarted with improved Telegram quality (Groq 70B before Llama 3B). Next: add graph visualization to dashboard, wire Ralph task completions into the ralph vault.

Files

PathPurpose
scripts/kfs/harvest-session.pyCore harvest script
scripts/kfs/harvest-session.shBash wrapper (uses kfs venv)
services/forge-kfs-harvest.servicesystemd oneshot service
services/forge-kfs-harvest.timersystemd timer (every 30min)
services/kfs-graphiti/main.pyGraphiti FastAPI service (port 5022)
logs/kfs-harvest.logHarvest run log
logs/kfs-harvested.txtDedup index (sha256 hashes of processed files)