Commands

memorize.py

Maps a project and registers it under ~/.lore/<name>. You rarely need it, because an agent registers git projects itself; use it for folders that are not git repositories, to choose the name, to import existing instruction files, or to re-map after the folder structure changes.

Synopsis

python3 memorize.py --path ~/projects/myapp
python3 memorize.py --path ~/projects/myapp --name app      # custom name
python3 memorize.py --path ~/projects/myapp --no-import     # do not import instruction files

Options

OptionMeaning
--path PATH requiredThe project root to map. ~ is expanded; it must be a directory.
--name NAMEThe project's name. Default: the last component of --path. Letters, digits, ., _ and - only. A name already used by a different folder is refused.
--no-importDo not import instruction files the project already has.
--import-activeImport them as active rules instead of pending ones that wait for your approval.

What it does

  1. Maps the project. It lists the files (through git ls-files -co --exclude-standard when git is available, so .gitignore is honoured; otherwise by walking the tree, skipping folders such as node_modules, .venv, dist, vendor and target). It records the sections with their file counts and languages, the languages overall (by file extension), the manifest files it found (package.json, pyproject.toml, go.mod, Cargo.toml, Makefile, …) and the subfolders of each section. At most 200,000 files are read. No file contents are stored: the result is ~/.lore/<name>/map.json.
  2. Registers the project in project.json, keeping its creation date if it already existed.
  3. Imports existing instruction files (unless --no-import), reading each of these when present:
    • .github/copilot-instructions.md and .github/instructions/
    • AGENTS.md and CLAUDE.md
    • .cursorrules, .cursor/rules and .windsurfrules
    They go through the same extraction as train.py. They arrive as pending, because text that already sits in a repository is not the same as a rule you chose. Files written by review.py sync are recognised by their marker and never imported.

Example

$ python3 memorize.py --path ~/projects/myapp
Mapped myapp: 4 files, 4 sections; languages: python (2)
  docs                             1 files  -
  root                             1 files  -
  src/api                          1 files  python
  tests                            1 files  python
Imported 1 rule(s) from 1 existing instruction file(s) as pending (approve them with review.py or the web UI); 0 duplicates skipped
Memory: /home/you/.lore/myapp
Next: train.py --name myapp --from <folder>   |   review.py --name myapp list

Notes

  • Safe to repeat. Re-running updates the map and keeps your rules. Near-identical rules are not imported twice.
  • Re-map after adding folders. Section-scoped rules and the static export need the section to exist in the map.
  • Automatic registration differs. When an agent registers a project by itself, it does not import instruction files: the agent's own client already loads them, and a just-cloned repository is not trusted to write rules. See automatic mode.
  • Imported text goes through the same hygiene checks as any rule; entries that fail are counted and reported ("N rule(s) refused").