Skip to content

feat: add anti-rationalization system with behavior checks and spec compliance#15

Open
mylukin wants to merge 4 commits intomainfrom
feature/anti-rationalization-system
Open

feat: add anti-rationalization system with behavior checks and spec compliance#15
mylukin wants to merge 4 commits intomainfrom
feature/anti-rationalization-system

Conversation

@mylukin
Copy link
Copy Markdown
Owner

@mylukin mylukin commented Jan 18, 2026

Summary

  • Add comprehensive anti-pattern detection system to identify workflow violations
  • Add behavior strategy for automatic workflow compliance checking
  • Add spec compliance check (Layer 2.5) to verify implementation matches acceptance criteria
  • Improve workflow enforcement with self-review step and evidence-based claims

Key Features

1. Anti-Pattern Detection (src/anti-patterns/)

  • Registry-based pattern detection system
  • Detects: file reading violations, manual status edits, workflow shortcuts, verification skipping
  • Extensible pattern definitions with severity levels

2. Behavior Strategy (src/strategies/behavior-strategy/)

  • Automatic behavior check during verification
  • Log collection and analysis for workflow compliance
  • Integration with layered check system

3. Spec Compliance Check (src/verifier/spec-compliance.ts)

  • Layer 2.5 verification: checks if implementation matches acceptance criteria EXACTLY
  • Detects over-engineering (features not requested)
  • Detects missing criteria (incomplete implementation)
  • Uses skeptical AI prompt approach ("Do NOT trust self-reports")

4. Workflow Improvements (src/rules/templates/)

  • Added "Evidence vs Claims (Iron Law)" section with explicit evidence requirements
  • Added mandatory self-review step between implementation and check
  • Updated workflow sequence: next → implement → self-review → check → done

Coverage Improvements

Module Before After
behavior-check.ts 11.76% 100%
log-collector.ts 53.84% 100%
output.ts 69.56% 100%
behavior-strategy/ 76.47% 98.31%

Test plan

  • All 2,493 tests passing
  • Build successful
  • TypeScript compilation passes
  • New modules have >98% coverage

🤖 Generated with Claude Code

mylukin and others added 3 commits January 18, 2026 12:09
Implement anti-rationalization system for detecting workflow violations:

- Add anti-pattern registry with 8 built-in patterns for detecting
  workflow bypass, file reading violations, and manual edits
- Add behavior verification strategy for UVS integration
- Integrate automatic behavior check into `agent-foreman check` command
- Add new rule template 08-anti-rationalization.md with guidance
- Add --skip-behavior flag to bypass behavior check when needed

The behavior check analyzes ai/progress.log and detects violations like:
- Skipping CLI commands (next, check, done)
- Reading index.json or task files for workflow decisions
- Manual status editing instead of using CLI

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add comprehensive tests for:
- behavior-check.ts (11.76% → 100%)
- log-collector.ts (53.84% → 100%)
- output.ts (69.56% → 100%)

57 new tests added across 3 test files.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add three key features inspired by superpowers project:

1. Evidence vs Claims (Iron Law) - Add explicit evidence requirements
   table to 08-anti-rationalization.md with gate function and forbidden
   claim patterns. Enforces "NO COMPLETION CLAIMS WITHOUT FRESH
   VERIFICATION EVIDENCE".

2. Self-Review Workflow Step - Add mandatory self-review step between
   implementation and check in 01-workflow.md. Updated workflow from
   "next → implement → check → done" to include self-review.

3. Spec Compliance Check (Layer 2.5) - Add new verification layer that
   checks if implementation matches acceptance criteria EXACTLY before
   running code quality checks. Detects over-engineering and missing
   criteria. Runs automatically with --ai flag.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mylukin mylukin changed the title feat: add anti-pattern detection and automatic behavior check feat: add anti-rationalization system with behavior checks and spec compliance Jan 18, 2026
Remove Chinese translations from markdown files in src/rules/templates
to maintain English-only documentation.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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