Agent Operations & Repository Reference
Deep operational reference linked from AGENTS.md. Keep AGENTS.md compact and put detailed checklists and maps here.
Fast iteration and build-speed guardrails
Full handbook: fast-iteration.md. Key fast-loop
commands: cargo check --workspace,
cargo test --bin tenon <filter>,
make dev-fast (target/dev-fast/tenon),
make check-fast /
scripts/gate.sh --fast,
tenon fmt --check --stdin0, and
scripts/gate.sh --quiet (cached full gate).
Do not regress build or gate speed:
- Never add
.gitrerun-if-changedor multi-MBinclude_bytes!/include_str!assets tocrates/tenon; keep static assets incrates/tenon-assetsand release provenance gated behind release builds orTENON_RELEASE_COMMIT. - Preserve the 4-crate split (
tenon-assets,tenon-frontend,tenon-compiler,tenon),debug = "line-tables-only"on[profile.dev]/[profile.test], and[profile.test]opt-level = 0withtenon-compiler/tenon-frontendatopt-level = 1; never duplicate modules across binaries (tenon-codecreusestenon-frontend) or pull CLI handlers intotenon-compiler. - Never spawn
tenonper-file in shell loops; usetenon fmt --check --stdin0or multi-path CLI invocations. - Never add a redundant full
cargo buildtoscripts/check.sh, keepTENON_CHECK_FAST=1(make check-fast/scripts/gate.sh --fast) separate from full-gate caching, and keepscripts/test_*.tnparallel-safe (isolated temp dirs/ports) forscripts/run_script_tests.tn. - Keep
build_cache(Cache, Linux/macOS/vendored-SQLiteFfiCache) anddriver/runtime_pchfail-closed, probe-free, and never required bytenon emit-c. - Keep
lower/regionslinear on branch-heavy functions (dense container-local indexing inregions_own, skipping scalar-only functions/blocks; guarded byregions_place_scales_linearly_on_branch_heavy_functions). - Keep Rust unit tests millisecond-fast and parallel-friendly
(in-memory where possible; split multi-app tests into concurrent
#[test]s; useBuildMode::Devunless testing-O2) and measure before/after whenever touching build, cache, or gate paths.
Checkpoints, experiments, and commits
- Commits: Imperative subject
type(scope): summary(<= 72chars), body with gate numbers, trailerPlan: M<m>.<n>onfeat/fix/perf/refactor/test. Types:feat fix test docs refactor perf build ci chore exp; scopes:lexer parser types ir cgen interp runtime cli std plugins agent bench spec plan tooling repo..githooks/commit-msgenforces this aftermake setup. Never--no-verify. - Checkpoint: Annotated tag
cp/<m>.<n>-<slug>onmain, logged inCHECKPOINTS.md, only whenPLAN.mdcriteria hold (make checkpoint ID=1.1 SLUG=hello MSG="..."). - Experiment: Branch
exp/<m>.<n>/<name>from a checkpoint in its own worktree with a hypothesis and deciding measurement (make experiment FROM=1.2 NAME=x HYP="..."); finishing archives its tip asarchive/exp/...; adopting one needs an ADR (make adr TITLE="..."). - Parallel tasks: Run on
task/<id>-<slug>or swarm worktree branches; merge tomainonly when green. - Optional token-saving helpers: When present
on
PATH, helpers likerunsum,cap,grepsum,diffsum,catsum,repomap, andctx-packare optional local conveniences (not gate dependencies).
Repository map
crates/tenon-assets/: embedded 105 bundled edition-2026 plugins (MEMBERS_2026), vendored SQLite, and 28 runtime headers (Rust).crates/tenon-frontend/: lexer, parser, AST, canonical terse UTF-8 formatter, read-only legacy~1decoder, constrained grammar emitter (tenon grammar --root), and diagnostics (Rust).crates/tenon-compiler/: typechecker, resolver, IR, regions/ownership, C codegen, driver, build caches, interpreter, editions, and packages (Rust).crates/tenon/: thin CLI/tooling binary crate (tenon,tenon-codec,app_launcher,app_test,plugin_kit,doc_card,edit,fix,doctor,release,profile,holes) (Rust).runtime/: kernel C runtime (tenon_rt.h,trt_state.h,trt_{mem,seq,path,map,f64,par}.h);trt_{cli,io,proc,mono,sha256}.hforward toplugins/cli/native/, wheretrt_{cli,io,proc,net,sandbox,app_scope,mono,sha256}.hlive and are embedded viacrates/tenon-assets.tests/: data and C probes that code/benchmarks read (token-estimates.tsv,runtime/{path,http_fixture,*.c},fixtures/{compact-syntax,pty,tools},vc-oracle/,diagnostics/generic-instance-limit.tn); unit tests live beside the code.examples/tools/andexamples/tui/: CLI tools (wc,grep,csv-sum,word-freq,head,tok,files,rgrep,head_config,tree-value,http-demo/,mcp-tools/,forge/,tvc/,agentd/,procman/,tenon-mcp/,tenon-app/,tenon-trace/,validate-app/,harness-exec/,harness-workbench/,hsyntax/) and TUI examples.plugins/: 105 bundlededition = "2026"plugins, including the 15std_*domain facades and standard batteries (std_core,std_data,std_formats,std_glob,std_regex,std_validate,std_tui,std_actions,std_mcp,std_cli,std_tui_host,std_web,std_agent,std_proc,std_vc), explicit state machines (fsm,fsm_gen,fsm_test), pure TUI stack (tui*/), agent/harness stack (agent*/,harness_*/,mcp*,a2a,openai_chat),app_actions*,app_test*,procman_*,script_host,sqlite,zlib,tvc, and more.bench/: benchmarks, baselines, results (bench/cli/: corpora, Python baselines, time/RSS runner);bench/transfer/T1/T1H.docs/spec/: language reference (LANGUAGE.md,IDIOMS.md,diagnostics.md);docs/decisions/: ADRs;docs/extension-points.md: extension-point register;scripts/: gate and tooling.- Companion repos in parent workspace:
../coding-harness-2/(Harness² coding agent),../coding-harness-evals/(independent evaluator; app lanes never read it),../copilot-term/,../todo-actions/,../tenon-dev-mcp/.
Compiler and performance conventions
- Phases are separate modules with plain data between them:
frontend (UTF-8 parser + read-only legacy
~1decoder), names and types, IR, backends (C, interpreter). - User errors are
Diagnosticvalues with stable codes (docs/spec/diagnostics.md);panic!only for compiler bugs, saying so. - Deterministic output: hash-map iteration order never reaches output.
- Emitted C is warning-free under gcc and clang
-std=c11 -Wall -Wextraand preserves left-to-right evaluation by hoisting calls into temporaries. - Source files end in
.tn(canonical terse UTF-8 per ADR-0314); runtime traps printtrap: <kind> at <file>:<line>:<col>and exit with code 101. - No optimization without a
bench/benchmark showing the need; include before/after numbers in the commit body, check byte-identical output before timing, and report peak memory with time. - Self-benchmarking Tenon against itself (and
Python): Before landing any compiler, interpreter,
runtime, or tooling optimization, snapshot a baseline release
binary
(
cargo build --release --bin tenon && cp target/release/tenon /tmp/tenon-baseline) and keep its SHA-256 + commit revision. After building the candidatetarget/release/tenon, run paired alternating comparisons on an idle host:- Tenon vs. Tenon (interpreter & runtime):
bench/interpreter-performance/run.py --baseline /tmp/tenon-baseline --candidate target/release/tenon --reps 5 --output bench/results/<slug>-interp.json(plus real pure-Tenon workloads such as../coding-harness-2/ui_*_test.tnand../tenon-dev-mcp--selftest). - Tenon vs. Python (native C &
interp):bench/cli/run.pyon seeded corpora (wc,grep,csv-sum,word-freq,head,tok) and dogfoodedscripts/*.tngate scripts. - Compiler & digest check:
python3 -B scripts/bench.py --digestand--save bench/results/<slug>.tsv. - Record raw data: Save both a Markdown summary
and machine-readable
.tsv/.jsonraw samples (median/min/max wall-clock ms, speedup ratio, child peak RSS in KiB, binary SHA-256s, and host load averages) underbench/results/(reference baseline: bench/results/2026-11-29-perf-wave-python-vs-tenon.md).
- Tenon vs. Tenon (interpreter & runtime):