Skip to content

Instantly share code, notes, and snippets.

@franky47
Last active May 12, 2026 17:17
Show Gist options
  • Select an option

  • Save franky47/9c764053c2d616fd874dbd7c9948ec4c to your computer and use it in GitHub Desktop.

Select an option

Save franky47/9c764053c2d616fd874dbd7c9948ec4c to your computer and use it in GitHub Desktop.
2026-05-12 - Human Talks - Resources
name install-fast-deterministic-tools
description Install fast deterministic TypeScript/JS tooling (tsgo, bun, knip, oxc, fallow, agent-ci) and wire them into a pre-commit hook so agents get fast feedback and quality code lands in PRs. Use when user wants to set up an agentic validation loop, add deterministic guardrails, speed up CI/local checks, or replace slow tsc/eslint/prettier with native-speed equivalents.
author François Best <github@francoisbest.com>

Fast deterministic tools for agentic loops

Goal: give agents (and humans) instant feedback via deterministic, native-speed tools. Wire them into pre-commit so the agent self-corrects before a commit lands, and into CI as a safety net.

Why

  • LLMs: malleable, slow, non-reproducible. Good for judgment.
  • Deterministic tools: fast, reproducible, dumb about intent. Good for enforcement.
  • Speed matters: faster loop = better prompt cache hits = cheaper + greener + flow-preserving.

The toolset

Tool Lang Replaces Job
tsgo Go tsc Typecheck. TS v7 native preview, package @typescript/native-preview.
bun Zig node + npm/pnpm + jest/vitest Runtime, package manager, test runner, script runner. No transpile.
knip TS Find dead code: unused exports, files, deps. Agents leave junk; knip deletes it.
oxlint Rust eslint Lint (ESLint-compatible rules).
oxfmt Rust prettier Format + import sort + package.json field sort.
fallow Rust partial knip + lint Duplication detection, complexity. Verbose — watch token cost in agent loops.
agent-ci TS act Run GitHub Actions locally so agents validate before pushing (avoids ping-pong CI commits).

Modern Node.js is a viable, less-VC-funded alternative to bun for runtime + test runner.

Install (bun-based project)

bun add -d @typescript/native-preview knip oxlint oxfmt fallow
# agent-ci: follow upstream install instructions (early-stage, check repo)

package.json scripts:

{
  "scripts": {
    "typecheck": "tsgo --noEmit",
    "lint": "oxlint",
    "format": "oxfmt",
    "format:check": "oxfmt --check",
    "deadcode": "knip",
    "test": "bun test",
    "validate": "bun run typecheck && bun run lint && bun run format:check && bun run deadcode && bun run test"
  }
}

Pre-commit hook

Prefer Git 2.54+ config-based hooks. Native, declarative, no dependency, multiple hooks per event, listable via git hook list pre-commit, disable-able via enabled = false. Lives in .git/config (repo), ~/.gitconfig (user), or /etc/gitconfig (system).

# .git/config (or commit a snippet to be sourced via git config --local include.path)
[hook "format"]
	event = pre-commit
	command = bunx oxfmt

[hook "lint"]
	event = pre-commit
	command = bunx oxlint

[hook "typecheck"]
	event = pre-commit
	command = bunx tsgo --noEmit

[hook "deadcode"]
	event = pre-commit
	command = bunx knip

Inspect: git hook list pre-commit. Disable one ad hoc: git config hook.lint.enabled false.

Fallback for Git < 2.54 — pick one:

  • lefthook — fast (Go), parallel, supports {staged_files} and stage_fixed. Recommended.
  • husky — most ubiquitous, JS-based, simpler config but slower bootstrap.
  • Plain .git/hooks/pre-commit script — zero deps, but not shareable across the team.
# lefthook.yml (fallback)
pre-commit:
  parallel: true
  commands:
    format:
      run: bunx oxfmt {staged_files}
      stage_fixed: true
    lint:
      run: bunx oxlint {staged_files}
    typecheck:
      run: bunx tsgo --noEmit
    deadcode:
      run: bunx knip
# husky equivalent: .husky/pre-commit
bunx oxfmt && bunx oxlint && bunx tsgo --noEmit && bunx knip

Loop intent: agent attempts a commit → hook runs → auto-fixes applied → checker failures surface as actionable diffs → agent reads, fixes, retries. Only clean code reaches the PR.

CI

Mirror the same bun run validate in CI as a safety net. If the pre-commit hook ran, CI is a no-op; if someone bypassed it, CI catches it.

Order of operations when agents misbehave

  1. Deterministic first. Can a tool catch this? Add/configure rule.
  2. Malleable second. Only if no tool fits, write guidance in AGENTS.md / CLAUDE.md.

Tools enforce; prose guides. Don't write a paragraph when a lint rule will do.

Gotchas

  • tsgo is beta — pin the version, expect rough edges, keep tsc as fallback in CI for now if shipping prod.
  • oxlint doesn't yet cover every ESLint rule — audit your existing config before swapping.
  • fallow is verbose; for agent loops, pipe through --quiet or filter to keep token usage sane.
  • agent-ci is early; act is the legacy fallback if it doesn't work for your workflow.
  • knip needs configuration tuning per project to avoid false positives on entrypoints.

Author

François Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment