ltcai 3.6.0 → 4.0.1

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.
Files changed (238) hide show
  1. package/README.md +39 -31
  2. package/docs/CHANGELOG.md +64 -0
  3. package/docs/REALTIME_COLLABORATION.md +3 -3
  4. package/docs/V3_FRONTEND.md +9 -8
  5. package/docs/V4_BRAIN_ARCHITECTURE.md +322 -0
  6. package/docs/V4_DIGITAL_BRAIN_RECOVERY.md +552 -0
  7. package/docs/V4_IMPLEMENTATION_PLAN.md +470 -0
  8. package/docs/kg-schema.md +51 -53
  9. package/docs/spec-vs-impl.md +10 -10
  10. package/kg_schema.py +2 -520
  11. package/knowledge_graph.py +37 -4629
  12. package/knowledge_graph_api.py +11 -127
  13. package/latticeai/__init__.py +1 -1
  14. package/latticeai/api/admin.py +16 -17
  15. package/latticeai/api/agents.py +20 -7
  16. package/latticeai/api/auth.py +46 -15
  17. package/latticeai/api/chat.py +112 -76
  18. package/latticeai/api/health.py +1 -1
  19. package/latticeai/api/hooks.py +1 -1
  20. package/latticeai/api/invitations.py +100 -0
  21. package/latticeai/api/knowledge_graph.py +139 -0
  22. package/latticeai/api/local_files.py +1 -1
  23. package/latticeai/api/mcp.py +23 -11
  24. package/latticeai/api/memory.py +1 -1
  25. package/latticeai/api/models.py +1 -1
  26. package/latticeai/api/network.py +81 -0
  27. package/latticeai/api/plugins.py +3 -6
  28. package/latticeai/api/realtime.py +5 -8
  29. package/latticeai/api/search.py +26 -2
  30. package/latticeai/api/security_dashboard.py +2 -3
  31. package/latticeai/api/setup.py +2 -2
  32. package/latticeai/api/static_routes.py +11 -16
  33. package/latticeai/api/tools.py +3 -0
  34. package/latticeai/api/ui_redirects.py +26 -0
  35. package/latticeai/api/workflow_designer.py +85 -6
  36. package/latticeai/api/workspace.py +93 -57
  37. package/latticeai/app_factory.py +1781 -0
  38. package/latticeai/brain/__init__.py +18 -0
  39. package/latticeai/brain/_kg_common.py +1123 -0
  40. package/latticeai/brain/context.py +213 -0
  41. package/latticeai/brain/conversations.py +236 -0
  42. package/latticeai/brain/discovery.py +1455 -0
  43. package/latticeai/brain/documents.py +218 -0
  44. package/latticeai/brain/identity.py +175 -0
  45. package/latticeai/brain/ingest.py +644 -0
  46. package/latticeai/brain/memory.py +102 -0
  47. package/latticeai/brain/network.py +205 -0
  48. package/latticeai/brain/projection.py +561 -0
  49. package/latticeai/brain/provenance.py +401 -0
  50. package/latticeai/brain/retrieval.py +1316 -0
  51. package/latticeai/brain/schema.py +640 -0
  52. package/latticeai/brain/store.py +216 -0
  53. package/latticeai/brain/write_master.py +225 -0
  54. package/latticeai/core/agent.py +31 -7
  55. package/latticeai/core/audit.py +0 -7
  56. package/latticeai/core/config.py +1 -1
  57. package/latticeai/core/context_builder.py +1 -2
  58. package/latticeai/core/enterprise.py +1 -1
  59. package/latticeai/core/graph_curator.py +2 -2
  60. package/latticeai/core/invitations.py +131 -0
  61. package/latticeai/core/marketplace.py +1 -1
  62. package/latticeai/core/mcp_registry.py +791 -0
  63. package/latticeai/core/model_compat.py +1 -1
  64. package/latticeai/core/model_resolution.py +0 -1
  65. package/latticeai/core/multi_agent.py +238 -4
  66. package/latticeai/core/policy.py +54 -0
  67. package/latticeai/core/realtime.py +65 -44
  68. package/latticeai/core/security.py +1 -1
  69. package/latticeai/core/sessions.py +66 -10
  70. package/latticeai/core/users.py +147 -0
  71. package/latticeai/core/workflow_engine.py +114 -2
  72. package/latticeai/core/workspace_os.py +477 -29
  73. package/latticeai/models/__init__.py +7 -0
  74. package/latticeai/models/router.py +779 -0
  75. package/latticeai/server_app.py +29 -1536
  76. package/latticeai/services/agent_runtime.py +243 -4
  77. package/latticeai/services/app_context.py +75 -14
  78. package/latticeai/services/ingestion.py +47 -0
  79. package/latticeai/services/kg_portability.py +33 -3
  80. package/latticeai/services/memory_service.py +39 -11
  81. package/latticeai/services/model_runtime.py +2 -5
  82. package/latticeai/services/platform_runtime.py +100 -23
  83. package/latticeai/services/run_executor.py +328 -0
  84. package/latticeai/services/search_service.py +17 -8
  85. package/latticeai/services/tool_dispatch.py +12 -2
  86. package/latticeai/services/triggers.py +241 -0
  87. package/latticeai/services/upload_service.py +37 -12
  88. package/latticeai/services/workspace_service.py +55 -16
  89. package/llm_router.py +29 -772
  90. package/ltcai_cli.py +1 -2
  91. package/mcp_registry.py +25 -788
  92. package/p_reinforce.py +124 -14
  93. package/package.json +10 -20
  94. package/scripts/bump_version.py +99 -0
  95. package/scripts/generate_diagrams.py +0 -1
  96. package/scripts/lint_v3.mjs +105 -18
  97. package/scripts/validate_release_artifacts.py +0 -1
  98. package/scripts/wheel_smoke.py +142 -0
  99. package/server.py +11 -7
  100. package/setup_wizard.py +1142 -0
  101. package/static/sw.js +81 -52
  102. package/static/v3/asset-manifest.json +33 -25
  103. package/static/v3/css/{lattice.base.e4cdd05d.css → lattice.base.49deefb5.css} +1 -1
  104. package/static/v3/css/lattice.base.css +1 -1
  105. package/static/v3/css/{lattice.components.9b49d614.css → lattice.components.cde18231.css} +1 -1
  106. package/static/v3/css/lattice.components.css +1 -1
  107. package/static/v3/css/{lattice.shell.8fcc9d33.css → lattice.shell.29d36d85.css} +1 -1
  108. package/static/v3/css/lattice.shell.css +1 -1
  109. package/static/v3/css/{lattice.tokens.e7018963.css → lattice.tokens.304cbc40.css} +3 -0
  110. package/static/v3/css/lattice.tokens.css +3 -0
  111. package/static/v3/css/{lattice.views.22f69117.css → lattice.views.0a18b6c5.css} +2 -2
  112. package/static/v3/css/lattice.views.css +2 -2
  113. package/static/v3/index.html +3 -4
  114. package/static/v3/js/{app.c541f955.js → app.c5c80c46.js} +1 -1
  115. package/static/v3/js/core/{api.33d6320e.js → api.ba0fbf14.js} +58 -1
  116. package/static/v3/js/core/api.js +57 -0
  117. package/static/v3/js/core/i18n.880e1fec.js +575 -0
  118. package/static/v3/js/core/i18n.js +575 -0
  119. package/static/v3/js/core/routes.37522821.js +101 -0
  120. package/static/v3/js/core/routes.js +71 -63
  121. package/static/v3/js/core/{shell.8c163e0e.js → shell.e3f6bbfa.js} +68 -39
  122. package/static/v3/js/core/shell.js +66 -37
  123. package/static/v3/js/core/{store.34ebd5e6.js → store.7b2aa044.js} +11 -1
  124. package/static/v3/js/core/store.js +11 -1
  125. package/static/v3/js/views/account.eff40715.js +143 -0
  126. package/static/v3/js/views/account.js +143 -0
  127. package/static/v3/js/views/activity.0d271ef9.js +67 -0
  128. package/static/v3/js/views/activity.js +67 -0
  129. package/static/v3/js/views/{admin-users.03bac88c.js → admin-users.f7ac7b43.js} +4 -6
  130. package/static/v3/js/views/admin-users.js +4 -6
  131. package/static/v3/js/views/{agents.014d0b74.js → agents.17c5288d.js} +35 -12
  132. package/static/v3/js/views/agents.js +35 -12
  133. package/static/v3/js/views/{chat.e6dd7dd0.js → chat.e250e2cc.js} +23 -0
  134. package/static/v3/js/views/chat.js +23 -0
  135. package/static/v3/js/views/graph-canvas.17c15d65.js +509 -0
  136. package/static/v3/js/views/graph-canvas.js +509 -0
  137. package/static/v3/js/views/{hybrid-search.b22b97e0.js → hybrid-search.2fb63ed9.js} +1 -2
  138. package/static/v3/js/views/hybrid-search.js +1 -2
  139. package/static/v3/js/views/{knowledge-graph.a96040a5.js → knowledge-graph.4d09c537.js} +60 -44
  140. package/static/v3/js/views/knowledge-graph.js +60 -44
  141. package/static/v3/js/views/network.52a4f181.js +97 -0
  142. package/static/v3/js/views/network.js +97 -0
  143. package/static/v3/js/views/{planning.9ac3e313.js → planning.4876fd77.js} +26 -5
  144. package/static/v3/js/views/planning.js +26 -5
  145. package/static/v3/js/views/runs.b63b2afa.js +144 -0
  146. package/static/v3/js/views/runs.js +144 -0
  147. package/static/v3/js/views/{settings.8631fa5e.js → settings.b7140634.js} +7 -8
  148. package/static/v3/js/views/settings.js +7 -8
  149. package/static/v3/js/views/snapshots.6f5db095.js +135 -0
  150. package/static/v3/js/views/snapshots.js +135 -0
  151. package/static/v3/js/views/{workflows.26c57290.js → workflows.7752225a.js} +87 -2
  152. package/static/v3/js/views/workflows.js +87 -2
  153. package/static/v3/js/views/workspace-admin.c466029b.js +156 -0
  154. package/static/v3/js/views/workspace-admin.js +156 -0
  155. package/static/vendor/chart.umd.min.js +20 -0
  156. package/static/vendor/fonts/inter-latin-300-normal.woff2 +0 -0
  157. package/static/vendor/fonts/inter-latin-400-normal.woff2 +0 -0
  158. package/static/vendor/fonts/inter-latin-500-normal.woff2 +0 -0
  159. package/static/vendor/fonts/inter-latin-600-normal.woff2 +0 -0
  160. package/static/vendor/fonts/inter-latin-700-normal.woff2 +0 -0
  161. package/static/vendor/fonts/inter-latin-800-normal.woff2 +0 -0
  162. package/static/vendor/fonts/inter.css +44 -0
  163. package/static/vendor/icons/tabler-icons.min.css +4 -0
  164. package/static/vendor/icons/tabler-icons.woff2 +0 -0
  165. package/static/vendor/marked.min.js +69 -0
  166. package/telegram_bot.py +1 -2
  167. package/tools/commands.py +4 -2
  168. package/tools/computer.py +1 -1
  169. package/tools/documents.py +1 -3
  170. package/tools/filesystem.py +0 -4
  171. package/tools/knowledge.py +1 -3
  172. package/tools/network.py +1 -3
  173. package/codex_telegram_bot.py +0 -195
  174. package/docs/assets/v3.4.0/agent-run.png +0 -0
  175. package/docs/assets/v3.4.0/agents.png +0 -0
  176. package/docs/assets/v3.4.0/before/chat-before.png +0 -0
  177. package/docs/assets/v3.4.0/before/files-before.png +0 -0
  178. package/docs/assets/v3.4.0/chat.png +0 -0
  179. package/docs/assets/v3.4.0/connect-folder.png +0 -0
  180. package/docs/assets/v3.4.0/files.png +0 -0
  181. package/docs/assets/v3.4.0/home.png +0 -0
  182. package/docs/assets/v3.4.0/hooks-dispatch.png +0 -0
  183. package/docs/assets/v3.4.0/knowledge-graph.png +0 -0
  184. package/docs/assets/v3.4.0/local-agent.png +0 -0
  185. package/docs/assets/v3.4.0/memory.png +0 -0
  186. package/docs/assets/v3.4.0/settings.png +0 -0
  187. package/docs/assets/v3.4.0/vision-input.png +0 -0
  188. package/docs/assets/v3.4.0/workflows.png +0 -0
  189. package/docs/assets/v3.4.1/e2e_runtime_log.txt +0 -42
  190. package/docs/assets/v3.4.1/hooks-dispatch.png +0 -0
  191. package/docs/assets/v3.4.1/local-agent.png +0 -0
  192. package/docs/images/admin-dashboard.png +0 -0
  193. package/docs/images/architecture.png +0 -0
  194. package/docs/images/enterprise.png +0 -0
  195. package/docs/images/graph.png +0 -0
  196. package/docs/images/hero.gif +0 -0
  197. package/docs/images/knowledge-graph.png +0 -0
  198. package/docs/images/lattice-ai-demo.gif +0 -0
  199. package/docs/images/lattice-ai-hero.png +0 -0
  200. package/docs/images/logo.svg +0 -33
  201. package/docs/images/mobile-responsive.png +0 -0
  202. package/docs/images/model-recommendation.png +0 -0
  203. package/docs/images/onboarding.png +0 -0
  204. package/docs/images/organization.png +0 -0
  205. package/docs/images/pipeline.png +0 -0
  206. package/docs/images/screenshot-admin.png +0 -0
  207. package/docs/images/screenshot-chat.png +0 -0
  208. package/docs/images/screenshot-graph.png +0 -0
  209. package/docs/images/skills.png +0 -0
  210. package/docs/images/workspace-dark.png +0 -0
  211. package/docs/images/workspace-light.png +0 -0
  212. package/docs/images/workspace.png +0 -0
  213. package/requirements.txt +0 -16
  214. package/static/account.html +0 -115
  215. package/static/activity.html +0 -73
  216. package/static/admin.html +0 -488
  217. package/static/agents.html +0 -139
  218. package/static/chat.html +0 -844
  219. package/static/css/reference/account.css +0 -439
  220. package/static/css/reference/admin.css +0 -610
  221. package/static/css/reference/base.css +0 -1661
  222. package/static/css/reference/chat.css +0 -4623
  223. package/static/css/reference/graph.css +0 -1016
  224. package/static/css/responsive.css +0 -861
  225. package/static/graph.html +0 -124
  226. package/static/platform.css +0 -104
  227. package/static/plugins.html +0 -136
  228. package/static/scripts/account.js +0 -238
  229. package/static/scripts/admin.js +0 -1614
  230. package/static/scripts/chat.js +0 -5081
  231. package/static/scripts/graph.js +0 -1804
  232. package/static/scripts/platform.js +0 -64
  233. package/static/scripts/ux.js +0 -167
  234. package/static/scripts/workspace.js +0 -948
  235. package/static/v3/js/core/routes.2ce3815a.js +0 -93
  236. package/static/workflows.html +0 -146
  237. package/static/workspace.css +0 -1121
  238. package/static/workspace.html +0 -357
@@ -0,0 +1,552 @@
1
+ # V4 Digital Brain — Transformation Program Recovery File
2
+
3
+ > **Purpose**: This file makes the v4.0.0 transformation program recoverable by any
4
+ > session (Claude, Codex, other models, or a human developer) without repeating
5
+ > completed analysis. **Update this file before ending any phase and before any
6
+ > likely session/context/usage limit.**
7
+ >
8
+ > Last updated: 2026-06-12 — v4.0.1 maintenance release prep; T9 remainder remains closed
9
+
10
+ ---
11
+
12
+ ## 0. RC STATUS (final)
13
+
14
+ **v4.0.1 packages the `main` commits after tag `v4.0.0`; implementation gaps are empty.**
15
+ Latest verified implementation milestone: T9 remainder closed with full unit coverage
16
+ (`585 passed`), ruff, Python compile, `npm run lint`, `npm run build:assets`,
17
+ Playwright v3 visual coverage, Python sdist/wheel build, installed-wheel smoke,
18
+ and `npm pack --dry-run`.
19
+ The v4.0.1 release process builds and validates artifacts for GitHub Release
20
+ attachment only. It does not publish to PyPI, npm Registry, VS Code Marketplace,
21
+ Open VSX, or production deployment targets.
22
+ v4.0.1 validation completed: Python compile, ruff, 585 unit tests, 9 live
23
+ integration tests, frontend lint, VS Code typecheck, 16 Playwright visual tests,
24
+ Python wheel/sdist build, npm tgz build, VSIX build, release artifact
25
+ validation, wheel smoke, and npm pack dry-run all passed.
26
+ Remaining implementation gaps: **none**.
27
+ Owner-only blockers: pptx history rewrite (requires force-push/owner decision)
28
+ and consent-gated production embedder provisioning (silent default download is
29
+ not permitted).
30
+
31
+ ## Remaining Gaps
32
+
33
+ None. The T9 remainder was closed on main with legacy page deletion, `/app`
34
+ parity views, token-native account UI, en/ko i18n, approval/run inbox,
35
+ workflow-trigger controls, Brain Network UI, chat context-trace panel, and
36
+ Knowledge Graph provenance coverage surfaced in the SPA. Owner-only blockers
37
+ above are intentionally not implementation gaps.
38
+
39
+ ## 1. Program Charter (from the user's v4.0.0 directive)
40
+
41
+ - Transform Lattice AI v3.6.0 into the **final-form Digital Brain Platform** (v4.0.0).
42
+ - Philosophy: models are temporary, knowledge is durable; user owns knowledge/memory/
43
+ context; local-first, privacy-first, digital sovereignty.
44
+ - **Preserve capabilities** (may redesign, must not remove): local-first, Knowledge
45
+ Graph (first-class, visible), graph visualization, search, model recommendation/
46
+ installation, environment analysis, workflow/pipeline, multi-agent, personal +
47
+ organization workspace, provenance, import/export, backup/restore.
48
+ - **Never fake functionality. No placeholders. No demo-only features.** If a
49
+ capability can't be fully realized, build real architecture/interfaces/contracts.
50
+ - Git: work on `feat/v4-digital-brain` only; commit verified work frequently; push to
51
+ remote feature branch; **no merge to main, no production release, no final tags** —
52
+ prepare a release candidate and stop for review.
53
+ - Quality gates: lint, typecheck, tests, build, release-artifact validation, version
54
+ refs updated, docs updated.
55
+ - Deliverables (13): product review, identity review, architecture review, UX review,
56
+ data-model review, brain architecture proposal, implementation plan, implementation,
57
+ validation results, risks/tradeoffs, remaining gaps, RC summary, commit history.
58
+
59
+ ## 2. Current Phase
60
+
61
+ **Phase A (Repository Audit) — COMPLETE (all 8 dimensions).**
62
+ **Phase B (Brain Architecture Proposal + Implementation Plan) — COMPLETE.**
63
+ Adversarial design review done: 3 critics (feasibility, data-safety,
64
+ coherence), all `approve_with_changes`; 19 blocking issues integrated as the
65
+ NORMATIVE "Design-review amendments" section of
66
+ `docs/V4_IMPLEMENTATION_PLAN.md` + corrections in the architecture doc
67
+ (knowledge_graph_api.py is LIVE not dead; edges_v2 identity redefined;
68
+ chat-history import added; garden = watched source; T9b UI track added;
69
+ T7 owns workflow_engine.py + realtime.py with suspension/reconciliation
70
+ specs; tracks run strictly serially). Review record:
71
+ `docs/v4-audit/v4_design_review.json`.
72
+ **Phase C (Implementation) — COMPLETE on main. Remaining implementation gaps are empty.**
73
+
74
+ Track log (update at every track boundary):
75
+ - **T2 DONE** (commit `5e8aa1b`, 74 files). Agent did ~90% then died on a
76
+ session limit; finished + verified inline. setup_wizard.py packaged & wheel
77
+ smoke (scripts/wheel_smoke.py, runs in release CI, verified locally: 19
78
+ modules import from clean-venv install); latticeai/app_factory.py
79
+ create_app + lazy server_app facade (subprocess no-side-effect acceptance
80
+ test in test_app_factory.py); AppContext chat+workspace routers; telegram
81
+ via injectable on_chat_message; knowledge_graph_api → api/knowledge_graph
82
+ (parity tests); llm_router → latticeai/models/router, mcp_registry →
83
+ latticeai/core/mcp_registry (root shims); dead bots deleted; [tool.ruff]
84
+ baseline — repo lints CLEAN, CI gate added; deps bounded;
85
+ requirements.txt retired (CI+Dockerfile install from pyproject).
86
+ Suite: 486 passed. Gotcha fixed inline: app_factory must keep the legacy
87
+ alias imports (_agent_risk etc.) as locals — they ARE the server_app
88
+ attribute surface via dict(locals()).
89
+ - **T3 IN PROGRESS as atomic sub-units**:
90
+ - **T3a DONE** (commit `d7f8291`): FTS5 trigram index (node_fts + triggers
91
+ + backfill), search() FTS-first w/ deterministic id-ASC ties, LIKE
92
+ fallback (short queries + builds w/o trigram), capability reported in
93
+ index_status().storage.fts_enabled. 7 tests; suite 493.
94
+ Learned: search() reads the kgv2 views — direct legacy-table SQL is not
95
+ a valid way to test read-path behavior; KnowledgeGraphStore ctor is
96
+ (db_path, blob_dir); ingest_message(role, content, ...).
97
+ - **T3b-1 DONE** (commit `650d4df`): edges_v2 rebuilt to
98
+ UNIQUE(source,target,type,legacy_type) (create→copy→swap, re-entrant,
99
+ data-preserving; projection ON CONFLICT updated); from_legacy()
100
+ round-trips canonical values on both enums (was degrading
101
+ CODE_FILE/AI_RESPONSE/… to CONCEPT). Suite 498.
102
+ - **T3b-2 DONE** (commit `b7de8d7`): _upsert_edge normalizes ALL edge
103
+ writes to canonical EdgeType (legacy label → metadata.legacy_label;
104
+ synonyms dedupe; delete_conversation filters accept both vocabularies);
105
+ nodes_v2 += workspace_id (additive ALTER heal), unscoped visibility =
106
+ 'legacy' sentinel, scope params threaded w/ COALESCE no-strip upserts.
107
+ Suite 503. NOTE for T4/T6: ingestion + workspace callers should now
108
+ pass owner/workspace_id explicitly (metadata user_email/workspace_id
109
+ hints already resolve).
110
+ - **T3c DONE** (commit after b7de8d7): edge_occurrences table (every
111
+ observation recorded, cascades) + nodes_v2.superseded_by +
112
+ mark_superseded(). Suite 507.
113
+ - **T3e DONE**: docs/kg-schema.md rewritten to match code (false API
114
+ claims removed; FTS5/scope/temporal documented).
115
+ - **T3d DONE**: `knowledge_graph.py` is now a root compatibility shim;
116
+ implementation moved under `latticeai/brain/` (`store`, `schema`,
117
+ `projection`, `write_master`, `discovery`, `ingest`, `provenance`,
118
+ `documents`, `retrieval`), with every module under 1,500 lines. v2 is
119
+ the authoritative write door; legacy tables are maintained as the
120
+ compatibility projection. Startup creates a one-time pre-flip SQLite
121
+ backup for existing graph data, stamps `PRAGMA user_version=4`, refuses
122
+ newer DB formats, and preserves legacy read/import compatibility.
123
+ Focused KG validation: 43 passed.
124
+ - **T4.1 DONE** (commits `427d6a3` + `a2a1445`): chat (app_factory
125
+ save_to_history), MCP (/mcp/call knowledge_graph_ingest), and uploads
126
+ (upload_service) all route through IngestionPipeline — new
127
+ CHAT_SOURCE_TYPES route calls ingest_message w/ role/conversation
128
+ semantics; provenance_coverage() store metric + GET
129
+ /knowledge-graph/provenance/coverage endpoint (parity baseline updated
130
+ deliberately). Coverage now 4/5 (workspace events land with T6 rebuild).
131
+ Suite 511.
132
+ - **T4.2 DONE** (commit `34ba891`): latticeai/brain/conversations.py
133
+ ConversationStore (same SQLite file as the KG → backup co-location free);
134
+ idempotent chat_history.json import; get_history/clear_* contracts
135
+ preserved incl. legacy bucket + started_at sweep; MemoryService
136
+ conversation tier reads the store. latticeai.brain packaged. Suite 517.
137
+ Branch pushed to origin/feat/v4-digital-brain.
138
+ - **T4.3 DONE** (commit `17dbe0a`): gardener dual-writes (vault markdown
139
+ mirror + pipeline ingest w/ provenance source_type=note); idempotent
140
+ startup vault import; get_relevant_context = brain query (vault-scan
141
+ fallback only when graph disabled); get_tree() implemented (was a
142
+ latent 500). Suite 528.
143
+ - **T4.4 DONE** (commit `e341f74`): graph_curator live — store.curate()
144
+ gated topic promotion w/ real nodes_v2.importance_score + POST
145
+ /knowledge-graph/curate. Suite 530. Backup round-trip test proves
146
+ conversations ride the KG backup. **T4 COMPLETE.**
147
+ - **T6.5 DONE** (commits `84ca636`+`443a8ce`): hashed session tokens at
148
+ rest (transparent plaintext migration), 8+ alnum password policy on
149
+ register/change-password, S256 PKCE on SSO. Suite 523→531.
150
+ - **T5 COMPLETE** (commits b12a68c, 4e8cd70, ca50d10): latticeai/brain/
151
+ memory.py (BrainMemory: Decision/Experience typed records via new
152
+ decision/experience/workspace_event pipeline source types; simulation
153
+ runs REFUSED at the memory boundary) + latticeai/brain/context.py
154
+ (ContextAssembler: budgeted chars/4 approx_tokens, per-section
155
+ provenance, honest absence, seam isolation). Chat context = assembler
156
+ (memories finally injected at inference + hybrid search replaces LIKE;
157
+ doc-gen branch preserved; trace persisted as trace_seed.context_assembly).
158
+ Agent learnings → Experience records via AgentDeps.brain_memory port
159
+ (vault dump fallback only when port absent; no more bare-except).
160
+ Suite 541.
161
+ - **T8 COMPLETE** (commit b1e05f4): latticeai/brain/identity.py (Ed25519
162
+ device keypair, file 0600 default / keyring opt-in via
163
+ LATTICEAI_DEVICE_KEY_KEYRING=1 — keyring at startup blew test runtime
164
+ 6s→237s, hence opt-in), signed export bundles + verified imports w/
165
+ origin provenance + unsigned-legacy local policy, export(workspace_id)
166
+ now REALLY filters (was header-only), latticeai/brain/network.py Brain
167
+ Network v1 (pairing, signed+replay-protected peer auth, push/receive,
168
+ signer-must-match-peer), /network API. Suite 548.
169
+ - **T7a DONE** (commit 1fc96ec): workflow tool nodes EXECUTE via
170
+ dispatch_tool under governance; ApprovalRequired pauses runs into
171
+ awaiting_approval w/ JSON cursor (WorkflowEngine.resume re-enters at the
172
+ paused node, never re-executing; denial fails honestly); skill +
173
+ plugin-skill nodes refuse honestly; plugin run_tool executes governed;
174
+ live runs persist mode='live' + pause cursor; POST
175
+ /workflows/api/runs/{id}/resume (one decision; record resolves).
176
+ - **T7b DONE** (commit 3064fa3): llm_role_runner — planner/executor/
177
+ reviewer call the loaded model; parse failure FAILS the run w/ raw
178
+ preserved (fail-closed); build_orchestrator picks mode='llm' only when
179
+ a model is loaded; agents run endpoint via asyncio.to_thread + sync
180
+ model bridge (asyncio.run safe in worker thread). Suite 559.
181
+ - **T6-scoped-reads DONE** (commit 7f58a57): workspaces_of/
182
+ filter_scoped_nodes on the store; all SearchService channels + kg.graph()
183
+ accept allowed_workspaces; search router scopes via _ScopedSearchService
184
+ proxy + PLATFORM.allowed_scopes; ContextAssembler hybrid seam scoped per
185
+ user. Legacy NULL rows machine-visible (documented). Suite 564.
186
+ - **T6-remainder DONE**: users now carry stable `user:<uuid>` identities
187
+ with non-destructive `users.json` migration; sessions store UUID subjects
188
+ while preserving email compatibility; workspace memberships/owners and KG
189
+ identity columns migrate from email strings to UUIDs. `core/policy.py` is the
190
+ enforced role/capability map behind admin dependencies and `/admin/roles`.
191
+ Invitations are real local tokens (create/list/accept/expire) and accepted
192
+ workspace invites add UUID-keyed members. Workspace OS state imports once from
193
+ JSON into the same `knowledge_graph.sqlite`, mirrors JSON for compatibility,
194
+ writes transactionally, and no longer truncates durable history collections.
195
+ Suite: 583.
196
+ - **T7d DONE** (commit 235f9b6): latticeai/services/triggers.py —
197
+ interval scheduler (missed-while-down → recorded skip events, no
198
+ catch-up) + brain_event triggers via visible post_tool hook on
199
+ kg_ingest.*; __trigger__ provenance in run inputs; describe() honest
200
+ status; started in app factory w/ idempotent hook registration. Suite 569.
201
+ - **T7e DONE** (commit 014ca91): custom registry agents executable
202
+ (config actually loaded; honest skip in simulation).
203
+ - **T7c DONE**: `latticeai/services/run_executor.py` owns durable asyncio
204
+ server-loop tasks for agent/workflow runs. `/agents/api/run` and workflow
205
+ definition runs now persist queued rows, execute sync orchestrator/tool work
206
+ via `asyncio.to_thread`, update the same run row through running/final states,
207
+ publish progress through the existing realtime SSE feed, support cooperative
208
+ cancellation, and reconcile orphaned active runs to `interrupted` at startup
209
+ while preserving `awaiting_approval` pause cursors. `RealtimeBus.publish` is
210
+ thread-safe via subscriber-loop `call_soon_threadsafe`. Suite: 579.
211
+ - **T9-canvas DONE** (commit 2fee077): force-directed canvas explorer
212
+ (graph-canvas.js + Explore rewire; visual spec updated).
213
+ - **T9-IA DONE** (commit 972d34c): brain-first nav (Brain/Ask/Capture/
214
+ Act/Library/System); knowledge-graph is the default landing route.
215
+ - **T9 REMAINDER DONE**: legacy static pages and scripts deleted; legacy GET
216
+ routes redirect into `/app`; parity views added for account/profile,
217
+ workspaces/org members/invitations/activation, snapshots/time-machine with
218
+ merge-restore, activity/presence, run approvals/cancellation, workflow
219
+ trigger configuration/status, Brain Network pairing/push, chat context trace,
220
+ and KG provenance coverage. en/ko i18n runtime backs routes, shell, and new
221
+ parity views; `scripts/lint_v3.mjs` gates it. Visual coverage moved to the
222
+ v3 surface and legacy-page specs were retired.
223
+ - T9-canvas agent left static/v3/js/views/graph-canvas.js (509 lines,
224
+ node --check passes) but NEVER rewired knowledge-graph.js — file kept
225
+ uncommitted in tree; integration outstanding.
226
+ - NOTE: The old T3d queue is closed. T9 parity surfaces remain active with
227
+ full contracts in this file + the plan.
228
+ - **T3e**: docs/kg-schema.md regenerated from enums.
229
+ - graph_curator decision moved to T4.
230
+ - **T9 PARTIAL — vendoring half DONE** (commit `aa613ae`, parallel-safe per
231
+ amendments): all CDN references removed from every shipped page (Inter,
232
+ Tabler icons, chart.js, marked.js vendored under static/vendor);
233
+ --lt3-on-accent token added; sw.js rebuilt around the v3 manifest;
234
+ lint_v3.mjs now mechanically enforces token/inline-style/CDN rules;
235
+ 6 guard tests. Closed later by T9-canvas, T9-IA, and T9 remainder.
236
+ - **T1 DONE** (commits `1cddc67` frontend + `c574eb6` backend). All 7 items:
237
+ by-id snapshot/memory authz via new WorkspaceService.authorize_record_read/
238
+ authorize_memory_delete; /workspace/os leak removed (workspace_count
239
+ replaces raw registry; legacy+v3 UI only read workspace_registry — checked);
240
+ chat context pairing fix (pair_user_history, module-level in api/chat.py);
241
+ recall matches-key fix + shared lexical scorer (no constants); run records
242
+ carry mode/record_schema_version=2 and simulation runs skip KG ingestion
243
+ (record_agent_run/record_workflow_run mode param; orchestrator declares
244
+ mode; agent_runtime threads it); fake fusion meters removed (hashed bundle
245
+ regenerated, manifest updated); README overclaims corrected.
246
+ Suite: 469 passed (455 baseline + 3 static guards + 11 T1 tests).
247
+ Note: T1 ran inline (main session) after the workflow implementer hit a
248
+ usage limit; only the frontend half came from the workflow agent.
249
+
250
+ Scope ruling (user directive, session 3): risk/effort/migration size are NOT
251
+ valid exclusion reasons — only true technical blockers. Consequently the
252
+ architecture now INCLUDES: KG v2 write-mastering flip, durable async run
253
+ engine + cancellation + SSE + triggers, per-tool approval gate, user-UUID
254
+ identity + policy enforcement + invitations, transactional workspace state,
255
+ FTS5 + optional sqlite-vec, Brain Network v1 peer exchange (signed bundles
256
+ over LAN HTTP), knowledge_graph.py decomposition into latticeai/brain/,
257
+ root-module absorption, create_app factory, legacy frontend deletion,
258
+ token-native login, i18n. Only two exclusions remain (both true blockers):
259
+ git history rewrite for the tracked pptx (force-push = owner decision at RC
260
+ review; file IS deleted at HEAD in T10) and silent default download of a
261
+ production embedder (consent violation; wizard-provisioned opt-in instead).
262
+
263
+ Full structured audit findings for all 8 dimensions are committed at
264
+ `docs/v4-audit/v4_audit_<dimension>.json` (summary / strengths / problems
265
+ with severity+files / opportunities with effort). §4 below condenses the two
266
+ that predate the JSON drop; **read the JSON files for the other six — they are
267
+ the canonical Phase A record.**
268
+
269
+ ## 3. Completed Work
270
+
271
+ 1. **Baseline established (main @ 5889195, v3.6.0)**
272
+ - Tests: `.venv/bin/python -m pytest tests/` → **455 unit pass, 9 integration
273
+ fail**. The 9 failures are *pre-existing* `httpx.ConnectError`s — they need a
274
+ live server. **Unit tests (`tests/unit`) are the validation gate.**
275
+ - `.venv` Python is 3.14.5. `pyproject.toml` requires >=3.11 (avoid PEP 701
276
+ f-strings nesting same quotes — 3.11 compat; CI runs 3.11).
277
+ - Code inventory: `latticeai/` package ~15,007 lines (28 core modules, 16
278
+ services, 27 API routers + `server_app.py` at 1,554 lines). Legacy root
279
+ modules ~6,720 lines incl. `knowledge_graph.py` **4,633 lines**,
280
+ `kg_schema.py` 521, `llm_router.py` 775, `mcp_registry.py` 791.
281
+ - Frontend: `/app` v3 SPA (`static/v3/`, token-native) is primary; legacy
282
+ static HTML pages were later removed and compatibility routes redirect
283
+ into `/app`.
284
+ - Repo root clutter: ~30 `ltcai-*.tgz` tarballs, `ltcai-0.3.1/` extracted copy,
285
+ logs, `chat_history.json`, 15MB pptx — most likely untracked; verify with
286
+ `git ls-files` before cleaning.
287
+ 2. **Branch created**: `feat/v4-digital-brain` (from main @ 5889195). No commits yet
288
+ besides this recovery file.
289
+ 3. **Phase A audits completed (2 of 8)** — full JSON in
290
+ `/tmp/v4_audit_agent-workflow-runtime.json` and
291
+ `/tmp/v4_audit_workspace-enterprise.json` (also summarized in §4 below; tmp files
292
+ may not survive reboot — §4 is the durable record).
293
+
294
+ ## 4. Findings (completed audit dimensions)
295
+
296
+ ### 4.1 Agent & Workflow Runtime — VERDICT: one real runtime, two demo-grade ones
297
+
298
+ **Real (keep/extend):**
299
+ - `latticeai/core/agent.py` — genuine single-agent LLM state machine
300
+ (PLAN→EXECUTE→VERIFY→ROLLBACK), real tool execution via `DEFAULT_TOOL_REGISTRY`
301
+ (`tools/__init__.py:247-256`), destructive-action blocking, loop detection, git
302
+ rollback, human-in-the-loop plan approval (`latticeai/api/chat.py:714-727`).
303
+ - Hooks platform is real as of v3.4+ (v3.3.0 gap closed): execution engine in
304
+ `latticeai/core/hooks.py:498-713`, 7 built-ins bound at startup
305
+ (`server_app.py:1327`), subprocess user hooks, fail-closed `pre_*` gates,
306
+ persisted run log (`hooks_runs.json`), fired from agent/workflow/tool/ingestion.
307
+ - `dispatch_tool` (`hooks.py:187-233`) is the single shared tool lifecycle seam.
308
+ - `WorkflowEngine` (`core/workflow_engine.py`) is a clean, tested interpreter
309
+ (validation, cycle guard, eval-free conditions) — the *engine* is fine.
310
+ - Tool governance single ownership point: `core/tool_registry.py`.
311
+
312
+ **Critical problems:**
313
+ - **Multi-Agent Runtime is deterministic theater**: production always uses
314
+ `default_role_runner` (`platform_runtime.py:211-216`); planner emits canned
315
+ 3-step plan (`multi_agent.py:339-343`), self-approves, executor does no work,
316
+ reviewer rubber-stamps — yet persists fake plans/handoffs/reviews into the
317
+ workspace store **and the Knowledge Graph** (fabricated provenance).
318
+ - **Workflow runs execute nothing**: `platform_runtime._tool_node_runner` (:79-97)
319
+ returns `{recorded: true}` instead of calling `execute_tool`; skill/plugin
320
+ runners are existence checks. Runs finish "ok" having done zero work.
321
+ - Custom agents in `AgentRegistry` are metadata-only — orchestrator filters to 5
322
+ hardcoded `AGENT_ROLES` (`multi_agent.py:476`); registration is a UI illusion.
323
+ - No async execution/cancellation/scheduling; `stop()` can't cancel; only
324
+ 'manual' trigger exists.
325
+ - Tool approval is audit-only (`agent.py:176-194` always auto-approves);
326
+ per-tool human gate doesn't exist despite governance vocabulary.
327
+ - Two parallel agent systems with colliding names (`core/agent.py` vs
328
+ `core/multi_agent.py`+`services/agent_runtime.py`).
329
+
330
+ **Key opportunities (= v4 work):** back orchestrator roles with the real
331
+ single-agent runtime + LLM router; make workflow tool nodes call `dispatch_tool`
332
+ with real governance (pause-for-approval state); async durable runs + SSE events +
333
+ real cancellation; trigger system (cron/interval + KG-event triggers via existing
334
+ hooks, e.g. "on document ingested, run workflow"); unify agent systems so registry
335
+ entries carry executable config (model/prompt/tool allowlist); route agent
336
+ learnings through `services/ingestion.py` with provenance; label simulation runs
337
+ honestly (`mode` field) until/unless execution is real.
338
+
339
+ ### 4.2 Workspace, Identity & Enterprise — VERDICT: solid auth, illusory isolation
340
+
341
+ **Real (keep):** `core/oidc.py` (fail-closed OIDC verifier, anti-downgrade),
342
+ SSO nonce binding (`api/auth.py:137-201`), honest open-core enterprise seam
343
+ (`core/enterprise.py` — everything reports `enabled=False`), `core/security.py`
344
+ (scrypt, trusted-proxy XFF, constant-time compares), `PermissionGateway`
345
+ (path+action+user+hash+TTL consent), workspace role enforcement in store with
346
+ tests, non-destructive workspace migration.
347
+
348
+ **Critical problems:**
349
+ - **The actual "brain" is machine-global, not workspace-scoped**:
350
+ `workspace_service.py:39` `SHARED_GLOBAL_AREAS = ('graph', 'skills')`;
351
+ KG store constructed once per machine (`server_app.py:296+`); chat history
352
+ global; portability export is admin-only machine-global. Personal vs
353
+ Organization workspace isolation only covers auxiliary JSON records.
354
+ - **By-id authz bypasses**: `GET /workspace/snapshots/{id}` (+`/{area}`,
355
+ `/export`, `/compare`) only `require_user` — any authenticated user reads any
356
+ workspace's snapshots (`workspace.py:343-389`). Memory delete lacks ownership
357
+ checks; `/workspace/os` leaks full registry incl. other orgs' member lists
358
+ (`workspace_os.py:433`).
359
+ - Single unlocked whole-file `workspace_os.json` (1,959 lines module, 0 locks):
360
+ lost updates under concurrency; silent `[-200:]`/`[-500:]` truncation of
361
+ memories/traces/timeline — contradicts "knowledge is durable".
362
+ - Three conflicting role vocabularies (users.json admin|user; workspace
363
+ owner/admin/member/viewer; `_ROLE_CAPS` matrix that **nothing enforces** though
364
+ `admin.py:112-113` claims it's "the real access policy").
365
+ - Minor: session tokens stored plaintext; 4-char min password; dead
366
+ `detect_edition()` env branch; dead `_sso_states`; org-creation timeline event
367
+ mis-scoped; SSO lacks PKCE.
368
+
369
+ **Key opportunities (= v4 work):** partition KG by workspace (prereq for
370
+ Personal/Organization Brain) — `~/.ltcai/workspaces/<id>/` or workspace_id
371
+ columns, threaded through ingestion/search/portability; close by-id authz gaps
372
+ (small!); unify identity (stable user UUIDs, one policy module, real
373
+ invitations); per-workspace SQLite for workspace state (kill lost updates +
374
+ truncation); federation foundations: device keypair identity (keyring), signed
375
+ provenance-stamped export bundles, selective sharing; visibility levels
376
+ (private/workspace/org) on memories+nodes; per-user "take your brain with you"
377
+ export + encryption at rest; harden edges (hash session tokens, PKCE, password
378
+ policy).
379
+
380
+ ### 4.3 Remaining six dimensions — COMPLETE; headline findings
381
+
382
+ Canonical record: `docs/v4-audit/*.json`. Cross-dimension headline synthesis:
383
+
384
+ - **product-identity**: identity is skin-deep — only README/ARCHITECTURE say
385
+ "Digital Brain"; PROJECT_PRINCIPLES/pyproject/package.json/SPA IA still say
386
+ "AI workspace". **p_reinforce.py "garden" vault (`~/.ltcai-brain`) is a second
387
+ brain bypassing the KG**, injected into every chat (`api/chat.py:368`),
388
+ contradicting "no source bypasses the graph". README overclaims agents/
389
+ workflows that FEATURE_STATUS admits are LLM-free. Naming sprawl (9 ids,
390
+ 2 env prefixes, uppercase `LTCAI` bin). FEATURE_STATUS.md honesty ledger is
391
+ the prize asset — institutionalize it.
392
+ - **backend-architecture**: inverted dependency — clean `latticeai/` imports
393
+ legacy root modules everywhere. `knowledge_graph.py` = 4,633-line single
394
+ class w/ 7 responsibilities. **IngestionPipeline covers only 1 of 4 KG write
395
+ paths** (browser only; chat/uploads/MCP write directly, no provenance).
396
+ `server_app.py` 1,555-line god module, import-time side effects, dormant
397
+ AppContext/deps.py. Chat history hard-capped at 50 messages in JSON.
398
+ telegram_bot imported unconditionally by chat router. Dead: codex_telegram_bot,
399
+ perm_monitor, knowledge_graph_api (vestigial).
400
+ - **knowledge-data-model**: KG v2 is **schema theater** — reads reconstruct
401
+ legacy Korean free-string types via COALESCE views; v2's owner_id/visibility/
402
+ evidence/created_by/embedding columns never populated; writes still mint
403
+ '업로드함'/'포함함'. No temporal/episodic dimension (edges UNIQUE collapse
404
+ history). No memory-type model. Search default = LIKE + brute-force cosine
405
+ over hash embeddings (grade='fallback'). graph_curator.py dead in production.
406
+ docs/kg-schema.md documents nonexistent APIs (validate_endpoints).
407
+ - **frontend-ux**: TWO complete frontends in production (legacy ~17k lines at
408
+ /chat,/graph,/workspace,/admin… vs v3 SPA at /app); onboarding + /admin route
409
+ into the LEGACY stack. v3 KG explorer (static SVG) is weaker than legacy
410
+ force-directed canvas — backwards for KG-first. CDN fonts/icons contradict
411
+ privacy-first. sw.js stale (precaches legacy). Hashed build artifacts
412
+ committed beside sources. lint_v3.mjs is syntax-check only.
413
+ - **memory-context**: memory IS injected at chat time but naively (string
414
+ concat of vault substring-scan + SQLite LIKE); workspace personal-memory tier
415
+ NEVER consumed at inference; **`MemoryService.recall` graph branch dead code**
416
+ (`.get("results")` vs actual `matches` key); fabricated recall scores
417
+ (hardcoded 0.6/0.5); recent-chat context **leaks other users' messages**
418
+ (filter passes any assistant reply); hybrid/vector search never used at
419
+ inference; agent learnings dumped to vault markdown w/ swallowed errors.
420
+ - **release-quality**: **published wheel is broken** — `server_app.py:149`
421
+ imports root `setup` module which py-modules omits; root `setup.py` is
422
+ application code colliding with setuptools. Zero Python lint/typecheck.
423
+ Deps fully unpinned (pyproject + duplicated requirements.txt). npm tarball
424
+ 24.8MB (ships docs images, bots). Version = 9 synchronized copies guarded by
425
+ a test. 15MB pptx tracked at HEAD. Root clutter (31 tgz, 2 venvs, logs) is
426
+ untracked (440 tracked files; 0 tgz tracked). Strong assets to keep:
427
+ validate_release_artifacts.py, version-consistency tests, CI matrix,
428
+ tag-driven release workflow.
429
+
430
+ ## 5. Decisions Made
431
+
432
+ 1. `feat/v4-digital-brain` is the working branch; main untouched.
433
+ 2. Unit tests (455) are the green gate; the 9 integration failures are
434
+ pre-existing and excluded from the gate (re-verify they don't regress further).
435
+ 3. Phase structure: A audit → B design (Brain Architecture Proposal + impl plan,
436
+ with adversarial design review) → C implementation tracks (disjoint file
437
+ ownership, frequent verified commits) → D validation + RC + final report.
438
+ 4. Audit failures are re-run as a fresh 6-dimension workflow (not resume) to
439
+ avoid cache ambiguity around failed agents.
440
+ 5. Recovery discipline: update this file at every phase boundary and before
441
+ any foreseeable limit.
442
+
443
+ ## 6. Remaining Work / Exact Next Actions
444
+
445
+ 1. **[NOW] Re-run the 6 failed audit dimensions** (same prompts as in workflow
446
+ script `v4-audit-wf_d690b8d1-60c.js` under the session workflows/scripts dir;
447
+ prompts are reproducible from §4.3 dimension list + FINDINGS schema).
448
+ 2. Merge all 8 findings into §4 of this file; mark Phase A complete.
449
+ 3. **Phase B**: write `docs/V4_BRAIN_ARCHITECTURE.md` (Brain Architecture
450
+ Proposal) + `docs/V4_IMPLEMENTATION_PLAN.md`; run adversarial design review
451
+ (2-3 critic agents); revise; commit.
452
+ 4. **Phase C**: implement per the plan (queue below), committing after each
453
+ verified track.
454
+ 5. **Phase D**: full validation, version bump to 4.0.0 (RC), docs, release notes,
455
+ push branch, final 13-deliverable report. STOP — wait for human review.
456
+
457
+ ## 7. Detailed Implementation Queue
458
+
459
+ **SUPERSEDED by `docs/V4_IMPLEMENTATION_PLAN.md` (tracks T1–T10 with file
460
+ ownership, migration strategies, tests, and risk register). That document is
461
+ the execution contract for Phase C.** The original provisional queue below is
462
+ retained for context only:
463
+
464
+ - **C1. Truth & safety floor (small, do first)**
465
+ - Close workspace by-id authz gaps; strip registry leak from `/workspace/os`.
466
+ - Mark multi-agent/workflow simulation runs with persisted `mode:
467
+ "simulation"`; stop writing fabricated runs into the KG as real provenance.
468
+ - Hash session tokens at rest; real password policy; PKCE on SSO exchange.
469
+ - **C2. Brain Core data layer**
470
+ - Workspace-partitioned Knowledge Graph + memory + chat scoping
471
+ (Personal Brain vs Organization Brain become real).
472
+ - Durable workspace state (per-workspace SQLite or locked store); remove
473
+ silent truncation.
474
+ - Memory model: episodic/semantic/experience/decision record types with
475
+ provenance, on the KG substrate.
476
+ - **C3. Real Agent Runtime**
477
+ - LLM-backed role runners on top of `core/agent.py` + `llm_router`;
478
+ registry entries become executable (model/prompt/tool allowlist).
479
+ - Per-tool approval gate generalizing the human-in-loop pause.
480
+ - **C4. Real Workflow Runtime**
481
+ - Tool/skill nodes execute through `dispatch_tool` under governance with
482
+ pause-for-approval; async runs + cancellation + SSE progress.
483
+ - Trigger foundations: interval/cron + KG-event triggers via hooks.
484
+ - **C5. Sovereignty & federation foundations**
485
+ - Per-user/per-workspace brain export (signed bundles, device keypair),
486
+ import with provenance; visibility levels.
487
+ - **C6. Identity unification** — user UUIDs, single policy module, invitations.
488
+ - **C7. UX/IA re-architecture** — pending frontend-ux audit results.
489
+ - **C8. Backend decomposition** — knowledge_graph.py monolith etc., pending
490
+ backend audit results.
491
+ - **C9. Release hygiene** — version single-source, root cleanup, lint/typecheck
492
+ story, pending release-quality audit results.
493
+
494
+ ## 8. Planned Phase B Activities
495
+
496
+ - Synthesize all 8 audits into: Product Review, Identity Review, Architecture
497
+ Review, UX Review, Data Model Review (deliverables 1-5).
498
+ - Author **Brain Architecture Proposal**: Brain Core; Memory/Knowledge/
499
+ Relationship/Experience/Decision/Context systems; Agent Runtime; Dynamic
500
+ Workflow Runtime; Personal Brain / Organization Brain / Brain Network /
501
+ Knowledge Exchange / Federation foundations — mapped onto the real existing
502
+ seams (ingestion pipeline, hooks, dispatch_tool, workspace service, KG store).
503
+ - Author Implementation Plan with track ownership (disjoint files per track).
504
+ - Adversarial review: 2-3 critic agents attack the proposal (feasibility,
505
+ fake-functionality risk, capability-preservation, migration safety); revise.
506
+ - Commit both docs.
507
+
508
+ ## 9. Planned Phase C Activities
509
+
510
+ - Execute queue §7 as sequenced tracks; after each track: run
511
+ `.venv/bin/python -m pytest tests/unit -q` (+ targeted new tests; every new
512
+ feature ships with tests), commit with conventional message, update this file.
513
+ - Implementation agents must follow: no placeholder code, no demo data, honest
514
+ labeling, additive migrations with backfill, 3.11-compatible syntax.
515
+
516
+ ## 10. Planned Phase D Activities
517
+
518
+ - `scripts/validate_release_artifacts.py`, `scripts/lint_v3.mjs`, full pytest,
519
+ `npm`/vsix build as applicable, packaging build.
520
+ - Version → 4.0.0 across pyproject.toml/package.json/setup.py/health endpoint
521
+ (verify the single-source mechanism from v3.3.0 audit).
522
+ - Update README/ARCHITECTURE/FEATURE_STATUS/CHANGELOG + RELEASE_NOTES_v4.0.0.md.
523
+ - Push `feat/v4-digital-brain`; produce final 13-deliverable report; STOP for
524
+ human review (no merge, no tag, no publish).
525
+
526
+ ## 11. Branch Status
527
+
528
+ - `main` contains the v4 implementation through T9 remainder closure and is
529
+ pushed to `origin/main` at every verified milestone.
530
+ - No tag, package publish, release upload, production deployment, force-push, or
531
+ history rewrite has been performed.
532
+
533
+ ## 12. Validation Status
534
+
535
+ - Full unit suite: `.venv/bin/python -m pytest tests/unit -q` → **585 passed,
536
+ 2 warnings**.
537
+ - Focused T9 tests: `tests/unit/test_workspace_os.py`,
538
+ `tests/unit/test_static_release_hygiene.py`, and `tests/visual/v3.spec.js`
539
+ passed after the parity/legacy-retirement changes.
540
+ - Static and code gates: `.venv/bin/python -m ruff check .`,
541
+ `.venv/bin/python scripts/check_python.py`, `npm run lint`,
542
+ `npm run build:assets`, and `node --check` on changed/new v3 JS passed.
543
+ - Build/package gates: `.venv/bin/python -m build`,
544
+ `.venv/bin/python scripts/wheel_smoke.py`, and `npm pack --dry-run` passed.
545
+
546
+ ## 13. Files Modified (branch vs main)
547
+
548
+ - T9 remainder changed backend compatibility redirects and SPA-facing APIs,
549
+ Workspace OS snapshot restore, v3 shell/routing/store/i18n/API modules, new
550
+ parity views, asset manifests, package/static inclusion rules, unit and visual
551
+ tests, mocks, release/status documentation, and removed retired legacy static
552
+ pages/scripts/CSS/tests.