Introducing Nexa Code — The First Harness Native AI Programming Assistant
Today we're releasing Nexa Code — an interactive AI programming assistant built entirely on the Nexa v2.0 Harness Runtime. It's not just another AI coding tool. It's the first demonstration that the Harness six-tuple H=(E,T,C,S,L,V) can be real runtime primitives, not just theoretical constructs.
Why Nexa Code is Different
Every AI coding assistant today — Claude Code, Codex, Cursor — is built as a Python application with a framework managing the agent loop. The harness (execution control, tool binding, context management, state persistence, lifecycle hooks, output verification) is implemented as runtime conventions — code that could be skipped, bypassed, or simply forgotten.
Nexa Code is different because the harness is a language property:
| Dimension | What Others Do | What Nexa Code Does |
|---|---|---|
| E — Execution | while loop in Python | autoloop — language keyword with max_steps, exit_when, timeout |
| T — Tool | function registry dict | @tool annotation → ToolSchema with risk_level, approval, sandbox |
| C — Context | truncate messages array | with_context — importance-weighted paging with auto-summarization |
| S — State | save to JSON file | snapshot/restore/fork/merge — first-class state operations |
| L — Lifecycle | callback hooks | before_step/after_step/reflect — compiler-verified hook signatures |
| V — Verify | assert in test suite | verify ... satisfies — runtime acceptance criteria with self-correction |
How It Works
Nexa Code implements a full ReAct (Reason→Act→Observe→Reflect) loop using the Harness Runtime:
# The Harness pipeline for each user request:
# C-dimension: Add user input to context
context_mgr.add_message("user", user_input)
# S-dimension: Snapshot state before execution
snap_id = state_store.snapshot(conversation, step_count)
# L-dimension: Fire before_step hook
hooks.fire("before_step", step=step_count+1)
# E-dimension: autoloop ReAct cycle (max 5 tool rounds)
for round in range(max_tool_rounds):
response = llm.chat(conversation, tools=tool_schemas)
tool_calls = parse_tool_calls(response)
if not tool_calls:
break # Final answer — exit loop
# T-dimension: Execute tools
for name, args in tool_calls:
result = tool_registry.execute(name, args)
# L-dimension: Reflect injection after 3+ rounds
if round >= 3:
reflect("Are you making progress?")
# V-dimension: Verify output quality
verify_result = evaluator.verify_satisfies(response, "string")
# S-dimension: Restore on verification failure
if not verify_result.passed:
state_store.restore(snap_id)
Built-in Tools
Nexa Code ships with 5 tools registered via the T-dimension:
- read_file(path) — Read any file with line numbers, up to 200 lines
- write_file(path, content) — Write content, auto-create directories
- search_files(pattern, directory) — Grep across code files
- list_directory(path) — List files and directories
- shell_exec(command) — Execute shell commands (dangerous commands blocked)
Interactive REPL
Nexa Code supports both interactive and one-shot modes:
# Interactive mode — full REPL with /commands
$ python nexa_code.py
╔════════════════════════════════════════════════╗
║ Nexa Code v2.0.0 ║
║ The First Harness Native AI Coding Agent ║
╚════════════════════════════════════════════════╝
Type your request, or use /help for commands.
Use Ctrl+C to interrupt, /exit to quit.
nexa-code> Read the VERSION file
⚡ Step 1
🔧 Tool calls: 1
→ read_file({"path": "VERSION"})
← File: VERSION (1 lines)...
✅ Step 1 completed
✓ Verify: passed=True
The VERSION file contains: 2.0.0
# One-shot mode — single task
$ python nexa_code.py "What version is this?"
Slash Commands
The REPL supports rich slash commands that map to Harness subsystems:
/help— Show available commands/clear— Clear conversation (C-dimension reset)/model NAME— Switch LLM model (V-dimension routing)/snap— Take state snapshot (S-dimension)/restore ID— Restore snapshot (S-dimension)/tools— List registered tools (T-dimension)/context— Show context stats (C-dimension)/trace— Show execution trace (E-dimension)/cd PATH— Change working directory/read PATH— Direct file read/write PATH— Direct file write/search PAT— Direct search/run CMD— Direct shell execution
Safety by Design
Nexa Code demonstrates three safety properties that come from the language, not from the developer remembering to add checks:
- Execution bounded:
autoloopenforces max_steps — the agent cannot loop forever - Tools verified:
@toolrequires description and schema — you cannot register an unsafe tool - Output checked:
verifyvalidates responses — the agent cannot silently produce garbage
When verification fails, the S-dimension automatically restores the last snapshot — the agent self-corrects rather than cascading errors.
What's Next for Nexa Code
Nexa Code is a v2.0 proof-of-concept. The next steps:
- Compiler integration: Write Nexa Code in
.nxsyntax, compile withnexa build - Multi-agent: Add CodeReviewer and TestGenerator actors via
spawn/pass/await - WASM sandbox: Execute tools in wasmtime sandbox for full isolation
- Streaming output: Real-time token streaming for better UX
The goal: every AI coding assistant should be built on a Harness Native language — because agent safety should be a language property, not a runtime convention.
— Owen, May 15, 2026