# cgx — Codebase Knowledge Graph

> Auto-generated by cgx on 2026-05-04T17:22:43.303495+00:00. Do not edit manually.
> Re-run `cgx analyze` to refresh.

## When to Use cgx

Use cgx commands INSTEAD of reading source files when you need to:
- Find where any function, class, or variable is defined
- Understand what depends on a specific piece of code
- Know what will break before making a change
- Understand the architecture of an unfamiliar area
- Find who owns a file or module
- Find dead code or unused exports
- Trace a full call chain from entry point to implementation

**Rule: Never open a file speculatively. Query first. Open only if you need
the implementation body — not to find where something lives.**

## Trigger Patterns

Run cgx automatically when the user says or implies any of:
- "what calls X" / "who uses X" / "what depends on X"
- "show me the architecture" / "how does this work"
- "what breaks if I change X" / "blast radius of X"
- "find X in the codebase" / "where is X defined"
- "who owns X" / "who wrote X"
- "is X used anywhere" / "is X dead code"
- Starting a new task in an unfamiliar part of the codebase
- Before making any edit to a function with many callers

## Commands

```bash
# Always run first in a new session
cgx summary

# Find any symbol
cgx query find <name>
cgx query find <name> --kind=Function

# Dependencies of a node
cgx query deps <node-name>

# Blast radius — run BEFORE every edit
cgx query blast-radius <function-name>

# Trace a call path
cgx query chain "<A> -> <B>"

# High-risk files
cgx hotspots

# Code ownership
cgx query owners <path>

# Search by concept
cgx query search "<phrase>"

# Community / cluster
cgx query community <id-or-name>

# Dead code
cgx query dead-code
```

## Workflow: Starting a Task

1. `cgx summary`                        — orient yourself
2. `cgx query find <entry-point>`       — locate the relevant node
3. `cgx query blast-radius <node>`      — know the risk before touching it
4. Open only the specific files you need

## Workflow: Before Every Edit

1. `cgx query blast-radius <function>`  — what breaks?
2. `cgx query deps <function>`          — what does it depend on?
3. Make the change
4. `cgx query blast-radius <function>`  — verify ripple is as expected

## Token Budget

| Action                    | Approx tokens |
|---------------------------|---------------|
| `cgx summary`             | ~400          |
| `cgx query find X`        | ~200          |
| `cgx query blast-radius X`| ~300-800      |
| Opening one source file   | ~2,000-15,000 |

Prefer 3 cgx queries over opening 1 file speculatively.

## This Codebase

- **Indexed:** 2026-05-04T17:22:43.303495+00:00
- **Nodes:** 12 (7 functions,
  0 classes, 3 files)
- **Edges:** 13
- **Languages:** typescript 100%
- **Communities:** 3

### Top Communities
- **#2** — File:src/db.ts (5 nodes)
- **#3** — File:src/auth.ts (4 nodes)
- **#1** — File:src/router.ts (3 nodes)

### Hotspots (highest risk — review carefully before editing)
- `src/auth.ts` — churn 1.00, 3 callers
- `src/db.ts` — churn 1.00, 2 callers
- `src/router.ts` — churn 0.33, 1 callers

### Entry Points (nothing imports these — safe starting points)
_(none detected)_


### Most Depended-On Nodes (god nodes — change with extreme care)
- `query` — 1 callers
- `logout` — 1 callers
- `resetPassword` — 1 callers
- `login` — 1 callers
- `handleLogin` — 1 callers
