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
|
@@ -2,14 +2,14 @@ import { tableHasColumn, tableExists } from '../tables.js';
|
|
|
2
2
|
export const v26 = {
|
|
3
3
|
version: 26,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
5
|
+
// Add role column to api_keys for the admin/member
|
|
6
6
|
// distinction that gates /v1/sleep. Additive — existing keys backfill to
|
|
7
7
|
// 'admin' via DEFAULT (single-tenant operator = admin by definition).
|
|
8
|
-
// No min_compatible_binary bump: old binaries
|
|
8
|
+
// No min_compatible_binary bump: old binaries ignore the
|
|
9
9
|
// column on SELECTs that don't name it; new binaries on old data run
|
|
10
10
|
// this migration at openHippoDb time before any createApiKey call.
|
|
11
11
|
//
|
|
12
|
-
//
|
|
12
|
+
// Defensive: also guard on tableExists. If a DB landed in the
|
|
13
13
|
// partial-v16-state (api_keys table missing despite schema_version >= 16),
|
|
14
14
|
// running ALTER TABLE here would crash and block all later migrations.
|
|
15
15
|
// The v27 heal below recreates api_keys with the role column already
|
|
@@ -2,16 +2,8 @@ import { tableHasColumn, tableExists } from '../tables.js';
|
|
|
2
2
|
export const v27 = {
|
|
3
3
|
version: 27,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// Surfaced 2026-05-24 on Keith's ~/.hippo/hippo.db: schema_version
|
|
8
|
-
// recorded as 25 but api_keys and audit_log tables were missing from
|
|
9
|
-
// migration v16. Root cause unknown — the migration runner has wrapped
|
|
10
|
-
// each migration in BEGIN/COMMIT since the first SQLite commit, so
|
|
11
|
-
// atomicity isn't the bug. Possible causes: DROP TABLE post-migration,
|
|
12
|
-
// SQL import / restore from a pre-v16 backup over a v16+ schema_version,
|
|
13
|
-
// or some edge case the wrapping doesn't catch. Cause may be operator
|
|
14
|
-
// action; either way the practical fix is the same.
|
|
5
|
+
// Self-heal: re-assert the v16 schema (api_keys + audit_log) on stores stamped past
|
|
6
|
+
// v16 whose tables are missing anyway (a dropped table or an old-backup restore).
|
|
15
7
|
//
|
|
16
8
|
// All CREATE IF NOT EXISTS — zero-cost no-op for users without the
|
|
17
9
|
// bug, fixes anyone who has it. Includes the role column from the
|
|
@@ -2,16 +2,13 @@ import { tableHasColumn } from '../tables.js';
|
|
|
2
2
|
export const v28 = {
|
|
3
3
|
version: 28,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// rebuild) have somewhere to write + read the staleness signal. Adds
|
|
9
|
-
// dag_level_3_built_at as a column (Keith Q5 pick: lets E5 entity-
|
|
10
|
-
// profile build path land without a second migration).
|
|
5
|
+
// Dirty-flag persistence for level-2 DAG summaries, so child-write propagation and the
|
|
6
|
+
// sleep-cycle rebuild can write + read the staleness signal. dag_level_3_built_at lands
|
|
7
|
+
// now so the entity-profile build path needs no second migration.
|
|
11
8
|
//
|
|
12
9
|
// All columns are additive + DEFAULTed/nullable, so backfill is
|
|
13
10
|
// automatic for existing rows. No min_compatible_binary bump: old
|
|
14
|
-
// binaries
|
|
11
|
+
// binaries ignore the columns on SELECTs that don't name
|
|
15
12
|
// them; new binaries on old data hit this migration at openHippoDb
|
|
16
13
|
// time before any DAG path touches summary_dirty.
|
|
17
14
|
//
|
|
@@ -29,7 +26,7 @@ export const v28 = {
|
|
|
29
26
|
db.exec(`ALTER TABLE memories ADD COLUMN rebuild_count INTEGER NOT NULL DEFAULT 0`);
|
|
30
27
|
}
|
|
31
28
|
if (!tableHasColumn(db, 'memories', 'dag_level_3_built_at')) {
|
|
32
|
-
//
|
|
29
|
+
// buildEntityProfiles sets this on level-3
|
|
33
30
|
// rows when they're created. Always NULL for level 0/1/2 rows.
|
|
34
31
|
db.exec(`ALTER TABLE memories ADD COLUMN dag_level_3_built_at TEXT`);
|
|
35
32
|
}
|
|
@@ -2,9 +2,8 @@ import { tableExists } from '../tables.js';
|
|
|
2
2
|
export const v29 = {
|
|
3
3
|
version: 29,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// planning-fallacy detector (a follow-up episode). Predictions
|
|
5
|
+
// Prediction first-class object: a predictions table for the reference-class /
|
|
6
|
+
// planning-fallacy detector. Predictions
|
|
8
7
|
// duplicate claim_text in the table itself so memory deletion
|
|
9
8
|
// (forget/consolidate/archive) does not lose prediction data; FK
|
|
10
9
|
// memory_id is NULLABLE with ON DELETE SET NULL.
|
|
@@ -16,7 +15,7 @@ export const v29 = {
|
|
|
16
15
|
// FK target. Precedent: v14 memories.kind trigger pair at db.ts:298-322.
|
|
17
16
|
//
|
|
18
17
|
// CHECK constraint pins closure_state to (open|closed|closed-unknown).
|
|
19
|
-
//
|
|
18
|
+
// Accuracy (clean vs regressed) is computed from (estimate_value,
|
|
20
19
|
// actual_value) at query time.
|
|
21
20
|
if (!tableExists(db, 'predictions')) {
|
|
22
21
|
db.exec(`
|
|
@@ -67,9 +67,9 @@ const TRG_DECISIONS_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
67
67
|
export const v30 = {
|
|
68
68
|
version: 30,
|
|
69
69
|
up: (db) => {
|
|
70
|
-
//
|
|
70
|
+
// Decision first-class object.
|
|
71
71
|
// Promotes `hippo decide` from a tagged memory (which decayed on a 90-day
|
|
72
|
-
// half-life even while the decision was still in force) to a
|
|
72
|
+
// half-life even while the decision was still in force) to a dedicated
|
|
73
73
|
// decisions table that is the source of truth. The memory mirror is kept
|
|
74
74
|
// for recall but is no longer authoritative; memory_id is NULLABLE with
|
|
75
75
|
// ON DELETE SET NULL so forget/consolidate/archive does not lose a
|
|
@@ -2,7 +2,7 @@ import { tableExists } from '../tables.js';
|
|
|
2
2
|
export const v31 = {
|
|
3
3
|
version: 31,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
5
|
+
// Incident first-class object.
|
|
6
6
|
// Mirrors the v30 decisions block but for an open -> resolved -> closed
|
|
7
7
|
// lifecycle (NOT supersede): there is no superseded_by self-FK and no
|
|
8
8
|
// supersede trigger. An incident is a postmortem capsule: a recorded
|
|
@@ -71,7 +71,7 @@ const TRG_PROCESSES_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
71
71
|
export const v32 = {
|
|
72
72
|
version: 32,
|
|
73
73
|
up: (db) => {
|
|
74
|
-
//
|
|
74
|
+
// Process first-class object.
|
|
75
75
|
// A process is a "living process map": a named, ordered list of steps that
|
|
76
76
|
// evolves. Unlike incident (open->resolved->closed, no supersede), process
|
|
77
77
|
// REUSES the v30 decisions supersede path as its delta mechanism: a process
|
|
@@ -75,7 +75,7 @@ const TRG_POLICIES_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
75
75
|
export const v33 = {
|
|
76
76
|
version: 33,
|
|
77
77
|
up: (db) => {
|
|
78
|
-
//
|
|
78
|
+
// Policy first-class object.
|
|
79
79
|
// The "bi-temporal-first" object type: a named rule/statement that is in
|
|
80
80
|
// force over an EFFECTIVE-TIME range (valid_from required, valid_to nullable
|
|
81
81
|
// = open-ended) and evolves via the v32 processes supersede machinery
|
|
@@ -86,10 +86,10 @@ export const v33 = {
|
|
|
86
86
|
// axis (the as-of query loadPoliciesAsOf); transaction-time is present via
|
|
87
87
|
// created_at + the supersede chain's superseded_at (time-travel deferred).
|
|
88
88
|
//
|
|
89
|
-
// All date inputs are normalized to
|
|
89
|
+
// All date inputs are normalized to standard ISO-8601 datetime
|
|
90
90
|
// (toISOString) at the store boundary before persist/compare, so the
|
|
91
91
|
// fixed-width values sort lexically and the half-open [valid_from, valid_to)
|
|
92
|
-
// as-of comparison is correct
|
|
92
|
+
// as-of comparison is correct.
|
|
93
93
|
if (!tableExists(db, 'policies')) {
|
|
94
94
|
db.exec(POLICIES_TABLE);
|
|
95
95
|
db.exec(IDX_POLICIES_TENANT_STATUS);
|
|
@@ -69,7 +69,7 @@ const TRG_SKILLS_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
69
69
|
export const v34 = {
|
|
70
70
|
version: 34,
|
|
71
71
|
up: (db) => {
|
|
72
|
-
//
|
|
72
|
+
// Skill first-class object.
|
|
73
73
|
// A skill is a reusable, agent-followable capability: an `instructions` body
|
|
74
74
|
// + an optional `trigger_text` (when to apply), evolving via the v32
|
|
75
75
|
// processes supersede machinery (superseded_by self-FK + supersede
|
|
@@ -72,8 +72,7 @@ const TRG_PROJECT_BRIEFS_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
72
72
|
export const v35 = {
|
|
73
73
|
version: 35,
|
|
74
74
|
up: (db) => {
|
|
75
|
-
//
|
|
76
|
-
// (docs/plans/2026-05-30-e2-project-brief-object.md). A project_brief is the
|
|
75
|
+
// project_brief first-class object. A project_brief is the
|
|
77
76
|
// living, repo-scoped summary of a repository's state: a `summary` body
|
|
78
77
|
// scoped to a `repo`, evolving via the v34 skills supersede machinery
|
|
79
78
|
// (superseded_by self-FK + supersede tenant-match trigger + version +
|
|
@@ -82,8 +81,8 @@ export const v35 = {
|
|
|
82
81
|
// PLUS `summary` (the brief body). The distinguishing op (refreshBrief, in
|
|
83
82
|
// src/project-briefs.ts) auto-assembles the summary from the repo's receipts
|
|
84
83
|
// (memory rows tagged path:<repo>); it needs no schema support beyond `repo`.
|
|
85
|
-
// All column names were checked against SQLite reserved words
|
|
86
|
-
//
|
|
84
|
+
// All column names were checked against SQLite reserved words:
|
|
85
|
+
// repo/summary/version/status/etc. are non-reserved.
|
|
87
86
|
if (!tableExists(db, 'project_briefs')) {
|
|
88
87
|
db.exec(PROJECT_BRIEFS_TABLE);
|
|
89
88
|
db.exec(IDX_PROJECT_BRIEFS_TENANT_STATUS);
|
|
@@ -72,17 +72,16 @@ const TRG_CUSTOMER_NOTES_SUPERSEDE_TENANT_MATCH_UPDATE = `
|
|
|
72
72
|
export const v36 = {
|
|
73
73
|
version: 36,
|
|
74
74
|
up: (db) => {
|
|
75
|
-
//
|
|
76
|
-
// (docs/plans/2026-06-01-e2-customer-note-object.md). A customer_note is a
|
|
75
|
+
// customer_note first-class object. A customer_note is a
|
|
77
76
|
// discrete note recorded against an account/customer entity, evolving via the
|
|
78
77
|
// v35 project_briefs supersede machinery (superseded_by self-FK + supersede
|
|
79
78
|
// tenant-match trigger + version + change_summary). This table = the v35
|
|
80
79
|
// project_briefs table with repo/summary replaced by `customer` (the
|
|
81
80
|
// entity-scoping dimension; a free-form account/customer id - the entities
|
|
82
|
-
// table is unbuilt
|
|
81
|
+
// table is unbuilt, so a FK is deferred) PLUS `note` (the note body).
|
|
83
82
|
// MANY notes per customer (each its own supersede chain), unlike the
|
|
84
83
|
// one-summary-per-repo project_brief. All column names checked against SQLite
|
|
85
|
-
// reserved words
|
|
84
|
+
// reserved words: customer/note/
|
|
86
85
|
// version/status/etc. are non-reserved.
|
|
87
86
|
if (!tableExists(db, 'customer_notes')) {
|
|
88
87
|
db.exec(CUSTOMER_NOTES_TABLE);
|
|
@@ -139,7 +139,7 @@ const TRG_GRAPH_QUEUE_CONSOLIDATED_ONLY_UPDATE = `
|
|
|
139
139
|
END;
|
|
140
140
|
END
|
|
141
141
|
`;
|
|
142
|
-
// Reverse guard
|
|
142
|
+
// Reverse guard: the graph-table triggers
|
|
143
143
|
// only fire on writes to the GRAPH tables. They do NOT fire when an
|
|
144
144
|
// already-indexed memory is later mutated. So 'UPDATE memories SET kind=raw'
|
|
145
145
|
// (or a tenant change) on a memory the graph references would silently leave
|
|
@@ -162,7 +162,7 @@ const TRG_MEMORIES_GRAPH_REFERENCED_GUARD = `
|
|
|
162
162
|
SELECT RAISE(ABORT, 'cannot change the kind or tenant of a memory while the graph references it (E3.3 graph-on-consolidated guard); a graph-referenced memory is immutable in kind/tenant - rebuild/remove the graph rows first, or rebuild them after supersession');
|
|
163
163
|
END
|
|
164
164
|
`;
|
|
165
|
-
//
|
|
165
|
+
// Second reverse guard: an entity that is
|
|
166
166
|
// a relation endpoint cannot be moved cross-tenant. The entity UPDATE trigger
|
|
167
167
|
// validates the entity against its source memory, but an existing relation
|
|
168
168
|
// pointing at the entity is NOT re-validated, so a raw 'UPDATE entities SET
|
|
@@ -181,7 +181,7 @@ const TRG_ENTITIES_NO_TENANT_MOVE_WHEN_REFERENCED = `
|
|
|
181
181
|
export const v37 = {
|
|
182
182
|
version: 37,
|
|
183
183
|
up: (db) => {
|
|
184
|
-
//
|
|
184
|
+
// Graph-on-consolidated guard.
|
|
185
185
|
// The graph layer (entities + relations) sits ON TOP OF consolidated state and
|
|
186
186
|
// must NEVER index the raw layer. The substrate: entities + relations +
|
|
187
187
|
// graph_extraction_queue, each FK-ing to memories and guarded so they can only
|
|
@@ -192,8 +192,8 @@ export const v37 = {
|
|
|
192
192
|
// is a BEFORE INSERT *and* BEFORE UPDATE trigger (the subquery-capable pattern
|
|
193
193
|
// from the v30 decisions / predictions tenant-match triggers). Both INSERT and
|
|
194
194
|
// UPDATE are guarded: an INSERT-only guard is bypassable via a raw SQL UPDATE
|
|
195
|
-
// that moves a row onto a raw memory
|
|
196
|
-
// names checked vs SQL reserved words
|
|
195
|
+
// that moves a row onto a raw memory. All column
|
|
196
|
+
// names checked vs SQL reserved words: rel_type avoids REFERENCES.
|
|
197
197
|
if (!tableExists(db, 'entities')) {
|
|
198
198
|
db.exec(ENTITIES_TABLE);
|
|
199
199
|
db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_tenant ON entities(tenant_id)`);
|
|
@@ -38,7 +38,7 @@ const RELATIONS_TABLE = `
|
|
|
38
38
|
// - memory path (memory_id NOT NULL): source_kind == the FK'd memory's kind
|
|
39
39
|
// (raw / lying source_kind ABORT) AND tenant-match.
|
|
40
40
|
// - object path (memory_id NULL): the (type,id) points at an EXISTING same-tenant
|
|
41
|
-
//
|
|
41
|
+
// object row whose status is active|superseded (explicit 4-way CASE per table).
|
|
42
42
|
const TRG_ENTITIES_CONSOLIDATED_ONLY_INSERT = `
|
|
43
43
|
CREATE TRIGGER IF NOT EXISTS trg_entities_consolidated_only_insert
|
|
44
44
|
BEFORE INSERT ON entities
|
|
@@ -217,10 +217,9 @@ const TRG_ENTITIES_NO_TENANT_MOVE_WHEN_REFERENCED = `
|
|
|
217
217
|
export const v38 = {
|
|
218
218
|
version: 38,
|
|
219
219
|
up: (db) => {
|
|
220
|
-
//
|
|
221
|
-
// object (decision/policy/customer-note/project-brief) instead of the
|
|
222
|
-
// memory mirror
|
|
223
|
-
// object must STAY in the graph after its mirror memory is forgotten or
|
|
220
|
+
// Object provenance: anchor graph entity/relation provenance to the authoritative
|
|
221
|
+
// first-class object (decision/policy/customer-note/project-brief) instead of the
|
|
222
|
+
// decaying memory mirror. An in-force object must STAY in the graph after its mirror memory is forgotten or
|
|
224
223
|
// consolidation-pruned. The graph is a PURE DERIVED CACHE (clearGraph + rebuild on
|
|
225
224
|
// every `graph extract` / `sleep`), so v38 DROPs+recreates entities/relations (no
|
|
226
225
|
// data copy) and the next extract repopulates. graph_extraction_queue is untouched.
|
|
@@ -229,7 +228,7 @@ export const v38 = {
|
|
|
229
228
|
// - memory path (memory_id NOT NULL): source_kind must equal the FK'd memory's live
|
|
230
229
|
// kind and that kind is distilled|superseded (raw still ABORTs) + tenant-match.
|
|
231
230
|
// - object path (memory_id NULL): source_object_type/id must reference an EXISTING
|
|
232
|
-
// same-tenant
|
|
231
|
+
// same-tenant object row whose status is active|superseded (not closed). Such objects
|
|
233
232
|
// are consolidated BY CONSTRUCTION, so the no-raw invariant still holds.
|
|
234
233
|
// - all-null is rejected.
|
|
235
234
|
//
|
|
@@ -243,9 +242,9 @@ export const v38 = {
|
|
|
243
242
|
// by design (the object path is distilled-by-construction; source_kind is only
|
|
244
243
|
// re-checked when memory_id NOT NULL).
|
|
245
244
|
// source_object_id is a SOFT (type,id) pointer (no hard FK) the rebuild re-validates,
|
|
246
|
-
// so a legitimate
|
|
245
|
+
// so a legitimate object hard-delete is never blocked; a `closed` object row drops at next
|
|
247
246
|
// extract. SQLite cannot parametrize a table name in a trigger, so the object-path
|
|
248
|
-
// validation is an explicit 4-way CASE (one arm per
|
|
247
|
+
// validation is an explicit 4-way CASE (one arm per object table).
|
|
249
248
|
recreateGraphTables(db);
|
|
250
249
|
createGraphGuards(db);
|
|
251
250
|
},
|
|
@@ -6,7 +6,7 @@ import { tableHasColumn } from '../tables.js';
|
|
|
6
6
|
export const v39 = {
|
|
7
7
|
version: 39,
|
|
8
8
|
up: (db, ctx) => {
|
|
9
|
-
// Memory scope isolation
|
|
9
|
+
// Memory scope isolation.
|
|
10
10
|
// origin_project: '<name>' = owned by that project, '' = user-global,
|
|
11
11
|
// NULL = legacy/unknown (ambient context treats NULL as deny).
|
|
12
12
|
if (!tableHasColumn(db, 'memories', 'origin_project')) {
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
export const v40 = {
|
|
2
2
|
version: 40,
|
|
3
3
|
up: (db) => {
|
|
4
|
-
//
|
|
4
|
+
// Retrieval-trace persistence.
|
|
5
5
|
// Follows the v18 goal_recall_log style: one parent trace row per
|
|
6
6
|
// recall, a WITHOUT ROWID child table for the ranked results, and a
|
|
7
7
|
// separate append-only outcomes table so audit_log pruning can never
|
|
8
8
|
// erase training data.
|
|
9
9
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// exactly as before — it never touches `last_trace_id` (that key
|
|
14
|
-
// simply stays whatever it was). recordTraceOutcome's F4 consumer-
|
|
15
|
-
// side validation (recall-trace.ts) makes any resulting staleness
|
|
16
|
-
// harmless to linkage: it re-validates the named trace's tenant AND
|
|
17
|
-
// intersects credited ids against the trace's OWN result set before
|
|
18
|
-
// inserting, so a stale/mismatched trace id from an old-binary write
|
|
19
|
-
// gets silently skipped rather than mislinked. That preserves the
|
|
20
|
-
// plan's "drop the three tables + last_trace_id restores v39 behavior
|
|
21
|
-
// exactly" rollback promise — a min_compatible_binary bump would
|
|
22
|
-
// additionally lock old binaries out of the WHOLE store for what is
|
|
23
|
-
// purely an observability/training feature, which the rollback
|
|
24
|
-
// promise does not require.
|
|
10
|
+
// No min_compatible_binary bump, on purpose: an old binary ignores these tables and
|
|
11
|
+
// recordTraceOutcome re-validates trace ids, so its stale writes are skipped; a bump
|
|
12
|
+
// would lock old binaries out of the whole store for an observability feature.
|
|
25
13
|
db.exec(`
|
|
26
14
|
CREATE TABLE IF NOT EXISTS recall_traces (
|
|
27
15
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const v41 = {
|
|
2
2
|
version: 41,
|
|
3
3
|
up: (db) => {
|
|
4
|
-
//
|
|
4
|
+
// Rejected-value tombstone.
|
|
5
5
|
// Additive table, template = v40 above. A human who rejects a fact gets
|
|
6
6
|
// a durable say: the write-path guard in upsertEntryRow refuses any
|
|
7
7
|
// write that would re-introduce a value whose normalized digest
|
|
@@ -17,11 +17,10 @@ export const v41 = {
|
|
|
17
17
|
// No FK on source_memory_id (v40 precedent above: tombstone outlives
|
|
18
18
|
// the row it was sourced from) — provenance only.
|
|
19
19
|
//
|
|
20
|
-
// Reserved-word check on column names
|
|
20
|
+
// Reserved-word check on column names:
|
|
21
21
|
// tenant/digest/reason/rejected/source/normalized/chars are non-reserved.
|
|
22
22
|
//
|
|
23
|
-
// No min_compatible_binary bump
|
|
24
|
-
// flagged to the ship gate). An old binary sharing a synced store
|
|
23
|
+
// No min_compatible_binary bump, a deliberate tradeoff: an old binary sharing a synced store
|
|
25
24
|
// writes WITHOUT the guard until upgraded; documented in
|
|
26
25
|
// MEMORY_ENVELOPE.md rather than hard-locking every old binary out of
|
|
27
26
|
// the store, which is disproportionate for the dominant single-user
|
|
@@ -2,9 +2,8 @@ import { tableHasColumn } from '../tables.js';
|
|
|
2
2
|
export const v42 = {
|
|
3
3
|
version: 42,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// and W2/W5 can filter on them without parsing JSON.
|
|
5
|
+
// Handoff envelope: five nullable columns so the envelope carries evidence and
|
|
6
|
+
// outcome and readers can filter on them without parsing JSON.
|
|
8
7
|
if (!tableHasColumn(db, 'session_handoffs', 'constraints_json')) {
|
|
9
8
|
db.exec(`ALTER TABLE session_handoffs ADD COLUMN constraints_json TEXT`);
|
|
10
9
|
}
|
|
@@ -13,7 +12,7 @@ export const v42 = {
|
|
|
13
12
|
}
|
|
14
13
|
if (!tableHasColumn(db, 'session_handoffs', 'outcome')) {
|
|
15
14
|
db.exec(`ALTER TABLE session_handoffs ADD COLUMN outcome TEXT`);
|
|
16
|
-
//
|
|
15
|
+
// Backfill from session_complete so pre-existing handoffs don't
|
|
17
16
|
// all read as unfinished and get injected by the new 72h ambient fallback.
|
|
18
17
|
db.exec(`
|
|
19
18
|
UPDATE session_handoffs SET outcome = (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const v45 = {
|
|
2
2
|
version: 45,
|
|
3
3
|
up: (db) => {
|
|
4
|
-
// Token ledger (src/token-ledger.ts
|
|
4
|
+
// Token ledger (src/token-ledger.ts): one row per block of
|
|
5
5
|
// memory text hippo hands an agent (hook, CLI, MCP, HTTP). `event` is 'inject'
|
|
6
6
|
// (sent), 'skip' (unchanged since the session's last inject, not sent), 'reset'
|
|
7
7
|
// (compaction dropped earlier injections, so the next one must be sent) or
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const v46 = {
|
|
2
2
|
version: 46,
|
|
3
3
|
up: (db) => {
|
|
4
|
-
//
|
|
4
|
+
// Failure log (src/failure-log.ts): hashes only, since failure text can carry paths and secrets.
|
|
5
5
|
// Additive only: no min_compatible_binary bump.
|
|
6
6
|
db.exec(`
|
|
7
7
|
CREATE TABLE IF NOT EXISTS failure_log (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const v47 = {
|
|
2
2
|
version: 47,
|
|
3
3
|
up: (db) => {
|
|
4
|
-
// Scope grants (src/auth.ts
|
|
4
|
+
// Scope grants (src/auth.ts): a member key reads a
|
|
5
5
|
// restricted scope only by an explicit row here. Additive only: no
|
|
6
6
|
// min_compatible_binary bump.
|
|
7
7
|
db.exec(`
|
|
@@ -2,7 +2,7 @@ import { MEMORY_QUARANTINE_DDL } from '../continuity.js';
|
|
|
2
2
|
export const v48 = {
|
|
3
3
|
version: 48,
|
|
4
4
|
up: (db) => {
|
|
5
|
-
// Quarantine (src/quarantine.ts
|
|
5
|
+
// Quarantine (src/quarantine.ts): a poisoned or suspect memory sits here pending
|
|
6
6
|
// admin review instead of being hidden with no record. Additive only: no min_compatible_binary bump.
|
|
7
7
|
db.exec(MEMORY_QUARANTINE_DDL);
|
|
8
8
|
},
|
package/dist/decisions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Decision first-class object.
|
|
3
3
|
*
|
|
4
4
|
* `hippo decide` used to write only a tagged memory (tags ['decision'], source
|
|
5
5
|
* 'decision') with a 90-day half-life, so an in-force decision decayed out of
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Tenant scoping: every helper requires tenantId. BEFORE INSERT/UPDATE triggers
|
|
17
17
|
* enforce decisions.tenant_id == the referenced memory's tenant_id, and a
|
|
18
18
|
* superseded_by same-tenant trigger makes cross-tenant supersession
|
|
19
|
-
* unrepresentable. Mirrors the
|
|
19
|
+
* unrepresentable. Mirrors the predictions pattern (src/predictions.ts).
|
|
20
20
|
*
|
|
21
21
|
* Dual-write atomicity: `saveDecision` writes the memory + decisions row (and,
|
|
22
22
|
* when superseding, the old row's UPDATE) inside writeEntry's SAVEPOINT
|