diff --git a/AGENTS.md b/AGENTS.md index 1cf0242..a794502 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,6 +5,7 @@ These instructions apply to this repository. ## Development Workflow - Before implementing or reviewing code, read [CODING_STANDARDS.md](CODING_STANDARDS.md). Use the originating task and later accepted decisions to establish scope. +- Before preparing a commit or final squash/merge message, follow [AI-assisted commits](CONTRIBUTING.md#ai-assisted-commits). - Before planning, implementing, or reviewing changes to product structure, dependencies, packaging, CI, or tests, read and apply [product boundaries](docs/product-boundaries.md). It is the normative contract for ownership, permitted composition, and consumer independence. - For substantial planning, roadmap decomposition, or expanding implementation scope, use [scope-maintainable-contribution](.agents/skills/scope-maintainable-contribution/SKILL.md). - For implementing agreed code changes, use [implement](.agents/skills/implement/SKILL.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e24beaf..404aeea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -120,3 +120,33 @@ Keep changes focused and reviewable. A typical platform change should include: - A conventional commit message. Before pushing, run the relevant local checks. For CI or release behavior, prefer running the full `just ci-local` gate. + +### AI-assisted commits + +For AI-assisted changes, briefly describe AI's contribution in the commit body and add the following trailers (metadata lines at the end of the message). This keeps the record with the change in Git history. For example: + +```text +fix: preserve catalog filters when navigating back + +AI helped draft the implementation and tests. + +Assisted-by: Codex:unknown +Skills-used: code-review, durable-behavior-tests +``` + +- `Assisted-by` records the coding tool and model label. Repeat it for each known contributing tool/model pair, including delegated work. Use session metadata, observed tool output, or information confirmed by the developer. Use `unknown` when the model is unavailable; identify configuration-only selections explicitly, for example `Cursor:unknown (selected: Auto)`. +- `Skills-used` lists skills actually used for this contribution. Availability or installation alone does not establish use. Use `none` when no skills were used, or `unknown` when use cannot be established; retain known names alongside `unknown` when the record is incomplete. Tool versions and skill revisions are optional when readily known. + +The person finalizing the commit checks the attribution. When amending or squashing, carry all known contributions into the final message and check that the trailers remain. These entries are contributor-reported attribution, not proof of exact backend model identity or compliance with skill instructions. + +If your coding tool does not load `AGENTS.md`, give it this section when requesting a commit message, or add the note yourself. The same convention applies when committing work copied from a browser chat. + +The `Assisted-by` format follows [OpenSSL's contribution guidance](https://github.com/openssl/openssl/blob/5be87c4438d91d7f6f28265b1d79ad9565731da3/CONTRIBUTING.md#L145). The `Skills-used` trailer is a SkLC convention adapting [PostHog's PR disclosure of agents, models, and invoked skills](https://github.com/PostHog/posthog/blob/574679ee6bff2aa7a286e272b5b418fe49ebc5cd/.github/pull_request_template.md). + +#### Finding the model label + +- **Codex:** In `$CODEX_HOME/sessions` (default `~/.codex/sessions`), search the dated subdirectories for the `rollout-*.jsonl` file whose name ends with `CODEX_THREAD_ID` followed by `.jsonl`. Read `payload.model` from the latest `turn_context` for the work you are attributing. If you switched models, check the turns that contributed to the commit. Ask contributing subagents to check their own sessions and report their labels. Use `unknown` if the record is unavailable. [Codex thread ID](https://github.com/openai/codex/tree/main/codex-rs/exec-server#command-metadata) +- **Claude Code:** Read `model.id` from the status line input while doing the work. This field describes the current model, so capture it before switching models. [Claude Code status line](https://code.claude.com/docs/en/statusline) +- **Cursor Agent CLI (legacy):** For a run captured with `--print --output-format stream-json`, read the `model` label from the `system` event with `subtype` set to `init`. Treat `Auto` as a selection if the run does not expose the resolved model. +- **Grok Build CLI:** For a headless run captured with `--output-format json`, read the model labels from the keys in `modelUsage` when that field is present. [Grok Build CLI output formats](https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/14-headless-mode.md#output-formats) +- **GitHub Copilot CLI:** Use `/usage` to see the current session's per-model usage. If the session lists multiple models, use the ones you can tie to the contribution. [Copilot CLI session commands](https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/overview#context-management)