Skip to main content
Glama
README.md
# skillminer

**Turn your AI-agent logs into skills that keep themselves up to date.**

1. **You give an instruction**, e.g. *"how we build and publish harness workspaces"*.
2. **skillminer scrapes your local logs** (Claude Code, Codex, Claude Desktop exports) for everything relevant and writes one `SKILL.md`.
3. **It keeps the skill current.** Every day it adds new sessions, applies your change requests ("remove X", "add Y"), and follows **later corrections**. If a later session says *"that's not the correct approach"*, the old rule is dropped and the skill gets an **Avoid** entry instead.

You can drive it from the CLI, a **local web console**, or **any MCP client** (including Claude Code itself). It runs locally, redacts secrets before mining, and has no dependencies beyond Node ≥ 18.17.

---

## Quick start

```bash
git clone https://github.com/Shashwatj0809/skillminer.git && cd skillminer
npm link                      # puts `skillminer` on your PATH (or use: node bin/skillminer.js)

export SKILLMINER_LLM=claude  # optional: write skills with the Claude Code CLI you already run (no API key)
```

### 1. Build a skill from an instruction

```bash
skillminer preview "how we build, test and publish harness workspaces"     # dry run, saves nothing
skillminer new harness-workspace "how we build, test and publish harness workspaces" --llm
```

Use `--repo <path>` to only use sessions from one repo, or `--keywords publish,pin` to widen the match. The skill is written to `~/.skillminer/skills/custom/harness-workspace/SKILL.md`.

### 2. Change it whenever you want

```bash
skillminer request harness-workspace "remove anything about cc-a11y"
skillminer request harness-workspace "add: never publish without a local test run"
skillminer request harness-workspace "pinning before publish is the wrong approach"
```

Requests are queued and applied on the next refresh. Add `--now` to apply one immediately. Removals always win, even over what the LLM writes.

### 3. Let it update itself daily

```bash
skillminer schedule --at 09:00 --llm --install
```

Every day at 09:00 the job:

- reads new sessions
- applies queued requests
- drops rules that a later session reversed
- copies the skills into `~/.claude/skills` so Claude Code picks them up

On macOS it runs as a LaunchAgent (catches up after sleep). On Linux it's a crontab line. Useful follow-ups: `skillminer schedule` (status), `skillminer runs` (history), `skillminer schedule --off`.

### 4. Open the console

```bash
skillminer console            # → http://localhost:4319
```

| Page | What you can do |
|---|---|
| **Overview** | See log sources, stats and recent runs. Build, Improve or **Run daily refresh now**, with live progress. |
| **Skills** | Read every skill. Hover a bullet and click **✕** to remove it. Queue or apply change requests, and see each skill's history. |
| **New skill** | Write an instruction, **Preview from logs**, then create the skill. |
| **Schedule** | Pick the daily time and turn on LLM and install. View the scheduled job's log. |
| **MCP** | Connect to skillminer's MCP server (or any stdio MCP server), browse and call its tools, and switch **"Run console actions through MCP"** on. You can also register skillminer with Claude Code in one click. |

### 5. Use it from Claude Code (MCP)

```bash
claude mcp add -s user skillminer -- skillminer mcp
```

Then just ask inside any session:
> *"use skillminer to create a skill for how we review PRs in this repo"*
> *"tell skillminer to remove the retry section from pr-review"*

MCP tools: `create_skill`, `request_skill_change`, `refresh_skills`, `preview_skill`, `list_skills`, `get_skill`, `delete_skill`, `forget`, `run_daily`, `schedule`, `list_runs`, plus `scan_logs`, `list_repos`, `build_skills`, `improve_skills`, `export_skills`, `import_skills`.

---

## Mined skills (no instruction needed)

skillminer can also build general skills from *all* your history: `user-preferences`, `tech-stack`, `working-style`, and a `project-context` skill per repo.

```bash
skillminer build [--install]       # build global + per-repo skills
skillminer improve                 # fold in new sessions (hand-added bullets are kept)
skillminer forget "daytona"        # drop a subject from mined skills, now and in future builds
skillminer export / import <file>  # move skills between machines as one .skillpack.json
```

## LLM options

By default skillminer uses offline heuristics, which are deterministic. Turn on `--llm` to have skills written from the same redacted evidence:

| `SKILLMINER_LLM` | Uses |
|---|---|
| `claude` | Your local Claude Code CLI (`claude -p`). No API key. No tools. No session saved, so it never feeds back into the logs. |
| `anthropic` / `openai` | API, with `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` |
| `ollama` | A local model; nothing leaves the machine |

`SKILLMINER_MODEL` overrides the model.

## Where things live

```
~/.skillminer/
├── skills/            global/, repos/, custom/   ← the SKILL.md files
├── catalog.json       managed skills: instruction, requests, removals, history
├── state.json         which log files were already seen
├── runs.jsonl         run history
├── schedule.json      daily schedule
└── logs/daily.log     output of scheduled runs
```

## Privacy

Emails, API keys, tokens, JWTs, private keys, IPs, phone numbers and home paths are redacted **before** anything is mined. Pasted documents, shell output, task notifications and injected skill bodies are ignored. The console only listens on `127.0.0.1` and rejects cross-site requests.

## Architecture

See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).

## License

MIT