# coderamp-labs/gitrules architecture

> Architecture diagram of the GitHub repository coderamp-labs/gitrules, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coderamp-labs/gitrules
- Repository: https://github.com/coderamp-labs/gitrules

## Overview

Gitrules is a browser-based composer for AI coding context files. Users select agents, rules, and MCP presets, edit them in a persistent workspace, then generate files and a one-click installer script. A separate recommendation flow ingests repository context and uses an LLM to suggest a minimal selection. The graph includes the documented search and MCP-facing capabilities; some route and UI wiring is inferred only from module names or README descriptions because those sources were not sampled.

Main entry points: [`app/services/actions_loader.py`](https://github.com/coderamp-labs/gitrules/blob/main/app/services/actions_loader.py) (Action loader), [`app/main.py`](https://github.com/coderamp-labs/gitrules/blob/main/app/main.py) (FastAPI application), [`app/static/js/workspace_manager.js`](https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/workspace_manager.js) (Workspace state), [`app/routes/generate.py`](https://github.com/coderamp-labs/gitrules/blob/main/app/routes/generate.py) (File generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workspace"]
  node_app["FastAPI application<br/>[main.py]"]
  node_workspace["Workspace state"]
  node_context_ui["Context controls<br/>[context_manager.js]"]
  node_file_tree["File tree UI<br/>[file_tree.js]"]
  node_editor["Monaco editor UI<br/>[monaco_editor.js]"]
end

subgraph group_catalog["Action catalog"]
  node_actions_data["Action presets"]
  node_action_models["Action models<br/>[actions.py]"]
  node_actions_loader["Action loader<br/>[actions_loader.py]"]
  node_actions_routes["Action API<br/>[actions.py]"]
  node_search["Fuzzy search<br/>[search_service.py]"]
end

subgraph group_generation["Generation and install"]
  node_generate_route["File generation<br/>[generate.py]"]
  node_install_script["Install script sharing<br/>[generate.py]"]
end

subgraph group_recommend["Discovery and recommendations"]
  node_recommend_route["Recommendations API<br/>[recommend.py]"]
  node_ingest["Repository ingestion<br/>[smart_ingest.py]"]
  node_recommend_service["Tool recommendation<br/>[recommend_tools.py]"]
end

node_user(("Workspace user"))
node_gitingest["Gitingest service"]
node_llm["LLM service"]

node_user -->|"opens workspace"| node_app
node_app -->|"serves workspace"| node_workspace
node_workspace -->|"manages contexts"| node_context_ui
node_workspace -->|"renders files"| node_file_tree
node_workspace -->|"edits files"| node_editor
node_app -->|"mounts routes"| node_actions_routes
node_actions_routes -->|"loads actions"| node_actions_loader
node_actions_loader -->|"reads presets"| node_actions_data
node_actions_loader -->|"builds models"| node_action_models
node_search -->|"searches catalog"| node_actions_loader
node_app -->|"mounts routes"| node_generate_route
node_generate_route -->|"loads selections"| node_actions_loader
node_generate_route -->|"generates installer"| node_install_script
node_user -->|"requests suggestions"| node_recommend_route
node_recommend_route -->|"ingests repository"| node_ingest
node_ingest -->|"submits repository"| node_gitingest
node_recommend_route -->|"requests selection"| node_recommend_service
node_recommend_service -->|"requests recommendations"| node_llm

click node_app "https://github.com/coderamp-labs/gitrules/blob/main/app/main.py"
click node_workspace "https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/workspace_manager.js"
click node_context_ui "https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/context_manager.js"
click node_file_tree "https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/file_tree.js"
click node_editor "https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/monaco_editor.js"
click node_actions_data "https://github.com/coderamp-labs/gitrules/tree/main/app/actions"
click node_action_models "https://github.com/coderamp-labs/gitrules/blob/main/app/models/actions.py"
click node_actions_loader "https://github.com/coderamp-labs/gitrules/blob/main/app/services/actions_loader.py"
click node_actions_routes "https://github.com/coderamp-labs/gitrules/blob/main/app/routes/actions.py"
click node_search "https://github.com/coderamp-labs/gitrules/blob/main/app/services/search_service.py"
click node_generate_route "https://github.com/coderamp-labs/gitrules/blob/main/app/routes/generate.py"
click node_install_script "https://github.com/coderamp-labs/gitrules/blob/main/app/routes/generate.py"
click node_recommend_route "https://github.com/coderamp-labs/gitrules/blob/main/app/routes/recommend.py"
click node_ingest "https://github.com/coderamp-labs/gitrules/blob/main/app/services/smart_ingest.py"
click node_recommend_service "https://github.com/coderamp-labs/gitrules/blob/main/app/services/recommend_tools.py"

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_app,node_workspace,node_context_ui,node_file_tree,node_editor,node_user toneBlue
class node_actions_data,node_action_models,node_actions_loader,node_actions_routes,node_search toneAmber
class node_generate_route,node_install_script toneMint
class node_recommend_route,node_ingest,node_recommend_service toneRose
class node_gitingest,node_llm toneIndigo
```

## Components

### Web workspace

- [FastAPI application](https://github.com/coderamp-labs/gitrules/blob/main/app/main.py): `app/main.py`
- [Workspace state](https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/workspace_manager.js): `app/static/js/workspace_manager.js`
- [Context controls](https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/context_manager.js): `app/static/js/context_manager.js`
- [File tree UI](https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/file_tree.js): `app/static/js/file_tree.js`
- [Monaco editor UI](https://github.com/coderamp-labs/gitrules/blob/main/app/static/js/monaco_editor.js): `app/static/js/monaco_editor.js`

### Action catalog

- [Action presets](https://github.com/coderamp-labs/gitrules/tree/main/app/actions): `app/actions`
- [Action models](https://github.com/coderamp-labs/gitrules/blob/main/app/models/actions.py): `app/models/actions.py`
- [Action loader](https://github.com/coderamp-labs/gitrules/blob/main/app/services/actions_loader.py): `app/services/actions_loader.py`
- [Action API](https://github.com/coderamp-labs/gitrules/blob/main/app/routes/actions.py): `app/routes/actions.py`
- [Fuzzy search](https://github.com/coderamp-labs/gitrules/blob/main/app/services/search_service.py): `app/services/search_service.py`

### Generation and install

- [File generation](https://github.com/coderamp-labs/gitrules/blob/main/app/routes/generate.py): `app/routes/generate.py`
- [Install script sharing](https://github.com/coderamp-labs/gitrules/blob/main/app/routes/generate.py): `app/routes/generate.py`

### Discovery and recommendations

- [Recommendations API](https://github.com/coderamp-labs/gitrules/blob/main/app/routes/recommend.py): `app/routes/recommend.py`
- [Repository ingestion](https://github.com/coderamp-labs/gitrules/blob/main/app/services/smart_ingest.py): `app/services/smart_ingest.py`
- [Tool recommendation](https://github.com/coderamp-labs/gitrules/blob/main/app/services/recommend_tools.py): `app/services/recommend_tools.py`

### Other components

- **Workspace user**
- **Gitingest service**
- **LLM service**

## Connections

- Workspace user → FastAPI application: opens workspace
- FastAPI application → Workspace state: serves workspace
- Workspace state → Context controls: manages contexts
- Workspace state → File tree UI: renders files
- Workspace state → Monaco editor UI: edits files
- FastAPI application → Action API: mounts routes
- Action API → Action loader: loads actions
- Action loader → Action presets: reads presets
- Action loader → Action models: builds models
- Fuzzy search → Action loader: searches catalog
- FastAPI application → File generation: mounts routes
- File generation → Action loader: loads selections
- File generation → Install script sharing: generates installer
- Workspace user → Recommendations API: requests suggestions
- Recommendations API → Repository ingestion: ingests repository
- Repository ingestion → Gitingest service: submits repository
- Recommendations API → Tool recommendation: requests selection
- Tool recommendation → LLM service: requests recommendations
