Перейти к основному содержимому

Configuration

Configuration files

HMG configuration falls into three categories: agent integration files, the store data directory, and runtime environment variables. Only what users actually touch is listed here.

FileRoleGenerated by
~/.codex/config.toml / .cursor/mcp.json / .mcp.jsonTells the host how to start the HMG MCP serverhmg init --agent <id>
~/.codex/hooks.json / .cursor/hooks.json / ~/.claude/settings.jsonHost lifecycle hooks (three: SessionStart / UserPromptSubmit / PreToolUse)hmg init --agent <id>
AGENTS.md / CLAUDE.md / .cursor/rules/hmg-memory.mdcThe agent's memory policy and usage ruleshmg init --agent <id>
store directoryThe data itself (memories/indexes/observations)created automatically

store path

  • Default store: <user data dir>/hmg/stores/default
    • macOS/Linux: ~/.local/share/hmg/stores/default
    • Windows: usually %LOCALAPPDATA%\hmg\stores\default
  • Use --store <path> for any store.
  • Most commands accept --store, e.g. hmg memorize "..." --store /my/store.

Identity and login (store.toml)

store.toml inside the store directory records local identity:

toml
# ~/.local/share/hmg/stores/default/store.toml

[identity]
local_tenant = "qiankun" # OS username, written at hmg init, never changes
linked_account = "userB" # written after hmg login, cleared on logout
linked_at = "2026-07-28T10:00:00Z" # login time
  • local_tenant: the tenant (first scope level) of every memory — the OS username, written at hmg init, never changes afterwards.
  • linked_account: the HMG user-center account written after upgrading your plan on the website and running hmg login. Login performs no data migration — local reads/writes always use local_tenant; the account mapping is only used during cloud sync.
  • Logout / account switch: only clears linked_account; local memories are untouched.

Environment variables

See Common environment variables.

Store directory

The store is the root directory of HMG data.

Default location

See above. hmg doctor --verbose prints the data directory actually in use — trust that output first.

Choosing a project store

  • Default store + scope: projects separated by repository/branch (the default in agent integration — scope is inferred automatically from the session directory). Good when you don't want to manage multiple directories.
  • Dedicated project store: --store /path/to/proj — physical isolation, no pollution, recommended for many projects.

Backup and migration

bash
# Method 1: copy the store directory directly
cp -r /old/store /backup/store

# Method 2: official migration (with backup)
hmg store migrate --from /old/store --to /new/store --backup --apply

# Dry-run preview first
hmg store migrate --from /old/store --to /new/store --dry-run

Maintenance commands

bash
# Clean orphan edges/indexes
hmg store hygiene --dry-run
hmg store hygiene

# Repair corrupted edges
hmg store repair-edges --dry-run
hmg store repair-edges --backup --apply

Common environment variables

Only common local items.

VariableRole
HMG_STOREDefault store path
HMG_DATA_DIRData directory used by the current host
HMG_PROVIDER_BACKENDProvider backend, commonly local
HMG_USE_LOCAL_DAEMONWhether to prefer the local daemon
HMG_CONSOLIDATION_SCHEDULERObservation consolidation scheduler (e.g. embedded, observation scenarios only)
HMG_CAPTURE_MODEObservation capture mode (e.g. raw-with-retention)
HMG_PROMOTION_MODEObservation promotion mode (e.g. execute)
HMG_AUTOMATION_TIERAutomation tier (e.g. remember-first-govern-later)
HMG_AGENT_IDCurrent host identifier, e.g. codex / cursor / claude
HMG_HTTP_ADDRLocal address when the HTTP fallback is enabled

Observation config and scheduling

The observation pipeline is not activated in agent integration (durable memories are written by the agent's own memorize/handoff). The commands below are for manual / automation scenarios.

bash
hmg observation config get
hmg observation config set capture_mode raw-with-retention
hmg observation scheduler status
hmg observation scheduler run-once