A local-first workflow rail and portable project brain for AI-assisted development.
Project description
AI Rail
Never explain your project twice to AI.
AI Rail is a local-first CLI that keeps AI-assisted development focused, repeatable, and safe.
It gives every Git repo a portable project brain, a simple daily workflow, and scoped prompts for tools like ChatGPT, Codex, Claude, Cursor, and Aider - so you can move between AI tools without re-explaining the codebase, losing context, or letting the coding agent drift into unrelated files.
rail n -> start the next scoped task
rail v -> review, run local checks, and create an audit prompt
rail s -> safely commit, push, close, and sync
rail h -> continue in a new AI chat with full project context
AI Rail keeps the coding agent on the active issue, keeps an AI reviewer (ChatGPT, Claude, or any LLM) in the audit loop, and lets your own machine run the tests - saving tokens, reducing over-coding, and making AI development feel controlled instead of chaotic.
Prerequisites
- Python 3.10+ and pipx
- Git with a configured remote
- GitHub CLI (
gh) installed and authenticated (gh auth login)
AI Rail uses Git for repository state and delegates GitHub Issue operations to gh. Run gh auth login before using AI Rail on a new machine.
Who This Is For
AI Rail is for developers who:
- use more than one AI coding tool on the same repo
- want GitHub Issues to be the task source of truth
- want repeatable prompts, review packs, checks, and handoffs
- prefer local-first tooling over hosted workflow state
- work solo or in small repos where conservative commit safety matters
What AI Rail Is Not
AI Rail is not:
- an AI model, agent runtime, or hosted service
- a replacement for Git, GitHub Issues, or your test suite
- a project management system for large teams
- a tool that sends code to a remote service by itself
- a way to bypass review, checks, or secret-file safety
Install
AI Rail is currently alpha software.
Recommended public install:
pipx install ai-rail
rail --version
rail demo
If pipx is not installed yet:
python -m pip install --user pipx
python -m pipx ensurepath
Restart your terminal, then run:
pipx install ai-rail
Latest source from GitHub:
pipx install git+https://github.com/afshinsb/ai-rail.git
rail --version
Contributor install from this source checkout:
git clone https://github.com/afshinsb/ai-rail.git
cd ai-rail
python -m pip install -e ".[dev]"
rail --version
Quick Demo
Print the built-in walkthrough:
rail demo
Try the bundled demo app:
cd examples/demo-todo
rail init --stack node --project-name "AI Rail Demo TODO"
rail doctor
npm run check
# requires: gh auth login
gh issue create --title "Add todo body validation" --body-file issues/001-add-body-validation.md
rail next --copy
Full Workflow
For a new repo with no scoped issues yet:
rail plan --copy
# paste into a GitHub-connected AI agent
The AI creates or updates one GitHub roadmap issue as the remote roadmap mirror and creates only the first active execution slice as GitHub Issues.
rail import
# import the roadmap issue into local .rail/PROJECT.md
.rail/PROJECT.md is the full local project memory and roadmap brain. GitHub Issues are the active task execution queue, not the entire long-term roadmap.
Then work one issue at a time:
rail n
# paste into coding agent
rail v
# paste into AI reviewer
rail s "type(scope): message"
After several shipped issues, audit and update the phase:
rail phase --copy
# paste into a GitHub-connected AI reviewer/agent
The phase audit updates project memory, checks completed work against the roadmap, and adjusts upcoming phases when needed.
rail import
# refresh local .rail/PROJECT.md from the updated roadmap issue
Then continue:
rail n
60-Second Quickstart
Inside any Git repo:
rail init --stack node --project-name "My Project"
rail doctor
rail resume
Daily loop:
rail next --copy
# paste/run the generated prompt in your AI coding tool
rail verify --copy
# paste the generated review prompt into any AI reviewer for audit
rail ship "type(scope): message"
Short alias loop:
rail n
# paste/run the generated prompt in your AI coding tool
rail v
# paste the generated review prompt into any AI reviewer for audit
rail s "type(scope): message"
rail verify runs checks and saves a verified snapshot of the reviewed diff. rail ship trusts that snapshot when the working tree still matches it, so the normal ship path does not rerun checks. Use rail ship --recheck "type(scope): message" when you intentionally want checks rerun during ship.
When switching AI tools or opening a new chat:
rail snapshot
rail handoff --for chatgpt --include-review --include-checks --copy
To update tool-specific AI instruction files from the same project brain:
rail export
Core Commands
| Command | Purpose |
|---|---|
rail init |
Add AI Rail files to a repo |
rail resume |
Show where you stopped |
rail plan |
Generate a GitHub-connected AI prompt to create a phased issue roadmap |
rail import |
Import the GitHub roadmap issue into local .rail/PROJECT.md |
rail phase |
Generate a GitHub-connected AI prompt to audit/update the current roadmap phase |
rail next |
Start the next issue and generate the first prompt |
rail handoff |
Generate portable context for another AI session/model |
rail verify |
Capture review info, run checks, and generate an audit prompt |
rail ship |
Commit, push, close the issue, mark done, and sync |
rail snapshot |
Refresh .rail/brain/ project-brain files |
rail export |
Generate AGENTS.md, CLAUDE.md, Cursor rules, AIDER.md, and Copilot instructions |
rail demo |
Print the public demo script |
rail release-check |
Check packaging/docs readiness |
Common aliases are thin wrappers over the long commands: rail r for resume, rail n for next --copy, rail p for plan --copy, rail ph for phase --copy, rail im for import, rail v for verify --copy, rail s for ship, rail snap for snapshot, rail h/hc/hg/hl for handoffs, rail x/xd/xf for exports, and rail rc for release-check.
Detailed commands such as rail start, rail prompt, rail review, rail checks, rail commit, rail issue-close, rail done, and rail sync remain available for manual control.
For Node repos, rail init --stack node inspects package.json scripts and chooses the first available check command from check, typecheck, lint, test, then build. You can override checks manually:
rail checks --run "npm run typecheck"
rail checks --run "npm run typecheck" --run "npm run lint"
Portable Project Brain
.rail/PROJECT.md is the full local project memory, roadmap brain, phase tracker, and next-task direction file. The GitHub roadmap issue is the remote roadmap mirror. GitHub implementation issues are only the active execution queue.
.rail/PROJECT.md may contain human-readable context, but roadmap task state lives in exactly one AI RAIL ROADMAP START/END block. Rail only updates task status inside that strict block. Task lines use - [ ] ISSUE | TASK_ID | TITLE, where ISSUE is #123 for active GitHub issues or TBD for future tasks. The phase AI creates the next issue slice and replaces TBD with issue numbers during rail phase --copy / rail import.
rail snapshot writes:
.rail/brain/PROJECT.md
.rail/brain/CURRENT_TASK.md
.rail/brain/STATUS.md
.rail/brain/RECENT_HISTORY.md
.rail/brain/HANDOFF.md
rail handoff --for codex|chatgpt|claude|cursor|aider --copy turns that brain into a paste-ready handoff so a new AI session can continue from the current project state.
Tool-Specific Exports
rail export turns the single AI Rail project brain into files that different AI coding tools already know how to read:
AGENTS.md
CLAUDE.md
AIDER.md
.cursor/rules/ai-rail.mdc
.github/copilot-instructions.md
Exports are safe by default. AI Rail updates its own managed block when markers are present, but refuses to overwrite existing human files unless you pass --force, which first writes a .rail.bak backup.
Safety Defaults
rail ship refuses unsafe commits by default when:
- there is no passing verified snapshot from
rail verify - files changed after the last verified snapshot
- configured checks changed after the last verified snapshot
- dangerous/generated files such as
.env, keys, local databases,node_modules/,dist/, or.rail/state/are changed
Escape hatches exist for advanced users, but the normal path is intentionally conservative.
Local-First Privacy
AI Rail does not send your code anywhere by itself. It shells out to git, gh, and your configured local checks.
Security:
rail verifyruns the check commands configured in.rail/config.jsonusing the system shell. Always review.rail/config.jsonin repositories you did not author before runningrail verifyorrail checks.
By default, .rail/state/history.jsonl is ignored by git to avoid committing personal workflow history into team repos.
License: Apache License 2.0.
Author
- Afshin Saberi
- GitHub: https://github.com/afshinsb
- Website: https://theafshin.com
Docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_rail-0.1.0a14.tar.gz.
File metadata
- Download URL: ai_rail-0.1.0a14.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
740d8f04f62f47ef6ab97689e73319ef531c430ef57b35be068a646b3538bddf
|
|
| MD5 |
990d8e984c48cf43a204ae48c31d6cbf
|
|
| BLAKE2b-256 |
446ce56f5f7638a1c0ea62bc2d8d2c87aad4cc56c72c77ddb749f02deeca2223
|
Provenance
The following attestation bundles were made for ai_rail-0.1.0a14.tar.gz:
Publisher:
publish.yml on afshinsb/ai-rail
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_rail-0.1.0a14.tar.gz -
Subject digest:
740d8f04f62f47ef6ab97689e73319ef531c430ef57b35be068a646b3538bddf - Sigstore transparency entry: 1810798716
- Sigstore integration time:
-
Permalink:
afshinsb/ai-rail@63f8c0c97b4d4976b79d28468030b14fadb08a93 -
Branch / Tag:
refs/tags/v0.1.0a14 - Owner: https://github.com/afshinsb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63f8c0c97b4d4976b79d28468030b14fadb08a93 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_rail-0.1.0a14-py3-none-any.whl.
File metadata
- Download URL: ai_rail-0.1.0a14-py3-none-any.whl
- Upload date:
- Size: 65.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aacc54ee0618f3211d90ecffe056d20823ea1c2d20297578b3914e598020b05c
|
|
| MD5 |
a82ef619433854a5f2ad35ccca2fa3a7
|
|
| BLAKE2b-256 |
3d34d45f9690308074369728bed68df656ca8b6f0791078da656833b6a578f41
|
Provenance
The following attestation bundles were made for ai_rail-0.1.0a14-py3-none-any.whl:
Publisher:
publish.yml on afshinsb/ai-rail
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_rail-0.1.0a14-py3-none-any.whl -
Subject digest:
aacc54ee0618f3211d90ecffe056d20823ea1c2d20297578b3914e598020b05c - Sigstore transparency entry: 1810798757
- Sigstore integration time:
-
Permalink:
afshinsb/ai-rail@63f8c0c97b4d4976b79d28468030b14fadb08a93 -
Branch / Tag:
refs/tags/v0.1.0a14 - Owner: https://github.com/afshinsb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63f8c0c97b4d4976b79d28468030b14fadb08a93 -
Trigger Event:
push
-
Statement type: