Agent-first governance connection

Agent-first setup

The primary interface is CLI/API/MCP. The owner signs in, handles subscription choices and issues a setup key. The coding agent completes setup without further web forms. The dashboard offers the same workspace/policy/key management as an optional alternative.

python -m pip install --upgrade atmem==2.3.18
atmem setup --token-stdin --agent coder --json

Supply the key through private stdin, ATMEM_API_KEY, a protected credential file, or omit --token-stdin to use the private interactive prompt. --home selects a private root. --scope defaults to project:shared. --host-config merges a JSON MCP host configuration without replacing unrelated servers; other host formats use the returned generated entries and their host's own configuration tooling.

The setup key has a management-only profile: workspaces:manage, policy:write and keys:manage, with no native-memory scopes. Only an authenticated owner can issue it. It cannot administer billing, delete the account or mint further account setup keys. The CLI creates a separate scoped project credential, activates it and verifies the actual MCP processes. Keys never appear in generated MCP configuration.

Each agent gets a separate Home and identity. Agents sharing a workspace use the same user-owned database by default under that private root. Separate machines need the same user-hosted service or provider; scope names do not synchronize stores.

The generated atmem-admin MCP entry exposes only management operations. Native memory uses the separate atmem entry. Setup can be retried with the same key and parameters; local registrations are retained for uncertain network responses. A successful result means the CLI checked enrollment and real MCP initialization, not that a host has reloaded its configuration or that a model received context.

Manage from CLI or MCP

atmem workspace entitlements --credential-file /private/management/connection.json --json
atmem workspace workspaces --credential-file /private/management/connection.json --json
atmem workspace create-workspace --name "Project B" --request-id project-b-v1 --credential-file /private/management/connection.json --json
atmem workspace policy --workspace WORKSPACE_ID --credential-file /private/management/connection.json --json

Use the management credential path returned by setup. set-primary selects the active workspace. Creation respects the current plan: Free/Starter one workspace, Pro ten. An ordinary project key stays within its own workspace and delegated permissions. The administration MCP tool accepts the equivalent operations and cannot substitute a different local credential file.

GET /v1/entitlements reports limits/reset time without Stripe financial references. Account setup operations use the existing bounded administrative allowance; ordinary project-agent cloud calls use the plan's agent request allowance. Local memory and provider calls do not consume that cloud allowance.

Connect your local AtMem runtime to the access rules in your AtMem.ai workspace. Each agent uses its own scoped key.

Agents, models, providers and canonical memory remain on user infrastructure. The optional cloud connection synchronizes policy and attributes agent API activity; it does not upload local memory or supply model compute.

Connect an agent

Create a scoped key in your workspace, then run:

atmem connect --scope project:shared --out atmem.mcp.json

Enter the key at the private prompt. This checks the identity and scope, saves the credential privately, activates the supported access guard, and writes a secret-free MCP configuration. Add its mcpServers entry to your agent's MCP configuration.

For two agents using one native memory store, give them different keys and Homes and the same explicit database path and permitted scope:

atmem connect --home /private/agent-a --db /private/project/memory.db --scope project:shared --out agent-a.mcp.json
atmem connect --home /private/agent-b --db /private/project/memory.db --scope project:shared --out agent-b.mcp.json

For automation use --token-stdin, or --credential-file with a private key registration produced by atmem workspace create-key. Keys never appear in the output or generated MCP configuration. A rejected scope does not activate access.

Enroll and activate

Sign in with Google or X in the governance dashboard. Create a workspace, policy, agent identity and scoped key. Then enter the key through a hidden prompt:

atmem login
atmem governance status --json
atmem governance sync --json
atmem governance activate --json

For an agent secret manager, atmem login --token-stdin reads the key from stdin. Never pass it in argv. --api-base selects an explicitly trusted HTTPS deployment. Credentials are saved to an owner-only local connection file. Policy must validate before activation is saved. Restart the native memory MCP server after activation.

atmem mcp --db /your/shared/memory.db --subject project:shared

Each separately identified agent needs its own OS configuration directory/key. Agents can share the same canonical database and explicitly granted project scope. Use supported database concurrency and AtMem's existing provenance and revision contracts; a shared key is not separate agent attribution.

The native MCP guard caches policy for at most five minutes while tools are used. Expired/revoked credentials or failed refreshes withhold memory access. Bounded read responses are withheld if they exceed the policy byte budget. Existing raw SDK and other MCP profiles do not automatically become governed by this optional connection. User-controlled software can change local settings.

Govern signed delegated context

The same activated connection also governs DelegatedContextService.prepare, the existing signed context path used by Mem0, LangGraph, Pydantic AI and custom providers. Keep their authenticated local registration and explicit activation; the cloud policy does not replace signature verification or local trust.

Use the exact enrolled agent/workspace IDs in the delegated binding, and grant its user_id as a shared scope. Add the registration's exact provider_id to providerKinds and explicitly allow delegated queries with remoteContextAllowed: true. This consent is required even for a loopback adapter, because it can consult a remote database or model. Its own configured network access remains under your control.

Before a query reaches the provider, the entry point verifies the binding, scope, provider and current policy. It narrows the provider's byte budget to the governed maximum. The returned envelope must still pass real signature, binding and digest checks before canonical acceptance/delivery. A managed delegated failure withholds context and does not silently use native fallback; unenrolled local configurations retain their explicit existing fallback policy. Restart the selected host process after activation or deactivation.

Delegate administration to agents

Owner-created keys may explicitly grant policy:write and/or keys:manage. Ordinary keys cannot manage other agents. Even administrative keys cannot manage billing or sign-in accounts, cross workspaces, widen their scopes or delegate a longer expiry. Policy updates require the current expectedRevision. Administrative permissions are checked separately from the memory allow list; revoke the key to remove administrative authority. Parent-key revocation also disables its delegated descendants, with at most four delegation hops.

atmem workspace policy --json
atmem workspace policy --file reviewed-policy.json --json
atmem workspace keys --json
atmem workspace create-key --agent reviewer --scope project:shared --activate-memory --out /private/reviewer-connection.json
atmem workspace revoke-key --key-id KEY_ID --json

Create-key saves the new secret to an owner-only connection file before attempting registration. Repeating the command with the same output path retries the same registration after an uncertain network outcome; it does not generate another secret. The JSON result contains the path and nonsecret metadata. The target agent must select that credential in its own runtime configuration and be allowed by policy before receiving memory.

--activate-memory explicitly permits the new agent to use native memory in existing workspace scopes. Delegated agents need policy:write as well as keys:manage for this option. It cannot widen existing scope or provider grants. Matching scope names alone do not synchronize databases on separate machines; use a shared user-hosted store or configured provider for remote teams.

The same operations are available through the governance_workspace MCP tool with operation, file, agent, scopes, permissions, expires_days, activate_memory, out and key_id. MCP callers can provide a structured policy object directly instead of a local file, including its expectedRevision. Native memory discovery remains secret-free through memory_capabilities. Administration is subject to explicit key permissions.

Cost and recovery

Plan allowances count agent cloud API requests, not every local remember/recall call. Caching reduces cloud requests. The three-day trial continues on Free after expiry; paid plans increase request, workspace and activity-history capacity. Local models/providers are funded by the user. Expired trial or insufficient plan allowance returns an explicit error and the guard fails closed. Check the governance account to review or resolve access. Administrative limits can temporarily block cloud operations.

atmem governance deactivate disables the optional guard locally without needing a working remote key; restart MCP. atmem logout removes the local credential but does not revoke it remotely. Revoke in the dashboard or through a separately authorized administration key. Previously returned data and third-party copies are not erased by revocation.

Upgrade and rollback

Connection/policy formats are versioned (...-v1). Unsupported formats fail closed. Before package upgrades, back up local databases/configuration using AtMem's existing supported backup and reversible migration procedures. Stop shared MCP writers during changes that require a database migration. Keep exact package pins and the last compatible backup; never open a migrated database with an older package unless the migration contract allows it. No additional schema migration is introduced by this optional connection or context discovery.

Keep upgrades under the user’s control; select and pin a compatible release for your host and providers. Published support terms are separate from package compatibility.