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:
-
Bash Script (list.sh):
This script lists all files in a given directory (recursively) and displays the full content of any specified file. -
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. -
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 onproject_config.md
,workflow_state.md
, andconvert_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 inconvert_rules.md
, and updateworkflow_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
-
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.
- What Happens:
-
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.
- Process:
All credits to @
-
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.
- Process:
-
File Conversion:
- Process:
Each file is converted from Next.js to Remix exactly 1:1 according to the detailed instructions inconvert_rules.md
. - Purpose:
The conversion must replicate the original file without any changes or hallucinations.
- Process:
-
State Update:
- Process:
After converting each file, the AI immediately updatesworkflow_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.
- Process:
-
Autonomous Loop:
- Cycle:
The system continuously checksworkflow_state.md
and iterates over the unconverted files until the entire tagged directory is processed.
- Cycle:
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.