Instructions, rules and memory

AGENTS.md, hook rules and memories.

Instructions

FileReaches the agent
~/.ngram/AGENTS.mdEvery thread, in every project
AGENTS.md in the project folderEvery thread in that project
AGENTS.md in a subfolderThe first time the agent reads or edits a file under that subfolder

In a folder with no AGENTS.md, ngram reads CLAUDE.md instead. No other file names are read.

Settings › Agents › Instructions opens or creates the global and project files.

Rules

A rule acts on the agent's work: it adds a message, blocks or allows a call, or runs a command.

ScopeFolder
Global~/.ngram/rules/
Project.ngram/rules/

Each rule is a file named <name>.hook.ngram:

---
description: No console.log in src
on: after edit
paths: ["src/**/*.ts"]
match: { added: 'console\.log' }
---
Remove the console.log you added.
KeyValue
onRequired. before <tool>, after <tool>, user message or stop
matchField to regex. Every field must match.
pathsGlobs. The call must touch a matching path.
actioninject (default), block, ask, allow or continue
runA command to run when the rule matches. Its output follows the body.
enabledfalse turns the rule off

The body is the message the agent gets.

  • Approval. A project rule with run is paused until you approve it, and again whenever it or the files beside it change. Saving it in ngram, trusting the folder, or Review in the thread approves it. Global rules never ask.
  • Settings › Agents › Rules lists every rule, with New Rule and Import Claude Code Hooks.
  • Rules: Test Rule (Cmd-Shift-P, with a rule open) replays the rule against a past thread and lists the calls it would have fired on.
  • The built-in ngram-rules skill has the full format.

Memory

The agent saves short notes on your preferences and the project, and reads them in later threads.

Command (Cmd-Shift-P)Opens
Agent: Edit Global MemoryMemories for every project
Agent: Edit Project MemoryMemories for this project

Edit or delete entries and save. Memories are stored on your Mac, never in the project. Turn memory off with "agent.memory.enabled": false.