{"skill":{"slug":"openclaw-insight","displayName":"openclaw-insight","summary":"Analyze OpenClaw AI assistant usage patterns and generate interactive insight reports. Trigger when users ask about: OpenClaw usage stats, session analytics,...","description":"---\nname: openclaw-insight\ndescription: |\n  Analyze OpenClaw AI assistant usage patterns and generate interactive insight reports.\n  Trigger when users ask about: OpenClaw usage stats, session analytics, token consumption,\n  cost estimation, friction analysis, optimization suggestions, or any request to audit/visualize\n  OpenClaw session data (e.g. \"show my stats\", \"how much am I spending on AI\", \"usage report\").\n---\n\n# OpenClaw Insight — Usage Guide\n\n> CLI tool that analyzes local OpenClaw session history and generates interactive reports with usage statistics, behavior patterns, friction analysis, and improvement suggestions. **100% local — no data leaves your machine.**\n\n## Installation\n\n### One-Click Install (Recommended)\n\nUse the official one-click installation script:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/linsheng9731/openclaw-insight/main/install.sh | bash\n```\n\nThis script will automatically:\n1. Detect your operating system and architecture\n2. Download the appropriate binary release\n3. Verify the integrity of the downloaded file\n4. Install it in a suitable location ($HOME/.local/bin by default)\n5. Make the command available in your PATH\n\n### Install Specific Version\n\nTo install a specific version (e.g., v1.0.0):\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/linsheng9731/openclaw-insight/main/install.sh | bash -s -- --version v1.0.0\n```\n\n### From Source\n\nFor development or if you want to build from source:\n\n```bash\ngit clone https://github.com/linsheng9731/openclaw-insight.git\ncd openclaw-insight\nnpm install && npm run build\n```\n\n## CLI Usage\n\n```bash\n# Default: analyze last 30 days, open HTML report in browser\nopenclaw-insight\n\n# Analyze last 7 days\nopenclaw-insight --days 7\n\n# JSON output\nopenclaw-insight --format json --output report.json\n\n# Specific agent + custom output\nopenclaw-insight --agent my-agent --output ~/Desktop/insight.html\n\n# Verbose, no auto-open\nopenclaw-insight --verbose --no-open\n```\n\n### Options\n\n| Option | Default | Description |\n|---|---|---|\n| `-d, --days <n>` | `30` | Number of days to analyze |\n| `-m, --max-sessions <n>` | `200` | Maximum sessions to process |\n| `-a, --agent <id>` | auto-detect | Agent ID to analyze |\n| `-s, --state-dir <path>` | `~/.openclaw` | OpenClaw state directory |\n| `-o, --output <path>` | `~/.openclaw/usage-data/report.html` | Output file path |\n| `-f, --format <fmt>` | `html` | Output format: `html` or `json` |\n| `--no-open` | — | Don not auto-open the report in browser |\n| `-v, --verbose` | — | Enable verbose output |\n\n## What the Report Includes\n\n### Usage Statistics\n- **Sessions**: total count, daily average, activity streaks\n- **Tokens**: input/output breakdown, cache hit rates, cost estimation\n- **Temporal**: daily activity charts, peak hours identification\n- **Channels**: per-channel session counts and token efficiency\n- **Models**: model diversity, per-model cache performance\n\n### Behavior Patterns\nAutomatically detects: peak hours, channel preferences, session duration profiles, cache utilization efficiency, model diversity, and tool usage preferences. Each pattern has an impact level (high / medium / low).\n\n### Friction Events\nIdentifies pain points in your sessions:\n\n| Type | Description |\n|---|---|\n| `high_token_waste` | Excessive output relative to input |\n| `excessive_compactions` | Repeatedly hitting context window limits |\n| `abandoned_session` | Started but barely used sessions |\n| `underutilized_cache` | Large sessions with zero cache hits |\n| `context_overflow` | Repeated context window exhaustion |\n| `single_message_sessions` | One-shot interactions with high overhead |\n\n### Improvement Suggestions\nPrioritized recommendations across these categories:\n- **Token Efficiency** — cache optimization, verbosity control, batching\n- **Channel Optimization** — multi-channel access, per-channel efficiency\n- **Model Selection** — routing simple tasks to cheaper models\n- **Context Management** — conversation splitting, token budgets\n- **Scheduling** — usage pattern optimization\n- **Memory Utilization** — cross-session context retention\n- **Feature Discovery** — underused OpenClaw capabilities\n- **Workflow Improvement** — conversation depth, specification clarity\n\nEach suggestion includes impact, effort, detailed explanation, and optional config snippets.\n\n## Data Sources\n\nThe tool reads from OpenClaw local state directory (read-only, never modifies data):\n\n```\n~/.openclaw/\n  agents/{agentId}/\n    sessions/\n      sessions.json          # Session metadata index\n      {sessionId}.jsonl      # Per-session conversation transcripts\n```\n\n## JSON Output Structure\n\nWhen using `--format json`, the report contains:\n\n```\nInsightReport {\n  generatedAt, periodStart, periodEnd, daysAnalyzed,\n  summary        — aggregate stats (sessions, tokens, cost, streaks, etc.)\n  dailyActivity  — per-day breakdown\n  hourlyDistribution — 24-hour activity heatmap\n  channelStats   — per-channel metrics\n  modelStats     — per-model metrics\n  sessionAnalyses — detailed per-session data\n  patterns       — detected behavior patterns\n  frictions      — friction events\n  suggestions    — improvement recommendations\n}\n```\n\n## Common Scenarios\n\n| User Request | Command |\n|---|---|\n| Show my stats | `openclaw-insight` |\n| How much am I spending? | `openclaw-insight --format json` then read `summary.estimatedCostUsd` |\n| Why are my sessions slow? | Run analysis then focus on friction events |\n| Compare my channels | Run analysis then present `channelStats` |\n| Report for last week | `openclaw-insight --days 7` |\n| How can I use OpenClaw better? | Run analysis then present top suggestions |\n\n## Troubleshooting\n\n| Problem | Fix |\n|---|---|\n| No agents found | Verify `~/.openclaw` exists and contains agent data |\n| No sessions in last N days | Increase `--days` value |\n| Empty channel/model stats | OpenClaw version may be too old |\n| Build errors | Upgrade to Node.js >= 22 |\n\n## Development\n\n```bash\nnpm install          # Install dependencies\nnpm run build        # Build\nnpm run dev          # Development mode\nnpm test             # Run tests\nnpm run clean        # Clean build artifacts\n```\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":646,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1773477214508,"updatedAt":1778999427036},"latestVersion":{"version":"1.0.0","createdAt":1773477214508,"changelog":"Initial release of OpenClaw Insight.\n\n- Provides a CLI tool to analyze OpenClaw AI assistant session data and generate interactive usage reports locally.\n- Supports HTML and JSON output with detailed breakdowns of sessions, token usage, costs, behavioral patterns, friction points, and optimization suggestions.\n- Offers comprehensive CLI options for custom analysis periods, agent selection, output formats, and verbosity.\n- Detects session frictions and generates actionable improvement recommendations.\n- Reads OpenClaw session history fully offline, ensuring no data leaves the user's machine.","license":"MIT-0"},"metadata":null,"owner":{"handle":"linsheng9731","userId":"s17dxycqesr6e3249qydt65521885sjp","displayName":"linsheng9731","image":"https://avatars.githubusercontent.com/u/5237574?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089884829}}