Skip to content

rewrite: add fd (find) and sd (sed) to rewrite registry #1759

Not planned

Description

@CGCURSE

Summary

fd and sd are vastly superior alternatives to find and sed for AI agents:

  • Agents frequently write broken find commands (complex flag escaping, -not -path vs ! -path portability)
  • Agents frequently write broken sed commands (POSIX regex escaping, -i portability between GNU/BSD)
  • fd has simpler syntax, respects .gitignore by default, parallel traversal
  • sd uses standard regex (no POSIX escape hell), simpler syntax

Proposed rewrite rules

find . -name "*.ts"                          → fd -e ts
find . -name "*.ts" -not -path "*/node_modules/*"  → fd -e ts --exclude node_modules
sed -i "s/foo/bar/g" file.txt               → sd foo bar file.txt
sed "s/foo/bar/g" file.txt                  → sd foo bar file.txt

Notes

  • rtk find already exists as a compact-output wrapper for native find — this would be a separate rewrite rule (like how rtk git wraps git but rg rewrites grep)
  • Both tools are widely available: brew install fd sd / apt install fd-find sd
  • Guards needed: only rewrite when fd/sd are in PATH

Context

Discovered while setting up RTK across Claude Code, Codex, Gemini CLI, and opencode. The find and sed rewrite gap is the most common agent error class not currently covered by RTK.

Activity

  1. added
    enhancement
    help wanted
    on May 27, 2026
  2. pszymkowiak commented on May 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 88%

    Summary

    Feature request to add fd and sd as rewrite targets in RTK registry, with PATH guards; well-scoped but not a duplicate of existing find-rewrite issues.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. KuSh commented on Nov 28, 2026

    @KuSh
    Collaborator

    Thanks for the suggestion. rtk keeps the command the agent asked for and only filters its output, so what the agent reads stays a subset of what the original tool would print (the Transparency principle in CONTRIBUTING.md). Rewriting find to fd or sed to sd would run a different tool with different results: fd skips hidden and gitignored files by default, so the agent would get a different file list than the one it asked for. find is already rewritten to rtk find, which filters find's own output. Closing as not planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions