Implementation:AMAP ML SkillClaw Dashboard Store
| Knowledge Sources | |
|---|---|
| Domains | Dashboard, Database, Skill_Evolution |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete SQLite-backed projection store that materializes skills, sessions, validation jobs, and session-skill links into queryable tables for the SkillClaw dashboard.
Description
The DashboardStore class manages a SQLite database with WAL journal mode that stores the materialized dashboard snapshot. It creates six tables: `meta` (key-value), `skills` (with 24 columns including source, version, SHA, usage counts, effectiveness), `skill_versions` (version history per skill), `sessions` (with timestamps, PRM scores, previews), `session_skill_links` (many-to-many relationships with relation type and count), and `validation_jobs` (with results and decision status). The `replace_snapshot()` method performs an atomic full replacement — deleting all rows and re-inserting from a snapshot dictionary. Query methods support filtering by search text, category, source, and skill_id with proper indexing. The store automatically initializes tables on first access.
Usage
Import and use when you need to:
- Persist dashboard snapshots for fast querying without touching shared storage
- Query skills with filtering (search, category, source) and pagination
- Retrieve skill detail with version history and related sessions
- List sessions with skill links and outcome metadata
- List validation jobs with result counts and decision status
- Get overview metrics (counts, top skills, recent sessions, categories)
Code Reference
Source Location
- Repository: SkillClaw
- File: `skillclaw/dashboard_store.py:L1-666`
Signature
class DashboardStore:
"""Materialized dashboard snapshot stored in SQLite."""
def __init__(self, db_path: str) -> None:
self.db_path = str(Path(db_path).expanduser())
def initialize(self) -> None:
"""Create all tables and indexes if they don't exist (WAL mode)."""
def replace_snapshot(self, snapshot: dict[str, Any]) -> dict[str, Any]:
"""Atomically replace all data with a new snapshot. Returns summary dict."""
def get_meta(self) -> dict[str, Any]:
"""Return all meta key-value pairs."""
def list_skills(self, *, search: str = "", category: str = "",
source: str = "", limit: int = 500) -> list[dict[str, Any]]:
"""Query skills with optional filtering."""
def get_skill(self, skill_id: str) -> dict[str, Any] | None:
"""Get full skill detail with versions and related sessions."""
def list_sessions(self, *, skill_id: str = "", search: str = "",
limit: int = 200) -> list[dict[str, Any]]:
"""Query sessions with optional skill_id and search filtering."""
def get_session(self, session_id: str) -> dict[str, Any] | None:
"""Get full session detail with skill links."""
def list_validation_jobs(self, *, status: str = "",
limit: int = 200) -> list[dict[str, Any]]:
"""Query validation jobs with optional status filter."""
def get_overview(self) -> dict[str, Any]:
"""Return overview metrics: counts, top skills, recent sessions, categories."""
Import
from skillclaw.dashboard_store import DashboardStore
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| db_path | str | Yes | SQLite database file path |
| snapshot | dict[str, Any] | Yes (for replace_snapshot) | Complete snapshot from build_dashboard_snapshot() |
| snapshot["skills"] | list[dict] | Yes | Skill records to insert |
| snapshot["sessions"] | list[dict] | Yes | Session records to insert |
| snapshot["session_skill_links"] | list[dict] | Yes | Session-skill link records |
| snapshot["validation_jobs"] | list[dict] | Yes | Validation job records |
| snapshot["meta"] | dict | Yes | Meta key-value pairs |
Outputs
| Name | Type | Description |
|---|---|---|
| replace_snapshot returns | dict | Summary with counts (skills, sessions, validation_jobs) and warnings |
| list_skills returns | list[dict] | Skill summary dicts sorted by session_count desc |
| get_skill returns | None | Full skill with versions, related_sessions, and raw payload |
| list_sessions returns | list[dict] | Session summaries with skill_names and outcome |
| get_session returns | None | Session with turns and skill links |
| get_overview returns | dict | Counts, top_skills (8), recent_sessions (8), categories, meta |
Usage Examples
Basic Snapshot Storage and Query
from skillclaw.config import SkillClawConfig
from skillclaw.dashboard_ingest import build_dashboard_snapshot
from skillclaw.dashboard_store import DashboardStore
config = SkillClawConfig.from_env()
# Build and store snapshot
snapshot = build_dashboard_snapshot(config)
store = DashboardStore(config.dashboard_db_path)
summary = store.replace_snapshot(snapshot)
print(f"Stored {summary['skills']} skills, {summary['sessions']} sessions")
# Query skills
skills = store.list_skills(search="python", limit=50)
for skill in skills:
print(f" {skill['name']} ({skill['source']}, v{skill['current_version']})")
Get Skill Detail with Versions
from skillclaw.dashboard_store import DashboardStore
store = DashboardStore("/path/to/dashboard.db")
store.initialize()
skill = store.get_skill("abc123def456")
if skill:
print(f"Skill: {skill['name']}")
print(f"Versions: {len(skill['versions'])}")
for version in skill["versions"]:
print(f" v{version['version']} - {version['action']} - {version['timestamp']}")
print(f"Related sessions: {len(skill['related_sessions'])}")
Get Overview Metrics
from skillclaw.dashboard_store import DashboardStore
store = DashboardStore("/path/to/dashboard.db")
overview = store.get_overview()
print(f"Total skills: {overview['counts']['skills']}")
print(f"Local skills: {overview['counts']['local_skills']}")
print(f"Shared skills: {overview['counts']['shared_skills']}")
print(f"Open validation jobs: {overview['counts']['open_validation_jobs']}")
print(f"Top skill: {overview['top_skills'][0]['name'] if overview['top_skills'] else 'none'}")