contextos-vault 1.5.0__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 (77) hide show
  1. contextos_vault-1.5.0/.continue/config.json +13 -0
  2. contextos_vault-1.5.0/.cursorrules +9 -0
  3. contextos_vault-1.5.0/.kiro/hooks/contextos-prefetch.json +12 -0
  4. contextos_vault-1.5.0/AGENTS.md +355 -0
  5. contextos_vault-1.5.0/CHANGELOG.md +132 -0
  6. contextos_vault-1.5.0/CLAUDE.md +34 -0
  7. contextos_vault-1.5.0/CONTRIBUTING.md +139 -0
  8. contextos_vault-1.5.0/LICENSE +21 -0
  9. contextos_vault-1.5.0/MANIFEST.in +32 -0
  10. contextos_vault-1.5.0/PKG-INFO +1031 -0
  11. contextos_vault-1.5.0/README.md +950 -0
  12. contextos_vault-1.5.0/SECURITY.md +44 -0
  13. contextos_vault-1.5.0/contextos/__init__.py +3 -0
  14. contextos_vault-1.5.0/contextos/api.py +487 -0
  15. contextos_vault-1.5.0/contextos/auth.py +257 -0
  16. contextos_vault-1.5.0/contextos/cache_layer.py +135 -0
  17. contextos_vault-1.5.0/contextos/chunker.py +153 -0
  18. contextos_vault-1.5.0/contextos/cli.py +2302 -0
  19. contextos_vault-1.5.0/contextos/compressor.py +91 -0
  20. contextos_vault-1.5.0/contextos/config.py +145 -0
  21. contextos_vault-1.5.0/contextos/connectors/__init__.py +28 -0
  22. contextos_vault-1.5.0/contextos/connectors/base.py +119 -0
  23. contextos_vault-1.5.0/contextos/connectors/github.py +220 -0
  24. contextos_vault-1.5.0/contextos/connectors/json_source.py +224 -0
  25. contextos_vault-1.5.0/contextos/connectors/openapi.py +275 -0
  26. contextos_vault-1.5.0/contextos/dashboard.py +402 -0
  27. contextos_vault-1.5.0/contextos/embedder.py +153 -0
  28. contextos_vault-1.5.0/contextos/evaluator.py +221 -0
  29. contextos_vault-1.5.0/contextos/graph.py +196 -0
  30. contextos_vault-1.5.0/contextos/ingestors/__init__.py +64 -0
  31. contextos_vault-1.5.0/contextos/ingestors/docx.py +128 -0
  32. contextos_vault-1.5.0/contextos/ingestors/pdf.py +72 -0
  33. contextos_vault-1.5.0/contextos/ingestors/pptx.py +128 -0
  34. contextos_vault-1.5.0/contextos/logger.py +244 -0
  35. contextos_vault-1.5.0/contextos/mcp_server.py +478 -0
  36. contextos_vault-1.5.0/contextos/memory.py +234 -0
  37. contextos_vault-1.5.0/contextos/plugins.py +190 -0
  38. contextos_vault-1.5.0/contextos/py.typed +0 -0
  39. contextos_vault-1.5.0/contextos/retrieval.py +275 -0
  40. contextos_vault-1.5.0/contextos/scaffolder.py +166 -0
  41. contextos_vault-1.5.0/contextos/schema.py +189 -0
  42. contextos_vault-1.5.0/contextos/session.py +299 -0
  43. contextos_vault-1.5.0/contextos/store.py +448 -0
  44. contextos_vault-1.5.0/contextos/symbols.py +223 -0
  45. contextos_vault-1.5.0/contextos/templates/__init__.py +0 -0
  46. contextos_vault-1.5.0/contextos/templates/api-first/architecture/api.md +47 -0
  47. contextos_vault-1.5.0/contextos/templates/default/architecture/overview.md +33 -0
  48. contextos_vault-1.5.0/contextos/templates/default/context/current.md +35 -0
  49. contextos_vault-1.5.0/contextos/templates/default/decisions/ADR-001-example.md +36 -0
  50. contextos_vault-1.5.0/contextos/templates/default/domain/entity.md +32 -0
  51. contextos_vault-1.5.0/contextos/templates/default/product/vision.md +32 -0
  52. contextos_vault-1.5.0/contextos/templates/default/workflows/example-flow.md +35 -0
  53. contextos_vault-1.5.0/contextos/templates/microservice/architecture/service.md +44 -0
  54. contextos_vault-1.5.0/contextos/ui.py +155 -0
  55. contextos_vault-1.5.0/contextos/vault.py +314 -0
  56. contextos_vault-1.5.0/contextos/watcher.py +222 -0
  57. contextos_vault-1.5.0/contextos_vault.egg-info/SOURCES.txt +75 -0
  58. contextos_vault-1.5.0/eval/contextos-questions.json +58 -0
  59. contextos_vault-1.5.0/eval/questions.json.example +37 -0
  60. contextos_vault-1.5.0/examples/my-project/architecture/backend.md +56 -0
  61. contextos_vault-1.5.0/examples/my-project/context/current-sprint.md +45 -0
  62. contextos_vault-1.5.0/examples/my-project/decisions/ADR-001-use-postgres.md +47 -0
  63. contextos_vault-1.5.0/examples/my-project/decisions/ADR-002-event-sourcing.md +42 -0
  64. contextos_vault-1.5.0/examples/my-project/domain/booking.md +63 -0
  65. contextos_vault-1.5.0/examples/my-project/domain/payment.md +51 -0
  66. contextos_vault-1.5.0/examples/my-project/product/vision.md +36 -0
  67. contextos_vault-1.5.0/examples/my-project/workflows/booking-flow.md +59 -0
  68. contextos_vault-1.5.0/mcp.json.example +11 -0
  69. contextos_vault-1.5.0/pyproject.toml +105 -0
  70. contextos_vault-1.5.0/setup.cfg +8 -0
  71. contextos_vault-1.5.0/tests/test_e2e.py +590 -0
  72. contextos_vault-1.5.0/tests/test_smoke.py +248 -0
  73. contextos_vault-1.5.0/tests/test_v11.py +228 -0
  74. contextos_vault-1.5.0/tests/test_v12.py +518 -0
  75. contextos_vault-1.5.0/tests/test_v13.py +519 -0
  76. contextos_vault-1.5.0/tests/test_v14.py +527 -0
  77. contextos_vault-1.5.0/tests/test_v14_fixes.py +455 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "models": [],
3
+ "contextProviders": [
4
+ {
5
+ "name": "http",
6
+ "params": {
7
+ "url": "http://127.0.0.1:8080/context",
8
+ "title": "ContextOS",
9
+ "description": "Local project knowledge vault"
10
+ }
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,9 @@
1
+ # ContextOS Integration
2
+ Before every task, retrieve context from ContextOS:
3
+
4
+ curl -s -X POST http://127.0.0.1:8080/context \
5
+ -H "Authorization: Bearer $CONTEXTOS_TOKEN" \
6
+ -H "Content-Type: application/json" \
7
+ -d '{"query": "<your task>", "project": "<project-name>"}'
8
+
9
+ After completing a task: run `context index` to update the knowledge graph.
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "ContextOS Prefetch",
3
+ "version": "1.0.0",
4
+ "description": "Fetches structured project context from ContextOS before every Kiro task. Injects architecture decisions, domain models, and current sprint context automatically.",
5
+ "when": {
6
+ "type": "preTaskExecution"
7
+ },
8
+ "then": {
9
+ "type": "askAgent",
10
+ "prompt": "Before starting this task, retrieve relevant project context from ContextOS. Call: curl -s -X POST http://127.0.0.1:8080/context -H \"Authorization: Bearer $CONTEXTOS_TOKEN\" -H \"Content-Type: application/json\" -d \"{\\\"query\\\": \\\"{{task}}\\\", \\\"project\\\": \\\"{{project}}\\\", \\\"max_tokens\\\": 4000}\". Use the returned context block to inform your implementation. If the server is not running, proceed without it."
11
+ }
12
+ }
@@ -0,0 +1,355 @@
1
+ # ContextOS — Agent Rulebook & Operating Manual
2
+
3
+ ## What is ContextOS?
4
+
5
+ ContextOS is a 100% local, filesystem-native knowledge operating system for software projects. It is both:
6
+ 1. **A tool you USE** — to give yourself persistent project memory across sessions
7
+ 2. **A codebase you MAINTAIN** — this repo is the ContextOS source code
8
+
9
+ As an AI coding agent working in this repo, you must use ContextOS itself while you build it (dogfooding).
10
+
11
+ ---
12
+
13
+ ## Quick Start for Agents (Read First)
14
+
15
+ ### Step 1 — Install
16
+ ```bash
17
+ pip install -e .
18
+ ```
19
+
20
+ ### Step 2 — Initialize in this repo
21
+ ```bash
22
+ context init
23
+ ```
24
+
25
+ ### Step 3 — Import the knowledge vault
26
+ ```bash
27
+ context import ./docs/vault
28
+ ```
29
+
30
+ ### Step 4 — Index (first run downloads ~130MB model, then fully offline)
31
+ ```bash
32
+ context index
33
+ ```
34
+
35
+ ### Step 5 — Create your session token
36
+ ```bash
37
+ context token create agent-session
38
+ # Copy the printed ctx_ token — shown once only
39
+ export CONTEXTOS_TOKEN=ctx_<your-token>
40
+ ```
41
+
42
+ ### Step 6 — Start the server (keep running in background)
43
+ ```bash
44
+ context serve --port 8765
45
+ ```
46
+
47
+ ### Step 7 — Verify
48
+ ```bash
49
+ curl http://127.0.0.1:8765/health
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Using ContextOS FROM Other Project Folders
55
+
56
+ You do NOT need to be in the ContextOS repo directory to use it. From any project folder:
57
+
58
+ ```bash
59
+ # The server is already running at 127.0.0.1:8765
60
+ # Just call the API with your token
61
+
62
+ # Get context before starting a task
63
+ curl -s -X POST http://127.0.0.1:8765/context \
64
+ -H "Authorization: Bearer $CONTEXTOS_TOKEN" \
65
+ -H "Content-Type: application/json" \
66
+ -d '{"query": "YOUR TASK DESCRIPTION", "project": "contextos"}'
67
+
68
+ # Search for specific knowledge
69
+ curl -s -X POST http://127.0.0.1:8765/search \
70
+ -H "Authorization: Bearer $CONTEXTOS_TOKEN" \
71
+ -H "Content-Type: application/json" \
72
+ -d '{"query": "how does chunking work", "project": "contextos", "limit": 5}'
73
+ ```
74
+
75
+ **The graph updates automatically** when you run `context index` from the ContextOS repo directory. Run it after significant code changes to keep the knowledge graph current.
76
+
77
+ ---
78
+
79
+ ## Agent Workflow Per Session
80
+
81
+ Follow this workflow EVERY session without exception:
82
+
83
+ ### Before Starting Any Task
84
+ ```
85
+ 1. Check server: curl http://127.0.0.1:8765/health
86
+ 2. If not running: cd /path/to/contextos && context serve --port 8765 &
87
+ 3. Fetch context: POST /context with your task description
88
+ 4. Read the returned context block before writing any code
89
+ ```
90
+
91
+ ### During a Task
92
+ ```
93
+ - Use context grep "<pattern>" to find relevant code fast (faster than reading files)
94
+ - Use context read <file> --lines X:Y to read specific sections
95
+ - Use POST /search for semantic lookups ("how does X work")
96
+ - Never re-explain architecture you can retrieve — ask the server
97
+ ```
98
+
99
+ ### After Completing a Task
100
+ ```
101
+ 1. Run: context index (update the knowledge graph with your changes)
102
+ 2. Update relevant vault docs if architecture changed
103
+ 3. If you added a new module: add a corresponding doc to docs/vault/architecture/
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Architecture Rules (Non-Negotiable)
109
+
110
+ These rules govern every line of code in this repo. Violating them breaks the system.
111
+
112
+ ### 1. API Server MUST bind to 127.0.0.1 only
113
+ ```python
114
+ # CORRECT
115
+ uvicorn.run(app, host="127.0.0.1", port=port)
116
+
117
+ # FORBIDDEN — will be rejected in code review
118
+ uvicorn.run(app, host="0.0.0.0", port=port)
119
+ ```
120
+
121
+ ### 2. No external network calls at runtime
122
+ ```python
123
+ # FORBIDDEN at runtime
124
+ import requests
125
+ requests.get("https://api.openai.com/...") # Never
126
+
127
+ # The embedding model must use local_files_only=True after first download
128
+ SentenceTransformer(model_name, local_files_only=True) # Correct
129
+ ```
130
+
131
+ ### 3. All paths use pathlib.Path
132
+ ```python
133
+ # CORRECT
134
+ from pathlib import Path
135
+ config_path = Path.cwd() / ".contextos" / "config.yaml"
136
+
137
+ # FORBIDDEN
138
+ import os
139
+ config_path = os.path.join(os.getcwd(), ".contextos", "config.yaml")
140
+ ```
141
+
142
+ ### 4. Vault documents are read-only
143
+ ```python
144
+ # ContextOS NEVER writes to vault documents
145
+ # All writes go to .contextos/ only
146
+ # Never: open(vault_path / "file.md", "w")
147
+ ```
148
+
149
+ ### 5. Token raw values are never stored
150
+ ```python
151
+ # Only SHA-256 hash is persisted
152
+ # Raw token printed once at creation, never again
153
+ # Never: json.dump({"token": raw_token}, f)
154
+ # Always: json.dump({"hash": sha256(raw_token)}, f)
155
+ ```
156
+
157
+ ### 6. All Pydantic models live in schema.py
158
+ ```python
159
+ # New data models MUST be added to contextos/schema.py
160
+ # Never create ad-hoc dicts where a Pydantic model should exist
161
+ # Import from contextos.schema — never duplicate model definitions
162
+ ```
163
+
164
+ ---
165
+
166
+ ## File Generation Order (Strict — Avoids Import Errors)
167
+
168
+ When adding new modules, always respect this dependency order:
169
+
170
+ ```
171
+ 1. contextos/schema.py ← Pydantic models (no dependencies)
172
+ 2. contextos/config.py ← Config (depends on schema)
173
+ 3. contextos/vault.py ← Filesystem scanner (depends on schema, config)
174
+ 4. contextos/chunker.py ← Chunker (depends on schema)
175
+ 5. contextos/embedder.py ← Embedder (depends on schema)
176
+ 6. contextos/store.py ← LanceDB (depends on schema)
177
+ 7. contextos/graph.py ← NetworkX graph (depends on schema)
178
+ 8. contextos/memory.py ← Memory manager (depends on config, store, graph)
179
+ 9. contextos/retrieval.py ← Retrieval pipeline (depends on all above)
180
+ 10. contextos/auth.py ← Token auth (depends on schema)
181
+ 11. contextos/api.py ← FastAPI (depends on retrieval, auth)
182
+ 12. contextos/cli.py ← CLI (depends on everything)
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Project Vault Structure
188
+
189
+ The knowledge vault lives in `docs/vault/`. This is what gets indexed.
190
+
191
+ ```
192
+ docs/vault/
193
+ architecture/
194
+ overview.md ← System architecture (3 layers)
195
+ api.md ← API endpoint reference
196
+ retrieval.md ← Retrieval pipeline internals
197
+ storage.md ← LanceDB + vector store design
198
+ domain/
199
+ document.md ← Document model
200
+ chunk.md ← Chunk model
201
+ token.md ← Token model
202
+ graph.md ← Graph node/edge models
203
+ decisions/
204
+ ADR-001-lancedb.md
205
+ ADR-002-bge-small.md
206
+ ADR-003-local-only.md
207
+ workflows/
208
+ indexing-flow.md ← How context index works end-to-end
209
+ search-flow.md ← How POST /search works
210
+ context-flow.md ← How POST /context assembles output
211
+ context/
212
+ current.md ← Updated each sprint with current goals
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Tech Stack Reference
218
+
219
+ | Component | Package | Version |
220
+ |---|---|---|
221
+ | Language | Python | 3.11+ |
222
+ | CLI | Typer | 0.12+ |
223
+ | UI | Rich | 13.7+ |
224
+ | API | FastAPI | 0.111+ |
225
+ | Embeddings | sentence-transformers | 3.x |
226
+ | Embedding model | BAAI/bge-small-en-v1.5 | local, 384-dim |
227
+ | Vector store | LanceDB | 0.6+ |
228
+ | Graph | NetworkX | 3.x |
229
+ | Config | pydantic-settings | 2.x |
230
+ | Models | Pydantic | v2 |
231
+
232
+ ---
233
+
234
+ ## API Quick Reference
235
+
236
+ All endpoints at `http://127.0.0.1:8765` (or configured port).
237
+
238
+ ```bash
239
+ # No auth required
240
+ GET /health
241
+
242
+ # All others require: Authorization: Bearer ctx_<token>
243
+ POST /search # Semantic document search
244
+ POST /context # Assembled context block for agent
245
+ GET /documents # List indexed documents
246
+ GET /graph # Full knowledge graph
247
+ POST /grep # Fast regex codebase search (v1.1)
248
+ POST /files/read # Read file with metadata (v1.1)
249
+ GET /tree # Project structure (v1.1)
250
+ GET /changelog # Recent git commits (v1.1)
251
+ ```
252
+
253
+ ### POST /search request shape
254
+ ```json
255
+ {
256
+ "query": "how does payment retry work",
257
+ "project": "contextos",
258
+ "type": "architecture",
259
+ "domain": null,
260
+ "limit": 5,
261
+ "include_graph": false
262
+ }
263
+ ```
264
+
265
+ ### POST /context request shape
266
+ ```json
267
+ {
268
+ "query": "implement the memory manager",
269
+ "project": "contextos",
270
+ "max_tokens": 4000,
271
+ "priority_order": ["context", "adr", "architecture", "domain", "workflow", "product"]
272
+ }
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Memory Management
278
+
279
+ When disk space is tight or a project is complete, use the memory manager:
280
+
281
+ ```bash
282
+ # See disk usage breakdown
283
+ context memory status
284
+
285
+ # List all projects with sizes
286
+ context memory projects
287
+
288
+ # Archive a project (compresses index, keeps vault)
289
+ context memory archive <project-name>
290
+
291
+ # Purge a project's index (keeps vault, forces re-index on next use)
292
+ context memory purge <project-name>
293
+
294
+ # Clear embedding cache (re-downloads on next index)
295
+ context memory clear-embeddings
296
+
297
+ # Full reset of .contextos/ (keeps vault, wipes all indexes)
298
+ context memory reset
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Common Patterns
304
+
305
+ ### Add a new CLI command
306
+ 1. Add function to `contextos/cli.py` with `@app.command("name")`
307
+ 2. Import dependencies lazily inside the function (not at module top)
308
+ 3. Follow the UI spec: banner → status → rich panel result → next action hint
309
+ 4. Add the command to `AGENTS.md` API reference
310
+
311
+ ### Add a new API endpoint
312
+ 1. Add route to `contextos/api.py`
313
+ 2. Add request/response models to `contextos/schema.py`
314
+ 3. Implement logic in the appropriate module (not inline in api.py)
315
+ 4. Add to API reference in `AGENTS.md`
316
+
317
+ ### Update the knowledge graph
318
+ After any significant change:
319
+ ```bash
320
+ context index # rebuilds chunks, embeddings, graph
321
+ context status # verify document count increased
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Environment Variables
327
+
328
+ ```bash
329
+ CONTEXTOS_TOKEN=ctx_<token> # Bearer token for API auth
330
+ CONTEXTOS_PORT=8765 # Port override (default: 8080)
331
+ CONTEXTOS_LOG_LEVEL=info # debug | info | warning
332
+ ```
333
+
334
+ Add to your shell profile (`~/.bashrc`, `~/.zshrc`, `~/.profile`):
335
+ ```bash
336
+ export CONTEXTOS_TOKEN=ctx_<your-token>
337
+ export CONTEXTOS_PORT=8765
338
+ ```
339
+
340
+ ---
341
+
342
+ ## What Makes ContextOS Different
343
+
344
+ | Problem | ContextOS Solution |
345
+ |---|---|
346
+ | Agent forgets architecture between sessions | Persistent vault indexed and searchable |
347
+ | Context window bloat from re-explaining | `/context` endpoint returns only relevant chunks |
348
+ | Can't search codebase fast | `context grep` with ripgrep, sub-100ms |
349
+ | Need to read file sections | `context read file.py --lines 40:80` |
350
+ | Token waste on unchanged context | Content-hash change detection — only re-indexes changed files |
351
+ | Cloud lock-in | 100% local, zero network at runtime |
352
+
353
+ ---
354
+
355
+ *ContextOS AGENTS.md — v1.0.0-rc1 — Keep this file updated as the system evolves.*
@@ -0,0 +1,132 @@
1
+ # Changelog
2
+
3
+ All notable changes to ContextOS are documented here.
4
+ This project follows [Semantic Versioning](https://semver.org/).
5
+
6
+ ---
7
+
8
+ ## [1.5.0] — 2026-06-04 — First Stable Release 🎉
9
+
10
+ **Published to PyPI as [`contextos-vault`](https://pypi.org/project/contextos-vault/)**
11
+
12
+ ```bash
13
+ pip install contextos-vault
14
+ context start
15
+ ```
16
+
17
+ This is the first stable release. All features from v1.0 through v1.5.0rc1 are included.
18
+ No code changes from rc1 — version bump only after verifying end-to-end PyPI installation.
19
+
20
+ ---
21
+
22
+ ## [1.5.0rc1] — 2026-06-04
23
+
24
+ ### Added — Production Maturity
25
+
26
+ - **E2E test suite** (`tests/test_e2e.py`) — 29 tests covering full pipeline, incremental index, API auth flow, CLI commands, BM25 cache, batch delete, watch mode
27
+ - **BM25 disk cache** — index built at `context index` time, pickled to `.contextos/cache/bm25.pkl`, loaded on first query. Eliminates per-query corpus rebuild
28
+ - **Batch delete** — re-index uses `doc_id IN (...)` instead of N individual deletes
29
+ - **Configurable embedding dimension** — `embedding_dim: 384` in config; auto-detected from loaded model
30
+ - **Path containment check** — `context read` validates `is_relative_to()` against vault roots
31
+
32
+ ### Fixed
33
+
34
+ - `--watch` mode: `cmd_serve` now uses `try/finally` to stop watcher on shutdown
35
+ - `embedder.py`: `get_embedding_dimension()` FutureWarning fixed with proper fallback
36
+ - Bare `except: pass` eliminated — all silent failures now log at `debug` level
37
+
38
+ ---
39
+
40
+ ## [1.4.1] — 2026-06-04
41
+
42
+ ### Fixed — Audit-Driven Bug Fixes
43
+
44
+ - **CRITICAL**: `api.py require_scope()` infinite recursion at import time — inner `_check` now depends on `require_token`, not `require_scope`
45
+ - **HIGH**: `retrieval.py assemble_context()` now uses `_rrf_score` (hybrid) correctly, not stale `_distance`
46
+ - **HIGH**: `vault._ingest_document()` injects `project_name` from caller — PDF/DOCX/PPTX no longer get `project: unknown`
47
+ - **MEDIUM**: `auth.check_rate_limit()` merge-write — no longer overwrites `request_count`
48
+ - **MEDIUM**: `memory.get_projects_breakdown()` single table scan — eliminated N+1 LanceDB queries
49
+ - **MEDIUM**: `watcher.py` now watches `.pdf`, `.docx`, `.pptx` in addition to `.md`
50
+ - **MEDIUM**: `mcp_server._mcp_cfg` cached at module level — not reloaded per tool call
51
+ - **MEDIUM**: `store.hybrid_search()` returns vector results when BM25 returns empty
52
+
53
+ ### Added
54
+
55
+ - `schema.py SearchRequest/ContextRequest`: `use_hybrid` and `hybrid_alpha` fields exposed on API
56
+ - `config.py`: `hybrid_search` and `hybrid_alpha` configurable in `config.yaml`
57
+ - `eval/contextos-questions.json` — 8 golden questions for ContextOS self-evaluation
58
+
59
+ ---
60
+
61
+ ## [1.4.0rc1] — 2026-06-04
62
+
63
+ ### Added — Hybrid Search, Multi-format Ingestors, Evaluator, One-command Bootstrap
64
+
65
+ - **Hybrid Search** — BM25 + vector + Reciprocal Rank Fusion. `alpha=0.7` default. 30-50% better retrieval for exact terms
66
+ - **PDF ingestor** — `pymupdf` page-by-page extraction
67
+ - **DOCX ingestor** — `python-docx` headings/tables/bold/italic → Markdown
68
+ - **PPTX ingestor** — `python-pptx` slides + speaker notes
69
+ - **Retrieval evaluator** — Hit Rate @K, MRR, avg score, latency. `context eval` CLI
70
+ - **`context start`** — one-command bootstrap: init + scaffold + import + index + token + serve
71
+ - **MCP tool scope enforcement** — `CONTEXTOS_TOKEN` validated per tool call
72
+ - ADR-004 (hybrid search), ADR-005 (ingestors)
73
+
74
+ ---
75
+
76
+ ## [1.3.0rc1] — 2026-06-03
77
+
78
+ ### Added — Auth Scopes, Logging, Cache, Plugins, Scaffolding, CI
79
+
80
+ - **Token scopes**: `read | write | admin` with hierarchical enforcement
81
+ - **Token expiry** and **rate limiting** (1000 req/min sliding window)
82
+ - **Structured logging**: `app.jsonl`, `slow.jsonl`, `audit.jsonl` with rotation
83
+ - **Context response cache**: LRU, TTL=5min, invalidated on index
84
+ - **Plugin system**: `~/.contextos/plugins/`, PyPI `entry_points`, `context plugin install`
85
+ - **Vault scaffolder**: `default`, `microservice`, `api-first` templates
86
+ - **CI commands**: `context ci check`, `context ci index`
87
+ - API: `/metrics`, `/audit`, `X-Request-ID` headers, `require_scope` middleware
88
+
89
+ ---
90
+
91
+ ## [1.2.0rc1] — 2026-06-03
92
+
93
+ ### Added — Session Memory, Connectors, TUI Dashboard
94
+
95
+ - **Session manager**: create, event, end, summary, vault export
96
+ - **Connectors**: GitHub Issues/Wiki, OpenAPI spec, JSON/YAML/TOML
97
+ - **Textual TUI dashboard**: `context dashboard` — live 4-panel system monitor
98
+ - **`context export`** — vault to single Markdown or JSON
99
+ - API: `/session/*`, `/pull`
100
+
101
+ ---
102
+
103
+ ## [1.1.0rc1] — 2026-06-03
104
+
105
+ ### Added — Performance + Integration
106
+
107
+ - **Incremental index** — content-hash change detection, skip unchanged docs
108
+ - **MCP server** — 6 native tools (stdio transport)
109
+ - **Symbol index** — Python AST + JS/TS regex extraction
110
+ - **Smart compression** — sumy TF-IDF extractive, no LLM
111
+ - **Live watch mode** — watchfiles per-file re-index
112
+ - `context context`, `context diff`, `context projects`, `context symbols`, `context setup`
113
+ - Agent templates: `.cursorrules`, `mcp.json`, `.continue/config.json`, copilot instructions
114
+
115
+ ---
116
+
117
+ ## [1.0.0rc1] — 2026-06-03
118
+
119
+ ### Initial Release
120
+
121
+ - Core 3-layer architecture: Vault → Index → API
122
+ - FastAPI server bound exclusively to `127.0.0.1`
123
+ - BAAI/bge-small-en-v1.5 embeddings (384-dim, local CPU)
124
+ - LanceDB vector store
125
+ - NetworkX knowledge graph
126
+ - 15 CLI commands with Rich UI
127
+ - Token authentication (SHA-256 hash, never plaintext)
128
+ - Memory management (purge, archive, reset)
129
+ - Kiro pre-task hook
130
+ - Self-documenting vault (`docs/vault/`)
131
+ - Example project vault (`examples/my-project/`)
132
+ - 15 smoke tests
@@ -0,0 +1,34 @@
1
+ # ContextOS Project Memory
2
+
3
+ This project uses ContextOS itself for persistent knowledge management.
4
+
5
+ ## Before Starting Any Task
6
+
7
+ Retrieve context from the local ContextOS server:
8
+
9
+ ```bash
10
+ curl -s -X POST http://127.0.0.1:8765/context \
11
+ -H "Authorization: Bearer $CONTEXTOS_TOKEN" \
12
+ -H "Content-Type: application/json" \
13
+ -d '{"query": "<YOUR TASK HERE>", "project": "contextos", "max_tokens": 4000}'
14
+ ```
15
+
16
+ If server is not running:
17
+ ```bash
18
+ cd /path/to/contextos && context serve --port 8765 &
19
+ ```
20
+
21
+ ## Architecture Rules
22
+ See AGENTS.md for complete rules. Critical constraints:
23
+ - API server MUST bind to 127.0.0.1 only (never 0.0.0.0)
24
+ - No external network calls at runtime
25
+ - All paths use pathlib.Path
26
+ - Vault documents are read-only
27
+ - Token raw values are never stored — SHA-256 hash only
28
+ - All Pydantic models live in schema.py
29
+
30
+ ## After Task Completion
31
+ ```bash
32
+ context index # update knowledge graph
33
+ context status # verify
34
+ ```
@@ -0,0 +1,139 @@
1
+ # Contributing to ContextOS
2
+
3
+ Thank you for your interest in contributing. ContextOS is an enterprise open-source project. All contributions must maintain the core design principles — especially the zero-network-at-runtime guarantee.
4
+
5
+ ---
6
+
7
+ ## Quick Start for Contributors
8
+
9
+ ```bash
10
+ git clone https://github.com/AbhayankarBellur/ContextOS.git
11
+ cd ContextOS
12
+ pip install -e ".[dev]"
13
+ context init
14
+ context import docs/vault
15
+ context index
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Development Setup
21
+
22
+ ### Requirements
23
+ - Python 3.11+
24
+ - pip
25
+
26
+ ### Install with dev dependencies
27
+ ```bash
28
+ pip install -e ".[dev]"
29
+ ```
30
+
31
+ ### Run the CLI
32
+ ```bash
33
+ context --help
34
+ context doctor # validate your setup
35
+ ```
36
+
37
+ ### Run tests
38
+ ```bash
39
+ pytest tests/ -v
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Architecture Rules (Non-Negotiable)
45
+
46
+ These rules apply to every pull request. PRs that violate them will not be merged.
47
+
48
+ | Rule | Requirement |
49
+ |---|---|
50
+ | API binding | `host='127.0.0.1'` only — never `0.0.0.0` |
51
+ | Network calls | Zero external calls at runtime |
52
+ | Paths | `pathlib.Path` only — never `os.path` |
53
+ | Vault files | Read-only — ContextOS never modifies source documents |
54
+ | Token storage | SHA-256 hash only — raw value never persisted |
55
+ | Data models | All Pydantic v2 models in `contextos/schema.py` |
56
+ | UI output | Rich only — no manual ANSI, no `print()` outside `ui.py` |
57
+
58
+ ---
59
+
60
+ ## File Structure
61
+
62
+ ```
63
+ contextos/
64
+ schema.py ← All Pydantic models (source of truth)
65
+ config.py ← pydantic-settings Config
66
+ vault.py ← Filesystem scanner + frontmatter parser
67
+ chunker.py ← MarkdownHeaderTextSplitter
68
+ embedder.py ← sentence-transformers wrapper
69
+ store.py ← LanceDB vector store
70
+ graph.py ← NetworkX knowledge graph
71
+ memory.py ← Disk management engine
72
+ retrieval.py ← Full retrieval pipeline
73
+ auth.py ← Token generation + validation
74
+ api.py ← FastAPI server (127.0.0.1 only)
75
+ cli.py ← Typer CLI (all commands)
76
+ ui.py ← Rich UI theme + shared components
77
+
78
+ docs/vault/ ← ContextOS's own knowledge vault
79
+ examples/ ← Example vaults for testing
80
+ tests/ ← Test suite
81
+ ```
82
+
83
+ **Dependency order must be respected.** Never import `cli.py` from `api.py`. Never import `api.py` from `retrieval.py`. See `AGENTS.md` for the full dependency graph.
84
+
85
+ ---
86
+
87
+ ## Pull Request Checklist
88
+
89
+ - [ ] `pip install -e .` succeeds cleanly
90
+ - [ ] `context doctor` reports all checks passing
91
+ - [ ] `context index` runs fully offline (after first model download)
92
+ - [ ] `context search "test"` returns results
93
+ - [ ] No new external network calls introduced
94
+ - [ ] All new data models added to `schema.py`
95
+ - [ ] All new CLI commands follow the UI spec in `ui.py`
96
+ - [ ] `AGENTS.md` updated if API surface changed
97
+
98
+ ---
99
+
100
+ ## Commit Message Format
101
+
102
+ ```
103
+ type: short description
104
+
105
+ Types: feat | fix | docs | refactor | test | chore
106
+ ```
107
+
108
+ Examples:
109
+ ```
110
+ feat: add POST /grep endpoint for codebase search
111
+ fix: handle missing frontmatter on vault documents
112
+ docs: update AGENTS.md with memory management commands
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Versioning
118
+
119
+ ContextOS follows semantic versioning. Version is set in `pyproject.toml` and `contextos/__init__.py`.
120
+
121
+ | Version | Scope |
122
+ |---|---|
123
+ | v1.0.x | Bug fixes |
124
+ | v1.1.x | New endpoints, new CLI commands |
125
+ | v1.2.x | New retrieval modes (GraphRAG, symbol search) |
126
+ | v2.0.0 | Breaking changes (new schema, protocol changes) |
127
+
128
+ ---
129
+
130
+ ## Reporting Issues
131
+
132
+ Use GitHub Issues. Include:
133
+ - Output of `context doctor`
134
+ - OS and Python version
135
+ - Exact command and error output
136
+
137
+ ---
138
+
139
+ *ContextOS — Local-first. Agent-native. Enterprise-grade.*