Git Workflow
Commit Signing (Required)
All commits must be GPG or EdDSA signed. Configure per-repository:
git config user.email "<your-email>"
git config user.signingkey <your-key-fingerprint>
git config commit.gpgsign true
Each contributor signs with their own key; the pre-push hook refuses an unsigned commit.
Branching
-
Branches:
{type}/Branching, commits, signing, hooks, and versioning, the type drawn from the commit vocabulary below (feat|fix|chore|refactor|docs|test) so branch and commit type agree; merge to main via MR when all checks pass. -
Docs-only changes take the same path — branch + MR. Docs are the highest-churn class; exempting them from review inverts scrutiny.
-
Merge conflicts: rebase onto main (
git rebase main), do NOT merge main into the branch.
Commit Messages
-
Imperative mood: "add gallery page" (not "added").
-
Type-prefixed:
feat:,fix:,chore:,refactor:,docs:,test:. -
Under 72 characters for the first line.
-
Co-Authored-By:trailer on every AI-assisted commit — required, naming the actual model. gadhs/pi’s commit guard appends it to an agent’s commit, with aReflection-Reviewtrailer recording its review; add it by hand only for an AI-assisted commit made outside pi. -
Example:
feat: add foster family resource page.
Bug Discovery
-
A pre-existing bug found during implementation: do NOT fix in the same MR. Create a new
fix:issue, link with/relate, fix in a separate branch. -
A defect this diff introduces is fixed in this MR — it is not a discovery, it is the work.
Multi-MR Plans
-
Only the last MR of a plan sets its Status to Done and moves its nav entry to Archive. Earlier MRs update the project’s service docs.
-
The plan’s single Status value changes on start, completion, or deferral — not per MR (GitLab tracks per-issue state).
Work Claiming
-
Assign yourself before starting:
glab issue update <N> --assignee @me. -
Check assignee first — do not compete.
Code Review & Merge
-
CODEOWNERS approval required (self-merge acceptable for sole-developer projects until the team grows).
-
Preserve authorship on merge — merge with a regular merge commit; never squash-on-merge. Squashing rewrites the merged commit to the merging account (erasing the human author) and strips the original GPG/EdDSA signature. Keep
should_remove_source_branchon and leave squash off. -
API contract stability: after the first stable release (1.0.0+), response shapes are additive only — no field removals, type changes, or renamed endpoints. Pre-1.0, breaking changes are permitted but must be documented in
CHANGELOG.adocunderChangedorRemoved.
Git Hooks
Activate (and ensure the exec bit survives checkout):
git config core.hooksPath .githooks && chmod +x .githooks/*
Git silently skips a hook that is not executable, emitting only an
advice.ignoredHook hint. If you see that hint — or commits/pushes sail through
with no checklist — the exec bit was lost; re-run the chmod above.
Also re-verify git config core.hooksPath still returns .githooks. It can
silently reset to the default .git/hooks (e.g. after certain git operations or
tooling that rewrites git config), which bypasses every vendored hook with no
warning. Check it before committing — especially in a long-running session where
commits previously went through the gate but suddenly don’t.
Pre-Commit Hook (.githooks/pre-commit)
Mechanical checks on every commit, for every committer:
-
the SPDX header on each staged
.rsfile; -
untracked debt markers (
FIXME/HACK/XXX/TODOwithout#Nor adebt-marker-ok:waiver); -
a CHANGELOG reminder (non-blocking).
The judgment review is gadhs/pi’s. pi reviews an agent’s commit before git
runs: J1–J8, plus the ## Code Review Rules of the committed AGENTS.md. Those
rules reach the reviewer only in a project pi trusts. pi counts canopy as
trusted by default while the checkout has no trust-requiring .pi/ resource
(.pi/settings.json, .pi/extensions/, …); /trust records the decision
explicitly. A CLEAN review lets the commit proceed. After FLAGS, either fix the
diff (the changed diff is reviewed afresh) or retry the identical diff with a
Review-Response: line in the message for each flagged question; that retry is
the only time the line is required. pi also appends the Co-Authored-By and
Reflection-Review trailers.
Commit-Msg Hook (.githooks/commit-msg)
Validates the commit subject against the type-prefix vocabulary above
(feat / fix / chore / refactor / docs / test), an optional (scope),
and the <72-char subject rule, with carve-outs for
Merge/Revert/fixup!/squash!. Adding a type means adding it to this doc
first — it is the single source of truth.
Pre-Push Hook (.githooks/pre-push)
The functional-correctness gate — runs the full local test battery. CI does not
replace it: canopy’s CI also runs the unit lane, the static audits,
quality-budgets and plan-lint, but the battery stays the gate (the dated override
in AGENTS.md). Specific checks are documented in
testing. All must pass before push; bypassing it (or
a lost exec bit) merges unvalidated code.
Versioning (SemVer 2.0.0)
-
MAJOR (
1.0.0): first production-ready release with stable API contracts. Incremented on breaking changes thereafter. -
MINOR (
0.2.0): new features, endpoints, or capabilities. No breaking changes. -
PATCH (
0.1.1): bug fixes, security patches, documentation-only changes.