-
Notifications
You must be signed in to change notification settings - Fork 40
[FEATURE] Add "Avoid Symlinks" to AI-Friendly Repo Recommendations #361
Description
Proposal: Add "Avoid Symlinks" Check and Remove Symlink Recommendations
Description
Add a new assessor that flags symbolic links to mutable source files within repositories intended for AI coding agents. Additionally, update existing AgentReady guidance and internals that currently recommend or use symlinks.
The Problem
Current-generation AI agents frequently fail to distinguish between a file and a symlink. This leads to several failure modes that can cause data loss or incorrect file states:
- Destructive Overwrites: Agents may write through a symlink without recognizing it, replacing the contents of the underlying target file. This is especially dangerous for configuration files like
.envthat may symlink to external secret stores. - Read/Write Asymmetry: Agents can often write to a file via a symlink (as the OS resolves the path), but then fail to read it back (because the agent's file-indexing tool sees the path as a link and skips it). This causes the agent to think the file is empty or missing and overwrite it.
- Security Bypass: Symlinks can be used to bypass agent permission controls. CVE-2026-25724 demonstrated that Claude Code's deny rules could be circumvented via symlinks because access control evaluated literal paths rather than resolved canonical paths.
- Platform Incompatibility: On Windows with Git's default
core.symlinks=false, symlinks become plain-text stub files containing paths. Agents parse these stubs as literal content, causing YAML/config parsing failures.
Supporting Evidence
- Cursor IDE: Reports of read/write asymmetry through symlinks causing file overwrites. The agent can write through symlinks but fails to read back, leading to repeated overwrites.
- OpenAI Codex: A verified bug where
apply_patchfollowed a.envsymlink to an external secret store and overwrote the target file's contents (~10 environment variables lost).- Source: GitHub Issue: openai/codex#10037
- Claude Code: CVE-2026-25724 — symlink bypass of deny rules in
settings.json, allowing read access to explicitly restricted files. Fixed in v2.1.7. - GitHub Copilot CLI: On Windows, Git symlinks materialized as text stubs caused 18 agent files to fail with YAML frontmatter errors across 546 symlinks in a single repo.
Scope
This issue covers three changes:
1. New symlink_usage assessor
- Rule: Flag symlinks to mutable source files within the repository.
- Exception: Symlinks for static/read-only dependencies are acceptable only if those paths are excluded from AI indexing (e.g., via
.gitignore,.cursorignore). - Alternative guidance: Use a flat directory structure, explicit copy scripts (e.g., a
pre-commithook), or tool-specific reference mechanisms (e.g.,@references in CLAUDE.md). - Tier: TBD — likely Tier 2 or Tier 3 given the direct impact on agent reliability.
2. Update CLAUDEmdAssessor to stop recommending symlinks
The current CLAUDEmdAssessor (assessors/documentation.py) recommends CLAUDE.md as a symlink to AGENTS.md and gives it a full score. This should be changed to:
- Prefer
@references or direct files over symlinks - Continue to accept symlinks (don't penalize existing repos that use them) but stop recommending them in remediation guidance
- Update remediation text to remove "Option 2: symlink CLAUDE.md to AGENTS.md"
3. Replace AgentReady's internal use of symlinks
AgentReady creates *-latest symlinks for reports (cli/main.py, cli/harbor.py). These should be replaced with an alternative mechanism (e.g., direct copies, or a latest text file containing the path).