Instructions, rules and memory
AGENTS.md, hook rules and memories.
Instructions
| File | Reaches the agent |
|---|---|
~/.ngram/AGENTS.md | Every thread, in every project |
AGENTS.md in the project folder | Every thread in that project |
AGENTS.md in a subfolder | The 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.
| Scope | Folder |
|---|---|
| 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.| Key | Value |
|---|---|
on | Required. before <tool>, after <tool>, user message or stop |
match | Field to regex. Every field must match. |
paths | Globs. The call must touch a matching path. |
action | inject (default), block, ask, allow or continue |
run | A command to run when the rule matches. Its output follows the body. |
enabled | false turns the rule off |
The body is the message the agent gets.
- Approval. A project rule with
runis 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-rulesskill 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 Memory | Memories for every project |
| Agent: Edit Project Memory | Memories 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.