Skip to content
Charming Docs
Esc
navigateopen⌘Jpreview
On this page

Code export

The code behind your app is yours: export it anytime and reuse it anywhere.

What you can do

The code behind your app is yours. It has three parts: the module is the app’s business logic, the ui is the interactive interface, and the styles are the visual look. You can export all three at any time and reuse them: move an app between agents, back it up, or hand it to a different tool. Anyone who can edit the app can export its code; someone with view-only access can’t.

Technical

Exporting source is an agent action. Ask your agent rather than looking for it in App settings.

Copy this prompt for your agent

Export the source for one of my Charming apps so I can reuse it (turn
it into a new app, back it up, or move it to a different agent). Read
https://charm.ing/docs/capabilities/code-export.md first. List my
apps and ask me which one, or if I've only got one, use that, then
export the source.

How an agent performs this job

To export source, an agent calls get_app_source({ app_id }) over MCP or GET /app/<id>/source over HTTP. Both return the same payload: id, url, manifestId, displayName, a server-owned revision, capabilities, and source: { module, ui, styles }. To turn that source into a new app, pass source.module (and ui, styles) into a fresh create_app / POST /app call; if you keep the same manifest.id and you’re the owner, create_app replaces your existing app’s stored source in place instead of creating a new row, so bump manifest.id when the new app should live on its own.

The contract

get_app_source and GET /app/<id>/source require the same edit access as update_app: the caller must be the owner or hold a collaborator (or team-member) grant on the app; get_app_source fails with not_found for anyone else. The HTTP route accepts the original chrm_app_* edit token (unclaimed apps) or a signed-in chrm_user_* token with that access (claimed apps); a render token or claim cookie is rejected.

Limits and access

  • Who can export. The owner, a collaborator, or a team member with write access can call get_app_source; an end-user or viewer share (read/run only, no edit) can’t.
  • Another way to get a copy. Instead of exporting and re-creating an App yourself, enable Template. People who can already view the source App can then make a copy. Publish it as Listed if anyone should be able to discover and copy it without access to the source App or its data.

Was this page helpful?