Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AI-enhanced knowledge base with semantic search - Knowledge that endures

License

Notifications You must be signed in to change notification settings

Fortemi/fortemi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

384 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fortémi

Pronounced: for-TAY-mee

Memory that understands.

Most storage systems are passive—they hold your data and wait for exact queries. Fortémi is different. It's an intelligent memory system that actually comprehends what you store: the meaning behind your notes, the relationships between ideas, and the context that connects them.

Ask it a question, and it doesn't just search for matching words. It finds answers that are conceptually relevant, even when you can't remember the right terminology. Store a document, and it automatically discovers how that knowledge connects to everything else you know. Over time, your knowledge base becomes a living network that grows smarter with every piece of information you add.

Built in Rust. Backed by PostgreSQL. Powered by embeddings. No cloud dependency required.

Under the hood: Hybrid retrieval (BM25 + dense vectors), automatic knowledge graph, 131 document types, W3C SKOS vocabularies, multi-memory isolation, OAuth2 auth, 37 MCP agent tools, and multimodal media processing. ~85k lines of Rust.

License


Quick Navigation

Audience Start Here
New Users Getting Started · Use Cases
Developers Quick Start · API Docs · Search Guide
AI Agents MCP Server · MCP Deployment
Operators Configuration · Operators Guide
Security Authentication · Encryption

What It Does

  • Understands meaning — Semantic search finds related content even without keyword matches
  • Discovers connections — Automatically links related notes via embedding similarity
  • Enhances content — RAG pipeline enriches notes with context from related knowledge
  • Processes media — Extracts knowledge from images, audio, video, and 3D models
  • Isolates tenants — Parallel memory archives with schema-level isolation and federated search
  • Streams events — Real-time SSE, WebSocket, and webhook notifications

See Use Cases for deployment patterns and Executive Summary for a capabilities overview.

Key Capabilities

Capability What It Does
Hybrid Search RRF fusion of BM25 + dense retrieval (details)
Multilingual FTS CJK bigrams, emoji trigrams, 6+ language stemmers (details)
Knowledge Graph Automatic linking at >70% similarity with graph exploration, community detection, and maintenance pipeline (details)
SKOS Vocabularies W3C controlled vocabulary with hierarchical concepts (details)
Multi-Memory Schema-isolated archives with federated cross-archive search (details)
Authentication OAuth2 + API keys, opt-in enforcement (details)
Media Processing Vision, audio, video, 3D model extraction (details)
Embedding Sets MRL dimensionality reduction, auto-embed, two-stage retrieval (details)
Real-Time Events SSE + WebSocket + webhook notifications (details)
Spatial-Temporal PostGIS location + time range queries
Encryption X25519/AES-256-GCM public-key encryption (details)
131 Document Types Auto-detection with optimized chunking per type (details)

Quick Start

Docker Bundle (Recommended)

Includes PostgreSQL, API server, and MCP server in one container:

docker compose -f docker-compose.bundle.yml up -d
curl http://localhost:3000/health

Ports: 3000 (API + Swagger UI at /docs), 3001 (MCP)

Clean reset: docker compose -f docker-compose.bundle.yml down -v && docker compose -f docker-compose.bundle.yml up -d

From Source

# Prerequisites: Rust 1.70+, PostgreSQL 18+ with pgvector, Ollama (optional)
psql -c "CREATE EXTENSION IF NOT EXISTS vector;"
for f in migrations/*.sql; do psql -d matric -f "$f"; done
DATABASE_URL="postgres://matric:matric@localhost/matric" cargo run --release -p matric-api

Try It

# Hybrid search (default: BM25 + semantic + RRF)
curl "http://localhost:3000/api/v1/search?q=retrieval+augmented+generation"

# Browse all endpoints
open http://localhost:3000/docs

See Getting Started for the full walkthrough and API docs for all endpoints.


Architecture

┌─────────────────────────────────────────────────────────────────┐
│                          Fortemi                                │
├──────────────────┬──────────────────────────────────────────────┤
│  matric-api      │ HTTP REST API with OpenAPI/Swagger           │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-search   │ Hybrid retrieval (BM25 + dense + RRF)        │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-jobs     │ Async NLP pipeline (embedding, RAG, linking) │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-inference│ LLM abstraction (Ollama, OpenAI backends)    │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-db       │ PostgreSQL + pgvector + PostGIS repositories  │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-crypto   │ X25519/AES-256-GCM public-key encryption     │
├──────────────────┼──────────────────────────────────────────────┤
│  matric-core     │ Core types, traits, and error handling       │
├──────────────────┼──────────────────────────────────────────────┤
│  mcp-server      │ MCP agent integration (Node.js, 37 tools)    │
└──────────────────┴──────────────────────────────────────────────┘

See Architecture for detailed system design with research citations.


MCP Server

37 core agent tools via Model Context Protocol. Docker bundle exposes MCP on port 3001.

Connect (.mcp.json or Claude Desktop):

{
  "mcpServers": {
    "fortemi": { "url": "https://your-domain.com/mcp" }
  }
}

Local stdio (development): node mcp-server/index.js with MATRIC_MEMORY_URL=http://localhost:3000

Set MCP_TOOL_MODE=full for all 202 granular tools. See MCP Guide · MCP Deployment.


Multi-Memory

Parallel memory archives with schema-level isolation. Select per request via X-Fortemi-Memory header. Search across all archives with federated search.

See Multi-Memory Guide · Agent Strategies.


Authentication

Opt-in via REQUIRE_AUTH=true. Supports OAuth2 (client credentials + authorization code) and API keys. Public endpoints (/health, /docs, /oauth/*) always accessible.

See Authentication Guide.


Configuration

Key variables (see full reference for all ~27 variables):

Variable Default Description
DATABASE_URL postgres://localhost/matric PostgreSQL connection
PORT 3000 API server port
REQUIRE_AUTH false Enable OAuth2/API key auth
ISSUER_URL https://localhost:3000 OAuth2 issuer URL
OLLAMA_BASE http://localhost:11434 Ollama API endpoint
OLLAMA_EMBED_MODEL nomic-embed-text Embedding model
OLLAMA_VISION_MODEL qwen3-vl:8b Vision model for image description
WHISPER_BASE_URL http://localhost:8000 Audio transcription endpoint
MAX_MEMORIES 10 Max archives (see capacity planning)
MCP_TOOL_MODE core core (37 tools) or full (all)

Development

cargo test --workspace                        # Run tests
cargo fmt && cargo clippy -- -D warnings      # Format + lint
RUST_LOG=debug cargo run -p matric-api        # Run with logging

See CI/CD for pipeline details.


Documentation

Getting Started

Features

Operations

Technical


References

  • Cormack, G. V., Clarke, C. L. A., & Büttcher, S. (2009). "Reciprocal rank fusion outperforms condorcet and individual rank learning methods." SIGIR '09.
  • Lewis, P., et al. (2020). "Retrieval-augmented generation for knowledge-intensive NLP tasks." NeurIPS 2020.
  • Reimers, N., & Gurevych, I. (2019). "Sentence-BERT: Sentence embeddings using siamese BERT-networks." EMNLP 2019.
  • Malkov, Y. A., & Yashunin, D. A. (2020). "Efficient and robust approximate nearest neighbor search using HNSW." IEEE TPAMI.
  • Hogan, A., et al. (2021). "Knowledge graphs." ACM Computing Surveys.
  • Kusupati, A., et al. (2022). "Matryoshka representation learning." NeurIPS 2022.
  • Miles, A., & Bechhofer, S. (2009). "SKOS simple knowledge organization system reference." W3C Recommendation.

See docs/research/ for detailed paper analyses.


Related Projects

  • HotM - Knowledge management frontend

About

AI-enhanced knowledge base with semantic search - Knowledge that endures

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •