Downcity
CommandsService

city memory

Memory service actions (status/search/get/store/flush)

city memory

Memory service command group.

Hierarchy note: city memory is a service action command, not a top-level command. Top-level entry is city service.

Usage

city memory <subcommand> [options]

Subcommands

  • status
  • search <query>
  • get <memoryPath> [--from <line>] [--lines <count>]
  • store --content <text> [--target <longterm|daily|working>] [--session-id <sessionId>]
  • flush --session-id <sessionId> [--max-messages <count>]

Examples

city memory status
city memory search "release decision"
city memory get .downcity/memory/MEMORY.md --from 10 --lines 20
city memory store --target longterm --content "User prefers concise release notes."
city memory flush --session-id telegram-chat-123 --max-messages 40
city memory flush --session-id telegram-chat-123 --time "2026-03-25T23:00:00+08:00"

Notes

  • Memory is enabled by default (zero config). Disable only when needed: context.memory.enabled=false.
  • memory is an independent service and is not coupled into the session execution core.
  • The system prompt only injects a small stable longterm memory pack from MEMORY.md plus memory service usage rules.
  • That injected memory is deduped, capped, and truncated instead of dumping whole memory files into the prompt.
  • When the agent needs more memory, it should explicitly call memory.search, memory.get, and memory.store.
  • All memory actions also support common one-shot scheduling via --delay / --time.
  • For detailed behavior, see Service Action Scheduling.
  • Start the agent first:
city agent start

Example Output (Based on Current Implementation)

The examples below are aligned with current command implementations in packages/downcity/src (including default output mode and field structure). Placeholder values are used for environment-specific fields.

$ city memory search "release decision"
{
  "success": true,
  "data": {
    "backend": "builtin",
    "mode": "scan",
    "results": []
  }
}
$ city memory flush --session-id <sessionId> --max-messages 40
{
  "success": true,
  "data": {
    "path": ".downcity/memory/daily/2026-04-07.md",
    "messageCount": 12,
    "writtenChars": 864
  }
}