sqlite_graphrag/commands/remember/
args.rs1use crate::cli::MemoryType;
4use crate::output::JsonOutputFormat;
5
6#[derive(clap::Args)]
7#[command(after_long_help = "EXAMPLES:\n \
8 # Create a memory with inline body\n \
9 sqlite-graphrag remember --name design-auth --type decision \\\n \
10 --description \"auth design\" --body \"JWT for stateless auth\"\n\n \
11 # Create with curated graph via --graph-stdin\n \
12 echo '{\"body\":\"...\",\"entities\":[],\"relationships\":[]}' | \\\n \
13 sqlite-graphrag remember --name my-mem --type note --description \"desc\" --graph-stdin\n\n \
14 # Enable automatic URL extraction with --graph-stdin (URL-regex only since v1.0.79)\n \
15 echo '{\"body\":\"See https://docs.rs ...\",\"entities\":[],\"relationships\":[]}' | \\\n \
16 sqlite-graphrag remember --name url-test --type note --description \"test\" \\\n \
17 --graph-stdin --enable-ner\n\n \
18 # Idempotent upsert with --force-merge\n \
19 sqlite-graphrag remember --name my-mem --type note --description \"updated\" \\\n \
20 --body \"new content\" --force-merge\n\n\
21NOTE:\n \
22 remember does NOT accept positional arguments.\n \
23 Use --body \"text\" for inline content\n \
24 Use --body-file path for file content\n \
25 Use --body-stdin for piped content\n \
26 Use --graph-stdin for JSON with entities and relationships\n\n\
27ENTITY TYPES (for --graph-stdin entities, NOT memory --type):\n \
28 concept, tool, person, file, project, decision, incident,\n \
29 organization, location, date, dashboard, issue_tracker, memory\n \
30 WARNING: reference, skill, document, note, user, feedback are\n \
31 MEMORY types only — NOT valid for entities.\n \
32 Mapping: reference→concept, document→file, user→person")]
33pub struct RememberArgs {
35 #[arg(long)]
38 pub name: String,
39 #[arg(
40 long,
41 value_enum,
42 long_help = "Memory kind stored in `memories.type`. Required when creating a new memory. Optional with --force-merge: if omitted the existing memory type is inherited. This is NOT the graph `entity_type` used in `--entities-file`. Valid values: user, feedback, project, reference, decision, incident, skill, document, note."
43 )]
44 pub r#type: Option<MemoryType>,
46 #[arg(long, allow_hyphen_values = true)]
53 pub description: Option<String>,
54 #[arg(
60 long,
61 allow_hyphen_values = true,
62 help = "Inline body content (max 500 KB / 512000 bytes and 30000 estimated tokens; split dense bodies into multiple memories at ~25000 tokens, or use --body-file)",
63 conflicts_with_all = ["body_file", "body_stdin", "graph_stdin"]
64 )]
65 pub body: Option<String>,
66 #[arg(
67 long,
68 help = "Read body from a file instead of --body",
69 conflicts_with_all = ["body", "body_stdin", "graph_stdin"]
70 )]
71 pub body_file: Option<std::path::PathBuf>,
73 #[arg(
76 long,
77 conflicts_with_all = ["body", "body_file", "graph_stdin"]
78 )]
79 pub body_stdin: bool,
80 #[arg(
81 long,
82 help = "JSON file containing entities to associate with this memory"
83 )]
84 pub entities_file: Option<std::path::PathBuf>,
86 #[arg(
87 long,
88 help = "JSON file containing relationships to associate with this memory"
89 )]
90 pub relationships_file: Option<std::path::PathBuf>,
92 #[arg(
93 long,
94 help = "Read graph JSON (body + entities + relationships) from stdin",
95 conflicts_with_all = [
96 "body",
97 "body_file",
98 "body_stdin",
99 "entities_file",
100 "relationships_file",
101 "graph_file"
102 ]
103 )]
104 pub graph_stdin: bool,
106 #[arg(
113 long,
114 value_name = "PATH",
115 help = "Read graph JSON (body + entities + relationships) from a file (combines with --body/--body-file/--body-stdin)",
116 conflicts_with_all = ["graph_stdin", "entities_file", "relationships_file"]
117 )]
118 pub graph_file: Option<std::path::PathBuf>,
119 #[arg(long, help = "Namespace (flag / XDG namespace.default / global)")]
120 pub namespace: Option<String>,
122 #[arg(long)]
124 pub metadata: Option<String>,
125 #[arg(long, help = "JSON file containing metadata key-value pairs")]
127 pub metadata_file: Option<std::path::PathBuf>,
128 #[arg(long)]
130 pub force_merge: bool,
131 #[arg(
132 long,
133 value_name = "EPOCH_OR_RFC3339",
134 value_parser = crate::parsers::parse_expected_updated_at,
135 long_help = "Optimistic lock: reject if updated_at does not match. \
136Accepts Unix epoch (e.g. 1700000000) or RFC 3339 (e.g. 2026-04-19T12:00:00Z)."
137 )]
138 pub expected_updated_at: Option<i64>,
140 #[arg(
141 long,
142 value_parser = crate::parsers::parse_bool_flexible,
143 action = clap::ArgAction::Set,
144 num_args = 0..=1,
145 default_missing_value = "true",
146 default_value = "false",
147 help = "Enable automatic URL-regex extraction from body (URL-regex only since v1.0.79)"
148 )]
149 pub enable_ner: bool,
151 #[arg(long, hide = true)]
153 pub skip_extraction: bool,
154 #[arg(
158 long,
159 default_value_t = false,
160 help = "Explicitly clear body content during --force-merge (without this flag, an empty body is ignored and the existing body is kept)"
161 )]
162 pub clear_body: bool,
163 #[arg(
165 long,
166 default_value_t = false,
167 help = "Validate input and report planned actions without persisting"
168 )]
169 pub dry_run: bool,
170 #[arg(
174 long,
175 default_value_t = false,
176 help = "Reject the write if --name would be normalized to kebab-case (preserve-name guard)"
177 )]
178 pub strict_name: bool,
179 #[arg(
184 long,
185 default_value_t = false,
186 help = "With --force-merge, replace (not merge) the memory's graph bindings; empty entities clears them"
187 )]
188 pub replace_graph: bool,
189 #[arg(long)]
191 pub session_id: Option<String>,
192 #[arg(long, value_enum, default_value_t = JsonOutputFormat::Json)]
194 pub format: JsonOutputFormat,
195 #[arg(long, hide = true, help = "No-op; JSON is always emitted on stdout")]
197 pub json: bool,
198 #[arg(long)]
200 pub db: Option<String>,
201 #[arg(long, default_value_t = crate::constants::DEFAULT_MAX_RSS_MB,
203 help = "Maximum process RSS in MiB; abort if exceeded during embedding (default: 8192)")]
204 pub max_rss_mb: u64,
205 #[arg(long, default_value_t = 4, value_name = "N",
209 value_parser = clap::value_parser!(u64).range(1..=32),
210 help = "Maximum simultaneous LLM embedding subprocesses (default: 4, clamp [1,32])")]
211 pub llm_parallelism: u64,
212 #[arg(long, default_value_t = false)]
216 pub enqueue_enrich: bool,
217}