# Go 1.22+
go version
# Complexity checking tools
go install github.com/uudashr/gocognit/cmd/gocognit@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
goa/
├── main.go # Entry point
├── cmd/goa/root.go # Cobra CLI root
├── config/ # Configuration cascade
├── core/ # Core engine
│ ├── command.go # Command interface + registry
│ ├── router.go # Command routing
│ ├── agentmanager.go # Agent lifecycle
│ ├── execution.go # Execution modes
│ ├── loopdetector.go # Loop detection
│ ├── sessionstore.go # Session persistence
│ ├── docengine.go # Documentation engine
│ ├── context.go # Command context
│ └── commands/ # Command implementations
├── internal/ # Shared types, errors, git worktree,
│ └── agentic/ # merged Agent SDK
├── tui/ # ANSI TUI (inspired by pi/OpenCode/kimi-code)
├── tools/ # Tool implementations
├── memory/ # Memory store
├── prompts/mode/ # Mode definitions (coder, planner, reviewer)
├── provider/ # Provider management
├── skills/ # Skill registry + runner
├── multiagent/ # Multi-agent orchestrators
├── plugins/ # JS plugin system
├── chunks/ # Milestone briefs
├── docs/ # Documentation
├── Makefile # Build automation
└── bugs.md # Known issues and roadmap
make build # Build binary
make install # Install to GOPATH/bin
make clean # Remove artifacts
make test # Full test suite with race detection + coverage
make test-short # Fast tests (no race)
make test-race # Race detection only
make test-cover # HTML coverage report → coverage.html
make vet # go vet
make fmt # go fmt
make lint # gocognit + gocyclo complexity checks
make run # Build and run
go run . # Run without building
go run . --model gpt-4o --debug # With flags
Goa follows standard Go formatting (gofmt). Run make fmt before committing.
| Scope | Cognitive Limit | Cyclomatic Limit |
|---|---|---|
| Config parsing | 20 | — |
| TUI rendering | 18 | — |
| All other logic | 15 | 12 |
Run complexity checks with make lint or:
gocognit -over 15 ./...
gocyclo -over 12 ./...
Any function exceeding thresholds must be refactored.
All tool errors follow the standard format:
[tool_name error: error_type]
Detail message
Hint: Actionable suggestion for recovery
Defined in internal/errors.go:
type ToolError struct {
Tool string // tool name
Type string // error category (file_not_found, permission_denied, etc.)
Detail string // human-readable detail
HintText string // actionable recovery hint
}
| Package | Target |
|---|---|
internal/ |
≥90% |
config/ |
≥85% |
core/ |
≥80% |
tools/ |
≥80% |
memory/, prompts/, provider/ |
≥75% |
tui/ |
≥70% (state logic) |
t.TempDir() for filesystem testsTest<FunctionName>_<Scenario># All tests
go test -count=1 -race -cover ./...
# Single package
go test -count=1 -race -cover ./config/...
# Single test
go test -count=1 -race -run TestLoader_Load ./config/...
# All packages must pass before commit
make test
The Agent SDK lives in internal/agentic/. It was originally a standalone module and has been merged into Goa, so it carries no external dependency. Its key types are used throughout Goa:
agentic.Agent — Created by AgentManageragentic.Tool — Implemented by all tools in tools/agentic.LLMProvider — Created by provider.Manageragentic.OutputObserver — Consumed by TUI panesagentic.AgentBus — Multi-agent messagingagentic/skillrunner.Runner — Skill executiontools/ implementing agentic.Tooltools.Documentable for self-documentationmain.go’s registerTools() functiontools/*_test.gocore/commands/ implementing core.Commandinit(): core.RegisterCommand(&MyCommand{})core/router.gocore/commands/*_test.goprofiles/defaults.go~/.goa/config.yaml with extendsmake test before commitmake lint passes(CI to be set up — currently local builds only.)