Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
feat: add CONTRIBUTING and SECURITY guidelines for community contributions and vulnerability reporting
Durganshu Mishra9ef7bbd5810f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 0000000..3cb3a66--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,149 @@+# Contributing to Gotcha++Thanks for your interest in contributing to Gotcha! We welcome contributions from the community. 🙏++Gotcha is an on-device Android agent that drives real devices through the accessibility service, so contributions carry a little more weight than usual — please read the [Safety-sensitive changes](#safety-sensitive-changes) section before touching the tool layer.++## Quick Start++1. **Fork & clone**++ ```bash+ git clone [email protected]:samosa-ai-com/Gotcha.git+ cd Gotcha+ ```++2. **Point Gradle at your Android SDK**++ Android Studio writes `local.properties` on first sync. To build from the CLI before that, create it yourself at the repo root — or just set `ANDROID_HOME`. See [`RUNNING.md`](RUNNING.md#1-prerequisites) for the exact format.++3. **Build and install**++ ```bash+ ./gradlew assembleDebug+ ./gradlew installDebug # onto a device or emulator running API 30++ ```++Full prerequisites (Android Studio 2025.2+, JDK 17+, SDK Platform 34), permission notes, and troubleshooting live in [`RUNNING.md`](RUNNING.md).++## How to Contribute++### 1. Find or open an issue++- **Always start with an issue.** Please don't open a PR without a corresponding issue.+- Check [existing issues](https://github.com/samosa-ai-com/Gotcha/issues) first to see if it's already being worked on.+- For anything non-trivial, describe the approach in the issue and wait for a maintainer to weigh in before writing code.++### 2. Branching strategy++- **`main`** — the **release** branch. Tagged builds are cut from here. **Do NOT submit PRs to `main`.**+- **`development`** — the **active development** branch. All features and fixes merge here first.++```bash+git checkout development+git pull origin development+git checkout -b feat/your-feature-name+```++Branch prefixes in use: `feat/`, `fix/`, `perf/`, `chore/`, `docs/`.++### 3. Make your changes++- Match the style of the surrounding code — naming, comment density, and idiom.+- Add tests for new behaviour. New tools especially: see below.+- Keep user-facing strings in the i18n resources rather than hardcoded.++### 4. Run the checks locally++CI is **disabled by default** to conserve GitHub Actions budget, so these must pass on your machine before you open a PR:++```bash+./gradlew testDebugUnitTest # JVM unit + Robolectric tests+./gradlew detekt lintDebug # static analysis+./gradlew assembleDebug # build+```++The unit tests shell out to a POSIX `sh` (`TerminalToolTest`), so run them from Linux, macOS, or Git Bash on Windows. Full details in [`docs/RUNNING_TESTS.md`](docs/RUNNING_TESTS.md).++> **There are no detekt or lint baselines.** Everything must pass clean — don't add a baseline to silence a new finding.++If you want the full CI matrix on a branch, trigger it manually from **Actions → CI → Run workflow** (opt-in, consumes budget).++### 5. Submit a pull request++- **Target the `development` branch.**+- Link the related issue (e.g. `Closes #123`).+- Describe what changed and how you verified it. Screenshots or a screen recording help a lot for UI and agent-behaviour changes.++## Adding or changing a tool++Tools are the app's feature surface, and they're tracked by a generated manifest.++1. Implement the tool under [`app/src/main/java/com/gotcha/tools/`](app/src/main/java/com/gotcha/tools/).+2. Register it in the capability catalog with the correct **capability tier** and **agent mode** — read-only tools must be available to Monitor; anything that writes, sends, deletes, or automates the screen is Operator-only.+3. Regenerate the coverage table:++ ```bash+ ./gradlew :app:testDebugUnitTest -PupdateCoverageDocs=true+ ```++ This rewrites [`docs/FEATURE_TEST_COVERAGE.md`](docs/FEATURE_TEST_COVERAGE.md) from `app/src/test/resources/feature-test-coverage.json`. Never edit that markdown by hand — `FeatureCoverageManifestTest` fails the build on drift.++4. Commit the regenerated doc alongside your change.++## Safety-sensitive changes++Extra scrutiny applies to anything that:++- adds a tool at **Tier 2+** (calls, SMS, calendar, location, camera, screen automation, device admin, root),+- widens what the **Monitor** agent can do,+- changes the **confirmation gate**, the command **deny-list**, or the **audit log**,+- touches credential storage or how data leaves the device.++These need an explicit design discussion in the issue first. Changes that weaken a safety boundary will be declined without a strong justification. See the [Safety & Permissions guide](https://samosa-ai.com/gotcha/docs/safety-permissions) for the model you're working within.++## Code standards++- **Kotlin**, Jetpack Compose, Material 3, MVVM — compiled to Java 17 bytecode.+- **Static analysis**: detekt + Android Lint, with custom rules in [`detekt-rules/`](detekt-rules/). No baselines.+- **Commits**: clear, descriptive messages. Conventional prefixes (`feat:`, `fix:`, `chore:`) are used throughout the history.+- **Secrets**: never commit API keys, `local.properties`, keystores, or real Samosa endpoint values.++## Project structure++```+Gotcha/+├── app/src/main/java/com/gotcha/+│ ├── agent/ # Agent engine, chat view model, skills+│ ├── tools/ # The tool catalog — one file per capability area+│ ├── llm/ # OpenAI-compatible client, tool-call plumbing+│ ├── service/ # Accessibility service, assistive ball, foreground services+│ ├── connectors/ # Google, Microsoft Graph, Notion, IMAP+│ ├── audio/ # TTS / STT engines+│ ├── data/ # Persistence, encrypted credential storage+│ └── ui/ # Compose screens+├── app/src/test/ # JVM unit + Robolectric tests+├── detekt-rules/ # Custom static-analysis rules+├── docs/ # Setup guides, model card, coverage manifest+└── scripts/ # Development utilities+```++## Help & documentation++- **Docs**: [samosa-ai.com/gotcha/docs](https://samosa-ai.com/gotcha/docs) — [Architecture](https://samosa-ai.com/gotcha/docs/architecture), [Agent Modes](https://samosa-ai.com/gotcha/docs/agent-modes), [Tool Catalog](https://samosa-ai.com/gotcha/docs/tool-catalog).+- **Get help**: [open an issue](https://github.com/samosa-ai-com/Gotcha/issues) describing what you're stuck on.+- **Security bugs**: don't open an issue — see [`SECURITY.md`](SECURITY.md).++## Using code from other projects++We value the spirit of Open Source and Free Software, which foster collaboration and code reuse across projects. However, Free Software is not the same as the public domain, and license terms still apply. Not all code can be freely reused in every context.++Before integrating a significant portion of code — or adding new dependencies or libraries — please consult the maintainers to verify license compatibility. AGPL-3.0 compatibility is a hard requirement.++## License++By contributing, you agree that your contributions will be licensed under the [AGPL-3.0 License](LICENSE).++---++Thank you for helping make Gotcha better! 🙏diff --git a/README.md b/README.mdindex 8d728cd..558ec19 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@### Say it. Gotcha does it.-**A fully on-device AI agent for Android that turns natural language into real device actions.**+**A fully on-device AI copilot for Android that turns natural language into real device actions.**[](https://samosa-ai.com/gotcha)[](https://samosa-ai.com/gotcha/docs)@@ -58,11 +58,12 @@ The app opens on Settings — fill in **API key**, **Base URL** (including `/v1/## 🤝 Project & Community-* 💡 **Contributing** — [open an issue](https://github.com/samosa-ai-com/Gotcha/issues) or send a PR. Dev commands:+* 💡 [**Contributing**](CONTRIBUTING.md) — branching strategy, how to add a tool, and the checks to run before a PR:```bash./gradlew testDebugUnitTest # JVM unit tests (needs a POSIX sh)./gradlew detekt lintDebug # static analysis — no baselines, everything must pass```+* 🛡️ [**Security Policy**](SECURITY.md) — how we handle vulnerabilities and where to report them privately.* ⚖️ [**License**](LICENSE) — released under AGPL-3.0. Copyright © 2026 Samosa AI.> [!WARNING]diff --git a/SECURITY.md b/SECURITY.mdnew file mode 100644index 0000000..c4ccf4f--- /dev/null+++ b/SECURITY.md@@ -0,0 +1,86 @@+# Security Policy++## Supported Versions++| Version | Supported |+| ------- | ------------------ |+| latest release | :white_check_mark: |+| older releases | :x: |++Gotcha ships as an `.apk` on [GitHub Releases](https://github.com/samosa-ai-com/Gotcha/releases). Fixes land in the next release — please update before reporting a bug against an older build.++## Reporting a Vulnerability++We take security seriously. If you discover a security vulnerability in Gotcha, please report it responsibly.++### How to report++1. **DO NOT** create a public GitHub issue for security vulnerabilities.+2. Use [GitHub's private vulnerability reporting](https://github.com/samosa-ai-com/Gotcha/security/advisories/new), or email the maintainers at [[email protected]](mailto:[email protected]).++### What to include++- Description of the vulnerability+- Steps to reproduce — Android version, device or emulator, app version, and agent mode (Monitor / Operator) if relevant+- Potential impact+- Suggested fix (if any)++### Response timeline++- **Acknowledgment**: within 48 hours+- **Initial assessment**: within 7 days+- **Resolution**: depends on severity, typically within 30 days++### What to expect++- We will acknowledge your report promptly.+- We will keep you informed of our progress.+- We will credit you in the fix announcement, unless you prefer anonymity.++## Security Considerations++Gotcha is an autonomous agent with deep device access, so its threat model is unusual for an Android app. The areas below are where we most want your eyes.++### On-device by design++- **Everything runs in one app on your phone** — no companion PC, no remote server, no ADB tether.+- **Credentials** (LLM API keys, connector OAuth tokens) are stored in `EncryptedSharedPreferences`, never logged, and never synced off-device.+- **Chats, action logs, and caches stay local.**+- **What does leave the device**: requests you make are sent to whichever LLM endpoint you configure — including screen contents when the agent reads the screen, and screenshots when using a vision model. Choose your provider accordingly, or run a local model.++### Safety boundaries++These are the controls a vulnerability report would most usefully target:++| Boundary | What it enforces |+|---|---|+| **Agent modes** | Monitor is read-only (~30 tools); Operator unlocks the full catalog. A Monitor-mode escape is a security bug. |+| **Capability tiers** | Tier 0–1 everyday, Tier 2 personal (calls, SMS, calendar, location, camera), Tier 3 automation (screen touch, notifications, device admin), Tier 4 privileged (root — fails closed on unrooted devices). |+| **Confirmation gate** | Sensitive actions pop an explicit Allow/Deny prompt before running. |+| **Command deny-list** | Blocks dangerous shell invocations in the terminal tool. |+| **Audit log** | Append-only record of executed actions. |+| **Fixed tool catalog** | Tools are defined in code — the model cannot invent a new tool at runtime. The tool loop is bounded (300 rounds per message by default) with an anti-loop guard. |++**Prompt injection is in scope.** Gotcha reads screen content, notifications, files, and email — all of which can carry attacker-controlled text. A report showing that injected content can drive the agent past a confirmation gate, a mode restriction, or a capability tier is exactly the kind of finding we want.++### Best practices for users++1. **Start in Monitor mode** and switch to Operator only when you need it.+2. **Evaluate on a spare device or emulator** before pointing Gotcha at a phone you care about.+3. **Grant permissions carefully** — Gotcha only gets what you approve, and each tier meaningfully widens what it can do.+4. **Leave the confirmation gate on.** It can be disabled in Settings; don't, unless you fully understand the consequences.+5. **Choose your LLM provider deliberately** — screen contents go wherever you point it. A local model server keeps everything on your network.+6. **Install only from official sources** — [GitHub Releases](https://github.com/samosa-ai-com/Gotcha/releases) or F-Droid. Verify the APK signature; release builds are signed and the workflow verifies asset integrity.+7. **Keep backups.** An LLM driving your device can get things wrong.++## Disclaimer++Gotcha is powered by Large Language Models operating autonomously across powerful Android APIs. Models can hallucinate, misinterpret instructions, or execute unexpected tool calls, which can cause accidental data loss, unexpected configuration changes, or file corruption. We explicitly assume no responsibility or liability for any loss, damage, system issues, or data corruption incurred through use of Gotcha. Use it responsibly and at your own risk.++## Scope++This policy covers the Gotcha Android application. Third-party dependencies, LLM providers, and connector services (Google, Microsoft Graph, Notion) have their own security policies and disclosure processes.++---++Thank you for helping keep Gotcha secure! 🔒