Status: Deferred — single crate remains optimal at current scale
Evaluated at: v0.2.4, 22.7 KLOC, 34 MCP tools, Schema v15
Revisit trigger: 50+ MCP tools OR compile time > 60s (clean) OR binary size > 20 MB
| Metric | Value |
|---|---|
| Total Rust LOC | ~22,750 |
Modules (src/) |
29 top-level |
| MCP Tools | 34 |
| Schema Version | 15 |
| Clean Build Time* | ~18–25 s (release) |
| Binary Size* | ~8.5 MB (release, stripped) |
| Test Count | 239 passed / 0 failed / 3 ignored |
*Measured on Windows 11, Ryzen 7, Rust 1.94.1.
| Module | Lines | Domain |
|---|---|---|
mcp/tools/repo.rs |
1,913 | MCP / Repository tools |
main.rs |
1,029 | CLI routing |
tui/state.rs |
928 | TUI state machine |
knowledge_engine.rs |
927 | Knowledge graph |
semantic_index.rs |
920 | Search / Embeddings |
dependency_graph.rs |
735 | Analysis / Call graph |
registry/migrate.rs |
714 | Registry / Schema |
query.rs |
692 | Query engine |
mcp/mod.rs |
601 | MCP transport |
scan.rs |
560 | Discovery |
- Contents:
mcp/, allmcp/tools/*.rs,mcp/mod.rs - Size: ~3,500 LOC
- Pros: MCP protocol changes are isolated; could be published as a standalone server binary.
- Cons: Heavily coupled to
registry,query,knowledge_engine,semantic_index— would require extracting public APIs first. - Effort: Medium-High (2–3 days to define stable internal APIs).
- Contents:
semantic_index.rs,embedding.rs,search.rs,discovery_engine.rs - Size: ~2,200 LOC
- Pros: Tantivy and embedding logic are self-contained; useful as a library.
- Cons: Still needs
registryfor repo metadata; embedding provider is an external Python script. - Effort: Medium (1–2 days).
- Contents:
registry/,registry/migrate.rs,registry/knowledge.rs, etc. - Size: ~3,000 LOC
- Pros: Schema and migrations are the most stable surface; other crates would depend on this.
- Cons:
registryalready importsknowledge_engineandsemantic_indexfor indexing — circular dependency risk. - Effort: High (requires untangling indexing from storage).
- Contents:
skill_runtime/,skill_sync/ - Size: ~2,000 LOC
- Pros: Fastest to extract; already has clear boundaries (parser, executor, registry, dependency).
- Cons: Skill registry depends on main
registryfor SQLite connection pooling. - Effort: Low-Medium (1 day).
If any revisit trigger fires, execute in this order to minimize disruption:
-
Phase 1 — Extract
devbase-skill- Lowest coupling, highest independence.
- Skill runtime already uses
anyhow::Resultand plain structs — minimal API surface.
-
Phase 2 — Extract
devbase-search- Requires defining a
SearchIndextrait thatdevbaseimplements. - Lets
devbase-searchbe reused by other projects.
- Requires defining a
-
Phase 3 — Extract
devbase-mcp- Only after
devbase-registryanddevbase-searchexpose stable APIs. - MCP tool handlers become thin wrappers over crate APIs.
- Only after
-
Phase 4 — Extract
devbase-registry(optional)- Only if the registry schema stabilizes (no new tables for 3+ releases).
- Otherwise the internal API churn is not worth the compile-time savings.
To make a future split painless, apply these incremental refactorings now:
| Task | File(s) | Effort |
|---|---|---|
Define RegistryConn trait instead of raw rusqlite::Connection |
registry/*.rs |
½ day |
Move McpTool trait to lib.rs and document it |
mcp/tools/mod.rs |
1 h |
Add #[derive(Debug, Clone)] to all public data structs |
registry/, skill_runtime/ |
1 h |
Gate TUI dependencies behind tui feature flag |
Cargo.toml, main.rs |
½ day |
Gate git2 / syncthing behind sync feature flag |
Cargo.toml |
½ day |
These changes do not split the crate but make the split a mechanical cut later.
| Condition | Action |
|---|---|
| Compile time > 60 s clean | Start Phase 1 (devbase-skill) |
| MCP tools > 50 | Start Phase 3 (devbase-mcp) |
| Binary size > 20 MB | Enable feature flags first, then split |
| Schema changes < 1 per release for 3 releases | Consider Phase 4 (devbase-registry) |
External consumer asks for devbase as a library |
Immediately start Phase 2 (devbase-search) |
Defer split. At 22.7 KLOC and ~20 s release builds, the single-crate model is still faster to iterate than a workspace. The recommended next 3 milestones remain feature-driven (Waves 21–23), not structural.
When the time comes, devbase-skill is the obvious first extraction — it already behaves like a sub-crate in spirit.