open-second-brain 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +23 -0
- package/.codex-plugin/plugin.json +15 -0
- package/LICENSE +21 -0
- package/README.md +76 -2
- package/__init__.py +35 -0
- package/bin/_launch.js +141 -0
- package/bin/o2b-hook.js +3 -0
- package/bin/o2b-mcp.js +3 -0
- package/bin/o2b.js +3 -0
- package/hooks/README.md +347 -0
- package/hooks/active-inject.ts +992 -0
- package/hooks/answer-quote-check.ts +1319 -0
- package/hooks/backlog-nudge.ts +116 -0
- package/hooks/counterparty-brief.ts +209 -0
- package/hooks/gap-agenda.ts +65 -0
- package/hooks/gap-promote.ts +159 -0
- package/hooks/hooks.json +256 -0
- package/hooks/hygiene-digest.ts +194 -0
- package/hooks/lib/active-context.ts +558 -0
- package/hooks/lib/agent-context-blocks.ts +200 -0
- package/hooks/lib/backlog-nudge-state.ts +95 -0
- package/hooks/lib/context-events.ts +32 -0
- package/hooks/lib/detect.ts +295 -0
- package/hooks/lib/hook-vault.ts +132 -0
- package/hooks/lib/host-context-ceiling.ts +172 -0
- package/hooks/lib/hygiene-digest-state.ts +126 -0
- package/hooks/lib/hygiene-digest-text.ts +144 -0
- package/hooks/lib/injection-ledger.ts +580 -0
- package/hooks/lib/log-cursor-state.ts +371 -0
- package/hooks/lib/messages.ts +161 -0
- package/hooks/lib/process-ceiling.ts +158 -0
- package/hooks/lib/session-state.ts +437 -0
- package/hooks/lib/standing-block.ts +152 -0
- package/hooks/lib/stdin.ts +129 -0
- package/hooks/lib/stop-advisory-handover.ts +218 -0
- package/hooks/lib/transcript.ts +265 -0
- package/hooks/log-catchup.ts +566 -0
- package/hooks/nav-inject.ts +134 -0
- package/hooks/neighbour-updates.ts +528 -0
- package/hooks/post-write-reminder.ts +146 -0
- package/hooks/pretool-host-backup.ts +502 -0
- package/hooks/pretool-orient.ts +142 -0
- package/hooks/recall-inject.ts +443 -0
- package/hooks/reground-deliver.ts +216 -0
- package/hooks/session-capture.ts +260 -0
- package/hooks/stop-advisory-deliver.ts +71 -0
- package/hooks/stop-log-guardrail.ts +94 -0
- package/hooks/subagent-inject.ts +431 -0
- package/hooks/view-render.ts +83 -0
- package/openclaw/index.js +12703 -0
- package/openclaw.plugin.json +66 -0
- package/package.json +111 -4
- package/plugin.yaml +13 -0
- package/plugins/codex/.codex-plugin/plugin.json +25 -0
- package/plugins/codex/.codexignore +25 -0
- package/plugins/codex/LICENSE +21 -0
- package/plugins/codex/README.md +77 -0
- package/plugins/codex/SECURITY.md +51 -0
- package/plugins/codex/hooks/hooks.json +277 -0
- package/plugins/codex/skills/brain-memory/SKILL.md +197 -0
- package/plugins/codex/skills/codegraph-partner/SKILL.md +130 -0
- package/plugins/codex/skills/decision-model-setup/SKILL.md +215 -0
- package/plugins/codex/skills/embeddings-setup/SKILL.md +270 -0
- package/plugins/codex/skills/open-second-brain/SKILL.md +56 -0
- package/plugins/codex/skills/schema-author/SKILL.md +23 -0
- package/plugins/hermes/__init__.py +134 -0
- package/plugins/hermes/_base.py +85 -0
- package/plugins/hermes/_schemas.py +1501 -0
- package/plugins/hermes/bridge.py +740 -0
- package/plugins/hermes/cli.py +100 -0
- package/plugins/hermes/config.py +755 -0
- package/plugins/hermes/plugin.yaml +13 -0
- package/plugins/hermes/provider.py +1138 -0
- package/plugins/opencode/open-second-brain.ts +1164 -0
- package/pyproject.toml +28 -0
- package/schemas/brain/complexity-report.schema.json +39 -0
- package/schemas/brain/intent-review.schema.json +36 -0
- package/schemas/brain/monthly-review.schema.json +34 -0
- package/schemas/brain/retention-review.schema.json +44 -0
- package/schemas/brain/search-query.schema.json +231 -0
- package/scripts/_bun-precheck.sh +103 -0
- package/scripts/_macos-sqlite.sh +68 -0
- package/scripts/o2b +16 -0
- package/scripts/o2b-aider +22 -0
- package/scripts/o2b-aider.cmd +44 -0
- package/scripts/o2b-hook +94 -0
- package/scripts/o2b-hook.cmd +47 -0
- package/scripts/o2b-mcp +16 -0
- package/scripts/o2b-mcp.cmd +46 -0
- package/scripts/o2b.cmd +46 -0
- package/scripts/vault-log +17 -0
- package/scripts/vault-log.cmd +44 -0
- package/skills/brain-memory/SKILL.md +197 -0
- package/skills/codegraph-partner/SKILL.md +130 -0
- package/skills/decision-model-setup/SKILL.md +215 -0
- package/skills/embeddings-setup/SKILL.md +270 -0
- package/skills/open-second-brain/SKILL.md +56 -0
- package/skills/schema-author/SKILL.md +23 -0
- package/src/cli/advisory-rail.ts +175 -0
- package/src/cli/aider.ts +167 -0
- package/src/cli/argparse.ts +96 -0
- package/src/cli/bootstrap/index.ts +24 -0
- package/src/cli/bootstrap/receipt.ts +178 -0
- package/src/cli/bootstrap/run.ts +728 -0
- package/src/cli/bootstrap/targets.ts +56 -0
- package/src/cli/bootstrap/token-cli.ts +285 -0
- package/src/cli/brain/help-text.ts +1658 -0
- package/src/cli/brain/helpers.ts +263 -0
- package/src/cli/brain/query-render.ts +57 -0
- package/src/cli/brain/rollback-prompt.ts +72 -0
- package/src/cli/brain/snapshot-render.ts +176 -0
- package/src/cli/brain/upgrade-render.ts +76 -0
- package/src/cli/brain/verbs/actions.ts +70 -0
- package/src/cli/brain/verbs/activation.ts +115 -0
- package/src/cli/brain/verbs/agenda.ts +131 -0
- package/src/cli/brain/verbs/agent-diff.ts +97 -0
- package/src/cli/brain/verbs/agent-query.ts +80 -0
- package/src/cli/brain/verbs/anticipate.ts +86 -0
- package/src/cli/brain/verbs/apply-evidence.ts +69 -0
- package/src/cli/brain/verbs/apply-markers.ts +133 -0
- package/src/cli/brain/verbs/architect.ts +127 -0
- package/src/cli/brain/verbs/attention-flows.ts +90 -0
- package/src/cli/brain/verbs/attest.ts +458 -0
- package/src/cli/brain/verbs/attr.ts +98 -0
- package/src/cli/brain/verbs/audit.ts +39 -0
- package/src/cli/brain/verbs/authored-at-backfill.ts +73 -0
- package/src/cli/brain/verbs/backlinks.ts +80 -0
- package/src/cli/brain/verbs/bank-export.ts +200 -0
- package/src/cli/brain/verbs/bank-import.ts +146 -0
- package/src/cli/brain/verbs/batch-plan.ts +159 -0
- package/src/cli/brain/verbs/bench.ts +545 -0
- package/src/cli/brain/verbs/benchmark.ts +125 -0
- package/src/cli/brain/verbs/bridges.ts +237 -0
- package/src/cli/brain/verbs/capture.ts +154 -0
- package/src/cli/brain/verbs/changes.ts +88 -0
- package/src/cli/brain/verbs/claims.ts +148 -0
- package/src/cli/brain/verbs/clusters.ts +374 -0
- package/src/cli/brain/verbs/co-occurrence.ts +94 -0
- package/src/cli/brain/verbs/codec.ts +36 -0
- package/src/cli/brain/verbs/context-pack.ts +212 -0
- package/src/cli/brain/verbs/context-presets.ts +108 -0
- package/src/cli/brain/verbs/context-receipts.ts +225 -0
- package/src/cli/brain/verbs/continuity.ts +471 -0
- package/src/cli/brain/verbs/dead-end.ts +92 -0
- package/src/cli/brain/verbs/dead-letters.ts +504 -0
- package/src/cli/brain/verbs/decision.ts +538 -0
- package/src/cli/brain/verbs/deep-synthesis.ts +115 -0
- package/src/cli/brain/verbs/design-note.ts +167 -0
- package/src/cli/brain/verbs/diarize.ts +86 -0
- package/src/cli/brain/verbs/digest.ts +92 -0
- package/src/cli/brain/verbs/distill.ts +247 -0
- package/src/cli/brain/verbs/doctor.ts +543 -0
- package/src/cli/brain/verbs/dream.ts +720 -0
- package/src/cli/brain/verbs/entity.ts +629 -0
- package/src/cli/brain/verbs/event-trace.ts +113 -0
- package/src/cli/brain/verbs/expire.ts +118 -0
- package/src/cli/brain/verbs/explorer.ts +149 -0
- package/src/cli/brain/verbs/export.ts +531 -0
- package/src/cli/brain/verbs/extract-signals.ts +279 -0
- package/src/cli/brain/verbs/extract.ts +254 -0
- package/src/cli/brain/verbs/facts.ts +118 -0
- package/src/cli/brain/verbs/feedback.ts +325 -0
- package/src/cli/brain/verbs/file-context.ts +87 -0
- package/src/cli/brain/verbs/foresight.ts +107 -0
- package/src/cli/brain/verbs/forget-source.ts +198 -0
- package/src/cli/brain/verbs/freeze.ts +104 -0
- package/src/cli/brain/verbs/generation-reports.ts +271 -0
- package/src/cli/brain/verbs/git.ts +267 -0
- package/src/cli/brain/verbs/graph-export.ts +114 -0
- package/src/cli/brain/verbs/graph-import.ts +53 -0
- package/src/cli/brain/verbs/hallways.ts +370 -0
- package/src/cli/brain/verbs/handoff.ts +65 -0
- package/src/cli/brain/verbs/health-baseline.ts +107 -0
- package/src/cli/brain/verbs/health.ts +79 -0
- package/src/cli/brain/verbs/history.ts +33 -0
- package/src/cli/brain/verbs/hygiene.ts +192 -0
- package/src/cli/brain/verbs/idea-lineage.ts +62 -0
- package/src/cli/brain/verbs/ideas.ts +68 -0
- package/src/cli/brain/verbs/import-claude-memory.ts +173 -0
- package/src/cli/brain/verbs/import-session.ts +910 -0
- package/src/cli/brain/verbs/inbox-drain.ts +91 -0
- package/src/cli/brain/verbs/index.ts +165 -0
- package/src/cli/brain/verbs/init.ts +189 -0
- package/src/cli/brain/verbs/intent-review.ts +61 -0
- package/src/cli/brain/verbs/intention.ts +110 -0
- package/src/cli/brain/verbs/knowledge-gaps.ts +86 -0
- package/src/cli/brain/verbs/knowledge-pack.ts +295 -0
- package/src/cli/brain/verbs/label.ts +141 -0
- package/src/cli/brain/verbs/lessons.ts +1064 -0
- package/src/cli/brain/verbs/lifecycle.ts +278 -0
- package/src/cli/brain/verbs/links.ts +131 -0
- package/src/cli/brain/verbs/lint.ts +68 -0
- package/src/cli/brain/verbs/log.ts +159 -0
- package/src/cli/brain/verbs/maintenance.ts +608 -0
- package/src/cli/brain/verbs/mcp-landscape.ts +29 -0
- package/src/cli/brain/verbs/merge.ts +98 -0
- package/src/cli/brain/verbs/migrate-store-forms.ts +230 -0
- package/src/cli/brain/verbs/migrate-store.ts +482 -0
- package/src/cli/brain/verbs/moc-audit.ts +68 -0
- package/src/cli/brain/verbs/monthly.ts +51 -0
- package/src/cli/brain/verbs/morning-brief.ts +150 -0
- package/src/cli/brain/verbs/note-history.ts +70 -0
- package/src/cli/brain/verbs/note-lifecycle.ts +356 -0
- package/src/cli/brain/verbs/note.ts +89 -0
- package/src/cli/brain/verbs/obligation.ts +159 -0
- package/src/cli/brain/verbs/okf-export.ts +210 -0
- package/src/cli/brain/verbs/okf-import.ts +41 -0
- package/src/cli/brain/verbs/orphan-repair.ts +85 -0
- package/src/cli/brain/verbs/page-dedup.ts +171 -0
- package/src/cli/brain/verbs/panel.ts +202 -0
- package/src/cli/brain/verbs/payload.ts +196 -0
- package/src/cli/brain/verbs/pending.ts +190 -0
- package/src/cli/brain/verbs/permissions.ts +243 -0
- package/src/cli/brain/verbs/pin.ts +50 -0
- package/src/cli/brain/verbs/post-compact-audit.ts +118 -0
- package/src/cli/brain/verbs/pre-compact-extract.ts +64 -0
- package/src/cli/brain/verbs/pre-extract.ts +58 -0
- package/src/cli/brain/verbs/privacy-marker-restamp.ts +73 -0
- package/src/cli/brain/verbs/procedural-graph.ts +95 -0
- package/src/cli/brain/verbs/procedural-memory.ts +93 -0
- package/src/cli/brain/verbs/profile.ts +53 -0
- package/src/cli/brain/verbs/project.ts +145 -0
- package/src/cli/brain/verbs/protect.ts +319 -0
- package/src/cli/brain/verbs/query.ts +145 -0
- package/src/cli/brain/verbs/recall-telemetry.ts +359 -0
- package/src/cli/brain/verbs/receipts.ts +195 -0
- package/src/cli/brain/verbs/recurrence.ts +121 -0
- package/src/cli/brain/verbs/refresh.ts +66 -0
- package/src/cli/brain/verbs/reject.ts +155 -0
- package/src/cli/brain/verbs/repair-lane.ts +252 -0
- package/src/cli/brain/verbs/retention.ts +46 -0
- package/src/cli/brain/verbs/rollback.ts +258 -0
- package/src/cli/brain/verbs/scaffold-stub.ts +151 -0
- package/src/cli/brain/verbs/scan-citations.ts +61 -0
- package/src/cli/brain/verbs/scan-inline.ts +94 -0
- package/src/cli/brain/verbs/schema.ts +241 -0
- package/src/cli/brain/verbs/secret.ts +469 -0
- package/src/cli/brain/verbs/semantics-backfill.ts +33 -0
- package/src/cli/brain/verbs/session-hook.ts +37 -0
- package/src/cli/brain/verbs/session-recall.ts +226 -0
- package/src/cli/brain/verbs/session-summary.ts +223 -0
- package/src/cli/brain/verbs/session.ts +205 -0
- package/src/cli/brain/verbs/set-primary.ts +118 -0
- package/src/cli/brain/verbs/settings.ts +128 -0
- package/src/cli/brain/verbs/sgrep.ts +78 -0
- package/src/cli/brain/verbs/signal.ts +100 -0
- package/src/cli/brain/verbs/skill-proposals.ts +886 -0
- package/src/cli/brain/verbs/snapshot.ts +294 -0
- package/src/cli/brain/verbs/source.ts +75 -0
- package/src/cli/brain/verbs/sources.ts +42 -0
- package/src/cli/brain/verbs/standing-rules.ts +119 -0
- package/src/cli/brain/verbs/state.ts +120 -0
- package/src/cli/brain/verbs/status.ts +36 -0
- package/src/cli/brain/verbs/storage.ts +113 -0
- package/src/cli/brain/verbs/summary.ts +81 -0
- package/src/cli/brain/verbs/synthesise.ts +63 -0
- package/src/cli/brain/verbs/telegram-capture.ts +80 -0
- package/src/cli/brain/verbs/temporal-daily.ts +87 -0
- package/src/cli/brain/verbs/temporal-evolution.ts +79 -0
- package/src/cli/brain/verbs/temporal-stale.ts +50 -0
- package/src/cli/brain/verbs/temporal-timeline.ts +92 -0
- package/src/cli/brain/verbs/temporal-weekly.ts +87 -0
- package/src/cli/brain/verbs/tension.ts +222 -0
- package/src/cli/brain/verbs/tiers.ts +170 -0
- package/src/cli/brain/verbs/today.ts +71 -0
- package/src/cli/brain/verbs/token-footprint.ts +62 -0
- package/src/cli/brain/verbs/trigger.ts +188 -0
- package/src/cli/brain/verbs/truth.ts +417 -0
- package/src/cli/brain/verbs/tune.ts +154 -0
- package/src/cli/brain/verbs/unlinked.ts +67 -0
- package/src/cli/brain/verbs/upgrade.ts +286 -0
- package/src/cli/brain/verbs/validate.ts +198 -0
- package/src/cli/brain/verbs/vitals.ts +95 -0
- package/src/cli/brain/verbs/watchdog.ts +51 -0
- package/src/cli/brain/verbs/writes.ts +507 -0
- package/src/cli/brain.ts +591 -0
- package/src/cli/coerce.ts +85 -0
- package/src/cli/command-manifest.ts +1757 -0
- package/src/cli/completions.ts +103 -0
- package/src/cli/cron-recipe.ts +512 -0
- package/src/cli/decision-model.ts +590 -0
- package/src/cli/deps-bootstrap.ts +24 -0
- package/src/cli/discipline.ts +67 -0
- package/src/cli/dream/agent.ts +193 -0
- package/src/cli/dream/owner.ts +268 -0
- package/src/cli/dream/queue.ts +181 -0
- package/src/cli/dream/run.ts +249 -0
- package/src/cli/dream/status.ts +69 -0
- package/src/cli/help-render.ts +129 -0
- package/src/cli/helpers.ts +157 -0
- package/src/cli/install/init-interactive.ts +340 -0
- package/src/cli/install/install.ts +707 -0
- package/src/cli/install/render.ts +354 -0
- package/src/cli/install/uninstall-target.ts +167 -0
- package/src/cli/install-cli-windows.ts +232 -0
- package/src/cli/install-cli.ts +307 -0
- package/src/cli/interrupt.ts +286 -0
- package/src/cli/json-helpers.ts +155 -0
- package/src/cli/main.ts +1758 -0
- package/src/cli/maintenance-cron.ts +234 -0
- package/src/cli/mcp-drain.ts +132 -0
- package/src/cli/mcp-fault-guard.ts +248 -0
- package/src/cli/onboarding.ts +384 -0
- package/src/cli/output.ts +93 -0
- package/src/cli/partner-codegraph-cron.ts +233 -0
- package/src/cli/partner.ts +228 -0
- package/src/cli/progress-rail.ts +250 -0
- package/src/cli/search/helpers.ts +177 -0
- package/src/cli/search/outcome-render.ts +343 -0
- package/src/cli/search/verbs/check.ts +665 -0
- package/src/cli/search/verbs/event-anchor-backfill.ts +132 -0
- package/src/cli/search/verbs/expand.ts +120 -0
- package/src/cli/search/verbs/focus.ts +93 -0
- package/src/cli/search/verbs/indexing.ts +688 -0
- package/src/cli/search/verbs/learned-weights.ts +121 -0
- package/src/cli/search/verbs/plan.ts +74 -0
- package/src/cli/search/verbs/provider-registry.ts +233 -0
- package/src/cli/search/verbs/query.ts +288 -0
- package/src/cli/search/verbs/rerank-eval.ts +309 -0
- package/src/cli/search/verbs/rerank-fit.ts +65 -0
- package/src/cli/search/verbs/restamp.ts +201 -0
- package/src/cli/search/verbs/schema-export.ts +226 -0
- package/src/cli/search/verbs/set-aside.ts +47 -0
- package/src/cli/search/verbs/status.ts +203 -0
- package/src/cli/search/verbs/vector-backfill.ts +345 -0
- package/src/cli/search/verbs/watch.ts +121 -0
- package/src/cli/search-cron-template.ts +95 -0
- package/src/cli/search.ts +134 -0
- package/src/cli/setup.ts +543 -0
- package/src/cli/state.ts +312 -0
- package/src/cli/stdin.ts +29 -0
- package/src/cli/stdout-guard.ts +68 -0
- package/src/cli/store-device.ts +259 -0
- package/src/cli/store-partition.ts +161 -0
- package/src/cli/store-path.ts +130 -0
- package/src/cli/store-shard.ts +535 -0
- package/src/cli/store.ts +298 -0
- package/src/cli/topic.ts +317 -0
- package/src/cli/transport-reach.ts +17 -0
- package/src/cli/uninstall.ts +210 -0
- package/src/cli/update.ts +183 -0
- package/src/cli/vault/help-text.ts +51 -0
- package/src/cli/vault/verbs/inspect.ts +141 -0
- package/src/cli/vault/verbs/map.ts +37 -0
- package/src/cli/vault/verbs/profile.ts +69 -0
- package/src/cli/vault/verbs/status.ts +100 -0
- package/src/cli/vault.ts +58 -0
- package/src/cli/version.ts +53 -0
- package/src/cli/view.ts +275 -0
- package/src/cli/windows-path-hint.ts +39 -0
- package/src/core/agent-context/budget-line.ts +19 -0
- package/src/core/agent-context/config.ts +35 -0
- package/src/core/agent-context/digest-cut-note.ts +138 -0
- package/src/core/agent-context/head-select.ts +209 -0
- package/src/core/agent-context/heads.ts +128 -0
- package/src/core/agent-context/neighbour-relevant.ts +175 -0
- package/src/core/agent-context/neighbours.ts +282 -0
- package/src/core/agent-context/pinned-block.ts +68 -0
- package/src/core/agent-context/session-identity.ts +124 -0
- package/src/core/agent-context/topic-tail.ts +262 -0
- package/src/core/agent-identity.ts +151 -0
- package/src/core/bench/embedding-cache.ts +358 -0
- package/src/core/bench/failure-modes.ts +257 -0
- package/src/core/bench/fixture.ts +315 -0
- package/src/core/bench/guards.ts +596 -0
- package/src/core/bench/judge.ts +75 -0
- package/src/core/bench/locomo.ts +199 -0
- package/src/core/bench/longmemeval-sample.ts +273 -0
- package/src/core/bench/longmemeval.ts +736 -0
- package/src/core/bench/phases.ts +1054 -0
- package/src/core/bench/replay-fixture.ts +290 -0
- package/src/core/bench/replay.ts +78 -0
- package/src/core/bench/run-store.ts +389 -0
- package/src/core/bench/types.ts +497 -0
- package/src/core/brain/active-budget-pressure.ts +215 -0
- package/src/core/brain/active-budget.ts +486 -0
- package/src/core/brain/active.ts +687 -0
- package/src/core/brain/agenda.ts +296 -0
- package/src/core/brain/agent-backend/claude.ts +42 -0
- package/src/core/brain/agent-backend/generic.ts +33 -0
- package/src/core/brain/agent-backend/json-source.ts +169 -0
- package/src/core/brain/agent-backend/mem0.ts +29 -0
- package/src/core/brain/agent-backend/registry.ts +49 -0
- package/src/core/brain/agent-backend/types.ts +89 -0
- package/src/core/brain/agent-source/diff.ts +160 -0
- package/src/core/brain/agent-source/freeze.ts +12 -0
- package/src/core/brain/agent-source/query.ts +187 -0
- package/src/core/brain/agent-source/registry.ts +101 -0
- package/src/core/brain/agent-source/summary.ts +28 -0
- package/src/core/brain/agent-source/types.ts +99 -0
- package/src/core/brain/agent-source/vault-provider.ts +276 -0
- package/src/core/brain/answer-quotes/check.ts +190 -0
- package/src/core/brain/anticipatory-cache.ts +591 -0
- package/src/core/brain/anticipatory-prune.ts +156 -0
- package/src/core/brain/applier-capability.ts +369 -0
- package/src/core/brain/apply-evidence.ts +524 -0
- package/src/core/brain/architect/decisions.ts +92 -0
- package/src/core/brain/architect/generate.ts +1121 -0
- package/src/core/brain/architect/manifests.ts +611 -0
- package/src/core/brain/architect/scan.ts +541 -0
- package/src/core/brain/artifact-ref-resolve.ts +217 -0
- package/src/core/brain/artifact-ref-view.ts +174 -0
- package/src/core/brain/atomic-facts.ts +339 -0
- package/src/core/brain/attention-flows.ts +411 -0
- package/src/core/brain/attestation/digest.ts +357 -0
- package/src/core/brain/attestation/record.ts +537 -0
- package/src/core/brain/attestation/signing.ts +405 -0
- package/src/core/brain/attestation/verify.ts +523 -0
- package/src/core/brain/attributes.ts +221 -0
- package/src/core/brain/audit-dirs.ts +39 -0
- package/src/core/brain/authored-at-backfill.ts +211 -0
- package/src/core/brain/backlinks.ts +438 -0
- package/src/core/brain/belief-semantic.ts +338 -0
- package/src/core/brain/capture/capture-note.ts +563 -0
- package/src/core/brain/capture/inbox-drain.ts +473 -0
- package/src/core/brain/capture/telegram-capture.ts +501 -0
- package/src/core/brain/capture-boundary.ts +166 -0
- package/src/core/brain/checkpoint-store.ts +153 -0
- package/src/core/brain/claim-graph.ts +342 -0
- package/src/core/brain/claude-memory-manifest.ts +62 -0
- package/src/core/brain/claude-memory-parser.ts +138 -0
- package/src/core/brain/claude-memory-paths.ts +64 -0
- package/src/core/brain/claude-memory-plan.ts +26 -0
- package/src/core/brain/claude-memory-render.ts +140 -0
- package/src/core/brain/commitment.ts +62 -0
- package/src/core/brain/compiled-digest-path.ts +125 -0
- package/src/core/brain/confidence.ts +91 -0
- package/src/core/brain/config-template.ts +904 -0
- package/src/core/brain/content-hash.ts +81 -0
- package/src/core/brain/context-density.ts +86 -0
- package/src/core/brain/context-lanes.ts +83 -0
- package/src/core/brain/context-pack-evidence.ts +423 -0
- package/src/core/brain/context-pack-outcome.ts +447 -0
- package/src/core/brain/context-pack.ts +1915 -0
- package/src/core/brain/context-presets.ts +333 -0
- package/src/core/brain/context-receipt-trigger.ts +34 -0
- package/src/core/brain/context-receipts-verify.ts +565 -0
- package/src/core/brain/context-receipts.ts +856 -0
- package/src/core/brain/context-transforms.ts +82 -0
- package/src/core/brain/continuity/emit.ts +37 -0
- package/src/core/brain/continuity/export-atif.ts +110 -0
- package/src/core/brain/continuity/export-atof.ts +131 -0
- package/src/core/brain/continuity/promote-host-memory.ts +673 -0
- package/src/core/brain/continuity/read-model.ts +131 -0
- package/src/core/brain/continuity/redaction.ts +42 -0
- package/src/core/brain/continuity/store.ts +575 -0
- package/src/core/brain/continuity/types.ts +263 -0
- package/src/core/brain/continuity/usage-signal.ts +223 -0
- package/src/core/brain/count-guard.ts +82 -0
- package/src/core/brain/counterparty-brief.ts +686 -0
- package/src/core/brain/dead-ends.ts +254 -0
- package/src/core/brain/dead-letter-recovery.ts +739 -0
- package/src/core/brain/dead-letter.ts +453 -0
- package/src/core/brain/dead-weight.ts +267 -0
- package/src/core/brain/decisions/brief.ts +63 -0
- package/src/core/brain/decisions/open-store.ts +1043 -0
- package/src/core/brain/decisions/recall.ts +121 -0
- package/src/core/brain/decisions/receipts.ts +677 -0
- package/src/core/brain/decisions/record.ts +814 -0
- package/src/core/brain/dedup-hash.ts +404 -0
- package/src/core/brain/dedup-index-cache.ts +144 -0
- package/src/core/brain/dedup-telemetry.ts +294 -0
- package/src/core/brain/deep-synthesis.ts +736 -0
- package/src/core/brain/delivery-shaping.ts +113 -0
- package/src/core/brain/derived-artifact.ts +107 -0
- package/src/core/brain/derived-fact.ts +168 -0
- package/src/core/brain/design-note.ts +634 -0
- package/src/core/brain/destructive-sites.ts +505 -0
- package/src/core/brain/diagnostics.ts +2200 -0
- package/src/core/brain/diarization.ts +355 -0
- package/src/core/brain/digest-agent-summary.ts +228 -0
- package/src/core/brain/digest-analysis.ts +160 -0
- package/src/core/brain/digest-brief.ts +152 -0
- package/src/core/brain/digest-collect.ts +532 -0
- package/src/core/brain/digest-types.ts +324 -0
- package/src/core/brain/digest.ts +379 -0
- package/src/core/brain/distill/backlog-proposals.ts +158 -0
- package/src/core/brain/distill/block-resolve.ts +205 -0
- package/src/core/brain/distill/claim.ts +23 -0
- package/src/core/brain/distill/distill-source.ts +506 -0
- package/src/core/brain/distill/quote-check.ts +190 -0
- package/src/core/brain/distill/quote-spans.ts +509 -0
- package/src/core/brain/distill/quote-verdict.ts +120 -0
- package/src/core/brain/doctor/active-budget-check.ts +84 -0
- package/src/core/brain/doctor/adopt-conflicts-check.ts +40 -0
- package/src/core/brain/doctor/attestation-check.ts +268 -0
- package/src/core/brain/doctor/check.ts +133 -0
- package/src/core/brain/doctor/chunk-holds-check.ts +131 -0
- package/src/core/brain/doctor/config-checks.ts +223 -0
- package/src/core/brain/doctor/delivery-provenance-check.ts +99 -0
- package/src/core/brain/doctor/device-retire-check.ts +45 -0
- package/src/core/brain/doctor/device-state-check.ts +67 -0
- package/src/core/brain/doctor/discipline-check.ts +111 -0
- package/src/core/brain/doctor/dream-owner-check.ts +87 -0
- package/src/core/brain/doctor/dream-queue-check.ts +182 -0
- package/src/core/brain/doctor/dream-replay-check.ts +129 -0
- package/src/core/brain/doctor/dream-trigger-check.ts +87 -0
- package/src/core/brain/doctor/embedding-sunset-check.ts +261 -0
- package/src/core/brain/doctor/embeddings-health-check.ts +304 -0
- package/src/core/brain/doctor/entity-alias-verdicts.ts +131 -0
- package/src/core/brain/doctor/entity-checks.ts +366 -0
- package/src/core/brain/doctor/frozen-check.ts +52 -0
- package/src/core/brain/doctor/git-tracked-state-check.ts +206 -0
- package/src/core/brain/doctor/inbox-archive-check.ts +77 -0
- package/src/core/brain/doctor/lane-id-check.ts +148 -0
- package/src/core/brain/doctor/lessons-block-check.ts +343 -0
- package/src/core/brain/doctor/link-checks.ts +95 -0
- package/src/core/brain/doctor/log-chain-check.ts +59 -0
- package/src/core/brain/doctor/log-checks.ts +192 -0
- package/src/core/brain/doctor/merge-chain-check.ts +183 -0
- package/src/core/brain/doctor/migration-check.ts +575 -0
- package/src/core/brain/doctor/orphan-session-check.ts +465 -0
- package/src/core/brain/doctor/payload-checks.ts +117 -0
- package/src/core/brain/doctor/permissions-check.ts +245 -0
- package/src/core/brain/doctor/planted-rows-check.ts +134 -0
- package/src/core/brain/doctor/preference-hygiene.ts +229 -0
- package/src/core/brain/doctor/privacy-marker-check.ts +61 -0
- package/src/core/brain/doctor/recall-channel-coverage.ts +248 -0
- package/src/core/brain/doctor/receipt-content-drift-check.ts +178 -0
- package/src/core/brain/doctor/receipt-ledger.ts +100 -0
- package/src/core/brain/doctor/record-checks.ts +404 -0
- package/src/core/brain/doctor/records.ts +307 -0
- package/src/core/brain/doctor/recovery-point-liveness.ts +234 -0
- package/src/core/brain/doctor/removed-tool-checks.ts +178 -0
- package/src/core/brain/doctor/report.ts +136 -0
- package/src/core/brain/doctor/rerank-health-check.ts +324 -0
- package/src/core/brain/doctor/secrets-sync-check.ts +71 -0
- package/src/core/brain/doctor/semantic-health-check.ts +212 -0
- package/src/core/brain/doctor/session-identity-check.ts +147 -0
- package/src/core/brain/doctor/stale-dependency-check.ts +522 -0
- package/src/core/brain/doctor/storage-capacity.ts +141 -0
- package/src/core/brain/doctor/store-check.ts +655 -0
- package/src/core/brain/doctor/store-gap-check.ts +222 -0
- package/src/core/brain/doctor/store-integrity.ts +457 -0
- package/src/core/brain/doctor/store-side-pass.ts +94 -0
- package/src/core/brain/doctor/store-trust-check.ts +197 -0
- package/src/core/brain/doctor/topic-plan-check.ts +42 -0
- package/src/core/brain/doctor/uncertain-stream.ts +117 -0
- package/src/core/brain/doctor/uncertainty-probes.ts +204 -0
- package/src/core/brain/doctor/unreadable-path.ts +211 -0
- package/src/core/brain/doctor/view-writer-check.ts +105 -0
- package/src/core/brain/doctor-exits.ts +806 -0
- package/src/core/brain/doctor.ts +911 -0
- package/src/core/brain/document-retire.ts +461 -0
- package/src/core/brain/dream-apply.ts +904 -0
- package/src/core/brain/dream-gates.ts +155 -0
- package/src/core/brain/dream-outcome.ts +125 -0
- package/src/core/brain/dream-owner/constants.ts +38 -0
- package/src/core/brain/dream-owner/create.ts +62 -0
- package/src/core/brain/dream-owner/fold.ts +179 -0
- package/src/core/brain/dream-owner/gate.ts +305 -0
- package/src/core/brain/dream-owner/owner.ts +409 -0
- package/src/core/brain/dream-owner/pass-record.ts +42 -0
- package/src/core/brain/dream-owner/status.ts +205 -0
- package/src/core/brain/dream-phases.ts +49 -0
- package/src/core/brain/dream-plan-cross-topic.ts +638 -0
- package/src/core/brain/dream-plan-retires.ts +136 -0
- package/src/core/brain/dream-plan-topics.ts +643 -0
- package/src/core/brain/dream-plan.ts +437 -0
- package/src/core/brain/dream-queue/agent-check.ts +187 -0
- package/src/core/brain/dream-queue/agent-config.ts +179 -0
- package/src/core/brain/dream-queue/agent-executor.ts +331 -0
- package/src/core/brain/dream-queue/agent-presets.ts +58 -0
- package/src/core/brain/dream-queue/agent-verified.ts +104 -0
- package/src/core/brain/dream-queue/constants.ts +90 -0
- package/src/core/brain/dream-queue/decision-executor.ts +439 -0
- package/src/core/brain/dream-queue/dream-session.ts +71 -0
- package/src/core/brain/dream-queue/fold.ts +516 -0
- package/src/core/brain/dream-queue/operations.ts +107 -0
- package/src/core/brain/dream-queue/pass.ts +134 -0
- package/src/core/brain/dream-queue/queue.ts +1370 -0
- package/src/core/brain/dream-queue/records.ts +293 -0
- package/src/core/brain/dream-queue/rollup-work.ts +313 -0
- package/src/core/brain/dream-queue/run-record.ts +361 -0
- package/src/core/brain/dream-queue/status-view.ts +415 -0
- package/src/core/brain/dream-refresh.ts +502 -0
- package/src/core/brain/dream-replay/admission.ts +247 -0
- package/src/core/brain/dream-replay/behind.ts +89 -0
- package/src/core/brain/dream-replay/bootstrap.ts +220 -0
- package/src/core/brain/dream-replay/fold.ts +208 -0
- package/src/core/brain/dream-replay/ledgers.ts +237 -0
- package/src/core/brain/dream-replay/loop.ts +511 -0
- package/src/core/brain/dream-replay/pass.ts +128 -0
- package/src/core/brain/dream-replay/plan.ts +157 -0
- package/src/core/brain/dream-replay/privacy.ts +62 -0
- package/src/core/brain/dream-replay/reconcile.ts +69 -0
- package/src/core/brain/dream-replay/records.ts +184 -0
- package/src/core/brain/dream-replay/status-view.ts +127 -0
- package/src/core/brain/dream-replay/transfer.ts +137 -0
- package/src/core/brain/dream-replay/window.ts +160 -0
- package/src/core/brain/dream-report.ts +398 -0
- package/src/core/brain/dream-rollup.ts +71 -0
- package/src/core/brain/dream-scan.ts +400 -0
- package/src/core/brain/dream-stage.ts +914 -0
- package/src/core/brain/dream-step.ts +246 -0
- package/src/core/brain/dream-summary.ts +240 -0
- package/src/core/brain/dream-tail.ts +150 -0
- package/src/core/brain/dream-trigger/auto.ts +31 -0
- package/src/core/brain/dream-trigger/check.ts +170 -0
- package/src/core/brain/dream-trigger/claim.ts +206 -0
- package/src/core/brain/dream-trigger/constants.ts +53 -0
- package/src/core/brain/dream-trigger/due.ts +335 -0
- package/src/core/brain/dream-trigger/forget.ts +33 -0
- package/src/core/brain/dream-trigger/line.ts +67 -0
- package/src/core/brain/dream-trigger/outcome.ts +518 -0
- package/src/core/brain/dream-trigger/record.ts +366 -0
- package/src/core/brain/dream-trigger/status.ts +166 -0
- package/src/core/brain/dream-types.ts +412 -0
- package/src/core/brain/dream-workrun.ts +194 -0
- package/src/core/brain/dream.ts +1097 -0
- package/src/core/brain/entities/canonical.ts +802 -0
- package/src/core/brain/entities/index-builder.ts +308 -0
- package/src/core/brain/entities/label-hygiene.ts +319 -0
- package/src/core/brain/entities/lexicon.ts +444 -0
- package/src/core/brain/entities/page-merge.ts +683 -0
- package/src/core/brain/entities/page-privacy.ts +35 -0
- package/src/core/brain/entities/page-scope.ts +45 -0
- package/src/core/brain/entities/person-nicknames.ts +157 -0
- package/src/core/brain/entities/person-variants.ts +259 -0
- package/src/core/brain/entities/registry.ts +1070 -0
- package/src/core/brain/entities/semantic-dedup.ts +353 -0
- package/src/core/brain/entities/status-scope.ts +78 -0
- package/src/core/brain/entities/types.ts +86 -0
- package/src/core/brain/event-trace.ts +391 -0
- package/src/core/brain/evidence-read.ts +65 -0
- package/src/core/brain/evidence.ts +96 -0
- package/src/core/brain/exact-state.ts +363 -0
- package/src/core/brain/expiration-set.ts +449 -0
- package/src/core/brain/expiration.ts +115 -0
- package/src/core/brain/explorer-console.ts +269 -0
- package/src/core/brain/explorer.ts +615 -0
- package/src/core/brain/export-transcripts.ts +358 -0
- package/src/core/brain/export.ts +590 -0
- package/src/core/brain/extract-signals-prefilter.ts +541 -0
- package/src/core/brain/extract-signals.ts +990 -0
- package/src/core/brain/fact-extract.ts +610 -0
- package/src/core/brain/file-recall.ts +164 -0
- package/src/core/brain/freeze-marker.ts +331 -0
- package/src/core/brain/freeze.ts +171 -0
- package/src/core/brain/freshness.ts +222 -0
- package/src/core/brain/frontmatter-tiers.ts +247 -0
- package/src/core/brain/gaps/gap-loop.ts +572 -0
- package/src/core/brain/gaps/gap-recall.ts +153 -0
- package/src/core/brain/gate-telemetry.ts +231 -0
- package/src/core/brain/gates/durability.ts +338 -0
- package/src/core/brain/gates/recoverability.ts +277 -0
- package/src/core/brain/generation-reports.ts +245 -0
- package/src/core/brain/git/decisions.ts +199 -0
- package/src/core/brain/git/digest.ts +116 -0
- package/src/core/brain/git/identity.ts +29 -0
- package/src/core/brain/git/ingest.ts +222 -0
- package/src/core/brain/git/reader.ts +456 -0
- package/src/core/brain/git/store.ts +655 -0
- package/src/core/brain/gitignore-guard.ts +296 -0
- package/src/core/brain/governance/forget-plan.ts +213 -0
- package/src/core/brain/governance/store-unreachable.ts +44 -0
- package/src/core/brain/handoff.ts +176 -0
- package/src/core/brain/heal-enrich.ts +188 -0
- package/src/core/brain/heal-run.ts +211 -0
- package/src/core/brain/health/batch-inflation.ts +102 -0
- package/src/core/brain/health/concept-gap.ts +96 -0
- package/src/core/brain/health/contradiction.ts +379 -0
- package/src/core/brain/health/edit-history.ts +207 -0
- package/src/core/brain/health/iso-time.ts +32 -0
- package/src/core/brain/health/reconcile.ts +248 -0
- package/src/core/brain/health/remediation.ts +424 -0
- package/src/core/brain/health/stale-claim.ts +53 -0
- package/src/core/brain/health/thesis.ts +649 -0
- package/src/core/brain/health-baseline.ts +185 -0
- package/src/core/brain/host-memory-promotions.ts +101 -0
- package/src/core/brain/host-memory-write.ts +140 -0
- package/src/core/brain/host-path-free.ts +46 -0
- package/src/core/brain/hygiene/apply.ts +275 -0
- package/src/core/brain/hygiene/dedup-verdicts.ts +147 -0
- package/src/core/brain/hygiene/detectors/capture-scope.ts +327 -0
- package/src/core/brain/hygiene/detectors/conflicts.ts +47 -0
- package/src/core/brain/hygiene/detectors/dedup.ts +238 -0
- package/src/core/brain/hygiene/detectors/document-dedup.ts +595 -0
- package/src/core/brain/hygiene/detectors/freshness.ts +59 -0
- package/src/core/brain/hygiene/detectors/frontmatter-tags.ts +99 -0
- package/src/core/brain/hygiene/detectors/id.ts +17 -0
- package/src/core/brain/hygiene/detectors/slug-collisions.ts +176 -0
- package/src/core/brain/hygiene/detectors/tags.ts +252 -0
- package/src/core/brain/hygiene/detectors/usefulness.ts +89 -0
- package/src/core/brain/hygiene/plan.ts +81 -0
- package/src/core/brain/hygiene/resolve-conflicts.ts +133 -0
- package/src/core/brain/hygiene/scan.ts +93 -0
- package/src/core/brain/hygiene/types.ts +125 -0
- package/src/core/brain/idea-discovery.ts +382 -0
- package/src/core/brain/idea-lineage.ts +329 -0
- package/src/core/brain/idempotency-ledger.ts +426 -0
- package/src/core/brain/import-census.ts +152 -0
- package/src/core/brain/import-claude-memory.ts +536 -0
- package/src/core/brain/index.ts +168 -0
- package/src/core/brain/ingest/batch-plan.ts +749 -0
- package/src/core/brain/ingest/checkpoint.ts +202 -0
- package/src/core/brain/ingest/content-manifest.ts +693 -0
- package/src/core/brain/ingest/contract.ts +70 -0
- package/src/core/brain/ingest/extract-html.ts +815 -0
- package/src/core/brain/ingest/extract-source.ts +290 -0
- package/src/core/brain/ingest/extractable-gate.ts +147 -0
- package/src/core/brain/ingest/ingest.ts +1137 -0
- package/src/core/brain/ingest/pre-extract-hcl.ts +389 -0
- package/src/core/brain/ingest/pre-extract-seeds.ts +76 -0
- package/src/core/brain/ingest/pre-extract.ts +455 -0
- package/src/core/brain/ingest/reconcile.ts +106 -0
- package/src/core/brain/ingest/source-formats.ts +210 -0
- package/src/core/brain/ingest/source-read.ts +84 -0
- package/src/core/brain/ingest/sources-registry.ts +151 -0
- package/src/core/brain/ingest/table-note.ts +519 -0
- package/src/core/brain/ingest/tail-read.ts +188 -0
- package/src/core/brain/init-store.ts +150 -0
- package/src/core/brain/init.ts +673 -0
- package/src/core/brain/inject-failopen.ts +123 -0
- package/src/core/brain/inject-governor.ts +250 -0
- package/src/core/brain/inline-rewrite.ts +110 -0
- package/src/core/brain/inline-scan.ts +338 -0
- package/src/core/brain/inline.ts +924 -0
- package/src/core/brain/intake/extract-intake.ts +587 -0
- package/src/core/brain/intake/page-entity-links.ts +198 -0
- package/src/core/brain/intake/source-trust.ts +508 -0
- package/src/core/brain/intent-review.ts +256 -0
- package/src/core/brain/intentions.ts +223 -0
- package/src/core/brain/label-suggest.ts +292 -0
- package/src/core/brain/labels.ts +247 -0
- package/src/core/brain/ledger-shards.ts +447 -0
- package/src/core/brain/lessons-promotion.ts +966 -0
- package/src/core/brain/lessons.ts +714 -0
- package/src/core/brain/lifecycle/correction.ts +727 -0
- package/src/core/brain/lifecycle/curator.ts +75 -0
- package/src/core/brain/lifecycle/memory-target.ts +845 -0
- package/src/core/brain/lifecycle/temporal-replace.ts +212 -0
- package/src/core/brain/lifecycle/tombstone-read.ts +323 -0
- package/src/core/brain/lifecycle/tombstone.ts +329 -0
- package/src/core/brain/lifecycle/validity.ts +109 -0
- package/src/core/brain/lineage/crutch.ts +515 -0
- package/src/core/brain/lineage/identity.ts +459 -0
- package/src/core/brain/lineage/ledger.ts +1203 -0
- package/src/core/brain/lineage/resolve.ts +182 -0
- package/src/core/brain/lineage/types.ts +82 -0
- package/src/core/brain/lineage/verify.ts +364 -0
- package/src/core/brain/link-graph/alias-index.ts +166 -0
- package/src/core/brain/link-graph/bridge-discovery.ts +431 -0
- package/src/core/brain/link-graph/co-occurrence.ts +295 -0
- package/src/core/brain/link-graph/communities.ts +430 -0
- package/src/core/brain/link-graph/concept-cluster.ts +152 -0
- package/src/core/brain/link-graph/format-wikilink.ts +211 -0
- package/src/core/brain/link-graph/graph-holdout.ts +200 -0
- package/src/core/brain/link-graph/graph-index.ts +185 -0
- package/src/core/brain/link-graph/hallways.ts +581 -0
- package/src/core/brain/link-graph/hub-candidates.ts +441 -0
- package/src/core/brain/link-graph/minimal-spelling.ts +110 -0
- package/src/core/brain/link-graph/moc-audit.ts +371 -0
- package/src/core/brain/link-graph/orphan-repair.ts +259 -0
- package/src/core/brain/link-graph/parse-wikilink.ts +202 -0
- package/src/core/brain/link-graph/repair-lane.ts +726 -0
- package/src/core/brain/link-graph/session-mining.ts +666 -0
- package/src/core/brain/link-graph/unlinked-mentions.ts +273 -0
- package/src/core/brain/lint-consolidate.ts +426 -0
- package/src/core/brain/llm-step.ts +110 -0
- package/src/core/brain/log-append-io.ts +272 -0
- package/src/core/brain/log-chain.ts +414 -0
- package/src/core/brain/log-days.ts +340 -0
- package/src/core/brain/log-events-at-reach.ts +198 -0
- package/src/core/brain/log-jsonl.ts +447 -0
- package/src/core/brain/log.ts +1034 -0
- package/src/core/brain/maintenance/action-scorer.ts +144 -0
- package/src/core/brain/maintenance/collect.ts +163 -0
- package/src/core/brain/maintenance/custom-task-id.ts +25 -0
- package/src/core/brain/maintenance/custom-tasks.ts +551 -0
- package/src/core/brain/maintenance/host-pressure.ts +501 -0
- package/src/core/brain/maintenance/journal.ts +413 -0
- package/src/core/brain/maintenance/lane-tasks.ts +284 -0
- package/src/core/brain/maintenance/lane.ts +774 -0
- package/src/core/brain/maintenance/lease.ts +143 -0
- package/src/core/brain/maintenance/reindex-task.ts +168 -0
- package/src/core/brain/maintenance/relink-anchors-task.ts +768 -0
- package/src/core/brain/manifest.ts +610 -0
- package/src/core/brain/marginal-value-stop.ts +83 -0
- package/src/core/brain/marker-routing.ts +225 -0
- package/src/core/brain/marker-writeback.ts +607 -0
- package/src/core/brain/mcp-route-metrics.ts +330 -0
- package/src/core/brain/memory-cost-meter.ts +240 -0
- package/src/core/brain/memory-page-records.ts +84 -0
- package/src/core/brain/memory-pages.ts +698 -0
- package/src/core/brain/merge-candidates.ts +134 -0
- package/src/core/brain/merge.ts +453 -0
- package/src/core/brain/metrics.ts +291 -0
- package/src/core/brain/model-window.ts +278 -0
- package/src/core/brain/monthly-review.ts +120 -0
- package/src/core/brain/morning-brief.ts +279 -0
- package/src/core/brain/most-applied.ts +124 -0
- package/src/core/brain/nav-inject.ts +49 -0
- package/src/core/brain/navmap.ts +109 -0
- package/src/core/brain/near-duplicate-vectors.ts +178 -0
- package/src/core/brain/near-duplicate.ts +141 -0
- package/src/core/brain/negative-recall.ts +755 -0
- package/src/core/brain/next-step.ts +99 -0
- package/src/core/brain/no-vault.ts +49 -0
- package/src/core/brain/note-history.ts +178 -0
- package/src/core/brain/note-path.ts +57 -0
- package/src/core/brain/note.ts +198 -0
- package/src/core/brain/notes/blank-overwrite-guard.ts +88 -0
- package/src/core/brain/notes/create-note-privacy.ts +46 -0
- package/src/core/brain/notes/create-note.ts +919 -0
- package/src/core/brain/notes/folder-lifecycle.ts +1428 -0
- package/src/core/brain/notes/index-refresh.ts +346 -0
- package/src/core/brain/notes/lifecycle.ts +1414 -0
- package/src/core/brain/notes/link-candidates.ts +227 -0
- package/src/core/brain/notes/log-window.ts +147 -0
- package/src/core/brain/notes/note-template.ts +299 -0
- package/src/core/brain/notes/note-title-resolver.ts +169 -0
- package/src/core/brain/notes/note-walk.ts +194 -0
- package/src/core/brain/notes/revert.ts +774 -0
- package/src/core/brain/notes/scaffold-stub.ts +541 -0
- package/src/core/brain/notes/write-destinations.ts +330 -0
- package/src/core/brain/notes/write-log.ts +228 -0
- package/src/core/brain/notes/write-record.ts +408 -0
- package/src/core/brain/obligations.ts +749 -0
- package/src/core/brain/observed-use.ts +209 -0
- package/src/core/brain/offset-cursor.ts +76 -0
- package/src/core/brain/open-loops.ts +248 -0
- package/src/core/brain/operator-snapshot.ts +577 -0
- package/src/core/brain/owner-scope-view.ts +131 -0
- package/src/core/brain/owner-scoped-facts.ts +43 -0
- package/src/core/brain/pack-stamp.ts +274 -0
- package/src/core/brain/page-dedup.ts +752 -0
- package/src/core/brain/page-lint-widening.ts +210 -0
- package/src/core/brain/page-lint.ts +969 -0
- package/src/core/brain/page-meta/confidence.ts +33 -0
- package/src/core/brain/page-meta/lifecycle.ts +85 -0
- package/src/core/brain/page-meta/page-id.ts +534 -0
- package/src/core/brain/page-meta/tier.ts +53 -0
- package/src/core/brain/parse-error.ts +84 -0
- package/src/core/brain/path-constants.ts +425 -0
- package/src/core/brain/paths.ts +1264 -0
- package/src/core/brain/payload-inventory.ts +539 -0
- package/src/core/brain/payload-json.ts +133 -0
- package/src/core/brain/payload-registry.ts +305 -0
- package/src/core/brain/pending/pending-lanes.ts +905 -0
- package/src/core/brain/pending.ts +160 -0
- package/src/core/brain/permissions/document-source.ts +100 -0
- package/src/core/brain/permissions/document.ts +638 -0
- package/src/core/brain/permissions/ledger.ts +302 -0
- package/src/core/brain/permissions/resolve.ts +130 -0
- package/src/core/brain/pin.ts +205 -0
- package/src/core/brain/pinned.ts +410 -0
- package/src/core/brain/planted-rows.ts +573 -0
- package/src/core/brain/pledge-intake.ts +632 -0
- package/src/core/brain/pledges.ts +971 -0
- package/src/core/brain/policy/blocks/active.ts +251 -0
- package/src/core/brain/policy/blocks/context.ts +87 -0
- package/src/core/brain/policy/blocks/continuity-hygiene.ts +96 -0
- package/src/core/brain/policy/blocks/decision-model.ts +60 -0
- package/src/core/brain/policy/blocks/discipline-report.ts +105 -0
- package/src/core/brain/policy/blocks/embeddings.ts +127 -0
- package/src/core/brain/policy/blocks/feedback.ts +53 -0
- package/src/core/brain/policy/blocks/guardrails.ts +215 -0
- package/src/core/brain/policy/blocks/health.ts +134 -0
- package/src/core/brain/policy/blocks/install.ts +131 -0
- package/src/core/brain/policy/blocks/integrity.ts +162 -0
- package/src/core/brain/policy/blocks/lessons.ts +146 -0
- package/src/core/brain/policy/blocks/lifecycle.ts +200 -0
- package/src/core/brain/policy/blocks/link-graph.ts +125 -0
- package/src/core/brain/policy/blocks/maintenance.ts +129 -0
- package/src/core/brain/policy/blocks/notes.ts +83 -0
- package/src/core/brain/policy/blocks/quote-check.ts +45 -0
- package/src/core/brain/policy/blocks/recall-inject.ts +192 -0
- package/src/core/brain/policy/blocks/rollup.ts +31 -0
- package/src/core/brain/policy/blocks/schema.ts +118 -0
- package/src/core/brain/policy/blocks/sessions.ts +124 -0
- package/src/core/brain/policy/blocks/storage.ts +282 -0
- package/src/core/brain/policy/blocks/temporal.ts +110 -0
- package/src/core/brain/policy/blocks/vault-scope.ts +169 -0
- package/src/core/brain/policy/blocks/write-binding.ts +113 -0
- package/src/core/brain/policy/defaults.ts +71 -0
- package/src/core/brain/policy/errors.ts +50 -0
- package/src/core/brain/policy/field-checks.ts +153 -0
- package/src/core/brain/policy/key-index.ts +143 -0
- package/src/core/brain/policy/load.ts +468 -0
- package/src/core/brain/policy/primary-agent.ts +59 -0
- package/src/core/brain/policy/settings-entry-authority.ts +105 -0
- package/src/core/brain/policy/settings-keys.ts +163 -0
- package/src/core/brain/policy/settings-names.ts +252 -0
- package/src/core/brain/policy/settings-source.ts +366 -0
- package/src/core/brain/policy/settings-store-commit.ts +115 -0
- package/src/core/brain/policy/settings-write.ts +777 -0
- package/src/core/brain/policy/settings-yaml-edit.ts +152 -0
- package/src/core/brain/policy/validate.ts +254 -0
- package/src/core/brain/policy.ts +177 -0
- package/src/core/brain/portability/bundle.ts +251 -0
- package/src/core/brain/portability/codec.ts +80 -0
- package/src/core/brain/portability/graph.ts +353 -0
- package/src/core/brain/portability/knowledge-pack.ts +1446 -0
- package/src/core/brain/portability/okf.ts +1755 -0
- package/src/core/brain/portability/origin-reach.ts +123 -0
- package/src/core/brain/portability/origins.ts +104 -0
- package/src/core/brain/portability/pack-stamp.ts +63 -0
- package/src/core/brain/portability/page-contract.ts +139 -0
- package/src/core/brain/portability/pointer.ts +262 -0
- package/src/core/brain/portability/preference-restore.ts +830 -0
- package/src/core/brain/portability/profiles.ts +219 -0
- package/src/core/brain/portability/recall-sources.ts +172 -0
- package/src/core/brain/portability/role-tokens.ts +165 -0
- package/src/core/brain/portability/sources.ts +123 -0
- package/src/core/brain/portability/vault-map-document.ts +34 -0
- package/src/core/brain/post-compact-audit.ts +448 -0
- package/src/core/brain/pre-compact-extract.ts +239 -0
- package/src/core/brain/pre-compress-pack.ts +388 -0
- package/src/core/brain/pref-audit.ts +397 -0
- package/src/core/brain/preference-body.ts +372 -0
- package/src/core/brain/preference-page-meta.ts +66 -0
- package/src/core/brain/preference-page-write.ts +249 -0
- package/src/core/brain/preference-provenance.ts +194 -0
- package/src/core/brain/preference-store.ts +135 -0
- package/src/core/brain/preference-txn.ts +446 -0
- package/src/core/brain/preference.ts +2398 -0
- package/src/core/brain/preferences-collect.ts +371 -0
- package/src/core/brain/present-time.ts +71 -0
- package/src/core/brain/pretool-host-backup.ts +353 -0
- package/src/core/brain/pretool-orient.ts +147 -0
- package/src/core/brain/privacy-marker-restamp.ts +429 -0
- package/src/core/brain/procedural-graph.ts +369 -0
- package/src/core/brain/procedural-hints.ts +85 -0
- package/src/core/brain/procedural-memory.ts +510 -0
- package/src/core/brain/profile-doc.ts +205 -0
- package/src/core/brain/progress.ts +386 -0
- package/src/core/brain/prompt-prefix.ts +149 -0
- package/src/core/brain/protect.ts +1014 -0
- package/src/core/brain/provenance/capture-scope.ts +249 -0
- package/src/core/brain/provenance/content-class.ts +342 -0
- package/src/core/brain/provenance/epistemic.ts +120 -0
- package/src/core/brain/provenance/page-origin.ts +169 -0
- package/src/core/brain/provenance/provenance.ts +117 -0
- package/src/core/brain/provenance/source-archive.ts +430 -0
- package/src/core/brain/provenance/trust-order.ts +34 -0
- package/src/core/brain/query-demand.ts +607 -0
- package/src/core/brain/query.ts +487 -0
- package/src/core/brain/quote-check-modes.ts +47 -0
- package/src/core/brain/reach-view.ts +68 -0
- package/src/core/brain/recall-adequacy.ts +246 -0
- package/src/core/brain/recall-budget.ts +356 -0
- package/src/core/brain/recall-inject-decision.ts +243 -0
- package/src/core/brain/recall-inject.ts +1420 -0
- package/src/core/brain/recall-telemetry.ts +568 -0
- package/src/core/brain/receipts/compact.ts +832 -0
- package/src/core/brain/receipts/scan.ts +409 -0
- package/src/core/brain/receipts/types.ts +292 -0
- package/src/core/brain/receipts/views.ts +96 -0
- package/src/core/brain/recent-turns.ts +156 -0
- package/src/core/brain/recompile.ts +320 -0
- package/src/core/brain/reconcile-domains.ts +143 -0
- package/src/core/brain/reconcile-outcomes.ts +109 -0
- package/src/core/brain/record-name.ts +74 -0
- package/src/core/brain/record-origin.ts +102 -0
- package/src/core/brain/recurrence.ts +332 -0
- package/src/core/brain/regions.ts +149 -0
- package/src/core/brain/reground-parts.ts +235 -0
- package/src/core/brain/render/activity-line.ts +81 -0
- package/src/core/brain/report-snapshot.ts +259 -0
- package/src/core/brain/research/external-fetch.ts +328 -0
- package/src/core/brain/research/extract.ts +61 -0
- package/src/core/brain/research/providers/brave.ts +51 -0
- package/src/core/brain/research/providers/provider.ts +27 -0
- package/src/core/brain/research/providers/tavily.ts +47 -0
- package/src/core/brain/research/research.ts +501 -0
- package/src/core/brain/response-checks.ts +178 -0
- package/src/core/brain/response-shape.ts +462 -0
- package/src/core/brain/retention.ts +197 -0
- package/src/core/brain/retire-siblings.ts +110 -0
- package/src/core/brain/retrieval-plan.ts +255 -0
- package/src/core/brain/review-candidates.ts +360 -0
- package/src/core/brain/rollup-ladder.ts +246 -0
- package/src/core/brain/runtime-notices.ts +505 -0
- package/src/core/brain/safeguard.ts +255 -0
- package/src/core/brain/safety/context-guard.ts +235 -0
- package/src/core/brain/salience-gate.ts +363 -0
- package/src/core/brain/schema-admin.ts +510 -0
- package/src/core/brain/schema-integrity.ts +502 -0
- package/src/core/brain/schema-mutate-store.ts +257 -0
- package/src/core/brain/schema-mutate.ts +798 -0
- package/src/core/brain/schema-pack-store.ts +313 -0
- package/src/core/brain/schema-pack.ts +588 -0
- package/src/core/brain/schema-report.ts +473 -0
- package/src/core/brain/schema-vocab.ts +141 -0
- package/src/core/brain/scope-identity.ts +93 -0
- package/src/core/brain/scoped-rule-axis.ts +31 -0
- package/src/core/brain/scoped-rule-key.ts +42 -0
- package/src/core/brain/scoped-rules.ts +323 -0
- package/src/core/brain/sdk.ts +142 -0
- package/src/core/brain/secrets/bundle.ts +539 -0
- package/src/core/brain/secrets/crypto.ts +156 -0
- package/src/core/brain/secrets/device-token-path.ts +18 -0
- package/src/core/brain/secrets/envelope.ts +726 -0
- package/src/core/brain/secrets/exec.ts +194 -0
- package/src/core/brain/secrets/owner-acl.ts +165 -0
- package/src/core/brain/secrets/store.ts +610 -0
- package/src/core/brain/secrets/sync-exposure.ts +263 -0
- package/src/core/brain/secrets/token-store.ts +542 -0
- package/src/core/brain/secrets/value-cipher.ts +58 -0
- package/src/core/brain/semantics-backfill.ts +99 -0
- package/src/core/brain/session-checkpoint.ts +360 -0
- package/src/core/brain/session-lifecycle.ts +926 -0
- package/src/core/brain/session-mining-ledger.ts +350 -0
- package/src/core/brain/session-mining-surveys.ts +240 -0
- package/src/core/brain/session-recall.ts +1667 -0
- package/src/core/brain/session-scope.ts +41 -0
- package/src/core/brain/session-summary.ts +465 -0
- package/src/core/brain/sessions/checkpoint.ts +362 -0
- package/src/core/brain/sessions/claude.ts +140 -0
- package/src/core/brain/sessions/codex.ts +153 -0
- package/src/core/brain/sessions/discover.ts +468 -0
- package/src/core/brain/sessions/dream-transcript.ts +38 -0
- package/src/core/brain/sessions/grok.ts +188 -0
- package/src/core/brain/sessions/hermes.ts +132 -0
- package/src/core/brain/sessions/import.ts +984 -0
- package/src/core/brain/sessions/mining-census.ts +234 -0
- package/src/core/brain/sessions/opencode.ts +137 -0
- package/src/core/brain/sessions/read-lines.ts +147 -0
- package/src/core/brain/sessions/registry.ts +114 -0
- package/src/core/brain/sessions/session-files.ts +124 -0
- package/src/core/brain/sessions/types.ts +184 -0
- package/src/core/brain/sessions/validate-feedback.ts +130 -0
- package/src/core/brain/set-primary.ts +122 -0
- package/src/core/brain/shared-namespace.ts +297 -0
- package/src/core/brain/sign.ts +65 -0
- package/src/core/brain/signal-archive.ts +180 -0
- package/src/core/brain/signal-retire.ts +301 -0
- package/src/core/brain/signal-state.ts +339 -0
- package/src/core/brain/signal.ts +1270 -0
- package/src/core/brain/similarity.ts +84 -0
- package/src/core/brain/skill-accept-journal.ts +413 -0
- package/src/core/brain/skill-page-drafts.ts +443 -0
- package/src/core/brain/skill-proposal-verifier.ts +100 -0
- package/src/core/brain/skill-proposals.ts +2852 -0
- package/src/core/brain/skill-rewrite-spec.ts +323 -0
- package/src/core/brain/skill-rewrite-tasks.ts +362 -0
- package/src/core/brain/skill-rewrite.ts +793 -0
- package/src/core/brain/skill-usage.ts +350 -0
- package/src/core/brain/snapshot-diff-render.ts +134 -0
- package/src/core/brain/snapshot-diff.ts +421 -0
- package/src/core/brain/snapshot-gate.ts +531 -0
- package/src/core/brain/snapshot-transient.ts +116 -0
- package/src/core/brain/snapshot.ts +4059 -0
- package/src/core/brain/source-cleanup.ts +1091 -0
- package/src/core/brain/source-links.ts +133 -0
- package/src/core/brain/stale-dependency.ts +552 -0
- package/src/core/brain/staleness.ts +316 -0
- package/src/core/brain/standing-rules-write.ts +93 -0
- package/src/core/brain/standing-rules.ts +451 -0
- package/src/core/brain/status.ts +650 -0
- package/src/core/brain/storage/capacity-error.ts +45 -0
- package/src/core/brain/storage/forecast.ts +450 -0
- package/src/core/brain/storage/gate-config.ts +135 -0
- package/src/core/brain/storage/gate.ts +241 -0
- package/src/core/brain/storage/usage.ts +388 -0
- package/src/core/brain/store-record-visibility.ts +176 -0
- package/src/core/brain/surprisal.ts +104 -0
- package/src/core/brain/sync-lockfile.ts +854 -0
- package/src/core/brain/tag-syntax.ts +119 -0
- package/src/core/brain/tar-extract.ts +197 -0
- package/src/core/brain/tar-names.ts +251 -0
- package/src/core/brain/tar-writer.ts +206 -0
- package/src/core/brain/templates/_BRAIN.md.tpl +175 -0
- package/src/core/brain/templates/bases/daily.base +21 -0
- package/src/core/brain/templates/bases/people.base +47 -0
- package/src/core/brain/templates/bases/projects.base +59 -0
- package/src/core/brain/templates/bases/tasks.base +42 -0
- package/src/core/brain/templates.ts +238 -0
- package/src/core/brain/temporal/activity-timeline.ts +176 -0
- package/src/core/brain/temporal/belief-evolution.ts +348 -0
- package/src/core/brain/temporal/build-index.ts +413 -0
- package/src/core/brain/temporal/citations.ts +381 -0
- package/src/core/brain/temporal/daily-brief.ts +102 -0
- package/src/core/brain/temporal/foresight.ts +150 -0
- package/src/core/brain/temporal/freshness-trend.ts +151 -0
- package/src/core/brain/temporal/period-common.ts +129 -0
- package/src/core/brain/temporal/select-events.ts +69 -0
- package/src/core/brain/temporal/stale-watch.ts +217 -0
- package/src/core/brain/temporal/types.ts +126 -0
- package/src/core/brain/temporal/weekly-brief.ts +334 -0
- package/src/core/brain/temporal-extract.ts +109 -0
- package/src/core/brain/tension-verdicts.ts +204 -0
- package/src/core/brain/tensions.ts +794 -0
- package/src/core/brain/text/neutralize-markdown.ts +710 -0
- package/src/core/brain/text/normalize.ts +28 -0
- package/src/core/brain/text/sanitize-principle.ts +68 -0
- package/src/core/brain/text/text-budget.ts +446 -0
- package/src/core/brain/text/tokenizer.ts +38 -0
- package/src/core/brain/thread-topics.ts +157 -0
- package/src/core/brain/time.ts +173 -0
- package/src/core/brain/today-dashboard.ts +463 -0
- package/src/core/brain/token-footprint.ts +199 -0
- package/src/core/brain/token-impact.ts +568 -0
- package/src/core/brain/tool-outcome.ts +25 -0
- package/src/core/brain/triggers/adapters.ts +93 -0
- package/src/core/brain/triggers/brief.ts +53 -0
- package/src/core/brain/triggers/scan.ts +83 -0
- package/src/core/brain/triggers/store.ts +1766 -0
- package/src/core/brain/triggers/types.ts +209 -0
- package/src/core/brain/trust/assess-rule-quality.ts +129 -0
- package/src/core/brain/trust/check-role-permission.ts +91 -0
- package/src/core/brain/trust/compute-trust-verdict.ts +58 -0
- package/src/core/brain/trust/compute-verification-delta.ts +295 -0
- package/src/core/brain/trust/instruction-file-ceiling.ts +97 -0
- package/src/core/brain/trust/operator-summary.ts +420 -0
- package/src/core/brain/trust/owner-write-gate.ts +171 -0
- package/src/core/brain/trust/retrieval-gate.ts +259 -0
- package/src/core/brain/trust/retrieval-receipts.ts +263 -0
- package/src/core/brain/trust/role.ts +65 -0
- package/src/core/brain/trust/self-approval-guardrail.ts +61 -0
- package/src/core/brain/trust/untrusted-provenance.ts +101 -0
- package/src/core/brain/truth/aggregate.ts +101 -0
- package/src/core/brain/truth/claim-provenance.ts +346 -0
- package/src/core/brain/truth/collision.ts +119 -0
- package/src/core/brain/truth/conflicts.ts +130 -0
- package/src/core/brain/truth/contamination.ts +132 -0
- package/src/core/brain/truth/correction-policy.ts +60 -0
- package/src/core/brain/truth/events-window.ts +160 -0
- package/src/core/brain/truth/fold.ts +127 -0
- package/src/core/brain/truth/grounding.ts +205 -0
- package/src/core/brain/truth/ingest.ts +92 -0
- package/src/core/brain/truth/merge-guard.ts +127 -0
- package/src/core/brain/truth/stated-claims.ts +256 -0
- package/src/core/brain/truth/store.ts +852 -0
- package/src/core/brain/truth/succession.ts +117 -0
- package/src/core/brain/truth/types.ts +187 -0
- package/src/core/brain/truth/validity.ts +203 -0
- package/src/core/brain/types.ts +2642 -0
- package/src/core/brain/undated-quantity.ts +513 -0
- package/src/core/brain/untrusted-source.ts +242 -0
- package/src/core/brain/upgrade.ts +732 -0
- package/src/core/brain/vault-dirty.ts +201 -0
- package/src/core/brain/vault-identity.ts +424 -0
- package/src/core/brain/vault-instruction-file.ts +121 -0
- package/src/core/brain/vitals.ts +167 -0
- package/src/core/brain/watchdog.ts +303 -0
- package/src/core/brain/wikilink.ts +607 -0
- package/src/core/brain/write-advisory.ts +441 -0
- package/src/core/brain/write-batch-privacy.ts +145 -0
- package/src/core/brain/write-batch.ts +1461 -0
- package/src/core/brain/write-disposition.ts +392 -0
- package/src/core/brain/write-gate.ts +122 -0
- package/src/core/brain/write-path-advisory.ts +101 -0
- package/src/core/brain/write-refusal-exit.ts +16 -0
- package/src/core/brain/write-session/engine.ts +530 -0
- package/src/core/brain/write-session/panel-target.ts +110 -0
- package/src/core/brain/write-session/panel.ts +391 -0
- package/src/core/brain/write-session/personas.ts +240 -0
- package/src/core/brain/write-session/store.ts +382 -0
- package/src/core/brain/write-session/types.ts +149 -0
- package/src/core/brain/write-session/validate.ts +244 -0
- package/src/core/brain/writeback-contract.ts +614 -0
- package/src/core/brain/yaml-parse.ts +290 -0
- package/src/core/config.ts +2362 -0
- package/src/core/decision-model/advisory.ts +96 -0
- package/src/core/decision-model/answerable.ts +103 -0
- package/src/core/decision-model/answers.ts +162 -0
- package/src/core/decision-model/config-types.ts +159 -0
- package/src/core/decision-model/config.ts +892 -0
- package/src/core/decision-model/contract.ts +225 -0
- package/src/core/decision-model/converse.ts +363 -0
- package/src/core/decision-model/diagnostics.ts +1004 -0
- package/src/core/decision-model/egress-guard.ts +135 -0
- package/src/core/decision-model/eval/grade.ts +536 -0
- package/src/core/decision-model/eval/mark.ts +277 -0
- package/src/core/decision-model/eval/take.ts +278 -0
- package/src/core/decision-model/eval-spec.ts +316 -0
- package/src/core/decision-model/latency.ts +24 -0
- package/src/core/decision-model/llm-emulation.ts +436 -0
- package/src/core/decision-model/pair-verdict.ts +386 -0
- package/src/core/decision-model/presets.ts +360 -0
- package/src/core/decision-model/provider-entries.ts +43 -0
- package/src/core/decision-model/provider.ts +134 -0
- package/src/core/decision-model/questions-skills.ts +78 -0
- package/src/core/decision-model/questions-topics.ts +372 -0
- package/src/core/decision-model/questions.ts +420 -0
- package/src/core/decision-model/record.ts +473 -0
- package/src/core/decision-model/reports/answerable.ts +198 -0
- package/src/core/decision-model/reports/extract-prefilter.ts +295 -0
- package/src/core/decision-model/reports/index.ts +76 -0
- package/src/core/decision-model/reports/labels.ts +218 -0
- package/src/core/decision-model/reports/pair-verdict.ts +232 -0
- package/src/core/decision-model/reports/recall-inject.ts +175 -0
- package/src/core/decision-model/reports/skills.ts +136 -0
- package/src/core/decision-model/request-floor.ts +42 -0
- package/src/core/decision-model/run.ts +408 -0
- package/src/core/decision-model/state.ts +209 -0
- package/src/core/decision-model/systemone.ts +257 -0
- package/src/core/decision-model/thresholds-fit.ts +292 -0
- package/src/core/decision-model/thresholds.ts +323 -0
- package/src/core/decision-model/transport.ts +206 -0
- package/src/core/decision-model/use-thresholds.ts +41 -0
- package/src/core/decision-model/vercel-evaluate.ts +90 -0
- package/src/core/derived-store-guard.ts +87 -0
- package/src/core/diff.ts +37 -0
- package/src/core/discipline/activity-git.ts +71 -0
- package/src/core/discipline/activity-mtime.ts +76 -0
- package/src/core/discipline/complexity.ts +204 -0
- package/src/core/discipline/decision.ts +75 -0
- package/src/core/discipline/legacy-jobs.ts +37 -0
- package/src/core/discipline/log-counts.ts +59 -0
- package/src/core/discipline/render.ts +109 -0
- package/src/core/discipline/report.ts +139 -0
- package/src/core/discipline/transcripts/claude-code.ts +78 -0
- package/src/core/discipline/transcripts/codex.ts +77 -0
- package/src/core/discipline/transcripts/cursor.ts +180 -0
- package/src/core/discipline/transcripts/index.ts +86 -0
- package/src/core/discipline/transcripts/types.ts +138 -0
- package/src/core/discipline/vault-delta.ts +65 -0
- package/src/core/discipline/window.ts +85 -0
- package/src/core/doctor-hermes-parity.ts +300 -0
- package/src/core/doctor-readiness.ts +1984 -0
- package/src/core/doctor-selftest.ts +880 -0
- package/src/core/doctor.ts +478 -0
- package/src/core/egress/consent-stamp.ts +241 -0
- package/src/core/egress/guard.ts +384 -0
- package/src/core/egress/registry.ts +409 -0
- package/src/core/fs/git-discovery.ts +262 -0
- package/src/core/fs/ignore.ts +246 -0
- package/src/core/fs-atomic.ts +640 -0
- package/src/core/fs-identity.ts +80 -0
- package/src/core/fs-lock.ts +580 -0
- package/src/core/fs-stamp.ts +120 -0
- package/src/core/fs-utils.ts +84 -0
- package/src/core/graph/agent-scope.ts +147 -0
- package/src/core/graph/frontmatter-relations.ts +55 -0
- package/src/core/graph/mcp-config.ts +181 -0
- package/src/core/graph/privacy-markers.ts +146 -0
- package/src/core/graph/relation-vocab.ts +79 -0
- package/src/core/graph/transport-reach.ts +97 -0
- package/src/core/graph/unique-match.ts +43 -0
- package/src/core/graph/visibility.ts +153 -0
- package/src/core/hygiene/hardcoded-paths.ts +168 -0
- package/src/core/hygiene/scan-repo.ts +214 -0
- package/src/core/identity-reminder.ts +165 -0
- package/src/core/install/adapters/_json-mcp.ts +591 -0
- package/src/core/install/adapters/aider-wrapper.ts +181 -0
- package/src/core/install/adapters/aider.ts +330 -0
- package/src/core/install/adapters/all.ts +37 -0
- package/src/core/install/adapters/codex.ts +595 -0
- package/src/core/install/adapters/copilot-cli.ts +584 -0
- package/src/core/install/adapters/cursor.ts +30 -0
- package/src/core/install/adapters/gemini-cli.ts +23 -0
- package/src/core/install/adapters/generic.ts +182 -0
- package/src/core/install/adapters/grok.ts +261 -0
- package/src/core/install/adapters/kiro.ts +27 -0
- package/src/core/install/adapters/opencode.ts +863 -0
- package/src/core/install/adapters/pi.ts +268 -0
- package/src/core/install/command-probe.ts +287 -0
- package/src/core/install/env.ts +69 -0
- package/src/core/install/friction.ts +391 -0
- package/src/core/install/grok-asset.ts +223 -0
- package/src/core/install/grok-config.ts +100 -0
- package/src/core/install/host-kinds.ts +34 -0
- package/src/core/install/host-probe.ts +385 -0
- package/src/core/install/identity.ts +52 -0
- package/src/core/install/instruction-block.ts +537 -0
- package/src/core/install/integrations.ts +25 -0
- package/src/core/install/json-merge.ts +126 -0
- package/src/core/install/jsonc.ts +789 -0
- package/src/core/install/managed-block.ts +190 -0
- package/src/core/install/manifest.ts +110 -0
- package/src/core/install/opencode-plugin-asset.ts +43 -0
- package/src/core/install/origin.ts +76 -0
- package/src/core/install/ownership-measure.ts +291 -0
- package/src/core/install/ownership.ts +1161 -0
- package/src/core/install/payload-equals.ts +91 -0
- package/src/core/install/payload-host.ts +160 -0
- package/src/core/install/payload.ts +191 -0
- package/src/core/install/registry.ts +46 -0
- package/src/core/install/rules-block.ts +659 -0
- package/src/core/install/session-paths.ts +41 -0
- package/src/core/install/settings.ts +231 -0
- package/src/core/install/types.ts +223 -0
- package/src/core/install/update.ts +177 -0
- package/src/core/integrity/degradation.ts +243 -0
- package/src/core/integrity/digest.ts +183 -0
- package/src/core/integrity/stamp.ts +208 -0
- package/src/core/maintenance/dependency-tree.ts +89 -0
- package/src/core/maintenance/ensure-current.ts +916 -0
- package/src/core/maintenance/o2b-command.ts +223 -0
- package/src/core/maintenance/self-heal-reindex.ts +265 -0
- package/src/core/maintenance/self-heal-upgrade-state.ts +611 -0
- package/src/core/maintenance/self-heal-upgrade.ts +275 -0
- package/src/core/markdown-fence.ts +24 -0
- package/src/core/math.ts +12 -0
- package/src/core/migration-gate.ts +731 -0
- package/src/core/origin-channel.ts +207 -0
- package/src/core/partner/codegraph-health.ts +192 -0
- package/src/core/partner/codegraph-report.ts +319 -0
- package/src/core/partner/codegraph.ts +631 -0
- package/src/core/path-safety.ts +381 -0
- package/src/core/platform-dirs.ts +178 -0
- package/src/core/process/run-program.ts +235 -0
- package/src/core/project-manifests.ts +85 -0
- package/src/core/reconciliation-report.ts +206 -0
- package/src/core/record-path.ts +93 -0
- package/src/core/redactor.ts +1362 -0
- package/src/core/reliability/audit.ts +230 -0
- package/src/core/reliability/command-bridge.ts +79 -0
- package/src/core/reliability/lock.ts +49 -0
- package/src/core/reliability/probe.ts +32 -0
- package/src/core/removed-surfaces.ts +65 -0
- package/src/core/route-scope.ts +106 -0
- package/src/core/runtime/collect-garbage.ts +25 -0
- package/src/core/runtime/host-facts.ts +721 -0
- package/src/core/scope-key.ts +136 -0
- package/src/core/search/activation/decay.ts +91 -0
- package/src/core/search/activation/store.ts +311 -0
- package/src/core/search/activation/types.ts +54 -0
- package/src/core/search/authored-at.ts +60 -0
- package/src/core/search/benchmark.ts +456 -0
- package/src/core/search/brain-store/catch-up.ts +1155 -0
- package/src/core/search/brain-store/changes.ts +164 -0
- package/src/core/search/brain-store/constants.ts +112 -0
- package/src/core/search/brain-store/entity-filter.ts +176 -0
- package/src/core/search/brain-store/forgotten.ts +318 -0
- package/src/core/search/brain-store/index-summary.ts +72 -0
- package/src/core/search/brain-store/ingest.ts +204 -0
- package/src/core/search/brain-store/location.ts +246 -0
- package/src/core/search/brain-store/orphans.ts +113 -0
- package/src/core/search/brain-store/prefix-hash.ts +49 -0
- package/src/core/search/brain-store/record-text.ts +168 -0
- package/src/core/search/brain-store/shard-scan.ts +169 -0
- package/src/core/search/build-progress.ts +566 -0
- package/src/core/search/capability-tier.ts +190 -0
- package/src/core/search/cards.ts +291 -0
- package/src/core/search/chunker.ts +880 -0
- package/src/core/search/cjk-tokenizer.ts +165 -0
- package/src/core/search/corpus-generation.ts +33 -0
- package/src/core/search/correction-coupling.ts +93 -0
- package/src/core/search/coverage.ts +358 -0
- package/src/core/search/cross-vault.ts +418 -0
- package/src/core/search/decider-step.ts +463 -0
- package/src/core/search/disclosure-mode.ts +30 -0
- package/src/core/search/embedding-spend.ts +261 -0
- package/src/core/search/embeddings/configured-provider.ts +44 -0
- package/src/core/search/embeddings/contract.ts +102 -0
- package/src/core/search/embeddings/credential-report.ts +102 -0
- package/src/core/search/embeddings/http-util.ts +435 -0
- package/src/core/search/embeddings/local-provider.ts +83 -0
- package/src/core/search/embeddings/null-provider.ts +37 -0
- package/src/core/search/embeddings/openai-compat.ts +573 -0
- package/src/core/search/embeddings/presets.ts +299 -0
- package/src/core/search/embeddings/pricing.ts +100 -0
- package/src/core/search/embeddings/provider-resolve.ts +99 -0
- package/src/core/search/embeddings/provider-semaphore.ts +152 -0
- package/src/core/search/embeddings/provider.ts +89 -0
- package/src/core/search/embeddings/query-embed.ts +257 -0
- package/src/core/search/embeddings/registry.ts +227 -0
- package/src/core/search/embeddings/signature.ts +310 -0
- package/src/core/search/embeddings/sunset.ts +544 -0
- package/src/core/search/embeddings/zeroentropy.ts +318 -0
- package/src/core/search/enrich.ts +161 -0
- package/src/core/search/entities.ts +100 -0
- package/src/core/search/entity-alias.ts +212 -0
- package/src/core/search/entity-refresh.ts +122 -0
- package/src/core/search/event-anchor-backfill.ts +130 -0
- package/src/core/search/event-anchor.ts +232 -0
- package/src/core/search/event-time-status.ts +81 -0
- package/src/core/search/evidence-pack.ts +221 -0
- package/src/core/search/evidence-verification.ts +170 -0
- package/src/core/search/explain-envelope.ts +183 -0
- package/src/core/search/feedback.ts +554 -0
- package/src/core/search/freshen.ts +794 -0
- package/src/core/search/fts-match-mode.ts +31 -0
- package/src/core/search/fts-safety.ts +64 -0
- package/src/core/search/fts.ts +130 -0
- package/src/core/search/fusion.ts +139 -0
- package/src/core/search/graph-phases.ts +119 -0
- package/src/core/search/graph-prepass.ts +278 -0
- package/src/core/search/index-estimate.ts +141 -0
- package/src/core/search/index-watch.ts +88 -0
- package/src/core/search/index.ts +1618 -0
- package/src/core/search/indexer.ts +3405 -0
- package/src/core/search/line-numbering.ts +114 -0
- package/src/core/search/link-constraints.ts +110 -0
- package/src/core/search/link-ratchet.ts +446 -0
- package/src/core/search/links.ts +187 -0
- package/src/core/search/mmr.ts +106 -0
- package/src/core/search/parked-index.ts +635 -0
- package/src/core/search/parked-set-aside.ts +256 -0
- package/src/core/search/paths.ts +116 -0
- package/src/core/search/pipeline/assemble.ts +629 -0
- package/src/core/search/pipeline/attribution.ts +116 -0
- package/src/core/search/pipeline/cache-slot.ts +481 -0
- package/src/core/search/pipeline/candidate-signals.ts +376 -0
- package/src/core/search/pipeline/event-time.ts +225 -0
- package/src/core/search/pipeline/iterative-recall.ts +561 -0
- package/src/core/search/pipeline/keyword-lane.ts +177 -0
- package/src/core/search/pipeline/outcome.ts +531 -0
- package/src/core/search/pipeline/pool-filters.ts +506 -0
- package/src/core/search/pipeline/post-rank.ts +696 -0
- package/src/core/search/pipeline/query-shape.ts +128 -0
- package/src/core/search/pipeline/relational-arm.ts +755 -0
- package/src/core/search/pipeline/request.ts +240 -0
- package/src/core/search/pipeline/second-pass.ts +227 -0
- package/src/core/search/pipeline/semantic-lane.ts +138 -0
- package/src/core/search/pipeline/session-pool-cap.ts +164 -0
- package/src/core/search/pipeline/store-open.ts +484 -0
- package/src/core/search/pipeline/weights.ts +39 -0
- package/src/core/search/price-recommendations.ts +75 -0
- package/src/core/search/profiles.ts +75 -0
- package/src/core/search/property-filter.ts +166 -0
- package/src/core/search/property-pushdown.ts +447 -0
- package/src/core/search/provider-consent.ts +377 -0
- package/src/core/search/provider-probe.ts +167 -0
- package/src/core/search/query-cache.ts +224 -0
- package/src/core/search/query-expansion.ts +130 -0
- package/src/core/search/query-plan.ts +211 -0
- package/src/core/search/rank-adjust.ts +154 -0
- package/src/core/search/ranker.ts +956 -0
- package/src/core/search/recall-hint.ts +63 -0
- package/src/core/search/recency.ts +67 -0
- package/src/core/search/reinforce.ts +261 -0
- package/src/core/search/relation-polarity.ts +255 -0
- package/src/core/search/relational-fanout.ts +431 -0
- package/src/core/search/relational-query.ts +76 -0
- package/src/core/search/rerank/contract.ts +32 -0
- package/src/core/search/rerank/cross-encoder.ts +207 -0
- package/src/core/search/rerank/decision-model.ts +457 -0
- package/src/core/search/rerank/failure.ts +129 -0
- package/src/core/search/rerank/index.ts +298 -0
- package/src/core/search/rerank/local.ts +83 -0
- package/src/core/search/rerank/provider.ts +37 -0
- package/src/core/search/rerank/registry.ts +170 -0
- package/src/core/search/rerank/sunset.ts +135 -0
- package/src/core/search/rerank-eval-gate.ts +222 -0
- package/src/core/search/rerank-fit-check.ts +347 -0
- package/src/core/search/result-filters.ts +601 -0
- package/src/core/search/retrieval-trail.ts +585 -0
- package/src/core/search/schema.ts +1693 -0
- package/src/core/search/search-error.ts +94 -0
- package/src/core/search/search-options-descriptor.ts +718 -0
- package/src/core/search/search-result.ts +202 -0
- package/src/core/search/search.ts +1309 -0
- package/src/core/search/self-heal.ts +373 -0
- package/src/core/search/semantic-phase.ts +336 -0
- package/src/core/search/serialize.ts +216 -0
- package/src/core/search/session-focus.ts +212 -0
- package/src/core/search/snippet-window.ts +225 -0
- package/src/core/search/store/aliases.ts +116 -0
- package/src/core/search/store/atomic.ts +50 -0
- package/src/core/search/store/brain-records.ts +362 -0
- package/src/core/search/store/chunk-entities.ts +73 -0
- package/src/core/search/store/chunks.ts +832 -0
- package/src/core/search/store/counts.ts +367 -0
- package/src/core/search/store/documents.ts +596 -0
- package/src/core/search/store/embedder-audit.ts +199 -0
- package/src/core/search/store/embedding-abi.ts +136 -0
- package/src/core/search/store/entity-bridges.ts +54 -0
- package/src/core/search/store/keyword.ts +222 -0
- package/src/core/search/store/lifecycle.ts +769 -0
- package/src/core/search/store/links.ts +315 -0
- package/src/core/search/store/path-prefix.ts +93 -0
- package/src/core/search/store/query-cache-table.ts +82 -0
- package/src/core/search/store/relations.ts +251 -0
- package/src/core/search/store/signal-exit.d.ts +11 -0
- package/src/core/search/store/sql.ts +15 -0
- package/src/core/search/store/state.ts +271 -0
- package/src/core/search/store/tiers.ts +118 -0
- package/src/core/search/store/trigram.ts +207 -0
- package/src/core/search/store/vector-carry-over.ts +167 -0
- package/src/core/search/store/vectors.ts +792 -0
- package/src/core/search/store/visibility-tag.ts +123 -0
- package/src/core/search/store/writer-lock.ts +1025 -0
- package/src/core/search/store-exit.ts +67 -0
- package/src/core/search/store-family.ts +111 -0
- package/src/core/search/store.ts +1179 -0
- package/src/core/search/structured-lanes.ts +64 -0
- package/src/core/search/structured-query.ts +140 -0
- package/src/core/search/surfacing-gate.ts +192 -0
- package/src/core/search/surfacing-key.ts +196 -0
- package/src/core/search/synonyms.ts +91 -0
- package/src/core/search/temporal-bridge.ts +101 -0
- package/src/core/search/temporal-intent.ts +226 -0
- package/src/core/search/time-range.ts +147 -0
- package/src/core/search/traversal.ts +156 -0
- package/src/core/search/trigram-prefilter.ts +85 -0
- package/src/core/search/tuning-store.ts +90 -0
- package/src/core/search/tuning.ts +260 -0
- package/src/core/search/types.ts +2078 -0
- package/src/core/search/validity.ts +106 -0
- package/src/core/search/vector-backfill.ts +226 -0
- package/src/core/search/vector-guard.ts +44 -0
- package/src/core/search/visibility-surface-registry.ts +1580 -0
- package/src/core/search/walker.ts +201 -0
- package/src/core/search/watch-runner.ts +103 -0
- package/src/core/search/with-timeout.ts +35 -0
- package/src/core/secret-ref.ts +165 -0
- package/src/core/secret-resolver.ts +317 -0
- package/src/core/shell-quote.ts +97 -0
- package/src/core/sqlite-close.ts +31 -0
- package/src/core/sqlite-file-set.ts +190 -0
- package/src/core/state/machine-state.ts +385 -0
- package/src/core/state/migrate.ts +1286 -0
- package/src/core/state/state-moves.ts +260 -0
- package/src/core/state/surfaces.ts +1872 -0
- package/src/core/store/FORMAT.md +417 -0
- package/src/core/store/appender.ts +277 -0
- package/src/core/store/blobs.ts +323 -0
- package/src/core/store/caller-reach.ts +45 -0
- package/src/core/store/clock-floor.ts +34 -0
- package/src/core/store/clock-store.ts +131 -0
- package/src/core/store/compare.ts +11 -0
- package/src/core/store/constants.ts +322 -0
- package/src/core/store/content-write-gates.ts +23 -0
- package/src/core/store/device-retirement.ts +67 -0
- package/src/core/store/device-roster.ts +253 -0
- package/src/core/store/device-state-scan.ts +102 -0
- package/src/core/store/dual-write-records.ts +339 -0
- package/src/core/store/dual-write.ts +461 -0
- package/src/core/store/envelope.ts +249 -0
- package/src/core/store/fold-pinned.ts +86 -0
- package/src/core/store/fold-preferences.ts +263 -0
- package/src/core/store/fold-setting-lists.ts +307 -0
- package/src/core/store/fold-settings.ts +200 -0
- package/src/core/store/fold-signals.ts +296 -0
- package/src/core/store/fold.ts +184 -0
- package/src/core/store/format-doc.ts +63 -0
- package/src/core/store/fresh-switch.ts +98 -0
- package/src/core/store/gc-hint.ts +28 -0
- package/src/core/store/held-ledger.ts +112 -0
- package/src/core/store/hlc.ts +91 -0
- package/src/core/store/lane-dual-moves.ts +374 -0
- package/src/core/store/lane-entry-store.ts +345 -0
- package/src/core/store/lane-fold-cache.ts +285 -0
- package/src/core/store/lane-pages.ts +739 -0
- package/src/core/store/lane-paths.ts +172 -0
- package/src/core/store/lane-raw.ts +105 -0
- package/src/core/store/lane-records.ts +222 -0
- package/src/core/store/legacy-tree.ts +84 -0
- package/src/core/store/local-lock.ts +120 -0
- package/src/core/store/migration-availability.ts +170 -0
- package/src/core/store/newest-records.ts +294 -0
- package/src/core/store/operation-privacy.ts +172 -0
- package/src/core/store/operation-scope.ts +75 -0
- package/src/core/store/own-appends.ts +76 -0
- package/src/core/store/partition-leave.ts +157 -0
- package/src/core/store/partition-view.ts +149 -0
- package/src/core/store/private-page.ts +40 -0
- package/src/core/store/private-region.ts +72 -0
- package/src/core/store/process-lock.ts +209 -0
- package/src/core/store/read/ledger-rows.ts +110 -0
- package/src/core/store/read/log-events.ts +271 -0
- package/src/core/store/read/memory-ids.ts +135 -0
- package/src/core/store/read/pinned.ts +44 -0
- package/src/core/store/read/preferences.ts +182 -0
- package/src/core/store/read/protection-store.ts +152 -0
- package/src/core/store/read/read-context.ts +44 -0
- package/src/core/store/read/read-view.ts +131 -0
- package/src/core/store/read/shards-from.ts +302 -0
- package/src/core/store/read/signals.ts +197 -0
- package/src/core/store/read/store-entities.ts +650 -0
- package/src/core/store/read/stream-read.ts +552 -0
- package/src/core/store/read/viewed-read.ts +106 -0
- package/src/core/store/reader.ts +586 -0
- package/src/core/store/reference-privacy.ts +491 -0
- package/src/core/store/removal-backlog.ts +118 -0
- package/src/core/store/safe-fs.ts +237 -0
- package/src/core/store/seen-shards.ts +480 -0
- package/src/core/store/shard-list.ts +85 -0
- package/src/core/store/shard-quarantine-write.ts +175 -0
- package/src/core/store/shard-quarantine.ts +397 -0
- package/src/core/store/state-digest-check.ts +74 -0
- package/src/core/store/state-digest-compare.ts +225 -0
- package/src/core/store/state-digest.ts +572 -0
- package/src/core/store/store-identity.ts +220 -0
- package/src/core/store/store-init.ts +271 -0
- package/src/core/store/store-location.ts +181 -0
- package/src/core/store/store-only.ts +507 -0
- package/src/core/store/store-open.ts +224 -0
- package/src/core/store/store-paths.ts +360 -0
- package/src/core/store/store-privacy.ts +82 -0
- package/src/core/store/store-status.ts +154 -0
- package/src/core/store/store-write.ts +309 -0
- package/src/core/store/torn-line.ts +151 -0
- package/src/core/store/ulid.ts +81 -0
- package/src/core/store-migration/auto-claimed-writes.ts +120 -0
- package/src/core/store-migration/auto-probe.ts +356 -0
- package/src/core/store-migration/auto-report.ts +808 -0
- package/src/core/store-migration/auto-state.ts +1858 -0
- package/src/core/store-migration/auto-transition.ts +155 -0
- package/src/core/store-migration/auto-worker.ts +1193 -0
- package/src/core/store-migration/backup.ts +511 -0
- package/src/core/store-migration/brain-settings.ts +288 -0
- package/src/core/store-migration/catalogue.ts +124 -0
- package/src/core/store-migration/cohort-here.ts +48 -0
- package/src/core/store-migration/cohort-status.ts +195 -0
- package/src/core/store-migration/convert.ts +588 -0
- package/src/core/store-migration/destinations.ts +258 -0
- package/src/core/store-migration/device-config.ts +165 -0
- package/src/core/store-migration/device-evidence.ts +303 -0
- package/src/core/store-migration/device-silence.ts +91 -0
- package/src/core/store-migration/device-state-layout.ts +31 -0
- package/src/core/store-migration/dry-run.ts +442 -0
- package/src/core/store-migration/exporters.ts +597 -0
- package/src/core/store-migration/gate-decision.ts +460 -0
- package/src/core/store-migration/gate-state.ts +254 -0
- package/src/core/store-migration/holder-liveness.ts +72 -0
- package/src/core/store-migration/import-batch.ts +159 -0
- package/src/core/store-migration/incremental-reads.ts +157 -0
- package/src/core/store-migration/journal-scope.ts +167 -0
- package/src/core/store-migration/journal.ts +652 -0
- package/src/core/store-migration/lane-entry-records.ts +92 -0
- package/src/core/store-migration/lane-id-repair.ts +421 -0
- package/src/core/store-migration/lane-map.ts +394 -0
- package/src/core/store-migration/later.ts +218 -0
- package/src/core/store-migration/legacy-claims.ts +283 -0
- package/src/core/store-migration/legacy-kept.ts +31 -0
- package/src/core/store-migration/legacy-scan.ts +581 -0
- package/src/core/store-migration/local-state.ts +161 -0
- package/src/core/store-migration/migrate.ts +1030 -0
- package/src/core/store-migration/migration-records.ts +395 -0
- package/src/core/store-migration/outcome.ts +256 -0
- package/src/core/store-migration/owner-only-copy.ts +51 -0
- package/src/core/store-migration/process-identity.ts +91 -0
- package/src/core/store-migration/quiesce.ts +359 -0
- package/src/core/store-migration/removal-marker.ts +82 -0
- package/src/core/store-migration/removal.ts +695 -0
- package/src/core/store-migration/retire-adopted.ts +96 -0
- package/src/core/store-migration/rollback.ts +764 -0
- package/src/core/store-migration/row-records.ts +334 -0
- package/src/core/store-migration/sizes.ts +38 -0
- package/src/core/store-migration/spill-map.ts +328 -0
- package/src/core/store-migration/surface-map.ts +446 -0
- package/src/core/store-migration/sync-leftovers.ts +383 -0
- package/src/core/store-migration/transition-watermark.ts +144 -0
- package/src/core/store-migration/transition.ts +198 -0
- package/src/core/store-migration/update-step.ts +153 -0
- package/src/core/store-migration/worker-log.ts +139 -0
- package/src/core/strings.ts +16 -0
- package/src/core/surface/descriptor.ts +100 -0
- package/src/core/surface/lexical-score.ts +164 -0
- package/src/core/surface/skill-attach-decision.ts +495 -0
- package/src/core/surface/skill-attach.ts +241 -0
- package/src/core/surface/skill-offer.ts +84 -0
- package/src/core/surface/skills-dir.ts +40 -0
- package/src/core/surface/skills.ts +234 -0
- package/src/core/tags.ts +114 -0
- package/src/core/text/nearest-name.ts +146 -0
- package/src/core/topics/actions.ts +672 -0
- package/src/core/topics/candidates.ts +314 -0
- package/src/core/topics/constants.ts +122 -0
- package/src/core/topics/decide-auto.ts +138 -0
- package/src/core/topics/decide-operations.ts +792 -0
- package/src/core/topics/decide-produce.ts +125 -0
- package/src/core/topics/decision-titles.ts +210 -0
- package/src/core/topics/fold.ts +719 -0
- package/src/core/topics/held-decisions.ts +278 -0
- package/src/core/topics/held-records.ts +464 -0
- package/src/core/topics/plan-outcome.ts +138 -0
- package/src/core/topics/plan.ts +685 -0
- package/src/core/topics/planning.ts +1192 -0
- package/src/core/topics/read.ts +124 -0
- package/src/core/topics/records.ts +204 -0
- package/src/core/topics/review.ts +68 -0
- package/src/core/topics/settings.ts +22 -0
- package/src/core/topics/undo-fold.ts +43 -0
- package/src/core/topics/verdict-writes.ts +257 -0
- package/src/core/topics/verdicts.ts +181 -0
- package/src/core/topics/wording-operation.ts +99 -0
- package/src/core/topics/write.ts +230 -0
- package/src/core/trust.ts +164 -0
- package/src/core/types.ts +85 -0
- package/src/core/validate.ts +196 -0
- package/src/core/vault-adapter/bases.ts +104 -0
- package/src/core/vault-adapter/codes.ts +8 -0
- package/src/core/vault-adapter/index.ts +121 -0
- package/src/core/vault-adapter/vault-binding.ts +398 -0
- package/src/core/vault-adapter/wikilink-audits.ts +18 -0
- package/src/core/vault-backing.ts +435 -0
- package/src/core/vault-presence.ts +57 -0
- package/src/core/vault-scope/defaults.ts +162 -0
- package/src/core/vault-scope/index-admission.ts +79 -0
- package/src/core/vault-scope/index.ts +559 -0
- package/src/core/vault-unexaminable.ts +148 -0
- package/src/core/vault.ts +1522 -0
- package/src/core/version.ts +21 -0
- package/src/core/view/auto-render.ts +222 -0
- package/src/core/view/catch-up.ts +182 -0
- package/src/core/view/constants.ts +139 -0
- package/src/core/view/corrections.ts +309 -0
- package/src/core/view/edit-record.ts +16 -0
- package/src/core/view/i18n.ts +228 -0
- package/src/core/view/lane-view-pages.ts +143 -0
- package/src/core/view/line-diff.ts +171 -0
- package/src/core/view/page-io.ts +522 -0
- package/src/core/view/page-path.ts +103 -0
- package/src/core/view/page-stats.ts +107 -0
- package/src/core/view/pages.ts +451 -0
- package/src/core/view/recover.ts +57 -0
- package/src/core/view/render.ts +476 -0
- package/src/core/view/retire.ts +346 -0
- package/src/core/view/target.ts +170 -0
- package/src/core/view/topic-edits.ts +299 -0
- package/src/core/view/topic-pages.ts +437 -0
- package/src/core/view/vault-guard.ts +222 -0
- package/src/core/view/view-records.ts +326 -0
- package/src/core/view/writer-fold.ts +124 -0
- package/src/core/view/writer.ts +244 -0
- package/src/core/write-binding/index.ts +431 -0
- package/src/core/write-binding/prefix.ts +49 -0
- package/src/mcp/argument-guard.ts +132 -0
- package/src/mcp/artifact-store.ts +143 -0
- package/src/mcp/brain/admin-policy-tools.ts +319 -0
- package/src/mcp/brain/admin-tools.ts +417 -0
- package/src/mcp/brain/agent-claim.ts +43 -0
- package/src/mcp/brain/analytics-tools.ts +396 -0
- package/src/mcp/brain/attest-tools.ts +145 -0
- package/src/mcp/brain/brief-tools.ts +186 -0
- package/src/mcp/brain/brief-view-tools.ts +655 -0
- package/src/mcp/brain/calendar-tools.ts +303 -0
- package/src/mcp/brain/changes-tools.ts +124 -0
- package/src/mcp/brain/context-active-tools.ts +533 -0
- package/src/mcp/brain/context-pinned-tools.ts +167 -0
- package/src/mcp/brain/context-session-tools.ts +173 -0
- package/src/mcp/brain/context-tools.ts +264 -0
- package/src/mcp/brain/decisions-tools.ts +601 -0
- package/src/mcp/brain/derive-tools.ts +89 -0
- package/src/mcp/brain/design-note-tools.ts +140 -0
- package/src/mcp/brain/device-path.ts +320 -0
- package/src/mcp/brain/distill-tools.ts +207 -0
- package/src/mcp/brain/dream-owner-tool.ts +171 -0
- package/src/mcp/brain/dream-tools.ts +539 -0
- package/src/mcp/brain/entity-tools.ts +179 -0
- package/src/mcp/brain/evidence-tools.ts +222 -0
- package/src/mcp/brain/expire-tools.ts +89 -0
- package/src/mcp/brain/extract-tools.ts +237 -0
- package/src/mcp/brain/feedback-tool.ts +724 -0
- package/src/mcp/brain/feedback-tools.ts +293 -0
- package/src/mcp/brain/generation-tools.ts +330 -0
- package/src/mcp/brain/health-tools.ts +529 -0
- package/src/mcp/brain/hygiene-tools.ts +494 -0
- package/src/mcp/brain/ingest-batch-tools.ts +156 -0
- package/src/mcp/brain/ingest-source-tools.ts +636 -0
- package/src/mcp/brain/ingest-tools.ts +223 -0
- package/src/mcp/brain/intake-args.ts +192 -0
- package/src/mcp/brain/knowledge-claim-tools.ts +325 -0
- package/src/mcp/brain/knowledge-lane-tools.ts +678 -0
- package/src/mcp/brain/knowledge-tools.ts +354 -0
- package/src/mcp/brain/knowledge-truth-tools.ts +416 -0
- package/src/mcp/brain/landscape-tools.ts +61 -0
- package/src/mcp/brain/lane-vault.ts +47 -0
- package/src/mcp/brain/lifecycle-file-tools.ts +580 -0
- package/src/mcp/brain/lifecycle-tools.ts +294 -0
- package/src/mcp/brain/memory-bridge-tools.ts +160 -0
- package/src/mcp/brain/ner-tools.ts +133 -0
- package/src/mcp/brain/notes-shared.ts +212 -0
- package/src/mcp/brain/notes-tools.ts +145 -0
- package/src/mcp/brain/notes-write-tools.ts +488 -0
- package/src/mcp/brain/pack-context-tools.ts +472 -0
- package/src/mcp/brain/pack-preset-tools.ts +310 -0
- package/src/mcp/brain/pack-receipt-tools.ts +512 -0
- package/src/mcp/brain/pack-shared.ts +181 -0
- package/src/mcp/brain/pack-tools.ts +463 -0
- package/src/mcp/brain/pagination.ts +35 -0
- package/src/mcp/brain/pledge-tools.ts +505 -0
- package/src/mcp/brain/procedure-tools.ts +580 -0
- package/src/mcp/brain/query-agent-tools.ts +220 -0
- package/src/mcp/brain/query-serialize.ts +198 -0
- package/src/mcp/brain/query-tools.ts +709 -0
- package/src/mcp/brain/query-unlinked-tools.ts +135 -0
- package/src/mcp/brain/query-writes-tools.ts +304 -0
- package/src/mcp/brain/reach-events.ts +201 -0
- package/src/mcp/brain/reach-readable.ts +145 -0
- package/src/mcp/brain/recall-bench-tools.ts +388 -0
- package/src/mcp/brain/recall-coerce-tools.ts +404 -0
- package/src/mcp/brain/recall-outcome-tools.ts +268 -0
- package/src/mcp/brain/recall-session-tools.ts +321 -0
- package/src/mcp/brain/recall-tools.ts +569 -0
- package/src/mcp/brain/receipt-tools.ts +236 -0
- package/src/mcp/brain/research-tools.ts +98 -0
- package/src/mcp/brain/review-tools.ts +320 -0
- package/src/mcp/brain/settings-tools.ts +120 -0
- package/src/mcp/brain/shared.ts +372 -0
- package/src/mcp/brain/storage-tools.ts +176 -0
- package/src/mcp/brain/synthesis-tools.ts +529 -0
- package/src/mcp/brain/tension-tools.ts +243 -0
- package/src/mcp/brain/time-bounds.ts +64 -0
- package/src/mcp/brain/topic-tools.ts +240 -0
- package/src/mcp/brain/workspace-tools.ts +370 -0
- package/src/mcp/brain/write-batch-tools.ts +385 -0
- package/src/mcp/brain-tools.ts +107 -0
- package/src/mcp/capabilities.ts +162 -0
- package/src/mcp/coerce.ts +372 -0
- package/src/mcp/decision-answerable.ts +45 -0
- package/src/mcp/drain.ts +204 -0
- package/src/mcp/dream-executor.ts +493 -0
- package/src/mcp/error-redaction.ts +91 -0
- package/src/mcp/frozen-refusal.ts +206 -0
- package/src/mcp/http.ts +715 -0
- package/src/mcp/hydrate-tool.ts +82 -0
- package/src/mcp/index.ts +26 -0
- package/src/mcp/instruction-segments.ts +510 -0
- package/src/mcp/instructions.ts +96 -0
- package/src/mcp/output-contract.ts +62 -0
- package/src/mcp/owner-scope-refusal.ts +144 -0
- package/src/mcp/preview-budget.ts +142 -0
- package/src/mcp/profiles.ts +153 -0
- package/src/mcp/progress.ts +187 -0
- package/src/mcp/protocol.ts +84 -0
- package/src/mcp/reach-refusal.ts +108 -0
- package/src/mcp/registry-guard.ts +465 -0
- package/src/mcp/resources-backlink-readers.ts +95 -0
- package/src/mcp/resources-digest-readers.ts +225 -0
- package/src/mcp/resources-record-readers.ts +379 -0
- package/src/mcp/resources-shared.ts +190 -0
- package/src/mcp/resources-topic-readers.ts +40 -0
- package/src/mcp/resources.ts +206 -0
- package/src/mcp/schema-tools.ts +199 -0
- package/src/mcp/search-tools.ts +2172 -0
- package/src/mcp/server.ts +1082 -0
- package/src/mcp/skill-tools.ts +284 -0
- package/src/mcp/stdio.ts +467 -0
- package/src/mcp/token-source.ts +65 -0
- package/src/mcp/tool-contract.ts +387 -0
- package/src/mcp/tool-error-codes.ts +564 -0
- package/src/mcp/tools.ts +645 -0
- package/src/mcp/vault-path-field.ts +264 -0
- package/src/mcp/vault-unreachable.ts +23 -0
- package/src/mcp/watchdog-tools.ts +46 -0
- package/src/mcp/wiring-tools.ts +308 -0
- package/src/openclaw/index.ts +215 -0
- package/src/openclaw/openclaw-sdk.d.ts +65 -0
- package/templates/brain-explorer.html +1375 -0
- package/templates/brain-starter/inbox/sig-2026-05-10-strict-types.md +16 -0
- package/templates/brain-starter/log/2026-05-12.md +19 -0
- package/templates/brain-starter/log/2026-05-13.md +37 -0
- package/templates/brain-starter/log/2026-05-14.md +43 -0
- package/templates/brain-starter/log/2026-05-15.md +43 -0
- package/templates/brain-starter/log/2026-05-16.md +31 -0
- package/templates/brain-starter/log/2026-05-17.md +10 -0
- package/templates/brain-starter/preferences/pref-changelog-every-release.md +25 -0
- package/templates/brain-starter/preferences/pref-explicit-imports-only.md +25 -0
- package/templates/brain-starter/preferences/pref-imperative-commit-messages.md +26 -0
- package/templates/brain-starter/preferences/pref-no-unexplained-abbreviations.md +26 -0
- package/templates/brain-starter/preferences/pref-prefer-bun-over-npx.md +25 -0
- package/templates/brain-starter/preferences/pref-prefer-typed-errors.md +25 -0
- package/templates/brain-starter/preferences/pref-russian-in-chat.md +25 -0
- package/templates/brain-starter/preferences/pref-test-before-refactor.md +19 -0
- package/templates/brain-starter/retired/ret-no-emojis-in-code.md +30 -0
- package/templates/brain-starter/retired/ret-prefer-curl-over-wget.md +30 -0
- package/templates/brain-starter/retired/ret-tabs-over-spaces.md +32 -0
- package/templates/identity-reminder.hermes.txt +1 -0
- package/templates/identity-reminder.openclaw.txt +1 -0
- package/templates/identity-reminder.txt +1 -0
- package/templates/install/aider-context.md.tmpl +40 -0
- package/tests/fixtures/decision-model/recall-inject-take.json +760 -0
- package/tests/fixtures/decision-model/rerank-take.json +1124 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
<!-- open-second-brain-store-format: 1 -->
|
|
2
|
+
|
|
3
|
+
# Open Second Brain store format
|
|
4
|
+
|
|
5
|
+
Format version: 1
|
|
6
|
+
|
|
7
|
+
This document describes the on-disk format of an Open Second Brain brain store: the folder that holds every piece of Open Second Brain machine data outside the user's notes. The format is open and plain text so that any tool, in any language, can read it, and so that several machines and many concurrent agents can write it through an ordinary file-sync tool without conflicts.
|
|
8
|
+
|
|
9
|
+
A copy of this document is written into the store root and into every partition when a store is created, and refreshed when a newer release ships a newer format version. The copy in a partition travels with the data it describes.
|
|
10
|
+
|
|
11
|
+
## Contents of the store
|
|
12
|
+
|
|
13
|
+
The store contains records in plain text JSON. Nothing in it is encrypted. Encryption at rest is the job of the disk or the sync layer the user chooses.
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<store>/
|
|
19
|
+
FORMAT.md this document
|
|
20
|
+
shared/ partition, synced to every working machine
|
|
21
|
+
FORMAT.md
|
|
22
|
+
store.json store identity
|
|
23
|
+
events/<device>/<YYYY-MM>.jsonl signals, evidence, notes, feedback
|
|
24
|
+
log/<device>/<YYYY-MM>.jsonl operational log, lifecycle, continuity
|
|
25
|
+
ledgers/<name>/<device>/<YYYY-MM>.jsonl idempotency, audit, metrics, receipts, lineage
|
|
26
|
+
topics/<device>/<YYYY-MM>.jsonl topic events
|
|
27
|
+
settings/<device>/<YYYY-MM>.jsonl shared settings
|
|
28
|
+
digests/<device>/<YYYY-MM>.jsonl state digests
|
|
29
|
+
dream-work/<device>/<YYYY-MM>.jsonl dream work that needs a model
|
|
30
|
+
dream-replay/<device>/<YYYY-MM>.jsonl windows the dream pass admitted, planned and covered
|
|
31
|
+
blobs/<sha256[0:2]>/<sha256> large bodies, immutable
|
|
32
|
+
private/ same shape, for private-visibility records
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Partitions
|
|
36
|
+
|
|
37
|
+
A partition is a top-level folder that holds records of one sensitivity. There are two:
|
|
38
|
+
|
|
39
|
+
- `shared`: records every working machine may hold.
|
|
40
|
+
- `private`: records of private visibility, for example personal-scope topics.
|
|
41
|
+
|
|
42
|
+
Each partition is synced as its own folder, so a user can keep `private` off a given machine (for example a server). The store root itself is never a sync folder, and records never move between partitions. A machine that does not hold a partition works on the partitions it has; a write to a partition the machine does not hold is refused.
|
|
43
|
+
|
|
44
|
+
### Store identity
|
|
45
|
+
|
|
46
|
+
Every partition holds `store.json`:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
{ "store_id": "<ulid>", "format": 1 }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The store id is the same in every partition of one store. It keys the device-local state directory on each machine. The file is created once, with an exclusive create, and never rewritten.
|
|
53
|
+
|
|
54
|
+
A store is created only by an explicit command (`o2b store init`), on one machine; writers never create one. Every other machine receives the partitions, identity files included, through sync. Creation writes the identity file of every partition it was asked for (both by default, or `shared` alone for a machine that must not hold private records) before it reports success. When some of the requested partitions already carry an identity file, creation adds the missing ones with that store id and never mints a second one; the file's content depends only on the store id, so a copy created locally and one delivered by sync are identical. Creation refuses when every requested partition is already held, when the partitions name different store ids, and when a partition folder holds store files without `store.json` (the identity has not arrived yet, or was lost). A writer that finds no store skips its write rather than creating one.
|
|
55
|
+
|
|
56
|
+
### Streams
|
|
57
|
+
|
|
58
|
+
A stream is a family of shards inside a partition:
|
|
59
|
+
|
|
60
|
+
- `events`: signals, evidence, notes and feedback.
|
|
61
|
+
- `log`: the operational log, lifecycle and continuity records.
|
|
62
|
+
- `ledgers`: named append-only ledgers, one directory per ledger name (`ledgers/<name>/...`). A ledger name is 1 to 64 lowercase letters, digits and hyphens, starting with a letter or digit.
|
|
63
|
+
- `topics`: topic events.
|
|
64
|
+
- `settings`: settings every machine must agree on.
|
|
65
|
+
- `digests`: state digests that let machines compare their folded state.
|
|
66
|
+
- `dream-work`: the queue of dream work that needs a model (see "Dream work").
|
|
67
|
+
- `dream-replay`: the windows the dream pass admitted, planned and covered, and the ledgers it keeps between them (see "Dream replay"). In `shared` only.
|
|
68
|
+
|
|
69
|
+
### Shards
|
|
70
|
+
|
|
71
|
+
A shard is one file of one stream, written by one device, for one month:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
<partition>/<stream>/<device>/<YYYY-MM>.jsonl
|
|
75
|
+
<partition>/ledgers/<name>/<device>/<YYYY-MM>.jsonl
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- `<device>` is the writing device's id: lowercase letters, digits and hyphens, at most 32 characters, never starting with `sync-conflict`.
|
|
79
|
+
- Every machine accepts the same device ids in records and shard paths, whatever its platform, so folds and digests agree across platforms. Only a machine's choice of its own id depends on the platform: a new id is never a name Windows reserves for a device (`con`, `prn`, `aux`, `nul`, `com1` to `com9`, `lpt1` to `lpt9`), and an existing id that is one of them is refused only on Windows. Such a directory cannot exist on NTFS, so on Windows a peer's device directory under a reserved name is skipped, its records are not read on that machine, and the doctor reports it.
|
|
80
|
+
- `<YYYY-MM>` is the UTC month of the physical part of the record's clock.
|
|
81
|
+
- A device writes only shards that carry its own device id. Concurrent agents on one device append to the same file. Two machines therefore never write the same file, and a file-sync tool never has to merge one.
|
|
82
|
+
- A compaction output may carry a suffix before the extension: `<YYYY-MM>.<suffix>.jsonl`, where the suffix is 1 to 40 lowercase letters, digits and hyphens, starts with a letter or digit, and never starts with `sync-conflict`.
|
|
83
|
+
- Any other file name in a stream directory (for example a sync tool's conflict copy) is not a shard and is not read as one.
|
|
84
|
+
|
|
85
|
+
Every line of a shard is one record, encoded as UTF-8 JSON and terminated by a newline (`\n`). A record is written with a single append, under a lock that is local to the writing device and never stored inside the store. A line, newline included, is at most 16384 bytes long (the line-size cap); a record whose line would be longer has its body spilled into a blob.
|
|
86
|
+
|
|
87
|
+
## Record envelope
|
|
88
|
+
|
|
89
|
+
Every record has this shape:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
{ "v": 1, "id": "<ulid>", "hlc": "<physical_ms>.<counter>", "device": "<device id>",
|
|
93
|
+
"agent": "<agent name>", "kind": "<kind>", "scope": "<scope>" | null,
|
|
94
|
+
"topic": "<topic id>" | null, "sum": "<sha256>", "body": { ... } }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Fields:
|
|
98
|
+
|
|
99
|
+
- `v`: format version of the record, an integer. This document describes version 1.
|
|
100
|
+
- `id`: the record id, a ULID (26 Crockford base32 characters, uppercase). Unique across all machines without coordination.
|
|
101
|
+
- `hlc`: the record's hybrid logical clock stamp, `<physical_ms>.<counter>`: milliseconds since the Unix epoch, a dot, and a counter. Both parts are non-negative integers without leading zeros.
|
|
102
|
+
- `device`: the id of the device that wrote the record. It matches the device segment of the shard path.
|
|
103
|
+
- `agent`: the identity of the agent that wrote the record: a non-empty, single-line string of at most 200 characters.
|
|
104
|
+
- `kind`: the record kind, 1 to 64 lowercase letters, digits and hyphens, starting with a letter. The kind decides the shape of the body.
|
|
105
|
+
- `scope`: the soft category of the record (a non-empty, single-line string of at most 200 characters), or `null`.
|
|
106
|
+
- `topic`: the id (a ULID) of the topic the record belongs to, or `null`.
|
|
107
|
+
- `sum`: the lowercase hex sha256 of the body's canonical JSON.
|
|
108
|
+
- `body`: a JSON object whose shape depends on `kind`.
|
|
109
|
+
|
|
110
|
+
### Canonical JSON and the checksum
|
|
111
|
+
|
|
112
|
+
The canonical JSON of a value is its JSON text with object keys sorted by code unit order at every level, array order kept, no whitespace, and object entries whose value is undefined omitted. `sum` is the sha256 of the canonical JSON of `body`, encoded as UTF-8, written as 64 lowercase hex characters. A reader recomputes it from the parsed body, so a body serialised with a different key order still verifies. A body nests objects and arrays at most 64 levels deep, the body object itself counting as one level: a writer never writes a deeper body, and a reader reports a record whose body (inline or in its blob) is deeper as a corrupt line and skips it.
|
|
113
|
+
|
|
114
|
+
### Blob references
|
|
115
|
+
|
|
116
|
+
When a line would exceed the line-size cap, the writer stores the body as a blob and writes a blob reference as the line's body:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
{ "$blob": "<sha256>", "bytes": <length of the blob in bytes> }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The key `$blob` is reserved: no record body may use it. The reference's hash equals the record's `sum`, and `bytes` is a non-negative integer.
|
|
123
|
+
|
|
124
|
+
## Blobs
|
|
125
|
+
|
|
126
|
+
A blob is an immutable file at `<partition>/blobs/<sha256[0:2]>/<sha256>`. Its content is the canonical JSON of a record body, encoded as UTF-8, and its name is the sha256 of that content, so the name of a blob that holds a record's body is the record's `sum`.
|
|
127
|
+
|
|
128
|
+
- A blob is written once, with an exclusive create, and never rewritten or appended to. A writer prepares the content in a temp file and links it to the final name; where the filesystem has no hard links (FAT, exFAT) it creates the final name directly, so a reader may briefly see a partly written blob, which it treats as pending.
|
|
129
|
+
- A temp file never takes a blob name. A writer keeps it outside the store when it can; otherwise it sits in the blob's folder under a name that starts with `.tmp-`. Readers ignore every name in `blobs/` that starts with a dot, and a sync setup should ignore them too (for example a Syncthing ignore pattern `.tmp-*`).
|
|
130
|
+
- A blob file that exists but does not hash to its name can only ever hold one content, so a writer that needs that blob may rewrite it with that content.
|
|
131
|
+
- A blob that is referenced but absent, or whose content does not hash to its name, or whose length is not the `bytes` of the reference, is pending: a reader shows the record with its body marked pending and fills the body in on a later read, once the sync tool has delivered the whole file. A reader sizes a blob before it reads it and does not load one larger than 64 MiB.
|
|
132
|
+
- A blob that hashes to its name but is not the canonical JSON of a JSON object can never change, since its name fixes its content. A reader skips the record that references it and reports it as a corrupt line.
|
|
133
|
+
|
|
134
|
+
## Clock rules
|
|
135
|
+
|
|
136
|
+
Every device keeps a hybrid logical clock and persists it in its device-local state, so it survives restarts.
|
|
137
|
+
|
|
138
|
+
- Send rule: for each new record, when the wall clock is ahead of the local clock's physical part, the stamp is the wall clock with counter 0; otherwise the physical part stays and the counter increments. The result becomes the local clock. A device's stamps are therefore strictly increasing even when its wall clock steps backwards.
|
|
139
|
+
- Receive rule: whenever a device ingests records from other devices, it raises its local clock to at least the largest stamp it ingested. A record written in reply to a remote record therefore orders after it, even when the replying machine's wall clock is behind. A stamp whose physical part is more than one day (86400000 ms) ahead of the device's wall clock is not adopted, so one record from a broken clock cannot move every later stamp into the far future. Reading a record counts as ingesting it: a record that replaces or removes one its writer read orders after it.
|
|
140
|
+
|
|
141
|
+
Stamps compare by physical part, then by counter.
|
|
142
|
+
|
|
143
|
+
## Order and folds
|
|
144
|
+
|
|
145
|
+
All machines order records by `hlc`, then `device`, then `id`, each compared as written (numbers for the clock, code unit order for the strings). The same set of records gives the same order on every machine, in any delivery order. A record that is delivered twice (for example after a file was restored) is applied once, by its `id`.
|
|
146
|
+
|
|
147
|
+
Entities that change over time (preferences, pinned context, topic fields, assignments and settings) are folds over their records:
|
|
148
|
+
|
|
149
|
+
- Precedence by authority: a human record beats an agent record, which beats a decision-model record.
|
|
150
|
+
- Within one authority, the record with the later clock wins.
|
|
151
|
+
- Removal is a tombstone record. A fold never deletes a record; the losing records stay in the history.
|
|
152
|
+
|
|
153
|
+
A record whose body is still a pending blob is not folded until its body arrives. A record of a fold kind whose body is malformed is not applied; the fold reports it. When two deliveries share an `id` but differ in content, the fold keeps the one that comes first in fold order (then by canonical JSON) and reports the conflict.
|
|
154
|
+
|
|
155
|
+
### Authority
|
|
156
|
+
|
|
157
|
+
A record of a mutable entity carries its authority in its body, in the field `authority`. It is part of the body, so the checksum covers it. It is never inferred from the `agent` name, and a mutable-entity record without a valid `authority` is not applied. The values, from the strongest to the weakest:
|
|
158
|
+
|
|
159
|
+
- `human`: the user decided, through a command, a tool call made on the user's explicit request, or an edit of the human view.
|
|
160
|
+
- `agent`: an agent decided on its own.
|
|
161
|
+
- `model`: a decision model decided.
|
|
162
|
+
|
|
163
|
+
### Preferences
|
|
164
|
+
|
|
165
|
+
A preference is identified by the string in its records' `preference` field. Each field of a preference is its own register, resolved by authority, then clock, so a human change to one field (for example `status`) is not undone by a later agent change while an agent may still change a field no human has set. Whether the preference exists is one more register: every `preference-set` proposes that it exists, a `preference-remove` proposes that it does not. Evidence records never change a field or the existence.
|
|
166
|
+
|
|
167
|
+
The field `text` carries the preference page's body, the Markdown below its frontmatter, when the body holds prose the other fields do not render: an imported memory's text, a person's notes under the page's headings, or a writer's guidance on how to apply the rule. A body that is only the `## Origin` list of `evidenced_by` (and, once retired, the `## Retired` section built from the retire fields) carries no prose, and its `text` is absent or `null`. The evidence list itself (the bullets under `## Origin` that are a bare wikilink) is never part of `text`: a page rebuilt from the fold, live or retired, renders it from `evidenced_by` under the first `## Origin` heading of `text` (or as a first section when `text` has none), so the list a page shows always equals `evidenced_by` and a change of the field alone changes the page; a `text` that still holds a list (written by an earlier release) shows the field's list instead. A retired page is that body followed by the `## Retired` section: the one `text` holds when it holds one, else the section built from the retire fields; with no `text` at all it is the field's list, then that section. Other lines under `## Origin`, and a heading or bullet inside a fenced code block, are prose like any other. Like every field, `text` is a register resolved by authority, then clock, so prose a human wrote is not replaced by a later agent write. A page rebuilt from the fold carries `text` as its body, not as a frontmatter key; with no `text`, the body is rendered from the fields.
|
|
168
|
+
|
|
169
|
+
The counters `applied_count`, `violated_count` and `outdated_count` are derived by counting `preference-evidence` records by their `result`. They are never written back: a `preference-set` that names a counter field is ignored for that field, and a `preference-set` that names only counter fields is not applied. The counters count the evidence of every partition the reading machine holds, so they are that machine's own view; a caller below local reach (a remote MCP transport) is shown the counters of the `shared` evidence alone.
|
|
170
|
+
|
|
171
|
+
A preference is private when one of its `preference-set` or `preference-remove` records sits in `private`, or when its fields reserve it as private. A `preference-evidence` record in `private` does not make the preference private: such a record lands there because its artifact or note names a private page. It counts toward the preference's counters on a machine that holds `private`, and it is never used to compute the status, confidence or evidence fields of a shared preference, so those fields read the same on every machine. Toward a preference that is itself private it counts like any other evidence.
|
|
172
|
+
|
|
173
|
+
### Pinned context
|
|
174
|
+
|
|
175
|
+
Pinned context is one register per partition. A `pinned-set` replaces the whole text; an append is written as a `pinned-set` of the full new text. A `pinned-clear` is the tombstone. When two machines replace it at nearly the same time, the replacement with the later clock is shown and the other stays in the history.
|
|
176
|
+
|
|
177
|
+
### Shared settings
|
|
178
|
+
|
|
179
|
+
Settings every machine must agree on are records in the `settings` stream of the `shared` partition, never device-local config. Each key is one register, resolved by authority, then clock; a `setting-unset` is the tombstone and the key falls back to its default. Keys are dot-separated lowercase words. Keys this version knows, with their values:
|
|
180
|
+
|
|
181
|
+
- `view.language`: the language tag (for example `en`, `ru` or `pt-BR`) of generated prose in the human view. No default; the renderer decides.
|
|
182
|
+
- `topics.new_min_records`: how many related unassigned records start a new topic, a positive integer. Default 5.
|
|
183
|
+
- `topics.new_min_sessions`: from how many sessions those records must come, a positive integer. Default 2.
|
|
184
|
+
- `topics.quiet_days`: after how many days without a record an active topic is offered to the user for a status decision, a positive integer. Default 30.
|
|
185
|
+
- `migration.silent_device_days`: after how many days without evidence of life a device of the migration cohort that has not switched counts as retired by silence, so the legacy tree may leave the vault without it; an integer from 0 to 3650, 0 turns the rule off. Default 30. Only the operator sets it.
|
|
186
|
+
- `dream.apply_drafts`: when text a model wrote for dream is applied: `auto` (the next pass applies it) or `review` (it waits in the state `awaiting-review` until a person approves or rejects it). Default `auto`.
|
|
187
|
+
- `dream.auto`: whether a session on the dream owner's machine starts the day's dream pass by itself: `true` or `false`. Default `true`. A brain with no dream owner is never started.
|
|
188
|
+
|
|
189
|
+
Keys `brain.<block>.<field>` (and `brain.<key>` for a scalar) hold the settings of a vault's legacy `_brain.yaml` that every machine must agree on. The migration from the legacy layout writes only the values the user changed from the shipped default, with `authority` `human`; a value equal to its default is not written, and the key falls back to that default. Their values are the JSON the file held.
|
|
190
|
+
|
|
191
|
+
A list setting can also be edited one entry at a time: a `setting-entry` record adds or removes one entry of the list. Only the schema field lists `brain.schema.<field>` (one field name after `brain.schema.`) are list settings; a `setting-entry` record for any other key is not applied, so a key that holds one value stays one register. A key that holds at least one `setting-entry` record folds per entry, so two machines that edit the list before they sync keep both edits. Each entry is one register, resolved by authority, then clock, like every register. The register of an entry is its slot: the entry in the form the schema pack reads it, NFC-normalised, with surrounding quotes stripped, trimmed and in lower case, each side of a `name=value` line normalised on its own (split at the first `=`), and each side of a `source->target` pair too; quotes around the whole line are stripped first unless the same quote character also stands inside it. So two spellings of one token are one register. The keyed lists `brain.schema.prefixes`, `brain.schema.expert_routing`, `brain.schema.attributes` and `brain.schema.frontmatter_tiers` hold `name=value` lines with one value per name: their slot is the normalised text before the first `=`, so a new value replaces the old entry. In `brain.schema.attributes` and `brain.schema.frontmatter_tiers` that text is a compound `type.field` name: as the schema pack reads it, a compound `type.field` name is split at its first `.` and each half normalised on its own, so `paper . year` and `paper.year` are one slot. A `setting-set` of the key with a list value offers every slot the key has ever named, its own entries as present and every other slot as removed; a `setting-unset` offers every slot as removed. A `setting-set` of a list setting whose value is not a list of one-line strings, numbers or booleans is not applied, whether or not the key holds a `setting-entry` record, so such a value never hides the list. So a key written only by whole lists resolves as one register over the list. The value is the list of entries present, each as the record that decided its slot wrote it, ordered by the fold order of that record, then by the entry's place in that record; when no entry is present the key is removed and falls back to its default. A key with no `setting-entry` record folds as one register. The schema fields are written this way: a schema apply writes one `setting-entry` per entry it adds or removes, never the whole list. A removal may carry `if_decided_by`, the id of the record that decided the entry's slot when the writer judged the removal: such a conditional removal applies only while the record it names decides the entry's slot among the key's records that carry no `if_decided_by`, and is otherwise ignored, wherever its clock falls and in whatever order the records arrive. `if_decided_by` is a field of `setting-entry` only: on a `setting-set` or `setting-unset` it is ignored, like any field a kind does not define. When the records of a key folded per entry name no entry at all once the conditional removals that do not apply are left out (an empty list, a `setting-unset`), the key is removed, and its strongest, then latest, record stands for it. Format version 1 includes `setting-entry` from the first release that contains the store.
|
|
192
|
+
|
|
193
|
+
A schema pack is read from these records with every reference to an undeclared token dropped (aliases, prefixes, extractable entries, expert routes and attributes of a token the vocabulary does not hold, a link constraint pair whose source or target the vocabulary does not hold, and the constraints of an undeclared link type or of one left with no pair), so two applies merged per entry never yield a pack with a dangling reference. Each schema apply is attested by a `reliability-audit` row in `shared` (`audit_dir` `schema-mutations`, `action` `schema_apply_mutations`) carrying the digest of the pack it produced and `decided`, the records it attests: the records it wrote and records rows it had seen already attest, plus records the operator adopted, whose ids the row also lists under `adopted` with `adopted_by`. Each entry of `decided` is `<id>:<sha256>`, the record's id and the sha256 of the record's canonical JSON (the whole envelope, body included), so a row attests the one version of the record it saw: another body under the same id, with a checksum that matches it, is not attested. An entry that is a bare id attests nothing. The migration's import writes a row with `action` `schema_import_baseline` whose `decided` names the schema records it imported. A pack that matches no single row's digest is attested when every record deciding it is named by some row. Once rows name records, a deciding record no row names is unattested even when the pack matches the newest row's digest (a record that sets an entry the pack already held changes no digest but still decides the entry). A schema apply and the integrity check read the pack, the records deciding it and the entries an apply compares against from one read of the `settings` stream, so a record that arrives meanwhile is never attested, and never removed, by that apply: an apply writes the removal of an entry the pack dropped on read only while the record that decided it in that read still decides the entry's slot when the removal is written, and writes it as a conditional removal (`if_decided_by`) naming that record, so another device's replacement of that entry is kept even when it arrives after the removal. An apply that only adopts records writes no `setting-entry` record. Only the fields the pack reads decide it: `preference_types`, `signal_types`, `page_types`, `log_event_kinds`, `aliases`, `prefixes`, `link_types`, `extractable`, `expert_routing`, `labels`, `link_constraints`, `attributes` and `frontmatter_tiers`; a record for any other name under `brain.schema.` is neither part of the pack nor attested.
|
|
194
|
+
|
|
195
|
+
A record that sets a known key to an invalid value is not applied. A key this version does not know is kept as the JSON value written, so an older reader keeps a newer release's setting instead of losing it.
|
|
196
|
+
|
|
197
|
+
## Reading
|
|
198
|
+
|
|
199
|
+
A reader parses each line, checks the envelope and verifies the checksum.
|
|
200
|
+
|
|
201
|
+
- An incomplete last line (no terminating newline) or a last line that fails verification is skipped and read again on a later pass. It is not treated as deleted: a sync tool may still be delivering the rest of the file.
|
|
202
|
+
- A line in the middle of a shard that fails verification is reported as a diagnostic and skipped.
|
|
203
|
+
- A record whose `v` is greater than the version a reader understands is skipped and reported, and the reader goes on with the next line.
|
|
204
|
+
- A run of bytes longer than the line-size cap without a newline can never be a record. It is reported as a corrupt line and skipped up to the next newline, or to the end of the shard; it is never held back as an incomplete last line. A reader reads a shard in bounded chunks, never whole.
|
|
205
|
+
- A record whose `device` is not the device segment of its shard's path is reported as a corrupt line and skipped.
|
|
206
|
+
- A shard is only ever appended to or replaced as a whole (a sync tool delivers a newer copy, compaction writes a new shard and removes the old one); it is never rewritten in place. A reader may therefore reuse what it read of a shard while the shard's size, modification time and change time are unchanged, provided those times were at least two seconds older than the moment it looked (a stamp younger than that is first confirmed by the checksum of the bytes it read), and read only what was appended after it once the bytes it read are proven unchanged (by its checksum, or because only its own process appended since). It never relies on the file id alone: some volumes report none, and some reuse one after a replace, so a same-size replacement inside one tick of a volume's clock keeps every field of the stamp. A tool that edits a shard in place breaks this, and on a volume whose clock runs behind the reader's by more than that window, or with an edit that lands in the reader's own-append chain, a reader may not see the edit.
|
|
207
|
+
- A record id appears in one partition only: records never move between partitions. A reader that finds an id already read from the other partition keeps the first copy and ignores the second, and a doctor reports the id.
|
|
208
|
+
|
|
209
|
+
## Trust
|
|
210
|
+
|
|
211
|
+
Records carry no signature. The checksum detects damage, not forgery: any machine that can write a partition folder, and anything the sync tool delivers into it, can write records under any device id, agent or authority. A machine that syncs a partition is therefore trusted with everything in that partition. The reader's checks (envelope, checksum, line-size cap, device segment, blob shape and size) keep one bad file from stopping the store or reaching outside it; they do not authenticate a peer. Keep `private` only on machines you trust with private records.
|
|
212
|
+
|
|
213
|
+
A writer never follows a symbolic link (or, on Windows, a junction) below a partition folder: it refuses a stream, ledger, device or blob folder that is a link, and a shard that is a link or has more than one hard link, and writes nothing. A reader opens a shard or blob only when it is a regular file: a link or a special file (a FIFO) under that name is reported and never read through or waited on. The partition folder itself may be a link. Folders the store creates are readable by their owner only (mode `0700`), and so are shards, blobs and `store.json` (mode `0600`), in both partitions; the format document stays readable by everyone.
|
|
214
|
+
|
|
215
|
+
## Compaction
|
|
216
|
+
|
|
217
|
+
Shards of closed months are never rewritten, except by compaction on their owning device. Compaction writes the same records to a new shard, then appends a record of kind `compacted` to the same stream of the same device, then removes the old shards. Its body is:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
{ "replaces": ["<shard path>", ...], "into": ["<shard path>", ...] }
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Shard paths in the body are relative to the partition and use `/` as the separator, for example `events/dev-a/2026-01.jsonl`. A reader treats a shard named in `replaces` as replaced: its disappearance is expected and is not reported as missing.
|
|
224
|
+
|
|
225
|
+
## Removal
|
|
226
|
+
|
|
227
|
+
A tombstone takes an entity out of every read at once: `signal-removed` forgets a signal, `preference-remove` removes a preference (the fold then keeps no field of it, so neither the principle nor the prose `text` is read), and `lane-entry-remove` removes a lane entry. Readers, rendered pages and the search index never show voided content: the index takes every voided record out once it has read the tombstone. An entity whose current frontmatter or fields carry the lifecycle mark `_status: tombstoned` (or `status: tombstoned`; a signal tombstoned in the legacy tree before the migration carries it in its capture) is left out by the same readers, and the index leaves every record of it out too, bringing them back when a later change clears the mark. The index also leaves out a signal waiting for write approval (state `staged`) until it is approved.
|
|
228
|
+
|
|
229
|
+
The shards are append-only, so the original lines stay in them, on this machine and on every machine the shards sync to, until store compaction exists (a later phase; see "Compaction"). Compaction is what will rewrite a closed shard without the voided lines. Until then `o2b brain doctor` reports how many records of removed content still await compaction (`store-removed-awaiting-compaction`). A lane tombstone that is the old half of a move (an archive move writes the tombstone and the new entry together) removes nothing and is not counted.
|
|
230
|
+
|
|
231
|
+
## State digests
|
|
232
|
+
|
|
233
|
+
Machines compare their folded state through digests, one per partition, published in the partition's `digests` stream.
|
|
234
|
+
|
|
235
|
+
A digest covers an explicit cut: one entry for every shard the publishing machine holds in the partition, excluding the `digests` stream itself, so publishing a digest never changes the cut it is compared on. Shards with no verified record yet are left out. An entry, and the cut, sorted by shard path:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
{ "shard": "<partition-relative shard path>", "count": <verified records>,
|
|
239
|
+
"last": "<id of the last verified record>", "pending": <records whose blob has not arrived> }
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`pending` is part of the cut because a record whose blob has not arrived cannot be folded yet; two machines that differ only in a delivered blob have different cuts. The digest carries the sha256 of the canonical JSON of the cut, and for each fold (`preferences`, `pinned`, `settings`, `topics`) the sha256 of the canonical JSON of the fold's resolved state computed from exactly the records in the cut. The `topics` hash came later: a digest written by an earlier release of format version 1 has none, and two digests are compared on a fold only when both carry it.
|
|
243
|
+
|
|
244
|
+
- Comparison: only digests whose cuts are identical are compared, each device's latest digest per cut, among the digests of the last 7 days. A fold whose hash differs between two such digests is reported as divergent, with the devices, the partition and the fold.
|
|
245
|
+
- Roster: the devices with records in the partition during the last 30 days, minus the devices retired by a `device-retire` record with `authority` `human`. A retired device that writes a record after its retire record is on the roster again. Retire records are read from the `settings` stream of `shared` and apply to every partition.
|
|
246
|
+
- Silence: a roster device that has published no digest in the partition for 7 days is reported as silent, never as divergent. A device first seen less than 7 days ago is not reported yet.
|
|
247
|
+
|
|
248
|
+
An offline device, an idle device or a machine without a partition therefore never stalls the comparison and never raises a false alarm.
|
|
249
|
+
|
|
250
|
+
## Record kinds
|
|
251
|
+
|
|
252
|
+
Record kinds are defined by the stream and the feature that writes them. Kinds this version of the format defines at the store level:
|
|
253
|
+
|
|
254
|
+
- `compacted`: a compaction replaced the shards in `replaces` with the shards in `into`.
|
|
255
|
+
|
|
256
|
+
Kinds of the mutable-entity folds, with their bodies (fields marked optional may be absent):
|
|
257
|
+
|
|
258
|
+
- `preference-set`: `{ "authority", "preference": "<id>", "fields": { "<name>": <json>, ... } }`, written to `events`. Proposes a value for each named field (lowercase words joined by underscores) and that the preference exists.
|
|
259
|
+
- `preference-remove`: `{ "authority", "preference": "<id>" }`, written to `events`. The tombstone of a preference.
|
|
260
|
+
- `preference-evidence`: `{ "preference": "<id>", "result": "applied" | "violated" | "outdated", "artifact": "<reference>" (optional), "merged_from": "<record id>" (optional), "at": "<ISO-8601>" (optional) }`, written to `events`. One application of a preference; it carries no authority. `at` is when the rule was applied (a record written before it existed is placed by the physical part of its clock). A merge copies each evidence record of the dropped preference to the kept one with `merged_from` naming the copied record, so a merge retried after a partial run copies each record once.
|
|
261
|
+
- `pinned-set`: `{ "authority", "content": "<text>" }`, written to `events`. Replaces the pinned context.
|
|
262
|
+
- `pinned-clear`: `{ "authority" }`, written to `events`. The tombstone of the pinned context.
|
|
263
|
+
- `setting-set`: `{ "authority", "key": "<key>", "value": <json, not null> }`, written to `settings` in `shared`.
|
|
264
|
+
- `setting-unset`: `{ "authority", "key": "<key>" }`, written to `settings` in `shared`. The tombstone of a setting.
|
|
265
|
+
- `setting-entry`: `{ "authority", "key": "<key>", "entry": "<one non-empty line>", "present": true | false, "if_decided_by": "<record id>" (optional, removals only) }`, written to `settings` in `shared`. Adds (`present` true) or removes (`present` false) one entry of a list setting; a removal with `if_decided_by` is conditional; see "Shared settings". A record with `if_decided_by` on an addition, or with an empty one, is not applied. A record for a key other than `brain.schema.<field>` is not applied.
|
|
266
|
+
|
|
267
|
+
Kinds of the state digests:
|
|
268
|
+
|
|
269
|
+
- `device-retire`: `{ "authority": "human", "device": "<device id>", "reason": "<text>" (optional) }`, written to `settings` in `shared`. Takes a device off the digest roster, and out of the devices a removal of the legacy tree waits for. The user writes it (`o2b store device retire`) on a machine other than the one retired; the record's own `device` field is the writing machine, the body's `device` the retired one. A reason that would route the record to `private` is refused, since every machine reads retirements from `shared`. A retired device that writes a record after its retire record is on the roster again and is reported by doctor.
|
|
270
|
+
- `state-digest`: `{ "partition": "shared" | "private", "cut": [<entry>, ...], "cut_hash": "<sha256>", "folds": { "preferences": "<sha256>", "pinned": "<sha256>", "settings": "<sha256>", "topics": "<sha256>" (optional) } }`, written to `digests` in its partition.
|
|
271
|
+
|
|
272
|
+
Kinds written by the dual writes of format version 1 (a trial: while the dual-write setting is on, the release's existing writers also append these records beside their legacy files). Mutable entities reuse the fold kinds above: preference writes and retires are `preference-set` records of the `pref-<slug>` id (a retire sets `status` to `retired`), apply-evidence is `preference-evidence`, and pinned context is `pinned-set` or `pinned-clear`. Pinned context goes to `private` when the writing machine holds that partition and to `shared` when it does not; a text that carries a `<private>` region (or the placeholder a stripped one leaves) or links a private page goes to `private` only. A `pinned-clear` is judged by the text it clears, so it lands where that text's `pinned-set` did. The two partition registers are not merged: a machine that holds `private` writes its sets and clears there, a machine that does not writes them to `shared`, and each partition's register (and its digest) reflects only the records in that partition.
|
|
273
|
+
|
|
274
|
+
All records one write produces land in one partition. The write is judged once: it is private when the page it writes or is about is private (or cannot be read), or when any of its content fields (a signal's principle, sources and raw text, a preference's principle, evidence and relationship fields, an event's text or artifact) carries a `<private>` region, links a private page, or names a preference whose page is not on disk; its own id, generated paths, hashes, timestamps, keys and agent names are not judged as links. That one verdict places every record of the write: a signal and its `idempotency` receipt, the records of a preference write, an apply-evidence event with its `preference-evidence` record and receipt, a pin's `preference-set` and its event, and every event and receipt of a write batch.
|
|
275
|
+
|
|
276
|
+
One exception: a `lane-entry-remove` carries no content, so it lands in the partition of the entry it removes, whatever the rest of its write is. A folder move or removal places each entry and its tombstone in that entry's own partition (a moved entry can still be raised to `private`, never lowered), and a write that raises a shared lane entry to `private` writes the entry's shared tombstone first, in the same write, as does a move that replaces a shared entry with a private one at its destination. A move lands in `private` when the entry it replaces at its destination is private, as a write over that entry does: nothing lowers an entry's partition. A move onto the entry it moves writes nothing. A move of a lane entry to a path that is no lane entry (outside `Brain/`, or not in a lane folder) is refused and writes nothing. A folder is never moved into its own subfolder, nor into a folder that holds it: the move is refused and writes nothing, as the rename on a machine that has not switched refuses it, so no tombstone of a folder move can remove an entry the same move wrote. A folder move or removal builds every record from one read of the lane entries, so an entry's value and its partition come from the same read, and while that read may miss a record (a shard it could not see or read only in part, or a record in `private` whose body blob has not arrived, quarantined on this machine or not) the moved entries go to `private`, as every lane write does then. A record in `shared` whose body blob has not arrived does not count: a record there never carries a value that makes an entry private. A device that holds only `shared` then sees a shared entry go, and a device that holds both reads the private value, whose clock is later.
|
|
277
|
+
|
|
278
|
+
Every dual-written body also carries `"vault_id": "<id>" | null`: the id in the `Brain/vault-id.json` marker of the vault the legacy write went to, or `null` when that vault has no marker. One store serves every vault on a machine. In format version 1 the field only records where a record came from: the search index of each vault reads every record of the store, and nothing filters by it yet. A later version decides whether a vault reads only its own records.
|
|
279
|
+
|
|
280
|
+
The other kinds:
|
|
281
|
+
|
|
282
|
+
- `signal`: `{ "id": "<signal id>", "path": "<vault-relative path of the signal file>", "staged": <bool>, "frontmatter": { ... }, "raw": "<text>" | null, "raw_shape": "bare" | "page" }`, written to `events`. One captured taste signal, with the frontmatter its file carries and its raw text. `raw_shape` says what `raw` holds: `bare`, the raw text a writer captured, or `page`, the whole body of an imported page (its `## Raw` heading included, still compressed when the page carried `_raw_codec`). A record written before the field existed is read as `page` when one of its first three lines is the `## Raw` heading. A switched machine mints the id with a device tag, the first six hex characters of the SHA-256 of its device id (`sig-<date>-<slug>-<tag>`, then `-2`, `-3` on that device), because it checks a new id only against its own view of the fold; an id minted before the tag, and every imported legacy id, stays as written. Write-session lane entries take the same tag (`ws-<yyyymmdd>-<hhmmss>-<tag>`). The frontmatter may carry `project`, the project key of the session the signal was captured in, and `session`, the id the host gave that session; both are optional, a writer stamps them only when it knows them, and topic planning groups signals by them.
|
|
283
|
+
- `log-event`: `{ "timestamp": "<ISO-8601>", "event_type": "<kind>", "body": { ... } }`, written to `log`. One operational log event, including notes and apply-evidence. An event goes to `shared`, except one that names a private page (a preference, or any page it links, in any field or inside its text), carries a `<private>` region, or belongs to a private write, which goes to `private` only; a preference id whose page is not on disk counts as private. The body of an event a person reads (`note`, `decision-record`, `decision-resolved`) may carry `project` and `session`, as a signal's frontmatter does; both are optional.
|
|
284
|
+
- `ledger-row`: `{ "row": <json> }`, written to `ledgers/<name>`. One row of an append-only ledger, as the ledger wrote it. Rows go to `shared`, with these exceptions. A row that names a private page goes to `private` only: every string the row carries is judged, at any depth, so a `<private>` region, a link or path to a private page, a preference id whose page is private or not on the writing machine (it cannot be judged), or a path outside the vault sends the row to `private` only. This covers `idempotency` receipts (a receipt for a write about a private preference too), `recurrence` events (a source that is a private page, or a link or `.md` path that names no page, as for a truth claim), `continuity`, `metrics`, `maintenance-journal`, `verifier-rejections` (also when a session turn the rejected proposal was drawn from is flagged `private`), `edit-history` and `decision-receipts` rows. A `continuity` row flagged `private` (a `<private>` region was stripped from it, or its writer said so) goes to `private` only. `lineage` rows (which sessions ran in which working directory, repository and branch), `query-demand` rows (what the user searched for), `permissions` rows (which writes were allowed or refused, and on what) and `git-commits` rows (commit messages and paths) go to `private` when the writing machine holds that partition and to `shared` when it does not. `truth-claims` rows go to `private` when the writing machine holds that partition and to `shared` when it does not; a claim whose source is a private page, or a link or `.md` path that names no page on the writing machine, goes to `private` only. Audit rows, `preference-audit` and `reliability-audit` (which every audit trail shares, secret custody included, named by the row's `audit_dir`), follow the same rule: `private` when the writing machine holds it, else `shared`; an audit row about a private preference still goes to `private` only. Ledger names: `idempotency`, `continuity`, `metrics`, `lineage`, `permissions`, `git-commits`, `reliability-audit`, `maintenance-journal`, `verifier-rejections`, `preference-audit`, `edit-history`, `decision-receipts`, `truth-claims`, `query-demand` and `recurrence`.
|
|
285
|
+
|
|
286
|
+
Kinds of the signal lifecycle (a captured signal moves on after its `signal` record: the dream pass consumes or archives it, a user retires it, the write approval lane approves or rejects it):
|
|
287
|
+
|
|
288
|
+
- `signal-state`: `{ "authority", "signal": "<signal id>", "state": <state> (optional), "fields": { "<name>": <json>, ... } (optional) }`, written to `events`. One move of the signal `signal`, a change of some of its frontmatter fields (`null` removes a field), or both; at least one of `state` and `fields` is present. The states: `consumed` (the dream pass used it), `archived` (it left the contradiction window unused), `retired` (retired by hand, with the retire metadata as `fields`), `expired` (its lifetime ended), `staged` (waiting for write approval), `approved` (approved, so active again) and `rejected` (rejected, out of the brain). A record lands in the partition of the signal it moves.
|
|
289
|
+
|
|
290
|
+
The signal fold: a signal starts active, or staged when its `signal` record says `staged`. A `signal` record whose `path` lies directly in `Brain/inbox/processed/` or `Brain/inbox/archived/` starts consumed or archived: only the migration writes such a capture, for a legacy page whose folder was its state, so a page moved into one of those folders by hand keeps the state the legacy reader gave it. Such a capture also outranks every `signal-state` record before it, since the legacy reader never read those (a page approved and then moved into `processed/` by hand read as consumed); a `signal-state` record after it wins as usual. Its state is one register and each field one register per signal, resolved by the clock alone, the later record winning whoever made it, since a lifecycle is a sequence of moves; `authority` says who decided and is kept for the history. A `signal-state` record without a valid `authority`, signal id, state or fields is not applied. A record whose `signal` record has not arrived is kept until it does.
|
|
291
|
+
|
|
292
|
+
- `signal-removed`: `{ "authority", "signal": "<signal id>" }`, written to `events`. The signal is forgotten: a user asked for it to be removed (for example `o2b brain delete-by-source`), not merely retired. Every record of the signal before the tombstone in fold order is void: the fold drops the signal, its frontmatter and its raw text, and no reader, page or search index shows them. A `signal` record later in fold order is a new capture under the same id and starts the signal over. The record lands in the partition of the signal it forgets: one tombstone in each partition that holds the signal, the `shared` one first, so a removal is the one operation whose records span two partitions. A removal interrupted between its tombstones is finished by running it again. See "Removal" for what the shards still hold.
|
|
293
|
+
|
|
294
|
+
Kinds of the dream owner (the one agent installation on one device that runs live dream passes on the brain). The owner is named by the three `settings` records below, all in `shared`, folded in order (clock, device, id): when no owner is known the first claim or request in fold order takes the role; a claim by the owner's device changes the owner's agent; a claim with `force` from another device takes the role at once, without a release; any other claim is ignored; a request from another device waits until the owner's device releases it, and a newer request replaces a waiting one (the replaced request has lost); a release counts only when the owner's device wrote it, and passes the role to the device and agent of the waiting request it names, or, with `request` and `to` both `null`, leaves the brain with no owner. Claims and requests carry `authority` `human` or `agent` (a person or an agent may move the role) and name the device that writes them. No setting key names the owner; `primary_agent` stays a declared name. A device whose own claim gave it the role runs its first live pass only from the look after the one that first saw it hold the role. A record that breaks these rules is not applied.
|
|
295
|
+
|
|
296
|
+
- `dream-owner-claim`: `{ "authority": "human" | "agent", "device": "<device id>", "agent": "<agent name>", "force": <bool> }`, written to `settings` in `shared` by the installation that creates a brain, by `o2b dream owner --here` on a brain with no owner or on the owner's device, and with `force: true` by `o2b dream owner --here --force`.
|
|
297
|
+
- `dream-owner-request`: `{ "authority": "human" | "agent", "device": "<device id>", "agent": "<agent name>" }`, written to `settings` in `shared`: a device that is not the owner asks for the role for that agent.
|
|
298
|
+
- `dream-owner-released`: `{ "request": "<request record id>" | null, "device": "<the releasing owner>", "to": "<device id>" | null }`, written to `settings` in `shared` by the owner's device, under its device-local pass lock, once any live pass in progress has finished.
|
|
299
|
+
|
|
300
|
+
Kinds of the human view (the readable Markdown pages one device, the view writer, renders into a folder the user chooses). The view writer is named by the three `settings` records below, all in `shared`, folded in order: when no writer is known the first claim in fold order (the lowest clock, then device) takes the role and every later claim is ignored; a request with no writer known takes the role at once, a forced request takes it at once, any other request waits until the current writer releases it, a newer request replaces a waiting one, and a request by the current writer cancels it. Claims and requests carry `authority` `human` and name the device that writes them; a release counts only when the current writer wrote it for the waiting request. No setting key names the view writer; the role lives in these records only. A device whose own claim gave it the role renders only from its second catch-up after the claim, so a rival claim with a lower clock has one catch-up to arrive; when sync takes longer than that, both devices may render once before the lower claim reaches the other, and the loser stops at its first catch-up after it.
|
|
301
|
+
|
|
302
|
+
- `view-writer-claim`: `{ "authority": "human", "device": "<device id>" }`, written to `settings` in `shared` by the first machine that creates or migrates the store.
|
|
303
|
+
- `view-writer-request`: `{ "authority": "human", "device": "<device id>", "force": <bool> }`, written to `settings` in `shared`: the user asks for the role on that device.
|
|
304
|
+
- `view-writer-released`: `{ "request": "<request record id>", "device": "<the releasing writer>", "to": "<device id>" }`, written to `settings` in `shared` by the writer once it has finished any render in progress.
|
|
305
|
+
- `view-render`: `{ "page": "<page path>", "topic": "<topic id>" (optional, for a topic page), "sum": "<sha256 of the page bytes>", "base": "<blob sha256>", "bytes": <length> }`, written to `log` in `shared` after the page holds those bytes. The blob is the canonical JSON of `{ "page", "text", "keys" }`: the page text and, per line, the key of the record it shows (or `null`), the merge base of the next render.
|
|
306
|
+
- `view-pass`: `{ "written": 0 }`, written to `log` in `shared` by a writer whose pass found every page of its view folder already as rendered (an idle pass), at most once a day. A pass with no view folder, or with a page it could not write, records none.
|
|
307
|
+
- `view-replaced`: `{ "page", "sum", "blob": "<blob sha256>", "bytes", "reason": "edit" | "race" | "conflict-copy" | "foreign" }`, written to `log`: page bytes that were not the writer's own render, kept as a blob of `{ "page", "text" }`. It lands in the partition of the edit's privacy verdict, with the human records the edit produced.
|
|
308
|
+
- `history-verdict`: `{ "authority", "record": "<note record id>", "keep": <bool>, "verdict" (optional) }`, written to `log` in `shared` by a decision model (`human_readable`): whether the named `note` log event belongs in the weekly history page. A note the model keeps is stored too, with `keep: true`, so a note with any stored verdict is settled and not asked about again. The newest verdict for a note decides - `keep: false` hides the note from `history.md`, a later `keep: true` brings it back. Decisions and confirmed rules are never named and never hidden.
|
|
309
|
+
- `view-correction`: `{ "authority", "page", "key", "text" }` or `{ "authority", "page", "key", "hidden": true }`, written to `events`: the user reworded or deleted the line of a page that shows `key`. One register per page and key, resolved by authority, then clock.
|
|
310
|
+
- `view-addition`: `{ "authority", "page", "after": "<key>" | null, "text" }`, written to `events`: a line the user added below the line that shows `after`.
|
|
311
|
+
|
|
312
|
+
Page paths are relative to the view folder and use `/`. Pages are rendered from `shared` records only; a preference with any record in `private` is left out of every page, and so is a private topic. A topic page is `topics/<YYYY-MM-DD>-<slug>/topic.md` (the topic's creation day and a slug of its title; a rename moves the folder), with a companion `archive.md` for the entries over the page budget and the resolved questions; its id comment line also names the topic (`topic=<topic id>`). Research reports render to `reports/<entry>.md` and source summaries to `sources/<entry>.md`, from the `lane-entry` records of the lanes `reports` and `sources`. A page in `topics/`, `reports/` or `sources/` the store no longer renders is removed by the view writer, after any edit it carries is ingested, and only when its path has exactly the shape the writer produces (forward slashes, no `..` or `\`, no empty segment, no Windows device name) and resolves inside the view folder, with no symbolic link below the view folder; a render record that names any other path is ignored. An edit of a topic page becomes the topic record that says the same thing, with `authority` `human`. A reworded rule line of `about-me.md` is a `preference-set` of the rule's `principle`, a deleted one a `preference-set` that sets `status` to `retired`.
|
|
313
|
+
|
|
314
|
+
Ledgers the migration from the legacy layout writes (`ledger-row` records, the same shape): `capture-decisions` (one row per inbound capture the capture bot accepted, rejected or found malformed), `search-feedback` (which search results an agent used, per query) and `search-reinforce` (which vault paths were reinforced by use). Their rows go to `private` when the writing machine holds that partition and to `shared` when it does not; a row that names a private page goes to `private` only.
|
|
315
|
+
|
|
316
|
+
A `search-reinforce` row is either one reinforcement, `{ "ts": <unix ms>, "paths": ["<vault-relative path>", ...] }`, or a reset, `{ "ts": <unix ms>, "reset": true }`. The ledger is append-only, so a reset is a row too: the reinforcement fold counts only the rows after the newest reset row in fold order, and a reset lands in the partition its writer would put a reinforcement in.
|
|
317
|
+
|
|
318
|
+
Kinds of topics (a topic is one area of work or one personal matter with an immutable id; its page in the human view is rendered from these records). Every topic record is written to `topics`, carries `authority` in its body and the topic's id (a ULID) in the envelope's `topic` field; the id never changes, and a rename changes only the title. A list item (a decision, an open question, a log entry, a milestone) is addressed by its `item` id (1 to 64 letters, digits, hyphens and underscores), which is its topic's own: the same id in two topics names two items; a record that creates an item may leave `item` out, and its own record id is the item id then. An item record of the form `{ "authority", "item", "removed": true }` is the item's tombstone.
|
|
319
|
+
|
|
320
|
+
- `topic-create`: `{ "authority", "title": "<one line>", "scope": "personal" | "project:<project>", "description": "<one line>" | null (optional), "goal": "<text>" | null (optional) }`. The topic exists from its first create in fold order, which fixes its scope and its creation time; its status starts as `active`. The envelope `scope` repeats the topic scope.
|
|
321
|
+
- `topic-rename`: `{ "authority", "title" (optional), "description": "<text>" | null (optional) }`, at least one of the two.
|
|
322
|
+
- `topic-status`: `{ "authority", "status": "active" | "waiting" | "blocked" | "on-hold" | "done" | "closed", "resolved": "<YYYY-MM-DD>" (optional) }`. A `done` status without `resolved` is resolved on the UTC day of the record's clock.
|
|
323
|
+
- `topic-goal`: `{ "authority", "goal": "<text>" | null }`. A goal offer that loses to a stronger authority and comes after the winner is kept as a proposal, shown on the page as an open question attributed to its agent.
|
|
324
|
+
- `decision`: `{ "authority", "item" (optional), "text", "serves": ["<milestone item>", ...] (optional) }`. A record that leaves `serves` out keeps the links the item already has; `"serves": []` clears them.
|
|
325
|
+
- `open-question`: `{ "authority", "item" (optional), "text" }`.
|
|
326
|
+
- `question-resolved`: `{ "authority", "question": "<item>", "answer": "<text>" (optional) }`. One from a decision model only proposes the resolution.
|
|
327
|
+
- `log-entry`: `{ "authority", "item" (optional), "text", "class": "correction" | "decision" | "blocker" | "reframing" | "rejected" | "note" | "routine", "reason": "<text>" (optional) }`. Every class but `routine` is shown on the topic page; routine progress stays in the store.
|
|
328
|
+
- `milestone`: `{ "authority", "item" (optional), "text" }`.
|
|
329
|
+
- `milestone-done`: `{ "authority", "milestone": "<item>", "evidence": "<text>" (optional) }`. It marks the milestone done only with `authority` `human`, or `agent` with `evidence`; any other one only proposes completion.
|
|
330
|
+
- `assign`: `{ "authority", "record": "<record id>" }`: the record belongs to the topic. `unassign` takes it out again.
|
|
331
|
+
- `unassign`: `{ "authority", "record": "<record id>" }`. Unless its `authority` is `model` it also blocks the route: no automatic pass assigns that record to that topic again.
|
|
332
|
+
- `merge`: `{ "authority", "into": "<topic id>" }`: the topic merged into another. It resolves to that topic, whose page carries both topics' items. Merges apply in fold order; one that would close a cycle, or names a topic that does not exist, is ignored.
|
|
333
|
+
- `split`: `{ "authority", "into": "<topic id>", "items": ["<item>", ...] (optional), "records": ["<record id>", ...] (optional) }`: the items and assigned records listed move to the other topic. An item is looked up as the split's topic names it (its own, or one split into it), so an item of a topic merged into another is split by a `split` under the merged topic.
|
|
334
|
+
- `link`: `{ "authority", "to": "<topic id>", "removed": true (optional) }`: the two topics are related; with `removed` the link is gone.
|
|
335
|
+
- `undo`: `{ "authority", "record": "<record id>" }`: the record named is void, as if never written, when the undo's authority is at least that record's. An undo can be undone. An undo of an `assign` whose `authority` is not `model` blocks that route as an `unassign` does.
|
|
336
|
+
|
|
337
|
+
Topics fold under the rules of every mutable entity: the title, description, goal and status of a topic, each item, the topic that owns an item, a milestone's completion, a question's resolution, a merge, a link and a record's assignment are each one register, resolved by authority, then clock. A record that is not a topic record belongs to the topic its `assign` names, else to the topic its envelope names. A topic is private when its first `topic-create` sits in `private`; every later record of a private topic is written there too, and so is an `undo` of any record that sits in `private` (the undo of an undone private create names a topic that is out of the fold, and still goes there), and an item record, `milestone-done` or `question-resolved` of an item that has a record in `private` (a `milestone-done` or `question-resolved` there counts too). A route taken back from a topic stays blocked for the topic it merged into. A `topic-create` with the personal scope goes to `private` unless its writer asks otherwise.
|
|
338
|
+
|
|
339
|
+
A topic record an agent session wrote may carry a `session` field, so two sessions of one agent name on one device tell their records apart. Its value is the first 32 characters of the lowercase hex sha256 of the UTF-8 bytes of `open-second-brain-session`, one NUL character (U+0000) and the session id with surrounding white space trimmed; an id that is empty or longer than 512 characters gives no stamp. The session id is `OPEN_SECOND_BRAIN_SESSION_ID` when it is set, else the host's own session id: for the MCP server of Claude Code (started with `--harness claude-code`) the `CLAUDE_CODE_SESSION_ID` of its environment, for a hook the `session_id` of its payload. The writer and the reader resolve it by this one rule, so the variable wins on both sides. It is informational: no fold reads it, and a record without it is attributed to its device and agent alone. A caller cannot name it through `brain_topic`; `o2b topic` stamps only from `OPEN_SECOND_BRAIN_SESSION_ID`. That variable must name one session and reach the writer and the hooks alike, from the host's environment. A value shared by several sessions (set machine-wide, or once for a bridge that serves several) gives them one stamp, so each session takes the others' records for its own and suppresses their neighbour updates. A value that reaches only one side (set only in an MCP server's own `env` block, say, so the hooks resolve the host's id instead) gives the writer and the hook different stamps, so each session is shown its own records once. Since the stamp is an unsalted hash, a guessable value can be recovered from a synced record.
|
|
340
|
+
|
|
341
|
+
A topic record that a decision model wrote from another store record carries a `source` field naming that record's id (an `event_kind` item names the record it came from; a `question-resolved` proposal names the record the model judged). A topic record that a decision model wrote or let through in `enforce` carries a `verdict` field: `{ "use": "<decision-model use>", "model": "<model id>", "provider": "<preset name of the chain entry that answered>", "version": <question version>, "mode": "enforce", "confidence": <number from 0 to 1> }` - identifiers and numbers only, never state or question text. The field is informational: a fold reads stored verdicts only and never calls a model, and a verdict never changes the authority precedence above.
|
|
342
|
+
|
|
343
|
+
Kinds of attestations (a signed statement of the state one machine measured, made with that machine's signing key):
|
|
344
|
+
|
|
345
|
+
- `attestation`: `{ "record": { ... } }`, written to `events` in `shared`. The whole signed attestation as its writer produced it: its id (`attest-<UTC instant>`, unique), creation time, signing device, the measured manifest, the store digest, the seal and the signature. An attestation names no page, so it always goes to `shared`, where every machine that verifies it can read it. The key that signed it is never a record: it stays in the signing machine's device-local state, and a verifier needs only its public half. When two records carry the same attestation id, the first in fold order is the attestation and the others are ignored.
|
|
346
|
+
|
|
347
|
+
Kinds of record lanes (the Brain record lanes that have no kind of their own: decisions, obligations, pledges, theses, tensions, gap tasks, attention flows, entities, procedures, procedural memory, skill proposals and benchmarks, captures, write sessions, exact-state pages, standing rules and the rest):
|
|
348
|
+
|
|
349
|
+
- `lane-entry`: `{ "authority", "lane": "<lane>", "entry": "<entry id>", "fields": { ... }, "text": "<Markdown>", "raw": "<file text>" (optional) }`, written to `events`. The whole current entry: `fields` are the structured fields the entry carried (a page's frontmatter, or the object a JSON file held), `text` its Markdown body. `raw`, when present, is the file's text byte for byte, written only when `fields` and `text` do not reproduce it (a page without frontmatter, a quoted value, CRLF line ends, the formatting of a JSON file). A reader serves `raw` only when it parses back to the record's own `fields` and `text`, and renders `fields` and `text` otherwise; a reader that does not know `raw` ignores it. The rollback export serves `raw` under the same rule: it writes `raw` into the restored file when it parses back, and the rendering of `fields` and `text` otherwise. `raw` counts for the entry's privacy like `fields` and `text`, and spills into a blob with the rest of the body. A lane name is 1 to 64 lowercase letters, digits and hyphens, starting with a letter or digit; an entry id is a non-empty single line of at most 512 characters, unique within its lane. Standing rules are entries of the lane `standing-rule` and carry `authority` `human`. An entry goes to `private` when its page is private by its visibility markers, or when its fields or text name a private page or one that cannot be judged; the text of a large entry spills into a blob like any other body.
|
|
350
|
+
- `lane-entry-remove`: `{ "authority", "lane": "<lane>", "entry": "<entry id>" }`, written to `events`. The tombstone of an entry. While the dual-write setting is on, a machine that has not switched writes it beside a removed or moved legacy page whose entry the store holds (a move also writes the entry at its new path, built from the page as it is on disk after the move, or only the tombstones when no page is there, the old entry's and that of a destination entry the rename overwrote; the page is never read through a symbolic link, at its own name or at a folder below `Brain/`, nor when it is a special file, so such a page also leaves only the tombstones, as the migration never imports it), so the store holds what the legacy tree holds. A page whose entry the store does not hold, renamed over a path whose entry it does hold, is written as that page's `lane-entry` (or, when no page the store would import is there, that entry's tombstone), placed as a write of the page on that machine would be, so the store never keeps the content the rename replaced.
|
|
351
|
+
|
|
352
|
+
Entries fold by lane and entry id: each entry is one register, resolved by authority, then clock.
|
|
353
|
+
|
|
354
|
+
Kinds of the migration from the legacy layout, written to `settings` in `shared` with `authority` `human` (the user ran the migration):
|
|
355
|
+
|
|
356
|
+
- `migration-cohort`: `{ "authority": "human", "vault_id": "<id>" | null, "devices": ["<device id>", ...] }`. Every device id found in the legacy tree when the migration started, with no age limit; a device of it that has not switched counts as retired by silence once its last evidence of life is older than `migration.silent_device_days`, and the record's clock stands in for the evidence of a device that left no dated trace.
|
|
357
|
+
- `migration-done`: `{ "authority": "human", "vault_id", "device": "<device id>", "cuts": { "<partition>": { "cut": [<entry>, ...], "cut_hash": "<sha256>" } }, "imported": <items> }`. The device finished importing; `cuts` holds the digest cut (see "State digests") of each partition it holds, taken right after the import.
|
|
358
|
+
- `device-switched`: `{ "authority": "human", "vault_id", "device": "<device id>" }`. The device moved to the store; a device that holds its own `device-switched` record writes the store only.
|
|
359
|
+
- `device-unswitched`: `{ "authority": "human", "device": "<device id>", "run_id": "<migration run>" }`. A rollback took the device back to the legacy layout. Of a device's own `device-switched` and `device-unswitched` records, the latest in fold order decides whether it is switched.
|
|
360
|
+
- `legacy-tree-removed`: `{ "authority": "human", "vault_id", "device": "<device id>", "forced": <bool>, "stopped": ["<device id>", ...], "retired_by_silence": [{ "device": "<device id>", "last_evidence": "<ISO time>" | null }, ...], "silence_threshold_days": <int>, "as_of": "<ISO time>" | null, "tree_already_left": <bool> }`. The device moved the vault's legacy tree into its device-local archive; `forced` says the cohort had not all switched, `stopped` names the devices still on the legacy layout then, and `retired_by_silence` the cohort devices retired by silence with their last evidence, measured against `as_of` with the threshold then in force (absent in a record of an older release). `tree_already_left` is `true` when the tree had already left the vault and the device only moved its own leftover files: such a record repeats the silence verdict of the removal that moved the tree, when the device held that removal's record, and a later device takes the verdict from the latest record of the vault without it (absent in a record of an older release, read as `false`). A legacy tree seen in the vault after this record is reported by the doctor.
|
|
361
|
+
|
|
362
|
+
Every record the migration imports carries, beside `vault_id`, the field `legacy_device` (the device id in the name of the legacy shard the item came from, or the empty string for a legacy un-sharded file and for a page) and the field `migrated`: `{ "key": "<vault-relative path>[#<line>]", "sum": "<sha256>", "part": <index>, "parts": <count> }`, the legacy item it came from (with the line for an append-only file), the checksum of that item's content, and which of the item's records this is (an item can become more than one record, such as a preference whose human-decided fields and derived fields carry different authorities). Two legacy items with identical content have different keys and stay two records. A legacy item that a dual write had already put in the store is not imported again: the migration matches this device's unmarked records by kind and body (without `vault_id`, `legacy_device` and `migrated`) as a multiset, one copy per item record.
|
|
363
|
+
|
|
364
|
+
Topic planning reads an imported record's origin from its body rather than its envelope: the time is the log event's `timestamp` or the signal frontmatter's `created_at` (an ISO day, or a time with its zone), else the `YYYY-MM-DD` day in the file name of the `migrated` key, else the record's clock; the device is `legacy_device` when it is not empty, else the envelope device. Nothing is added to the body for this.
|
|
365
|
+
|
|
366
|
+
Every other kind is defined by the feature that writes it, and a reader that does not know a kind keeps the record and leaves its body alone.
|
|
367
|
+
|
|
368
|
+
## Dream work
|
|
369
|
+
|
|
370
|
+
Dream work that needs a model (wording a summary, answering a closed question) waits in a queue of records in the `dream-work` stream. A store without these records has an empty queue. Only the dream owner's device writes them: a record is folded only when the device that wrote it is the dream owner at that record's place in the fold order (the dream owner records of the `settings` stream fold together with the queue in one order, clock, then device, then id), so a brain with no dream owner has no queue. An item, and every later record about it, is written to the partition of the most private record it is built from: `private` when any of them is private, otherwise `shared`. A machine folds the partitions it holds; a machine without `private` sees nothing of the private items.
|
|
371
|
+
|
|
372
|
+
The id of an item is the hex sha256 of the canonical JSON of the list `[operation, subject, occurrence, input_hash, prompt_version, schema_version]`. The kinds:
|
|
373
|
+
|
|
374
|
+
- `dream-work-item`: `{ "id", "operation", "subject", "occurrence", "input_hash": "<sha256>", "prompt_version", "schema_version", "answer_schema": { ... }, "after": ["<item id>", ...], "resources": ["<namespace>:<name>", ...], "private_resource_barriers": ["<sha256 resource key>", ...], "evidence": ["<record id or blob reference>", ...], "payload": { ... } }`, written to `dream-work`. One unit of work. A second item with an id already folded is ignored. `occurrence` is a sortable string (the window day and a sequence) that orders the queue. `after` names the items it comes after; `resources` the ordering resources it touches (`topic:<id>`, `chain:<preference id>`, `rung:<name>`). `private_resource_barriers` lists only sha256 keys of resource names held by earlier open private items; a device without `private` treats those shared items as blocked without seeing private item ids or subjects.
|
|
375
|
+
- `dream-work-lease`: `{ "item", "generation": <n>, "lease_token": "<unique take token>", "run", "owner_revision", "expires_at": "<ISO-8601>" }`, written to `dream-work`. A take. Its generation is above every earlier lease of the item. If two leases have one generation after stale-lock takeover, the first in fold order wins; later same-generation leases are rejected. Only the winning token may answer or release while the lease is live. An applied record names the token and receipt of its accepted answer; the lease need not remain live after the answer is accepted.
|
|
376
|
+
- `dream-work-answer`: `{ "item", "generation", "lease_token", "input_hash", "value": <json> | "text": "<text>", "agent", "model", "receipt": "<sha256>" }`, written to `dream-work`. An accepted answer, under the newest lease token and for the item's own input. `receipt` is the sha256 of the canonical JSON of `[item, generation, input_hash, value or null, text or null]`.
|
|
377
|
+
- `dream-work-attempt`: `{ "item", "generation", "lease_token", "outcome": "failed" | "refused" | "released", "reason", "retry_at": "<ISO-8601>" | null, "input_hash"? }`, written to `dream-work`. A failed attempt ends its lease and sets when the item may be taken again; five failed attempts since the item or since its last retry park it. A released attempt ends its lease with no wait; one an executor gives back with a reason of its own (`shadow`, `egress-refused`) carries the item's `input_hash`, and the fold keeps that reason as the item's last release. A refused attempt records an answer that was not accepted and changes nothing else.
|
|
378
|
+
- `dream-work-applied`: `{ "item", "generation", "lease_token", "receipt", "effects": ["<record id>", ...] }`, written to `dream-work`. The accepted answer named by `receipt` was applied by the operation that produced the item (for the closed questions of topic planning, by topic planning itself, and `effects` is `["abstained"]` when the answer decided nothing); the item is finished.
|
|
379
|
+
- `dream-work-closed`: `{ "item", "reason": "cancelled" | "superseded", "note", "successor": "<item id>" | null, "authority": "human" | "agent" }`, written to `dream-work`. The item is closed. An item that names a superseded item in `after` follows to its successor.
|
|
380
|
+
- `dream-work-retry`: `{ "item", "authority": "human" }`, written to `dream-work`. A person asked for the item to be offered again; its failed attempts count from zero.
|
|
381
|
+
- `dream-work-approve`: `{ "item", "authority": "human" }`, written to `dream-work`. A person approved a text answer held for review (the shared setting `dream.apply_drafts` is `review`); the next pass applies it.
|
|
382
|
+
|
|
383
|
+
An item folds to one state: `waiting`, `leased`, `accepted` (an answer is recorded and not yet applied), `awaiting-review` (an answer of a text operation recorded while `dream.apply_drafts` is `review`, with no `dream-work-approve` yet; nothing applies it), `finished`, `parked` or `closed`. A waiting item is ready when every item in `after` is finished and no item earlier in the queue order that is neither finished nor closed shares a resource with it. A device holding only `shared` may take only resource-free shared items; this lets it preserve resource order without seeing private items that may arrive later. Status uses the same eligibility rule as take. A record that breaks these rules is listed as rejected and never applied. The `dream-work` fold is not one of the folds a state digest hashes. The stream is part of format version 1: a reader that does not know it leaves it alone.
|
|
384
|
+
|
|
385
|
+
## Dream replay
|
|
386
|
+
|
|
387
|
+
The dream pass works in windows of one UTC day, oldest first, and keeps what it covered in the `dream-replay` stream, so another machine that becomes the dream owner continues where the last one stopped. A window is named by its day; a day evaluated again (today's window, by a later pass of the same day) is named `<day>#<n>`, `n` counting the earlier evaluations. A record of the stream lives in the `shared` partition unless it names what the window read from private records: a plan or an inventory page that names a private signal, a private preference or a record of the `private` partition goes to `private`, and the late and clamped records an admission read from `private` are named only in its `dream-admission-private` part. A device folds the stream of every partition it holds. The coverage, the shared admission and the ledger records stay in `shared`. A window's records are written in this order:
|
|
388
|
+
|
|
389
|
+
- `dream-admission-private`: `{ "day", "window", "late": [...], "clamped": [...], "run" }`, in `private`, only when the admission read late or clamped records from the `private` partition: those records, named nowhere else. It is written before its admission, which names it; a part that no admission names (a pass stopped between the two writes) is ignored, and the next pass admits the window again.
|
|
390
|
+
- `dream-admission`: `{ "day", "window", "from", "to", "positions": [{ "partition", "stream", "device", "shard", "offset", "prefix_hash" }, ...], "gaps": [{ "partition", "stream", "shard", "reason", "since" }, ...], "late": [{ "id", "at" }, ...], "clamped": [{ "id", "at" }, ...], "left_out": [{ "partition", "stream", "shard", "offset", "since" }, ...], "rebased": { "shards": [...], "seen": <n> } | null, "admitted_at", "run", "private_part"?: "<record id>" }`. The window's input boundary: per shard of the `events` and `log` streams, the first byte not admitted, with the sha256 of the bytes before it. `late` names the records first seen after their day was covered (judged from the window's start, `from`), `clamped` the records dated after the moment of admission (judged at that moment). An admission with `gaps` is not followed by a plan; a later admission of the same window replaces it. A shard that stayed incomplete for three days is listed in `left_out` and its records are admitted, as late, once it reads again. `rebased` counts the records of a replaced or rewritten shard that were taken as seen. `private_part` names the admission's `dream-admission-private` record; a device that holds `private` folds that part into the admission.
|
|
391
|
+
- `dream-window-plan`: `{ "day", "window", "bounds": { "from", "to" }, "instant", "version": <n>, "effects": [...], "audit": { ... }, "engine_version", "policy_digest", "run" }`. What the window decided, with the payload of every effect frozen, so a window interrupted after its plan is finished from the plan and never planned again. A plan whose `version` (the encoding of its payloads) is not the reader's is not applied: the window is planned again and the new plan record is the window's. Each effect has an `effect` id: the sha256 of the canonical JSON of `[window, kind, subject]`.
|
|
392
|
+
- `dream-coverage`: `{ "day", "window", "admission": "<record id>", "plan": "<record id>", "owner", "run", "behind": <n> }`. The window is finished. The newest covered day is where the next pass starts.
|
|
393
|
+
- `dream-bootstrap`: `{ "cursor", "counts": { ... }, "start" | null, "done": <bool>, "run" }`. The first pass's inventory of a brain that predates the replay, page by page.
|
|
394
|
+
- `dream-cross-topic-spent`: `{ "day", "owner_token", "effect", "window" }`. The cross-topic allowance of one owner token was spent on that day. One record per effect counts.
|
|
395
|
+
- `dream-rollup-baseline`: `{ "rung", "baseline", "produced", "window", "effect" }`. A rollup rung's counter after a window fired it. One record per effect counts; the newest window's wins.
|
|
396
|
+
|
|
397
|
+
The fold of the stream gives the last covered day, the window that has an admission and no coverage (it is finished first), and the positions the next admission reads from. Signal captures and applications of a rule (the `apply-evidence` events of the log and the `preference-evidence` records) are the inputs of a window: each window sees those below its boundary whose time is not after its instant. Every other record is state and is read as it is. The stream is part of format version 1: a reader that does not know it leaves it alone.
|
|
398
|
+
|
|
399
|
+
## Device-local state
|
|
400
|
+
|
|
401
|
+
Each machine keeps a device-local directory outside the store, keyed by the store id: append locks, the persisted clock, blob temp files, the search index, caches, hook state and snapshots. A `decide-asked.json` an earlier version kept there is no longer read or written: the dream work queue remembers what was asked. It is never synced.
|
|
402
|
+
|
|
403
|
+
Some state that a legacy install kept inside the vault is device-local once a machine writes the store only, because no other machine needs to agree on it and it is never a record:
|
|
404
|
+
|
|
405
|
+
- search activation: the access events of this machine's searches and the activation state folded from them, which decay and are swept;
|
|
406
|
+
- dream workruns: the per-pass checkpoint files of this machine's dream process, kept as crash evidence;
|
|
407
|
+
- the learned search weights: a cache folded from the `search-feedback` rows, recomputed at will.
|
|
408
|
+
|
|
409
|
+
Sync only the partition folders, each as its own sync folder; never sync the store root or the device-local directory as a whole.
|
|
410
|
+
|
|
411
|
+
## Versioning
|
|
412
|
+
|
|
413
|
+
The format version is the integer `v` in every record and the `format` field of `store.json`.
|
|
414
|
+
|
|
415
|
+
- A change that every reader of the current version can still read keeps the version.
|
|
416
|
+
- A change that an older reader would misread raises the version. An older reader then skips the newer records and reports them, and never rewrites them.
|
|
417
|
+
- A release may refresh `FORMAT.md` in a partition only with a document of the same or a newer format version; an older release never replaces a newer document.
|