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

The Goose repository does not contain a main.go file; it is an agent framework written in Rust with executable entry points defined in 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 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 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 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 Files)

Instead of a main.go file, Goose defines its executable entry points in Rust main.rs files located in specific crate directories.

goose-cli Entry Point (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, this entry point initializes the session management and loads YAML recipe configurations.


# 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)

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


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

$ goose server --port 8080

The 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)

While not a binary entry point, the core Agent implementation in 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.

Where main.go References Actually Come From

References to main.go appear only within recipe templates as generated examples. The full-stack-project-initializer recipe creates a 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:

// 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

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 file in the repository.

Why do I see main.go mentioned in Goose documentation?

References to 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 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?

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 files, not main.go.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →