hippo-memory 3.3.0 → 3.3.2
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 +1 -1
- package/dist/api/context/context-pools.d.ts +1 -1
- package/dist/api/context/context-pools.js +7 -1
- package/dist/api/context/context-render.js +1 -3
- package/dist/api/memories/remember.js +2 -2
- package/dist/base/memory/entry.d.ts +9 -3
- package/dist/base/memory/entry.js +11 -5
- package/dist/base/scope/read-admission.js +2 -2
- package/dist/base/util/secret-detect.js +2 -0
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/domain/context/select-policy.d.ts +2 -2
- package/dist/domain/context/select-policy.js +3 -2
- package/dist/domain/sharing/share.js +3 -1
- package/dist/store/sqlite/recall/candidates.js +5 -2
- package/dist/surface/capture/extract.d.ts +1 -1
- package/dist/surface/capture/extract.js +9 -8
- package/dist/surface/cli/memory-import.js +2 -2
- 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
package/README.md
CHANGED
|
@@ -203,7 +203,7 @@ hippo capture --file conversation.md --dry-run
|
|
|
203
203
|
|
|
204
204
|
#### Rules from follow-up turns (opt-in, uses a model)
|
|
205
205
|
|
|
206
|
-
Word patterns
|
|
206
|
+
Word patterns pin a later turn only when it holds a rule word (never, always, must, make sure) or a preference word that names code or limits a choice. Any other statement that names code or limits a choice, such as "Run the tests with `pnpm test:unit`, not the bare `pnpm test`", stays an unpinned note that only a matching prompt or `hippo recall` brings back. Patterns store nothing from "That file is generated, so changes belong in the template it comes from." With `{"capture": {"followUpRules": "model"}}` in `.hippo/config.json` and `ANTHROPIC_API_KEY` set, a session capture also asks a model which of your sentences state a lasting rule. Hippo stores those sentences, in your own words, as pinned rules.
|
|
207
207
|
|
|
208
208
|
- **What it sends:** your turns after the first one in the session, the last 20, each cut to 1,000 characters. Pasted blocks, fenced code and log lines are removed first, and secrets, email addresses and home paths are masked. The assistant's replies are never sent.
|
|
209
209
|
- **To whom:** Anthropic, with your `ANTHROPIC_API_KEY`, in one call per session capture. A failed call logs one line and capture keeps its pattern rules. A session with no project never makes the call.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MemoryEntry } from '../../base/memory/entry.js';
|
|
2
2
|
import type { AmbientLoadResult, AmbientRecallRequest } from '../../base/ports/store/context-reads.js';
|
|
3
3
|
import type { SessionHandoff } from '../../base/session/handoff.js';
|
|
4
4
|
import { type AmbientAdmission } from '../../base/scope/read-admission.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Which rows a context call loads.
|
|
2
|
+
import { isCapturedNote } from '../../base/memory/entry.js';
|
|
1
3
|
import { DEFAULT_SEARCH_CANDIDATE_LIMIT } from '../../base/rank/search-types.js';
|
|
2
4
|
import { projectNames } from '../../base/scope/project-identity.js';
|
|
3
5
|
import { ambientAdmits, ambientEnvelopeAdmits, } from '../../base/scope/read-admission.js';
|
|
@@ -34,7 +36,11 @@ async function loadAmbientEntries(source, tenantId, options) {
|
|
|
34
36
|
ownScope: window.ownScope,
|
|
35
37
|
})
|
|
36
38
|
: await source.reads.contextCandidates(tenantId, window);
|
|
37
|
-
|
|
39
|
+
// SHORTCUT: a search filters notes after its limit, so a query matching 200 notes returns fewer rows or none;
|
|
40
|
+
// push it into the search SQL if a store gets there.
|
|
41
|
+
return {
|
|
42
|
+
entries: rows.filter((e) => ownTenant(e) && admit(e) && (e.pinned || !isCapturedNote(e))),
|
|
43
|
+
};
|
|
38
44
|
}
|
|
39
45
|
// The store applies the quality floor too, or its recent-N load stops short of a store whose
|
|
40
46
|
// newest rows are junk.
|
|
@@ -168,12 +168,10 @@ export function contextBlockLines(items, totalTokens, framing, opts) {
|
|
|
168
168
|
];
|
|
169
169
|
}
|
|
170
170
|
export const USER_RULES_HEADING = '## Rules from the user';
|
|
171
|
-
// The person's reply lead ("No:", "Yes, keep doing that:") reads as an answer, not as an order.
|
|
172
|
-
const CORRECTION_LEAD = /^(?:No|Yes, keep doing that):\s*/;
|
|
173
171
|
/** The person's own rule as a plain instruction: no confidence, date or tags to read it as an old
|
|
174
172
|
* note. */
|
|
175
173
|
export function userRuleLine(e) {
|
|
176
|
-
return `- ${shownContent(
|
|
174
|
+
return `- ${shownContent(e)}`;
|
|
177
175
|
}
|
|
178
176
|
/** The section that opens a block; no rules print nothing, and the blank line closes it. */
|
|
179
177
|
export function userRuleLines(entries) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// instruction check.
|
|
3
3
|
import { detectInstruction, INSTRUCTION_LIKE_TAG, UNTRUSTED_ORIGIN_TAG, } from '../instruction-detect.js';
|
|
4
4
|
import { quarantineScopeFor } from '../../domain/trust/quarantine.js';
|
|
5
|
-
import { createMemory,
|
|
5
|
+
import { createMemory, withoutCaptureTags, } from '../../base/memory/entry.js';
|
|
6
6
|
import { computeSalience } from '../../base/memory/salience.js';
|
|
7
7
|
import { vetSecrets } from '../../base/util/secret-detect.js';
|
|
8
8
|
import { assertCallerProject } from '../../base/scope/project-identity.js';
|
|
@@ -55,7 +55,7 @@ function prepareRemember(ctx, opts, untrusted) {
|
|
|
55
55
|
? detectInstruction(vetted.content)
|
|
56
56
|
: { flagged: false, reason: null };
|
|
57
57
|
const flagged = !untrusted && memberShares(ctx, opts) && detectInstruction(vetted.content).flagged;
|
|
58
|
-
const tags = trustTagged(opts.tags &&
|
|
58
|
+
const tags = trustTagged(opts.tags && withoutCaptureTags(opts.tags), untrusted, flagged);
|
|
59
59
|
const local = opts.local ?? {};
|
|
60
60
|
const created = createMemory(vetted.content, {
|
|
61
61
|
layer: local.layer,
|
|
@@ -80,9 +80,15 @@ export declare const COMPACTION_MEMORY_TAG = "compaction-memory";
|
|
|
80
80
|
export declare const COMPACTION_SOURCE_PREFIX = "compaction:";
|
|
81
81
|
/** Tag on a rule the person stated, which only capture may set. */
|
|
82
82
|
export declare const USER_RULE_TAG = "from-user";
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
/** Tag and category of a later statement capture keeps with no rule word. */
|
|
84
|
+
export declare const CAPTURED_NOTE_TAG = "captured-note";
|
|
85
|
+
/** A note can be a one-off order, so only a matching prompt or an explicit recall may bring it back. */
|
|
86
|
+
export declare function isCapturedNote(entry: {
|
|
87
|
+
readonly tags: readonly string[];
|
|
88
|
+
}): boolean;
|
|
89
|
+
/** `tags` without the tags only capture may set, for every tag a person types or vouches for: a
|
|
90
|
+
* typed tag must not make a row print as the person's rule, and a corrected note is no longer a note. */
|
|
91
|
+
export declare function withoutCaptureTags(tags: readonly string[]): string[];
|
|
86
92
|
/** A memory counts as high schema fit strictly above this. */
|
|
87
93
|
export declare const HIGH_SCHEMA_FIT = 0.7;
|
|
88
94
|
/** The base half-life scaled by the PLAN.md signals: an error tag, and high or low schema fit. */
|
|
@@ -28,10 +28,16 @@ export const COMPACTION_MEMORY_TAG = 'compaction-memory';
|
|
|
28
28
|
export const COMPACTION_SOURCE_PREFIX = 'compaction:';
|
|
29
29
|
/** Tag on a rule the person stated, which only capture may set. */
|
|
30
30
|
export const USER_RULE_TAG = 'from-user';
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
/** Tag and category of a later statement capture keeps with no rule word. */
|
|
32
|
+
export const CAPTURED_NOTE_TAG = 'captured-note';
|
|
33
|
+
/** A note can be a one-off order, so only a matching prompt or an explicit recall may bring it back. */
|
|
34
|
+
export function isCapturedNote(entry) {
|
|
35
|
+
return entry.tags.includes(CAPTURED_NOTE_TAG);
|
|
36
|
+
}
|
|
37
|
+
/** `tags` without the tags only capture may set, for every tag a person types or vouches for: a
|
|
38
|
+
* typed tag must not make a row print as the person's rule, and a corrected note is no longer a note. */
|
|
39
|
+
export function withoutCaptureTags(tags) {
|
|
40
|
+
return tags.filter((t) => t !== USER_RULE_TAG && t !== CAPTURED_NOTE_TAG);
|
|
35
41
|
}
|
|
36
42
|
/** A memory counts as high schema fit strictly above this. */
|
|
37
43
|
export const HIGH_SCHEMA_FIT = 0.7;
|
|
@@ -132,7 +138,7 @@ function assertValidMemoryInput(content, options) {
|
|
|
132
138
|
export function createSuccessor(old, content, opts, now) {
|
|
133
139
|
const fields = {
|
|
134
140
|
layer: opts.layer ?? old.layer,
|
|
135
|
-
tags:
|
|
141
|
+
tags: withoutCaptureTags(opts.tags ?? old.tags),
|
|
136
142
|
pinned: opts.pinned ?? old.pinned,
|
|
137
143
|
source: old.source,
|
|
138
144
|
confidence: 'verified',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Which rows an ambient load and a summary drill-down admit, as plain data: a store on a worker
|
|
2
2
|
// thread applies the same rule the caller would, since a function cannot cross a thread.
|
|
3
|
-
import { COMPACTION_MEMORY_TAG } from '../memory/entry.js';
|
|
3
|
+
import { COMPACTION_MEMORY_TAG, isCapturedNote } from '../memory/entry.js';
|
|
4
4
|
import { isWorthSurfacing } from '../memory/memory-quality.js';
|
|
5
5
|
import { classifyOriginProject, projectNames } from './project-identity.js';
|
|
6
6
|
import { passesScopeFilterForRecall } from './recall-scope.js';
|
|
@@ -40,7 +40,7 @@ export function ambientAdmits(e, a) {
|
|
|
40
40
|
export function ambientRefusal(e, a) {
|
|
41
41
|
if (!ambientAdmits(e, a))
|
|
42
42
|
return 'admission';
|
|
43
|
-
return e.pinned || isWorthSurfacing(e) ? null : 'quality';
|
|
43
|
+
return e.pinned || (isWorthSurfacing(e) && !isCapturedNote(e)) ? null : 'quality';
|
|
44
44
|
}
|
|
45
45
|
export function descendantAdmits(row, a) {
|
|
46
46
|
return (passesScopeFilterForRecall(row.scope ?? null, undefined, a.ownScope) &&
|
|
@@ -32,6 +32,8 @@ const SECRET_PATTERNS = [
|
|
|
32
32
|
{ name: 'npm-token', re: /\bnpm_[A-Za-z0-9]{36}\b/ },
|
|
33
33
|
{ name: 'huggingface-token', re: /\bhf_[A-Za-z]{34}\b/ },
|
|
34
34
|
{ name: 'gitlab-token', re: /\bglpat-[\w-]{20,}/ },
|
|
35
|
+
{ name: 'cloudflare-token', re: /\bcf(?:k|ut|at)_[\w-]{40,}/ },
|
|
36
|
+
{ name: 'cloudflare-wrangler-token', re: /\bcfoat_[\w-]{20,}/ },
|
|
35
37
|
{ name: 'google-oauth-token', re: /\bya29\.[\w-]{20,}/ },
|
|
36
38
|
{
|
|
37
39
|
name: 'slack-webhook',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Single source of truth for the package version, written by scripts/sync-version.mjs; never
|
|
3
3
|
* edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
|
|
4
4
|
* package.json read: the published bundle may lack package.json on a path ESM can resolve. */
|
|
5
|
-
export declare const PACKAGE_VERSION = "3.3.
|
|
5
|
+
export declare const PACKAGE_VERSION = "3.3.2";
|
|
6
6
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by
|
|
7
7
|
* hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
|
|
8
8
|
export declare const EXPIRING_KEYS_MIN_BINARY = "1.64.0";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Single source of truth for the package version, written by scripts/sync-version.mjs; never
|
|
3
3
|
* edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
|
|
4
4
|
* package.json read: the published bundle may lack package.json on a path ESM can resolve. */
|
|
5
|
-
export const PACKAGE_VERSION = '3.3.
|
|
5
|
+
export const PACKAGE_VERSION = '3.3.2';
|
|
6
6
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by
|
|
7
7
|
* hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
|
|
8
8
|
export const EXPIRING_KEYS_MIN_BINARY = '1.64.0';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MemoryEntry } from '../../base/memory/entry.js';
|
|
2
2
|
import type { PromptRecallGate } from '../../base/rank/prompt-recall.js';
|
|
3
3
|
import type { HippoConfig } from '../../base/config/config.js';
|
|
4
4
|
/** A row with its score and what it costs the budget. */
|
|
@@ -25,7 +25,7 @@ export declare function reservePinned(rankedPinned: readonly PricedRow[], budget
|
|
|
25
25
|
export declare function admitWithinBudget<T extends PricedRow>(rows: readonly T[], picked: Picked<T>, budget: number, onOverBudget?: (row: T) => void): void;
|
|
26
26
|
/** The prompt-recall gate a config asks for; a value that is not a number reads as its default. */
|
|
27
27
|
export declare function promptRecallGateOf(inject: HippoConfig['pinnedInject']): PromptRecallGate;
|
|
28
|
-
/** The newest `limit` rows worth surfacing; a pin always is. */
|
|
28
|
+
/** The newest `limit` rows worth surfacing; a pin always is, a captured note never is. */
|
|
29
29
|
export declare function newestWorthSurfacing<T extends {
|
|
30
30
|
entry: MemoryEntry;
|
|
31
31
|
}>(rows: readonly T[], limit: number): T[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The ranking and budget policy of a context block, on plain rows: the api reads the stores, prices
|
|
2
2
|
// the rows and asks these functions who gets in.
|
|
3
|
+
import { isCapturedNote } from '../../base/memory/entry.js';
|
|
3
4
|
import { isWorthSurfacing } from '../../base/memory/memory-quality.js';
|
|
4
5
|
import { compareScoredResults } from '../../base/rank/compare.js';
|
|
5
6
|
// Overlap a candidate needs with the prompt when the config sets none.
|
|
@@ -57,7 +58,7 @@ export function promptRecallGateOf(inject) {
|
|
|
57
58
|
}),
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
/** The newest `limit` rows worth surfacing; a pin always is. */
|
|
61
|
+
/** The newest `limit` rows worth surfacing; a pin always is, a captured note never is. */
|
|
61
62
|
export function newestWorthSurfacing(rows, limit) {
|
|
62
63
|
return ([...rows]
|
|
63
64
|
// Newest first, then id: stable within one store, but same-millisecond rows fall to random ids across ingests.
|
|
@@ -67,7 +68,7 @@ export function newestWorthSurfacing(rows, limit) {
|
|
|
67
68
|
})
|
|
68
69
|
// Filter before slice so a junk row is backfilled past, not counted against N. Pins bypass the floor: a dropped
|
|
69
70
|
// pin's share of the shared budget would go to a backfilled row, and the pin loop could not win it back.
|
|
70
|
-
.filter(({ entry }) => entry.pinned || isWorthSurfacing(entry))
|
|
71
|
+
.filter(({ entry }) => entry.pinned || (isWorthSurfacing(entry) && !isCapturedNote(entry)))
|
|
71
72
|
.slice(0, limit));
|
|
72
73
|
}
|
|
73
74
|
/** No query: the strongest rows first, each kept if it still fits `left` tokens. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Sharing local memories to the global store: transfer scoring, share, peers and auto-share.
|
|
2
2
|
import { BadRequestError, NotFoundError } from '../../base/errors/api-errors.js';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
-
import { generateId, COMPACTION_MEMORY_TAG, ERROR_TAG, EXTRACTED_TAG, } from '../../base/memory/entry.js';
|
|
4
|
+
import { generateId, COMPACTION_MEMORY_TAG, ERROR_TAG, EXTRACTED_TAG, CAPTURED_NOTE_TAG, } from '../../base/memory/entry.js';
|
|
5
5
|
import { strengthModelFor } from '../../base/memory/eval-switches.js';
|
|
6
6
|
import { CLI_ACTOR } from '../../base/scope/actor.js';
|
|
7
7
|
import { AGENT_MEMORY_SOURCE_PREFIX, AGENT_MEMORY_TAGS, } from '../../base/memory/agent-memory-tools.js';
|
|
@@ -49,6 +49,7 @@ const TRANSFERABLE_TAGS = new Set([
|
|
|
49
49
|
/** Tags whose rows only a hand-run share or promote may copy to the global store; derived rows
|
|
50
50
|
* inherit them. */
|
|
51
51
|
export const NEVER_AUTO_SHARE_TAGS = new Set([
|
|
52
|
+
CAPTURED_NOTE_TAG,
|
|
52
53
|
'git-learned',
|
|
53
54
|
'session-digest',
|
|
54
55
|
...AGENT_MEMORY_TAGS,
|
|
@@ -59,6 +60,7 @@ export function neverAutoShareTags(sources) {
|
|
|
59
60
|
/** Tags whose rows sleep keeps as written: never merged, never sent to LLM extraction. Conflict
|
|
60
61
|
* detection keeps its own list. */
|
|
61
62
|
export const NO_MERGE_TAGS = new Set([
|
|
63
|
+
CAPTURED_NOTE_TAG,
|
|
62
64
|
EXTRACTED_TAG,
|
|
63
65
|
'session-digest',
|
|
64
66
|
COMPACTION_MEMORY_TAG,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ERROR_TAG, Layer, schemaFitFrom } from '../../../base/memory/entry.js';
|
|
1
|
+
import { CAPTURED_NOTE_TAG, ERROR_TAG, Layer, schemaFitFrom, } from '../../../base/memory/entry.js';
|
|
2
2
|
import { FALLBACK_HALF_LIFE_DAYS, PRODUCTION_STRENGTH, calculateStrength, confidenceFacets, } from '../../../base/memory/strength.js';
|
|
3
3
|
import { strengthSql, originInSql, rewardFactorSql, scopeAdmitSql } from '../runtime/rule-sql.js';
|
|
4
4
|
import { DECAY_KEY_HALF_LIVES, DECAY_KEY_SLACK_DAYS, DECAY_KEY_SQL, DECAY_KEY_WHERE, } from '../../../db/decay-key.js';
|
|
@@ -253,7 +253,10 @@ function decayKeySubsetRows(db, rows, cap, now) {
|
|
|
253
253
|
/** Live tenant rows passing `filter`, at most `filter.cap`, in loadAllEntries' order; below the
|
|
254
254
|
* cap, every such row. */
|
|
255
255
|
export function listContextCandidates(db, model, tenantId, filter) {
|
|
256
|
-
|
|
256
|
+
// In the SQL, before the cap: a filter after it would let notes fill the cap and starve other rows.
|
|
257
|
+
const rowsWhere = contextRowsWhere(tenantId, filter, [
|
|
258
|
+
`(pinned = 1 OR instr(tags_json, '"${CAPTURED_NOTE_TAG}"') = 0)`,
|
|
259
|
+
]);
|
|
257
260
|
const { params } = rowsWhere;
|
|
258
261
|
const cap = Math.max(0, Math.trunc(filter.cap));
|
|
259
262
|
const whereSql = rowsWhere.sql;
|
|
@@ -29,7 +29,7 @@ export declare function pickedText(sentences: readonly string[]): string | null;
|
|
|
29
29
|
/** Captures complete supported statements, each text parsed alone so a fence or heading in one never reaches the next.
|
|
30
30
|
* The first `userTexts` texts are a person's own words; on a repeat their copy wins, so it keeps `fromUser`,
|
|
31
31
|
* and a copy that is their rule wins over one that is not.
|
|
32
|
-
* From `firstFollowUp` on, those words answer the agent's work, so a statement in them can be
|
|
32
|
+
* From `firstFollowUp` on, those words answer the agent's work, so a statement in them can be kept as a note. */
|
|
33
33
|
export declare function extractFromTexts(texts: readonly string[], userTexts?: number, firstFollowUp?: number): ExtractedItem[];
|
|
34
34
|
/** A text an older capture, which kept every bold marker, stored for a line, and what capture
|
|
35
35
|
* extracts from that line now. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { duplicateKey } from '../../base/util/same-text.js';
|
|
2
2
|
import { assessAutomaticMemory, asideCloseOffset, QUOTE_MARK, } from '../../base/memory/memory-quality.js';
|
|
3
|
-
import { ERROR_TAG } from '../../base/memory/entry.js';
|
|
3
|
+
import { CAPTURED_NOTE_TAG, ERROR_TAG } from '../../base/memory/entry.js';
|
|
4
4
|
import { blankCodeSpans, strongMarkers } from '../../base/memory/markdown-delimiters.js';
|
|
5
5
|
/** A rule the person stated: capture pins it and tags it as theirs. */
|
|
6
6
|
export function isStatedRule(item) {
|
|
@@ -342,7 +342,7 @@ function extractSpecSections(prose, cuts) {
|
|
|
342
342
|
to,
|
|
343
343
|
}));
|
|
344
344
|
}
|
|
345
|
-
// A reply
|
|
345
|
+
// A reply can state how the person wants the work done with no rule word, so it is kept for recall.
|
|
346
346
|
const ANY_STATEMENT = [/\S/];
|
|
347
347
|
// A kept reply names code or limits a choice; a thanks or a pasted test count does neither.
|
|
348
348
|
const CODE_CUE = /`|\w[\\/]\w|\w\.[A-Za-z]|\w_\w|\w\(|[<>{}[\]=]|(?:^|\s)--?[A-Za-z]/;
|
|
@@ -369,9 +369,9 @@ function isPraise(content) {
|
|
|
369
369
|
return false;
|
|
370
370
|
return rest.split(/\s+/).filter(Boolean).length <= 3 || NOT_A_DIRECTIVE.test(rest);
|
|
371
371
|
}
|
|
372
|
-
/** A statement in a reply
|
|
373
|
-
function
|
|
374
|
-
const item = extractFromPatterns(sentence, ANY_STATEMENT,
|
|
372
|
+
/** A statement in a reply worth keeping: 2 words when it names code, 4 with a limiting word. */
|
|
373
|
+
function followUpItem(sentence, category) {
|
|
374
|
+
const item = extractFromPatterns(sentence, ANY_STATEMENT, category);
|
|
375
375
|
if (!item)
|
|
376
376
|
return null;
|
|
377
377
|
const { content } = item;
|
|
@@ -382,12 +382,13 @@ function followUpRule(sentence) {
|
|
|
382
382
|
const kept = (words >= 2 && CODE_CUE.test(content)) || (words >= 4 && limits);
|
|
383
383
|
return kept ? { ...item, tags: [...item.tags, 'follow-up'] } : null;
|
|
384
384
|
}
|
|
385
|
-
/** What a sentence holds; in a reply a preference that names code or limits a choice is a rule.
|
|
385
|
+
/** What a sentence holds; in a reply a preference that names code or limits a choice is a rule. A
|
|
386
|
+
* statement with no such word stays a note: most replies are one-off orders, and a rule pins. */
|
|
386
387
|
function sentenceItem(sentence, followUp) {
|
|
387
388
|
const hit = CATEGORIES.map(([category, patterns]) => extractFromPatterns(sentence, patterns, category)).find((found) => found !== null) ?? null;
|
|
388
389
|
if (!followUp || (hit !== null && hit.category !== 'preference'))
|
|
389
390
|
return hit;
|
|
390
|
-
return
|
|
391
|
+
return followUpItem(sentence, hit === null ? CAPTURED_NOTE_TAG : 'rule') ?? hit;
|
|
391
392
|
}
|
|
392
393
|
// The items of the spec bullets first, then those of each prose block.
|
|
393
394
|
function extractSourced(text, cuts, followUp = false) {
|
|
@@ -413,7 +414,7 @@ function extractSourced(text, cuts, followUp = false) {
|
|
|
413
414
|
/** Captures complete supported statements, each text parsed alone so a fence or heading in one never reaches the next.
|
|
414
415
|
* The first `userTexts` texts are a person's own words; on a repeat their copy wins, so it keeps `fromUser`,
|
|
415
416
|
* and a copy that is their rule wins over one that is not.
|
|
416
|
-
* From `firstFollowUp` on, those words answer the agent's work, so a statement in them can be
|
|
417
|
+
* From `firstFollowUp` on, those words answer the agent's work, so a statement in them can be kept as a note. */
|
|
417
418
|
export function extractFromTexts(texts, userTexts = 0, firstFollowUp = userTexts) {
|
|
418
419
|
const items = texts.flatMap((text, i) => extractSourced(text, boldPairs, i >= firstFollowUp && i < userTexts).map(({ item }) => i < userTexts ? { ...item, fromUser: true } : item));
|
|
419
420
|
return oncePerText(items, (item) => assessAutomaticMemory(item.content).accepted);
|
|
@@ -6,7 +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 {
|
|
9
|
+
import { withoutCaptureTags } from '../../base/memory/entry.js';
|
|
10
10
|
import { importChatGPTInto, importClaudeInto, importCursorInto, importGenericFileInto, } from '../importers/sources.js';
|
|
11
11
|
import { importMarkdownInto } from '../importers/markdown.js';
|
|
12
12
|
import { importVaultInto } from '../importers/vault.js';
|
|
@@ -51,7 +51,7 @@ function warnRedacted(count) {
|
|
|
51
51
|
export async function handleImport({ hippoRoot, tenantId, args, flags, }) {
|
|
52
52
|
const useGlobal = boolFlag(flags, 'global');
|
|
53
53
|
const dryRun = boolFlag(flags, 'dry-run');
|
|
54
|
-
const extraTags =
|
|
54
|
+
const extraTags = withoutCaptureTags(stringListFlag(flags, 'tag') ?? []);
|
|
55
55
|
const targetRoot = useGlobal ? hippoHomeDir() : hippoRoot;
|
|
56
56
|
if (boolFlag(flags, 'agents')) {
|
|
57
57
|
return await importAgentMemories(hippoRoot, tenantId, { useGlobal, dryRun });
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hippo-memory",
|
|
3
3
|
"name": "Hippo Memory",
|
|
4
4
|
"description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
|
|
5
|
-
"version": "3.3.
|
|
5
|
+
"version": "3.3.2",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
package/package.json
CHANGED