跳到正文
GitHub·· 9 天前AI 评分62

Lens 开源发布:把实时数据流变成可引用的知识图谱供智能体推理

adeelahmad/lense

AI 导读

Lens 是一个 MIT 协议开源项目,把录音、文档、邮件、日历、聊天室、设备和 webhook 等数据流接入后转成带引用的知识图谱,供智能体推理使用。它可作为 MCP 服务器提供 25 个工具,覆盖搜索、转录、引用、图谱、主题和笔记,智能体通过 OAuth 登录且只能看到本人有权读取的内容。

正文

Lens: Your life. Your AI.

Lens: intelligence for your agent

Safe, secure and cost-effective.

Connect your live data streams; Lens turns them into a cited knowledge graph your agent can reason over. Runs on your hardware with local models or any cloud model, private by default and cost-aware.

Install

curl -fsSL https://raw.githubusercontent.com/adeelahmad/lense/main/install.sh | sh

That one line is all: it installs Docker if needed, starts Lens and opens the setup page, where a short wizard asks for a namespace, a model provider and storage (details). Run it again to update. Deployment covers servers and Cloudron; there are also packages for Synology, QNAP and Proxmox.

To work on the code instead, make run builds and runs everything from a checkout, make setup-code prints the first-admin setup code, and make dev runs it with hot reload; see Get started.

Why Lens

AI doesn't lack intelligence. It lacks structure. Lens gives your agent eyes. Without structure, every prompt is a guess about who you are and what happened. Lens supplies the people and things involved, how they relate, what happened when, and the source of each fact, so your agent stops guessing.

Lens is one private AI hub for your whole life. Every source is a sensor: recordings, documents, email, calendars, chat rooms, devices and webhooks all flow in, and everything becomes memory you can trust, because every answer cites where it came from, down to the second of a recording or the line of a document. It runs on your own hardware, from a Raspberry Pi to the cloud, and you own every byte.

Lens is built first for agents and AI assistants. After setup, most people do two things: talk to an assistant that finds and fetches what they need, and look at the charts and reports that show what is in their archive and what it cost.

Lens is also infrastructure to build on. An app built on Lens, such as an email responder or a customer manager, starts with real, structured context (who is involved, what was said, what was decided, with sources) instead of a blank prompt. Apps reach it the same way agents do: through the MCP server, the REST API and OAuth sign-in, limited to what their person may read.

What you can do with it

  • Ask, and get cited answers. A chat assistant on every page (and by voice) searches, reads and cites your archive, and acts on it with tools: changes wait for your approval. Each namespace can have its own assistant with its own name, instructions and memory, and the assistant can answer in Slack, Discord, Telegram, Matrix and other chat rooms. (Chat, chat rooms)
  • Connect your agents. Lens is an MCP server (/mcp) with 25 tools for search, transcripts, citations, the graph, topics and notes. Agents sign in with OAuth and see only what their person may read. (MCP)
  • Bring in everything. Watched folders on S3, Dropbox, Google Drive, OneDrive, SFTP, SMB, WebDAV or local disks; IMAP mail and iCal calendars; a built-in MQTT broker, syslog and webhook streams; uploads of audio, video, PDFs, Office files, web pages and transcripts. (Sensors, processing)
  • Understand it. Transcription and speaker recognition, entities and topics in a knowledge graph you can explore, query with Cypher or SPARQL, and see as it was at any version. (Graph, graph history, topics, video)
  • Keep notes beside it. Every recording, entity and topic has a page, plus free notes that you and the assistant write and link. (Notes)
  • Automate it. Pipelines and workflows on a canvas, routines on a schedule, and extensions (prompts, templates and sandboxed Python) the assistant can call.
  • See what it costs. An activity ledger of every model call, with reports, charts and budgets that cap spending. Routine choices go to small decision models, and the LLM only when it adds value. (Activity and costs, budgets)
  • Stay private. Passkeys instead of passwords, encryption at rest with a key per namespace, roles per namespace, and an audit log. Reach it from anywhere through a Cloudflare tunnel with nothing opened on your router. (Encryption, authentication, remote access)
  • Use open standards. RDF and Dublin Core for every record, OIDC sign-in for other apps, MQTT, IIIF for publishing, OpenTelemetry for monitoring, and an optional Fedora mirror. (Linked data, IIIF, telemetry)

Light by default

Lens runs on a small machine. Heavy parts (local speech models, a local LLM, document conversion, Fedora) stay off or download only when you turn them on, and any of them can be swapped for a cloud provider instead. Every setting lives in the web app. (Components, speech providers, local models)

In progress

  • An import webhook that pushes files into a namespace with its own token.
  • Routing rules that sort a shared inbox into namespaces.
  • Setting up a namespace's assistant and its chat rooms from the web app.

Stack

fastapi_backend/ FastAPI API (/api/v1), MCP server, the processing engine, and the lens CLI and workers
nextjs-frontend/ Next.js web app with a typed client generated from the API's OpenAPI schema
SurrealDB documents, graph edges, the job queue and graph history; word search in a small SQLite index beside it

Documentation

Start with Get started, then Architecture, Configuration, API and Deployment. The full guide list is in the docs folder. Contributing, Security, Changelog.

License

Lens is open source under the MIT License. Optional extras that you install yourself may carry their own licenses (for example extract-msg, GPL-3.0, for Outlook .msg files); none is part of the default install.

Built on the Next.js FastAPI Template (MIT).

来源:GitHub · github.com