Appearance
Welcome to Loci
A place for your generators!
Loci is a framework-independent code generation system designed around developer experience and first-class AI collaboration. It offers a declarative, composable way to define generators, with ergonomic helpers for common tasks.
Loci generators are explicit and predictable, making them easy to run, both by humans and autonomous agents.
ruby
module Example
class ExampleGenerator < Loci::BaseGenerator
description "Example generator"
arg :name, required: true, description: "Positional argument"
args :list, description: "Variadic (splat) arguments"
option :verbose, default: false,
description: "Boolean flag options (e.g. --verbose)"
option :opts_list, array: true,
description: "Repeated opts (e.g. --opts-list val1 --opts-list val2)"
option :map_option, default: {},
description: "Key-value pairs (e.g. --map-option k1:v1 k2:v2)"
gen :nested_generator_to_call
gen :nested_gen_with_customized_args do |g, params|
g.new(**params, name: "Another name")
end
def call
log "Hello #{params.name}!"
end
end
endFeatures
- Declarative generator definitions with minimal boilerplate
- Framework-agnostic and dependency-light by design
- Clear, readable APIs optimized for long-term maintainability
- Robust documentation and guided tutorials
- Built-in MCP client, designed with AI-driven workflows in mind
Naming
Loci (pronounced loh-kee, classical Latin) is the plural of locus, meaning "a place." In biology, a locus is the specific location of a gene on a chromosome. Loci is a place for your gene-rators!