# What Is the Purpose of the `main.go` File in Goose?

> Discover the truth about the main.go file in Goose. Learn why the framework uses main.rs and find its executable entry points for Rust crates.

- Repository: [goose/goose](https://github.com/aaif-goose/goose)
- Tags: internals
- Published: 2026-04-07

---

**The Goose repository does not contain a [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file; it is an agent framework written in Rust with executable entry points defined in [`main.rs`](https://github.com/aaif-goose/goose/blob/main/main.rs) files within various crates.**

The `aaif-goose/goose` repository is an open-source agent framework that orchestrates LLM interactions, tool execution, and permission systems. While developers exploring the codebase might search for a [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file expecting a Go-based entry point, Goose is architected entirely in Rust. Understanding the actual entry points requires examining the crate structure under `crates/` rather than looking for Go source files.

## Why Goose Does Not Use a [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) File

Goose is implemented as a Rust workspace with multiple crates. The framework compiles to native binaries from Rust source code (`.rs` files), not Go. Consequently, there is no [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file in the repository that contributes to the runtime, build process, or core functionality.

The project structure follows standard Rust conventions with executable binaries defined in three primary crates:

- `goose-cli` – Command-line interface for running recipes
- `goose-server` – HTTP server implementing the Agent Client Protocol (ACP)
- `goose` – Core library providing the agent loop and tool execution pipeline

## The Actual Entry Points in Goose (Rust [`main.rs`](https://github.com/aaif-goose/goose/blob/main/main.rs) Files)

Instead of a [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file, Goose defines its executable entry points in Rust [`main.rs`](https://github.com/aaif-goose/goose/blob/main/main.rs) files located in specific crate directories.

### `goose-cli` Entry Point ([`crates/goose-cli/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-cli/src/main.rs))

The CLI binary parses command-line arguments, creates sessions, and runs recipes and agents. According to the source code in [`crates/goose-cli/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-cli/src/main.rs), this entry point initializes the session management and loads YAML recipe configurations.

```bash

# Starts the Goose CLI from the Rust entry point

$ goose run my-recipe.yaml

```

This file handles the bootstrap process when you execute Goose commands, including argument parsing and agent initialization.

### `goose-server` Entry Point ([`crates/goose-server/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-server/src/main.rs))

The server binary starts an Actix-web HTTP server that implements the Agent Client Protocol (ACP) routes:

```bash

# Starts the ACP server that powers the UI and remote CLI calls

$ goose server --port 8080

```

The [`crates/goose-server/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-server/src/main.rs) file handles the web server initialization and route configuration for the backend API that the Electron UI communicates with.

### Core Agent Implementation ([`crates/goose/src/agents/agent.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/agents/agent.rs))

While not a binary entry point, the core `Agent` implementation in [`crates/goose/src/agents/agent.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/agents/agent.rs) orchestrates the tool execution pipeline and permission system. This library code is imported by both the CLI and server binaries from [`crates/goose/src/lib.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/lib.rs).

## Where [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) References Actually Come From

References to [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) appear only within recipe templates as **generated examples**. The `full-stack-project-initializer` recipe creates a [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file on-the-fly when scaffolding a new Go web service for users, but this file is not stored in the Goose codebase.

When the recipe executes, it generates Go code similar to this:

```go
// This file is created by the full-stack-project-initializer recipe,
// not shipped with Goose. It starts a Gin HTTP server with a health check.
package main

import (
    "github.com/gin-gonic/gin"
)

func main() {
    r := gin.Default()
    r.GET("/healthz", func(c *gin.Context) { 
        c.JSON(200, gin.H{"status": "ok"}) 
    })
    r.Run(":8080")
}

```

This illustrates Goose's capability to generate code in multiple languages (Go, Python, JavaScript) as part of its scaffolding features, even though the framework itself remains Rust-based.

## Summary

- **No [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) exists** in the aaif-goose/goose repository; the framework is written in Rust with entry points in [`main.rs`](https://github.com/aaif-goose/goose/blob/main/main.rs) files.
- **Rust entry points** are located at [`crates/goose-cli/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-cli/src/main.rs) (CLI bootstrap) and [`crates/goose-server/src/main.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose-server/src/main.rs) (HTTP server).
- **Recipe generation** creates [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) files dynamically for user projects, but these are not part of Goose's source code.
- The core agent logic resides in [`crates/goose/src/agents/agent.rs`](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/agents/agent.rs) and handles the main agent loop, tool execution, and permission systems.

## Frequently Asked Questions

### Is Goose written in Go or Rust?

Goose is written entirely in Rust. The repository uses a workspace structure with crates for the CLI, server, and core library. While Goose can generate Go code as part of its recipe system, the framework itself has no Go dependencies or source files, and there is no [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file in the repository.

### Why do I see [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) mentioned in Goose documentation?

References to [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) appear in the `full-stack-project-initializer` recipe and similar YAML templates. These are illustrative examples showing how Goose can scaffold a minimal Go web service using the Gin framework. The [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go) file is generated on-the-fly when the recipe runs, not stored in the repository at `aaif-goose/goose`.

### What language does Goose use for code generation?

Goose supports generating code in multiple languages including Go, Python, and JavaScript depending on the recipe configuration. However, these generated files are outputs intended for user projects, not components of the Goose runtime, which is exclusively Rust-based.

### How do I run Goose if there's no [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go)?

You run Goose by compiling the Rust source code, which produces native binaries. Use `cargo run` in the respective crate directories, or install the compiled binaries to execute `goose run` for the CLI or `goose server` for the HTTP server. The entry points are the compiled artifacts from [`main.rs`](https://github.com/aaif-goose/goose/blob/main/main.rs) files, not [`main.go`](https://github.com/aaif-goose/goose/blob/main/main.go).