Skip to content

feat(coaching): add pre-write YAGNI gate for Write/Edit - #390

Merged
getappz merged 2 commits into
masterfrom
task/95
Aug 5, 2026
Merged

feat(coaching): add pre-write YAGNI gate for Write/Edit#390
getappz merged 2 commits into
masterfrom
task/95

Conversation

@getappz

@getappz getappz commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Auto-opened on item done for 019f676f-cff4-7230-9b98-e2966fa95054.

Summary by CodeRabbit

  • New Features

    • Added a built-in coaching check that encourages a quick YAGNI review before writing or editing code.
    • The check uses a flare-code ladder to guide implementation decisions and does not apply to mechanical, generated, test, or fixture changes.
    • Updated default coaching guidance to include this pre-write review step.
  • Tests

    • Expanded coverage to verify seeded coaching rules, including their triggers, sync targets, guidance, tiers, and enforcement settings.

Adds a fifth DEFAULT_COACHING_RULES entry (id: yagni-gate) that nudges
the flare-code ladder (does this need to exist, reuse before writing,
stdlib/native/installed-dep before new code, shortest form) on every
Write/Edit call. Reuses the existing coaching rule engine already wired
into pre_tool_use instead of building new gate infrastructure, so it's
seeded/refreshed by the same agentflare init / SessionStart path as the
other core-module rules.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The default coaching rules now include a non-enforced yagni-gate rule for Write and Edit. The core coaching description names the pre-write YAGNI check. The defaults test now covers all seeded rules and checks their triggers and sync targets.

Changes

Coaching Defaults

Layer / File(s) Summary
Add and describe the YAGNI rule
src/components.rs
DEFAULT_COACHING_RULES adds the yagni-gate rule for Write and Edit. The core-coaching description includes the pre-write YAGNI check.
Extend the coaching defaults test
src/components.rs
The fresh-home coaching defaults test is renamed to cover all seeded rules. The test now checks each rule’s tool triggers and sync targets against its declared defaults.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only an automation note and omits the required Summary, Test plan, and Notes for reviewers sections. Add the required sections and document the change, test status, risks, edge cases, and backwards compatibility.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding a YAGNI gate for Write and Edit operations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/95

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components.rs (1)

1628-1644: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the Write/Edit trigger and claude-code sync target.

The test checks body, tier, and enforced, but it does not check trigger or sync. A default rule can therefore seed with incorrect tool triggers or host synchronization and the test will still pass. Add assertions for these fields, or add focused assertions for yagni-gate.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components.rs` around lines 1628 - 1644, Extend
coaching_defaults_seed_all_default_rules_on_fresh_home to validate each seeded
rule’s trigger includes both Write and Edit, and its sync target is claude-code,
alongside the existing body, tier, and enforced assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components.rs`:
- Around line 1628-1644: Extend
coaching_defaults_seed_all_default_rules_on_fresh_home to validate each seeded
rule’s trigger includes both Write and Edit, and its sync target is claude-code,
alongside the existing body, tier, and enforced assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b688c67-2050-417a-a9e5-caf5e052de34

📥 Commits

Reviewing files that changed from the base of the PR and between ca2775e and 60bd4cc.

📒 Files selected for processing (1)
  • src/components.rs

…e seed test

CodeRabbit nitpick on PR #390: the seed test checked body/tier/enforced
per default rule but not trigger.tools or sync, so a rule could seed
with the wrong Write/Edit trigger or claude-code sync target and the
test would still pass.
@getappz getappz changed the title optimize/code: pre-generation YAGNI gate (constrain before writing, not just review-after) feat(coaching): add pre-write YAGNI gate for Write/Edit Aug 5, 2026
@getappz
getappz merged commit 6665918 into master Aug 5, 2026
17 checks passed
@getappz
getappz deleted the task/95 branch August 5, 2026 17:05
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