# Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. ## Before you write code Open an issue first for anything larger than a small fix, and say what you intend to change. It saves you from writing something that will not be merged. Freehand has one design rule: **minimal for the model, complete for the human.** - Changes that serve the person at the keyboard (display, sessions, undo, export, providers, installation) are welcome. - Changes that decide something for the model are out of scope: plan mode, todo tools, built-in sub-agents, automatic compaction, per-command approval prompts, fixed poll intervals. - Changes to what the model sees (the system prompt in `src/freehand/prompt.md`, the tool descriptions, the status line, harness notes) change benchmark behaviour. Such a pull request needs benchmark evidence that it helps. ## Pull requests ```bash uv sync --extra dev uv run pyflakes src tests uv run pytest -q ``` Both checks must pass. For faster local feedback, run `uv run pytest -q --suite=core`; real-browser tests run with `uv run pytest -q --suite=browser --require-browser`. The default command still runs everything. See [CI checks and troubleshooting](docs/ci.md) for partitions, failure artifacts and the required PR check. Both suites must pass before merging code changes. In addition: - Add or update a test for any change in behaviour. Tests run offline against the scripted fake model APIs in `tests/`. - `src/freehand/runtime/` uses only the standard library and must import on Python 3.9. - Do not edit [CHANGELOG.md](CHANGELOG.md) in ordinary pull requests; maintainers update it at release time. - Keep a pull request to one change, and keep open pull requests to 2-3 at a time so reviews stay thorough. - For visual or interactive changes (CLI/TUI, web UI, desktop, HTML export), attach a before/after screenshot, terminal snippet, or short recording in the pull request description. AI-assisted pull requests are welcome. Please test the change yourself, describe in plain language what changed and how you verified it, and be ready to follow up on review questions. Run your agent from the repository root so it loads [AGENTS.md](AGENTS.md), and disclose AI assistance in the pull request template. ## Layout ``` src/freehand/runtime/ stdlib-only agent loop (agent.py, providers.py, auth.py, run.sh); also runs in task containers src/freehand/cli.py command line; ui.py the interactive session; tui.py the input area and pickers; session.py sessions and first-message context; export.py the HTML export src/freehand/control.py a session driven by a program; server.py and web/ the browser interface on top of it src/freehand/mcp.py MCP client behind `freehand mcp` desktop/ Electron shell around `freehand web` src/freehand/prompt.md system prompt ({transcript_path} and {image_part} are filled in at startup) src/freehand/integrations/harbor.py Harbor adapter for benchmark runs tests/ offline tests against scripted fake model APIs ``` The runtime needs only Python 3.9+ and no packages, so the code that ships is the code that runs in benchmark containers. ## Reporting bugs Use the bug template. Include the Freehand version (`freehand --version`), the operating system, the provider and model, and the steps to reproduce. `freehand sessions export ` produces a web page of a session; check it for secrets before you attach it. Security problems are not reported in issues: see [SECURITY.md](SECURITY.md). ## Releases See [the release checklist](docs/releasing.md) for mandatory checks, desktop dependency overrides and platform targets.