hippo-memory 3.7.1 → 3.9.0
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 +36 -34
- package/dist/api/agent-memories.d.ts +3 -2
- package/dist/api/agent-memories.js +21 -5
- package/dist/base/memory/agent-memory-report.js +1 -0
- package/dist/base/util/env.d.ts +1 -0
- package/dist/base/util/env.js +2 -0
- package/dist/base/util/secret-detect.d.ts +8 -0
- package/dist/base/util/secret-detect.js +31 -11
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/domain/agent-memories/apply.js +2 -1
- package/dist/domain/agent-memories/claude-code.d.ts +4 -0
- package/dist/domain/agent-memories/claude-code.js +24 -1
- package/dist/domain/agent-memories/container-steps.js +19 -3
- package/dist/domain/agent-memories/folder-store.d.ts +1 -0
- package/dist/domain/agent-memories/handover.js +2 -2
- package/dist/domain/agent-memories/keys.d.ts +4 -2
- package/dist/domain/agent-memories/keys.js +6 -3
- package/dist/domain/agent-memories/legacy.js +15 -8
- package/dist/domain/agent-memories/markdown.d.ts +5 -0
- package/dist/domain/agent-memories/markdown.js +7 -2
- package/dist/domain/agent-memories/note-parts.d.ts +4 -0
- package/dist/domain/agent-memories/note-parts.js +232 -0
- package/dist/domain/agent-memories/plan.d.ts +9 -4
- package/dist/domain/agent-memories/plan.js +35 -15
- package/dist/domain/agent-memories/source.d.ts +5 -0
- package/dist/domain/agent-memories/source.js +12 -0
- package/dist/domain/agent-memories/sync.js +5 -1
- package/dist/domain/agent-memories/types.d.ts +5 -1
- package/dist/store/sqlite/entries/set-aside.d.ts +2 -2
- package/dist/store/sqlite/entries/set-aside.js +5 -3
- package/dist/surface/capture/compact.d.ts +1 -1
- package/dist/surface/capture/compact.js +1 -1
- package/dist/surface/cli/doctor.js +1 -0
- package/dist/surface/cli/embedder-install.d.ts +18 -0
- package/dist/surface/cli/embedder-install.js +121 -0
- package/dist/surface/cli/hook-runtime.d.ts +3 -0
- package/dist/surface/cli/hook-runtime.js +13 -0
- package/dist/surface/cli/hook.js +3 -0
- package/dist/surface/cli/hooks/note-import-worker.d.ts +15 -0
- package/dist/surface/cli/hooks/note-import-worker.js +44 -0
- package/dist/surface/cli/hooks/note-written.d.ts +4 -0
- package/dist/surface/cli/hooks/note-written.js +41 -0
- package/dist/surface/cli/hooks/post-compact.js +9 -18
- package/dist/surface/cli/hooks/session-end.js +2 -14
- package/dist/surface/cli/init.js +35 -1
- package/dist/surface/cli/maintenance.js +2 -2
- package/dist/surface/cli/setup.js +2 -0
- package/dist/surface/cli/verbs/memory.js +3 -1
- package/dist/surface/cli/verbs/sessions.d.ts +2 -0
- package/dist/surface/cli/verbs/sessions.js +16 -2
- package/dist/surface/cli/verbs.d.ts +2 -0
- package/dist/surface/hooks-install/json-hooks.js +2 -2
- package/dist/surface/hooks-install/rules/claude-hooks.d.ts +3 -2
- package/dist/surface/hooks-install/rules/claude-hooks.js +25 -2
- package/dist/surface/hooks-install/rules/install-plan.js +1 -0
- package/dist/surface/hooks-install/rules/json-hooks.d.ts +4 -2
- package/dist/surface/hooks-install/rules/json-hooks.js +3 -2
- package/dist/surface/hooks-install/rules/shared.d.ts +3 -0
- package/dist/surface/hooks-install/rules/shared.js +5 -0
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Claude Code's hooks: install, migrate older forms, and remove hippo's handlers.
|
|
2
|
-
import { HIPPO_SLEEP_MARKER, HIPPO_LAST_SLEEP_MARKER, HIPPO_SESSION_RULES_MARKER, HIPPO_SESSION_RULES_COMMAND, HIPPO_CAPTURE_MARKER, HIPPO_SESSION_END_MARKER, HIPPO_PINNED_INJECT_MARKER, HIPPO_PINNED_INJECT_COMMAND, HIPPO_PRE_COMPACT_MARKER, HIPPO_COMPACT_RESUME_MARKER, HIPPO_CAPTURE_ERROR_MARKER, HIPPO_POST_COMPACT_MARKER, } from './shared.js';
|
|
2
|
+
import { HIPPO_SLEEP_MARKER, HIPPO_LAST_SLEEP_MARKER, HIPPO_SESSION_RULES_MARKER, HIPPO_SESSION_RULES_COMMAND, HIPPO_CAPTURE_MARKER, HIPPO_SESSION_END_MARKER, HIPPO_PINNED_INJECT_MARKER, HIPPO_PINNED_INJECT_COMMAND, HIPPO_PRE_COMPACT_MARKER, HIPPO_COMPACT_RESUME_MARKER, HIPPO_CAPTURE_ERROR_MARKER, HIPPO_POST_COMPACT_MARKER, HIPPO_NOTE_WRITTEN_MARKER, } from './shared.js';
|
|
3
3
|
import { isJsonString, isJsonObjectLiteral, } from '../../../base/util/json.js';
|
|
4
4
|
import { handlerCommands, hookArrayContains, isHippoCommand, runsHippo, stripHandlers, withoutHandlers, } from './hook-handlers.js';
|
|
5
5
|
import { HOOK_LONG_TIMEOUT_SECONDS, HOOK_MEDIUM_TIMEOUT_SECONDS, HOOK_SHORT_TIMEOUT_SECONDS, ensureHooksObject, nothingInstalled, } from './install-plan.js';
|
|
@@ -82,6 +82,7 @@ const CLAUDE_HOOK_MARKERS = [
|
|
|
82
82
|
['PreCompact', [HIPPO_PRE_COMPACT_MARKER]],
|
|
83
83
|
['PostCompact', [HIPPO_POST_COMPACT_MARKER]],
|
|
84
84
|
['PostToolUseFailure', [HIPPO_CAPTURE_ERROR_MARKER]],
|
|
85
|
+
['PostToolUse', [HIPPO_NOTE_WRITTEN_MARKER]],
|
|
85
86
|
['Stop', [HIPPO_SLEEP_MARKER]],
|
|
86
87
|
];
|
|
87
88
|
// Stop is only ever migrated away, so install never appends to it and a Stop that is not a list
|
|
@@ -121,7 +122,7 @@ function appendCompactionHooks(hooks, compactLog) {
|
|
|
121
122
|
const installedPostCompact = appendHookIfMissing(hooks, 'PostCompact', HIPPO_POST_COMPACT_MARKER, claudeCommandGroup(`hippo post-compact --log-file "${compactLog}"`, HOOK_MEDIUM_TIMEOUT_SECONDS));
|
|
122
123
|
return { installedPreCompact, installedCompactResume, installedPostCompact };
|
|
123
124
|
}
|
|
124
|
-
export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLog }) {
|
|
125
|
+
export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLog, noteLog }) {
|
|
125
126
|
const merge = ensureHooksObject(settings, CLAUDE_APPENDED_EVENTS);
|
|
126
127
|
if (merge === null)
|
|
127
128
|
return invalidClaudeSettings(settingsPath);
|
|
@@ -131,6 +132,7 @@ export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLo
|
|
|
131
132
|
const { installedSessionEnd, installedSessionStart, installedSessionRules, migratedPinnedInjectRecent, installedUserPromptSubmit, } = appendSessionHooks(hooks, logFile);
|
|
132
133
|
const { installedPreCompact, installedCompactResume, installedPostCompact } = appendCompactionHooks(hooks, compactLog);
|
|
133
134
|
const installedCaptureError = appendCaptureErrorHook(hooks);
|
|
135
|
+
const installedNoteWritten = appendNoteWrittenHook(hooks, noteLog);
|
|
134
136
|
const result = {
|
|
135
137
|
target: 'claude-code',
|
|
136
138
|
settingsPath,
|
|
@@ -142,6 +144,7 @@ export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLo
|
|
|
142
144
|
installedCompactResume,
|
|
143
145
|
installedPostCompact,
|
|
144
146
|
installedCaptureError,
|
|
147
|
+
installedNoteWritten,
|
|
145
148
|
migratedPinnedInjectRecent,
|
|
146
149
|
...migration,
|
|
147
150
|
invalidJson: false,
|
|
@@ -160,6 +163,26 @@ function appendCaptureErrorHook(hooks) {
|
|
|
160
163
|
// hook the plugin ships.
|
|
161
164
|
return appendHookIfMissing(hooks, 'PostToolUseFailure', HIPPO_CAPTURE_ERROR_MARKER, claudeCommandGroup('hippo capture-error', HOOK_MEDIUM_TIMEOUT_SECONDS, '.*'));
|
|
162
165
|
}
|
|
166
|
+
// Measured on Claude Code 2.1.326: an `Edit(...)` rule does not fire for a Write call, so each tool
|
|
167
|
+
// gets its own rule; `//**` reaches any config folder.
|
|
168
|
+
const NOTE_WRITTEN_IFS = [
|
|
169
|
+
'Write(//**/projects/*/memory/*.md)',
|
|
170
|
+
'Edit(//**/projects/*/memory/*.md)',
|
|
171
|
+
];
|
|
172
|
+
function appendNoteWrittenHook(hooks, noteLog) {
|
|
173
|
+
// PostToolUse: a memory note Claude Code just wrote reaches hippo at once, in a detached worker
|
|
174
|
+
// that `hippo note-written` starts. Versions that ignore `if` still get the hook's own path check.
|
|
175
|
+
const command = `hippo note-written --log-file "${noteLog}"`;
|
|
176
|
+
return appendHookIfMissing(hooks, 'PostToolUse', HIPPO_NOTE_WRITTEN_MARKER, {
|
|
177
|
+
matcher: 'Edit|Write|MultiEdit',
|
|
178
|
+
hooks: NOTE_WRITTEN_IFS.map((condition) => ({
|
|
179
|
+
type: 'command',
|
|
180
|
+
command,
|
|
181
|
+
timeout: HOOK_MEDIUM_TIMEOUT_SECONDS,
|
|
182
|
+
if: condition,
|
|
183
|
+
})),
|
|
184
|
+
});
|
|
185
|
+
}
|
|
163
186
|
/** The Claude Code handlers uninstall kept that still mention a hippo command (`nice hippo
|
|
164
187
|
* sleep`, `pnpm exec hippo ...`), so the user can be told to remove them by hand. */
|
|
165
188
|
export function keptHippoHandlers(hooks) {
|
|
@@ -16,6 +16,7 @@ export function nothingInstalled(target, settingsPath) {
|
|
|
16
16
|
installedCompactResume: false,
|
|
17
17
|
installedPostCompact: false,
|
|
18
18
|
installedCaptureError: false,
|
|
19
|
+
installedNoteWritten: false,
|
|
19
20
|
migratedPinnedInjectRecent: false,
|
|
20
21
|
migratedFromStop: false,
|
|
21
22
|
migratedLegacySessionEnd: false,
|
|
@@ -28,6 +28,8 @@ export interface InstallResult {
|
|
|
28
28
|
installedPostCompact: boolean;
|
|
29
29
|
/** PostToolUseFailure -> `hippo capture-error` (failed tool calls become error memories). */
|
|
30
30
|
installedCaptureError: boolean;
|
|
31
|
+
/** PostToolUse -> `hippo note-written` (a memory note Claude Code writes is imported at once). */
|
|
32
|
+
installedNoteWritten: boolean;
|
|
31
33
|
migratedPinnedInjectRecent: boolean;
|
|
32
34
|
migratedFromStop: boolean;
|
|
33
35
|
migratedLegacySessionEnd: boolean;
|
|
@@ -45,8 +47,8 @@ export declare function settingsText(settings: JsonValue): string;
|
|
|
45
47
|
export declare function planCopilotHooks(settingsPath: string, current: string | null): HookInstallPlan;
|
|
46
48
|
/** Adds hippo's hooks to parsed settings, which it edits in place, and migrates older hippo
|
|
47
49
|
* entries; `settings` is undefined for a file that is not JSON, which stays untouched.
|
|
48
|
-
* `compactLog` is where the compaction hooks log. */
|
|
49
|
-
export declare function planJsonHooks(target: 'claude-code' | 'codex', paths: Pick<JsonHookPaths, 'settings' | 'logFile'>, settings: JsonValue | undefined, compactLog: string): HookInstallPlan;
|
|
50
|
+
* `compactLog` is where the compaction hooks log, `noteLog` where the note hook does. */
|
|
51
|
+
export declare function planJsonHooks(target: 'claude-code' | 'codex', paths: Pick<JsonHookPaths, 'settings' | 'logFile'>, settings: JsonValue | undefined, compactLog: string, noteLog: string): HookInstallPlan;
|
|
50
52
|
/** What uninstall does to parsed settings, edited in place: the settings to write (null when
|
|
51
53
|
* nothing changed) and, for Claude Code, the kept handlers that still name a hippo command. */
|
|
52
54
|
export interface HookRemovalPlan {
|
|
@@ -59,8 +59,8 @@ export function planCopilotHooks(settingsPath, current) {
|
|
|
59
59
|
}
|
|
60
60
|
/** Adds hippo's hooks to parsed settings, which it edits in place, and migrates older hippo
|
|
61
61
|
* entries; `settings` is undefined for a file that is not JSON, which stays untouched.
|
|
62
|
-
* `compactLog` is where the compaction hooks log. */
|
|
63
|
-
export function planJsonHooks(target, paths, settings, compactLog) {
|
|
62
|
+
* `compactLog` is where the compaction hooks log, `noteLog` where the note hook does. */
|
|
63
|
+
export function planJsonHooks(target, paths, settings, compactLog, noteLog) {
|
|
64
64
|
const invalid = {
|
|
65
65
|
result: { ...nothingInstalled(target, paths.settings), invalidJson: true },
|
|
66
66
|
write: null,
|
|
@@ -75,6 +75,7 @@ export function planJsonHooks(target, paths, settings, compactLog) {
|
|
|
75
75
|
settingsPath: paths.settings,
|
|
76
76
|
logFile: paths.logFile,
|
|
77
77
|
compactLog,
|
|
78
|
+
noteLog,
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
/** Removes hippo's own hook handlers and keeps every other handler. */
|
|
@@ -20,6 +20,7 @@ export declare const HIPPO_PRE_COMPACT_MARKER = "hippo pre-compact";
|
|
|
20
20
|
export declare const HIPPO_COMPACT_RESUME_MARKER = "hippo compact-resume";
|
|
21
21
|
export declare const HIPPO_CAPTURE_ERROR_MARKER = "hippo capture-error";
|
|
22
22
|
export declare const HIPPO_POST_COMPACT_MARKER = "hippo post-compact";
|
|
23
|
+
export declare const HIPPO_NOTE_WRITTEN_MARKER = "hippo note-written";
|
|
23
24
|
/** Copilot's config folder: $COPILOT_HOME, else ~/.copilot under the profile folder, as the
|
|
24
25
|
* Copilot apps resolve it (a HOME that differs from the profile must not move it). */
|
|
25
26
|
export declare function copilotHomeDir({ home, env }: Homes): string;
|
|
@@ -42,4 +43,6 @@ export declare function sleepLogPathOn(homes: Homes): string;
|
|
|
42
43
|
* because `hippo last-sleep` truncates that one every SessionStart. Nothing reads it
|
|
43
44
|
* programmatically; overridden by `--log-file`. */
|
|
44
45
|
export declare function defaultPreCompactLogPath(homes: Homes): string;
|
|
46
|
+
/** Where `hippo note-written` logs each import; overridden by `--log-file`. */
|
|
47
|
+
export declare function defaultNoteWrittenLogPath(homes: Homes): string;
|
|
45
48
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -13,6 +13,7 @@ export const HIPPO_PRE_COMPACT_MARKER = 'hippo pre-compact';
|
|
|
13
13
|
export const HIPPO_COMPACT_RESUME_MARKER = 'hippo compact-resume';
|
|
14
14
|
export const HIPPO_CAPTURE_ERROR_MARKER = 'hippo capture-error';
|
|
15
15
|
export const HIPPO_POST_COMPACT_MARKER = 'hippo post-compact';
|
|
16
|
+
export const HIPPO_NOTE_WRITTEN_MARKER = 'hippo note-written';
|
|
16
17
|
/** Copilot's config folder: $COPILOT_HOME, else ~/.copilot under the profile folder, as the
|
|
17
18
|
* Copilot apps resolve it (a HOME that differs from the profile must not move it). */
|
|
18
19
|
export function copilotHomeDir({ home, env }) {
|
|
@@ -46,4 +47,8 @@ export function sleepLogPathOn(homes) {
|
|
|
46
47
|
export function defaultPreCompactLogPath(homes) {
|
|
47
48
|
return path.join(userHome(homes), HIPPO_DIR, 'logs', 'pre-compact.log');
|
|
48
49
|
}
|
|
50
|
+
/** Where `hippo note-written` logs each import; overridden by `--log-file`. */
|
|
51
|
+
export function defaultNoteWrittenLogPath(homes) {
|
|
52
|
+
return path.join(userHome(homes), HIPPO_DIR, 'logs', 'note-written.log');
|
|
53
|
+
}
|
|
49
54
|
//# sourceMappingURL=shared.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hippo-memory",
|
|
3
3
|
"name": "Hippo Memory",
|
|
4
4
|
"description": "One memory for every agent you'll ever use. Hippo writes what you teach a coding agent into a store in your repo, and your other agents read that same store.",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.9.0",
|
|
6
6
|
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hippo-memory",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "One memory for every agent you'll ever use. Hippo writes what you teach a coding agent into a store in your repo, and your other agents read that same store.",
|
|
6
6
|
"main": "index.ts",
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hippo-memory",
|
|
3
3
|
"name": "Hippo Memory",
|
|
4
4
|
"description": "One memory for every agent you'll ever use. Hippo writes what you teach a coding agent into a store in your repo, and your other agents read that same store.",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.9.0",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hippo-memory",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "One memory for every agent you'll ever use. Hippo writes what you teach a coding agent into a store in your repo, and your other agents read that same store.",
|
|
5
5
|
"mcpName": "io.github.kitfunso/hippo-memory",
|
|
6
6
|
"type": "module",
|