Skip to content

chore: Claude-first setup#2783

Merged
mmagician merged 21 commits into
nextfrom
mmagician-claude-setup
May 13, 2026
Merged

chore: Claude-first setup#2783
mmagician merged 21 commits into
nextfrom
mmagician-claude-setup

Conversation

@mmagician
Copy link
Copy Markdown
Collaborator

@mmagician mmagician commented Apr 16, 2026

Desired workflow:

  1. Point Claude at an issue, ask it to create a PR to address it
  2. Plan
  3. Once plan is approved, Claude works on the implementation
  4. Before a commit, executes a hook to make lint
  5. Before push:
  • runs make test
  • runs two review agents; if any agent comes back with findings, main agent fixes these
  1. Before creating PR, ensures the PR is being created in --draft mode
  2. After PR is created, checks if CHANGELOG.md exists; if yes, proceeds; if not, determines whether it should add an entry or a no changelog label - the main agent takes care of this.
  3. PR author manually reviews the PR; if all looks good, he requests reviews from peers; else explains to Claude what should change and codifies this as skill/hook, so that next time Claude doesn't make the same mistake. As you can see from the commit history, I've had a few iterations on this, but at the end this resulting PR is basically one-shotted. We should aim at one-shoting 95% of our PRs (and 5% would result in skills/hooks being updated).
  4. Peers/code owners review the PR. As with the previous point, requested changes (patterns/standards/Miden-specific practices) should be codified.

The goal is to codify our shared knowledge into a set of actionable artifacts.

TODOs:

mmagician and others added 17 commits April 14, 2026 10:15
- Stop forcing reviewers to fabricate findings; nits/notes are advisory
- Require explicit APPROVE:/CLEAN: verdict (not just absence of BLOCK:)
- Use repo root in lint/test hooks so they work from subdirectories
- Add branch guards to rebase agent (skip protected branches)
- Pass --allowedTools to review agents for Bash/Read access
- Add per-project lessons link to CLAUDE.md
- Remove dangling .claude/skills symlink

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

fix: CI monitor needs --allowedTools and effort: medium to actually execute
@mmagician mmagician added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Apr 16, 2026
claude and others added 2 commits April 16, 2026 12:19
Adds a PostToolUse hook that fires after PR creation and spawns a
changelog-manager agent to classify the diff. The agent determines
whether a CHANGELOG.md entry or "no changelog" label is needed, and
feeds actionable instructions back to the main agent via exit code 2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mmagician mmagician added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Apr 16, 2026
* Improve Claude setup based on NTL battle-testing

Consolidated pre-push hook:
- Merged pre-push-test.sh into pre-push-review.sh (tests run first,
  then reviewers only if tests pass - saves reviewer tokens on broken code)
- Severity-based blocking: nits and notes don't block push, only
  Critical/Important/Warning findings do
- Proper diff base resolution: tries upstream, falls back to default
  branch via gh, then HEAD~1
- Handles reviewer crashes gracefully (empty/malformed output = block)
- Escape hatch: SKIP_PRE_PUSH=1

Input guards on all hooks:
- Each hook validates the command matches before acting (defense in depth
  against settings.json filter regressions)

Improved settings.json:
- Removed separate pre-push-test.sh entry (now in pre-push-review.sh)
- Added proper `if` filter on pre-pr-draft.sh (was firing on all Bash)
- Removed post-pr-create-ci-monitor.sh (superseded)

Lessons system:
- Added .claude/lessons.md for codifying review feedback
- Added .claude/commands/codify-lesson.md slash command
- Updated CLAUDE.md to reference in-repo lessons file instead of
  global ~/.claude path

Agent improvements:
- Code reviewer and security reviewer use gh-based default branch
  resolution instead of hardcoded branch names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address review: remove guards, split hooks, drop lessons

- Remove input guards from all hooks (boilerplate, unclear value)
- Restore pre-push-test.sh as separate hook (keep tests and reviews
  conceptually separate per review feedback)
- Remove lessons.md and codify-lesson.md (use SKILLS.md instead)
- Revert CLAUDE.md lessons reference
- Keep: severity-based blocking, diff base resolution, crash handling,
  proper if filters, agent branch resolution via gh

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Adding new lines at the end of the file

* Removing unecessary code from post-pr-create-changelog.sh

* removing code from pre-pr-draft.sh

* remove escape hatch from pre-pr-draft.sh

* simplifying pre-pr-draft.sh

* removing escape hatch and default org repo from pre-push-review.sh

---------

Co-authored-by: Claude (Opus) <noreply@anthropic.com>
@mmagician mmagician marked this pull request as ready for review May 12, 2026 16:19
Copy link
Copy Markdown
Contributor

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

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

Looks good to me, like a very detailed plan of what I'd write in plan mode. Agents are cool, but updating anything related to claude setup is very difficult.

A few things I noticed while using this:

  1. I've noticed after using this setup, is that when running it, my machine M4 pro mac runs very hot because I think a lot of time is spent running cargo build & cargo test related commands. Maybe its because I had a couple agents working at once? In my normal workflow pre claude code, I would just run make test and this would catch most issues. Maybe we need to update the setup so that claude code knows to run make test as opposed to other cargo X commands.

  2. Its difficult to update the hooks since some of the changes to the hooks are not allowed by the classifier model. Ideally its easy to update the hooks, CLAUDE.md, and agent skills inside of a PR, so that over time the claude setup gets better over time.

Overall I think the setup is good. It one shotted this PR after a deep design / planning session: #2912

@mmagician mmagician added this pull request to the merge queue May 13, 2026
@mmagician
Copy link
Copy Markdown
Collaborator Author

Its difficult to update the hooks since some of the changes to the hooks are not allowed by the classifier model.

Can you elaborate @partylikeits1983 ? I'm not sure I understand

Merged via the queue into next with commit 025bb2a May 13, 2026
18 checks passed
@mmagician mmagician deleted the mmagician-claude-setup branch May 13, 2026 05:43
@partylikeits1983
Copy link
Copy Markdown
Contributor

Can you elaborate @partylikeits1983 ? I'm not sure I understand

The difficulty is that say you want to use claude code to update the hooks or agents. Claude code really makes it hard to do because in the rules it says to not update the hooks or agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants