Skip to content

About

one night build on ai harness from scratch

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI Harness

A small coding agent I built from scratch in one night.

It talks to an LLM, calls tools in a loop, and can explore the repo, edit files, and run shell commands. The todo/ app in this repo was generated by the agent as a quick test.

demo.mp4

Local copy of the demo: demo.mp4

What it does

  • Streams model output to the terminal
  • Lets the model call tools: read and bash (run commands, write/edit files)
  • Reloads tools mid-session if you add a new one under src/tools/
  • Supports Groq and Anthropic via a thin provider layer

This is a learning / weekend harness, not a polished product.

Quick start

pnpm install

Put your key in .env:

Groq_API_Key=...
# optional
# ANTHROPIC_API_KEY=...

Run with a prompt:

pnpm run dev -- -t "List the files in this repo and summarize what each folder is for."

Or after linking the bin:

pnpm link --global
cc -t "Add a dark mode toggle to the todo app."

Provider / model flags:

pnpm run dev -- -t "..." --provider groq
pnpm run dev -- -t "..." --provider anthropic --model claude-sonnet-4-5

Layout

src/
  main.ts              # CLI entry, system prompt, event logging
  agent/loop.ts        # tool-calling agent loop
  providers/           # Anthropic + OpenAI-compatible (Groq)
  tools/
    read.ts            # read a file
    bash.ts            # shell + write/edit helpers
    registry.ts        # discover / reload tools
todo/                  # tiny HTML/CSS/JS todo app the agent built
bin/cc.js              # `cc` CLI wrapper

How the loop works

  1. Send the user prompt + system instructions to the provider
  2. If the model returns tool calls, run them and append results
  3. Repeat until the model stops calling tools (or hits the turn limit)

That’s it — no fancy planner, just a streaming tool loop.

Try the todo app

npx --yes serve todo

Then open the URL it prints.

Notes

  • Built overnight as a from-scratch exercise
  • Default Groq model is whatever is set in src/providers/index.ts
  • Paths used by tools are constrained to the project root

License

ISC

About

one night build on ai harness from scratch

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages