File size: 3,314 Bytes
f390f79
c5f78b3
 
 
 
 
f390f79
c5f78b3
f390f79
 
c5f78b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
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*