Skip to content

Your lightweight open-source personal agent.

docs: add branching strategy and CONTRIBUTING guide

chengyongru5a220959afd7
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..626c8bb2b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,91 @@
+# Contributing to nanobot
+
+Thank you for your interest in contributing! This guide will help you get started.
+
+## Maintainers
+
+| Maintainer | Focus |
+|------------|-------|
+| [@re-bin](https://github.com/re-bin) | Project lead, `main` branch |
+| [@chengyongru](https://github.com/chengyongru) | `nightly` branch, experimental features |
+
+## Branching Strategy
+
+nanobot uses a two-branch model to balance stability and innovation:
+
+| Branch | Purpose | Stability |
+|--------|---------|-----------|
+| `main` | Stable releases | Production-ready |
+| `nightly` | Experimental features | May have bugs or breaking changes |
+
+### Which Branch Should I Target?
+
+**Target `nightly` if your PR includes:**
+
+- New features or functionality
+- Refactoring that may affect existing behavior
+- Changes to APIs or configuration
+
+**Target `main` if your PR includes:**
+
+- Bug fixes with no behavior changes
+- Documentation improvements
+- Minor tweaks that don't affect functionality
+
+**When in doubt, target `nightly`.** It's easier to cherry-pick stable changes to `main` than to revert unstable changes.
+
+### How Does Nightly Get Merged to Main?
+
+We don't merge the entire `nightly` branch. Instead, stable features are **cherry-picked** from `nightly` into individual PRs targeting `main`:
+
+```
+nightly ──┬── feature A (stable) ──► PR ──► main
+ ├── feature B (testing)
+ └── feature C (stable) ──► PR ──► main
+```
+
+This happens approximately **once a week**, but the timing depends on when features become stable enough.
+
+### Quick Summary
+
+| Your Change | Target Branch |
+|-------------|---------------|
+| New feature | `nightly` |
+| Bug fix | `main` |
+| Documentation | `main` |
+| Refactoring | `nightly` |
+| Unsure | `nightly` |
+
+## Development Setup
+
+```bash
+# Clone the repository
+git clone https://github.com/HKUDS/nanobot.git
+cd nanobot
+
+# Install with dev dependencies
+pip install -e ".[dev]"
+
+# Run tests
+pytest
+
+# Lint code
+ruff check nanobot/
+
+# Format code
+ruff format nanobot/
+```
+
+## Code Style
+
+- Line length: 100 characters (ruff)
+- Target: Python 3.11+
+- Linting: `ruff` with rules E, F, I, N, W (E501 ignored)
+- Async: Uses `asyncio` throughout; pytest with `asyncio_mode = "auto"`
+
+## Questions?
+
+Feel free to open an [issue](https://github.com/HKUDS/nanobot/issues) or join our community:
+
+- [Discord](https://discord.gg/MnCvHqpUGB)
+- [Feishu/WeChat](./COMMUNICATION.md)
diff --git a/README.md b/README.md
index bc272555f..424d29002 100644
--- a/README.md
+++ b/README.md
@@ -1410,6 +1410,15 @@ nanobot/
PRs welcome! The codebase is intentionally small and readable. 🤗
+### Branching Strategy
+
+| Branch | Purpose |
+|--------|---------|
+| `main` | Stable releases — bug fixes and minor improvements |
+| `nightly` | Experimental features — new features and breaking changes |
+
+**Unsure which branch to target?** See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
+
**Roadmap** — Pick an item and [open a PR](https://github.com/HKUDS/nanobot/pulls)!
- [ ] **Multi-modal** — See and hear (images, voice, video)