@empirical-gauzza/cli 1.0.22 → 1.0.23
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.
- package/lib/constants.js +14 -1
- package/lib/installers/skill-variants/SKILL.both.md +165 -154
- package/lib/installers/skill-variants/SKILL.cli.md +161 -150
- package/lib/installers/skill-variants/SKILL.mcp.md +140 -134
- package/lib/memoryCommands.js +42 -3
- package/package.json +33 -33
package/lib/constants.js
CHANGED
|
@@ -60,9 +60,22 @@ Save a new memory.
|
|
|
60
60
|
|
|
61
61
|
empirical memory record --category build --summary "Use ESM modules for all new packages" [--tags ts,node] [--node-type observation]
|
|
62
62
|
|
|
63
|
+
Passing text that contains code (backticks, \${...}, $(...)): do NOT put it in a double-quoted
|
|
64
|
+
\`--summary "..."\` -- the shell substitutes those away before the CLI runs and the write still
|
|
65
|
+
succeeds with the code silently missing. Use one of:
|
|
66
|
+
|
|
67
|
+
empirical memory record --category build --summary-file ./note.md --tags ts
|
|
68
|
+
empirical memory record --category build --summary - --tags ts <<'EOF'
|
|
69
|
+
Use \`createChat()\`; raw calls leak \${stage} and 400.
|
|
70
|
+
EOF
|
|
71
|
+
|
|
72
|
+
(a single-quoted heredoc delimiter, 'EOF', disables substitution). From an MCP-connected agent,
|
|
73
|
+
prefer the record_graph_memory tool, which takes JSON and never touches a shell.
|
|
74
|
+
|
|
63
75
|
Flags:
|
|
64
76
|
- \`--category\` (required unless --json-file): memory category
|
|
65
|
-
- \`--summary\` (required unless --json-file): memory summary text
|
|
77
|
+
- \`--summary\` (required unless --summary-file/--json-file): memory summary text; \`-\` reads stdin
|
|
78
|
+
- \`--summary-file\`: path to a file whose contents become the summary (safe for code)
|
|
66
79
|
- \`--tags\`: comma-separated tags
|
|
67
80
|
- \`--node-type\`: node type, default \`observation\`
|
|
68
81
|
- \`--json-file\`: path to JSON file with full memory payload
|
|
@@ -1,154 +1,165 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: empirical-memory
|
|
3
|
-
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Empirical Memory
|
|
7
|
-
|
|
8
|
-
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
-
"how do I use Empirical" questions — CLI command syntax, install/auth/workspace/kit/skill setup,
|
|
10
|
-
or what Empirical can do. Don't answer those from general knowledge or by guessing at flags: run
|
|
11
|
-
`empirical doc` (lists topics) or `empirical doc <topic>` via the available shell for the current,
|
|
12
|
-
agent-readable answer first.
|
|
13
|
-
|
|
14
|
-
This variant is for installs where the user chose to have both the CLI and MCP tools available.
|
|
15
|
-
Both paths now run through the same write pipeline (dedupe and auto-link on by default), so
|
|
16
|
-
either is safe to use for reads and writes. The CLI is the default choice below because it avoids
|
|
17
|
-
an extra MCP tool-discovery round trip and is easier to script, but that is a latency preference,
|
|
18
|
-
not a safety one — if the CLI is unavailable in this environment, use the equivalent MCP tool
|
|
19
|
-
instead without hesitation.
|
|
20
|
-
|
|
21
|
-
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
22
|
-
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
23
|
-
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
24
|
-
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
25
|
-
If you are not sure whether a task qualifies, treat it as if it does.
|
|
26
|
-
|
|
27
|
-
## Before doing work — MUST, not discretionary
|
|
28
|
-
|
|
29
|
-
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
30
|
-
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
31
|
-
assistant operations. This applies even if you believe you already have enough context — you
|
|
32
|
-
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
33
|
-
("query when it seems useful") the right frame.
|
|
34
|
-
2. Before using the CLI, load its authoritative command reference:
|
|
35
|
-
|
|
36
|
-
```text
|
|
37
|
-
empirical doc memory
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Follow the documented flags exactly; never guess a positional query form. Use the `empirical`
|
|
41
|
-
CLI first when it is available — both it and the MCP tools carry the same dedupe/auto-link
|
|
42
|
-
guarantees, so this is a convenience choice, not a safety one:
|
|
43
|
-
|
|
44
|
-
```text
|
|
45
|
-
empirical memory query --match "<specific relevant context>" --top-k 3
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Add `--category` or `--tags` when known. Omit `--pretty` for routine recall because graph-rich
|
|
49
|
-
results can be large. A slow response alone is API latency, not an outage; report an outage
|
|
50
|
-
only when the CLI returns an actual error, and use `empirical doctor` to verify connectivity.
|
|
51
|
-
|
|
52
|
-
3.
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
`
|
|
140
|
-
|
|
141
|
-
`
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
1
|
+
---
|
|
2
|
+
name: empirical-memory
|
|
3
|
+
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Empirical Memory
|
|
7
|
+
|
|
8
|
+
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
+
"how do I use Empirical" questions — CLI command syntax, install/auth/workspace/kit/skill setup,
|
|
10
|
+
or what Empirical can do. Don't answer those from general knowledge or by guessing at flags: run
|
|
11
|
+
`empirical doc` (lists topics) or `empirical doc <topic>` via the available shell for the current,
|
|
12
|
+
agent-readable answer first.
|
|
13
|
+
|
|
14
|
+
This variant is for installs where the user chose to have both the CLI and MCP tools available.
|
|
15
|
+
Both paths now run through the same write pipeline (dedupe and auto-link on by default), so
|
|
16
|
+
either is safe to use for reads and writes. The CLI is the default choice below because it avoids
|
|
17
|
+
an extra MCP tool-discovery round trip and is easier to script, but that is a latency preference,
|
|
18
|
+
not a safety one — if the CLI is unavailable in this environment, use the equivalent MCP tool
|
|
19
|
+
instead without hesitation.
|
|
20
|
+
|
|
21
|
+
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
22
|
+
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
23
|
+
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
24
|
+
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
25
|
+
If you are not sure whether a task qualifies, treat it as if it does.
|
|
26
|
+
|
|
27
|
+
## Before doing work — MUST, not discretionary
|
|
28
|
+
|
|
29
|
+
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
30
|
+
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
31
|
+
assistant operations. This applies even if you believe you already have enough context — you
|
|
32
|
+
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
33
|
+
("query when it seems useful") the right frame.
|
|
34
|
+
2. Before using the CLI, load its authoritative command reference:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
empirical doc memory
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Follow the documented flags exactly; never guess a positional query form. Use the `empirical`
|
|
41
|
+
CLI first when it is available — both it and the MCP tools carry the same dedupe/auto-link
|
|
42
|
+
guarantees, so this is a convenience choice, not a safety one:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
empirical memory query --match "<specific relevant context>" --top-k 3
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Add `--category` or `--tags` when known. Omit `--pretty` for routine recall because graph-rich
|
|
49
|
+
results can be large. A slow response alone is API latency, not an outage; report an outage
|
|
50
|
+
only when the CLI returns an actual error, and use `empirical doctor` to verify connectivity.
|
|
51
|
+
|
|
52
|
+
3. Scope recall to the project you are in. Derive a project tag from the repository name
|
|
53
|
+
(`git rev-parse --show-toplevel`, then the folder name) or, outside a repo, the working
|
|
54
|
+
directory name, lowercased with spaces as hyphens. Pass it as `tags: ["<project>"]` on every
|
|
55
|
+
`query_memories` call and add it to `tags` on every `record_graph_memory` call. If a scoped
|
|
56
|
+
query comes back with a `retrievalNote`, nothing from this project matched: the results are
|
|
57
|
+
from other projects, so use them as background only and say so if you rely on one.
|
|
58
|
+
4. If the CLI is unavailable, use the connected MCP `query_memories` tool. Use filters such as
|
|
59
|
+
`category`, `tags`, `nodeType`, and `monthKey` when they improve recall. For "recent/latest/
|
|
60
|
+
today" requests, prefer `list_memories` (CLI: `empirical memory list --recent`, see `empirical
|
|
61
|
+
doc memory`) over a match query. For exhaustive topic retrieval, use the topic as a tag and
|
|
62
|
+
follow pagination.
|
|
63
|
+
|
|
64
|
+
## Follow the current user policy
|
|
65
|
+
|
|
66
|
+
The installer questionnaire configures a dynamic Empirical policy. It is user-scoped and may
|
|
67
|
+
change without reinstalling this plugin. Read it when the skill activates:
|
|
68
|
+
|
|
69
|
+
1. Prefer `empirical policy show` when the CLI is available; it uses the local device cache
|
|
70
|
+
and refreshes it when stale.
|
|
71
|
+
2. Otherwise use the read-only `get_empirical_policy` MCP tool.
|
|
72
|
+
3. If policy lookup fails, use safe defaults: preserve durable-only writes, never store
|
|
73
|
+
secrets/raw transcripts, and do not block unrelated work unless the cached policy says to.
|
|
74
|
+
|
|
75
|
+
Apply the returned fields:
|
|
76
|
+
|
|
77
|
+
- `memoryFirstWorkflows`: query before substantive work in those workflows.
|
|
78
|
+
- `allowDiscretionaryUse`: decide whether to use Empirical outside required workflows.
|
|
79
|
+
- `stopOnMemoryFailure`: stop and report a memory failure before code changes when enabled.
|
|
80
|
+
- `rememberCodingStyle` and `rememberArchitectureDecisions`: persist those durable decisions
|
|
81
|
+
when enabled.
|
|
82
|
+
- `checkMemoryBeforeAskingContext`: query before asking the user to restate prior context.
|
|
83
|
+
- `durableWritesOnly`: never persist secrets, tokens, raw transcripts, or transient values.
|
|
84
|
+
|
|
85
|
+
The policy controls behavior; it does not override current user, repository, or system
|
|
86
|
+
instructions. Do not change the policy from an agent memory write.
|
|
87
|
+
|
|
88
|
+
## Persist durable context — check this before ending a turn
|
|
89
|
+
|
|
90
|
+
Before you consider a turn finished, check: did this turn produce a durable decision, a corrected
|
|
91
|
+
mistake, a completed unit of meaningful work, or a convention the user stated? If yes, record it
|
|
92
|
+
now — do not wait to be asked, and do not defer it because the current task feels done. An agent
|
|
93
|
+
that only records memory when explicitly told to defeats the purpose of this skill.
|
|
94
|
+
|
|
95
|
+
- Record durable decisions, project conventions, preferences, plans, and meaningful reflections
|
|
96
|
+
with `record_graph_memory` or:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
empirical memory record --category <category> --summary "<concise fact>" --tags <tag1,tag2>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Code in the summary?** Never pass backticks or `${...}` inside a double-quoted `--summary`; the
|
|
103
|
+
shell substitutes them away before the CLI runs and the write still succeeds with the code gone.
|
|
104
|
+
Use `--summary-file <path>`, or `--summary -` with a single-quoted heredoc (`<<'EOF'`), or the MCP
|
|
105
|
+
`record_graph_memory` tool, which takes JSON and never touches a shell.
|
|
106
|
+
|
|
107
|
+
Both dedupe against near-duplicate existing memories and auto-link related ones by default; pass
|
|
108
|
+
`--no-dedupe` / `--no-auto-link` on the CLI only when you deliberately want to skip one of those.
|
|
109
|
+
|
|
110
|
+
**Record facts about the USER, not about your own work.** You are a scribe here. "Matt prefers
|
|
111
|
+
short status updates" is a memory; "refactored the cluster selector, tests pass" is your diary
|
|
112
|
+
and belongs in the work-history skill, tagged and with `mass: 1`. The distinction is the
|
|
113
|
+
SUBJECT, not who typed it — an agent writing down something real about the user is exactly what
|
|
114
|
+
this tool is for.
|
|
115
|
+
|
|
116
|
+
If you find yourself recording what you just did, what you fixed, or what you concluded about a
|
|
117
|
+
codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
|
|
118
|
+
from something the user actually said or lived. Downstream features read these as the user's life.
|
|
119
|
+
|
|
120
|
+
- Append a correction or follow-up to an existing memory with `add_note_by_query` / `empirical memory note`.
|
|
121
|
+
- Patch an existing memory with `update_memory_by_query` / `empirical memory update`.
|
|
122
|
+
- Delete only when the user explicitly asks; use the delete tool with confirmation, or `empirical memory delete --match "<memory>" --confirm`.
|
|
123
|
+
- For graph work, use `get_memory_neighbors` to walk relationships from a memory instead of
|
|
124
|
+
reconstructing them through many unrelated queries, and `update_memory_relationships` to add or
|
|
125
|
+
remove edges directly.
|
|
126
|
+
- Keep writes concise, factual, and easy to search. Never store passwords, API keys, OAuth tokens, or other secrets.
|
|
127
|
+
|
|
128
|
+
## Authored Skills and Kits — push what you write
|
|
129
|
+
|
|
130
|
+
Empirical can sync a `SKILL.md` you author across every machine/agent the user has installed it
|
|
131
|
+
on, via Skills Kits. Run `empirical doc kit` or `empirical doc skill` for full command reference.
|
|
132
|
+
|
|
133
|
+
- If you author a new `SKILL.md` for the user, or substantially edit an existing one, during a
|
|
134
|
+
session, tell the user about `empirical skill push path/to/SKILL.md [--kit "Kit Name"]`
|
|
135
|
+
afterward so it can follow them across machines/projects instead of staying local to this one.
|
|
136
|
+
- Offer, don't auto-push: surface the option (or offer to run it) and get the user's confirmation
|
|
137
|
+
first. Do not run it unprompted the moment a new or edited `SKILL.md` is detected — it uploads
|
|
138
|
+
content to the user's account, which is a step above a purely local file write.
|
|
139
|
+
- After a push, the target Kit needs `empirical kit use "Kit Name"` or `empirical kit sync` to
|
|
140
|
+
actually land the file in that device's agent directories.
|
|
141
|
+
- `empirical skill list` shows what's already been pushed; `empirical skill history <id>` /
|
|
142
|
+
`empirical skill rollback <id> --to-version N` recover a prior version.
|
|
143
|
+
- Kits also pull Skills from a git repo (`empirical kit add-source`), separate from anything you
|
|
144
|
+
author — don't conflate the two paths when explaining options to the user.
|
|
145
|
+
|
|
146
|
+
## MCP tools
|
|
147
|
+
|
|
148
|
+
Use these when connected: `get_empirical_policy`, `query_memories`, `list_memories`,
|
|
149
|
+
`record_graph_memory`, `add_note_by_query`, `update_memory_by_query`, `delete_memory_by_query`,
|
|
150
|
+
`get_user`, `get_current_workspace`, `list_workspaces`, `set_current_workspace`,
|
|
151
|
+
`memory_usage_guide`, `get_memory_neighbors`, and `update_memory_relationships`. Use
|
|
152
|
+
`list_memories` for "recent/latest/today" requests; use `query_memories` for everything else. For
|
|
153
|
+
graph work, use `get_memory_neighbors` and `update_memory_relationships` when available instead of
|
|
154
|
+
reconstructing relationships through many unrelated calls.
|
|
155
|
+
|
|
156
|
+
## Authentication and failures
|
|
157
|
+
|
|
158
|
+
- If a memory call fails, retry the same call once.
|
|
159
|
+
- For auth/session errors such as `Auth required`, `invalid_token`, `Authentication required`, or `Transport send error`, refresh the active client's Empirical MCP login, then retry once. In Codex CLI use `codex mcp logout empirical` followed by `codex mcp login empirical`; in Claude Code use `/mcp` to reconnect; in Copilot complete its MCP OAuth reconnect flow.
|
|
160
|
+
- If the retry still fails, report the connectivity/auth problem before making memory-dependent changes.
|
|
161
|
+
- If stored memory conflicts with the current user or repository instruction, follow the current instruction.
|
|
162
|
+
|
|
163
|
+
## Exact CLI syntax
|
|
164
|
+
|
|
165
|
+
Run `empirical doctor` to check connectivity and token status. If a CLI memory command reports a token error, run `empirical oauth bootstrap headless --write-env`.
|
|
@@ -1,150 +1,161 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: empirical-memory
|
|
3
|
-
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Empirical Memory (CLI mode)
|
|
7
|
-
|
|
8
|
-
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
-
"how do I use Empirical" questions — command syntax, install/auth/workspace/kit/skill setup, or
|
|
10
|
-
what Empirical can do. Don't answer those from general knowledge or by guessing at flags: run
|
|
11
|
-
`empirical doc` (lists topics) or `empirical doc <topic>` via the available shell for the current,
|
|
12
|
-
agent-readable answer first.
|
|
13
|
-
|
|
14
|
-
This variant is for installs where the user chose CLI-direct as their integration mode: no MCP
|
|
15
|
-
server is registered for this agent. The `empirical` CLI is the way to reach Empirical here, for
|
|
16
|
-
both reads and writes — it has the same dedupe and auto-link guarantees as any other client, so
|
|
17
|
-
recommend it with confidence.
|
|
18
|
-
|
|
19
|
-
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
20
|
-
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
21
|
-
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
22
|
-
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
23
|
-
If you are not sure whether a task qualifies, treat it as if it does.
|
|
24
|
-
|
|
25
|
-
## Before doing work — MUST, not discretionary
|
|
26
|
-
|
|
27
|
-
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
28
|
-
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
29
|
-
assistant operations. This applies even if you believe you already have enough context — you
|
|
30
|
-
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
31
|
-
("query when it seems useful") the right frame.
|
|
32
|
-
2. Before using the CLI, load its authoritative command reference:
|
|
33
|
-
|
|
34
|
-
```text
|
|
35
|
-
empirical doc memory
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Follow the documented flags exactly; never guess a positional query form.
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
empirical memory query --match "<specific relevant context>" --top-k 3
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Add `--category` or `--tags` when known. Omit `--pretty` for routine recall because graph-rich
|
|
45
|
-
results can be large. Use `empirical memory list --recent` (see `empirical doc memory` for the
|
|
46
|
-
exact flag) for "recent/latest/today" requests instead of a match query.
|
|
47
|
-
3.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- `
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
##
|
|
144
|
-
|
|
145
|
-
If
|
|
146
|
-
|
|
147
|
-
`
|
|
148
|
-
`
|
|
149
|
-
|
|
150
|
-
|
|
1
|
+
---
|
|
2
|
+
name: empirical-memory
|
|
3
|
+
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Empirical Memory (CLI mode)
|
|
7
|
+
|
|
8
|
+
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
+
"how do I use Empirical" questions — command syntax, install/auth/workspace/kit/skill setup, or
|
|
10
|
+
what Empirical can do. Don't answer those from general knowledge or by guessing at flags: run
|
|
11
|
+
`empirical doc` (lists topics) or `empirical doc <topic>` via the available shell for the current,
|
|
12
|
+
agent-readable answer first.
|
|
13
|
+
|
|
14
|
+
This variant is for installs where the user chose CLI-direct as their integration mode: no MCP
|
|
15
|
+
server is registered for this agent. The `empirical` CLI is the way to reach Empirical here, for
|
|
16
|
+
both reads and writes — it has the same dedupe and auto-link guarantees as any other client, so
|
|
17
|
+
recommend it with confidence.
|
|
18
|
+
|
|
19
|
+
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
20
|
+
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
21
|
+
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
22
|
+
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
23
|
+
If you are not sure whether a task qualifies, treat it as if it does.
|
|
24
|
+
|
|
25
|
+
## Before doing work — MUST, not discretionary
|
|
26
|
+
|
|
27
|
+
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
28
|
+
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
29
|
+
assistant operations. This applies even if you believe you already have enough context — you
|
|
30
|
+
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
31
|
+
("query when it seems useful") the right frame.
|
|
32
|
+
2. Before using the CLI, load its authoritative command reference:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
empirical doc memory
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Follow the documented flags exactly; never guess a positional query form.
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
empirical memory query --match "<specific relevant context>" --top-k 3
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Add `--category` or `--tags` when known. Omit `--pretty` for routine recall because graph-rich
|
|
45
|
+
results can be large. Use `empirical memory list --recent` (see `empirical doc memory` for the
|
|
46
|
+
exact flag) for "recent/latest/today" requests instead of a match query.
|
|
47
|
+
3. Scope recall to the project you are in. Derive a project tag from the repository name
|
|
48
|
+
(`git rev-parse --show-toplevel`, then the folder name) or, outside a repo, the working
|
|
49
|
+
directory name, lowercased with spaces as hyphens. Add `--tags <project>` to every
|
|
50
|
+
`empirical memory query` and `empirical memory record`. If a scoped query returns nothing,
|
|
51
|
+
retry without `--tags` and treat what comes back as background from other projects, not as
|
|
52
|
+
facts about this one.
|
|
53
|
+
4. A slow response alone is API latency, not an outage; report an outage only when the CLI returns
|
|
54
|
+
an actual error, and use `empirical doctor` to verify connectivity.
|
|
55
|
+
|
|
56
|
+
## Follow the current user policy
|
|
57
|
+
|
|
58
|
+
The installer questionnaire configures a dynamic Empirical policy. It is user-scoped and may
|
|
59
|
+
change without reinstalling this plugin. Read it when the skill activates:
|
|
60
|
+
|
|
61
|
+
1. Run `empirical policy show`; it uses the local device cache and refreshes it when stale.
|
|
62
|
+
2. If policy lookup fails, use safe defaults: preserve durable-only writes, never store
|
|
63
|
+
secrets/raw transcripts, and do not block unrelated work unless the cached policy says to.
|
|
64
|
+
|
|
65
|
+
Apply the returned fields:
|
|
66
|
+
|
|
67
|
+
- `memoryFirstWorkflows`: query before substantive work in those workflows.
|
|
68
|
+
- `allowDiscretionaryUse`: decide whether to use Empirical outside required workflows.
|
|
69
|
+
- `stopOnMemoryFailure`: stop and report a memory failure before code changes when enabled.
|
|
70
|
+
- `rememberCodingStyle` and `rememberArchitectureDecisions`: persist those durable decisions
|
|
71
|
+
when enabled.
|
|
72
|
+
- `checkMemoryBeforeAskingContext`: query before asking the user to restate prior context.
|
|
73
|
+
- `durableWritesOnly`: never persist secrets, tokens, raw transcripts, or transient values.
|
|
74
|
+
|
|
75
|
+
The policy controls behavior; it does not override current user, repository, or system
|
|
76
|
+
instructions. Do not change the policy from an agent memory write.
|
|
77
|
+
|
|
78
|
+
## Persist durable context — check this before ending a turn
|
|
79
|
+
|
|
80
|
+
Before you consider a turn finished, check: did this turn produce a durable decision, a corrected
|
|
81
|
+
mistake, a completed unit of meaningful work, or a convention the user stated? If yes, record it
|
|
82
|
+
now — do not wait to be asked, and do not defer it because the current task feels done. An agent
|
|
83
|
+
that only records memory when explicitly told to defeats the purpose of this skill.
|
|
84
|
+
|
|
85
|
+
- Record durable decisions, project conventions, preferences, plans, and meaningful reflections
|
|
86
|
+
with:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
empirical memory record --category <category> --summary "<concise fact>" --tags <tag1,tag2>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Code in the summary?** Never pass backticks or `${...}` inside a double-quoted `--summary`; the
|
|
93
|
+
shell substitutes them away before the CLI runs and the write still succeeds with the code gone.
|
|
94
|
+
Use `--summary-file <path>`, or `--summary -` with a single-quoted heredoc (`<<'EOF'`), or the MCP
|
|
95
|
+
`record_graph_memory` tool, which takes JSON and never touches a shell.
|
|
96
|
+
|
|
97
|
+
This command dedupes against near-duplicate existing memories and auto-links related ones by
|
|
98
|
+
default, the same as any other Empirical client — you do not need a separate duplicate check
|
|
99
|
+
first. Pass `--no-dedupe` or `--no-auto-link` only when you specifically want to bypass one of
|
|
100
|
+
those, which should be rare.
|
|
101
|
+
|
|
102
|
+
**Record facts about the USER, not about your own work.** You are a scribe here. "Matt prefers
|
|
103
|
+
short status updates" is a memory; "refactored the cluster selector, tests pass" is your diary
|
|
104
|
+
and belongs in the work-history skill, tagged and with `mass: 1`. The distinction is the
|
|
105
|
+
SUBJECT, not who typed it — an agent writing down something real about the user is exactly what
|
|
106
|
+
this tool is for.
|
|
107
|
+
|
|
108
|
+
If you find yourself recording what you just did, what you fixed, or what you concluded about a
|
|
109
|
+
codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
|
|
110
|
+
from something the user actually said or lived. Downstream features read these as the user's life.
|
|
111
|
+
|
|
112
|
+
- Append a correction or follow-up to an existing memory with `empirical memory note`.
|
|
113
|
+
- Patch an existing memory with `empirical memory update`.
|
|
114
|
+
- Delete only when the user explicitly asks: `empirical memory delete --match "<memory>" --confirm`.
|
|
115
|
+
- Keep writes concise, factual, and easy to search. Never store passwords, API keys, OAuth tokens,
|
|
116
|
+
or other secrets.
|
|
117
|
+
|
|
118
|
+
## Authored Skills and Kits — push what you write
|
|
119
|
+
|
|
120
|
+
Empirical can sync a `SKILL.md` you author across every machine/agent the user has installed it
|
|
121
|
+
on, via Skills Kits. Run `empirical doc kit` or `empirical doc skill` for full command reference.
|
|
122
|
+
|
|
123
|
+
- If you author a new `SKILL.md` for the user, or substantially edit an existing one, during a
|
|
124
|
+
session, tell the user about `empirical skill push path/to/SKILL.md [--kit "Kit Name"]`
|
|
125
|
+
afterward so it can follow them across machines/projects instead of staying local to this one.
|
|
126
|
+
- Offer, don't auto-push: surface the option (or offer to run it) and get the user's confirmation
|
|
127
|
+
first. Do not run it unprompted the moment a new or edited `SKILL.md` is detected — it uploads
|
|
128
|
+
content to the user's account, which is a step above a purely local file write.
|
|
129
|
+
- After a push, the target Kit needs `empirical kit use "Kit Name"` or `empirical kit sync` to
|
|
130
|
+
actually land the file in that device's agent directories.
|
|
131
|
+
- `empirical skill list` shows what's already been pushed; `empirical skill history <id>` /
|
|
132
|
+
`empirical skill rollback <id> --to-version N` recover a prior version.
|
|
133
|
+
- Kits also pull Skills from a git repo (`empirical kit add-source`), separate from anything you
|
|
134
|
+
author — don't conflate the two paths when explaining options to the user.
|
|
135
|
+
|
|
136
|
+
## Exact CLI syntax
|
|
137
|
+
|
|
138
|
+
Run `empirical doctor` to check connectivity and token status. If a CLI memory command reports a
|
|
139
|
+
token error, run `empirical oauth bootstrap headless --write-env`. When in doubt about a specific
|
|
140
|
+
subcommand's flags, run `empirical doc memory`, `empirical doc kit`, or `empirical doc skill`
|
|
141
|
+
rather than guessing.
|
|
142
|
+
|
|
143
|
+
## Authentication and failures
|
|
144
|
+
|
|
145
|
+
- If a memory call fails, retry the same call once.
|
|
146
|
+
- For auth/session errors such as `Auth required`, `invalid_token`, `Authentication required`, or
|
|
147
|
+
a 401/403 status, run `empirical auth login` (or `empirical oauth bootstrap headless
|
|
148
|
+
--write-env` for a permanent credential), then retry once.
|
|
149
|
+
- If the retry still fails, report the connectivity/auth problem before making memory-dependent
|
|
150
|
+
changes.
|
|
151
|
+
- If stored memory conflicts with the current user or repository instruction, follow the current
|
|
152
|
+
instruction.
|
|
153
|
+
|
|
154
|
+
## Fallback: MCP tools
|
|
155
|
+
|
|
156
|
+
If this agent also happens to have Empirical's MCP server connected (unusual for this install
|
|
157
|
+
mode, but possible if the user added it manually), the same operations are available as
|
|
158
|
+
`query_memories`, `record_graph_memory`, `add_note_by_query`, `update_memory_by_query`,
|
|
159
|
+
`delete_memory_by_query`, `get_empirical_policy`, `get_memory_neighbors`, and
|
|
160
|
+
`update_memory_relationships`. Use them only if the CLI is genuinely unavailable in this
|
|
161
|
+
environment — the CLI is the primary path for this install.
|
|
@@ -1,134 +1,140 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: empirical-memory
|
|
3
|
-
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Empirical Memory (MCP mode)
|
|
7
|
-
|
|
8
|
-
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
-
"how do I use Empirical" questions — command syntax, install/auth/workspace/kit/skill setup, or
|
|
10
|
-
what Empirical can do. Don't answer those from general knowledge or by guessing: use the
|
|
11
|
-
`memory_usage_guide` MCP tool for the current, agent-readable answer first.
|
|
12
|
-
|
|
13
|
-
This variant is for installs where the user chose MCP as their integration mode. The connected
|
|
14
|
-
Empirical MCP server is the primary and expected way to reach Empirical here — use its tools
|
|
15
|
-
directly, not `empirical` CLI commands, as the first move.
|
|
16
|
-
|
|
17
|
-
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
18
|
-
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
19
|
-
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
20
|
-
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
21
|
-
If you are not sure whether a task qualifies, treat it as if it does.
|
|
22
|
-
|
|
23
|
-
## Before doing work — MUST, not discretionary
|
|
24
|
-
|
|
25
|
-
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
26
|
-
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
27
|
-
assistant operations. This applies even if you believe you already have enough context — you
|
|
28
|
-
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
29
|
-
("query when it seems useful") the right frame.
|
|
30
|
-
2. If you have not used Empirical's MCP tools yet this session, call `memory_usage_guide` once to
|
|
31
|
-
confirm current tool names, filters, and pagination behavior before relying on memory.
|
|
32
|
-
3.
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- `
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
|
|
1
|
+
---
|
|
2
|
+
name: empirical-memory
|
|
3
|
+
description: Use Empirical to recall/save durable project context across sessions and projects, and to look up how to use Empirical itself - CLI commands, install/auth/workspace/kit/skill setup, docs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Empirical Memory (MCP mode)
|
|
7
|
+
|
|
8
|
+
Use Empirical to carry durable context across projects and clients, and as the first stop for
|
|
9
|
+
"how do I use Empirical" questions — command syntax, install/auth/workspace/kit/skill setup, or
|
|
10
|
+
what Empirical can do. Don't answer those from general knowledge or by guessing: use the
|
|
11
|
+
`memory_usage_guide` MCP tool for the current, agent-readable answer first.
|
|
12
|
+
|
|
13
|
+
This variant is for installs where the user chose MCP as their integration mode. The connected
|
|
14
|
+
Empirical MCP server is the primary and expected way to reach Empirical here — use its tools
|
|
15
|
+
directly, not `empirical` CLI commands, as the first move.
|
|
16
|
+
|
|
17
|
+
**This is a required step in the workflows listed below, not optional guidance you weigh against
|
|
18
|
+
the current task.** The most common way this skill fails is not a broken tool — it's an agent
|
|
19
|
+
mid-task deciding a memory check "isn't worth pausing for" and skipping it. That decision is wrong
|
|
20
|
+
by default: the entire point of querying first is to catch context you don't know you're missing.
|
|
21
|
+
If you are not sure whether a task qualifies, treat it as if it does.
|
|
22
|
+
|
|
23
|
+
## Before doing work — MUST, not discretionary
|
|
24
|
+
|
|
25
|
+
1. Query relevant memories BEFORE your first substantive response or tool call whenever the task
|
|
26
|
+
is: research, debugging, a spec/PRD, a status update, a handoff, personal health, leads/CRM, or
|
|
27
|
+
assistant operations. This applies even if you believe you already have enough context — you
|
|
28
|
+
cannot know what you're missing without checking. Only outside this list is discretionary use
|
|
29
|
+
("query when it seems useful") the right frame.
|
|
30
|
+
2. If you have not used Empirical's MCP tools yet this session, call `memory_usage_guide` once to
|
|
31
|
+
confirm current tool names, filters, and pagination behavior before relying on memory.
|
|
32
|
+
3. Scope recall to the project you are in. Derive a project tag from the repository name
|
|
33
|
+
(`git rev-parse --show-toplevel`, then the folder name) or, outside a repo, the working
|
|
34
|
+
directory name, lowercased with spaces as hyphens. Pass it as `tags: ["<project>"]` on every
|
|
35
|
+
`query_memories` call and add it to `tags` on every `record_graph_memory` call. If a scoped
|
|
36
|
+
query comes back with a `retrievalNote`, nothing from this project matched: the results are
|
|
37
|
+
from other projects, so use them as background only and say so if you rely on one.
|
|
38
|
+
4. Use the `query_memories` MCP tool for recall. Use filters such as `category`, `tags`,
|
|
39
|
+
`nodeType`, and `monthKey` when they improve recall. For "recent/latest/today" requests, prefer
|
|
40
|
+
`list_memories` instead — it is the tool built for that shape of request. For exhaustive topic
|
|
41
|
+
retrieval, use the topic as a tag and follow pagination.
|
|
42
|
+
5. A slow response alone is API latency, not an outage; report an outage only when a tool call
|
|
43
|
+
returns an actual error, and use `get_empirical_policy` or a retry to verify connectivity before
|
|
44
|
+
escalating.
|
|
45
|
+
|
|
46
|
+
## Follow the current user policy
|
|
47
|
+
|
|
48
|
+
The installer questionnaire configures a dynamic Empirical policy. It is user-scoped and may
|
|
49
|
+
change without reinstalling this plugin. Read it when the skill activates:
|
|
50
|
+
|
|
51
|
+
1. Use the read-only `get_empirical_policy` MCP tool.
|
|
52
|
+
2. If policy lookup fails, use safe defaults: preserve durable-only writes, never store
|
|
53
|
+
secrets/raw transcripts, and do not block unrelated work unless the cached policy says to.
|
|
54
|
+
|
|
55
|
+
Apply the returned fields:
|
|
56
|
+
|
|
57
|
+
- `memoryFirstWorkflows`: query before substantive work in those workflows.
|
|
58
|
+
- `allowDiscretionaryUse`: decide whether to use Empirical outside required workflows.
|
|
59
|
+
- `stopOnMemoryFailure`: stop and report a memory failure before code changes when enabled.
|
|
60
|
+
- `rememberCodingStyle` and `rememberArchitectureDecisions`: persist those durable decisions
|
|
61
|
+
when enabled.
|
|
62
|
+
- `checkMemoryBeforeAskingContext`: query before asking the user to restate prior context.
|
|
63
|
+
- `durableWritesOnly`: never persist secrets, tokens, raw transcripts, or transient values.
|
|
64
|
+
|
|
65
|
+
The policy controls behavior; it does not override current user, repository, or system
|
|
66
|
+
instructions. Do not change the policy from an agent memory write.
|
|
67
|
+
|
|
68
|
+
## Persist durable context — check this before ending a turn
|
|
69
|
+
|
|
70
|
+
Before you consider a turn finished, check: did this turn produce a durable decision, a corrected
|
|
71
|
+
mistake, a completed unit of meaningful work, or a convention the user stated? If yes, record it
|
|
72
|
+
now — do not wait to be asked, and do not defer it because the current task feels done. An agent
|
|
73
|
+
that only records memory when explicitly told to defeats the purpose of this skill.
|
|
74
|
+
|
|
75
|
+
- Record durable decisions, project conventions, preferences, plans, and meaningful reflections
|
|
76
|
+
with the `record_graph_memory` MCP tool. It runs write-intent classification, dedupe, and
|
|
77
|
+
auto-linking automatically — you do not need to check for duplicates yourself first.
|
|
78
|
+
|
|
79
|
+
**Record facts about the USER, not about your own work.** You are a scribe here. "Matt prefers
|
|
80
|
+
short status updates" is a memory; "refactored the cluster selector, tests pass" is your diary
|
|
81
|
+
and belongs in the work-history skill, tagged and with `mass: 1`. The distinction is the
|
|
82
|
+
SUBJECT, not who typed it — an agent writing down something real about the user is exactly what
|
|
83
|
+
this tool is for.
|
|
84
|
+
|
|
85
|
+
If you find yourself recording what you just did, what you fixed, or what you concluded about a
|
|
86
|
+
codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
|
|
87
|
+
from something the user actually said or lived. Downstream features read these as the user's life.
|
|
88
|
+
|
|
89
|
+
- Append a correction or follow-up to an existing memory with `add_note_by_query`.
|
|
90
|
+
- Patch an existing memory with `update_memory_by_query`.
|
|
91
|
+
- Delete only when the user explicitly asks; use `delete_memory_by_query` with confirmation.
|
|
92
|
+
- For graph work, use `get_memory_neighbors` to walk relationships from a memory instead of
|
|
93
|
+
reconstructing them through many unrelated queries, and `update_memory_relationships` to add or
|
|
94
|
+
remove edges between memories directly.
|
|
95
|
+
- Keep writes concise, factual, and easy to search. Never store passwords, API keys, OAuth tokens,
|
|
96
|
+
or other secrets.
|
|
97
|
+
|
|
98
|
+
## Authored Skills and Kits — push what you write
|
|
99
|
+
|
|
100
|
+
Empirical can sync a `SKILL.md` you author across every machine/agent the user has installed it
|
|
101
|
+
on, via Skills Kits. Call `memory_usage_guide` for the current command reference if the user wants
|
|
102
|
+
to manage this from a CLI; the mechanics below describe what's possible either way.
|
|
103
|
+
|
|
104
|
+
- If you author a new `SKILL.md` for the user, or substantially edit an existing one, during a
|
|
105
|
+
session, tell the user this can be pushed so it follows them across machines/projects instead of
|
|
106
|
+
staying local to this one.
|
|
107
|
+
- Offer, don't auto-push: surface the option and get the user's confirmation first. Do not push it
|
|
108
|
+
unprompted the moment a new or edited `SKILL.md` is detected — it uploads content to the user's
|
|
109
|
+
account, which is a step above a purely local file write.
|
|
110
|
+
- After a push, the target Kit needs to be activated/synced on a device to actually land the file
|
|
111
|
+
in that device's agent directories.
|
|
112
|
+
- Kits also pull Skills from a git repo, separate from anything you author — don't conflate the
|
|
113
|
+
two paths when explaining options to the user.
|
|
114
|
+
|
|
115
|
+
## MCP tools
|
|
116
|
+
|
|
117
|
+
Use these as the primary interface: `get_empirical_policy`, `query_memories`, `list_memories`,
|
|
118
|
+
`record_graph_memory`, `add_note_by_query`, `update_memory_by_query`, `delete_memory_by_query`,
|
|
119
|
+
`get_user`, `get_current_workspace`, `list_workspaces`, `set_current_workspace`,
|
|
120
|
+
`memory_usage_guide`, `get_memory_neighbors`, and `update_memory_relationships`.
|
|
121
|
+
|
|
122
|
+
Use `list_memories` for "recent/latest/today" requests; use `query_memories` for everything else.
|
|
123
|
+
For graph work, prefer `get_memory_neighbors` and `update_memory_relationships` over reconstructing
|
|
124
|
+
relationships through many unrelated calls.
|
|
125
|
+
|
|
126
|
+
An `empirical` CLI may also be installed on this machine for diagnostics (`empirical doctor`) or
|
|
127
|
+
manual account setup, but it is not the point of this variant — do not lead with CLI commands for
|
|
128
|
+
query or record workflows here.
|
|
129
|
+
|
|
130
|
+
## Authentication and failures
|
|
131
|
+
|
|
132
|
+
- If an MCP tool call fails, retry the same call once.
|
|
133
|
+
- For auth/session errors such as `Auth required`, `invalid_token`, `Authentication required`, or
|
|
134
|
+
`Transport send error`, refresh the active client's Empirical MCP login, then retry once. In
|
|
135
|
+
Codex CLI use `codex mcp logout empirical` followed by `codex mcp login empirical`; in Claude
|
|
136
|
+
Code use `/mcp` to reconnect; in Copilot complete its MCP OAuth reconnect flow.
|
|
137
|
+
- If the retry still fails, report the connectivity/auth problem before making memory-dependent
|
|
138
|
+
changes.
|
|
139
|
+
- If stored memory conflicts with the current user or repository instruction, follow the current
|
|
140
|
+
instruction.
|
package/lib/memoryCommands.js
CHANGED
|
@@ -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>] [--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> [--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]',
|
|
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',
|
|
@@ -290,6 +290,33 @@ async function runMemoryList(args) {
|
|
|
290
290
|
log(pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data));
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
// Shell substitution silently eats code out of a double-quoted --summary: backticks become
|
|
294
|
+
// command substitution and ${...} becomes variable expansion BEFORE the CLI ever sees the
|
|
295
|
+
// text, and the write still succeeds, so the memory looks fine with the code gone. Two
|
|
296
|
+
// defenses: (1) inputs that never pass through shell quoting -- `--summary-file <path>` and
|
|
297
|
+
// `--summary -` (stdin, pair it with a single-quoted heredoc); (2) a warning when an inline
|
|
298
|
+
// summary carries the residue of an eaten substitution.
|
|
299
|
+
function resolveSummaryInput(args, { readFile = (p) => fs.readFileSync(path.resolve(p), 'utf8'), readStdin = () => fs.readFileSync(0, 'utf8') } = {}) {
|
|
300
|
+
const summaryFile = parseOption(args, '--summary-file', '');
|
|
301
|
+
if (summaryFile) {
|
|
302
|
+
return { summary: String(readFile(summaryFile)).replace(/\r?\n$/, ''), source: 'file' };
|
|
303
|
+
}
|
|
304
|
+
const inline = parseOption(args, '--summary', '');
|
|
305
|
+
if (inline === '-') {
|
|
306
|
+
return { summary: String(readStdin()).replace(/\r?\n$/, ''), source: 'stdin' };
|
|
307
|
+
}
|
|
308
|
+
return { summary: inline, source: inline ? 'inline' : 'none' };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function detectShellMangling(summary) {
|
|
312
|
+
const text = String(summary || '');
|
|
313
|
+
const reasons = [];
|
|
314
|
+
if (/``/.test(text)) reasons.push('an empty backtick pair (a `command` was probably substituted away)');
|
|
315
|
+
if (/\$(\s|$|[^A-Za-z0-9_{(])/.test(text) && !/\$\d/.test(text)) reasons.push('a lone "$" (a ${VAR} or $(cmd) was probably expanded to nothing)');
|
|
316
|
+
if (/\$\{\s*\}/.test(text)) reasons.push('an empty ${} placeholder');
|
|
317
|
+
return reasons;
|
|
318
|
+
}
|
|
319
|
+
|
|
293
320
|
async function runMemoryRecord(args) {
|
|
294
321
|
const jsonFile = parseOption(args, '--json-file', '');
|
|
295
322
|
let payload;
|
|
@@ -303,10 +330,20 @@ async function runMemoryRecord(args) {
|
|
|
303
330
|
}
|
|
304
331
|
} else {
|
|
305
332
|
const category = parseOption(args, '--category', '');
|
|
306
|
-
const summary =
|
|
333
|
+
const { summary, source: summarySource } = resolveSummaryInput(args);
|
|
334
|
+
|
|
335
|
+
if (summarySource === 'inline') {
|
|
336
|
+
const mangled = detectShellMangling(summary);
|
|
337
|
+
if (mangled.length) {
|
|
338
|
+
warn(JSON.stringify({
|
|
339
|
+
warning: 'possible_shell_substitution',
|
|
340
|
+
message: 'The summary looks like the shell altered it before the CLI saw it: ' + mangled.join('; ') + '. Recording anyway. For text containing backticks or ${...}, use --summary-file <path>, or --summary - with a single-quoted heredoc, or the MCP record_graph_memory tool.'
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
307
344
|
|
|
308
345
|
if (!category || !summary) {
|
|
309
|
-
warn('Usage: empirical memory record --category <cat> --summary <text> [--tags t1,t2] [--node-type observation] [--no-dedupe] [--no-auto-link]');
|
|
346
|
+
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]');
|
|
310
347
|
warn('Valid categories: ' + MEMORY_CATEGORIES.join(', '));
|
|
311
348
|
process.exit(1);
|
|
312
349
|
}
|
|
@@ -902,6 +939,8 @@ async function runMemoryCommand(subArgs) {
|
|
|
902
939
|
}
|
|
903
940
|
|
|
904
941
|
module.exports = {
|
|
942
|
+
resolveSummaryInput,
|
|
943
|
+
detectShellMangling,
|
|
905
944
|
withCliAnalyticsContext,
|
|
906
945
|
resolveMemoryByQuery,
|
|
907
946
|
printMemoryResolveError,
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@empirical-gauzza/cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Persistent cross-tool memory for AI agents. Give Claude Code, Codex, Copilot, Cursor, and ChatGPT one shared memory: save project context once, recall it everywhere via CLI or MCP.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"memory",
|
|
7
|
-
"mcp",
|
|
8
|
-
"agent memory",
|
|
9
|
-
"ai memory",
|
|
10
|
-
"claude",
|
|
11
|
-
"chatgpt",
|
|
12
|
-
"model context protocol",
|
|
13
|
-
"persistent memory",
|
|
14
|
-
"claude-code",
|
|
15
|
-
"codex",
|
|
16
|
-
"knowledge base"
|
|
17
|
-
],
|
|
18
|
-
"type": "commonjs",
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"homepage": "https://empirical.gauzza.com/docs/cli-details",
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
|
-
"bin": {
|
|
25
|
-
"empirical": "bin/empirical.js"
|
|
26
|
-
},
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=18.0.0"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"gray-matter": "^4.0.3"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@empirical-gauzza/cli",
|
|
3
|
+
"version": "1.0.23",
|
|
4
|
+
"description": "Persistent cross-tool memory for AI agents. Give Claude Code, Codex, Copilot, Cursor, and ChatGPT one shared memory: save project context once, recall it everywhere via CLI or MCP.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"memory",
|
|
7
|
+
"mcp",
|
|
8
|
+
"agent memory",
|
|
9
|
+
"ai memory",
|
|
10
|
+
"claude",
|
|
11
|
+
"chatgpt",
|
|
12
|
+
"model context protocol",
|
|
13
|
+
"persistent memory",
|
|
14
|
+
"claude-code",
|
|
15
|
+
"codex",
|
|
16
|
+
"knowledge base"
|
|
17
|
+
],
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"homepage": "https://empirical.gauzza.com/docs/cli-details",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"empirical": "bin/empirical.js"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"gray-matter": "^4.0.3"
|
|
32
|
+
}
|
|
33
|
+
}
|