Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
294 changes: 259 additions & 35 deletions apps/memos-local-plugin/core/capture/capture.ts

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions apps/memos-local-plugin/core/capture/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ export interface CaptureConfig {
alphaScoring: boolean;
synthReflections: boolean;
llmConcurrency: number;
/**
* Hard cap for LLM calls made by one topic-end reflect pass. This bounds
* startup recovery / dirty-episode replay so a single large episode cannot
* generate unbounded paid requests.
*/
maxReflectLlmCalls: number;
/**
* Startup-recovered episodes are reconstructed from already-persisted
* traces. Any "orphan" during that replay is usually a matching drift, not
* genuinely missing content. Keep inserts disabled by default to avoid
* duplicating historical rows while still allowing operators to opt in.
*/
maxRecoveryOrphanInserts: number;
/**
* V7 §3.2 batched variant. Controls when reflection synthesis + α scoring
* collapse into ONE LLM call per episode instead of N per-step calls.
Expand Down
6 changes: 6 additions & 0 deletions apps/memos-local-plugin/core/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ export const DEFAULT_CONFIG: ResolvedConfig = {
// still contribute useful α values.
synthReflections: true,
llmConcurrency: 4,
// Bound topic-end reflect work so dirty startup recovery cannot replay
// a huge historical episode into thousands of paid LLM calls.
maxReflectLlmCalls: 128,
// Recovered episodes are reconstructed from persisted traces; replay
// orphans are usually matching drift, so do not insert duplicate rows.
maxRecoveryOrphanInserts: 0,
// V7 §3.2 batched variant. With "auto" we issue a single LLM call
// per episode for both reflection synth and α scoring as long as
// the episode is short enough — this collapses 2N per-step calls
Expand Down
4 changes: 4 additions & 0 deletions apps/memos-local-plugin/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ const AlgorithmSchema = Type.Object({
synthReflections: Bool(false),
/** Concurrency for α scoring + synth LLM calls (per_step mode only). */
llmConcurrency: NumberInRange(4, 1, 32),
/** Hard cap for one topic-end reflect pass, including recovery replay. */
maxReflectLlmCalls: NumberInRange(128, 0, 10_000),
/** Max orphan trace inserts allowed during startup-recovered replay. */
maxRecoveryOrphanInserts: NumberInRange(0, 0, 10_000),
/**
* V7 §3.2 batched variant. When/how to fold per-step reflection synth +
* α scoring into one episode-level LLM call:
Expand Down
Loading
Loading