agentleFS
sysevol-aisysevol-ai/CodeNib/.claude/CLAUDE.md

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

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
  1. Very specific:

    .c files: use the cpp chunker (not a separate C chunker).

    line 62
  2. Very specific:

    No agent attribution: Do not add Co-Authored-By: Claude ..., 🤖 Generated with Claude Code, session links, or any "made by an AI" footer to …

    line 80
  3. Distinctive:

    When you edit code under one of these subtrees, follow its CLAUDE.md in addition to this file.

    line 136

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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.md with 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_line are 0-based (tree-sitter); CodeLocation.start_line/end_line are 1-based (output/HuggingFace). _chunk_to_code_block() in dataset/gt_locate.py does the +1 conversion. See codenib/dataset/CLAUDE.md and codenib/code_chunking/CLAUDE.md.
  • .c files use the cpp chunker (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 by attribution: { commit: "", pr: "" } in .claude/settings.json.
  • Commit messages: Conventional Commits — type(scope): summary, where type is feat/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.md verbatim — 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.yml runs one unit gate on an ephemeral GitHub-hosted runner. Draft PRs defer this job until they become ready for review, unless they carry full-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.yml runs after default-branch pushes, on the daily schedule, or by manual dispatch. A hosted preflight job selects a six-job chain on the persistent self-hosted runner: unit, integration, integration-serial, scip-core, graph-consumer, and slow.

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-ignore for **.md, docs/**, LICENSE, and .gitignore;
  • PR unit: [skip tests] in the PR title or the skip-tests label;
  • 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:

PathCovers
codenib/code_chunking/CLAUDE.mdChunk depth (L0/L1/L2), per-language chunk types, line-number origin
codenib/graph/CLAUDE.mdCodeGraph (igraph), node/edge types, pickle schema versioning, C++ decoder parity
codenib/dataset/CLAUDE.mdSWE-bench loading, ground-truth extraction, line conversion, test repos
test/CLAUDE.mdpytest marker tiers, fixture caches, package-shadow gotcha
scripts/agent_compile/CLAUDE.mdAgent-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.