- Go 1.26.2+
golangci-lint(install)
git clone https://github.com/chocks/agentctl.git
cd agentctl
make build
make test- Create a branch from
main. - Make your changes.
- Run the checks:
make fmt
make lint
make test-
Commit with a clear message. We use Conventional Commits:
feat:new functionalityfix:bug fixdocs:documentation onlybuild:build/CI changesrefactor:no behavior changetest:test-only changes
-
Open a PR against
main.
agentctl governs five high-risk actions: install_package, run_code, access_secret, write_file, call_external_api. Contributions should stay within this scope.
Good contributions:
- Bug fixes in policy evaluation or trace recording
- New policy rules for the existing five actions
- Improvements to the CLI, TUI, hook/MCP adapters, or replay workflow
- Test coverage for edge cases in
pkg/policyandpkg/trace
Probably out of scope:
- New action types (discuss in an issue first)
- External infrastructure dependencies (databases, message queues)
- Full compliance platform features
When in doubt, open an issue before writing code.
- Style: follow the Uber Go Style Guide.
- Formatting:
gofmtis non-negotiable.make fmthandles it. - Tests: table-driven tests with
t.Runsubtests. Policy tests must cover every rule branch — this is a security path, not just a style preference. - Errors: wrap with
fmt.Errorf("context: %w", err)so callers can useerrors.Is. - Struct literals: always use named fields.
- Paths: use
path/filepath, never manual string concatenation. - Dependencies: prefer the standard library. A new dependency needs to clearly pay for itself.
pkg/schema is a sensitive file. If you change it:
- Update policy evaluation, trace queries, and tests in the same PR.
- Update hook and MCP request mapping if the request shape changed.
- Update docs if the user-facing contract changed.
Trace recording must be reliable. Do not optimize trace writes in a way that risks dropping decisions. If your change touches pkg/trace, test the failure paths.
-
make fmtproduces no diff -
make lintpasses -
make testpasses - Schema changes are reflected in policy evaluation, trace queries, and tests
- Docs are updated when user-facing behavior changes
- CLI output changes remain script-friendly (parseable, no gratuitous formatting)
By contributing, you agree that your contributions will be licensed under the MIT License.