derekinside 0.7.0__tar.gz
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.
- derekinside-0.7.0/LICENSE +21 -0
- derekinside-0.7.0/PKG-INFO +406 -0
- derekinside-0.7.0/README.md +363 -0
- derekinside-0.7.0/pyproject.toml +89 -0
- derekinside-0.7.0/setup.cfg +4 -0
- derekinside-0.7.0/src/derekinside/__init__.py +5 -0
- derekinside-0.7.0/src/derekinside/bridge/__init__.py +16 -0
- derekinside-0.7.0/src/derekinside/bridge/agent_store.py +106 -0
- derekinside-0.7.0/src/derekinside/bridge/auth.py +43 -0
- derekinside-0.7.0/src/derekinside/bridge/http.py +495 -0
- derekinside-0.7.0/src/derekinside/bridge/mcp.py +566 -0
- derekinside-0.7.0/src/derekinside/cli.py +1145 -0
- derekinside-0.7.0/src/derekinside/config.py +282 -0
- derekinside-0.7.0/src/derekinside/context/__init__.py +5 -0
- derekinside-0.7.0/src/derekinside/context/gate.py +240 -0
- derekinside-0.7.0/src/derekinside/drivers/__init__.py +4 -0
- derekinside-0.7.0/src/derekinside/drivers/ollama.py +262 -0
- derekinside-0.7.0/src/derekinside/drivers/openai.py +242 -0
- derekinside-0.7.0/src/derekinside/drivers/vllm.py +86 -0
- derekinside-0.7.0/src/derekinside/engine/__init__.py +6 -0
- derekinside-0.7.0/src/derekinside/engine/engine.py +193 -0
- derekinside-0.7.0/src/derekinside/engine/model.py +217 -0
- derekinside-0.7.0/src/derekinside/engine/pipeline.py +188 -0
- derekinside-0.7.0/src/derekinside/engine/profiler.py +467 -0
- derekinside-0.7.0/src/derekinside/engine/registry.py +158 -0
- derekinside-0.7.0/src/derekinside/indexer/__init__.py +19 -0
- derekinside-0.7.0/src/derekinside/indexer/chunker.py +330 -0
- derekinside-0.7.0/src/derekinside/indexer/classifier.py +188 -0
- derekinside-0.7.0/src/derekinside/indexer/consensus.py +283 -0
- derekinside-0.7.0/src/derekinside/indexer/embedder.py +78 -0
- derekinside-0.7.0/src/derekinside/indexer/enricher.py +161 -0
- derekinside-0.7.0/src/derekinside/indexer/entity.py +642 -0
- derekinside-0.7.0/src/derekinside/indexer/entity_resolver.py +220 -0
- derekinside-0.7.0/src/derekinside/indexer/fusion.py +229 -0
- derekinside-0.7.0/src/derekinside/indexer/graph_pruner.py +269 -0
- derekinside-0.7.0/src/derekinside/indexer/merge.py +106 -0
- derekinside-0.7.0/src/derekinside/indexer/relation_inferrer.py +417 -0
- derekinside-0.7.0/src/derekinside/search/__init__.py +13 -0
- derekinside-0.7.0/src/derekinside/search/hybrid.py +84 -0
- derekinside-0.7.0/src/derekinside/search/propagation.py +176 -0
- derekinside-0.7.0/src/derekinside/search/reranker.py +115 -0
- derekinside-0.7.0/src/derekinside/storage/__init__.py +25 -0
- derekinside-0.7.0/src/derekinside/storage/facts.py +262 -0
- derekinside-0.7.0/src/derekinside/storage/graph.py +469 -0
- derekinside-0.7.0/src/derekinside/storage/pgvector.py +648 -0
- derekinside-0.7.0/src/derekinside/storage/subgraph.py +193 -0
- derekinside-0.7.0/src/derekinside/sync/__init__.py +9 -0
- derekinside-0.7.0/src/derekinside/sync/engine.py +273 -0
- derekinside-0.7.0/src/derekinside.egg-info/PKG-INFO +406 -0
- derekinside-0.7.0/src/derekinside.egg-info/SOURCES.txt +82 -0
- derekinside-0.7.0/src/derekinside.egg-info/dependency_links.txt +1 -0
- derekinside-0.7.0/src/derekinside.egg-info/entry_points.txt +2 -0
- derekinside-0.7.0/src/derekinside.egg-info/requires.txt +21 -0
- derekinside-0.7.0/src/derekinside.egg-info/top_level.txt +1 -0
- derekinside-0.7.0/tests/test_agent_store.py +187 -0
- derekinside-0.7.0/tests/test_classifier.py +116 -0
- derekinside-0.7.0/tests/test_consensus.py +275 -0
- derekinside-0.7.0/tests/test_context.py +295 -0
- derekinside-0.7.0/tests/test_drivers.py +336 -0
- derekinside-0.7.0/tests/test_embedder.py +151 -0
- derekinside-0.7.0/tests/test_engine_lazy.py +121 -0
- derekinside-0.7.0/tests/test_enricher.py +274 -0
- derekinside-0.7.0/tests/test_entity.py +362 -0
- derekinside-0.7.0/tests/test_entity_resolver.py +113 -0
- derekinside-0.7.0/tests/test_facts.py +228 -0
- derekinside-0.7.0/tests/test_fusion.py +198 -0
- derekinside-0.7.0/tests/test_graph.py +343 -0
- derekinside-0.7.0/tests/test_graph_pruner.py +165 -0
- derekinside-0.7.0/tests/test_hybrid.py +112 -0
- derekinside-0.7.0/tests/test_integration.py +331 -0
- derekinside-0.7.0/tests/test_merge.py +91 -0
- derekinside-0.7.0/tests/test_model_registry.py +191 -0
- derekinside-0.7.0/tests/test_pg_integration.py +201 -0
- derekinside-0.7.0/tests/test_phase1.py +137 -0
- derekinside-0.7.0/tests/test_phase2.py +164 -0
- derekinside-0.7.0/tests/test_phase3.py +69 -0
- derekinside-0.7.0/tests/test_profiler.py +252 -0
- derekinside-0.7.0/tests/test_propagation.py +104 -0
- derekinside-0.7.0/tests/test_relation_inferrer.py +250 -0
- derekinside-0.7.0/tests/test_reranker.py +131 -0
- derekinside-0.7.0/tests/test_subgraph.py +121 -0
- derekinside-0.7.0/tests/test_sync.py +52 -0
- derekinside-0.7.0/tests/test_sync_engine.py +210 -0
- derekinside-0.7.0/tests/test_track_a.py +171 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 derekwang85
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: derekinside
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Local-first AI knowledge system — multi-model entity extraction, knowledge graph, self-learning consensus, constraint-solving pipeline
|
|
5
|
+
Author-email: aITMS01 <aitms01@derekinside.dev>, Derek Wang <derek@derekinside.dev>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/derekwang85/derekinside
|
|
8
|
+
Project-URL: Repository, https://github.com/derekwang85/derekinside
|
|
9
|
+
Project-URL: Documentation, https://github.com/derekwang85/derekinside#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/derekwang85/derekinside/issues
|
|
11
|
+
Keywords: knowledge-graph,rag,entity-extraction,ai-memory,local-ai,agent-memory
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Requires-Dist: python-dateutil>=2.8
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: httpx>=0.27
|
|
29
|
+
Requires-Dist: click>=8.0
|
|
30
|
+
Requires-Dist: psycopg[binary]>=3.1
|
|
31
|
+
Provides-Extra: pgvector
|
|
32
|
+
Requires-Dist: psycopg-pool>=3.1; extra == "pgvector"
|
|
33
|
+
Provides-Extra: ollama
|
|
34
|
+
Requires-Dist: httpx>=0.27; extra == "ollama"
|
|
35
|
+
Provides-Extra: http
|
|
36
|
+
Requires-Dist: fastapi>=0.100; extra == "http"
|
|
37
|
+
Requires-Dist: uvicorn>=0.24; extra == "http"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff>=0.15; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT">
|
|
46
|
+
<img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python 3.10+">
|
|
47
|
+
<img src="https://img.shields.io/badge/version-0.7.0-blue" alt="Version">
|
|
48
|
+
<img src="https://img.shields.io/github/actions/workflow/status/derekwang85/derekinside/ci.yml?label=CI" alt="CI">
|
|
49
|
+
<img src="https://img.shields.io/badge/coverage-65%25-green" alt="Coverage">
|
|
50
|
+
<img src="https://img.shields.io/github/stars/derekwang85/derekinside" alt="Stars">
|
|
51
|
+
<img src="https://img.shields.io/github/last-commit/derekwang85/derekinside" alt="Last Commit">
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<h1 align="center">🧠 DereInside</h1>
|
|
55
|
+
<p align="center"><em>Know your project from the inside out. / 由内而外地了解你的项目。</em></p>
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<strong>Local-first · Multi-model · Self-learning · Agent-native</strong>
|
|
59
|
+
<br>
|
|
60
|
+
The AI knowledge system that <strong>understands your code</strong> — not just retrieves it.
|
|
61
|
+
<br>
|
|
62
|
+
理解你的代码的 AI 知识系统 —— 而不只是检索它。
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🆕 Latest Updates
|
|
68
|
+
|
|
69
|
+
> **v0.7.0** — 正式发布到 PyPI + ghcr.io:50K star 路线图阶段 0 全部技术准备就绪
|
|
70
|
+
|
|
71
|
+
- **🚀 正式发布** — 首个可安装发布:`pip install derekinside`,多架构 Docker 镜像(ghcr.io),GitHub Release 自动草拟。
|
|
72
|
+
- **📦 发布流水线 (c7/c8)** — `release.yml`:tag 触发 → verify → build → PyPI(Trusted Publishing/OIDC)→ Docker(buildx 多架构)→ 草拟 Release。
|
|
73
|
+
- **🏛️ 规约体系文档完整性补全 (d1-d3)** — ADR-002 / everos-analysis.md / user_profile.md 补齐,全项目引用零断链;新增阶段 0 发布检查清单。
|
|
74
|
+
- **🗺️ 50K star 执行进度同步 (d4-d5)** — 路线图报告新增「执行进度总览」,完成状态统一标注。
|
|
75
|
+
|
|
76
|
+
> **v0.6.0** — 规约体系 + sync/fact 图谱 + ContextGate 上下文门禁 + EverOS 裁决
|
|
77
|
+
|
|
78
|
+
- **🏗️ Model Registry (Track A)** — 6+ 可插拔模型端点(Ollama / vLLM / OpenAI / FreeCode / MiniMax),四维画像自动探测(capabilities × intelligence × cost × speed × quality)。
|
|
79
|
+
- **🧩 Constraint-Solving Pipeline** — 不是线性 fallback,而是多维约束求解器:按智能/成本/延迟过滤、按目标排序、优雅降级。
|
|
80
|
+
- **🔄 Self-Learning Consensus** — 多模型交叉验证,自动拒绝噪音实体。
|
|
81
|
+
- **🧬 Knowledge Graph 爆炸增长** — 生产知识图谱实体 5,485 个(7.9x),链接 10,817 个(7.6x)。
|
|
82
|
+
- **📊 评测可复现 (c5)** — 新增 `long_mem_eval.py --offline` 确定性离线基线(7 样本 / 48 实体,P 92.9% · R 27.7% · F1 0.426),无 DB/LLM 即可复现。
|
|
83
|
+
- **🧪 CI 强化 (c2/c3)** — ruff 全量+格式门禁、离线套件 coverage 门禁(63%)、真实 PostgreSQL service job(pgvector 集成测试 8/8),离线单测 363 项全绿。
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 🏆 Why DereInside?
|
|
88
|
+
|
|
89
|
+
Most "AI knowledge" tools are black boxes. One embedding model. One pipeline. One size fits nobody.
|
|
90
|
+
|
|
91
|
+
**DereInside is different.** It's a **multi-model cognitive engine** — not a vector database with a chat wrapper.
|
|
92
|
+
|
|
93
|
+
| What others do | What DereInside does |
|
|
94
|
+
|:--------------|:--------------------|
|
|
95
|
+
| One embedding model for everything | **6 interchangeable models**, auto-switched by content type |
|
|
96
|
+
| Fixed pipeline, no tuning | **Constraint-solving pipeline** — define what you need (intelligence × cost × speed), the system selects the best model |
|
|
97
|
+
| Black-box evaluation | **Quantified public benchmarks** (LongMemEval) — every mode has measurable precision/recall/F1 |
|
|
98
|
+
| Manual prompt engineering | **Self-learning consensus** — multiple models cross-validate each other, automatically rejecting noise |
|
|
99
|
+
| Tool-specific lock-in (Ollama only) | **Open provider architecture** — Ollama / vLLM / OpenAI / FreeCode / MiniMax / any OpenAI-compatible endpoint |
|
|
100
|
+
| Static knowledge | **Living knowledge graph** — entities, relations, cross-Wing fusion, temporal decay |
|
|
101
|
+
| Cloud-dependent | **Zero-cloud optional** — runs on a Raspberry Pi 4; GPU optional, not required |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🧬 Architecture — Designed, Not Patched
|
|
106
|
+
|
|
107
|
+
DereInside's architecture is the result of **deliberate engineering**, not organic growth. Every layer was designed to solve a real constraint:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
┌─────────────────────┐
|
|
111
|
+
│ Model Registry │
|
|
112
|
+
│ 6+ model endpoints │
|
|
113
|
+
│ (Ollama/vLLM/OpenAI) │
|
|
114
|
+
└──────┬──────────────┘
|
|
115
|
+
│
|
|
116
|
+
┌─────────────┼─────────────┐
|
|
117
|
+
▼ ▼ ▼
|
|
118
|
+
┌────────────┐ ┌──────────┐ ┌──────────┐
|
|
119
|
+
│ Embedding │ │Extraction│ │ Rerank │
|
|
120
|
+
│ Pipeline │ │Pipeline │ │ Pipeline │
|
|
121
|
+
└──────┬─────┘ └────┬─────┘ └────┬─────┘
|
|
122
|
+
│ │ │
|
|
123
|
+
▼ ▼ ▼
|
|
124
|
+
┌──────────────────────────────────────┐
|
|
125
|
+
│ Constraint Solver │
|
|
126
|
+
│ Filter: intel × cost × latency │
|
|
127
|
+
│ Rank: quality / speed / cost │
|
|
128
|
+
│ Relax: graceful degradation │
|
|
129
|
+
└──────────────────────────────────────┘
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 🎯 Model Registry — First-Class Models, Not Plumbing
|
|
133
|
+
|
|
134
|
+
Every AI endpoint is a **first-class citizen** with a **four-dimensional profile**:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
models:
|
|
138
|
+
qwen-7b:
|
|
139
|
+
driver: ollama # Transport: Ollama
|
|
140
|
+
capabilities: [extract, rerank] # What it can do
|
|
141
|
+
intelligence: high # How smart it is
|
|
142
|
+
cost_tier: free # What it costs
|
|
143
|
+
speed_tier: slow # How fast it runs
|
|
144
|
+
quality: high # Output quality
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This means you can **swap providers without changing code**. In production? Switch from Ollama to vLLM for GPU acceleration. API budget available? Add OpenAI as a fallback. Using FreeCode's free tier? Add it in one line — the system auto-profles its capabilities.
|
|
148
|
+
|
|
149
|
+
### 🔄 Pipeline Resolver — Constraint Solving, Not Fallback Chains
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
pipeline:
|
|
153
|
+
extract:
|
|
154
|
+
requires:
|
|
155
|
+
min_intelligence: low # Only smart enough models
|
|
156
|
+
max_cost: free # Only free models
|
|
157
|
+
max_latency_ms: 10000 # Under 10 seconds
|
|
158
|
+
objective: optimize_quality
|
|
159
|
+
candidates:
|
|
160
|
+
- qwen-7b # High quality, free
|
|
161
|
+
- qwen-1.5b # Faster fallback
|
|
162
|
+
- gpt-4o-mini # ❌ Excluded: paid
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Not a linear "try A then B then C" — a **multi-dimensional constraint solver**:
|
|
166
|
+
- Filters by intelligence requirement
|
|
167
|
+
- Filters by cost budget
|
|
168
|
+
- Filters by latency ceiling
|
|
169
|
+
- Checks model health
|
|
170
|
+
- Ranks by objective (quality / speed / cost)
|
|
171
|
+
- **Relaxes constraints gracefully** when no model matches, with clear logging
|
|
172
|
+
|
|
173
|
+
### 🧪 Model Profiler — Zero-Conf Auto-Detection
|
|
174
|
+
|
|
175
|
+
Users shouldn't need to know their model's specs. DereInside **probes models automatically**:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
class ModelProfiler:
|
|
179
|
+
# Golden data from LongMemEval — zero external API cost
|
|
180
|
+
SMOKE_SET = [3 samples, ~2s] # Boot positioning
|
|
181
|
+
FULL_SET = [15 samples, ~10s] # Deep benchmark
|
|
182
|
+
|
|
183
|
+
def profile(self, model) -> ModelProfile:
|
|
184
|
+
return ModelProfile(
|
|
185
|
+
capabilities=self._detect_capabilities(model), # What can it do?
|
|
186
|
+
intelligence=self._measure_intelligence(model), # How smart?
|
|
187
|
+
speed=self._measure_speed(model), # How fast?
|
|
188
|
+
quality=self._measure_quality(model), # How accurate?
|
|
189
|
+
cost_tier=self._guess_cost(model), # How expensive?
|
|
190
|
+
)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Passive observer**: runtime metrics (latency, entity count, error rate) collected as zero-cost side effects. When it detects anomalies — latency doubling, entity count dropping — it triggers a re-profle automatically.
|
|
194
|
+
|
|
195
|
+
**Oscillation detection**: if a FreeCode model keeps changing, profle freezes after 3 probes and alerts instead of chasing instability.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 🧠 Self-Learning Consensus
|
|
200
|
+
|
|
201
|
+
DereInside doesn't trust a single model. It **cross-validates across multiple extraction modes**:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Chunk: "class OrderService extends BaseService { @Autowired ... }"
|
|
205
|
+
|
|
206
|
+
regex → {OrderService, BaseService} (精95.6%)
|
|
207
|
+
hybrid-7b → {OrderService, BaseService, ...} (精77.4%)
|
|
208
|
+
1.5b → {OrderService, BaseService, Autowired} (高召回, 有噪音)
|
|
209
|
+
|
|
210
|
+
ConsensusEngine:
|
|
211
|
+
OrderService 3/3 → confirmed (weight=1.0) ✓
|
|
212
|
+
BaseService 3/3 → confirmed (weight=1.0) ✓
|
|
213
|
+
Autowired 1/3 → rejected (weight=0.0) ✗ (噪音: 非实体)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Result**: noise rejection improves with each extraction run. After 3 full cycles on a 2,467-chunk codebase, estimated noise drops from ~28% to ~10%.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 🏗️ Knowledge Graph — Rich, Clean, Connected
|
|
221
|
+
|
|
222
|
+
DereInside builds a knowledge graph that understands **relationships**, not just keywords:
|
|
223
|
+
|
|
224
|
+
| Relation | Source | Semantics |
|
|
225
|
+
|:---------|:-------|:----------|
|
|
226
|
+
| `OrderService` → `BaseService` | `class OrderService extends BaseService` | **extends** |
|
|
227
|
+
| `KYCController` → `/api/kyc/submit` | `@PostMapping("/api/kyc/submit")` | **serves_path** |
|
|
228
|
+
| `AuditService` → `AuditLogRepository` | `@Autowired` | **depends_on** |
|
|
229
|
+
| `TradeEntity` ↔ `PositionService` | Field declaration | **has_field** |
|
|
230
|
+
| `KYCApplication` → (merged) `KYC申请` | Entity resolution | **alias** |
|
|
231
|
+
|
|
232
|
+
**Entity resolution** automatically merges:
|
|
233
|
+
- `KYCApplication` = `kycapplication` = `KYC 申请` (alias dict)
|
|
234
|
+
- `AuditServiceImpl` → `AuditService` (suffix stripping)
|
|
235
|
+
- Cross-wing duplicates → automatic fusion
|
|
236
|
+
|
|
237
|
+
**Subgraph queries** traverse the graph:
|
|
238
|
+
```bash
|
|
239
|
+
derekinside graph subgraph "KYC" --depth 2 --ascii
|
|
240
|
+
# → 🔍 KYC (concept)
|
|
241
|
+
# ├─ KYCApplication (class) ← depends_on
|
|
242
|
+
# ├─ KYCController (class) ← serves_path: /api/kyc/submit
|
|
243
|
+
# ├─ 合同审批流程 (concept) ← related
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 📊 Quantified — Not Hype
|
|
249
|
+
|
|
250
|
+
Every extraction mode is benchmarked on **LongMemEval** with human-annotated ground truth. The **offline fixed-corpus baseline** is fully deterministic and reproducible on any machine (no DB or LLM required), so you always get the same numbers:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
python3 scripts/long_mem_eval.py --offline
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
| Mode | Corpus | Precision | Recall | F1 | Uses |
|
|
257
|
+
|:-----|:------:|:--------:|:------:|:--:|:-----|
|
|
258
|
+
| **regex (offline)** | 7 samples / 48 entities | **92.9%** | 27.7% | **0.426** | Code entities |
|
|
259
|
+
| **hybrid-1.5b / 7B** | requires local ollama | — | — | — | General purpose |
|
|
260
|
+
|
|
261
|
+
> LLM/hybrid comparison (1.5B / 7B) runs in the `qwen2.5-coder` mode against your local ollama endpoint. Run the same script **without** `--offline` against a populated database to reproduce the full 100-chunk comparison on your own data.
|
|
262
|
+
|
|
263
|
+
**Smart Dispatch** automatically selects the right mode per chunk:
|
|
264
|
+
```
|
|
265
|
+
.cjava/.py → regex (精92.9%)
|
|
266
|
+
.md/.txt → hybrid-1.5b (needs local ollama)
|
|
267
|
+
.xml/.sql → 1.5b (needs local ollama)
|
|
268
|
+
.log → skip (0s)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Result: **2,467 chunks reduced from 5h26m to ~1.5h** with weighted F1 improvement of ~15%.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 🏭 Production Profile (as of June 2026)
|
|
276
|
+
|
|
277
|
+
DereInside is running in production powering the aITMS01 engineering workflow:
|
|
278
|
+
|
|
279
|
+
| Metric | Value | Growth |
|
|
280
|
+
|:-------|:-----:|:------:|
|
|
281
|
+
| **Wings** (knowledge domains) | **21** | +50% from launch |
|
|
282
|
+
| **Rooms** (sub-domains) | **54** | +20% |
|
|
283
|
+
| **Pages** (ingested) | **599** | +8% |
|
|
284
|
+
| **Chunks** (indexed) | **2,931** | +11%, 100% embedded |
|
|
285
|
+
| **Knowledge Graph Entities** | **5,485** | **7.9x** |
|
|
286
|
+
| **Knowledge Graph Links** | **10,817** | **7.6x** |
|
|
287
|
+
|
|
288
|
+
The knowledge graph explosion (7.9x entities, 7.6x links) is the direct result of the Model Registry + constraint-solving pipeline — the system now discovers relationships across code, documents, and conversations that were invisible under the old single-model architecture.
|
|
289
|
+
|
|
290
|
+
**What this means in practice:**
|
|
291
|
+
- Zero cloud dependency — runs on a single VM with PostgreSQL
|
|
292
|
+
- All embeddings, extractions, and graph operations local
|
|
293
|
+
- API response < 200ms for search queries
|
|
294
|
+
- Full re-index of 2,931 chunks completes in ~1.5h (was 5h26m before smart dispatch)
|
|
295
|
+
- Agent-native: MCP server provides structured context to sub-agents at spawn time
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## ⚡ Quick Start
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Install
|
|
303
|
+
pip install derekinside
|
|
304
|
+
|
|
305
|
+
# Ingest your project
|
|
306
|
+
derekinside mine ~/TradeOMS --wing=tradeoms
|
|
307
|
+
|
|
308
|
+
# Build the knowledge graph
|
|
309
|
+
derekinside graph build
|
|
310
|
+
|
|
311
|
+
# Search
|
|
312
|
+
derekinside search "KYC approval flow"
|
|
313
|
+
|
|
314
|
+
# Serve as API for AI agents
|
|
315
|
+
derekinside serve --mode http --port 18890
|
|
316
|
+
|
|
317
|
+
# Explore the graph
|
|
318
|
+
derekinside graph subgraph "OrderService" --depth 2 --ascii
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### MCP Integration (AI Agent ready)
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
# Your AI agent gets persistent memory via MCP
|
|
325
|
+
from mcp import ClientSession
|
|
326
|
+
|
|
327
|
+
session = ClientSession("http://localhost:18890")
|
|
328
|
+
context = session.query("What is the KYC process?")
|
|
329
|
+
# → Returns entities, relations, and ranked chunks
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## 🛣️ Roadmap
|
|
335
|
+
|
|
336
|
+
| Phase | Status | What |
|
|
337
|
+
|:------|:------:|:-----|
|
|
338
|
+
| **Phase 0** | ✅ | gbrain → DereInside migration |
|
|
339
|
+
| **Phase 1-2** | ✅ | Hierarchical indexes + knowledge graph |
|
|
340
|
+
| **Phase 2.5** | ✅ | 5-mode extraction + LongMemEval benchmarks |
|
|
341
|
+
| **Phase 3** | ✅ | MCP server + HTTP bridge + per-agent isolation |
|
|
342
|
+
| **Track A** | ✅ | **Model Registry + Pipeline + Profiler** — architectural overhaul |
|
|
343
|
+
| **Track B** | ✅ | Smart dispatch, Consensus self-learning, Cross-wing fusion, Temporal decay |
|
|
344
|
+
| **Track C** | ✅ | Relation inferrer, Entity resolution, Graph pruning, Enrichment, Subgraph |
|
|
345
|
+
| **Phase 4** | 🚧 | Multi-model ensemble + Agent-native context gate |
|
|
346
|
+
| **Phase 5** | 📋 | Web UI dashboard + collaborative annotations |
|
|
347
|
+
| **Phase 6** | 📋 | Fleet learning — share profles across instances |
|
|
348
|
+
| **EverOS Merger** | 📋 | Evaluate EverOS integration (see [RFC-0002](docs/rfcs/0002-everos-merge.md)) |
|
|
349
|
+
| **Fact Logging** | 📋 | Cross-Agent shared memory (see [RFC-0001](docs/rfcs/0001-fact-logging.md)) |
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## 🤝 Contributing
|
|
354
|
+
|
|
355
|
+
We're building something that matters. If you share the vision:
|
|
356
|
+
|
|
357
|
+
- **Code contributors**: See [CONTRIBUTING.md](CONTRIBUTING.md) — we welcome PRs
|
|
358
|
+
- **Testers**: Run LongMemEval on your own data and share results
|
|
359
|
+
- **Feedback**: Open an issue or start a discussion
|
|
360
|
+
- **Sponsors**: Reach out if DereInside saves your team time
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 📜 License
|
|
365
|
+
|
|
366
|
+
MIT — free for any use, commercial or otherwise.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
<details>
|
|
371
|
+
<summary>🌏 中文简介 / Chinese Overview</summary>
|
|
372
|
+
|
|
373
|
+
### DereInside 是什么?
|
|
374
|
+
|
|
375
|
+
一个 **本地优先 · 多模型 · 自学习 · 面向智能体(Agent)** 的 AI 代码知识系统。区别于"向量数据库 + 聊天外壳",DereInside 是一台**多模型认知引擎**:
|
|
376
|
+
|
|
377
|
+
- **多模型注册表**:6+ 可插拔模型端点(Ollama / vLLM / OpenAI / FreeCode / MiniMax 等),按内容类型自动切换。
|
|
378
|
+
- **约束求解流水线**:代码里声明需要的智能度 × 成本 × 速度,系统自动挑选最优模型,而非"先试 A 再试 B"的线性回退。
|
|
379
|
+
- **自学习共识**:多个模型互相校验,自动剔除噪音实体,错误率随运行次数下降。
|
|
380
|
+
- **活的知识图谱**:实体、关系、跨 Wing 融合、时间衰减——不只存关键词,还理解"谁依赖谁、谁提供什么接口"。
|
|
381
|
+
- **零云端可选**:在树莓派 4 上也能跑,GPU 可选、非必需。
|
|
382
|
+
- **评测可复现**:离线确定性基线让你在任何机器上得到完全相同的精确率/召回率/F1 数值。
|
|
383
|
+
|
|
384
|
+
### 快速上手
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
pip install derekinside
|
|
388
|
+
derekinside mine ~/TradeOMS --wing=tradeoms # 摄取项目
|
|
389
|
+
derekinside graph build # 构建知识图谱
|
|
390
|
+
derekinside search "KYC approval flow" # 语义搜索
|
|
391
|
+
derekinside serve --mode http --port 18890 # 起 API(供 AI 智能体调用)
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
支持 MCP 协议,接入后你的 AI 智能体在生成时即可获得结构化上下文。
|
|
395
|
+
|
|
396
|
+
</details>
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
<p align="center">
|
|
401
|
+
<strong>🧠 DereInside: Know your project from the inside out.</strong>
|
|
402
|
+
<br>
|
|
403
|
+
<em>From one engineer who refused to build another black box.</em>
|
|
404
|
+
<br>
|
|
405
|
+
🌏 中英双语维护中 · 欢迎参与贡献
|
|
406
|
+
</p>
|