Releases: zacxyonly/SimpleContext
v4.3.0 β App Commands: Official Plugin-to-Host Interface
π App Commands β Kontrak Resmi Plugin β Host
Rilis ini memperkenalkan app_commands sebagai kontrak resmi di BasePlugin
untuk mengekspos command ke aplikasi host (Telegram bot, Discord, CLI, web UI, dll).
Sebelumnya plugin komunitas tidak punya cara standar untuk mendeklarasikan
command β setiap host app punya convention sendiri. Mulai v4.3.0, semua
tersentralisasi di core.
β¨ What's New
AppCommandContext β Interface Platform-Agnostic
from simplecontext.plugins.base import AppCommandContext
ctx = AppCommandContext.create(
command = "search",
user_id = "12345",
args = ["python", "error"],
platform = "telegram", # "discord" | "cli" | "web" | dll
raw = update, # object asli platform (opsional)
sc = sc, # SimpleContext instance (opsional)
)app_commands di BasePlugin
class MyPlugin(BasePlugin):
name = "my_plugin"
app_commands = {
"mycommand": {
"description": "Deskripsi singkat", # wajib
"usage": "/mycommand <query>", # opsional
"handler": "handle_mycommand", # nama method di class ini
"args_hint": "<query>", # opsional
"hidden": False, # opsional, default False
}
}
async def handle_mycommand(self, ctx: AppCommandContext) -> str:
return f"Query: {ctx.args_str}, Platform: {ctx.platform}"get_app_commands() di BasePlugin
Validasi handler exist sebelum return β command yang broken tidak didaftarkan.
on_app_command() di BasePlugin
Fallback hook untuk plugin yang ingin handle semua command di satu method.
app_info di BasePlugin
Dict yang diisi host saat plugin di-load. Plugin bisa tahu platform tempat dia berjalan.
PluginLoader β 3 method baru
| Method | Deskripsi |
|---|---|
get_all_app_commands() |
Agregasi commands dari semua plugin, dengan conflict detection |
fire_app_command(ctx) |
Eksekusi command ke plugin yang tepat via AppCommandContext |
set_app_info(info) |
Inject metadata platform ke semua plugin sekaligus |
π Ecosystem
| Repo | Versi |
|---|---|
| SimpleContext | v4.3.0 β |
| SimpleContext-Plugin | v1.1.0 |
| SimpleContext-Bot | v1.2.0 |
| SimpleContext-Agents | β |
π Full Changelog
feat(plugins):AppCommandContextdataclass β platform-agnostic command interfacefeat(plugins):app_commandsclass attribute diBasePluginfeat(plugins):get_app_commands()dengan handler validationfeat(plugins):on_app_command()fallback hookfeat(plugins):app_infodict β platform metadata injectionfeat(loader):get_all_app_commands()dengan conflict detectionfeat(loader):fire_app_command()dengan fallback keon_app_command()feat(loader):set_app_info()β inject ke semua plugin sekaligusfeat(loader):summary()sekarang includeapp_commandsper pluginfeat: exportAppCommandContextdarisimplecontextpackagechore: bump version4.0.0β4.3.0docs: add Ecosystem section + Call for Contributors di README
v4.2.0 β Fuzzy Search, Memory Graph & Adaptive Scoring
π§ SimpleContext v4.2.0
β¨ New Features
π Fuzzy Search
Typo-tolerant search menggunakan Levenshtein distance murni Python.
Tidak membutuhkan dependency eksternal.
results = sc.fuzzy.search(user_id, "ptyhon debg")
# β akan menemukan "python debug"π§© Memory Graph & Relationships
Menghubungkan node context dalam bentuk graph relationships sehingga fakta bisa saling terhubung dan ditelusuri.
sc.graph.link(node_a.id, node_b.id, "related_to", strength=0.8)
sc.graph.link(node_a.id, node_b.id, "causes")
sc.graph.get_neighbors(node_id)
sc.graph.get_path(start_id, end_id, max_hops=3)Supported relationship types
related_tocausespart_ofcontradictsprecedessupports
β° Pattern Detection
Mendeteksi pola perilaku dari histori interaksi user.
patterns = sc.detect_patterns(user_id, time_window_days=7)Output contoh:
peak_hourstopics_frequencysentiment_trendactivity_streakmost_used_agentcommon_questions
π Smart Compression
Mengompres working memory dengan teknik chunking yang sadar topik
tanpa menggunakan LLM.
sc.smart_compress(user_id, strategy="semantic") # topic boundary detection
sc.smart_compress(user_id, strategy="time") # per session gap
sc.smart_compress(user_id, strategy="token") # by estimated token countπ Adaptive Scoring
Bobot scoring context akan belajar dari feedback user secara adaptif.
sc.feedback(user_id, selected_nodes, score=1.0) # helpful
sc.feedback(user_id, selected_nodes, score=-1.0) # not helpful
sc.adaptive.get_weights(user_id)
sc.adaptive.reset_weights(user_id)πΎ Snapshot & Versioning
Export dan restore snapshot memory dengan label dan timestamp.
snap = sc.snapshot(user_id, label="before_update")
snaps = sc.list_snapshots(user_id)
sc.restore_snapshot(snaps[0]["path"], merge=False)π Stats
- β 161 tests passing
- π¦ Zero external dependencies
- π Fully backward compatible
Semua API dari v3 / v4 / v4.1 tetap berjalan.
π Upgrade from v4.1.0
# Replace simplecontext/ folder with new version
# No config changes needed
# Fully backward compatibleπ Related Projects
- SimpleContext-Agents β 9 agent definitions
- SimpleContext-Bot β Telegram bot integration
v4.1.0 β Tiered Memory & Context Scoring
π§ SimpleContext v4.1.0
First public release.
What's included
- 3-Tier Memory (working / episodic / semantic)
- Intent-aware ContextPlanner
- Context scoring: relevance + importance + recency + path priority
- Rule-based fact extraction
- Jaccard dedup + conflict resolution
- Importance decay
- LRU cache (30s TTL)
- Agent YAML with hot-reload
- Agent chaining
- Plugin system with persistent state
- Multi-storage: SQLite / Redis / PostgreSQL
- 135 tests passing
- Zero external dependencies
Supported LLMs
Gemini, OpenAI, Anthropic Claude, Ollama, and any OpenAI-compatible API.
Full Changelog: https://github.com/zacxyonly/SimpleContext/commits/v4.1.0