Convertor1:1 fully autonomous code convertor

Below is a complete, working example of an autonomous conversion system using Cursor. This solution consists of:

Below is a revised, fully integrated solution that removes any need for manual commands. Instead of instructing you to type something like “@./list.sh -l ./” manually, the system prompt itself now automatically detects when a directory is tagged using the “@” symbol and triggers the filetree extraction and file iteration processes. This solution consists of three parts:

  1. Bash Script (list.sh):
    This script lists all files in a given directory (recursively) and displays the full content of any specified file.

  2. AI Ruleset (ai_ruleset.md):
    This Markdown file defines the core autonomous developer rules. In addition to reading the stable project context (project_config.md) and the current session state (workflow_state.md), the AI must also load conversion specifics from convert_rules.md. The rules enforce that every file is converted exactly 1:1 according to the conversion rules (e.g., converting Next.js components to Remix), and that every file’s conversion is logged immediately.

  3. Enhanced System Prompt:
    The system prompt now incorporates directory tagging automatically. When you include a directory with the “@” symbol (for example, @./src), the AI automatically runs the necessary filetree extraction using list.sh, iterates over each file (retrieving their complete contents), and then performs the conversion following the rules.


1. Bash Script: list.sh

#!/bin/bash
# list.sh - Lists all files in a directory or displays the full content of a file.
#
# Usage:
#   ./list.sh -l [directory]      # Recursively list all files (default: current directory)
#   ./list.sh -c [filename]       # Display the full contents of the specified file
#
# Example:
#   ./list.sh -l ./              # Lists all files under the current directory
#   ./list.sh -c ./src/App.tsx   # Shows full content of App.tsx

usage() {
    echo "Usage: $0 [-l directory] [-c filename]"
    exit 1
}

if [ "$#" -eq 0 ]; then
    usage
fi

while getopts ":l:c:" opt; do
  case $opt in
    l)
      DIRECTORY="$OPTARG"
      echo "Listing all files in directory: $DIRECTORY"
      find "$DIRECTORY" -type f
      ;;
    c)
      FILENAME="$OPTARG"
      if [ -f "$FILENAME" ]; then
          echo "Displaying contents of file: $FILENAME"
          cat "$FILENAME"
      else
          echo "Error: File '$FILENAME' not found."
          exit 1
      fi
      ;;
    \?)
      echo "Invalid option: -$OPTARG" >&2
      usage
      ;;
    :)
      echo "Option -$OPTARG requires an argument." >&2
      usage
      ;;
  esac
done

2. AI Ruleset: ai_ruleset.md

# AI Autonomous Developer Ruleset – convertor1:1

**System Identity:**  
You are an autonomous AI developer. You must operate solely based on these three files:
- **project_config.md** (Long-Term Memory – LTM)
- **workflow_state.md** (Short-Term Memory, Rules, and Log – STM)
- **convert_rules.md** (Detailed conversion instructions for Next.js to Remix)

---

## Core Directive

> **Before every action, you MUST:**  
> 1. Automatically read `workflow_state.md`, `project_config.md`, and `convert_rules.md` in full.
> 2. Determine the current phase and state (ANALYZE, BLUEPRINT, CONSTRUCT, VALIDATE).
> 3. Consult the embedded **## Rules** (including conversion specifics in `convert_rules.md`).
> 4. Act strictly according to these rules and the current step-by-step plan.
> 5. Immediately update `workflow_state.md` with the new state, plan progress, and log details.
>
> *Any deviation from these instructions—such as generating non‑1:1 code or altering the UI—is strictly forbidden and will be penalized.*

---

## Workflow Phases (as defined in workflow_state.md)

- **[PHASE: ANALYZE]**  
  *Purpose:* Understand the task by reviewing all context (project_config.md, workflow_state.md, and convert_rules.md).  
  *Action:* Do not generate code—only analyze.

- **[PHASE: BLUEPRINT]**  
  *Purpose:* Produce a detailed plan listing exactly which files need conversion and how (with no code yet).
  
- **[PHASE: CONSTRUCT]**  
  *Purpose:* Execute the conversion plan exactly as specified, ensuring a strict 1:1 conversion (especially for UI components).
  
- **[PHASE: VALIDATE]**  
  *Purpose:* Verify the conversion against the plan and requirements (e.g., by testing or manual checks).

---

## Automatic File Handling

- **Directory Tagging:**  
  When a directory is tagged with the “@” symbol (e.g. `@./src`), you must automatically:
  1. Run the command:  
     ```
     ./list.sh -l <directory>
     ```  
     to list the entire filetree.
  2. Parse the filetree and iterate over each file.
  3. For each file, automatically run:  
     ```
     ./list.sh -c <file_path>
     ```  
     to extract the full file contents.
  4. Convert the file exactly 1:1 from Next.js to Remix, strictly following the instructions in `convert_rules.md`.
  5. Update `workflow_state.md` immediately after each file conversion.

---

*End of Ruleset for convertor1:1*

3. Enhanced System Prompt

This is the system prompt you feed into Cursor. It automatically triggers the full workflow based on directory tagging:

System Prompt:
“You are an autonomous AI developer. Operate solely based on project_config.md, workflow_state.md, and convert_rules.md. When you see a directory tagged with the ‘@’ symbol (for example, @./src), automatically run the filetree extraction using ./list.sh -l [directory] and iterate over each file by running ./list.sh -c [filename] to retrieve its full content. Convert each file exactly 1:1 from Next.js to Remix as defined in convert_rules.md, and update workflow_state.md immediately after processing each file. Any deviation from the 1:1 conversion will be penalized. Begin processing the directory tagged as @./src.”


4. How the Workflow Works – Step-by-Step

  1. Automatic Directory Tagging:

    • What Happens:
      When you include a tagged directory like @./src in your prompt, the system automatically recognizes it as the target for conversion.
    • Result:
      The AI loads the directory context without you manually issuing a list command.
  2. Automatic Filetree Extraction:

    • Process:
      The system automatically calls ./list.sh -l ./src to generate an ASCII filetree of the tagged directory.
    • Purpose:
      This filetree provides a complete, accurate view of all files to be processed.

All credits to @

  1. Iterating Over Files:

    • Process:
      For each file in the filetree, the system automatically calls ./list.sh -c [filename] to obtain the full file content.
    • Purpose:
      This ensures that every file is processed with full context for a true 1:1 conversion.
  2. File Conversion:

    • Process:
      Each file is converted from Next.js to Remix exactly 1:1 according to the detailed instructions in convert_rules.md.
    • Purpose:
      The conversion must replicate the original file without any changes or hallucinations.
  3. State Update:

    • Process:
      After converting each file, the AI immediately updates workflow_state.md with the new state, logs the action, and proceeds to the next file.
    • Purpose:
      This continuous update ensures that context is maintained throughout the entire conversion process.
  4. Autonomous Loop:

    • Cycle:
      The system continuously checks workflow_state.md and iterates over the unconverted files until the entire tagged directory is processed.

Summary for Forum Post

In the improved autonomous conversion system, you no longer need to manually issue file listing commands. Simply tag a directory using the “@” symbol (for example, @./src) in your system prompt, and the AI automatically:

  • Runs ./list.sh -l [directory] to extract the complete filetree.
  • Iterates over each file by automatically calling ./list.sh -c [filename] to retrieve the exact file contents.
  • Converts each file from Next.js to Remix exactly 1:1 according to convert_rules.md.
  • Updates workflow_state.md immediately after processing each file.

This streamlined approach fully automates the conversion process, ensuring strict adherence to 1:1 conversion rules without requiring manual intervention. It minimizes errors and maintains continuous context, making your conversion workflow both efficient and reliable.

All credits to @kleosr

Im working on a new version that wil automatically create workflows so you can use the same prompt I will update code example soon.

1 Like

Now testing changed it a little bit so far it works good initial prompt and reply from the gemini 3.7 model:

1 Like

So far this runs, im testing
Problem its still only looking at some of the files even though it should iterate a filetree list each content of the file and convert it 1 by 1. Im working on that now, which was exactly the problem I had before so not resolved yet with this current implementation.

1 Like

Your rules are extremely verbose and confusing, for instance why you need to use filetree if Cursor can provide that context by itself? try to remove all rules and just ask "Convert *ALL* files under directory @directory following *STRICTLY* our rules in convert_rules.md", stuff like “exactly 1:1” is confusing and should be placed in convert_rules, a better phrasing is “maintaining all functionality”

I am successfully operating on the premise that .mdc is the extension for rules files and the best results are achieved when the rules exist in .cursor\rules\

1 Like

Thank you for the suggestion i changed that part.

Did an extreme 4 hour test and refinmenrt had to run in ow mode

End result:
Sonnet 3.5 and sonnet 3.7 still dont convert every file even placing them in the wring paths though i told it exicitly ti do not so i added rules to the prompt for every omission it did but still cannot get it ro fully work in mumtiple nextjs projects

We have to conclude the ai is tulid or my rukeswt is still not good enough.

Dissapointed after so many tries i cannot make this work.

Will update all code new prompt tomorrow hope someone has some ideas.

The problem is the ai is just unreliavle like this cannot be used as a rhrustworthy assistent.

I also tried gemini but its imementation is just still totally vroken in cursor. It only outouts what it would do without actually doing it.

Is there no gpt4 model in cursor that still got me the best results so far but with reasoning without its just plain stupid too

1 Like

Hey there, @Jarrodsz

First and foremost, great work and good testing. I mean.. I hear you working through this level of complexity can feel frustrating, especially after putting in so much effort.

  1. AI Reliability Issues : You’re absolutely right Claude Sonnet 3.5/3.7 and Gemini aren’t behaving as expected, even with explicit rules, same thing happened to me, don’t lose hope.
  2. Ruleset Challenges : The fact that files are being placed in the wrong paths despite clear instructions suggests the ruleset might need further refinement or stricter enforcement.
  3. Tool Limitations : It sounds like Cursor’s integration with certain models (like Gemini) isn’t mature enough yet, which limits its effectiveness for tasks like this so, involve the usage of 3.7 with one shot prompting.

Refine the Ruleset

  • Explicit File Path Validation : Add a step in workflow_state.md where the AI validates file paths before writing them. For example:

Validate: Does the target path match the source structure? If not, halt and log an error.

Automate Workflow Creation

  • Since you’re already working on automating workflows, consider creating a template generator that pre-defines rules for different project types (e.g., Next.js → Remix). This way, users can select a template and avoid manual rule setup.
Template Name: Next.js to Remix Conversion
Rules: 
  - Convert all .tsx files to .jsx unless otherwise specified.
  - Preserve folder structure exactly as-is.
  - Log every file conversion in workflow_state.md.

And hey, don’t hesitate to reach out if you want to bounce ideas around I’m always here to help.

Cheers,
kleosr

1 Like

Lets diecuss this on discord. I got far but it still does not work would appreciate if we can run true it together. Whats your handle on discord🙏?

I extended my prompt while more rules need to be in workflow i think. Also my current prompt doesent seem to use the workflow method anymore even though i explicit mention it.

@Jarrodsz Yes, we can work our together; my handle remains a the same as my GitHub username kleosr

Update:
Still no working solution and i Broke the auto workflow that i integrated in the prompt.

  • still incomplete code conversions. whole components get hallucinated
  • it output components but still no 1:1 match :frowning:

Whats your handle on discord? maybe together we can tackle this.

Could not find you
kleosr just on the cursor discord should work right?

Intried the raper prompt it does a terrible jonb for this so have to work on getting my own solution fuxed.

Why is it so hard for ai just to copy and react componemt 1:1

I’m usually on general, just direct message me from there.

I still cannot find you on discord.

I really need to make some progress on this and have a solid foundation so today im going to.

Create a repro project

  1. It will contain the workflow files
  2. It will contain specific concert rules.ms
  3. It will contain a presetup remix project with shadcn installed

Now my promptnis very long it will provide it in fhr readme.

@kleosr
If you on github request access uou can easily clonr and provide pull requests

The new idea to get a foundation is:

  1. Use exactly the workflow protocol now ( i like the riper protocol from this forum also very mich maybe both can be integrated?) it lets you enter plan mode wntwr execute mode and review mode. In review mode we could have something like a file compare util that shows how mich % it converted original nextjs components to remix or just some eay to check if the conversion went ok is or its just hallucinated on a a certain file.
  2. It will then copy the “ base remix project” to a new folder
  3. It will then scan the nextjs code folder ( project to convert) and convert it into the copied version of the base remix project.
  4. I will include a nextjs nice admin dashboard for free to test fhe conversion on spend many time on it and its kinda complex so a good usecase.

For testing i created new remix prroject from scratch but that wastes tokens even slow requests and takes much longer.

@kleosr
What do you think?

I hope i can get more people interested in this.

This could potentially be used to convert from programming language x to language y so it has a broader possibility than just my initial goal of converting nextjs to remix

On a note:

@caption-editor copy the ui EXACTLY and made up layout by yourself this is forbidden copy EXACTLY the ui from try again… show me a file comparision afterwards so i can see the old vs the new file content and differences i want to later add this code in a remix folder called /app/routes/_app+/campaigns+/transcribe

This prompt works for a single component fairly well. But its not working on complex ones.

So you suggest to eliminate the list.sh

The problem is with large filetrees sonnet many times says “ i look at some components to get an idea or i will read a few files from x”
Then it missed context

The idea is to force sonnet to read all files thats why i cameup with the list.sh

Unless we can force it to read all files insee no way around than feeding it file by file