# Contributing to Namma Agent
Thanks for your interest in contributing to Namma Agent!
Namma Agent is a cloud-only assistant. The application lives in the [`namma_agent/`](namma_agent/) package.
We welcome bug fixes, improvements, new tools, tests, documentation updates, and other useful contributions.
**All contributions must be submitted through Pull Requests targeting the `dev` branch.** Do not submit PRs directly to `main`.
## 1. Fork the repository
Before making changes, create your own fork.
1. Open the [Namma Agent repository](https://github.com/SanthoshReddy352/Namma-Agent).
2. Click the **Fork** button in the top-right corner.
3. Create a fork under your GitHub account.
You will now have your own copy of the repository:
```text
Original repository:
SanthoshReddy352/Namma-Agent
Your fork:
YOUR_USERNAME/Namma-Agent
```
## 2. Clone your fork
Open a terminal and clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/Namma-Agent.git
cd Namma-Agent
```
Replace `YOUR_USERNAME` with your GitHub username.
## 3. Configure the original repository as upstream
Your fork is called `origin`. The original Namma Agent repository is called `upstream`.
Add the original repository as another remote:
```bash
git remote add upstream https://github.com/SanthoshReddy352/Namma-Agent.git
```
Verify your remotes:
```bash
git remote -v
```
You should see both `origin` and `upstream`.
## 4. Create a feature branch from dev
Namma Agent uses the following branch structure:
- `main`: Stable production code. Maintained by the project owner.
- `dev`: Integration branch. All community contributions must target this branch.
- Feature branches: Individual branches where contributors develop their changes.
Always start your work from the latest `dev` branch.
```bash
git fetch upstream
git switch -c feature/your-feature-name upstream/dev
```
For example:
```bash
git switch -c feature/add-weather-tool upstream/dev
```
Use a descriptive branch name based on your contribution.
Do not make changes directly on `main` or `dev`.
## 5. Set up the development environment
Create and activate a Python virtual environment:
```bash
python3 -m venv .venv
```
Activate it:
**Linux / macOS:**
```bash
source .venv/bin/activate
```
**Windows (PowerShell):**
```powershell
.venv\Scripts\Activate.ps1
```
Install dependencies:
```bash
pip install -r namma_agent/requirements.txt
```
Run the existing test suite before making changes:
```bash
python -m pytest namma_agent/tests/ -q
```
The tests should pass before you start working. If existing tests fail, investigate the failure before proceeding.
See the [README](README.md) for run instructions and provider configuration.
## 6. Make your changes
Implement your changes in your feature branch.
Follow these project guidelines:
- **Tests must pass.** Run `python -m pytest namma_agent/tests/ -q` before opening a PR. Add focused tests for new behavior under `namma_agent/tests/test_.py`. Tests are offline/mocked and require no API key.
- **Add tools the v2 way.** Add a `namma_agent/tools/.py` file with a `register(registry)` function. Parameters must use JSON Schema. Do not introduce intent regexes. Make destructive or sensitive actions approval-gated, and degrade gracefully when an external binary is missing.
- **Don't hard-code the assistant's name.** It is configurable through `assistant.name` / `ASSISTANT_NAME`. Resolve it through `namma_agent.config.assistant_name()` (backend) or `config.assistant_name` (UI). Only `NAMMA_*` environment variable names are fixed.
- **Stay cross-platform.** Guard OS-specific code using `platform.system()` / `os.name`. For text subprocesses, pass `encoding="utf-8", errors="replace"`.
- **Keep secrets out of Git.** Configuration belongs in `namma_agent/config.yaml`; secrets belong in `.env` (gitignored). Never commit API keys, credentials, tokens, or private configuration.
Keep your changes focused and avoid unrelated modifications.
## 7. Test your changes
Before committing, run:
```bash
python -m pytest namma_agent/tests/ -q
```
Also run any relevant focused tests and other applicable checks.
Do not open a PR with failing tests.
## 8. Commit your changes
Review your changes:
```bash
git status
git diff
```
Stage and commit your work:
```bash
git add .
git commit -m "feat: describe your contribution"
```
Use clear commit messages. Examples:
```text
feat: add weather tool
fix: handle missing configuration
test: add assistant config tests
docs: improve installation instructions
```
## 9. Push your feature branch to your fork
Push your branch to your GitHub fork:
```bash
git push -u origin feature/your-feature-name
```
Your changes will now be available in your fork on GitHub.
## 10. Open a Pull Request
1. Open your fork on GitHub.
2. GitHub may show a **Compare & pull request** button. Click it.
3. Verify the source and destination repositories and branches.
4. Set the destination repository to `SanthoshReddy352/Namma-Agent`.
5. Set the base branch to `dev`.
6. Set the head branch to your feature branch.
7. Add a descriptive title and explain your changes.
8. Include the tests you ran and their results.
9. Submit the Pull Request.
**Your PR must look like this:**
```text
base repository: SanthoshReddy352/Namma-Agent
base branch: dev
head repository: YOUR_USERNAME/Namma-Agent
compare branch: feature/your-feature-name
```
Do not target `main`.
## 11. PR review and merging
Every contribution goes through the project's review process.
- Automated GitHub Actions checks will run on your PR.
- All required checks must pass.
- The project maintainer will review your code.
- Changes may be requested before approval.
- Once approved and all requirements are satisfied, the maintainer will merge your PR into `dev`.
The project maintainer independently decides when tested changes in `dev` are ready to be merged into `main`.
Please do not merge your own PRs.
## 12. Keep your branch updated
If `dev` receives new changes while you are working, update your feature branch before submitting or updating your PR:
```bash
git fetch upstream
git merge upstream/dev
```
Resolve any merge conflicts, run the tests again, and push your updated branch:
```bash
git push origin feature/your-feature-name
```
Your existing PR will automatically update.
## Ground rules
- Keep PRs focused and reasonably small.
- Explain what changed and why.
- Include testing instructions and results.
- Do not commit generated files, secrets, credentials, or unrelated changes.
- Be respectful during code reviews and respond to requested changes.
- Do not push directly to the upstream `main` or `dev` branches.
## License
By contributing to Namma Agent, you agree that your contributions are licensed under the project's [MIT License](LICENSE).
Thank you for helping improve Namma Agent!