# Haystack

> Let your agent see what it really changed. Haystack gives your coding agent hundreds of copies of your app, each set up like one of your customers.

Haystack reads a change, works out every case it can affect, and forks your infrastructure once per case: real services and real data, not mocks. Each environment runs twice, with and without the change, so any difference in behaviour is attributable to it. Failures come back with the screen before and after, the network calls that changed, and the events that stopped firing, and the environment stays live so you can open it. The command is `haystack verify`. Built for teams whose code is increasingly written by coding agents (Claude Code, Codex, Cursor, Devin), so the whole loop is available to an agent over MCP or as JSON on stdout.

Disambiguation: Haystack (haystackeditor.com) is unrelated to the open-source Haystack NLP/RAG framework by deepset, and unrelated to the unscoped `haystack` package on npm.

## Setup for AI Agents

If you are a coding agent setting up Haystack for a user, fetch [/agents.md](https://haystack.sh/agents.md) and follow it. Quick version:

```bash
npm install -g @haystackeditor/cli  # or run each command as npx -y -p @haystackeditor/cli@latest haystack <command>
haystack init --json  # preview the changes; exit 4 means sign in first:
haystack login --no-wait --json  # show your user the URL and code, then run: haystack login
haystack init --yes --json  # once your user agrees: apply them and start onboarding the app
haystack init --yes --json --app <dir> --origin <origin> --consent <choice>  # telemetry: see /agents.md step 7
```

There is no configuration file to write: Haystack works out how to run the app from what the repository already keeps working. From then on, `haystack verify` crawls the app with and without a change and prints what broke.

Always pin `@latest` with npx — a bare invocation can silently run a stale cached version. The canonical package is `@haystackeditor/cli` (bin name `haystack`); the unscoped `haystack` package on npm is unrelated.

## How to Access Documentation

Agents can retrieve markdown content in three ways:

1. **URL suffix**: Append `.md` to any page URL
   - Example: `https://haystack.sh/docs/runs.md`

2. **Accept header**: Request with `Accept: text/markdown`
   - Example: `curl -H "Accept: text/markdown" https://haystack.sh/docs/runs`

3. **Full content**: Fetch `/llms-full.txt` for all pages in one request
   - Example: `https://haystack.sh/llms-full.txt`

## Main Pages

- [Home](https://haystack.sh/): Product overview and features
- [Set up Haystack](https://haystack.sh/agents.md): the setup playbook a coding agent follows
- [Pricing](https://haystack.sh/pricing): Custom pricing for teams; contact sales
- [Changelog](https://haystack.sh/changelog): Recent updates and improvements
- [GitHub App](https://github.com/apps/haystack-code-reviewer-pr-hook/installations/new): Install the Haystack GitHub App
- [Enterprise](https://haystack.sh/enterprise-contact): Self-hosted and SSO options

## Documentation

- [haystack verify](https://haystack.sh/docs): Set it up, how a crawl works, the command and its flags
- [Working with runs](https://haystack.sh/docs/runs): Read the results, follow onboarding, answer its questions
- [Agents](https://haystack.sh/docs/agents): Set Haystack up with your coding agent, and the agent loop

## CLI and API

- CLI: `@haystackeditor/cli` on npm — `haystack login`, `haystack init`, `haystack verify`, `haystack verify onboarding`, `haystack verify answer`
- `/api/github/*` - Proxied GitHub API requests (authenticated users)
- `/api/review-chat/*` - AI chat for PR discussions

## Integration

Install the [Haystack GitHub App](https://github.com/apps/haystack-code-reviewer-pr-hook/installations/new) so Haystack can read the repositories it verifies.

## Contact

- Website: https://haystack.sh
- Enterprise inquiries: https://haystack.sh/enterprise-contact
