Slock
Give each Slock worker its own Mem AI Identity when Slock launches Codex, Claude Code, or another agent runtime.
Slock can run several named agents on the same computer. Nowledge Mem should treat those agents as separate workers, not as one anonymous Codex or Claude session.
The setup is deliberately small: connect the AI tool Slock launches first, then set one environment variable on each Slock agent.
What You Need
- Nowledge Mem is running.
- The AI tool Slock launches is already connected to Mem, such as Codex or Claude Code.
- Each Slock worker has a stable role, such as Cindy, Alice, or Reviewer.
First Useful Setup
Create one Mem AI Identity for the Slock worker:
nmem agents upsert cindy \
--name "Cindy" \
--default-space onboarding \
--instructions "Help with onboarding. Explain one step at a time."This creates the Mem AI Identity named Cindy. Its command and environment ID is cindy.
This command only creates the identity record. It does not make every Codex session use Cindy. The identity is used only where you set NMEM_AGENT_ID=cindy or explicitly pass agent_id="cindy".
Then open the Slock agent's runtime config and add one environment variable:
NMEM_AGENT_ID=cindy
That is enough when the Mem AI Identity already has a default space.
Moving Cindy Later
The Cindy identity belongs to Mem, not to Slock. If you later move Cindy to another orchestrator, keep NMEM_AGENT_ID=cindy and configure the new launcher to pass that environment variable.
The AI tool can change too. Cindy can start in Codex and later run in Pi or Claude Code. In that case, update the connector and --source-app to the new AI tool, but keep the same Mem AI Identity.
If you need a related but different worker, create a new identity such as cindy-reviewer. That keeps Cindy stable while letting the new worker evolve its own Rules.
When To Add Space
NMEM_SPACE is optional. It applies to the whole Slock runtime process.
Use it only when this Slock agent should override the identity's default space for every Mem read and write during that run:
NMEM_SPACE=onboardingIf the agent may work across different projects, leave NMEM_SPACE unset and change the active space from Mem or from the command the agent runs.
Do Not Add A Second Identity By Default
Most users should not set NMEM_HOST_AGENT_ID.
Use NMEM_HOST_AGENT_ID only when an integration author or advanced user needs to map a host-local immutable id, such as slock:<uuid>, onto a Mem AI Identity. For normal Slock setup, NMEM_AGENT_ID=cindy is clearer and enough.
What Success Looks Like
With nmem 0.9.0 or later, start a fresh Slock worker session and ask it to check Mem:
nmem --json context --source-app codexInside the Slock worker, the command should inherit NMEM_AGENT_ID=cindy and return the worker identity you configured. If you run the same check from a normal terminal instead, pass the identity explicitly:
nmem --json context --agent-id cindy --source-app codexThe source app should still be codex, claude-code, or whatever Slock actually launched; the Mem AI Identity is the named worker.