Skip to content

docs: add mandatory branch/PR workflow rules#1

Merged
shaypal5 merged 4 commits intomainfrom
docs/add-branch-pr-workflow
Apr 18, 2026
Merged

docs: add mandatory branch/PR workflow rules#1
shaypal5 merged 4 commits intomainfrom
docs/add-branch-pr-workflow

Conversation

@shaypal5
Copy link
Copy Markdown
Contributor

Summary

  • Adds a Branch & PR Workflow section to CLAUDE.md as the first section (before all other rules), locking the rule that no work goes directly to main
  • Installs .git/hooks/pre-push to mechanically block any push targeting main, regardless of who or what triggers it
  • Updates .agent-plan.md to reflect that these workflow rules are now locked

Workflow rules locked

  1. git checkout main && git pull before starting any work
  2. git checkout -b <descriptive-branch-name> — always branch from latest main
  3. Commit work to the branch
  4. Update .agent-plan.md to reflect state after the PR merges; commit to same branch
  5. Open a PR on GitHub with a detailed description — never push to main directly

Enforcement layers

Layer Mechanism
Primary CLAUDE.md — read by Claude at session start
Secondary Agent memory (feedback entry)
Mechanical .git/hooks/pre-push — blocks push to main at git level

🤖 Generated with Claude Code

Locks the rule that no work goes directly to main. Every unit of work
must branch from latest main, commit there, update .agent-plan.md in
the same PR, and open a GitHub PR. Also installs a git pre-push hook
(.git/hooks/pre-push) that mechanically blocks any push targeting main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit “Branch & PR Workflow” rules to the repo’s agent-facing documentation and updates the agent plan to reflect the new workflow constraints.

Changes:

  • Adds a mandatory Branch & PR Workflow section at the top of CLAUDE.md.
  • Updates .agent-plan.md current-state text to mention the workflow rules and their enforcement.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
CLAUDE.md Documents mandatory branching/PR workflow rules, including “never push to main”.
.agent-plan.md Updates current system state to reference the new workflow rules and claimed enforcement mechanism.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .agent-plan.md Outdated
Comment thread CLAUDE.md Outdated
shaypal5 and others added 2 commits April 18, 2026 09:30
Extends the branch/PR workflow in CLAUDE.md with two required steps:
apply labels (type + layer taxonomy) and assign to a milestone. Adds
the full label taxonomy and a milestone map table to CLAUDE.md.

GitHub side: creates 22 labels across type/layer/status groups and
6 milestones (v0.1.0 through v1.0.0) matching the roadmap release gates.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Integrates shaypal5/pr-agent-context@v4 with two workflows:

- .github/workflows/pr-agent-context.yml
  Runs on pull_request (opened/synchronize/reopened). Calls the
  reusable workflow in ci mode with publish_mode=append and
  include_outdated_review_threads=true so stale-but-unresolved
  threads always appear in the generated agent context comment.
  Coverage artifacts are collected under the pr-agent-context-coverage
  prefix for use by the refresh flow via cross-run lookup.

- .github/workflows/pr-agent-context-refresh.yml
  Triggered by pull_request_review, pull_request_review_comment, and
  completed non-Actions check_run events. Runs in refresh mode with
  publish_mode=append (new comment per refresh, previous managed
  comments hidden), wait_for_reviews_to_settle=true, and
  enable_cross_run_coverage_lookup=true to reuse coverage artifacts
  from the CI run on the same head SHA.

Both workflows explicitly set include_outdated_review_threads=true
per project configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 18, 2026 06:41
@shaypal5 shaypal5 added the type: ci CI/CD pipeline changes label Apr 18, 2026
@github-actions

This comment has been minimized.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/pr-agent-context.yml
Comment thread .github/workflows/pr-agent-context-refresh.yml
@github-actions

This comment has been minimized.

- CLAUDE.md: scope the force-push prohibition to `main` explicitly
  (`git push --force origin main`) and add a note clarifying that the
  local pre-push hook is a personal convenience, not a versioned
  repo-wide enforcement; GitHub branch protection is the team-level guard
- .agent-plan.md: correct state description to say "local convenience hook
  (not versioned) and GitHub branch protection" instead of implying the
  hook is a reliable repo-wide mechanism

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

pr-agent-context report:

This run includes unresolved review comments on PR #1.

For each unresolved review comment, recommend one of: resolve as irrelevant, accept and implement
the recommended solution, open a separate issue and resolve as out-of-scope for this PR, accept and
implement a different solution, or resolve as already treated by the code.

After I reply with my decision per item, implement the accepted actions, resolve the corresponding
PR comments, and push all of these changes in a single commit.

# Copilot Comments

## COPILOT-1
Location: .agent-plan.md
URL: https://github.com/leadforge-dev/leadforge/pull/1#discussion_r3104702550
Status: outdated
Root author: copilot-pull-request-reviewer

Comment:
    The statement that the workflow is “enforced via `.git/hooks/pre-push`” is misleading/inaccurate in a repo context: `.git/hooks` isn’t versioned/cloned for other developers, and this PR doesn’t add any tracked hook script that would be installed automatically. Consider replacing this with a versioned hooks directory (and documented `core.hooksPath` setup), or describing enforcement via GitHub branch protection/CI checks instead of `.git/hooks`.

## COPILOT-2
Location: CLAUDE.md
URL: https://github.com/leadforge-dev/leadforge/pull/1#discussion_r3104702559
Status: outdated
Root author: copilot-pull-request-reviewer

Comment:
    The examples list `git push --force` without specifying `main`, but the sentence is about commands that target `main` directly. As written, it can be read as banning force-pushes to any branch; if the intent is only to block pushes to `main`, consider tightening the wording/examples to explicitly include `main` (or split into two rules: no pushes to `main`, and separate guidance on force-push usage).
    ~~~suggestion
    Never use `git push origin main`, `git push --force origin main`, or any variant that targets `main` directly.
    ~~~

## COPILOT-3
Location: .github/workflows/pr-agent-context.yml:14
URL: https://github.com/leadforge-dev/leadforge/pull/1#discussion_r3104738699
Root author: copilot-pull-request-reviewer

Comment:
    This workflow calls a third-party reusable workflow pinned only to the `v4` tag. For supply-chain security and reproducibility, pin `uses:` to an immutable commit SHA (and optionally keep a comment noting the corresponding release tag).
    ~~~suggestion
        uses: shaypal5/pr-agent-context/.github/workflows/pr-agent-context.yml@<FULL_40_CHAR_COMMIT_SHA_FOR_V4> # v4
    ~~~

## COPILOT-4
Location: .github/workflows/pr-agent-context-refresh.yml:39
URL: https://github.com/leadforge-dev/leadforge/pull/1#discussion_r3104738714
Root author: copilot-pull-request-reviewer

Comment:
    This workflow calls a third-party reusable workflow pinned only to the `v4` tag. For supply-chain security and reproducibility, pin `uses:` to an immutable commit SHA (and optionally keep a comment noting the corresponding release tag).
    ~~~suggestion
        uses: shaypal5/pr-agent-context/.github/workflows/pr-agent-context.yml@<FULL_40_CHAR_COMMIT_SHA_FOR_V4> # v4
    ~~~

Run metadata:

Tool ref: v4
Tool version: 4.0.18
Trigger: commit pushed
Workflow run: 24599246501 attempt 1
Comment timestamp: 2026-04-18T06:52:54.524480+00:00
PR head commit: 270394b4d26bf28533e751aa2aa093c1991ff912

@shaypal5 shaypal5 merged commit 878dd58 into main Apr 18, 2026
1 check passed
@shaypal5 shaypal5 deleted the docs/add-branch-pr-workflow branch April 18, 2026 06:56
shaypal5 added a commit that referenced this pull request May 1, 2026
Review feedback addressed:

- Remove primary_task/label_window_days as explicit kwargs from
  resolve_config() and Generator.from_recipe() — these fields are
  resolved from recipe YAML and override dict only, not casually
  overridable, since the generation pipeline doesn't yet support
  arbitrary task types (Copilot-1, Copilot-3, shaypal5 #1, #2)
- Add label_window_days <= horizon_days validation in
  GenerationConfig.__post_init__ (Copilot-2, shaypal5 #3)
- Add tests for invalid primary_task on GenerationConfig: empty
  string, non-string type (shaypal5 #6, pr-agent-context)
- Add tests for invalid label_window_days on Recipe.from_dict: bool,
  non-positive, float (shaypal5 #7, pr-agent-context)
- Add test for label_window_days > horizon_days rejection
- Fix existing test using horizon_days=30 (now conflicts with default
  label_window_days=90)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shaypal5 added a commit that referenced this pull request May 1, 2026
* feat: carry primary_task and label_window_days into WorldSpec for dataset card

Add `primary_task` and `label_window_days` fields to `GenerationConfig`
(with defaults preserving current behavior). Propagate through
`Recipe.from_dict()`, `resolve_config()`, and `Generator.from_recipe()`
so recipe YAML can override them. Update `render_dataset_card()` to read
from `world_spec.config` instead of hard-coded string literals.

Closes #6

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update .agent-plan.md for WorldSpec task fields (PR #36)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address review feedback — tighten scope, add validation + tests

Review feedback addressed:

- Remove primary_task/label_window_days as explicit kwargs from
  resolve_config() and Generator.from_recipe() — these fields are
  resolved from recipe YAML and override dict only, not casually
  overridable, since the generation pipeline doesn't yet support
  arbitrary task types (Copilot-1, Copilot-3, shaypal5 #1, #2)
- Add label_window_days <= horizon_days validation in
  GenerationConfig.__post_init__ (Copilot-2, shaypal5 #3)
- Add tests for invalid primary_task on GenerationConfig: empty
  string, non-string type (shaypal5 #6, pr-agent-context)
- Add tests for invalid label_window_days on Recipe.from_dict: bool,
  non-positive, float (shaypal5 #7, pr-agent-context)
- Add test for label_window_days > horizon_days rejection
- Fix existing test using horizon_days=30 (now conflicts with default
  label_window_days=90)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

foundation type: ci CI/CD pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants