know-cli 0.4.0__tar.gz → 0.4.2__tar.gz

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 (88) hide show
  1. {know_cli-0.4.0 → know_cli-0.4.2}/PKG-INFO +67 -106
  2. {know_cli-0.4.0 → know_cli-0.4.2}/README.md +52 -96
  3. know_cli-0.4.2/docs/arc.md +38 -0
  4. {know_cli-0.4.0 → know_cli-0.4.2}/docs/architecture.md +45 -57
  5. {know_cli-0.4.0 → know_cli-0.4.2}/docs/digest-llm.md +16 -16
  6. know_cli-0.4.2/docs/onboarding-new-devs.md +13 -0
  7. know_cli-0.4.2/docs/plans/2026-02-15-refactor-know-cli-v2-daemon-architecture-plan.md +834 -0
  8. know_cli-0.4.2/docs/plans/2026-02-16-fix-testing-issues-search-graph-performance-plan.md +100 -0
  9. know_cli-0.4.2/docs/solutions/architecture/p2-p3-architectural-improvements.md +157 -0
  10. {know_cli-0.4.0 → know_cli-0.4.2}/pyproject.toml +16 -11
  11. know_cli-0.4.2/src/know/IMPROVEMENTS.md +107 -0
  12. know_cli-0.4.2/src/know/__init__.py +8 -0
  13. know_cli-0.4.2/src/know/cli/__init__.py +173 -0
  14. know_cli-0.4.2/src/know/cli/agent.py +221 -0
  15. know_cli-0.4.2/src/know/cli/core.py +502 -0
  16. know_cli-0.4.2/src/know/cli/diff.py +65 -0
  17. know_cli-0.4.2/src/know/cli/hooks.py +65 -0
  18. know_cli-0.4.2/src/know/cli/knowledge.py +179 -0
  19. know_cli-0.4.2/src/know/cli/mcp.py +66 -0
  20. know_cli-0.4.2/src/know/cli/search.py +336 -0
  21. know_cli-0.4.2/src/know/cli/stats.py +170 -0
  22. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/context_engine.py +88 -35
  23. know_cli-0.4.2/src/know/daemon.py +456 -0
  24. know_cli-0.4.2/src/know/daemon_db.py +475 -0
  25. know_cli-0.4.2/src/know/embeddings.py +71 -0
  26. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/exceptions.py +0 -3
  27. know_cli-0.4.2/src/know/import_graph.py +211 -0
  28. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/index.py +4 -103
  29. know_cli-0.4.2/src/know/knowledge_base.py +313 -0
  30. know_cli-0.4.2/src/know/parsers.py +665 -0
  31. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/scanner.py +4 -19
  32. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/semantic_search.py +57 -419
  33. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/stats.py +88 -0
  34. know_cli-0.4.2/src/know/token_counter.py +112 -0
  35. {know_cli-0.4.0 → know_cli-0.4.2}/tests/conftest.py +0 -2
  36. know_cli-0.4.2/tests/test_token_features.py +76 -0
  37. know_cli-0.4.2/tests/test_v2_features.py +382 -0
  38. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_week2.py +7 -7
  39. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_week3.py +1 -1
  40. know_cli-0.4.0/REDESIGN_PLAN.md +0 -71
  41. know_cli-0.4.0/docs/IMPLEMENTATION_PLAN.md +0 -305
  42. know_cli-0.4.0/docs/IMPROVEMENTS.md +0 -72
  43. know_cli-0.4.0/docs/STRATEGIC_AUDIT.md +0 -624
  44. know_cli-0.4.0/docs/arc.md +0 -43
  45. know_cli-0.4.0/docs/onboarding-new-devs.md +0 -13
  46. know_cli-0.4.0/src/know/__init__.py +0 -26
  47. know_cli-0.4.0/src/know/cli.py +0 -2306
  48. know_cli-0.4.0/src/know/cost.py +0 -199
  49. know_cli-0.4.0/src/know/history.py +0 -163
  50. know_cli-0.4.0/src/know/import_graph.py +0 -337
  51. know_cli-0.4.0/src/know/knowledge_base.py +0 -354
  52. know_cli-0.4.0/src/know/lexical_index.py +0 -297
  53. know_cli-0.4.0/src/know/parsers.py +0 -527
  54. know_cli-0.4.0/src/know/state.py +0 -118
  55. know_cli-0.4.0/src/know/token_counter.py +0 -97
  56. know_cli-0.4.0/src/know/tools.py +0 -276
  57. know_cli-0.4.0/tests/mcp_stub/mcp/__init__.py +0 -11
  58. know_cli-0.4.0/tests/mcp_stub/mcp/server/__init__.py +0 -1
  59. know_cli-0.4.0/tests/mcp_stub/mcp/server/fastmcp.py +0 -44
  60. know_cli-0.4.0/tests/test_history_cost.py +0 -119
  61. know_cli-0.4.0/tests/test_search_hybrid.py +0 -162
  62. know_cli-0.4.0/tests/test_state.py +0 -62
  63. know_cli-0.4.0/tests/test_week6_tools.py +0 -124
  64. {know_cli-0.4.0 → know_cli-0.4.2}/.github/actions/know-cli/action.yml +0 -0
  65. {know_cli-0.4.0 → know_cli-0.4.2}/.github/workflows/example-advanced.yml +0 -0
  66. {know_cli-0.4.0 → know_cli-0.4.2}/.github/workflows/example-basic.yml +0 -0
  67. {know_cli-0.4.0 → know_cli-0.4.2}/.gitignore +0 -0
  68. {know_cli-0.4.0 → know_cli-0.4.2}/AGENTS.md +0 -0
  69. {know_cli-0.4.0 → know_cli-0.4.2}/KNOW_SKILL.md +0 -0
  70. {know_cli-0.4.0 → know_cli-0.4.2}/docs/architecture-diff.md +0 -0
  71. {know_cli-0.4.0 → know_cli-0.4.2}/docs/dependencies.md +0 -0
  72. {know_cli-0.4.0 → know_cli-0.4.2}/docs/digest-compact.md +0 -0
  73. {know_cli-0.4.0 → know_cli-0.4.2}/docs/onboarding-new_devs.md +0 -0
  74. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/ai.py +0 -0
  75. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/config.py +0 -0
  76. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/diff.py +0 -0
  77. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/generator.py +0 -0
  78. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/git_hooks.py +0 -0
  79. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/logger.py +0 -0
  80. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/mcp_server.py +0 -0
  81. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/models.py +0 -0
  82. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/quality.py +0 -0
  83. {know_cli-0.4.0 → know_cli-0.4.2}/src/know/watcher.py +0 -0
  84. {know_cli-0.4.0 → know_cli-0.4.2}/tests/README.md +0 -0
  85. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_efficiency.py +0 -0
  86. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_know.py +0 -0
  87. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_unit.py +0 -0
  88. {know_cli-0.4.0 → know_cli-0.4.2}/tests/test_week4.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: know-cli
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Context Intelligence for AI Coding Agents — smart, token-budgeted code context
5
- Project-URL: Homepage, https://github.com/vic/know-cli
6
- Project-URL: Repository, https://github.com/vic/know-cli
5
+ Project-URL: Homepage, https://github.com/sushilk1991/know-cli
6
+ Project-URL: Repository, https://github.com/sushilk1991/know-cli
7
7
  Author-email: Sushil Kumar <sushilk.1991@gmail.com>
8
8
  License-Expression: MIT
9
9
  Keywords: ai,cli,codebase,coding-agent,context,embeddings,llm,mcp,tokens
@@ -17,16 +17,24 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Topic :: Software Development :: Documentation
18
18
  Classifier: Topic :: Utilities
19
19
  Requires-Python: >=3.10
20
- Requires-Dist: anthropic>=0.8.0
21
20
  Requires-Dist: click>=8.1.0
22
- Requires-Dist: fastembed>=0.3.0
23
- Requires-Dist: httpx>=0.24.0
24
- Requires-Dist: numpy>=1.24.0
25
21
  Requires-Dist: pathspec>=0.11.0
26
22
  Requires-Dist: pyyaml>=6.0
27
23
  Requires-Dist: rich>=13.0.0
24
+ Requires-Dist: tiktoken>=0.5.0
25
+ Requires-Dist: tree-sitter-c>=0.23.0
26
+ Requires-Dist: tree-sitter-go>=0.23.0
27
+ Requires-Dist: tree-sitter-java>=0.23.0
28
+ Requires-Dist: tree-sitter-javascript>=0.23.0
29
+ Requires-Dist: tree-sitter-python>=0.23.0
30
+ Requires-Dist: tree-sitter-ruby>=0.23.0
31
+ Requires-Dist: tree-sitter-rust>=0.23.0
32
+ Requires-Dist: tree-sitter-typescript>=0.23.0
33
+ Requires-Dist: tree-sitter>=0.24.0
28
34
  Requires-Dist: watchdog>=3.0.0
29
35
  Requires-Dist: xxhash>=3.0.0
36
+ Provides-Extra: ai
37
+ Requires-Dist: anthropic>=0.8.0; extra == 'ai'
30
38
  Provides-Extra: dev
31
39
  Requires-Dist: black>=23.0.0; extra == 'dev'
32
40
  Requires-Dist: mypy>=1.0.0; extra == 'dev'
@@ -36,9 +44,6 @@ Requires-Dist: pytest>=7.0.0; extra == 'dev'
36
44
  Requires-Dist: ruff>=0.1.0; extra == 'dev'
37
45
  Provides-Extra: mcp
38
46
  Requires-Dist: mcp>=1.0.0; extra == 'mcp'
39
- Provides-Extra: parser
40
- Requires-Dist: tree-sitter-languages>=1.10.0; extra == 'parser'
41
- Requires-Dist: tree-sitter>=0.20.0; extra == 'parser'
42
47
  Provides-Extra: search
43
48
  Requires-Dist: fastembed>=0.3.0; extra == 'search'
44
49
  Requires-Dist: numpy>=1.24.0; extra == 'search'
@@ -68,6 +73,8 @@ AI coding agents dump entire files into context. Every `@file` reference, every
68
73
  - 📊 Import graph knows what depends on what
69
74
  - 🧠 Cross-session memory means agents never re-discover the same things
70
75
  - 💰 Token budgeting keeps costs predictable
76
+ - ⚡ Background daemon for sub-100ms query latency
77
+ - 🤖 Agent-native commands (`next-file`, `signatures`, `related`) for autonomous workflows
71
78
 
72
79
  **60-80% fewer tokens. Same (or better) results.**
73
80
 
@@ -84,6 +91,8 @@ know context "help me fix the auth bug" --budget 4000
84
91
 
85
92
  That's it. You just got the most relevant code for your task, packed into exactly 4000 tokens.
86
93
 
94
+ The background daemon starts automatically on first use — subsequent queries return in under 100ms.
95
+
87
96
  ---
88
97
 
89
98
  ## Works With
@@ -129,39 +138,17 @@ know recall "how does auth work?"
129
138
 
130
139
  Memories are automatically included in `know context` results. Your agent gets smarter over time.
131
140
 
132
- ### 🔍 Search — `know search` (Hybrid like qmd)
141
+ ### 🔍 Semantic Search — `know search`
133
142
 
134
- Hybrid retrieval by default:
135
- - **Lexical**: SQLite **FTS5** (BM25 ranking) over chunk text + metadata
136
- - **Vector**: embeddings via **fastembed** (when installed)
137
- - **Deterministic rerank**: **Reciprocal Rank Fusion (RRF)**
143
+ Real embeddings, not grep. Understands meaning, not just keywords.
138
144
 
139
145
  ```bash
140
- # Default: hybrid (FTS + vectors when available)
141
146
  know search "error handling"
142
-
143
- # JSON output (stable schema)
144
- know --json search "database connection pooling" --top-k 10
145
- # (also supported after the command)
146
147
  know search "database connection pooling" --top-k 10 --json
147
-
148
- Notes:
149
- - Queries with punctuation (e.g. `click.option`) are normalized for lexical search.
150
- - Results downweight docs/tests so source code tends to rank higher.
151
- # Force engine
152
- know search "authentication" --engine lexical
153
- know search "authentication" --engine vector
154
-
155
- # Filters
156
- know search "jwt" --path src/auth/ --type py
157
-
158
- # Better snippets
159
- know search "retry" --line-numbers
148
+ know search "authentication" --chunk # Search at function level
160
149
  ```
161
150
 
162
- Notes:
163
- - The FTS index is stored in: `.know/cache/index.db` (table: `chunks_fts`).
164
- - If **FTS5** and/or **fastembed** are unavailable, `know search` gracefully falls back.
151
+ Uses [fastembed](https://github.com/qdrant/fastembed) (BAAI/bge-small-en-v1.5) — runs locally, no API calls.
165
152
 
166
153
  ### 📊 Import Graph — `know graph`
167
154
 
@@ -197,76 +184,38 @@ know mcp config # Print Claude Desktop config
197
184
 
198
185
  **MCP Resources:** `codebase://digest`, `codebase://structure`, `codebase://memories`
199
186
 
200
- ### 🛠 Tool Discovery — `know tools`
187
+ ### 🤖 Agent Commands
201
188
 
202
- Find runnable project tools so agents stop guessing commands.
189
+ Purpose-built for autonomous AI agent workflows.
203
190
 
204
191
  ```bash
205
- know tools list
206
- know tools search "database"
207
- know tools suggest "deploy"
208
- know --output-format markdown tools list
192
+ know next-file "authentication" --exclude src/auth/old.py
193
+ know signatures src/auth/middleware.py
194
+ know related src/auth/middleware.py
195
+ know generate-context --budget 8000
196
+ know diff --since "3 days ago"
209
197
  ```
210
198
 
211
- Scans common sources: `scripts/`, `bin/`, `tools/`, `package.json` scripts, `Makefile` targets, Python CLIs, `docker-compose` services, and GitHub Actions workflows.
212
-
213
- ### 🧭 Agent State `know state`
214
-
215
- Track active task progress and create checkpoints you can restore later.
216
-
217
- ```bash
218
- know state set --task "fix auth bug" --progress "analyzed middleware"
219
- know state get
220
- know state checkpoint --name "before refactor"
221
- know state restore cp_1739078400
222
- ```
223
-
224
- ### 🗂 Execution History — `know history`
225
-
226
- Log what you tried and whether it worked.
227
-
228
- ```bash
229
- know history log --command "npm test" --result failed --reason "missing env var"
230
- know history search "test" --result failed
231
- know history success-rate "deploy"
232
- ```
233
-
234
- ### 💸 Cost Analytics — `know cost`
235
-
236
- Analyze token usage and estimated cost from local telemetry.
237
- If exact pricing/baseline data is unavailable, know reports fallback estimates and `unknown_fields` explicitly.
238
-
239
- ```bash
240
- know cost summary
241
- know cost by-query --limit 5
242
- know cost savings
243
- know cost budget --limit 100000
244
- ```
245
-
246
- ### ⚡ Quick File Context — `know quick`
247
-
248
- Get a minimal context bundle for one file (default 500-token budget).
249
-
250
- ```bash
251
- know quick src/auth.py
252
- know quick src/auth.py --budget 800 --json
253
- ```
199
+ | Command | Description |
200
+ |---------|-------------|
201
+ | `know next-file "query"` | Return the single most relevant file for a query |
202
+ | `know signatures [file]` | Get function/class signatures for a file or project |
203
+ | `know related <file>` | Show import dependencies and dependents |
204
+ | `know generate-context` | Generate `.know/CONTEXT.md` for agents to read on session start |
205
+ | `know diff --since "1 week ago"` | Show architectural changes over time |
254
206
 
255
- ### 🔗 Dependency Neighbors — `know related`
207
+ ### Background Daemon
256
208
 
257
- See what a file imports and what imports it.
209
+ A Unix socket daemon keeps indexes in memory for instant responses.
258
210
 
259
211
  ```bash
260
- know related src/auth.py
212
+ know status # Shows daemon status, index age, cache size
261
213
  ```
262
214
 
263
- ### 📊 Module Summaries `know summarize`
264
-
265
- One-sentence summary for each module in the codebase.
266
-
267
- ```bash
268
- know summarize --limit 50
269
- ```
215
+ - Starts automatically on first CLI call
216
+ - Serves search, signatures, related, and memory queries over IPC
217
+ - Falls back to direct SQLite access if daemon is unavailable
218
+ - Disable with `KNOW_NO_DAEMON=1` for CI/CD environments
270
219
 
271
220
  ### 📈 Usage Stats — `know stats`
272
221
 
@@ -361,31 +310,29 @@ know status --json
361
310
  | `know remember "text"` | Store a memory |
362
311
  | `know recall "query"` | Recall memories |
363
312
  | `know forget <id>` | Delete a memory |
313
+ | `know memories list` | List all memories |
364
314
  | `know graph <file>` | Show import dependencies |
365
- | `know quick <file>` | Minimal context for one file |
366
- | `know related <file>` | Show import/dependent neighbors for a file |
367
- | `know summarize` | One-line module summaries |
368
315
  | `know explain -c <name>` | AI-explain a component |
369
316
  | `know stats` | Usage statistics |
370
317
  | `know status` | Project health check |
371
- | `know tools list` | List discovered project tools |
372
- | `know tools search "query"` | Search for tools |
373
- | `know tools suggest "intent"` | Suggest relevant tools for a task |
374
- | `know state set/get/checkpoint/restore` | Manage agent task state |
375
- | `know history log/search/success-rate` | Track command outcomes |
376
- | `know cost summary/by-query/savings/budget` | Token/cost analytics + budget |
377
318
  | `know reindex` | Rebuild search index |
378
319
  | `know mcp serve` | Start MCP server |
379
320
  | `know mcp config` | Print MCP client config |
380
321
  | `know digest` | Generate codebase summary |
381
322
  | `know watch` | Auto-update on file changes |
323
+ | `know next-file "query"` | Best file for a query (agent use) |
324
+ | `know signatures [file]` | Function/class signatures |
325
+ | `know related <file>` | Import deps and dependents |
326
+ | `know generate-context` | Generate `.know/CONTEXT.md` |
327
+ | `know diff --since "1w"` | Architectural changes over time |
328
+ | `know hooks install` | Install git hooks for auto-update |
329
+ | `know hooks uninstall` | Remove git hooks |
382
330
 
383
331
  ### Global Flags
384
332
 
385
333
  | Flag | Description |
386
334
  |------|-------------|
387
335
  | `--json` | Machine-readable JSON output |
388
- | `--output-format markdown` | Human-readable markdown output for supported commands |
389
336
  | `--quiet` | Minimal output |
390
337
  | `--verbose` | Detailed output |
391
338
  | `--time` | Show execution time |
@@ -433,6 +380,8 @@ Your Query → know context
433
380
 
434
381
  All processing is **local**. Embeddings run on your machine. No data leaves your laptop (except `know explain` which calls Claude API).
435
382
 
383
+ Semantic search via [fastembed](https://github.com/qdrant/fastembed) is optional — install with `pip install know-cli[search]`. Without it, know uses fast BM25 full-text search as the default.
384
+
436
385
  ---
437
386
 
438
387
  ## Configuration
@@ -475,10 +424,22 @@ exclude_paths:
475
424
 
476
425
  ---
477
426
 
427
+ ## Architecture
428
+
429
+ ```
430
+ .know/
431
+ config.yaml # Project configuration
432
+ daemon.db # Unified SQLite database (chunks, memories, imports)
433
+ cache/
434
+ index.db # Scanner cache
435
+ ```
436
+
437
+ **Single database:** All data (code chunks, memories, import graph) lives in one SQLite database with WAL mode for concurrent access. The background daemon keeps it in memory; CLI commands fall back to direct access when the daemon is unavailable.
438
+
478
439
  ## Contributing
479
440
 
480
441
  ```bash
481
- git clone https://github.com/vic/know-cli
442
+ git clone https://github.com/sushilk1991/know-cli
482
443
  cd know-cli
483
444
  pip install -e ".[dev,search,mcp]"
484
445
  python -m pytest tests/ -v
@@ -22,6 +22,8 @@ AI coding agents dump entire files into context. Every `@file` reference, every
22
22
  - 📊 Import graph knows what depends on what
23
23
  - 🧠 Cross-session memory means agents never re-discover the same things
24
24
  - 💰 Token budgeting keeps costs predictable
25
+ - ⚡ Background daemon for sub-100ms query latency
26
+ - 🤖 Agent-native commands (`next-file`, `signatures`, `related`) for autonomous workflows
25
27
 
26
28
  **60-80% fewer tokens. Same (or better) results.**
27
29
 
@@ -38,6 +40,8 @@ know context "help me fix the auth bug" --budget 4000
38
40
 
39
41
  That's it. You just got the most relevant code for your task, packed into exactly 4000 tokens.
40
42
 
43
+ The background daemon starts automatically on first use — subsequent queries return in under 100ms.
44
+
41
45
  ---
42
46
 
43
47
  ## Works With
@@ -83,39 +87,17 @@ know recall "how does auth work?"
83
87
 
84
88
  Memories are automatically included in `know context` results. Your agent gets smarter over time.
85
89
 
86
- ### 🔍 Search — `know search` (Hybrid like qmd)
90
+ ### 🔍 Semantic Search — `know search`
87
91
 
88
- Hybrid retrieval by default:
89
- - **Lexical**: SQLite **FTS5** (BM25 ranking) over chunk text + metadata
90
- - **Vector**: embeddings via **fastembed** (when installed)
91
- - **Deterministic rerank**: **Reciprocal Rank Fusion (RRF)**
92
+ Real embeddings, not grep. Understands meaning, not just keywords.
92
93
 
93
94
  ```bash
94
- # Default: hybrid (FTS + vectors when available)
95
95
  know search "error handling"
96
-
97
- # JSON output (stable schema)
98
- know --json search "database connection pooling" --top-k 10
99
- # (also supported after the command)
100
96
  know search "database connection pooling" --top-k 10 --json
101
-
102
- Notes:
103
- - Queries with punctuation (e.g. `click.option`) are normalized for lexical search.
104
- - Results downweight docs/tests so source code tends to rank higher.
105
- # Force engine
106
- know search "authentication" --engine lexical
107
- know search "authentication" --engine vector
108
-
109
- # Filters
110
- know search "jwt" --path src/auth/ --type py
111
-
112
- # Better snippets
113
- know search "retry" --line-numbers
97
+ know search "authentication" --chunk # Search at function level
114
98
  ```
115
99
 
116
- Notes:
117
- - The FTS index is stored in: `.know/cache/index.db` (table: `chunks_fts`).
118
- - If **FTS5** and/or **fastembed** are unavailable, `know search` gracefully falls back.
100
+ Uses [fastembed](https://github.com/qdrant/fastembed) (BAAI/bge-small-en-v1.5) — runs locally, no API calls.
119
101
 
120
102
  ### 📊 Import Graph — `know graph`
121
103
 
@@ -151,76 +133,38 @@ know mcp config # Print Claude Desktop config
151
133
 
152
134
  **MCP Resources:** `codebase://digest`, `codebase://structure`, `codebase://memories`
153
135
 
154
- ### 🛠 Tool Discovery — `know tools`
136
+ ### 🤖 Agent Commands
155
137
 
156
- Find runnable project tools so agents stop guessing commands.
138
+ Purpose-built for autonomous AI agent workflows.
157
139
 
158
140
  ```bash
159
- know tools list
160
- know tools search "database"
161
- know tools suggest "deploy"
162
- know --output-format markdown tools list
141
+ know next-file "authentication" --exclude src/auth/old.py
142
+ know signatures src/auth/middleware.py
143
+ know related src/auth/middleware.py
144
+ know generate-context --budget 8000
145
+ know diff --since "3 days ago"
163
146
  ```
164
147
 
165
- Scans common sources: `scripts/`, `bin/`, `tools/`, `package.json` scripts, `Makefile` targets, Python CLIs, `docker-compose` services, and GitHub Actions workflows.
166
-
167
- ### 🧭 Agent State `know state`
168
-
169
- Track active task progress and create checkpoints you can restore later.
170
-
171
- ```bash
172
- know state set --task "fix auth bug" --progress "analyzed middleware"
173
- know state get
174
- know state checkpoint --name "before refactor"
175
- know state restore cp_1739078400
176
- ```
177
-
178
- ### 🗂 Execution History — `know history`
179
-
180
- Log what you tried and whether it worked.
181
-
182
- ```bash
183
- know history log --command "npm test" --result failed --reason "missing env var"
184
- know history search "test" --result failed
185
- know history success-rate "deploy"
186
- ```
187
-
188
- ### 💸 Cost Analytics — `know cost`
189
-
190
- Analyze token usage and estimated cost from local telemetry.
191
- If exact pricing/baseline data is unavailable, know reports fallback estimates and `unknown_fields` explicitly.
192
-
193
- ```bash
194
- know cost summary
195
- know cost by-query --limit 5
196
- know cost savings
197
- know cost budget --limit 100000
198
- ```
199
-
200
- ### ⚡ Quick File Context — `know quick`
201
-
202
- Get a minimal context bundle for one file (default 500-token budget).
203
-
204
- ```bash
205
- know quick src/auth.py
206
- know quick src/auth.py --budget 800 --json
207
- ```
148
+ | Command | Description |
149
+ |---------|-------------|
150
+ | `know next-file "query"` | Return the single most relevant file for a query |
151
+ | `know signatures [file]` | Get function/class signatures for a file or project |
152
+ | `know related <file>` | Show import dependencies and dependents |
153
+ | `know generate-context` | Generate `.know/CONTEXT.md` for agents to read on session start |
154
+ | `know diff --since "1 week ago"` | Show architectural changes over time |
208
155
 
209
- ### 🔗 Dependency Neighbors — `know related`
156
+ ### Background Daemon
210
157
 
211
- See what a file imports and what imports it.
158
+ A Unix socket daemon keeps indexes in memory for instant responses.
212
159
 
213
160
  ```bash
214
- know related src/auth.py
161
+ know status # Shows daemon status, index age, cache size
215
162
  ```
216
163
 
217
- ### 📊 Module Summaries `know summarize`
218
-
219
- One-sentence summary for each module in the codebase.
220
-
221
- ```bash
222
- know summarize --limit 50
223
- ```
164
+ - Starts automatically on first CLI call
165
+ - Serves search, signatures, related, and memory queries over IPC
166
+ - Falls back to direct SQLite access if daemon is unavailable
167
+ - Disable with `KNOW_NO_DAEMON=1` for CI/CD environments
224
168
 
225
169
  ### 📈 Usage Stats — `know stats`
226
170
 
@@ -315,31 +259,29 @@ know status --json
315
259
  | `know remember "text"` | Store a memory |
316
260
  | `know recall "query"` | Recall memories |
317
261
  | `know forget <id>` | Delete a memory |
262
+ | `know memories list` | List all memories |
318
263
  | `know graph <file>` | Show import dependencies |
319
- | `know quick <file>` | Minimal context for one file |
320
- | `know related <file>` | Show import/dependent neighbors for a file |
321
- | `know summarize` | One-line module summaries |
322
264
  | `know explain -c <name>` | AI-explain a component |
323
265
  | `know stats` | Usage statistics |
324
266
  | `know status` | Project health check |
325
- | `know tools list` | List discovered project tools |
326
- | `know tools search "query"` | Search for tools |
327
- | `know tools suggest "intent"` | Suggest relevant tools for a task |
328
- | `know state set/get/checkpoint/restore` | Manage agent task state |
329
- | `know history log/search/success-rate` | Track command outcomes |
330
- | `know cost summary/by-query/savings/budget` | Token/cost analytics + budget |
331
267
  | `know reindex` | Rebuild search index |
332
268
  | `know mcp serve` | Start MCP server |
333
269
  | `know mcp config` | Print MCP client config |
334
270
  | `know digest` | Generate codebase summary |
335
271
  | `know watch` | Auto-update on file changes |
272
+ | `know next-file "query"` | Best file for a query (agent use) |
273
+ | `know signatures [file]` | Function/class signatures |
274
+ | `know related <file>` | Import deps and dependents |
275
+ | `know generate-context` | Generate `.know/CONTEXT.md` |
276
+ | `know diff --since "1w"` | Architectural changes over time |
277
+ | `know hooks install` | Install git hooks for auto-update |
278
+ | `know hooks uninstall` | Remove git hooks |
336
279
 
337
280
  ### Global Flags
338
281
 
339
282
  | Flag | Description |
340
283
  |------|-------------|
341
284
  | `--json` | Machine-readable JSON output |
342
- | `--output-format markdown` | Human-readable markdown output for supported commands |
343
285
  | `--quiet` | Minimal output |
344
286
  | `--verbose` | Detailed output |
345
287
  | `--time` | Show execution time |
@@ -387,6 +329,8 @@ Your Query → know context
387
329
 
388
330
  All processing is **local**. Embeddings run on your machine. No data leaves your laptop (except `know explain` which calls Claude API).
389
331
 
332
+ Semantic search via [fastembed](https://github.com/qdrant/fastembed) is optional — install with `pip install know-cli[search]`. Without it, know uses fast BM25 full-text search as the default.
333
+
390
334
  ---
391
335
 
392
336
  ## Configuration
@@ -429,10 +373,22 @@ exclude_paths:
429
373
 
430
374
  ---
431
375
 
376
+ ## Architecture
377
+
378
+ ```
379
+ .know/
380
+ config.yaml # Project configuration
381
+ daemon.db # Unified SQLite database (chunks, memories, imports)
382
+ cache/
383
+ index.db # Scanner cache
384
+ ```
385
+
386
+ **Single database:** All data (code chunks, memories, import graph) lives in one SQLite database with WAL mode for concurrent access. The background daemon keeps it in memory; CLI commands fall back to direct access when the daemon is unavailable.
387
+
432
388
  ## Contributing
433
389
 
434
390
  ```bash
435
- git clone https://github.com/vic/know-cli
391
+ git clone https://github.com/sushilk1991/know-cli
436
392
  cd know-cli
437
393
  pip install -e ".[dev,search,mcp]"
438
394
  python -m pytest tests/ -v
@@ -0,0 +1,38 @@
1
+ # know-cli
2
+
3
+
4
+
5
+ *Generated by [know](https://github.com/sushilk1991/know-cli)*
6
+
7
+
8
+ ## 📁 Project Structure
9
+
10
+ - **[src.know.ai](src/know/ai.py)** - AI integration for intelligent code understanding with advanced token optimization.
11
+ - **[src.know.diff](src/know/diff.py)** - Diff mode for tracking architectural changes safely using git worktrees.
12
+ - **[src.know.knowledge_base](src/know/knowledge_base.py)** - Knowledge base: cross-session memory for AI agents.
13
+ - **[src.know.index](src/know/index.py)** - Index management for incremental code scanning.
14
+ - **[src.know.logger](src/know/logger.py)** - Logging configuration for know.
15
+ - **[src.know.watcher](src/know/watcher.py)** - File system watcher for auto-updating documentation.
16
+ - **[src.know.models](src/know/models.py)** - Data models for know-cli.
17
+ - **[src.know.token_counter](src/know/token_counter.py)** - Token counting for context budget management.
18
+ - **[src.know.model_router](src/know/model_router.py)** - Smart model router for cost-optimized AI interactions.
19
+ - **[src.know.stats](src/know/stats.py)** - Usage statistics tracker for know-cli.
20
+ - **[src.know.semantic_search](src/know/semantic_search.py)** - Semantic code search using real embeddings and vector similarity.
21
+ - **[src.know.__init__](src/know/__init__.py)** - know - Living documentation generator for codebases.
22
+ - **[src.know.cli](src/know/cli.py)** - CLI entry point for know.
23
+ - **[src.know.generator](src/know/generator.py)** - Documentation generator.
24
+ - **[src.know.config](src/know/config.py)** - Configuration management for know.
25
+ - ... and 8 more modules
26
+
27
+ ## 📊 Statistics
28
+
29
+ - **Files:** 23
30
+ - **Modules:** 23
31
+ - **Functions:** 57
32
+ - **Classes:** 47
33
+
34
+ ---
35
+
36
+ *Generated by [know](https://github.com/sushilk1991/know-cli) v1.0.0*
37
+
38
+ Run `know update` to refresh this documentation.