Spaces:
Sleeping
Sleeping
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,13 +1,105 @@
|
|
| 1 |
---
|
| 2 |
-
title: Agent Knowledge
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 6.9.0
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
short_description:
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Agent Knowledge Store
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
+
short_description: Multi-container Knowledge Base with TVE and MCP
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# π KNOWLEDGE STORE β Multi-Container Knowledge Base
|
| 12 |
+
|
| 13 |
+
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.
|
| 14 |
+
|
| 15 |
+
## Containers & Decay Models
|
| 16 |
+
|
| 17 |
+
| Container | Decay Model | Half-life | Notes |
|
| 18 |
+
|---|---|---|---|
|
| 19 |
+
| **Medical** | Exponential | 180 days | Outdated = dangerous |
|
| 20 |
+
| **Legal** | Slow Exponential | 730 days | Laws change rarely |
|
| 21 |
+
| **Company** | Tiered | 14β365 days | Market fast, SOPs slow |
|
| 22 |
+
| **Research** | Citation Curve | 540 days | Peaks at day 30 |
|
| 23 |
+
| **Tech/Docs** | Versioned Decay | 90 days | Tag with version |
|
| 24 |
+
| **Prompts** | Stable | β | No decay |
|
| 25 |
+
| **History** | Anti-decay | β | Value **increases** with age |
|
| 26 |
+
| **Personal** | Drift Decay | 180 days | Preferences drift |
|
| 27 |
+
| **Finance** | Extreme Decay | 7 days | Market data decays fast |
|
| 28 |
+
| **Operations** | Operational | 180 days | Keep runbooks versioned |
|
| 29 |
+
|
| 30 |
+
## Knowledge Value Score
|
| 31 |
+
|
| 32 |
+
`value = (base_importance Γ 0.5) + (access_bonus Γ 0.1) + (time_factor Γ 0.4) Γ 100`
|
| 33 |
+
|
| 34 |
+
- `0β39`: Low value (red) β consider archiving or updating
|
| 35 |
+
- `40β69`: Moderate (yellow) β verify freshness
|
| 36 |
+
- `70β100`: High value (green) β actively useful
|
| 37 |
+
|
| 38 |
+
## MCP β Claude Desktop
|
| 39 |
+
|
| 40 |
+
```json
|
| 41 |
+
{
|
| 42 |
+
"mcpServers": {
|
| 43 |
+
"knowledge": {
|
| 44 |
+
"command": "npx",
|
| 45 |
+
"args": ["-y", "mcp-remote", "https://chris4k-agent-knowledge.hf.space/mcp/sse"]
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## MCP Tools
|
| 52 |
+
|
| 53 |
+
| Tool | Description |
|
| 54 |
+
|---|---|
|
| 55 |
+
| `ks_write` | Write a document to a container/folder |
|
| 56 |
+
| `ks_read` | Read by container/folder/id |
|
| 57 |
+
| `ks_search` | Full-text + tag + container search |
|
| 58 |
+
| `ks_list` | List docs in container/folder |
|
| 59 |
+
| `ks_delete` | Delete a document |
|
| 60 |
+
| `ks_containers` | List containers with counts and avg value |
|
| 61 |
+
| `ks_stats` | Overall statistics |
|
| 62 |
+
| `ks_top_value` | Highest-value documents right now |
|
| 63 |
+
|
| 64 |
+
## REST API
|
| 65 |
+
|
| 66 |
+
```
|
| 67 |
+
GET /api/containers
|
| 68 |
+
GET /api/docs?container=legal&sort=value
|
| 69 |
+
GET /api/docs/search?q=GDPR&container=legal&sort=relevance
|
| 70 |
+
GET /api/docs/top-value?container=tech&limit=10
|
| 71 |
+
GET /api/docs/{container}/{folder}/{id}
|
| 72 |
+
POST /api/docs {"container":"legal","folder":"gdpr","title":"...","body":"...","tags":[],"importance":8}
|
| 73 |
+
PATCH /api/docs/{container}/{folder}/{id}
|
| 74 |
+
DELETE /api/docs/{container}/{folder}/{id}
|
| 75 |
+
GET /api/stats
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Agent Usage
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
import requests
|
| 82 |
+
BASE = "https://chris4k-agent-knowledge.hf.space"
|
| 83 |
+
|
| 84 |
+
# Store knowledge
|
| 85 |
+
requests.post(f"{BASE}/api/docs", json={
|
| 86 |
+
"container": "tech",
|
| 87 |
+
"folder": "api",
|
| 88 |
+
"title": "FastAPI Dependency Injection Pattern",
|
| 89 |
+
"body": "...",
|
| 90 |
+
"tags": ["fastapi", "patterns", "python"],
|
| 91 |
+
"importance": 7,
|
| 92 |
+
"author": "researcher",
|
| 93 |
+
"version": "0.111"
|
| 94 |
+
})
|
| 95 |
+
|
| 96 |
+
# Search
|
| 97 |
+
results = requests.get(f"{BASE}/api/docs/search?q=GDPR+deletion&container=legal").json()
|
| 98 |
+
|
| 99 |
+
# Top value docs right now
|
| 100 |
+
top = requests.get(f"{BASE}/api/docs/top-value?limit=5").json()
|
| 101 |
+
for doc in top:
|
| 102 |
+
print(f"{doc['_value']:>5.1f} [{doc['container']}] {doc['title']}")
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
*Chris4K Β· ki-fusion-labs.de Β· Part of the JARVIS/TheCore agent ecosystem*
|