Skip to main content

ClariLayer Docs

Quickstart

Quickstart

Quickstart

Connect your AI, save one decision or rule, and recall it across projects and sessions.

1. Connect your client

1. Connect with your AI

Paste the prompt into your AI to connect. Then start with a file, a past conversation, or a rule you already use.

Your choice of what to remember comes later. Setup alone does not authorize saving or importing.

Read onboarding prompt
Read https://app.clarilayer.com/agents.md and help me set up ClariLayer and complete my first task.
Connection-only prompts and manual setup

Ask Claude Code to set it up

Copy this prompt and paste it into Claude Code. Your AI will help you set up the connection and check it. You may need to complete a browser sign-in or restart your AI.

Connection status updates only after ClariLayer receives a successful health check.

View setup prompt
Help me connect ClariLayer to Claude Code.

This prompt authorizes connection setup only. Do not upload or bootstrap any context, call write tools, or create or edit project instruction files. Do not claim that copying this prompt or writing configuration means the connection works.

Connection details:
- Server name: `clarilayer`
- Transport: remote MCP over Streamable HTTP
- URL: https://app.clarilayer.com/api/mcp/mcp

Preserve all unrelated client configuration. Inspect through the client's settings or a private local helper that emits only the server-present, transport-matches, and URL-matches booleans. Never read an entire config into chat or emit raw config, CLI output, headers, or token values. If a server named `clarilayer` already exists, do not overwrite, remove, rename, or duplicate it. Compare its transport and URL with the details above, report any difference, and ask me before making a narrowly scoped update through the client's supported settings.

Prefer OAuth when this client exposes a compatible login flow. ClariLayer OAuth has not been verified end to end for every client, so do not promise it will be available. If OAuth is unavailable and this client supports secure bearer-token, API-key, or Authorization-header configuration, tell me to create or copy a ClariLayer context key and enter it directly in that secure client field. Never ask me to paste, send, or repeat the key in this chat, and never place it in chat text, command history, logs, screenshots, or project files.

For Claude Code, inspect the existing MCP entry first. If no `clarilayer` entry exists and you can run the local CLI, add it with `claude mcp add --transport http clarilayer https://app.clarilayer.com/api/mcp/mcp`. Then use Claude Code's `/mcp` flow to authenticate when OAuth is offered. If you cannot operate the local CLI, guide me through the same steps.

After setup, tell me if the client needs a refresh or restart. Verify only with read-only MCP tool discovery and then `clarilayer__health`. Report the connection as working only after the health call succeeds. If you cannot access connector settings or tools from this session, give me the exact UI or CLI steps I must perform and wait for me to report the result.
Manual connection settings

Run in your terminal

claude mcp add --transport http clarilayer https://app.clarilayer.com/api/mcp/mcp --header "Authorization: Bearer cl_YOUR_CONTEXT_KEY"

Replace cl_YOUR_CONTEXT_KEY with the context key you mint in ClariLayer. The key is shown once at creation, so paste it straight into the command above. Keep it out of prompts, tickets and screen recordings.

Optional: install or update project instructions

Install or update ClariLayer instructions

This Claude Code prompt targets only CLAUDE.md. Paste it into that local agent. The agent inspects one file and asks before editing. An already-current or conflict decision, or an approved write, reports installed, already current, or conflict/manual review; declined approval stops without claiming an installation state. Copying it here does not edit your repository.

Install or update ClariLayer's managed instructions for Claude Code.

ClariLayer's browser and remote MCP server have not edited any local file. You are the local agent performing this repository-local inspection. The user's act of pasting this scoped update prompt authorizes a safe create or replacement limited to the recognized ClariLayer managed range or an exact published legacy block in the one target below. Do not ask for redundant approval for that safe case. An ambiguous, malformed, or hand-edited legacy conflict requires an exact one-file diff and explicit confirmation before any change.

1. Call the ClariLayer MCP tool `get_project_stanza` with `mode: "full"`. Use its structured `managed_block`, `managed_block_template`, `managed_instance`, `legacy_stanza`, `legacy_stanzas`, `legacy_managed_blocks`, `append_once_sentinel`, `client_targets`, and `managed_apply_guidance` fields exactly; do not recreate or paraphrase their contents.
2. Select only the `claude-code` descriptor and confirm that it names exactly `CLAUDE.md`. If the descriptor or the pinned metadata below differs, change nothing and report `conflict/manual review`.
3. Inspect exactly `CLAUDE.md`. Do not inspect or modify any other project instruction target.
4. This selected target has no required preamble.
5. No authenticated project report scope was supplied. Use managed_block as target_managed_block and do not invent instance metadata.
6. If the selected target already contains a range byte-identical to target_managed_block, change nothing and report `already current`.
7. If the current target contains one exact published v1/v2/v3 managed range, replace only that range with target_managed_block. Do not remove or rebind an exact scoped current-v4 range without authenticated project report scope; leave it unchanged, report `conflict/manual review`, and guide the user to the signed-in Connect update path. If it contains one exact legacy_stanza or legacy_stanzas item, replace only those exact bytes. A normal new install or these safe replacements are already authorized by this prompt: preserve every byte outside the selected range and do not ask again.
8. If legacy heading text is present but no exact legacy block matches, or a managed range is hand-edited, unknown/newer, malformed, or ambiguous, change nothing. Show the complete exact one-file proposed diff with no elision and ask for confirmation; without confirmation report `conflict/manual review`. Never silently downgrade an unknown/newer range.
9. Translate the canonical guidance's internal `already-current` label to `already current`, and `conflict/manual-review` to `conflict/manual review`. After an authorized create or replacement, report `installed`. Report exactly one terminal state with no alternate spelling: `installed`, `already current`, `conflict/manual review`.
10. Before any write, retain the exact bytes before and after the selected range. After the write, re-read the complete selected target. Report `installed` and submit a local attestation only if the installed range equals target_managed_block, carries the pinned version/hash and no instance metadata, and every surrounding byte is unchanged. If verification fails, report `conflict/manual review` and do not attest installation.
11. No authenticated project report scope was supplied. Do not call sync_instruction_setup or invent project/installation identifiers; report only the local terminal state.

Selected target: CLAUDE.md
Managed protocol version: 4
Managed payload hash: sha256:2a549743ee65b0cc81e8bd57cc30cf437fd30278f1780730616448fd3ac83a0d
Managed begin marker: <!-- BEGIN CLARILAYER MANAGED INSTRUCTIONS -->
Managed end marker: <!-- END CLARILAYER MANAGED INSTRUCTIONS -->
This target has no required preamble. Do not invent one.

Canonical fail-safe guidance:
Select exactly one client target; never touch more than one instruction file. target_managed_block means managed_block_template with only its four typed placeholders filled from the explicit Connect report scope and locally computed refs; without that scope it means the generic managed_block. For Cursor, if the selected target already exists, require its exact required_preamble before any already-current, append, or replacement decision; otherwise return conflict/manual-review and change nothing. If that target contains exactly one well-formed managed range with the published begin marker before the end marker, compare the entire range: when it is byte-identical to target_managed_block return already-current and change nothing. During an explicit scoped Connect update, an exact generic managed_block or an exact current-v4 range carrying only the four recognized typed instance metadata lines may be rebound by replacing only that range with target_managed_block. When it is byte-identical to one legacy_managed_blocks item replace only that marked range. Any other well-formed range, including a hand-edited or unknown/newer version, is conflict/manual-review: show the complete exact one-file replacement diff and require confirmation before replacing it. Duplicate, nested, reversed, or unmatched markers are conflict/manual-review: change nothing. With no managed marker, replace only a byte-identical legacy_stanza or one exact legacy_stanzas item. If append_once_sentinel exists but the full legacy bytes differ, return conflict/manual-review and change nothing. If neither markers nor the legacy sentinel exists, append target_managed_block during an explicit scoped Connect update, otherwise append managed_block, to an existing Claude Code or Codex target, or create the selected target with the same selected block. For Cursor, create the target with its exact required_preamble, a blank line, then that selected block. An unscoped update must not remove or rebind a recognized scoped current-v4 range. Before a write, retain the exact surrounding bytes. After a write, re-read the selected target and require the current managed range, version and hash plus byte-identical surrounding content before reporting installed or attesting the result. Never edit bytes outside the recognized managed range or exact legacy block, never delete unrelated content, and never claim the server or browser edited a file.

The browser and remote server did not edit a file.

Older shortened ClariLayer section?

Use this only for an early ClariLayer section that kept the old heading but was shortened or edited. The standard installer above remains the default and safely sends that state to manual review. Copying this opt-in recovery prompt only hands instructions to your selected local agent; the browser and remote server have not read or edited your repository.

Recover one older shortened ClariLayer section in Claude Code's project instructions.

This is a separate, opt-in guided legacy migration. The normal managed installer must remain fail closed for edited legacy text. ClariLayer's browser and remote MCP server have not read or edited this repository; you are the selected local agent, and only you may inspect or change the one target below after explicit approval.

Follow this algorithm exactly:

1. Call the ClariLayer MCP tool `get_project_stanza`. Use its structured `managed_block`, `managed_version`, `managed_hash`, `managed_markers`, and `client_targets` fields exactly; never recreate, paraphrase, or partially copy `managed_block`. Select only the `claude-code` descriptor. Require its `client` to be `claude-code`, its `target_file` to be `CLAUDE.md`, and its `required_preamble` to be null. Require all returned version, hash, and marker metadata to match the pinned values below, and require `managed_block` to carry those exact markers and metadata. Any mismatch is unsafe.
2. Read the entire byte content of exactly `CLAUDE.md`. Do not inspect or modify any other project instruction target. The browser and remote server have not performed this read or any write.
3. Recovery is eligible only if every condition below is true:
   - No managed begin marker or managed end marker occurs anywhere in the file.
   - The exact line `## ClariLayer — your data context layer (use it proactively)` occurs exactly once in the whole file, and that sole occurrence is a real Markdown H2 heading outside every backtick or tilde fenced code block. Heading-shaped text inside fenced code is not eligible.
   - The candidate section is unambiguously bounded from the first byte of that H2 heading through immediately before the next real Markdown H1 or H2 heading outside fenced code, or through EOF when no later H1/H2 exists.
   - Preserve the exact separator at that boundary instead of consuming it. Before a following heading, take the maximal contiguous whitespace-byte suffix immediately preceding that heading, require it to contain at least one complete line ending, and keep that suffix outside the replacement range so the following heading remains at the start of its original line. At EOF, likewise keep any maximal trailing whitespace-byte suffix that contains the file's final line ending outside the replacement range; if there is no final line ending, preserve the no-trailing-newline state. These preserved bytes are not part of `managed_block` and must not be normalized.
4. Fail closed on any unsafe state. A missing or duplicate exact heading, a heading that exists only inside fenced code, an unterminated or ambiguous fence, an ambiguous section boundary or boundary separator, any complete/malformed/partial/duplicate/nested/reversed managed marker, any selected-target or pinned-metadata mismatch, or any other uncertainty means: change nothing, report `conflict/manual review`, and recommend manual review. Never append `managed_block` over the legacy section.
5. Before writing, show the exact full one-file replacement diff for `CLAUDE.md`: the complete bounded candidate replacement range removed and the complete canonical `managed_block` added, while every preserved boundary or trailing suffix byte appears as unchanged context, with no elision, summary, or truncation. Ask for explicit approval of that exact diff. If approval is declined, write nothing and claim no terminal installation state.
6. Immediately before any approved write, re-read the whole file as bytes and require byte-for-byte equality, including line endings, with the bytes used to produce the shown diff. If any byte changed concurrently, stop without writing and report `conflict/manual review`.
7. After approval, replace only the bounded candidate replacement range with the returned canonical `managed_block`. Preserve every byte before and after that range, including the exact boundary/trailing suffix isolated in step 3, unrelated content, whitespace, line endings, and the existing trailing-newline state. Never synthesize a separator by altering `managed_block`; retain the original separator outside it. Do not modify another instruction target.
8. Re-read the whole target after the write. Verify that the inserted managed range is byte-identical to `managed_block`; the pinned begin and end markers each occur exactly once and in that order; the installed version and hash match both the returned and pinned values; the exact old heading is gone; and every byte outside the replaced range is unchanged. Only after every check passes, report the existing terminal state `installed` and a separate supplemental receipt/detail exactly `guided legacy migration`. Do not create a new terminal state. If any verification fails, report it honestly and never call the result `installed`.

Selected recovery client: claude-code
Selected target: CLAUDE.md
Required preamble: null
Exact legacy H2: ## ClariLayer — your data context layer (use it proactively)
Managed protocol version: 4
Managed payload hash: sha256:2a549743ee65b0cc81e8bd57cc30cf437fd30278f1780730616448fd3ac83a0d
Managed begin marker: <!-- BEGIN CLARILAYER MANAGED INSTRUCTIONS -->
Managed end marker: <!-- END CLARILAYER MANAGED INSTRUCTIONS -->

The browser and remote server did not edit a file.

Copy the onboarding prompt and paste it into your AI. The shared guide helps it connect, offers to start with a file, a past conversation or a rule, then prepares a fresh-chat task. You may need to complete browser sign-in or restart the client. The public guide lists the tested client versions and authentication routes. Connection-only prompts and manual settings are available below the main prompt.

Setup alone does not authorize saving, importing, project-instruction edits, semantic processing, capture, or team sharing. Saying “remember X” authorizes saving X; your AI clarifies ambiguous content and checks for an equivalent before writing. A read-only connection can use an existing personal rule.

ClariLayer is the context layer you never have to curate. Start with one decision or rule you want your AI to remember. Start free. No credit card. See pricing.

After connecting, ask your agent to call clarilayer__health. A successful response confirms the authenticated workspace, not that a particular rule was used. If authentication fails, check your key or complete the claude.ai approval flow. Connection recovery has the details.

Optional: bring over selected history after connecting

Connecting ClariLayer does not read local history, install a collector, or accept past context. In Connect your AI, open client settings, select your local client, and choose Import history now under Optional: selected history and capture when available. You choose the history source, destination space and extraction provider. Review the extracted batch before accepting it. Ongoing capture is another explicit choice and can be paused or revoked.

Source support and extraction-provider support are different. Current qualified extraction uses the version-specific Claude CLI profile; OpenAI and Cursor extraction providers are unavailable, and native Cursor history qualification remains limited. Your selected source content is processed by the provider you choose. ClariLayer stores extracted context rather than a raw transcript archive.

2. Save one artifact or rule

Once connected, your AI asks where you want to start. Choose one of these in the chat, or skip this step.

  • A file. Point to one file or paste an excerpt. For a project note, the AI suggests a decision or rule and shows where it applies. Edit or approve it before saving. For a supported Analytics file, such as a SQL query or data dictionary, review the content to import before approving it.
  • A past conversation. Paste a passage and review the suggested rule. For a larger selected history import, choose the source, space and provider in Connect, then review and accept the batch. If local import is unavailable, you can still use a pasted excerpt.
  • A personal rule. Tell your AI what to remember or pick a saved rule. A read-only connection can use one that already exists.

Your AI checks the stored entry before suggesting a first task. If an import is partial, choose an item that was actually saved. A pending proposal still needs Inbox review.

3. Complete a task in a fresh chat

Use the fresh-chat continuation supplied by the shared guide. Give only your task or topic. If you chose an Analytics import, label the task “Analytics”. Leave out the saved answer and source file. The continuation goes directly to health, runtime guidance, recall, and the task; it does not ask you to save the rule again or open yet another chat.

Analytics entries carry asserted or caveat; general work memory is not independently verified.

Your AI uses recall_context for general work and get_analysis_context for an already-selected Analytics task. When needed it reads the full entry with get_context_entry, applies the rule to a concrete result, and explains the source and limitations. If general recall is unavailable, a permitted direct read of a known selected entry is direct readback, not recall. It must not invent a match or silently switch general work to Analytics. Read the recall reference.

Optional browser controls in Connect let you select a rule before a new recall, preview a scoped question, manually check delivery, and report whether it helped or skip. Preview does not run your agent or record agent use. A served trace only proves delivery to this actor/workspace; it cannot identify the client or chat or prove task correctness. Missing or partial evidence remains unknown. Chat feedback is separate from website feedback.

Optional: find context by meaning

You can search saved context by name without semantic indexing. When self-service consent is available, guided setup with an eligible selected starter reveals an optional organization-wide choice for an owner/admin. When the guide is off, this choice remains inside optional client settings before the manual connection instructions; it does not block the agent-led journey. Existing granted, withheld or revoked decisions are not re-prompted; an error dismissal writes nothing.

Enabling permits eligible existing and future entry names/main text and recall query text to be sent to Google through the Vercel AI Gateway; ClariLayer stores entry vectors. Indexing is asynchronous, and search availability depends on the service controls. Not now records withheld. Check progress or change consent in Account settings. Revocation removes stored embedding rows, but in-flight requests may finish and data already sent cannot be recalled. Read the semantic indexing privacy notice.

Credentials and other deployments

ClariLayer's MCP server is a remote, stateless Streamable HTTP endpoint at POST /api/mcp/mcp. Claude Code, Cursor, Codex, and other compatible clients can use the remote endpoint; claude.ai uses its hosted Connector flow. A client that supports only stdio needs a compatible HTTP bridge and is not directly supported by the generic route.

Use an MCP-capable client and a ClariLayer workspace. Local clients use a personal cl_… context key. context:read permits recall; saving or importing requires context:write. The full key is shown once: store it securely and keep it out of prompts, tickets and recordings. Revoke a lost key and create a replacement.

Prefer OAuth when the selected client offers a compatible flow. ClariLayer has not verified OAuth end to end in every client. When OAuth is unavailable, enter the context key directly in the client's secure bearer-token, API-key, or Authorization-header field; never paste it into AI chat. The production claude.ai connector uses OAuth approval, with no context key field. A self-hosted or other deployment must enable and configure OAuth before offering that path. Use the deployment's canonical app endpoint; do not replace it with a marketing URL.

Connection recovery and managed instructions

For a local-client authentication failure, check that the full key was installed and has not been revoked. For claude.ai, reconnect and finish the approval flow. Return to the client selector to open setup with your selected client; sign-in and signup preserve that choice.

Open Optional: install or update project instructions under your local client's snippet when you are ready to make recall part of your working routine.

The managed prompt names exactly one target for the client you selected. Copying it does not change your repository: your local agent inspects that one file, asks for approval before an edit, and preserves bytes outside the recognized ClariLayer range. An already-current or conflict decision, or an approved write, reports exactly installed, already current, or conflict/manual review; if you decline approval, the agent stops without claiming an installation state. A malformed managed range, a legacy stanza whose sentinel remains but whose full bytes differ, or incompatible Cursor frontmatter fails closed to manual review. For Claude Code and Codex, otherwise-unrecognized existing text is preserved while the managed range appends on first install.

If an early CLAUDE.md or AGENTS.md kept the exact old ClariLayer heading but shortened or edited the section underneath it, open Older shortened ClariLayer section? and explicitly copy the separate guided recovery prompt. The standard installer remains fail closed. The recovery option appears only for Claude Code and Codex, shows a full one-file replacement diff before asking for approval, and stops on ambiguous headings, fenced examples, marker fragments, or concurrent file changes. Cursor recovery stays manual because its frontmatter and target semantics differ. Neither copying option lets the browser or remote server read or write your repository.

Completion receipts for ongoing work

The managed instructions establish a completion loop: recall → confirmed live remember/reconcile → context_checkpoint. Your agent recalls before relevant data work, writes a confirmed durable change to live context with remember, and reconciles it when appropriate. If the suggestion still needs human review, it uses propose and stops for acceptance; proposal-only work cannot continue to a completion receipt. After an accepted proposal is live, or after another confirmed live outcome, the completion loop can continue.

A pending proposal is not live recall context, and an update_failed checkpoint does not allow completion. When the task made no durable context change, the agent can use no_update_required only after explicitly checking the relevant facets.

The receipt has a deliberately narrow meaning: it persists the agent's managed-protocol declaration (context_updated or no_update_required) and validates ownership and eligibility of any referenced ClariLayer objects. It does not independently prove that an entry changed during this task, that code deployed, that Databricks validation passed, that a query result is correct, or that the saved rule is semantically equivalent to an external system.

The four verbs

ClariLayer documents four verbs. General work starts with recall_context and explicit remember writes. bootstrap, get_analysis_context, and reconcile are the structured Analytics path.

  • recall — use recall_context for selected general work, preserving source and applicability. Use get_analysis_context as the additional specialist Analytics or CRM recall path.
  • remember — save a confirmed decision, fact, preference, rule, lesson, or Analytics definition so your agent can use it in later sessions.
  • bootstrap — import selected SQL, dbt, CLAUDE.md notes, a data dictionary or codebook, and semantic-layer models into Analytics context.
  • reconcile — check a saved SQL definition against warehouse actual_sample evidence or a HubSpot CRM contract against row-free crm_evidence; a mismatch is flagged as a caveat. Salesforce contracts remain store/recall-only.

Beyond the four verbs

Beyond the basic recall-and-remember loop, the agent can also:

  • Record a completion receipt — after the relevant recall and confirmed write/reconcile path, call context_checkpoint so the task has a durable context_updated or no_update_required receipt.
  • Harvest a whole session — on your explicit request, distill the durable facts from a working conversation and stage them in your Context Inbox for review (via propose / propose_batch). Nothing is auto-saved; you approve each, and the transcript is never sent to ClariLayer — only the distilled candidate facts.
  • Manage what's saved — reversibly retire context with archive / restore (and archive_reasoning / restore_reasoning for the caveats and assumptions attached to an entry), or remove it for good with forget.

What "checked" means

General work memory keeps its source and applicability visible, but it is not independently reconciled against an external source. When specialist Analytics reconcile runs against a supported warehouse or HubSpot evidence path, a declared-vs-observed mismatch is flagged as a caveat; otherwise the entry stays asserted. Those are the only public Analytics outcomes. The verified status remains gated and is not live. Read Verified vs Asserted for exactly what each status means and why.

Where to go next

  • The Context Layer explains selected memory, recall, source, applicability, correction, and specialist Analytics reconciliation.
  • AI Agent Context Guide shows the recall-first working loop in practice.
  • SaaS Metrics Definition Library is a reference for the metric definitions teams argue about most.
  • The For teams strand covers what happens as your personal context merges into shared, governed team context.