| 1 | # Contributing to Codewhale |
| 2 | |
| 3 | Codewhale is what it is because of the people who used it, reported what broke, |
| 4 | translated it, added their providers and sent fixes. Thank you for being here. |
| 5 | Everyone is welcome, in English or 中文, with or without code. |
| 6 | |
| 7 | All feedback is a gift to this project, including "this looked wrong" or "I got |
| 8 | lost here" with no fix attached. The [roadmap](docs/ROADMAP.md) says where |
| 9 | Codewhale is going and where help counts most. |
| 10 | |
| 11 | ## Where things go |
| 12 | |
| 13 | | You have | Best place | |
| 14 | | --- | --- | |
| 15 | | A bug, a crash, or behavior that surprised you | [Bug report](https://github.com/codewhale-hq/CodeWhale/issues/new?template=bug_report.yml) | |
| 16 | | An idea or a feature you want | [Feature request](https://github.com/codewhale-hq/CodeWhale/issues/new?template=feature_request.yml), or [Ideas](https://github.com/codewhale-hq/CodeWhale/discussions/categories/ideas) to talk it through first | |
| 17 | | Feedback on how something looks, reads or feels | [Feedback](https://github.com/codewhale-hq/CodeWhale/issues/new?template=feedback.yml) | |
| 18 | | A question | [Q&A](https://github.com/codewhale-hq/CodeWhale/discussions/categories/q-a) or [Discord](https://discord.gg/37gfS3ksug) | |
| 19 | | A security problem | A [private advisory](https://github.com/codewhale-hq/CodeWhale/security/advisories/new), never a public issue ([policy](.github/SECURITY.md)) | |
| 20 | | A fix, a branch, a patch, a translation, a provider or model, a docs or website change | [Contribution](https://github.com/codewhale-hq/CodeWhale/issues/new?template=contribution.yml) ([how it lands](#how-your-contribution-lands)) | |
| 21 | | A design, a failing test, or an audit of a platform or provider | [Contribution](https://github.com/codewhale-hq/CodeWhale/issues/new?template=contribution.yml) | |
| 22 | | A plugin catalog entry | [codewhale-plugin-marketplace](https://github.com/codewhale-hq/codewhale-plugin-marketplace) | |
| 23 | |
| 24 | If you are not sure, open an issue. Nothing is filed in the wrong place for |
| 25 | long: a maintainer moves it. |
| 26 | |
| 27 | ## New features start as an issue |
| 28 | |
| 29 | The questions that decide a feature are about the product, not the diff: does it |
| 30 | belong in the engine or in a plugin, what does it do in each permission mode, how |
| 31 | does it show up in receipts, what is it called in 19 languages. Answering those |
| 32 | after the code is written means rewriting code you already finished. Answering |
| 33 | them in an issue costs you a few sentences. |
| 34 | |
| 35 | So for a new feature: |
| 36 | |
| 37 | 1. Open a [feature request](https://github.com/codewhale-hq/CodeWhale/issues/new?template=feature_request.yml). |
| 38 | Say what you are trying to do and what gets in the way. A proposed design is |
| 39 | welcome and optional. |
| 40 | 2. Tick "I would like to work on this" if you want to build it. |
| 41 | 3. A maintainer answers with the shape that fits, or with what is still |
| 42 | undecided. Then share a branch on the same issue. |
| 43 | |
| 44 | If you already have a working branch or patch, share it through the |
| 45 | [Contribution form](https://github.com/codewhale-hq/CodeWhale/issues/new?template=contribution.yml) and we will have the same conversation there. |
| 46 | |
| 47 | ## Standing projects |
| 48 | |
| 49 | These are always open. Send work through the [Contribution form](https://github.com/codewhale-hq/CodeWhale/issues/new?template=contribution.yml); |
| 50 | no earlier issue is needed: |
| 51 | |
| 52 | - **Translations.** You can improve the terminal language packs, the translated |
| 53 | READMEs in `docs/i18n/`, the website, and the translated docs in |
| 54 | `docs/zh_hans/` and `docs/id/`. The [localization matrix](docs/LOCALIZATION.md) |
| 55 | shows what each language has and how to add one, and the |
| 56 | [Chinese localization group](https://github.com/codewhale-hq/CodeWhale/issues/6804) |
| 57 | is recruiting. |
| 58 | - **Providers and models.** You can add a missing provider or a new model, or |
| 59 | correct a price, a context size or a provider quirk. |
| 60 | [Providers](docs/PROVIDERS.md) lists what ships, and |
| 61 | `python3 scripts/check-provider-registry.py` checks your change. |
| 62 | Bundled descriptor rows are reserved for established operators with reliable |
| 63 | APIs, public documentation, and clear community demand; any other |
| 64 | OpenAI-compatible or Anthropic-compatible endpoint works immediately via |
| 65 | `[providers.<name>]` in `config.toml` without a bundled row. |
| 66 | - **Documentation.** You can fix a typo, an unclear step, a missing example or |
| 67 | an instruction that no longer matches the product. |
| 68 | - **Bug fixes.** If there is no issue yet, describe the bug in the form by saying |
| 69 | what you ran, what happened and what you expected. |
| 70 | - **Planned work.** You can take anything in a |
| 71 | [milestone](docs/ROADMAP.md#releases) or anything labelled |
| 72 | [help wanted](https://github.com/codewhale-hq/CodeWhale/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). |
| 73 | Comment on the issue to claim it so two people do not build the same thing. |
| 74 | |
| 75 | Large changes to planned work are easier in layers; see |
| 76 | [Large work](#large-work). |
| 77 | |
| 78 | ### What a planned-work issue gives you |
| 79 | |
| 80 | Every issue a maintainer opens for planned work, and every release tracking issue, has the same parts, so you can pick one up without asking first: |
| 81 | |
| 82 | - **Status:** what is on `main` already, with commit links, and what is still missing. |
| 83 | - **Ways to help:** each piece open to contributors, with the files to read, the command to test it locally (usually `scripts/dev-test.sh <crate> <filter>`) and what "done" means. Pieces that need no Rust, such as trying a feature and reporting exactly what happened, are listed first. A precise report is credited like code. |
| 84 | - **Being built by maintainers right now:** the parts someone already holds, so you don't build the same thing twice. |
| 85 | - **How to take a piece:** comment to claim it, then link your branch or patch on the issue. |
| 86 | |
| 87 | If an issue for planned work is missing one of these, say so on it. That is a bug in the issue. |
| 88 | |
| 89 | ## How we work with you |
| 90 | |
| 91 | - We reply by naming what you reported, diagnosed or fixed. |
| 92 | - A maintainer brings accepted work up to date with `main`, runs the platform |
| 93 | checks and writes the changelog entry. You do not rebase around our changes. |
| 94 | - Your name is on the commit, as its author or co-author |
| 95 | ([details](#how-your-contribution-lands)). |
| 96 | - You hear what was kept, adapted or left out, and why. |
| 97 | - We credit you in the changelog and in |
| 98 | [the contributors list](docs/CONTRIBUTORS.md). |
| 99 | - If something is not ready or not a fit, we say what is blocked and what would |
| 100 | change the answer. |
| 101 | |
| 102 | ## Getting Started |
| 103 | |
| 104 | ### Prerequisites |
| 105 | |
| 106 | - Rust 1.89 or later (edition 2024) |
| 107 | - Cargo package manager |
| 108 | - Git |
| 109 | |
| 110 | ### Setting Up Development Environment |
| 111 | |
| 112 | 1. Fork and clone the repository: |
| 113 | ```bash |
| 114 | git clone https://github.com/YOUR_USERNAME/CodeWhale.git |
| 115 | cd CodeWhale |
| 116 | ``` |
| 117 | |
| 118 | 2. Build the current engine and terminal: |
| 119 | ```bash |
| 120 | CODEWHALE_BUILD_SHA="$(git rev-parse HEAD)" cargo build --locked -p codewhale-cli |
| 121 | ``` |
| 122 | |
| 123 | 3. Run the tests near your change (see [Fast local loop](#fast-local-loop)): |
| 124 | ```bash |
| 125 | scripts/dev-test.sh tui your_test_filter |
| 126 | ``` |
| 127 | |
| 128 | 4. Run with development settings: |
| 129 | ```bash |
| 130 | ./target/debug/codewhale --version |
| 131 | ./target/debug/codewhale |
| 132 | ``` |
| 133 | |
| 134 | ### Testing the latest source |
| 135 | |
| 136 | The canonical source is [`codewhale-hq/Codewhale`'s `main` branch](https://github.com/codewhale-hq/Codewhale/tree/main). |
| 137 | Release candidates land there after their CI gates pass, so contributors can |
| 138 | test and build on the same source. Tagged downloads remain the latest published |
| 139 | release; their version can lag the development version on `main`. |
| 140 | |
| 141 | For a fresh checkout of the current source: |
| 142 | |
| 143 | ```bash |
| 144 | git clone --branch main https://github.com/codewhale-hq/Codewhale.git |
| 145 | cd Codewhale |
| 146 | CODEWHALE_BUILD_SHA="$(git rev-parse HEAD)" cargo build --release --locked -p codewhale-cli |
| 147 | ./target/release/codewhale --version |
| 148 | ./target/release/codewhale |
| 149 | ``` |
| 150 | |
| 151 | Include the commit shown by `--version` when reporting a problem. If you work |
| 152 | from a fork, add the canonical repository as `upstream` and fetch `upstream/main` |
| 153 | before starting a change; preserve any local work when updating your branch. |
| 154 | |
| 155 | ## Development Workflow |
| 156 | |
| 157 | ### Code Style |
| 158 | |
| 159 | - Run `cargo fmt` before committing to ensure consistent formatting |
| 160 | - Run `cargo clippy` and address all warnings |
| 161 | - Follow Rust naming conventions (snake_case for functions/variables, CamelCase for types) |
| 162 | - Do not add new code comments; put the reasoning in the commit message |
| 163 | |
| 164 | ### Testing |
| 165 | |
| 166 | - A bug fix may add the one regression test that would have caught it; no coverage for its own sake |
| 167 | - Run the tests near your change (see [Fast local loop](#fast-local-loop)). |
| 168 | A maintainer runs the full test suite on Linux, macOS and Windows before your |
| 169 | work lands (see [How Your Contribution Lands](#how-your-contribution-lands)) |
| 170 | - Colocate unit tests beside the code they cover (standard Rust `#[cfg(test)]` |
| 171 | modules), and add integration tests under the owning crate's `tests/` |
| 172 | directory (for example `crates/tui/tests/` or `crates/state/tests/`). The |
| 173 | repository root `tests/` directory is not used |
| 174 | |
| 175 | ### Pre-push verification |
| 176 | |
| 177 | These are the Rust commands CI runs on Linux (the `Lint` check and the Linux |
| 178 | shards of `Sharded tests (ubuntu-latest)`). You do not need all of them before |
| 179 | sharing a branch: run `cargo fmt`, then check and test the crates you touched |
| 180 | (see [Fast local loop](#fast-local-loop)). Run the full set locally when a change |
| 181 | spans many crates: |
| 182 | |
| 183 | ```bash |
| 184 | cargo fmt --all -- --check |
| 185 | cargo clippy --workspace --all-targets --all-features --locked -- \ |
| 186 | -D warnings \ |
| 187 | -A clippy::uninlined_format_args \ |
| 188 | -A clippy::too_many_arguments \ |
| 189 | -A clippy::unnecessary_map_or |
| 190 | cargo test --workspace --all-features --locked |
| 191 | ``` |
| 192 | |
| 193 | Clippy lints test, bench and example targets too (`--all-targets`), and the |
| 194 | three allowances above are the only ones CI and the release lane accept. |
| 195 | |
| 196 | #### Fast local loop |
| 197 | |
| 198 | The full gate above is what CI enforces, but you do not need it for every |
| 199 | edit. `crates/tui` is a ~750k-line crate, so the loop that stays fast is |
| 200 | the one that avoids rebuilding it more than necessary (numbers and the |
| 201 | reasoning are in [`docs/BUILD_PERFORMANCE.md`](docs/BUILD_PERFORMANCE.md)): |
| 202 | |
| 203 | ```bash |
| 204 | # 1. Type-check first (seconds after the first build; no codegen, no link). |
| 205 | scripts/dev-cargo.sh check -p codewhale-tui |
| 206 | |
| 207 | # 2. Run only the tests near your change (one crate, one filter). |
| 208 | scripts/dev-test.sh tui fleet_setup |
| 209 | # or: scripts/dev-test.sh crates/command-contract/src/elapsed.rs |
| 210 | |
| 211 | # 3. Run a whole crate's unit suite. scripts/dev-test.sh uses nextest when |
| 212 | # it is installed (one process per test, all cores busy, slow tests |
| 213 | # named; ~100 s here vs ~270 s with libtest). |
| 214 | cargo install cargo-nextest --locked # once |
| 215 | scripts/dev-test.sh tui |
| 216 | scripts/dev-cargo.sh nextest run --workspace --all-features --locked |
| 217 | |
| 218 | # 4. The suite CI runs on Linux (hosted CI runs it as parallel shards): |
| 219 | cargo test --workspace --all-features --locked |
| 220 | ``` |
| 221 | |
| 222 | `.config/nextest.toml` already serializes the PTY suite and bounds the |
| 223 | integration tests that spawn the real binary, so `cargo nextest run` is |
| 224 | safe to use on the whole workspace (nextest does not run doctests; the |
| 225 | authoritative `cargo test` gate does). Tests must not depend on running in |
| 226 | the same process as another test (nextest gives every test its own |
| 227 | process); if a test needs the rustls crypto provider, install it in that |
| 228 | test as production does at startup. |
| 229 | |
| 230 | On a machine with less than 16 GB of RAM (or when cross-compiling, e.g. |
| 231 | for OHOS), build one rustc at a time: `CARGO_BUILD_JOBS=1` (or `-j1`), one |
| 232 | crate at a time, `--lib` for tests, never `--workspace`/`--all-targets`. |
| 233 | The tui library needs ~6 GB for its own rustc and its unit-test build ~8 GB; |
| 234 | `cargo test --workspace` runs both at once. Numbers and the full recipe: |
| 235 | [`docs/BUILD_PERFORMANCE.md`](docs/BUILD_PERFORMANCE.md#low-memory-build-recipe-machines-with--16-gb-cross-builds). |
| 236 | |
| 237 | If you work in several worktrees, do **not** share one `CARGO_TARGET_DIR` |
| 238 | by default: two cargos on the same target flock and serialize. Use |
| 239 | `scripts/dev-cargo.sh` / `scripts/dev-test.sh`, which give each workspace |
| 240 | its own Cargo `build-dir` (`{workspace-path-hash}` under |
| 241 | `${CODEWHALE_CACHE_ROOT:-${XDG_CACHE_HOME:-$HOME/.cache}/codewhale}`). |
| 242 | `CODEWHALE_DEV_CACHE=local` keeps `./target` if you want that. |
| 243 | `sccache` wraps rustc only when incremental compilation is already off |
| 244 | (`CARGO_INCREMENTAL=0` or `CODEWHALE_SCCACHE=1`) and `sccache` is on |
| 245 | `PATH`; a missing binary is a printed fallback, not an error. Override |
| 246 | the cache root with `CODEWHALE_CACHE_ROOT` — there is no machine-specific |
| 247 | default. A single shared `CARGO_TARGET_DIR` remains valid only for |
| 248 | serialized trunk work. See |
| 249 | [`docs/BUILD_PERFORMANCE.md`](docs/BUILD_PERFORMANCE.md). |
| 250 | |
| 251 | Some checks are platform-bound or intentionally excluded from an ordinary |
| 252 | change. Choose them for the risk they answer rather than treating every |
| 253 | available suite as ritual. Visible TUI behavior is accepted in the actual |
| 254 | terminal at the sizes and interaction path affected by the change; the former |
| 255 | full-screen PTY assertion suite was removed because it froze layout and copy |
| 256 | while missing product quality. |
| 257 | |
| 258 | - **Long-running process acceptance** should use a sealed local home, local |
| 259 | fixtures, and the real binary. Record the terminal size, inputs, visible |
| 260 | result, and any filesystem side effect instead of adding a full-screen |
| 261 | golden. |
| 262 | - **OCR** (`image_ocr`) uses the macOS Vision framework or a locally |
| 263 | installed `tesseract`; its platform-specific paths are |
| 264 | `cfg(target_os = "macos")`-gated and depend on host tooling. |
| 265 | - **Seatbelt sandbox** tests are macOS-only (`cfg(target_os = |
| 266 | "macos")` at the module level) and do not run elsewhere. |
| 267 | |
| 268 | #### Local git hooks are optional |
| 269 | |
| 270 | This repository does not install git hooks, and no hook installer |
| 271 | exists; CI is the enforced gate. If you want a local `pre-push` hook |
| 272 | that runs the commands above, add it yourself (`.git/hooks/pre-push` or |
| 273 | `git config core.hooksPath`). Constraints for any local hook: |
| 274 | |
| 275 | - A hook must never push, tag, publish, deploy, mutate credentials, or |
| 276 | rewrite the working tree (no auto-fix commits or silent file |
| 277 | modification). It may only verify and report. |
| 278 | - To bypass your own hook for a knowingly documented reason (for |
| 279 | example, pushing work-in-progress to your own fork branch), use |
| 280 | `git push --no-verify` and say so when you share the branch. Bypassing a |
| 281 | local hook does not make the gates pass — CI still runs them, and a |
| 282 | bypassed gate must never be reported as a passing one. |
| 283 | - Release publication (tags, GitHub Releases, crates/npm artifacts) is a |
| 284 | separate, owner-approved gate. Neither local hooks nor a green local |
| 285 | run authorize any publication step. |
| 286 | |
| 287 | ### Commit Messages |
| 288 | |
| 289 | Use clear, descriptive commit messages following conventional commits: |
| 290 | |
| 291 | - `feat:` New feature |
| 292 | - `fix:` Bug fix |
| 293 | - `docs:` Documentation changes |
| 294 | - `refactor:` Code refactoring |
| 295 | - `test:` Adding or updating tests |
| 296 | - `chore:` Maintenance tasks |
| 297 | |
| 298 | Example: `feat: add doctor subcommand for system diagnostics` |
| 299 | |
| 300 | **Contributors do not edit the changelog.** A maintainer or agent landing a |
| 301 | user-visible change adds its `CHANGELOG.md` line in the same commit, and |
| 302 | `./scripts/sync-changelog.sh` keeps the packaged slice in |
| 303 | `crates/tui/CHANGELOG.md` in sync. |
| 304 | |
| 305 | One check is enforced by CI: a `feat:` commit whose message mentions an |
| 306 | issue (`#N`) must add `#N` to `CHANGELOG.md` in the same change |
| 307 | (`scripts/release/check-feature-release-notes.sh`). As a contributor, put issue |
| 308 | numbers in the Contribution issue instead of in `feat:` commit messages; the |
| 309 | maintainer who lands the work writes the entry. |
| 310 | |
| 311 | **AI-assistant co-author trailers are fine.** Using an assistant is welcome and |
| 312 | needs no disclosure, and CI no longer rejects an auto-appended |
| 313 | `Co-authored-by: <some tool>` line. What we do care about is that the humans who |
| 314 | did the work are named — `Co-authored-by` feeds the GitHub contribution graph. |
| 315 | Remove an auto-appended line only if you want to: |
| 316 | |
| 317 | ```bash |
| 318 | git rebase -i origin/main # reword each commit, delete the Co-authored-by line |
| 319 | ``` |
| 320 | |
| 321 | Co-author a *person* freely; the address must be their GitHub-linked one |
| 322 | (`id+login@users.noreply.github.com`) or the credit does not register. |
| 323 | |
| 324 | ## How Your Contribution Lands |
| 325 | |
| 326 | Open a [Contribution](https://github.com/codewhale-hq/CodeWhale/issues/new?template=contribution.yml) and describe the change. A branch on your fork, a |
| 327 | commit, a gist or a pasted patch is optional, and so is finishing it. Name anyone |
| 328 | else whose commits are in the branch. |
| 329 | |
| 330 | 1. **A maintainer, or an agent working for one, reads it**, asks questions on the |
| 331 | issue, and reviews the whole diff if there is one. |
| 332 | 2. **They list what your work does**, including the edge cases it handles, and |
| 333 | decide for each one whether it is kept, adapted or left out. If something would |
| 334 | be adapted or left out, they post that list on the issue before landing it, so |
| 335 | you can correct a misreading. |
| 336 | 3. **They bring it up to date with `main`**, resolve conflicts and add the |
| 337 | changelog entry. A second person or agent reviews the integrated change. |
| 338 | Maintainers resolve the findings and run the full suite on Linux, macOS and |
| 339 | Windows on the exact commit. |
| 340 | 4. **It lands on `main`, and the issue gets a note** with the commit, what was |
| 341 | kept, adapted and left out, and a reminder that a landing is not a release. |
| 342 | An issue that was fully delivered closes as completed. One that still has work |
| 343 | in it stays open. |
| 344 | |
| 345 | If you want hosted CI on your branch before that, ask on the issue: a maintainer |
| 346 | reviews the branch, pushes it to a `ci/*` branch here, runs the checks and links |
| 347 | the run. You can also test `main` or a release candidate before it ships and tell |
| 348 | us what differs on your setup. |
| 349 | |
| 350 | ### Your credit |
| 351 | |
| 352 | - When your diff lands, you are the commit's **author**. When it is adapted or |
| 353 | rebuilt from your design, reproduction or prototype, you are a |
| 354 | **`Co-authored-by`**. Both use your GitHub-linked address, so the commit counts |
| 355 | on your profile. |
| 356 | - The commit says `Integrated from #N by @your-handle`, with the number of your |
| 357 | issue. |
| 358 | - A maintainer adds your line to `.github/AUTHOR_MAP` and credits you in |
| 359 | `CHANGELOG.md`, [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md) and the website's |
| 360 | release credits. You do not edit those files. |
| 361 | |
| 362 | ### If you open a pull request |
| 363 | |
| 364 | It is welcome, and nothing closes it automatically. A maintainer reads it the same |
| 365 | way and lands accepted work on `main` with the same credit, then closes the pull |
| 366 | request by hand with a note naming the commit. Pull requests here do not run the |
| 367 | test suite, so the Contribution form is the quicker path. |
| 368 | |
| 369 | ### What helps it land |
| 370 | |
| 371 | 1. **Keep it to one change.** One bug fix or one feature; do not mix a refactor |
| 372 | with a feature. |
| 373 | 2. **Start from current `main`.** If `main` moves, you do not need to rebase. |
| 374 | 3. **Include the regression test** for a bug fix, or for a new contract between |
| 375 | components. |
| 376 | 4. **Say which layer it replaces** if you add a layer, module or abstraction, and |
| 377 | update the docs your change makes wrong. |
| 378 | 5. **Ask before touching the trust boundary.** That includes auth and credential |
| 379 | flows, sandbox policy, publishing and release plumbing, and `prompts/` content. |
| 380 | |
| 381 | ## Large work |
| 382 | |
| 383 | Start with one issue that names the intended slices and what each one leaves out. |
| 384 | Share each slice as its own Contribution that links the issue, keep it to one |
| 385 | behavior boundary, and say which earlier slice it builds on and which commands you |
| 386 | ran. Everything targets `main`. Config and schema changes need round-trip or |
| 387 | migration-preservation tests. |
| 388 | |
| 389 | ## Labels |
| 390 | |
| 391 | Issues and pull requests are labelled by `.github/workflows/triage.yml`, which |
| 392 | only ever adds labels that already exist. Pull requests get their labels from |
| 393 | the paths they change and their conventional-commit title prefix; issues get |
| 394 | them from the title and form answers. |
| 395 | |
| 396 | | Family | Meaning | |
| 397 | | --- | --- | |
| 398 | | `area:*` | The subsystem or client: `tui`, `core`, `tools`, `mcp`, `state`, `sandbox`, `plugins`, `providers`, `runtime-api`, `install`, `localization`, `ci`, `desktop`, `web`, `mobile`, `remote-control`, `subagents` | |
| 399 | | `os:*` | Platform-specific behaviour: `windows`, `macos`, `linux`, `freebsd`, `ohos` | |
| 400 | | `priority:p0` / `p1` / `p2` | Set by a maintainer; `release-blocker` still marks work that must land before a release | |
| 401 | | `bug`, `enhancement`, `documentation`, `question`, `cleanup`, `performance`, `security` | What kind of change it is | |
| 402 | | `accessibility` | Screen readers, keyboard use, contrast, motion | |
| 403 | | `contribution` | Opened with the Contribution form | |
| 404 | | `contributor:external` | Opened by someone outside the maintainer team | |
| 405 | | `lang:zh` | Written in Chinese | |
| 406 | | `needs-triage`, `needs-info`, `agent-in-progress`, `needs-human`, `keep-open`, `pinned`, `stale` | Workflow state; other workflows read these names | |
| 407 | | `agent-ready` | Maintainer grant: the issue is ready for an autonomous agent. Absent means not startable; the Agent task form does not apply it | |
| 408 | |
| 409 | Release targeting uses milestones, not version labels. |
| 410 | |
| 411 | ## Working with an agent |
| 412 | |
| 413 | Using an AI assistant is welcome and needs no disclosure. Codewhale is used to |
| 414 | work on Codewhale, and many fixes here began as a person pointing an agent at |
| 415 | an issue. |
| 416 | |
| 417 | What makes agent-assisted work easy to land is the same as for any other: a |
| 418 | specific reproduction, a small diff, the checks you ran, and a description of |
| 419 | the trade-off. Keep each contribution to one friction point, and put a list of |
| 420 | ideas for improvement in an issue. |
| 421 | |
| 422 | Do not point an agent at auth, credentials, sandbox policy, publishing and |
| 423 | release plumbing, provider policy, telemetry, sponsorship, branding or global |
| 424 | prompts without a maintainer's agreement on the issue first. |
| 425 | |
| 426 | Maintainers write some issues with the |
| 427 | [Agent task](.github/ISSUE_TEMPLATE/agent-task.yml) form so that an agent with |
| 428 | no other context can finish them. The form does not apply `agent-ready`: a |
| 429 | maintainer grants that label during triage, and its absence means an agent must |
| 430 | not start the issue. Agents and maintainers follow |
| 431 | [docs/AGENT_ETHOS.md](docs/AGENT_ETHOS.md). |
| 432 | |
| 433 | ## How maintainers ship |
| 434 | |
| 435 | Maintainers, and the agents working for them, land small verified slices |
| 436 | directly on `main` with the checks they ran in the commit message. Every push |
| 437 | to `main` runs a fast preflight. The landing workflow reuses a successful full |
| 438 | Linux, macOS and Windows CI run for the pushed commit, or dispatches a full run |
| 439 | if it cannot verify one. A release also needs a green `release-candidate.yml` |
| 440 | run on the exact commit being released. Follow the sequence in |
| 441 | [docs/RELEASE_RUNBOOK.md](docs/RELEASE_RUNBOOK.md). |
| 442 | |
| 443 | Contributed work lands the same way, as described in |
| 444 | [How Your Contribution Lands](#how-your-contribution-lands). |
| 445 | |
| 446 | ## Project Structure |
| 447 | |
| 448 | Codewhale is a Cargo workspace with one Engine implementation in |
| 449 | `crates/engine/src/core/engine/`. The public `codewhale` executable links the |
| 450 | TUI/runtime library; interactive sessions, noninteractive runs and the Runtime |
| 451 | API share that Engine. |
| 452 | |
| 453 | | Path | Purpose | |
| 454 | | --- | --- | |
| 455 | | `crates/cli/` | Public command entrypoint, configuration commands and runtime dispatch | |
| 456 | | `crates/engine/` | Agent Engine, turn loop, tools, sub-agents, hooks, MCP and extension host | |
| 457 | | `crates/tui/` | Interactive terminal UI, keybindings, views and presentation | |
| 458 | | `crates/app-server/` | Runtime API HTTP/SSE server and embedded local web client | |
| 459 | | `crates/core/`, `crates/protocol/`, `crates/state/` | Request construction, session/turn types, protocol framing and persistence | |
| 460 | | Other `crates/` | Shared configuration, credentials, localization, telemetry, workflow and packaging support; see each Cargo manifest | |
| 461 | | `web/` | Public Next.js website and documentation; separate from the embedded Runtime web client | |
| 462 | | `telemetry-ingest/`, `telemetry-stats/` | Telemetry ingestion/stats Cloudflare Workers, schemas and service tests | |
| 463 | | `extensions/`, `integrations/` | Editor integration and external-service bridges | |
| 464 | | `npm/`, `packaging/` | npm wrappers/SDK and platform installation definitions (AUR, Docker, FreeBSD, Nix, WinGet) | |
| 465 | | `deploy/` | Deployment templates consumed by setup scripts, including Tencent Lighthouse services | |
| 466 | | `.codewhale/` | Repository authority policy, project hooks, Fleet definitions and checked-in workflow examples | |
| 467 | | `brand/`, `pet/` | Source artwork, brand variants and whale companion sources used by the README, website and terminal | |
| 468 | | `docs/` | User/developer documentation, schemas, fixtures and referenced release material | |
| 469 | | `scripts/`, `.github/`, `.cnb.yml` | Development, validation, CI and release tooling | |
| 470 | | `patches/`, `vendor/` | Vendored dependency fixes and workspace-owned forks, including their licensing files | |
| 471 | |
| 472 | Generated files that the product embeds or validates, such as model catalogs, |
| 473 | website facts and schemas, remain tracked with their generators. Keep local |
| 474 | critique output, temporary verification reports and personal operator |
| 475 | instructions outside the tracked product tree; describe the change and its |
| 476 | validation in the Contribution issue. Do not copy workspace-level operator |
| 477 | `AGENTS.md` or `CLAUDE.md` files into this repository. |
| 478 | |
| 479 | See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the runtime data flow and |
| 480 | [the build guide](docs/BUILD_PERFORMANCE.md) for crate dependencies and local |
| 481 | verification. |
| 482 | |
| 483 | ## Security |
| 484 | |
| 485 | Please do **not** open a public issue for a vulnerability. See |
| 486 | [SECURITY.md](.github/SECURITY.md) for private reporting. |
| 487 | |
| 488 | ## Code of Conduct |
| 489 | |
| 490 | Be respectful and inclusive. We welcome contributors of all backgrounds and |
| 491 | experience levels. See [CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md). |
| 492 | |
| 493 | ## License |
| 494 | |
| 495 | By contributing to Codewhale, you agree that your contributions will be |
| 496 | licensed under the MIT License. |
| 497 | |
| 498 | ## Questions? |
| 499 | |
| 500 | Ask in [Discussions](https://github.com/codewhale-hq/CodeWhale/discussions) or |
| 501 | on [Discord](https://discord.gg/37gfS3ksug), or add the maintainer, Hunter, on |
| 502 | WeChat (`hunterbown`) and ask to join the Whale Brothers group. Everyone is |
| 503 | welcome. |
| 504 |