ltcai 9.7.0 → 9.9.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 (85) hide show
  1. package/README.md +114 -320
  2. package/docs/BENCHMARKS.md +107 -0
  3. package/docs/CHANGELOG.md +72 -0
  4. package/docs/CI_AND_RELEASE_GATES.md +106 -0
  5. package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
  6. package/docs/DEVELOPMENT.md +11 -8
  7. package/docs/ONBOARDING.md +1 -1
  8. package/docs/OPERATIONS.md +15 -6
  9. package/docs/PERFORMANCE.md +9 -1
  10. package/docs/SECURITY_AUDIT.md +91 -0
  11. package/docs/TRUST_MODEL.md +1 -1
  12. package/docs/USABILITY_AUDIT.md +164 -0
  13. package/docs/WHY_LATTICE.md +1 -1
  14. package/docs/architecture.md +4 -2
  15. package/docs/kg-schema.md +1 -1
  16. package/docs/spec-vs-impl.md +8 -1
  17. package/lattice_brain/__init__.py +1 -1
  18. package/lattice_brain/graph/retrieval.py +93 -4
  19. package/lattice_brain/graph/retrieval_vector.py +43 -0
  20. package/lattice_brain/ingestion.py +399 -14
  21. package/lattice_brain/runtime/multi_agent.py +1 -1
  22. package/latticeai/__init__.py +1 -1
  23. package/latticeai/api/brain_intelligence.py +12 -0
  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 +7 -0
  29. package/latticeai/core/agent.py +105 -8
  30. package/latticeai/core/agent_eval.py +222 -1
  31. package/latticeai/core/legacy_compatibility.py +1 -1
  32. package/latticeai/core/marketplace.py +1 -1
  33. package/latticeai/core/tool_governor.py +92 -1
  34. package/latticeai/core/workspace_os.py +1 -1
  35. package/latticeai/services/architecture_readiness.py +1 -1
  36. package/latticeai/services/automation_intelligence.py +151 -14
  37. package/latticeai/services/brain_intelligence.py +72 -0
  38. package/latticeai/services/change_proposals.py +165 -23
  39. package/latticeai/services/product_readiness.py +1 -1
  40. package/latticeai/services/tool_dispatch.py +33 -0
  41. package/package.json +5 -3
  42. package/scripts/bench_models.py +312 -0
  43. package/scripts/check_bundle_budget.mjs +103 -0
  44. package/scripts/check_current_release_docs.mjs +1 -1
  45. package/scripts/check_doc_status.mjs +149 -0
  46. package/scripts/generate_sbom.py +70 -0
  47. package/src-tauri/Cargo.lock +1 -1
  48. package/src-tauri/Cargo.toml +1 -1
  49. package/src-tauri/tauri.conf.json +1 -1
  50. package/static/app/asset-manifest.json +27 -11
  51. package/static/app/assets/Act-CfOPUKPs.js +2 -0
  52. package/static/app/assets/Brain-Cgkh0Hpn.js +321 -0
  53. package/static/app/assets/BrainHome-D8e3wQiW.js +3 -0
  54. package/static/app/assets/BrainSignals-BjRBA18L.js +1 -0
  55. package/static/app/assets/Capture-CQQYQ1Ga.js +1 -0
  56. package/static/app/assets/CommandPalette-pss56Mg4.js +1 -0
  57. package/static/app/assets/Library-CoI3xYJk.js +1 -0
  58. package/static/app/assets/LivingBrain-CaU_hCxQ.js +1 -0
  59. package/static/app/assets/ProductFlow-Db-1O71-.js +1 -0
  60. package/static/app/assets/System-Dfocn0zN.js +1 -0
  61. package/static/app/assets/bot-Bp2x1i6F.js +1 -0
  62. package/static/app/assets/circle-check-CyGal42W.js +1 -0
  63. package/static/app/assets/cpu-DQFk82hG.js +1 -0
  64. package/static/app/assets/download-C70gKQVi.js +1 -0
  65. package/static/app/assets/folder-open-DNGytsVw.js +1 -0
  66. package/static/app/assets/hard-drive-CYo_bEl4.js +1 -0
  67. package/static/app/assets/i18n-BBMJshCW.js +7 -0
  68. package/static/app/assets/index-BjaXCeOZ.js +10 -0
  69. package/static/app/assets/{index-85wQvEie.css → index-BqRcLZR3.css} +1 -1
  70. package/static/app/assets/input-ChWD-Fsh.js +1 -0
  71. package/static/app/assets/navigation-D9D9_FPC.js +1 -0
  72. package/static/app/assets/network-DzLDGmtV.js +1 -0
  73. package/static/app/assets/primitives-CmaSAyGG.js +1 -0
  74. package/static/app/assets/sparkles-DXiaM1NS.js +1 -0
  75. package/static/app/assets/textarea-CV43-o79.js +1 -0
  76. package/static/app/index.html +4 -2
  77. package/static/sw.js +1 -1
  78. package/static/app/assets/Act-B6c39ays.js +0 -2
  79. package/static/app/assets/Brain-D7Qg4k6M.js +0 -321
  80. package/static/app/assets/Capture-VF_di68r.js +0 -1
  81. package/static/app/assets/Library-D_Gis2PA.js +0 -1
  82. package/static/app/assets/System-C5s5H2ov.js +0 -1
  83. package/static/app/assets/index-DJC_2oub.js +0 -18
  84. package/static/app/assets/primitives-DL4Nip8C.js +0 -1
  85. package/static/app/assets/textarea-woZfCXHy.js +0 -1
package/docs/CHANGELOG.md CHANGED
@@ -4,6 +4,78 @@ The top entry is either the current unreleased main-branch work or the current
4
4
  release line. Older entries are historical and may describe behavior as it
5
5
  existed at that release.
6
6
 
7
+ ## [9.9.0] - 2026-07-21
8
+
9
+ ### Fixed
10
+ - Change proposals record the target's original content hash and existence;
11
+ approval re-hashes the disk and rejects a modified/deleted/created target
12
+ with a 409 conflict instead of overwriting newer content. Applies are atomic
13
+ (`os.replace`) and serialized so duplicate/concurrent approvals apply once.
14
+ - The agent verifier no longer fabricates a PASS on unparseable critic output:
15
+ one strict repair retry, then the new terminal `NEEDS_REVIEW` state. `DONE`
16
+ now requires a valid PASS and deterministic execution evidence; the loose
17
+ `next_state == DONE` success path is removed.
18
+ - Device analysis no longer fabricates a `supported: true` model card on probe
19
+ failure; the recommendation screen models `loading | ready | unavailable`
20
+ and offers retry / continue-without-a-model.
21
+
22
+ ### Added
23
+ - `MUTATING_TOOL_INVENTORY` single-source governance classification for every
24
+ side-effecting tool, a fail-closed CI coverage gate, and dispatch-level
25
+ blocking (409) of existing-content overwrites that cannot be staged as a
26
+ reviewable proposal (`create_docx/xlsx/pptx/pdf`, `local_write`).
27
+ - Agent-eval result classification (`correct_completion` / `safe_termination`
28
+ / `needs_review` / `failed`) and fail-closed verifier scenarios (20 total).
29
+ - CI: `dependency-audit.yml` (pip-audit + npm audit + CycloneDX SBOM) and
30
+ scheduled `postgres-integration.yml`; all GitHub Actions SHA-pinned; a
31
+ frontend bundle-budget gate (150 KiB gzip).
32
+ - `docs/SECURITY_AUDIT.md`, `docs/BENCHMARKS.md` + `scripts/bench_models.py`,
33
+ `docs/USABILITY_AUDIT.md`, `docs/CI_AND_RELEASE_GATES.md`, and a
34
+ documentation status/link gate (`scripts/check_doc_status.mjs`).
35
+
36
+ ### Changed
37
+ - Initial JS bundle reduced ~22% (180.3 → 141.6 KiB gzip) via lazy-loaded
38
+ onboarding, Brain home, and command palette.
39
+ - `ARCHITECTURE.md` verified against the real module layout and corrected;
40
+ stale 9.6-era operational/feature/development docs updated and classified.
41
+
42
+ ## [9.8.0] - 2026-07-20
43
+
44
+ ### Added
45
+ - Added `extraction_quality` (score/level/reasons) and low-quality `warnings`
46
+ to every ingest result, with upstream extractor confidence taking
47
+ precedence; the proactive `gate_ingest_candidate()` now records an
48
+ observe-only `quality_gate` verdict on non-chat ingests.
49
+ - Added background ingestion job progress (`total`/`processed`/`failed`,
50
+ capped per-item errors) with resume-from-remaining support, plus
51
+ `GET /api/ingestion/jobs`, `GET /api/ingestion/jobs/{id}`,
52
+ `POST /api/ingestion/jobs/{id}/resume`, and approval-gated
53
+ `POST /api/ingestion/folder`.
54
+ - Added `context_quality` (mode/nodes/limited/reason) to chat responses
55
+ (non-stream top-level and final SSE trailer) with a localized
56
+ limited-context note in the assistant bubble.
57
+ - Added `GET /api/brain/vector-freshness` and a pending-indexing chip in the
58
+ Brain views; `vector_freshness()` never raises and degrades to
59
+ `unavailable` with a reason.
60
+ - Added four agent-eval scenarios (ingestion chain, concept extraction,
61
+ RAG-grounded answer with a negative grounding test, automation
62
+ proposal-first), growing the CI gate to 16 scenarios with
63
+ `expect_final_contains` grounding assertions.
64
+ - Added deterministic `confidence`, `confidence_factors`, duplicate
65
+ suppression, installed-recipe detection, and a low-quality floor to
66
+ automation suggestions, with a `quality` reporting block.
67
+ - Added a frontend ingestion jobs panel (progress bar, failed count, resume)
68
+ and extraction-quality warnings in the ingestion panels, all with ko/en
69
+ i18n parity.
70
+
71
+ ### Changed
72
+ - Rebuilt README media-first: hero walkthrough GIF, screenshot grid, compact
73
+ release-history table, and roughly 60% less prose.
74
+ - `context_for_query()` gains an opt-in metadata path
75
+ (`context_for_query_with_meta()`); the default output is byte-identical.
76
+ - Background ingestion job initial status is now `queued` (was internal
77
+ `pending`).
78
+
7
79
  ## [9.7.0] - 2026-07-20
8
80
 
9
81
  ### Added
@@ -0,0 +1,106 @@
1
+ # CI & Release Gates
2
+
3
+ > Status: reference 2026-07-21
4
+
5
+ Reference for the GitHub Actions workflows that guard `main` and releases, the
6
+ supply-chain hardening applied to them, and the recommended branch-protection
7
+ configuration. Companion to [SECURITY_AUDIT.md](SECURITY_AUDIT.md) and
8
+ [BENCHMARKS.md](BENCHMARKS.md).
9
+
10
+ ## Workflows
11
+
12
+ | Workflow | File | Triggers | Purpose |
13
+ |----------|------|----------|---------|
14
+ | CI | `.github/workflows/ci.yml` | push/PR to `main` | Lint, typecheck, unit + integration tests, brain/agent eval gates, build + wheel smoke |
15
+ | Release | `.github/workflows/release.yml` | tags `v*` / `[0-9]*` | Build & validate all artifacts (no publish) |
16
+ | Visual Smoke | `.github/workflows/visual.yml` | push/PR, nightly cron, dispatch | Playwright visual smoke |
17
+ | **Dependency Audit** | `.github/workflows/dependency-audit.yml` | push/PR, weekly cron, dispatch | pip-audit + npm audit + CycloneDX SBOMs |
18
+ | **Postgres Integration** | `.github/workflows/postgres-integration.yml` | weekly cron, dispatch | Live SQLite→Postgres/pgvector migration test |
19
+
20
+ The last two were added for the P2 deployment-trust / supply-chain workstream.
21
+
22
+ ## Supply-chain hardening: pinned actions
23
+
24
+ Every third-party `uses:` in every workflow is pinned to an **immutable commit
25
+ SHA**, with the human-readable version in a trailing comment. A moving tag
26
+ (`@v4`) can be repointed by the action owner; a SHA cannot. SHAs were resolved
27
+ from the authoritative upstream refs via `git ls-remote --tags` on 2026-07-21.
28
+
29
+ | Action | Tag | Pinned commit SHA |
30
+ |--------|-----|-------------------|
31
+ | actions/checkout | v4.4.0 | `11d5960a326750d5838078e36cf38b85af677262` |
32
+ | actions/checkout | v5.1.0 | `fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09` |
33
+ | actions/setup-python | v5.6.0 | `a26af69be951a213d495a4c3e4e4022e16d87065` |
34
+ | actions/setup-python | v6.3.0 | `ece7cb06caefa5fff74198d8649806c4678c61a1` |
35
+ | actions/setup-node | v5.0.0 | `a0853c24544627f65ddf259abe73b1d18a591444` |
36
+ | actions/upload-artifact | v4.6.2 | `ea165f8d65b6e75b540449e92b4886f43607fa02` |
37
+
38
+ Pinning coverage: **100% of current `uses:` entries** across `ci.yml`,
39
+ `release.yml`, `visual.yml`, `dependency-audit.yml`, and
40
+ `postgres-integration.yml`. All are first-party `actions/*`. If a third-party
41
+ action is added later, resolve and pin its SHA the same way before merge.
42
+
43
+ ## Dependency-audit gate posture (conservative)
44
+
45
+ The audit workflow is intentionally **non-blocking on day-to-day PRs** and
46
+ **strict on the scheduled/dispatch run**:
47
+
48
+ - `push` / `pull_request`: `pip-audit` and `npm audit` run with
49
+ `continue-on-error` keyed on the event name, so a newly-disclosed CVE in a
50
+ transitive dependency never reddens an unrelated PR. Findings still appear in
51
+ the job summary and uploaded report artifacts.
52
+ - `schedule` (weekly) / `workflow_dispatch`: the same steps run **strict** —
53
+ `pip-audit --strict` fails on any known vuln; `npm audit --audit-level=high`
54
+ fails on high/critical. This is the loud channel for triage.
55
+
56
+ CycloneDX SBOMs (`sbom-python.json`, `sbom-npm.json`) are produced every run and
57
+ uploaded as artifacts. Regenerate locally with `scripts/generate_sbom.py`.
58
+
59
+ **To promote to a required blocking PR check:** remove the `continue-on-error`
60
+ expressions in `dependency-audit.yml` and add `python-audit` / `npm-audit` to
61
+ the required-checks list below.
62
+
63
+ ## Postgres integration gate
64
+
65
+ `postgres-integration.yml` runs the migration-integrity suite
66
+ (`tests/integration/test_v42_postgres_migration_live.py`) that is skipped
67
+ everywhere else. The suite is gated by `LTCAI_LIVE_POSTGRES_DOCKER_CONSENT=1`;
68
+ the workflow sets that variable, and the test itself starts and tears down a
69
+ `pgvector/pgvector:pg16` container via `docker compose` (preinstalled on
70
+ GitHub-hosted `ubuntu-latest`). It is deliberately kept off the PR path (slow,
71
+ image pull, needs Docker) and runs weekly + on demand.
72
+
73
+ ## Recommended branch protection for `main`
74
+
75
+ Required status checks (blocking):
76
+
77
+ - `CI / Test (Python 3.11)`
78
+ - `CI / Test (Python 3.12)`
79
+ - `CI / Integration smoke test`
80
+ - `CI / Build package`
81
+ - `Visual Smoke / Playwright visual smoke`
82
+
83
+ Advisory / non-blocking today (promote when the team is ready):
84
+
85
+ - `Dependency Audit / Python dependency audit (pip-audit)`
86
+ - `Dependency Audit / npm dependency audit`
87
+
88
+ Additional recommended settings: require PRs before merge, require branches to
89
+ be up to date, require linear history, and dismiss stale approvals on new
90
+ commits.
91
+
92
+ ## Release gate (publication safety)
93
+
94
+ `release.yml` builds and validates artifacts only — it never publishes. Package
95
+ publication (PyPI / npm / VS Code Marketplace / Open VSX) is a manual step
96
+ (`npm run publish:*`) using **exact version filenames**, never a `dist/*` glob,
97
+ so pushing a tag can never publish by accident. See
98
+ [../RELEASE.md](../RELEASE.md) for the full procedure.
99
+
100
+ ## Limitations (honest)
101
+
102
+ - Branch-protection rules are repository settings and cannot be committed from a
103
+ workflow; the list above is the recommended configuration to apply in GitHub
104
+ settings, not an enforced artifact.
105
+ - The audit gate depends on upstream advisory databases (OSV, npm registry);
106
+ absence of findings means "nothing known", not "provably safe".
@@ -1,6 +1,6 @@
1
1
  # Community And Plugins
2
2
 
3
- Current release: **9.7.0 — Proactive Hybrid Brain**.
3
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
4
 
5
5
  LatticeAI defines the path from a strong local-first framework (8.4.0
6
6
  action-aware baseline, 8.5.0 registry+DI hardening, 8.6.0 capture/navigation
@@ -1,10 +1,13 @@
1
1
  # Lattice AI Development
2
2
 
3
- Current release: **9.7.0Proactive Hybrid Brain**.
3
+ > **Status: canonical** — current contributor guidance, kept in sync with the
4
+ > current release.
5
+
6
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
7
 
5
8
  This document is for contributors working on the local-first Digital Brain
6
9
  codebase. Product positioning and quick start stay in `README.md`; release
7
- history is intentionally limited to 8.0.0-9.6.0 in `docs/CHANGELOG.md` and
10
+ history is intentionally limited to 8.0.0-9.9.0 in `docs/CHANGELOG.md` and
8
11
  `RELEASE.md`.
9
12
 
10
13
  ## Product Contract
@@ -153,10 +156,10 @@ For user-facing, API, runtime, release, or packaging changes, check:
153
156
  Release/publish examples must use exact target-version filenames. Do not
154
157
  document wildcard artifact upload commands.
155
158
 
156
- For 9.6.0 release work, exact artifacts are:
159
+ For 9.9.0 release work, exact artifacts are:
157
160
 
158
- - `dist/ltcai-9.6.0-py3-none-any.whl`
159
- - `dist/ltcai-9.6.0.tar.gz`
160
- - `ltcai-9.6.0.tgz`
161
- - `dist/ltcai-9.6.0.vsix`
162
- - `src-tauri/target/release/bundle/dmg/Lattice AI_9.6.0_aarch64.dmg`
161
+ - `dist/ltcai-9.9.0-py3-none-any.whl`
162
+ - `dist/ltcai-9.9.0.tar.gz`
163
+ - `ltcai-9.9.0.tgz`
164
+ - `dist/ltcai-9.9.0.vsix`
165
+ - `src-tauri/target/release/bundle/dmg/Lattice AI_9.9.0_aarch64.dmg`
@@ -1,6 +1,6 @@
1
1
  # Lattice AI Onboarding
2
2
 
3
- Current release: **9.7.0 — Proactive Hybrid Brain**.
3
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
4
 
5
5
  The first-run goal is a five-minute path from "I opened the app" to "my Brain
6
6
  has a source, a question, and proof." This page is the product contract behind
@@ -1,13 +1,18 @@
1
- # Lattice AI — Operations Guide (v9.6.0)
1
+ # Lattice AI — Operations Guide (v9.9.0)
2
+
3
+ > **Status: canonical** — kept in sync with the current release. Storage layout
4
+ > below reflects the SQLite live Brain store and workspace scoping, not the
5
+ > earlier Markdown-per-node graph.
2
6
 
3
7
  ## 1. 데이터 파일 위치
4
8
 
5
9
  | 파일 | 용도 |
6
10
  |------|------|
7
11
  | `~/.ltcai/users.json` | 사용자 계정 (scrypt 해시 저장) |
8
- | `~/.ltcai/history.json` | 대화 히스토리 |
12
+ | `~/.ltcai/knowledge_graph.sqlite` | Brain 라이브 스토어 — Knowledge Graph 노드/엣지/청크, 대화 히스토리, 프로비넌스 (workspace_id 스코프) |
13
+ | `~/.ltcai/knowledge_graph_blobs/` | 업로드 원본/blob 저장소 |
9
14
  | `~/.ltcai/audit.json` | 감사 로그 (agent 실행, 사용자 변경 등) |
10
- | `~/.ltcai/brain/` | Knowledge Graph 노드 (Markdown) |
15
+ | `~/.ltcai/chat_history.json` | 레거시 대화 히스토리 최초 1회 SQLite로 idempotent 임포트 후 미사용 |
11
16
  | `~/ltcai-agent/` | Agent workspace (agent가 생성한 파일) |
12
17
 
13
18
  ## 2. 백업 및 복구
@@ -112,8 +117,10 @@ pip install --upgrade ltcai
112
117
 
113
118
  ### 6.3 데이터 마이그레이션 주의사항
114
119
  - `users.json` 스키마 변경 시: 서버가 자동으로 누락 필드를 기본값으로 보완합니다.
115
- - `history.json` 스키마 변경 시: 하위 호환성 유지. 구버전 레코드는 무시됩니다.
116
- - `brain/` Knowledge Graph: Markdown 파일 기반이므로 별도 마이그레이션 없음.
120
+ - 대화 히스토리: SQLite 라이브 스토어에 저장됩니다. 레거시 `chat_history.json`은
121
+ 최초 실행 1회 idempotent 임포트된 사용되지 않습니다.
122
+ - `knowledge_graph.sqlite` Knowledge Graph: SQLite 스키마 마이그레이션은 부팅 시
123
+ 적용되며 읽기 호환성/롤백/동등성 테스트로 보호됩니다.
117
124
 
118
125
  ## 7. 공개 서버 체크리스트
119
126
 
@@ -135,7 +142,9 @@ pip install --upgrade ltcai
135
142
  - 대화 히스토리는 `user_email` 필드로 필터링됩니다.
136
143
  - Agent workspace (`~/ltcai-agent/`)는 현재 단일 공유 디렉토리입니다.
137
144
  멀티 유저 환경에서는 `~/ltcai-agent/<email>/` 구조로 분리를 권장합니다.
138
- - Knowledge Graph (`brain/`) 역시 단일 공유 공간입니다.
145
+ - Knowledge Graph `workspace_id`로 스코프됩니다. 없는 스코프의 노드는
146
+ 기본 비공개(fail-closed)이며, 레거시 글로벌 읽기는 명시적 호환성 옵트인이
147
+ 있을 때만 허용됩니다.
139
148
 
140
149
  ## 9. 서버 시작 / 종료
141
150
 
@@ -1,5 +1,13 @@
1
1
  # Knowledge Graph Performance Baseline
2
2
 
3
+ > **Status: reference** — a synthetic regression baseline, not a
4
+ > current-release measurement. The numbers below were last captured on the
5
+ > v9.6.0 working tree (see provenance line) and are carried forward as the
6
+ > comparison reference. The 9.7.0-9.8.0 line added graph-layer paths
7
+ > (`hybrid_search`, vector freshness, extraction-quality scoring), so
8
+ > regenerate with `scripts/profile_kg.py` on the current tree before treating
9
+ > these as 9.8.0 numbers.
10
+
3
11
  Synthetic performance and memory baseline for `KnowledgeGraphStore`
4
12
  (`lattice_brain/graph/`). Measured with `scripts/profile_kg.py`.
5
13
 
@@ -34,7 +42,7 @@ Run it:
34
42
  .venv/bin/python scripts/profile_kg.py --json # machine-readable
35
43
  ```
36
44
 
37
- ## Measured baseline (2026-07-20, v9.6.0 working tree)
45
+ ## Measured baseline (last captured on the v9.6.0 working tree)
38
46
 
39
47
  Apple Silicon (darwin), Python 3.x from `.venv`, SQLite with FTS5 trigram
40
48
  available, tracemalloc enabled.
@@ -0,0 +1,91 @@
1
+ # Security Audit — Static Scan Snapshot
2
+
3
+ > Status: audit snapshot 2026-07-21
4
+
5
+ This is a point-in-time static-analysis snapshot for release **v9.8.0**. It
6
+ records exactly which scanners ran, the raw findings, and an honest per-finding
7
+ real-risk assessment. It is not a guarantee of absence of vulnerabilities; it is
8
+ evidence of what the listed tools saw on the listed date.
9
+
10
+ Related: [CI & Release Gates](CI_AND_RELEASE_GATES.md) documents how these scans
11
+ are wired into continuous integration (`.github/workflows/dependency-audit.yml`).
12
+
13
+ ## Tooling & commands
14
+
15
+ Scanners were installed into the project virtualenv only (`.venv`), never added
16
+ to runtime dependencies:
17
+
18
+ ```
19
+ .venv/bin/python -m pip install pip-audit bandit
20
+ ```
21
+
22
+ | Tool | Version | Command |
23
+ |-----------|---------|---------|
24
+ | pip-audit | 2.10.1 | `.venv/bin/python -m pip_audit -r requirements.txt --strict` |
25
+ | pip-audit | 2.10.1 | `.venv/bin/python -m pip_audit` (installed environment) |
26
+ | bandit | 1.9.4 | `.venv/bin/python -m bandit -r latticeai lattice_brain -ll` |
27
+ | npm audit | (npm 10)| `npm audit --audit-level=high` |
28
+
29
+ ## Dependency vulnerabilities (pip-audit / npm audit)
30
+
31
+ **Result: no known vulnerabilities.**
32
+
33
+ - `pip-audit -r requirements.txt --strict` → `No known vulnerabilities found`.
34
+ - `pip-audit` over the installed environment → `No known vulnerabilities found`.
35
+ - `npm audit --audit-level=high` → `found 0 vulnerabilities`.
36
+
37
+ No dependency version changes were required. Because there were no actual
38
+ vulnerable pins to fix, no dependency files were modified (per the honest-fix
39
+ rule: only fix a real, safe-to-fix issue).
40
+
41
+ ## Static code analysis (bandit)
42
+
43
+ Scanned **54,795 lines** across `latticeai/` and `lattice_brain/`. With the
44
+ `-ll` display filter (MEDIUM severity and above), bandit reported **80 findings**:
45
+ 1 HIGH and 79 MEDIUM. Breakdown by rule:
46
+
47
+ | Count | Severity | Rule | What it flags |
48
+ |------:|----------|------|---------------|
49
+ | 1 | HIGH | B324 hashlib | Weak MD5 hash "for security" |
50
+ | 58 | MEDIUM | B608 hardcoded_sql_expressions | SQL built via string formatting |
51
+ | 7 | MEDIUM | B310 blacklist (urlopen) | `urllib.request.urlopen` with unrestricted scheme |
52
+ | 5 | MEDIUM | B604 shell=True | A function called with `shell=True` |
53
+ | 3 | MEDIUM | B108 hardcoded_tmp_directory | Hardcoded `/tmp` path |
54
+ | 3 | MEDIUM | B104 hardcoded_bind_all_interfaces | Bind to `0.0.0.0` |
55
+ | 2 | MEDIUM | B306 blacklist (mktemp) | `tempfile.mktemp()` |
56
+ | 1 | MEDIUM | B615 huggingface_unsafe_download | `hf_hub_download` without a pinned revision |
57
+
58
+ ### Per-finding real-risk assessment
59
+
60
+ | Rule | Location(s) | Verdict | Rationale |
61
+ |------|-------------|---------|-----------|
62
+ | **B324** MD5 | `lattice_brain/quality.py:44` | **False positive** | MD5 derives a deterministic *pseudo-label* for embedding clusters (`emb_cluster_<hash>`); not used for authentication, integrity, or secrets. Safe cosmetic fix would be `hashlib.md5(..., usedforsecurity=False)`; source is out of this task's edit scope, so documented only. |
63
+ | **B604** shell=True | `latticeai/core/agent.py:539`, `latticeai/core/tool_registry.py:129/136/168/175` | **False positive** | These are `ToolPolicy(..., shell=True, ...)` dataclass *declarations* describing whether a tool is a shell tool — not `subprocess(..., shell=True)` calls. Bandit matches the keyword, not an actual shell invocation. |
64
+ | **B108** /tmp | `lattice_brain/graph/_kg_constants.py:186/215`, `latticeai/core/agent_eval.py:240` | **False positive / benign** | The `_kg_constants` hits are `/tmp` entries in an **exclusion allowlist** of directories to skip during ingestion (a defensive list). The `agent_eval` hit is a test/eval default `agent_root`. No untrusted file is written to a predictable temp path here. |
65
+ | **B104** 0.0.0.0 | `latticeai/cli/entrypoint.py:53/237/238` | **By design, low risk** | The bind switches to `0.0.0.0` only when the operator explicitly passes `--tunnel`; default remains `127.0.0.1`. Intentional and gated. |
66
+ | **B310** urlopen | `latticeai/services/model_engines.py:120/234`, `latticeai/services/model_runtime.py:242` | **Low real risk** | Calls target operator-configured local inference engines (LM Studio / Ollama). URLs are not attacker-controlled in normal use. Recommendation: assert `http(s)` scheme before `urlopen` to close the `file:`/custom-scheme door. |
67
+ | **B608** SQL f-strings | `lattice_brain/storage/postgres.py`, `.../migration.py`, `lattice_brain/graph/*.py`, `lattice_brain/conversations.py` | **Low real risk — review** | Interpolated fragments are overwhelmingly **schema/table identifiers** quoted through `lattice_brain.storage.postgres._quote_ident`, with row *values* passed as bound parameters. Not user-value injection. Standing recommendation: keep every interpolated identifier sourced from internal constants / allowlists, never from request input. |
68
+ | **B306** mktemp | `latticeai/integrations/telegram_bot.py:450/568` | **Real, low severity** | `tempfile.mktemp()` has a documented create-time race; prefer `tempfile.mkstemp()` / `NamedTemporaryFile`. Impact is limited (local temp files for outbound Telegram media), but this is a genuine hardening item for a future source-owning change. |
69
+ | **B615** HF download | `latticeai/services/model_runtime.py:601` | **Real, supply-chain relevant** | `hf_hub_download(...)` is called without `revision=`, so a mutated upstream model repo could serve a different artifact than expected. Recommendation: pin a commit/`revision` (or verify a hash) when fetching model weights. Ties directly into the P2 supply-chain theme. |
70
+
71
+ ## Actions taken vs deferred
72
+
73
+ - **Fixed:** nothing — no dependency vulnerability existed to fix safely, and
74
+ the code-level findings live in source files outside this task's edit scope.
75
+ - **Deferred (documented) hardening items**, for a future change that owns the
76
+ relevant source:
77
+ 1. Pin a `revision` in `model_runtime.py` `hf_hub_download` (B615).
78
+ 2. Replace `tempfile.mktemp()` in `integrations/telegram_bot.py` (B306).
79
+ 3. Validate URL scheme before `urlopen` in the model engine paths (B310).
80
+ 4. Optional cosmetic: `usedforsecurity=False` on the clustering MD5 (B324).
81
+
82
+ ## Limitations (honest)
83
+
84
+ - Static analysis only. No dynamic/DAST, no fuzzing, no secret-scanning here.
85
+ - bandit reasons syntactically; the false positives above were confirmed by
86
+ reading each site, not by suppression.
87
+ - pip-audit resolves against the OSV/PyPI advisory database as of the snapshot
88
+ date; new advisories appear continuously — see the scheduled
89
+ `dependency-audit` workflow for the ongoing signal.
90
+ - SBOMs (CycloneDX) for both ecosystems can be regenerated with
91
+ `.venv/bin/python scripts/generate_sbom.py`.
@@ -1,6 +1,6 @@
1
1
  # Lattice AI Trust Model
2
2
 
3
- Current release: **9.7.0 — Proactive Hybrid Brain**.
3
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
4
 
5
5
  Lattice AI is local-first, explicit about external communication, and honest
6
6
  when a capability is unavailable.
@@ -0,0 +1,164 @@
1
+ # Usability Heuristic Audit
2
+
3
+ > Status: audit snapshot 2026-07-21
4
+
5
+ A heuristic (expert) evaluation of the Lattice AI product surface against
6
+ Jakob Nielsen's 10 usability heuristics, focused on the five journeys called out
7
+ in external review: **device analysis**, **agent completion**, **change
8
+ approval**, **Brain hierarchy**, and **slow first run**.
9
+
10
+ **This is not a substitute for real-user testing.** Heuristic evaluation finds
11
+ plausible problems from an expert's read of the code and UI; it cannot measure
12
+ what real users actually do, misread, or abandon. Every recommendation below
13
+ should be validated with 5–8 real sessions before it is treated as fact.
14
+
15
+ Evidence is cited as `file:line` against the frontend source
16
+ (`frontend/src/**`, TypeScript/React) and Python services. Note the shipped
17
+ `static/app/assets/*.js` is a minified bundle and is not citable line-by-line;
18
+ citations point at the readable source it is built from.
19
+
20
+ ## Journey 1 — Device analysis (onboarding)
21
+
22
+ Surface: `frontend/src/components/onboarding/AnalysisScreen.tsx`; backing logic
23
+ `latticeai/services/model_recommendation.py`.
24
+
25
+ - The screen renders **real detected facts**, not pure theater: it maps over a
26
+ `analysis` prop and shows real RAM when available
27
+ (`AnalysisScreen.tsx:18`, `:95` — `ramGb ? \`${Math.round(ramGb)} GB\``).
28
+ - RAM sizing and Apple-Silicon detection are honest, documented estimates:
29
+ `estimated_ram_gb = size_gb * 1.25 + 2.5` (`model_recommendation.py:64`),
30
+ `is_apple_silicon` (`:69`), `recommend_catalog` (`:160`).
31
+
32
+ Heuristics:
33
+ - **#1 Visibility of system status** — GOOD: hardware line items begin in a
34
+ `flow.analysis.checking` state (`AnalysisScreen.tsx:63-67`) then resolve to
35
+ detected values, so the scan reads as progress rather than a frozen screen.
36
+ - **#2 Match to the real world** — GOOD: plain-language labels (chip, RAM, GPU,
37
+ support, models) via i18n keys rather than jargon.
38
+ - **#1 risk** — the staged "checking → detected" reveal is presentation timing,
39
+ not the true probe duration; if detection is effectively instant, the delay is
40
+ cosmetic. Recommend: keep the animation only as long as real work is pending,
41
+ and label any assumed/estimated value (e.g. RAM heuristic) as an estimate so
42
+ users don't read `~16 GB` as a precise measurement.
43
+
44
+ ## Journey 2 — Agent completion
45
+
46
+ Surface: `latticeai/core/agent.py`.
47
+
48
+ - Terminal states are explicit: `DONE`, `FAILED`, `NEEDS_REVIEW`
49
+ (`agent.py:50-56`), and a user-facing `final_message` is always set
50
+ (`:307`, and the default `"작업을 완료했습니다."` at `:357`).
51
+
52
+ Heuristics:
53
+ - **#1 Visibility of system status** — GOOD: the loop distinguishes *completed*
54
+ from *needs-review* from *failed*, so the UI can tell the user which of three
55
+ very different outcomes occurred instead of a generic "done".
56
+ - **#9 Help users recognize/recover from errors** — GOOD structurally: parse
57
+ slips are traced with a `recovered` flag (`agent.py:255`, `:439-441`), so the
58
+ system can surface "I had to retry" honestly.
59
+ - **Recommendation** — ensure the frontend actually renders the *distinction*
60
+ between `DONE` and `NEEDS_REVIEW` prominently (color + copy), not just the
61
+ `final_message` string; a review-required outcome that looks like success is a
62
+ **#1/#5** hazard (user thinks work shipped when it is only staged).
63
+
64
+ ## Journey 3 — Change approval
65
+
66
+ Surface: `latticeai/services/change_proposals.py`, gate entry
67
+ `latticeai/core/agent.py:273` (`approve`).
68
+
69
+ - Mutations of existing content are **staged, not applied**: `review(...)`
70
+ returns `{"decision": "proposed", ...}` with a proposal record
71
+ (`change_proposals.py:124`, `:177`), and application is a separate explicit
72
+ `approve_and_apply` (`:347`). Additive creates flow with less friction.
73
+
74
+ Heuristics:
75
+ - **#3 User control & freedom** — STRONG: proposal-first governance means a
76
+ destructive/edit action is reversible-by-default (it hasn't happened yet).
77
+ This is the best-defended journey of the five.
78
+ - **#5 Error prevention** — STRONG: the split between additive (`allow_additive`)
79
+ and mutating (`proposed`) is exactly the guardrail #5 asks for.
80
+ - **#10 Help & documentation / #2 match** — RISK: the value only lands if the
81
+ approval UI explains *what changes* and *why it was staged* in plain language.
82
+ Recommend a per-proposal diff + one-line "why this needs your review" derived
83
+ from the `classification`/`reason` provenance already stored
84
+ (`change_proposals.py:237`), so approval is an informed decision, not a blind
85
+ "OK".
86
+
87
+ ## Journey 4 — Brain hierarchy
88
+
89
+ Surface: `frontend/src/features/brain/DepthEmergence.tsx`,
90
+ `.../BrainMemoryLayer.tsx`.
91
+
92
+ - The Brain reveals structure **progressively by depth**: nothing at depth 1,
93
+ memory layer at depth ≥2, knowledge layer at depth ≥3, higher structure at
94
+ depth ≥4 (`DepthEmergence.tsx:29`, `:33-39`); the memory layer caps visible
95
+ nodes by depth (`BrainMemoryLayer.tsx:16`).
96
+
97
+ Heuristics:
98
+ - **#8 Aesthetic & minimalist design** — GOOD intent: progressive disclosure
99
+ avoids dumping the full graph on a new user.
100
+ - **#6 Recognition rather than recall** — RISK: depth is an abstract control. A
101
+ user may not know what "depth 3" means or that concepts appear only there.
102
+ Recommend naming each tier (e.g. "Memories → Concepts → Connections") and
103
+ showing the current tier label, so the hierarchy is recognizable, not a hidden
104
+ numeric mode.
105
+ - **#7 Flexibility & efficiency** — RISK: capping visible nodes (6–8) aids
106
+ focus but can hide relevant memory with no "show more" affordance; verify an
107
+ expansion path exists for power users.
108
+
109
+ ## Journey 5 — Slow first run
110
+
111
+ Surface: `frontend/src/components/onboarding/InstallScreen.tsx`,
112
+ `.../DownloadConsentPanel.tsx`; backing `latticeai/services/model_runtime.py`.
113
+
114
+ - First run is staged and streamed: `InstallStage` = idle→install→download→
115
+ validate→load→done (`InstallScreen.tsx:12`), a live `percent` bar
116
+ (`:28`, `:44`, `:119`) fed by `streamModelPrepare` (`:38`), plus an up-front
117
+ time estimate line (`:86`, `expectedLine` at `:158` using
118
+ `estimatedDownloadMinutes` / `estimatedFirstResponseSeconds`).
119
+ - Download size and consent are disclosed **before** the download begins
120
+ (`DownloadConsentPanel.tsx:9`, `:18-24`).
121
+
122
+ Heuristics:
123
+ - **#1 Visibility of system status** — STRONG: staged progress + percent + ETA
124
+ is close to the textbook remedy for a long wait; the slow first run is
125
+ *communicated*, not silent.
126
+ - **#5 Error prevention / #3 control** — GOOD: size + consent before a large
127
+ download respects the user's bandwidth and choice.
128
+ - **RISK** — the ETA is a static estimate from catalog metadata
129
+ (`estimatedDownloadMinutes`), not a live-adjusted projection; on a slow link
130
+ the bar can stall while the estimate reads optimistically. Recommend deriving
131
+ a live ETA from observed `event.percent` throughput and clearly marking the
132
+ initial number as an estimate. Also confirm a **failure** path exists on the
133
+ `error` stage (`InstallScreen.tsx:12`) with a retry, not a dead end (#9).
134
+
135
+ ## Cross-cutting findings
136
+
137
+ - **#4 Consistency & standards** — i18n has an explicit ko/en fallback discipline
138
+ (e.g. `brain.sources.fallback` in both `frontend/src/i18n/brain.ts:643` and
139
+ `:1301`). Keep en/ko key parity enforced (the repo already has an i18n literal
140
+ check) so no screen silently falls back to Korean for an English user.
141
+ - **#10 Documentation** — onboarding leans on progressive UI over docs, which is
142
+ good, but the abstract controls (Brain depth) would benefit from inline
143
+ first-use hints.
144
+
145
+ ## Priority recommendations (heuristic — validate with real users)
146
+
147
+ 1. **Make `NEEDS_REVIEW` visually distinct from `DONE`** in agent completion
148
+ (Journey 2) — highest risk of a false "it shipped" mental model.
149
+ 2. **Show a diff + plain-language "why staged" on every change proposal**
150
+ (Journey 3) so approval is informed.
151
+ 3. **Name the Brain hierarchy tiers and show the current tier** (Journey 4) to
152
+ convert an abstract depth control into recognizable structure.
153
+ 4. **Live-adjust the first-run ETA and label estimates as estimates**
154
+ (Journeys 1 & 5).
155
+ 5. **Verify the install `error` stage offers a retry** (Journey 5, #9).
156
+
157
+ ## Limitations (honest)
158
+
159
+ - Expert heuristic evaluation only; no real users, no task-success metrics, no
160
+ time-on-task, no accessibility audit (screen-reader/keyboard) beyond noting
161
+ `aria-hidden` usage.
162
+ - Frontend runtime behavior was inferred from source, not driven live in this
163
+ pass; timing/animation claims should be confirmed in a running build.
164
+ - Severity is the evaluator's judgment, not a measured frequency × impact.
@@ -1,6 +1,6 @@
1
1
  # Why Lattice AI Exists
2
2
 
3
- Current release: **9.7.0 — Proactive Hybrid Brain**.
3
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
4
 
5
5
  **Lattice AI is a local-first Digital Brain that keeps your knowledge durable
6
6
  across any AI model.**
@@ -1,8 +1,10 @@
1
1
  # Lattice AI Architecture
2
2
 
3
- > Historical subsystem note. The canonical current architecture document is
3
+ > **Status: historical** — subsystem note preserved for background. The
4
+ > canonical current architecture document is
4
5
  > [`ARCHITECTURE.md`](../ARCHITECTURE.md). This file preserves the v3.6.0
5
- > Knowledge Graph First architecture detail for background.
6
+ > Knowledge Graph First architecture detail; its version and subsystem claims
7
+ > are intentionally frozen at that point in time.
6
8
 
7
9
  > v3.6.0 — **Knowledge Graph First.** Every data source converges into the graph
8
10
  > through one unified ingestion pipeline (`latticeai/services/ingestion.py`), with
package/docs/kg-schema.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Knowledge Graph Schema
2
2
 
3
- Current release: **9.7.0 — Proactive Hybrid Brain**.
3
+ Current release: **9.9.0 — Fail-Closed Trust**.
4
4
 
5
5
  명세 출처: `lattice_ai_full_spec.pptx` 슬라이드 20·21·22
6
6
  구현: `kg_schema.py`
@@ -1,6 +1,13 @@
1
1
  # Lattice AI — 명세(PPT) vs 구현(repo) 매핑
2
2
 
3
- `lattice_ai_full_spec.pptx` 사양과 현재 리포지토리 구현 사이의 정렬 상태를 장으로 정리한다.
3
+ > **Status: historical** 초기 PPT 명세 대비 갭을 정리한 스냅샷 문서다. 이후
4
+ > 여러 갭이 해소되었다(예: `src-tauri/`의 Tauri 데스크탑 셸, SQLite 라이브
5
+ > 스토어 + 임베딩/벡터 검색, 하이브리드 리트리벌 등). 현행 아키텍처의
6
+ > 단일 진실은 [`../ARCHITECTURE.md`](../ARCHITECTURE.md)와
7
+ > [`../FEATURE_STATUS.md`](../FEATURE_STATUS.md)이며, 아래 갭 서술은
8
+ > 작성 시점 기준으로 보존한다.
9
+
10
+ `lattice_ai_full_spec.pptx` 의 사양과 작성 시점 리포지토리 구현 사이의 정렬 상태를 한 장으로 정리한다.
4
11
  각 항목은 **목표(PPT) → 현재(repo) → 갭 → 보강 위치** 순으로 본다.
5
12
 
6
13
  ---
@@ -26,7 +26,7 @@ from .storage import (
26
26
  storage_from_env,
27
27
  )
28
28
 
29
- __version__ = "9.7.0"
29
+ __version__ = "9.9.0"
30
30
 
31
31
  __all__ = [
32
32
  "AgentRuntime",