memories.sh
CLI Reference

memories generate

Generate IDE rule and instruction files from memories.

memories generate [target] [options]

Generate native configuration files for AI coding tools from your memory store. Each tool has its own format and file location.

Targets

TargetDefault Output PathDescription
cursor.cursor/rules/memories.mdcCursor rules with YAML frontmatter
claudeCLAUDE.mdClaude Code instructions
agentsAGENTS.mdFor Amp, Codex, Goose, Kilo, Kiro, OpenCode
copilot.github/copilot-instructions.mdGitHub Copilot instructions
windsurf.windsurf/rules/memories.mdWindsurf rules (6000 char limit)
cline.clinerules/memories.mdCline rules
roo.roo/rules/memories.mdRoo rules
geminiGEMINI.mdGemini instructions

Options

OptionDescription
--types <types>Comma-separated memory types to include (default: rule,decision,fact)
--dry-runPreview generated content without writing files
--forceOverwrite files even if not managed by memories.sh
-o, --output <path>Custom output path (per-target subcommands only)
-w, --watchWatch for database changes and auto-regenerate

Examples

Interactive target selection:

memories generate

Generate for a specific target:

memories generate cursor
memories generate claude --output ./docs/CLAUDE.md

Generate for all targets:

memories generate all

Watch mode (auto-regenerate on database changes):

memories generate all --watch

Preview without writing:

memories generate cursor --dry-run

Overwrite Safety

Generated files include a <!-- Generated by memories.sh --> marker comment. The generate command will not overwrite files that lack this marker unless --force is used. This prevents accidentally overwriting hand-edited files.

Watch Mode

Watch mode monitors the database file for changes and auto-regenerates with a 500ms debounce. This is useful during development when you're actively adding memories and want config files to stay in sync.