JSPM

  • Created
  • Published
  • Downloads 4325
  • Score
    100M100P100Q112828F
  • License SEE LICENSE IN LICENSE

Zelari Code โ€” AI Council coding agent CLI. Multi-agent orchestration (Caronte, Nettuno, Gerione, Plutone, Minosse, Lucifero) with slash commands, provider-agnostic LLM streaming, and self-update.

Package Exports

  • zelari-code
  • zelari-code/dist/cli/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zelari-code) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Zelari Code

             -#%=
           .*%%%@#:
          =%%%%%%%@*
         +%%%%%%%%%%#.
        +%%%@@@@@@@%@#.
      .*%@@@@@@@@@@@@@%-
     .#%@@@@@@@@@@@@@@@@-
     *%@@@@@@@@@@@@@@@@@%.
    :@%%@@@@@@%:+%@@@@@%@=
     =@%%@@@@@%.=-+%@%%@*
     .=@@%@@@@%.*@*-+@@*.
   -*%@@@@@@@@%.*@@@+:#@@#=.
  *%%%%%%@@@@@@.*#%#=-:+@@@%
 :@%%%%%%@@@@@@.:=.*:*@@@@@@=
 *@%%@%%@@@@@@@*%@*:-:%@@@@@%.
:@@@%@@@@@@@@@@@@@@#%@@@@@@@@=
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%#

     Z E L A R I   C O D E
          N-THEM Studio

AI Council coding agent CLI โ€” multi-agent orchestration with slash commands, provider-agnostic LLM streaming, and self-update.

Version License Node

๐Ÿ“– Guida completa all'uso (IT) โ€” installazione, TUI, comandi slash, council, skills, workspace, headless, MCP.

Zelari Code is a standalone CLI extracted from AnathemaBrain. It brings the multi-agent council (Caronte, Nettuno, Gerione, Plutone, Minosse, Lucifero) directly into your terminal with a rich TUI (Ink + React), slash command system, and provider-agnostic LLM streaming (OpenAI-compatible, xAI Grok with OAuth, GLM/Z.AI).

Upgrading from โ‰ค 0.4.x? See MIGRATION.md โ€” the internal src/main/core/, src/agents/, src/shared/, src/types/ paths no longer exist. The published core package is @zelari/core (MIT). 9 subpath exports.

Prerequisites

Requirement Version Notes
Node.js โ‰ฅ 20 LTS Earlier versions lack stable fetch, AbortController.timeout, and node:test. Works on 20.x and 22.x.
npm โ‰ฅ 10 Ships with Node 20 LTS; tested with npm 10 and 11.
OS Linux, macOS, Windows 10/11 Tested on Pop!_OS 24.04, macOS 15, Windows 11. Windows requires Git Bash (auto-detected).
Disk ~50 MB for the CLI + @zelari/core Models are not bundled โ€” provider APIs are remote.
Account + API key 1 of: xAI Grok, OpenAI-compatible, GLM/Z.AI, MiniMax, DeepSeek OAuth Grok supported via /login grok.

Optional (for v1.3.0 advanced tools)

These are opt-in โ€” the CLI runs fine without them. The agent auto-skips a tool if its dependency is missing.

Tool group Dependency Used by
lsp_* Language server on PATH (e.g. typescript-language-server, pyright-langserver) + Node/Python LSP client libs lsp_definition, lsp_references, lsp_hover, lsp_symbols, lsp_rename
ast_* (none) ast_outline, ast_find_symbol โ€” TypeScript Compiler API, no LSP needed
semantic_search Local embedding model (default Xenova/all-MiniLM-L6-v2 via @xenova/transformers, downloads on first use) semantic_search, /index
browser_check Playwright (npx playwright install chromium once, ~150 MB) browser_check
diagnostics loop eslint and/or ruff on PATH (project-local preferred) post-edit compile/lint feedback

Disable any tool group: set ZELARI_LSP=0, ZELARI_AST=0, ZELARI_SEMANTIC=0, ZELARI_BROWSER=0, ZELARI_DIAGNOSTICS=0.

Install

npm install -g zelari-code
zelari-code

Prerequisites:

  • Node.js โ‰ฅ 20 โ€” required. Without it the agent cannot run npm/tsc/builds, so zelari-code refuses to boot.
  • Git โ€” recommended. Without it, /diff, /undo and the git sidebar are disabled. Install from https://git-scm.com.
  • Git Bash (Windows only) โ€” recommended. The agent's bash tool needs real POSIX semantics (ls, which, $VAR, &&). Ships with Git for Windows.

After install, verify your environment:

zelari-code --doctor   # checks shim, bundle, PATH, node/git/bash in the agent shell

Why --doctor matters on Windows: the agent runs commands through Git Bash, which inherits a different PATH than the Node process. Node can be visible to PowerShell yet invisible to Git Bash (typical when Node was installed for "current user" only). --doctor's node (agent shell) row catches this; the boot-time preflight (runPreflight) blocks the launch with an actionable message instead of letting the agent fail mid-task.

zelari-code: command not found (Windows)

After npm install -g, the zelari-code command may not be on your PATH. Fix:

PowerShell (run as admin, then restart your terminal):

$npmPrefix = npm config get prefix
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$npmPrefix", "User")

Git Bash / WSL:

echo 'export PATH="$(npm config get prefix):$PATH"' >> ~/.bashrc
source ~/.bashrc

Verify the fix: where zelari-code (CMD) or which zelari-code (Bash) should print a path.

Node visible to PowerShell but not to Git Bash? This is the dual-PATH problem: Node installed for "current user" only reaches the user shell, while Git Bash inherits the system Path. Fix: reinstall Node with "Add to PATH for all users", or add C:\Program Files\nodejs\ to the System Path (not User). Confirm with zelari-code --doctor โ€” the node (agent shell) row must read OK.

First Run

The first time you run zelari-code (or whenever your provider config is missing), the CLI launches a 5-step onboarding wizard instead of the regular TUI:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ zelari-code v1.3.0 โ€” first-time setup    โ”‚
โ”‚ 1/welcome  2/provider  3/model  4/apikey  5/...โ”‚
โ”‚                                                 โ”‚
โ”‚ Welcome! Let's get you coding in under 2 min.   โ”‚
โ”‚ Press [Enter] to continue, [Q] to quit.         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

The wizard walks you through:

  1. Welcome โ€” overview + how to quit.
  2. Provider โ€” pick from grok, minimax, glm, deepseek, openai-compatible (โ†‘/โ†“ + Enter).
  3. Model โ€” type a model name or accept the default (Enter).
  4. API key โ€” choose env (use GROK_API_KEY etc.), keystore (save locally), or skip (set later via /login).
  5. Confirm โ€” review + Enter to commit.

When you press Enter on confirm, the wizard writes ~/.tmp/zelari-code/provider.json (and keys.json if you chose keystore), shows a brief "โœ“ Setup complete!" banner, then transparently transitions into the regular TUI โ€” no need to re-launch.

Skipping / re-running

zelari-code --no-wizard            # skip wizard even on first run
zelari-code --reset-config         # force re-run wizard (clears provider.json)
ZELARI_NO_WIZARD=1 zelari-code     # env equivalent of --no-wizard
zelari-code --version              # print version + exit (no TUI)
zelari-code --help                 # print help + exit (no TUI)

The wizard re-runs automatically if provider.json is missing on the next launch.

Quick Start

# Set your OpenAI-compatible API key (OpenAI, Together, Groq, custom endpoint, etc.)
export OPENAI_API_KEY=sk-...

# Or use Grok via OAuth (Device Authorization Grant โ€” RFC 8628)
zelari-code
# Inside the TUI: /login grok
# โ†’ A code + verification URL appears; open the URL, enter the code, authorize.

# Or use GLM/Z.AI
export GLM_API_KEY=...

# Run zelari-code from any directory
zelari-code

Slash Commands

Full reference: docs/GUIDA.md (all flags, examples, skill IDs).

Command Description
/help List all commands + loaded skills
/exit Exit the CLI
/login <provider> [key] Set API key; /login grok starts OAuth
/provider, /provider <id> Show / switch LLM provider
/provider custom <url> Self-hosted endpoint (Ollama, LM Studio, โ€ฆ)
/model <name>, /models Set model / list discovered models
/skill <id> [input] Invoke a coding skill (23 built-in + SKILL.md)
/skill-stats [id] Skill invocation stats
/skill-compare <id1> <id2> Compare two skills' stats
/council <input> Run the 6-member council pipeline
/zelari <input> Run an autonomous mission โ€” multi-run council until the MVP slice is complete
/council-feedback <id> <1-5> Rate a council member
/promote-member <id> Promote a council member to a skill
/sessions, /resume <id>, /new Session management
/branch <name>, /branches, /checkout <name> Session branches
/compact, /clear Compact / clear transcript
/diff [--staged], /undo --yes Git diff / revert (destructive)
/steer <text>, /steer --interrupt <text> Queue follow-up during a run
/workspace โ€ฆ .zelari/ artifacts + AGENTS.MD
/update, /update --yes Check / install CLI updates
/mode [agent|council|zelari] Switch dispatch mode (shift+tab fallback)
/checkpoint [label] Snapshot the working tree (rollback target)
/rollback [id|latest] Restore a checkpoint (revert / restore files atomically)
/index Build / refresh the semantic search index

TUI: shift+tab cycles agent โ†’ council โ†’ zelari mode for free-form prompts (with terminal-fallback hardening since v1.3.0). The equivalent command /mode [agent|council|zelari] works in any terminal.

Headless Mode

Run a single task without the TUI (CI/scripts):

zelari-code --headless --task "Explain src/cli/main.ts" --output plain
zelari-code --headless --task "Design a REST API" --council --output json

See docs/GUIDA.md for exit codes and all flags.

Self-Update

Zelari Code includes a built-in update mechanism:

# Inside the TUI:
/update          # check for updates (prints current vs latest)
/update --yes    # apply update (runs npm install -g zelari-code@latest)

On startup, the CLI silently checks the npm registry. If a newer version is available, it prints a one-line hint to stderr.

Disable auto-check: ANATHEMA_DEV=1 zelari-code

Features

  • ๐Ÿค– Multi-agent council โ€” 6 roles (Caronte, Nettuno, Gerione, Plutone, Minosse, Lucifero) with feedback loops and member promotion
  • โšก Zelari-mode โ€” autonomous multi-run missions: a free-form prompt is turned into a structured mission brief, then the council loops (design โ†’ implementation) until the MVP slice's completion.ok is green or the iteration budget runs out
  • ๐Ÿง  Project memory โ€” zero-dependency file-based recall (.zelari/memory/), fed into the council as RAG context between mission slices (opt-out with ZELARI_MEMORY=0)
  • โ‡งโ‡ฅ Agent/council/zelari mode switch โ€” shift+tab cycles free-form prompts between the single agent, the full council pipeline, and an autonomous mission (mode shown in the status line)
  • ๐ŸŽจ Rich TUI โ€” Ink + React: native-scrollback chat stream, input bar with status line below it (mode ยท provider ยท model ยท session ยท cwd ยท execution timer)
  • ๐Ÿ—‚๏ธ Live git sidebar โ€” right-hand panel with the N-THEM emblem and the working-tree changes (+added/-removed per file, refreshed every 4s; auto-hidden on narrow terminals)
  • โฑ๏ธ Execution timer โ€” elapsed time of the in-flight turn in the status line (โฑ 12s), frozen as last 34s when the run completes
  • ๐Ÿง  Provider-agnostic โ€” OpenAI-compatible APIs (OpenAI, Together, Groq, custom), xAI Grok with OAuth refresh, GLM/Z.AI
  • ๐Ÿ› ๏ธ Built-in tools โ€” filesystem (read/write/edit), shell (bash), search (grep), web fetch/search
  • ๐Ÿง  LSP code intelligence (lsp_* tools) โ€” go-to-definition, find references, hover type, document symbols, rename symbol via real language servers (tsserver, pyright, โ€ฆ)
  • ๐ŸŒฒ AST structural tools (ast_* tools) โ€” symbol outline + find-by-name via the TypeScript compiler API, no language server needed
  • ๐Ÿ”Ž Semantic search (semantic_search + /index) โ€” concept-level code search via embeddings, local-first
  • ๐ŸŒ Browser verification (browser_check) โ€” headless browser with click/fill/goto/wait actions, console + network + screenshot capture for visual verification of web work
  • ๐Ÿ” Post-edit diagnostics loop โ€” after every edit_file/write_file the harness runs project lint/compile (eslint, ruff, LSP-pluggable) and surfaces the errors to the model in the same turn (opt out: ZELARI_DIAGNOSTICS=0)
  • ๐Ÿ’พ Prompt-cache accounting โ€” tracks prompt-cache hit rate per provider/model and surfaces it in the status bar (cache 73%) so you can see when a session is amortizing its prefix
  • ๐Ÿงท Workspace checkpoints โ€” /checkpoint [label] + /rollback [id|latest] use git plumbing to snapshot the working tree (tracked + untracked) and restore it atomically; every zelari-mode mission takes one before starting
  • ๐Ÿค Sub-agent delegation (task tool) โ€” delegate a focused read-only research sub-task to an isolated sub-agent with its own fresh context, max 12 tool turns, no write/bash/recursion
  • ๐Ÿ“š 23 coding skills (+ user SKILL.md from .zelari/skills/, .claude/skills/, โ€ฆ)
  • ๐Ÿ”„ Cross-provider failover โ€” automatic retry with provider swap on transient errors
  • ๐Ÿ“Š Metrics + skill history โ€” fire-and-forget logging to ~/.tmp/zelari-code/
  • ๐Ÿ—œ๏ธ Session management โ€” JSONL transcripts, resume across restarts, compaction
  • ๐ŸŒฟ Branch isolation โ€” session snapshots per branch
  • ๐Ÿ”Œ MCP โ€” external MCP servers via .zelari/mcp.json
  • ๐Ÿ†• Self-update โ€” /update slash command + silent registry check on startup

Architecture

zelari-code (CLI, proprietary)
โ”œโ”€โ”€ src/cli/                  # Ink TUI, provider config, workspace, wizard, MCP
โ”‚   โ”œโ”€โ”€ components/           # ChatStream, InputBar, Sidebar, StatusBar, โ€ฆ
โ”‚   โ”œโ”€โ”€ slashHandlers/        # /provider, /workspace, /update, โ€ฆ
โ”‚   โ””โ”€โ”€ workspace/            # .zelari/ persistence + AGENTS.MD curation
โ””โ”€โ”€ packages/core/            # @zelari/core (MIT, npm)
    โ”œโ”€โ”€ core/                 # AgentHarness โ€” provider-neutral agent loop
    โ”œโ”€โ”€ agents/               # Council API, roles, 23 skills, tool schemas
    โ”œโ”€โ”€ harness/tools/        # Tool registry + filesystem/shell/search/web
    โ”œโ”€โ”€ events/               # BrainEvent contract
    โ””โ”€โ”€ council/              # Run mode, tier banners

AgentHarness takes (model, provider, messages, tools) + a streaming function and yields AsyncIterable<BrainEvent>. The CLI subscribes and renders via eventsToMessages(). See MIGRATION.md for the v0.5+ package boundary.

Environment Variables

Variable Description
OPENAI_API_KEY OpenAI API key
OPENAI_MODEL Default model (default: grok-4)
OPENAI_BASE_URL Custom OpenAI-compatible endpoint
GLM_API_KEY GLM/Z.AI API key
GROK_API_KEY xAI Grok API key (alternative to OAuth)
DEEPSEEK_API_KEY DeepSeek API key (models auto-discovered; default deepseek-v4-pro)
MINIMAX_API_KEY MiniMax API key
ANATHEMA_DEV=1 Disable silent update check on startup
ZELARI_NO_WIZARD=1 Skip first-run wizard
ZELARI_NO_SHIM_REPAIR=1 Disable auto-repair of a missing Windows bin shim on install
ZELARI_COUNCIL_TIER=lite Council with 3 members instead of 6
ZELARI_MCP=0 Disable MCP servers
ANATHEMA_FAILOVER=0 Disable cross-provider failover
ZELARI_MEMORY=0 Disable the file-based project memory (.zelari/memory/)
ZELARI_MISSION_AUTO=1 Auto-start Zelari missions (skip the brief confirmation)
ZELARI_MISSION_MAX_ITER Max Zelari mission iterations (default 10)
ZELARI_MODE_MAX_TOOLS_LUCIFER Chairman (Lucifero) tool budget in zelari-mode (default 30)
ZELARI_DIAGNOSTICS=0 Disable the post-edit compiler/lint diagnostics loop
ZELARI_DIAGNOSTICS_TIMEOUT_MS Timeout of the diagnostics loop (default 5000)
ZELARI_AST=0 Disable AST structural tools (ast_*)
ZELARI_SEMANTIC=0 Disable semantic search + /index
ZELARI_SEMANTIC_FILE Override the embeddings store path
ZELARI_EMBED_MODEL Embedding model id (default Xenova/all-MiniLM-L6-v2)
ZELARI_BROWSER=0 Disable browser_check
ZELARI_LSP=0 Disable LSP tools (lsp_*)
ZELARI_CHECKPOINT=0 Disable automatic workspace checkpoints in zelari-mode
ZELARI_TOOL_OUTPUT_LINES Lines of tool output shown in the TUI (default 8)

See docs/GUIDA.md for the full list.

Council Workspace

The CLI persists council output (decisions, risks, docs, plan, reviews) into a project-local .zelari/ directory and auto-curates an AGENTS.MD at the project root.

Layout

.zelari/                      # auto-gitignored, per-project
โ”œโ”€โ”€ plan.md                   # phases / tasks / milestones (Markdown + YAML frontmatter)
โ”œโ”€โ”€ risks.md                  # risk register (live, ordered by severity)
โ”œโ”€โ”€ decisions/                # ADRs (Architecture Decision Records) โ€” 001-<slug>.md
โ”œโ”€โ”€ reviews/                  # Minosse verdict per council run
โ””โ”€โ”€ docs/                     # doc drafts produced by the council
AGENTS.MD                     # committed at project root, auto-curated from .zelari/

Slash commands

Command Effect
/workspace List all artifacts + usage hint
/workspace show plan Render .zelari/plan.md
/workspace show decisions List all ADRs (id, status, title)
/workspace show risks Render .zelari/risks.md
/workspace show agents Render AGENTS.MD (project root)
/workspace show docs List .zelari/docs/ drafts
/workspace sync Re-run AGENTS.MD auto-curation (idempotent โ€” no-op if unchanged)
/workspace reset --yes Delete .zelari/ (destructive โ€” requires confirmation)

AGENTS.MD format

AGENTS.MD is partitioned into:

  1. Manual blocks (free-form, preserved verbatim across updates) โ€” write anything you want here.
  2. Auto-managed sections delimited by <!-- zelari:auto:start section="..." --> / <!-- zelari:auto:end --> markers โ€” overwritten each sync.

Auto-managed sections:

  • tech-stack โ€” languages, frameworks, build tools (derived from package.json)
  • decisions โ€” accepted ADRs (newest first, capped)
  • conventions โ€” code conventions observed in source tree
  • build โ€” build/test/lint commands
  • open-questions โ€” info-level risks + unsolved questions

Set ZELARI_AGENTS_MD=0 to disable AGENTS.MD auto-curation.

Storage layout internals

  • Frontmatter: subset YAML (scalars, flow/sequence/block-sequence arrays, flow/block maps) โ€” no external deps.
  • Concurrency: per-key mutex (filesystem writes are serialized per artifact).
  • Idempotency: hash comparison โ€” AGENTS.MD write is skipped when no section changed (clean git diff).

See docs/plans/2026-07-01-council-workspace-cli-stubs.md for the full schema.

Documentation

Doc Description
docs/GUIDA.md Guida utente completa (IT)
docs/TOOLS.md Tool builtin, workspace, MCP
MIGRATION.md Upgrade from โ‰ค 0.4.x
docs/decisions/ ADRs (monorepo, npm publish, API policy)

Development

git clone https://github.com/N-THEM-Studio/zelari-code.git
cd zelari-code
npm install
npm run build:cli
npm link
zelari-code

Run tests

npm test

Typecheck

npm run typecheck
  • AnathemaBrain โ€” the Electron desktop GUI that shares the agent runtime + council system with this CLI
  • Zelari Coder originated as the npm run coder script inside AnathemaBrain
  • @zelari/core on npm โ€” reusable agent runtime (MIT)

License

Proprietary ยฉ 2026 N-THEM Studio. See LICENSE.