Contributing
How to build, test, and ship changes to ashlr.
ashlr is MIT-licensed and developed in the open at github.com/ashlrai/ashlr-plugin. PRs welcome.
Pages in this section
| Architecture | The mental model — MCP router, hook system, genome, server boundary. Read this first if you want to add a tool. |
| Testing | How to run the test suite, write new tests, and avoid the Windows flakes that bite this codebase. |
| Releases | The release process — version bumps, CHANGELOG conventions, what triggers each deploy. |
Quickstart
You need:
- Bun. The required CI check pins Bun 1.4.4, so use that version or newer to match it.
- Node.js, for
bun run fresh:checkand theashlr-pluginCLI. - Git, and the GitHub CLI (
gh) for cloning, forking, opening PRs and arming auto-merge. - Perl 5 for the secret scan. It needs no extra modules and is preinstalled on macOS and most Linux distributions.
The plugin and server are separate test suites with separate dependency trees. The plugin is the user-facing MCP code; the server (server/) is the optional Pro hosted backend, with its own dependencies and its own bun run check (cd server && bun install && bun run check). Use bun run test for the plugin rather than plain bun test: it prepares derived docs before the suite starts. bun run check runs every repository check; run bun install in server/, site/ and vscode/ first, as CI does. Each new git worktree needs its own bun install too.
Agents work here too
ashlr is part of the Ashlr ecosystem. Phantom and its sibling repos form an autonomous, code-first, agent-native software factory: agents do the engineering, the human sits as a passive board member, and the goal is open source RSI (recursive self-improvement). Most PRs here are opened by coding agents, and they follow the same rules as people, set in AGENTS.md: branch, commit, open a PR, and merge on green. No write access? Contribute from a fork with your own agent. Two hot-file rules keep parallel PRs from colliding:
- New pipe server cases go in a new test file such as
__tests__/pipe-server-<topic>.test.ts, not in__tests__/pipe-server.test.ts. - Do not commit a regenerated
site/lib/docs.generated.json.
Agents that want to use the plugin, not just edit it, start at llms.txt.
From branch to main
People and agents take the same path.
- Branch or fork. With write access, branch from
main. Without it, fork first:gh repo fork ashlrai/ashlr-plugin --clone. - Check locally. Commit your work, run
git fetch origin(git fetch upstreamin a fork) so the base matches themainCI compares against, then runbun scripts/premerge-local.ts origin/main(in a fork whosemainlags, useupstream/main). It picks the tests your committed diff affects, runs them alongsidebun run typecheckwithin a 60-second budget (--budget-ms <n>raises it), and prints one JSON verdict. It exits 0 on"status":"pass"and 1 otherwise, and it fails rather than skips when it cannot select tests. See Testing. For docs-only changes, also run the doc tests listed in AGENTS.md. - Scan for secrets.
git diff origin/main...HEAD | perl .github/tests/secret-shape/scrub.pl --check --allow-fixturesruns the same scanner CI does (in a fork, diff againstupstream/main). It prints<blocked> allowed=<n>, the token-shaped matches it blocked and the test-fixture placeholders it let through, and exits 1 when<blocked>is above zero. It never prints a value. - Open a PR using the template. Keep it to one concern and say how you tested it. If behavior changed, add a line under
## [Unreleased]inCHANGELOG.md. - Arm auto-merge with
gh pr merge --auto. That needs write access, so a maintainer arms it for a fork PR. The PR then merges through the merge queue onceCI Gateis green, with no manual merge step.
What the pre-merge check runs depends on what your commits change. Text docs select no tests, so it runs only the typecheck: .md, .mdx, .rst and .txt files in a docs/ folder (including site/content/docs/), any README, CHANGELOG, CONTRIBUTING or LICENSE file, and top-level files such as AGENTS.md and llms.txt. That is narrower than CI's docs-only list: a meta.json beside the site docs, any other file under site/ or video/, and anything under .github/ (the PR template included) count as config or source and run all three suites. Markdown under commands/, skills/ and agents/ is product input, not docs. A changed test file runs just that file. A change under servers/, scripts/, hooks/, ports/, commands/, skills/, agents/ or __tests__/ runs all three suites (__tests__, server/tests and integration/tests), and so does a config file (JSON, YAML, a lockfile or a dotfile) or any other source file. A change under server/ runs server/tests and integration/tests; one under integration/ runs only integration/tests. server/ and integration/ have their own dependencies, so for those diffs run (cd server && bun install) && (cd integration && bun install) first and raise the budget, for example --budget-ms 600000. A fail whose step note says the budget ran out means the budget was too small, not that a test failed.
CI Gate is the single required check. On a PR it requires fast checks (version sync, plus install, typecheck and site release facts for code changes) and Secret-shape scan. The merge queue run always does the install, typecheck and release-facts steps, even for a docs-only PR. The full suite runs daily, and coverage, CodeQL and the benchmark also run after each merge to main. None of those is a required check, and a red run is fixed forward on main. See Testing.
Pull requests and merge-queue entries also run a Linux install smoke. OS-sensitive diffs run affected tests, typecheck and install smoke on Windows and macOS; scripts/os-path-gate.mjs defines the selected paths. Gate (linux), Gate (windows) and Gate (macos) report these jobs separately, outside CI Gate. See Testing for the job selection and failure artifacts.
A PR that touches site/** also runs Build + Deploy (Vercel) from deploy-site.yml. It builds the site, and deploys a preview when the repository's Vercel secrets are available (a fork PR gets the build only). It is not part of CI Gate, so the queue does not wait for it. cd site && bun install && bun run build reproduces a failure locally. See Releases.
The rules on main stop there. No approving review is required, and the merge queue squash-merges each PR, so the PR title becomes the commit subject on main. Write it as a conventional, imperative subject such as docs(contributing): ... or fix(grep): .... Paths listed in .github/CODEOWNERS (CI workflows, the secret-shape scanner, and files that make keyed, network or loopback requests) request the code owner's review automatically. Expect a closer look there, and keep such a change in its own PR.
To run the same checks before you push, one root bun install is enough:
When a check fails
gh pr checks <pr-number> lists the checks on your PR (add --watch to wait for them). For a failed run, gh run view <run-id> --log-failed prints only the steps that failed. Each step CI Gate depends on has a local twin:
| Failed step | Run locally | Usual fix |
|---|---|---|
fast checks: Version sync check | bun run version:check | The manifests disagree on the version. Only a release changes it; see Releases. |
fast checks: Typecheck | bun run typecheck | Fix the type error. |
fast checks: Site release facts | bun run site/scripts/gen-docs.ts --check --skip-corpus | Run bun run site/scripts/gen-docs.ts and commit the files it rewrites, except site/lib/docs.generated.json. |
Secret-shape scan: Scan candidate diff (fail closed) | the scan command above | Take the token-shaped string out of the diff. The scan prints counts, never the value. It reads the unchanged context lines git prints around each change as well as the added lines, so a match on an untouched line beside your edit fails too; replace that string in the same PR. A placeholder passes only in a test path (a test/, tests/, fixtures/, benches/ or examples/ folder, or a .test., .spec. or _test. file) and only if it contains FAKE, EXAMPLE, DUMMY, TEST or XXXX. A private key block never passes. |
A PR can pass on its own and still fail in the merge queue. The queue runs the full fast checks against main plus the PRs queued ahead of it, and GitHub removes a PR whose run fails. Bring the branch up to date (git pull origin main, or git pull upstream main from a fork), fix it, and push. If gh pr view <pr-number> --json autoMergeRequest then shows null, auto-merge is off: arm it again with gh pr merge --auto. For a fork PR, a maintainer or fleet agent re-arms it.
Contribute from a fork with your own agent
No write access? You can still hand the whole job to Claude Code, Codex or another coding agent. Set up the fork once:
Then give your agent a prompt like this:
Read AGENTS.md and the "From branch to main" section of CONTRIBUTING.md, and follow them. Fix (issue link). Keep the diff to one concern, commit, run
bun scripts/premerge-local.ts upstream/mainuntil it reports"status":"pass"(if the diff touches code, install theserver/andintegration/dependencies and raise--budget-msfirst), and run the secret scan ongit diff upstream/main...HEAD. Then push the branch to my fork and open a PR againstashlrai/ashlr-pluginmainusing the PR template.
The steps that differ from a maintainer branch use your fork and its upstream remote:
After that:
CI Gateruns on the PR. For a docs-only change (docs/,site/,video/, top-level Markdown,LICENSEor issue templates), the PR run offast checksskips the install, typecheck and release-facts steps, so it is mostly version sync and the secret scan. The merge queue run always does the fullfast checks. GitHub can hold workflow runs from a first-time contributor until a maintainer approves them.- You cannot arm auto-merge on a fork PR. A maintainer or fleet agent arms it, and the PR lands through the merge queue once
CI Gateis green. - In a fork,
origin/mainis your fork'smain, which stops moving once you fork. CI compares the PR againstashlrai/ashlr-pluginmain, so local checks useupstream/maintoo. - If
mainmoved on, rungit pull upstream mainon your branch and push again.
PR checklist
The PR template asks for most of these too, so people and agents tick the same boxes.
bun scripts/premerge-local.ts origin/main(upstream/mainfrom a fork) reports"status":"pass". It coversbun run typecheckand the tests your diff affects. For a docs-only change, the doc tests in AGENTS.md pass too.- The secret scan is clean:
git diff origin/main...HEAD | perl .github/tests/secret-shape/scrub.pl --check --allow-fixtures(upstream/main...HEADfrom a fork). - If you changed a tool's output: the
RESULTline ofbun run bench -- --repo . --dry-rundoesn't drop by more than 5 points againstmain. bun run smoke:toolsstill reports every default tool. The expected count excludesashlr__pipe, which registers only withASHLR_PIPE_ENABLE=1.- If you added a tool or changed a tool's name, description or input schema: run
bun run references:sync, andbun run references:checkis clean apart from one expected line:site/lib/docs.generated.json is stale. PRs leave that file out, so the check reports it whenever the checkout holds the committed copy, as a fresh clone does. See Adding a new MCP tool. - If you changed skills, commands or hooks: run
bun run doctor:syncand commit the rewritten.claude-plugin/install-manifest.json. - If you touched a manifest:
bun run version:checkpasses. - If behavior changed:
CHANGELOG.mdhas a line under## [Unreleased]. - No new network calls or telemetry without an opt-in.
- If you changed the website (
site/):cd site && bun install && bun run checkpasses. - Hot files left alone: new pipe server cases are in a new
__tests__/pipe-server-<topic>.test.ts, andsite/lib/docs.generated.jsonis not in the commit. - No agent scratch files in the commit: planning notes, investigation logs or evidence patches stay out of the repository, and the PR description carries what reviewers need.
- The PR title is a conventional, imperative subject (it becomes the squashed commit on
main), and the description says why, not just what.
Finding something to work on
New here? Start with the good first issue label; help wanted marks issues we would especially like a PR for. Comment on the issue before you start, keep the PR tied to one issue, and open an issue first if you are unsure something belongs here.
What we're looking for
- Bug fixes with a regression test.
- MCP tool fixes, tests and polish in
servers/(the catalog isservers/_tool-catalog.json). If you change a tool's output, theRESULTline ofbun run bench -- --repo . --dry-runshould not drop by more than 5 points againstmain. If you add a tool or change its name, description or input schema, runbun run references:sync; see Adding a new MCP tool. - Genome retrieval and sync in
servers/_genome-*.ts. The genome, compression and budgeting algorithms themselves live in@ashlr/core-efficiency; open those PRs there. - Agents, slash commands and skills in
agents/,commands/andskills/. Runbun run doctor:syncafter changing skills, commands or hooks; it rewrites.claude-plugin/install-manifest.json. - Documentation, including the pages under
site/content/docs/. Some pages, such as the tool and command references, are generated from repository sources; Edit the docs lists them and what to edit instead. - Cross-platform fixes. Windows CI is the toughest target; flake fixes are always welcome.
- CI fixes and benchmark harness improvements.
What gets rejected
- Changes to the genome, compression or budgeting algorithms themselves. Those live in
@ashlr/core-efficiency; open the PR there. - Telemetry, analytics, or tracking that isn't strictly opt-in. The contract is docs/telemetry.md.
- Tools that depend on closed-source services without a clean local fallback.
- Anything that breaks the privacy commitments, such as telemetry that includes paths, source, or query content.
- Bundled third-party code that requires shipping binaries.