# skibidiskib/ai-codex architecture

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

- Interactive diagram: https://gitdiagram.com/skibidiskib/ai-codex
- Repository: https://github.com/skibidiskib/ai-codex

## Overview

ai-codex is a CLI that scans a project and generates compact Markdown indexes for AI coding assistants. Its main workflow parses CLI/config options, detects a framework, scans routes, pages, components, library exports and supported database schemas, then writes applicable index files. The graph preserves the documented output capabilities, including runtime detection for SvelteKit. Source excerpts show the CLI-to-orchestrator flow and generator dispatch; framework-specific generation is partly sampled, so unsupported internal handoffs are omitted.

Main entry points: [`src/core.ts`](https://github.com/skibidiskib/ai-codex/blob/master/src/core.ts) (Framework detection and dispatch), [`src/helpers.ts`](https://github.com/skibidiskib/ai-codex/blob/master/src/helpers.ts) (Filesystem helpers), [`src/generators/schema.ts`](https://github.com/skibidiskib/ai-codex/blob/master/src/generators/schema.ts) (Schema parsing and index), [`src/adapters/sveltekit.ts`](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/sveltekit.ts) (SvelteKit scanning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and orchestration"]
  node_cli["CLI and config<br/>[generate-codex.ts]"]
  node_orchestrator["Framework detection and dispatch<br/>[core.ts]"]
end

subgraph group_frameworks["Framework scanning"]
  node_next["Next.js scanning<br/>[nextjs.ts]"]
  node_svelte["SvelteKit scanning<br/>[sveltekit.ts]"]
end

subgraph group_indexes["Index generation"]
  node_routes["Route index<br/>[nextjs.ts]"]
  node_pages["Page index<br/>[nextjs.ts]"]
  node_components["Component index<br/>[nextjs.ts]"]
  node_library["Library exports<br/>[lib.ts]"]
  node_schema["Schema parsing and index<br/>[schema.ts]"]
  node_routesfile["routes.md"]
  node_pagesfile["pages.md"]
  node_componentsfile["components.md"]
  node_libfile["lib.md<br/>[lib.md]"]
  node_schemafile["schema.md"]
end

subgraph group_shared["Shared utilities"]
  node_helpers["Filesystem helpers<br/>[helpers.ts]"]
  node_types["Shared data types<br/>[types.ts]"]
end

node_developer(("Project operator"))

node_developer -->|"runs"| node_cli
node_cli -->|"calls main"| node_orchestrator
node_orchestrator -->|"detects and dispatches"| node_next
node_orchestrator -->|"detects and dispatches"| node_svelte
node_orchestrator -->|"generates routes"| node_routes
node_orchestrator -->|"generates pages"| node_pages
node_orchestrator -->|"generates components"| node_components
node_orchestrator -->|"calls generator"| node_library
node_orchestrator -->|"calls generator"| node_schema
node_routes -.->|"produces"| node_routesfile
node_pages -.->|"produces"| node_pagesfile
node_components -.->|"produces"| node_componentsfile
node_library -.->|"produces"| node_libfile
node_schema -.->|"produces"| node_schemafile
node_next -->|"uses"| node_helpers
node_svelte -->|"uses"| node_helpers
node_svelte -->|"parses bindings"| node_schema
node_library -->|"uses"| node_helpers
node_schema -->|"uses"| node_helpers
node_orchestrator -->|"uses"| node_helpers
node_orchestrator -->|"uses types"| node_types

click node_cli "https://github.com/skibidiskib/ai-codex/blob/master/src/generate-codex.ts"
click node_orchestrator "https://github.com/skibidiskib/ai-codex/blob/master/src/core.ts"
click node_next "https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts"
click node_svelte "https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/sveltekit.ts"
click node_routes "https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts"
click node_pages "https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts"
click node_components "https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts"
click node_library "https://github.com/skibidiskib/ai-codex/blob/master/src/generators/lib.ts"
click node_schema "https://github.com/skibidiskib/ai-codex/blob/master/src/generators/schema.ts"
click node_libfile "https://github.com/skibidiskib/ai-codex/blob/master/.ai-codex/lib.md"
click node_helpers "https://github.com/skibidiskib/ai-codex/blob/master/src/helpers.ts"
click node_types "https://github.com/skibidiskib/ai-codex/blob/master/src/types.ts"

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_orchestrator toneBlue
class node_next,node_svelte toneAmber
class node_routes,node_pages,node_components,node_library,node_schema,node_routesfile,node_pagesfile,node_componentsfile,node_libfile,node_schemafile toneMint
class node_helpers,node_types toneRose
class node_developer toneIndigo
```

## Components

### CLI and orchestration

- [CLI and config](https://github.com/skibidiskib/ai-codex/blob/master/src/generate-codex.ts): `src/generate-codex.ts`
- [Framework detection and dispatch](https://github.com/skibidiskib/ai-codex/blob/master/src/core.ts): `src/core.ts`

### Framework scanning

- [Next.js scanning](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts): `src/adapters/nextjs.ts`
- [SvelteKit scanning](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/sveltekit.ts): `src/adapters/sveltekit.ts`

### Index generation

- [Route index](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts): `src/adapters/nextjs.ts`
- [Page index](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts): `src/adapters/nextjs.ts`
- [Component index](https://github.com/skibidiskib/ai-codex/blob/master/src/adapters/nextjs.ts): `src/adapters/nextjs.ts`
- [Library exports](https://github.com/skibidiskib/ai-codex/blob/master/src/generators/lib.ts): `src/generators/lib.ts`
- [Schema parsing and index](https://github.com/skibidiskib/ai-codex/blob/master/src/generators/schema.ts): `src/generators/schema.ts`
- **routes.md**
- **pages.md**
- **components.md**
- [lib.md](https://github.com/skibidiskib/ai-codex/blob/master/.ai-codex/lib.md): `.ai-codex/lib.md`
- **schema.md**

### Shared utilities

- [Filesystem helpers](https://github.com/skibidiskib/ai-codex/blob/master/src/helpers.ts): `src/helpers.ts`
- [Shared data types](https://github.com/skibidiskib/ai-codex/blob/master/src/types.ts): `src/types.ts`

### Other components

- **Project operator**

## Connections

- Project operator → CLI and config: runs (evidence: `README.md`)
- CLI and config → Framework detection and dispatch: calls main (evidence: `src/generate-codex.ts`)
- Framework detection and dispatch → Next.js scanning: detects and dispatches (evidence: `src/core.ts`)
- Framework detection and dispatch → SvelteKit scanning: detects and dispatches (evidence: `src/core.ts`)
- Framework detection and dispatch → Route index: generates routes (evidence: `src/core.ts`)
- Framework detection and dispatch → Page index: generates pages (evidence: `src/core.ts`)
- Framework detection and dispatch → Component index: generates components (evidence: `src/core.ts`)
- Framework detection and dispatch → Library exports: calls generator (evidence: `src/core.ts`)
- Framework detection and dispatch → Schema parsing and index: calls generator (evidence: `src/core.ts`)
- Route index → routes.md: produces (evidence: `README.md`)
- Page index → pages.md: produces (evidence: `README.md`)
- Component index → components.md: produces (evidence: `README.md`)
- Library exports → lib.md: produces (evidence: `README.md`)
- Schema parsing and index → schema.md: produces (evidence: `README.md`)
- Next.js scanning → Filesystem helpers: uses (evidence: `src/adapters/nextjs.ts`)
- SvelteKit scanning → Filesystem helpers: uses (evidence: `src/adapters/sveltekit.ts`)
- SvelteKit scanning → Schema parsing and index: parses bindings (evidence: `src/adapters/sveltekit.ts`)
- Library exports → Filesystem helpers: uses (evidence: `src/generators/lib.ts`)
- Schema parsing and index → Filesystem helpers: uses (evidence: `src/generators/schema.ts`)
- Framework detection and dispatch → Filesystem helpers: uses (evidence: `src/core.ts`)
- Framework detection and dispatch → Shared data types: uses types (evidence: `src/core.ts`)
