CodeNib
CLAUDE.md86 starsChanged 4 months agoApache-2.0View on GitHub
CodeNib is a code analysis agent with graph-enhanced search. It parses multi-language codebases with tree-sitter, builds semantic graphs (igraph), and provides hybrid retrieval (BM25 + FAISS/Milvus embeddings + regex/trigram + LLM re-ranking) via litellm. Retrieval is exposed both as composable agent skills and over the Model Context Protocol (MCP). Python 3.10+. Layered rules. This is the project-wide file (always loaded). Each major subtree carries its own CLAUDE.md with deeper, domain-specific rules that load on demand when you touch files in…
- Installs packages
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- test/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
.cfiles: use the cpp chunker (not a separate C chunker). - Very specific: line 80
No agent attribution: Do not add Co-Authored-By: Claude ..., 🤖 Generated with Claude Code, session links, or any "made by an AI" footer to …
- Distinctive: line 136
When you edit code under one of these subtrees, follow its CLAUDE.md in addition to this file.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
CodeNib is a code analysis agent with graph-enhanced search. It parses multi-language codebases with tree-sitter, builds semantic graphs (igraph), and provides hybrid retrieval (BM25 + FAISS/Milvus embeddings + regex/trigram + LLM re-ranking) via litellm. Retrieval is exposed both as composable agent skills and over the Model Context Protocol (MCP). Python 3.10+.
Layered rules. This is the project-wide file (always loaded). Each major subtree carries its own
CLAUDE.mdwith deeper, domain-specific rules that load on demand when you touch files in that directory. See Per-directory rules below.
Package structure
codenib/
code_chunking/ # Tree-sitter chunkers: Python, Go, Rust, C++, JS/TS (CLAUDE.md)
graph/ # CodeGraph (igraph), ROI subgraph, range queries; graph/incremental/ LSP patchers (CLAUDE.md)
dataset/ # SWE-bench loading, ground-truth extraction, query synthesis (CLAUDE.md)
index/ # BM25 sparse, FAISS/embedding, regex node, trigram (Zoekt) indexes
incremental/ # Incremental embedding pipeline (git-diff driven chunk/index updates)
agent/ # Keyword extraction, re-ranking, resource guards, skills + runner
compiler/ # Two-phase index compilation: IndexCompiler -> RepoManifest
mcp/ # Model Context Protocol server (semantic/BM25/regex/Zoekt search)
model/ # Retrieval pipelines (bm25/embedding/graph/rerank) + agentless prompts
llm/ # litellm-based chat interface
scip_interface/ # SCIP indexing bindings (proto, shell scripts)
ls_index/ # Language server index (clangd, rust-analyzer, scip-typescript)
ops/ # Graph operations (expand, traverse)
eval/ # Evaluation utilities
core/ # C++ decoder backend (libigraph) mirroring CodeGraph/SCIPGraphDecoder
test/ # Mirrors package structure; uses pytest markers (CLAUDE.md)
scripts/ # CLI entry points: dataset collection, embedding, evaluation
# scripts/agent_compile/ — agent-compile RFC tooling (CLAUDE.md)
third_party/ # Git submodules (scip-python)Dev commands
make dev # pip install -e ".[dev,test]"
make test # pytest
make scip # Install SCIP toolchain (rust-analyzer, scip-clang, TS, Python)
make install # pip install -e .Pre-commit hooks: black (line-length 88), isort, flake8+bugbear, clang-format
for C/C++, and the local codenib-namespace hook (scripts/check_namespace.py)
guarding the CodeNib naming migration.
Critical conventions
These bite across the whole codebase — full details live in the per-directory rules, but keep these in mind everywhere:
- Line numbering:
CodeChunk.start_line/end_lineare 0-based (tree-sitter);CodeLocation.start_line/end_lineare 1-based (output/HuggingFace)._chunk_to_code_block()indataset/gt_locate.pydoes the +1 conversion. Seecodenib/dataset/CLAUDE.mdandcodenib/code_chunking/CLAUDE.md. .cfiles use thecppchunker (not a separate C chunker).
Frontend / web demo
The DeepWiki-style web demo (FastAPI backend codenib/web/ + Next.js frontend
web/ + codenib/wiki/) is on main (merged via PR #166/#167). To run,
screenshot, or iterate the UI:
- How to run, screenshot (Playwright), and self-critique the demo:
.claude/guides/frontend-loop.md. - Where the graph UI is headed (Cytoscape overhaul, the compiler-precise
edge-provenance differentiator, wiki reframe):
.claude/design/graph-frontend-direction.md.
Git & PR conventions
Rules for any AI/code agent (Claude Code, etc.) committing or opening PRs here.
- No agent attribution. Do not add
Co-Authored-By: Claude ...,🤖 Generated with Claude Code, session links, or any "made by an AI" footer to commit messages, PR bodies, or review comments. This is enforced byattribution: { commit: "", pr: "" }in.claude/settings.json. - Commit messages: Conventional Commits —
type(scope): summary, wheretypeisfeat/fix/docs/refactor/perf/test/chore/ci. Imperative mood, ≤72-char subject; body explains why + how it was verified. - PRs must follow
.github/PULL_REQUEST_TEMPLATE.mdverbatim — keep every section heading (Summary,Changes,Type of Change,Testing,Checklist) in order. Fill the bullets, tick the relevant- [x]boxes; do not substitute ad-hoc sections. Add extra context below the template, never in place of it.
CI
Pull-request and trusted full CI are deliberately separate (full reference:
docs/ci_cd.md):
- Pull requests:
.github/workflows/ci.ymlruns one unit gate on an ephemeral GitHub-hosted runner. Draft PRs defer this job until they become ready for review, unless they carryfull-ci. A skipped draft run is not the required ready-for-review result, and a cancelled run is incomplete. - Trusted runs:
.github/workflows/ci-full.ymlruns after default-branch pushes, on the daily schedule, or by manual dispatch. A hostedpreflightjob selects a six-job chain on the persistent self-hosted runner:unit,integration,integration-serial,scip-core,graph-consumer, andslow.
On default-branch pushes, the serial chain runs only when the diff touches its
allowlist (chunking, dataset, graph, index, ls_index, core, and related
scripts/tests; see docs/ci_cd.md). Scheduled and manual
full runs force the serial chain. The credential/model-dependent slow tier
runs only for scheduled or manual full runs; PR labels do not dispatch the
trusted workflow.
Skip mechanisms:
- both workflows use
paths-ignorefor**.md,docs/**,LICENSE, and.gitignore; - PR unit:
[skip tests]in the PR title or theskip-testslabel; - trusted default-branch push:
[skip tests]in the head commit message; - trusted manual dispatch:
skip_tests: true.
Full pytest marker reference: test/CLAUDE.md.
Per-directory rules
Domain rules live next to the code they govern and load on demand:
| Path | Covers |
codenib/code_chunking/CLAUDE.md | Chunk depth (L0/L1/L2), per-language chunk types, line-number origin |
codenib/graph/CLAUDE.md | CodeGraph (igraph), node/edge types, pickle schema versioning, C++ decoder parity |
codenib/dataset/CLAUDE.md | SWE-bench loading, ground-truth extraction, line conversion, test repos |
test/CLAUDE.md | pytest marker tiers, fixture caches, package-shadow gotcha |
scripts/agent_compile/CLAUDE.md | Agent-compile RFC tooling, phase lineage, RepoManifest/IndexCompiler |
When you edit code under one of these subtrees, follow its CLAUDE.md in
addition to this file. If a rule changes, update the file nearest the code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

