Skip to main content

Purpose

The main package is not a reusable library surface. Its job is to assemble the default hrns application from the reusable packages.

Current startup behavior

main.go performs four concrete tasks:

1. Load skills

It calls:
skills.LoadAllSkills([]string{
    skills.DefaultGlobalRootPath,
    skills.DefaultLocalRootPath,
})
Then it creates load_skill with skills.NewLoadSkillTool(...).

2. Load agents

The bundled app registers built-in agents from the agents package and also loads file-system agents from:
  • ./.hrns/agents
  • ~/.hrns/agents

3. Build the default tool map

The default tool map includes:
  • read_file
  • list_files
  • write_file
  • run_command
  • web_fetch
  • load_skill

4. Start the bundled runner

The package creates:
tui.New(
    tui.WithTools(...),
    tui.WithAgents(...),
    tui.WithSkills(...),
)
and then calls Run(ctx). The TUI composes the runtime system message from the selected agent or base prompt plus the passed skill metadata. Provider loading, onboarding, client creation, mode detection, and loop creation now happen inside tui.Run(...).

When to reuse it

In most cases, you should not reuse main directly. If you want a custom prompt, custom tools, or a different UI, copy the wiring pattern into your own program and compose the packages yourself.