[Docs index](/docs.md) / [Sandcastles](/docs/sandcastles/overview.md) / Managing Sandcastle Data

---

# Managing Sandcastle Data

Every sandcastle with persistent state has one or more **collections** — document stores that hold the app's data. This guide covers how to view, edit, and manage that data outside the app itself.

## Before you begin

- You need at least execute access to the sandcastle to view data.
- You need edit or admin access to modify data or reset collections.

## Viewing collections and documents

Go to **Sandcastles**, click the sandcastle, then click **Data**. This opens the data browser.

- The **left sidebar** lists every collection the sandcastle has. Click a collection to see its documents.
- The **main panel** shows the documents in the selected collection as a scrollable list. Each document displays its fields and values.

Use this page to:

- Verify that the app is writing data correctly.
- Inspect a specific document's fields (useful for debugging).
- Understand the data shape before asking the AI to build a new view.

## Creating and editing documents

From the data browser, you can create new documents and edit existing ones directly. This is useful for:

- Seeding test data while developing the app.
- Fixing a bad record without going through the app's UI.
- Adding data that the app's forms don't cover yet.

Documents are JSON. Each document has a unique `_id` field assigned automatically.

## Resetting a collection

If the data is in a bad state (broken seed data, test pollution, schema drift), you can reset a collection from the data page. Resetting deletes all documents in the collection. This is a destructive action — you will be asked to confirm by typing the collection name.

Reset is useful during development. Be careful in production — there is no undo.

## How the linked subagent interacts with data

The linked subagent has its own set of state tools for reading and writing to the sandcastle's collections:

- **Find documents** — query with filters, sort, and pagination.
- **Insert documents** — add one or more new documents.
- **Update a document** — modify fields on an existing document.
- **Delete a document** — remove a document by ID.
- **Describe schema** — inspect the collection's field names and types.

These are the same operations the app's frontend uses, just invoked by the subagent instead of by a user clicking a button. This is how you automate data maintenance: schedule the subagent to clean up stale records, sync data from an external system, or generate summary documents.

## Limits

- **100 documents per query.** If a collection has more than 100 documents, use filters to narrow the result set, or paginate with `skip` and `limit`.
- **Collections are workspace-isolated.** A sandcastle cannot read another sandcastle's collections, and a user in another workspace cannot see yours.
- **Structured data only.** Collections store JSON documents, not files. For file storage, use the linked subagent's filesystem.

## Next steps

- [Editing a sandcastle](./editing-a-sandcastle.md) — add views that use the data.
- [Subagents overview](../subagents/overview.md) — automate data operations through the linked subagent.
- [Troubleshooting](./troubleshooting.md)

---

## Navigation

### In this section: Sandcastles

- [Sandcastles](/docs/sandcastles/overview.md)
- [Use Cases and Playbooks](/docs/sandcastles/use-cases.md)
- [Troubleshooting](/docs/sandcastles/troubleshooting.md)
- [Creating a Sandcastle](/docs/sandcastles/creating-a-sandcastle.md)
- [Editing a Sandcastle](/docs/sandcastles/editing-a-sandcastle.md)
- **Managing Sandcastle Data** (current)

#### Playbooks

- [Playbook: Build a Budget Variance Dashboard](/docs/sandcastles/playbook-budget-variance-dashboard.md)
- [Playbook: Build a Contract Renewal Tracker](/docs/sandcastles/playbook-contract-renewal-tracker.md)
- [Playbook: Build a Purchase Approval Tracker](/docs/sandcastles/playbook-purchase-approval-tracker.md)
- [Playbook: Build a Vendor Performance Scorecard](/docs/sandcastles/playbook-vendor-performance-scorecard.md)

### Other sections

- [MCP Servers](/docs/mcp-servers/overview.md)
- [Tool Creation](/docs/tool-creation/overview.md)
- [Agent Filesystem](/docs/agent-filesystem/overview.md)
- [Chat Sharing](/docs/chat-sharing/overview.md)
- [Scheduled Triggers](/docs/scheduled-triggers/overview.md)
- [Agent Skills](/docs/agent-skills/overview.md)
- [Subagents](/docs/subagents/overview.md)
- [Workspace Permissions](/docs/workspace-permissions/overview.md)

[Back to docs index](/docs.md)
