How to Reuse Code Between Apps with Agent

Hey everyone!

I was wondering if there’s a way for Agent to reuse code from one of my other apps. For example, if I need to use a feature from App 1 in App 2, can Agent pull that code automatically?

If that’s not currently possible, what’s the easiest way to locate and bring specific code from one app into another?

Also, it would be awesome if Agent could eventually support this functionality if it’s not already an option.

Thanks!
Roy

You can copy the files and code

2 Likes

I agree it would be a very useful feature.

1 Like

I’ve raised this with the team in the past, and believe there are some discussions on how this might work in practice.

1 Like

I wish there were a way to see what the status of this is.

Me too. Trust me, they’re not sitting on their hands at Replit. Busy busy!

1 Like

Oh, I know!

Very thankful for the Replit platform. I have been able to build some pretty cool tools.

1 Like

Same! Glad you’re here too!

Same here, that would be very useful

1 Like

Account or team based Code templates would be awesome.

I currently just ask the agent about a feature and then ask it to “create a prompt for a llm that will generate this feature again save it as a *.md file”

Here is how I go about re-using code:

This week, I needed to add a complex feature to a new app - a RAG chatbot. I had already done something similar in an old app. So:

  • I went to the old app and asked the agent to give me a detailed description of how the feature worked under the hood, and to show me some code snippets and which code files were relevant.

  • I then took that big description and the files, dropped them into the agent chat in the new app, and told it something like this:

    "here is how we did something similar in another app. Please look through in detail, discuss it with me, ask me if you need to see anything else from the old app. We will discuss the differences in how we want the old and new apps to use this feature. Once we are ready, plan and architect our new feature using a similar approach and patterns"

  • It did need to see an additional file and some css definitions. So I went and grabbed them for it.

  • The new agent and I discussed the plan, and then I told it to get coding.

I had become the Agent’s assistant, running between apps at its command :blush: But the whole thing worked a treat, and we now have a solid version of the old feature working in the new app!

Importantly, the way this feature was to work in both apps was not exactly the same. I believe this is crucial to what the OP was requesting, because it is rare that we simply want to re-use code 100% in the same way across apps.

Vibe engineering, rather than having libraries of re-usable drop-in functions, allows us to be more flexible like this. So I guess yes, we need libraries, but only as study material for the agent to reference.

I’d be interested in other people’s thoughts on this.

2 Likes

Edit: I can read.