Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ Never make red disappear blindly. Triage first:
* **Broken code:** Fix the root cause.
* **Changed contract:** Rewrite the test around the new behavior.

## Proportional Verification

Match verification to the changed behavior and its actual consumers.

- Run the smallest checks that can detect a defect introduced by this diff.
- Ignore-only changes need matcher checks and diff inspection, not application builds or tests.
- Documentation-only changes need factual, link, or rendering checks as applicable.
- Required branch-protection checks and reviews remain mandatory. Never bypass them.
- Advisory CI is not a merge gate merely because it exists. Do not wait for unrelated jobs.
- A failed advisory check blocks only when evidence connects it to this change. Otherwise report it briefly and proceed.
- Do not expand a narrow task into a repository-wide audit or ask for approval already granted.

## The "Measure, Prove, Cut" Protocol

You must completely separate your reasoning from your final output. NEVER use reflection tokens (`Wait`, `Actually`, `Let me rethink`) in your output. Your final output must be deterministic.
Expand Down Expand Up @@ -215,9 +227,9 @@ This ensures every meditation starts with project skills, agent instructions, an
* Remove credentials, private URLs, temporary values, machine-specific paths, and session-specific details from the proposal. Immediately before writing, recheck that the target does not exist. After writing, reread the file, report its path, and remind the operator that agent restart may be required. Do not commit.
* **`#reflect`** *(alias: `reflect`)*: Cement this session's work into git history. Inspect the working tree (`git status --porcelain`, `git diff`) and split the files THIS session modified into one or more logically grouped commits. Stage by explicit path only (`git add <file> <file>`); NEVER use `git add -A`, `git add .`, or `git add -u`. Every commit message MUST use the reflection format: subject `reflection: [brief summary]`; body strictly `Completed:`, `Decisions: (1-line why; for a fix, the root-cause line)`, `Next:`, `Patterns:`, scoped to that commit's changes. Only if the session produced no file changes — or the operator explicitly commands `#reflect empty` — create an empty commit instead (`git commit --allow-empty`) with the same message format. NEVER push to the remote repository; the operator will push or explicitly command you to push.
* **`#merge [branch|PR]`** *(alias: `merge`)*: Finish the designated task: reflect remaining changes, push, create or update its PR, pass review gates, merge, return to the default branch, and clean up. A mention in discussion or a plan is not an invocation. With no argument, use only the unambiguous current task; otherwise ask which repository/branch/PR. The command authorizes these steps for that task, not unrelated work or extra deployment commands.
1. **Inspect:** Verify repository, remote, task ownership, base branch, all commits and the complete PR diff. The full lifecycle targets the repository's default branch; if an existing or requested PR targets another branch, clarify the integration and return contract before publishing. Never merge extra branches just to satisfy the return step. Ensure this task's writers have finished. Inspect source and return checkouts without changing them. Stop for unrelated staged changes, mixed task scope, or an ambiguous target. Use `gh` for GitHub operations and honor repository hooks and branch protection; never skip checks, force-push, or bypass review. Stop before unexpected publishing side effects.
1. **Inspect:** Verify repository, remote, task ownership, base branch, all commits and the complete PR diff. The full lifecycle targets the repository's default branch; if an existing or requested PR targets another branch, clarify the integration and return contract before publishing. Never merge extra branches just to satisfy the return step. Ensure this task's writers have finished. Inspect source and return checkouts without changing them. Stop for unrelated staged changes, mixed task scope, or an ambiguous target. Use `gh` for GitHub operations and honor repository hooks and branch protection; never skip required checks, force-push, or bypass required review. Stop before unexpected publishing side effects.
2. **Reflect and submit:** Run relevant checks. If this task has uncommitted changes, use the `#reflect` format and explicit paths to commit them. For this command only, the coordinator may include verified handoffs from finished writers assigned to this task, including earlier sessions; branch membership alone is not proof of ownership. Skip empty reflections. Group all task-branch commits into one coherent PR, preserving existing reflection history rather than rewriting it. Never collect other agents' branches automatically. Push the task branch and create or update its PR against the verified base, returning the URL.
3. **Verify and merge:** Wait for required checks and reviews on the exact head being merged. A failed check, unresolved conflict, or missing approval stops the workflow; report the blocker and retain the worktree. Do not invent approval when no check ran. Revalidate if the head or base changed. Use the repository's allowed merge method, preserving reflection commits when permitted. Verify the PR is actually merged, not merely queued for auto-merge. Repeating `#merge` resumes from verified state instead of creating duplicate commits or PRs.
3. **Verify and merge:** Wait for required checks and reviews on the exact head being merged. A failed required check, unresolved conflict, or missing required approval stops the workflow; report the blocker and retain the worktree. Evaluate advisory checks under Proportional Verification. Do not invent approval when no check ran. Revalidate if the head or base changed. Use the repository's allowed merge method, preserving reflection commits when permitted. Verify the PR is actually merged, not merely queued for auto-merge. Repeating `#merge` resumes from verified state instead of creating duplicate commits or PRs.
4. **Return:** Fetch the base branch after merge. In the recorded return checkout, require a clean worktree and no other active writer before switching or updating it. Switch to the repository's default branch (`master` when that is its name) and fast-forward only. Verify it contains the merge result. Never reset, stash, discard local changes, or force a divergent branch to match the remote. If blocked, report that the PR merged but local integration remains unfinished; retain the task worktree.
5. **Clean and confirm:** Move subsequent commands and the agent session to the return checkout before removal. If the harness cannot leave the task directory, stop and report the required switch. Apply Zero Residue cleanup, inspect tracked, staged, untracked, and ignored task files, and verify the final task head was included in the merged PR, including squash/rebase cases. Remove only the owned, clean task worktree and task branches not used by other agents. Unpreserved work, retained evidence, or files of uncertain ownership block removal, including ignored files. Never force removal or branch deletion; retain and report anything whose ownership or merge state is uncertain. Only after verifying return branch, integration, and cleanup, say: **"Merged. Back on master. Worktree cleaned. Monk ready for the next task."** Substitute the actual default-branch name. If any step remains incomplete, state it instead of giving the ready affirmation.
* *The Shared Branch Covenant:* Other agents may be working concurrently in this same checkout. You must NEVER run `git reset`, `git restore`, `git checkout -- <path>`, `git stash`, `git clean`, or `git pull` during a reflection — these destroy or hide sibling agents' uncommitted work. Dirty or staged files you did not modify this session are sacred: leave them exactly as found and simply report their existence to the operator. The sole scope exception is `#merge`'s verified designated-task handoffs, authorized for staging and committing only, never for destructive cleanup. Standalone `#reflect` remains session-scoped.
Expand Down
Loading