stevesolun/ctx / docs
skill-router
FlaggedRepo-aware recommendation manager for ctx. Scans the active repository, identifies stack and workflow signals, recommends a capped set of skills, agents, and MCP servers, and unloads helpers that no longer match the current work after user confirmation. Harnesses are recommended by the custom-model onboarding flow or loop adapters and then attach to the same recommendation layer.
toolbox/behavior-miner.md
View on GitHub# Behavior miner
[`src/behavior_miner.py`](https://github.com/stevesolun/ctx/blob/main/src/behavior_miner.py)
watches your invocation patterns and proposes toolbox tweaks grounded in
real evidence.
## What it collects
Four signal families, each with `MIN_EVIDENCE = 3` before a suggestion
can surface:
| Signal | Source | Example suggestion |
|---|---|---|
| **Co-invocation** | Pairs of agents invoked in the same session | "You ran `code-reviewer` + `security-reviewer` together 4 times — consider a bundle." |
| **Skill cadence** | Skill load frequency over time | "`python-patterns` loaded every session — promote to `pre`." |
| **File-type** | File extensions of work-in-progress | "60% of your diffs touch `.tf` files — consider a Terraform toolbox." |
| **Commit-type** | Conventional Commit parsing | "8 of your last 10 commits are `fix:` — consider a pre-commit test toolbox." |
## User profile
Signals aggregate into `~/.claude/user-profile.json` as a `BehaviorProfile`:
```jsonc
{
"total_intent_events": 87,
"total_commits": 10,
"co_invocation_pairs": [{"a": "python", "b": "pytest", "count": 4}],
"skill_cadence": [["python-patterns", 12]],
"file_types": [["py", 87], ["md", 31]],
"commit_types": [["fix", 8], ["feat", 2]],
"suggestions": [
{
"kind": "co-invocation",
"rationale": "Signals 'python' and 'pytest' co-occurred 4x.",
"evidence": 4,
"proposed": {"name": "python-pytest-bundle"}
}
],
"generated_at": 1713456789
}
```
## Digest
On `session-end`, the hook calls `format_digest(profile)` and prints
anything new. Example output:
```
[toolbox] 2 suggestion(s):
- python-pytest-bundle (co-invocation, 4x): Signals 'python' and 'pytest' co-occurred 4x.
- python-patterns-default (skill-cadence, 12x): Skill 'python-patterns' was loaded/unloaded 12x.
```
Suggestions are never applied automatically. The digest is advisory; apply
changes through the normal `python -m toolbox` commands after review.
## CLI
```bash
# Build the full JSON profile without saving it
python -m behavior_miner profile
# Build and persist ~/.claude/user-profile.json
python -m behavior_miner profile --save
# Print a short digest, optionally persisting the underlying profile
python -m behavior_miner suggest --limit 5
python -m behavior_miner suggest --save
```
## Privacy
All signal data stays in `~/.claude/`. Nothing is sent over the network.
The miner never reads file contents — only names, extensions, and commit
message prefixes.
## Related
- [Intent interview](intent-interview.md) — surfaces miner suggestions
during the `toolbox init` flow.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |