A small TypeScript workspace for exploring a CLI-style coding agent.
This repository currently contains:
agent: a CLI coding-agent prototype that runs verification, retrieves evidence, and persists structured run artifacts.agent-playground: a tiny TypeScript project with a deliberate bug and a failing test, used as a target repo for the agent.
The codebase is intentionally small. It is meant to make the agent loop easy to understand before adding real automation such as repository scanning, code edits, and test execution.
.
├── agent/
│ ├── src/
│ │ ├── app/ # use-case orchestration
│ │ ├── artifacts/ # run artifact persistence
│ │ ├── cli/ # argument parsing and process exit behavior
│ │ ├── domain/ # shared domain types
│ │ ├── infra/ # command/file/search adapters
│ │ ├── retrieval/ # repository evidence retrieval logic
│ │ └── verification/ # verification step runners
│ └── runs/ # JSON run artifacts
└── agent-playground/
└── src/
├── sum.ts
└── sum.test.ts
The current agent does the following:
- Reads command-line arguments from
process.argv. - Accepts only the
fixcommand. - Requires
--repoand--issue. - Verifies that the target repo path exists.
- Runs
pnpm testin the target repo and captures structured output. - Retrieves likely related files using issue keywords, test output paths, and test-import expansion.
- Persists a typed
RunRecordartifact inagent/runs/*.json.
It does not yet:
- generate code patches with an LLM
- apply patches to the repository
- run multi-step verification (
lint/tsc/test/build) - loop on failures for automatic repair
- Node.js 20+ recommended
pnpm10
Install dependencies in each package:
cd agent
pnpm installcd agent-playground
pnpm installFrom the agent directory:
pnpm agent fix --repo ../agent-playground --issue "sum test is failing"Expected behavior:
- the CLI validates the command
- the CLI validates the repo path
- the CLI executes tests and retrieval
- the CLI saves a structured run artifact path
If the command or arguments are invalid, it exits with a usage message or an error.
From the agent-playground directory:
pnpm testThis test is expected to fail right now because sum.ts contains an intentional off-by-one bug.
The goal is to build up an agent loop step by step:
- Accept a task from the command line.
- Inspect a target repository.
- Identify relevant files.
- Run tests or checks.
- Apply a fix.
- Re-run validation.
- Report the result.
The current implementation now covers steps 1-4 partially (with logs), but does not yet perform edit/apply/retry automation.
- TypeScript
tsxfor running TypeScript directlyvitestin the playground projectexecafor command execution and repo search helpers
Good next milestones for this project:
- Add LLM patch generation with strict unified-diff output constraints.
- Add safe patch application (
git apply --checkthengit apply). - Add verification pipeline orchestration (
lint -> tsc -> test -> build). - Add loop control for retry/failure taxonomy and stop conditions.
- Add regression tasks and basic success-rate metrics.
No license has been added yet. If you plan to publish this on GitHub, add one before making reuse expectations public.