Skip to content

Ghent analysis/master claude docs#119

Open
JulesVandenbroeck wants to merge 7 commits into
GhentAnalysis/masterfrom
GhentAnalysis/master_claude_docs
Open

Ghent analysis/master claude docs#119
JulesVandenbroeck wants to merge 7 commits into
GhentAnalysis/masterfrom
GhentAnalysis/master_claude_docs

Conversation

@JulesVandenbroeck

Copy link
Copy Markdown
Collaborator

Summary

This PR adds persistent Claude Code context and rules to the columnflow repository, so that any analysis built on columnflow can benefit from consistent, well-informed AI assistance.

What was added

CLAUDE.md (root)

Lean entry point for Claude Code: always-loaded rules, common law run commands, pointer to user docs.

.claude/rules/ — always-loaded rules

File Purpose
01-pipeline.md Task order, 5 TAF types, law.cfg registration
02-invariants.md set_ak_column, uses/produces, imports, Selector return type, MC guard, keep_columns, no loops
linting.md Follow .flake8 while coding; run bash tests/run_linting before pushing; commit fixes as linting fixes
github.md Allowed/forbidden git actions (push/rebase require confirmation; no branch deletion; no direct PR to main)

.claude/rules/ — path-scoped rules (load only for matching files)

File Paths Purpose
selection.md **/selection/** Selector decorator, SelectionResult, stats, sub-selector composition
production.md **/production/** Producer decorator, sub-TAF calls, MC-conditional columns, external files
calibration.md **/calibration/** Calibrator hooks, shift registration
config.md **/config/** Order object hierarchy, required auxiliaries, shift aliases
categorization.md **/categorization/** Categorizer decorator and config registration
histogramming.md **/histogramming/** HistProducer pattern, weight columns, shift declaration
inference.md **/inference/** @inference_model, all three systematic types
custom-tasks.md **/tasks/** Custom law task skeleton and three concrete patterns

docs/columnflow_claude_guide/

Six user-facing documentation files: framework structure, coding style, task commands, awkward-array reference, do's and don'ts, custom task examples.

Test plan

  • Verify .claude/rules/ files load in a new Claude Code session
  • Confirm path-scoped rules only appear when editing files in the matching directory
  • bash tests/run_linting — zero errors
  • python -m unittest tests.test_util tests.test_task_parameters tests.test_base_tasks — all pass

juvanden and others added 7 commits June 24, 2026 11:13
Rewrites and extends the docs/columnflow_claude_guide/ to serve as both
persistent Claude instructions and a proper user guide:

- 01_framework_structure.md: adds "big picture" section explaining why
  columnflow exists, the three pillars (law/order/awkward), a plain-English
  walkthrough of every pipeline step, and annotated config-object examples
  including systematic uncertainty classes

- 03_task_commands.md: rewritten as a per-task user guide with explanations
  of what each task does, its outputs, key parameters, multiple command
  examples, and practical tips for debugging and re-running

- 05_dos_and_donts.md: rewritten for new users with correct/wrong code pairs
  covering set_ak_column usage, vectorized operations, imports, Selector
  return types, keep_columns, law.cfg registration, versioning, and systematics

- 06_custom_tasks.md: new file with full worked examples of writing Selectors
  (object-level, event-level, composed exposed), Producers (features, weights),
  Calibrators with lifecycle hooks, Categorizers, HistProducers, InferenceModels,
  and custom law Tasks; includes common patterns from the hh2bbww analysis

- CLAUDE.md: updated table of contents to include the new 06 guide

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Creates a .claude/rules/ directory following the Claude Code memory spec
(https://code.claude.com/docs/en/memory#organize-rules-with-claude/rules/):

Always-loaded rules (no paths frontmatter):
- 01-pipeline.md: task order, 5 TAF types table, law.cfg module registration
- 02-invariants.md: set_ak_column, uses/produces, maybe_import, Selector return
  type, MC guard, keep_columns, lifecycle hooks, no Python loops over events

Path-scoped rules (load only when Claude works in matching directories):
- selection.md     → **/selection/**
- production.md    → **/production/**
- calibration.md   → **/calibration/**
- config.md        → **/config/**
- categorization.md → **/categorization/**
- histogramming.md → **/histogramming/**
- inference.md     → **/inference/**

All rule files are under 110 lines; CLAUDE.md trimmed to 24 lines.
Rules are condensed from docs/columnflow_claude_guide/ which remains the
full user-facing documentation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds two new .claude/rules/ files:
- custom-tasks.md (path-scoped to tasks/**): patterns for writing custom
  law tasks that extend the columnflow pipeline, with examples for
  histogram-consuming tasks, per-category datacard workflows, and custom
  plot tasks derived from hh2bbww
- linting.md (always-loaded): instructs Claude to run flake8 after writing
  code and fix all errors using the project .flake8 config

Updates CLAUDE.md to reference both new rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .claude/rules/github.md: new always-loaded rule defining what Claude
  is and is not allowed to do with git/GitHub — commits and branch
  creation are allowed freely; push and rebase require confirmation;
  branch/commit deletion is forbidden; PRs must never go directly from
  a feature branch to main (intermediate branch required)
- .claude/rules/linting.md: restructured into "while coding" (follow
  .flake8 rules proactively) vs "before pushing" (run run_linting,
  commit fixes as "linting fixes"); added tests section with sandbox
  and no-sandbox commands
- CLAUDE.md: updated always-loaded rules list to reference both new files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updates .claude/rules/linting.md with accurate CI coverage:
- adds markdown linting (pymarkdown / run_docs lint) and breakpoint check
- adds CI jobs table mapping each job to its script and scope
- adds per-module test table with sandbox requirements and what each covers
- notes test_selectionresults.py is a manual script, not run by run_tests
Updates CLAUDE.md one-liner to mention all three pre-push checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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