codebase-wiki
Enables AI agents to index, search, and retrieve architectural documentation and store self-learning notes from codebases.
README
Codebase Wiki
Architectural knowledge base with MCP interface for AI agents.
Agents discover services, generate LLM-powered docs with Mermaid C2/C3/sequence diagrams, and index them for semantic search. Includes self-learning notes and first-class workflow/flow indexing.
Quick Start
npm install -g @carreira-cloud/codebase-wiki
cd my-project
codebase-wiki init # Initialize knowledge base
codebase-wiki serve # Browse at http://localhost:3080
codebase-wiki start-mcp # Start MCP server for AI agents
Commands
| Command | Description |
|---|---|
init |
Initialize knowledge base for current repo |
serve |
Start web UI (markdown + mermaid rendering, flows tab) |
start-mcp |
Start MCP server (stdio JSON-RPC, 12 tools) |
search <query> |
Search docs, notes, and flows by keyword |
get <service> |
Retrieve full documentation for a service |
list |
List all indexed services |
stats |
Statistics: services, flows, notes, content size |
install-opencode |
Install OpenCode skills and commands |
MCP Tools
Documentation (8 tools)
| Tool | Description |
|---|---|
wiki_index |
Index an LLM-generated architectural document |
wiki_search |
Search documentation by keyword |
wiki_get |
Retrieve full documentation for a service |
wiki_list |
List all indexed services |
wiki_delete |
Remove a service's documentation |
wiki_stats |
Statistics: services, content size, notes count, flows count |
Self-Learning Notes (3 tools)
| Tool | Description |
|---|---|
wiki_note |
Store a self-learning discovery note |
wiki_notes_search |
Search agent notes by keyword |
wiki_notes_list |
List notes (optional type filter) |
Workflows & Flows (3 tools)
| Tool | Description |
|---|---|
wiki_flow_index |
Index a workflow diagram with keywords and linked services |
wiki_flow_search |
Search flows across all services by keyword |
wiki_flow_list |
List flows (optional service/flow_type filter) |
OpenCode Commands
/wiki generate <service> → Agent discovers, generates docs, indexes via MCP
/wiki generate-all → Generate docs for all services
/wiki enhance <service> <flow> → Add Mermaid C3/C2/sequence diagrams
/wiki discover-flows <service> → Discover and index all workflows with edge cases
/wiki flow-search <query> → Search flows across all services
/wiki flow-list <service> → List flows for a service
/wiki search <query> → Search docs + notes + flows
/wiki get <service> → Retrieve full doc
/wiki list → List all indexed services
/wiki stats → Knowledge base statistics
Self-Learning
Agents automatically add notes when they discover something new. Six note types:
| Type | Trigger |
|---|---|
gotcha |
Unexpected behavior, edge case, known bug |
pattern |
Recurring pattern across 2+ services |
integration |
Undocumented service integration detail |
convention |
Code convention, naming pattern |
decision |
Design decision (lightweight ADR) |
tip |
Shortcut, useful command, workflow hack |
Flows & Diagrams
Each flow is independently indexed with:
- Mermaid sequence diagram (happy path + error paths + edge cases)
- Keywords for discoverability
- Linked services for cross-service navigation
- Flow type: happy_path, error_path, edge_case, recovery, full
Diagrams render in the web UI via Mermaid.js. The UI also renders service documentation markdown (tables, code blocks, headings) via marked.js.
Architecture
src/
├── cli.ts # CLI entry (8 commands)
├── mcp-server.ts # MCP JSON-RPC server (12 tools)
├── ui-server.ts # Web UI (marked.js + mermaid.js, flows tab)
├── lancedb/client.ts # JSON file-backed storage (docs, notes, flows)
├── types.ts # TypeScript types
└── index.ts # Public API exports
docs/
├── getting-started.md
├── mcp-tools.md
├── self-learning.md
├── configuration.md
└── architecture.md
Storage: .codebase-wiki/rag_db/docs.json + notes.json + flows.json
License
MIT — Bruno Carreira
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。