Meta Skill Datastore
When to Use
Trigger phrases:
- "meta skill datastore"
- "Help me with meta skill datastore"
Use cases:
- When the task matches this skill's domain expertise
When NOT to use:
- For tasks outside this skill's scope
/meta-datastore record-execution --skill seo-optimizer --success true --latency 245
Query performance
/meta-datastore query "SELECT AVG(latency_ms) FROM skill_executions WHERE skill_name='seo-optimizer'"
Get improvement candidates
/meta-datastore get-improvements --min-impact 0.7 --status proposed
### Integration
Connects to:
- performance-monitor (writes metrics)
- feedback-collector (stores feedback)
- pattern-recognition (queries patterns)
- skill-evolution (tracks versions)
## When NOT to Use
- When the skill is stable and not changing
- For skills with fewer than 10 invocations (not enough data)
- When manual curation produces better results
## Overview
Meta Skill Datastore is a foundational meta-skills skill that provides skill management capabilities for the agent ecosystem.
## Architecture
- **Input layer** — Receives and validates incoming requests
- **Processing layer** — Core logic for skill management
- **Output layer** — Formats and delivers results
- **State management** — Maintains context across invocations
## Configuration
- Set up required environment variables and paths
- Configure logging level and output format
- Define resource limits (memory, time, API calls)
- Enable/disable features via configuration flags
## Integration
- Exposes standard interfaces for other skills to consume
- Supports event-driven and request-response patterns
- Compatible with the 1ai-skills hook system
- Logs metrics for the skill performance monitor
## Anti-Rationalization Table
| Rationalization | Reality |
|---|---|
| "Skills do not need to evolve" | Static skills become outdated. Self-evolving skills improve continuously. |
| "Manual skill management is fine" | With 1000+ skills, manual management is impossible. Automate. |
| "Performance does not matter" | Skill performance directly impacts agent effectiveness. Track it. |
| "SQLite is too simple for metrics" | SQLite handles millions of rows for single-agent deployments; operational overhead of a full DBMS is wasted. |
| "Just log to a file" | Structured queryability enables cross-skill pattern discovery that flat file grep cannot provide. |
| "Feedback is subjective noise" | Aggregated feedback across 100+ invocations reveals statistically significant improvement signals. |
## Process
### Preparation
- Define the metrics schema: latency, success rate, token usage, error category.
- Configure retention policies: daily aggregation, monthly archival, yearly purge.
- Validate the SQLite database file path and ensure write permissions.
### Execution
- Record every skill invocation with name, timestamp, duration, success/failure, and error type.
- Store feedback as structured JSON with rating, free-text comments, and invocation reference.
- Run weekly aggregation queries to compute quartile performance bounds per skill.
### Stewardship
- Monitor database file size; compact with `VACUUM` quarterly.
- Archive data older than 90 days to compressed JSONL for long-term trend analysis.
- Update schema via migration scripts rather than destructive recreations.
## Workflow
1. **Instrument** — Add a `record_execution()` call at the end of every skill's main function to capture latency, success, and tokens.
2. **Collect** — Batch-write execution records into the datastore; use WAL mode for concurrent access.
3. **Analyze** — Run weekly SQL queries identifying skills with degrading performance or rising error rates.
4. **Feedback ingest** — Accept structured feedback records tied to specific invocation IDs for full traceability.
5. **Pattern detect** — Join execution data with feedback to surface skills performing well technically but poorly in user ratings.
6. **Version track** — Store skill SKILL.md content hashes alongside executions to correlate version changes with performance shifts.
7. **Report** — Generate a weekly meta-datastore digest showing top-5 improvement candidates with supporting evidence.
## Verification
- [ ] All steps executed successfully
- [ ] Results validated against acceptance criteria
- [ ] Error handling tested with edge cases
- [ ] Documentation updated with findings
- [ ] SQLite database file created and writable
- [ ] record_execution inserts rows without error
- [ ] Query by skill_name returns correct aggregation
- [ ] Feedback records link to valid invocation IDs
- [ ] VACUUM runs without locking concurrent readers
- [ ] Schema migration applies without data loss
## Code Examples
```python
import sqlite3
import json
from datetime import datetime, timezone
DB_PATH = "~/.1ai/meta-datastore.db"
def record_execution(skill_name: str, success: bool, latency_ms: int,
tokens_used: int = 0, error_type: str = "") -> int:
"""Record a skill execution and return the invocation ID."""
conn = sqlite3.connect(DB_PATH)
conn.execute("""CREATE TABLE IF NOT EXISTS skill_executions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
skill_name TEXT NOT NULL,
timestamp TEXT NOT NULL,
success INTEGER NOT NULL,
latency_ms INTEGER NOT NULL,
tokens_used INTEGER DEFAULT 0,
error_type TEXT DEFAULT ''
)""")
cur = conn.execute(
"INSERT INTO skill_executions(skill_name, timestamp, success, latency_ms, tokens_used, error_type) "
"VALUES (?, ?, ?, ?, ?, ?)",
(skill_name, datetime.now(timezone.utc).isoformat(), int(success), latency_ms, tokens_used, error_type)
)
conn.commit()
conn.close()
return cur.lastrowid
def get_avg_latency(skill_name: str) -> float:
"""Return average latency for a skill over the last 100 runs."""
conn = sqlite3.connect(DB_PATH)
row = conn.execute(
"SELECT AVG(latency_ms) FROM skill_executions "
"WHERE skill_name = ? ORDER BY id DESC LIMIT 100",
(skill_name,)
).fetchone()
conn.close()
return row[0] if row[0] else 0.0
def store_feedback(invocation_id: int, rating: int, comment: str) -> None:
"""Attach feedback to a specific skill execution."""
conn = sqlite3.connect(DB_PATH)
conn.execute("""CREATE TABLE IF NOT EXISTS feedback (
id INTEGER PRIMARY KEY AUTOINCREMENT,
invocation_id INTEGER NOT NULL,
rating INTEGER CHECK(rating BETWEEN 1 AND 5),
comment TEXT,
created TEXT NOT NULL,
FOREIGN KEY (invocation_id) REFERENCES skill_executions(id)
)""")
conn.execute(
"INSERT INTO feedback(invocation_id, rating, comment, created) VALUES (?, ?, ?, ?)",
(invocation_id, rating, comment, datetime.now(timezone.utc).isoformat())
)
conn.commit()
conn.close()
def get_improvement_candidates(min_invocations: int = 10) -> list[dict]:
"""Return skills with high latency or low success rate needing improvement."""
conn = sqlite3.connect(DB_PATH)
rows = conn.execute("""
SELECT skill_name, COUNT(*) as runs,
AVG(latency_ms) as avg_lat,
AVG(success) as success_rate
FROM skill_executions
GROUP BY skill_name
HAVING runs >= ?
ORDER BY success_rate ASC, avg_lat DESC
""", (min_invocations,)).fetchall()
conn.close()
return [
{"skill": r[0], "runs": r[1], "avg_latency_ms": round(r[2], 1), "success_rate": round(r[3], 2)}
for r in rows
]
Common Issues
| Error |
Root Cause |
Fix |
database is locked |
Concurrent writes from parallel skill invocations |
Enable WAL mode: PRAGMA journal_mode=WAL; |
no such table |
First run without schema initialization |
Call record_execution once to auto-create tables |
disk full |
Unbounded metric growth exceeding disk quota |
Add retention: DELETE FROM skill_executions WHERE id NOT IN (SELECT id FROM skill_executions ORDER BY id DESC LIMIT 10000) |
FOREIGN KEY constraint failed |
Orphaned feedback referencing deleted invocation |
Cascade delete: add ON DELETE CASCADE to feedback FK |
inconsistent results |
Concurrent read during write without transaction isolation |
Wrap writes in BEGIN IMMEDIATE / END blocks |
Monetization
| Approach |
Timeframe |
Description |
| Meta-skill analytics SaaS |
3-6 months |
Hosted dashboard showing cross-skill performance trends, regression alerts, and improvement recommendations for agent teams |
| Custom integration consulting |
1-3 months |
Deploy the datastore schema and reporting pipeline into existing agent orchestration platforms (LangChain, CrewAI, AutoGen) |
| Performance benchmarking service |
2-4 months |
Run standardized skill workloads, publish comparative benchmarks, charge for detailed per-skill diagnostic reports |
| Managed datastore plugin |
1-2 months |
Bundle as a ready-to-install plugin for OMP / 1ai-hub with automated setup, migration management, and backup scheduling |
| Open-core enterprise license |
3-9 months |
Free single-agent SQLite version; paid multi-agent PostgreSQL backend with sharding and real-time dashboards |
1---2name: meta-skill-datastore3description: Use when centralized database for meta-skill operations. Stores performance4 metrics, feedback, patterns, and skill evolution history. Use when working with5 meta skill datastore.6domain: meta7author: oyi778license: Apache-2.09subdomain: meta-skills10tags:11- datastore12- meta13- meta-learning14- self-improvement15- skill16- skill-evolution17version: 1.0.018category: meta19metadata:20 source: https://skillmd.com/skills/oyi77/meta-skill-datastore21---2223# Meta Skill Datastore2425## When to Use2627**Trigger phrases:**28- "meta skill datastore"29- "Help me with meta skill datastore"3031**Use cases:**32- When the task matches this skill's domain expertise3334**When NOT to use:**35- For tasks outside this skill's scope3637/meta-datastore record-execution --skill seo-optimizer --success true --latency 2453839# Query performance40/meta-datastore query "SELECT AVG(latency_ms) FROM skill_executions WHERE skill_name='seo-optimizer'"4142# Get improvement candidates43/meta-datastore get-improvements --min-impact 0.7 --status proposed44```4546### Integration4748Connects to:49- performance-monitor (writes metrics)50- feedback-collector (stores feedback)51- pattern-recognition (queries patterns)52- skill-evolution (tracks versions)535455## When NOT to Use5657- When the skill is stable and not changing58- For skills with fewer than 10 invocations (not enough data)59- When manual curation produces better results606162## Overview6364Meta Skill Datastore is a foundational meta-skills skill that provides skill management capabilities for the agent ecosystem.6566## Architecture6768- **Input layer** — Receives and validates incoming requests69- **Processing layer** — Core logic for skill management70- **Output layer** — Formats and delivers results71- **State management** — Maintains context across invocations7273## Configuration7475- Set up required environment variables and paths76- Configure logging level and output format77- Define resource limits (memory, time, API calls)78- Enable/disable features via configuration flags7980## Integration8182- Exposes standard interfaces for other skills to consume83- Supports event-driven and request-response patterns84- Compatible with the 1ai-skills hook system85- Logs metrics for the skill performance monitor8687## Anti-Rationalization Table8889| Rationalization | Reality |90|---|---|91| "Skills do not need to evolve" | Static skills become outdated. Self-evolving skills improve continuously. |92| "Manual skill management is fine" | With 1000+ skills, manual management is impossible. Automate. |93| "Performance does not matter" | Skill performance directly impacts agent effectiveness. Track it. |94| "SQLite is too simple for metrics" | SQLite handles millions of rows for single-agent deployments; operational overhead of a full DBMS is wasted. |95| "Just log to a file" | Structured queryability enables cross-skill pattern discovery that flat file grep cannot provide. |96| "Feedback is subjective noise" | Aggregated feedback across 100+ invocations reveals statistically significant improvement signals. |9798## Process99100### Preparation101- Define the metrics schema: latency, success rate, token usage, error category.102- Configure retention policies: daily aggregation, monthly archival, yearly purge.103- Validate the SQLite database file path and ensure write permissions.104105### Execution106- Record every skill invocation with name, timestamp, duration, success/failure, and error type.107- Store feedback as structured JSON with rating, free-text comments, and invocation reference.108- Run weekly aggregation queries to compute quartile performance bounds per skill.109110### Stewardship111- Monitor database file size; compact with `VACUUM` quarterly.112- Archive data older than 90 days to compressed JSONL for long-term trend analysis.113- Update schema via migration scripts rather than destructive recreations.114115## Workflow1161171. **Instrument** — Add a `record_execution()` call at the end of every skill's main function to capture latency, success, and tokens.1182. **Collect** — Batch-write execution records into the datastore; use WAL mode for concurrent access.1193. **Analyze** — Run weekly SQL queries identifying skills with degrading performance or rising error rates.1204. **Feedback ingest** — Accept structured feedback records tied to specific invocation IDs for full traceability.1215. **Pattern detect** — Join execution data with feedback to surface skills performing well technically but poorly in user ratings.1226. **Version track** — Store skill SKILL.md content hashes alongside executions to correlate version changes with performance shifts.1237. **Report** — Generate a weekly meta-datastore digest showing top-5 improvement candidates with supporting evidence.124125## Verification126127- [ ] All steps executed successfully128- [ ] Results validated against acceptance criteria129- [ ] Error handling tested with edge cases130- [ ] Documentation updated with findings131- [ ] SQLite database file created and writable132- [ ] record_execution inserts rows without error133- [ ] Query by skill_name returns correct aggregation134- [ ] Feedback records link to valid invocation IDs135- [ ] VACUUM runs without locking concurrent readers136- [ ] Schema migration applies without data loss137138## Code Examples139140```python141import sqlite3142import json143from datetime import datetime, timezone144145DB_PATH = "~/.1ai/meta-datastore.db"146147def record_execution(skill_name: str, success: bool, latency_ms: int,148 tokens_used: int = 0, error_type: str = "") -> int:149 """Record a skill execution and return the invocation ID."""150 conn = sqlite3.connect(DB_PATH)151 conn.execute("""CREATE TABLE IF NOT EXISTS skill_executions (152 id INTEGER PRIMARY KEY AUTOINCREMENT,153 skill_name TEXT NOT NULL,154 timestamp TEXT NOT NULL,155 success INTEGER NOT NULL,156 latency_ms INTEGER NOT NULL,157 tokens_used INTEGER DEFAULT 0,158 error_type TEXT DEFAULT ''159 )""")160 cur = conn.execute(161 "INSERT INTO skill_executions(skill_name, timestamp, success, latency_ms, tokens_used, error_type) "162 "VALUES (?, ?, ?, ?, ?, ?)",163 (skill_name, datetime.now(timezone.utc).isoformat(), int(success), latency_ms, tokens_used, error_type)164 )165 conn.commit()166 conn.close()167 return cur.lastrowid168169def get_avg_latency(skill_name: str) -> float:170 """Return average latency for a skill over the last 100 runs."""171 conn = sqlite3.connect(DB_PATH)172 row = conn.execute(173 "SELECT AVG(latency_ms) FROM skill_executions "174 "WHERE skill_name = ? ORDER BY id DESC LIMIT 100",175 (skill_name,)176 ).fetchone()177 conn.close()178 return row[0] if row[0] else 0.0179180def store_feedback(invocation_id: int, rating: int, comment: str) -> None:181 """Attach feedback to a specific skill execution."""182 conn = sqlite3.connect(DB_PATH)183 conn.execute("""CREATE TABLE IF NOT EXISTS feedback (184 id INTEGER PRIMARY KEY AUTOINCREMENT,185 invocation_id INTEGER NOT NULL,186 rating INTEGER CHECK(rating BETWEEN 1 AND 5),187 comment TEXT,188 created TEXT NOT NULL,189 FOREIGN KEY (invocation_id) REFERENCES skill_executions(id)190 )""")191 conn.execute(192 "INSERT INTO feedback(invocation_id, rating, comment, created) VALUES (?, ?, ?, ?)",193 (invocation_id, rating, comment, datetime.now(timezone.utc).isoformat())194 )195 conn.commit()196 conn.close()197198def get_improvement_candidates(min_invocations: int = 10) -> list[dict]:199 """Return skills with high latency or low success rate needing improvement."""200 conn = sqlite3.connect(DB_PATH)201 rows = conn.execute("""202 SELECT skill_name, COUNT(*) as runs,203 AVG(latency_ms) as avg_lat,204 AVG(success) as success_rate205 FROM skill_executions206 GROUP BY skill_name207 HAVING runs >= ?208 ORDER BY success_rate ASC, avg_lat DESC209 """, (min_invocations,)).fetchall()210 conn.close()211 return [212 {"skill": r[0], "runs": r[1], "avg_latency_ms": round(r[2], 1), "success_rate": round(r[3], 2)}213 for r in rows214 ]215```216217## Common Issues218219| Error | Root Cause | Fix |220|---|---|---|221| `database is locked` | Concurrent writes from parallel skill invocations | Enable WAL mode: `PRAGMA journal_mode=WAL;` |222| `no such table` | First run without schema initialization | Call `record_execution` once to auto-create tables |223| `disk full` | Unbounded metric growth exceeding disk quota | Add retention: `DELETE FROM skill_executions WHERE id NOT IN (SELECT id FROM skill_executions ORDER BY id DESC LIMIT 10000)` |224| `FOREIGN KEY constraint failed` | Orphaned feedback referencing deleted invocation | Cascade delete: add `ON DELETE CASCADE` to feedback FK |225| `inconsistent results` | Concurrent read during write without transaction isolation | Wrap writes in `BEGIN IMMEDIATE` / `END` blocks |226227## Monetization228229| Approach | Timeframe | Description |230|---|---|---|231| Meta-skill analytics SaaS | 3-6 months | Hosted dashboard showing cross-skill performance trends, regression alerts, and improvement recommendations for agent teams |232| Custom integration consulting | 1-3 months | Deploy the datastore schema and reporting pipeline into existing agent orchestration platforms (LangChain, CrewAI, AutoGen) |233| Performance benchmarking service | 2-4 months | Run standardized skill workloads, publish comparative benchmarks, charge for detailed per-skill diagnostic reports |234| Managed datastore plugin | 1-2 months | Bundle as a ready-to-install plugin for OMP / 1ai-hub with automated setup, migration management, and backup scheduling |235| Open-core enterprise license | 3-9 months | Free single-agent SQLite version; paid multi-agent PostgreSQL backend with sharding and real-time dashboards |