Cognis — Persistent Memory for AI Agents
Cognis gives you long-term memory that persists across sessions. Memories are scoped per-user and per-project, with optional team-wide sharing.
Setup
The LYZR_API_KEY environment variable must be set. Get a key at studio.lyzr.ai.
export LYZR_API_KEY="your-key-here"Optionally set COGNIS_OWNER_ID to override the default owner (system username).
Scoping
Cognis uses two levels of scoping to keep memories organized:
- owner_id: Identifies the user. Defaults to the system username (
whoami). Override withCOGNIS_OWNER_ID. - agent_id: Identifies the project context.
- Personal scope: claudecode_<sha256(git_root)[:16]> — unique per user per project. - Team scope: repo_<sanitized_repo_name> — shared across all contributors to a repo.
The scripts detect the git root and remote automatically. No manual configuration needed.
Saving Memories
Save something the user wants to remember:
bash scripts/cognis-save.sh "The user prefers PostgreSQL for all new services"Save a team-wide memory (visible to all repo contributors):
bash scripts/cognis-save.sh "Deploy process: run migrations first, then deploy API, then workers" --teamRead references/api-reference.md for full parameter details.
Searching Memories
Search for relevant memories:
bash scripts/cognis-search.sh "what database do we use"Search only team memories:
bash scripts/cognis-search.sh "deployment process" --repoSearch both personal and team:
bash scripts/cognis-search.sh "auth setup" --bothGetting Assembled Context
Fetch relevant context (combines short-term and long-term memory):
bash scripts/cognis-context.shThis returns assembled context for the current project, including relevant personal and team memories.
When to Use Personal vs Team Scope
- Personal (default): User preferences, individual notes, personal workflow details, things the user says about themselves.
- Team (
--team): Architecture decisions, deployment processes, coding conventions, shared knowledge that any contributor would benefit from.
Gotchas
- Memories are extracted asynchronously by default. Use the search endpoint to verify a memory was stored (it may take a few seconds).
- The
LYZR_API_KEYmust have access to the Cognis memory service. If you get 401/403 errors, readreferences/quickstart.mdfor troubleshooting. - Scripts output JSON to stdout and diagnostics to stderr. Parse stdout for programmatic use.
- All scripts are idempotent — safe to retry on transient failures.
Available Scripts
scripts/cognis-save.sh— Save a memory (personal or team scope). Runbash scripts/cognis-save.sh --helpfor usage.scripts/cognis-search.sh— Search memories with semantic matching. Runbash scripts/cognis-search.sh --helpfor usage.scripts/cognis-context.sh— Get assembled context for the current project. Runbash scripts/cognis-context.sh --helpfor usage.
References
- Read
references/quickstart.mdfor first-time setup and verification. - Read
references/api-reference.mdif you need to call the Cognis API directly or need full parameter details. - Read
references/architecture.mdto understand how scoping and memory storage works. - Read
references/use-cases.mdfor patterns like session capture, codebase indexing, and team knowledge bases.