Skip to main content

Memory and skills

OpsCode provides two complementary mechanisms for customizing agent behavior across sessions:

  • Memory (AGENTS.md and /memory) — Persistent context loaded at the start of every session. Use memory for repository conventions, naming standards, cloud account mappings, and architectural rules.
  • Skills (SKILL.md) — Modular, on-demand instruction sets loaded only when relevant to the current task. Use skills for detailed runbooks, domain playbooks, and multi-step engineering workflows.

Memory​

AGENTS.md files​

AGENTS.md files define persistent instructions that OpsCode loads automatically at session startup:

LocationScopeTypical contents
.opscode/AGENTS.md or ./AGENTS.mdProject-level (committed to Git)Terraform module layout rules, required resource tags, target Kubernetes cluster conventions
~/.opscode/{agent}/AGENTS.mdUser-levelPersonal preferences, preferred CLI flags, output formatting style

When both files exist, OpsCode loads both and gives project-level instructions higher priority.

Saved memories (/memory)​

As you work in an interactive session, OpsCode can save learned facts to disk so you never have to repeat yourself:

Remember that all S3 buckets in this repo must use KMS key alias/prod-data-key

Memories are stored in two locations:

ScopeDirectoryPriority
Project.opscode/memory/Higher (overrides user memory with the same key)
User~/.opscode/memory/Fallback across all repositories

Manage saved memories interactively using /memory:

/memory                    # List all active memory entries
/memory save <key> # Save a specific memory entry
/memory delete <key> # Delete a memory entry
Context window guardrails

To prevent saved memories from crowding out your active conversation, OpsCode caps injected memory at 200 lines or 25 KB per session. Put lengthy reference guides inside a Skill instead.

Skills​

Skills are self-contained directories containing a SKILL.md file (plus optional helper scripts, templates, or reference docs). OpsCode uses progressive disclosure: it reads skill descriptions at startup, and loads the full SKILL.md body only when your task matches that domain.

Global vs. subagent skills​

  • Global skills: Loaded into the root orchestrator agent (cloud-core, docker, kubernetes, remember, plus your custom skills).
  • Subagent skills: Bundled inside specialized subagents (34 domain skills across OpenTofu, Terraform, Ansible, Helm, GitHub Actions, and Jenkins). These consume zero tokens until the subagent is invoked.

Skill directory structure​

my-skill/
├── SKILL.md # Required — instructions with YAML frontmatter
├── scripts/ # Optional — helper scripts executed by the agent
├── references/ # Optional — detailed domain documentation
└── assets/ # Optional — boilerplate templates and examples

SKILL.md format​

Every SKILL.md starts with YAML frontmatter defining name and description:

.opscode/skills/kubernetes-hardening/SKILL.md
---
name: kubernetes-hardening
description: "Author, audit, and troubleshoot Kubernetes manifests following Pod Security Standards"
---

# Kubernetes Hardening Workflow

When authoring or reviewing Kubernetes workload manifests:

1. Define explicit CPU and memory `requests` and `limits` on every container.
2. Configure `readinessProbe` and `livenessProbe` with explicit timeouts.
3. Enforce non-root execution (`runAsNonRoot: true`, `allowPrivilegeEscalation: false`).
4. Include standard labels: `app.kubernetes.io/name`, `app.kubernetes.io/instance`, `app.kubernetes.io/version`.

Skill resolution order​

When multiple skill directories contain a skill with the same name, the highest-priority source wins:

PrioritySourcePath
1 (Highest)Project agent skills.agents/skills/
2Project OpsCode skills.opscode/skills/
3User agent skills~/.agents/skills/
4User OpsCode skills~/.opscode/skills/
5Plugin skillsInstalled marketplace plugins
6 (Lowest)Built-in skillsBundled with OpsCode

Create and invoke skills​

Scaffold a new skill from the terminal:

ops skills create release-checklist

Or distill your current interactive session into a reusable skill automatically:

/skill-create

Invoke a skill explicitly at launch or during a session:

# Pre-load a skill at CLI startup
ops -s kubernetes-hardening
# Inside an interactive session
/skills # Browse all discovered skills
/skill kubernetes-hardening # Activate a specific skill