akm-cli 0.9.0-beta.5 → 0.9.0-beta.51
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/CHANGELOG.md +711 -0
- package/README.md +12 -4
- package/dist/akm +38 -0
- package/dist/akm-migrate-storage +38 -0
- package/dist/assets/profiles/default.json +9 -4
- package/dist/assets/profiles/frequent.json +1 -1
- package/dist/assets/profiles/memory-focus.json +1 -1
- package/dist/assets/profiles/quick.json +1 -1
- package/dist/assets/profiles/synthesize.json +15 -0
- package/dist/assets/profiles/thorough.json +1 -1
- package/dist/assets/prompts/consolidate-system.md +23 -0
- package/dist/assets/prompts/contradiction-judge.md +33 -0
- package/dist/assets/prompts/distill-knowledge-system.md +22 -0
- package/dist/assets/prompts/distill-lesson-system.md +36 -0
- package/dist/assets/prompts/extract-session.md +6 -2
- package/dist/assets/prompts/graph-extract-system.md +1 -0
- package/dist/assets/prompts/graph-extract-user-prompt.md +1 -1
- package/dist/assets/prompts/memory-infer-system.md +1 -0
- package/dist/assets/prompts/memory-infer-user.md +5 -0
- package/dist/assets/prompts/metadata-enhance-system.md +1 -0
- package/dist/assets/prompts/procedural-system.md +44 -0
- package/dist/assets/prompts/recombine-system.md +40 -0
- package/dist/assets/prompts/staleness-detect-system.md +6 -0
- package/dist/assets/prompts/validate-summary-judge.md +1 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +38 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +38 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +39 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +40 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +43 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +38 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +43 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +40 -0
- package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +43 -0
- package/dist/assets/templates/html/health.html +281 -111
- package/dist/assets/wiki/ingest-workflow-template.md +38 -10
- package/dist/cli/parse-args.js +46 -1
- package/dist/cli/shared.js +28 -0
- package/dist/cli.js +27 -11
- package/dist/commands/agent/agent-dispatch.js +2 -2
- package/dist/commands/agent/agent-support.js +0 -7
- package/dist/commands/agent/contribute-cli.js +17 -4
- package/dist/commands/config-cli.js +18 -2
- package/dist/commands/env/child-env.js +47 -0
- package/dist/commands/env/env-cli.js +33 -26
- package/dist/commands/env/secret-cli.js +36 -22
- package/dist/commands/feedback-cli.js +15 -6
- package/dist/commands/graph/graph-cli.js +5 -13
- package/dist/commands/graph/graph.js +76 -72
- package/dist/commands/health/checks.js +49 -1
- package/dist/commands/health/html-report.js +422 -80
- package/dist/commands/health.js +386 -9
- package/dist/commands/improve/calibration.js +161 -0
- package/dist/commands/improve/consolidate/chunking.js +141 -0
- package/dist/commands/improve/consolidate/eligibility.js +81 -0
- package/dist/commands/improve/consolidate/merge.js +145 -0
- package/dist/commands/improve/consolidate/sanitize.js +231 -0
- package/dist/commands/{lint.js → improve/consolidate/types.js} +1 -1
- package/dist/commands/improve/consolidate.js +635 -660
- package/dist/commands/improve/dedup.js +482 -0
- package/dist/commands/improve/distill.js +159 -69
- package/dist/commands/improve/eligibility.js +434 -0
- package/dist/commands/improve/encoding-salience.js +205 -0
- package/dist/commands/improve/extract-cli.js +124 -2
- package/dist/commands/improve/extract-prompt.js +39 -2
- package/dist/commands/improve/extract-watch.js +140 -0
- package/dist/commands/improve/extract.js +389 -40
- package/dist/commands/improve/feedback-valence.js +54 -0
- package/dist/commands/improve/homeostatic.js +467 -0
- package/dist/commands/improve/improve-auto-accept.js +138 -7
- package/dist/commands/improve/improve-cli.js +36 -61
- package/dist/commands/improve/improve-profiles.js +14 -0
- package/dist/commands/improve/improve-result-file.js +14 -25
- package/dist/commands/improve/improve-session.js +58 -0
- package/dist/commands/improve/improve.js +485 -2498
- package/dist/commands/improve/locks.js +154 -0
- package/dist/commands/improve/loop-stages.js +1083 -0
- package/dist/commands/improve/memory/memory-contradiction-detect.js +23 -28
- package/dist/commands/improve/outcome-loop.js +256 -0
- package/dist/commands/improve/preparation.js +1966 -0
- package/dist/commands/improve/proactive-maintenance.js +115 -0
- package/dist/commands/improve/procedural.js +418 -0
- package/dist/commands/improve/recombine.js +850 -0
- package/dist/commands/improve/reflect-noise.js +0 -0
- package/dist/commands/improve/reflect.js +183 -40
- package/dist/commands/improve/salience.js +438 -0
- package/dist/commands/improve/triage.js +93 -0
- package/dist/commands/lint/agent-linter.js +19 -24
- package/dist/commands/lint/base-linter.js +173 -60
- package/dist/commands/lint/command-linter.js +19 -24
- package/dist/commands/lint/env-key-rules.js +38 -1
- package/dist/commands/lint/fact-linter.js +39 -0
- package/dist/commands/lint/index.js +31 -13
- package/dist/commands/lint/memory-linter.js +1 -1
- package/dist/commands/lint/registry.js +7 -2
- package/dist/commands/lint/task-linter.js +3 -3
- package/dist/commands/lint/workflow-linter.js +26 -1
- package/dist/commands/proposal/drain-policies.js +5 -0
- package/dist/commands/proposal/drain.js +43 -50
- package/dist/commands/proposal/proposal-cli.js +21 -31
- package/dist/commands/proposal/proposal.js +5 -0
- package/dist/commands/proposal/propose.js +7 -2
- package/dist/commands/proposal/validators/proposal-quality-validators.js +9 -8
- package/dist/commands/proposal/validators/proposals.js +189 -63
- package/dist/commands/read/curate.js +414 -94
- package/dist/commands/read/knowledge.js +6 -3
- package/dist/commands/read/search-cli.js +9 -4
- package/dist/commands/read/search.js +10 -6
- package/dist/commands/read/show.js +86 -7
- package/dist/commands/sources/init.js +49 -17
- package/dist/commands/sources/installed-stashes.js +11 -3
- package/dist/commands/sources/schema-repair.js +43 -45
- package/dist/commands/sources/self-update.js +2 -2
- package/dist/commands/sources/source-add.js +7 -3
- package/dist/commands/sources/stash-cli.js +28 -40
- package/dist/commands/sources/stash-skeleton.js +23 -8
- package/dist/commands/tasks/tasks-cli.js +19 -27
- package/dist/commands/tasks/tasks.js +39 -11
- package/dist/commands/wiki-cli.js +21 -35
- package/dist/core/asset/asset-registry.js +3 -1
- package/dist/core/asset/asset-spec.js +18 -2
- package/dist/core/asset/frontmatter.js +166 -167
- package/dist/core/asset/markdown.js +8 -0
- package/dist/core/authoring-rules.js +92 -0
- package/dist/core/common.js +0 -5
- package/dist/core/config/config-migration.js +12 -11
- package/dist/core/config/config-schema.js +340 -56
- package/dist/core/config/config-types.js +3 -3
- package/dist/core/config/config.js +28 -7
- package/dist/core/events.js +3 -7
- package/dist/core/improve-types.js +11 -8
- package/dist/core/logs-db.js +10 -66
- package/dist/core/parse.js +36 -16
- package/dist/core/paths.js +3 -0
- package/dist/core/standards/resolve-standards-context.js +87 -0
- package/dist/core/standards/resolve-stash-standards.js +99 -0
- package/dist/core/standards/resolve-type-conventions.js +66 -0
- package/dist/core/state/migrations.js +714 -0
- package/dist/core/state-db.js +525 -474
- package/dist/indexer/db/db.js +439 -247
- package/dist/indexer/db/graph-db.js +129 -86
- package/dist/indexer/ensure-index.js +152 -17
- package/dist/indexer/graph/graph-boost.js +51 -41
- package/dist/indexer/graph/graph-extraction.js +218 -4
- package/dist/indexer/index-writer-lock.js +99 -0
- package/dist/indexer/indexer.js +123 -221
- package/dist/indexer/passes/dir-staleness.js +114 -0
- package/dist/indexer/passes/memory-inference.js +13 -5
- package/dist/indexer/passes/staleness-detect.js +2 -5
- package/dist/indexer/search/db-search.js +19 -6
- package/dist/indexer/search/ranking-contributors.js +22 -0
- package/dist/indexer/search/ranking.js +4 -0
- package/dist/indexer/search/search-source.js +17 -18
- package/dist/indexer/search/semantic-status.js +4 -0
- package/dist/indexer/walk/matchers.js +9 -0
- package/dist/integrations/agent/config.js +6 -53
- package/dist/integrations/agent/index.js +2 -18
- package/dist/integrations/agent/prompts.js +75 -9
- package/dist/integrations/agent/runner-dispatch.js +59 -0
- package/dist/integrations/harnesses/claude/session-log.js +11 -1
- package/dist/integrations/harnesses/index.js +2 -3
- package/dist/integrations/harnesses/opencode/session-log.js +173 -3
- package/dist/integrations/harnesses/opencode-sdk/index.js +2 -2
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +0 -2
- package/dist/integrations/session-logs/index.js +16 -0
- package/dist/llm/client.js +45 -15
- package/dist/llm/embedder.js +42 -3
- package/dist/llm/embedders/deterministic.js +66 -0
- package/dist/llm/embedders/local.js +66 -2
- package/dist/llm/feature-gate.js +8 -4
- package/dist/llm/graph-extract.js +67 -44
- package/dist/llm/memory-infer-impl.js +138 -0
- package/dist/llm/memory-infer.js +1 -127
- package/dist/llm/metadata-enhance.js +44 -31
- package/dist/llm/structured-call.js +49 -0
- package/dist/migrate-storage-node.mjs +8 -0
- package/dist/output/context.js +5 -5
- package/dist/output/renderers.js +74 -2
- package/dist/output/shapes/curate.js +14 -2
- package/dist/output/shapes/passthrough.js +0 -1
- package/dist/output/text/helpers.js +16 -1
- package/dist/registry/providers/skills-sh.js +21 -147
- package/dist/registry/providers/static-index.js +15 -157
- package/dist/registry/resolve.js +22 -9
- package/dist/runtime.js +25 -1
- package/dist/scripts/migrate-storage.js +2617 -1961
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +759 -510
- package/dist/setup/setup.js +29 -8
- package/dist/sources/include.js +6 -2
- package/dist/sources/providers/filesystem.js +0 -1
- package/dist/sources/providers/git-install.js +210 -0
- package/dist/sources/providers/git-provider.js +234 -0
- package/dist/sources/providers/git-stash.js +248 -0
- package/dist/sources/providers/git.js +10 -661
- package/dist/sources/providers/npm.js +2 -6
- package/dist/sources/providers/provider-utils.js +13 -7
- package/dist/sources/providers/sync-from-ref.js +9 -1
- package/dist/sources/providers/tar-utils.js +16 -8
- package/dist/sources/providers/website.js +9 -5
- package/dist/sources/website-ingest.js +187 -29
- package/dist/sources/wiki-fetchers/registry.js +53 -0
- package/dist/sources/wiki-fetchers/youtube.js +239 -0
- package/dist/storage/database.js +45 -10
- package/dist/storage/managed-db.js +82 -0
- package/dist/storage/repositories/registry-cache.js +92 -0
- package/dist/storage/sqlite-pragmas.js +146 -0
- package/dist/tasks/backends/cron.js +1 -1
- package/dist/tasks/backends/launchd.js +1 -1
- package/dist/tasks/backends/schtasks.js +1 -1
- package/dist/tasks/{resolveAkmBin.js → resolve-akm-bin.js} +2 -2
- package/dist/tasks/runner.js +5 -13
- package/dist/text-import-hook.mjs +0 -0
- package/dist/wiki/wiki.js +37 -0
- package/dist/workflows/db.js +3 -4
- package/dist/workflows/runtime/runs.js +1 -117
- package/dist/workflows/runtime/workflow-asset-loader.js +125 -0
- package/dist/workflows/validate-summary.js +2 -7
- package/docs/data-and-telemetry.md +3 -2
- package/docs/migration/release-notes/0.9.0.md +39 -0
- package/package.json +13 -11
- package/dist/commands/db-cli.js +0 -23
- package/dist/indexer/db/db-backup.js +0 -376
|
@@ -22,8 +22,14 @@
|
|
|
22
22
|
* - Two exceptions (hard-rejected): openviking source type and legacy
|
|
23
23
|
* `stashes[]` key. Both have explicit migration paths; silently dropping
|
|
24
24
|
* would mask user data loss.
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
25
|
+
* - UNKNOWN-KEY POLICY: object schemas use passthrough (unknown keys are
|
|
26
|
+
* preserved and ignored, NOT rejected). akm runs across multiple installed
|
|
27
|
+
* versions sharing one config.json; a newer version writes keys an older
|
|
28
|
+
* version's schema doesn't know yet, so hard-rejecting unknown keys turned
|
|
29
|
+
* benign version skew into `INVALID_CONFIG_FILE` failures. Known keys are
|
|
30
|
+
* still type-checked; passthrough preserves unknown keys across a
|
|
31
|
+
* load→save round trip so an older reader never strips a newer writer's
|
|
32
|
+
* settings. (Replaced the prior strict-mode object walls.)
|
|
27
33
|
* - `defaultWriteTarget` resolution and similar cross-field invariants are
|
|
28
34
|
* enforced at save time via `superRefine` on the top-level schema.
|
|
29
35
|
*/
|
|
@@ -50,7 +56,7 @@ const LlmCapabilitiesSchema = z
|
|
|
50
56
|
.object({
|
|
51
57
|
structuredOutput: z.boolean().optional(),
|
|
52
58
|
})
|
|
53
|
-
.
|
|
59
|
+
.passthrough();
|
|
54
60
|
/**
|
|
55
61
|
* Connection config used for both top-level `llm` (after migration) and
|
|
56
62
|
* `profiles.llm[*]`. `model` is required at schema level — partial entries
|
|
@@ -75,15 +81,15 @@ export const LlmConnectionConfigSchema = z
|
|
|
75
81
|
judgeModel: z.string().min(1).optional(),
|
|
76
82
|
enableThinking: z.boolean().optional(),
|
|
77
83
|
})
|
|
78
|
-
.
|
|
84
|
+
.passthrough();
|
|
79
85
|
export const LlmProfileConfigSchema = LlmConnectionConfigSchema.extend({
|
|
80
86
|
supportsJsonSchema: z.boolean().optional(),
|
|
81
|
-
}).
|
|
87
|
+
}).passthrough();
|
|
82
88
|
const EmbeddingOllamaOptionsSchema = z
|
|
83
89
|
.object({
|
|
84
90
|
num_ctx: positiveInt.optional(),
|
|
85
91
|
})
|
|
86
|
-
.
|
|
92
|
+
.passthrough();
|
|
87
93
|
/**
|
|
88
94
|
* Embedding connection config. Both `endpoint` and `model` are optional:
|
|
89
95
|
* - Remote: provide `endpoint` (http/https URL) + `model`.
|
|
@@ -107,7 +113,7 @@ export const EmbeddingConnectionConfigSchema = z
|
|
|
107
113
|
contextLength: positiveInt.optional(),
|
|
108
114
|
ollamaOptions: EmbeddingOllamaOptionsSchema.optional(),
|
|
109
115
|
})
|
|
110
|
-
.
|
|
116
|
+
.passthrough();
|
|
111
117
|
// ── Agent profiles ──────────────────────────────────────────────────────────
|
|
112
118
|
// Derives from the canonical VALID_HARNESS_IDS (#565) so the Zod gate cannot
|
|
113
119
|
// drift from the TS union / parse check / setup detection.
|
|
@@ -119,8 +125,12 @@ export const AgentProfileConfigSchema = z
|
|
|
119
125
|
args: z.array(z.string()).optional(),
|
|
120
126
|
workspace: z.string().min(1).optional(),
|
|
121
127
|
model: z.string().min(1).optional(),
|
|
128
|
+
// Per-call timeout (ms) used when a command does not pass an explicit
|
|
129
|
+
// timeout (e.g. `akm wiki ingest` without `--timeout-ms`). null = no
|
|
130
|
+
// timeout. Honored by resolveAgentProfile (integrations/agent/config.ts).
|
|
131
|
+
timeoutMs: z.union([positiveInt, z.null()]).optional(),
|
|
122
132
|
})
|
|
123
|
-
.
|
|
133
|
+
.passthrough();
|
|
124
134
|
// ── Improve profile / process ──────────────────────────────────────────────
|
|
125
135
|
export const ImproveProcessConfigSchema = z
|
|
126
136
|
.object({
|
|
@@ -133,8 +143,36 @@ export const ImproveProcessConfigSchema = z
|
|
|
133
143
|
// consolidation pass skips entirely (emits `pool_below_min_size`). 0 disables
|
|
134
144
|
// the guard. Only meaningful on the `consolidate` process. Default 500.
|
|
135
145
|
minPoolSize: z.number().int().min(0).optional(),
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
// Consolidate process: deterministic near-duplicate dedup pre-pass (#617).
|
|
147
|
+
// A cheap, no-LLM fast path that collapses obvious duplicates (`.derived`
|
|
148
|
+
// origin pairs + content twins) before the LLM consolidation. Default OFF
|
|
149
|
+
// — when absent the consolidate pass behaves byte-identically to today.
|
|
150
|
+
// `cosineThreshold` is a strict floor in [0, 1] (default 0.97) for the
|
|
151
|
+
// optional embedding-similarity match; exact normalized content-hash
|
|
152
|
+
// equality always collapses regardless of the threshold. Only meaningful
|
|
153
|
+
// on the `consolidate` process.
|
|
154
|
+
dedup: z
|
|
155
|
+
.object({
|
|
156
|
+
enabled: z.boolean().optional(),
|
|
157
|
+
cosineThreshold: z.number().min(0).max(1).optional(),
|
|
158
|
+
// WS-3a: maximum pool size for the O(n²) cosine-similarity twin compare.
|
|
159
|
+
// Only the first `cosineCandidateLimit` memories are cosine-compared;
|
|
160
|
+
// exact-hash matches still run over the full pool. Default 500. Raise
|
|
161
|
+
// with care — cost is O(n²).
|
|
162
|
+
cosineCandidateLimit: z.number().int().positive().optional(),
|
|
163
|
+
})
|
|
164
|
+
.passthrough()
|
|
165
|
+
.optional(),
|
|
166
|
+
// Consolidate process: judged-state cache (#581). When enabled, a memory
|
|
167
|
+
// whose current content hash equals its cached judged hash is SKIPPED from
|
|
168
|
+
// the LLM pool (judged-unchanged → no re-judge), letting one run sweep the
|
|
169
|
+
// whole corpus at O(changed/new) cost instead of narrowing to a recent
|
|
170
|
+
// time-window slice. Default OFF — when absent the consolidate pass behaves
|
|
171
|
+
// byte-identically to today (the incrementalSince path is unaffected). Only
|
|
172
|
+
// meaningful on the `consolidate` process.
|
|
173
|
+
judgedCache: z.object({ enabled: z.boolean().optional() }).passthrough().optional(),
|
|
174
|
+
qualityGate: z.object({ enabled: z.boolean().optional() }).passthrough().optional(),
|
|
175
|
+
contradictionDetection: z.object({ enabled: z.boolean().optional() }).passthrough().optional(),
|
|
138
176
|
// Extract process config (only meaningful for extract process)
|
|
139
177
|
defaultSince: z.string().min(1).optional(),
|
|
140
178
|
maxTotalChars: positiveInt.optional(),
|
|
@@ -144,18 +182,199 @@ export const ImproveProcessConfigSchema = z
|
|
|
144
182
|
// on the `extract` process.
|
|
145
183
|
minContentChars: z.number().int().min(0).optional(),
|
|
146
184
|
maxChunkSize: z.number().int().min(1).max(50).optional(),
|
|
185
|
+
// Consolidate process: narrow candidate pool to memories modified within
|
|
186
|
+
// this duration window plus their graph neighbours. Only meaningful on
|
|
187
|
+
// the `consolidate` process. Absent = full-pool sweep.
|
|
188
|
+
incrementalSince: z.string().optional(),
|
|
189
|
+
// Consolidate process: hard cap on memories processed per pass.
|
|
190
|
+
// Reflect/distill: max refs processed (same as profile-level `limit`).
|
|
191
|
+
limit: positiveInt.optional(),
|
|
192
|
+
// Consolidate process: graph neighbours per changed memory during
|
|
193
|
+
// incremental consolidation. Default 5. Only meaningful with incrementalSince.
|
|
194
|
+
neighborsPerChanged: z.number().int().min(1).optional(),
|
|
195
|
+
// Distill process: skip distill entirely when reflect produced zero planned refs.
|
|
196
|
+
requirePlannedRefs: z.boolean().optional(),
|
|
197
|
+
// proactiveMaintenance process (Layer 2): staleness gate + rotation cooldown
|
|
198
|
+
// in days (default 30). Only meaningful on `proactiveMaintenance`.
|
|
199
|
+
dueDays: z.number().int().min(0).optional(),
|
|
200
|
+
// proactiveMaintenance process: top-N bound per run (default 25). Alias for
|
|
201
|
+
// `limit`; `maxPerRun` wins when both are set.
|
|
202
|
+
maxPerRun: positiveInt.optional(),
|
|
203
|
+
// graphExtraction process (#624 P2): when set, rank eligible files by
|
|
204
|
+
// utility_scores DESC and process only the top-N per run (incremental
|
|
205
|
+
// high-signal-first sweep). Unset = process all eligible (current
|
|
206
|
+
// behavior). Only meaningful on `graphExtraction`.
|
|
207
|
+
topN: positiveInt.optional(),
|
|
208
|
+
// graphExtraction process: full-corpus scan. When true, graph extraction
|
|
209
|
+
// runs on ALL stash files instead of only files touched by actionable refs
|
|
210
|
+
// in the current run. Used by the `graph-refresh` built-in profile / a
|
|
211
|
+
// scheduled weekly task. Only meaningful on `graphExtraction`.
|
|
212
|
+
fullScan: z.boolean().optional(),
|
|
213
|
+
// #626 — extract process: pre-LLM heuristic triage gate. When enabled, a
|
|
214
|
+
// deterministic scorer decides BEFORE the extraction LLM call whether a
|
|
215
|
+
// session carries enough signal to be worth extracting; low-signal sessions
|
|
216
|
+
// are skipped at zero LLM cost. Default OFF. Only meaningful on `extract`.
|
|
217
|
+
// `minScore` is the minimum total heuristic score to PASS (default 2).
|
|
218
|
+
triage: z
|
|
219
|
+
.object({
|
|
220
|
+
enabled: z.boolean().optional(),
|
|
221
|
+
minScore: z.number().min(0).optional(),
|
|
222
|
+
})
|
|
223
|
+
.passthrough()
|
|
224
|
+
.optional(),
|
|
225
|
+
// MemoryInference process: minimum pending memory count to run the pass.
|
|
226
|
+
minPendingCount: z.number().int().min(0).optional(),
|
|
147
227
|
// Extract process: minimum number of new (unseen, in-window) candidate
|
|
148
228
|
// sessions below which the extract pass skips entirely (emits an
|
|
149
229
|
// `improve_skipped` event with `reason: "below_min_new_sessions"`). 0
|
|
150
230
|
// disables the guard. Only meaningful on the `extract` process. Default 0
|
|
151
231
|
// (disabled) so existing behaviour is preserved; only opted-in profiles set it.
|
|
152
232
|
minNewSessions: z.number().int().min(0).optional(),
|
|
233
|
+
// Extract process: cap on NEW sessions processed (LLM-called) per run; the
|
|
234
|
+
// rest roll to the next run (still unseen). 0 disables. Absent = default 25.
|
|
235
|
+
maxSessionsPerRun: z.number().int().min(0).optional(),
|
|
153
236
|
// #561 — index agent sessions as a searchable `session` asset (extract
|
|
154
237
|
// process). Absent = on-when-an-LLM-is-available (fail-open when offline).
|
|
238
|
+
// COST: when on, each processed session makes a SECOND LLM call (the session
|
|
239
|
+
// summary) on top of the extraction call — i.e. ~2 LLM calls/session. Set to
|
|
240
|
+
// false to halve per-session extract cost at the price of unsearchable
|
|
241
|
+
// sessions. (Unchanged/skip sessions still cost zero — the content-hash
|
|
242
|
+
// ledger gates both calls upstream.)
|
|
155
243
|
indexSessions: z.boolean().optional(),
|
|
156
244
|
// #561 — minimum session duration in minutes for session indexing. 0
|
|
157
245
|
// disables the gate. Absent = default 5. Only meaningful on `extract`.
|
|
158
246
|
minSessionDuration: z.number().min(0).optional(),
|
|
247
|
+
// Consolidate process: fallback p90 wall-clock time per consolidation chunk
|
|
248
|
+
// in seconds, used for cold-start budget estimation when no telemetry
|
|
249
|
+
// history exists. The actual p90 is derived from observed run durations
|
|
250
|
+
// once sufficient history accumulates; this value is only used on the very
|
|
251
|
+
// first run. Default 30 s. Only meaningful on the `consolidate` process.
|
|
252
|
+
p90ChunkSecondsDefault: z.number().finite().positive().optional(),
|
|
253
|
+
// WS-3b: Homeostatic demotion (step 0a). Before any LLM merge, demote
|
|
254
|
+
// retrievalSalience for stale/low-value assets so the merge pool is bounded
|
|
255
|
+
// and high-SNR. Demotion is state.db-only (file content untouched);
|
|
256
|
+
// re-promotable on re-retrieval. Default OFF. Only meaningful on the
|
|
257
|
+
// `consolidate` process.
|
|
258
|
+
homeostaticDemotion: z
|
|
259
|
+
.object({
|
|
260
|
+
enabled: z.boolean().optional(),
|
|
261
|
+
// Minimum days since last retrieval to consider an asset stale (default 30).
|
|
262
|
+
staleDays: z.number().int().min(0).optional(),
|
|
263
|
+
// Demotion factor: multiply retrievalSalience by this when stale (default 0.5).
|
|
264
|
+
demotionFactor: z.number().min(0).max(1).optional(),
|
|
265
|
+
})
|
|
266
|
+
.passthrough()
|
|
267
|
+
.optional(),
|
|
268
|
+
// WS-3b: Schema-similarity gate (step 0b). At intake, if a new candidate's
|
|
269
|
+
// body embedding is within epsilon of an existing derived-layer lesson/knowledge
|
|
270
|
+
// node, mark it schema-consistent and lower its priority. Default OFF.
|
|
271
|
+
// Only meaningful on the `consolidate` and `extract` processes.
|
|
272
|
+
schemaSimilarity: z
|
|
273
|
+
.object({
|
|
274
|
+
enabled: z.boolean().optional(),
|
|
275
|
+
// Epsilon: cosine similarity threshold above which a candidate is schema-consistent
|
|
276
|
+
// (default 0.85 — looser than dedup's 0.97 since we want to catch conceptual overlap).
|
|
277
|
+
epsilon: z.number().min(0).max(1).optional(),
|
|
278
|
+
// Multiplicative factor applied to candidate confidence when schema-consistent.
|
|
279
|
+
// Default 0.5 — halves the confidence so schema-consistent candidates are less likely
|
|
280
|
+
// to pass the quality gate and create redundant stash entries.
|
|
281
|
+
confidencePenalty: z.number().min(0).max(1).optional(),
|
|
282
|
+
})
|
|
283
|
+
.passthrough()
|
|
284
|
+
.optional(),
|
|
285
|
+
// WS-3b: Hot-probation intake buffer (step 0c, #604). New system-generated
|
|
286
|
+
// extractions enter captureMode: hot-probation and spend ONE consolidation
|
|
287
|
+
// cycle in probation. Dedup + quality second-pass runs before promotion.
|
|
288
|
+
// Default OFF. Only meaningful on the `extract` process.
|
|
289
|
+
hotProbation: z
|
|
290
|
+
.object({
|
|
291
|
+
enabled: z.boolean().optional(),
|
|
292
|
+
})
|
|
293
|
+
.passthrough()
|
|
294
|
+
.optional(),
|
|
295
|
+
// WS-3b: Anti-collapse guards (step 8). Prevents the consolidation pipeline
|
|
296
|
+
// from collapsing too aggressively and losing diversity.
|
|
297
|
+
// - maxGeneration: refuse to merge two assets both above this generation (default 2).
|
|
298
|
+
// - lexicalDiversityCheck: low n-gram diversity ⇒ raise merge threshold.
|
|
299
|
+
// - randomClusterFraction: occasional random (non-similar) cluster in pool (default 0.05).
|
|
300
|
+
// Default OFF. Only meaningful on the `consolidate` process.
|
|
301
|
+
antiCollapse: z
|
|
302
|
+
.object({
|
|
303
|
+
enabled: z.boolean().optional(),
|
|
304
|
+
maxGeneration: z.number().int().min(1).optional(),
|
|
305
|
+
lexicalDiversityCheck: z.boolean().optional(),
|
|
306
|
+
randomClusterFraction: z.number().min(0).max(1).optional(),
|
|
307
|
+
})
|
|
308
|
+
.passthrough()
|
|
309
|
+
.optional(),
|
|
310
|
+
// WS-3b: CLS (Complementary Learning System) interleaving (step 9).
|
|
311
|
+
// distill/memoryInference prompts include embedding-retrieved existing adjacent
|
|
312
|
+
// lessons/knowledge to prevent catastrophic interference with prior generalizations.
|
|
313
|
+
// Default OFF. Only meaningful on `distill` and `memoryInference` processes.
|
|
314
|
+
cls: z
|
|
315
|
+
.object({
|
|
316
|
+
enabled: z.boolean().optional(),
|
|
317
|
+
// Number of adjacent lessons/knowledge to include in prompts (default 3).
|
|
318
|
+
adjacentCount: z.number().int().min(1).optional(),
|
|
319
|
+
})
|
|
320
|
+
.passthrough()
|
|
321
|
+
.optional(),
|
|
322
|
+
// WS-3b: Distill→source fidelity check (step 10). After a distill proposal,
|
|
323
|
+
// check it against its cited source memories; a contradiction flag forces
|
|
324
|
+
// human review. Default OFF. Only meaningful on `distill` process.
|
|
325
|
+
fidelityCheck: z
|
|
326
|
+
.object({
|
|
327
|
+
enabled: z.boolean().optional(),
|
|
328
|
+
})
|
|
329
|
+
.passthrough()
|
|
330
|
+
.optional(),
|
|
331
|
+
// #609 — recombine process: minimum related-memory cluster size before an
|
|
332
|
+
// LLM generalization call. Default 3. Only meaningful on `recombine`.
|
|
333
|
+
minClusterSize: z.number().int().min(2).optional(),
|
|
334
|
+
// #609 — recombine process: hard cap on clusters processed per run (one
|
|
335
|
+
// bounded LLM call each). Default 5. Only meaningful on `recombine`.
|
|
336
|
+
maxClustersPerRun: positiveInt.optional(),
|
|
337
|
+
// #632 — recombine process: max members a cluster may contain before it is
|
|
338
|
+
// SKIPPED (drops bland over-broad buckets). When set, largest-first ranking
|
|
339
|
+
// no longer starves tighter clusters. Default UNSET = no cap. Only
|
|
340
|
+
// meaningful on `recombine`.
|
|
341
|
+
maxClusterSize: positiveInt.optional(),
|
|
342
|
+
// #632 — recombine process: tag values that must never form a tag cluster
|
|
343
|
+
// (generic project-wide tags). Default UNSET/[]. Only meaningful on
|
|
344
|
+
// `recombine`.
|
|
345
|
+
excludeTags: z.array(z.string().min(1)).optional(),
|
|
346
|
+
// #632 — recombine process: entity_norm values that must never form an
|
|
347
|
+
// entity cluster (user counterpart to the built-in generic-entity filter).
|
|
348
|
+
// Default UNSET/[]. Only meaningful on `recombine`.
|
|
349
|
+
excludeEntities: z.array(z.string().min(1)).optional(),
|
|
350
|
+
// #609 — recombine process: relatedness signal used to form clusters
|
|
351
|
+
// (tags | graph | both). Clustering is by relatedness, never embedding
|
|
352
|
+
// similarity. Default "both" (#632). Only meaningful on `recombine`.
|
|
353
|
+
relatednessSource: z.enum(["tags", "graph", "both"]).optional(),
|
|
354
|
+
// #609 — recombine process: consecutive re-inductions required before a
|
|
355
|
+
// hypothesis is promoted to a lesson. Default 2. Only meaningful on
|
|
356
|
+
// `recombine`.
|
|
357
|
+
confirmThreshold: z.number().int().min(1).optional(),
|
|
358
|
+
// #615 — procedural process: minimum number of distinct assets sharing the
|
|
359
|
+
// same successful normalized ordered-action sequence before it is compiled
|
|
360
|
+
// into a workflow proposal. Default 3. Only meaningful on `procedural`.
|
|
361
|
+
minRecurrence: z.number().int().min(2).optional(),
|
|
362
|
+
// #615 — procedural process: hard cap on workflow proposals emitted per run
|
|
363
|
+
// (one bounded LLM call each). Default 3. Only meaningful on `procedural`.
|
|
364
|
+
maxProposalsPerRun: positiveInt.optional(),
|
|
365
|
+
// #615 — procedural process: asset type a compiled sequence is emitted as.
|
|
366
|
+
// Reserved; v1 always emits "workflow". Only meaningful on `procedural`.
|
|
367
|
+
emitAs: z.enum(["workflow", "skill"]).optional(),
|
|
368
|
+
// #639 — semantic value-floor filter for the `reflect` process. When
|
|
369
|
+
// enabled, proposals classified as "low-value" by the deterministic noise
|
|
370
|
+
// gate are deferred. DEFAULT OFF (absent / { enabled: false } = pre-#639
|
|
371
|
+
// byte-identical behaviour). Only meaningful on the `reflect` process.
|
|
372
|
+
lowValueFilter: z.object({ enabled: z.boolean().optional() }).passthrough().optional(),
|
|
373
|
+
// #641 — procedural-aware floor for the `extract` process triage gate.
|
|
374
|
+
// When true, a session must have markers>=1 OR editCommit>=0.5 to pass, even
|
|
375
|
+
// if score>=minScore. DEFAULT OFF (absent/false = pre-#641 byte-identical).
|
|
376
|
+
// Only meaningful on the `extract` process when triage is also enabled.
|
|
377
|
+
proceduralAwareFloor: z.boolean().optional(),
|
|
159
378
|
// Triage process config (only meaningful for the `triage` process)
|
|
160
379
|
applyMode: z.enum(["queue", "promote"]).optional(),
|
|
161
380
|
policy: z.string().min(1).optional(),
|
|
@@ -168,10 +387,10 @@ export const ImproveProcessConfigSchema = z
|
|
|
168
387
|
profile: z.string().min(1).optional(),
|
|
169
388
|
timeoutMs: z.union([positiveInt, z.null()]).optional(),
|
|
170
389
|
})
|
|
171
|
-
.
|
|
390
|
+
.passthrough()
|
|
172
391
|
.optional(),
|
|
173
392
|
})
|
|
174
|
-
.
|
|
393
|
+
.passthrough();
|
|
175
394
|
const ImproveProfileProcessesSchema = z
|
|
176
395
|
.object({
|
|
177
396
|
reflect: ImproveProcessConfigSchema.optional(),
|
|
@@ -179,40 +398,27 @@ const ImproveProfileProcessesSchema = z
|
|
|
179
398
|
consolidate: ImproveProcessConfigSchema.optional(),
|
|
180
399
|
memoryInference: ImproveProcessConfigSchema.optional(),
|
|
181
400
|
graphExtraction: ImproveProcessConfigSchema.optional(),
|
|
401
|
+
extract: ImproveProcessConfigSchema.optional(),
|
|
182
402
|
validation: ImproveProcessConfigSchema.optional(),
|
|
183
403
|
triage: ImproveProcessConfigSchema.optional(),
|
|
404
|
+
proactiveMaintenance: ImproveProcessConfigSchema.optional(),
|
|
405
|
+
recombine: ImproveProcessConfigSchema.optional(),
|
|
406
|
+
procedural: ImproveProcessConfigSchema.optional(),
|
|
184
407
|
})
|
|
185
408
|
.passthrough()
|
|
186
409
|
.superRefine((val, ctx) => {
|
|
187
410
|
// 0.8.0 removed the duplicated `feedbackDistillation` process key — it was
|
|
188
|
-
// a thin wrapper around `processes.distill.enabled`.
|
|
189
|
-
|
|
190
|
-
|
|
411
|
+
// a thin wrapper around `processes.distill.enabled`. Keep the migration
|
|
412
|
+
// hint so a stale config gets an actionable message rather than silently
|
|
413
|
+
// doing nothing. All OTHER unknown process keys are tolerated (passthrough)
|
|
414
|
+
// — see the unknown-key policy in this file's header. Hard-rejecting them
|
|
415
|
+
// turned benign cross-version skew into INVALID_CONFIG_FILE failures.
|
|
416
|
+
if ("feedbackDistillation" in val) {
|
|
191
417
|
ctx.addIssue({
|
|
192
418
|
code: z.ZodIssueCode.custom,
|
|
193
419
|
message: "feedbackDistillation was removed in 0.8.0 — use processes.distill.enabled instead. " +
|
|
194
420
|
"It now controls both the orchestration gate and the LLM-call gate.",
|
|
195
421
|
});
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const allowed = new Set([
|
|
199
|
-
"reflect",
|
|
200
|
-
"distill",
|
|
201
|
-
"consolidate",
|
|
202
|
-
"memoryInference",
|
|
203
|
-
"graphExtraction",
|
|
204
|
-
"validation",
|
|
205
|
-
"extract",
|
|
206
|
-
"triage",
|
|
207
|
-
]);
|
|
208
|
-
for (const k of Object.keys(raw)) {
|
|
209
|
-
if (!allowed.has(k)) {
|
|
210
|
-
ctx.addIssue({
|
|
211
|
-
code: z.ZodIssueCode.unrecognized_keys,
|
|
212
|
-
keys: [k],
|
|
213
|
-
message: `Unrecognized improve process key: "${k}".`,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
422
|
}
|
|
217
423
|
});
|
|
218
424
|
export const ImproveProfileConfigSchema = z
|
|
@@ -221,16 +427,26 @@ export const ImproveProfileConfigSchema = z
|
|
|
221
427
|
processes: ImproveProfileProcessesSchema.optional(),
|
|
222
428
|
autoAccept: nonNegativeNumber.optional(),
|
|
223
429
|
limit: positiveInt.optional(),
|
|
430
|
+
// #616 — bounded multi-cycle phasing. Number of prep->loop->post-loop
|
|
431
|
+
// cycles per run. positiveInt forbids 0/negative. DEFAULT 1 => byte-identical
|
|
432
|
+
// single-pass behavior.
|
|
433
|
+
maxCycles: positiveInt.optional(),
|
|
434
|
+
// #614 — symmetric valence weighting in the eligibility sort. When true,
|
|
435
|
+
// the attention term becomes |valence| MAGNITUDE so BOTH strong positive
|
|
436
|
+
// and strong negative feedback drive attention (utility stays dominant) and
|
|
437
|
+
// strong-signed assets are routed to a fix/reinforce lane. DEFAULT OFF —
|
|
438
|
+
// false/absent preserves the legacy negative-only ranking byte-for-byte.
|
|
439
|
+
symmetricValence: z.boolean().optional(),
|
|
224
440
|
sync: z
|
|
225
441
|
.object({
|
|
226
442
|
enabled: z.boolean().optional(),
|
|
227
443
|
push: z.boolean().optional(),
|
|
228
444
|
message: z.string().min(1).optional(),
|
|
229
445
|
})
|
|
230
|
-
.
|
|
446
|
+
.passthrough()
|
|
231
447
|
.optional(),
|
|
232
448
|
})
|
|
233
|
-
.
|
|
449
|
+
.passthrough();
|
|
234
450
|
// ── Profiles / defaults ────────────────────────────────────────────────────
|
|
235
451
|
export const ProfilesSchema = z
|
|
236
452
|
.object({
|
|
@@ -238,14 +454,14 @@ export const ProfilesSchema = z
|
|
|
238
454
|
agent: z.record(z.string(), AgentProfileConfigSchema).optional(),
|
|
239
455
|
improve: z.record(z.string(), ImproveProfileConfigSchema).optional(),
|
|
240
456
|
})
|
|
241
|
-
.
|
|
457
|
+
.passthrough();
|
|
242
458
|
export const DefaultsSchema = z
|
|
243
459
|
.object({
|
|
244
460
|
llm: z.string().min(1).optional(),
|
|
245
461
|
agent: z.string().min(1).optional(),
|
|
246
462
|
improve: z.string().min(1).optional(),
|
|
247
463
|
})
|
|
248
|
-
.
|
|
464
|
+
.passthrough();
|
|
249
465
|
// ── Sources / registries / installed ────────────────────────────────────────
|
|
250
466
|
const SourceConfigEntryOptionsSchema = z
|
|
251
467
|
.object({
|
|
@@ -269,7 +485,7 @@ export const SourceConfigEntrySchema = z
|
|
|
269
485
|
options: SourceConfigEntryOptionsSchema.optional(),
|
|
270
486
|
wikiName: z.string().min(1).optional(),
|
|
271
487
|
})
|
|
272
|
-
.
|
|
488
|
+
.passthrough()
|
|
273
489
|
.superRefine((entry, ctx) => {
|
|
274
490
|
if (entry.writable === true && (entry.type === "website" || entry.type === "npm")) {
|
|
275
491
|
ctx.addIssue({
|
|
@@ -288,7 +504,7 @@ export const RegistryConfigEntrySchema = z
|
|
|
288
504
|
provider: z.string().min(1).optional(),
|
|
289
505
|
options: z.record(z.unknown()).optional(),
|
|
290
506
|
})
|
|
291
|
-
.
|
|
507
|
+
.passthrough();
|
|
292
508
|
const KitSourceSchema = z.enum(["filesystem", "git", "npm", "github", "website", "local"]);
|
|
293
509
|
export const InstalledStashEntrySchema = z
|
|
294
510
|
.object({
|
|
@@ -304,7 +520,7 @@ export const InstalledStashEntrySchema = z
|
|
|
304
520
|
resolvedRevision: z.string().min(1).optional(),
|
|
305
521
|
wikiName: z.string().min(1).optional(),
|
|
306
522
|
})
|
|
307
|
-
.
|
|
523
|
+
.passthrough()
|
|
308
524
|
.superRefine((entry, ctx) => {
|
|
309
525
|
if (entry.writable === true && entry.source !== "git" && entry.source !== "filesystem") {
|
|
310
526
|
ctx.addIssue({
|
|
@@ -319,7 +535,7 @@ export const OutputConfigSchema = z
|
|
|
319
535
|
format: z.enum(["json", "yaml", "text"]).optional(),
|
|
320
536
|
detail: z.enum(["brief", "normal", "full"]).optional(),
|
|
321
537
|
})
|
|
322
|
-
.
|
|
538
|
+
.passthrough();
|
|
323
539
|
// ── Search ──────────────────────────────────────────────────────────────────
|
|
324
540
|
const SearchGraphBoostSchema = z
|
|
325
541
|
.object({
|
|
@@ -333,34 +549,99 @@ const SearchGraphBoostSchema = z
|
|
|
333
549
|
/** Range [0, 1]; values > 1 hard-error (no silent clamp). */
|
|
334
550
|
confidenceWeight: z.number().finite().min(0).max(1).default(0.2).optional(),
|
|
335
551
|
})
|
|
336
|
-
.
|
|
552
|
+
.passthrough();
|
|
337
553
|
export const SearchConfigSchema = z
|
|
338
554
|
.object({
|
|
339
555
|
minScore: nonNegativeNumber.optional(),
|
|
340
|
-
|
|
556
|
+
defaultExcludeTypes: z.array(nonEmptyString).optional(),
|
|
557
|
+
curateRerank: z.object({ enabled: z.boolean().optional() }).passthrough().optional(),
|
|
341
558
|
graphBoost: SearchGraphBoostSchema.optional(),
|
|
342
559
|
})
|
|
343
|
-
.
|
|
560
|
+
.passthrough();
|
|
344
561
|
// ── Feedback ────────────────────────────────────────────────────────────────
|
|
345
562
|
export const FeedbackConfigSchema = z
|
|
346
563
|
.object({
|
|
347
564
|
requireReason: z.boolean().optional(),
|
|
348
565
|
allowedFailureModes: z.array(nonEmptyString).optional(),
|
|
349
566
|
})
|
|
350
|
-
.
|
|
567
|
+
.passthrough();
|
|
351
568
|
// ── Improve top-level (utility decay, event retention) ─────────────────────
|
|
352
569
|
const ImproveUtilityDecaySchema = z
|
|
353
570
|
.object({
|
|
354
571
|
halfLifeDays: z.number().finite().min(0.1).optional(),
|
|
355
572
|
feedbackStabilityBoost: z.number().finite().min(1).optional(),
|
|
356
573
|
})
|
|
357
|
-
.
|
|
574
|
+
.passthrough();
|
|
575
|
+
// #612 / WS-4 — auto-accept gate calibration + bounded, opt-in per-phase
|
|
576
|
+
// threshold auto-tune. DEFAULT OFF: when absent (or `autoTune: false`) no
|
|
577
|
+
// tuning occurs, so the gate behaves byte-identically to today.
|
|
578
|
+
// WS-4 adds: per-phase persistence (state.db) + auto-tune ceiling default 85.
|
|
579
|
+
const ImproveCalibrationSchema = z
|
|
580
|
+
.object({
|
|
581
|
+
/** Master switch for the bounded threshold auto-tune. Default false (parity). */
|
|
582
|
+
autoTune: z.boolean().optional(),
|
|
583
|
+
/** Lower bound (0-100) the tuned threshold may never drop below. */
|
|
584
|
+
minThreshold: z.number().int().min(0).max(100).optional(),
|
|
585
|
+
/**
|
|
586
|
+
* Upper bound (0-100) the tuned threshold may never rise above.
|
|
587
|
+
* WS-4 default: 85 (prevents gate converging to pure exploitation).
|
|
588
|
+
*/
|
|
589
|
+
maxThreshold: z.number().int().min(0).max(100).optional(),
|
|
590
|
+
/** Maximum adjustment magnitude (points) applied in one tune step. */
|
|
591
|
+
maxStep: positiveInt.optional(),
|
|
592
|
+
/** Minimum acted-on sample count required before any adjustment. */
|
|
593
|
+
minSamples: nonNegativeNumber.optional(),
|
|
594
|
+
/** Target realized accept rate in [0, 1]. Default 0.9. */
|
|
595
|
+
targetAcceptRate: z.number().finite().min(0).max(1).optional(),
|
|
596
|
+
})
|
|
597
|
+
.passthrough();
|
|
598
|
+
// WS-4 — exploration budget: a fixed fraction of proposals accepted per run
|
|
599
|
+
// regardless of confidence. DEFAULT OFF.
|
|
600
|
+
const ImproveExplorationSchema = z
|
|
601
|
+
.object({
|
|
602
|
+
/**
|
|
603
|
+
* Enable the exploration budget lane. Default false (parity).
|
|
604
|
+
* When true, a fraction of proposals are accepted regardless of confidence.
|
|
605
|
+
*/
|
|
606
|
+
enabled: z.boolean().optional(),
|
|
607
|
+
/**
|
|
608
|
+
* Fraction of proposals per run to accept as exploration [0, 1].
|
|
609
|
+
* Default 0.05 (5%). Clamped to [0, 1] at read time.
|
|
610
|
+
*/
|
|
611
|
+
budgetFraction: z.number().finite().min(0).max(1).optional(),
|
|
612
|
+
})
|
|
613
|
+
.passthrough();
|
|
614
|
+
const ImproveSalienceSchema = z
|
|
615
|
+
.object({
|
|
616
|
+
/**
|
|
617
|
+
* WS-2 Part-V gate: enable the outcome-weight term in the salience projection.
|
|
618
|
+
* Default false (parity — WS-1 weights w_e=0.30, w_r=0.70 until Part-V confirms
|
|
619
|
+
* no regression). Set to true after running scripts/akm-eval + health report.
|
|
620
|
+
*/
|
|
621
|
+
outcomeWeightEnabled: z.boolean().optional(),
|
|
622
|
+
/**
|
|
623
|
+
* Minimum encoding salience score [0, 1] for a zero-feedback asset to be
|
|
624
|
+
* admitted to the high-salience improve lane (#608).
|
|
625
|
+
* Default 0.75. Set to 1.0 to disable the lane entirely.
|
|
626
|
+
*/
|
|
627
|
+
salienceThreshold: z.number().min(0).max(1).optional(),
|
|
628
|
+
/**
|
|
629
|
+
* Per-run additive replay budget (#610). Up to this many top-salience refs are
|
|
630
|
+
* revisited even with no reactive signal and regardless of cooldown. Additive
|
|
631
|
+
* on top of --limit. Default 0 = no replay.
|
|
632
|
+
*/
|
|
633
|
+
replayBudget: z.number().int().min(0).optional(),
|
|
634
|
+
})
|
|
635
|
+
.passthrough();
|
|
358
636
|
export const ImproveConfigSchema = z
|
|
359
637
|
.object({
|
|
360
638
|
utilityDecay: ImproveUtilityDecaySchema.optional(),
|
|
361
639
|
eventRetentionDays: nonNegativeNumber.optional(),
|
|
640
|
+
calibration: ImproveCalibrationSchema.optional(),
|
|
641
|
+
exploration: ImproveExplorationSchema.optional(),
|
|
642
|
+
salience: ImproveSalienceSchema.optional(),
|
|
362
643
|
})
|
|
363
|
-
.
|
|
644
|
+
.passthrough();
|
|
364
645
|
// ── Index / per-pass ────────────────────────────────────────────────────────
|
|
365
646
|
const GRAPH_EXTRACTION_INCLUDE_TYPES_ALLOWED = [
|
|
366
647
|
"memory",
|
|
@@ -372,6 +653,7 @@ const GRAPH_EXTRACTION_INCLUDE_TYPES_ALLOWED = [
|
|
|
372
653
|
"lesson",
|
|
373
654
|
"task",
|
|
374
655
|
"wiki",
|
|
656
|
+
"fact",
|
|
375
657
|
];
|
|
376
658
|
const INDEX_PASS_PROVIDER_KEYS = new Set([
|
|
377
659
|
"endpoint",
|
|
@@ -388,6 +670,7 @@ const INDEX_PASS_KNOWN_KEYS = new Set([
|
|
|
388
670
|
"graphExtractionBatchSize",
|
|
389
671
|
"graphExtractionIncludeTypes",
|
|
390
672
|
"memoryInferenceBatchSize",
|
|
673
|
+
"lazyGraphExtraction",
|
|
391
674
|
]);
|
|
392
675
|
/**
|
|
393
676
|
* Per-pass `index.<pass>` entry. Uses preprocess + manual validation so we can
|
|
@@ -414,8 +697,8 @@ export const IndexPassConfigSchema = z.preprocess((raw, ctx) => {
|
|
|
414
697
|
ctx.addIssue({
|
|
415
698
|
code: z.ZodIssueCode.custom,
|
|
416
699
|
message: `Unknown key \`${[...(ctx.path ?? []), key].join(".")}\`. Per-pass entries support \`llm\` ` +
|
|
417
|
-
"(boolean opt-out), `graphExtractionBatchSize`, `graphExtractionIncludeTypes`,
|
|
418
|
-
"`memoryInferenceBatchSize`.",
|
|
700
|
+
"(boolean opt-out), `graphExtractionBatchSize`, `graphExtractionIncludeTypes`, " +
|
|
701
|
+
"`memoryInferenceBatchSize`, and `lazyGraphExtraction`.",
|
|
419
702
|
});
|
|
420
703
|
return raw;
|
|
421
704
|
}
|
|
@@ -434,15 +717,16 @@ export const IndexPassConfigSchema = z.preprocess((raw, ctx) => {
|
|
|
434
717
|
graphExtractionBatchSize: positiveInt.optional(),
|
|
435
718
|
graphExtractionIncludeTypes: z.array(z.enum(GRAPH_EXTRACTION_INCLUDE_TYPES_ALLOWED)).nonempty().optional(),
|
|
436
719
|
memoryInferenceBatchSize: positiveInt.optional(),
|
|
720
|
+
lazyGraphExtraction: z.boolean().optional(),
|
|
437
721
|
})
|
|
438
722
|
.passthrough());
|
|
439
|
-
const MetadataEnhanceSchema = z.object({ enabled: z.boolean().optional() }).
|
|
723
|
+
const MetadataEnhanceSchema = z.object({ enabled: z.boolean().optional() }).passthrough();
|
|
440
724
|
const StalenessDetectionSchema = z
|
|
441
725
|
.object({
|
|
442
726
|
enabled: z.boolean().optional(),
|
|
443
727
|
thresholdDays: positiveInt.optional(),
|
|
444
728
|
})
|
|
445
|
-
.
|
|
729
|
+
.passthrough();
|
|
446
730
|
/**
|
|
447
731
|
* Index config is a union of reserved feature sections and per-pass entries.
|
|
448
732
|
* Passthrough so per-pass entries (keyed by arbitrary pass names like `graph`,
|
|
@@ -515,12 +799,12 @@ export const SetupTaskSchedulesSchema = z
|
|
|
515
799
|
improve: z.string().min(1).optional(),
|
|
516
800
|
index: z.string().min(1).optional(),
|
|
517
801
|
})
|
|
518
|
-
.
|
|
802
|
+
.passthrough();
|
|
519
803
|
export const SetupConfigSchema = z
|
|
520
804
|
.object({
|
|
521
805
|
taskSchedules: SetupTaskSchedulesSchema.optional(),
|
|
522
806
|
})
|
|
523
|
-
.
|
|
807
|
+
.passthrough();
|
|
524
808
|
// ── Top-level AkmConfig ────────────────────────────────────────────────────
|
|
525
809
|
/**
|
|
526
810
|
* Base object schema used both as the top-level shape and as the source of
|
|
@@ -552,7 +836,7 @@ export const AkmConfigShape = {
|
|
|
552
836
|
improve: ImproveConfigSchema.optional(),
|
|
553
837
|
setup: SetupConfigSchema.optional(),
|
|
554
838
|
};
|
|
555
|
-
export const AkmConfigBaseSchema = z.object(AkmConfigShape).
|
|
839
|
+
export const AkmConfigBaseSchema = z.object(AkmConfigShape).passthrough();
|
|
556
840
|
export const AkmConfigSchema = AkmConfigBaseSchema.superRefine((config, ctx) => {
|
|
557
841
|
// #464.a: defaultWriteTarget must name a configured source when sources
|
|
558
842
|
// are present. With no sources configured, error out instead of silently
|
|
@@ -9,8 +9,8 @@ import { VALID_HARNESS_IDS } from "../../integrations/harnesses/index.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* Canonical list of valid agent harness / platform ids. Re-exported from the
|
|
11
11
|
* unified harness registry (#562) so the Zod `AgentPlatformSchema` enum, the
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* `AgentProfileConfig` platform union, and setup's `DetectedHarness` union all
|
|
13
|
+
* derive from one place and cannot drift. Add a harness in
|
|
14
|
+
* `src/integrations/harnesses/index.ts`.
|
|
15
15
|
*/
|
|
16
16
|
export { VALID_HARNESS_IDS };
|