# nathanramorim/forge-sdd architecture

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

- Interactive diagram: https://gitdiagram.com/nathanramorim/forge-sdd
- Repository: https://github.com/nathanramorim/forge-sdd

## Overview

Forge-SDD is a Go CLI and npm-delivered installer that scaffolds an AI-assisted Software Design Doc workflow into a project. Users initialize or update a project, then use generated agent commands to discover and plan work, implement features or fixes, review, and archive; the CLI also diagnoses installations and records/reports local telemetry. The source excerpts show the CLI’s configuration, survey, and scaffold calls, but not every command handler or generated prompt’s runtime behavior, so those relationships are omitted or marked unverified.

Main entry points: [`cmd/forge-sdd/main.go`](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/main.go) (CLI commands), [`internal/scaffold/scaffold.go`](https://github.com/nathanramorim/forge-sdd/blob/main/internal/scaffold/scaffold.go) (Template scaffold), [`cmd/forge-sdd/session.go`](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/session.go) (Session telemetry), [`internal/scaffold/templates/.agents/commands`](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands) (Feature and fixes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["CLI delivery"]
  node_npm["npm launcher<br/>[run.js]"]
  node_cli["CLI commands<br/>[main.go]"]
end

subgraph group_setup["Project setup"]
  node_config["Project config<br/>[config.go]"]
  node_survey["Interactive setup<br/>[survey.go]"]
  node_scaffold["Template scaffold<br/>[scaffold.go]"]
  node_cheatsheet["Command cheat sheet<br/>[cheatsheet.go]"]
  node_agentfiles["Agent integrations"]
  node_sddfiles["SDD project files"]
end

subgraph group_method["SDD workflow"]
  node_commands["Canonical commands<br/>[commands]"]
  node_discovery["Discovery planning<br/>[commands]"]
  node_featurework["Feature and fixes<br/>[commands]"]
  node_review["Review and archive<br/>[commands]"]
end

subgraph group_ops["Project operations"]
  node_doctor["Installation doctor<br/>[doctor.go]"]
  node_destroy["Project removal<br/>[destroy.go]"]
  node_session["Session telemetry<br/>[session.go]"]
  node_report["Metrics report<br/>[report.go]"]
  node_lessons["Fix lessons<br/>[lessons.go]"]
  node_metrics[("Local metrics<br/>[.metrics]")]
end

node_user(("Project user"))
node_registry[("npm registry")]

node_user -->|"runs CLI"| node_npm
node_npm -.->|"fetches package"| node_registry
node_user -->|"runs commands"| node_cli
node_cli -->|"collects choices"| node_survey
node_cli -->|"renders project"| node_scaffold
node_cli -.->|"reads settings"| node_config
node_cli -->|"checks versions"| node_registry
node_scaffold -->|"renders integrations"| node_agentfiles
node_scaffold -->|"renders structure"| node_sddfiles
node_scaffold -->|"renders commands"| node_commands
node_cli -.->|"prints summary"| node_cheatsheet
node_user -->|"describes work"| node_discovery
node_discovery -.->|"plans features"| node_featurework
node_user -->|"requests changes"| node_featurework
node_featurework -.->|"requests review"| node_review
node_user -->|"reviews or archives"| node_review
node_cli -->|"runs diagnostics"| node_doctor
node_cli -->|"removes structure"| node_destroy
node_cli -.->|"records sessions"| node_session
node_session -->|"checks telemetry"| node_config
node_session -->|"writes records"| node_metrics
node_cli -.->|"shows metrics"| node_report
node_report -.->|"reads records"| node_metrics
node_user -.->|"uses lessons"| node_lessons

click node_npm "https://github.com/nathanramorim/forge-sdd/blob/main/npm/bin/run.js"
click node_cli "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/main.go"
click node_config "https://github.com/nathanramorim/forge-sdd/blob/main/internal/config/config.go"
click node_survey "https://github.com/nathanramorim/forge-sdd/blob/main/internal/survey/survey.go"
click node_scaffold "https://github.com/nathanramorim/forge-sdd/blob/main/internal/scaffold/scaffold.go"
click node_cheatsheet "https://github.com/nathanramorim/forge-sdd/blob/main/internal/scaffold/cheatsheet.go"
click node_agentfiles "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/agents"
click node_sddfiles "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/sdd"
click node_commands "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands"
click node_discovery "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands"
click node_featurework "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands"
click node_review "https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands"
click node_doctor "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/doctor.go"
click node_destroy "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/destroy.go"
click node_session "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/session.go"
click node_report "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/report.go"
click node_lessons "https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/lessons.go"
click node_metrics "https://github.com/nathanramorim/forge-sdd/tree/main/sdd/.metrics"

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_npm,node_cli,node_user toneBlue
class node_config,node_survey,node_scaffold,node_cheatsheet,node_agentfiles,node_sddfiles,node_registry toneAmber
class node_commands,node_discovery,node_featurework,node_review toneMint
class node_doctor,node_destroy,node_session,node_report,node_lessons,node_metrics toneRose
```

## Components

### CLI delivery

- [npm launcher](https://github.com/nathanramorim/forge-sdd/blob/main/npm/bin/run.js): `npm/bin/run.js`
- [CLI commands](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/main.go): `cmd/forge-sdd/main.go`

### Project setup

- [Project config](https://github.com/nathanramorim/forge-sdd/blob/main/internal/config/config.go): `internal/config/config.go`
- [Interactive setup](https://github.com/nathanramorim/forge-sdd/blob/main/internal/survey/survey.go): `internal/survey/survey.go`
- [Template scaffold](https://github.com/nathanramorim/forge-sdd/blob/main/internal/scaffold/scaffold.go): `internal/scaffold/scaffold.go`
- [Command cheat sheet](https://github.com/nathanramorim/forge-sdd/blob/main/internal/scaffold/cheatsheet.go): `internal/scaffold/cheatsheet.go`
- [Agent integrations](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/agents): `internal/scaffold/templates/agents`
- [SDD project files](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/sdd): `internal/scaffold/templates/sdd`

### SDD workflow

- [Canonical commands](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands): `internal/scaffold/templates/.agents/commands`
- [Discovery planning](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands): `internal/scaffold/templates/.agents/commands`
- [Feature and fixes](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands): `internal/scaffold/templates/.agents/commands`
- [Review and archive](https://github.com/nathanramorim/forge-sdd/tree/main/internal/scaffold/templates/.agents/commands): `internal/scaffold/templates/.agents/commands`

### Project operations

- [Installation doctor](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/doctor.go): `cmd/forge-sdd/doctor.go`
- [Project removal](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/destroy.go): `cmd/forge-sdd/destroy.go`
- [Session telemetry](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/session.go): `cmd/forge-sdd/session.go`
- [Metrics report](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/report.go): `cmd/forge-sdd/report.go`
- [Fix lessons](https://github.com/nathanramorim/forge-sdd/blob/main/cmd/forge-sdd/lessons.go): `cmd/forge-sdd/lessons.go`
- [Local metrics](https://github.com/nathanramorim/forge-sdd/tree/main/sdd/.metrics): `sdd/.metrics`

### Other components

- **Project user**
- **npm registry**

## Connections

- Project user → npm launcher: runs CLI (evidence: `README.md`)
- npm launcher → npm registry: fetches package
- Project user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Interactive setup: collects choices (evidence: `cmd/forge-sdd/main.go`)
- CLI commands → Template scaffold: renders project (evidence: `cmd/forge-sdd/main.go`)
- CLI commands → Project config: reads settings
- CLI commands → npm registry: checks versions (evidence: `cmd/forge-sdd/main.go`)
- Template scaffold → Agent integrations: renders integrations (evidence: `internal/scaffold/scaffold.go`)
- Template scaffold → SDD project files: renders structure (evidence: `internal/scaffold/scaffold.go`)
- Template scaffold → Canonical commands: renders commands (evidence: `internal/scaffold/scaffold.go`)
- CLI commands → Command cheat sheet: prints summary
- Project user → Discovery planning: describes work (evidence: `README.md`)
- Discovery planning → Feature and fixes: plans features
- Project user → Feature and fixes: requests changes (evidence: `README.md`)
- Feature and fixes → Review and archive: requests review
- Project user → Review and archive: reviews or archives (evidence: `README.md`)
- CLI commands → Installation doctor: runs diagnostics (evidence: `cmd/forge-sdd/main.go`)
- CLI commands → Project removal: removes structure (evidence: `cmd/forge-sdd/main.go`)
- CLI commands → Session telemetry: records sessions
- Session telemetry → Project config: checks telemetry (evidence: `cmd/forge-sdd/session.go`)
- Session telemetry → Local metrics: writes records (evidence: `cmd/forge-sdd/session.go`)
- CLI commands → Metrics report: shows metrics
- Metrics report → Local metrics: reads records
- Project user → Fix lessons: uses lessons
