# Contributing to EvoRule
**Project**: EvoRule โ Reactive Execution Engine
**Version**: 0.1.3
**Last updated**: 2026-09-13
> ๐จ๐ณ **ไธญๆ็่ดก็ฎๆๅ่ง [CONTRIBUTING_ZH.md](CONTRIBUTING_ZH.md)ใ**
> For international contributors, the English version is the authoritative reference.
---
## ๐ฏ Core Principles
### Principle 1: TCB minimal, business on top
โ
**`evorule-tcb` is a Kani-verifiable minimal kernel โ only addition, subtraction, and causal chains**
โ **Do NOT push business logic into `evorule-tcb`**
**Why**:
- The larger the TCB, the harder it is to formally verify
- TCB changes = constitution changes โ must pass build.rs gates + Kani
- Business logic should be JSON data loaded at runtime
### Principle 2: Mechanism vs. application separation
โ
**`evo-agent` is the application layer; it talks to `evorule` via HTTP API**
โ **Do NOT embed LLM / business rules / workflows inside `evorule`**
**Why**:
- Mechanism layer is independently verifiable
- Application layer can evolve independently (LLM upgrade doesn't touch evorule)
- The HTTP + JSON contract is public, cross-language
### Principle 3: JSON is the only expression
โ
**Rules / state / events / I/O params / audit ledger = all JSON**
โ **Do NOT introduce non-JSON data formats (binary, protobuf, msgpack) in the system**
**Why**:
- Transparency, explainability, and auditability all stem from JSON
- `git diff` = audit, `grep` = query, JSONL = time machine
- Business can be read, written, and version-controlled
### Principle 4: Causal chain integrity
โ
**Every Fact has a `cause` field; the chain is fully traceable**
โ **Do NOT introduce "internal state changes without a cause"**
**Why**:
- `rewind` / `replay` / `diff` are built on the causal chain
- Auditing, debugging, and dispute resolution all depend on it
---
## ๐ Reporting Bugs
Use [GitHub Issues](https://github.com/evorule/evorule/issues).
**Report template**:
```markdown
**Environment**:
- OS: [e.g. Windows 11 / Ubuntu 22.04]
- Rust: [e.g. 1.74]
- evorule version: [e.g. v6.0.0]
**Steps to reproduce**:
1. ...
2. ...
**Expected behavior**:
...
**Actual behavior**:
...
**Logs / screenshots**:
[Paste server startup log or curl output]
```
---
## ๐ก Feature Requests
Also use Issues with the `enhancement` label.
**Template**:
```markdown
**Problem**: What's wrong with the current approach?
**Proposed solution**: Brief description
**Alternatives considered**: Other options you evaluated
**Impact scope**: Which tier / module is affected
```
---
## ๐ง Submitting a PR
### Workflow
1. **Fork the repo** โ create a fork under your GitHub account
2. **Create a branch**: `git checkout -b feature/your-feature-name`
3. **Write code + write tests** โ coverage must not drop
4. **Local validation**:
```bash
cargo check --workspace
cargo test --workspace
cargo clippy --workspace -- -D warnings ```
5. **Push**: `git push origin feature/your-feature-name`
6. **Open PR** on GitHub, fill in the PR template
7. **Sign CLA** (see below)
8. **Wait for review** โ maintainers reply within 7 days
### Commit message convention
Use [Conventional Commits](https://www.conventionalcommits.org/):
```
feat(tier0): add Kani proof for set_integer_safety
fix(db): adapt to sqlx 0.8 API
docs(readme): distinguish constitution from business rules
chore(deps): upgrade tokio to 1.40
refactor(reactor): split stable_detector module
test(e2e): add core constitution smoke test
```
### Branch naming
- `feature/<name>` โ new feature
- `fix/<name>` โ bug fix
- `docs/<name>` โ docs only
- `chore/<name>` โ misc
- `refactor/<name>` โ refactor
---
## ๐ License Policy (ecosystem-wide)
- **Default**: all ecosystem repos are **AGPL-3.0-or-later**, under the dual-license architecture (see DUAL_LICENSE.md for commercial/closed-source terms).
- **Design exception**: `evorule-sdk` uses **Apache-2.0** โ a deliberate choice for permissive client-library integration, not license drift (see the sdk repo README).
- License questions: check each repo's README License section before flagging a mismatch.
## ๐ CLA (Contributor License Agreement)
**All contributions must include a CLA**. The bot will check automatically on PR.
- Individual contributors: [CLA-individual.md](CLA-individual.md)๏ผๅทฒๅๅธ๏ผ
- Corporate contributors: [CLA-corporate.md](CLA-corporate.md)๏ผๅทฒๅๅธ๏ผ๏ผๆ่็ณป evorulelab@gmail.com
**Why CLA?**
- Enable commercial licensing (see [DUAL_LICENSE.md](DUAL_LICENSE.md))
- Avoid contributor copyright disputes
- AGPL-3.0 alone is not enough for commercial dual-licensing
---
## ๐งช Testing Requirements
### Unit + integration tests
- New features must have corresponding unit tests
- Integration tests go in `tests/`
- Coverage must not drop (current ~95%)
### End-to-end tests
Start `evorule-server` and verify 5 core scenarios:
1. Health check
2. Session lifecycle
3. `set` + `increment` + `state` (constitution core)
4. Time machine (`replay` / `rewind`)
5. Audit chain
See: `tests/e2e_smoke.py`
### Kani formal verification (evorule-tcb only)
When adding new tier0 meta-instructions or domain types, you must add a Kani proof:
```bash
cargo kani -p evorule-tcb --features kani
```
---
## ๐ Coding Standards
### Style
- `cargo fmt` must pass
- `cargo clippy -- -D warnings` must pass
- Functions must have doc comments (`deny(missing_docs)`)
- Public API examples must be runnable
### File header
All `.rs` files must include the SPDX header:
```rust
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2026 EvoRule Project
// This file is part of EvoRule, licensed under GNU Affero General Public License v3 or later.
```
### Module layering
- `evorule-tcb`: **only** pure computation (`no_std` compatible)
- `evorule-reactor`: event loop + FactsLog + time machine
- `evorule-governance`: I/O + HTTP API + audit
- `evo-agent` (separate repo): LLM orchestration
### Immutability by default
- Prefer `fn` over `fn mut`
- Use `BTreeMap` (deterministic iteration) over `HashMap`
- Public APIs should accept `&T` over `T`
---
## ๐ซ What NOT to do
- โ **Do NOT add I/O to `evorule-tcb`** (breaks `no_std`)
- โ **Do NOT embed LLM inside `evorule`** (mechanism layer must stay LLM-free)
- โ **Do NOT introduce non-JSON data formats** (breaks transparency)
- โ **Do NOT use `unsafe` outside FFI code** (violates `#![forbid(unsafe_code)]`)
- โ **Do NOT use `unwrap` / `expect` / `panic` in `evorule-tcb`** (breaks "never panic" invariant)
- โ **Do NOT modify the "constitution" outside `core_eval.json`** (constitution stability is EvoRule's core)
- โ **Do NOT commit secrets / API keys / personal info / internal addresses** (it's a public repo)
---
## ๐ Contact
- **GitHub**: https://github.com/evorule/evorule/issues
- **Email**: evorulelab@gmail.com
- **Org**: [EvoRule](https://github.com/evorule)
---
## ๐ Acknowledgments
Thanks to all contributors! Your name will appear in [AUTHORS.md](AUTHORS.md).
---
**Style follows `evorule-core-backup` + community best practices
([Keep a Changelog](https://keepachangelog.com/),
[Conventional Commits](https://www.conventionalcommits.org/),
[Contributor Covenant](https://www.contributor-covenant.org/)).**