Skip to content

Latest commit

Β 

History

History
111 lines (80 loc) Β· 4.12 KB

README.md

File metadata and controls

111 lines (80 loc) Β· 4.12 KB

πŸ€– agent-core

A terminal coding agent built from scratch.
No LangChain. No agent SDKs. Just a loop, four tools, and a healthy fear of rm -rf.

TypeScript Node Frameworks Benchmark

cat typing very fast

the agent, mid-task


✨ What it does

Ask it something about your project. It reads files, runs commands, edits code and answers, deciding each step on its own.

you> what version is in package.json? bump the patch number.

πŸ”§ bash({"command":"ls -R","timeout":120}) β†’ βœ… 5 lines
πŸ”§ read({"path":"package.json","offset":1,"limit":200}) β†’ βœ… 6 lines
πŸ”§ edit({"path":"package.json","oldText":"  \"version\": \"0.1.0\",","newText":"  \"version\": \"0.1.1\","}) β†’ βœ… 1 lines
The package version has been bumped from **0.1.0** to **0.1.1** in `package.json`.
[tokens: 4,191 in, 254 out]
  • πŸ” Streaming tool-calling loop, written by hand
  • πŸ› οΈ 4 tools, same as Pi: read Β· write Β· edit Β· bash
  • πŸ”Œ Any OpenAI-compatible model: OpenAI, Ollama (local or cloud), and more
  • πŸ›‘οΈ Asks before running shell commands, validates every tool input with zod
  • πŸ“„ AGENTS.md support for per-project instructions

πŸš€ Quick start

git clone https://github.com/javin1106/agent-core.git && cd agent-core
npm install
cp .env.example .env      # pick a model: Ollama works for free
npm run dev               # add "-- --yolo" to skip command approvals
calmly typing while the room is on fire

you, using --yolo in a repo you didn't write

πŸ—οΈ Architecture

flowchart LR
    U([you]) <--> CLI["cli.ts<br/>terminal UI"]
    CLI -- your message --> A["agent.ts<br/>the loop"]
    A -. events .-> CLI
    A --> M["call-model.ts<br/>retry Β· resume Β· continue"]
    M --> P["ai/openai.ts<br/>LLMProvider"]
    P <--> LLM[(any OpenAI-<br/>compatible model)]
    A --> T["tools/<br/>read Β· write Β· edit Β· bash"]
    T <--> FS[(your project)]
Loading

The loop, in four lines:

ask the model  β†’  it wants tools?  β†’  run them, add the results  β†’  repeat
                         ↓ no
                   final answer βœ…

The agent only emits events; the CLI just draws them. Swapping in a TUI or a web UI means writing a new renderer, not touching the agent.

🧯 Built to survive

this is fine dog

  • Retries with exponential backoff (1s β†’ 2s β†’ 4s β†’ 8s)
  • Dropped connection mid-reply? It resumes the reply instead of restarting
  • Hit the length limit? It asks for the rest automatically
  • Ctrl+C stops the current task, not the app
  • Failed turn? Finished tool steps are kept, so it never forgets a file it changed
  • Token + cost tracking per turn and per session

πŸ“Š Benchmark

15 small coding tasks (create, edit, search, run), each in a fresh temp folder, checked automatically. Run it yourself with npm run eval -- --runs 3.

Model Pass rate Model calls / task Tokens / task Time / task
gpt-oss:120b (Ollama Cloud) 93% (42/45, 3 runs) ~3.1 ~3.3K ~2.9s

πŸ—ΊοΈ Roadmap

  • Agent loop, tools, zod validation, AGENTS.md
  • Retries, resume, auto-continue, Ctrl+C, cost tracking
  • Eval suite (npm run eval) and importable library (src/index.ts)
  • Context compaction + saved sessions (--continue)
  • Publish to npm, then a proper TUI
Built to learn how agents really work, one loop at a time.