You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plans/2026-07-09-tracedecay-brain-rewrite.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,7 +201,7 @@ The plan treats merged rows below as required base semantics at publication base
201
201
|`#438` merged — restart-safe applied-manifest retirement | Validates and transactionally retires only proven schema-2 `Applied` source/target manifest owners under an exclusive lifecycle capability while leaving original shard data untouched and the destination canonical; final head `4f7b2b2c`, merge `3bea5ec7`. | Import restart-safe retirement as accepted anti-corruption behavior: retries are idempotent, ambiguous ownership fails closed with doctor evidence, registry rows and manifests change atomically, and V2 preserves the exact applied-ledger/retirement receipt (FM-111). |
202
202
|`#439` merged — derive orphan stores from registry reconstruction | Reuses the read-only registry-reconstruction preflight to count only manifests actually missing project/alias/store/scope/artifact rows, replacing incomplete token-accounting/path proxies; final head `de55e376`, merge `974d423b`. | Doctor, health, migration, and repair share one per-manifest typed diff and population. Complete registry rows never produce an orphan warning; a reported orphan links the exact missing rows and reconstruction plan (FM-114). |
203
203
|`#440` merged — isolate registry diff conflicts | Independently preflights each eligible reconstruction plan so one conflicting manifest does not hide missing rows in unrelated manifests; final head `7a56db8e`, merge `0dd1fd7d`. | Preserve each conflict, continue classifying every unrelated manifest, and expose per-manifest reconstruction/detection receipts through the shared catalog/doctor truth (FM-114). |
204
-
| `#441` open — Hermes memory/context routing, with local follow-up | Remote PR head `152bfacc` gates first-turn guidance, routes memory/LCM from the logical Hermes session workspace, generalizes handle dereference, and isolates cloned context-engine state. Local worktree `/fast/projects/tracedecay` had amended head `26626698` plus user-owned follow-up for named Hermes profiles and a transitional profile-level `user-memory.db`; one open review finding shows generalized handle dereference can drop the original project selector. | Treat the failures as fixtures, not the draft implementation as V2 authority: host profile/config target is distinct from TraceDecay data profile; every invocation carries immutable session/workspace scope; singleton/clone state has explicit per-session versus process-shared ownership; non-code greetings produce useful silence; compatibility-handle retrieval preserves the exact canonical scope/auth binding; projectless activity remains activity-owned while durable user facts use explicit `DeclaredScope::Profile`; active-project memory composes profile plus exact-project facts with provenance. If the V1 `user-memory.db` ships, PR 33 migration imports it once into activity knowledge tables and retires the separate runtime store (FM-138–FM-143). |
204
+
| `#441` open — Hermes memory/context routing, with local follow-up | Remote PR head `152bfacc` gates first-turn guidance, routes memory/LCM from the logical Hermes session workspace, generalizes handle dereference, and isolates cloned context-engine state. Local worktree `/fast/projects/tracedecay` had amended head `26626698` plus user-owned follow-up for named Hermes profiles and a transitional profile-level `user-memory.db`; one open review finding shows generalized handle dereference can drop the original project selector. A later local fix found branch creation copied/reflinked only the live main SQLite file while another connection could checkpoint WAL pages, so its branch lock did not fence database writers and the snapshot could be half-checkpointed or omit committed WAL data. | Treat the failures as fixtures, not the draft implementation as V2 authority: host profile/config target is distinct from TraceDecay data profile; every invocation carries immutable session/workspace scope; singleton/clone state has explicit per-session versus process-shared ownership; non-code greetings produce useful silence; compatibility-handle retrieval preserves the exact canonical scope/auth binding; projectless activity remains activity-owned while durable user facts use explicit `DeclaredScope::Profile`; active-project memory composes profile plus exact-project facts with provenance. If the V1 `user-memory.db` ships, PR 33 migration imports it once into activity knowledge tables and retires the separate runtime store. V2 never creates a branch database copy and never copies/reflinks a live main file: the daemon-owned snapshot service uses SQLite's online backup API or a bounded `VACUUM INTO` operation, pins a source watermark, verifies the destination, and publishes only a signed fsynced manifest (FM-138–FM-145). |
205
205
206
206
PR `#409` was closed without merge and superseded by release PRs `#413`/`#416`; PRs #418, #425–#440 listed as merged above are accepted history where applicable. Latest audited `origin/master` is `273f50c0372f063b97f4755563a3ded65ef324d5` at 0.0.53; draft plan PR #421 and Hermes PR #441 are open. The plan branch must be rebased to this or a newer accepted base before final verification. The implementation lead refreshes open PRs, merge bases, changed files, checks, and TraceDecay semantic context immediately before each program phase. If GitHub and TraceDecay disagree, record both snapshots and reconcile index/ref freshness before changing the plan.
207
207
@@ -432,11 +432,14 @@ Ordering and concurrency contracts:
432
432
- Each provider artifact/source instance has a monotonic source sequence; each session/agent stream has a projected sequence. There is no invented total global order.
433
433
- Every observation carries occurred time, ingested time, source sequence, rewrite generation, and causation/correlation links. Late events are inserted without rewriting prior history.
434
434
- One bounded writer actor owns each SQLite shard connection. Concurrent agents enqueue append batches through a private spool; read services use short-lived read-only snapshot pools.
435
+
- The daemon is the only ordinary live process allowed to construct the V2 store factory, own mutable SQLite connections, checkpoint WAL, run query read pools, publish snapshots, or swap generations. CLI, MCP, hooks, dashboard, SDKs, automations, installers, and provider plugins call the daemon application service over authenticated local IPC or the protected HTTP API; they never open SQLite or fall back to an embedded writer/reader when the daemon is unavailable.
435
436
- WAL, busy timeout, queue depth, maximum batch bytes, maximum transaction duration, and checkpoint thresholds are explicit configuration with safe defaults and telemetry.
437
+
- Database snapshots/backups/branch evidence are transactionally consistent products, never filesystem clones: no copy, reflink, hard link, main-file-only archive, or DB-without-WAL family operation is legal on a live shard. The snapshot coordinator uses the SQLite online backup API for live backups and may use `VACUUM INTO` only as a bounded daemon/offline-maintenance primitive, then validates header/application/schema/page counts, integrity policy, source watermark and row-family manifests, fsyncs file plus parent, and atomically publishes the manifest.
436
438
- Queue saturation applies tiered backpressure: coalesce rebuildable notifications, spill canonical observations durably, and reject/mark optional enrichment. It never silently drops prompts, tool events, approvals, edits, or outcomes.
437
439
- Idempotency is per source record. Projectors and outbox consumers are at-least-once and idempotent. Leases are fenced by generation; a crashed owner cannot resume writes after a new owner takes over.
438
440
- Readers receive vector watermarks and may request frozen, live, or eventual consistency. No read transaction survives UI think time or cursor pagination.
439
441
- Crash tests cover process death before/after spool fsync, observation commit, outbox commit, hint render, host acknowledgement, projector checkpoint, and WAL checkpoint.
442
+
- Corruption-resistance tests additionally race writes, readers, passive/TRUNCATE checkpoints, online backup/`VACUUM INTO`, generation publication, daemon restart, disk-full, short write, bit flip, truncation, and killpoints. They prove no architecture-induced corruption or committed-WAL omission; unavoidable media faults are detected before publication, quarantined as a whole DB/WAL/SHM family, and recovered from a verified snapshot without hiding healthy shards.
440
443
441
444
The hint engine is a deterministic, versioned policy pipeline:
442
445
@@ -1583,6 +1586,7 @@ Current planning evidence: `gitleaks 8.30.1` found zero findings in the plan set
1583
1586
1584
1587
Record and expose:
1585
1588
1589
+
- Every TraceDecay-owned log record carries the exact originating `ComponentVersion` and component/build identity. This is mandatory at emission for daemon, CLI, MCP, hook, provider integration, installer/updater, API/server, dashboard backend, automation, migration, remote-sync, crash, and test-harness logs; forwarding preserves the producer version instead of overwriting it with the collector version.
Do not log sensitive query literals or payloads. Use safe query fingerprints and sampled `EXPLAIN QUERY PLAN` metadata.
1600
+
Do not log sensitive query literals or payloads. Use safe query fingerprints and sampled `EXPLAIN QUERY PLAN` metadata. Log/diagnostic queries support exact/range/include/exclude/current-runtime version predicates and report excluded plus legacy-unknown counts, so old-version evidence can be removed from a diagnostic view without being deleted or silently hidden.
`TraceDecayBuildRefV1.version` is required on every newly emitted TraceDecay log event and uses semantic-version precedence with prerelease/build handling; development artifacts use an explicit valid development/build version rather than an empty or inferred value. A forwarder sets `collector` but preserves `producer` byte-for-byte. Multi-line human diagnostics are one typed event or independently version-stamped continuation events. `TraceDecayVersionSelectionBasisV1::CurrentRuntime` resolves against the application server/CLI runtime captured at request admission; `CompatibleProtocol` resolves through the versioned compatibility manifest, never a string-prefix guess. Empty `include` means the selected basis population, then `exclude` subtracts. `LegacyUnknownVersionPolicyV1` exists only to query imported pre-contract records; a new `DiagnosticLogEventV1` cannot represent an unknown version. Metric labels still exclude arbitrary build/version cardinality—version is an indexed diagnostic predicate and evidence boundary, not a free-form metric dimension.
945
+
905
946
`SavedViewV1` and `SavedViewDefinitionV1` are the one persisted/wire saved-view envelope. Plan 11 owns the UI-neutral `InvestigationStateV1` codec, bounded scene-trail interaction semantics, and `ExperimentViewSpecV1` presentation; plan 24 owns `TaskViewSpecV1` validation/lenses. All three variants live under this domain contract and share identity, name/owner scope, classification/redaction, live/frozen snapshot, optimistic version, expiry, revoke/reauthorize, and sharing lifecycle. Experiment views reference immutable experiment/run/cell/stage/comparison/comparison-cell/reduction/playhead identities and never embed inputs or outputs. A variant cannot introduce another saved-view ID, table, query scope, grant, route family, or command namespace. `PendingSanitization` is an automated safety state, not a human approval queue.
906
947
907
948
Deterministic derivation uses fixed UUIDv5 namespaces published by `id.rs`. Input encoding is version byte `1`, then big-endian length-prefixed UTF-8 fields and fixed-width hash/integer fields. Enum tags use their registry snake-case names. No locale, platform path syntax, JSON object order, wall clock, or process randomness participates.
0 commit comments