Inputlayer
Streaming reasoning layer for AI. Incremental rules engine with vector search, graph traversal, and explainable derivation traces.
Install / Use
/learn @inputlayer/InputlayerREADME
InputLayer
Streaming reasoning layer for AI systems.
Store facts. Define rules. InputLayer derives the conclusions, keeps them current as data changes, and explains every result with a proof tree. Combine recursive reasoning with vector search in a single query. Open source.
Quick Example
Connecting flights - define direct routes as facts, let InputLayer derive all reachable destinations:
// Facts: direct flight routes
+direct_flight[("New York", "London"), ("London", "Paris"), ("Paris", "Tokyo"), ("Tokyo", "Sydney")]
// Rules: you can reach a destination directly, or through connections
+can_reach(A, B) <- direct_flight(A, B)
+can_reach(A, C) <- direct_flight(A, B), can_reach(B, C)
// Query: where can you fly from New York?
?can_reach("New York", Dest)
┌────────────┬──────────┐
│ New York │ Dest │
├────────────┼──────────┤
│ "New York" │ "London" │
│ "New York" │ "Paris" │
│ "New York" │ "Tokyo" │
│ "New York" │ "Sydney" │
└────────────┴──────────┘
4 rows
Four facts, two rules, and the engine derived every reachable destination - including connections through intermediate cities.
What Makes It Different
Rules + vector search in one query
A shopper asks for printer ink. In embedding space, every ink cartridge looks the same. But only specific models fit their printer - that's a structured fact, not a similarity score. InputLayer evaluates compatibility rules and ranks by cosine distance in a single query.
Correct conclusion retraction
An entity is cleared from a sanctions list. Every flag derived through it retracts - but only if no second ownership path still supports it. InputLayer tracks every derivation path independently and only retracts when all paths are gone.
Incremental updates
One fact changes in a 2,000-node graph with 400,000 derived relationships. InputLayer updates only the affected derivations in 6.83ms. Full recompute: 11.3 seconds. 1,652x faster.
Provenance
Run .why on any result and get a structured proof tree showing which facts and which rules produced it. Run .why_not to see exactly which condition blocked a derivation.
.why ?can_reach("New York", "Sydney")
// [rule] can_reach (clause 1): can_reach(A, C) <- direct_flight(A, B), can_reach(B, C)
// [base] direct_flight("New York", "London")
// [rule] can_reach (clause 1): ...
// [base] direct_flight("London", "Paris")
// [rule] can_reach (clause 1): ...
// [base] direct_flight("Paris", "Tokyo")
// [rule] can_reach (clause 0): can_reach(A, B) <- direct_flight(A, B)
// [base] direct_flight("Tokyo", "Sydney")
Get Started
# Docker
docker run -p 8080:8080 ghcr.io/inputlayer/inputlayer
# Or build from source
git clone https://github.com/inputlayer/inputlayer.git
cd inputlayer
cargo build --release
./target/release/inputlayer-server --port 8080
Open http://localhost:8080 for the interactive GUI, or connect via WebSocket at ws://localhost:8080/ws.
If you know SQL, the query language takes about 10 minutes to learn. See the Quick Start Guide.
SDKs
Python:
pip install inputlayer
from inputlayer import InputLayer
async with InputLayer() as il:
kg = il.knowledge_graph("default")
result = await kg.query(CanReach)
TypeScript:
npm install inputlayer-js
See Python SDK docs and TypeScript SDK docs.
Use Cases
- Financial Risk - Trace ownership chains to any depth for sanctions screening. Correct retraction handles the diamond problem.
- Conversational Commerce - Compatibility rules + vector similarity in one query. The wrong cartridge never gets recommended.
- Manufacturing - Multi-hop dependency chains from training records to production line availability, updated in milliseconds.
- Supply Chain - A port closes and every affected supplier, order, and SLA penalty is identified across the graph.
- Agentic AI - Agent memory as a knowledge graph with
.whyproof trees for every conclusion.
Built On
Differential Dataflow by Frank McSherry. Incremental computation engine written in Rust. Single binary, no external dependencies.
Documentation
- Quick Start
- Core Concepts
- Explainability (.why / .why_not)
- Vector Search
- Recursion
- Python SDK
- TypeScript SDK
- WebSocket API Docs
Contributing
See CONTRIBUTING.
License
Apache 2.0 + Commons Clause. Open source for non-commercial use. Commercial use requires a separate license - see COMMERCIAL_LICENSE.md.
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
