@empirical-gauzza/cli 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,47 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const os = require('os');
5
- const path = require('path');
6
- const { commandExists } = require('../fsUtils');
7
- const { installCodex } = require('./codex');
8
- const { installCopilot } = require('./copilot');
9
- const { installClaude } = require('./claude');
10
-
11
- function detectInstallTargets() {
12
- const home = os.homedir();
13
- const targets = [];
14
-
15
- const codexDetected = commandExists('codex') || fs.existsSync(path.join(home, '.codex'));
16
- if (codexDetected) {
17
- targets.push({
18
- id: 'codex',
19
- label: 'Codex CLI',
20
- install: installCodex
21
- });
22
- }
23
-
24
- const copilotDetected = commandExists('copilot') || fs.existsSync(path.join(home, '.copilot'));
25
- if (copilotDetected) {
26
- targets.push({
27
- id: 'copilot',
28
- label: 'GitHub Copilot CLI',
29
- install: installCopilot
30
- });
31
- }
32
-
33
- const claudeDetected = commandExists('claude') || fs.existsSync(path.join(home, '.claude'));
34
- if (claudeDetected) {
35
- targets.push({
36
- id: 'claude',
37
- label: 'Claude CLI',
38
- install: installClaude
39
- });
40
- }
41
-
42
- return targets;
43
- }
44
-
45
- module.exports = {
46
- detectInstallTargets
47
- };
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
6
+ const { commandExists } = require('../fsUtils');
7
+ const { installCodex } = require('./codex');
8
+ const { installCopilot } = require('./copilot');
9
+ const { installClaude } = require('./claude');
10
+
11
+ function detectInstallTargets() {
12
+ const home = os.homedir();
13
+ const targets = [];
14
+
15
+ const codexDetected = commandExists('codex') || fs.existsSync(path.join(home, '.codex'));
16
+ if (codexDetected) {
17
+ targets.push({
18
+ id: 'codex',
19
+ label: 'Codex CLI',
20
+ install: installCodex
21
+ });
22
+ }
23
+
24
+ const copilotDetected = commandExists('copilot') || fs.existsSync(path.join(home, '.copilot'));
25
+ if (copilotDetected) {
26
+ targets.push({
27
+ id: 'copilot',
28
+ label: 'GitHub Copilot CLI',
29
+ install: installCopilot
30
+ });
31
+ }
32
+
33
+ const claudeDetected = commandExists('claude') || fs.existsSync(path.join(home, '.claude'));
34
+ if (claudeDetected) {
35
+ targets.push({
36
+ id: 'claude',
37
+ label: 'Claude CLI',
38
+ install: installClaude
39
+ });
40
+ }
41
+
42
+ return targets;
43
+ }
44
+
45
+ module.exports = {
46
+ detectInstallTargets
47
+ };
@@ -95,6 +95,7 @@ that only records memory when explicitly told to defeats the purpose of this ski
95
95
  Two rules that are not optional:
96
96
 
97
97
  - Record one memory per finding. A session that fixed three things records three memories, each with the fix phrase and the date in its summary. One combined summary is not recorded: it cannot be found by any question about one of its parts.
98
+ - Tags are topics and project names, at most 6 per memory. Reuse tags that recall already returned for this project before inventing one. Never put workflow state (complete, pending, fixed, verified, in-progress), task or step numbers (task-5, us-3.2), or sentences into tags, whether via `empirical memory record --tags` or `record_graph_memory`: state belongs in data.status or in the summary, numbers belong in the summary.
98
99
  - Empirical first. A note in a local file, a scratchpad, or a host memory directory is not recorded; it is invisible to every other session, tool, and agent. Record in Empirical, then keep a local pointer if you want one.
99
100
 
100
101
  - Record durable decisions, project conventions, preferences, plans, and meaningful reflections
@@ -122,6 +123,18 @@ Two rules that are not optional:
122
123
  codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
123
124
  from something the user actually said or lived. Downstream features read these as the user's life.
124
125
 
126
+ **Say which one it is: pass `authorType`.** Same distinction, made explicit in the data instead
127
+ of left to be guessed from which transport you happened to use. `authorType: "user"` when the
128
+ memory is about the user — something they said, decided, prefer, or are working toward.
129
+ `authorType: "agent"` when it is your own work. Do not set `"agent"` merely because you are the
130
+ one calling: an agent writing down a real fact about the user is recording a user-authored fact,
131
+ and that is the whole point of this tool. On the CLI it is `--author-type user|agent`. Omit it
132
+ when you genuinely cannot tell, and it stays unresolved rather than being invented.
133
+
134
+ This is read back at retrieval time to keep an agent's session notes out of answers about the
135
+ user's own life and work, so a wrong value does not show up as a warning, it shows up as the
136
+ wrong memories coming back.
137
+
125
138
  - Append a correction or follow-up to an existing memory with `add_note_by_query` / `empirical memory note`.
126
139
  - Patch an existing memory with `update_memory_by_query` / `empirical memory update`.
127
140
  - Delete only when the user explicitly asks; use the delete tool with confirmation, or `empirical memory delete --match "<memory>" --confirm`.
@@ -85,6 +85,7 @@ that only records memory when explicitly told to defeats the purpose of this ski
85
85
  Two rules that are not optional:
86
86
 
87
87
  - Record one memory per finding. A session that fixed three things records three memories, each with the fix phrase and the date in its summary. One combined summary is not recorded: it cannot be found by any question about one of its parts.
88
+ - Tags are topics and project names, at most 6 per memory. Reuse tags that recall already returned for this project before inventing one. Never put workflow state (complete, pending, fixed, verified, in-progress), task or step numbers (task-5, us-3.2), or sentences into tags passed via `empirical memory record --tags`: state belongs in data.status or in the summary, numbers belong in the summary.
88
89
  - Empirical first. A note in a local file, a scratchpad, or a host memory directory is not recorded; it is invisible to every other session, tool, and agent. Record in Empirical, then keep a local pointer if you want one.
89
90
 
90
91
  - Record durable decisions, project conventions, preferences, plans, and meaningful reflections
@@ -114,6 +115,18 @@ Two rules that are not optional:
114
115
  codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
115
116
  from something the user actually said or lived. Downstream features read these as the user's life.
116
117
 
118
+ **Say which one it is: pass `authorType`.** Same distinction, made explicit in the data instead
119
+ of left to be guessed from which transport you happened to use. `authorType: "user"` when the
120
+ memory is about the user — something they said, decided, prefer, or are working toward.
121
+ `authorType: "agent"` when it is your own work. Do not set `"agent"` merely because you are the
122
+ one calling: an agent writing down a real fact about the user is recording a user-authored fact,
123
+ and that is the whole point of this tool. On the CLI it is `--author-type user|agent`. Omit it
124
+ when you genuinely cannot tell, and it stays unresolved rather than being invented.
125
+
126
+ This is read back at retrieval time to keep an agent's session notes out of answers about the
127
+ user's own life and work, so a wrong value does not show up as a warning, it shows up as the
128
+ wrong memories coming back.
129
+
117
130
  - Append a correction or follow-up to an existing memory with `empirical memory note`.
118
131
  - Patch an existing memory with `empirical memory update`.
119
132
  - Delete only when the user explicitly asks: `empirical memory delete --match "<memory>" --confirm`.
@@ -75,6 +75,7 @@ that only records memory when explicitly told to defeats the purpose of this ski
75
75
  Two rules that are not optional:
76
76
 
77
77
  - Record one memory per finding. A session that fixed three things records three memories, each with the fix phrase and the date in its summary. One combined summary is not recorded: it cannot be found by any question about one of its parts.
78
+ - Tags are topics and project names, at most 6 per memory. Reuse tags that recall already returned for this project before inventing one. Never put workflow state (complete, pending, fixed, verified, in-progress), task or step numbers (task-5, us-3.2), or sentences into tags passed via `record_graph_memory`: state belongs in data.status or in the summary, numbers belong in the summary.
78
79
  - Empirical first. A note in a local file, a scratchpad, or a host memory directory is not recorded; it is invisible to every other session, tool, and agent. Record in Empirical, then keep a local pointer if you want one.
79
80
 
80
81
  - Record durable decisions, project conventions, preferences, plans, and meaningful reflections
@@ -91,6 +92,18 @@ Two rules that are not optional:
91
92
  codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
92
93
  from something the user actually said or lived. Downstream features read these as the user's life.
93
94
 
95
+ **Say which one it is: pass `authorType`.** Same distinction, made explicit in the data instead
96
+ of left to be guessed from which transport you happened to use. `authorType: "user"` when the
97
+ memory is about the user — something they said, decided, prefer, or are working toward.
98
+ `authorType: "agent"` when it is your own work. Do not set `"agent"` merely because you are the
99
+ one calling: an agent writing down a real fact about the user is recording a user-authored fact,
100
+ and that is the whole point of this tool. On the CLI it is `--author-type user|agent`. Omit it
101
+ when you genuinely cannot tell, and it stays unresolved rather than being invented.
102
+
103
+ This is read back at retrieval time to keep an agent's session notes out of answers about the
104
+ user's own life and work, so a wrong value does not show up as a warning, it shows up as the
105
+ wrong memories coming back.
106
+
94
107
  - Append a correction or follow-up to an existing memory with `add_note_by_query`.
95
108
  - Patch an existing memory with `update_memory_by_query`.
96
109
  - Delete only when the user explicitly asks; use `delete_memory_by_query` with confirmation.
@@ -47,7 +47,7 @@ const MEMORY_SUBCOMMAND_USAGE = {
47
47
  query: 'Usage: empirical memory query --match <query> [--top-k 3] [--category <cat>] [--tags <t1,t2>] [--tags-all <t1,t2>] [--status <s1,s2>] [--pretty] [--format table]',
48
48
  get: 'Usage: empirical memory get --memory-id <id> [--pretty]',
49
49
  list: 'Usage: empirical memory list [--category <cat>] [--tags <t1,t2>] [--start-date <ISO>] [--end-date <ISO>] [--limit 20] [--cursor <cursor>] [--oldest] [--pretty] [--format table]',
50
- record: 'Usage: empirical memory record --category <cat> (--summary <text> | --summary - | --summary-file <path>) [--tags t1,t2] [--node-type observation] [--json-file <path>] [--no-dedupe] [--no-auto-link]',
50
+ record: 'Usage: empirical memory record --category <cat> (--summary <text> | --summary - | --summary-file <path>) [--tags t1,t2] [--node-type observation] [--json-file <path>] [--no-dedupe] [--no-auto-link] [--author-type user|agent]',
51
51
  note: 'Usage: empirical memory note --text <note> (--match <query> | --memory-id <id>) [--min-score 0.35]',
52
52
  update: 'Usage: empirical memory update (--match <query> | --memory-id <id>) (--patch-json <json> | --json-file <path>) [--min-score 0.35]',
53
53
  delete: 'Usage: empirical memory delete (--match <query> | --memory-id <id>) [--confirm] [--min-score 0.35]\nUsage: empirical memory delete (--tag <t> | --category <c> | --all) --confirm',
@@ -351,7 +351,7 @@ async function runMemoryRecord(args) {
351
351
  }
352
352
 
353
353
  if (!category || !summary) {
354
- warn('Usage: empirical memory record --category <cat> (--summary <text> | --summary - | --summary-file <path>) [--tags t1,t2] [--node-type observation] [--json-file <path>] [--no-dedupe] [--no-auto-link]');
354
+ warn('Usage: empirical memory record --category <cat> (--summary <text> | --summary - | --summary-file <path>) [--tags t1,t2] [--node-type observation] [--json-file <path>] [--no-dedupe] [--no-auto-link] [--author-type user|agent]');
355
355
  warn('Valid categories: ' + MEMORY_CATEGORIES.join(', '));
356
356
  process.exit(1);
357
357
  }
@@ -395,6 +395,29 @@ async function runMemoryRecord(args) {
395
395
  payload.autoLink = false;
396
396
  }
397
397
 
398
+ // Authorship (2026-09-09). `source` is observable truth: this is the CLI, so say so.
399
+ // Until now the CLI sent nothing, the server fell back to the transport it saw ('api'),
400
+ // and api maps to authorType 'user' because that mapping was written for the web portal.
401
+ // Every agent write through this command was therefore stored as authored by the user.
402
+ // 'cli' resolves to authorType 'unknown', which is the honest answer when nobody says.
403
+ if (payload.source === undefined) payload.source = 'cli';
404
+
405
+ // --author-type lets the caller state what the transport cannot know. An agent recording
406
+ // its own session notes should pass 'agent'; an agent recording something the user said
407
+ // or decided should pass 'user'. Omitted, it stays 'unknown' rather than being guessed.
408
+ const authorType = parseOption(args, '--author-type', '');
409
+ if (authorType) {
410
+ if (!['user', 'agent', 'system'].includes(authorType)) {
411
+ warn(JSON.stringify({
412
+ error: true,
413
+ code: 'invalid_author_type',
414
+ message: `Invalid --author-type "${authorType}". Valid: user, agent, system`
415
+ }));
416
+ process.exit(1);
417
+ }
418
+ payload.authorType = authorType;
419
+ }
420
+
398
421
  const accessToken = requireAccessToken();
399
422
  const baseUrl = resolveApiBaseUrl();
400
423
  const recordUrl = new URL('/api/v1/memories', baseUrl).toString();