Skip to content

feat: agent quality workflows and worktree ship gates - #40

Merged
robertoecf merged 2 commits into
mainfrom
claude/agent-quality-workflows
Aug 10, 2026
Merged

feat: agent quality workflows and worktree ship gates#40
robertoecf merged 2 commits into
mainfrom
claude/agent-quality-workflows

Conversation

@robertoecf

@robertoecf robertoecf commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds docs/agents/ orientation, domain, quality, MCP trust checklist, and in-repo openfindata-ship skill (no external skill install).
  • Hardens git guardrails/hooks so root checkout and main are inspect-only; humans and agents work from dedicated worktrees.
  • Adds scripts/ship/preflight.sh (readiness + ruff/mypy/pytest with SHA evidence) and MCP trust reviewer skill.

Reviews

  • Adversarial: CROSS_FAMILY (author: Cursor/Composer; reviewer: GPT-5.6 Terra via adversarial-reviewer). Initial High findings fixed (ship review-after-commit + clean tree; CONTRIBUTING worktree-first). Re-review: clear to open PR.
  • MCP Trust: MCP_SURFACE / PASS (docs + reviewer skill only; no runtime mcp_app / code-mode change).
  • Deslop: no removable slop found.
  • Preflight: readiness OK; ruff/mypy clean; 319 passed.

Test plan

  • bash scripts/git/install-hooks.sh then confirm commit blocked on root/main
  • From a worktree: bash scripts/ship/preflight.sh passes
  • Dirty worktree fails docs/agents/openfindata-ship/scripts/readiness.sh
  • CI ci.yml green on this PR

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added standardized repository guidance for development, worktrees, quality checks, shipping, and agent workflows.
    • Added automated readiness, preflight, pull request review, and MCP trust checks.
    • Added shared Git hook support across worktrees, including checkout, commit, and push validation.
  • Documentation

    • Added orientation, domain, quality, contribution, shipping, and MCP trust documentation.
    • Documented supported workflows, review requirements, publication boundaries, and troubleshooting guidance.

Port Wealthuman-style agent workflows into openfindata: docs/agents map,
in-repo ship skill, MCP trust review, preflight evidence, and hooks that
keep root/main inspect-only.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@robertoecf, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0709a857-c2ba-4f5b-a976-5588b7c3e3f6

📥 Commits

Reviewing files that changed from the base of the PR and between 0db4e92 and cc2b1d8.

📒 Files selected for processing (9)
  • .claude/skills/mcp-trust-reviewer/SKILL.md
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • docs/agents/domain.md
  • docs/agents/openfindata-ship/README.md
  • docs/agents/openfindata-ship/scripts/check-pr-threads.sh
  • docs/agents/openfindata-ship/scripts/readiness.sh
  • docs/agents/quality.md
📝 Walkthrough

Walkthrough

The change adds agent and MCP trust documentation, formalizes the ship workflow, enforces worktree-aware Git hooks, and introduces readiness and preflight quality gates with recorded evidence.

Changes

Agent workflow and repository guardrails

Layer / File(s) Summary
Policy and agent guidance
AGENTS.md, CLAUDE.md, CONTRIBUTING.md, docs/agents/*, .claude/skills/*
Adds canonical guidance for harness use, worktrees, MCP trust review, domain orientation, contribution rules, and quality gates.
Ship workflow and readiness checks
docs/agents/openfindata-ship/*
Defines ship routing and authorization rules. Adds readiness validation and GitHub review-thread checks.
Shared Git guardrails and hooks
scripts/git/guardrails.sh, scripts/git/install-hooks.sh, .githooks/*
Enforces allowed worktree and branch contexts. Installs hooks in the shared Git directory and adds commit, push, and post-checkout checks.
Preflight quality gate
scripts/ship/preflight.sh
Adds quick, push, and CI modes for readiness, Ruff, mypy, and pytest checks. Successful runs record SHA-bound evidence.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Preflight as scripts/ship/preflight.sh
  participant Readiness as readiness.sh
  participant Python as Ruff, mypy, and pytest
  participant Evidence as Git common-directory evidence

  Preflight->>Readiness: Run readiness checks with selected base reference
  Readiness-->>Preflight: Return readiness status
  Preflight->>Python: Run configured quality gates
  Python-->>Preflight: Return validation status
  Preflight->>Evidence: Record mode, steps, SHA, path, and UTC timestamp
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.12% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: agent quality workflows and worktree-based shipping guardrails.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/agent-quality-workflows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (5)
.githooks/post-checkout (1)

15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Gate the warning on the branch-checkout flag.

Git calls post-checkout with three arguments. The third argument is 1 for a branch checkout and 0 for a file checkout. The hook currently ignores it, so git checkout -- <path> and git worktree add also print the warnings. Gate the call to reduce noise.

♻️ Proposed change
-guardrails_warn_post_checkout
+# $3 == 1 marks a branch checkout; skip file checkouts.
+if [[ "${3:-1}" == "1" ]]; then
+  guardrails_warn_post_checkout
+fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.githooks/post-checkout at line 15, Update the post-checkout hook around
guardrails_warn_post_checkout to accept Git’s third hook argument and invoke the
warning only when that flag equals 1, suppressing warnings for file checkouts
and worktree operations.
scripts/git/guardrails.sh (3)

236-247: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use an array for staged files to survive paths with spaces.

files holds newline-separated paths and expands unquoted. Bash splits on spaces and tabs, so a path such as src/my file.py becomes two arguments and ruff fails or checks the wrong path. Read the list into an array with a NUL delimiter.

♻️ Proposed change
-  local files
-  files="$(guardrails_staged_py_files)"
-  if [[ -z "$files" ]]; then
+  local files=()
+  while IFS= read -r -d '' f; do
+    files+=("$f")
+  done < <(git diff --cached --name-only -z --diff-filter=ACMR -- '*.py' || true)
+  if [[ ${`#files`[@]} -eq 0 ]]; then
     guardrails_log "no staged Python files — skipping Ruff"
   else
     guardrails_log "ruff check (staged only)"
-    # shellcheck disable=SC2086
-    "$py" -m ruff check $files
+    "$py" -m ruff check -- "${files[@]}"
 
     guardrails_log "ruff format --check (staged only)"
-    # shellcheck disable=SC2086
-    "$py" -m ruff format --check $files
+    "$py" -m ruff format --check -- "${files[@]}"
   fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/git/guardrails.sh` around lines 236 - 247, Update the staged-file
handling around guardrails_staged_py_files to read paths into a Bash array using
a NUL delimiter, preserving filenames containing spaces. Use the array when
invoking both ruff check and ruff format --check, while retaining the no-files
skip behavior.

282-286: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Install hooks from the shared repository root, not the current checkout.

checkout_root comes from guardrails_current_checkout, so the source is the worktree that runs the installer. core.hooksPath is a repository-level setting shared by every worktree. A worktree on an old or experimental branch therefore installs its own .githooks and guardrails.sh for all worktrees. Use guardrails_repo_root as the source, or log the source path so the operator sees which branch supplied the hooks.

♻️ Proposed change
-  checkout_root="$(guardrails_current_checkout)"
+  checkout_root="$(guardrails_repo_root)"
   common_git_dir="$(git rev-parse --path-format=absolute --git-common-dir)"
   install_dir="${common_git_dir}/openfindata-hooks"
   source_hooks="${checkout_root}/.githooks"

The copy model also means the installed hooks become stale after a pull that changes .githooks/* or scripts/git/guardrails.sh. That risk is already covered by the guideline that requires bash scripts/git/install-hooks.sh after such a pull. As per coding guidelines: "After a pull or merge that changes .githooks/* or scripts/git/guardrails.sh, run bash scripts/git/install-hooks.sh before relying on local hooks."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/git/guardrails.sh` around lines 282 - 286, Update the hook source
selection near guardrails_current_checkout so installation copies from
guardrails_repo_root, while retaining common_git_dir for the shared install
destination. Ensure source_hooks resolves to the repository root’s .githooks
directory rather than the active worktree.

Source: Coding guidelines


292-297: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Copy every hook in .githooks and clear stale files.

The installer copies three fixed names. If a hook is added to .githooks/, the installer silently skips it. If a hook is removed from .githooks/, the stale copy stays in install_dir and keeps running. A loop over the source directory fixes both cases.

♻️ Proposed change
-  mkdir -p "$install_dir"
-  cp "${source_hooks}/pre-commit" "${install_dir}/pre-commit"
-  cp "${source_hooks}/pre-push" "${install_dir}/pre-push"
-  cp "${source_hooks}/post-checkout" "${install_dir}/post-checkout"
-  cp "${checkout_root}/scripts/git/guardrails.sh" "${install_dir}/guardrails.sh"
-  chmod +x "${install_dir}/pre-commit" "${install_dir}/pre-push" "${install_dir}/post-checkout" "${install_dir}/guardrails.sh"
+  rm -rf "$install_dir"
+  mkdir -p "$install_dir"
+  local hook
+  for hook in "${source_hooks}"/*; do
+    [[ -f "$hook" ]] || continue
+    cp "$hook" "${install_dir}/$(basename "$hook")"
+  done
+  cp "${checkout_root}/scripts/git/guardrails.sh" "${install_dir}/guardrails.sh"
+  chmod +x "${install_dir}"/*
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/git/guardrails.sh` around lines 292 - 297, Update the installer
around install_dir setup to remove stale hook files and copy every hook from
source_hooks dynamically, replacing the three fixed cp commands. Preserve
installation of guardrails.sh and its executable permissions, while ensuring
hooks removed from .githooks no longer remain active.
docs/agents/orientation.md (1)

26-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the approximate tool count from the orientation pointer.

docs/MCP_SURFACE.md is the canonical catalog. The ~25 tools claim can become stale when the curated surface changes. Refer to the curated catalog without embedding a count.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/agents/orientation.md` at line 26, Update the orientation table entry
for MCP in docs/agents/orientation.md to remove the approximate “~25 tools”
count while still directing readers to the curated mcp_app catalog and
docs/MCP_SURFACE.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/mcp-trust-reviewer/SKILL.md:
- Around line 31-38: Update the “Limites duros” section of the
mcp-trust-reviewer skill to explicitly prohibit executing repository-controlled
code, including tests, hooks, scripts, MCP servers, and networked commands, as
well as triggering side effects. Keep the reviewer inspection-only unless an
isolated verification procedure is explicitly defined.

In `@CLAUDE.md`:
- Around line 76-78: Define one worktree-aware Python environment contract
across the documentation: in CLAUDE.md (lines 76-78), document the supported
worktree-local then shared-root .venv fallback and interpreter resolution; in
AGENTS.md (lines 43-49), update the expanded gate to use that same resolver as
scripts/ship/preflight.sh; and in docs/agents/quality.md (lines 16-20), make the
expanded commands executable under the documented setup, including when only the
shared root environment exists.

In `@CONTRIBUTING.md`:
- Around line 15-16: Reconcile the branch naming guidance in CONTRIBUTING.md:
update the worktree example and the branch-name table to use only
claude/<feature-slug>, cursor/<feature-slug>, or codex/<feature-slug>, or
explicitly state that the broader feature/<slug> and fix/<slug> patterns apply
only to non-agent branches. Keep all documented examples and rules consistent.

In `@docs/agents/domain.md`:
- Around line 18-19: Update the missing-file handling guidance in
docs/agents/domain.md so absent required security documents such as
SOURCES_WITH_AUTH.md and MCP_SURFACE.md stop processing with a named
MISSING_REFERENCE result. Preserve canonical-source fallback only for optional
notes, and do not silently skip missing security-sensitive references.

In `@docs/agents/openfindata-ship/README.md`:
- Around line 17-18: Update the helper references in the README entries for
scripts/readiness.sh and scripts/check-pr-threads.sh to use
repository-root-relative paths including docs/agents/openfindata-ship/, while
preserving their existing descriptions.

In `@docs/agents/openfindata-ship/scripts/check-pr-threads.sh`:
- Around line 9-17: Update the REPO_SLUG validation case before OWNER and NAME
extraction to accept only exactly one slash with non-empty owner and repository
components. Reject values with no slash, multiple slashes, or leading/trailing
slashes, while preserving the existing invalid-slug error and exit behavior.

In `@docs/agents/openfindata-ship/scripts/readiness.sh`:
- Around line 13-14: Update the root-checkout detection in the readiness script
to compare the absolute Git directory and absolute common Git directory returned
by git metadata, rather than testing whether .git is a directory. Use this
comparison for the related shipping guard so the primary checkout is always
treated as inspection-only, including when .git is a file.

---

Nitpick comments:
In @.githooks/post-checkout:
- Line 15: Update the post-checkout hook around guardrails_warn_post_checkout to
accept Git’s third hook argument and invoke the warning only when that flag
equals 1, suppressing warnings for file checkouts and worktree operations.

In `@docs/agents/orientation.md`:
- Line 26: Update the orientation table entry for MCP in
docs/agents/orientation.md to remove the approximate “~25 tools” count while
still directing readers to the curated mcp_app catalog and docs/MCP_SURFACE.md.

In `@scripts/git/guardrails.sh`:
- Around line 236-247: Update the staged-file handling around
guardrails_staged_py_files to read paths into a Bash array using a NUL
delimiter, preserving filenames containing spaces. Use the array when invoking
both ruff check and ruff format --check, while retaining the no-files skip
behavior.
- Around line 282-286: Update the hook source selection near
guardrails_current_checkout so installation copies from guardrails_repo_root,
while retaining common_git_dir for the shared install destination. Ensure
source_hooks resolves to the repository root’s .githooks directory rather than
the active worktree.
- Around line 292-297: Update the installer around install_dir setup to remove
stale hook files and copy every hook from source_hooks dynamically, replacing
the three fixed cp commands. Preserve installation of guardrails.sh and its
executable permissions, while ensuring hooks removed from .githooks no longer
remain active.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a5195df4-bc70-4ff1-afb7-a52933cf1210

📥 Commits

Reviewing files that changed from the base of the PR and between 3f17e03 and 0db4e92.

📒 Files selected for processing (18)
  • .claude/skills/mcp-trust-reviewer/SKILL.md
  • .githooks/post-checkout
  • .githooks/pre-commit
  • .githooks/pre-push
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • docs/agents/domain.md
  • docs/agents/mcp-trust-review.md
  • docs/agents/openfindata-ship/README.md
  • docs/agents/openfindata-ship/SKILL.md
  • docs/agents/openfindata-ship/scripts/check-pr-threads.sh
  • docs/agents/openfindata-ship/scripts/readiness.sh
  • docs/agents/orientation.md
  • docs/agents/quality.md
  • scripts/git/guardrails.sh
  • scripts/git/install-hooks.sh
  • scripts/ship/preflight.sh

Comment thread .claude/skills/mcp-trust-reviewer/SKILL.md
Comment thread CLAUDE.md Outdated
Comment thread CONTRIBUTING.md
Comment thread docs/agents/domain.md Outdated
Comment thread docs/agents/openfindata-ship/README.md Outdated
Comment thread docs/agents/openfindata-ship/scripts/check-pr-threads.sh Outdated
Comment thread docs/agents/openfindata-ship/scripts/readiness.sh Outdated
Tighten MCP trust reviewer isolation, root-checkout detection, PR slug
validation, and docs contracts for worktrees/venv/branch policy.

Co-authored-by: Cursor <cursoragent@cursor.com>
@robertoecf
robertoecf merged commit 4c83914 into main Aug 10, 2026
7 checks passed
@robertoecf
robertoecf deleted the claude/agent-quality-workflows branch August 10, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant