ltcai 9.6.0 → 9.8.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 (73) hide show
  1. package/README.md +98 -306
  2. package/auto_setup.py +11 -1
  3. package/docs/CHANGELOG.md +91 -0
  4. package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
  5. package/docs/DEVELOPMENT.md +1 -1
  6. package/docs/ONBOARDING.md +1 -1
  7. package/docs/PERFORMANCE.md +106 -0
  8. package/docs/TRUST_MODEL.md +1 -1
  9. package/docs/WHY_LATTICE.md +1 -1
  10. package/docs/kg-schema.md +1 -1
  11. package/kg_schema.py +11 -1
  12. package/knowledge_graph.py +12 -2
  13. package/knowledge_graph_api.py +11 -1
  14. package/lattice_brain/__init__.py +1 -1
  15. package/lattice_brain/graph/proactive.py +583 -0
  16. package/lattice_brain/graph/retrieval.py +301 -8
  17. package/lattice_brain/graph/retrieval_vector.py +145 -0
  18. package/lattice_brain/ingestion.py +757 -16
  19. package/lattice_brain/quality.py +44 -9
  20. package/lattice_brain/runtime/multi_agent.py +38 -2
  21. package/latticeai/__init__.py +1 -1
  22. package/latticeai/api/brain_intelligence.py +39 -2
  23. package/latticeai/api/change_proposals.py +32 -3
  24. package/latticeai/api/chat.py +17 -0
  25. package/latticeai/api/chat_helpers.py +48 -0
  26. package/latticeai/api/chat_stream.py +9 -1
  27. package/latticeai/api/local_files.py +120 -2
  28. package/latticeai/api/review_queue.py +66 -2
  29. package/latticeai/app_factory.py +3 -0
  30. package/latticeai/core/agent.py +193 -135
  31. package/latticeai/core/agent_eval.py +278 -4
  32. package/latticeai/core/legacy_compatibility.py +15 -1
  33. package/latticeai/core/marketplace.py +1 -1
  34. package/latticeai/core/workspace_os.py +1 -1
  35. package/latticeai/runtime/router_registration.py +2 -0
  36. package/latticeai/services/architecture_readiness.py +1 -1
  37. package/latticeai/services/automation_intelligence.py +151 -14
  38. package/latticeai/services/brain_intelligence.py +169 -1
  39. package/latticeai/services/change_proposals.py +56 -4
  40. package/latticeai/services/product_readiness.py +1 -1
  41. package/latticeai/services/review_queue.py +43 -2
  42. package/llm_router.py +10 -1
  43. package/local_knowledge_api.py +10 -1
  44. package/ltcai_cli.py +11 -1
  45. package/mcp_registry.py +10 -1
  46. package/p_reinforce.py +10 -1
  47. package/package.json +1 -1
  48. package/scripts/brain_quality_eval.py +1 -1
  49. package/scripts/check_current_release_docs.mjs +1 -1
  50. package/scripts/profile_kg.py +360 -0
  51. package/setup_wizard.py +10 -1
  52. package/src-tauri/Cargo.lock +1 -1
  53. package/src-tauri/Cargo.toml +1 -1
  54. package/src-tauri/tauri.conf.json +1 -1
  55. package/static/app/asset-manifest.json +11 -11
  56. package/static/app/assets/{Act-BkOEmwBi.js → Act-Dd3z8AzF.js} +2 -1
  57. package/static/app/assets/Brain-BMkgdWnI.js +321 -0
  58. package/static/app/assets/Capture-D2Aw9gkv.js +1 -0
  59. package/static/app/assets/Library-Yreq-KW5.js +1 -0
  60. package/static/app/assets/System-CXNmmtEo.js +1 -0
  61. package/static/app/assets/{index-85wQvEie.css → index-7gY9t9Sd.css} +1 -1
  62. package/static/app/assets/index-CndfILiF.js +18 -0
  63. package/static/app/assets/primitives-DxsIXb6G.js +1 -0
  64. package/static/app/assets/textarea-DH7ne8VI.js +1 -0
  65. package/static/app/index.html +2 -2
  66. package/static/sw.js +1 -1
  67. package/static/app/assets/Brain-C9ITUsQ_.js +0 -321
  68. package/static/app/assets/Capture-C-ppTeud.js +0 -1
  69. package/static/app/assets/Library-CGQbgWTu.js +0 -1
  70. package/static/app/assets/System-djmj0n2_.js +0 -1
  71. package/static/app/assets/index-AF0-4XVv.js +0 -18
  72. package/static/app/assets/primitives-jbb2qv4Q.js +0 -1
  73. package/static/app/assets/textarea-CFoo0OxJ.js +0 -1
@@ -0,0 +1,106 @@
1
+ # Knowledge Graph Performance Baseline
2
+
3
+ Synthetic performance and memory baseline for `KnowledgeGraphStore`
4
+ (`lattice_brain/graph/`). Measured with `scripts/profile_kg.py`.
5
+
6
+ **This is a synthetic baseline, not a real-workload benchmark.** Use it for
7
+ release-over-release regression comparison, not as a marketing number.
8
+
9
+ ## Methodology
10
+
11
+ - `scripts/profile_kg.py` builds a throwaway store the same way the unit tests
12
+ do (`KnowledgeGraphStore(tmp/graph.sqlite, tmp/blobs)`) and ingests N
13
+ synthetic text sources through the real `ingest_source()` pipeline
14
+ (chunking, rule-based concept/triple extraction, provenance edges).
15
+ - Corpus: fixed-vocabulary English + Korean text, seeded RNG (`--seed`,
16
+ default 42), ~60% short (~40 words) / 30% medium (~160) / 10% long (~520)
17
+ documents with recurring entities so concept nodes are shared and edges form.
18
+ - Fully offline: no LLM router is registered (extraction takes the rules
19
+ path) and the embedder is the built-in deterministic hash model. No network,
20
+ no model downloads.
21
+ - Timing: `time.perf_counter()` per call; p50/p95/mean over all calls in a
22
+ phase. Memory: `tracemalloc` peak, reset per phase.
23
+ - Caveat: tracemalloc runs for the whole profile and roughly doubles Python
24
+ allocation cost, so absolute timings are conservative upper bounds.
25
+ - Caveat: the synthetic vocabulary is small, so FTS selectivity and concept
26
+ density differ from real user data; every tenth query is a guaranteed miss
27
+ to avoid measuring only warm hits.
28
+
29
+ Run it:
30
+
31
+ ```bash
32
+ .venv/bin/python scripts/profile_kg.py # 5000 sources, 50 queries
33
+ .venv/bin/python scripts/profile_kg.py --nodes 500 # quick run (~10 s)
34
+ .venv/bin/python scripts/profile_kg.py --json # machine-readable
35
+ ```
36
+
37
+ ## Measured baseline (2026-07-20, v9.6.0 working tree)
38
+
39
+ Apple Silicon (darwin), Python 3.x from `.venv`, SQLite with FTS5 trigram
40
+ available, tracemalloc enabled.
41
+
42
+ ### 500 sources (quick profile, ~9 s total)
43
+
44
+ Graph produced: 2,019 nodes / 6,546 edges, 21.2 MB SQLite file.
45
+
46
+ | phase | calls | p50 ms | p95 ms | wall s | peak MB |
47
+ |----------------------|------:|-------:|-------:|-------:|--------:|
48
+ | ingest_source | 500 | 6.9 | 17.7 | 4.1 | 0.6 |
49
+ | search | 50 | 1.2 | 2.5 | 0.07 | 0.6 |
50
+ | context_for_query | 50 | 1.0 | 2.4 | 0.06 | 0.5 |
51
+ | neighbors | 50 | 0.35 | 0.45 | 0.02 | 0.6 |
52
+ | traverse (depth 2) | 50 | 4.8 | 5.2 | 0.24 | 1.1 |
53
+ | stats | 5 | 1.5 | 1.7 | 0.01 | 0.4 |
54
+ | rebuild_vector_index | 1 | 1319 | 1319 | 1.3 | 5.0 |
55
+ | vector_search | 10 | 287 | 294 | 2.9 | 14.4 |
56
+
57
+ Ingestion throughput: **~122 items/sec** (412 KB corpus).
58
+
59
+ ### 5000 sources (default profile, ~2.5 min total)
60
+
61
+ Graph produced: 18,426 nodes / 62,534 edges, 198.8 MB SQLite file
62
+ (4.26 MB corpus). Measured while other processes shared the CPU, so treat as
63
+ an upper bound.
64
+
65
+ | phase | calls | p50 ms | p95 ms | wall s | peak MB |
66
+ |----------------------|------:|-------:|-------:|-------:|--------:|
67
+ | ingest_source | 5000 | 20.1 | 54.6 | 119.9 | 1.4 |
68
+ | search | 50 | 4.3 | 19.8 | 0.40 | 1.2 |
69
+ | context_for_query | 50 | 4.1 | 18.5 | 0.40 | 1.2 |
70
+ | neighbors | 50 | 0.39 | 0.50 | 0.03 | 1.2 |
71
+ | traverse (depth 2) | 50 | 12.2 | 15.8 | 0.64 | 1.7 |
72
+ | stats | 5 | 13.1 | 13.5 | 0.07 | 1.1 |
73
+ | rebuild_vector_index | 1 | 14624 | 14624 | 14.6 | 45.6 |
74
+ | vector_search | 10 | 1732 | 1774 | 17.4 | 83.5 |
75
+
76
+ Ingestion throughput: **~42 items/sec** at this scale.
77
+
78
+ Scaling signal (500 → 5000 sources, 10x): per-item ingest p50 grew ~3x
79
+ (6.9 ms → 20.1 ms) — ingestion cost is superlinear in DB size (FTS triggers,
80
+ dedup lookups, edge upserts against growing tables). `vector_search` p50 grew
81
+ ~6x (287 ms → 1732 ms), consistent with its O(index size) brute-force scan.
82
+ Keyword search p50 grew ~3.6x but stays under 5 ms.
83
+
84
+ Regenerate with `.venv/bin/python scripts/profile_kg.py` after graph-layer
85
+ changes and compare against these tables.
86
+
87
+ ## Observations
88
+
89
+ - Keyword `search()` / `context_for_query()` stay low-millisecond thanks to
90
+ the FTS5 trigram index; they are not the scaling bottleneck.
91
+ - `traverse(depth=2)` cost grows with edge fan-out (synthetic corpus creates
92
+ dense shared-concept hubs); p95 is ~5 ms at 500 sources and ~16 ms at 5000.
93
+ - `vector_search()` is a brute-force scan over every stored embedding
94
+ (O(index size) per query). It is the dominant cost at scale and the first
95
+ candidate for an ANN/pruning optimization if vector recall becomes a hot
96
+ path. The profiler caps vector queries at 10 for this reason.
97
+ - `rebuild_vector_index(full=True)` embeds documents and chunks with the hash
98
+ embedder; with a real embedding provider expect this phase to be slower by
99
+ the provider's per-call latency times the item count.
100
+
101
+ ## Regression workflow
102
+
103
+ 1. Before a graph-layer change: `.venv/bin/python scripts/profile_kg.py --nodes 500 --json > /tmp/kg-before.json`
104
+ 2. After the change: same command to `/tmp/kg-after.json`.
105
+ 3. Compare phase p50/p95 and `db_size_mb`; investigate anything that moved
106
+ more than ~20% beyond run-to-run noise.
@@ -1,6 +1,6 @@
1
1
  # Lattice AI Trust Model
2
2
 
3
- Current release: **9.6.0 — Trusted Agent Loop**.
3
+ Current release: **9.8.0 — Honest Knowledge Pipeline**.
4
4
 
5
5
  Lattice AI is local-first, explicit about external communication, and honest
6
6
  when a capability is unavailable.
@@ -1,6 +1,6 @@
1
1
  # Why Lattice AI Exists
2
2
 
3
- Current release: **9.6.0 — Trusted Agent Loop**.
3
+ Current release: **9.8.0 — Honest Knowledge Pipeline**.
4
4
 
5
5
  **Lattice AI is a local-first Digital Brain that keeps your knowledge durable
6
6
  across any AI model.**
package/docs/kg-schema.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Knowledge Graph Schema
2
2
 
3
- Current release: **9.6.0 — Trusted Agent Loop**.
3
+ Current release: **9.8.0 — Honest Knowledge Pipeline**.
4
4
 
5
5
  명세 출처: `lattice_ai_full_spec.pptx` 슬라이드 20·21·22
6
6
  구현: `kg_schema.py`
package/kg_schema.py CHANGED
@@ -1,3 +1,13 @@
1
1
  """Compatibility shim for the v4 Knowledge Graph schema."""
2
2
 
3
- from lattice_brain.graph.schema import * # noqa: F403,F401
3
+ import warnings as _warnings
4
+
5
+ _warnings.warn(
6
+ "Importing 'kg_schema' from the repository root is deprecated; "
7
+ "use 'from lattice_brain.graph.schema import ...' instead. "
8
+ "The root shim will be removed in a future major release.",
9
+ DeprecationWarning,
10
+ stacklevel=2,
11
+ )
12
+
13
+ from lattice_brain.graph.schema import * # noqa: F403,F401,E402
@@ -4,7 +4,17 @@ The implementation now lives under :mod:`lattice_brain`. Root imports are
4
4
  kept for older integrations and tests.
5
5
  """
6
6
 
7
- from lattice_brain.graph._kg_common import ( # noqa: F401
7
+ import warnings as _warnings
8
+
9
+ _warnings.warn(
10
+ "Importing 'knowledge_graph' from the repository root is deprecated; "
11
+ "use 'from lattice_brain.graph.store import KnowledgeGraphStore' instead. "
12
+ "The root shim will be removed in a future major release.",
13
+ DeprecationWarning,
14
+ stacklevel=2,
15
+ )
16
+
17
+ from lattice_brain.graph._kg_common import ( # noqa: F401,E402
8
18
  EDGE_VERB,
9
19
  GRAPH_SCHEMA_VERSION,
10
20
  LOCAL_CODE_EXTENSIONS,
@@ -24,7 +34,7 @@ from lattice_brain.graph._kg_common import ( # noqa: F401
24
34
  _slug,
25
35
  set_llm_router,
26
36
  )
27
- from lattice_brain.graph.store import KnowledgeGraphStore
37
+ from lattice_brain.graph.store import KnowledgeGraphStore # noqa: E402
28
38
 
29
39
  __all__ = [
30
40
  "KnowledgeGraphStore",
@@ -6,7 +6,17 @@ importable for the deprecation window and will be removed in a future major
6
6
  release.
7
7
  """
8
8
 
9
- from latticeai.api.knowledge_graph import ( # noqa: F401
9
+ import warnings as _warnings
10
+
11
+ _warnings.warn(
12
+ "Importing 'knowledge_graph_api' from the repository root is deprecated; "
13
+ "use 'from latticeai.api.knowledge_graph import create_knowledge_graph_router' instead. "
14
+ "The root shim will be removed in a future major release.",
15
+ DeprecationWarning,
16
+ stacklevel=2,
17
+ )
18
+
19
+ from latticeai.api.knowledge_graph import ( # noqa: F401,E402
10
20
  KnowledgeGraphIngestRequest,
11
21
  create_knowledge_graph_router,
12
22
  )
@@ -26,7 +26,7 @@ from .storage import (
26
26
  storage_from_env,
27
27
  )
28
28
 
29
- __version__ = "9.6.0"
29
+ __version__ = "9.8.0"
30
30
 
31
31
  __all__ = [
32
32
  "AgentRuntime",