{"id":50043881,"url":"https://github.com/cognitx-leyton/codegraph","last_synced_at":"2026-05-21T04:39:19.855Z","repository":{"id":351287182,"uuid":"1209646594","full_name":"cognitx-leyton/codegraph","owner":"cognitx-leyton","description":"🕸️ Code knowledge graph for Claude Code \u0026 AI coding agents — index TypeScript, NestJS, React into Neo4j and query architecture in Cypher","archived":false,"fork":false,"pushed_at":"2026-04-27T10:18:43.000Z","size":1747,"stargazers_count":7,"open_issues_count":9,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-27T10:26:38.125Z","etag":null,"topics":["ai-agents","ast","claude","claude-code","code-analysis","code-knowledge-graph","codebase-search","coding-agents","cypher","dependency-graph","graphrag","knowledge-graph","mcp","neo4j","nestjs","python","react","retrieval-augmented-generation","static-analysis","typescript"],"latest_commit_sha":null,"homepage":"https://cognitx.leyton.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cognitx-leyton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-13T16:30:43.000Z","updated_at":"2026-04-27T09:05:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cognitx-leyton/codegraph","commit_stats":null,"previous_names":["cognitx-leyton/graphrag-code","cognitx-leyton/codegraph"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cognitx-leyton/codegraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitx-leyton%2Fcodegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitx-leyton%2Fcodegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitx-leyton%2Fcodegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitx-leyton%2Fcodegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cognitx-leyton","download_url":"https://codeload.github.com/cognitx-leyton/codegraph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cognitx-leyton%2Fcodegraph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33288964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","ast","claude","claude-code","code-analysis","code-knowledge-graph","codebase-search","coding-agents","cypher","dependency-graph","graphrag","knowledge-graph","mcp","neo4j","nestjs","python","react","retrieval-augmented-generation","static-analysis","typescript"],"created_at":"2026-05-21T04:39:19.037Z","updated_at":"2026-05-21T04:39:19.843Z","avatar_url":"https://github.com/cognitx-leyton.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕸️ graphrag-code\n\n***A Neo4j code knowledge graph for TypeScript codebases — index NestJS and React code, then answer architecture questions with Cypher.***\n\n![License](https://img.shields.io/badge/license-Apache%202.0-D22128?style=flat-square)\n![Python](https://img.shields.io/badge/python-3.10+-3776AB?style=flat-square\u0026logo=python\u0026logoColor=white)\n![Neo4j](https://img.shields.io/badge/neo4j-5.24-008CC1?style=flat-square\u0026logo=neo4j\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/typescript-ready-3178C6?style=flat-square\u0026logo=typescript\u0026logoColor=white)\n![NestJS](https://img.shields.io/badge/nestjs-aware-E0234E?style=flat-square\u0026logo=nestjs\u0026logoColor=white)\n![React](https://img.shields.io/badge/react-aware-61DAFB?style=flat-square\u0026logo=react\u0026logoColor=black)\n\n`graphrag-code` turns a TypeScript/TSX repository into a queryable **code knowledge graph** — a structured retrieval backend for **[Claude Code](https://www.anthropic.com/claude-code)**, **Claude**, and other **AI coding agents**. It walks the AST, recognises framework constructs (NestJS controllers, modules, DI; React components and hooks), and loads the result into Neo4j. Your agent can then ask *architectural* questions — dependency chains, endpoint inventories, component usage, hubs of DI — in Cypher, instead of fuzzy-matching code chunks with embeddings.\n\nBuilt at **[Leyton CognitX](https://cognitx.leyton.com/)** to make large TypeScript monorepos legible to humans, to Claude, and to LLM agents alike.\n\n## 🚀 Quickstart: use in your repo\n\n```bash\npipx install cognitx-codegraph\ncd /path/to/your-repo\ncodegraph init\n```\n\n`codegraph init` asks 4-5 short questions (which packages to index, which package boundaries to enforce, whether to install the Claude Code surface + GitHub Actions gate + local Neo4j) and then:\n\n1. Writes `.claude/commands/` (7 slash commands), `.github/workflows/arch-check.yml`, `.arch-policies.toml`, `docker-compose.yml`, and a `CLAUDE.md` snippet.\n2. Starts a local Neo4j container via `docker compose up -d`.\n3. Runs the first index.\n4. Prints what to query next.\n\nYou're fully set up in ~2 minutes. Want everything without prompts? `codegraph init --yes`. Want just the files and no Docker? `codegraph init --yes --skip-docker --skip-index`.\n\nFull walkthrough: [codegraph/docs/init.md](./codegraph/docs/init.md). Policy reference: [codegraph/docs/arch-policies.md](./codegraph/docs/arch-policies.md).\n\n## ✨ Highlights\n\n- **Framework-aware parsing** — not just imports: NestJS controllers / injectables / modules, React components and hooks, TypeORM entities, GraphQL operations, FastAPI / Flask / Django routes, SQLAlchemy models, plus generic Python classes and decorators are all first-class nodes.\n- **Neo4j-backed** — every relationship is a Cypher query away. Dependency walks, shortest paths, DI chains, blast-radius, orphan detection, all out of the box.\n- **Claude Code \u0026 AI agent native** — first-class MCP server with 16 tools, plus `codegraph install \u003cplatform\u003e` for Claude Code, Codex, Cursor, Gemini CLI, Aider, Copilot, and 8 more.\n- **Confidence-scored edges** — every relationship carries an `EXTRACTED` / `INFERRED` / `AMBIGUOUS` label and a numeric score; filter to a high-trust subgraph for strict checks.\n- **Incremental indexing** — SHA256 content-addressed cache (`--update`), git-diff mode (`--since`), filesystem watcher (`codegraph watch`), git hooks (`codegraph hook install`).\n- **Architecture conformance gate** — 5 built-in policies (cycles, cross-package, layer bypass, coupling ceiling, orphans) plus custom Cypher; ships with a GitHub Actions workflow scaffolded by `codegraph init`.\n- **Monorepo-friendly** — scope indexing to specific packages, exclude build/test artefacts by default, redact confidential routes/components from the graph via `.codegraphignore`.\n- **No LLM in the pipeline** — indexing is fully deterministic (AST + heuristic resolution). Predictable, reproducible, no cost-per-index.\n\n## 📑 Table of Contents\n\n- [Why a code knowledge graph?](#-why-a-code-knowledge-graph)\n- [Using with Claude Code \u0026 AI agents](#-using-with-claude-code--ai-agents)\n- [Architecture](#-architecture)\n- [CLI cheat sheet](#-cli-cheat-sheet)\n- [Graph schema](#-graph-schema)\n- [Example queries](#-example-queries)\n- [Configuration](#-configuration)\n- [Documentation](#-documentation)\n- [Roadmap](#-roadmap)\n- [Contributing](#-contributing)\n- [Contributors](#-contributors)\n- [Star history](#-star-history)\n- [License](#-license)\n\n## 🧠 Why a code knowledge graph?\n\nVector search over raw code chunks is a blunt instrument. It finds lexically similar snippets, not *architecturally relevant* ones. Questions like *\"which services does this controller transitively depend on?\"*, *\"who injects `AuthService`?\"*, or *\"which React components use this hook?\"* are graph queries, not similarity queries.\n\n`graphrag-code` gives an LLM (or a human) the structured backbone it needs:\n\n- **Retrieval-augmented generation (RAG)** over a TypeScript codebase with typed traversals instead of opaque embeddings.\n- **Architecture audits** — find hubs, cycles, orphans, tangled modules.\n- **Safer refactors** — understand the blast radius of a change before you make it.\n- **Onboarding** — let new engineers query the codebase in plain Cypher instead of reading files top-to-bottom.\n\n## 🤖 Using with Claude Code \u0026 AI agents\n\n`graphrag-code` is designed as a drop-in retrieval backend for agentic coding workflows. The typical pattern for [Claude Code](https://www.anthropic.com/claude-code) (and any other LLM coding agent — Cursor, Aider, Continue, custom MCP clients):\n\n1. **Index your repo once** (see [Quickstart](#-quickstart)) — `codegraph.cli index` walks the AST and loads the graph into Neo4j.\n2. **Expose the graph to your agent** — either via a thin MCP server, a CLI wrapper the agent can shell out to, or direct Bolt queries from tool-call handlers.\n3. **Let the agent ask architectural questions** in Cypher *before* editing code.\n\n### Why this beats embedding-only RAG for coding agents\n\nClaude Code and other coding agents work best with **structured, low-noise context**. Vector search over code chunks pulls back things that *look* similar; a typed graph answers the question the agent is *actually* asking:\n\n| Agent question | Graph query |\n| --- | --- |\n| *\"What would break if I rename `AuthService`?\"* | Reverse `INJECTS` + `IMPORTS*` traversal |\n| *\"What endpoints does `UserController` expose?\"* | `EXPOSES` direct lookup |\n| *\"Which React components call `useAuth`?\"* | `USES_HOOK` lookup |\n| *\"How is this file reached from the auth entrypoint?\"* | `shortestPath` on `IMPORTS` |\n| *\"Which services are DI hubs I should treat as core?\"* | `INJECTS` aggregation |\n\nAll answered in single-digit milliseconds, with zero tokens spent on retrieving irrelevant snippets.\n\n### Exposing the graph to Claude via MCP\n\ncodegraph ships a first-class **[Model Context Protocol](https://modelcontextprotocol.io/)** stdio server. Install the optional extra, add one block to Claude Code's config, and five typed tools appear in the agent's tool menu — no more shelling out to `codegraph query`.\n\n```bash\npip install \"codegraph[mcp]\"\n```\n\nIn `~/.claude.json` (or your Claude Desktop config):\n\n```json\n{\n  \"mcpServers\": {\n    \"codegraph\": {\n      \"command\": \"codegraph-mcp\",\n      \"type\": \"stdio\",\n      \"env\": {\n        \"CODEGRAPH_NEO4J_URI\":  \"bolt://localhost:7688\",\n        \"CODEGRAPH_NEO4J_USER\": \"neo4j\",\n        \"CODEGRAPH_NEO4J_PASS\": \"codegraph123\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Code. 16 tools become available:\n\n| Tool | Purpose |\n| --- | --- |\n| `query_graph(cypher, limit)` | Read-only Cypher escape hatch. Writes are rejected at the session level, so an LLM-generated `DROP`/`DELETE` can't mutate the graph. |\n| `describe_schema()` | Labels, relationship types, and per-label node counts — cheap way for an agent to learn what's in the graph at session start. |\n| `list_packages()` | Every indexed monorepo package with its detected framework, version, TypeScript flag, package manager, and detection confidence. |\n| `callers_of_class(class_name, file, max_depth, limit)` | Blast-radius traversal over `INJECTS` / `EXTENDS` / `IMPLEMENTS`. The canonical \"what breaks if I rename X\" query. |\n| `endpoints_for_controller(controller_name)` | HTTP routes exposed by a NestJS controller class (method + path + handler). |\n| `files_in_package(name, limit)` | List files belonging to a `:Package` by name. |\n| `hook_usage(hook_name, limit)` | Which components / functions use a given React hook. |\n| `gql_operation_callers(op_name, op_type, limit)` | Who calls a GraphQL query / mutation / subscription, optionally narrowed by type. |\n| `most_injected_services(limit)` | Rank `@Injectable` classes by number of unique callers — the classic \"DI hub detection\" query. |\n| `find_class(name_pattern, limit)` | Case-sensitive substring search over class names, backed by the `class_name` index. |\n| `find_function(name_pattern, limit)` | Case-sensitive substring search over function and method names, backed by the `func_name` and `method_name` indexes. |\n| `describe_function(name, file, limit)` | Signature details (docstring, params, return type, decorators) for a function or method — answer \"what does X do\" in one call. |\n| `calls_from(name, file, max_depth, limit)` | What a function/method calls, optionally transitive up to 5 hops via `:CALLS` edges. |\n| `callers_of(name, file, max_depth, limit)` | Who calls a function/method, optionally transitive up to 5 hops (reverse `:CALLS`). |\n| `reindex_file(path, package)` | Re-index a single file (delete old subgraph, parse, reload). Requires `--allow-write`. |\n| `wipe_graph(confirm)` | Delete every node and relationship from the graph. Requires `--allow-write`. |\n\nAll 16 tools share a single long-lived Neo4j driver and open sessions in `READ_ACCESS` mode. Configuration is env-var only (the same `CODEGRAPH_NEO4J_*` vars the CLI uses). The server is stdio-only — no network exposure.\n\n## 🏗️ Architecture\n\n```\n  TS / Python repo               Parser                Graph loader          Neo4j\n ┌────────────────┐      ┌──────────────────┐      ┌──────────────┐     ┌──────────┐\n │ *.ts / *.tsx   │ ───► │ tree-sitter walk  │ ───► │ Typed nodes  │───► │ Property │\n │ *.py           │      │ + framework       │      │ + edges      │     │ graph    │\n │ packages/*/src │      │ detection         │      │ + ownership  │     │          │\n └────────────────┘      │ (NestJS / React / │      └──────────────┘     └────┬─────┘\n                         │  FastAPI / Django)│                                │\n                         └──────────────────┘                                 ▼\n                                                                         Cypher / RAG\n                                                                         + MCP tools\n```\n\nAll indexing is local: your code never leaves the machine, and Neo4j runs in a Docker container alongside the CLI. The pipeline is fully deterministic — no LLM in the indexing path. Edges carry a `confidence` label (`EXTRACTED` / `INFERRED` / `AMBIGUOUS`) and a numeric score so consumers can filter the noisy parts of the graph out of strict checks.\n\n## 🛠️ CLI cheat sheet\n\n`codegraph` is a Typer app; every subcommand supports `--json` for agent-native output.\n\n| Command | Purpose |\n| --- | --- |\n| `codegraph init` | Scaffold codegraph into a repo (interactive). `--yes`, `--bolt-port`, `--http-port`, `--skip-docker`, `--skip-index`. |\n| `codegraph index \u003crepo\u003e` | Walk source, parse, write the graph. `-p/--package`, `--update` (SHA256 cache), `--since \u003cref\u003e` (git diff), `--no-wipe`, `--skip-ownership`, `--ignore-file`, `--json`. |\n| `codegraph query \u003ccypher\u003e` | Run a Cypher query. `-n/--limit`, `--json`. |\n| `codegraph arch-check` | Run architecture-conformance policies. Exits 1 on violations, 2 on config errors. |\n| `codegraph validate` | Sanity-check the loaded graph (counts, orphans, schema). |\n| `codegraph wipe` | `MATCH (n) DETACH DELETE n`. |\n| `codegraph stats` | Quick node / edge counts. Updates the `codegraph:stats-*` block in `CLAUDE.md` with `--update`. |\n| `codegraph export` | Produce `graph.html` (interactive), `graph.json`, and optional `graph.graphml` / `graph.cypher`. |\n| `codegraph benchmark` | Token-reduction benchmark vs. raw source. `--min-reduction` for CI gating. |\n| `codegraph report` | Generate `GRAPH_REPORT.md` from Leiden community detection. |\n| `codegraph watch` | Debounced filesystem watcher; rebuilds on save. Requires `[watch]` extra. |\n| `codegraph hook install` / `status` / `uninstall` | Manage post-commit + post-checkout git hooks that re-index automatically. |\n| `codegraph install \u003cplatform\u003e` | Wire codegraph into one of 14 AI agent platforms (writes rules file, registers MCP server). |\n| `codegraph uninstall \u003cplatform\u003e` | Remove integration; preserves shared rules sections still in use. |\n| `codegraph repl` | Interactive Cypher REPL. Same as `codegraph` with no args. |\n\nFull reference with every flag and `--json` shape: [`codegraph/docs/cli.md`](./codegraph/docs/cli.md).\n\n## 🧩 Graph schema\n\n**Nodes** — 15 typed labels with rich properties:\n\n| Kind | What it is |\n| --- | --- |\n| `Package` | One per configured monorepo package. Carries detected `framework` (React / Next.js / Vue / Angular / Svelte / SvelteKit / **NestJS** / Fastify / Odoo / **FastAPI** / Flask / Django), version, TS/JS flag, styling, router, state management, UI library, build tool, package manager, confidence. |\n| `File` | A `.ts` / `.tsx` / `.py` file. Properties: language, LOC, framework flags (`is_controller`, `is_injectable`, `is_module`, `is_component`, `is_entity`, `is_resolver`, `is_test`). |\n| `Class` | NestJS controllers / injectables / modules, TypeORM entities, GraphQL resolvers, Python classes. Carries `is_controller`, `is_injectable`, `base_path`, `table_name`, etc. |\n| `Method` | Class methods with visibility, async flag, return type, params, docstring. |\n| `Function` | Module-level functions, React components, FastAPI route handlers. Same metadata. |\n| `Interface` | TypeScript interfaces. |\n| `Endpoint` | HTTP route exposed by a controller (method + path + handler). NestJS, FastAPI, Flask, Django. |\n| `Column` | TypeORM / SQLAlchemy column with type, nullability, primary, generated. |\n| `GraphQLOperation` | Query / mutation / subscription with return type, resolver class, handler. |\n| `Event` | Event-bus events emitted or handled. |\n| `Atom` | Jotai / Recoil state atom. |\n| `EnvVar` | `process.env.X` / `os.environ['X']` reference. |\n| `Route` | React Router / Next.js / file-system route with target component. |\n| `External` | Symbol imported from `node_modules` / unresolved. |\n| `EdgeGroup` | Hyperedge — protocol implementer set or Leiden community. Members link via `MEMBER_OF`. |\n\n**Edges** — ~30 typed relationships, each with `confidence` + `confidence_score`. A representative slice:\n\n`IMPORTS`, `IMPORTS_SYMBOL`, `IMPORTS_EXTERNAL`, `DEFINES_CLASS`, `DEFINES_FUNC`, `DEFINES_IFACE`, `HAS_METHOD`, `HAS_COLUMN`, `EXPOSES`, `INJECTS`, `PROVIDES`, `EXPORTS_PROVIDER`, `EXTENDS`, `IMPLEMENTS`, `RENDERS`, `USES_HOOK`, `DECORATED_BY`, `CALLS`, `CALLS_ENDPOINT`, `RESOLVES`, `HANDLES`, `HANDLES_EVENT`, `EMITS_EVENT`, `READS_ATOM`, `WRITES_ATOM`, `READS_ENV`, `BELONGS_TO`, `MEMBER_OF`, `OWNED_BY`, `LAST_MODIFIED_BY`, `CONTRIBUTED_BY`, `TESTS`, `TESTS_CLASS`.\n\nFull catalogue with property details and example queries: [`codegraph/docs/schema.md`](./codegraph/docs/schema.md). Edge confidence model: [`codegraph/docs/confidence.md`](./codegraph/docs/confidence.md). Hyperedges: [`codegraph/docs/hyperedges.md`](./codegraph/docs/hyperedges.md).\n\n## 🔎 Example queries\n\nA handful of the queries in [`codegraph/queries.md`](codegraph/queries.md):\n\n```cypher\n// 1. Every HTTP endpoint with its controller\nMATCH (c:Class {is_controller:true})-[:EXPOSES]-\u003e(e:Endpoint)\nRETURN c.name, e.method, e.path, e.handler\nORDER BY c.name, e.path;\n\n// 2. Most-injected services (DI hubs)\nMATCH (svc:Class {is_injectable:true})\u003c-[:INJECTS]-(caller:Class)\nRETURN svc.name, count(caller) AS injections\nORDER BY injections DESC LIMIT 20;\n\n// 3. Which React components use a given hook?\nMATCH (:Hook {name:'useAuth'})\u003c-[:USES_HOOK]-(c:Function)\nRETURN c.name, c.file;\n\n// 4. Transitive dependencies of a file\nMATCH (:File {path:$start})-[:IMPORTS*1..3]-\u003e(d:File)\nRETURN DISTINCT d.path;\n```\n\nSee [`codegraph/queries.md`](codegraph/queries.md) for the full catalogue.\n\n## ⚙️ Configuration\n\n### Project config — `codegraph.toml`\n\n`codegraph` has **no hardcoded packages**. You tell it which packages to index via a `codegraph.toml` at the repo root, a `[tool.codegraph]` block in your existing `pyproject.toml`, or `--package` flags on the CLI. Config file values are loaded first; CLI flags override them.\n\n**`codegraph.toml`** (preferred — a standalone file, no interference with Python tooling):\n\n```toml\n# Paths are relative to the repo root. Each entry should be a TypeScript\n# package directory (i.e. contain a package.json / tsconfig.json so path\n# aliases can be resolved).\npackages = [\n  \"packages/server\",\n  \"packages/web\",\n]\n\n# Optional — these extend the built-in defaults, they don't replace them.\nexclude_dirs     = [\"custom-build\", \"fixtures\"]\nexclude_suffixes = [\".gen.ts\"]\n```\n\n**`pyproject.toml`** (if you already have one and want everything in one place):\n\n```toml\n[tool.codegraph]\npackages = [\"packages/server\", \"packages/web\"]\n```\n\n**CLI override** — wins over either file:\n\n```bash\ncodegraph index . --package packages/server --package packages/web\n```\n\nIf no config file exists and no `--package` flags are passed, `index` stops with a clear error. There are no Twenty-specific or other defaults.\n\n### Python support (`.py` indexing)\n\ncodegraph indexes Python codebases with the same fidelity as TypeScript. The detector auto-picks the language based on the package directory: if the directory contains `__init__.py`, `pyproject.toml`, or `setup.py`, it's parsed as Python; otherwise it's parsed as TypeScript.\n\nInstall the optional `[python]` extra to enable the Python frontend:\n\n```bash\npip install \"codegraph[python]\"\n```\n\nThen point `--package` at a Python package root:\n\n```bash\ncodegraph index . --package src/my_package\n```\n\nWhat's indexed:\n\n- **AST surface** — modules, classes, functions, methods, decorators, imports (relative + absolute + aliased), class inheritance, docstrings, type hints (`return_type`, `params_json`).\n- **Method call graph** — `:CALLS` edges between methods/functions with confidence-scored resolution.\n- **Framework detection** — FastAPI, Flask, Django, Odoo. Detection runs per package via `pyproject.toml` / requirements / source-pattern signals.\n- **Endpoints** — `@app.get/post/...` (FastAPI), `@app.route` (Flask), Django URL config → `:Endpoint` nodes with method + path + handler.\n- **ORM** — SQLAlchemy `Column(...)` and Django `models.Field()` → `:Column` nodes; relationships → `RELATES_TO` edges.\n- **Tests** — `test_*.py` / `*_test.py` are paired back to their production peer via `:TESTS` and `:TESTS_CLASS` edges.\n\n### Neo4j connection\n\nControlled via environment variables (defaults match the bundled `docker-compose.yml`):\n\n| Variable | Default |\n| --- | --- |\n| `CODEGRAPH_NEO4J_URI` | `bolt://localhost:7688` |\n| `CODEGRAPH_NEO4J_USER` | `neo4j` |\n| `CODEGRAPH_NEO4J_PASS` | `codegraph123` |\n\n### File walk exclusions\n\nIndexing always skips `node_modules`, `dist`, `build`, `.next`, `.turbo`, `.nuxt`, `.svelte-kit`, `.vercel`, `coverage`, `generated`, `__generated__`, `.cache`, `.parcel-cache`, plus `*.d.ts` and `*.stories.{ts,tsx}`. Add to these via `exclude_dirs` / `exclude_suffixes` in your config — those keys **extend** the defaults, they don't replace them.\n\n### `.codegraphignore`\n\nFor **confidential routes, components, or files** that shouldn't reach the graph (and therefore shouldn't reach any LLM agent querying it), drop a `.codegraphignore` file at the repo root. Syntax is gitignore-style, plus two codegraph extensions:\n\n```gitignore\n# Standard gitignore — file paths\n**/admin/**\n**/*.secret.ts\n!**/admin/public/**         # negation — re-include a subtree\n\n# Route patterns — match RouteNode.path\n@route:/admin/*\n@route:/settings/system/*\n\n# Component patterns — match React component / NestJS class names\n@component:*Admin*\n@component:*UserManagement*\n```\n\nOverride the default location with `--ignore-file PATH` on the CLI or `ignore_file = \"custom/.ignore\"` in `codegraph.toml`. `.codegraphignore` is **additive** on top of `BASE_EXCLUDE_DIRS` — it doesn't replace them.\n\n## 📚 Documentation\n\nDeep dives, organised by topic:\n\n| Topic | Doc |\n| --- | --- |\n| Inner package overview, all 16 CLI commands at a glance | [`codegraph/README.md`](./codegraph/README.md) |\n| Per-command reference (every flag, every `--json` shape) | [`codegraph/docs/cli.md`](./codegraph/docs/cli.md) |\n| Per-tool reference for the MCP server | [`codegraph/docs/mcp.md`](./codegraph/docs/mcp.md) |\n| Full graph schema — nodes, edges, properties, indexing phases | [`codegraph/docs/schema.md`](./codegraph/docs/schema.md) |\n| Edge confidence labels and scores | [`codegraph/docs/confidence.md`](./codegraph/docs/confidence.md) |\n| `:EdgeGroup` hyperedges (protocol implementers, communities) | [`codegraph/docs/hyperedges.md`](./codegraph/docs/hyperedges.md) |\n| Incremental indexing — `--update`, `--since`, `watch`, `hook` | [`codegraph/docs/incremental.md`](./codegraph/docs/incremental.md) |\n| AI platform integrations (14 platforms) | [`codegraph/docs/platforms.md`](./codegraph/docs/platforms.md) |\n| Architecture-conformance policies | [`codegraph/docs/arch-policies.md`](./codegraph/docs/arch-policies.md) |\n| `codegraph init` walkthrough | [`codegraph/docs/init.md`](./codegraph/docs/init.md) |\n| Canonical Cypher query catalogue | [`codegraph/queries.md`](./codegraph/queries.md) |\n| Version-by-version changelog | [`CHANGELOG.md`](./CHANGELOG.md) |\n\n## 🛣️ Roadmap\n\nRecent shipped highlights — full per-version detail in [`CHANGELOG.md`](./CHANGELOG.md):\n\n- ~~First-class MCP server exposing the graph to LLM agents~~ — **shipped** (16 tools, see [Exposing the graph to Claude via MCP](#exposing-the-graph-to-claude-via-mcp))\n- ~~Python language frontend~~ — **shipped** (Stage 1 parsing + Stage 2 framework detection / endpoints / ORM)\n- ~~Incremental re-indexing on file changes~~ — **shipped** (`--update` SHA256 cache, `--since \u003cref\u003e`, `codegraph watch`, `codegraph hook install`)\n- ~~Multi-platform AI agent integrations~~ — **shipped** (`codegraph install \u003cplatform\u003e` for 14 platforms: Claude Code, Codex, Cursor, Gemini CLI, Copilot, Aider, …)\n- ~~Edge-level confidence labels~~ — **shipped** (`EXTRACTED` / `INFERRED` / `AMBIGUOUS` with numeric scores)\n- ~~Hyperedge model for protocol implementers + communities~~ — **shipped** (`:EdgeGroup` nodes)\n- ~~Architecture-conformance policies~~ — **shipped** (5 built-in: import cycles, cross-package, layer bypass, coupling ceiling, orphan detection — plus custom Cypher policies)\n\nUp next:\n\n- Go and Rust language frontends\n- Pre-built RAG retrievers for common architecture questions\n- Auto-generated graph visualisations as PR comments\n\n## 🤝 Contributing\n\nPRs welcome. The repository uses protected branches:\n\n- **`main`** — production-ready code. All changes land here via PR.\n- **`release`** — release-candidate branch. Stabilisation before tagging.\n- **`hotfix`** — urgent fixes that need to skip the normal cycle.\n\nEvery PR into `main`, `release`, or `hotfix` requires a Code Owner review (see [`CODEOWNERS`](CODEOWNERS)). Please open an issue before a large refactor so we can align on direction.\n\n## 👥 Contributors\n\nThanks to everyone who has helped shape `graphrag-code`:\n\n\u003ca href=\"https://github.com/cognitx-leyton/graphrag-code/graphs/contributors\"\u003e\n  \u003cimg alt=\"Avatar grid of graphrag-code contributors\" src=\"https://contrib.rocks/image?repo=cognitx-leyton/graphrag-code\" /\u003e\n\u003c/a\u003e\n\n*Made with [contrib.rocks](https://contrib.rocks).*\n\n## ⭐ Star history\n\nIf `graphrag-code` helps you make sense of a TypeScript monorepo, a star helps others find it too.\n\n\u003ca href=\"https://www.star-history.com/?repos=cognitx-leyton%2Fgraphrag-code\u0026type=date\u0026legend=top-left\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/chart?repos=cognitx-leyton/graphrag-code\u0026type=date\u0026theme=dark\u0026legend=top-left\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/chart?repos=cognitx-leyton/graphrag-code\u0026type=date\u0026legend=top-left\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/chart?repos=cognitx-leyton/graphrag-code\u0026type=date\u0026legend=top-left\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n\n## 📄 License\n\nLicensed under the [Apache License 2.0](LICENSE). Copyright © [Leyton CognitX](https://cognitx.leyton.com/) and contributors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcognitx-leyton%2Fcodegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcognitx-leyton%2Fcodegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcognitx-leyton%2Fcodegraph/lists"}