# Session Intelligence

> Analyze the user's own local Claude Code, Codex, and Cursor coding-session history to find evidence-backed workflow patterns and safely turn approved findings into rules, skills, commands, agents, docs, notes, or statistics. Use for requests such as analyze my sessions, review how I use AI, find repeated instructions, reduce token or context waste, improve my prompts, discover documentation gaps, compare Claude/Codex/Cursor usage, mine successful workflows, measure rework or verification, check whether a rule helped, or convert a recurring pattern into a durable artifact.

- Skill: `mluev/session-intelligence` (Agent Skill, multi-file: 43 files)
- Install (CLI): `npx skillmds@latest add mluev/session-intelligence`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mluev/session-intelligence/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: mluev (https://skillmd.com/u/mluev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mluev/session-intelligence

---


# Session Intelligence

Improve the user's AI-assisted work from local behavioral evidence while keeping transcript text behind explicit consent.

## Non-negotiable boundaries

- Never read raw transcript files into model context. Use `scripts/si.py` only.
- `doctor` and `diagnose` may run without excerpt consent because their output contains no transcript text.
- Never run `evidence` without explicit consent for one named finding and bounded release.
- Never write history or an artifact without explicit approval.
- Never treat cross-tool occurrence as an automatic confidence boost.
- Never compare incompatible provider token totals or invent exact cost.
- Never recommend from low-confidence, single-session, or structurally unreliable evidence.
- Hook, MCP, and direct configuration mutations are out of scope in v1. Represent them as reviewed `note` recommendations only.

## Select mode and scope

Modes are arguments to this one skill: `full` (default), `rules`, `docs`, `waste`, `prompts`, `success`, or `verify`. The focused `/si-rules`, `/si-docs`, `/si-waste`, and `/si-prompts` entrypoints are intentionally retained in `commands/`; they share this staged engine but each has one narrow goal.

Scope is `global` or `project`. If ambiguous, ask one short choice. Project scope requires the selected project root; descendants belong to that project. Documentation extraction is project-only.

Default window is 30 days. The CLI expands to 90 days only when fewer than ten usable sessions exist and reports the expansion.

## Default workflow

1. Read [references/running.md](references/running.md), then run `scripts/si.py run` for the selected scope. This performs `doctor` followed by `diagnose`. Do not inspect transcript sources directly.
2. Check coverage and data quality first. If evidence is insufficient or structurally unreliable, report that and stop; silence is valid.
3. Apply the selected lens from [references/capabilities.md](references/capabilities.md). Confirm candidates with [references/detection-playbook.md](references/detection-playbook.md).
4. Present two strengths worth preserving and at most three ranked opportunities. For each include support, evidence quality, recommendation, expected benefit, trade-off, and next measurement.
5. Ask whether the user consents to bounded excerpts for a specific finding. Refusal ends excerpt work without penalty; structural recommendations may still be discussed.
6. After consent, run `evidence` only for that finding and stay within approved turn and character limits. Mention release counts and redactions.
7. Before drafting an artifact, read the relevant section of [references/improving-ai-workflows.md](references/improving-ai-workflows.md). Use only `rule`, `skill`, `slash-command`, `agent`, `doc`, `note`, `stat`, or `none`.
8. Run `route preview`, show the exact diff and proposal hash, and wait for explicit approval. Run `route apply --approved` only for that unchanged hash.
9. Offer opt-in baseline recording. Later verification needs at least five comparable sessions in each window and must say association, never causation.

## Report contract

Lead with any coverage warning. Then provide two supported strengths and no more than three findings ranked by support, detector quality, completeness, recency, and actionability. Each finding states logical session count and sources, evidence kind, confidence, plausible alternatives, benefit, trade-off, and next measurement. Cross-tool spread is descriptive only. Do not quote transcripts before consent.

Use stable finding IDs from `si.diagnostic/v1`. Do not expose opaque pointers unless needed for evidence selection.

## References

- [running.md](references/running.md): CLI, staged workflow, and routing
- [measurement.md](references/measurement.md): definitions and causal limits
- [privacy.md](references/privacy.md): release and state boundaries
- [contracts.md](references/contracts.md): public schemas
- [capabilities.md](references/capabilities.md): analysis lenses
- [detection-playbook.md](references/detection-playbook.md): confirmation and alternatives
- [improving-ai-workflows.md](references/improving-ai-workflows.md): artifact craft
- [sources.md](references/sources.md): adapters and degradation

## Validation

```bash
PYTHONPATH=scripts python3 -m unittest discover -s tests -v
python3 scripts/si.py diagnose --scope project --path /Users/dev/acme-web --root evals/fixtures --window-days 90
```

The fixture run must report 8 project sessions across all three sources, contain no transcript text, and produce no persistent write.

