Kntxt: Ambient P2P Collaboration for the Flow-State Developer

Feel your teammate's code. No servers. No accounts. No distractions.


💡 The Inspiration

Remote collaboration is often a choice between isolation and interruption. We miss the ambient awareness of a physical office—the rhythmic clicking of a keyboard or the subtle "pulse" of a teammate making progress. We wanted to recreate that shared nervous system in the terminal, allowing developers to feel each other's presence without the heavy overhead of a screen share or a video call.

🛠️ How We Built It

Kntxt is built with Rust (Nightly 2024) to handle the intense concurrency of networking, local AI, and terminal rendering.

  • Decentralized Networking: We used Iroh for QUIC-based P2P connections. By hashing a 4-digit code, we derive deterministic cryptographic keypairs, creating an end-to-end encrypted tunnel directly between peers without any central servers.
  • Local AI Brain: We integrated MistralRS/Candle to run a specialized Qwen2.5-Coder-0.5B LLM entirely on the user's machine. On macOS, this is Metal-accelerated for near-instant inference.
  • The Haptic Pulse: We used Objective-C FFI to hook into the macOS NSHapticFeedbackManager. When your peer saves a file, your trackpad physically taps.
  • Knowledge Graph Radar: A force-directed graph built with Petgraph visualizes the shape of collaboration. It applies physics forces like repulsion ($F_{rep} = \frac{150}{d^2}$) to keep the cluster organic and readable.
  • Agent Awareness: We built a dedicated Agent Parser that reads memory files from AI tools like Cursor, Cline, and Claude Code directly, providing 100% accurate intent summaries without extra compute cost.

🚀 Challenges We Overcame

  • The Inference Lag: Running an LLM can take seconds, which ruins real-time presence. We solved this with a Two-Phase Broadcast: an immediate FileActivity signal triggers the haptic tap instantly, followed by a FileUpdate once the AI summary is ready.
  • P2P NAT Traversal: Connecting two peers across restricted Wi-Fi (like coffee shops) is difficult. We leveraged Iroh's DHT and mDNS discovery to ensure peers could "entangle" with just a 4-digit code.
  • Resource Management: Running an LLM alongside a compiler required aggressive optimization. We utilized quantized GGUF models and Apple Silicon acceleration to ensure the developer's "flow" is never interrupted.

🏅 Accomplishments That We're Proud Of

  • Zero-Config Connectivity: No accounts, no sign-ups, and no .env files. The 4-digit code is the session.
  • Multi-Modal Sensors: Beyond file saves, we built an LSP Sensor that listens on a Unix domain socket for pre-save signals, giving your peer awareness as soon as you start typing.
  • Privacy-First AI: Your code never leaves your machine. Only the high-level "intent" summaries cross the network.

🧠 What We Learned

We learned that haptics are a massively underutilized channel for "quiet" communication. A subtle tap on a trackpad conveys more presence than a dozen Slack notifications. We also discovered that tiny, specialized 0.5B parameter models are remarkably capable at summarizing code diffs when provided with enough session context.


Install Kntxt and feel the flow.

npm install -g @tomdra01/kntxt
kntxt

Built With

  • candle
  • gguf
  • huggingface
  • ratatui
  • rust
  • tokio
Share this project:

Updates