$curl -o .claude/agents/onboard.md https://raw.githubusercontent.com/Rune-kit/rune/HEAD/agents/onboard.mdAuto-generate project context — scans codebase, creates CLAUDE.md + .rune/ directory so every future AI session starts with full context. Use on first session.
| 1 | # onboard |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | 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. Saves 10-20 minutes of re-explaining per session on undocumented projects. |
| 6 | |
| 7 | ## Triggers |
| 8 | |
| 9 | - `/rune onboard` — manual invocation on any project |
| 10 | - Called by `rescue` as Phase 0 (understand before refactoring) |
| 11 | - Auto-trigger: when no CLAUDE.md exists in project root |
| 12 | |
| 13 | ## Calls (outbound) |
| 14 | |
| 15 | - `scout` (L2): deep codebase scan — structure, frameworks, patterns, dependencies |
| 16 | - `sentinel-env` (L3): validate developer environment (runtime versions, required tools, env vars) so the onboarded project is actually runnable |
| 17 | - `autopsy` (L2): when project appears messy or undocumented — health assessment |
| 18 | |
| 19 | ## Called By (inbound) |
| 20 | |
| 21 | - User: `/rune onboard` manual invocation |
| 22 | - `rescue` (L1): Phase 0 — understand legacy project before refactoring |
| 23 | - `cook` (L1): if no CLAUDE.md found, onboard first |
| 24 | |
| 25 | ## Output Files |
| 26 | |
| 27 | ``` |
| 28 | project/ |
| 29 | ├── CLAUDE.md # Project config for AI sessions (with invariants pointer block) |
| 30 | └── .rune/ |
| 31 | ├── conventions.md # Detected patterns & style |
| 32 | ├── decisions.md # Empty, ready for session-bridge |
| 33 | ├── progress.md # Empty, ready for session-bridge |
| 34 | ├── session-log.md # Empty, ready for session-bridge |
| 35 | ├── instincts.md # Empty, ready for session-bridge instinct learning |
| 36 | ├── contract.md # Project invariants enforced by cook/sentinel |
| 37 | ├── INVARIANTS.md # Danger zones + cross-file rules, consumed by logic-guardian |
| 38 | └── DEVELOPER-GUIDE.md # Human-readable onboarding for new developers |
| 39 | ``` |
| 40 | |
| 41 | ## Executable Steps |
| 42 | |
| 43 | ### Step 1 — Full Scan |
| 44 | Invoke `rune:scout` on the project root. Collect: |
| 45 | - Top-level directory structure (depth 2) |
| 46 | - All config files: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `composer.json`, `.nvmrc`, `.python-version`, `Pipfile.lock`, `poetry.lock`, `uv.lock` |
| 47 | - Python environment markers: `.venv/`, `venv/`, `conda-meta/`, `.python-version` |
| 48 | - Entry point files: `main.*`, `index.*`, `app.*`, `server.*` |
| 49 | - Test directory names and test file patterns |
| 50 | - CI/CD config files: `.github/workflows/`, `Makefile`, `Dockerfile` |
| 51 | - README.md if present |
| 52 | |
| 53 | Do not read every source file — scout gives the skeleton. Use `Read` only on config files and entry points. |
| 54 | |
| 55 | ### Step 2 — Detect Tech Stack |
| 56 | From the scan output, determine with confidence: |
| 57 | - **Language**: TypeScript | JavaScript | Python | Rust | Go | other |
| 58 | - **Framework**: Next.js | Vite+React | SvelteKit | Express | FastAPI | Django | none | other |
| 59 | - **Package manager**: npm | pnpm | yarn | pip | poetry | cargo | go modules |
| 60 | - **Test framework**: Vitest | Jest | pytest | cargo test | go test | none |
| 61 | - **Build tool**: tsc | vite | webpack | esbuild | cargo | none |
| 62 | - **Linter/formatter**: ESLint | Biome | Ruff | Black | Clippy | none |
| 63 | - **Python environment** (if Python project): detect from project markers: |
| 64 | - `.venv/` or `venv/` directory → venv |
| 65 | - `poetry.lock` → poetry |
| 66 | - `uv.lock` → uv |
| 67 | - `.python-version` → pyenv |
| 68 | - `conda-meta/` or `environment.yml` → conda |
| 69 | - `Pipfile.lock` → pipenv |
| 70 | - None found → none (note: recommend setting up a virtual environment) |
| 71 | |
| 72 | If a field cannot be determined with confidence, write "unknown" — do not guess. |
| 73 | |
| 74 | ### Step 3 — Extract Conventions |
| 75 | 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: |
| 76 | - **Naming patterns**: camelCase | snake_case | PascalCase for files, functions, variables |
| 77 | - **Import style**: named imports | default imports | barrel files (index.ts) |
| 78 | - **Error handling pattern**: try/catch | Result type | error boundary | unhandled |
| 79 | - **State management**: React Context | Zustand | Redux | Svelte stores | none |
| 80 | - **API pattern**: REST | tRPC | GraphQL | SDK | none |
| 81 | - **Test structure**: co-located (`file.test.ts`) | separate directory (`tests/`) | none |
| 82 | |
| 83 | Write extracted conventions as bullet points — be specific, not generic. |
| 84 | |
| 85 | ### Step 4 — Generate CLAUDE.md |
| 86 | 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. |
| 87 | |
| 88 | 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 |