hippo-memory 3.1.1 → 3.2.1

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.
Files changed (64) hide show
  1. package/dist/api/context/context-plan.d.ts +2 -0
  2. package/dist/api/context/context-plan.js +8 -2
  3. package/dist/api/context/context-pools.d.ts +3 -0
  4. package/dist/api/context/context-pools.js +12 -0
  5. package/dist/api/context/context-render.d.ts +6 -0
  6. package/dist/api/context/context-render.js +24 -9
  7. package/dist/api/context/context-types.d.ts +6 -3
  8. package/dist/api/context/context.js +5 -4
  9. package/dist/api/context/user-rule.d.ts +12 -0
  10. package/dist/api/context/user-rule.js +24 -0
  11. package/dist/api/context/user-rules-get.d.ts +10 -0
  12. package/dist/api/context/user-rules-get.js +25 -0
  13. package/dist/api/index.d.ts +1 -0
  14. package/dist/api/index.js +1 -0
  15. package/dist/api/memories/remember.js +2 -2
  16. package/dist/api/prompt-hook.d.ts +11 -0
  17. package/dist/api/prompt-hook.js +26 -10
  18. package/dist/api/session-end.d.ts +1 -1
  19. package/dist/api/session-end.js +5 -3
  20. package/dist/base/memory/entry.d.ts +5 -0
  21. package/dist/base/memory/entry.js +8 -1
  22. package/dist/base/ports/store/capture.d.ts +3 -0
  23. package/dist/base/ports/store/ledger.d.ts +2 -2
  24. package/dist/base/ports/store/types.d.ts +3 -1
  25. package/dist/base/util/same-text.d.ts +7 -0
  26. package/dist/base/util/same-text.js +12 -0
  27. package/dist/base/util/version.d.ts +1 -1
  28. package/dist/base/util/version.js +1 -1
  29. package/dist/store/sqlite/capture/captures.js +33 -8
  30. package/dist/store/sqlite/entries/entry-writes.d.ts +5 -0
  31. package/dist/store/sqlite/entries/entry-writes.js +13 -0
  32. package/dist/store/sqlite/ledger/token-ledger.js +7 -1
  33. package/dist/store/sqlite/recall/candidates.js +3 -0
  34. package/dist/store/sqlite/sharing/copy-rows.d.ts +2 -0
  35. package/dist/store/sqlite/sharing/copy-rows.js +2 -1
  36. package/dist/surface/capture/command.d.ts +9 -2
  37. package/dist/surface/capture/command.js +67 -48
  38. package/dist/surface/capture/extract.d.ts +9 -2
  39. package/dist/surface/capture/extract.js +80 -20
  40. package/dist/surface/capture/transcript.js +6 -1
  41. package/dist/surface/cli/context.d.ts +7 -0
  42. package/dist/surface/cli/context.js +17 -10
  43. package/dist/surface/cli/hook.js +3 -0
  44. package/dist/surface/cli/hooks/session-end-worker.js +5 -3
  45. package/dist/surface/cli/init.js +3 -0
  46. package/dist/surface/cli/memory-import.js +2 -1
  47. package/dist/surface/cli/session-rules.d.ts +3 -0
  48. package/dist/surface/cli/session-rules.js +45 -0
  49. package/dist/surface/cli/setup.js +2 -0
  50. package/dist/surface/cli/verbs/sessions.d.ts +1 -0
  51. package/dist/surface/cli/verbs/sessions.js +10 -2
  52. package/dist/surface/cli/verbs.d.ts +1 -0
  53. package/dist/surface/hooks-install/rules/claude-hooks.js +11 -3
  54. package/dist/surface/hooks-install/rules/install-plan.js +1 -0
  55. package/dist/surface/hooks-install/rules/json-hooks.d.ts +2 -0
  56. package/dist/surface/hooks-install/rules/shared.d.ts +2 -0
  57. package/dist/surface/hooks-install/rules/shared.js +2 -0
  58. package/dist-ui/assets/{index-DWo8WuPW.js → index-DvZmCHQ5.js} +2 -2
  59. package/dist-ui/assets/{react-BZPdts19.js → react-BpaniaUk.js} +2 -2
  60. package/dist-ui/index.html +2 -2
  61. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  62. package/extensions/openclaw-plugin/package.json +1 -1
  63. package/openclaw.plugin.json +1 -1
  64. package/package.json +2 -2
@@ -12,8 +12,8 @@ import { DEFAULT_CONTEXT_BUDGET } from '../../api/context/context.js';
12
12
  import { cliApiContext, cliHookRequest } from './api-context.js';
13
13
  import { renderAmbientSummary } from '../../base/memory/ambient.js';
14
14
  import { strengthOf } from '../../api/types.js';
15
- import { contextBlockLines, contextCost, crossProjectLines, settleTokens, } from '../../api/context/context-render.js';
16
- import { additionalContextOutput, hasContextData, sessionStartEnvelope, toRenderItems, } from '../../api/prompt-hook.js';
15
+ import { contextBlockLines, contextCost, crossProjectLines, settleTokens, userRuleLines, } from '../../api/context/context-render.js';
16
+ import { additionalContextOutput, hasContextData, sessionStartEnvelope, splitUserRules, toRenderItems, } from '../../api/prompt-hook.js';
17
17
  import { flushDeliveryRecorder, startDeliveryRecorder, takeDelivery } from '../../api/ledger-db.js';
18
18
  import { boolFlag, parseBudgetFlag, parseCountFlag, parseLimitFlag, stringFlagOrExit, } from './flag-values.js';
19
19
  import { requireInit, workingFolder } from './shared.js';
@@ -92,18 +92,21 @@ async function renderContext(options) {
92
92
  const framing = stringFlagOrExit(flags, 'framing') ?? 'observe';
93
93
  const now = ctx.infra.clock();
94
94
  const input = { query, budget, pinnedOnly, format, framing, session, rec, now };
95
- const result = await api.contextGet(ctx, buildContextOpts(flags, input, ctx));
95
+ const opts = buildContextOpts(flags, input, ctx);
96
+ const result = await api.contextGet(ctx, opts);
96
97
  if (!hasContextData(result)) {
97
98
  rec?.delivered({ state: 'empty' });
98
99
  return;
99
100
  }
100
101
  const envelope = format === 'copilot' ? sessionStartEnvelope(stdinText) : undefined;
101
- await renderContextView(contextView(ctx, input, result, envelope), format, query);
102
+ const view = contextView(ctx, input, result, envelope, opts.currentProject);
103
+ await renderContextView(view, format, query);
102
104
  }
103
- function contextView(ctx, input, result, envelope) {
105
+ function contextView(ctx, input, result, envelope, project) {
104
106
  return {
105
107
  config: ctx.config,
106
108
  tenantId: ctx.tenantId,
109
+ project,
107
110
  ledgerSessionId: input.session.ledgerSessionId,
108
111
  payloadSessionId: input.session.payloadSessionId,
109
112
  pinnedOnly: input.pinnedOnly,
@@ -133,7 +136,7 @@ async function renderContextView(view, format, query) {
133
136
  await renderContextMarkdown(view);
134
137
  }
135
138
  }
136
- function resolveContextSession(stdinText) {
139
+ export function resolveContextSession(stdinText) {
137
140
  // The session id bounds the active-task-snapshot read: the stdin hook payload wins, then
138
141
  // hostSessionId(); absent both, api.contextGet applies the pure freshness bound.
139
142
  const payload = readHookPayload(stdinText);
@@ -220,11 +223,15 @@ async function renderContextJson(view, query) {
220
223
  * ledger does. */
221
224
  async function renderContextMarkdown(view) {
222
225
  const { result, rec, framing } = view;
226
+ const { userRules, others } = splitUserRules(view);
223
227
  // Cross-project inclusions get their own section so they never masquerade as project memory.
224
- const renderItems = toRenderItems(result.entries.filter((r) => r.category !== 'cross-project'));
225
- const crossEntries = result.entries.filter((r) => r.category === 'cross-project');
228
+ const renderItems = toRenderItems(others.filter((r) => r.category !== 'cross-project'));
229
+ const crossEntries = others.filter((r) => r.category === 'cross-project');
226
230
  const text = settleTokens((t) => {
227
- const lines = continuityTexts(result.activeSnapshot, result.sessionHandoff, result.recentEvents, result);
231
+ const lines = [
232
+ ...userRuleLines(userRules),
233
+ ...continuityTexts(result.activeSnapshot, result.sessionHandoff, result.recentEvents, result),
234
+ ];
228
235
  if (renderItems.length > 0) {
229
236
  lines.push(...contextBlockLines(renderItems, t, framing, { now: view.now, strength: view.strength }));
230
237
  }
@@ -236,7 +243,7 @@ async function renderContextMarkdown(view) {
236
243
  if (text.length > 0)
237
244
  console.log(text);
238
245
  rec?.delivered(text.length > 0 ? { state: 'sent', emittedText: `${text}\n` } : { state: 'empty' });
239
- await bookContextInject(view, renderItems.length, estimateTokens(text));
246
+ await bookContextInject(view, userRules.length + renderItems.length, estimateTokens(text));
240
247
  }
241
248
  export async function handleContext({ hippoRoot, tenantId, args, flags, }) {
242
249
  // Bounded, not a TTY guard: the hot stdin path and a manual run share this one command.
@@ -104,6 +104,9 @@ function printClaudeHookInstall(result) {
104
104
  if (result.installedSessionStart) {
105
105
  console.log(`Installed hippo last-sleep SessionStart hook in ${result.target} settings`);
106
106
  }
107
+ if (result.installedSessionRules) {
108
+ console.log(`Installed hippo session-rules SessionStart hook in ${result.target} settings`);
109
+ }
107
110
  if (result.installedUserPromptSubmit) {
108
111
  console.log(`Installed hippo pinned-inject UserPromptSubmit hook in ${result.target} settings`);
109
112
  }
@@ -39,11 +39,12 @@ function runSessionEndWork({ hippoRoot, tenantId, flags, mode, held, }) {
39
39
  },
40
40
  currentProject: () => ctx.infra.machine.projectIdentity(workingFolder(ctx)),
41
41
  // The run writes to this folder's own store, else to the global one in its reach.
42
- capture: async (into, turns, originProject) => {
42
+ capture: async (into, turns, originProject, fromStart) => {
43
43
  const root = into === ctx ? hippoRoot : ctx.reach?.global?.root;
44
44
  if (root === undefined)
45
45
  return false;
46
- return captureEndedSession(root, { tenantId, flags, transcriptPath, turns, originProject });
46
+ const ended = { tenantId, flags, transcriptPath, turns, originProject, fromStart };
47
+ return captureEndedSession(root, ended);
47
48
  },
48
49
  digest: (scan, key, log) => recordSessionDigest(hippoRoot, ctx.store, scan, { key, tenantId, log, config: ctx.config }),
49
50
  workingState: (log) => (transcriptPath ? transcriptWorkingState(transcriptPath, log) : null),
@@ -62,7 +63,7 @@ async function sleepFolderStore(hippoRoot, tenantId, flags, closeLogFile) {
62
63
  }
63
64
  }
64
65
  /** True when capture ran to the end, so a turn close may move its cursor past these turns. */
65
- async function captureEndedSession(store, { tenantId, flags, transcriptPath, turns, originProject }) {
66
+ async function captureEndedSession(store, { tenantId, flags, transcriptPath, turns, originProject, fromStart }) {
66
67
  const logFile = stringFlag(flags, 'log-file') ?? null;
67
68
  try {
68
69
  await runCapture(captureTarget(store), {
@@ -74,6 +75,7 @@ async function captureEndedSession(store, { tenantId, flags, transcriptPath, tur
74
75
  tenantId,
75
76
  originProject,
76
77
  sessionTurns: turns,
78
+ fromStart,
77
79
  });
78
80
  return true;
79
81
  }
@@ -331,6 +331,9 @@ function installClaudeCodeSettingsHooks(hook) {
331
331
  if (result.installedSessionStart) {
332
332
  console.log(` Auto-installed hippo last-sleep SessionStart hook in ${hook} settings`);
333
333
  }
334
+ if (result.installedSessionRules) {
335
+ console.log(` Auto-installed hippo session-rules SessionStart hook in ${hook} settings`);
336
+ }
334
337
  if (result.installedUserPromptSubmit) {
335
338
  console.log(` Auto-installed hippo pinned-inject UserPromptSubmit hook in ${hook} settings`);
336
339
  }
@@ -6,6 +6,7 @@ import { embedCoverage, memoryEmbedMissing } from '../../api/embeddings.js';
6
6
  import { importAtSessionEnd, importForStore } from '../../api/agent-memories.js';
7
7
  import { currentMachine } from '../../infra/machine.js';
8
8
  import { detailLines } from '../../base/memory/agent-memory-report.js';
9
+ import { withoutUserTag } from '../../base/memory/entry.js';
9
10
  import { importChatGPTInto, importClaudeInto, importCursorInto, importGenericFileInto, } from '../importers/sources.js';
10
11
  import { importMarkdownInto } from '../importers/markdown.js';
11
12
  import { importVaultInto } from '../importers/vault.js';
@@ -50,7 +51,7 @@ function warnRedacted(count) {
50
51
  export async function handleImport({ hippoRoot, tenantId, args, flags, }) {
51
52
  const useGlobal = boolFlag(flags, 'global');
52
53
  const dryRun = boolFlag(flags, 'dry-run');
53
- const extraTags = stringListFlag(flags, 'tag') ?? [];
54
+ const extraTags = withoutUserTag(stringListFlag(flags, 'tag') ?? []);
54
55
  const targetRoot = useGlobal ? hippoHomeDir() : hippoRoot;
55
56
  if (boolFlag(flags, 'agents')) {
56
57
  return await importAgentMemories(hippoRoot, tenantId, { useGlobal, dryRun });
@@ -0,0 +1,3 @@
1
+ import type { CommandContext } from './flag-values.js';
2
+ export declare function handleSessionRules({ hippoRoot, tenantId }: CommandContext): Promise<void>;
3
+ //# sourceMappingURL=session-rules.d.ts.map
@@ -0,0 +1,45 @@
1
+ // `hippo session-rules`: the SessionStart hook that sends the rules the person taught, and nothing
2
+ // else.
3
+ import { estimateTokens } from '../../base/util/token-text.js';
4
+ import { userRulesGet } from '../../api/index.js';
5
+ import { userRuleLines } from '../../api/context/context-render.js';
6
+ import { bookTokenUse } from '../../api/ledger-db.js';
7
+ import { cliApiContext, cliHookRequest, cliLedgerReach } from './api-context.js';
8
+ import { resolveContextSession } from './context.js';
9
+ import { hookStoreRoot, inPilotHoldout } from './hook-runtime.js';
10
+ import { readHookStdin } from './stdin.js';
11
+ import { workingFolder } from './shared.js';
12
+ async function printSessionRules(hippoRoot, tenantId, stdinText) {
13
+ const { currentSessionId, ledgerSessionId, payloadSessionId } = resolveContextSession(stdinText);
14
+ // Booked at the first hook call, as the prompt hook books it, so the holdout sees no rules.
15
+ const held = await inPilotHoldout(hippoRoot, tenantId, currentSessionId, {
16
+ write: payloadSessionId !== undefined,
17
+ });
18
+ if (held)
19
+ return;
20
+ const ctx = cliApiContext(hippoRoot, tenantId);
21
+ const rules = await userRulesGet(ctx, {
22
+ currentProject: ctx.infra.machine.projectIdentity(workingFolder(ctx)),
23
+ currentSessionId,
24
+ });
25
+ const text = userRuleLines(rules).join('\n').trim();
26
+ if (text === '')
27
+ return;
28
+ process.stdout.write(JSON.stringify({
29
+ hookSpecificOutput: { hookEventName: 'SessionStart', additionalContext: text },
30
+ }));
31
+ await bookTokenUse({
32
+ tenantId,
33
+ sessionId: ledgerSessionId,
34
+ surface: 'session_start',
35
+ event: 'inject',
36
+ items: rules.length,
37
+ tokens: estimateTokens(text),
38
+ }, cliLedgerReach(hippoRoot));
39
+ }
40
+ export async function handleSessionRules({ hippoRoot, tenantId }) {
41
+ const { text: stdinText } = await readHookStdin();
42
+ // Fires in every folder, so it never requires init: a folder with no store reads the global one.
43
+ await cliHookRequest(() => printSessionRules(hookStoreRoot(hippoRoot), tenantId, stdinText));
44
+ }
45
+ //# sourceMappingURL=session-rules.js.map
@@ -104,6 +104,8 @@ function setupJsonTool(tool, dryRun) {
104
104
  bits.push('SessionEnd (session-end)');
105
105
  if (result.installedSessionStart)
106
106
  bits.push('SessionStart');
107
+ if (result.installedSessionRules)
108
+ bits.push('SessionStart (session-rules)');
107
109
  if (result.installedUserPromptSubmit)
108
110
  bits.push('UserPromptSubmit (pinned-inject)');
109
111
  if (result.installedPreCompact)
@@ -19,6 +19,7 @@ export declare const SESSION_VERBS: {
19
19
  capture: VerbSpec;
20
20
  setup: VerbSpec;
21
21
  'last-sleep': VerbSpec;
22
+ 'session-rules': VerbSpec;
22
23
  'session-end': VerbSpec;
23
24
  '__session-end-worker': VerbSpec;
24
25
  'pre-compact': VerbSpec;
@@ -301,7 +301,7 @@ export const SESSION_VERBS = {
301
301
  usage: [
302
302
  `
303
303
  setup One-shot: detect installed AI tools and install their hooks:
304
- claude-code gets 7 hooks in $CLAUDE_CONFIG_DIR/settings.json
304
+ claude-code gets 8 hooks in $CLAUDE_CONFIG_DIR/settings.json
305
305
  (~/.claude by default), opencode a plugin, codex 2 hooks in
306
306
  its hooks.json plus a launcher wrapper, copilot 4 hooks, the
307
307
  MCP server and an instructions block under $COPILOT_HOME
@@ -323,6 +323,14 @@ export const SESSION_VERBS = {
323
323
  --keep Print without clearing`,
324
324
  ],
325
325
  }),
326
+ 'session-rules': verb(() => import('../session-rules.js'), 'handleSessionRules', {
327
+ flags: {},
328
+ usage: [
329
+ `
330
+ session-rules SessionStart hook: send every rule you stated to this project as Claude Code
331
+ session context, from the project store and the global one`,
332
+ ],
333
+ }),
326
334
  'session-end': verb(() => import('../hooks/session-end.js'), 'handleSessionEnd', {
327
335
  // Its sleep step reads --dry-run, but the capture after it writes for real.
328
336
  dryRun: false,
@@ -399,7 +407,7 @@ export const SESSION_VERBS = {
399
407
  hook <sub> [target] Manage framework integrations
400
408
  hook list Show available hooks
401
409
  hook install <target> Install hook (claude-code|codex|copilot|cursor|openclaw|opencode|pi)
402
- claude-code adds 7 hooks to $CLAUDE_CONFIG_DIR/settings.json
410
+ claude-code adds 8 hooks to $CLAUDE_CONFIG_DIR/settings.json
403
411
  (~/.claude by default); opencode installs a plugin; codex
404
412
  adds 2 hooks to $CODEX_HOME/hooks.json (trust them once in /hooks) and
405
413
  wraps the detected launcher in place; copilot writes
@@ -36,6 +36,7 @@ export declare const COMMANDS: {
36
36
  capture: import("./verb-row.js").VerbSpec;
37
37
  setup: import("./verb-row.js").VerbSpec;
38
38
  'last-sleep': import("./verb-row.js").VerbSpec;
39
+ 'session-rules': import("./verb-row.js").VerbSpec;
39
40
  'session-end': import("./verb-row.js").VerbSpec;
40
41
  '__session-end-worker': import("./verb-row.js").VerbSpec;
41
42
  'pre-compact': import("./verb-row.js").VerbSpec;
@@ -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_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, } 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';
@@ -74,7 +74,10 @@ function appendHookIfMissing(hooks, event, marker, group) {
74
74
  * included; uninstall removes only handlers that run one. */
75
75
  const CLAUDE_HOOK_MARKERS = [
76
76
  ['SessionEnd', [HIPPO_SESSION_END_MARKER, HIPPO_SLEEP_MARKER, HIPPO_CAPTURE_MARKER]],
77
- ['SessionStart', [HIPPO_LAST_SLEEP_MARKER, HIPPO_COMPACT_RESUME_MARKER]],
77
+ [
78
+ 'SessionStart',
79
+ [HIPPO_LAST_SLEEP_MARKER, HIPPO_SESSION_RULES_MARKER, HIPPO_COMPACT_RESUME_MARKER],
80
+ ],
78
81
  ['UserPromptSubmit', [HIPPO_PINNED_INJECT_MARKER]],
79
82
  ['PreCompact', [HIPPO_PRE_COMPACT_MARKER]],
80
83
  ['PostCompact', [HIPPO_POST_COMPACT_MARKER]],
@@ -87,6 +90,9 @@ const CLAUDE_APPENDED_EVENTS = CLAUDE_HOOK_MARKERS.map(([event]) => event).filte
87
90
  function appendSessionHooks(hooks, logFile) {
88
91
  const installedSessionEnd = appendHookIfMissing(hooks, 'SessionEnd', HIPPO_SESSION_END_MARKER, claudeCommandGroup(`hippo session-end --log-file "${logFile}"`, HOOK_SHORT_TIMEOUT_SECONDS));
89
92
  const installedSessionStart = appendHookIfMissing(hooks, 'SessionStart', HIPPO_LAST_SLEEP_MARKER, claudeCommandGroup(`hippo last-sleep --path "${logFile}"`, HOOK_SHORT_TIMEOUT_SECONDS));
93
+ // No matcher: a resumed or cleared session and a compaction lose the rules too, so every source
94
+ // sends them again.
95
+ const installedSessionRules = appendHookIfMissing(hooks, 'SessionStart', HIPPO_SESSION_RULES_MARKER, claudeCommandGroup(HIPPO_SESSION_RULES_COMMAND, HOOK_SHORT_TIMEOUT_SECONDS));
90
96
  // Mid-session pinned-rule re-injection: UserPromptSubmit runs every turn, so pinned memories stay
91
97
  // in context; the fresh write tail makes lessons saved earlier in the session visible on the next
92
98
  // prompt even before they are pinned.
@@ -95,6 +101,7 @@ function appendSessionHooks(hooks, logFile) {
95
101
  return {
96
102
  installedSessionEnd,
97
103
  installedSessionStart,
104
+ installedSessionRules,
98
105
  migratedPinnedInjectRecent,
99
106
  installedUserPromptSubmit,
100
107
  };
@@ -121,7 +128,7 @@ export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLo
121
128
  // SAFETY: ensureHooksObject left every event hippo appends to absent or an array.
122
129
  const hooks = merge;
123
130
  const migration = migrateLegacyClaudeHooks(hooks);
124
- const { installedSessionEnd, installedSessionStart, migratedPinnedInjectRecent, installedUserPromptSubmit, } = appendSessionHooks(hooks, logFile);
131
+ const { installedSessionEnd, installedSessionStart, installedSessionRules, migratedPinnedInjectRecent, installedUserPromptSubmit, } = appendSessionHooks(hooks, logFile);
125
132
  const { installedPreCompact, installedCompactResume, installedPostCompact } = appendCompactionHooks(hooks, compactLog);
126
133
  const installedCaptureError = appendCaptureErrorHook(hooks);
127
134
  const result = {
@@ -129,6 +136,7 @@ export function planClaudeCodeHooks(settings, { settingsPath, logFile, compactLo
129
136
  settingsPath,
130
137
  installedSessionEnd,
131
138
  installedSessionStart,
139
+ installedSessionRules,
132
140
  installedUserPromptSubmit,
133
141
  installedPreCompact,
134
142
  installedCompactResume,
@@ -10,6 +10,7 @@ export function nothingInstalled(target, settingsPath) {
10
10
  settingsPath,
11
11
  installedSessionEnd: false,
12
12
  installedSessionStart: false,
13
+ installedSessionRules: false,
13
14
  installedUserPromptSubmit: false,
14
15
  installedPreCompact: false,
15
16
  installedCompactResume: false,
@@ -18,6 +18,8 @@ export interface InstallResult {
18
18
  settingsPath: string;
19
19
  installedSessionEnd: boolean;
20
20
  installedSessionStart: boolean;
21
+ /** SessionStart -> `hippo session-rules` (sends the rules you stated). */
22
+ installedSessionRules: boolean;
21
23
  installedUserPromptSubmit: boolean;
22
24
  installedPreCompact: boolean;
23
25
  installedCompactResume: boolean;
@@ -9,6 +9,8 @@ export interface ToolDetection {
9
9
  }
10
10
  export declare const HIPPO_SLEEP_MARKER = "hippo sleep";
11
11
  export declare const HIPPO_LAST_SLEEP_MARKER = "hippo last-sleep";
12
+ export declare const HIPPO_SESSION_RULES_MARKER = "hippo session-rules";
13
+ export declare const HIPPO_SESSION_RULES_COMMAND = "hippo session-rules";
12
14
  export declare const HIPPO_CAPTURE_MARKER = "hippo capture --last-session";
13
15
  export declare const HIPPO_SESSION_END_MARKER = "hippo session-end";
14
16
  export declare const HIPPO_PINNED_INJECT_MARKER = "hippo context --pinned-only";
@@ -2,6 +2,8 @@ import * as path from 'node:path';
2
2
  import { HIPPO_DIR, userHome } from '../../../base/util/agent-homes.js';
3
3
  export const HIPPO_SLEEP_MARKER = 'hippo sleep';
4
4
  export const HIPPO_LAST_SLEEP_MARKER = 'hippo last-sleep';
5
+ export const HIPPO_SESSION_RULES_MARKER = 'hippo session-rules';
6
+ export const HIPPO_SESSION_RULES_COMMAND = 'hippo session-rules';
5
7
  export const HIPPO_CAPTURE_MARKER = 'hippo capture --last-session';
6
8
  export const HIPPO_SESSION_END_MARKER = 'hippo session-end';
7
9
  export const HIPPO_PINNED_INJECT_MARKER = 'hippo context --pinned-only';