@empirical-gauzza/cli 1.0.23 → 1.0.24
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/README.md +63 -63
- package/bin/empirical.js +1 -1
- package/lib/doc.js +1 -1
- package/lib/env.js +49 -49
- package/lib/installers/detect.js +47 -47
- package/lib/installers/hooks.js +3 -3
- package/lib/installers/skill-variants/SKILL.both.md +170 -165
- package/lib/installers/skill-variants/SKILL.cli.md +166 -161
- package/lib/installers/skill-variants/SKILL.mcp.md +145 -140
- package/lib/oauthClient.js +222 -222
- package/lib/policyCommands.js +144 -144
- package/lib/workspaceContext.js +47 -47
- package/package.json +33 -33
|
@@ -1,161 +1,166 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
If
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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. 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
|
+
Two rules that are not optional:
|
|
86
|
+
|
|
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
|
+
- 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
|
+
- Record durable decisions, project conventions, preferences, plans, and meaningful reflections
|
|
91
|
+
with:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
empirical memory record --category <category> --summary "<concise fact>" --tags <tag1,tag2>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Code in the summary?** Never pass backticks or `${...}` inside a double-quoted `--summary`; the
|
|
98
|
+
shell substitutes them away before the CLI runs and the write still succeeds with the code gone.
|
|
99
|
+
Use `--summary-file <path>`, or `--summary -` with a single-quoted heredoc (`<<'EOF'`), or the MCP
|
|
100
|
+
`record_graph_memory` tool, which takes JSON and never touches a shell.
|
|
101
|
+
|
|
102
|
+
This command dedupes against near-duplicate existing memories and auto-links related ones by
|
|
103
|
+
default, the same as any other Empirical client — you do not need a separate duplicate check
|
|
104
|
+
first. Pass `--no-dedupe` or `--no-auto-link` only when you specifically want to bypass one of
|
|
105
|
+
those, which should be rare.
|
|
106
|
+
|
|
107
|
+
**Record facts about the USER, not about your own work.** You are a scribe here. "Matt prefers
|
|
108
|
+
short status updates" is a memory; "refactored the cluster selector, tests pass" is your diary
|
|
109
|
+
and belongs in the work-history skill, tagged and with `mass: 1`. The distinction is the
|
|
110
|
+
SUBJECT, not who typed it — an agent writing down something real about the user is exactly what
|
|
111
|
+
this tool is for.
|
|
112
|
+
|
|
113
|
+
If you find yourself recording what you just did, what you fixed, or what you concluded about a
|
|
114
|
+
codebase, stop: that is work-history or scar-tissue, and filing it here makes it indistinguishable
|
|
115
|
+
from something the user actually said or lived. Downstream features read these as the user's life.
|
|
116
|
+
|
|
117
|
+
- Append a correction or follow-up to an existing memory with `empirical memory note`.
|
|
118
|
+
- Patch an existing memory with `empirical memory update`.
|
|
119
|
+
- Delete only when the user explicitly asks: `empirical memory delete --match "<memory>" --confirm`.
|
|
120
|
+
- Keep writes concise, factual, and easy to search. Never store passwords, API keys, OAuth tokens,
|
|
121
|
+
or other secrets.
|
|
122
|
+
|
|
123
|
+
## Authored Skills and Kits — push what you write
|
|
124
|
+
|
|
125
|
+
Empirical can sync a `SKILL.md` you author across every machine/agent the user has installed it
|
|
126
|
+
on, via Skills Kits. Run `empirical doc kit` or `empirical doc skill` for full command reference.
|
|
127
|
+
|
|
128
|
+
- If you author a new `SKILL.md` for the user, or substantially edit an existing one, during a
|
|
129
|
+
session, tell the user about `empirical skill push path/to/SKILL.md [--kit "Kit Name"]`
|
|
130
|
+
afterward so it can follow them across machines/projects instead of staying local to this one.
|
|
131
|
+
- Offer, don't auto-push: surface the option (or offer to run it) and get the user's confirmation
|
|
132
|
+
first. Do not run it unprompted the moment a new or edited `SKILL.md` is detected — it uploads
|
|
133
|
+
content to the user's account, which is a step above a purely local file write.
|
|
134
|
+
- After a push, the target Kit needs `empirical kit use "Kit Name"` or `empirical kit sync` to
|
|
135
|
+
actually land the file in that device's agent directories.
|
|
136
|
+
- `empirical skill list` shows what's already been pushed; `empirical skill history <id>` /
|
|
137
|
+
`empirical skill rollback <id> --to-version N` recover a prior version.
|
|
138
|
+
- Kits also pull Skills from a git repo (`empirical kit add-source`), separate from anything you
|
|
139
|
+
author — don't conflate the two paths when explaining options to the user.
|
|
140
|
+
|
|
141
|
+
## Exact CLI syntax
|
|
142
|
+
|
|
143
|
+
Run `empirical doctor` to check connectivity and token status. If a CLI memory command reports a
|
|
144
|
+
token error, run `empirical oauth bootstrap headless --write-env`. When in doubt about a specific
|
|
145
|
+
subcommand's flags, run `empirical doc memory`, `empirical doc kit`, or `empirical doc skill`
|
|
146
|
+
rather than guessing.
|
|
147
|
+
|
|
148
|
+
## Authentication and failures
|
|
149
|
+
|
|
150
|
+
- If a memory call fails, retry the same call once.
|
|
151
|
+
- For auth/session errors such as `Auth required`, `invalid_token`, `Authentication required`, or
|
|
152
|
+
a 401/403 status, run `empirical auth login` (or `empirical oauth bootstrap headless
|
|
153
|
+
--write-env` for a permanent credential), then retry once.
|
|
154
|
+
- If the retry still fails, report the connectivity/auth problem before making memory-dependent
|
|
155
|
+
changes.
|
|
156
|
+
- If stored memory conflicts with the current user or repository instruction, follow the current
|
|
157
|
+
instruction.
|
|
158
|
+
|
|
159
|
+
## Fallback: MCP tools
|
|
160
|
+
|
|
161
|
+
If this agent also happens to have Empirical's MCP server connected (unusual for this install
|
|
162
|
+
mode, but possible if the user added it manually), the same operations are available as
|
|
163
|
+
`query_memories`, `record_graph_memory`, `add_note_by_query`, `update_memory_by_query`,
|
|
164
|
+
`delete_memory_by_query`, `get_empirical_policy`, `get_memory_neighbors`, and
|
|
165
|
+
`update_memory_relationships`. Use them only if the CLI is genuinely unavailable in this
|
|
166
|
+
environment — the CLI is the primary path for this install.
|