Skip to content

Configuration

n-dx uses a layered configuration system across its packages. The ndx config command provides unified access.

LLM Setup During Init

ndx init includes a guided LLM configuration flow. In an interactive terminal it presents keyboard-driven selectors (arrow keys to navigate, Enter to confirm) for both provider and model. The flow follows a strict precedence order:

  1. Explicit CLI flags — skip all prompts
  2. Existing project config (.n-dx.json) — reuse previous selections
  3. Interactive prompt (TTY only) — ask the user
  4. Runtime default fallback — handled by downstream packages

On re-init, if the vendor and model are already configured the LLM prompts are skipped entirely.

Available Models

VendorModel IDLabelDefault
claudeclaude-sonnet-4-6Claude Sonnet 4.6yes
claudeclaude-opus-4-20250514Claude Opus 4
claudeclaude-haiku-4-20250414Claude Haiku 4
codexgpt-5-codexGPT-5 Codexyes

The model catalog is curated and local — init works offline without querying vendor APIs. Unknown model IDs are accepted with a warning, so you can use models not yet in the catalog.

Non-Interactive (Flag-Based) Configuration

Three flags control LLM selection without prompts:

FlagDescription
--provider=<claude|codex>Set the active LLM vendor
--model=<model-id>Set the model for the active vendor
--claude-model=<model-id>Set the Claude model (independent of active vendor)
--codex-model=<model-id>Set the Codex model (independent of active vendor)

Examples:

sh
# Fully non-interactive init (CI / scripting)
ndx init --provider=claude --model=claude-sonnet-4-6 .

# Configure both vendors in a single call
ndx init --provider=claude --claude-model=claude-sonnet-4-6 --codex-model=gpt-5-codex .

# A lone vendor-specific flag implies the provider
ndx init --claude-model=claude-opus-4-20250514 .   # implies --provider=claude

Flag rules:

  • --model cannot be combined with --claude-model or --codex-model (ambiguous target vendor).
  • --claude-model and --codex-model can be used together. When both are present without --provider, the active vendor falls through to existing config or the interactive prompt.
  • A lone --claude-model implies --provider=claude; a lone --codex-model implies --provider=codex.

Config Keys (.n-dx.json)

LLM settings are persisted under the llm namespace in .n-dx.json:

KeyTypeDescription
llm.vendor"claude" | "codex"Active LLM vendor
llm.claude.modelstringClaude model ID
llm.codex.modelstringCodex model ID

Example .n-dx.json after init:

json
{
  "llm": {
    "vendor": "claude",
    "claude": {
      "model": "claude-sonnet-4-6"
    }
  }
}

.codex/config.toml remains MCP-only

Model configuration lives in .n-dx.json, not in .codex/config.toml. The Codex config file is used exclusively for MCP server definitions (stdio transport). ndx init does not write model or vendor settings to .codex/config.toml.

LLM Vendor

sh
ndx config llm.vendor claude .    # or: codex
VendorRex BehaviorHench BehaviorToken Accounting
claudeShared LLM client; API when key configured, CLI fallbackBoth api and cli providersFull support
codexCodex CLI adapter (codex exec)CLI-only (api rejected)Limited (CLI doesn't return usage)

Claude Configuration

sh
# API mode (recommended)
ndx config llm.claude.api_key sk-ant-... .
# or via environment variable:
export ANTHROPIC_API_KEY=sk-ant-...

# Pin a model (default: claude-sonnet-4-6)
ndx config llm.claude.model claude-opus-4-20250514 .

# CLI mode
ndx config llm.claude.cli_path /path/to/claude .

Codex Configuration

sh
ndx config llm.codex.cli_path /path/to/codex .
ndx config rex.model gpt-5.3-codex .

Hench Configuration

sh
ndx config hench.provider api .     # api or cli (api requires claude vendor)
ndx config hench.maxTurns 30 .      # max tool-use turns per task
ndx config hench.maxTokens 100000 . # token budget per task

Configuration is stored in .hench/config.json.

Web Server

sh
ndx config web.port 8080 .         # dashboard port (default: 3117)

Stored in .n-dx.json at the project root.

Viewing Configuration

sh
ndx config .              # show all settings
ndx config --json .       # machine-readable output
ndx config --help .       # show all available keys

Configuration Files

FileOwnerPurpose
.rex/config.jsonRexPRD configuration, model settings
.hench/config.jsonHenchAgent configuration (provider, max turns, budget)
.sourcevision/manifest.jsonSourceVisionAnalysis metadata and version
.n-dx.jsonn-dxProject-level overrides (LLM vendor/model, web port, etc.)

Assistant Artifacts

These files are generated by ndx init and managed by n-dx. They are safe to commit to version control.

FileAssistantPurpose
CLAUDE.mdClaudeProject instructions (auto-generated, re-run ndx init to update)
.claude/skills/*/SKILL.mdClaudeWorkflow skills in YAML frontmatter format
.claude/settings.local.jsonClaudeAuto-approved read-only MCP tool permissions (merged, not overwritten)
AGENTS.mdCodexProject instructions with embedded skill and MCP docs
.agents/skills/*/SKILL.mdCodexWorkflow skills in plain markdown format
.codex/config.tomlCodexMCP server definitions (stdio transport)

See Getting Started — Assistant Surfaces for details on what each artifact contains.

Released under the Elastic License 2.0.