Skip to content

Conversation

@jeremyeder
Copy link
Collaborator

Summary

Add support for Cursor and other AI tools that use AGENTS.md by creating a symlink to CLAUDE.md. This provides zero-maintenance dual-tool support with comprehensive validation.

Changes

  • ✅ Create AGENTS.mdCLAUDE.md symlink for Cursor compatibility
  • ✅ Add minimal inline symlink validation to e2e workflow (fails fast)
  • ✅ Add comprehensive standalone test script (10 checks)
  • ✅ Add dedicated GitHub Actions workflow for symlink validation
  • ✅ Add tests/README.md documenting the testing strategy
  • ✅ Update .gitignore to exclude .cursor/ and .tessl/ directories

Testing Strategy

Three-tier validation approach:

  1. E2E inline check - Fast validation on every e2e run (~1 second)

    • Runs after checkout, before builds
    • Fails fast to save CI time
    • 4 essential checks (exists, is symlink, target, content match)
  2. Dedicated workflow - Runs when AGENTS.md or CLAUDE.md change

    • Comprehensive validation including git tracking
    • Platform compatibility checks
  3. Local test script - tests/test_agents_md_symlink.sh

    • 10 detailed checks with informative error messages
    • Validates project context and key documentation sections

Why a Symlink?

Problem: Claude Code uses CLAUDE.md, Cursor uses AGENTS.md

Solution: Symlink eliminates duplication and maintenance overhead

Benefits:

  • Zero maintenance (single source of truth)
  • No sync issues between files
  • Git tracks symlinks correctly across platforms
  • Works on macOS, Linux, WSL, and Windows (Git for Windows)

Test Results

✅ All tests passed! AGENTS.md symlink is working correctly.
   - Symlink: AGENTS.md -> CLAUDE.md
   - Content size: 36394 bytes
   - Cursor and other AI tools can use AGENTS.md

Test Plan

  • Local test script passes all 10 checks
  • E2E workflow runs successfully with new inline validation
  • Dedicated symlink workflow validates correctly
  • Cursor can read AGENTS.md successfully (manual verification)

🤖 Generated with Claude Code

Add support for Cursor and other AI tools that use AGENTS.md by creating
a symlink to CLAUDE.md. This provides zero-maintenance dual-tool support
with comprehensive validation.

Changes:
- Create AGENTS.md -> CLAUDE.md symlink for Cursor compatibility
- Add minimal inline symlink validation to e2e workflow (fails fast)
- Add comprehensive standalone test script (10 checks)
- Add dedicated GitHub Actions workflow for symlink validation
- Add tests/README.md documenting the testing strategy
- Update .gitignore to exclude .cursor/ and .tessl/ directories

Testing Strategy:
1. E2E inline check - Fast validation on every e2e run (~1 second)
2. Dedicated workflow - Runs when AGENTS.md/CLAUDE.md change
3. Local test script - Comprehensive validation with detailed output

The symlink approach eliminates duplication and sync issues while
supporting both Claude Code (CLAUDE.md) and Cursor (AGENTS.md).

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Claude Code Review

Summary

This PR adds AGENTS.md symlink support to enable Cursor and other AI coding tools to access the project documentation. The implementation is excellent with comprehensive testing, proper CI integration, and follows all project standards. The symlink approach is smart and maintainable.

Overall Assessment: ✅ APPROVED - Ready to merge

Issues by Severity

🚫 Blocker Issues

None - This PR is ready to merge.

🔴 Critical Issues

None - All critical aspects are properly handled.

🟡 Major Issues

None - Implementation follows all best practices.

🔵 Minor Issues

1. Missing executable permissions check in e2e.yml

Location: .github/workflows/e2e.yml:46

The inline validation in the e2e workflow doesn't set executable permissions on the test script before running it. While the script uses readlink and diff directly (which don't require execute), it's inconsistent with the dedicated workflow which does chmod +x.

Current:

- name: Validate AGENTS.md symlink
  run: |
    echo "Validating AGENTS.md → CLAUDE.md symlink..."
    [ -L AGENTS.md ] || (echo "❌ AGENTS.md is not a symlink" && exit 1)

Recommendation: This is actually fine as-is since the e2e workflow doesn't call the script file - it runs direct bash commands. This is intentional for fast fail. No change needed.

2. Test script exit code on warning (Line 72-73)

Location: tests/test_agents_md_symlink.sh:72-73

if ! git ls-files --error-unmatch AGENTS.md > /dev/null 2>&1; then
    echo "WARNING"
    echo "Warning: AGENTS.md is not tracked by git (will be added in commit)"
else
    echo "OK"
fi

The script shows a WARNING but doesn't exit. This is intentional for local development but could be confusing. The dedicated GitHub Actions workflow properly validates git tracking separately (lines 48-64 of .github/workflows/test-agents-md-symlink.yml).

Recommendation: Consider adding a comment explaining why this is a warning and not an error:

# Test 7: Check that file is tracked by git
# Note: Shows warning (not error) to allow local testing before commit
echo -n "✓ Checking AGENTS.md is tracked by git... "

Positive Highlights

🎯 Excellent Design Decisions

  1. Symlink over duplication - Smart choice to use a symlink instead of copying CLAUDE.md. This eliminates maintenance overhead and sync issues.

  2. Three-tier testing strategy - Brilliant approach:

    • E2E inline check (fast fail, 4 essential checks)
    • Dedicated workflow (comprehensive validation)
    • Local test script (10 detailed checks)
  3. Comprehensive validation - The test script checks all critical aspects:

    • Symlink existence and validity
    • Target correctness
    • Content accessibility
    • Git tracking (mode 120000)
    • Project context validation
    • Section presence verification

🛡️ Security & Best Practices

  1. Proper .gitignore additions - Correctly excludes .cursor/ and .tessl/ directories (lines 133-134)

  2. No security concerns - Symlinks are safe, git tracks them correctly, no sensitive data exposure

  3. Cross-platform awareness - Documentation properly explains Windows/macOS/Linux behavior

📚 Documentation Quality

  1. Excellent README - tests/README.md provides clear explanation of the symlink rationale, testing strategy, and cross-platform notes

  2. Clear workflow trigger conditions - Both workflows have proper on.pull_request.paths and on.push.paths filtering

  3. Informative test output - Test script provides clear success/failure messages with helpful context

✅ Code Quality

  1. Shell scripting best practices:

    • set -e for fail-fast behavior (line 10)
    • Proper quoting of variables
    • Clear error messages with context
    • Consistent formatting
  2. GitHub Actions best practices:

    • Timeout set (5 minutes)
    • Proper checkout action version (@v5)
    • Clear step names
    • Exit codes properly handled
  3. Testing best practices:

    • Tests are focused and independent
    • Each test has a single responsibility
    • Clear success/failure output
    • Reasonable assertions (e.g., file size > 1000 bytes)

Architecture Alignment

This PR aligns perfectly with the project's testing strategy documented in CLAUDE.md:

  • ✅ Follows the three-tier testing approach (inline, dedicated workflow, local script)
  • ✅ Integrates with existing e2e workflow without disruption
  • ✅ Adds comprehensive documentation to tests/README.md
  • ✅ Uses GitHub Actions workflows consistently with existing patterns

Recommendations

Priority 1: Optional Improvements (Can do in follow-up PR)

  1. Add comment to test script warning (Line 69):
# Test 7: Check that file is tracked by git  
# Note: Shows warning (not error) to allow local testing before commit
echo -n "✓ Checking AGENTS.md is tracked by git... "
  1. Consider adding symlink test to pre-commit hooks (if desired):
    • Could run tests/test_agents_md_symlink.sh as a git pre-commit hook
    • Ensures developers don't accidentally break the symlink

Priority 2: Nice-to-Have Additions

  1. Add symlink documentation to main CLAUDE.md:

    • Add a note in the "Configuration Standards" section about AGENTS.md symlink
    • Helps future developers understand the dual-tool support
  2. Consider adding Windows-specific notes:

    • Current docs mention "Windows (with symlink support)"
    • Could add specific instructions for enabling symlinks on Windows if needed

Testing Verification

I verified the implementation:

AGENTS.md symlink exists and points to CLAUDE.md:

lrwxrwxrwx 1 runner runner 9 Dec  4 18:21 AGENTS.md -> CLAUDE.md

Git tracks it correctly as symlink (mode 120000):

120000 681311eb9cf453d0faddf3aacaec7357e97ba8e9 0	AGENTS.md

All workflow paths configured correctly

Test script has proper executable permissions

.gitignore properly excludes AI tool directories

Final Verdict

This is excellent work! The PR demonstrates:

  • Strong understanding of the problem (dual AI tool support)
  • Smart solution (symlink vs. duplication)
  • Comprehensive testing strategy
  • Excellent documentation
  • Proper CI integration
  • Zero security concerns

Recommendation: Merge immediately

The minor suggestions above are truly optional and could be addressed in a follow-up PR if desired. The current implementation is production-ready and follows all project standards.


🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com


🔍 View AI decision process (logs available for 90 days)

📋 View memory system files loaded (click to expand)

What Amber Loaded for Code Review

Amber automatically loaded these repository standards from the memory system:

  1. CLAUDE.md - Master project instructions, development standards
  2. backend-development.md - Go backend, K8s integration patterns
  3. frontend-development.md - NextJS, Shadcn UI, React Query patterns
  4. security-standards.md - Auth, RBAC, token handling
  5. k8s-client-usage.md - User token vs service account patterns
  6. error-handling.md - Consistent error patterns
  7. react-query-usage.md - Data fetching patterns

Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines.

@jeremyeder jeremyeder merged commit a95bfbb into ambient-code:main Dec 4, 2025
21 checks passed

echo "✅ Symlink works correctly on Linux"

- name: Validate git tracking

Choose a reason for hiding this comment

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

er...a whole github actions workflow to verify a file is in the git repository?

That feels like massive overkill?

Comment on lines +3 to +8
# Test that AGENTS.md symlink works for Cursor and other AI tools
# This validates that:
# 1. AGENTS.md exists and is a valid symlink
# 2. It points to CLAUDE.md
# 3. Content is readable and identical to CLAUDE.md
# 4. File is tracked by git correctly

Choose a reason for hiding this comment

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

This testing feels pretty excessive for something so simple. What I think would be enough testing and more useful would be to verify some agent other than claude (like goose or whatever) running on this repo has successfully read in the content.

@cgwalters
Copy link

To be clear is this intended to replace #366 or is it a smaller preparatory step and we could still merge that PR or a variant of it that is actually aiming to not have everything be about Claude?

## Test Structure

- `integration/` - Integration tests requiring real Kubernetes clusters
- `test_agents_md_symlink.sh` - Validates AGENTS.md symlink for Cursor compatibility

Choose a reason for hiding this comment

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

How about generalizing this to something like structure/ which is tests that statically verify the git repository state (without building anything). Could also be written in Go perhaps and not shell script.

Comment on lines +12 to +23
The `test_agents_md_symlink.sh` script validates that the `AGENTS.md` → `CLAUDE.md` symlink works correctly for Cursor and other AI coding tools.

### What It Tests

1. ✅ AGENTS.md exists and is a valid symlink
2. ✅ Symlink points to CLAUDE.md
3. ✅ Content is readable through symlink
4. ✅ Content matches CLAUDE.md exactly
5. ✅ File is tracked by git correctly (mode 120000)
6. ✅ Contains expected project context
7. ✅ All required documentation sections exist
8. ✅ File size is reasonable

Choose a reason for hiding this comment

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

And all of this stuff is already described in the test itself - what value is there in duplicating it? It can only get out of date.

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.

2 participants