Languages: English | 简体中文
CLI-first local code indexing for agent workflows, backed by
codebase-memory-mcp.
codebase-skill is a local CLI wrapper for the official DeusData/codebase-memory-mcp project, with an optional multi-tool skill stub.
It keeps indexes inside the current repository under .codebase/, exposes a global codebase command, and avoids the MCP protocol at runtime.
Quick links: Install · Quick start · Optional skill · Development · GitHub publishing
| Area | Decision |
|---|---|
| Index storage | Project-local .codebase/<uuid>/ |
| Runtime model | Local CLI, no MCP protocol at runtime |
| Upstream engine | DeusData/codebase-memory-mcp |
| Primary interface | codebase shell command |
| Agent integration | Optional ~/.agents/skills/codebase/SKILL.md (multi-tool) |
| Target workflow | Codex, Claude Code, OpenCode, Copilot, local CLI |
- Project-local index storage under
.codebase/<uuid>/ - A normal shell command:
codebase - Optional multi-tool skill install under
~/.agents/skills/codebase - Better defaults for agent workflows:
func,calls,snippet,search-code,detect-changes,refresh - No git dependency, no runtime MCP server requirement
codebase-memory-mcp is still the real indexer and graph engine. This repo adds:
- project-local storage conventions
- a CLI-first workflow that agents can call directly
- refresh metadata
- a small optional skill stub for Claude Code, Codex, OpenCode, and similar tools
If you want raw upstream behavior, call the upstream tool directly. If you want a pragmatic local retrieval workflow for Codex, Claude Code, OpenCode, Copilot, or plain shell use, use this repo.
This project is for teams or individuals who want code-index style retrieval without turning every lookup into an MCP round trip.
- Keep indexing local to the repository instead of scattering state elsewhere.
- Give agents a stable
codebasecommand instead of a protocol dependency. - Keep repo instructions simple: use
codebasefirst, then fall back torg. - Reuse the upstream graph/index engine without inheriting MCP runtime overhead.
brew install pythonsudo apt update
sudo apt install -y curl python3 python3-pipcurl -fsSL https://raw.githubusercontent.com/hzy9738/codebase-skill/main/scripts/install.sh | bashThe installer:
- installs this package with
python3 -m pip install --user - retries with
--break-system-packageson PEP 668 style Python environments when needed - keeps the executable at
~/.local/bin/codebase - installs upstream
codebase-memory-mcpwhen possible during setup
git clone https://github.com/hzy9738/codebase-skill.git
cd codebase-skill
bash scripts/install.shcodebase index --mode moderate
codebase func login
codebase calls login --direction both
codebase snippet login
codebase search-code redis --file-pattern '*.go'
codebase detect-changes
codebase refreshUseful diagnostics:
codebase self-check
codebase status
codebase --versioncodebase writes indexes under the current working directory:
<project>/.codebase/
d0f7ca83-c52c-450e-8cc0-4f4f2f3313b8/
index/*.db
metadata.json
019da154-2915-7413-852c-230622b512f4/
index/*.db
metadata.json
Typical workflow:
- Run
codebase indexonce on a fresh project. - Use
codebase functo discover candidate functions or methods. - Use
codebase callsandcodebase snippetafter symbol resolution. - Use
codebase search-codefor text-oriented retrieval. - Use
codebase refreshinstead of repeated full re-indexes.
Session behavior:
- Index data is isolated per session under
<project>/.codebase/<uuid>/. - Session UUIDs are auto-detected from the parent agent process (Claude Code, Codex, OpenCode) via PID lookup, or generated automatically.
- Use
codebase --session <id> ...orCODEBASE_SESSION=<id>to override. - There is no automatic runtime download on first use. Install the upstream binary explicitly with
codebase install-runtimeif it is missing.
codebase is CLI-first — you can call the codebase command directly from any agent that runs shell commands. The skill wrapper is optional and intentionally tiny.
To install the skill file interactively:
bash scripts/install-skill.shThis prompts you to choose a target directory:
~/.agents/skills(default)~/.claude/skills(Claude Code)~/.codex/skills(Codex)~/.opencode/skills(OpenCode)~/.cc-switch/skills(cc-switch)- or a custom path
You can also pass the path directly:
bash scripts/install-skill.sh ~/.claude/skillsRecommended AGENTS.md rule:
- 内部代码和文档检索优先使用 `codebase` skill,不可用或无结果时再降级到 `rg`、`fd` 或其他命令。status: show project, cache, metadata, and index stateinstall-runtime: explicitly installcodebase-memory-mcpinto~/.local/binindex: build or rebuild the local indexrefresh: rebuild only when the index is missing or mode changedprojects: list indexed projects in the current local cachereset: delete.codebaseself-check: verify PATH, dependencies, session detection, and index wiringfunc: search indexed functions and methodscalls: show callers and callees for a resolved symbolsnippet: print the source snippet for a symbolsearch-code: text/code search with graph-aware rankingsearch-graph: direct wrapper for upstreamsearch_graphtrace-path: direct wrapper for upstreamtrace_pathquery-graph: direct wrapper for upstreamquery_graphdetect-changes: show changed files and impacted symbolsarchitecture: print upstream architecture summaryschema: print graph schema summaryindex-status: show upstream index statusadr: get or update ADR content through upstreammanage_adringest-traces: forward runtime traces to upstreamingest_traces
Runtime resolution order:
CBM_CODEBASE_MEMORY_BINcodebase-memory-mcpfromPATH~/.local/bin/codebase-memory-mcp
Run the local checks:
bash tests/smoke_test.shRun the wrapper without installing:
bin/codebase --helpContribution and release workflow:
- see
CONTRIBUTING.md - see
RELEASING.md
Copy-ready GitHub repository metadata, About text, topics, and first-release copy live in GITHUB_PUBLICATION.md.
- Index quality and graph behavior still depend on
DeusData/codebase-memory-mcp - First-time indexing cost is mostly the upstream indexer cost
ingest-tracesdepends on current upstream runtime edge support- This repo is not a replacement for
rg; it is the indexed retrieval layer you use before falling back
MIT