Added Claude Code to Replit through Shell, now what?

So in the hope of reducing costs I added CC to Replit through the shell and this great YouTube https://www.youtube.com/watch?v=IV1913V4UNA

So now, do I work with CC through the same agent window or only in the shell?

So in the hope of reducing costs I added CC to Replit through the shell and this great YouTube https://www.youtube.com/watch?v=IV1913V4UNA

So now, do I work with CC through the same agent window or only in the shell?

Sorry for newbie question.

1 Like

I just use it through the shell


so, something like this @pmz ?

So how would I say pass a screenshot to Claude if i wanted to fix something?

1 Like

In shell, not through Agent. Also, if you don’t set it up proper, it won’t persist through server restarts and it’s a PITA. There’s a whole workflow that Matt Palmer posted about it.

That’s one of the magic things about Agent. It does it. Claude Code CLI does not.

I suppose you could upload to attached assets and then reference the file in your prompt. I haven’t tried that, though.

1 Like


lolz

Wow nice setup, so you prefer Gemini?

could you share the link please Eric?

my aim really is to save agent usage costs as Im up to $50 a day and its killing me!

I think its this one: https://www.youtube.com/watch?v=wcJrYhbPavY

Why is nobody talking about using the SSH ability to connect directly to VS Code or Cursor on your Replit repo? I’ve been doing this for over a year and it allows you to use ANY AI model you want through extensions and also get a nice instant interface. I can edit files and code directly in VS Code if needed and it is directly affected on the server.

I’ve made videos about this before but just something people seem to miss (it’s under the developer tab and super easy).

The only issue that I run into with my Replit repos is that it will disconnect frequently and sometimes will lose the session history from claude (need to change it’s default install directory on the workspace).

I use the Replit agent for managing the server, integrations, initial development, and other things and then switch over to using Codex, Claude Code, Gemini, and MiniMax recently when I’m doing small tasks or changes.

Another feature that people don’t seem to think about is that your code is posted on github, why not spin up a few codex or claude code instances on the web for simple changes and then just merge them back into the main brain on Replit?

4 Likes

The SSH is by far better than using the shell. I had VS code with codex for a bit. Just yesterday I moved to antigravity, and so far much happier with the performance of agents there.

1 Like

Create a directory called screenshots, drag your screenshot there, and then tell Claude that you’ve posted an image there. Works like a champ!

Shame we can’t have it in Thailand yet :frowning:

was the purpose of Extensions to do just that?

the store is empty. did they shut this feature down to stop people from bypassing the agent?
” Browse Extensions - Replit ”

It’s terrible anyway, I wouldn’t worry about it.

Here is step by step on connecting Cursor to Replit and some good rules to add.
Step 1: Generate SSH Keys in Replit

Open the Shell/Terminal in your Replit project and generate the keys:

bash

ssh-keygen -t ed25519 -C "your_email@example.com"

When prompted:

  • Press Enter to accept default location (/home/runner/.ssh/id_ed25519)

  • Press Enter twice to skip passphrase (or create one for extra security)

Verify creation:

bash

ls ~/.ssh/

You should see: id_ed25519 (private) and id_ed25519.pub (public)


Step 2: View Your Keys

Public key (safe to share):

bash

cat ~/.ssh/id_ed25519.pub

Private key (keep secret):

bash

cat ~/.ssh/id_ed25519

Step 3: Save Keys to Your Computer

On Windows:

  1. Create .ssh folder:

cmd

mkdir %USERPROFILE%\.ssh
  1. Copy keys from Replit (use cat commands above)

  2. Save files:

    • Open Notepad/VS Code

    • Paste private key → Save as C:\Users\YourUsername\.ssh\replit (no extension, “All Files”)

    • Paste public key → Save as C:\Users\YourUsername\.ssh\replit.pub

  3. Set permissions (PowerShell as Admin):

powershell

icacls "%USERPROFILE%\.ssh\replit" /inheritance:r /grant:r "%username%:R"

On Linux/Mac:

  1. Create .ssh folder:

bash

mkdir -p ~/.ssh
  1. Copy keys from Replit (use cat commands above)

  2. Save files:

bash

nano ~/.ssh/replit      # Paste private key, Ctrl+X to save
nano ~/.ssh/replit.pub  # Paste public key, Ctrl+X to save
  1. Set permissions:

bash

chmod 700 ~/.ssh
chmod 600 ~/.ssh/replit
chmod 644 ~/.ssh/replit.pub

Step 4: Add Keys to Replit Account

  1. Copy your public key from Replit:

bash

cat ~/.ssh/id_ed25519.pub
  1. Go to Replit Account Settings:

    • Click your profile icon → Settings

    • Navigate to “SSH Keys” section

    • Click “Add SSH Key”

  2. Paste and save:

    • Paste your public key

    • Give it a name (e.g., “My Laptop” or “Work Computer”)

    • Click “Add Key”


Step 5: Create (or Update) Your SSH Config File

On Windows:

  1. Create the file:

cmd

notepad %USERPROFILE%\.ssh\config

Or use VS Code:

cmd

code %USERPROFILE%\.ssh\config
```

2. Paste this configuration:
```
Host *.replit.dev
  Port 22
  IdentityFile ~/.ssh/replit
  StrictHostKeyChecking no
  UserKnownHostsFile NUL

Host *.replit.co
  Port 22
  IdentityFile ~/.ssh/replit
  StrictHostKeyChecking no
  UserKnownHostsFile NUL
  1. Save and close (File → Save in Notepad, or Ctrl+S in VS Code)

On Linux/Mac:

  1. Create the file:

bash

nano ~/.ssh/config

Or use your preferred editor:

bash

vim ~/.ssh/config
# or
code ~/.ssh/config
```

2. Paste this configuration:
```
Host *.replit.dev
  Port 22
  IdentityFile ~/.ssh/replit
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null

Host *.replit.co
  Port 22
  IdentityFile ~/.ssh/replit
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  1. Save and exit (Ctrl+X, then Y, then Enter in nano)

  2. Set permissions:

bash

chmod 600 ~/.ssh/config
```

Configuration Explained:

  • **Host .replit.dev / Host .replit.co: Matches any Replit subdomain
  • Port 22: Standard SSH port
  • IdentityFile: Path to your private key (update if you named it differently)
  • StrictHostKeyChecking no: Skips host verification prompt
  • UserKnownHostsFile: NUL on Windows (discards known hosts) / /dev/null on Linux/Mac (discards known hosts)

Notes:

  • File must be named exactly config (no .txt or other extension)
  • If you used a different key name, update IdentityFile path accordingly
  • The config file is read by SSH client when connecting to matching hosts
  • Both .replit.dev and .replit.co domains are now supported

Step 6: Connect to Cursor

In Replit, open the Developer Tab and go to Connect. You should be able to click on Launch Cursor now.

Common Issues:

  • Incorrect permissions on the private key
  • Private key has an extension like .txt

Optimizing Cursor for Replit Projects

Once you have Cursor connected to your project, you’re ready to get started. There are a few additions that make Cursor more powerful and capable when working with your Replit project.

1. Create a cursorvars.md file

Create a file called cursorvars.md and add an exclude for it in the .gitignore file, then add:

DATABASE_URL: [get your database URL from Replit secrets]
PREVIEWURL: [get the URL to your app]

Add any other secrets that it might need when writing code… I put my OpenAI ones.

2. Create a cursor_scripts folder

Create a folder in your project called cursor_scripts and add that to your .gitignore file also. This is where you want Cursor to put its temp scripts, and you don’t want Replit agents getting confused.

3. Add Cursor Rules

Now in Cursor, add a couple of rules explaining what you did:

Rule 1:

This is a Replit project. When creating scripts to cleanup or update the database, keep those in the root cursor_scripts folder. Also in the project there is a file called cursorvars.md and in that I will put various Replit environmental variables for you to be aware of, especially DATABASE_URL. You can use that value to run direct database commands and updates. Do not use db:push to make database changes, update the tables using SQL.

Note: This last part is because db:push rarely works even with -force.

Rule 2 - Restart dev server after code changes:

# Restart dev server after code changes

- After applying **any code change** that affects the running app, the AI should **restart the dev server on the remote SSH shell** by running:
```bash
  fuser -k 5000/tcp || true
  npm run dev
  • The intent is:

    • Stop whatever process is currently listening on port 5000 (even if the process name changes or pkill misses it).
    • Start the dev server via npm run dev so changes are picked up on a clean port.
  • This restart step should be mentioned briefly when performed, especially when debugging issues that depend on the latest code.

Rule 3 - Auto-Commit (Optional but Recommended)

IMPORTANT: If you don’t want to have to keep switching to Replit and going to the Git tab to commit your changes, you can automate this.

Create another rule (replace YOUREMAILHERE and YOURNAMEHERE):

Auto-commit After Approval

When the user approves or accepts changes made in the session, run the auto-commit script with a descriptive message summarizing the work:

cd /home/runner/workspace && git config user.email “YOUREMAILHERE” && git config user.name “YOURNAMEHERE” && git add -A && git commit -m “Brief description of changes”

Use a concise, descriptive commit message that reflects the main changes (e.g., “Fix tier discounts in POS”, “Add customer data validation”, “Remove dead JWT route”).

1 Like