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.
- package/README.md +98 -306
- package/auto_setup.py +11 -1
- package/docs/CHANGELOG.md +91 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/ONBOARDING.md +1 -1
- package/docs/PERFORMANCE.md +106 -0
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +1 -1
- package/kg_schema.py +11 -1
- package/knowledge_graph.py +12 -2
- package/knowledge_graph_api.py +11 -1
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/proactive.py +583 -0
- package/lattice_brain/graph/retrieval.py +301 -8
- package/lattice_brain/graph/retrieval_vector.py +145 -0
- package/lattice_brain/ingestion.py +757 -16
- package/lattice_brain/quality.py +44 -9
- package/lattice_brain/runtime/multi_agent.py +38 -2
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/brain_intelligence.py +39 -2
- package/latticeai/api/change_proposals.py +32 -3
- package/latticeai/api/chat.py +17 -0
- package/latticeai/api/chat_helpers.py +48 -0
- package/latticeai/api/chat_stream.py +9 -1
- package/latticeai/api/local_files.py +120 -2
- package/latticeai/api/review_queue.py +66 -2
- package/latticeai/app_factory.py +3 -0
- package/latticeai/core/agent.py +193 -135
- package/latticeai/core/agent_eval.py +278 -4
- package/latticeai/core/legacy_compatibility.py +15 -1
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/runtime/router_registration.py +2 -0
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/automation_intelligence.py +151 -14
- package/latticeai/services/brain_intelligence.py +169 -1
- package/latticeai/services/change_proposals.py +56 -4
- package/latticeai/services/product_readiness.py +1 -1
- package/latticeai/services/review_queue.py +43 -2
- package/llm_router.py +10 -1
- package/local_knowledge_api.py +10 -1
- package/ltcai_cli.py +11 -1
- package/mcp_registry.py +10 -1
- package/p_reinforce.py +10 -1
- package/package.json +1 -1
- package/scripts/brain_quality_eval.py +1 -1
- package/scripts/check_current_release_docs.mjs +1 -1
- package/scripts/profile_kg.py +360 -0
- package/setup_wizard.py +10 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +11 -11
- package/static/app/assets/{Act-BkOEmwBi.js → Act-Dd3z8AzF.js} +2 -1
- package/static/app/assets/Brain-BMkgdWnI.js +321 -0
- package/static/app/assets/Capture-D2Aw9gkv.js +1 -0
- package/static/app/assets/Library-Yreq-KW5.js +1 -0
- package/static/app/assets/System-CXNmmtEo.js +1 -0
- package/static/app/assets/{index-85wQvEie.css → index-7gY9t9Sd.css} +1 -1
- package/static/app/assets/index-CndfILiF.js +18 -0
- package/static/app/assets/primitives-DxsIXb6G.js +1 -0
- package/static/app/assets/textarea-DH7ne8VI.js +1 -0
- package/static/app/index.html +2 -2
- package/static/sw.js +1 -1
- package/static/app/assets/Brain-C9ITUsQ_.js +0 -321
- package/static/app/assets/Capture-C-ppTeud.js +0 -1
- package/static/app/assets/Library-CGQbgWTu.js +0 -1
- package/static/app/assets/System-djmj0n2_.js +0 -1
- package/static/app/assets/index-AF0-4XVv.js +0 -18
- package/static/app/assets/primitives-jbb2qv4Q.js +0 -1
- 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.
|
package/docs/TRUST_MODEL.md
CHANGED
package/docs/WHY_LATTICE.md
CHANGED
package/docs/kg-schema.md
CHANGED
package/kg_schema.py
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
"""Compatibility shim for the v4 Knowledge Graph schema."""
|
|
2
2
|
|
|
3
|
-
|
|
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
|
package/knowledge_graph.py
CHANGED
|
@@ -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
|
-
|
|
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",
|
package/knowledge_graph_api.py
CHANGED
|
@@ -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
|
-
|
|
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
|
)
|