Skip to content

Setup

Open in ChatGPT Open in Claude
SDK initialization flow: load script, identify user, show agent 1 Load SDK <script> snippet async, non-blocking 2 Identify user foldspace.identify() ties session to user 3 Show agent .agent(key).show() widget appears inside foldspace('when', 'ready', ...)

Install the Foldspace SDK with one snippet. Copy yours from Agent Studio → Setup (pre-filled with your loader URL and Agent Key) and paste it before the closing </body> tag. The SDK loads asynchronously, so it never blocks or slows your site.

index.html
<body>
<!-- Your HTML content goes here -->
<script type="text/javascript">
(function (w, d, u, n, k, c) {
w[n] = w[n] || function () { (w[n].q = w[n].q || []).push(arguments); };
w.__FOLD_SPACE__ = n; w[n].k = k; w[n].c = c;
var s = d.createElement('script'); s.async = true; s.src = u + '?k=' + k;
var h = d.getElementsByTagName('script')[0]; h.parentNode.insertBefore(s, h);
})(window, document, 'https://script.eucerahive.io/web/sdk/foldspace.js', 'foldspace', 'YOUR-AGENT-KEY');
// Identify the signed-in user so the agent has real context and conversation
// history persists for this user across sessions and devices.
const context = {
user: { id: 'YOUR-USER-ID' },
subscription: { id: 'YOUR-SUBSCRIPTION-ID' },
};
foldspace('when', 'ready', () => {
foldspace.identify(context);
foldspace.agent('YOUR-AGENT-KEY').show();
});
</script>
</body>

Replace YOUR-AGENT-KEY with your Agent Key from Agent Studio → Setup.

foldspace.identify() ties the session to your signed-in user. This is what gives the agent real user context and persists each user’s conversation history across sessions and devices, instead of treating every visit as a new anonymous session.

Identity is built in, so the agent runs without identify(), but pass your real user.id (and subscription.id, if you bill by subscription) in production. Add fields like email, name, role, or your own attributes to enrich context and analytics. See User context for the full field list and custom attributes.

Set the agent’s appearance, greeting, and behavior in Agent Studio → Style & Behavior, or override it in code from the SDK configuration reference.

Once you have your Agent Key, you can skip the manual wiring and let your AI coding tool do the integration:

Set up with your AI coding tool

Install the Foldspace plugin and your AI coding tool will integrate Foldspace for you: add the agent, connect your authenticated users, and discover your product's actions.

Terminal window
# Add the Foldspace marketplace (one time)
claude plugin marketplace add foldspace-ai/plugins
# Install the codebase plugin
claude plugin install foldspace-codebase-plugin@foldspace-plugins
# Provide your API key
export FOLDSPACE_API_KEY=xxxxxxxx

Then ask the agent: "Integrate Foldspace into this app."

Browse the plugins on GitHub →