Commit graph

2149 commits

Author SHA1 Message Date
Fred Amaral
f96cd06b71 docs: add comprehensive testing documentation 2025-11-03 14:20:59 -03:00
Fred Amaral
91db453231 docs: document new infrastructure features in README 2025-11-03 14:20:33 -03:00
Fred Amaral
a0914801e2 test: add integration tests for skill matcher 2025-11-03 14:19:57 -03:00
Fred Amaral
7cda41d586 test: add integration tests for review orchestrator 2025-11-03 14:19:37 -03:00
Fred Amaral
a411970670 feat(verification): add violation recovery procedures
Add three violation recovery scenarios:
- Claimed complete without running verification
- Ran command but didn't paste output
- Used banned phrases before verification

Each includes detection, recovery steps, and rationale.

Task 26/26 from infrastructure implementation plan.
2025-11-03 14:17:11 -03:00
Fred Amaral
4fc58f0e08 feat(debugging): add violation recovery procedures
Add three violation recovery scenarios:
- Jumped to fix before finding root cause
- Multiple hypotheses tested simultaneously
- Skipped Phase 1 checklist

Each includes detection, recovery steps, and rationale.

Task 25/26 from infrastructure implementation plan.
2025-11-03 14:16:41 -03:00
Fred Amaral
f10a88f446 feat(tdd): add violation recovery procedures
Add three violation recovery scenarios:
- Wrote implementation before test
- Test passes without implementation (false green)
- Kept code as reference instead of deleting

Each includes detection, recovery steps, and rationale.

Task 24/26 from infrastructure implementation plan.
2025-11-03 14:16:06 -03:00
Fred Amaral
90e9640554 feat(patterns): add violation recovery to failure-recovery pattern
Add comprehensive 'When You Violate This Skill' section with template and example.
Provides standardized structure for skills to document violation detection and recovery.

Task 23/26 from infrastructure implementation plan.
2025-11-03 14:15:32 -03:00
Fred Amaral
a7d6838895 feat(patterns): create preflight-checks universal pattern
Add comprehensive preflight checks pattern template for skills with prerequisites.
Defines YAML frontmatter structure, check types (blocking/warning), and integration guidelines.

Task 22/26 from infrastructure implementation plan.
2025-11-03 14:15:04 -03:00
Fred Amaral
5b703931f9 feat(commands): add /ring:next-skill for workflow transitions 2025-11-03 14:12:55 -03:00
Fred Amaral
34c533ad95 feat(commands): add /ring:metrics for usage tracking and analysis 2025-11-03 14:12:36 -03:00
Fred Amaral
751faa42a8 feat(commands): add /ring:which-skill for intelligent skill discovery 2025-11-03 14:12:18 -03:00
Fred Amaral
e7eeb7d6a0 feat(commands): add /ring:validate for skill compliance checking 2025-11-03 14:11:58 -03:00
Fred Amaral
6f41f65ded feat(commands): add /ring:review for automated sequential reviews 2025-11-03 14:11:40 -03:00
Fred Amaral
cd6900a6d6 feat(agents): add full-reviewer for single-invocation all-gates review 2025-11-03 14:09:29 -03:00
Fred Amaral
807823286e feat(agents): add review orchestrator for automated sequential reviews 2025-11-03 14:08:34 -03:00
Fred Amaral
06ae3cfcd4 feat(skills): add composition patterns to test-driven-development 2025-11-03 14:05:31 -03:00
Fred Amaral
4a8310d2ad feat(skills): add prerequisites to test-driven-development 2025-11-03 14:05:01 -03:00
Fred Amaral
22928ad983 feat(skills): add compliance rules to test-driven-development 2025-11-03 14:04:35 -03:00
Fred Amaral
5f0d506fb7 feat(agents): add output schema to security-reviewer 2025-11-03 14:04:07 -03:00
Fred Amaral
7d99454fb0 feat(agents): add output schema to business-logic-reviewer 2025-11-03 14:03:41 -03:00
Fred Amaral
370fe34fc7 feat(agents): add output schema to code-reviewer 2025-11-03 14:03:19 -03:00
Fred Amaral
726ed9523d security: fix CVE-1 and CVE-2 in compliance-validator.sh
Fixed 2 CRITICAL security vulnerabilities in compliance-validator.sh:

**CVE-1: Arbitrary Command Execution**
- Vulnerability: bash -c executed patterns from YAML without validation
- Location: Lines 113-116, 120-124 (command_succeeds, command_output_contains)
- Fix:
  * Implemented command whitelist (git, npm, yarn, pytest, jest, make, cargo, go, python)
  * Added validate_command() to check against whitelist
  * Added safe_run_command() with 30-second timeout
  * All commands now validated before execution
  * Proper error messages for rejected commands

**CVE-2: Command Injection via Patterns**
- Vulnerability: Unquoted patterns in git_diff_order case statements
- Location: Lines 127-184
- Fix:
  * Added validate_pattern() to sanitize glob patterns
  * Reject patterns with dangerous chars (; & $ \` ( ) < > \\)
  * Sanitize patterns using tr -d before use in case statements
  * Validate pipe-separated pattern format

**Security Enhancements:**
- Whitelisted commands: git, npm, yarn, pytest, jest, make, cargo, go, python, python3, node
- Command timeout: 30 seconds max (with macOS compatibility)
- Pattern validation: Block special characters that could enable injection
- Input sanitization: Remove dangerous chars from patterns before use

**Testing:**
- Created comprehensive security test suite (10 tests)
- All tests pass:
  * CVE-1 command injection prevention (4 tests)
  * CVE-2 pattern injection prevention (2 tests)
  * Timeout protection
  * Whitelisted command execution
  * Multiple injection attempts
  * Command chaining prevention

Test results: 10/10 passed

Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:57:36 -03:00
Fred Amaral
3f3d085264 feat(preflight): support all prerequisite types
**High (H2):** Extend prerequisite checker to support file, env, and
git_clean types in addition to commands. Enables comprehensive
pre-flight validation.

Prerequisite types:
- command: Check if command exists (default for legacy format)
- file: Check if file exists
- env: Check if environment variable is set
- git_clean: Check if working directory is clean

Format:
  prerequisites:
    - type: command
      value: jq
    - type: file
      value: .env
    - type: env
      value: API_KEY
    - type: git_clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:42:27 -03:00
Fred Amaral
64ae86cc8e fix(output-validator): add end-of-line anchor to VERDICT regex
**High (H1):** Add $ anchor to VERDICT value regex to prevent
accepting invalid values like "PASS with notes". Now strictly
enforces PASS, FAIL, or NEEDS_DISCUSSION with nothing after.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:42:15 -03:00
Fred Amaral
e8ea891180 fix(skill-matcher): enforce top 5 limit using head
**Critical (C3):** Fix output limiting by using head to actually
restrict results to top 5 skills. Previous implementation used break
in a pipe subshell which didn't work correctly.

Changes:
- Filter zero-score skills in awk before limiting
- Use head -5 to enforce limit before while loop
- Move count increment inside loop for correct numbering
- Show warning only if total_matches > 5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:42:07 -03:00
Fred Amaral
50fa7d4188 feat(metrics): add idempotency with event-id deduplication
**Critical (C2):** Add optional event-id parameter that enables
idempotent metrics tracking. Duplicate events are detected and
skipped, preventing double-counting.

**High (H4):** Make metrics updates atomic by combining timestamp
and data updates in single jq commands, ensuring consistency.

Changes:
- Accept optional 5th parameter: event-id
- Track event_ids in metrics.json
- Check for duplicates before processing
- Record event_id atomically with data updates
- Return success for duplicate events (idempotent)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:41:59 -03:00
Fred Amaral
4216b6000a fix(compliance): use file mtime for uncommitted changes and optimize find
**Critical (C1):** Fix git_diff_order to use file modification times
instead of git log timestamps for uncommitted changes. This ensures
TDD compliance checks work correctly during development.

**High (H3):** Optimize find performance by pruning node_modules and
vendor directories, preventing unnecessary directory traversal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:41:49 -03:00
Fred Amaral
38f1ddfcf0 fix(lib): resolve all Critical and High priority review issues
Critical Fixes:
- C1: Remove TODO placeholders - implement full validation with yq
- C2: Replace eval with bash -c for safer command execution
- C3: Fix bash 3.2 compatibility (remove process substitution, use heredoc)

High Priority Fixes:
- H1: Add structured error context propagation with common.sh library
- H2: Add comprehensive input validation (path traversal, format checks)
- H3: Implement structured logging with timestamps and severity levels
- H4: Fix metrics state sequencing with atomic updates and validation
- H5: Add file locking to metrics-tracker.sh (directory-based lock)
- H6: Add truncation warning when showing only top 5 results
- H7: Implement proper git_diff_order check using commit timestamps
- H8: Add dependency checks for jq and yq before usage

Changes:
- compliance-validator.sh: Full yq-based validation, proper git_diff_order
- preflight-checker.sh: Implement prerequisite checking with yq
- metrics-tracker.sh: Add locking, atomic updates, state validation
- skill-matcher.sh: Add truncation warning, input validation
- output-validator.sh: Add input validation and security checks
- skill-composer.sh: Add input validation
- common.sh: New shared library for logging and error handling

Test Results:
- All scripts pass syntax checks on bash 3.2.57
- Input validation blocks path traversal attacks
- Metrics tracking creates valid JSON with proper locking
- Error messages provide context and location information

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 13:29:31 -03:00
Fred Amaral
77b8620d11 feat(lib): add metrics tracker and exclude runtime files 2025-11-03 13:18:20 -03:00
Fred Amaral
fae01e8492 feat(lib): add skill composer for workflow transitions 2025-11-03 13:17:35 -03:00
Fred Amaral
65345f6a85 feat(lib): add skill matcher for task-to-skill mapping 2025-11-03 13:16:57 -03:00
Fred Amaral
e5d2cd445b feat(lib): add preflight checker for skill prerequisites 2025-11-03 13:12:08 -03:00
Fred Amaral
3880fa57d0 feat(lib): add output format validator for agent reviews 2025-11-03 13:11:41 -03:00
Fred Amaral
358d525bd4 feat(lib): add compliance validator with rule parsing 2025-11-03 13:10:45 -03:00
Fred Amaral
752ed1773f feat(lib): create infrastructure library directory 2025-11-03 13:06:21 -03:00
Fred Amaral
f302ed5462 feat(agents): overhaul reviewer prompts for structured analysis
Bumps plugin version to 0.0.3.

The prompts for `code-reviewer`, `business-logic-reviewer`, and
`security-reviewer` are completely rewritten. This introduces a
standardized, highly-structured format for all three agents.

Key enhancements include:
- Prioritized checklists for systematic, gate-specific review
- A strict markdown output format with a clear verdict section
- Explicit pass/fail criteria to reduce ambiguity
- Common anti-patterns and best-practice examples to improve guidance

The previous agent prompts were less structured, which could lead to
inconsistent review quality and less thorough analysis. This overhaul
provides a more methodical and repeatable process for the agents. The
standardized structure, checklists, and explicit criteria ensure that
reviews are more comprehensive, reliable, and easier for developers to parse
and act upon, improving the entire automated review workflow.
2025-11-02 16:34:07 -03:00
Fred Amaral
f8403ff148 feat(review): implement sequential 3-gate review agents
This commit replaces the single code reviewer with a structured,
three-gate sequential review process to improve quality and efficiency.

The new workflow consists of three specialized agents run in order:
1. `code-reviewer` (Gate 1 - Foundation): Validates architecture,
 code quality, and maintainability.
2. `business-logic-reviewer` (Gate 2 - Correctness): A new agent to
 verify business rules, requirements, and edge cases.
3. `security-reviewer` (Gate 3 - Safety): A new agent for auditing
 security vulnerabilities.

This sequential process ensures that each stage builds on a validated
foundation, preventing wasted effort. For instance, security analysis
is only performed on code that has passed architectural and business
logic reviews.

All reviewer agents are also upgraded to the `opus` model, and all
related skills and documentation are updated to reflect this new workflow.

---
This change replaces the general-purpose code reviewer with a more robust, three-stage sequential review process involving specialized agents. By introducing distinct gates for code quality, business logic, and security, reviews become more focused and effective. Each gate builds on the previous one, ensuring foundational issues are resolved before more specific analysis begins, which prevents wasted effort and improves final code quality.
2025-11-01 20:03:20 -05:00
Fred Amaral
6f7935b58c 📝 docs: rewrite and restructure project documentation
Overhaul README.md from a brief summary into a comprehensive guide
for developers. It now includes sections on installation, philosophy, a
full skill list, usage examples, and contribution guidelines.

Refactor CLAUDE.md, the primary guide for the AI, for better structure
and actionability. The file now clearly outlines the repository's
architecture, key workflows, common commands, and mandatory patterns.

The previous documentation was minimal and no longer reflected the
project's maturity and complexity. This extensive rewrite provides a
professional and thorough onboarding experience for new users and
contributors. For the AI, the new structure offers a clearer and more
actionable model of the repository, enabling it to use the skills and
workflows more effectively and consistently.
2025-11-01 14:16:30 -07:00
Fred Amaral
2270b3dff6 feat(skills): introduce bulletproofing plan, tests, and quick reference
This introduces the "Skill Bulletproofing" initiative, a major effort
to make agent skills more robust, reliable, and resistant to common
failure modes like rationalization and incorrect execution.

A detailed implementation plan outlines the systematic enhancement of
core skills with features like mandatory checkpoints, state tracking, and
explicit failure conditions.

To improve skill discovery and awareness, a new quick reference guide is
added and injected into the agent's context at session start. This
provides a scannable overview of all available skills. Formal test
plans are also added to document baseline behaviors and validate the
effectiveness of the improvements.

The legacy `RELEASE-NOTES.md` file is removed, as this new structured
approach to planning and documentation provides a more granular and
useful historical record.
2025-11-01 14:03:29 -07:00
Fred Amaral
38d35d0115 feat: integrate universal patterns into all skills 2025-11-01 13:47:25 -07:00
Fred Amaral
b8414a4111 feat: add universal patterns for state tracking, failure recovery, exit criteria, and todos 2025-11-01 13:45:05 -07:00
Fred Amaral
c85db41b0c feat: add zero-context verification and rollback steps to writing-plans 2025-11-01 13:43:51 -07:00
Fred Amaral
075ee67bde feat: require recon evidence and phase locks in brainstorming 2025-11-01 13:42:17 -07:00
Fred Amaral
58daae05c2 feat: add banned phrases and command-first rule to verification skill 2025-11-01 13:40:33 -07:00
Fred Amaral
f4427272b4 feat: add phase gates and hypothesis limits to systematic debugging 2025-11-01 13:39:17 -07:00
Fred Amaral
0821986456 feat: require actual failure output and strict delete enforcement in TDD 2025-11-01 13:37:39 -07:00
Fred Amaral
5798f594d5 feat: strengthen using-ring with mandatory check points and TodoWrite requirement 2025-11-01 13:35:55 -07:00
Fred Amaral
b7c3703607 init repo 2025-10-30 13:17:57 -07:00