# egen/junction architecture

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

- Interactive diagram: https://gitdiagram.com/egen/junction
- Repository: https://github.com/egen/junction

## Overview

Junction is a CLI that bootstraps infrastructure repositories with a tailored six-agent coding-agent graph and supporting operational framework. The main workflow is to collect or infer platform answers, generate and validate the graph, then scaffold agent-native configuration, shared guardrails and knowledge, and optionally GCP Terraform. The graph preserves the optional local-agent discovery branch and the documented agent-format and operations capabilities. Some wiring is based on the README and partial excerpts; uncertain internal calls are omitted.

Main entry points: [`junction/cli.py`](https://github.com/egen/junction/blob/main/junction/cli.py) (Junction CLI), [`junction/agent_adapters/_base.py`](https://github.com/egen/junction/blob/main/junction/agent_adapters/_base.py) (Adapter Base), [`junction/scaffold.py`](https://github.com/egen/junction/blob/main/junction/scaffold.py) (Framework Scaffold), [`junction/graph_schema.py`](https://github.com/egen/junction/blob/main/junction/graph_schema.py) (Graph Schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and Discovery"]
  node_junction_cli["Junction CLI<br/>[cli.py]"]
  node_discovery["Question Discovery<br/>[discovery.py]"]
  node_agent_discovery["Agent Discovery<br/>[agent_discovery.py]"]
  node_config["Platform Config<br/>[config_builder.py]"]
end

subgraph group_model["Graph and Agent Model"]
  node_graph_generator["Graph Generator<br/>[graph_generator.py]"]
  node_graph_schema["Graph Schema<br/>[graph_schema.py]"]
  node_graph_json_schema["Graph JSON Schema"]
  node_agent_specs["Agent Specs<br/>[agent_specs.py]"]
end

subgraph group_scaffold["Repository Scaffolding"]
  node_adapter_base["Adapter Base<br/>[_base.py]"]
  node_copilot_adapter["Copilot Adapter<br/>[copilot.py]"]
  node_claude_adapter["Claude Adapter<br/>[claude_code.py]"]
  node_cursor_adapter["Cursor Adapter<br/>[cursor.py]"]
  node_continue_adapter["Continue Adapter<br/>[continue_dev.py]"]
  node_scaffold["Framework Scaffold<br/>[scaffold.py]"]
  node_framework["Skills and Guardrails"]
end

subgraph group_integrations["Infrastructure Output"]
  node_terraform["Terraform Generator"]
end

node_engineer(("Engineer"))
node_claude_cli["Claude CLI"]
node_target_repo["Target Repository"]

node_engineer -->|"runs"| node_junction_cli
node_junction_cli -.->|"optionally infers answers"| node_agent_discovery
node_agent_discovery -.->|"inspects read-only"| node_claude_cli
node_junction_cli -->|"collects answers"| node_discovery
node_junction_cli -->|"loads platform settings"| node_config
node_junction_cli -->|"generates graph"| node_graph_generator
node_graph_generator -->|"produces graph"| node_graph_schema
node_junction_cli -->|"validates graph"| node_graph_schema
node_graph_schema -->|"checks schema"| node_graph_json_schema
node_junction_cli -->|"builds agent specs"| node_agent_specs
node_agent_specs -->|"provides agent definitions"| node_adapter_base
node_adapter_base -->|"renders format"| node_copilot_adapter
node_adapter_base -->|"renders format"| node_claude_adapter
node_adapter_base -->|"renders format"| node_cursor_adapter
node_adapter_base -->|"renders format"| node_continue_adapter
node_junction_cli -->|"starts scaffolding"| node_scaffold
node_scaffold -->|"copies framework"| node_framework
node_scaffold -->|"writes shared files"| node_target_repo
node_junction_cli -->|"targets repository"| node_target_repo
node_junction_cli -.->|"optionally generates IaC"| node_terraform
node_terraform -->|"writes Terraform"| node_target_repo

click node_junction_cli "https://github.com/egen/junction/blob/main/junction/cli.py"
click node_discovery "https://github.com/egen/junction/blob/main/junction/discovery.py"
click node_agent_discovery "https://github.com/egen/junction/blob/main/junction/agent_discovery.py"
click node_config "https://github.com/egen/junction/blob/main/junction/config_builder.py"
click node_graph_generator "https://github.com/egen/junction/blob/main/junction/graph_generator.py"
click node_graph_schema "https://github.com/egen/junction/blob/main/junction/graph_schema.py"
click node_graph_json_schema "https://github.com/egen/junction/blob/main/junction/schemas/agent-graph.schema.json"
click node_agent_specs "https://github.com/egen/junction/blob/main/junction/agent_specs.py"
click node_adapter_base "https://github.com/egen/junction/blob/main/junction/agent_adapters/_base.py"
click node_copilot_adapter "https://github.com/egen/junction/blob/main/junction/agent_adapters/copilot.py"
click node_claude_adapter "https://github.com/egen/junction/blob/main/junction/agent_adapters/claude_code.py"
click node_cursor_adapter "https://github.com/egen/junction/blob/main/junction/agent_adapters/cursor.py"
click node_continue_adapter "https://github.com/egen/junction/blob/main/junction/agent_adapters/continue_dev.py"
click node_scaffold "https://github.com/egen/junction/blob/main/junction/scaffold.py"
click node_framework "https://github.com/egen/junction/tree/main/junction/framework/github"
click node_terraform "https://github.com/egen/junction/blob/main/junction/terraform_generator.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_junction_cli,node_discovery,node_agent_discovery,node_config toneBlue
class node_graph_generator,node_graph_schema,node_graph_json_schema,node_agent_specs toneAmber
class node_adapter_base,node_copilot_adapter,node_claude_adapter,node_cursor_adapter,node_continue_adapter,node_scaffold,node_framework toneMint
class node_terraform toneRose
class node_engineer,node_claude_cli,node_target_repo toneIndigo
```

## Components

### CLI and Discovery

- [Junction CLI](https://github.com/egen/junction/blob/main/junction/cli.py): `junction/cli.py`
- [Question Discovery](https://github.com/egen/junction/blob/main/junction/discovery.py): `junction/discovery.py`
- [Agent Discovery](https://github.com/egen/junction/blob/main/junction/agent_discovery.py): `junction/agent_discovery.py`
- [Platform Config](https://github.com/egen/junction/blob/main/junction/config_builder.py): `junction/config_builder.py`

### Graph and Agent Model

- [Graph Generator](https://github.com/egen/junction/blob/main/junction/graph_generator.py): `junction/graph_generator.py`
- [Graph Schema](https://github.com/egen/junction/blob/main/junction/graph_schema.py): `junction/graph_schema.py`
- [Graph JSON Schema](https://github.com/egen/junction/blob/main/junction/schemas/agent-graph.schema.json): `junction/schemas/agent-graph.schema.json`
- [Agent Specs](https://github.com/egen/junction/blob/main/junction/agent_specs.py): `junction/agent_specs.py`

### Repository Scaffolding

- [Adapter Base](https://github.com/egen/junction/blob/main/junction/agent_adapters/_base.py): `junction/agent_adapters/_base.py`
- [Copilot Adapter](https://github.com/egen/junction/blob/main/junction/agent_adapters/copilot.py): `junction/agent_adapters/copilot.py`
- [Claude Adapter](https://github.com/egen/junction/blob/main/junction/agent_adapters/claude_code.py): `junction/agent_adapters/claude_code.py`
- [Cursor Adapter](https://github.com/egen/junction/blob/main/junction/agent_adapters/cursor.py): `junction/agent_adapters/cursor.py`
- [Continue Adapter](https://github.com/egen/junction/blob/main/junction/agent_adapters/continue_dev.py): `junction/agent_adapters/continue_dev.py`
- [Framework Scaffold](https://github.com/egen/junction/blob/main/junction/scaffold.py): `junction/scaffold.py`
- [Skills and Guardrails](https://github.com/egen/junction/tree/main/junction/framework/github): `junction/framework/github`

### Infrastructure Output

- [Terraform Generator](https://github.com/egen/junction/blob/main/junction/terraform_generator.py): `junction/terraform_generator.py`

### Other components

- **Engineer**
- **Claude CLI**
- **Target Repository**

## Connections

- Engineer → Junction CLI: runs
- Junction CLI → Agent Discovery: optionally infers answers
- Agent Discovery → Claude CLI: inspects read-only
- Junction CLI → Question Discovery: collects answers
- Junction CLI → Platform Config: loads platform settings
- Junction CLI → Graph Generator: generates graph
- Graph Generator → Graph Schema: produces graph
- Junction CLI → Graph Schema: validates graph
- Graph Schema → Graph JSON Schema: checks schema
- Junction CLI → Agent Specs: builds agent specs
- Agent Specs → Adapter Base: provides agent definitions
- Adapter Base → Copilot Adapter: renders format
- Adapter Base → Claude Adapter: renders format
- Adapter Base → Cursor Adapter: renders format
- Adapter Base → Continue Adapter: renders format
- Junction CLI → Framework Scaffold: starts scaffolding
- Framework Scaffold → Skills and Guardrails: copies framework
- Framework Scaffold → Target Repository: writes shared files
- Junction CLI → Target Repository: targets repository
- Junction CLI → Terraform Generator: optionally generates IaC
- Terraform Generator → Target Repository: writes Terraform
