# malburi/ax-navi-cli architecture

> Architecture diagram of the GitHub repository malburi/ax-navi-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/malburi/ax-navi-cli
- Repository: https://github.com/malburi/ax-navi-cli

## Overview

AX-NAVI CLI is an AI development navigator for legacy codebases. Its main workflow is to build a deterministic code index, use that evidence to answer questions or assess changes, then run agent-assisted work with write approval and post-change checks. The graph also includes documented wiki generation and MCP access. Some capability branches are based on the README because their implementation was not sampled; unsupported internal links are omitted.

Main entry points: [`packages/indexer/index.mjs`](https://github.com/malburi/ax-navi-cli/blob/main/packages/indexer/index.mjs) (Indexer facade), [`packages/provider-agent-sdk/src/index.mjs`](https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-agent-sdk/src/index.mjs) (Agent SDK provider), [`agents/lib/build-index.mjs`](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/build-index.mjs) (Index builder), [`packages/core/src/loop.mjs`](https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/loop.mjs) (Agent loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI experience"]
  node_cli["AX-NAVI CLI<br/>[bin.mjs]"]
  node_repl["Interactive REPL<br/>[repl.mjs]"]
end

subgraph group_indexing["Codebase map"]
  node_indexer["Indexer facade<br/>[index.mjs]"]
  node_indexbuild["Index builder<br/>[build-index.mjs]"]
  node_adapters["Language adapters<br/>[registry.mjs]"]
  node_dispatch["Dispatch analysis<br/>[dispatch.mjs]"]
  node_indexquery["Index queries<br/>[query-index.mjs]"]
  node_coverage["Coverage report"]
end

subgraph group_agent["Agent runtime"]
  node_loop["Agent loop<br/>[loop.mjs]"]
  node_gateway["Tool gateway<br/>[gateway.mjs]"]
  node_index_tool["Index tool<br/>[index-query.mjs]"]
  node_provider["Claude CLI provider<br/>[index.mjs]"]
  node_sdk["Agent SDK provider<br/>[index.mjs]"]
end

subgraph group_safety["Safety and audit"]
  node_writeguard["Write guard<br/>[write-guard.mjs]"]
  node_plug_hooks["Plugin hooks<br/>[hooks.mjs]"]
  node_audit["Turn audit<br/>[turn-audit.mjs]"]
  node_encoding["Legacy encoding"]
end

subgraph group_integrations["Interfaces and outputs"]
  node_mcp["MCP server<br/>[server.mjs]"]
  node_wiki["Wiki generation"]
end

node_user(("Developer"))
node_claude(("Claude runtime"))

node_user -->|"runs"| node_cli
node_cli -.->|"opens"| node_repl
node_user -->|"builds map"| node_indexer
node_indexer -->|"re-exports"| node_indexbuild
node_indexer -->|"re-exports"| node_indexquery
node_indexer -->|"re-exports"| node_coverage
node_indexbuild -->|"uses adapters"| node_adapters
node_indexbuild -->|"uses analysis"| node_dispatch
node_indexquery -->|"uses analysis"| node_dispatch
node_user -->|"asks impact"| node_indexquery
node_repl -.->|"starts work"| node_loop
node_loop -->|"dispatches tools"| node_gateway
node_gateway -->|"checks writes"| node_writeguard
node_index_tool -->|"queries map"| node_indexer
node_loop -.->|"uses provider"| node_provider
node_sdk -->|"checks edits"| node_writeguard
node_sdk -->|"reuses helpers"| node_provider
node_provider -->|"invokes CLI"| node_claude
node_mcp -->|"queries map"| node_indexer
node_plug_hooks -->|"snapshots changes"| node_audit
node_plug_hooks -->|"checks writes"| node_writeguard
node_audit -->|"repairs encoding"| node_encoding
node_sdk -->|"restores files"| node_encoding
node_user -->|"requests wiki"| node_wiki

click node_cli "https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/bin.mjs"
click node_repl "https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/repl.mjs"
click node_indexer "https://github.com/malburi/ax-navi-cli/blob/main/packages/indexer/index.mjs"
click node_indexbuild "https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/build-index.mjs"
click node_adapters "https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/adapters/registry.mjs"
click node_dispatch "https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/index/dispatch.mjs"
click node_indexquery "https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/query-index.mjs"
click node_coverage "https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/coverage-report.mjs"
click node_loop "https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/loop.mjs"
click node_gateway "https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/tools/gateway.mjs"
click node_index_tool "https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/tools/builtin/index-query.mjs"
click node_provider "https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-claude-cli/src/index.mjs"
click node_sdk "https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-agent-sdk/src/index.mjs"
click node_mcp "https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/mcp/server.mjs"
click node_writeguard "https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/safety/write-guard.mjs"
click node_plug_hooks "https://github.com/malburi/ax-navi-cli/blob/main/packages/plugin/src/hooks.mjs"
click node_audit "https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/turn-audit.mjs"
click node_encoding "https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-claude-cli/src/legacy-encoding.mjs"
click node_wiki "https://github.com/malburi/ax-navi-cli/tree/main/agents/lib"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_repl toneBlue
class node_indexer,node_indexbuild,node_adapters,node_dispatch,node_indexquery,node_coverage toneAmber
class node_loop,node_gateway,node_index_tool,node_provider,node_sdk toneMint
class node_writeguard,node_plug_hooks,node_audit,node_encoding toneRose
class node_mcp,node_wiki,node_user,node_claude toneIndigo
```

## Components

### CLI experience

- [AX-NAVI CLI](https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/bin.mjs): `packages/cli/src/bin.mjs`
- [Interactive REPL](https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/repl.mjs): `packages/cli/src/repl.mjs`

### Codebase map

- [Indexer facade](https://github.com/malburi/ax-navi-cli/blob/main/packages/indexer/index.mjs): `packages/indexer/index.mjs`
- [Index builder](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/build-index.mjs): `agents/lib/build-index.mjs`
- [Language adapters](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/adapters/registry.mjs): `agents/lib/adapters/registry.mjs`
- [Dispatch analysis](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/index/dispatch.mjs): `agents/lib/index/dispatch.mjs`
- [Index queries](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/query-index.mjs): `agents/lib/query-index.mjs`
- [Coverage report](https://github.com/malburi/ax-navi-cli/blob/main/agents/lib/coverage-report.mjs): `agents/lib/coverage-report.mjs`

### Agent runtime

- [Agent loop](https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/loop.mjs): `packages/core/src/loop.mjs`
- [Tool gateway](https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/tools/gateway.mjs): `packages/core/src/tools/gateway.mjs`
- [Index tool](https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/tools/builtin/index-query.mjs): `packages/core/src/tools/builtin/index-query.mjs`
- [Claude CLI provider](https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-claude-cli/src/index.mjs): `packages/provider-claude-cli/src/index.mjs`
- [Agent SDK provider](https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-agent-sdk/src/index.mjs): `packages/provider-agent-sdk/src/index.mjs`

### Safety and audit

- [Write guard](https://github.com/malburi/ax-navi-cli/blob/main/packages/core/src/safety/write-guard.mjs): `packages/core/src/safety/write-guard.mjs`
- [Plugin hooks](https://github.com/malburi/ax-navi-cli/blob/main/packages/plugin/src/hooks.mjs): `packages/plugin/src/hooks.mjs`
- [Turn audit](https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/turn-audit.mjs): `packages/cli/src/turn-audit.mjs`
- [Legacy encoding](https://github.com/malburi/ax-navi-cli/blob/main/packages/provider-claude-cli/src/legacy-encoding.mjs): `packages/provider-claude-cli/src/legacy-encoding.mjs`

### Interfaces and outputs

- [MCP server](https://github.com/malburi/ax-navi-cli/blob/main/packages/cli/src/mcp/server.mjs): `packages/cli/src/mcp/server.mjs`
- [Wiki generation](https://github.com/malburi/ax-navi-cli/tree/main/agents/lib): `agents/lib`

### Other components

- **Developer**
- **Claude runtime**

## Connections

- Developer → AX-NAVI CLI: runs (evidence: `README.md`)
- AX-NAVI CLI → Interactive REPL: opens
- Developer → Indexer facade: builds map (evidence: `README.md`)
- Indexer facade → Index builder: re-exports (evidence: `packages/indexer/index.mjs`)
- Indexer facade → Index queries: re-exports (evidence: `packages/indexer/index.mjs`)
- Indexer facade → Coverage report: re-exports (evidence: `packages/indexer/index.mjs`)
- Index builder → Language adapters: uses adapters (evidence: `agents/lib/build-index.mjs`)
- Index builder → Dispatch analysis: uses analysis (evidence: `agents/lib/build-index.mjs`)
- Index queries → Dispatch analysis: uses analysis (evidence: `agents/lib/query-index.mjs`)
- Developer → Index queries: asks impact (evidence: `README.md`)
- Interactive REPL → Agent loop: starts work
- Agent loop → Tool gateway: dispatches tools (evidence: `packages/core/src/loop.mjs`)
- Tool gateway → Write guard: checks writes (evidence: `packages/core/src/tools/gateway.mjs`)
- Index tool → Indexer facade: queries map (evidence: `packages/core/src/tools/builtin/index-query.mjs`)
- Agent loop → Claude CLI provider: uses provider
- Agent SDK provider → Write guard: checks edits (evidence: `packages/provider-agent-sdk/src/index.mjs`)
- Agent SDK provider → Claude CLI provider: reuses helpers (evidence: `packages/provider-agent-sdk/src/index.mjs`)
- Claude CLI provider → Claude runtime: invokes CLI (evidence: `packages/provider-claude-cli/src/index.mjs`)
- MCP server → Indexer facade: queries map (evidence: `packages/cli/src/mcp/server.mjs`)
- Plugin hooks → Turn audit: snapshots changes (evidence: `packages/plugin/src/hooks.mjs`)
- Plugin hooks → Write guard: checks writes (evidence: `packages/plugin/src/hooks.mjs`)
- Turn audit → Legacy encoding: repairs encoding (evidence: `packages/cli/src/turn-audit.mjs`)
- Agent SDK provider → Legacy encoding: restores files (evidence: `packages/provider-agent-sdk/src/index.mjs`)
- Developer → Wiki generation: requests wiki (evidence: `README.md`)
