Early Development: This project is in active development (v0.x). APIs and conventions may change between versions. Install with the
devtag.
An opinionated framework for AI-assisted software development. Provides conventions for docs, implementation specs, and coding session workflows that both humans and agents can navigate.
The goal:
Any agent (or person) should be able to open a project that uses Flight Rules and understand:
- What the project is trying to do
- How the implementation is structured
- What has already been done
- What should happen next
- What we've learned along the way
Install the CLI globally:
npm install -g flight-rules@devThen initialize Flight Rules in any project:
cd your-project
flight-rules initOr run directly without installing:
npx flight-rules@dev initThe init command will:
- Create a
.flight-rules/directory with framework files - Optionally create a
docs/directory with project documentation from templates - Optionally generate agent adapters (AGENTS.md for Cursor, CLAUDE.md for Claude Code, etc.)
Flight Rules gives your project a structured documentation system that AI agents (and humans) can navigate consistently.
| Location | Purpose |
|---|---|
.flight-rules/ |
Framework files (replaced on upgrade) |
docs/ |
Your project documentation (new templates added on upgrade, existing files preserved) |
Inside .flight-rules/:
| Directory | Purpose |
|---|---|
AGENTS.md |
Guidelines for AI agents working on your project |
doc-templates/ |
Templates for creating project docs |
commands/ |
Workflow commands (start/end coding session) |
prompts/ |
Reusable prompt templates |
Implementation specs live in docs/implementation/ and follow a three-level hierarchy:
| Level | Name | Example | Description |
|---|---|---|---|
| 1 | Area | 1-foundation-shell/ |
A major implementation area |
| 2 | Task Group | 1.4-application-shell.md |
A file containing related tasks |
| 3 | Task | 1.4.1. Routing Structure |
A specific unit of work with status |
Key principle: The spec is the single source of truth. If code diverges from spec, update the spec.
Flight Rules distinguishes between:
- Ad-hoc requests — "Change function X in file Y"
- Structured sessions — Follow a start/end ritual with documentation
Two core flows:
dev-session.start— Review context, set goals, create a plandev-session.end— Summarize work, update progress, capture learnings
Agents don't start these flows on their own; you explicitly invoke them.
Flight Rules provides workflow commands that agents can execute:
| Command | Purpose |
|---|---|
/dev-session.start |
Begin a structured coding session with goals and plan |
/dev-session.end |
End session, summarize work, update progress |
/prd.create |
Create a Product Requirements Document |
/prd.clarify |
Refine specific sections of an existing PRD |
/impl.outline |
Create implementation area structure |
/impl.create |
Add detailed tasks to implementation specs |
/feature.add |
Add a new feature to PRD and implementation docs |
/test.add |
Add tests for specific functionality |
/test.assess-current |
Analyze existing test coverage |
/prompt.refine |
Iteratively improve a prompt |
/readme.create |
Generate README from PRD and project state |
/readme.reconcile |
Update README to reflect recent changes |
/prd.reconcile |
Update PRD based on what was actually built |
/impl.reconcile |
Update implementation docs with status changes |
/docs.reconcile |
Run all reconcile commands + consistency check |
Each project tracks which Flight Rules version it uses:
flight_rules_version: 0.1.2
This appears in .flight-rules/AGENTS.md and helps coordinate upgrades.
When you run flight-rules init, you get:
your-project/
├── AGENTS.md # (Optional) Adapter for Cursor - points to .flight-rules/
├── docs/ # YOUR content (new templates added on upgrade)
│ ├── prd.md
│ ├── progress.md
│ ├── critical-learnings.md
│ ├── tech-stack.md
│ ├── implementation/
│ │ └── overview.md
│ └── session_logs/
└── .flight-rules/ # Framework files (can be replaced on upgrade)
├── AGENTS.md # Agent guidelines
├── doc-templates/ # Templates for creating your docs
│ ├── prd.md
│ ├── progress.md
│ ├── critical-learnings.md
│ ├── tech-stack.md
│ ├── session-log.md
│ └── implementation/
│ └── overview.md
├── commands/ # Workflow commands
│ ├── dev-session.start.md
│ ├── dev-session.end.md
│ ├── prd.create.md
│ ├── prd.clarify.md
│ ├── impl.outline.md
│ ├── impl.create.md
│ ├── feature.add.md
│ ├── test.add.md
│ ├── test.assess-current.md
│ ├── prompt.refine.md
│ ├── readme.create.md
│ ├── readme.reconcile.md
│ ├── prd.reconcile.md
│ ├── impl.reconcile.md
│ └── docs.reconcile.md
└── prompts/ # Reusable prompt templates
- Agents should read
.flight-rules/AGENTS.md - Skim
docs/prd.mdanddocs/implementation/overview.md - Check
docs/progress.mdfor recent work
- "start coding session" — Sets goals, creates a plan
- "end coding session" — Summarizes work, updates docs
- Identify relevant Area, Task Group, and Task
- Update Tasks when reality diverges from plan
- Keep
Status:fields current
| Command | Description |
|---|---|
flight-rules init |
Install Flight Rules into a project (interactive setup wizard) |
flight-rules upgrade |
Upgrade Flight Rules in an existing project (preserves your docs) |
flight-rules adapter |
Generate agent-specific adapters (--cursor, --claude) |
flight-rules update |
Update the Flight Rules CLI itself (--channel to switch dev/latest) |
flight-rules ralph |
Run autonomous agent loop through task groups |
Flight Rules includes support for "Ralph Loops" — autonomous AI agent loops that work through your implementation specs unattended.
Ralph spawns fresh Claude Code instances in a loop. Each iteration:
- Reads your implementation specs
- Finds the next incomplete task group
- Implements all tasks in that group
- Runs quality checks (reads
package.jsonto discover available scripts) - Commits the work
- Exits (triggering the next fresh iteration with a clean context)
The loop terminates when all task groups are complete or max iterations is reached.
Memory persists between iterations via:
- Git history (commits from previous iterations)
docs/progress.md(work log)docs/ralph_logs/(verbose session logs)docs/critical-learnings.md(patterns and gotchas)- The implementation spec files themselves (status updates)
# Start the loop (default 10 iterations)
flight-rules ralph
# Run with more iterations
flight-rules ralph --max-iterations 20
flight-rules ralph -n 20
# Focus on a specific implementation area
flight-rules ralph --area 2
flight-rules ralph --area 2-cli-core
# Create a new branch before starting (recommended)
flight-rules ralph --branch # Auto-generates: ralph/YYYYMMDD-HHMM
flight-rules ralph --branch feature/my-work # Custom branch name
# Combine options for a typical workflow
flight-rules ralph --area 2 --branch -n 20
# See what would run without executing
flight-rules ralph --dry-run
# See full Claude output during execution
flight-rules ralph --verbose- Claude Code CLI installed:
npm install -g @anthropic-ai/claude-code - Authenticated with Claude Code: run
claudeand follow prompts - Implementation specs with task groups to work through
- Use
--branch: Always create a new branch before starting a Ralph loop for easy rollback and PR workflow - Target specific areas: Use
--areato focus Ralph on one implementation area at a time - Small task groups: Each task group should be completable within one context window
- Clear acceptance criteria: Ralph works best with specific, verifiable criteria
- Quality checks configured: Ensure
npm test,npm run lint, etc. are set up inpackage.json - Review the work: Ralph commits frequently — review with
git logand create a PR for code review - Container usage: For maximum safety, run in a Docker container without network access
Ralph uses --dangerously-skip-permissions to run Claude autonomously. This flag bypasses all permission prompts. Use with caution and preferably in isolated environments.
Upgrade Flight Rules while preserving your content:
flight-rules upgradeWhat gets replaced:
- The
.flight-rules/directory (framework files)
What gets added (without overwriting):
- New templates are added to
docs/if they don't already exist - Your existing doc files are never modified
If you prefer not to use the CLI:
-
Clone this repo:
git clone https://github.com/ryanpacker/flight-rules.git ~/flight-rules -
Copy the payload into your project:
cp -R ~/flight-rules/payload /path/to/your/project/.flight-rules -
Create a
docs/directory and copy templates from.flight-rules/doc-templates/to customize them.
- Skills/MCP integration — Conventions for documenting tools and workflows
- Hosted planning systems — Potential integration with Linear, etc.
- v1.0 stability — Stabilizing APIs and conventions for a production-ready release
Current focus:
- A solid, Markdown-based structure
- Clear expectations for agents
- CLI tooling for easy installation and upgrades
This repo is an npm package with the following structure:
| Path | Purpose |
|---|---|
src/ |
CLI source code (TypeScript) |
dist/ |
Compiled CLI (committed for GitHub installs) |
payload/ |
The content delivered to projects as .flight-rules/ |
scripts/ |
Build and release utilities |
git clone https://github.com/ryanpacker/flight-rules.git
cd flight-rules
npm install
npm run buildThe project uses Vitest for testing with ~93% code coverage.
npm test # Run tests once
npm run test:watch # Watch mode for development
npm run test:coverage # Generate coverage reportTests are located in tests/ and mirror the src/ structure:
| Test File | Coverage |
|---|---|
tests/utils/files.test.ts |
100% |
tests/commands/init.test.ts |
98.5% |
tests/commands/upgrade.test.ts |
100% |
tests/commands/adapter.test.ts |
79% |
npm version patch # or minor/major
git push && git push --tags
npm publish --tag devThis automatically builds, syncs the version to payload/AGENTS.md, creates a tagged commit, and publishes to npm.
Note: Until v1.0, all releases use the
devtag. Users install withnpm install -g flight-rules@dev.