switchroom 0.20.17 → 0.20.19
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/dist/agent-scheduler/index.js +7 -1
- package/dist/auth-broker/index.js +42 -5
- package/dist/cli/notion-write-pretool.mjs +7 -1
- package/dist/cli/switchroom.js +1684 -437
- package/dist/host-control/main.js +43 -6
- package/dist/vault/approvals/kernel-server.js +42 -5
- package/dist/vault/broker/server.js +42 -5
- package/package.json +1 -1
- package/profiles/_shared/dev-protocol.md.hbs +1 -1
- package/profiles/coding/CLAUDE.md.hbs +2 -2
- package/profiles/default/CLAUDE.md.hbs +5 -5
- package/profiles/executive-assistant/CLAUDE.md.hbs +2 -2
- package/profiles/health-coach/CLAUDE.md.hbs +2 -2
- package/telegram-plugin/dist/gateway/gateway.js +57 -13
- package/telegram-plugin/telegraph.ts +23 -5
- package/telegram-plugin/tests/telegraph.test.ts +34 -0
- package/telegram-plugin/tests/welcome-text.test.ts +5 -4
- package/telegram-plugin/welcome-text.ts +7 -0
|
@@ -11445,7 +11445,13 @@ var init_schema = __esm(() => {
|
|
|
11445
11445
|
reflect: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `reflect` LLM op (synthesis / mental-model " + "refresh). Emits `HINDSIGHT_API_REFLECT_LLM_*`. Absent → uses global."),
|
|
11446
11446
|
consolidation: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `consolidation` LLM op (background memory " + "merge). Emits `HINDSIGHT_API_CONSOLIDATION_LLM_*`. Absent → global.")
|
|
11447
11447
|
}).optional().describe("LLM knob for the hindsight container. The flat `provider`/`model` set " + "the global default (backward-compatible); optional `retain`/`reflect`/" + "`consolidation` blocks override individual ops. All fields optional; " + "unset fields fall back to the hard-coded defaults."),
|
|
11448
|
-
|
|
11448
|
+
recall_pool: exports_external.object({
|
|
11449
|
+
enabled: exports_external.boolean().optional().describe("Turn on the recall/background WORKER SPLIT: a second container, " + "`switchroom-hindsight-recall`, serves recall/reflect only with N " + "uvicorn workers, while the existing `switchroom-hindsight` " + "container keeps pg0, the single background WorkerPoller, the " + "healthcheck and all consolidation/retain processing but moves off " + "the public port onto public+1. The public port (memory.config.url) " + "does not change — the pool binds it instead. Absent/false (the " + "default) → the single-container topology, unchanged. Opt-in only. " + "Raises recall throughput ~2.2x on the fleet (2.6→5.6 rps)."),
|
|
11450
|
+
workers: exports_external.number().int().positive().optional().describe("uvicorn `--workers` for the recall pool (HINDSIGHT_API_WORKERS). " + "Default 4. Each worker holds its own GPU cross-encoder reranker, " + "so past ~4 workers contend for VRAM rather than adding throughput " + "on a single GPU — raise only on a bigger GPU or a CPU reranker. " + "The per-worker DB pools are auto-sized down from the pg0 " + "connection budget so N*(write+read)+60 background stays under " + "max_connections=250; a worker count that would overflow that " + "budget is rejected at launch."),
|
|
11451
|
+
db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker WRITE pool cap " + "(HINDSIGHT_API_DB_POOL_MAX_SIZE). Absent → auto-sized from the " + "worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow."),
|
|
11452
|
+
read_db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker READ pool cap " + "(HINDSIGHT_API_READ_DB_POOL_MAX_SIZE). Absent → auto-sized from " + "the worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow.")
|
|
11453
|
+
}).optional().describe("Optional recall/background container split for the hindsight " + "singleton. Off by default; see `enabled`. Provisioned by " + "`switchroom memory setup` (src/setup/hindsight-recall-pool.ts) so it " + "survives `switchroom apply` — the hand-applied topology it replaces " + "did not."),
|
|
11454
|
+
env: exports_external.record(exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()])).optional().describe("Operator overrides for switchroom's capability-gated Hindsight " + "performance defaults. Only the keys switchroom actually manages are " + "honoured (`HINDSIGHT_PERF_ENV_KEYS` in " + "src/setup/hindsight-perf-defaults.ts: RERANKER_LOCAL_FP16, " + "RERANKER_LOCAL_BATCH_SIZE, LLM_MAX_CONCURRENT, " + "RETAIN/CONSOLIDATION_LLM_MAX_CONCURRENT, LLM_STRICT_SCHEMA, " + "LLM_MAX_RETRIES, CONSOLIDATION_LLM_PARALLELISM, " + "MAX_OBSERVATIONS_PER_SCOPE, " + "RECALL_MAX_CANDIDATES_PER_SOURCE, LINK_EXPANSION_PER_ENTITY_LIMIT, " + "LINK_EXPANSION_TIMEOUT, LLM_REASONING_EFFORT, " + "RERANKER_LOCAL_BUCKET_BATCHING, RERANKER_MAX_CANDIDATES, " + "RERANKER_LOCAL_MAX_CONCURRENT, RECALL_MAX_CONCURRENT, " + "REFLECT_WALL_TIMEOUT, WORKER_CONSOLIDATION_RESERVED_SLOTS, " + "WORKER_CONSOLIDATION_SLOT_LIMIT, " + "CONSOLIDATION_MAX_MEMORIES_PER_ROUND, GRAPH_SEED_MIN_SIMILARITY, " + "LLM_SUPPORTS_MAX_ITEMS, RECENCY_DECAY_FUNCTION, " + "RECENCY_DECAY_HALFLIFE_DAYS — switchroom defaults recall's recency " + "curve to `exponential` with a 30-day half-life so a fact retained " + "today outranks a stale one, instead of upstream's near-flat " + "linear/365-day window), the override-only keys " + "switchroom manages but ships NO default for " + "(`HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS`: " + "HINDSIGHT_API_WORKER_CONSOLIDATION_BANK_PRIORITY — a per-deployment " + "`bank-pattern:priority,...` map; unset means upstream's flat " + "created_at FIFO across banks; and " + "HINDSIGHT_CE_DECISIVE_RELATIVE_GAP — the rollback knob for " + "switchroom's CE-saturation damping patch, a float; >= ~0.65 backs the " + "damping out entirely, unset means the patch's own derived gap; and " + "HINDSIGHT_API_RECENCY_DECAY_LINEAR_WINDOW_DAYS — only read when the " + "decay function is `linear`, so switchroom ships no default for it but " + "still honours an operator who flips the function back; and " + "HINDSIGHT_API_WORKER_MAX_SLOTS — the worker poller's TOTAL in-flight " + "task budget, the pool WORKER_CONSOLIDATION_RESERVED_SLOTS reserves out of; " + "unset means upstream's own default; and " + "HINDSIGHT_API_WORKER_RETAIN_RESERVED_SLOTS — the reserved slot FLOOR for the " + "retain (memory write) lane, carved from that same total; unset means " + "upstream's own 0, i.e. no floor and retain competes for the shared " + "pool; and " + "the pre-0.8.6 name HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS is still " + "accepted for every operation type and normalised to " + "..._RESERVED_SLOTS on the way in, because setting both names for " + "one type is a hard boot failure in the engine and switchroom " + "therefore emits only the canonical name; and " + "HINDSIGHT_API_SEMANTIC_MIN_SIMILARITY — the cosine-similarity floor a " + "candidate must reach to be returned by the semantic retrieval arm at " + "all (0..1); unset means upstream's own 0.3, and where it should sit " + "depends on the bank's embedding model and phrasing diversity, so " + "switchroom ships no opinion; and " + "HINDSIGHT_MCP_RECALL_BUDGET_MODE — the rollback knob for switchroom's " + "mcp-recall-token-budget image patch; `legacy` restores upstream's " + "exact pre-patch recall returns, anything else or unset is the " + "honest-envelope mode; and " + "HINDSIGHT_API_LLM_TEMPERATURE_REFLECT — upstream's own per-op reflect " + "temperature knob, made live by switchroom's reflect-temperature image " + "patch; a float, or `none` to omit the kwarg (provider default, " + "upstream's accidental pre-patch behaviour); unset means the image's " + "baked default 0.1; and " + "HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT — the background " + "half of switchroom's recall-admission split (#3660): of the " + "RECALL_MAX_CONCURRENT admission slots, at most this many may be held " + "by background consolidation recalls at once, so foreground per-turn " + "recall always keeps the remainder; must be >= 1 and strictly less " + "than RECALL_MAX_CONCURRENT or the engine refuses to boot; unset " + "means the image's derived default min(2, RECALL_MAX_CONCURRENT - 1); " + "1 biases hard toward the interactive lane while a consolidation " + "backlog drains; and " + "HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S — the rollback/tuning knob for " + "switchroom's MM-refresh-debounce image patch: the minimum seconds " + "between consolidation-triggered refreshes of one mental model; unset " + "means the image's baked 3600, 0 restores upstream's " + "refresh-every-round behaviour; explicit and cron-scheduled refreshes " + "are never debounced; and " + "HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES — the language set dateparser is " + "restricted to during temporal query analysis (upstream #3154, which " + "superseded switchroom's own temporal-language image patch at v0.9.0); " + "comma-separated; switchroom EMITS `en` on every host because upstream's " + "unset default auto-detects across 200+ locales inline on the shared " + "asyncio loop (~165x slower per call), set e.g. `en,es` for i18n parsing; " + "and " + "HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS — the max chars of query text " + "dateparser.search_dates() is handed during temporal analysis (0 = " + "unlimited), made live by switchroom's temporal-offload image patch " + "(which moved the synchronous extraction off the shared asyncio loop onto " + "a single-worker thread and bounds its input, ending multi-second loop " + "stalls on multi-KB consolidation queries); unset means the image's baked " + "2000, set 0 to restore an unbounded full scan); and " + "HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE — the Postgres " + "text-search regconfig the native BM25 arms and the search_vector index " + "write run to_tsvector/to_tsquery against; unset means upstream's " + "always-safe `english`, set `hindsight_english` to use switchroom's " + "junk-stopping config (dict + stopword file provisioned durably by the " + "image entrypoint, recall degrading to semantic-only if it is ever " + "missing); and " + "HINDSIGHT_API_BM25_MAX_QUERY_TERMS — the max number of query tokens the " + "keyword (BM25) recall arm searches for; unset means upstream's 0 = " + "unbounded, which makes a multi-KB consolidation query a disjunction " + "over hundreds of terms; set e.g. 64 to cap it, at the cost of " + "silently dropping the tail of a long query; and " + "HINDSIGHT_API_EMBEDDINGS_PROVIDER with the four " + "HINDSIGHT_API_EMBEDDINGS_ONNX_{MODEL_ID,POOLING,QUERY_PREFIX," + "PASSAGE_PREFIX} keys — the ONNX-embeddings cutover: unset keeps " + "upstream's slower `local` (PyTorch) backend, set `onnx` plus the model " + "id/pooling to run the SAME model on ONNX-CPU at a fraction of the " + "latency; the two _PREFIX keys are the query/passage affixes and are " + "set to the empty string for bge parity (vectors are byte-identical " + "between the two backends, so no re-embedding is needed) — unusually " + "for this block an EMPTY value here is honoured, not dropped, because an " + "affix-free prefix is the intended value; and the v0.9.0 knobs " + "switchroom allowlists for reach but emits no value for — " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES_{LOW,MID,HIGH} (per-recall-budget " + "rerank caps; unset/0 falls back to the global " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES switchroom does pin), " + "HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS (embedding-input truncation " + "ceiling; unset means the model's own limit), " + "HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD (entity-resolution fuzzy " + "match floor; unset means upstream's 0.15) and " + "HINDSIGHT_API_ENABLE_{TEMPORAL_RETRIEVAL,GRAPH_RETRIEVAL,RERANKING} " + "(global per-stage kill switches, all default true — the emergency lever " + "if one retrieval stage is implicated in a latency incident, at the cost " + "of recall quality); plus the " + "embedded-PostgreSQL (pg0) sizing keys switchroom manages in " + "src/setup/hindsight-pg-defaults.ts (`HINDSIGHT_PG_ENV_KEYS`: " + "SWITCHROOM_HINDSIGHT_PG_EFFECTIVE_CACHE_SIZE, " + "SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS — a postgres size string such " + "as `4GB`, or the sentinel `off` to leave pg0's own default for that " + "one knob). A value set here " + "REPLACES switchroom's default and is emitted even when the gating " + "capability is absent, so an operator can always force a knob. Other " + "`HINDSIGHT_API_*` keys are deliberately IGNORED — a blanket " + "passthrough would collide with the vars startHindsight() derives " + "itself (HINDSIGHT_API_PORT, the retain token/deadline budget).")
|
|
11449
11455
|
});
|
|
11450
11456
|
MicrosoftWorkspaceConfigSchema = exports_external.object({
|
|
11451
11457
|
microsoft_client_id: exports_external.string().min(1).optional().describe("Microsoft OAuth application (client) ID from Entra portal " + "(literal string or vault reference e.g. " + "'vault:microsoft-oauth-client-id'). OPTIONAL — omit it to use " + "switchroom's shipped default Microsoft app (zero-config). " + "Set it only to bring your own Entra app (BYO)."),
|
|
@@ -21559,7 +21565,7 @@ function allocateAgentUid(name) {
|
|
|
21559
21565
|
}
|
|
21560
21566
|
|
|
21561
21567
|
// src/build-info.ts
|
|
21562
|
-
var VERSION = "0.20.
|
|
21568
|
+
var VERSION = "0.20.19";
|
|
21563
21569
|
|
|
21564
21570
|
// src/setup/hindsight-recall-passthrough.ts
|
|
21565
21571
|
var HINDSIGHT_RECALL_TAG_WEIGHT_SEED = Object.freeze({ sidechain: 0.8 });
|
|
@@ -21758,6 +21764,7 @@ var HINDSIGHT_DEFAULT_LLM_SUPPORTS_MAX_ITEMS = "false";
|
|
|
21758
21764
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_FUNCTION = "exponential";
|
|
21759
21765
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_HALFLIFE_DAYS = 30;
|
|
21760
21766
|
var HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION = "pg_search";
|
|
21767
|
+
var HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES = "en";
|
|
21761
21768
|
var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
21762
21769
|
[
|
|
21763
21770
|
"HINDSIGHT_API_RECALL_MAX_CANDIDATES_PER_SOURCE",
|
|
@@ -21824,7 +21831,11 @@ var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
|
21824
21831
|
"HINDSIGHT_API_GRAPH_SEED_MIN_SIMILARITY",
|
|
21825
21832
|
String(HINDSIGHT_DEFAULT_GRAPH_SEED_MIN_SIMILARITY)
|
|
21826
21833
|
],
|
|
21827
|
-
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION]
|
|
21834
|
+
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION],
|
|
21835
|
+
[
|
|
21836
|
+
"HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES",
|
|
21837
|
+
HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES
|
|
21838
|
+
]
|
|
21828
21839
|
];
|
|
21829
21840
|
var HINDSIGHT_PERF_DEFAULTS_GPU = [
|
|
21830
21841
|
["HINDSIGHT_API_RERANKER_LOCAL_FP16", HINDSIGHT_DEFAULT_RERANKER_LOCAL_FP16],
|
|
@@ -21859,10 +21870,26 @@ var HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS = new Set([
|
|
|
21859
21870
|
"HINDSIGHT_API_RETAIN_WALL_TIMEOUT",
|
|
21860
21871
|
"HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT",
|
|
21861
21872
|
"HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S",
|
|
21862
|
-
"HINDSIGHT_API_TEMPORAL_LANGUAGES",
|
|
21863
21873
|
"HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS",
|
|
21864
21874
|
"HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE",
|
|
21865
|
-
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS"
|
|
21875
|
+
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS",
|
|
21876
|
+
"HINDSIGHT_API_EMBEDDINGS_PROVIDER",
|
|
21877
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_MODEL_ID",
|
|
21878
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_POOLING",
|
|
21879
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
21880
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX",
|
|
21881
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_LOW",
|
|
21882
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_MID",
|
|
21883
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_HIGH",
|
|
21884
|
+
"HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS",
|
|
21885
|
+
"HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD",
|
|
21886
|
+
"HINDSIGHT_API_ENABLE_TEMPORAL_RETRIEVAL",
|
|
21887
|
+
"HINDSIGHT_API_ENABLE_GRAPH_RETRIEVAL",
|
|
21888
|
+
"HINDSIGHT_API_ENABLE_RERANKING"
|
|
21889
|
+
]);
|
|
21890
|
+
var HINDSIGHT_PERF_ALLOW_EMPTY_KEYS = new Set([
|
|
21891
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
21892
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX"
|
|
21866
21893
|
]);
|
|
21867
21894
|
var HINDSIGHT_WORKER_SLOT_TYPES = [
|
|
21868
21895
|
"consolidation",
|
|
@@ -21876,6 +21903,15 @@ var HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES = new Map(HINDSIGHT_WORKER_SLOT_TYPES
|
|
|
21876
21903
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_MAX_SLOTS`,
|
|
21877
21904
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_RESERVED_SLOTS`
|
|
21878
21905
|
]));
|
|
21906
|
+
var HINDSIGHT_RECALL_POOL_ENV_KEYS = [
|
|
21907
|
+
"HINDSIGHT_API_WORKERS",
|
|
21908
|
+
"HINDSIGHT_API_WORKER_ENABLED",
|
|
21909
|
+
"HINDSIGHT_API_DATABASE_URL",
|
|
21910
|
+
"HINDSIGHT_API_DB_URL",
|
|
21911
|
+
"HINDSIGHT_API_DB_POOL_MAX_SIZE",
|
|
21912
|
+
"HINDSIGHT_API_READ_DB_POOL_MAX_SIZE",
|
|
21913
|
+
"HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP"
|
|
21914
|
+
];
|
|
21879
21915
|
var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
21880
21916
|
...[
|
|
21881
21917
|
...HINDSIGHT_PERF_DEFAULTS_UNGATED,
|
|
@@ -21884,7 +21920,8 @@ var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
|
21884
21920
|
].map(([k]) => k),
|
|
21885
21921
|
...HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS,
|
|
21886
21922
|
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.keys(),
|
|
21887
|
-
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values()
|
|
21923
|
+
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values(),
|
|
21924
|
+
...HINDSIGHT_RECALL_POOL_ENV_KEYS
|
|
21888
21925
|
]);
|
|
21889
21926
|
|
|
21890
21927
|
// src/setup/hindsight-context-budget.ts
|
|
@@ -4885,7 +4885,13 @@ var init_schema = __esm(() => {
|
|
|
4885
4885
|
reflect: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `reflect` LLM op (synthesis / mental-model " + "refresh). Emits `HINDSIGHT_API_REFLECT_LLM_*`. Absent → uses global."),
|
|
4886
4886
|
consolidation: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `consolidation` LLM op (background memory " + "merge). Emits `HINDSIGHT_API_CONSOLIDATION_LLM_*`. Absent → global.")
|
|
4887
4887
|
}).optional().describe("LLM knob for the hindsight container. The flat `provider`/`model` set " + "the global default (backward-compatible); optional `retain`/`reflect`/" + "`consolidation` blocks override individual ops. All fields optional; " + "unset fields fall back to the hard-coded defaults."),
|
|
4888
|
-
|
|
4888
|
+
recall_pool: exports_external.object({
|
|
4889
|
+
enabled: exports_external.boolean().optional().describe("Turn on the recall/background WORKER SPLIT: a second container, " + "`switchroom-hindsight-recall`, serves recall/reflect only with N " + "uvicorn workers, while the existing `switchroom-hindsight` " + "container keeps pg0, the single background WorkerPoller, the " + "healthcheck and all consolidation/retain processing but moves off " + "the public port onto public+1. The public port (memory.config.url) " + "does not change — the pool binds it instead. Absent/false (the " + "default) → the single-container topology, unchanged. Opt-in only. " + "Raises recall throughput ~2.2x on the fleet (2.6→5.6 rps)."),
|
|
4890
|
+
workers: exports_external.number().int().positive().optional().describe("uvicorn `--workers` for the recall pool (HINDSIGHT_API_WORKERS). " + "Default 4. Each worker holds its own GPU cross-encoder reranker, " + "so past ~4 workers contend for VRAM rather than adding throughput " + "on a single GPU — raise only on a bigger GPU or a CPU reranker. " + "The per-worker DB pools are auto-sized down from the pg0 " + "connection budget so N*(write+read)+60 background stays under " + "max_connections=250; a worker count that would overflow that " + "budget is rejected at launch."),
|
|
4891
|
+
db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker WRITE pool cap " + "(HINDSIGHT_API_DB_POOL_MAX_SIZE). Absent → auto-sized from the " + "worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow."),
|
|
4892
|
+
read_db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker READ pool cap " + "(HINDSIGHT_API_READ_DB_POOL_MAX_SIZE). Absent → auto-sized from " + "the worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow.")
|
|
4893
|
+
}).optional().describe("Optional recall/background container split for the hindsight " + "singleton. Off by default; see `enabled`. Provisioned by " + "`switchroom memory setup` (src/setup/hindsight-recall-pool.ts) so it " + "survives `switchroom apply` — the hand-applied topology it replaces " + "did not."),
|
|
4894
|
+
env: exports_external.record(exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()])).optional().describe("Operator overrides for switchroom's capability-gated Hindsight " + "performance defaults. Only the keys switchroom actually manages are " + "honoured (`HINDSIGHT_PERF_ENV_KEYS` in " + "src/setup/hindsight-perf-defaults.ts: RERANKER_LOCAL_FP16, " + "RERANKER_LOCAL_BATCH_SIZE, LLM_MAX_CONCURRENT, " + "RETAIN/CONSOLIDATION_LLM_MAX_CONCURRENT, LLM_STRICT_SCHEMA, " + "LLM_MAX_RETRIES, CONSOLIDATION_LLM_PARALLELISM, " + "MAX_OBSERVATIONS_PER_SCOPE, " + "RECALL_MAX_CANDIDATES_PER_SOURCE, LINK_EXPANSION_PER_ENTITY_LIMIT, " + "LINK_EXPANSION_TIMEOUT, LLM_REASONING_EFFORT, " + "RERANKER_LOCAL_BUCKET_BATCHING, RERANKER_MAX_CANDIDATES, " + "RERANKER_LOCAL_MAX_CONCURRENT, RECALL_MAX_CONCURRENT, " + "REFLECT_WALL_TIMEOUT, WORKER_CONSOLIDATION_RESERVED_SLOTS, " + "WORKER_CONSOLIDATION_SLOT_LIMIT, " + "CONSOLIDATION_MAX_MEMORIES_PER_ROUND, GRAPH_SEED_MIN_SIMILARITY, " + "LLM_SUPPORTS_MAX_ITEMS, RECENCY_DECAY_FUNCTION, " + "RECENCY_DECAY_HALFLIFE_DAYS — switchroom defaults recall's recency " + "curve to `exponential` with a 30-day half-life so a fact retained " + "today outranks a stale one, instead of upstream's near-flat " + "linear/365-day window), the override-only keys " + "switchroom manages but ships NO default for " + "(`HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS`: " + "HINDSIGHT_API_WORKER_CONSOLIDATION_BANK_PRIORITY — a per-deployment " + "`bank-pattern:priority,...` map; unset means upstream's flat " + "created_at FIFO across banks; and " + "HINDSIGHT_CE_DECISIVE_RELATIVE_GAP — the rollback knob for " + "switchroom's CE-saturation damping patch, a float; >= ~0.65 backs the " + "damping out entirely, unset means the patch's own derived gap; and " + "HINDSIGHT_API_RECENCY_DECAY_LINEAR_WINDOW_DAYS — only read when the " + "decay function is `linear`, so switchroom ships no default for it but " + "still honours an operator who flips the function back; and " + "HINDSIGHT_API_WORKER_MAX_SLOTS — the worker poller's TOTAL in-flight " + "task budget, the pool WORKER_CONSOLIDATION_RESERVED_SLOTS reserves out of; " + "unset means upstream's own default; and " + "HINDSIGHT_API_WORKER_RETAIN_RESERVED_SLOTS — the reserved slot FLOOR for the " + "retain (memory write) lane, carved from that same total; unset means " + "upstream's own 0, i.e. no floor and retain competes for the shared " + "pool; and " + "the pre-0.8.6 name HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS is still " + "accepted for every operation type and normalised to " + "..._RESERVED_SLOTS on the way in, because setting both names for " + "one type is a hard boot failure in the engine and switchroom " + "therefore emits only the canonical name; and " + "HINDSIGHT_API_SEMANTIC_MIN_SIMILARITY — the cosine-similarity floor a " + "candidate must reach to be returned by the semantic retrieval arm at " + "all (0..1); unset means upstream's own 0.3, and where it should sit " + "depends on the bank's embedding model and phrasing diversity, so " + "switchroom ships no opinion; and " + "HINDSIGHT_MCP_RECALL_BUDGET_MODE — the rollback knob for switchroom's " + "mcp-recall-token-budget image patch; `legacy` restores upstream's " + "exact pre-patch recall returns, anything else or unset is the " + "honest-envelope mode; and " + "HINDSIGHT_API_LLM_TEMPERATURE_REFLECT — upstream's own per-op reflect " + "temperature knob, made live by switchroom's reflect-temperature image " + "patch; a float, or `none` to omit the kwarg (provider default, " + "upstream's accidental pre-patch behaviour); unset means the image's " + "baked default 0.1; and " + "HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT — the background " + "half of switchroom's recall-admission split (#3660): of the " + "RECALL_MAX_CONCURRENT admission slots, at most this many may be held " + "by background consolidation recalls at once, so foreground per-turn " + "recall always keeps the remainder; must be >= 1 and strictly less " + "than RECALL_MAX_CONCURRENT or the engine refuses to boot; unset " + "means the image's derived default min(2, RECALL_MAX_CONCURRENT - 1); " + "1 biases hard toward the interactive lane while a consolidation " + "backlog drains; and " + "HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S — the rollback/tuning knob for " + "switchroom's MM-refresh-debounce image patch: the minimum seconds " + "between consolidation-triggered refreshes of one mental model; unset " + "means the image's baked 3600, 0 restores upstream's " + "refresh-every-round behaviour; explicit and cron-scheduled refreshes " + "are never debounced; and " + "HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES — the language set dateparser is " + "restricted to during temporal query analysis (upstream #3154, which " + "superseded switchroom's own temporal-language image patch at v0.9.0); " + "comma-separated; switchroom EMITS `en` on every host because upstream's " + "unset default auto-detects across 200+ locales inline on the shared " + "asyncio loop (~165x slower per call), set e.g. `en,es` for i18n parsing; " + "and " + "HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS — the max chars of query text " + "dateparser.search_dates() is handed during temporal analysis (0 = " + "unlimited), made live by switchroom's temporal-offload image patch " + "(which moved the synchronous extraction off the shared asyncio loop onto " + "a single-worker thread and bounds its input, ending multi-second loop " + "stalls on multi-KB consolidation queries); unset means the image's baked " + "2000, set 0 to restore an unbounded full scan); and " + "HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE — the Postgres " + "text-search regconfig the native BM25 arms and the search_vector index " + "write run to_tsvector/to_tsquery against; unset means upstream's " + "always-safe `english`, set `hindsight_english` to use switchroom's " + "junk-stopping config (dict + stopword file provisioned durably by the " + "image entrypoint, recall degrading to semantic-only if it is ever " + "missing); and " + "HINDSIGHT_API_BM25_MAX_QUERY_TERMS — the max number of query tokens the " + "keyword (BM25) recall arm searches for; unset means upstream's 0 = " + "unbounded, which makes a multi-KB consolidation query a disjunction " + "over hundreds of terms; set e.g. 64 to cap it, at the cost of " + "silently dropping the tail of a long query; and " + "HINDSIGHT_API_EMBEDDINGS_PROVIDER with the four " + "HINDSIGHT_API_EMBEDDINGS_ONNX_{MODEL_ID,POOLING,QUERY_PREFIX," + "PASSAGE_PREFIX} keys — the ONNX-embeddings cutover: unset keeps " + "upstream's slower `local` (PyTorch) backend, set `onnx` plus the model " + "id/pooling to run the SAME model on ONNX-CPU at a fraction of the " + "latency; the two _PREFIX keys are the query/passage affixes and are " + "set to the empty string for bge parity (vectors are byte-identical " + "between the two backends, so no re-embedding is needed) — unusually " + "for this block an EMPTY value here is honoured, not dropped, because an " + "affix-free prefix is the intended value; and the v0.9.0 knobs " + "switchroom allowlists for reach but emits no value for — " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES_{LOW,MID,HIGH} (per-recall-budget " + "rerank caps; unset/0 falls back to the global " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES switchroom does pin), " + "HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS (embedding-input truncation " + "ceiling; unset means the model's own limit), " + "HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD (entity-resolution fuzzy " + "match floor; unset means upstream's 0.15) and " + "HINDSIGHT_API_ENABLE_{TEMPORAL_RETRIEVAL,GRAPH_RETRIEVAL,RERANKING} " + "(global per-stage kill switches, all default true — the emergency lever " + "if one retrieval stage is implicated in a latency incident, at the cost " + "of recall quality); plus the " + "embedded-PostgreSQL (pg0) sizing keys switchroom manages in " + "src/setup/hindsight-pg-defaults.ts (`HINDSIGHT_PG_ENV_KEYS`: " + "SWITCHROOM_HINDSIGHT_PG_EFFECTIVE_CACHE_SIZE, " + "SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS — a postgres size string such " + "as `4GB`, or the sentinel `off` to leave pg0's own default for that " + "one knob). A value set here " + "REPLACES switchroom's default and is emitted even when the gating " + "capability is absent, so an operator can always force a knob. Other " + "`HINDSIGHT_API_*` keys are deliberately IGNORED — a blanket " + "passthrough would collide with the vars startHindsight() derives " + "itself (HINDSIGHT_API_PORT, the retain token/deadline budget).")
|
|
4889
4895
|
});
|
|
4890
4896
|
MicrosoftWorkspaceConfigSchema = exports_external.object({
|
|
4891
4897
|
microsoft_client_id: exports_external.string().min(1).optional().describe("Microsoft OAuth application (client) ID from Entra portal " + "(literal string or vault reference e.g. " + "'vault:microsoft-oauth-client-id'). OPTIONAL — omit it to use " + "switchroom's shipped default Microsoft app (zero-config). " + "Set it only to bring your own Entra app (BYO)."),
|
|
@@ -19653,6 +19659,7 @@ var HINDSIGHT_DEFAULT_LLM_SUPPORTS_MAX_ITEMS = "false";
|
|
|
19653
19659
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_FUNCTION = "exponential";
|
|
19654
19660
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_HALFLIFE_DAYS = 30;
|
|
19655
19661
|
var HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION = "pg_search";
|
|
19662
|
+
var HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES = "en";
|
|
19656
19663
|
var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
19657
19664
|
[
|
|
19658
19665
|
"HINDSIGHT_API_RECALL_MAX_CANDIDATES_PER_SOURCE",
|
|
@@ -19719,7 +19726,11 @@ var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
|
19719
19726
|
"HINDSIGHT_API_GRAPH_SEED_MIN_SIMILARITY",
|
|
19720
19727
|
String(HINDSIGHT_DEFAULT_GRAPH_SEED_MIN_SIMILARITY)
|
|
19721
19728
|
],
|
|
19722
|
-
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION]
|
|
19729
|
+
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION],
|
|
19730
|
+
[
|
|
19731
|
+
"HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES",
|
|
19732
|
+
HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES
|
|
19733
|
+
]
|
|
19723
19734
|
];
|
|
19724
19735
|
var HINDSIGHT_PERF_DEFAULTS_GPU = [
|
|
19725
19736
|
["HINDSIGHT_API_RERANKER_LOCAL_FP16", HINDSIGHT_DEFAULT_RERANKER_LOCAL_FP16],
|
|
@@ -19754,10 +19765,26 @@ var HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS = new Set([
|
|
|
19754
19765
|
"HINDSIGHT_API_RETAIN_WALL_TIMEOUT",
|
|
19755
19766
|
"HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT",
|
|
19756
19767
|
"HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S",
|
|
19757
|
-
"HINDSIGHT_API_TEMPORAL_LANGUAGES",
|
|
19758
19768
|
"HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS",
|
|
19759
19769
|
"HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE",
|
|
19760
|
-
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS"
|
|
19770
|
+
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS",
|
|
19771
|
+
"HINDSIGHT_API_EMBEDDINGS_PROVIDER",
|
|
19772
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_MODEL_ID",
|
|
19773
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_POOLING",
|
|
19774
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
19775
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX",
|
|
19776
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_LOW",
|
|
19777
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_MID",
|
|
19778
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_HIGH",
|
|
19779
|
+
"HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS",
|
|
19780
|
+
"HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD",
|
|
19781
|
+
"HINDSIGHT_API_ENABLE_TEMPORAL_RETRIEVAL",
|
|
19782
|
+
"HINDSIGHT_API_ENABLE_GRAPH_RETRIEVAL",
|
|
19783
|
+
"HINDSIGHT_API_ENABLE_RERANKING"
|
|
19784
|
+
]);
|
|
19785
|
+
var HINDSIGHT_PERF_ALLOW_EMPTY_KEYS = new Set([
|
|
19786
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
19787
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX"
|
|
19761
19788
|
]);
|
|
19762
19789
|
var HINDSIGHT_WORKER_SLOT_TYPES = [
|
|
19763
19790
|
"consolidation",
|
|
@@ -19771,6 +19798,15 @@ var HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES = new Map(HINDSIGHT_WORKER_SLOT_TYPES
|
|
|
19771
19798
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_MAX_SLOTS`,
|
|
19772
19799
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_RESERVED_SLOTS`
|
|
19773
19800
|
]));
|
|
19801
|
+
var HINDSIGHT_RECALL_POOL_ENV_KEYS = [
|
|
19802
|
+
"HINDSIGHT_API_WORKERS",
|
|
19803
|
+
"HINDSIGHT_API_WORKER_ENABLED",
|
|
19804
|
+
"HINDSIGHT_API_DATABASE_URL",
|
|
19805
|
+
"HINDSIGHT_API_DB_URL",
|
|
19806
|
+
"HINDSIGHT_API_DB_POOL_MAX_SIZE",
|
|
19807
|
+
"HINDSIGHT_API_READ_DB_POOL_MAX_SIZE",
|
|
19808
|
+
"HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP"
|
|
19809
|
+
];
|
|
19774
19810
|
var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
19775
19811
|
...[
|
|
19776
19812
|
...HINDSIGHT_PERF_DEFAULTS_UNGATED,
|
|
@@ -19779,7 +19815,8 @@ var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
|
19779
19815
|
].map(([k]) => k),
|
|
19780
19816
|
...HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS,
|
|
19781
19817
|
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.keys(),
|
|
19782
|
-
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values()
|
|
19818
|
+
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values(),
|
|
19819
|
+
...HINDSIGHT_RECALL_POOL_ENV_KEYS
|
|
19783
19820
|
]);
|
|
19784
19821
|
|
|
19785
19822
|
// src/setup/hindsight-context-budget.ts
|
|
@@ -4481,7 +4481,13 @@ var init_schema = __esm(() => {
|
|
|
4481
4481
|
reflect: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `reflect` LLM op (synthesis / mental-model " + "refresh). Emits `HINDSIGHT_API_REFLECT_LLM_*`. Absent → uses global."),
|
|
4482
4482
|
consolidation: HindsightPerOpLlmSchema.optional().describe("Per-op override for the `consolidation` LLM op (background memory " + "merge). Emits `HINDSIGHT_API_CONSOLIDATION_LLM_*`. Absent → global.")
|
|
4483
4483
|
}).optional().describe("LLM knob for the hindsight container. The flat `provider`/`model` set " + "the global default (backward-compatible); optional `retain`/`reflect`/" + "`consolidation` blocks override individual ops. All fields optional; " + "unset fields fall back to the hard-coded defaults."),
|
|
4484
|
-
|
|
4484
|
+
recall_pool: exports_external.object({
|
|
4485
|
+
enabled: exports_external.boolean().optional().describe("Turn on the recall/background WORKER SPLIT: a second container, " + "`switchroom-hindsight-recall`, serves recall/reflect only with N " + "uvicorn workers, while the existing `switchroom-hindsight` " + "container keeps pg0, the single background WorkerPoller, the " + "healthcheck and all consolidation/retain processing but moves off " + "the public port onto public+1. The public port (memory.config.url) " + "does not change — the pool binds it instead. Absent/false (the " + "default) → the single-container topology, unchanged. Opt-in only. " + "Raises recall throughput ~2.2x on the fleet (2.6→5.6 rps)."),
|
|
4486
|
+
workers: exports_external.number().int().positive().optional().describe("uvicorn `--workers` for the recall pool (HINDSIGHT_API_WORKERS). " + "Default 4. Each worker holds its own GPU cross-encoder reranker, " + "so past ~4 workers contend for VRAM rather than adding throughput " + "on a single GPU — raise only on a bigger GPU or a CPU reranker. " + "The per-worker DB pools are auto-sized down from the pg0 " + "connection budget so N*(write+read)+60 background stays under " + "max_connections=250; a worker count that would overflow that " + "budget is rejected at launch."),
|
|
4487
|
+
db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker WRITE pool cap " + "(HINDSIGHT_API_DB_POOL_MAX_SIZE). Absent → auto-sized from the " + "worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow."),
|
|
4488
|
+
read_db_pool_max_size: exports_external.number().int().positive().optional().describe("Override the per-worker READ pool cap " + "(HINDSIGHT_API_READ_DB_POOL_MAX_SIZE). Absent → auto-sized from " + "the worker count. Set this only to override the auto-sizing; the " + "connection-budget check still applies and rejects an overflow.")
|
|
4489
|
+
}).optional().describe("Optional recall/background container split for the hindsight " + "singleton. Off by default; see `enabled`. Provisioned by " + "`switchroom memory setup` (src/setup/hindsight-recall-pool.ts) so it " + "survives `switchroom apply` — the hand-applied topology it replaces " + "did not."),
|
|
4490
|
+
env: exports_external.record(exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()])).optional().describe("Operator overrides for switchroom's capability-gated Hindsight " + "performance defaults. Only the keys switchroom actually manages are " + "honoured (`HINDSIGHT_PERF_ENV_KEYS` in " + "src/setup/hindsight-perf-defaults.ts: RERANKER_LOCAL_FP16, " + "RERANKER_LOCAL_BATCH_SIZE, LLM_MAX_CONCURRENT, " + "RETAIN/CONSOLIDATION_LLM_MAX_CONCURRENT, LLM_STRICT_SCHEMA, " + "LLM_MAX_RETRIES, CONSOLIDATION_LLM_PARALLELISM, " + "MAX_OBSERVATIONS_PER_SCOPE, " + "RECALL_MAX_CANDIDATES_PER_SOURCE, LINK_EXPANSION_PER_ENTITY_LIMIT, " + "LINK_EXPANSION_TIMEOUT, LLM_REASONING_EFFORT, " + "RERANKER_LOCAL_BUCKET_BATCHING, RERANKER_MAX_CANDIDATES, " + "RERANKER_LOCAL_MAX_CONCURRENT, RECALL_MAX_CONCURRENT, " + "REFLECT_WALL_TIMEOUT, WORKER_CONSOLIDATION_RESERVED_SLOTS, " + "WORKER_CONSOLIDATION_SLOT_LIMIT, " + "CONSOLIDATION_MAX_MEMORIES_PER_ROUND, GRAPH_SEED_MIN_SIMILARITY, " + "LLM_SUPPORTS_MAX_ITEMS, RECENCY_DECAY_FUNCTION, " + "RECENCY_DECAY_HALFLIFE_DAYS — switchroom defaults recall's recency " + "curve to `exponential` with a 30-day half-life so a fact retained " + "today outranks a stale one, instead of upstream's near-flat " + "linear/365-day window), the override-only keys " + "switchroom manages but ships NO default for " + "(`HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS`: " + "HINDSIGHT_API_WORKER_CONSOLIDATION_BANK_PRIORITY — a per-deployment " + "`bank-pattern:priority,...` map; unset means upstream's flat " + "created_at FIFO across banks; and " + "HINDSIGHT_CE_DECISIVE_RELATIVE_GAP — the rollback knob for " + "switchroom's CE-saturation damping patch, a float; >= ~0.65 backs the " + "damping out entirely, unset means the patch's own derived gap; and " + "HINDSIGHT_API_RECENCY_DECAY_LINEAR_WINDOW_DAYS — only read when the " + "decay function is `linear`, so switchroom ships no default for it but " + "still honours an operator who flips the function back; and " + "HINDSIGHT_API_WORKER_MAX_SLOTS — the worker poller's TOTAL in-flight " + "task budget, the pool WORKER_CONSOLIDATION_RESERVED_SLOTS reserves out of; " + "unset means upstream's own default; and " + "HINDSIGHT_API_WORKER_RETAIN_RESERVED_SLOTS — the reserved slot FLOOR for the " + "retain (memory write) lane, carved from that same total; unset means " + "upstream's own 0, i.e. no floor and retain competes for the shared " + "pool; and " + "the pre-0.8.6 name HINDSIGHT_API_WORKER_<TYPE>_MAX_SLOTS is still " + "accepted for every operation type and normalised to " + "..._RESERVED_SLOTS on the way in, because setting both names for " + "one type is a hard boot failure in the engine and switchroom " + "therefore emits only the canonical name; and " + "HINDSIGHT_API_SEMANTIC_MIN_SIMILARITY — the cosine-similarity floor a " + "candidate must reach to be returned by the semantic retrieval arm at " + "all (0..1); unset means upstream's own 0.3, and where it should sit " + "depends on the bank's embedding model and phrasing diversity, so " + "switchroom ships no opinion; and " + "HINDSIGHT_MCP_RECALL_BUDGET_MODE — the rollback knob for switchroom's " + "mcp-recall-token-budget image patch; `legacy` restores upstream's " + "exact pre-patch recall returns, anything else or unset is the " + "honest-envelope mode; and " + "HINDSIGHT_API_LLM_TEMPERATURE_REFLECT — upstream's own per-op reflect " + "temperature knob, made live by switchroom's reflect-temperature image " + "patch; a float, or `none` to omit the kwarg (provider default, " + "upstream's accidental pre-patch behaviour); unset means the image's " + "baked default 0.1; and " + "HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT — the background " + "half of switchroom's recall-admission split (#3660): of the " + "RECALL_MAX_CONCURRENT admission slots, at most this many may be held " + "by background consolidation recalls at once, so foreground per-turn " + "recall always keeps the remainder; must be >= 1 and strictly less " + "than RECALL_MAX_CONCURRENT or the engine refuses to boot; unset " + "means the image's derived default min(2, RECALL_MAX_CONCURRENT - 1); " + "1 biases hard toward the interactive lane while a consolidation " + "backlog drains; and " + "HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S — the rollback/tuning knob for " + "switchroom's MM-refresh-debounce image patch: the minimum seconds " + "between consolidation-triggered refreshes of one mental model; unset " + "means the image's baked 3600, 0 restores upstream's " + "refresh-every-round behaviour; explicit and cron-scheduled refreshes " + "are never debounced; and " + "HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES — the language set dateparser is " + "restricted to during temporal query analysis (upstream #3154, which " + "superseded switchroom's own temporal-language image patch at v0.9.0); " + "comma-separated; switchroom EMITS `en` on every host because upstream's " + "unset default auto-detects across 200+ locales inline on the shared " + "asyncio loop (~165x slower per call), set e.g. `en,es` for i18n parsing; " + "and " + "HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS — the max chars of query text " + "dateparser.search_dates() is handed during temporal analysis (0 = " + "unlimited), made live by switchroom's temporal-offload image patch " + "(which moved the synchronous extraction off the shared asyncio loop onto " + "a single-worker thread and bounds its input, ending multi-second loop " + "stalls on multi-KB consolidation queries); unset means the image's baked " + "2000, set 0 to restore an unbounded full scan); and " + "HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE — the Postgres " + "text-search regconfig the native BM25 arms and the search_vector index " + "write run to_tsvector/to_tsquery against; unset means upstream's " + "always-safe `english`, set `hindsight_english` to use switchroom's " + "junk-stopping config (dict + stopword file provisioned durably by the " + "image entrypoint, recall degrading to semantic-only if it is ever " + "missing); and " + "HINDSIGHT_API_BM25_MAX_QUERY_TERMS — the max number of query tokens the " + "keyword (BM25) recall arm searches for; unset means upstream's 0 = " + "unbounded, which makes a multi-KB consolidation query a disjunction " + "over hundreds of terms; set e.g. 64 to cap it, at the cost of " + "silently dropping the tail of a long query; and " + "HINDSIGHT_API_EMBEDDINGS_PROVIDER with the four " + "HINDSIGHT_API_EMBEDDINGS_ONNX_{MODEL_ID,POOLING,QUERY_PREFIX," + "PASSAGE_PREFIX} keys — the ONNX-embeddings cutover: unset keeps " + "upstream's slower `local` (PyTorch) backend, set `onnx` plus the model " + "id/pooling to run the SAME model on ONNX-CPU at a fraction of the " + "latency; the two _PREFIX keys are the query/passage affixes and are " + "set to the empty string for bge parity (vectors are byte-identical " + "between the two backends, so no re-embedding is needed) — unusually " + "for this block an EMPTY value here is honoured, not dropped, because an " + "affix-free prefix is the intended value; and the v0.9.0 knobs " + "switchroom allowlists for reach but emits no value for — " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES_{LOW,MID,HIGH} (per-recall-budget " + "rerank caps; unset/0 falls back to the global " + "HINDSIGHT_API_RERANKER_MAX_CANDIDATES switchroom does pin), " + "HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS (embedding-input truncation " + "ceiling; unset means the model's own limit), " + "HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD (entity-resolution fuzzy " + "match floor; unset means upstream's 0.15) and " + "HINDSIGHT_API_ENABLE_{TEMPORAL_RETRIEVAL,GRAPH_RETRIEVAL,RERANKING} " + "(global per-stage kill switches, all default true — the emergency lever " + "if one retrieval stage is implicated in a latency incident, at the cost " + "of recall quality); plus the " + "embedded-PostgreSQL (pg0) sizing keys switchroom manages in " + "src/setup/hindsight-pg-defaults.ts (`HINDSIGHT_PG_ENV_KEYS`: " + "SWITCHROOM_HINDSIGHT_PG_EFFECTIVE_CACHE_SIZE, " + "SWITCHROOM_HINDSIGHT_PG_SHARED_BUFFERS — a postgres size string such " + "as `4GB`, or the sentinel `off` to leave pg0's own default for that " + "one knob). A value set here " + "REPLACES switchroom's default and is emitted even when the gating " + "capability is absent, so an operator can always force a knob. Other " + "`HINDSIGHT_API_*` keys are deliberately IGNORED — a blanket " + "passthrough would collide with the vars startHindsight() derives " + "itself (HINDSIGHT_API_PORT, the retain token/deadline budget).")
|
|
4485
4491
|
});
|
|
4486
4492
|
MicrosoftWorkspaceConfigSchema = exports_external.object({
|
|
4487
4493
|
microsoft_client_id: exports_external.string().min(1).optional().describe("Microsoft OAuth application (client) ID from Entra portal " + "(literal string or vault reference e.g. " + "'vault:microsoft-oauth-client-id'). OPTIONAL — omit it to use " + "switchroom's shipped default Microsoft app (zero-config). " + "Set it only to bring your own Entra app (BYO)."),
|
|
@@ -20066,6 +20072,7 @@ var HINDSIGHT_DEFAULT_LLM_SUPPORTS_MAX_ITEMS = "false";
|
|
|
20066
20072
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_FUNCTION = "exponential";
|
|
20067
20073
|
var HINDSIGHT_DEFAULT_RECENCY_DECAY_HALFLIFE_DAYS = 30;
|
|
20068
20074
|
var HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION = "pg_search";
|
|
20075
|
+
var HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES = "en";
|
|
20069
20076
|
var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
20070
20077
|
[
|
|
20071
20078
|
"HINDSIGHT_API_RECALL_MAX_CANDIDATES_PER_SOURCE",
|
|
@@ -20132,7 +20139,11 @@ var HINDSIGHT_PERF_DEFAULTS_UNGATED = [
|
|
|
20132
20139
|
"HINDSIGHT_API_GRAPH_SEED_MIN_SIMILARITY",
|
|
20133
20140
|
String(HINDSIGHT_DEFAULT_GRAPH_SEED_MIN_SIMILARITY)
|
|
20134
20141
|
],
|
|
20135
|
-
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION]
|
|
20142
|
+
["HINDSIGHT_API_TEXT_SEARCH_EXTENSION", HINDSIGHT_DEFAULT_TEXT_SEARCH_EXTENSION],
|
|
20143
|
+
[
|
|
20144
|
+
"HINDSIGHT_API_QUERY_ANALYZER_LANGUAGES",
|
|
20145
|
+
HINDSIGHT_DEFAULT_QUERY_ANALYZER_LANGUAGES
|
|
20146
|
+
]
|
|
20136
20147
|
];
|
|
20137
20148
|
var HINDSIGHT_PERF_DEFAULTS_GPU = [
|
|
20138
20149
|
["HINDSIGHT_API_RERANKER_LOCAL_FP16", HINDSIGHT_DEFAULT_RERANKER_LOCAL_FP16],
|
|
@@ -20167,10 +20178,26 @@ var HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS = new Set([
|
|
|
20167
20178
|
"HINDSIGHT_API_RETAIN_WALL_TIMEOUT",
|
|
20168
20179
|
"HINDSIGHT_API_CONSOLIDATION_RECALL_MAX_CONCURRENT",
|
|
20169
20180
|
"HINDSIGHT_MM_REFRESH_MIN_INTERVAL_S",
|
|
20170
|
-
"HINDSIGHT_API_TEMPORAL_LANGUAGES",
|
|
20171
20181
|
"HINDSIGHT_API_TEMPORAL_MAX_QUERY_CHARS",
|
|
20172
20182
|
"HINDSIGHT_API_TEXT_SEARCH_EXTENSION_NATIVE_LANGUAGE",
|
|
20173
|
-
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS"
|
|
20183
|
+
"HINDSIGHT_API_BM25_MAX_QUERY_TERMS",
|
|
20184
|
+
"HINDSIGHT_API_EMBEDDINGS_PROVIDER",
|
|
20185
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_MODEL_ID",
|
|
20186
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_POOLING",
|
|
20187
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
20188
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX",
|
|
20189
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_LOW",
|
|
20190
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_MID",
|
|
20191
|
+
"HINDSIGHT_API_RERANKER_MAX_CANDIDATES_HIGH",
|
|
20192
|
+
"HINDSIGHT_API_EMBEDDINGS_MAX_INPUT_TOKENS",
|
|
20193
|
+
"HINDSIGHT_API_ENTITY_TRGM_SIMILARITY_THRESHOLD",
|
|
20194
|
+
"HINDSIGHT_API_ENABLE_TEMPORAL_RETRIEVAL",
|
|
20195
|
+
"HINDSIGHT_API_ENABLE_GRAPH_RETRIEVAL",
|
|
20196
|
+
"HINDSIGHT_API_ENABLE_RERANKING"
|
|
20197
|
+
]);
|
|
20198
|
+
var HINDSIGHT_PERF_ALLOW_EMPTY_KEYS = new Set([
|
|
20199
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_QUERY_PREFIX",
|
|
20200
|
+
"HINDSIGHT_API_EMBEDDINGS_ONNX_PASSAGE_PREFIX"
|
|
20174
20201
|
]);
|
|
20175
20202
|
var HINDSIGHT_WORKER_SLOT_TYPES = [
|
|
20176
20203
|
"consolidation",
|
|
@@ -20184,6 +20211,15 @@ var HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES = new Map(HINDSIGHT_WORKER_SLOT_TYPES
|
|
|
20184
20211
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_MAX_SLOTS`,
|
|
20185
20212
|
`HINDSIGHT_API_WORKER_${type.toUpperCase()}_RESERVED_SLOTS`
|
|
20186
20213
|
]));
|
|
20214
|
+
var HINDSIGHT_RECALL_POOL_ENV_KEYS = [
|
|
20215
|
+
"HINDSIGHT_API_WORKERS",
|
|
20216
|
+
"HINDSIGHT_API_WORKER_ENABLED",
|
|
20217
|
+
"HINDSIGHT_API_DATABASE_URL",
|
|
20218
|
+
"HINDSIGHT_API_DB_URL",
|
|
20219
|
+
"HINDSIGHT_API_DB_POOL_MAX_SIZE",
|
|
20220
|
+
"HINDSIGHT_API_READ_DB_POOL_MAX_SIZE",
|
|
20221
|
+
"HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP"
|
|
20222
|
+
];
|
|
20187
20223
|
var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
20188
20224
|
...[
|
|
20189
20225
|
...HINDSIGHT_PERF_DEFAULTS_UNGATED,
|
|
@@ -20192,7 +20228,8 @@ var HINDSIGHT_PERF_ENV_KEYS = new Set([
|
|
|
20192
20228
|
].map(([k]) => k),
|
|
20193
20229
|
...HINDSIGHT_PERF_OVERRIDE_ONLY_KEYS,
|
|
20194
20230
|
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.keys(),
|
|
20195
|
-
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values()
|
|
20231
|
+
...HINDSIGHT_WORKER_RESERVED_SLOT_ALIASES.values(),
|
|
20232
|
+
...HINDSIGHT_RECALL_POOL_ENV_KEYS
|
|
20196
20233
|
]);
|
|
20197
20234
|
|
|
20198
20235
|
// src/setup/hindsight-context-budget.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "switchroom",
|
|
3
3
|
"//version": "NOT the release version — source of truth is the git tag, resolved by scripts/build.mjs:resolveVersion() (see CLAUDE.md > Standard release process). This field is stale by design and only the Layer-4 dev/non-tag fallback for build.mjs + src/cli/resolve-version.ts; do NOT bump it expecting a release to pick it up. npm-pack tarball naming needs a real version — do that as an UNCOMMITTED pack-time bump (see release step 6), never a committed one.",
|
|
4
|
-
"version": "0.20.
|
|
4
|
+
"version": "0.20.19",
|
|
5
5
|
"description": "Run Claude Code 24/7 on your Claude Pro/Max subscription over Telegram. Open-source alternative to OpenClaw and NanoClaw — no API keys.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -7,7 +7,7 @@ This governs HOW delegated work is done, and is **not a license to do it inline*
|
|
|
7
7
|
- **Orient before you build — validate, don't assume.** Root-cause in real source — the repo's files at HEAD, not `dist/`, caches, or generated output. If the evidence contradicts your theory, the plan, or the task description, report the contradiction rather than force-fitting it. Cite `file:line`, commits, PRs.
|
|
8
8
|
- **Infer before you ask.** Most questions are answerable from the code and history. If genuinely unsure, ask ONE question at a time, during planning; act autonomously during execution — make the reasonable call and note the assumption.
|
|
9
9
|
- **Design report before implementation, when the change is large.** Architecturally significant, cross-cutting, or ambiguous-approach work earns an evidence-grounded design report and a red-team pass before code, and ships as focused single-concern PRs.
|
|
10
|
-
- **Run `git fetch origin` first, then branch off `origin/main`.** Never branch off the working copy as-is: you do not start in the repo you are coding in, and the checkout on disk may be many commits stale. Scoped tests + lint locally; CI is the full-suite authority.
|
|
10
|
+
- **Run `git fetch origin` first, then branch off `origin/main`.** Never use the dead `mekenthompson/switchroom` fork as a remote, base, or push target. Never branch off the working copy as-is: you do not start in the repo you are coding in, and the checkout on disk may be many commits stale; remove worktrees when done, don't orphan them. Scoped tests + lint locally; CI is the full-suite authority.
|
|
11
11
|
- **Adversarial review of the diff.** Read every change as an adversary would: what breaks, what's untested, what's inconsistent.
|
|
12
12
|
- **Blockers and majors block the merge; prefer fixing lows before merge too** — ship reliable code with a slight delay over filing tech debt that never gets addressed. Fix a low now unless it's genuinely out of scope or disproportionate to the change; only then file it as a tracked follow-up (filing is mandatory, and a filed low is a commitment to fix it, not a way to forget it). Fix what blocks, then merge on CI green. Do not count review rounds and do not run a mandatory re-review pass: verifying your own fix is part of making it, not a separate step. When that fix-vs-defer call is a genuine judgment call, don't decide it silently — surface it to the user as choice / user-impact / recommendation: name the options (fix now vs defer), their user-outcome impact, and which you recommend.
|
|
13
13
|
- **Durable fixes over hack patches. Deterministic mechanisms over model-dependent behaviour** — if code can enforce a guarantee, don't leave it to prompt discipline. **Tests assert outcomes, not just code paths:** one that wouldn't fail on the bug it guards is not a test.
|
|
@@ -40,8 +40,8 @@ You are a senior software engineering agent. You write, review, debug, and archi
|
|
|
40
40
|
|
|
41
41
|
Claude Code's file-based auto-memory is disabled. Use **Hindsight** MCP tools:
|
|
42
42
|
|
|
43
|
-
- `mcp__hindsight__recall` — search past memories. Auto-fires on
|
|
44
|
-
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every
|
|
43
|
+
- `mcp__hindsight__recall` — search past memories. Auto-fires on most inbound messages — but not on bare acks, very short prompts, or stateless trivia ("what time is it"), so no memory block doesn't mean no memory.
|
|
44
|
+
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every Nth turn (N defaults to 3 but is per-agent — `config_get` shows your `memory.retain.every_n_turns`) and only processes that window plus one overlap turn, so it's prompt and cheap.
|
|
45
45
|
- `mcp__hindsight__reflect` — synthesize across memories for complex queries.
|
|
46
46
|
- `mcp__switchroom-telegram__mental_model_propose` — propose a mental model: a standing semantic summary refreshed over the bank (e.g. "codebase architecture"). Mental-model writes are operator-approved: this posts an approval card and persists on approval. Don't call `mcp__hindsight__create_mental_model`/`update_mental_model` directly (they're denied and redirected here).
|
|
47
47
|
|
|
@@ -35,11 +35,11 @@ You are operating in the **{{topicName}}** {{#if topicEmoji}}{{topicEmoji}} {{/i
|
|
|
35
35
|
|
|
36
36
|
**Claude Code's built-in file-based auto-memory is disabled for this agent.** Don't try to write `.md` files under `.claude/projects/.../memory/` or maintain a `MEMORY.md` index — that whole system is off. There's exactly one memory backend: **Hindsight**.
|
|
37
37
|
|
|
38
|
-
Hindsight is a memory bank with semantic search, knowledge graph, entity resolution, mental models, and directives. You talk to it through MCP tools
|
|
38
|
+
Hindsight is a memory bank with semantic search, knowledge graph, entity resolution, mental models, and directives. You talk to it through MCP tools — read / retain / reflect / directive are pre-approved (allow-listed, not a wildcard); the rest isn't: mental-model writes redirect (below), and destructive `delete_*` / `clear_*` ops raise an approval card.
|
|
39
39
|
|
|
40
40
|
### Day-to-day tools
|
|
41
|
-
- `mcp__hindsight__recall` — semantic-search
|
|
42
|
-
- `mcp__hindsight__retain` — store a new memory. The plugin auto-retains via the Stop hook
|
|
41
|
+
- `mcp__hindsight__recall` — semantic-search past memories. Auto-fires on MOST inbound messages via the UserPromptSubmit hook, but skips short prompts, bare acks, and trivia — a skipped turn injects nothing, so an absent memory block means nothing. Call manually for a specific query or a skipped turn needing memory.
|
|
42
|
+
- `mcp__hindsight__retain` — store a new memory. The plugin auto-retains via the Stop hook — every Nth turn (that window plus one overlap), so it usually handles capture and survives restarts. N is per-agent (default 3, some 8; `config_get` shows your `memory.retain.every_n_turns`, so don't assume 3). Call manually for significant decisions, corrections, or facts you want immediately searchable.
|
|
43
43
|
- `mcp__hindsight__reflect` — Hindsight's LLM-powered "answer this query using the bank's content + directives". Use when the user asks a question that requires synthesis across multiple past memories.
|
|
44
44
|
|
|
45
45
|
### Mental Models
|
|
@@ -74,7 +74,7 @@ Auto-retain (see above) covers routine capture; use manual `retain` for high-sig
|
|
|
74
74
|
|
|
75
75
|
Auto-recall and auto-retain feed the bank but never *synthesize* — that's on you, only if you act on these triggers. Each has a backstop:
|
|
76
76
|
|
|
77
|
-
- **Reflect instead of hand-assembling.** About to fire 2+ manual `recall`s for one answer ("summarize where Y stands")? Call `mcp__hindsight__reflect` instead. (Backstop: auto-recall injects the top hits every turn — reflect is the escalation.)
|
|
77
|
+
- **Reflect instead of hand-assembling.** About to fire 2+ manual `recall`s for one answer ("summarize where Y stands")? Call `mcp__hindsight__reflect` instead. (Backstop: auto-recall injects the top hits on every non-skipped turn — reflect is the escalation.)
|
|
78
78
|
- **Propose a model when you keep re-deriving.** Rebuilt the *same standing answer* across sessions? Propose a mental model via `mcp__switchroom-telegram__mental_model_propose(name, source_query)` (or run the `mental-model-curator` skill). Not for a one-off fact (`retain`) or identity (profile banks own that).
|
|
79
79
|
- **Merge or retire directives when they pile up.** Directives cap at `MAX_DIRECTIVES=30` active per bank — past that the lowest-priority ones drop from recall (silently — the recall hook's stderr warning is swallowed by Claude Code; the visible signals are `directives_omitted` on the recall_log row and `switchroom doctor`). When they overlap or read stale, run the `mental-model-curator` merge/retire pass (deletes stay operator-approved). (Backstop: `switchroom doctor` WARNs at >24, FAILs at >30.)
|
|
80
80
|
|
|
@@ -83,7 +83,7 @@ Auto-recall and auto-retain feed the bank but never *synthesize* — that's on y
|
|
|
83
83
|
By default, every restart starts a **fresh `claude` session** — the in-flight transcript is NOT carried over (`session_continuity.resume_mode: handoff`, the default since switchroom #362). Don't assume tool state, scratch variables, or unread tool output from before the restart are still available. What does survive:
|
|
84
84
|
|
|
85
85
|
- **Handoff briefing** — on a clean shutdown, the Stop hook writes a bounded raw transcript tail of the prior session to `.handoff.md`. On boot, start.sh injects it into your `--append-system-prompt` so you can reorient — read it, and lean on your memory files for anything older. If `.handoff.md` is missing or stale (fresh agent, or pre-Stop-hook crash), `start.sh` runs `handoff-briefing.sh` to assemble `.handoff-briefing.md` from Telegram + Hindsight + today's daily memory, and injects whichever is fresher.
|
|
86
|
-
- **Hindsight memory** — auto-recall fires on
|
|
86
|
+
- **Hindsight memory** — auto-recall fires on inbound user messages (minus skips) and surfaces memories from past sessions. Long-term facts, decisions, and mental models live here, not in the transcript.
|
|
87
87
|
- **Telegram history** — the gateway's SQLite buffer remembers every inbound/outbound message. Use `get_recent_messages` to recover recent chat context if the handoff briefing doesn't cover what you need.
|
|
88
88
|
- **Boot-resume inbound** — if your previous session was killed mid-turn, the gateway wakes you on its own with a synthesized inbound (you'll see `<channel source="resume_interrupted">` or `<channel source="resume_watchdog_timeout">`). You don't poll for this — it arrives as your first turn. Two cases, and the inbound text spells out which:
|
|
89
89
|
- **`resume_interrupted`** (operator restart / SIGTERM / crash): pick the work back up and carry it to completion. Briefly tell the user you're resuming and roughly how long ago it was interrupted — then just do it. Do NOT ask whether to resume.
|
|
@@ -39,8 +39,8 @@ You help the user stay organized, prepared, and focused on high-leverage work. Y
|
|
|
39
39
|
|
|
40
40
|
Claude Code's file-based auto-memory is disabled. Use **Hindsight** MCP tools:
|
|
41
41
|
|
|
42
|
-
- `mcp__hindsight__recall` — search past memories. Auto-fires
|
|
43
|
-
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every
|
|
42
|
+
- `mcp__hindsight__recall` — search past memories. Auto-fires on most inbound messages — but not on bare acks, very short prompts, or stateless trivia ("what time is it"), so no memory block doesn't mean no memory.
|
|
43
|
+
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every Nth turn (N defaults to 3 but is per-agent — `config_get` shows your `memory.retain.every_n_turns`) and only processes that window plus one overlap turn, so it's prompt and cheap.
|
|
44
44
|
- `mcp__switchroom-telegram__mental_model_propose` — propose a mental model: a standing semantic summary refreshed over the bank (e.g. "contacts", "active projects", "user preferences"). Mental-model writes are operator-approved: this posts an approval card and persists on approval. Don't call `mcp__hindsight__create_mental_model`/`update_mental_model` directly (they're denied and redirected here).
|
|
45
45
|
|
|
46
46
|
Save proactively: contacts and their roles, scheduling preferences, project status, decisions with rationale, communication templates. Only Hindsight memories survive compaction.
|
|
@@ -33,8 +33,8 @@ Recommend the user consult a professional for: persistent pain/injury, medical c
|
|
|
33
33
|
|
|
34
34
|
Claude Code's file-based auto-memory is disabled. Use **Hindsight** MCP tools:
|
|
35
35
|
|
|
36
|
-
- `mcp__hindsight__recall` — search past memories. Auto-fires on
|
|
37
|
-
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every
|
|
36
|
+
- `mcp__hindsight__recall` — search past memories. Auto-fires on most inbound messages — but not on bare acks, very short prompts, or stateless trivia ("what time is it"), so no memory block doesn't mean no memory.
|
|
37
|
+
- `mcp__hindsight__retain` — store important facts. Auto-retain runs in chunked mode — it fires every Nth turn (N defaults to 3 but is per-agent — `config_get` shows your `memory.retain.every_n_turns`) and only processes that window plus one overlap turn, so it's prompt and cheap.
|
|
38
38
|
- `mcp__switchroom-telegram__mental_model_propose` — propose a mental model (e.g. a "fitness profile" — a standing semantic summary refreshed over the bank). Mental-model writes are operator-approved: this posts an approval card and persists on approval. Don't call `mcp__hindsight__create_mental_model`/`update_mental_model` directly (they're denied and redirected here).
|
|
39
39
|
|
|
40
40
|
Save proactively: workout logs, goals, PRs, preferences, patterns (e.g. "poor sleep on Sundays"), injuries/limitations. Only Hindsight memories survive session compaction.
|