hippo-memory 1.61.0 → 1.63.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 +37 -53
- package/dist/agent-memories/apply.d.ts +3 -1
- package/dist/agent-memories/apply.js +23 -1
- package/dist/agent-memories/claude-code.d.ts +4 -1
- package/dist/agent-memories/claude-code.js +53 -9
- package/dist/agent-memories/report.d.ts +1 -0
- package/dist/agent-memories/report.js +2 -2
- package/dist/agent-memories/sync.d.ts +3 -3
- package/dist/agent-memories/sync.js +46 -24
- package/dist/agent-memories/types.d.ts +0 -2
- package/dist/ambient-store.d.ts +4 -4
- package/dist/ambient-store.js +4 -3
- package/dist/api/assemble.d.ts +7 -10
- package/dist/api/assemble.js +62 -66
- package/dist/api/audit.d.ts +2 -2
- package/dist/api/audit.js +2 -2
- package/dist/api/auth.d.ts +6 -6
- package/dist/api/auth.js +5 -7
- package/dist/api/context-select.d.ts +50 -0
- package/dist/api/context-select.js +342 -0
- package/dist/api/context-types.d.ts +12 -17
- package/dist/api/context.d.ts +5 -4
- package/dist/api/context.js +208 -535
- package/dist/api/dormant.js +1 -1
- package/dist/api/drill-down.d.ts +4 -4
- package/dist/api/drill-down.js +56 -41
- package/dist/api/outcome.d.ts +8 -13
- package/dist/api/outcome.js +13 -17
- package/dist/api/promote.d.ts +5 -8
- package/dist/api/promote.js +55 -66
- package/dist/api/quarantine.js +3 -2
- package/dist/api/recall-types.d.ts +43 -55
- package/dist/api/recall.d.ts +3 -3
- package/dist/api/recall.js +310 -456
- package/dist/api/remember.d.ts +2 -2
- package/dist/api/sleep.d.ts +7 -35
- package/dist/api/sleep.js +206 -220
- package/dist/api/tokens.d.ts +2 -2
- package/dist/api/tokens.js +2 -2
- package/dist/api/types.d.ts +6 -10
- package/dist/api/types.js +2 -4
- package/dist/audit-prune.d.ts +4 -6
- package/dist/audit-prune.js +3 -5
- package/dist/audit.js +11 -33
- package/dist/auth.d.ts +8 -9
- package/dist/auth.js +5 -7
- package/dist/autolearn.d.ts +1 -1
- package/dist/autolearn.js +1 -1
- package/dist/availability.js +3 -5
- package/dist/capture/command.d.ts +5 -4
- package/dist/capture/command.js +8 -22
- package/dist/capture/compact.d.ts +2 -2
- package/dist/capture/compact.js +11 -15
- package/dist/capture/extract.js +37 -115
- package/dist/capture-error.d.ts +1 -1
- package/dist/capture-error.js +1 -1
- package/dist/churn-git.d.ts +1 -1
- package/dist/churn-git.js +1 -1
- package/dist/cli/audit.js +3 -4
- package/dist/cli/auth.js +3 -6
- package/dist/cli/briefs.js +324 -306
- package/dist/cli/context.js +44 -34
- package/dist/cli/continuity.js +283 -271
- package/dist/cli/curate.d.ts +1 -1
- package/dist/cli/curate.js +43 -58
- package/dist/cli/dag.js +5 -9
- package/dist/cli/decisions.js +334 -345
- package/dist/cli/explain.js +68 -61
- package/dist/cli/goals.js +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/maintenance.js +62 -51
- package/dist/cli/playbooks.js +391 -379
- package/dist/cli/projects.js +11 -6
- package/dist/cli/recall.js +30 -44
- package/dist/cli/remember.js +118 -87
- package/dist/cli/session-hooks.js +106 -115
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.js +267 -250
- package/dist/cli/shared.js +3 -3
- package/dist/cli/slack.js +1 -1
- package/dist/cli/sleep.js +27 -1
- package/dist/cli/status.d.ts +4 -4
- package/dist/cli/status.js +80 -76
- package/dist/cli/transfer.js +88 -107
- package/dist/cli/usage.js +9 -6
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +4 -9
- package/dist/compaction-record.d.ts +2 -2
- package/dist/compaction-record.js +89 -68
- package/dist/compare.d.ts +11 -16
- package/dist/compare.js +11 -16
- package/dist/config.d.ts +19 -18
- package/dist/config.js +90 -67
- package/dist/connectors/github/backfill.d.ts +2 -2
- package/dist/connectors/github/backfill.js +8 -15
- package/dist/connectors/github/cli-impl.js +3 -8
- package/dist/connectors/github/deletion.d.ts +5 -12
- package/dist/connectors/github/deletion.js +5 -12
- package/dist/connectors/github/dlq.d.ts +6 -9
- package/dist/connectors/github/dlq.js +2 -3
- package/dist/connectors/github/ingest.d.ts +5 -7
- package/dist/connectors/github/ingest.js +8 -12
- package/dist/connectors/github/octokit-client.d.ts +3 -5
- package/dist/connectors/github/octokit-client.js +5 -6
- package/dist/connectors/github/signature.d.ts +9 -39
- package/dist/connectors/github/signature.js +9 -39
- package/dist/connectors/github/tenant-routing.d.ts +1 -1
- package/dist/connectors/github/tenant-routing.js +1 -1
- package/dist/connectors/github/transform.js +2 -2
- package/dist/connectors/github/types.d.ts +2 -10
- package/dist/connectors/github/types.js +1 -3
- package/dist/connectors/slack/deletion.d.ts +3 -8
- package/dist/connectors/slack/deletion.js +3 -8
- package/dist/connectors/slack/dlq.d.ts +1 -1
- package/dist/connectors/slack/ingest.d.ts +1 -1
- package/dist/connectors/slack/ingest.js +7 -16
- package/dist/connectors/slack/signature.d.ts +1 -1
- package/dist/connectors/slack/tenant-routing.d.ts +3 -5
- package/dist/connectors/slack/tenant-routing.js +3 -5
- package/dist/connectors/slack/transform.d.ts +5 -6
- package/dist/connectors/slack/transform.js +5 -6
- package/dist/connectors/slack/types.d.ts +2 -6
- package/dist/connectors/slack/types.js +1 -3
- package/dist/connectors/slack/web-client.js +10 -3
- package/dist/connectors/slack/workspaces.d.ts +3 -5
- package/dist/connectors/slack/workspaces.js +3 -5
- package/dist/consolidate/conflicts.js +3 -14
- package/dist/consolidate/decay.js +9 -29
- package/dist/consolidate/llm-passes.js +4 -5
- package/dist/consolidate/merge.js +8 -23
- package/dist/consolidate/run.d.ts +1 -8
- package/dist/consolidate/run.js +3 -25
- package/dist/consolidate/sleep.js +5 -17
- package/dist/consolidate/traces.js +9 -21
- package/dist/customer-notes.d.ts +5 -7
- package/dist/customer-notes.js +82 -76
- package/dist/dag.d.ts +10 -21
- package/dist/dag.js +189 -203
- package/dist/db/continuity.js +2 -2
- package/dist/db/migrations/v14.js +1 -1
- package/dist/db/migrations/v15.js +1 -2
- package/dist/db/migrations/v16.js +3 -4
- package/dist/db/migrations/v17.js +2 -3
- package/dist/db/migrations/v19.js +1 -1
- package/dist/db/migrations/v20.js +1 -1
- package/dist/db/migrations/v21.js +2 -6
- package/dist/db/migrations/v22.js +2 -4
- package/dist/db/migrations/v23.js +1 -1
- package/dist/db/migrations/v24.js +4 -6
- package/dist/db/migrations/v25.js +2 -3
- package/dist/db/migrations/v26.js +3 -3
- package/dist/db/migrations/v27.js +2 -10
- package/dist/db/migrations/v28.js +5 -8
- package/dist/db/migrations/v29.js +3 -4
- package/dist/db/migrations/v30.js +2 -2
- package/dist/db/migrations/v31.js +1 -1
- package/dist/db/migrations/v32.js +1 -1
- package/dist/db/migrations/v33.js +3 -3
- package/dist/db/migrations/v34.js +1 -1
- package/dist/db/migrations/v35.js +3 -4
- package/dist/db/migrations/v36.js +3 -4
- package/dist/db/migrations/v37.js +5 -5
- package/dist/db/migrations/v38.js +7 -8
- package/dist/db/migrations/v39.js +1 -1
- package/dist/db/migrations/v40.js +4 -16
- package/dist/db/migrations/v41.js +3 -4
- package/dist/db/migrations/v42.js +3 -4
- package/dist/db/migrations/v45.js +1 -1
- package/dist/db/migrations/v46.js +1 -1
- package/dist/db/migrations/v47.js +1 -1
- package/dist/db/migrations/v48.js +1 -1
- package/dist/decisions.d.ts +2 -2
- package/dist/decisions.js +97 -80
- package/dist/dedupe.js +86 -61
- package/dist/delivery-recorder.js +154 -135
- package/dist/doctor.js +129 -110
- package/dist/dormant.js +1 -4
- package/dist/embedding-provider.d.ts +4 -8
- package/dist/embedding-provider.js +4 -8
- package/dist/embeddings.js +55 -47
- package/dist/env.d.ts +1 -1
- package/dist/env.js +12 -12
- package/dist/escape.d.ts +5 -0
- package/dist/escape.js +10 -0
- package/dist/eval-stats.d.ts +1 -2
- package/dist/eval-stats.js +1 -2
- package/dist/eval-suite.js +27 -21
- package/dist/extract.js +4 -9
- package/dist/failure-log.d.ts +3 -3
- package/dist/failure-log.js +1 -1
- package/dist/forward-claim-detector.d.ts +2 -4
- package/dist/forward-claim-detector.js +6 -11
- package/dist/goals.d.ts +3 -3
- package/dist/goals.js +103 -91
- package/dist/graph/read.d.ts +2 -2
- package/dist/graph/read.js +5 -6
- package/dist/graph/types.d.ts +8 -8
- package/dist/graph/write.d.ts +7 -14
- package/dist/graph/write.js +16 -23
- package/dist/graph-extract.d.ts +7 -8
- package/dist/graph-extract.js +62 -72
- package/dist/graph-recall.d.ts +2 -2
- package/dist/graph-recall.js +55 -49
- package/dist/graph-stream.d.ts +5 -6
- package/dist/graph-stream.js +66 -57
- package/dist/graph-view.d.ts +2 -2
- package/dist/graph-view.js +7 -7
- package/dist/half-life-migration.d.ts +1 -2
- package/dist/half-life-migration.js +2 -3
- package/dist/hooks/codex-session.js +1 -1
- package/dist/hooks/codex-wrapper.d.ts +1 -1
- package/dist/hooks/codex-wrapper.js +3 -2
- package/dist/hooks/json-hooks.d.ts +2 -2
- package/dist/hooks/json-hooks.js +5 -4
- package/dist/hooks/opencode.d.ts +1 -1
- package/dist/hooks/opencode.js +5 -4
- package/dist/hooks/shared.d.ts +3 -7
- package/dist/hooks/shared.js +1 -8
- package/dist/http-util.d.ts +2 -3
- package/dist/http-util.js +3 -0
- package/dist/importers/core.d.ts +2 -9
- package/dist/importers/core.js +15 -30
- package/dist/importers/sources.js +2 -1
- package/dist/importers/vault.js +2 -20
- package/dist/incidents.d.ts +1 -1
- package/dist/incidents.js +46 -39
- package/dist/instruction-detect.d.ts +1 -1
- package/dist/instruction-detect.js +1 -1
- package/dist/invalidation.d.ts +3 -0
- package/dist/invalidation.js +160 -114
- package/dist/json.d.ts +5 -0
- package/dist/json.js +4 -0
- package/dist/judgment.js +1 -2
- package/dist/local-embedding.js +1 -1
- package/dist/mcp/admin-tools.js +7 -17
- package/dist/mcp/format.js +1 -1
- package/dist/mcp/framing.js +3 -6
- package/dist/mcp/protocol.d.ts +2 -5
- package/dist/mcp/protocol.js +1 -3
- package/dist/mcp/recall-tools.js +12 -15
- package/dist/mcp/request.js +4 -3
- package/dist/mcp/session-state.js +2 -3
- package/dist/mcp/stdio.js +2 -1
- package/dist/mcp/tools.js +9 -6
- package/dist/memory-value-weights.d.ts +5 -8
- package/dist/memory-value-weights.js +5 -8
- package/dist/memory-value.d.ts +13 -13
- package/dist/memory-value.js +26 -37
- package/dist/memory.d.ts +20 -22
- package/dist/memory.js +24 -48
- package/dist/multihop.d.ts +1 -1
- package/dist/multihop.js +3 -2
- package/dist/owner-validation.d.ts +4 -5
- package/dist/owner-validation.js +4 -5
- package/dist/physics.d.ts +4 -4
- package/dist/physics.js +7 -9
- package/dist/policies.d.ts +9 -10
- package/dist/policies.js +96 -81
- package/dist/postinstall.js +3 -6
- package/dist/predictions/planning-fallacy.d.ts +9 -14
- package/dist/predictions/planning-fallacy.js +10 -16
- package/dist/predictions/store.d.ts +15 -23
- package/dist/predictions/store.js +36 -33
- package/dist/processes.d.ts +2 -7
- package/dist/processes.js +88 -72
- package/dist/project-briefs.d.ts +2 -3
- package/dist/project-briefs.js +141 -118
- package/dist/project-identity.d.ts +22 -9
- package/dist/project-identity.js +47 -12
- package/dist/project-merge.d.ts +28 -5
- package/dist/project-merge.js +213 -46
- package/dist/project-remote.d.ts +12 -0
- package/dist/project-remote.js +138 -0
- package/dist/prompt-recall.js +1 -2
- package/dist/rate-limit.d.ts +1 -1
- package/dist/rate-limit.js +1 -1
- package/dist/raw-archive.d.ts +9 -0
- package/dist/raw-archive.js +70 -53
- package/dist/recall-history.d.ts +19 -20
- package/dist/recall-history.js +24 -42
- package/dist/recall-pipeline.js +4 -28
- package/dist/recall-scope.d.ts +7 -8
- package/dist/recall-scope.js +7 -8
- package/dist/recall-trace.d.ts +5 -9
- package/dist/recall-trace.js +6 -10
- package/dist/refine-llm.d.ts +1 -1
- package/dist/refine-llm.js +2 -2
- package/dist/reject-flow.d.ts +3 -4
- package/dist/reject-flow.js +122 -117
- package/dist/rejection.d.ts +5 -6
- package/dist/rejection.js +7 -15
- package/dist/rerankers/clef.d.ts +1 -1
- package/dist/rerankers/jev.d.ts +1 -2
- package/dist/rerankers/jev.js +4 -5
- package/dist/rerankers/llm.d.ts +1 -2
- package/dist/rerankers/llm.js +1 -2
- package/dist/rerankers/types.d.ts +1 -2
- package/dist/rrf.d.ts +2 -2
- package/dist/rrf.js +2 -2
- package/dist/search/bm25-search.d.ts +1 -1
- package/dist/search/bm25-search.js +2 -1
- package/dist/search/boosts.js +2 -1
- package/dist/search/hybrid.d.ts +1 -1
- package/dist/search/hybrid.js +2 -1
- package/dist/search/physics-search.d.ts +1 -1
- package/dist/search/physics-search.js +2 -1
- package/dist/search/types.d.ts +2 -0
- package/dist/search/types.js +3 -1
- package/dist/secret-detect.d.ts +4 -5
- package/dist/secret-detect.js +6 -10
- package/dist/server/auth.js +5 -5
- package/dist/server/client-ip.js +1 -1
- package/dist/server/cursor.js +2 -1
- package/dist/server/mcp-http.js +4 -4
- package/dist/server/request.d.ts +3 -6
- package/dist/server/request.js +6 -7
- package/dist/server/routes/admin.js +5 -4
- package/dist/server/routes/customer-notes.js +6 -5
- package/dist/server/routes/decisions.js +4 -3
- package/dist/server/routes/incidents.js +7 -5
- package/dist/server/routes/memories.js +7 -7
- package/dist/server/routes/policies.js +3 -2
- package/dist/server/routes/predictions.js +12 -15
- package/dist/server/routes/processes.js +3 -2
- package/dist/server/routes/project-briefs.js +8 -7
- package/dist/server/routes/recall.js +95 -93
- package/dist/server/routes/skills.js +6 -5
- package/dist/server/types.d.ts +1 -1
- package/dist/server/validation.d.ts +1 -2
- package/dist/server/validation.js +7 -14
- package/dist/server-detect.js +72 -58
- package/dist/server.d.ts +2 -2
- package/dist/server.js +131 -117
- package/dist/shared.d.ts +26 -17
- package/dist/shared.js +102 -104
- package/dist/skills.d.ts +3 -3
- package/dist/skills.js +88 -72
- package/dist/store/audit-event.d.ts +2 -2
- package/dist/store/audit-event.js +1 -1
- package/dist/store/candidates.d.ts +2 -2
- package/dist/store/candidates.js +4 -3
- package/dist/store/conflicts.js +30 -22
- package/dist/store/delete-and-batch.d.ts +11 -14
- package/dist/store/delete-and-batch.js +40 -91
- package/dist/store/entry-reads.d.ts +17 -25
- package/dist/store/entry-reads.js +59 -40
- package/dist/store/entry-row.d.ts +6 -24
- package/dist/store/entry-row.js +6 -24
- package/dist/store/entry-writes.d.ts +6 -7
- package/dist/store/entry-writes.js +13 -11
- package/dist/store/handoffs.d.ts +1 -1
- package/dist/store/handoffs.js +7 -10
- package/dist/store/index-and-stats.d.ts +2 -6
- package/dist/store/index-and-stats.js +4 -10
- package/dist/store/mirrors.d.ts +6 -19
- package/dist/store/mirrors.js +14 -39
- package/dist/store/open.js +9 -31
- package/dist/store/rows.d.ts +5 -11
- package/dist/store/rows.js +6 -11
- package/dist/store/search-rows.d.ts +17 -34
- package/dist/store/search-rows.js +34 -56
- package/dist/store/sessions.d.ts +4 -5
- package/dist/store/sessions.js +5 -6
- package/dist/store/summaries.d.ts +13 -17
- package/dist/store/summaries.js +26 -70
- package/dist/support-bundle.js +4 -8
- package/dist/tenant.d.ts +1 -5
- package/dist/token-ledger.d.ts +1 -1
- package/dist/token-ledger.js +3 -5
- package/dist/trace.js +1 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/working-memory.d.ts +1 -1
- 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/dist/cli/explain.js
CHANGED
|
@@ -3,6 +3,7 @@ import { confidenceFacets } from '../memory.js';
|
|
|
3
3
|
import { isInitialized } from '../store/open.js';
|
|
4
4
|
import { loadSearchEntries } from '../store/search-rows.js';
|
|
5
5
|
import { loadIndex } from '../store/index-and-stats.js';
|
|
6
|
+
import { DEFAULT_RECALL_BUDGET } from '../search/types.js';
|
|
6
7
|
import { loadConfig } from '../config.js';
|
|
7
8
|
import { dropHeldCopies } from '../same-text.js';
|
|
8
9
|
import { detectScope } from '../scope.js';
|
|
@@ -27,7 +28,7 @@ function noteScopeHidden(hippoRoot, globalRoot, query, tenantId, requested) {
|
|
|
27
28
|
}
|
|
28
29
|
export async function cmdExplain(hippoRoot, query, flags) {
|
|
29
30
|
requireInit(hippoRoot);
|
|
30
|
-
const budget = parseBudgetFlag(flags['budget'],
|
|
31
|
+
const budget = parseBudgetFlag(flags['budget'], DEFAULT_RECALL_BUDGET);
|
|
31
32
|
const limit = parseLimitFlag(flags['limit']);
|
|
32
33
|
const asJson = Boolean(flags['json']);
|
|
33
34
|
const includeSuperseded = Boolean(flags['include-superseded']);
|
|
@@ -57,31 +58,39 @@ export async function cmdExplain(hippoRoot, query, flags) {
|
|
|
57
58
|
const results = dropHeldCopies(rank.results, (r) => r.entry);
|
|
58
59
|
const candidates = rank.localEntries.length + rank.globalEntries.length;
|
|
59
60
|
if (asJson) {
|
|
60
|
-
|
|
61
|
-
rank: rank + 1,
|
|
62
|
-
id: r.entry.id,
|
|
63
|
-
layer: r.entry.layer,
|
|
64
|
-
confidence: confidenceFacets(r.entry).tier,
|
|
65
|
-
aged_out: confidenceFacets(r.entry).agedOut,
|
|
66
|
-
score: r.score,
|
|
67
|
-
tokens: r.tokens,
|
|
68
|
-
tags: r.entry.tags,
|
|
69
|
-
content: r.entry.content,
|
|
70
|
-
breakdown: r.breakdown,
|
|
71
|
-
}));
|
|
72
|
-
console.log(JSON.stringify({
|
|
73
|
-
query,
|
|
74
|
-
mode: modeUsed,
|
|
75
|
-
candidates,
|
|
76
|
-
returned: output.length,
|
|
77
|
-
results: output,
|
|
78
|
-
}));
|
|
61
|
+
printExplainJson(results, query, modeUsed, candidates);
|
|
79
62
|
return;
|
|
80
63
|
}
|
|
81
64
|
if (results.length === 0) {
|
|
82
65
|
console.log(`No memories matched "${query}" (scanned ${candidates}).`);
|
|
83
66
|
return;
|
|
84
67
|
}
|
|
68
|
+
printExplainTable(results, query, modeUsed, candidates);
|
|
69
|
+
results.forEach((r, i) => printExplainBreakdown(r, i));
|
|
70
|
+
console.log('Note: explain does not mark memories as retrieved (read-only).');
|
|
71
|
+
}
|
|
72
|
+
function printExplainJson(results, query, modeUsed, candidates) {
|
|
73
|
+
const output = results.map((r, rank) => ({
|
|
74
|
+
rank: rank + 1,
|
|
75
|
+
id: r.entry.id,
|
|
76
|
+
layer: r.entry.layer,
|
|
77
|
+
confidence: confidenceFacets(r.entry).tier,
|
|
78
|
+
aged_out: confidenceFacets(r.entry).agedOut,
|
|
79
|
+
score: r.score,
|
|
80
|
+
tokens: r.tokens,
|
|
81
|
+
tags: r.entry.tags,
|
|
82
|
+
content: r.entry.content,
|
|
83
|
+
breakdown: r.breakdown,
|
|
84
|
+
}));
|
|
85
|
+
console.log(JSON.stringify({
|
|
86
|
+
query,
|
|
87
|
+
mode: modeUsed,
|
|
88
|
+
candidates,
|
|
89
|
+
returned: output.length,
|
|
90
|
+
results: output,
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
function printExplainTable(results, query, modeUsed, candidates) {
|
|
85
94
|
console.log(`Query: "${query}"`);
|
|
86
95
|
console.log(`Mode: ${modeUsed} candidates: ${candidates} returned: ${results.length}`);
|
|
87
96
|
console.log();
|
|
@@ -95,49 +104,47 @@ export async function cmdExplain(hippoRoot, query, flags) {
|
|
|
95
104
|
console.log(`${String(i + 1).padEnd(5)} ${fmt(r.score, 3).padEnd(7)} ${fmt(r.entry.strength).padEnd(9)} ${ageStr.padEnd(6)} ${r.entry.layer.padEnd(10)} ${r.entry.id.padEnd(17)} ${preview}`);
|
|
96
105
|
}
|
|
97
106
|
console.log();
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
console.log();
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (b.mode === 'physics') {
|
|
108
|
-
console.log(` mode: physics-gravity`);
|
|
109
|
-
console.log(` cosine: ${fmt(b.cosine, 3)} (pre-amp baseline)`);
|
|
110
|
-
console.log(` final: ${fmt(b.final, 4)} (post-amp, from physics scorer)`);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
const matched = b.matchedTerms.length > 0 ? b.matchedTerms.join(', ') : '(none)';
|
|
114
|
-
console.log(` mode: ${b.mode}${b.mode === 'hybrid-no-vec' ? ' (no cached doc vector — run `hippo embed`)' : ''}`);
|
|
115
|
-
console.log(` BM25: raw=${fmt(r.bm25, 3)} normalized=${fmt(b.normBm25, 3)} weight=${fmt(b.bm25Weight, 2)} matched=[${matched}]`);
|
|
116
|
-
console.log(` embedding: cosine=${fmt(b.cosine, 3)} weight=${fmt(b.embeddingWeight, 2)}`);
|
|
117
|
-
console.log(` base: ${fmt(b.bm25Weight, 2)}*${fmt(b.normBm25, 3)} + ${fmt(b.embeddingWeight, 2)}*${fmt(b.cosine, 3)} = ${fmt(b.base, 4)}`);
|
|
118
|
-
console.log(` strength: x${fmt(b.strengthMultiplier, 3)} (strength=${fmt(r.entry.strength, 3)})`);
|
|
119
|
-
console.log(` recency: x${fmt(b.recencyMultiplier, 3)} (age=${b.ageDays}d)`);
|
|
120
|
-
if (b.decisionBoost !== 1)
|
|
121
|
-
console.log(` decision: x${fmt(b.decisionBoost, 2)} (tagged 'decision')`);
|
|
122
|
-
if (b.scopeBoost !== 1)
|
|
123
|
-
console.log(` scope: x${fmt(b.scopeBoost, 2)} (scope tag ${b.scopeBoost > 1 ? 'match' : 'mismatch'})`);
|
|
124
|
-
if (b.pathBoost !== 1)
|
|
125
|
-
console.log(` path: x${fmt(b.pathBoost, 3)} (cwd path tag overlap)`);
|
|
126
|
-
if (b.sourceBump !== 1)
|
|
127
|
-
console.log(` source: x${fmt(b.sourceBump, 2)} (local priority bump over global)`);
|
|
128
|
-
if (b.outcomeBoost !== 1)
|
|
129
|
-
console.log(` outcome: x${fmt(b.outcomeBoost, 3)} (user feedback: pos-neg = ${(r.entry.outcome_positive ?? 0) - (r.entry.outcome_negative ?? 0)})`);
|
|
130
|
-
if (b.churnStaleMultiplier !== 1)
|
|
131
|
-
console.log(` churn: x${fmt(b.churnStaleMultiplier, 2)} (tagged 'churn-stale')`);
|
|
132
|
-
if (b.preMmrRank !== undefined && b.postMmrRank !== undefined && b.preMmrRank !== b.postMmrRank) {
|
|
133
|
-
const arrow = b.postMmrRank < b.preMmrRank ? 'up' : 'down';
|
|
134
|
-
console.log(` mmr: rank ${b.preMmrRank} -> ${b.postMmrRank} (diversity ${arrow})`);
|
|
135
|
-
}
|
|
136
|
-
console.log(` final: ${fmt(b.final, 4)}`);
|
|
137
|
-
}
|
|
107
|
+
}
|
|
108
|
+
function printExplainBreakdown(r, i) {
|
|
109
|
+
const b = r.breakdown;
|
|
110
|
+
console.log(`[${i + 1}] ${r.entry.id} composite=${fmt(r.score, 4)}`);
|
|
111
|
+
if (!b) {
|
|
112
|
+
console.log(' (no breakdown available)');
|
|
138
113
|
console.log();
|
|
114
|
+
return;
|
|
139
115
|
}
|
|
140
|
-
|
|
116
|
+
if (b.mode === 'physics') {
|
|
117
|
+
console.log(` mode: physics-gravity`);
|
|
118
|
+
console.log(` cosine: ${fmt(b.cosine, 3)} (pre-amp baseline)`);
|
|
119
|
+
console.log(` final: ${fmt(b.final, 4)} (post-amp, from physics scorer)`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const matched = b.matchedTerms.length > 0 ? b.matchedTerms.join(', ') : '(none)';
|
|
123
|
+
console.log(` mode: ${b.mode}${b.mode === 'hybrid-no-vec' ? ' (no cached doc vector — run `hippo embed`)' : ''}`);
|
|
124
|
+
console.log(` BM25: raw=${fmt(r.bm25, 3)} normalized=${fmt(b.normBm25, 3)} weight=${fmt(b.bm25Weight, 2)} matched=[${matched}]`);
|
|
125
|
+
console.log(` embedding: cosine=${fmt(b.cosine, 3)} weight=${fmt(b.embeddingWeight, 2)}`);
|
|
126
|
+
console.log(` base: ${fmt(b.bm25Weight, 2)}*${fmt(b.normBm25, 3)} + ${fmt(b.embeddingWeight, 2)}*${fmt(b.cosine, 3)} = ${fmt(b.base, 4)}`);
|
|
127
|
+
console.log(` strength: x${fmt(b.strengthMultiplier, 3)} (strength=${fmt(r.entry.strength, 3)})`);
|
|
128
|
+
console.log(` recency: x${fmt(b.recencyMultiplier, 3)} (age=${b.ageDays}d)`);
|
|
129
|
+
if (b.decisionBoost !== 1)
|
|
130
|
+
console.log(` decision: x${fmt(b.decisionBoost, 2)} (tagged 'decision')`);
|
|
131
|
+
if (b.scopeBoost !== 1)
|
|
132
|
+
console.log(` scope: x${fmt(b.scopeBoost, 2)} (scope tag ${b.scopeBoost > 1 ? 'match' : 'mismatch'})`);
|
|
133
|
+
if (b.pathBoost !== 1)
|
|
134
|
+
console.log(` path: x${fmt(b.pathBoost, 3)} (cwd path tag overlap)`);
|
|
135
|
+
if (b.sourceBump !== 1)
|
|
136
|
+
console.log(` source: x${fmt(b.sourceBump, 2)} (local priority bump over global)`);
|
|
137
|
+
if (b.outcomeBoost !== 1)
|
|
138
|
+
console.log(` outcome: x${fmt(b.outcomeBoost, 3)} (user feedback: pos-neg = ${(r.entry.outcome_positive ?? 0) - (r.entry.outcome_negative ?? 0)})`);
|
|
139
|
+
if (b.churnStaleMultiplier !== 1)
|
|
140
|
+
console.log(` churn: x${fmt(b.churnStaleMultiplier, 2)} (tagged 'churn-stale')`);
|
|
141
|
+
if (b.preMmrRank !== undefined && b.postMmrRank !== undefined && b.preMmrRank !== b.postMmrRank) {
|
|
142
|
+
const arrow = b.postMmrRank < b.preMmrRank ? 'up' : 'down';
|
|
143
|
+
console.log(` mmr: rank ${b.preMmrRank} -> ${b.postMmrRank} (diversity ${arrow})`);
|
|
144
|
+
}
|
|
145
|
+
console.log(` final: ${fmt(b.final, 4)}`);
|
|
146
|
+
}
|
|
147
|
+
console.log();
|
|
141
148
|
}
|
|
142
149
|
export async function handleExplain({ hippoRoot, args, flags }) {
|
|
143
150
|
const query = args.join(' ').trim();
|
package/dist/cli/goals.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as api from '../api.js';
|
|
|
4
4
|
import { resolveTenantId } from '../tenant.js';
|
|
5
5
|
import { printError } from './output.js';
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
|
-
// `hippo goal <push|list|complete|suspend|resume>`
|
|
7
|
+
// `hippo goal <push|list|complete|suspend|resume>`
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
const GOAL_POLICY_TYPES = [
|
|
10
10
|
'schema-fit-biased',
|
package/dist/cli/init.js
CHANGED
|
@@ -242,7 +242,7 @@ function refreshShippedBlock(filePath, text, hook) {
|
|
|
242
242
|
/** Claude Code settings hooks, Codex's hooks.json and the OpenCode plugin, under the home directory; idempotent, so re-running init adds newer hooks. */
|
|
243
243
|
function installUserLevelHooks(agents, codexHint) {
|
|
244
244
|
for (const hook of agents) {
|
|
245
|
-
// The Codex capture wrapper swaps the codex launcher binary, so init only points at the opt-in
|
|
245
|
+
// The Codex capture wrapper swaps the codex launcher binary, so init only points at the opt-in.
|
|
246
246
|
if (hook === 'codex' && codexHint && !isCodexWrapperInstalled()) {
|
|
247
247
|
console.log(' Codex detected. To capture Codex sessions: hippo hook install codex');
|
|
248
248
|
}
|
package/dist/cli/maintenance.js
CHANGED
|
@@ -102,34 +102,60 @@ export async function cmdEmbed(hippoRoot, flags) {
|
|
|
102
102
|
// when no provider key is present (e.g. embedded earlier with a key that was
|
|
103
103
|
// later removed). The provider-availability gate is deferred to the embed path.
|
|
104
104
|
if (flags['reset-physics']) {
|
|
105
|
-
|
|
106
|
-
const embIndex = loadEmbeddingIndex(root);
|
|
107
|
-
const db = openHippoDb(root);
|
|
108
|
-
try {
|
|
109
|
-
const count = resetAllPhysicsState(db, entries, embIndex);
|
|
110
|
-
console.log(`Reset physics state: ${count} particles re-initialized from embeddings.`);
|
|
111
|
-
}
|
|
112
|
-
finally {
|
|
113
|
-
closeHippoDb(db);
|
|
114
|
-
}
|
|
105
|
+
resetPhysics(root);
|
|
115
106
|
return;
|
|
116
107
|
}
|
|
117
108
|
if (flags['status']) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const orphaned = Object.keys(embIndex).length - activeEmbedded;
|
|
123
|
-
console.log(`Embedding status: ${activeEmbedded}/${entries.length} memories embedded`);
|
|
124
|
-
if (orphaned > 0) {
|
|
125
|
-
console.log(` ${orphaned} orphaned embeddings (run \`hippo embed\` to prune)`);
|
|
126
|
-
}
|
|
127
|
-
const missing = entries.filter((e) => !embIndex[e.id]);
|
|
128
|
-
if (missing.length > 0) {
|
|
129
|
-
console.log(` ${missing.length} memories need embedding (run \`hippo embed\` to embed them)`);
|
|
130
|
-
}
|
|
109
|
+
printEmbedStatus(root);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!embedProviderReady(root))
|
|
131
113
|
return;
|
|
114
|
+
console.log('Embedding all memories (this may take a moment on first run to download model)...');
|
|
115
|
+
let count;
|
|
116
|
+
try {
|
|
117
|
+
count = await embedAll(root, resolveEmbeddingModel(root));
|
|
132
118
|
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
printError(`Embedding failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
121
|
+
const partial = loadEmbeddingIndex(root);
|
|
122
|
+
printError(`Partial progress saved: ${Object.keys(partial).length} embeddings on disk. Re-run \`hippo embed\` to resume.`);
|
|
123
|
+
process.exitCode = 1;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const entriesAfter = loadAllEntries(root);
|
|
127
|
+
const embIndexAfter = loadEmbeddingIndex(root);
|
|
128
|
+
console.log(`Done. ${count} new embeddings created. ${Object.keys(embIndexAfter).length}/${entriesAfter.length} total.`);
|
|
129
|
+
}
|
|
130
|
+
function resetPhysics(root) {
|
|
131
|
+
const entries = loadAllEntries(root);
|
|
132
|
+
const embIndex = loadEmbeddingIndex(root);
|
|
133
|
+
const db = openHippoDb(root);
|
|
134
|
+
try {
|
|
135
|
+
const count = resetAllPhysicsState(db, entries, embIndex);
|
|
136
|
+
console.log(`Reset physics state: ${count} particles re-initialized from embeddings.`);
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
closeHippoDb(db);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function printEmbedStatus(root) {
|
|
143
|
+
const entries = loadAllEntries(root);
|
|
144
|
+
const embIndex = loadEmbeddingIndex(root);
|
|
145
|
+
const activeIds = new Set(entries.map((e) => e.id));
|
|
146
|
+
const activeEmbedded = Object.keys(embIndex).filter((id) => activeIds.has(id)).length;
|
|
147
|
+
const orphaned = Object.keys(embIndex).length - activeEmbedded;
|
|
148
|
+
console.log(`Embedding status: ${activeEmbedded}/${entries.length} memories embedded`);
|
|
149
|
+
if (orphaned > 0) {
|
|
150
|
+
console.log(` ${orphaned} orphaned embeddings (run \`hippo embed\` to prune)`);
|
|
151
|
+
}
|
|
152
|
+
const missing = entries.filter((e) => !embIndex[e.id]);
|
|
153
|
+
if (missing.length > 0) {
|
|
154
|
+
console.log(` ${missing.length} memories need embedding (run \`hippo embed\` to embed them)`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** False, after saying why, when no usable provider exists. */
|
|
158
|
+
function embedProviderReady(root) {
|
|
133
159
|
// Embedding (unlike status/reset) needs an available provider.
|
|
134
160
|
const embedProvider = (() => {
|
|
135
161
|
try {
|
|
@@ -142,38 +168,23 @@ export async function cmdEmbed(hippoRoot, flags) {
|
|
|
142
168
|
})();
|
|
143
169
|
if (!embedProvider) {
|
|
144
170
|
process.exitCode = 1;
|
|
145
|
-
return;
|
|
171
|
+
return false;
|
|
146
172
|
}
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (embedProvider.kind === 'local') {
|
|
153
|
-
console.log('Embeddings not available. Install @huggingface/transformers to enable:');
|
|
154
|
-
console.log(' npm install @huggingface/transformers');
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
printError(`Embedding provider '${embedProvider.kind}' is configured but ${embedProvider.keyEnv} is not set.`);
|
|
158
|
-
printError(`Export ${embedProvider.keyEnv}, or set config.embeddings.provider back to 'local'.`);
|
|
159
|
-
process.exitCode = 1;
|
|
160
|
-
}
|
|
161
|
-
return;
|
|
173
|
+
if (embedProvider.isAvailable())
|
|
174
|
+
return true;
|
|
175
|
+
if (loadConfig(root).embeddings.enabled === false) {
|
|
176
|
+
console.log('Embeddings are disabled in config (embeddings.enabled = false). Set it to true or "auto" to enable.');
|
|
177
|
+
return false;
|
|
162
178
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
count = await embedAll(root, resolveEmbeddingModel(root));
|
|
179
|
+
if (embedProvider.kind === 'local') {
|
|
180
|
+
console.log('Embeddings not available. Install @huggingface/transformers to enable:');
|
|
181
|
+
console.log(' npm install @huggingface/transformers');
|
|
167
182
|
}
|
|
168
|
-
|
|
169
|
-
printError(`Embedding
|
|
170
|
-
|
|
171
|
-
printError(`Partial progress saved: ${Object.keys(partial).length} embeddings on disk. Re-run \`hippo embed\` to resume.`);
|
|
183
|
+
else {
|
|
184
|
+
printError(`Embedding provider '${embedProvider.kind}' is configured but ${embedProvider.keyEnv} is not set.`);
|
|
185
|
+
printError(`Export ${embedProvider.keyEnv}, or set config.embeddings.provider back to 'local'.`);
|
|
172
186
|
process.exitCode = 1;
|
|
173
|
-
return;
|
|
174
187
|
}
|
|
175
|
-
|
|
176
|
-
const embIndexAfter = loadEmbeddingIndex(root);
|
|
177
|
-
console.log(`Done. ${count} new embeddings created. ${Object.keys(embIndexAfter).length}/${entriesAfter.length} total.`);
|
|
188
|
+
return false;
|
|
178
189
|
}
|
|
179
190
|
//# sourceMappingURL=maintenance.js.map
|