agent-knowledge / README.md
Chris4K's picture
Upload README.md
c5f78b3 verified
---
title: Agent Knowledge Store
emoji: πŸ“š
colorFrom: red
colorTo: blue
sdk: docker
pinned: false
short_description: Multi-container Knowledge Base with TVE and MCP
---
# πŸ“š KNOWLEDGE STORE β€” Multi-Container Knowledge Base
Persistent knowledge base with **10 domain containers**, each with its own **temporal value decay model**. Knowledge value scores update continuously based on age, access patterns, and domain-specific decay curves.
## Containers & Decay Models
| Container | Decay Model | Half-life | Notes |
|---|---|---|---|
| **Medical** | Exponential | 180 days | Outdated = dangerous |
| **Legal** | Slow Exponential | 730 days | Laws change rarely |
| **Company** | Tiered | 14–365 days | Market fast, SOPs slow |
| **Research** | Citation Curve | 540 days | Peaks at day 30 |
| **Tech/Docs** | Versioned Decay | 90 days | Tag with version |
| **Prompts** | Stable | ∞ | No decay |
| **History** | Anti-decay | ∞ | Value **increases** with age |
| **Personal** | Drift Decay | 180 days | Preferences drift |
| **Finance** | Extreme Decay | 7 days | Market data decays fast |
| **Operations** | Operational | 180 days | Keep runbooks versioned |
## Knowledge Value Score
`value = (base_importance Γ— 0.5) + (access_bonus Γ— 0.1) + (time_factor Γ— 0.4) Γ— 100`
- `0–39`: Low value (red) β€” consider archiving or updating
- `40–69`: Moderate (yellow) β€” verify freshness
- `70–100`: High value (green) β€” actively useful
## MCP β€” Claude Desktop
```json
{
"mcpServers": {
"knowledge": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://chris4k-agent-knowledge.hf.space/mcp/sse"]
}
}
}
```
## MCP Tools
| Tool | Description |
|---|---|
| `ks_write` | Write a document to a container/folder |
| `ks_read` | Read by container/folder/id |
| `ks_search` | Full-text + tag + container search |
| `ks_list` | List docs in container/folder |
| `ks_delete` | Delete a document |
| `ks_containers` | List containers with counts and avg value |
| `ks_stats` | Overall statistics |
| `ks_top_value` | Highest-value documents right now |
## REST API
```
GET /api/containers
GET /api/docs?container=legal&sort=value
GET /api/docs/search?q=GDPR&container=legal&sort=relevance
GET /api/docs/top-value?container=tech&limit=10
GET /api/docs/{container}/{folder}/{id}
POST /api/docs {"container":"legal","folder":"gdpr","title":"...","body":"...","tags":[],"importance":8}
PATCH /api/docs/{container}/{folder}/{id}
DELETE /api/docs/{container}/{folder}/{id}
GET /api/stats
```
## Agent Usage
```python
import requests
BASE = "https://chris4k-agent-knowledge.hf.space"
# Store knowledge
requests.post(f"{BASE}/api/docs", json={
"container": "tech",
"folder": "api",
"title": "FastAPI Dependency Injection Pattern",
"body": "...",
"tags": ["fastapi", "patterns", "python"],
"importance": 7,
"author": "researcher",
"version": "0.111"
})
# Search
results = requests.get(f"{BASE}/api/docs/search?q=GDPR+deletion&container=legal").json()
# Top value docs right now
top = requests.get(f"{BASE}/api/docs/top-value?limit=5").json()
for doc in top:
print(f"{doc['_value']:>5.1f} [{doc['container']}] {doc['title']}")
```
*Chris4K Β· ki-fusion-labs.de Β· Part of the JARVIS/TheCore agent ecosystem*