01 · Onboard
One command reads the repository, works out its stack, and installs the rules, the review commands and a merge gate. You review what it wrote, then open a pull request so the team reviews the change like any other.
You will learn
- What redline init installs, and where each piece acts
- What a merge gate and a rung are
- Why every repository starts at observe, where findings are reported but nothing is blocked
Why
Step 00 ended with two gaps. Nothing checks how the code is written, only that it compiles and the tests pass. And nothing tells a coding assistant what this team expects, so it guesses. init closes both: it writes the rules where every assistant reads them, and adds a gate that checks every pull request against the same rules, whoever or whatever wrote the code.
New term Merge gate
One check on every pull request, redline-gate / gate, that combines five jobs into one pass or fail: the rule checker, the pull request checklist, the decision-record check, dependency review and a secret scan. You meet each job in the next steps. For now the gate is advice: a red gate shows on the pull request, but GitHub still lets you merge. Step 07 makes it required.
Run it
From the root of your repository, on an up-to-date main, with the package manager you picked in step 00:
$ pnpm dlx redlinegate@latest init
$ npx redlinegate@latest init
$ yarn dlx redlinegate@latest init
$ bunx redlinegate@latest init
Each runs Redline once without installing it; init then adds it to your project. If it asks to download redlinegate first, answer y. Then init asks a few questions about the repository. Space ticks a box, Enter moves on. Keep the default everywhere except the three in bold:
| It asks | Answer |
|---|---|
| Which standards apply here? | Tick javascript-typescript (JavaScript, TypeScript). Nothing is ticked for you: which rules a repository is held to is your decision. |
| Where does this repository live? | GitHub |
| What runs your pull request checks? | GitHub Actions |
| Which assistants should read the standards? | The ones already ticked |
| Extra context to render beside the rules | Spec-driven development, already ticked |
| What should Redline set up alongside its own checks? | Nothing. GitHub's own secret scanning and dependency alerts don't need a box: Redline switches them on when it applies repository settings, in step 07. |
| What should Redline install? | gate, merge-policy and labels, already ticked |
| Where should the merge gate live? | in this repository. See below for why. |
| How hard should the check bite? | observe: findings are reported, and only the dependency and secret checks can fail the gate. The end of this page explains why. |
| Add Redline to this project's devDependencies? | yes, pin it, already selected. Your package manager adds redlinegate at this exact version, so you, your team and your assistant all run the same Redline. |
| Ready? | Write the files, commit nothing. You read what it wrote before anything reaches GitHub; the commit and the pull request come after. |
New term Where the merge gate lives
The merge gate is a GitHub Actions workflow, and init can put it in one of two places:
- in the organisation, the default. The gate lives once, in the organisation's
.githubrepository, and every repository calls it from there. A pull request cannot edit the gate that judges it, and fixing the gate fixes it everywhere. It needs the organisation to publish a gate first, which is what a real team should do. - in this repository. The gate is copied into the repository itself, so it works with no organisation set up: right for a personal account, and for this path. It is weaker: the gate runs from the pull request's own commit, so a pull request can edit the gate judging it, even to switch off the secret and dependency checks.
initsays so on every run.
Choosing the organisation when it publishes no gate is not a dead end: init notices, and asks again whether to skip the gate for now or copy it in.
Once you answer the last question, it writes the files and stops:
# after Ready? profile javascript-typescript opted out: review-ownership ▲ the gate is vendored at .github/workflows/redline-gate.yml rather than referenced from <you>/.github. It runs from the pull request's own head commit, so a pull request that edits it changes the gate judging it … ▲ nothing requires review on .github/workflows/ here, so that edit needs no owner's approval … ▲ this repository already has .github/workflows/ci.yml — if one of them is already your merge gate, re-run with --skip gate … ▲ redlinegate@… is a devDependency now (pnpm add …) Files … written + package.json + AGENTS.md + CLAUDE.md + .github/copilot-instructions.md + .github/instructions/redline-javascript.instructions.md + .github/instructions/redline-typescript.instructions.md + .cursor/rules/redline-core.mdc + .cursor/rules/redline-javascript.mdc + .cursor/rules/redline-typescript.mdc + .claude/commands/redline-review.md + .github/prompts/redline-review.prompt.md + .cursor/commands/redline-review.md … + .github/workflows/redline.yml + .github/workflows/redline-gate.yml + .github/pull_request_template.md + .redline.json not committed — the files are in your working tree, and you are on main …
The ▲ lines are warnings, not errors, and none needs action on this path:
- The gate is vendored, meaning copied into this repository. That is the answer you chose; Where the merge gate lives above explains the cost.
- Nothing requires review on
.github/workflows/: no owner has to approve a change to the gate. A team names one with--with review-ownership --review-owners <team>. Alone on a personal account, there is nobody else to name. - The repository already has
ci.yml: Redline checks it is not about to add a second gate. Yours only runs the tests, so keep the Redline gate.
Nothing has reached GitHub yet: no commit, no pull request, no repository setting. Running it from a script, with no questions? Add --gate-source local --pin-cli --no-commit to the same command for the same result.
Redline is in your package.json now, so from here on every command runs your project's own copy: pnpm redline <command>, or npx redlinegate, yarn redline or bun run redline.
What it wrote
Every file is in your working tree, so git status lists them and your editor opens them. They catch mistakes at three different moments: while the assistant writes the code, when you ask for a review, and when the pull request asks to merge. Take a tab at a time, and open each file beside it.
The same rules, written once per assistant in the form that assistant reads on every request. They act while the code is written.
| File | Read by |
|---|---|
AGENTS.md | Codex and every assistant that reads AGENTS.md. The core rules and the JavaScript and TypeScript rules, in one file. |
CLAUDE.md | Claude Code. It imports AGENTS.md with @AGENTS.md, so the rules exist once. |
.github/copilot-instructions.md | GitHub Copilot, on every request: the core rules. |
.github/instructions/redline-*.instructions.md | GitHub Copilot, by file type: its applyTo line loads the TypeScript rules only for .ts and .tsx files. |
.cursor/rules/redline-*.mdc | Cursor: redline-core.mdc always, the others by their globs line. |
Open AGENTS.md and read a few rules. Each has an id in backticks, like core/hardcoded-secrets, and a severity: BLOCKER, HIGH or SUGGESTION. Because you kept spec-driven development ticked, each file also carries a short section on working spec-first.
Redline's part of each file sits between REDLINE:BEGIN and REDLINE:END markers, and the next init rewrites it. Rules of your own go in .redline/local.md, which init renders into every one of these files.
Three commands, written once per assistant. They act when you ask.
| Assistant | Files |
|---|---|
| Claude Code | .claude/commands/redline-*.md |
| GitHub Copilot | .github/prompts/redline-*.prompt.md |
| Cursor | .cursor/commands/redline-*.md |
/redline-reviewreviews your current change against the rules and lists what breaks them, each with its rule id. Step 02 uses it./redline-verifychecks that the repository still matches the standards and guardrails it claims./redline-inithas the assistant run onboarding for you, the way you just did by hand.
.redline.json records a hash of each command file, so a later init can tell a file you edited from one it may safely replace.
.github/workflows/redline.yml is the small file that decides when the gate runs and with which settings. It has no checks of its own:
- When: on every pull request event that can change the verdict: opened, new commits, reopened, description edited, a label added or removed, and marked ready for review. A newer run cancels the older one on the same pull request.
- What it calls: one job,
redline-gate, which runs./.github/workflows/redline-gate.yml. Keep that job id: the check GitHub shows is named after it. - The settings it passes:
rung: observe,adr-diff-threshold: 300,fail-on-dependency-severity: high,soft-fail-labels: redline-exempt,redline-syncand an emptystand-down. Theredline-gate.ymltab explains each.
The file says Managed by Redline at the top. Change a setting with init rather than by hand: the next run rewrites the file.
.github/workflows/redline-gate.yml is the merge gate itself: a GitHub Actions workflow that runs five checks on every pull request and turns them into one verdict. It acts before the merge, on every change, whoever or whatever wrote it.
The five checks
| Job | What it checks | Fails the gate at observe? |
|---|---|---|
| PR checklist | Every box under ## Launch readiness in the pull request description is ticked. | No, reported only |
| ADR required for significant changes | A change over 300 lines links a decision record in docs/adr/, or carries the no-adr label. | No, reported only |
| Deterministic policy | The rules a program can decide without a model, on the diff only. It installs Redline into a temporary folder on the runner, never into your checkout, and runs redline policy. | No, reported only |
| Dependency review | No dependency the pull request adds has a known vulnerability of high severity or worse. | Yes, at every rung |
| Secret scan (diff) | TruffleHog scans the commits in the pull request for secrets it can verify are live. | Yes, at every rung |
The verdict
A sixth job, gate, reads the five results and writes a summary on the workflow run. GitHub shows it on the pull request as redline-gate / gate: the caller's job id, then this one.
- A failed dependency review or secret scan fails the gate, always. No label and no rung waives them. These two are the security floor.
- The other three are process checks. At
observea failure is a warning and the gate stays green. Atblock-blockerorblock-highit fails the gate, unless the pull request carries a soft-fail label and a## Redline exemptionblock with a reason and an end date.
The settings it accepts
redline.yml passes these in. Each has a default, so the gate runs without them:
rung: how hard the process checks bite. Explained below.adr-diff-threshold: the changed lines above which a decision record is required.fail-on-dependency-severity: the lowest vulnerability severity that fails dependency review.soft-fail-labels: the labels that can turn a failing process check into a warning, with an exemption block.stand-down: jobs another tool in the repository already does, skipped and counted as passed.initfills it only from tools you named, never from a guess.
A copy in your repository
Because you answered in this repository, this file is a copy of Redline's gate. Its header names the Redline version that wrote it, and that version is the one the gate installs on the runner, so the gate changes only when you re-run init. redline verify compares the two and tells you when the copy falls behind.
The cost, which the header and init both state: the gate runs from the pull request's own commit, so a pull request that edits this file changes the gate judging it. Read every change to it in review. A team hosts the gate in its organisation's .github repository instead, where a pull request here cannot touch it.
Don't edit the file by hand: init --repair rewrites it.
.github/pull_request_template.md is what GitHub puts in the description of every new pull request. Two of its sections are read by the gate:
- Summary and Change type: for the reviewer. Not checked.
## Launch readiness: seven boxes, from "no secrets, keys, or customer data" to "no unrelated changes". The PR checklist job fails while any is unticked, or if the heading is missing. A box that does not apply is deleted, with the reason in the summary.- Architecture decision: where the link to a decision record goes. Step 05 covers it.
## Redline exemption: a reason, an end date at most 90 days out, and which checks it covers. Only for merging past a failing process check, and never for the security floor.
A repository that already has a template keeps it: Redline adds its sections inside its own markers.
redlinegate is in devDependencies at the exact version that ran, and your lockfile records it. You, your team and your assistant run the same Redline, and moving to a newer one is a pull request like any other dependency. The gate does not use this copy: it installs its own on the runner.
The record of this onboarding. A later init reads it, so re-running keeps your choices instead of resetting them. Its first lines explain every field; the ones worth reading now:
profile,vendors: the standards and the assistants you chose.rung:observe.gateSourceandgateVersion:local, and the version that wrote the gate.capabilities: what Redline installs and reports. Afalsehere means the repository has its own.pendingAdmin: settings an administrator still has to grant. Empty on a repository you own.requiredApprovals:0. The branch ruleset Redline applies in step 07 asks for no approving review, so one person can follow this path alone.
Edit it with init, not by hand. It is reviewed in the pull request like any other file.
Commit it and open the pull request
Once you have read the files, take them to a pull request the way you would any change.
1. Commit on a branch
$ git checkout -b redline/standards $ git add -A $ git commit -m "chore: onboard to Redline"
git add -A is safe here because the repository was clean before init. On a repository with work in progress, add only the files init listed.
2. Open the pull request
$ git push -u origin redline/standards $ gh label create no-adr --description "Large change with no architecture decision" $ gh pr create --title "chore: onboard to Redline" --body-file .github/pull_request_template.md --label no-adr $ gh pr comment --body "Generated by redline init: rules, review commands and gate. No design decision."
- The description is the pull request template
initjust wrote. GitHub only fills a new pull request from the template once it is onmain, and this pull request is the one that puts it there, so it is passed in by hand. - The
no-adrlabel. A change over 300 lines must link an architecture decision record, so a large change carries the reasoning behind it. This one is about 2,000 lines but decides nothing: it is generated. The label says so, and the comment says why, so the next reader does not have to guess. The label is new to the repository, so it is created first. Step 05 covers the decision records themselves.
3. Watch the checks
The gate starts the moment the pull request opens. Follow it from the terminal, or open the pull request in the browser:
$ gh pr checks --watch $ gh pr view --web
It goes red
Your first pull request under Redline has a red check. That is expected, and it teaches the first thing about the gate:
$ gh pr checks X redline-gate / PR checklist ✓ redline-gate / ADR required for significant changes ✓ redline-gate / Deterministic policy ✓ redline-gate / Dependency review ✓ redline-gate / Secret scan (diff) ✓ redline-gate / gate passes, with a warning
The ADR check passes on the label. The checklist failed, and the gate still passed. The checklist is a process check: at observe it is reported, and the gate stays green. Open it and the reason is one line:
# PR checklist - [ ] No secrets, keys, or customer data in code, logs, or fixtures … Error: 7 unchecked launch-readiness item(s). Tick each one, or delete the line and say why in the PR description.
The section is in the description, but nobody has vouched for it. That is the point of the check: a person, not the template, says each item is true. Open the pull request on GitHub and read the seven boxes under ## Launch readiness. Tick each one that is true of this change; boxes in a description can be ticked without editing it. If one does not apply, delete the line and say why in the summary. Each change to the description runs the job again, and it goes green.
Private repository Dependency review and the gate are red too
On a private repository, two more checks fail:
$ gh pr checks X redline-gate / PR checklist X redline-gate / Dependency review X redline-gate / gate ✓ redline-gate / ADR required for significant changes ✓ redline-gate / Deterministic policy ✓ redline-gate / Secret scan (diff)
Open Dependency review and the reason is one line:
# Dependency review Error: Dependency review is not supported on this repository. Please ensure that Dependency graph is enabled along with GitHub Advanced Security
Dependency review is part of the security floor: the checks that fail the gate at every rung, observe included, so this one turns the gate red where the checklist did not. Step 06 is about the floor. On a public repository GitHub gives all of it away. On a private one, two pieces are part of GitHub Advanced Security, which an organisation buys on a Team or Enterprise plan, per active committer:
- GitHub Code Security runs dependency review: a pull request that adds a package with a known
highorcriticalvulnerability is stopped before it reachesmain. - GitHub Secret Protection runs secret scanning and push protection: a key pushed to GitHub is refused at the push, before it lands in history and has to be rotated.
That is what a breach costs to prevent. A vulnerable package or a leaked token caught here costs a commit; the same one found in production costs an incident, a rotation and an explanation. Redline does not skip the job quietly when the licence is missing: a floor that switches itself off is not a floor. Answer it one of two ways.
Switch Advanced Security on. The right fix for a team's real repositories. An organisation owner makes GitHub Code Security and GitHub Secret Protection available to the repository; until then the options are greyed out. Then, in Settings → Advanced Security, enable Code Security, Secret Protection and Push protection, and on the pull request's Checks tab choose Re-run failed jobs. On a personal account there is no Code Security to switch on; making the repository public is the equivalent.
Hand it to Dependabot. When Advanced Security is not available. Dependabot is free on private repositories. On your branch:
$ pnpm redline init --setup dependabot --integrations dependabot --no-commit
$ npx redlinegate init --setup dependabot --integrations dependabot --no-commit
$ yarn redline init --setup dependabot --integrations dependabot --no-commit
$ bun run redline init --setup dependabot --integrations dependabot --no-commit
# after init ▲ this repository already runs Dependabot (you said so …), so the gate's dependencies job is stood down here rather than run a second time … Files 3 written + .github/workflows/redline.yml + .github/dependabot.yml + .redline.json
.github/dependabot.yml switches on Dependabot's version updates, and redline.yml now passes stand-down: 'dependencies', so the gate skips the job and counts it as passed. Read the three files, then push them:
$ git add -A $ git commit -m "chore: hand dependency checks to Dependabot" $ git push
Be clear about what that trades away:
- A vulnerable dependency is no longer blocked in the pull request. It merges, then Dependabot raises an alert and opens a pull request to update it. Step 06 shows the difference on a real change.
- Secret scanning and push protection stay off. The gate's own secret scan still runs on every pull request.
In Settings → Advanced Security, switch on Dependabot alerts, Dependabot security updates, the one that opens the fix pull request, and Malware alerts. Having the dependency graph and Dependabot alerts on is not Code Security: the gate's dependency review still cannot run. When the repository gets Code Security, or goes public, put the job back with pnpm redline init --integrations "" --no-commit.
Redline can do this part for you. At init's last question, Write, commit and open a pull request commits on redline/onboard, opens the pull request with the template filled in, the checklist ticked and the no-adr label applied, and switches on the GitHub settings: a branch ruleset on main, secret scanning, push protection and Dependabot alerts. You did it by hand once, so you know what it does when it does it for you. Step 07 runs it to make the gate required.
Merge it
With the checks green, review the diff on GitHub, merge it, and bring the merged files back to your machine:
$ gh pr merge --squash $ git checkout main $ git pull
Every later step starts from this main, so the rules and review commands are in place before you write any code.
Every repository starts at observe
New term Rung
How strict the gate is. The enforcement ladder has three rungs: observe, block-blocker and block-high. At observe a broken rule is reported, and the gate stays green. Moving up needs evidence that the rules are right, which step 09 covers.
The one exception is the security floor (step 06): a vulnerable dependency or a leaked secret fails the gate at every rung, observe included.
Starting at observe means the team sees what Redline would block before anything is blocked. Nobody's afternoon is ruined by a rule the team has never discussed. Ask the repository where it stands:
$ pnpm redline status profile javascript-typescript (javascript, typescript) host github checks GitHub Actions rung observe — findings are reported, only the security floor fails the check …
$ npx redlinegate status profile javascript-typescript (javascript, typescript) host github checks GitHub Actions rung observe — findings are reported, only the security floor fails the check …
$ yarn redline status profile javascript-typescript (javascript, typescript) host github checks GitHub Actions rung observe — findings are reported, only the security floor fails the check …
$ bun run redline status profile javascript-typescript (javascript, typescript) host github checks GitHub Actions rung observe — findings are reported, only the security floor fails the check …
Check your understanding
Onboarding put the rules in AGENTS.md and also installed a merge gate. Why both?