# SaladDay/pi-from-scratch

600 行 TypeScript 写成的超级迷你版 pi，让你轻松从 0 写出属于你的 pi-agent

Repository: https://github.com/SaladDay/pi-from-scratch
Canonical: https://ross.abutalabs.com/products/pi-from-scratch
Homepage: https://pi-from-scratch.vercel.app
Language: TypeScript
License: MIT
License Family: permissive
Topics: agent-loop, ai-agent, coding-agent, llm, pi, tool-calling, typescript, llm-agent, pi-agent, typescript-tutorial
Last push: 2026-08-18T08:09:35+00:00

## Health v2 (maintenance only)
Score: 57/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 35, longevity 1
- inputs: {"age_days": 24, "days_push": 15, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, young
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1131, forks 82 (observed 2026-08-28T04:03:42.575206+00:00)

## What it is
A tutorial project that walks through building a minimal 600-line TypeScript coding agent (nano-pi) modeled on the production-grade pi agent. It pairs an article with an interactive website showing source code and execution traces, covering the LLM streaming layer, agent loop, and file/bash tools.

## Use cases
- learn how to build an AI coding agent from scratch
- understand agent loops and tool calling in TypeScript
- study how the pi agent architecture works
- build a minimal LLM agent that reads files and runs bash
- teach myself LLM streaming and SSE parsing
- follow a step-by-step coding agent tutorial

## When to choose
- you want to understand agent internals rather than use a production tool
- you prefer learning by building a tiny implementation
- you want a readable TypeScript codebase for agent loops and tool calling

## When to avoid
- you need a production-ready coding agent with multi-provider support
- you need extensions, session branching, or token compaction features
- you want a framework to build applications on rather than a teaching resource

## Facets
- artifact type: learning-resource
- maturity: active
- function: agent-framework, llm-inference, developer-tools, sdk
- domain: artificial-intelligence, large-language-models, developer-tools, tutorials
- platform: cli
- tags: coding-agent, agent-loop, tool-calling, tutorial, educational, pi-agent, nano-pi, ai-agents, nodejs, typescript, web

## Member repositories
- SaladDay/pi-from-scratch (main) score 57

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:42.575206+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:38:00.512456+00:00, confidence not recorded.
  - readme: https://github.com/SaladDay/pi-from-scratch (fetched 2026-08-28T04:03:42.575206+00:00, sha 22a80b3def20)
  - homepage: https://pi-from-scratch.vercel.app (fetched 2026-08-29T12:42:33.518750+00:00, sha 23d47c36b254)
- Data as of 2026-08-30T08:39:29.467469+00:00.
