stixdb-engine 0.1.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.
- stixdb_engine-0.1.0/.env.example +91 -0
- stixdb_engine-0.1.0/.gitattributes +2 -0
- stixdb_engine-0.1.0/.gitignore +71 -0
- stixdb_engine-0.1.0/CHANGELOG.md +49 -0
- stixdb_engine-0.1.0/CONTRIBUTING.md +123 -0
- stixdb_engine-0.1.0/COOKBOOKS_SUMMARY.md +528 -0
- stixdb_engine-0.1.0/Dockerfile +38 -0
- stixdb_engine-0.1.0/LICENSE +21 -0
- stixdb_engine-0.1.0/PKG-INFO +535 -0
- stixdb_engine-0.1.0/PRODUCTION.md +563 -0
- stixdb_engine-0.1.0/QUICKSTART.md +471 -0
- stixdb_engine-0.1.0/README.md +485 -0
- stixdb_engine-0.1.0/SECURITY.md +44 -0
- stixdb_engine-0.1.0/SKILLS_SUMMARY.md +221 -0
- stixdb_engine-0.1.0/cookbooks/INDEX.md +362 -0
- stixdb_engine-0.1.0/cookbooks/core-sdk/01_basic_store_retrieve.py +140 -0
- stixdb_engine-0.1.0/cookbooks/core-sdk/02_agent_tuning.py +131 -0
- stixdb_engine-0.1.0/cookbooks/core-sdk/03_local_vs_server.py +323 -0
- stixdb_engine-0.1.0/cookbooks/custom-embeddings/README.md +339 -0
- stixdb_engine-0.1.0/cookbooks/custom-embeddings/domain_specialized_embeddings.py +281 -0
- stixdb_engine-0.1.0/cookbooks/custom-embeddings/hybrid_search_strategy.py +244 -0
- stixdb_engine-0.1.0/cookbooks/custom-embeddings/openai_embeddings.py +200 -0
- stixdb_engine-0.1.0/cookbooks/custom-embeddings/privacy_first_local_embeddings.py +248 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/README.md +306 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/anthropic.py +141 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/multi_model_routing.py +250 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/ollama_local.py +153 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/openai_gpt4o.py +169 -0
- stixdb_engine-0.1.0/cookbooks/custom-llm/privacy_first_local_llm.py +189 -0
- stixdb_engine-0.1.0/cookbooks/langchain/rag_pipeline.py +167 -0
- stixdb_engine-0.1.0/cookbooks/langchain/stixdb_retriever.py +192 -0
- stixdb_engine-0.1.0/cookbooks/multi-agent/concurrent_agents.py +167 -0
- stixdb_engine-0.1.0/cookbooks/openai-compatible/with_openai_sdk.py +223 -0
- stixdb_engine-0.1.0/cookbooks/rest-api/curl_examples.sh +170 -0
- stixdb_engine-0.1.0/cookbooks/rest-api/local_to_server.md +245 -0
- stixdb_engine-0.1.0/doc/ARCHITECTURE_DIAGRAMS.md +97 -0
- stixdb_engine-0.1.0/doc/README.md +64 -0
- stixdb_engine-0.1.0/doc/STIXDB_COMPREHENSIVE_GUIDE.md +141 -0
- stixdb_engine-0.1.0/doc/architecture/00-project-guide.md +686 -0
- stixdb_engine-0.1.0/doc/architecture/10-app-overview.md +143 -0
- stixdb_engine-0.1.0/doc/architecture/11-system-architecture.md +261 -0
- stixdb_engine-0.1.0/doc/architecture/12-repo-organization.md +214 -0
- stixdb_engine-0.1.0/doc/architecture/13-openai-compatibility.md +156 -0
- stixdb_engine-0.1.0/doc/architecture/14-search-api.md +186 -0
- stixdb_engine-0.1.0/doc/architecture/15-sdk-usage.md +180 -0
- stixdb_engine-0.1.0/doc/performance/01-streaming-overview.md +119 -0
- stixdb_engine-0.1.0/doc/performance/02-retrieval-latency-fix.md +125 -0
- stixdb_engine-0.1.0/doc/performance/03-verbose-progress-mode.md +106 -0
- stixdb_engine-0.1.0/doc/performance/04-benchmarking-guide.md +179 -0
- stixdb_engine-0.1.0/docker-compose.yml +127 -0
- stixdb_engine-0.1.0/pyproject.toml +79 -0
- stixdb_engine-0.1.0/sdk/LICENSE +21 -0
- stixdb_engine-0.1.0/sdk/README.md +408 -0
- stixdb_engine-0.1.0/sdk/examples/async_usage.py +26 -0
- stixdb_engine-0.1.0/sdk/examples/health_check.py +17 -0
- stixdb_engine-0.1.0/sdk/examples/ingest_folder_openai_chat.py +49 -0
- stixdb_engine-0.1.0/sdk/examples/query_ask.py +25 -0
- stixdb_engine-0.1.0/sdk/examples/store_and_search.py +38 -0
- stixdb_engine-0.1.0/sdk/pyproject.toml +70 -0
- stixdb_engine-0.1.0/sdk/skills/SKILL.md +732 -0
- stixdb_engine-0.1.0/sdk/skills/sdk-memory-layer/README.md +16 -0
- stixdb_engine-0.1.0/sdk/skills/sdk-memory-layer/SKILL.md +732 -0
- stixdb_engine-0.1.0/sdk/skills/sdk-memory-layer/evals/evals.json +30 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/__init__.py +23 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/base.py +16 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/client.py +92 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/memory.py +309 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/py.typed +0 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/query.py +96 -0
- stixdb_engine-0.1.0/sdk/src/stixdb_sdk/search.py +90 -0
- stixdb_engine-0.1.0/skills/NAMING_CONVENTIONS.md +209 -0
- stixdb_engine-0.1.0/skills/SKILL.md +905 -0
- stixdb_engine-0.1.0/start-local.ps1 +80 -0
- stixdb_engine-0.1.0/start-local.sh +77 -0
- stixdb_engine-0.1.0/stixdb/__init__.py +15 -0
- stixdb_engine-0.1.0/stixdb/agent/__init__.py +17 -0
- stixdb_engine-0.1.0/stixdb/agent/consolidator.py +336 -0
- stixdb_engine-0.1.0/stixdb/agent/maintenance.py +443 -0
- stixdb_engine-0.1.0/stixdb/agent/memory_agent.py +84 -0
- stixdb_engine-0.1.0/stixdb/agent/planner.py +163 -0
- stixdb_engine-0.1.0/stixdb/agent/reasoner.py +817 -0
- stixdb_engine-0.1.0/stixdb/agent/sessions.py +67 -0
- stixdb_engine-0.1.0/stixdb/agent/worker.py +205 -0
- stixdb_engine-0.1.0/stixdb/api/__init__.py +1 -0
- stixdb_engine-0.1.0/stixdb/api/routes/__init__.py +1 -0
- stixdb_engine-0.1.0/stixdb/api/routes/agent.py +56 -0
- stixdb_engine-0.1.0/stixdb/api/routes/collections.py +251 -0
- stixdb_engine-0.1.0/stixdb/api/routes/openai.py +278 -0
- stixdb_engine-0.1.0/stixdb/api/routes/query.py +76 -0
- stixdb_engine-0.1.0/stixdb/api/routes/search.py +420 -0
- stixdb_engine-0.1.0/stixdb/api/server.py +137 -0
- stixdb_engine-0.1.0/stixdb/backup/__init__.py +3 -0
- stixdb_engine-0.1.0/stixdb/backup/minio_store.py +61 -0
- stixdb_engine-0.1.0/stixdb/cli.py +90 -0
- stixdb_engine-0.1.0/stixdb/config.py +252 -0
- stixdb_engine-0.1.0/stixdb/context/__init__.py +5 -0
- stixdb_engine-0.1.0/stixdb/context/broker.py +233 -0
- stixdb_engine-0.1.0/stixdb/context/response.py +80 -0
- stixdb_engine-0.1.0/stixdb/engine.py +1264 -0
- stixdb_engine-0.1.0/stixdb/graph/__init__.py +12 -0
- stixdb_engine-0.1.0/stixdb/graph/cluster.py +85 -0
- stixdb_engine-0.1.0/stixdb/graph/edge.py +104 -0
- stixdb_engine-0.1.0/stixdb/graph/memory_graph.py +434 -0
- stixdb_engine-0.1.0/stixdb/graph/node.py +147 -0
- stixdb_engine-0.1.0/stixdb/ingestion/__init__.py +13 -0
- stixdb_engine-0.1.0/stixdb/ingestion/documents.py +134 -0
- stixdb_engine-0.1.0/stixdb/observability/__init__.py +3 -0
- stixdb_engine-0.1.0/stixdb/observability/tracer.py +268 -0
- stixdb_engine-0.1.0/stixdb/skills/engine-memory-layer/README.md +17 -0
- stixdb_engine-0.1.0/stixdb/skills/engine-memory-layer/SKILL.md +905 -0
- stixdb_engine-0.1.0/stixdb/skills/engine-memory-layer/evals/evals.json +35 -0
- stixdb_engine-0.1.0/stixdb/storage/__init__.py +27 -0
- stixdb_engine-0.1.0/stixdb/storage/base.py +176 -0
- stixdb_engine-0.1.0/stixdb/storage/embeddings.py +136 -0
- stixdb_engine-0.1.0/stixdb/storage/kuzu_backend.py +693 -0
- stixdb_engine-0.1.0/stixdb/storage/neo4j_backend.py +452 -0
- stixdb_engine-0.1.0/stixdb/storage/networkx_backend.py +263 -0
- stixdb_engine-0.1.0/stixdb/storage/vector_store.py +295 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# ==========================================
|
|
2
|
+
# StixDB Environment Configuration Example
|
|
3
|
+
# ==========================================
|
|
4
|
+
|
|
5
|
+
# ------------------------------------------
|
|
6
|
+
# 1. Background Agent Configuration
|
|
7
|
+
# ------------------------------------------
|
|
8
|
+
STIXDB_AGENT_CYCLE_INTERVAL=30.0 # Seconds between perceive/plan/act loops
|
|
9
|
+
STIXDB_AGENT_CONSOLIDATION_THRESHOLD=0.88 # Minimum cosine similarity to merge redundant nodes
|
|
10
|
+
STIXDB_AGENT_DECAY_HALF_LIFE=48.0 # Hours before an unaccessed node's importance halves
|
|
11
|
+
STIXDB_AGENT_PRUNE_THRESHOLD=0.00 # Node importance below this will be permanently pruned
|
|
12
|
+
STIXDB_AGENT_WORKING_MEMORY_MAX=256 # Max number of hot nodes kept in working memory
|
|
13
|
+
STIXDB_AGENT_MAX_CONSOLIDATION_BATCH=64 # Max nodes the regenerator merges per cycle
|
|
14
|
+
STIXDB_AGENT_AUTO_SUMMARIZE=true # Should agents automatically summarize large clusters?
|
|
15
|
+
STIXDB_AGENT_LINEAGE_SAFE_MODE=true # Preserve summarized source nodes instead of pruning them later
|
|
16
|
+
|
|
17
|
+
# ------------------------------------------
|
|
18
|
+
# 2. LLM Reasoner Configuration
|
|
19
|
+
# ------------------------------------------
|
|
20
|
+
STIXDB_LLM_PROVIDER=custom # openai | anthropic | ollama | custom | none
|
|
21
|
+
STIXDB_LLM_MODEL=nvidia/nemotron-3-super-120b-a12b # E.g., gpt-4o, claude-3-5-sonnet, llama3, or custom model
|
|
22
|
+
STIXDB_LLM_TEMPERATURE=0.2 # Temp controlling generation parameters
|
|
23
|
+
STIXDB_LLM_MAX_TOKENS=2048 # Max context token sequence length
|
|
24
|
+
STIXDB_LLM_MAX_CONTEXT_NODES=20 # Max number of graph nodes provided as context
|
|
25
|
+
STIXDB_LLM_GRAPH_TRAVERSAL_DEPTH=3 # Max depth of graph traversal during query retrieval
|
|
26
|
+
STIXDB_LLM_TIMEOUT=60.0 # Rest API timeout for completion calls
|
|
27
|
+
|
|
28
|
+
# ------------------------------------------
|
|
29
|
+
# 3. Embedding Provider Configuration
|
|
30
|
+
# ------------------------------------------
|
|
31
|
+
STIXDB_EMBEDDING_PROVIDER=custom # sentence_transformers | openai | ollama | custom
|
|
32
|
+
STIXDB_EMBEDDING_MODEL=Qwen/Qwen3-Embedding-8B # Model architecture mapped via string name
|
|
33
|
+
STIXDB_EMBEDDING_DIMENSIONS=384 # Dimension size for embeddings generated
|
|
34
|
+
|
|
35
|
+
# ------------------------------------------
|
|
36
|
+
# 4. Storage & Vector DB Configuration
|
|
37
|
+
# ------------------------------------------
|
|
38
|
+
# STIXDB_STORAGE_MODE controls the graph backend:
|
|
39
|
+
#
|
|
40
|
+
# memory — In-process NetworkX (fastest, no persistence, data lost on restart)
|
|
41
|
+
# kuzu — KuzuDB embedded (persistent on disk, no Docker required) ✔ RECOMMENDED FOR LOCAL DEV
|
|
42
|
+
# neo4j — Neo4j via Docker (production)
|
|
43
|
+
#
|
|
44
|
+
STIXDB_STORAGE_MODE=kuzu # memory | kuzu | neo4j
|
|
45
|
+
STIXDB_DATA_DIR=./stixdb_data # Root data directory
|
|
46
|
+
STIXDB_KUZU_PATH=./stixdb_data/kuzu # Path for KuzuDB files (kuzu mode only)
|
|
47
|
+
STIXDB_VECTOR_BACKEND=memory # memory (in-proc) | chroma | qdrant
|
|
48
|
+
STIXDB_STORAGE_MAX_ACTIVE_NODES=1000000 # Safety cap enforcing eviction threshold
|
|
49
|
+
|
|
50
|
+
# ExtDB Endpoints (Required only if using Qdrant/Chroma)
|
|
51
|
+
# QDRANT_HOST=localhost
|
|
52
|
+
# QDRANT_PORT=6333
|
|
53
|
+
# CHROMA_HOST=localhost
|
|
54
|
+
|
|
55
|
+
# ------------------------------------------
|
|
56
|
+
# 5. External API Keys & Endpoints
|
|
57
|
+
# ------------------------------------------
|
|
58
|
+
# OPENAI_API_KEY=sk-your-openai-key-here
|
|
59
|
+
# ANTHROPIC_API_KEY=sk-ant-your-anthropic-key-here
|
|
60
|
+
# OLLAMA_BASE_URL=http://localhost:11434
|
|
61
|
+
|
|
62
|
+
# Custom OpenAI-compatible provider (only if STIXDB_LLM_PROVIDER=custom)
|
|
63
|
+
# STIXDB_LLM_CUSTOM_BASE_URL=https://your-provider.com/v1/
|
|
64
|
+
# STIXDB_LLM_CUSTOM_API_KEY=your-custom-llm-api-key
|
|
65
|
+
|
|
66
|
+
# Custom embedding provider (only if STIXDB_EMBEDDING_PROVIDER=custom)
|
|
67
|
+
# STIXDB_EMBEDDING_CUSTOM_BASE_URL=https://your-provider.com/v1/
|
|
68
|
+
# STIXDB_EMBEDDING_CUSTOM_API_KEY=your-custom-embedding-api-key
|
|
69
|
+
|
|
70
|
+
# ------------------------------------------
|
|
71
|
+
# 6. Ingestion Configuration
|
|
72
|
+
# ------------------------------------------
|
|
73
|
+
STIXDB_CHUNK_SIZE=1000 # Characters per ingestion chunk
|
|
74
|
+
STIXDB_CHUNK_OVERLAP=200 # Overlap between consecutive chunks
|
|
75
|
+
# Supported: .txt .md .pdf (native text) and all code/
|
|
76
|
+
# markup extensions. For scanned PDFs, run OCR externally
|
|
77
|
+
# and upload the resulting .md or .txt file.
|
|
78
|
+
|
|
79
|
+
# ------------------------------------------
|
|
80
|
+
# 7. Observability & Telemetry
|
|
81
|
+
# ------------------------------------------
|
|
82
|
+
STIXDB_ENABLE_TRACES=true # Enables distributed tracing
|
|
83
|
+
STIXDB_ENABLE_METRICS=true # Enables Prometheus metrics monitoring
|
|
84
|
+
STIXDB_METRICS_PORT=9090 # Port Prometheus server exposes
|
|
85
|
+
STIXDB_LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR
|
|
86
|
+
|
|
87
|
+
# ------------------------------------------
|
|
88
|
+
# 7. Server & API Configuration
|
|
89
|
+
# ------------------------------------------
|
|
90
|
+
STIXDB_API_PORT=4020 # Port where the REST API runs
|
|
91
|
+
STIXDB_API_KEY=your-secure-api-key-here # If set, all requests must pass X-API-Key header
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
env/
|
|
12
|
+
ENV/
|
|
13
|
+
|
|
14
|
+
# Build & distribution
|
|
15
|
+
*.egg-info/
|
|
16
|
+
dist/
|
|
17
|
+
build/
|
|
18
|
+
*.egg
|
|
19
|
+
MANIFEST
|
|
20
|
+
*.whl
|
|
21
|
+
|
|
22
|
+
# Pytest / coverage
|
|
23
|
+
.pytest_cache/
|
|
24
|
+
.coverage
|
|
25
|
+
.coverage.*
|
|
26
|
+
htmlcov/
|
|
27
|
+
.hypothesis/
|
|
28
|
+
|
|
29
|
+
# Mypy / type checkers
|
|
30
|
+
.mypy_cache/
|
|
31
|
+
.dmypy.json
|
|
32
|
+
dmypy.json
|
|
33
|
+
.pyre/
|
|
34
|
+
|
|
35
|
+
# Ruff
|
|
36
|
+
.ruff_cache/
|
|
37
|
+
|
|
38
|
+
# Environment files — NEVER commit real credentials
|
|
39
|
+
.env
|
|
40
|
+
.env.local
|
|
41
|
+
.env.*.local
|
|
42
|
+
stix/.env
|
|
43
|
+
|
|
44
|
+
# IDE / editor
|
|
45
|
+
.vscode/
|
|
46
|
+
.idea/
|
|
47
|
+
*.sublime-project
|
|
48
|
+
*.sublime-workspace
|
|
49
|
+
.DS_Store
|
|
50
|
+
Thumbs.db
|
|
51
|
+
|
|
52
|
+
# Claude Code local settings
|
|
53
|
+
.claude/
|
|
54
|
+
|
|
55
|
+
# STIX runtime data
|
|
56
|
+
stix_data/
|
|
57
|
+
stix/stix_data/
|
|
58
|
+
*.db
|
|
59
|
+
|
|
60
|
+
# Logs
|
|
61
|
+
*.log
|
|
62
|
+
logs/
|
|
63
|
+
|
|
64
|
+
# Notebooks checkpoints
|
|
65
|
+
.ipynb_checkpoints/
|
|
66
|
+
|
|
67
|
+
# Docker volumes (local dev)
|
|
68
|
+
neo4j_data/
|
|
69
|
+
chroma_data/
|
|
70
|
+
pg_data/
|
|
71
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to StixDB are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
StixDB uses [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Planned
|
|
13
|
+
- Pinecone vector backend
|
|
14
|
+
- Multi-hop graph reasoning traces UI
|
|
15
|
+
- Collection-level RBAC
|
|
16
|
+
- Webhook callbacks on agent cycle events
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## [0.1.0] — 2025-01-01
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **StixDBEngine** — top-level async engine managing multiple isolated collections
|
|
24
|
+
- **MemoryGraph** — unified graph + vector store interface (NetworkX / KuzuDB / Neo4j)
|
|
25
|
+
- **MemoryAgent** — per-collection autonomous background agent
|
|
26
|
+
- `AccessPlanner` — hybrid LRU+LFU heat scoring for node tier promotion
|
|
27
|
+
- `Consolidator` — cosine-similarity merging (threshold 0.88) + exponential decay pruning
|
|
28
|
+
- `MemoryAgentWorker` — decoupled `perceive → plan → act` async loop (30s default)
|
|
29
|
+
- **ContextBroker** — 7-phase retrieval: embed → vector search → graph BFS → re-rank → truncate → LLM reason → record
|
|
30
|
+
- **Reasoner** — LLM synthesis over graph context (OpenAI / Anthropic / Ollama / Custom / None)
|
|
31
|
+
- **REST API** (FastAPI)
|
|
32
|
+
- Collection CRUD, bulk ingest, file upload
|
|
33
|
+
- `POST /collections/{id}/ask` — agentic Q&A
|
|
34
|
+
- `POST /search` — multi-query, cross-collection, filterable search
|
|
35
|
+
- `GET /collections/{id}/agent/status` — agent introspection
|
|
36
|
+
- `GET /traces` — execution trace log
|
|
37
|
+
- OpenAI-compatible `/v1/chat/completions`, `/v1/models`, `/v1/embeddings`
|
|
38
|
+
- **Python SDK** (`stixdb-sdk`) — sync + async HTTP client
|
|
39
|
+
- **Storage backends**: NetworkX (ephemeral), KuzuDB (local persistent, no Docker), Neo4j (Docker, production)
|
|
40
|
+
- **Vector backends**: NumPy (in-process), ChromaDB, Qdrant
|
|
41
|
+
- **Embedding providers**: sentence-transformers, OpenAI, Ollama, custom OpenAI-compatible
|
|
42
|
+
- **Memory tiers**: `working`, `episodic`, `semantic`, `procedural`, `archived`
|
|
43
|
+
- **Node types**: `fact`, `entity`, `event`, `concept`, `procedure`, `summary`, `question`
|
|
44
|
+
- **Lineage safety mode** — source nodes pinned across consolidation cycles
|
|
45
|
+
- **Document ingestion** — PDF (page-level provenance), plain text (character offset chunking)
|
|
46
|
+
- **Observability** — structlog, Prometheus metrics, distributed trace log
|
|
47
|
+
- **Docker Compose** stack — StixDB + Neo4j + ChromaDB + PostgreSQL
|
|
48
|
+
- **CLI** — `stixdb serve`, `stixdb demo`, `stixdb multi-demo`
|
|
49
|
+
- Full test suite — agent, graph, lineage, search API, OpenAI compatibility, SDK
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Contributing to StixDB
|
|
2
|
+
|
|
3
|
+
Thanks for your interest — all contributions are welcome: bug reports, features, documentation, examples, and storage/embedding backend integrations.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
- Python 3.10+
|
|
12
|
+
- Git
|
|
13
|
+
|
|
14
|
+
### Setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/your-org/stix.git
|
|
18
|
+
cd stix
|
|
19
|
+
|
|
20
|
+
python -m venv .venv
|
|
21
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
22
|
+
|
|
23
|
+
pip install -e ".[dev]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Copy the example env and configure it:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cp .env.example .env
|
|
30
|
+
# Edit .env — at minimum set STIXDB_LLM_PROVIDER=none for testing without an API key
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Run the tests
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pytest tests/ -v
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Tests run in heuristic mode (`LLMProvider.NONE`) by default — no API key needed.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
stix/ Core engine
|
|
47
|
+
agent/ MemoryAgent — AccessPlanner, Consolidator, Worker
|
|
48
|
+
api/ FastAPI server and routes
|
|
49
|
+
context/ ContextBroker (7-phase retrieval) and Reasoner
|
|
50
|
+
graph/ MemoryGraph, node/edge/cluster models
|
|
51
|
+
storage/ StorageBackend implementations (NetworkX, KuzuDB, Neo4j)
|
|
52
|
+
VectorStore implementations (NumPy, ChromaDB, Qdrant)
|
|
53
|
+
EmbeddingClient (sentence-transformers, OpenAI, Ollama, custom)
|
|
54
|
+
ingestion/ Document parsing and chunking
|
|
55
|
+
observability/ Structured logging and trace emission
|
|
56
|
+
|
|
57
|
+
sdk/ Python HTTP client (stixdb-sdk)
|
|
58
|
+
src/stixdb_sdk/ Client, MemoryAPI, QueryAPI, SearchAPI
|
|
59
|
+
|
|
60
|
+
examples/ Runnable examples
|
|
61
|
+
tests/ Automated test suite
|
|
62
|
+
doc/ Architecture and performance documentation
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## How to Contribute
|
|
68
|
+
|
|
69
|
+
### Reporting a bug
|
|
70
|
+
|
|
71
|
+
Open a [GitHub Issue](https://github.com/your-org/stix/issues/new?template=bug_report.md) with:
|
|
72
|
+
- Reproduction steps (minimal code)
|
|
73
|
+
- Your environment (Python version, storage/vector backend, OS)
|
|
74
|
+
- Full stack trace
|
|
75
|
+
|
|
76
|
+
### Requesting a feature
|
|
77
|
+
|
|
78
|
+
Open a [GitHub Issue](https://github.com/your-org/stix/issues/new?template=feature_request.md) describing the problem and your proposed solution.
|
|
79
|
+
|
|
80
|
+
### Submitting a pull request
|
|
81
|
+
|
|
82
|
+
1. Fork the repo and create a branch: `feature/my-thing` or `fix/issue-123`
|
|
83
|
+
2. Make your changes
|
|
84
|
+
3. Add or update tests in `tests/`
|
|
85
|
+
4. Run `pytest tests/ -v` — all tests must pass
|
|
86
|
+
5. Run `ruff check stix/ sdk/src/ && ruff format --check stix/ sdk/src/`
|
|
87
|
+
6. Open a PR with a clear description (use the PR template)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Adding a New Storage Backend
|
|
92
|
+
|
|
93
|
+
Implement `stix/storage/base.py:StorageBackend` and register it in `stix/config.py` under `StorageMode`. See `stix/storage/networkx_backend.py` for the simplest reference implementation.
|
|
94
|
+
|
|
95
|
+
## Adding a New Vector Backend
|
|
96
|
+
|
|
97
|
+
Implement the `VectorStore` protocol in `stix/storage/vector_store.py`. See `MemoryVectorStore` for a minimal reference.
|
|
98
|
+
|
|
99
|
+
## Adding a New LLM Provider
|
|
100
|
+
|
|
101
|
+
Extend `stix/agent/reasoner.py` — add a branch in `Reasoner._call_llm` and register the new value in `LLMProvider`.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Code Style
|
|
106
|
+
|
|
107
|
+
- Formatter: `ruff format` (line length 100)
|
|
108
|
+
- Linter: `ruff check`
|
|
109
|
+
- Logging: `structlog` — never use `print()` in library code
|
|
110
|
+
- Models: Pydantic v2
|
|
111
|
+
- Tests: `pytest` + `pytest-asyncio`
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Security
|
|
116
|
+
|
|
117
|
+
Do not open public issues for security vulnerabilities. See [SECURITY.md](SECURITY.md).
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
By contributing you agree that your contributions are licensed under the [MIT License](LICENSE).
|