# cgx — Codebase Knowledge Graph

> Auto-generated by cgx on 2026-05-10T09:36:29.087463+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 — MANDATORY

You MUST run cgx (CLI or MCP) automatically — without waiting to be asked — whenever:
- "what calls X" / "who uses X" / "what depends on X"
- "show me the architecture" / "how does this work" / "explain X"
- "what breaks if I change X" / "blast radius of X"
- "find X in the codebase" / "where is X defined" / "where is X used"
- "who owns X" / "who wrote X" / "git blame X"
- "is X used anywhere" / "is X dead code" / "can I delete X"
- Starting ANY new task — run `cgx summary` before touching any file
- Before ANY edit — run `cgx query blast-radius` on the target function
- After any question about code structure, dependencies, or architecture

Never grep or open source files to answer structural questions. cgx is always faster and cheaper.

## Commands

If cgx is available as an MCP tool (preferred — no subprocess):
```
get_repo_summary            # orient: nodes, communities, hotspots
find_symbol <name>          # locate any function/class/type
get_blast_radius <node_id>  # what breaks if this changes
get_neighbors <node_id>     # direct dependencies
get_call_chain <from> <to>  # trace a call path
get_hotspots                # riskiest files to edit
get_file_owners <path>      # git blame ownership
search_graph <query>        # full-text search
run_query <sql>             # raw SQL against the graph
```

If cgx is available as a CLI:
```bash
cgx summary                           # orient yourself
cgx query find <name>                 # locate a symbol
cgx query find <name> --kind=Function
cgx query blast-radius <function>     # change impact (run BEFORE every edit)
cgx query deps <node-name>            # what does this depend on
cgx query chain "<A> -> <B>"          # trace call path
cgx hotspots                          # high-risk files
cgx query owners <path>               # file ownership
cgx query search "<phrase>"           # search by concept
cgx query community <id-or-name>      # explore a cluster
cgx query dead-code                   # find unused exports
```

## Dead Code Commands
```bash
cgx query dead-code --summary
cgx query dead-code --safe-to-delete
cgx query dead-code --kind=exports --path=src/auth/
cgx query dead-code --kind=files
```

## 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-10T09:36:29.087463+00:00
- **Nodes:** 23 (15 functions,
  2 classes, 6 files)
- **Edges:** 52
- **Languages:** typescript 100%
- **Communities:** 7
- **Dead code candidates:** 11 (2 high confidence · safe to investigate)

### Top Communities
- **#7** — Class:UserService (6 nodes)
- **#1** — Class:AuthService (4 nodes)
- **#3** — Function:getUser (3 nodes)
- **#5** — Function:query (3 nodes)
- **#2** — Function:handleDeleteUser (3 nodes)

### Hotspots (highest risk — review carefully before editing)
_(none — no git history or low churn)_


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


### Most Depended-On Nodes (god nodes — change with extreme care)
- `query` — 5 callers
- `AuthService` — 3 callers
- `login` — 3 callers
- `deleteUser` — 2 callers
- `hashPassword` — 2 callers
