Contributing
Contribution Guidelines
How to propose and submit changes to AgentShield, and the standards a change must meet.
AgentShield is a security control. A change that makes a failure look like an allow is a defect, even when the happy-path tests are green.
Before you open a change
- Read Architecture and the security model. The originals are
docs/ARCHITECTURE.mdanddocs/SECURITY_MODEL.md. - If you move a service boundary, a decision rule, or a storage choice, add or update an ADR in
docs/adr/. - Keep OpenAPI and the implementation together. If a route is not finished, leave it unregistered and record it in
docs/api/README.md. Never return an empty success body for an unimplemented operation. - Schema changes are new SQL files under
infrastructure/docker/postgres/migrations/, safe to run twice, and listed in the migrations kustomization. Do not add a framework setting that creates tables from classes.
Scope of a pull request
- Prefer one focused change, ideally one roadmap item.
- Include tests that fail if the security behavior regresses.
- Say which checks you ran.
- Update documentation in
apps/docswhen behavior, configuration, or APIs change.
Standards
| Area | Expectation |
|---|---|
| Failure handling | Errors fail closed. Never convert an error into allow, never call a tool after an error |
| Trust | Treat agent input as claims. Do not add authority to request body fields |
| Determinism | Authorization must not depend on clocks, network calls, or model output |
| Secrets | Never log bodies or tool content; never include secrets in errors; redact before storing |
| Contracts | Error envelope error.code, error.message, error.request_id; stable codes |
| Metrics | No tenant identifiers in labels; label values from fixed sets |
| Formatting | gofmt, Ruff, and tsc --noEmit clean |
Documentation changes
The documentation site lives in apps/docs:
- Pages are MDX in
content/docs/. Each folder has ameta.jsonthat orders its pages. - Document only behavior that exists in the code. Link the implementing files with the
<Sources>component. - API reference pages render from
docs/api/*.openapi.yaml. Change the contract, not the rendering. - Run
npm run buildandnpm run check:linksinapps/docsbefore submitting.
Review
Reviewers check correctness, fail-closed behavior, tests for the security property, contract and ADR updates, and documentation. Expect questions about what happens when each dependency fails.
Was this page helpful?