Repository navigation
Description
Purpose
A whole-codebase architectural audit conducted after the daemon-client (ADR-031/032) and SQLite (#1222/#1224) migrations. Goal: an honest map of where the architecture actually is vs. where the docs/ADRs claim it is, and a prioritized list of what to improve. Findings below are evidence-backed (file:line). This is a tracking/planning issue — each section should spin off its own implementation issue.
Companion: #1226 handles the dead-code/doc purge. This issue is the higher-level structural assessment. Where they overlap, #1226 is the cleanup and this is the "what should the shape be."
Strategic direction (set 2026-05-29)
We are moving away from MCP entirely toward published skills + scripts for AI-agent integration. Rationale: avoid MCP surface bloat, and skills are the better long-term fit (domain knowledge + multi-step procedures + composition, distributable to any agent). The audit's MCP findings below should be read as "migrate off," not "consolidate." Interacts with #1199 (whose title still assumes an MCP server ships — needs reframing) and #1181.
A. Transport / proto layer
A1. packages/daemon/proto/ is a stale duplicate that TS clients still load 🔴
packages/proto/proto/is canonical — the Rust build (packages/proto/build.rs) compiles it, and it received the relationship-event messages in commit54f11796.packages/daemon/proto/is an abandoned copy, last touched at Push GetRoots limit/offset pagination into SurrealStore::get_children #1175 (before the proto crate was extracted). It is missingrelationship_created/updated/deleted+RelationshipPayload/RelationshipDeletedPayload.- TS clients load the stale copy:
packages/agent-tools/src/client.ts:9andpackages/dev-tools/src/dev-proxy.ts:21both resolve../../daemon/proto/node_service.proto. → They are blind to the relationship/hierarchy events the daemon now emits onWatchNodes. The comment in the canonical proto says these events are exactly what lets a pulled child node attach to its parent in the outliner. - Action: delete
packages/daemon/proto/; repoint TS consumers atpackages/proto/proto/(or a generated artifact). Verify TS clients then receive relationship events. (Folds into Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1226 A3.)
B. Daemon + core service layer
B1. NodeService is a god-object 🔴
packages/core/src/services/node_service.rs— 58pub async fn, ~11,772 lines, mixing CRUD, hierarchy, relationships/mentions, embeddings/search, playbook execution context, and schema field ops.- Action: split into focused services (NodeCrud / Hierarchy / Relationship / Embedding); move playbook execution-context out of the core service into a wrapper/middleware.
B2. Sleep-based eventual-consistency retry loops survive into the SQLite era 🔴
node_service.rs:2100-2119(5×50ms),:4625-4692(create_parent_edgesibling-not-found, 20×100ms), plus:9030/9039/9458/9471/9510. Comments still cite "SurrealDB eventual consistency."- SQLite is synchronous/ACID — these add 50-2000ms latency and mask whether the path is actually correct.
- Action: remove or replace with explicit transaction semantics; confirm the stale-sibling scenario can't occur under SQLite.
B3. Business logic leaks into the daemon gRPC adapters 🟠
- The daemon RPCs are meant to be thin (ADR-031), but
daemon/src/services/node_service.rsdoes real work: collection-path add on create (:96-107), lifecycle_status defaulting (:110-123), auto-fetch version on update/delete (:175-179,:225-244). - Clients calling core directly (agent, tests) don't get these behaviors → inconsistent contract.
- Action: push collection resolution, lifecycle defaulting, version-fetch defaulting down into
NodeService.
B4. CollectionService re-instantiated per-RPC 🟠
CollectionService::new()called 14× across single RPCs indaemon/node_service.rs(:99,193,202,744,...) + import_service. Stateless but rebuilt every call; daemon shouldn't know collection semantics at all.- Action: inject once at construction, or fold collection ops into core.
B5. empty_to_none sentinel pattern is pervasive and fragile 🟠
daemon/node_service.rs:1113-1119helper used 23+ times; conflates proto3 "unset" with empty-string and silently breaks any field where""is legitimate. This is the root of API: introduce InsertPosition enum across proto/gRPC + service (replace overloaded insert_after_node_id) #1216's ambiguity, generalized.- Action: use proto3
optional(explicit presence) or wrapper messages; delete the sentinel. (Ties to API: introduce InsertPosition enum across proto/gRPC + service (replace overloaded insert_after_node_id) #1216 — InsertPosition is one instance of this class.)
B6. Lossy core→gRPC error mapping 🟠
service_error_to_status()(:1252-1274) routes most variants through a genericOpsErrorpass-through;fetch_node()(:1136) wraps everything asStatus::internal(). Clients can't distinguish not-found / version-conflict / validation.- Action: map every
NodeServiceErrorvariant explicitly; ensureVersionConflict → aborted; add parity tests.
B7. Fractional-ordering jitter is a SurrealDB-era artifact 🟡
db/fractional_ordering.rs:21-32adds random jitter "to prevent collisions under eventual consistency (SurrealDB/RocksDB)." Under SQLite's serialized writes this is unnecessary and complicates rebalancing.- Action: verify and remove; make ordering deterministic.
B8. Possible TOCTOU in bulk ops 🟡
sqlite_store.rs:1625-1648(bulk_update_nodes) andbulk_create_hierarchy(:1659-1699) callget_node()before / outside the surrounding transaction → read-then-update race; bulk op can partially complete.- Action: move reads inside the transaction or document the partial-failure contract.
C. Frontend state / service layer
C1. Five stacked wrappers around node CRUD 🟠
tauri-commands.ts(548) →backend-adapter.ts(670) →shared-node-store.svelte.ts(3,305) →reactive-node-service.svelte.ts(1,788) +reactive-structure-tree.svelte.ts. Four hops between component and backend; unclear ownership.- Action: merge transport layers (backend-adapter + tauri-commands); clarify the data-vs-hierarchy split.
C2. Dual hierarchy caches must be hand-synced 🟠
SharedNodeStore.nodes(hasparentId) andReactiveStructureTree.children(edges) are independent; frontend manually callsmoveInMemoryRelationship()on parent change (reactive-node-service.svelte.ts:911). Tauri vs browser modes use different sync paths; no invariant check. This caused the Delete obsolete cache management code from SharedNodeStore #557 class of bug.- Action: make structureTree the single source of truth; derive
parentId; unify Tauri/browser sync; add an init-time invariant check. (Note B-layer: relationship events from A1 are what should drive this.)
C3. Hierarchy/ordering business logic lives in the frontend 🟠
calculateOutdentInsertOrderPure()(reactive-node-service.svelte.ts:60-85),canHaveChildren()indent gating (:875), depth recursion (:131-138), child-transfer-on-split (:384-450). If the daemon's rules change, the frontend diverges; can't validate end-to-end.- Action: move ordering math + container rules + depth into the daemon; return order hints in RPC responses.
C4. Three message/entity shapes converted at multiple boundaries 🟡
- chat: protocol/view-model/persisted (
components/chat/types.ts:6-9);nodeToTaskNode()(task-node.ts:268); separate normalizers intauri-sync-listener.ts:62andbrowser-sync-service.ts:208. - Action: normalize once at the sync boundary; reduce per-viewer converters.
C5. Last-Write-Wins conflict resolution is incomplete 🟡
shared-node-store.svelte.ts:409-429always discards local; hardcoded 5s detection window (:506); nodeType-conversion special-case bypasses detection (:2273-2278). Concurrent edits outside the window are silently lost.- Action: move conflict adjudication to the daemon (return version + conflict marker in RPC error); revisit OT/CRDT (already flagged "Phase 7" in code).
C6. Migration residue in the frontend 🟡
- Stale TODO/removed-feature comments:
reactive-node-service.svelte.ts:35-36, 229-231, 496-732;backend-adapter.ts:113; deprecated APIs infocus-manager.svelte.ts:186-249. (Folds into Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1226.)
D. AI-agent integration surfaces (MCP → skills+scripts)
Strategic direction (2026-05-29): migrate off MCP to published skills + scripts. These findings define the target architecture, what it deletes, and what must be preserved.
D0. The target architecture — and why it's sound
Guiding principle: the skill is a teacher, not a wrapper. An LLM arrives knowing nothing about NodeSpace — what a node is, that hierarchy is edges (not nesting), that node types are schema-defined, that there's a daemon, or when it should reach for this tool at all. MCP gives the model a flat list of tool signatures with no worldview. A skill imparts the domain model and usage judgment first, then the mechanism. That is the core reason skills beat MCP here, not just "less surface."
A good NodeSpace SKILL.md must convey, in order:
- What NodeSpace is — local-first knowledge graph; typed nodes (note/task/date/custom); relationships are first-class edges.
- The mental model — parent/child via edges + fractional ordering; date nodes anchor daily context; content is markdown.
- When to use it — "search for prior context at session start"; "save findings as you go"; "this persists across sessions" — the judgment the model has no prior for.
- How — the CLI commands / scripts as the mechanism.
The runtime topology (no server, no protocol):
Agent loads SKILL.md (domain model + when/how)
→ runs `nodespace …` directly OR runs a bundled script for a fixed multi-step procedure
→ nodespace CLI ──gRPC(UDS)──► nodespaced → NodeService → SQLite
The script is optional and earns its place only for determinism. Default: no script — SKILL.md → CLI directly (covers single ops). Add a script only when a procedure is multi-step, order-sensitive, and you've seen the agent get it wrong (e.g. "ensure today's date node → attach finding → link to project"). The script chains CLI calls, parses --json, handles errors, and returns a clean pass/fail — turning N fuzzy agent decisions into one reliable call.
| Layer | Responsibility |
|---|---|
| SKILL.md | What NodeSpace is + when/why to use it (teaches the model) |
| Script (optional) | How, deterministically: fixed multi-step procedure + parsing + error handling |
| CLI | one typed operation per call (gRPC client to daemon) |
| Daemon | the actual work |
This already exists in skeleton: @nodespaceai/skill ships SKILL.md + an install-time installer.ts that copies the skill into detected agents (Claude Code, Codex, Gemini, OpenCode). The installer runs once at install, not at agent-runtime. So the pattern is proven — the gaps are coverage (D3) and quality of teaching (D4).
D1. Four overlapping tool surfaces, ~60% duplicated 🔴
- (1) Rust handlers
core/src/mcp/handlers/— richest (~40 ops incl. markdown, schema, batch, index ops, relationship graph, playbook). - (2)
@nodespaceai/agent-tools(TS, gRPC) — only 5 (search/get/create/update/getChildren). - (3)
packages/mcp(TS, stdio→CLI) — 6. - (4)
packages/agentlocal-agent Rust tools — its own catalog again. - No single source of truth; parameter naming (
node_idvsnodeIdvsid) and return shapes (full vs truncated 2000/500 vs minimal) diverge across surfaces. The target collapses these to one path: CLI → daemon, taught by the skill.
D2. The dead thing is the HTTP transport, not the handler logic 🔴 (corrects #1226)
McpServerService/run_mcp_server/McpTransport::Http— dead (nothing in prod starts it; onlydev-mcpconstructs it).- BUT handler functions are reused as a library by
packages/agent:prepare_nodes_from_template,NodeTemplate(skill_pipeline.rs:17,231,prompt_assembler.rs:12,257,409),handle_create_schema,handle_get_markdown_from_node_id(local_agent/tools.rs:10,894,1215). - Action: extract the reusable logic into a transport-agnostic core module, repoint
packages/agent, then delete the MCP server + transport. Tracked in Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1226 A1.
D3. CLI coverage gap blocks the migration 🔴
- The CLI exposes ≈5 knowledge-graph ops; agents need ≈15 (query, relationships, schema, markdown export, index hierarchy, batch). A skill can only be as capable as the CLI it teaches. This is the gating dependency — tracked in CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1227.
D4. SKILL.md under-teaches and mis-teaches 🟠
- Current
packages/skill/SKILL.mdis thin on D0 Set up Tauri + Svelte project structure #1–Create design system foundation #2 (what NodeSpace is, the edge-based model) and contains a wrong fact an agent could persist: "NodeService uses SurrealDB with RocksDB backend." - Action: rewrite SKILL.md around the teacher principle (domain model first); remove stale DB claims (ties Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1226 + CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1227).
D5. Decommission plan 🟠
- Delete
packages/mcp(stdio MCP server) and the MCP protocol/transport in core. Decide@nodespaceai/agent-tools' fate: keep only if a skill needs streaming/tight loops (subprocess CLI can't stream cleanly); otherwise scripts shell the CLI directly and agent-tools is deleted too — one client, one catalog. - Action: write an ADR "skills+scripts replace MCP" (supersedes the MCP-server framing in Install the NodeSpace skill into AI agents on first launch #1199/Settings: Integrations panel for PATH and skill configuration #1181); pick CLI-only vs. keep-gRPC based on whether any skill needs live events; sequence the decommission after CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1227 lands coverage.
Cross-cutting themes
- Unfinished migrations left residue at every layer — SurrealDB-era retry loops/jitter (B2, B7), stale proto copy (A1), dead MCP transport (D2), frontend TODO graveyard (C6). Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1226 covers the mechanical purge.
- Business logic drifts upward and outward — ordering/hierarchy rules live in the frontend (C3) and the daemon adapters (B3) instead of core. Pull them down so every client (UI, CLI, agent, future scripts) gets one contract.
- No single source of truth — tool catalog (D1), proto location (A1), entity shape (C4) each exist in multiple hand-synced copies.
- The daemon boundary itself is sound —
src-taurideliberately does NOT depend onnodespace-core(types.rsmirrors sever it); the gRPC separation holds. The problems are what flows across the boundary, not the boundary.
Suggested issue breakdown (spin-offs)
Status reconciled 2026-05-30 against
main(not by checkbox trust — verified in code).
Done / merged:
-
A1 — delete
daemon/proto, repoint TS atproto/proto/— done in Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1230. Verified:daemon/proto/gone; TS clients point at canonical proto. -
B1 — split
NodeServicegod-object — done in Decompose NodeService god-object into focused sub-services (facade delegation) #1240. Verified:node_service.rs→node_service/dir (mod.rs facade + crud/relationship/schema/bulk/query/embedding), largest file ~2.7k lines. -
B2 — remove SurrealDB-era retry loops — done in Remove sleep-based eventual-consistency retry loops from NodeService (SQLite is synchronous/ACID) #1239 (issue Remove sleep-based eventual-consistency retry loops from NodeService (SQLite is synchronous/ACID) #1237). Verified: zero "eventual consistency" residue in production paths.
-
D2 — extract reusable handler logic out of
mcp/handlers, then delete MCP transport — done in Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1230. Verified:packages/core/src/mcp/gone;McpServerService/run_mcp_serverhave zero refs; logic now innodespace_core::markdown/::schema. -
D3 — close CLI coverage gap — done in CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1232 (issue CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1227).
-
D4 — remove stale SurrealDB/RocksDB claims from SKILL.md — done in CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1232. (The "rewrite SKILL.md as a teacher / domain-model-first" portion remains as D4b below.)
-
B3/B4 — delegate daemon collection/lifecycle/version logic to core
node_ops— done in Make daemon NodeService RPCs thin: delegate collection/lifecycle/version logic to core node_ops (B3 + B4) #1244 (issue Make daemon NodeService RPCs thin: delegate collection/lifecycle/version logic to core node_ops (B3 + B4) #1241). Key finding: the logic already existed innode_opsand the agent already called it; the daemon's copy was deleted and now delegates. -
B5 —
empty_to_noneproto-presence audit — done in Remove the empty_to_none sentinel in daemon NodeService — proto-presence audit (B5) #1245 (issue Remove the empty_to_none sentinel in daemon NodeService — proto-presence audit (B5) #1242). The dangerous fields (content/properties/version) had already been migrated by API: introduce InsertPosition enum across proto/gRPC + service (replace overloaded insert_after_node_id) #1216; this closed out the remaining sites. -
C2 — make
structureTreethe single source of truth for hierarchy; unify the two sync paths; init-time invariant check — done in C2: Make structureTree single source of truth — unify dual sync paths + invariant check #1250 (issue C2: Make structureTree the single source of truth for hierarchy — unify dual sync paths + invariant check #1247). The architect found the browser sync path had aDate.now()order fallback + a no-oprelationshipUpdatedstub — a live Delete obsolete cache management code from SharedNodeStore #557-class drift bug, now fixed via a unifiedhierarchy-sync.ts. -
C2b — remove the
Node.parentIdfield from the type entirely — done in C2b: Remove Node.parentId field — structureTree is single source of truth (closes #1248) #1252 (issue C2b: Remove the Node.parentId field entirely (follow-up to #1247) #1248). structureTree is now the sole hierarchy source; the vestigial field is gone. -
C6 — delete frontend migration residue: tombstone comments + FocusManager legacy/
@deprecatedAPI — done in Delete frontend migration residue: tombstone comments + FocusManager legacy/@deprecated API (C6) #1249 (issue Delete frontend migration residue: tombstone comments + FocusManager legacy/@deprecated API (C6) #1246).
Open / spun off:
- B6 — exhaustive core→gRPC error mapping + parity tests — done in B6: Exhaustive NodeServiceError→gRPC error mapping + parity tests #1257 (issue B6: Exhaustive core→gRPC error mapping + parity tests (no catch-all to Status::internal) #1254).
- B7 — remove fractional-ordering jitter — done in B7: Remove SurrealDB-era fractional-ordering jitter — make ordering deterministic under SQLite #1256 (issue B7: Remove SurrealDB-era fractional-ordering jitter — make ordering deterministic under SQLite #1253). Ordering is now deterministic under SQLite.
- C1a — consolidate the node-CRUD transport layer (fold
tauri-commandsnode half intobackendAdapter) — done in C1a: Consolidate the node-CRUD transport layer — fold tauri-commands node half into backendAdapter #1255 (issue C1a: Consolidate the node-CRUD transport layer — fold tauri-commands node half into backendAdapter #1251). - C1b — clarify the data-vs-hierarchy ownership split between
shared-node-storeandreactive-node-service. Deferred until C3a (C3a: Delete frontend outdent ordering math — trust the daemon's authoritative order via relationship events #1259) lands — see the consolidated status block below. - C3 — split into C3a (C3a: Delete frontend outdent ordering math — trust the daemon's authoritative order via relationship events #1259), C3b (C3b: Enforce container rule (canHaveChildren) in the daemon; source the frontend UI gate from schema #1260), C3c (deferred). See the consolidated status block below.
- C4 — deduplicate sync-boundary normalizer → C4: Deduplicate the sync-boundary normalizeNodeData (one shared normalizer for both sync paths) #1266 (reframed; see consolidated status block below).
- C5 — daemon-adjudicated conflict resolution → C5: Replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict (amends ADR-026) #1268 (amends ADR-026; see consolidated status block below).
- D4b — rewrite SKILL.md as a teacher → D4b: Rewrite SKILL.md as a teacher — lead with the domain/mental model (edges, schema types, date anchors) #1269 (see consolidated status block below).
- D5 — decommission MCP; delete
packages/mcp+agent-tools; ADR-035 → D5: Decommission MCP — delete packages/mcp + agent-tools, shims shell the CLI, write ADR-035 #1265 (see consolidated status block below).
Backend section (A, B) is COMPLETE. Every A/B finding is merged: A1 (#1230), B1 (#1240), B2 (#1239), B3/B4 (#1244), B5 (#1245), B6 (#1257), B7 (#1256). The only B item never separately filed is B8 (possible TOCTOU in bulk ops, 🟡) — see below.
Frontend section (C) is well-advanced. Merged: C2 (#1250), C2b (#1252), C6 (#1249), C1a (#1255). C3 filed & split (see below).
C3 was already ~90% done. Investigation found the write path already delegates ordering to the daemon (
InsertPositionfrom #1216) and the authoritative order already reaches the frontend via therelationship:updatedevent (C2'shierarchy-sync.ts). So C3 is mostly deleting the redundant frontend duplicate, plus one real gap (the daemon doesn't enforce container rules on move). Split into C3a/C3b (filed) + C3c (deferred).
Done — all merged:
- B8 → fix(core): close TOCTOU in bulk_update via SQL COALESCE, document bulk_create_hierarchy contract #1262 (issue B8: Close TOCTOU in bulk_update / bulk_create_hierarchy (read escapes the transaction) #1258) · B4 follow-up → B4 follow-up: fold remaining 11 CollectionService::new daemon sites into core (collection_ops) #1261 (B4 follow-up: fold remaining 11 CollectionService::new daemon sites into core (collection_ops) #1243) · C3a → C3a: Delete frontend outdent ordering math — trust the daemon's authoritative order via relationship events #1263 (C3a: Delete frontend outdent ordering math — trust the daemon's authoritative order via relationship events #1259) · C3b → C3b: Enforce container rule (canHaveChildren) in the daemon; source the frontend UI gate from schema #1264 (C3b: Enforce container rule (canHaveChildren) in the daemon; source the frontend UI gate from schema #1260) · C4 → C4: Deduplicate the sync-boundary normalizeNodeData (one shared normalizer for both sync paths) #1267 (C4: Deduplicate the sync-boundary normalizeNodeData (one shared normalizer for both sync paths) #1266)
- D5 — decommission MCP (deleted
packages/mcp+agent-tools, shims shell the CLI, ADR-035) → D5: Decommission MCP — delete packages/mcp + agent-tools, shims shell the CLI, write ADR-035 #1270 (issue D5: Decommission MCP — delete packages/mcp + agent-tools, shims shell the CLI, write ADR-035 #1265). agent-tools was delete-not-keep; phantomnodespace mcpregistration removed. - D4b — SKILL.md rewritten as a teacher (mental model: edges + fractional ordering, schema types, date anchors) → D4b: Rewrite SKILL.md as a teacher — lead with the domain/mental model (edges, schema types, date anchors) #1271 (issue D4b: Rewrite SKILL.md as a teacher — lead with the domain/mental model (edges, schema types, date anchors) #1269).
- Add user notification for background child transfer failures #656 — background child-transfer failure notification → Add user notification for background child transfer failures #1272. Reused the existing
ConflictNotificationStore(per the scope-guidance comment); no parallel toast system, so no collision with C5.
In review (open):
- C5 — replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict → C5: Replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict (amends ADR-026) #1273 (issue C5: Replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict (amends ADR-026) #1268), merged. Amends ADR-026. Fixed the dead-code OCC path; silent-data-loss fix.
Remaining — deferred, intentionally not filed (gated):
- C3c — atomic child-transfer-on-split → C3c: Atomic child-transfer-on-split — single MoveChildrenToParent RPC (all-or-nothing) #1275 (filed). New
MoveChildrenToParentRPC, all-or-nothing; parallel-safe with C5 (C5: Replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict (amends ADR-026) #1273, verified file-disjoint); preserves Add user notification for background child transfer failures #656's notification. - C1b — clarify data-vs-hierarchy ownership (store vs service). RESOLVED — no refactor needed. Re-audited after C5 merged: the three-way boundary is now clean and matches
frontend-state-and-persistence.md—structureTreeowns hierarchy edges (zero node data),shared-node-storeowns the node-data cache + OCC/persistence,reactive-node-serviceis a per-viewer UI-state adapter holding no node data (verified: zero node-data$statein the service; store's hierarchy caches removed in Delete obsolete cache management code from SharedNodeStore #557; all reads delegate to structureTree). The store's 3,372 lines are cohesive (node-data lifecycle + hard race handling), not a mixed-responsibility god-object. C2/C2b/C3a/C5 did the work. Residual ~80 lines of dead code → small standalone cleanup Frontend dead-code cleanup: vestigial conflict/validation members + dead OptimisticOperationManager (C1b re-audit residue) #1277 (not a C1b refactor). - D1 — four overlapping tool surfaces → RESOLVED by D2 (Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1230) + D5 (D5: Decommission MCP — delete packages/mcp + agent-tools, shims shell the CLI, write ADR-035 #1270). Surfaces 1–3 (core mcp/handlers, agent-tools, packages/mcp) deleted. Surface 4 (
packages/agent/.../local_agent/tools.rs) is retained intentionally: it's the in-process ReAct-loop consumer (ADR-031) that wraps the samenode_opsthe CLI reaches over gRPC — verifiedtools.rs:988 → node_ops::create_node, no duplicated graph logic. Its distinct param structs are token-efficiency ergonomics for the local model that map onto the sharedCreateNodeInput; behavior can't drift. No D1-tail issue needed. (Note: the ADR-030 §Phase-1 "unify tool definitions between MCP handlers and local agent" bullet is now moot — MCP handlers deleted; strike when ADR-030 is next touched.) - Cleanup (trivial, not an issue):
packages/mcp/andpackages/agent-tools/dirs still exist on disk as empty shells (only stalenode_modules; D5 deleted the source).rm -rfthem; fold into the C3c PR or a one-line cleanup. Grep workspace globs / CI to confirm no remaining references.
✅ AUDIT COMPLETE (2026-05-30)
Every original finding (A1, B1–B8, C1–C6, D1–D5) is resolved. This tracking issue is being closed.
- A (transport/proto): 100% — A1 → Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1230.
- B (daemon/core): 100% — B1 Decompose NodeService god-object into focused sub-services (facade delegation) #1240, B2 Remove sleep-based eventual-consistency retry loops from NodeService (SQLite is synchronous/ACID) #1239, B3/B4 Make daemon NodeService RPCs thin: delegate collection/lifecycle/version logic to core node_ops (B3 + B4) #1244 (+ follow-up B4 follow-up: fold remaining 11 CollectionService::new daemon sites into core (collection_ops) #1261), B5 Remove the empty_to_none sentinel in daemon NodeService — proto-presence audit (B5) #1245, B6 B6: Exhaustive NodeServiceError→gRPC error mapping + parity tests #1257, B7 B7: Remove SurrealDB-era fractional-ordering jitter — make ordering deterministic under SQLite #1256, B8 fix(core): close TOCTOU in bulk_update via SQL COALESCE, document bulk_create_hierarchy contract #1262.
- C (frontend): 100% of findings resolved — C1a C1a: Consolidate the node-CRUD transport layer — fold tauri-commands node half into backendAdapter #1255, C1b resolved (re-audit; no refactor needed), C2 C2: Make structureTree single source of truth — unify dual sync paths + invariant check #1250, C2b C2b: Remove Node.parentId field — structureTree is single source of truth (closes #1248) #1252, C3a C3a: Delete frontend outdent ordering math — trust the daemon's authoritative order via relationship events #1263, C3b C3b: Enforce container rule (canHaveChildren) in the daemon; source the frontend UI gate from schema #1264, C3c filed C3c: Atomic child-transfer-on-split — single MoveChildrenToParent RPC (all-or-nothing) #1275, C4 C4: Deduplicate the sync-boundary normalizeNodeData (one shared normalizer for both sync paths) #1267, C5 C5: Replace the client-side 5s conflict heuristic with the daemon's authoritative OCC version conflict (amends ADR-026) #1273, C6 Delete frontend migration residue: tombstone comments + FocusManager legacy/@deprecated API (C6) #1249. (C3 reframed: was ~90% already done — write path already delegated ordering to the daemon. C4 reframed: the "3 message shapes" were deliberate layering; the real win was a duplicated normalizer.)
- D (AI-agent integration / MCP→skills): 100% — D1 resolved by D2+D5, D2 Audit & cleanup: finish daemon + SQLite migrations (purge dead HTTP MCP / SurrealDB / RocksDB from code and docs) #1230, D3 CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1232, D4 CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1232, D4b D4b: Rewrite SKILL.md as a teacher — lead with the domain/mental model (edges, schema types, date anchors) #1271, D5 D5: Decommission MCP — delete packages/mcp + agent-tools, shims shell the CLI, write ADR-035 #1270. The "skills replace MCP" arc fully shipped (ADR-035).
Follow-ons spun out of this audit, tracked independently (not blockers to closing):
- C3c: Atomic child-transfer-on-split — single MoveChildrenToParent RPC (all-or-nothing) #1275 (C3c) — atomic child-transfer-on-split. Filed, ready, parallel-safe.
- Frontend dead-code cleanup: vestigial conflict/validation members + dead OptimisticOperationManager (C1b re-audit residue) #1277 — frontend dead-code cleanup (the ~80-line C1b re-audit residue).
The audit did its job: mapped reality vs. docs, spun off ~25 implementation issues, and drove the entire backend (A+B), the MCP→skills teardown (D), and the frontend hierarchy/conflict rework (C) to completion. Remaining work is ordinary backlog (#1275, #1277), no longer "audit findings." Closing.
Out of scope
- Implementation of any single fix (each spins off its own issue).
- The cloud-sync internals (separate audit).
Activity
malibio commentedon May 29, 2026
Spun off two backend findings into trackable issues:
node_service.rsinto focused sub-services behind a facade (signatures unchanged, blast radius bounded to packages/core).create_parent_edge'Sibling not found' retry branch is dead code (the store silently falls back to last position), confirmed viasqlite_store.rs:1301-1304.Parallelization: sequenced with partial overlap. #1237 lands FIRST (small, deletion-only, removes the very hierarchy code #1238 would otherwise relocate). #1238 runs its non-hierarchy phases (ctx extraction, Relationship/Schema/Query/Embedding/Bulk, playbook-context wrapper) in parallel, but blocks its Hierarchy phase on #1237's merge, then rebases. Both touch
create_parent_edge/move_node/reorder— that's the collision zone.Make daemon NodeService RPCs thin: delegate create/update/delete to n…
Remove the empty_to_none sentinel in daemon NodeService — proto-prese…
fix(core): close TOCTOU in bulk_update via SQL COALESCE, document bul…
malibio commentedon May 30, 2026
✅ Audit complete — closing
Every finding (A1, B1–B8, C1–C6, D1–D5) is resolved. Summary:
Several findings were reframed during scoping rather than taken at face value — C3 was ~90% already done; C4's '3 message shapes' were deliberate layering; B6 was mostly complete. The investigate-before-filing approach kept us from manufacturing work.
Follow-ons tracked independently (ordinary backlog, not audit findings):
Closing.
Make daemon NodeService RPCs thin: delegate create/update/delete to n…
Remove the empty_to_none sentinel in daemon NodeService — proto-prese…
fix(core): close TOCTOU in bulk_update via SQL COALESCE, document bul…