Helix is an autonomous bug-fixing system. Phase 1 turns the Phase 0 foundation into a real closed loop:
bug input -> repo context -> patch plan -> file edits -> build/test verification -> verdict -> retry if needed
The current MVP supports one local TypeScript/Node repository at a time.
Phase 1 is complete when the repo can do all of the following:
- accept a fix request through the CLI or API
- persist the job and attempts in PostgreSQL
- enqueue work in Redis through BullMQ
- let the worker run the agent loop
- create isolated attempt workspaces under
/tmp/helix/<jobId> - collect relevant repo files for context
- ask a model for a structured patch plan
- apply text edits to the attempt workspace
- run
pnpm buildandpnpm test - mark the job
completedorfailedwith stored attempt history
This repository now supports that flow.
apps/
api/ HTTP API for creating and querying fix jobs
cli/ Local CLI for submitting and polling fix jobs
dashboard/ Next.js dashboard app
docs/ Docs app
packages/
agent/ Agent loop, prompt building, verification, orchestration
executor/ Workspace cloning, file edits, command runner, repo scan
shared/ Prisma client, queue config, shared contracts, env loading
ui/ Shared UI components
workers/
agent-worker/ BullMQ worker that executes fix jobs
prisma/
schema.prisma Database schema- Node.js 22+ recommended
- pnpm 10+
- PostgreSQL
- Redis
- An OpenAI-compatible API key
- Docker Desktop or Docker Engine if you want one-command local infrastructure
Copy .env.example to .env:
cp .env.example .envRequired variables:
POSTGRES_DB: local PostgreSQL database name used by Docker ComposePOSTGRES_USER: local PostgreSQL username used by Docker ComposePOSTGRES_PASSWORD: local PostgreSQL password used by Docker ComposeDATABASE_URL: PostgreSQL connection string used by PrismaREDIS_HOST: Redis hostname for BullMQREDIS_PORT: Redis port for BullMQAPI_PORT: port used by the API serverOPENAI_API_KEY: model provider API keyOPENAI_MODEL: model name, for examplegpt-5.4-miniOPENAI_BASE_URL: model base URL, for examplehttps://api.openai.com/v1
Notes:
- The runtime now auto-loads the repo root
.envfor the API, worker, and shared packages. - You can use OpenAI directly or an OpenAI-compatible provider such as OpenRouter.
Example OpenRouter configuration:
OPENAI_API_KEY=your_openrouter_key
OPENAI_BASE_URL=https://openrouter.ai/api/v1
OPENAI_MODEL=openai/gpt-4o-mini
OPENAI_REASONING_EFFORT=medium
OPENAI_TIMEOUT_MS=120000If you do not already have PostgreSQL and Redis running, start both with Docker:
pnpm infra:upStop them when you are done:
pnpm infra:downpnpm installThe install step also runs prisma generate, so the Prisma client is ready before you start the API or worker.
Create or update your database schema:
pnpm exec prisma migrate devIf you only want to refresh the Prisma client:
pnpm prisma:generateStart the API in one terminal:
pnpm --filter api devStart the worker in a second terminal:
pnpm --filter agent-worker devUse the CLI in a third terminal:
pnpm --filter helix-cli dev -- fix \
--repo ./demo-app \
--bug "TypeError: Cannot read properties of undefined" \
--stack "src/index.ts:2 TypeError: Cannot read properties of undefined"Health check:
curl http://127.0.0.1:4000/healthManual API submission:
curl -X POST http://127.0.0.1:4000/fix \
-H "Content-Type: application/json" \
-d '{
"repoPath":"/absolute/path/to/demo-app",
"bugDescription":"TypeError: Cannot read properties of undefined",
"stackTrace":"src/index.ts:2 TypeError: Cannot read properties of undefined",
"maxAttempts":3
}'Check job status:
curl http://127.0.0.1:4000/jobs/<job-id>When a job succeeds, Helix should:
- store the job as
queued - let the worker mark it
processing - create
/tmp/helix/<jobId>/base - create
/tmp/helix/<jobId>/attempt-1 - scan relevant files from the target repo
- generate a strict JSON patch plan
- apply text edits inside the attempt workspace
- run
pnpm build - run
pnpm test - mark the attempt
succeededand the jobcompleted
If a run fails, the attempt error is stored and the worker retries until maxAttempts is exhausted.
Your target repo should:
- be local on disk
- have a valid
package.json - support
pnpm build - support
pnpm test - be small enough that file retrieval stays manageable
Phase 1 is intentionally scoped to local TypeScript/Node repos only.
Use these commands to verify the workspace:
pnpm exec prisma validate
pnpm --filter @repo/shared exec tsc --noEmit
pnpm --filter @repo/executor exec tsc --noEmit
pnpm --filter @repo/agent exec tsc --noEmit
pnpm --filter api exec tsc --noEmit
pnpm --filter agent-worker exec tsc --noEmit
pnpm --filter helix-cli exec tsc --noEmitPhase 1 intentionally keeps the system narrow. It does not yet:
- sandbox commands
- support non-Node repos
- use embeddings or retrieval memory
- separate evaluator logic into a dedicated package
- provide a production dashboard for traces
- support multi-agent execution
Those belong to the next phases.