ralph-claude-code/templates/AGENT.md
Frank Bria 9b19d70e35
feat(structure): migrate Ralph files to .ralph/ subfolder (#109)
* feat(structure): migrate Ralph files to .ralph/ subfolder

BREAKING CHANGE: Ralph configuration files now live in .ralph/ subfolder

This refactoring moves all Ralph-specific files into a hidden .ralph/
directory while keeping src/ at the project root. This improves
compatibility with existing tooling and keeps the project root clean.

Changes:
- Move PROMPT.md, @fix_plan.md, @AGENT.md to .ralph/
- Move specs/, logs/, docs/generated/, examples/ to .ralph/
- Move state files (.response_analysis, .circuit_breaker_state, etc.) to .ralph/
- Keep src/ at project root (unchanged)
- Add RALPH_DIR=".ralph" configuration variable
- Add ralph-migrate command for existing projects
- Create migrate_to_ralph_folder.sh migration script
- Update all path references in scripts and tests
- Update documentation (README.md, CLAUDE.md)

New project structure:
  project/
  ├── .ralph/           # Ralph configuration
  │   ├── PROMPT.md
  │   ├── @fix_plan.md
  │   ├── @AGENT.md
  │   ├── specs/
  │   ├── logs/
  │   └── docs/generated/
  └── src/              # Source code (unchanged)

Migration: Run `ralph-migrate` in existing projects to upgrade.

All 310 tests pass (100% pass rate).

* chore: add .claude/settings.local.json to .gitignore

* fix: address code review feedback for .ralph/ subfolder structure

Fixes multiple path-related issues identified in code review:

Test fixes:
- Fix create_sample_prompt to use $RALPH_DIR/PROMPT.md in test_session_continuity.bats
- Fix result_file path to use $RALPH_DIR/.json_parse_result in test_json_parsing.bats
- Fix @fix_plan.md and .response_analysis paths in test_cli_modern.bats
- Update templates directory missing test to account for global fallback

Template fix:
- Fix @fix_plan.md reference in templates/PROMPT.md to use .ralph/ prefix

Script fixes:
- Fix PROMPT_FILE comparison in ralph_loop.sh to use $RALPH_DIR/PROMPT.md
- Fix examples migration logic in migrate_to_ralph_folder.sh (remove premature mkdir)
- Move templates directory check AFTER cd in setup.sh (was checking wrong location)
- Add template directory validation with fallback to global templates

All 310 tests pass.

* Update migrate_to_ralph_folder.sh

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>

* fix: address code review feedback for .ralph/ subfolder structure

Code Review Fixes:
- Fix test_json_parsing.bats: all result_file and session file paths now use $RALPH_DIR prefix
- Fix ralph_loop.sh help text: paths now show .ralph/.ralph_session, .ralph/.call_count, etc.
- Fix migrate_to_ralph_folder.sh:
  - Proper error handling for date command (separate local declaration)
  - Use cp -a source/. dest/ pattern to preserve dotfiles and attributes
  - Remove 2>/dev/null suppression to surface copy errors
- Update create_files.sh to use .ralph/ structure for embedded scripts
- Update .gitignore with all .ralph/ state file paths
- Add old structure detection in ralph_loop.sh with helpful migration message

Version Update:
- Bump to v0.10.0 (breaking change: structural reorganization)
- Update README.md and CLAUDE.md with new version and release notes
- Add ralph-migrate documentation to Key Commands section

All 310 tests pass.

---------

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
2026-01-20 23:22:30 -07:00

5.1 KiB

Agent Build Instructions

Project Setup

# Install dependencies (example for Node.js project)
npm install

# Or for Python project
pip install -r requirements.txt

# Or for Rust project  
cargo build

Running Tests

# Node.js
npm test

# Python
pytest

# Rust
cargo test

Build Commands

# Production build
npm run build
# or
cargo build --release

Development Server

# Start development server
npm run dev
# or
cargo run

Key Learnings

  • Update this section when you learn new build optimizations
  • Document any gotchas or special setup requirements
  • Keep track of the fastest test/build cycle

Feature Development Quality Standards

CRITICAL: All new features MUST meet the following mandatory requirements before being considered complete.

Testing Requirements

  • Minimum Coverage: 85% code coverage ratio required for all new code
  • Test Pass Rate: 100% - all tests must pass, no exceptions
  • Test Types Required:
    • Unit tests for all business logic and services
    • Integration tests for API endpoints or main functionality
    • End-to-end tests for critical user workflows
  • Coverage Validation: Run coverage reports before marking features complete:
    # Examples by language/framework
    npm run test:coverage
    pytest --cov=src tests/ --cov-report=term-missing
    cargo tarpaulin --out Html
    
  • Test Quality: Tests must validate behavior, not just achieve coverage metrics
  • Test Documentation: Complex test scenarios must include comments explaining the test strategy

Git Workflow Requirements

Before moving to the next feature, ALL changes must be:

  1. Committed with Clear Messages:

    git add .
    git commit -m "feat(module): descriptive message following conventional commits"
    
    • Use conventional commit format: feat:, fix:, docs:, test:, refactor:, etc.
    • Include scope when applicable: feat(api):, fix(ui):, test(auth):
    • Write descriptive messages that explain WHAT changed and WHY
  2. Pushed to Remote Repository:

    git push origin <branch-name>
    
    • Never leave completed features uncommitted
    • Push regularly to maintain backup and enable collaboration
    • Ensure CI/CD pipelines pass before considering feature complete
  3. Branch Hygiene:

    • Work on feature branches, never directly on main
    • Branch naming convention: feature/<feature-name>, fix/<issue-name>, docs/<doc-update>
    • Create pull requests for all significant changes
  4. Ralph Integration:

    • Update .ralph/@fix_plan.md with new tasks before starting work
    • Mark items complete in .ralph/@fix_plan.md upon completion
    • Update .ralph/PROMPT.md if development patterns change
    • Test features work within Ralph's autonomous loop

Documentation Requirements

ALL implementation documentation MUST remain synchronized with the codebase:

  1. Code Documentation:

    • Language-appropriate documentation (JSDoc, docstrings, etc.)
    • Update inline comments when implementation changes
    • Remove outdated comments immediately
  2. Implementation Documentation:

    • Update relevant sections in this AGENT.md file
    • Keep build and test commands current
    • Update configuration examples when defaults change
    • Document breaking changes prominently
  3. README Updates:

    • Keep feature lists current
    • Update setup instructions when dependencies change
    • Maintain accurate command examples
    • Update version compatibility information
  4. AGENT.md Maintenance:

    • Add new build patterns to relevant sections
    • Update "Key Learnings" with new insights
    • Keep command examples accurate and tested
    • Document new testing patterns or quality gates

Feature Completion Checklist

Before marking ANY feature as complete, verify:

  • All tests pass with appropriate framework command
  • Code coverage meets 85% minimum threshold
  • Coverage report reviewed for meaningful test quality
  • Code formatted according to project standards
  • Type checking passes (if applicable)
  • All changes committed with conventional commit messages
  • All commits pushed to remote repository
  • .ralph/@fix_plan.md task marked as complete
  • Implementation documentation updated
  • Inline code comments updated or added
  • .ralph/@AGENT.md updated (if new patterns introduced)
  • Breaking changes documented
  • Features tested within Ralph loop (if applicable)
  • CI/CD pipeline passes

Rationale

These standards ensure:

  • Quality: High test coverage and pass rates prevent regressions
  • Traceability: Git commits and .ralph/@fix_plan.md provide clear history of changes
  • Maintainability: Current documentation reduces onboarding time and prevents knowledge loss
  • Collaboration: Pushed changes enable team visibility and code review
  • Reliability: Consistent quality gates maintain production stability
  • Automation: Ralph integration ensures continuous development practices

Enforcement: AI agents should automatically apply these standards to all feature development tasks without requiring explicit instruction for each task.