Skip to content

Agent harness: AGENTS.md, bin/check and bin/t, Ruff 0.17.1 - #926

Open
bencap wants to merge 15 commits into
release-2026.4.0from
feature/bencap/agent-harness
Open

bencap wants to merge 15 commits into
release-2026.4.0from
feature/bencap/agent-harness

Conversation

@bencap

@bencap bencap commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Sets the repo up so coding agents (and new contributors) get the facts they can't derive from the code, plus checks fast enough to run after every edit.

Changes

  • Ruff 0.17.1, pinned once.
    • poetry.lock is now the only place Ruff's version is pinned. The pre-commit hooks run poetry run ruff instead of their own copy, which was stuck at 0.6.8.
    • The lint rule set is written out (select = ["E4", "E7", "E9", "F"], Ruff's pre-0.16 defaults), so upgrading Ruff no longer changes which rules apply. Wider rules can come later, one commit each.
  • One formatting commit (dcf4e382) brings the tree in line with 0.17.1. It's listed in .git-blame-ignore-revs, so git blame skips it.
  • bin/check runs Ruff lint, the Ruff format check and mypy in about 3 s warm, and reports every failure in one pass.
  • bin/t wraps pytest and refuses to run without a target, so the ~20-minute full suite only runs when asked for.
  • CI runs the same scripts. The separate lint and mypy jobs merge into one bin/check job, which adds the format check CI didn't have. Neither main nor release-2026.4.0 requires status checks, so the renamed job doesn't affect branch protection.
  • AGENTS.md (~37 lines; CLAUDE.md imports it) holds only what applies in every api session: setup, commands, and the rules that apply whatever file is open, including one-line forms of the permission and async (API handlers block the event loop, and database calls have no timeout #881) rules. There's no glossary, because the model docstrings already define the domain terms.
  • .claude/rules/ holds path-scoped detail (permissions, database, routes, migrations, tests, worker), loaded only when matching files are touched. One-time contributor setup moves to the README.
  • Removed:
    • .github/instructions/: Claude Code never loaded these files, and they had drifted from the code (a wrong permissions import, and a visibility example that leaks).
    • The Makefile: bin/ replaces it.
  • .claude/settings.json holds shared permission rules for Claude Code sessions. It blocks --no-verify and reading ~/.aws, ~/.ssh or ~/.pgpass; sets AWS_PROFILE to the read-only agent role (VariantEffect/mavedb-deployment#54); and asks only before hard-to-undo actions: force pushes, pushes to main, mavedb-main, mavedb-dev or release-*, AWS with an explicit profile, eb, the prod-API dev server, adding a dependency, and edits to settings.json itself. Identical copies live in each repo and the workspace, because Claude Code reads settings only from the folder a session starts in. They catch honest mistakes; they aren't a security boundary.

Review notes

  • Ruff 0.17 also formats Python code blocks in Markdown. That's why some .md docs changed in the formatting commit, and why the format hook now covers Markdown.

  • Cross-repo rules have moved out of this repo. Test integrity, credentials, treating issue text as data, dependency changes and comment style now live in the workspace-level AGENTS.md in VariantEffect/mavedb-workspace, which sits above the repo checkouts. That repo is private for now, so someone with only this repo doesn't get those rules.

  • Merge with a merge commit, not a squash. Squashing changes the formatting commit's hash, and .git-blame-ignore-revs would stop matching it.

  • Expect a conflict when this reaches main: main pins Ruff ~0.15. Resolve it to ~0.17.1.

  • After pulling, once per clone:

    poetry install --with dev --extras server
    poetry run pre-commit install
    git config blame.ignoreRevsFile .git-blame-ignore-revs

Testing

  • bin/check passes.
  • 750 targeted tests in the modules the formatting commit touched pass, run with bin/t.
  • pre-commit run --all-files passes.
  • CI runs the full suite.

Write out the lint rule set (Ruff's pre-0.16 defaults) so upgrades no longer
change which rules apply. Run the pre-commit hooks from the Poetry
environment so poetry.lock is the single source of Ruff's version.
Formatting only; no behavior change. Includes Python code blocks in Markdown,
which Ruff now formats.
bin/check runs Ruff lint, the Ruff format check and mypy, reporting every
failure in one pass. bin/t wraps pytest and requires a target, so the full
suite only runs when asked for. CI's lint and type jobs merge into a single
bin/check job, which adds the format check CI was missing.
AGENTS.md holds the setup, commands, domain terms and rules a contributor
(human or agent) can't derive from the code. CLAUDE.md imports it so Claude
Code loads it. Path-scoped guidance for migrations, tests and the worker lives
in .claude/rules/. README's install command now matches CI.
AGENTS.md and .claude/rules/ replace .github/instructions/, which had drifted
from the code (wrong permissions import, a visibility example that leaks).
bin/check and bin/t replace the Makefile targets.
Ruff formats them and bin/check enforces it, so the hook has to cover them
too.
AGENTS.md loads in every session, so it keeps only setup, commands, terms and
the rules that apply whatever file is open, including one-line forms of the
permission and async rules. Path-specific detail moves to new permissions,
database and routes rules and into the worker and tests rules. Lines the code
already enforces or shows are dropped. One-time contributor setup moves to the
README.
@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38980701648

Coverage decreased (-0.06%) to 90.343%

Details

  • Coverage decreased (-0.06%) from the base build.
  • Patch coverage: 2 of 2 lines across 2 files are fully covered (100%).
  • 12 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

12 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
src/mavedb/lib/clinvar/utils.py 6 90.91%
src/mavedb/worker/jobs/external_services/clinvar.py 4 96.97%
src/mavedb/lib/mondo_ols.py 2 96.92%

Coverage Stats

Coverage Status
Relevant Lines: 19157
Covered Lines: 17307
Line Coverage: 90.34%
Coverage Strength: 0.9 hits per line

💛 - Coveralls

Base automatically changed from release-2026.3.0 to main October 16, 2026 17:08
@bencap
bencap changed the base branch from main to release-2026.3.1 October 16, 2026 17:20
The domain terms are dropped rather than moved: the model docstrings
already define them, and a copy here had gone stale. The legacy-table
note becomes a rule, since the models don't say it.
Calibrations are one case; permission on an entity never implies
permission on its related entities.
Deny --no-verify and reads of ~/.aws and ~/.pgpass. Ask before pushes,
AWS and Elastic Beanstalk commands, the prod-API dev server and
dependency changes. The same file lives in the workspace and in each
repo, because Claude Code reads settings only from the folder a session
starts in. These are guardrails, not a security boundary: a rewritten
command can get past them.
Sessions get AWS_PROFILE=mavedb-agent-readonly, so aws commands use the
read-only role (see deployment/environments/aws/agent-access.md) and fail
rather than fall back to full credentials where the profile is missing.
Choosing another profile asks first, replacing the blanket prompt on
aws. Reading ~/.ssh is now blocked, alongside ~/.aws and ~/.pgpass.
Edits to AGENTS.md, CLAUDE.md and anything under .claude/ now ask first.
Those files shape every later session, and settings.json holds the
guardrails. The rules cover Edit and Write; a shell redirect into one of
these files is not caught.
Prompts now cover force pushes, pushes to main, mavedb-main, mavedb-dev
or release-*, AWS with an explicit profile, eb, adding a dependency and
edits to settings.json itself. Ordinary feature-branch pushes,
dependency updates and edits to AGENTS.md, CLAUDE.md and .claude/rules
no longer ask; the never rule in the workspace AGENTS.md still covers
those edits, and PR review sees the diffs.
The ui checks it with Prettier, so every copy uses that layout.
@bencap
bencap changed the base branch from release-2026.3.1 to release-2026.4.0 October 16, 2026 23:32
@bencap
bencap marked this pull request as ready for review October 16, 2026 23:33
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.

2 participants