-
-
Notifications
You must be signed in to change notification settings - Fork 11
Features
CKB (Code Knowledge Backend) gives AI assistants deep understanding of your codebase. This guide organizes all features by what you can accomplish rather than by version or implementation.
| Use Case | What You Can Do |
|---|---|
| Code Navigation | Find symbols, trace call graphs, understand structure |
| Impact Analysis | Assess change safety, find blast radius, detect breaking changes |
| Architecture | Understand module structure, document decisions, track responsibilities |
| Ownership | Find who owns what, identify reviewers, track ownership drift |
| Code Quality | Find hotspots, detect dead code, audit risk, analyze coupling |
| Documentation | Link docs to code, detect staleness, enforce coverage |
| Multi-Repo | Search across repos, analyze contracts, serve indexes remotely |
| Runtime Intelligence | Connect telemetry to code, detect production dead code |
| Automation | Daemon mode, webhooks, scheduled tasks, PR analysis |
| Language Support | Quality tiers, indexer requirements |
| Response Quality | Confidence tiers, provenance, drilldowns |
Find and understand code without reading every file.
| Feature | Description | Tools |
|---|---|---|
| Symbol Search | Find functions, types, interfaces by name |
searchSymbols, ckb search
|
| Find References | All places a symbol is used |
findReferences, ckb refs
|
| Go to Definition | Jump to where a symbol is defined |
getSymbol, ckb symbol
|
| Call Graph | Who calls this? What does it call? |
getCallGraph, ckb callgraph
|
| Trace Usage | How is this symbol reached from entrypoints? |
traceUsage, ckb trace
|
| List Entrypoints | API handlers, CLI mains, background jobs |
listEntrypoints, ckb entrypoints
|
| Key Concepts | Important symbols and patterns in the codebase |
listKeyConcepts, ckb concepts
|
| Explain File | File-level orientation and purpose | explainFile |
| Explain Path | Why does this path/directory exist? | explainPath |
| Recently Relevant | What files matter right now? |
recentlyRelevant, ckb recent
|
"Find all functions that handle HTTP requests" "Show me the call graph for
ProcessPayment" "What code paths lead tosendEmail?" "List the main entry points in this service"
CKB uses a backend ladder for queries:
- SCIP — Pre-computed index (fastest, most accurate)
- LSP — Language server (real-time, slightly slower)
- Git — Fallback for basic operations
Hybrid Retrieval (v7.4): Search combines text matching with graph-based ranking (Personalized PageRank) to surface structurally related symbols, achieving 100% recall on benchmarks.
See also: User-Guide#cli-commands, Hybrid-Retrieval
Know what will break before you change it.
| Feature | Description | Tools |
|---|---|---|
| Impact Analysis | Blast radius of changing a symbol |
analyzeImpact, ckb impact
|
| Risk Scoring | Multi-factor risk assessment |
auditRisk, ckb audit
|
| Hotspot Detection | High-churn, high-complexity code |
getHotspots, ckb hotspots
|
| Diff Summary | What changed and what might break |
summarizeDiff, ckb diff-summary
|
| PR Summary | Pull request analysis with risk assessment |
summarizePr, ckb pr-summary
|
| Breaking Changes | Detect signature/contract changes | analyzeImpact --breaking |
"What will break if I rename
UserService?" "Analyze the risk of this PR" "Which files are the most dangerous to change?" "Is it safe to deletelegacyHandler?"
| Factor | Weight | Description |
|---|---|---|
| Complexity | 20% | Cyclomatic/cognitive complexity |
| Test Coverage | 20% | Lack of test coverage |
| Bus Factor | 15% | Single-author code |
| Security | 15% | Handles auth, crypto, PII |
| Staleness | 10% | Not touched in 6+ months |
| Error Rate | 10% | Runtime error frequency |
| Coupling | 5% | High co-change coupling |
| Churn | 5% | Frequent modifications |
See also: User-Guide#ckb-impact, User-Guide#ckb-audit
Know how the codebase is organized and why decisions were made.
| Feature | Description | Tools |
|---|---|---|
| Architecture Overview | High-level structure and dependencies |
getArchitecture, ckb arch
|
| Module Overview | Boundaries, responsibilities, owners |
getModuleOverview, ckb modules
|
| Module Responsibilities | What each module is responsible for | getModuleResponsibilities |
| Module Annotations | Add metadata to modules | ckb modules annotate |
| ADR Management | Create/query Architectural Decision Records |
listDecisions, createDecision, ckb decisions
|
| Explain Symbol | Full context: origin, evolution, warnings |
explainSymbol, ckb explain
|
| Explain Origin | Trace history through renames | explainOrigin |
"Give me an architecture overview" "What is the
internal/authmodule responsible for?" "Why was Redis chosen for caching?" (finds ADR) "Explain whyLegacyParserexists and who added it"
ADRs document important architectural choices:
# Create an ADR
ckb decisions create \
--title "Use Redis for caching" \
--context "User sessions need fast access" \
--decision "Redis with 1-hour TTL" \
--module internal/cache
# Query ADRs
ckb decisions --search "caching"ADRs automatically surface in explain, justify, and impact commands for their linked modules.
See also: Configuration#architectural-decision-records, User-Guide#ckb-decisions
Know who owns what and who should review changes.
| Feature | Description | Tools |
|---|---|---|
| Ownership Lookup | CODEOWNERS + git blame |
getOwnership, ckb ownership
|
| Ownership Drift | Detect ownership changes over time | getOwnershipDrift |
| Reviewer Suggestions | Who should review this change? | summarizePr |
| Recent Contributors | Who has been active in this area? |
recentlyRelevant, ckb recent
|
"Who owns the authentication code?" "Who should review changes to
payment/processor.go?" "Has ownership of the API layer changed recently?" "Who has been working on the search module?"
CKB combines multiple signals:
- CODEOWNERS — Explicit ownership rules (100% confidence)
- Git Blame — Weighted by recency, filters bot commits
- Commit History — Active contributors in time window
See also: User-Guide#ckb-ownership
Find problem areas and prioritize refactoring.
| Feature | Description | Tools |
|---|---|---|
| Hotspots | High-churn + high-complexity files |
getHotspots, ckb hotspots
|
| Complexity Analysis | Cyclomatic/cognitive complexity per file |
getComplexity, ckb complexity
|
| Coupling Analysis | Files that change together |
analyzeCoupling, ckb coupling
|
| Dead Code Detection | Unused code (static + telemetry) |
findDeadCodeCandidates, ckb dead-code
|
| Justify Symbol | Keep/investigate/remove verdict |
justifySymbol, ckb justify
|
| Risk Audit | Multi-factor risk scoring |
auditRisk, ckb audit
|
| Quick Wins | High-impact, low-effort improvements | auditRisk --quick-wins |
"What are the top hotspots in this codebase?" "Is
oldHelperstill used anywhere?" "Which files always change together?" "Give me quick wins for reducing technical debt"
justifySymbol returns one of:
- keep — Has references, is entrypoint, or has ADR justifying it
- investigate — Unclear, needs human review
- remove — No references, no runtime usage, safe to delete
Export your codebase in an LLM-optimized format:
ckb export --min-complexity=10 --max-symbols=200Output includes module map, cross-module connections, and importance-ranked symbols.
See also: User-Guide#ckb-hotspots, User-Guide#ckb-justify, Telemetry
Keep documentation in sync with code.
| Feature | Description | Tools |
|---|---|---|
| Doc-Symbol Linking | Connect docs to code symbols |
indexDocs, ckb docs index
|
| Find Docs for Symbol | What docs mention this code? |
getDocsForSymbol, ckb docs symbol
|
| Find Symbols in Doc | What code does this doc reference? |
getSymbolsInDoc, ckb docs file
|
| Staleness Detection | Find outdated symbol references |
checkDocStaleness, ckb docs stale
|
| Coverage Metrics | Documentation coverage stats |
getDocCoverage, ckb docs coverage
|
| CI Enforcement | Fail if coverage drops | ckb docs coverage --fail-under=80 |
"What documentation mentions
Engine.Start?" "Are there any stale references in our README?" "What's our documentation coverage?" "Which symbols are completely undocumented?"
CKB detects symbol references via:
-
Backticks:
UserService.Authenticatein markdown -
Directives:
<!-- ckb:symbol internal.auth.UserService --> - Fenced Code: Parses code blocks in 8 languages
See also: Doc-Symbol-Linking
Search and analyze across multiple repositories.
| Feature | Description | Tools |
|---|---|---|
| Federation Management | Create/manage repo collections | ckb federation create/add/sync |
| Cross-Repo Search | Search modules, ownership, decisions |
federationSearchModules, federationSearchOwnership
|
| Cross-Repo Hotspots | Hotspots across all repos | federationGetHotspots |
| Contract Detection | Find proto/OpenAPI contracts |
listContracts, ckb contracts list
|
| Contract Impact | What breaks if I change this API? |
analyzeContractImpact, ckb contracts impact
|
| Remote Index Serving | Serve indexes over HTTP | ckb serve --index-server |
| Remote Federation | Query remote CKB servers |
federationAddRemote, federationSearchSymbolsHybrid
|
| Repo Registry | Register and switch between repos |
listRepos, switchRepo, ckb repo
|
"Find all authentication modules across our microservices" "What services consume the User API?" "Show hotspots across all backend repos" "Who should I notify before changing
user.proto?"
CKB detects and tracks API contracts:
| Type | Extensions | Detection |
|---|---|---|
| Protocol Buffers | .proto |
Package, imports, services |
| OpenAPI |
.yaml, .json
|
Paths, servers, version |
Impact analysis shows direct and transitive consumers with confidence tiers.
See also: Federation, Configuration#index-server-configuration-v73, Authentication
Connect production telemetry to code understanding.
| Feature | Description | Tools |
|---|---|---|
| Telemetry Integration | Ingest OTLP metrics | ckb telemetry status |
| Service Mapping | Map services to repos |
serviceMap configuration |
| Observed Usage | Which functions are called in production? | ckb telemetry usage |
| Dead Code Detection | Find code not called in production |
findDeadCodeCandidates, ckb dead-code
|
| Coverage Levels | High/medium/low/insufficient | ckb telemetry status |
"Is
legacyEndpointactually used in production?" "What's our telemetry coverage?" "Find functions that haven't been called in 30 days"
- Configure OTEL Collector to send
callsmetrics to CKB - Map
service.nameto repository viaserviceMap - CKB tracks which symbols are called at runtime
- Dead code detection combines static analysis + runtime data
Coverage Levels:
| Level | Score | Feature Access |
|---|---|---|
| High | ≥ 0.80 | Full: dead code, impact enrichment |
| Medium | ≥ 0.60 | Partial: with warnings |
| Low | ≥ 0.40 | Limited: usage display only |
| Insufficient | < 0.40 | None: telemetry features disabled |
See also: Telemetry, Configuration#telemetry-v64
Run CKB as a service with scheduled tasks and webhooks.
| Feature | Description | Tools |
|---|---|---|
| Daemon Mode | Always-on CKB service | ckb daemon start/stop/status |
| Watch Mode (MCP) | Auto-reindex during AI sessions | ckb mcp --watch |
| Watch Mode (CLI) | Standalone auto-reindex | ckb index --watch |
| Webhook Refresh | Trigger reindex via HTTP | POST /api/v1/refresh |
| Scheduled Tasks | Cron-style task scheduling | ckb daemon schedule |
| Webhooks | Notify on events | ckb webhooks |
| Token Management | Scoped API tokens | ckb token create/revoke/rotate |
| Incremental Indexing | Fast updates (Go only) |
ckb index (automatic) |
| PR Analysis | Risk assessment in CI | ckb pr-summary |
- name: Analyze PR
run: |
ckb index
ckb pr-summary --base=main --head=${{ github.head_ref }}For Go projects, CKB only reindexes changed files:
| Scenario | Full Index | Incremental |
|---|---|---|
| 10,000 files | ~60s | ~2-5s |
| Single file change | ~60s | ~1s |
See also: Daemon-Mode, CI-CD-Integration, Incremental-Indexing, Authentication
76 tools for AI assistants, organized into efficient presets.
| Preset | Tools | Tokens | Best For |
|---|---|---|---|
core |
14 | ~2k | General development (default) |
review |
19 | ~2k | PR reviews, ownership |
refactor |
19 | ~2k | Refactoring, dead code |
docs |
20 | ~2k | Documentation maintenance |
ops |
25 | ~2k | CKB administration |
federation |
28 | ~3k | Multi-repo work |
full |
76 | ~9k | Everything |
# Start with a preset
ckb mcp --preset=review
# List available presets
ckb mcp --list-presetsStart with core and let the AI expand mid-session:
{
"name": "expandToolset",
"arguments": {
"preset": "federation",
"reason": "User asked about cross-repository dependencies"
}
}See also: Presets, MCP-Integration
CKB operates in three tiers based on available backends:
| Tier | Requirements | Features |
|---|---|---|
| Fast | None | Tree-sitter parsing, basic search |
| Standard | SCIP index | Full cross-references, call graphs |
| Full | SCIP + Telemetry | Runtime usage, dead code detection |
# Control tier per-command
ckb search "Handler" --tier=fast
# Or via environment
export CKB_TIER=standard
# Check what's needed for a tier
ckb doctor --tier=standardSee also: User-Guide#analysis-tiers-v72, Practical-Limits
Not all languages are equal. CKB classifies languages into quality tiers:
| Tier | Quality | Languages |
|---|---|---|
| Tier 1 | Full support | Go |
| Tier 2 | Full support, minor edge cases | TypeScript, JavaScript, Python |
| Tier 3 | Basic support, callgraph may be incomplete | Rust, Java, Kotlin, C++, Ruby, Dart |
| Tier 4 | Experimental | C#, PHP |
Key limitations:
- Incremental indexing is Go-only
- TypeScript monorepos may need
--infer-tsconfig - C/C++ requires
compile_commands.json - Python works best with activated virtual environment
# Check language tools
ckb doctor --tier standardSee also: Language-Support
CKB provides metadata about result quality so you know how much to trust them.
| Tier | Score | Meaning |
|---|---|---|
| High | ≥ 0.95 | Fresh SCIP data, definitive |
| Medium | 0.70-0.94 | Good data, minor caveats |
| Low | 0.30-0.69 | Stale or incomplete data |
| Speculative | < 0.30 | Cross-repo or heuristic |
Results show which backends contributed:
-
scip— From SCIP index -
git— From git history -
lsp— From language server -
treesitter— From tree-sitter parsing
When results are truncated, CKB suggests follow-up queries:
{
"suggestedNextCalls": [
{
"tool": "findReferences",
"params": {"symbolId": "..."},
"reason": "47 references found, showing 10"
}
]
}See also: API-Reference
CKB is static analysis. It has known limitations:
| Limitation | Why | Workaround |
|---|---|---|
| Dynamic dispatch | Can't see runtime types | Check implementations manually |
| Generated code | May not be indexed | Regenerate before indexing |
| Cross-repo callers | Indexes one repo at a time | Use federation |
| Runtime behavior | Static analysis only | Use debugger/profiler |
| Code generation | Not CKB's job | Use AI assistant directly |
See also: Practical-Limits
# 1. Install
npm install -g @tastehub/ckb
# 2. Initialize
cd /your/project
ckb init
# 3. Index
ckb index
# 4. Configure AI tool
ckb setup --tool=claude-code
# 5. Start exploring
ckb arch
ckb search "Handler"
ckb hotspotsSee also: Quick-Start, User-Guide, MCP-Integration