agentmode

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Detected string

Detected is the canonical slug of the AI agent driving the CLI when agent mode is active (e.g. "claude-code", "cursor", "aider"). It is "unknown" when agent mode is enabled explicitly via the flag or DASH0_AGENT_MODE but no known agent env var was found, and "" when agent mode is disabled.

View Source
var Enabled bool

Enabled reports whether agent mode is active. The result is determined once, during Init, and cached for the lifetime of the process.

Functions

func DetectAgentSlug added in v1.16.1

func DetectAgentSlug() string

DetectAgentSlug scans the environment for known AI-agent markers and returns the canonical slug of the first match (e.g. "claude-code", "cursor", "codex"), or "" if none is found. Unlike Detected, this is not affected by DASH0_AGENT_MODE — it reports which agent host the process is running under regardless of whether agent-mode output is enabled, which is what callers like internal/skill need for picking a host-specific directory.

func Init

func Init(flagValue, flagSet bool)

Init resolves whether agent mode should be active according to the following priority (first match wins):

  1. --agent-mode flag → enabled, or disabled with --agent-mode=false (passed as flagValue; flagSet reports whether the flag was given)
  2. DASH0_AGENT_MODE=0|false → disabled
  3. DASH0_AGENT_MODE=1|true → enabled
  4. Any known AI-agent env var → enabled

Independently of which path enables agent mode, the environment is scanned for known AI-agent markers so Detected holds the most specific slug available (or "unknown" when none is found but agent mode is active anyway).

Call Init once from main, before any output.

func PrintJSONError

func PrintJSONError(w io.Writer, err error)

PrintJSONError writes err as a JSON object to w. If the error string contains a "\nHint:" section, it is split into the "error" and "hint" fields.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL