kb-mine

Mine agent session histories to detect recurring errors and suggest lesson capture.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/ozand/knowledge-base-template --skill kb-mine-ozand
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kb-mine
Source: https://github.com/ozand/knowledge-base-template/tree/main/_template/qmd/skills/kb-mine
Command: npx skills add https://github.com/ozand/knowledge-base-template --skill kb-mine-ozand

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Debugging sessions often repeat the same errors without anyone noticing the pattern. This Skill searches historic agent session logs to surface recurring errors and past resolutions, so fixes are never rediscovered from scratch. ## Core Features & Use Cases - Session Log Mining: Parses current session context and queries historic Pi agent session histories via QMD semantic search. - Recurring Error Detection: Identifies errors that appeared in three or more past sessions and proposes capturing them as permanent lessons. - Resolution Extraction: Retrieves full chat contexts with timestamps and relevance scores to extract how past errors were resolved. - Use Case: After fixing a provider timeout error, run the mining workflow to discover the same failure occurred in four earlier sessions, then capture it as a reusable KB lesson. ## Quick Start Ask the agent to mine past session histories for occurrences of the current error and suggest whether a lesson should be captured.

Frequently Asked Questions about kb-mine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search past agent session logs for recurring errors?▼

Run the Pi sessions adapter to refresh the index, then query the QMD sources collection with a structured search describing the error. Matching chat histories are returned with timestamps, roles, and relevance scores.

How to detect if an error has happened before in agent sessions?▼

Formulate a semantic search target from the current error, then run a QMD query against the session sources collection. If the same error appears in three or more historic sessions, the workflow suggests capturing it as a permanent lesson.

Does session mining require QMD to be installed?▼

Yes, the mining workflow depends on the optional QMD module with its configured sources collection and the Pi sessions adapter. Without QMD, historic session logs cannot be semantically indexed or queried.

Why does the QMD query return no matching sessions?▼

Empty results usually mean the index is stale or the query is too narrow. Re-run the adapter script and qmd update to refresh ephemeral sources, then broaden the structured query with intent, lexical, and vector terms.

When should I capture a lesson instead of just mining logs?▼

Capture a lesson when mining reveals the same error in three or more past sessions, or when you have just resolved a new recurring error. One-off issues do not need permanent lessons.