Skip to content

docs: wire /brevity into Tide working agreements - #92

Merged
bdchatham merged 1 commit into
mainfrom
feat/brevity-wiring-claude-md
May 31, 2026
Merged

docs: wire /brevity into Tide working agreements#92
bdchatham merged 1 commit into
mainfrom
feat/brevity-wiring-claude-md

Conversation

@bdchatham

@bdchatham bdchatham commented May 31, 2026

Copy link
Copy Markdown
Collaborator

Layer 2 of the staged brevity roll-out (#86#89 → this).

Diff (3 lines)

CLAUDE.md ## Working Agreements gains:

Brevity discipline: Apply /brevity (.claude/skills/brevity/) before writing PR bodies or in-code comments. The skill self-determines floor; agents do not pre-skip.

AGENTS.md ## Working Agreement gains:

Output discipline. Every agent in the roster authors PR descriptions and in-code comments. Before any agent ships a PR body or writes a WHY-style comment, it applies /brevity (.claude/skills/brevity/). The skill's 8 rules + 5-row rationalization table hold against the verbose-by-default biases an LLM agent produces under pressure. The skill self-determines when input is at floor — agents do not pre-skip. Doc/design, runbooks, memory writes, and mid-conversation chat are out of scope for the skill today; see its references/guardrails.md for un-defer triggers.

Why

/brevity (PR #89) handles user-invocation routing via SKILL.md description. But proactive use — agents pre-applying brevity before drafting a PR body, without being asked — requires explicit wiring. Caveman's SessionStart + UserPromptSubmit hook approach was rejected on trust-boundary grounds (#86 coral synthesis). This PR is the cheapest version of proactive wiring: working-agreement references in the two top-level project conventions docs.

Coral cross-review

product-engineer + reviewer reviewed once with two HOLDs:

Finding Severity Fix
design notes widens surface beyond skill's MVP HIGH Cut; explicitly enumerate deferred surfaces with pointer to skill's references/guardrails.md
CLAUDE.md bullet 3× section convention length (60 vs 15-25 words) MEDIUM Compress to one imperative clause matching surrounding bullets
Skip-language reads as get-out-of-jail-free card (from PE) Invert — "skill self-determines floor; agents do not pre-skip"

All addressed. Re-review: both CLEAR.

Follow-ups (tracked durably)

Test plan

  • After merge: dispatch a sub-agent (product-engineer or kubernetes-specialist) to draft a PR body for a fake-but-realistic 5-file refactor. Verify the sub-agent references / applies brevity even though no user phrase like "tighten this" appears.
  • After merge: invoke a council session on a small design; verify the synthesized output doesn't sprawl past the skill's scope.

🤖 Generated with Claude Code

PR #89 landed the brevity skill with user-invocation routing. Layer 2:
proactive use by referencing the skill in Tide's top-level working
agreements so agents apply it without explicit user invocation.

- CLAUDE.md: one bullet under Working Agreements, matching section
  cadence (25 words, imperative).
- AGENTS.md: one paragraph under Working Agreement covering all 15
  agents in the roster. Surface scoped to PR descriptions + in-code
  comments (matches the skill's MVP); deferred surfaces (doc/design,
  runbooks, memory writes, mid-conversation chat) enumerated explicitly
  with a pointer to references/guardrails.md.

Skip language inverted on coral feedback: "The skill self-determines
floor; agents do not pre-skip." Removes the bypassable threshold.

Coral cross-review (product-engineer + reviewer): two HOLD findings
(design-notes scope expansion + bullet length) resolved; cleared.

Follow-ups tracked:
- #90: portable-scrub + sync to user-scope (after 2 real-use cycles)
- #91: persona-line /brevity reference in each .claude/agents/ file
  for sub-agent dispatch coverage

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

cursor Bot commented May 31, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only updates to agent working agreements; no code paths, secrets, or deployment behavior change.

Overview
Documents proactive use of /brevity in the two top-level agent convention files (layer 2 after the skill itself), so roster agents apply it before drafting PR bodies or WHY-style comments without a user nudge.

CLAUDE.md adds a Brevity discipline working-agreement bullet: apply .claude/skills/brevity/ on those outputs; the skill decides floor; agents must not pre-skip.

AGENTS.md adds Output discipline under Working Agreement with the same mandate, plus explicit out-of-scope surfaces (doc/design, runbooks, memory, mid-chat) and a pointer to references/guardrails.md for un-defer triggers.

No runtime, registry, or interface contract changes—policy text only.

Reviewed by Cursor Bugbot for commit 0589794. Bugbot is set up for automated code reviews on this repo. Configure here.

@bdchatham
bdchatham merged commit 0a8c364 into main May 31, 2026
1 check passed
bdchatham added a commit that referenced this pull request Jun 1, 2026
…greement-wired

Pivot per Brandon's "targeted and effective, no bloat" framing.

The original v1 shipped a GitHub Actions workflow + 8 bash scripts +
claude-code-action invocation + state directory + concurrency group + cost
guardrail + self-consistency + anchored marker + hash dedupe + 5-finding cap.
The action failed-closed on its own introduction PR because the Claude Code
App wasn't installed on the repo — the inverse of the suggestive-only intent.

Pivot:

- Drop ALL CI infrastructure
- Agent-invoked + user-invocable, no claude-code-action
- Working-agreement reference in CLAUDE.md + AGENTS.md (same pattern as
  /brevity layer 2; PR #92)

## Final shape (8 files, 393 lines)

  .claude/skills/pr-quality/
  ├── SKILL.md                                 (88 lines)
  ├── references/
  │   ├── rule-registry.md                     (87 — locked v1 set + 2
  │   │                                          mechanical specs inline +
  │   │                                          deferred mechanisms with
  │   │                                          un-defer triggers)
  │   ├── format-spec.md                       (41)
  │   └── judges/
  │       ├── narration_comments.md            (33)
  │       ├── temporary_migration_notes.md     (38)
  │       └── authoritative_voice.md           (33)
  ├── scripts/
  │   ├── scan-yaml-cpu.sh                     (39 — stateful awk, indent
  │   │                                          + parent-block tracking,
  │   │                                          multi-container aware)
  │   └── scan-harbor-ghcr.sh                  (34 — unified-diff state
  │                                              machine)
  └── evals/evals.json                         (happy + halt + pressure)

## Two invocation modes

**Pre-PR (agent-fired)**: before `gh pr create`, agent runs /pr-quality
against the staged diff + planned body. Findings surface inline for
revision. No comment posted.

**Post-PR (user-invocable)**: /pr-quality <PR> reads the existing PR via
gh, dispatches the v1 judges, posts a fresh comment with findings. No
comment on zero findings.

## Composition with /brevity

Verbosity dimension dispatches /brevity via subagent-loads-target-skill
(same pattern as /coral, /council). The verbosity judge in
references/judges/ is intentionally NOT a re-implementation of brevity's
rules — pr-quality detects the trigger, brevity owns the standard. PE
flagged the coupling risk in scope review; the boundary is preserved.

## Deletions (was CI ceremony)

- .github/workflows/pr-quality.yml
- 9 scripts (check-optout, check-pr-size, fetch-context, dispatch-judges,
  aggregate, render-comment, post-or-update, judge-llm,
  judge-skill-dispatch — plus the now-split judge-mechanical)
- scripts/README.md
- references/guardrails.md (CI-specific content; what remained fits in
  SKILL.md guardrails stanza)
- references/judge-prompt-template.md (without self-consistency, the
  structured-output contract collapses to 5 fields — inlined into rule-
  registry's per-judge schema)
- references/judges/no_cpu_limits.md, harbor_ecr_convention.md
  (mechanical specs are in the script + 1 row in rule-registry)
- state/.gitkeep (no state worth persisting; closer to a thin
  orchestrator than a stateful procedure)

## Working-agreement wiring (same-PR per layer-2 pattern)

CLAUDE.md ## Working Agreements gains:

  - **PR-quality discipline:** Before invoking `gh pr create`, apply
    /pr-quality to the staged diff + planned body. Findings surface
    inline for revision. Post-PR: invoke /pr-quality <PR> to post a
    fresh comment with findings. (Brevity runs during authoring;
    pr-quality runs on the final diff — they don't chain.)

AGENTS.md ## Working Agreement gains a parallel "Pre-PR review"
paragraph after the existing "Output discipline" entry.

## Deferred mechanisms (un-defer triggers in rule-registry.md)

- Self-consistency (n=3 sampling) → first real false-positive
- 5-finding cap + severity rank → first PR producing >7 findings
- Anchored marker + hash dedupe → first comment-spam complaint
- Cost ceiling per PR → first session budget overrun

Coral panel reviewed the trim plan: PE CLEAR, reviewer CLEAR (3 small
adjustments incorporated), PM NEW with harder cuts (all incorporated;
Brandon explicitly retained pre-PR mode as the customer override).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
bdchatham added a commit that referenced this pull request Jun 1, 2026
* feat(skills/pr-quality): post-PR coordinator + GitHub Action

Closes #88.

Adds .claude/skills/pr-quality/ — a procedural coordinator skill that runs
on pull_request: opened/synchronize/reopened, dispatches a fixed v1 judge
set in parallel, and posts a single anchored PR comment with up to 5
findings ranked by severity. Suggestive only — never gates merge. Silence
is the success state on clean PRs.

## v1 scope (locked by coral scope-cut)

Dimensions: 2 (verbosity dispatches /brevity; convention adherence with
5 specific memory-encoded rules). Deferred dimensions (docs completeness,
reference drift, commit message hygiene) carry un-defer triggers in
references/rule-registry.md.

Rules:
- no_cpu_limits (mechanical YAML scan, awk indent + parent-block aware)
- harbor_ecr_convention (mechanical diff-state-machine grep)
- narration_comments (LLM-judged, function-doc style only, n=3 SC)
- temporary_migration_notes (LLM-judged, durable docs only)
- authoritative_voice (LLM-judged, .claude/skills/**/*.md only)
- /brevity dispatch on PR body via skill-loaded subagent

## Architecture

GitHub Action only (no local-invocable surface in v1). Workflow at
.github/workflows/pr-quality.yml with:
- Per-PR concurrency group + cancel-in-progress
- Fork-PR guard (forks have read-only token; explicit skip rather than
  pull_request_target footgun)
- ANTHROPIC_API_KEY pre-check (env-scoped, no template leak)
- Artifact upload of full state for debugging

Composition: subagent loads target skill (same pattern as /coral, /council).
No skill-to-skill registry invented.

## Comment model

Anchored marker `<!-- tide-pr-quality | sha=<SHA> | findings-hash=<H> -->`.
- No prior + findings count == 0 → no comment posted (no thumbs-up)
- No prior + findings > 0 → create new
- Prior + hash matches → no-op (no churn on identical re-runs)
- Prior + hash differs → PATCH in place
- Prior + findings count == 0 → DELETE prior (clean PR after fixes)

## Cross-review

product-engineer + reviewer + product-manager cleared after 2 review cycles.

Round 1 HOLDs addressed:
- Missing judge scripts (judge-mechanical.sh, judge-llm.sh,
  judge-skill-dispatch.sh) — written
- JSON contamination via undisciplined stdout — every judge writes JSON to
  stdout only, logs to stderr via log() { ... >&2; }
- Fork-PR write-permission reality — workflow guard added
- SKILL.md step 6 vs format-spec rendering mismatch — SKILL.md defers to
  format-spec.md as single source of truth

Round 2 HOLDs addressed:
- no_cpu_limits awk was structurally broken on stdin/FILENAME — rewrote
  with proper file-arg + indent + parent-block tracking; PyYAML branch
  rejected per PE for multi-container miscite + early-return bugs (YAGNI)
- Workflow secret-leak via template interpolation — switched to env: +
  ${ANTHROPIC_API_KEY:-} guard
- judge-llm.sh --arg ARG_MAX risk — switched to --rawfile streaming

## Follow-ups (tracked in rule-registry.md un-defer triggers)

- Documentation completeness dimension — un-defer on first missing-doc
  reviewer flag
- Reference drift dimension — un-defer on first stale wikilink causing
  confusion
- Commit message hygiene dimension — un-defer on first non-CC commit on
  main
- Acceptance criterion deferred: dry-run on last 10 PRs (do post-merge)

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

* refactor(skills/pr-quality): drop CI infra; agent-invoked + working-agreement-wired

Pivot per Brandon's "targeted and effective, no bloat" framing.

The original v1 shipped a GitHub Actions workflow + 8 bash scripts +
claude-code-action invocation + state directory + concurrency group + cost
guardrail + self-consistency + anchored marker + hash dedupe + 5-finding cap.
The action failed-closed on its own introduction PR because the Claude Code
App wasn't installed on the repo — the inverse of the suggestive-only intent.

Pivot:

- Drop ALL CI infrastructure
- Agent-invoked + user-invocable, no claude-code-action
- Working-agreement reference in CLAUDE.md + AGENTS.md (same pattern as
  /brevity layer 2; PR #92)

## Final shape (8 files, 393 lines)

  .claude/skills/pr-quality/
  ├── SKILL.md                                 (88 lines)
  ├── references/
  │   ├── rule-registry.md                     (87 — locked v1 set + 2
  │   │                                          mechanical specs inline +
  │   │                                          deferred mechanisms with
  │   │                                          un-defer triggers)
  │   ├── format-spec.md                       (41)
  │   └── judges/
  │       ├── narration_comments.md            (33)
  │       ├── temporary_migration_notes.md     (38)
  │       └── authoritative_voice.md           (33)
  ├── scripts/
  │   ├── scan-yaml-cpu.sh                     (39 — stateful awk, indent
  │   │                                          + parent-block tracking,
  │   │                                          multi-container aware)
  │   └── scan-harbor-ghcr.sh                  (34 — unified-diff state
  │                                              machine)
  └── evals/evals.json                         (happy + halt + pressure)

## Two invocation modes

**Pre-PR (agent-fired)**: before `gh pr create`, agent runs /pr-quality
against the staged diff + planned body. Findings surface inline for
revision. No comment posted.

**Post-PR (user-invocable)**: /pr-quality <PR> reads the existing PR via
gh, dispatches the v1 judges, posts a fresh comment with findings. No
comment on zero findings.

## Composition with /brevity

Verbosity dimension dispatches /brevity via subagent-loads-target-skill
(same pattern as /coral, /council). The verbosity judge in
references/judges/ is intentionally NOT a re-implementation of brevity's
rules — pr-quality detects the trigger, brevity owns the standard. PE
flagged the coupling risk in scope review; the boundary is preserved.

## Deletions (was CI ceremony)

- .github/workflows/pr-quality.yml
- 9 scripts (check-optout, check-pr-size, fetch-context, dispatch-judges,
  aggregate, render-comment, post-or-update, judge-llm,
  judge-skill-dispatch — plus the now-split judge-mechanical)
- scripts/README.md
- references/guardrails.md (CI-specific content; what remained fits in
  SKILL.md guardrails stanza)
- references/judge-prompt-template.md (without self-consistency, the
  structured-output contract collapses to 5 fields — inlined into rule-
  registry's per-judge schema)
- references/judges/no_cpu_limits.md, harbor_ecr_convention.md
  (mechanical specs are in the script + 1 row in rule-registry)
- state/.gitkeep (no state worth persisting; closer to a thin
  orchestrator than a stateful procedure)

## Working-agreement wiring (same-PR per layer-2 pattern)

CLAUDE.md ## Working Agreements gains:

  - **PR-quality discipline:** Before invoking `gh pr create`, apply
    /pr-quality to the staged diff + planned body. Findings surface
    inline for revision. Post-PR: invoke /pr-quality <PR> to post a
    fresh comment with findings. (Brevity runs during authoring;
    pr-quality runs on the final diff — they don't chain.)

AGENTS.md ## Working Agreement gains a parallel "Pre-PR review"
paragraph after the existing "Output discipline" entry.

## Deferred mechanisms (un-defer triggers in rule-registry.md)

- Self-consistency (n=3 sampling) → first real false-positive
- 5-finding cap + severity rank → first PR producing >7 findings
- Anchored marker + hash dedupe → first comment-spam complaint
- Cost ceiling per PR → first session budget overrun

Coral panel reviewed the trim plan: PE CLEAR, reviewer CLEAR (3 small
adjustments incorporated), PM NEW with harder cuts (all incorporated;
Brandon explicitly retained pre-PR mode as the customer override).

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

---------

Co-authored-by: Claude Opus 4.7 <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