Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

> 它将本地数字资产的原始数据(代码库、笔记、Skill、工作流)编译为 AI 可决策的结构化情境,不负责思考,不负责执行,只负责感知、编码、持久化、检索。

- **当前阶段**:阶段六 → v0.15.0 已发布(CHANGELOG 已记录);v0.16.0 进行中(Workspace 扩展 Phase 2)
- **当前版本**:v0.15.0(CHANGELOG 已记录,`fix/project-health-cleanup@4e8d882`,**待合入 `main` 并打 tag**)
- **已完成里程碑**:Registry God Object 完全拆解(10 子模块提取)+ 18 workspace crates 提取 + MCP Python SDK 1.16.0 兼容修复 + repo.rs trait 化 + flaky 测试根治(RF-2.1/2.2/2.3)+ 许可证迁移 + health 性能优化(-44%)+ index skip-embeddings + batch encoding 实验 + RF-6 清零 + 架构治理文档(ADR/不变量清单)+ Tantivy BM25 代码符号搜索(P1)+ AppContext 职责拆分 Phase 1/2(storage.rs 860→430 行)+ 架构不变量 CI(G5/T11/T12)+ Embedding 多后端(Candle/Ollama 配置切换, P3)+ EnvVersionCache 扩展(9 工具链检测, P4)
- **当前阶段**:阶段八 → v0.17.0-dev 进行中(Agent Memory 向量存储 / Embedding 职责外迁)
- **当前版本**:v0.17.0-dev(Schema 34,60 MCP tools,442 tests)
- **已完成里程碑**:Registry God Object 完全拆解(10 子模块提取)+ 18 workspace crates 提取 + MCP Python SDK 1.16.0 兼容修复 + repo.rs trait 化 + flaky 测试根治(RF-2.1/2.2/2.3)+ 许可证迁移 + health 性能优化(-44%)+ index skip-embeddings + batch encoding 实验 + RF-6 清零 + 架构治理文档(ADR/不变量清单)+ Tantivy BM25 代码符号搜索(P1)+ AppContext 职责拆分 Phase 1/2(storage.rs 860→430 行)+ 架构不变量 CI(G5/T11/T12)+ Embedding 多后端(Candle/Ollama 配置切换, P3)+ EnvVersionCache 扩展(9 工具链检测, P4)+ **v0.16.0 Agent Contexts(P1/P2/P3)**:`agent_contexts`/`agent_memories`/`context_entity_links` Schema + 9 个 Session MCP tools + Context-aware Skill Runtime(`DEVBASE_ACTIVE_CONTEXT` 注入)+ **v0.16.1 Workflow-Session Binding**:`workflow_executions.context_id` + 执行自动绑定 Active Context + **v0.17.0-dev Embedding Externalization**:`embedding` 从 default features 移除(Candle/Ollama 降级为 opt-in `llm-backend`)+ Schema 34 向量存储 + `cosine_similarity` SQLite UDF + `devkit_session_recall` / `devkit_session_index`(60 tools)
- **核心方向**:让 Kimi CLI 在调用文件工具之前,先通过 devbase 获得"该读哪些文件、为什么读、它们之间的关系"
- **本质分析**:见 `vault/99-Meta/devbase-essence-analysis-20260430.md` 与 `docs/architecture/redefinition.md`
- **设计文档**:
- [`docs/architecture/workflow-dsl.md`](docs/architecture/workflow-dsl.md) — Workflow DSL 规范
- [`docs/architecture/workspace-as-schema.md`](docs/architecture/workspace-as-schema.md) — 统一实体模型设计
- [`docs/RFC/agent-memory-vector-storage.md`](docs/RFC/agent-memory-vector-storage.md) — v0.17.0 Agent Memory 向量存储 RFC(Embedding 职责外迁设计)
- [`docs/guides/mcp-integration-guide.md`](docs/guides/mcp-integration-guide.md) — MCP 集成指南
- [`docs/README.md`](docs/README.md) — 完整文档导航

Expand All @@ -22,10 +23,10 @@ Skill Runtime 全生命周期已落地(含依赖管理 Schema v15),Schema
- **Workspace**:`%LOCALAPPDATA%\devbase\workspace/` —— 文件系统 = source of truth
- `vault/` —— PARA 结构:00-Inbox, 01-Projects, 02-Areas, 03-Resources, 04-Archives, 99-Meta
- `assets/` —— 二进制资源
- **MCP Server**:stdio only,**58 个 tools**(含 5 个 vault tools + 8 个代码分析工具 + 4 个 embedding/搜索工具 + 4 个 Skill Runtime tools + 3 个 Workflow/评分 tools + 1 个报告工具 + 1 个 arXiv 工具 + 2 个 KnownLimit tools + 3 个 Relation tools + 2 个 Agent 状态工具 + 9 个 Agent Context tools + 1 个 streaming index 工具 + 1 个 oplog 工具);配置见 `mcp.json`
- **MCP Server**:stdio only,**60 个 tools**(含 5 个 vault tools + 8 个代码分析工具 + 4 个 embedding/搜索工具 + 4 个 Skill Runtime tools + 3 个 Workflow/评分 tools + 1 个报告工具 + 1 个 arXiv 工具 + 2 个 KnownLimit tools + 3 个 Relation tools + 9 个 Agent Context tools + 2 个 Agent Memory 向量工具 + 1 个 streaming index 工具 + 1 个 oplog 工具);配置见 `mcp.json`
- **Kimi CLI 集成**:MCP server 已通过 `kimi mcp add` 注册,端到端验证通过(`kimi --print` 成功调用 `devkit_health`);项目级 skill 位于 `.kimi/skills/devbase-project/SKILL.md`
- **统一节点模型**:`core::node::{Node, NodeType, Edge}` —— GitRepo / VaultNote / Asset / ExternalLink
- **当前测试**:490+ workspace passed / 0 failed / 4 ignored(主 crate 390 + symbol-links 4 + sync-protocol 12 + core-types 3 + syncthing-client 2 + vault-frontmatter 5 + vault-wikilink 5 + workflow-interpolate 9 + workflow-model 2 + registry-health 3 + registry-metrics 4 + registry-workspace 5 + embedding 5 + skill-runtime-types 7 + skill-runtime-parser 3 + 其他 crates ~30);11/11 passed(integration `tests/cli.rs`)
- **当前测试**:442+ lib passed / 0 failed / 3 ignored + 11/11 integration passed(`tests/cli.rs`)
- **编译状态**:0 warning / 0 vulnerabilities(`cargo audit` 干净,除上游 `tokei` 的 `RUSTSEC-2020-0163`)
- **Workspace 结构**:`crates/` 目录已启用,18 个零耦合模块已提取为独立 crate(`devbase-symbol-links`, `devbase-sync-protocol`, `devbase-core-types`, `devbase-syncthing-client`, `devbase-vault-frontmatter`, `devbase-vault-wikilink`, `devbase-workflow-interpolate`, `devbase-workflow-model`, `devbase-registry-health`, `devbase-registry-metrics`, `devbase-registry-workspace`, `devbase-embedding`, `devbase-skill-runtime-types`, `devbase-skill-runtime-parser`, `devbase-registry-entity`, `devbase-registry-relation`, `devbase-registry-call-graph`, `devbase-registry-dead-code`, `devbase-registry-code-symbols`)
- **Workflow Engine**:YAML 解析 + 拓扑调度 + batch 并行执行 + 5 种 step 类型(skill/subworkflow/parallel/condition/loop)
Expand Down
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,74 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.17.0-dev] - 2026-05-13

### Added

- **Agent Memory 向量存储** — Schema v34
- `agent_memories` 新增 `embedding BLOB`, `embedding_model TEXT`, `indexed_at DATETIME`
- Partial index `idx_agent_memories_embedding` 仅索引含向量的行
- `AgentMemory` 结构体扩展向量元数据字段
- **SQLite UDF: `cosine_similarity`** — `src/registry/agent_context.rs`
- 输入: 两个 little-endian f32 BLOB
- 输出: REAL ∈ [-1.0, 1.0]
- 注册时机: `WorkspaceRegistry::init_db_at` 迁移完成后自动注册
- **语义记忆搜索** — `search_memories_semantic(context_id, query_embedding, limit)`
- 纯 SQL `ORDER BY cosine_similarity(embedding, ?) DESC`
- 零 LLM 运行时依赖;仅执行向量比对
- **MCP Tools +2** (60 total)
- `devkit_session_recall` — 外部向量查询 + 语义召回 top-k memories
- `devkit_session_index` — 为已有 memory 注入外部生成 embedding
- **Skill Runtime Auto-Recall** — `src/skill_runtime/executor.rs`
- Tier 1: Semantic recall (本地 Candle/Ollama 或外部 HTTP endpoint)
- Tier 2: Keyword fallback (`LIKE` search on `content`)
- 新环境变量: `DEVBASE_CONTEXT_MEMORY_COUNT`, `DEVBASE_CONTEXT_RECALL_METHOD`
- `DEVBASE_CONTEXT_MEMORIES` 升级为 top-k 相关 memories(含 `score` + `model`)
- **外部 Embedding Provider 集成**
- `call_external_embedding_endpoint` — `reqwest::blocking` POST `/api/embeddings`
- 配置驱动: `config.toml [embedding]` (enabled/provider/model/base_url/timeout)
- 端到端测试: mock TCP server 验证 Ollama 格式解析 + 错误码处理
- **RFC 文档** — `docs/RFC/agent-memory-vector-storage.md`
- 架构决策: devbase = 向量数据库层,不做 embedding 生成
- 参照 pgvector 边界设计

### Changed

- **Feature Flags**: `embedding` 从 `default` 移除
- Candle/Ollama 依赖变为 opt-in: `--features embedding`
- 默认构建零 ML 依赖,编译时间减少 30~50%
- `insert_memory` 签名扩展: 新增可选 `embedding: Option<&[f32]>` 和 `embedding_model: Option<&str>`
- `list_memories` / `search_memories` SELECT 语句扩展为 8 列(兼容新增字段)
- AGENTS.md 同步至 v0.17.0-dev 基线

### Breaking Changes

- 默认构建不再包含 `devbase-embedding` crate;需要语义生成能力的用户须显式启用 `--features embedding`
- `generate_query_embedding` 在默认构建下返回错误(提示启用 feature 或配置外部 endpoint)

## [0.16.1] - 2026-05-13

### Added

- **Workflow-Session Binding** — Schema v33
- `workflow_executions` 新增 `context_id` 列 + 索引
- `create_execution` 自动绑定 `resolve_active_context()`
- MCP `devkit_workflow_run` 与 CLI `workflow run` 均支持自动绑定
- `devkit_session_workflows` tool: 列出指定 context 的 workflow 执行历史
- `context_entity_links` 表 (Schema v32): context 与任意 entity 的多对多关联

## [0.16.0] - 2026-05-13

### Added

- **Agent Contexts (AI Agent OS)** — Schema v31
- `agent_contexts` 表: 持久化 AI session / project scope
- `agent_memories` 表: 结构化记忆(decision/constraint/note/discovery/error)
- 9 个 Session MCP tools: save/list/resume/attach/detach/activate/search/capture/workflows
- `resolve_active_context()`: 环境变量 `DEVBASE_ACTIVE_CONTEXT` → 文件 `.active_context` fallback
- Context-aware Skill Runtime: 注入 `DEVBASE_ACTIVE_CONTEXT` + `DEVBASE_CONTEXT_MEMORIES` + `DEVBASE_CONTEXT_LINKS`
- 所有 agent_context 操作自动写入 OpLog (`OplogEventType::AgentContext`)

## [0.15.0] - 2026-05-04

### Added
Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase"
version = "0.15.0"
version = "0.17.0-dev"
edition = "2024"
description = "Developer workspace database and knowledge-base manager"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
Expand All @@ -14,7 +14,10 @@ name = "registry_bench"
harness = false

[features]
default = ["tui", "mcp", "embedding", "lang-rust", "lang-python", "lang-js-ts", "lang-go"]
default = ["tui", "mcp", "lang-rust", "lang-python", "lang-js-ts", "lang-go"]
# embedding feature removed from default in v0.17.0.
# LLM inference (Candle/Ollama) is now opt-in via `llm-backend` feature.
# devbase stores and searches externally-generated embeddings only.
tui = ["ratatui", "crossterm", "watch"]
watch = ["notify"]
mcp = []
Expand All @@ -39,7 +42,7 @@ reqwest = { version = "0.12", features = ["json", "blocking"] }
tantivy = "0.26"
dirs = "6"
chrono = { version = "0.4", features = ["serde"] }
rusqlite = { version = "0.34", features = ["bundled", "chrono"] }
rusqlite = { version = "0.34", features = ["bundled", "chrono", "functions"] }
r2d2 = "0.8"
r2d2_sqlite = "0.27.0"
blake3 = "1.5"
Expand Down Expand Up @@ -99,7 +102,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.15.0"
version = "0.17.0-dev"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
edition = "2024"
license = "AGPL-3.0-or-later"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-embedding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-embedding"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-call-graph/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-call-graph"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-code-symbols/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-code-symbols"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-dead-code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-dead-code"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-entity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-entity"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-health/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-health"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-metrics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-metrics"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-relation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-relation"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-registry-workspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-registry-workspace"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-skill-runtime-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-skill-runtime-parser"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-skill-runtime-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-skill-runtime-types"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-workflow-interpolate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-workflow-interpolate"
version = "0.15.0"
version.workspace = true
edition = "2024"
description = "Workflow variable interpolation for devbase"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
Expand Down
2 changes: 1 addition & 1 deletion crates/devbase-workflow-model/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "devbase-workflow-model"
version = "0.15.0"
version.workspace = true
edition = "2024"
authors = ["juice094 <160722440+juice094@users.noreply.github.com>"]
license = "MIT"
Expand Down
Loading
Loading