REST API for the Halbert dashboard.
Code: halbert_core/halbert_core/dashboard/routes/
http://localhost:8000
Start with:
make devInteractive documentation at:
http://localhost:8000/docs
POST /api/chat/send
Content-Type: application/json
Request:
{
"message": "Why is my bcachefs pool failing?",
"mentions": ["@storage", "@service"],
"persona": "guide",
"debug": false,
"current_page": "storage",
"page_context": "Viewing failed pool mount-bcachefs",
"images": [],
"history": [
{"role": "user", "content": "Previous message"},
{"role": "assistant", "content": "Previous response"}
]
}Response:
{
"response": "Looking at the storage discoveries...",
"debug": {
"model_used": "llama3.1:70b",
"model_type": "specialist",
"complexity_score": 0.7,
"tokens_used": 512
}
}POST /api/chat/config
Content-Type: application/json
Request:
{
"message": "Add a comment at the end",
"file_path": "/etc/samba/smb.conf",
"file_content": "# Current file content...",
"history": [],
"images": []
}Response:
{
"response": "I'll add the comment...",
"edit_blocks": [
{"search": "last line", "replace": "last line\n# Added comment"}
],
"proposed_content": "# Full file with edits applied...",
"summary": "Added comment at end of file"
}GET /api/models/loaded
Returns currently loaded models and their status.
GET /api/chat/memory/stats
Response:
{
"status": "ok",
"chromadb_available": true,
"memory_events": 150,
"collections": {
"self_knowledge_all": 500,
"self_conversations": 150,
"self_hwmon": 0,
"self_journald": 0
}
}POST /api/chat/memory/query
Content-Type: application/json
{
"query": "bcachefs mount failure",
"k": 5,
"collection": "self_conversations"
}
Response:
{
"status": "ok",
"query": "bcachefs mount failure",
"results": [
{
"content": "The bcachefs pool failed because...",
"role": "assistant",
"conversation_id": "conv-123",
"distance": 0.45
}
],
"count": 1
}GET /api/chat/memory/collections
Response:
{
"status": "ok",
"collections": [
{"name": "self_conversations", "count": 150, "known": true},
{"name": "self_knowledge_all", "count": 500, "known": true},
{"name": "self_journald", "count": 0, "known": true},
{"name": "self_hwmon", "count": 0, "known": true}
]
}GET /api/chat/memory/entries/{collection}?limit=50&offset=0
Response:
{
"status": "ok",
"collection": "self_conversations",
"entries": [
{
"id": "conv:abc123:1702580400000",
"content": "Why is my bcachefs pool failing?",
"metadata": {
"role": "user",
"conversation_id": "abc123",
"timestamp": "1702580400",
"page": "storage"
}
}
],
"count": 50
}DELETE /api/chat/memory/entry/{collection}/{entry_id}
Response:
{
"status": "ok",
"deleted": true
}POST /api/chat/memory/delete/{collection}
Content-Type: application/json
{
"entry_ids": ["id1", "id2", "id3"]
}
Response:
{
"status": "ok",
"deleted": 3
}POST /api/chat/memory/clear/{collection}
Response:
{
"status": "ok",
"cleared": true
}Telemetry ingestion service for journald and hwmon collection.
GET /api/settings/ingestion/status
Response:
{
"running": true,
"started_at": "2025-12-14T10:30:00",
"journald_events": 156,
"hwmon_events": 42,
"last_journald_event": "2025-12-14T10:35:22",
"last_hwmon_event": "2025-12-14T10:35:30",
"errors": 0,
"config_path": "/home/user/.config/halbert/ingestion.yml"
}POST /api/settings/ingestion/start
Starts the background telemetry collection.
POST /api/settings/ingestion/stop
Stops the background telemetry collection.
GET /api/discovery/{type}
Types: storage, service, network, container, gpu, sharing, security, backup
Response:
{
"discoveries": [
{
"id": "disk-nvme0n1",
"type": "storage",
"name": "nvme0n1",
"title": "Samsung 980 PRO",
"status": "healthy",
"data": {...}
}
]
}POST /api/discovery/scan
Triggers a fresh system discovery scan.
GET /api/conversations
POST /api/conversations
Content-Type: application/json
{"name": "Troubleshooting disk", "persona": "guide"}
GET /api/conversations/{id}
DELETE /api/conversations/{id}
POST /api/conversations/{id}/messages
Content-Type: application/json
{"role": "user", "content": "Message text", "mentions": []}
GET /api/settings/endpoints # List saved endpoints
POST /api/settings/endpoints # Save/update endpoint
DELETE /api/settings/endpoints/{id} # Delete endpoint
GET /api/settings/endpoints/{id}/models # List models from endpoint
POST /api/settings/endpoints/{id}/test # Test connectivity
POST /api/settings/assign/guide # Assign guide model
POST /api/settings/assign/specialist # Assign specialist model
POST /api/settings/assign/vision # Assign vision model
POST /api/settings/guide/clear # Clear guide assignment
Request:
{
"endpoint_id": "local-ollama",
"model": "llama3.1:8b"
}GET /api/settings/ai-rules # List rules
POST /api/settings/ai-rules # Create rule
PUT /api/settings/ai-rules/{id} # Update rule
DELETE /api/settings/ai-rules/{id} # Delete rule
Rule Schema:
{
"id": "rule-123",
"text": "bcachefs requires kernel 6.8 or earlier",
"priority": "high",
"category": "storage",
"enabled": true
}GET /api/editor/file?path=/etc/samba/smb.conf
POST /api/editor/file
Content-Type: application/json
{
"path": "/etc/samba/smb.conf",
"content": "# New content..."
}
GET /api/editor/backups?path=/etc/samba/smb.conf
POST /api/editor/restore
{"path": "/etc/samba/smb.conf", "backup": "smb.conf.bak.1234567890"}
POST /api/terminal/execute
Content-Type: application/json
{"command": "systemctl status nginx"}
Response:
{
"output": "● nginx.service - A high performance web server...",
"error": "",
"exit_code": 0
}POST /api/services/{name}/start
POST /api/services/{name}/stop
POST /api/services/{name}/restart
GET /api/services/{name}/logs?lines=100
GET /api/approvals/pending
POST /api/approvals/{id}/approve
POST /api/approvals/{id}/reject
{"reason": "Approved by admin"}
GET /api/settings/policy
Response:
{
"status": "ok",
"policy": {
"default_allow": true,
"tools": {
"write_config": {"allow": true},
"schedule_cron": {"allow": true}
}
},
"path": "/home/user/.config/halbert/policy.yml"
}POST /api/settings/policy
Content-Type: application/json
{
"policy": {
"default_allow": true,
"tools": {"dangerous_tool": {"allow": false}}
}
}
POST /api/settings/policy/tool
Content-Type: application/json
{"tool": "write_config", "allow": true}
DELETE /api/settings/policy/tool/{tool_name}
GET /api/settings/guardrails/status
Response:
{
"status": "ok",
"safe_mode_active": false,
"config": {"confidence_threshold": 0.8, "cpu_budget": 80}
}POST /api/settings/guardrails/safe-mode/enter
Content-Type: application/json
{"reason": "Manual activation"}
POST /api/settings/guardrails/safe-mode/exit
GET /api/settings/anomaly/status
Response:
{
"status": "ok",
"summary": {
"total_anomalies_24h": 2,
"critical_anomalies_24h": 0,
"failure_streak": 0,
"recent_error_rate": 0.0
},
"recent_anomalies": [
{
"timestamp": "2025-12-14T10:30:00",
"type": "cpu_spike",
"severity": "warning",
"description": "CPU usage 95% above threshold 90%"
}
]
}POST /api/settings/anomaly/check
Runs anomaly detection checks immediately.
GET /api/settings/recovery/status
POST /api/settings/recovery/rollback
Content-Type: application/json
{"file_path": "/etc/myapp/config.yml"}
POST /api/settings/recovery/restart-service
Content-Type: application/json
{"service": "nginx"}
POST /api/settings/recovery/alert
Content-Type: application/json
{"message": "Recovery alert", "severity": "warning"}
POST /api/settings/simulate/tool
Content-Type: application/json
{
"tool": "write_config",
"args": {"path": "/etc/app.conf", "content": "new content"}
}
Response:
{
"status": "ok",
"simulation": {
"success": true,
"action": "Write file: /etc/app.conf",
"changes": [{"type": "file_modify", "path": "/etc/app.conf", "diff": "..."}],
"warnings": [],
"reversible": true,
"rollback_strategy": "Restore /etc/app.conf from backup",
"estimated_duration_s": 0.1
}
}POST /api/settings/simulate/file-write
Content-Type: application/json
{"path": "/etc/app.conf", "content": "new content"}
POST /api/settings/simulate/command
Content-Type: application/json
{"command": "apt update", "dry_run_flag": "--dry-run"}
POST /api/settings/simulate/service-restart
Content-Type: application/json
{"service": "nginx"}
Real-time updates via WebSocket connection.
ws://localhost:8000/ws
| Type | Description |
|---|---|
system_status |
System metrics every 5s |
approval_request |
New approval needed |
job_update |
Scheduler job status changed |
decision |
LLM decision made |
chat_token |
Streaming chat token |
chat_complete |
Chat response complete |
Chat Token Message:
{
"type": "chat_token",
"data": {
"request_id": "req-123",
"token": "Hello",
"done": false
}
}GET /api/settings/scheduler/status
GET /api/settings/scheduler/jobs
POST /api/settings/scheduler/cancel/{job_id}
No authentication by default. Dashboard binds to 127.0.0.1 only.
For network access, run with --host 0.0.0.0 but note this exposes the API without auth.