divinesense

module
v0.98.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2026 License: MIT

README

DivineSense (神识)

AI 驱动的个人第二大脑 — 通过五位智能代理自动化任务、过滤高价值信息、以技术杠杆提升生产力

License Version Go React


为什么选择 DivineSense?

  • AI 原生架构:内置五位智能代理(Memo/Schedule/Amazing/Geek/Evolution),深度协同工作
  • 数据完全私有:100% 自托管,无遥测,所有数据存储在您自己的服务器
  • 极简单文件部署:Go 语言编译的单二进制文件,零依赖,极低资源占用
  • Chat Apps 无缝集成:原生支持 Telegram 和 钉钉,双向对话,随时随地记录与交互
  • Geek Mode:深度集成 Claude Code CLI,提供独立沙箱环境执行代码与自动化任务
  • 智能日程管理:支持自然语言创建日程(如"明天下午三点开会"),自动冲突检测

核心功能

AI 代理系统 — 五位「鹦鹉」协同工作
代理 名称 执行策略 核心能力
MemoParrot 灰灰 ReAct 循环 语义搜索笔记,智能标签建议
ScheduleParrot 时巧 原生工具调用 自然语言创建日程,冲突检测
AmazingParrot 折衷 两阶段规划 综合助理,多工具并发执行
GeekParrot 极客 Playground Claude Code CLI 集成,AI 试验场
EvolutionParrot 进化 自我进化 AI 修改源代码,提交 GitHub PR

智能路由:四层意图分类(Cache → Rule → History → LLM),响应延迟 0-400ms

搜索与检索
  • 混合检索:BM25 + 向量搜索 + RRF 融合
  • 自适应策略:根据查询复杂度自动选择最佳检索方式
  • 重排优化:BAAI/bge-reranker-v2-m3 精炼结果,准确率提升 60%+
笔记管理
  • Markdown 编辑:支持 KaTeX 公式、Mermaid 图表、GFM
  • 智能标签:AI 自动建议标签和分类
  • 重复检测:基于内容相似性自动去重
  • 附件管理:支持图片、文件等媒体内容
日程管理
  • 自然语言解析:支持"明天下午3点开会"等表达
  • 冲突检测:自动检测日程冲突并建议解决方案
  • 多视图日历:FullCalendar 集成,支持日/周/月视图
  • 智能提醒:基于用户习惯的个性化提醒
Chat Apps 集成
  • 多平台支持:Telegram、钉钉、WhatsApp(预留)
  • 双向对话:聊天应用中发送消息,AI 自动回复
  • 安全加密:AES-256-GCM 加密存储访问令牌
  • Webhook 验证:HMAC-SHA256 签名 + 时间戳防重放
Geek Mode — 代码执行
  • Claude Code CLI 集成:全双工持久化会话架构
  • 沙箱隔离:用户工作目录独立,安全执行
  • 危险命令检测:自动拦截 rm -rf 等破坏性操作
  • 代码产物预览:实时预览生成的网页和代码
成本追踪
  • 实时统计:Token 使用量、费用估算
  • 缓存优化:DeepSeek 上下文缓存,成本降低 70%+
  • 预算告警:支持每日预算设置和超额提醒

快速开始

一键安装(推荐)
# 交互式安装(推荐新手)
curl -fsSL https://raw.githubusercontent.com/hrygo/divinesense/main/deploy/install.sh | sudo bash -s -- --interactive

# 二进制模式(Geek Mode 推荐)
curl -fsSL https://raw.githubusercontent.com/hrygo/divinesense/main/deploy/install.sh | sudo bash -s -- --mode=binary

# Docker 模式
curl -fsSL https://raw.githubusercontent.com/hrygo/divinesense/main/deploy/install.sh | sudo bash -s -- --mode=docker
Docker 快速测试
docker run -d --name divinesense \
  -p 5230:5230 \
  -v ~/.divinesense:/var/opt/divinesense \
  ghcr.io/hrygo/divinesense:stable

访问 http://localhost:5230

注意:生产环境部署需在云控制台开放安全组端口(默认 5230)


部署指南

部署模式对比
特性 Docker 模式 二进制模式
Geek Mode 支持 ⚠️ 需额外配置 ✅ 原生支持
Evolution Mode ❌ 不支持 ✅ 原生支持
资源占用 高(容器开销)
启动速度
适用场景 快速部署、测试 Geek Mode、生产环境
云服务器部署注意事项
  1. 安全组配置:安装后在控制台开放端口 5230
  2. 使用 80 端口:需配置 AmbientCapabilities=CAP_NET_BIND_SERVICE
  3. Nginx 反向代理:可选,用于域名绑定

详见:部署指南

本地开发
git clone https://github.com/hrygo/divinesense.git && cd divinesense
make deps-all && make start

访问 http://localhost:25173 。详见 贡献指南


技术架构

技术栈:Go 1.25 + React 18 + Vite 7 + PostgreSQL (pgvector) + Tailwind CSS 4

AI 模型

  • 对话 LLM:DeepSeek (deepseek-chat)
  • 向量 Embedding:SiliconFlow (BAAI/bge-m3, 1024维)
  • 意图分类:SiliconFlow (Qwen/Qwen2.5-7B-Instruct)
  • 重排 Rerank:SiliconFlow (BAAI/bge-reranker-v2-m3)

架构亮点

  • CC Runner:深度集成 Claude Code,通过 PTY 实现全双工交互与会话持久化
  • 单二进制分发:Go embed 打包前端静态资源,零依赖部署
  • Connect RPC:gRPC-HTTP 转码,类型安全的 API
  • Unified Block Model:AI 聊天对话持久化,支持流式渲染和会话恢复
  • 智能缓存层:LRU 缓存 + DeepSeek 上下文缓存,响应延迟 <1ms

详细架构系统架构文档


常见问题

Q: SQLite 和 PostgreSQL 有什么区别?

A: PostgreSQL 支持完整 AI 功能(对话、记忆、路由),SQLite 仅支持向量搜索(开发测试)

Q: Geek Mode 需要什么条件?

A: 需要安装 Claude Code CLI (npm install -g @anthropic-ai/claude-code) 并启用 DIVINESENSE_CLAUDE_CODE_ENABLED=true

Q: 如何备份数据?

A: 使用 /opt/divinesense/deploy-binary.sh backuppg_dump 导出数据库

Q: AI 功能是否必须联网?

A: 是的,AI 功能需要调用外部 API(DeepSeek/SiliconFlow),但所有数据存储在您的服务器


开发文档

文档 说明
系统架构 AI 代理、数据流、项目结构
后端开发 API、数据库、环境配置
前端开发 布局、组件、Tailwind 4
Chat Apps 指南 Telegram/钉钉机器人接入
Git 工作流 分支管理、PR 规范
贡献指南 入门必读:环境搭建、开发规范

安全与隐私

  • ✅ 无遥测、无数据上传
  • ✅ 所有数据存储在您的服务器
  • ✅ AES-256-GCM 加密(Chat Apps 凭证)
  • ✅ 支持离线部署(内网环境)

社区


更新日志

查看 CHANGELOG.md 了解版本历史


开源协议

MIT — 自由使用、修改和分发


致谢

本项目受到 memos 启发。

Directories

Path Synopsis
ai
agent
Package agent provides conversation context management for multi-turn dialogues.
Package agent provides conversation context management for multi-turn dialogues.
agent/registry
Package registry provides metrics collection for UniversalParrot.
Package registry provides metrics collection for UniversalParrot.
agent/tools
Package tools provides tool-level result caching for AI agents.
Package tools provides tool-level result caching for AI agents.
agent/universal
Package universal provides configuration loading for UniversalParrot.
Package universal provides configuration loading for UniversalParrot.
aitime
Package aitime provides the time parsing service interface for AI agents.
Package aitime provides the time parsing service interface for AI agents.
cache
Package cache provides the cache service interface for AI agents.
Package cache provides the cache service interface for AI agents.
context
Package context provides context building for LLM prompts.
Package context provides context building for LLM prompts.
duplicate
Package duplicate provides memo duplicate detection for P2-C002.
Package duplicate provides memo duplicate detection for P2-C002.
filter
Package filter provides optimized regex patterns for sensitive data detection.
Package filter provides optimized regex patterns for sensitive data detection.
genui
Package genui provides Generative UI components for AI agents.
Package genui provides Generative UI components for AI agents.
graph
Package graph - builder implementation for P3-C001.
Package graph - builder implementation for P3-C001.
habit
Package habit provides user habit learning and analysis for AI agents.
Package habit provides user habit learning and analysis for AI agents.
memory
Package memory provides the unified memory service interface for AI agents.
Package memory provides the unified memory service interface for AI agents.
metrics
Package metrics provides the evaluation metrics service interface for AI agents.
Package metrics provides the evaluation metrics service interface for AI agents.
prediction
Package prediction provides predictive interaction capabilities for AI agents.
Package prediction provides predictive interaction capabilities for AI agents.
preload
Package preload provides predictive cache preloading for AI operations.
Package preload provides predictive cache preloading for AI operations.
rag
Package rag provides Self-RAG optimization.
Package rag provides Self-RAG optimization.
reminder
Package reminder provides reminder management for schedules and todos.
Package reminder provides reminder management for schedules and todos.
review
Package review provides intelligent memo review system based on spaced repetition.
Package review provides intelligent memo review system based on spaced repetition.
router
Package router provides routing result caching for performance optimization.
Package router provides routing result caching for performance optimization.
schedule
Package schedule provides schedule-related AI agent utilities.
Package schedule provides schedule-related AI agent utilities.
session
Package session provides the session persistence service interface for AI agents.
Package session provides the session persistence service interface for AI agents.
stats
Package stats provides cost alerting for agent sessions.
Package stats provides cost alerting for agent sessions.
tags
Package tags provides intelligent tag suggestion for memos.
Package tags provides intelligent tag suggestion for memos.
timeout
Package timeout defines centralized timeout constants for AI operations.
Package timeout defines centralized timeout constants for AI operations.
tracing
Package tracing provides end-to-end request tracing for AI operations.
Package tracing provides end-to-end request tracing for AI operations.
cmd
divinesense command
internal
plugin
chat_apps
Package chat_apps provides multi-platform chat app integration for DivineSense.
Package chat_apps provides multi-platform chat app integration for DivineSense.
chat_apps/channels
Package channels provides the ChatChannel interface for all chat platform integrations.
Package channels provides the ChatChannel interface for all chat platform integrations.
chat_apps/channels/dingtalk
Package dingtalk provides cryptographic utilities for DingTalk.
Package dingtalk provides cryptographic utilities for DingTalk.
chat_apps/channels/telegram
Package telegram implements the Telegram Bot channel.
Package telegram implements the Telegram Bot channel.
chat_apps/channels/whatsapp
Package whatsapp implements WhatsApp integration via Baileys Node.js bridge.
Package whatsapp implements WhatsApp integration via Baileys Node.js bridge.
chat_apps/media
Package media provides multimedia processing for chat apps.
Package media provides multimedia processing for chat apps.
chat_apps/metrics
Package metrics provides webhook health monitoring for chat apps.
Package metrics provides webhook health monitoring for chat apps.
chat_apps/store
Package store provides cryptographic utilities for secure token storage.
Package store provides cryptographic utilities for secure token storage.
email
Package email provides SMTP email sending functionality for self-hosted DivineSense instances.
Package email provides SMTP email sending functionality for self-hosted DivineSense instances.
idp
idp/oauth2
Package oauth2 is the plugin for OAuth2 Identity Provider.
Package oauth2 is the plugin for OAuth2 Identity Provider.
ocr
Package ocr provides OCR (Optical Character Recognition) functionality using Tesseract.
Package ocr provides OCR (Optical Character Recognition) functionality using Tesseract.
scheduler
Package scheduler provides a GitHub Actions-inspired cron job scheduler.
Package scheduler provides a GitHub Actions-inspired cron job scheduler.
textextract
Package textextract provides full-text extraction functionality using Apache Tika.
Package textextract provides full-text extraction functionality using Apache Tika.
proto
gen/api/v1
Package apiv1 is a reverse proxy.
Package apiv1 is a reverse proxy.
auth
Package auth provides authentication and authorization for the DivineSense server.
Package auth provides authentication and authorization for the DivineSense server.
router/api/v1
Package v1 - duplicate detection handlers for P2-C002.
Package v1 - duplicate detection handlers for P2-C002.
runner/ocr
Package ocr provides a background runner for processing attachments with OCR and text extraction.
Package ocr provides a background runner for processing attachments with OCR and text extraction.
scheduler/rrule
Package rrule provides RRULE (Recurrence Rule) parsing and generation.
Package rrule provides RRULE (Recurrence Rule) parsing and generation.
scheduler/suggestion
Package suggestion provides intelligent schedule time suggestions.
Package suggestion provides intelligent schedule time suggestions.
service/memo
Package memo provides memo-related services including search highlighting.
Package memo provides memo-related services including search highlighting.
service/schedule
Package schedule provides schedule management functionality including creation, querying, updating, and deleting schedules with recurring event support.
Package schedule provides schedule management functionality including creation, querying, updating, and deleting schedules with recurring event support.
stats
Package stats provides simple local usage statistics for personal assistant systems.
Package stats provides simple local usage statistics for personal assistant systems.
timezone
Package timezone provides timezone utilities for the DivineSense application.
Package timezone provides timezone utilities for the DivineSense application.
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL