onboard
Purpose
Auto-generate project context for AI sessions. Scans the codebase and creates a CLAUDE.md project config plus .rune/ state directory so every future session starts with full context. In multi-runtime repos it also sets up each runtime's instructions file and Rune hooks (Step 4.5). Saves 10-20 minutes of re-explaining per session on undocumented projects.
Triggers
/rune onboard— manual invocation on any project/rune onboard --runtimes— only Step 4.5: per-runtime agent config + hooks (AGENTS.md, GEMINI.md,.codex/,.grok/,.cursor/, …)- Called by
rescueas Phase 0 (understand before refactoring) - Auto-trigger: when no CLAUDE.md exists in project root
Calls (outbound)
scout(L2): deep codebase scan — structure, frameworks, patterns, dependenciessentinel-env(L3): validate developer environment (runtime versions, required tools, env vars) so the onboarded project is actually runnableautopsy(L2): when project appears messy or undocumented — health assessment
Called By (inbound)
- User:
/rune onboardmanual invocation rescue(L1): Phase 0 — understand legacy project before refactoringcook(L1): if no CLAUDE.md found, onboard first
Output Files
project/
├── CLAUDE.md # Project config for AI sessions (with invariants pointer block)
└── .rune/
├── conventions.md # Detected patterns & style
├── decisions.md # Empty, ready for session-bridge
├── progress.md # Empty, ready for session-bridge
├── session-log.md # Empty, ready for session-bridge
├── instincts.md # Empty, ready for session-bridge instinct learning
├── contract.md # Project invariants enforced by cook/sentinel
├── INVARIANTS.md # Danger zones + cross-file rules, consumed by logic-guardian
└── DEVELOPER-GUIDE.md # Human-readable onboarding for new developers
Executable Steps
Step 1 — Full Scan
Invoke rune:scout on the project root. Collect:
- Top-level directory structure (depth 2)
- All config files:
package.json,pyproject.toml,Cargo.toml,go.mod,composer.json,.nvmrc,.python-version,Pipfile.lock,poetry.lock,uv.lock - Python environment markers:
.venv/,venv/,conda-meta/,.python-version - Entry point files:
main.*,index.*,app.*,server.* - Test directory names and test file patterns
- CI/CD config files:
.github/workflows/,Makefile,Dockerfile - README.md if present
Do not read every source file — scout gives the skeleton. Use Read only on config files and entry points.
Step 2 — Detect Tech Stack
From the scan output, determine with confidence:
- Language: TypeScript | JavaScript | Python | Rust | Go | other
- Framework: Next.js | Vite+React | SvelteKit | Express | FastAPI | Django | none | other
- Package manager: npm | pnpm | yarn | pip | poetry | cargo | go modules
- Test framework: Vitest | Jest | pytest | cargo test | go test | none
- Build tool: tsc | vite | webpack | esbuild | cargo | none
- Linter/formatter: ESLint | Biome | Ruff | Black | Clippy | none
- Python environment (if Python project): detect from project markers:
.venv/orvenv/directory → venvpoetry.lock→ poetryuv.lock→ uv.python-version→ pyenvconda-meta/orenvironment.yml→ condaPipfile.lock→ pipenv- None found → none (note: recommend setting up a virtual environment)
If a field cannot be determined with confidence, write "unknown" — do not guess.
Step 3 — Extract Conventions
Read 3–5 representative source files (pick files with the most connections in the project — typically the main module, a route/controller file, and a utility file). Extract:
- Naming patterns: camelCase | snake_case | PascalCase for files, functions, variables
- Import style: named imports | default imports | barrel files (index.ts)
- Error handling pattern: try/catch | Result type | error boundary | unhandled
- State management: React Context | Zustand | Redux | Svelte stores | none
- API pattern: REST | tRPC | GraphQL | SDK | none
- Test structure: co-located (
file.test.ts) | separate directory (tests/) | none
Write extracted conventions as bullet points — be specific, not generic.
Step 4 — Generate CLAUDE.md
Use Write to create CLAUDE.md at the project root. Populate every section using data from Steps 2–3. Do not leave template placeholders — if data is unknown, write "unknown" or omit the section. Use the template below as the exact structure.
If a CLAUDE.md already exists, use Read to load it first, then merge — preserve any human-written sections (comments starting with <!-- manual -->) and update auto-detected sections only.
Other runtimes read a different file. CLAUDE.md is what Claude Code loads. Codex, Cursor, Grok Build, GitHub Copilot, OpenCode, Antigravity and Amp read AGENTS.md; Gemini CLI reads GEMINI.md. When running outside Claude Code, write the same content to AGENTS.md (or GEMINI.md on Gemini CLI) instead, with the same merge rules. If the project already has more than one of these files, update each so they stay in sync. Everything below that says CLAUDE.md means "the project-config file for this runtime".
Step 4.5 — Per-Runtime Agent Config + Hooks (multi-runtime projects)
Run when more than one AI runtime is in use (e.g. .claude/ and .codex/ or .grok/ both exist), when the user asks to "set up Codex / Grok / Gemini / Cursor" for this repo, or via /rune onboard --runtimes. Skip silently for a single-runtime project.