AlterX is a Go CLI tool and library for generating subdomain wordlists using a DSL (Domain-Specific Language) for patterns and an optional pattern mining mode. It ingests a list of known subdomains, extracts variables (sub, suffix, root, etc.), and applies user-defined or automatically discovered patterns to produce permutations. The architecture is modular: a Mutator engine orchestrates either default pattern-based generation (using ClusterBomb cartesian product) or pattern mining (via edit-distance clustering, n-gram analysis, and DFA-based regex generation). Key entry points are the CLI (`cmd/alterx/main.go`) and the library API (`mutator.go`). External dependencies include `fasttemplate` for variable replacement, `publicsuffix` for domain parsing, and `projectdiscovery/utils` for deduplication and other utilities. The pattern mining subsystem (ported from Regulator) uses a three-phase clustering algorithm and Brzozowski's DFA minimization to generate subdomains from observed patterns. The tool supports three modes: default (user patterns), discover (mined patterns only), and both (combined).