๐งฉ Extending the System
This isnโt a black box. This is infrastructure you can fork, rewire, and evolve.
Every subsystem in the stackโmemory, inference, agents, analyticsโis designed to be plug-and-play. If you're building custom tooling or domain-specific LLM systems, this guide shows you exactly where to hook in.
๐ค Build Your Own Agent
Agents are autonomous workers that monitor model behavior, inject logic, or retrain automatically. You can create new ones in seconds:
Create a new file in
backend/agents/
, e.g.my_custom_agent.py
Implement the interface:
Register your agent in
core/registry.py
Trigger it from:
CLI (
cli/agent_runner.py
)Another agent
UI button or
/api/agent/trigger
Agents have access to:
Memory
Logs
Model output
Full prompt lifecycle
๐ง Swap or Extend Your Model
Quick swaps:
Advanced extensions:
Adapter Logic
models/adapter.py
Add support for LoRA, quantization, model-specific config
Tokenization
data/tokenizer.py
Load custom tokenizers or apply task-specific preprocessing
Training Control
models/trainer.py
Adjust parameters based on model type or mode (batch, streaming, prompt injection)
โ๏ธ New API Routes
The API layer is modular and based on FastAPI. You can easily extend it by adding a new route file:
Then plug it into api/server.py
:
๐ Custom Memory Logic
Want smarter recall, tagging, or retrieval?
Switch distance function: Edit
data/vectorizer.py
and replace cosine with dot, L2, or hybrid.Add filters: Inject tag filtering or session context into the vector lookup logic.
Scale up: Swap PostgreSQL for FAISS or Weaviate to support ANN-based search at scale.
Track accuracy: Add logging hooks to log whether vector hits actually improved model outputs.
๐ CLI Tooling (Plug & Extend)
Every CLI script in cli/
has access to core subsystems.
Example custom CLI tool:
Drop-in tools have access to:
Model
Logger
Vector Memory
Agents
Config / .env
Wrap your tools with bash
or run in cron for automation.
๐ Good First Extensions
twitter_agent.py
Agent that scrapes X posts and retrains based on $TOKEN mentions
vector_cleaner.py
CLI script to prune semantic memory entries older than X days
live_model_switch
Add a toggle in UI to hot-swap between Falcon and Mistral
notion_sync.py
Sync LLM outputs or prompts to your personal knowledge repo
embedding_viewer.py
Web UI module for inspecting memory vectors visually
๐ Contributing or Forking
Locentra OS is open-source under the MIT License.
Before opening a PR:
Write tests under
tests/
Document new flags or config keys
Describe exactly what behavior is added or changed
Submit your PR. We review every one.
Last updated