# fmarzochi/egc architecture

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

- Interactive diagram: https://gitdiagram.com/fmarzochi/egc
- Repository: https://github.com/fmarzochi/egc

## Overview

EGC is a local-first runtime that equips multiple AI coding tools with shared project memory, command guardrails, output compression, and session coordination. The user’s main workflow is to install EGC once, then work in a supported tool: session hooks connect the tool, memory and safety features operate in the background, and sessions share context. The graph also preserves the documented dashboard, model-provider, and installation capabilities. Several links reflect README-level behavior; unsampled implementation details are intentionally not inferred.

Main entry points: [`scripts/lib/install-lifecycle.js`](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-lifecycle.js) (Install Lifecycle), [`mcp/servers/egc-guardian/src/index.ts`](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/index.ts) (Guardian Server), [`mcp/servers/egc-memory/src/index.ts`](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-memory/src/index.ts) (Memory Server), [`scripts/lib/install-manifests.js`](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-manifests.js) (Install Manifests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Installation"]
  node_install_lifecycle["Install Lifecycle"]
  node_install_manifests["Install Manifests"]
  node_target_registry["Tool Adapters<br/>[registry.js]"]
  node_install_apply["Install Apply<br/>[apply.js]"]
end

subgraph group_agent_runtime["Agent Runtime"]
  node_session_hooks["Session Hooks"]
  node_guardian_mcp["Guardian Server<br/>[index.ts]"]
end

subgraph group_memory_mesh["Memory Mesh"]
  node_memory_mcp["Memory Server<br/>[index.ts]"]
  node_memory_store[("Persistent Memory")]
  node_session_mesh["Session Bus<br/>[session-bus.ts]"]
  node_sync_backends["Sync Backends"]
end

subgraph group_safety_context["Safety And Context"]
  node_crusher["Token Crusher<br/>[engine.js]"]
  node_memory_filters["Memory Filters<br/>[memory-filters.js]"]
  node_catalog[("Agent Catalog<br/>[catalog-index.ts]")]
  node_injection_scan["Injection Scanner"]
end

subgraph group_visibility_models["Dashboard And Models"]
  node_dashboard["Live Dashboard<br/>[server.js]"]
  node_dashboard_ops["Dashboard Operations<br/>[ops.js]"]
  node_operations["Shared Operations<br/>[index.js]"]
  node_model_resolver["Model Resolver<br/>[model_resolver.py]"]
end

node_developer(("Developer"))
node_ai_tools(("AI Coding Tools"))
node_external_models(("Model Providers"))

node_developer -->|"installs"| node_install_lifecycle
node_install_lifecycle -->|"uses manifests"| node_install_manifests
node_install_manifests -->|"selects adapters"| node_target_registry
node_install_lifecycle -.->|"applies setup"| node_install_apply
node_install_apply -->|"configures tools"| node_ai_tools
node_ai_tools -->|"starts sessions"| node_session_hooks
node_session_hooks -->|"loads memory"| node_memory_mcp
node_ai_tools -->|"checks commands"| node_guardian_mcp
node_ai_tools -->|"filters shell output"| node_crusher
node_memory_mcp -->|"persists context"| node_memory_store
node_ai_tools -->|"shares session events"| node_session_mesh
node_memory_mcp -.->|"syncs memory"| node_sync_backends
node_guardian_mcp -->|"uses catalog"| node_catalog
node_guardian_mcp -->|"scans prompts"| node_injection_scan
node_crusher -.->|"filters context"| node_memory_filters
node_developer -->|"views activity"| node_dashboard
node_dashboard -->|"routes operations"| node_dashboard_ops
node_dashboard_ops -->|"dispatches operations"| node_operations
node_ai_tools -.->|"selects models"| node_model_resolver
node_model_resolver -->|"resolves providers"| node_external_models

click node_install_lifecycle "https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-lifecycle.js"
click node_install_manifests "https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-manifests.js"
click node_target_registry "https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-targets/registry.js"
click node_install_apply "https://github.com/fmarzochi/egc/blob/main/scripts/lib/install/apply.js"
click node_session_hooks "https://github.com/fmarzochi/egc/tree/main/scripts/hooks"
click node_guardian_mcp "https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/index.ts"
click node_memory_mcp "https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-memory/src/index.ts"
click node_memory_store "https://github.com/fmarzochi/egc/tree/main/mcp/servers/egc-memory/src"
click node_session_mesh "https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-memory/src/session-bus.ts"
click node_sync_backends "https://github.com/fmarzochi/egc/tree/main/mcp/servers/egc-memory/src/sync"
click node_crusher "https://github.com/fmarzochi/egc/blob/main/scripts/lib/crusher/engine.js"
click node_memory_filters "https://github.com/fmarzochi/egc/blob/main/scripts/lib/memory-filters.js"
click node_catalog "https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/catalog-index.ts"
click node_injection_scan "https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/prompt-injection-scanner.ts"
click node_dashboard "https://github.com/fmarzochi/egc/blob/main/dashboard/server.js"
click node_dashboard_ops "https://github.com/fmarzochi/egc/blob/main/dashboard/ops.js"
click node_operations "https://github.com/fmarzochi/egc/blob/main/scripts/lib/operations/index.js"
click node_model_resolver "https://github.com/fmarzochi/egc/blob/main/src/llm/core/model_resolver.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_install_lifecycle,node_install_manifests,node_target_registry,node_install_apply toneBlue
class node_session_hooks,node_guardian_mcp toneAmber
class node_memory_mcp,node_memory_store,node_session_mesh,node_sync_backends toneMint
class node_crusher,node_memory_filters,node_catalog,node_injection_scan toneRose
class node_dashboard,node_dashboard_ops,node_operations,node_model_resolver,node_developer,node_ai_tools,node_external_models toneIndigo
```

## Components

### Installation

- [Install Lifecycle](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-lifecycle.js): `scripts/lib/install-lifecycle.js`
- [Install Manifests](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-manifests.js): `scripts/lib/install-manifests.js`
- [Tool Adapters](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install-targets/registry.js): `scripts/lib/install-targets/registry.js`
- [Install Apply](https://github.com/fmarzochi/egc/blob/main/scripts/lib/install/apply.js): `scripts/lib/install/apply.js`

### Agent Runtime

- [Session Hooks](https://github.com/fmarzochi/egc/tree/main/scripts/hooks): `scripts/hooks`
- [Guardian Server](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/index.ts): `mcp/servers/egc-guardian/src/index.ts`

### Memory Mesh

- [Memory Server](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-memory/src/index.ts): `mcp/servers/egc-memory/src/index.ts`
- [Persistent Memory](https://github.com/fmarzochi/egc/tree/main/mcp/servers/egc-memory/src): `mcp/servers/egc-memory/src`
- [Session Bus](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-memory/src/session-bus.ts): `mcp/servers/egc-memory/src/session-bus.ts`
- [Sync Backends](https://github.com/fmarzochi/egc/tree/main/mcp/servers/egc-memory/src/sync): `mcp/servers/egc-memory/src/sync`

### Safety And Context

- [Token Crusher](https://github.com/fmarzochi/egc/blob/main/scripts/lib/crusher/engine.js): `scripts/lib/crusher/engine.js`
- [Memory Filters](https://github.com/fmarzochi/egc/blob/main/scripts/lib/memory-filters.js): `scripts/lib/memory-filters.js`
- [Agent Catalog](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/catalog-index.ts): `mcp/servers/egc-guardian/src/catalog-index.ts`
- [Injection Scanner](https://github.com/fmarzochi/egc/blob/main/mcp/servers/egc-guardian/src/prompt-injection-scanner.ts): `mcp/servers/egc-guardian/src/prompt-injection-scanner.ts`

### Dashboard And Models

- [Live Dashboard](https://github.com/fmarzochi/egc/blob/main/dashboard/server.js): `dashboard/server.js`
- [Dashboard Operations](https://github.com/fmarzochi/egc/blob/main/dashboard/ops.js): `dashboard/ops.js`
- [Shared Operations](https://github.com/fmarzochi/egc/blob/main/scripts/lib/operations/index.js): `scripts/lib/operations/index.js`
- [Model Resolver](https://github.com/fmarzochi/egc/blob/main/src/llm/core/model_resolver.py): `src/llm/core/model_resolver.py`

### Other components

- **Developer**
- **AI Coding Tools**
- **Model Providers**

## Connections

- Developer → Install Lifecycle: installs (evidence: `README.md`)
- Install Lifecycle → Install Manifests: uses manifests (evidence: `scripts/lib/install-manifests.js`)
- Install Manifests → Tool Adapters: selects adapters (evidence: `scripts/lib/install-manifests.js`)
- Install Lifecycle → Install Apply: applies setup
- Install Apply → AI Coding Tools: configures tools (evidence: `README.md`)
- AI Coding Tools → Session Hooks: starts sessions (evidence: `README.md`)
- Session Hooks → Memory Server: loads memory (evidence: `README.md`)
- AI Coding Tools → Guardian Server: checks commands (evidence: `README.md`)
- AI Coding Tools → Token Crusher: filters shell output (evidence: `README.md`)
- Memory Server → Persistent Memory: persists context (evidence: `README.md`)
- AI Coding Tools → Session Bus: shares session events (evidence: `README.md`)
- Memory Server → Sync Backends: syncs memory
- Guardian Server → Agent Catalog: uses catalog
- Guardian Server → Injection Scanner: scans prompts
- Token Crusher → Memory Filters: filters context
- Developer → Live Dashboard: views activity (evidence: `README.md`)
- Live Dashboard → Dashboard Operations: routes operations (evidence: `dashboard/server.js`)
- Dashboard Operations → Shared Operations: dispatches operations (evidence: `dashboard/ops.js`)
- AI Coding Tools → Model Resolver: selects models
- Model Resolver → Model Providers: resolves providers (evidence: `README.md`)
