> For the complete documentation index, see [llms.txt](https://docs.living-memory.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.living-memory.app/javascript.md).

# JavaScript SDK quickstart

The SDK connects a Node or JavaScript app to a hosted credential-bearing Space. This example uses Node 18 or later and a write-capable capsule URL supplied privately as `LIVING_MEMORY_URL`.

```sh
npm install @nature-labs/living-memory-js@0.1.0
```

Save this as `example.mjs`:

```js
import { enterSpace } from '@nature-labs/living-memory-js';

const address = process.env.LIVING_MEMORY_URL;
if (!address) throw new Error('Set LIVING_MEMORY_URL privately.');

try {
  const space = await enterSpace(address);
  await space.remember('The project uses blue primary buttons.');
  const results = await space.search('What color are the primary buttons?');
  console.log(results);
} catch (error) {
  console.error(error.code ?? 'REQUEST_FAILED');
  process.exitCode = 1;
}
```

Run `node example.mjs` after configuring the environment variable in your private environment. Expected result: relevant entries with a `text` field. Empty results do not confirm recall succeeded.

## Current boundary

SDK version `0.1.0` was checked against the hosted service on 2 October 2026 for entry, remember and search. It exposes `enterSpace`, `remember` and `search`; it does not expose handoff/resume or account OAuth login helpers.

`enterSpace` requires discovery of both `memory_add` and `memory_search`. A read-only door therefore fails entry in this version even when the server supports reading it. Use a suitable MCP client for read-only access.

`ROOM_FULL` and `MEMORY_TOO_LARGE` are write failures. An oversized memory is not silently truncated. Do not blindly repeat an uncertain write.

Keep credentials out of browser bundles, public configuration and logs. Debug events can include the address and query; redact before sharing. See the [SDK source and API](https://github.com/v1b3x0r/living-memory-js) for details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.living-memory.app/javascript.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
