Elixir/OTP core for H (hiness on Hex, :harness OTP application).

H runs coding-agent sessions in a supervised local daemon with branched conversations, file-backed WAL commits, and synchronized terminal (hi) and browser (hiweb) clients.

Start or embed the daemon

  • Call H.serve/1 to start a standalone daemon instance with loopback HTTP, a private Unix domain socket (api.sock), and owner-token authentication.
  • Configure config :harness, data_dir: "/path/to/store" to start the supervised daemon instance inside an existing OTP application (see H.Application) and call H.Daemon directly in the same BEAM VM.
  • Implement H.Extension, H.Harness, H.Tool, H.ExecutionEnv, H.Storage, or H.Provider to extend H at startup.

Operator manual and installation

This HexDocs package documents the Elixir module API, typespecs, and behaviour contracts. Read the operator manual, walkthroughs, and signed binary release guides on hiness.dev:

Summary

Functions

Computes the local Unix domain socket path inside the private data directory. Use a shorter data directory or disable the socket if the path exceeds the OS limit.

Starts the H daemon with TCP and <data_dir>/api.sock, publishes <data_dir>/daemon.json, and prints the bound API URLs.

Functions

api_socket_path(data_dir)

@spec api_socket_path(String.t()) :: String.t()

Computes the local Unix domain socket path inside the private data directory. Use a shorter data directory or disable the socket if the path exceeds the OS limit.

serve(opts \\ [])

@spec serve(keyword()) ::
  {:ok,
   %{
     url: String.t(),
     urls: [String.t()],
     port: non_neg_integer(),
     api_socket: nil | String.t(),
     data_dir: String.t()
   }}
  | {:error, term()}

Starts the H daemon with TCP and <data_dir>/api.sock, publishes <data_dir>/daemon.json, and prints the bound API URLs.

Options:

  • :data_dir - storage root directory (default "~/.local/share/h")
  • :port - HTTP port (default 4100)
  • :bind_addresses - IPv4 tuples (default from <data_dir>/network.json, or loopback)
  • :api_socket - bind local Unix domain socket (default true)
  • :idle_session_timeout_ms - unload quiet local file-backed sessions (default 300_000; :infinity disables)
  • :provider - H.Provider module (default H.Provider.ReqLLM)
  • :provider_config - map forwarded to provider (default %{})
  • :auto_compaction - scoped input token thresholds (see Local HTTP and SSE protocol)
  • :environments - optional map/list of H.EnvRegistry specs
  • :harnesses - optional trusted H.Harness registrations
  • :no_extensions - bypass <data_dir>/extensions.json and all path packages