ex-brain 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,95 +1,145 @@
1
1
  # ex-brain
2
2
 
3
- CLI 个人知识库,基于 [seekdb](https://docs.seekdb.ai/) 构建,支持页面管理、混合检索、时间线、标签、导入导出与 MCP Server
3
+ CLI personal knowledge base built on [seekdb](https://docs.seekdb.ai/), featuring page management, hybrid search, timelines, tags, import/export, and MCP Server.
4
4
 
5
- ## 核心功能
5
+ ## Core Features
6
6
 
7
- - **知识图谱可视化** - 交互式图谱,展示实体关联关系
8
- - **智能编译** - 语义分析,智能更新 Compiled Truth
9
- - **时间线管理** - 自动提取事件,记录历史演变
10
- - **混合检索** - 全文搜索 + 向量语义查询
11
- - **实体链接** - 自动识别实体,创建关联页面
7
+ - **Knowledge Graph Visualization** - Interactive graph showing entity relationships
8
+ - **Intelligent Compilation** - Semantic analysis with smart Compiled Truth updates
9
+ - **Timeline Management** - Automatic event extraction and history tracking
10
+ - **Hybrid Search** - Full-text search + vector semantic queries
11
+ - **Entity Linking** - Auto-detect entities and create linked pages
12
12
 
13
- ## 数据采集
13
+ <img src="https://mdn.alipayobjects.com/huamei_ytl0i7/afts/img/A*TqdfTZ-yCPwAAAAAgBAAAAgAejCYAQ/original" width="800">
14
14
 
15
- 推荐使用 [MarkSnip](https://chromewebstore.google.com/detail/kcbaglhfgbkjdnpeokaamjjkddempipm) 作为数据采集工具:
15
+ ## Data Collection
16
16
 
17
- - 一键剪藏网页为 Markdown 格式
18
- - 支持代码块、表格、数学公式
19
- - 本地处理,隐私友好
20
- - 支持 Obsidian 集成
17
+ We recommend [MarkSnip](https://chromewebstore.google.com/detail/kcbaglhfgbkjdnpeokaamjjkddempipm) for data collection:
21
18
 
22
- 配合 ex-brain 使用:
19
+ - One-click web clipping to Markdown format
20
+ - Supports code blocks, tables, math formulas
21
+ - Local processing, privacy-friendly
22
+ - Obsidian integration support
23
+
24
+ Use with ex-brain:
23
25
 
24
26
  ```bash
25
- # MarkSnip 剪藏后,导入到知识库
27
+ # After clipping with MarkSnip, import to knowledge base
26
28
  cat article.md | ebrain put articles/slug --stdin
27
29
 
28
- # 或智能编译
30
+ # Or intelligent compilation
29
31
  ebrain compile companies/river-ai --file article.md --source web_clip
30
32
  ```
31
33
 
32
- ## 安装
34
+ ## Installation
33
35
 
34
36
  ```bash
35
- # 全局安装(需要 Bun Node.js
37
+ # Global installation (requires Bun or Node.js)
36
38
  bun install -g ex-brain
37
- #
39
+ # or
38
40
  npm install -g ex-brain
39
41
 
40
42
  ebrain --help
41
43
  ```
42
44
 
43
- ## 快速开始
45
+ ## Quick Start
44
46
 
45
47
  ```bash
46
- # 初始化(自动创建 ~/.ebrain/data/ebrain.db
48
+ # Initialize (creates ~/.ebrain/data/ebrain.db automatically)
47
49
  ebrain init
48
50
 
49
- # 写入页面
51
+ # Write a page
50
52
  ebrain put my/note --file note.md
51
53
 
52
- # 知识图谱可视化
53
- ebrain graph # 启动图谱 Web UI (http://localhost:3000)
54
- ebrain graph --port 8080 --open # 指定端口并自动打开浏览器
54
+ # Knowledge graph visualization
55
+ ebrain graph # Start graph Web UI (http://localhost:3000)
56
+ ebrain graph --port 8080 --open # Custom port and auto-open browser
55
57
 
56
- # 智能编译新信息
58
+ # Intelligently compile new information
57
59
  ebrain compile companies/river-ai "River AI completed Series A funding" --source meeting_notes
58
60
 
59
- # 从页面提取时间线事件
61
+ # Extract timeline events from a page
60
62
  ebrain timeline extract companies/river-ai
61
63
 
62
- # 检索
63
- ebrain search "某主题"
64
- ebrain query "某问题"
64
+ # Search
65
+ ebrain search "some topic"
66
+ ebrain query "some question"
67
+
68
+ # AI-powered Q&A with LLM (RAG)
69
+ ebrain query --llm "What is the main idea of River AI's product?"
70
+ ebrain query --llm "What are Mario Zechner's main views on game development?"
71
+
72
+ # Smart ingest: compile + timeline + entity links in one command
73
+ ebrain smart-ingest companies/river-ai --file article.md
65
74
 
66
- # 启动 MCP Server(供 AI 工具调用)
75
+ # Start MCP Server (for AI tool integration)
67
76
  ebrain serve
68
77
  ```
69
78
 
70
- ## 配置
79
+ ## Configuration
71
80
 
72
- 编辑 `~/.ebrain/settings.json`:
81
+ Edit `~/.ebrain/settings.json`:
73
82
 
74
83
  ```jsonc
75
84
  {
76
85
  "db": { "path": "~/.ebrain/data/ebrain.db" },
77
86
  "embed": {
78
- "provider": "hash", // "openai_compatible"
87
+ "provider": "hash", // or "openai_compatible"
79
88
  "baseURL": "...",
80
89
  "model": "...",
81
90
  "dimensions": 1024,
82
91
  "apiKey": "sk-..."
92
+ },
93
+ "llm": {
94
+ "baseURL": "https://dashscope.aliyuncs.com/compatible-mode/v1",
95
+ "model": "qwen-plus",
96
+ "apiKey": "sk-..."
97
+ },
98
+ "extraction": {
99
+ "confidenceThreshold": 0.7 // Entity extraction confidence (0~1)
83
100
  }
84
101
  }
85
102
  ```
86
103
 
87
- 运行 `ebrain config` 查看当前生效配置。详见 [docs/ebrain-cli.md](docs/ebrain-cli.md)
104
+ Run `ebrain config` to view active configuration. See [docs/ebrain-cli.md](docs/ebrain-cli.md) for details.
105
+
106
+ ## AI Q&A (RAG)
107
+
108
+ Ask natural language questions and get answers based on your knowledge base:
109
+
110
+ ```bash
111
+ # Basic Q&A
112
+ ex-brain query --llm "What is the main idea of River AI's product?"
113
+
114
+ # Control context depth
115
+ ebrain query --llm "What happened in Q4?" --context-limit 3
116
+ ```
117
+
118
+ How it works:
119
+
120
+ 1. **Semantic Search** — Finds top matching pages for your question
121
+ 2. **Multi-Layer Context Collection** — Builds rich context from:
122
+ - **Page Content** — Compiled truth + timeline for each matched page
123
+ - **Raw Documents** — Original imported documents (via `raw set`)
124
+ - **Linked Pages** — Incoming and outgoing linked pages, filtered by semantic relevance to the question
125
+ 3. **LLM Synthesis** — Generates a sourced answer with `[[slug|title]]` citations
126
+
127
+ Configure LLM in `~/.ebrain/settings.json`:
128
+
129
+ ```json
130
+ {
131
+ "llm": {
132
+ "baseURL": "https://dashscope.aliyuncs.com/compatible-mode/v1",
133
+ "model": "qwen-plus",
134
+ "apiKey": "sk-..."
135
+ }
136
+ }
137
+ ```
88
138
 
89
- ## 开发
139
+ ## Development
90
140
 
91
141
  ```bash
92
142
  bun install
93
143
  bun run src/cli.ts --help
94
144
  bun test
95
- ```
145
+ ```
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "ex-brain",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI personal knowledge base powered by seekdb",
5
- "main": "dist/cli.js",
5
+ "module": "src/cli.ts",
6
6
  "type": "module",
7
7
  "bin": {
8
- "ebrain": "dist/cli.js"
8
+ "ebrain": "src/cli.ts"
9
9
  },
10
10
  "files": [
11
- "dist",
12
- "README.md"
11
+ "src",
12
+ "!src/**/*.test.ts"
13
13
  ],
14
14
  "scripts": {
15
15
  "dev": "bun run src/cli.ts",
@@ -29,6 +29,7 @@
29
29
  "@seekdb/openai": "1.2.0",
30
30
  "commander": "^14.0.3",
31
31
  "gray-matter": "^4.0.3",
32
+ "jsonrepair": "^3.13.3",
32
33
  "pinyin-pro": "^3.28.0",
33
34
  "seekdb": "^1.2.0",
34
35
  "yaml": "^2.8.3",