ltcai 8.1.0 → 8.2.0

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