On this page

AI Agent Quickstart

Tenon is designed for AI coding agents (Claude Code, Codex, Antigravity, Cursor, OpenCode, and custom harnesses) to read, write, check, and build with minimal token overhead.

1. Install the Tenon agent skill

The one-line installer (curl -fsSL https://tenon-lang.org/install.sh | bash) runs tenon setup --skills automatically. Run it anytime to install or refresh the bundled SKILL.md in standard agent skill directories (~/.agents/skills/tenon/ and ~/.claude/skills/tenon/):

tenon setup --skills

2. Prime the agent context

Emit a token-budgeted primer tailored to the task at hand:

tenon prime --task cli
# Available tasks: general, cli, tui, mcp, agent, web, plugin
# Optional: --budget <tokens> --json

Inspect the 105 bundled edition = "2026" plugin APIs (including the 15 std_* domain facades and standard packages, plus fsm/fsm_gen/fsm_test) on demand without reading source trees:

tenon plugins index --all
tenon doc --card tui --json

3. Read, write, and edit canonical terse UTF-8 .tn

Tenon stores canonical terse UTF-8 .tn source on disk (M26+, ADR-0314), supporting compound assignments (+=), implicit tail returns, = expr function bodies, deep with lenses, ??, let ... else, typed holes (todo("...")), and requires/ensures contracts. Legacy compact ~1 files remain readable transparently.

# Write a new file directly as canonical terse UTF-8
tenon write app/helper.tn <<'EOF'
fn greet(name: str) -> str = name
EOF

# Inspect any .tn file (or structured AST/outline JSON)
tenon view app/helper.tn
tenon view app/helper.tn --json

# Edit an existing function in place
tenon edit replace-fn app/helper.tn greet

Single-file manifestless #! scripts (ADR-0319) run directly without tenon.toml:

tenon ./script.tn --arg value

4. Add plugins, auto-fix, constrain decoding, and verify

tenon add std_data
tenon check --fix --json
tenon holes --json
tenon grammar --surface ordinary --root expr --format gbnf
tenon test
tenon profile ./app
tenon install

5. Connect via MCP (tenon mcp serve)

Expose Tenon's compiler, documentation cards, and workspace tools over stdio JSON-RPC to any MCP-compatible host:

tenon mcp serve

Example MCP client configuration:

{
  "mcpServers": {
    "tenon": {
      "command": "tenon",
      "args": ["mcp", "serve"]
    }
  }
}

Verify the server responds to initialize and tools/list over stdio, or run the end-to-end qualification harness in bench/onboarding-smoke/README.md.

6. Run the bundled coding harness (tenon harness)

Tenon ships a fast, sandboxed Tier-0 coding harness (tenon harness) backed by harness_aci, harness_policy, harness_verify, harness_rewind, and agent_obs. It defaults to a local OpenAI-compatible llama-server ($TENON_HARNESS_URL or http://127.0.0.1:18083/v1) with a compact fixed prefix (< 2K tokens) for high KV-cache hit rates:

# Pre-build and cache the bundled harness binary once
tenon harness warmup --json

# Run a fast Tier-0 task against local llama-server (default http://127.0.0.1:18083/v1)
TENON_HARNESS_MODEL=inkling-2-mini \
  tenon harness --policy-preset workspace-edit --json "Fix the failing test in main.tn"

# Opt-in semantic MCP bridge, escalation handoff, and secret-redacted trajectory capture
tenon harness --mcp --escalate probe-k1 --record-trace ./traces "Add --json flag to CLI"

Key flags:

Split Architecture: tenon harness vs coding-harness-2

Surface Best For Architecture
tenon harness (bundled in tenon) Fast everyday Tier-0 single-agent tasks (bug fixes, small features, API discovery, CI scripts) Compact < 2K prefix, 6-tool harness_aci, zero-turn tenon check --fix + harness_verify delta, opt-in --escalate handoff
coding-harness-2 (../coding-harness-2) Multi-agent Harness² evolution, deep multi-file refactors, EXPERIENCE.md domain learning, parallel branches Full multi-stage planner/verifier/evolution loop consuming EscalationHandoff and shared harness_aci/harness_policy plugins

Verify the bundled harness end-to-end with bench/harness-cli/smoke.py.