skills/spec-story-chat-analyzer/SKILL.md
Analyze SpecStory chat history exports to identify problems, friction points, and areas needing improvement. This skill should be used when the user wants to understand what went wrong in their agent interactions. Use when the user asks to "analyze chat history", "what went wrong", "review agent sessions", or "find problems in conversations".
npx skillsauth add cyberelf/agent_skills chat-analyzerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze SpecStory chat history exports and produce a detailed analysis report with actionable fixes for agent constitution files (AGENTS.md, CLAUDE.md, etc.).
# Get full analysis report (main output)
python3 chat_analyze.py analyze data/history.md
# Get problems checklist
python3 chat_analyze.py problems data/history.md
# Supporting commands for deep-dive
python3 chat_analyze.py stats data/history.md
python3 chat_analyze.py toc data/history.md
python3 chat_analyze.py tools data/history.md
python3 chat_analyze.py show data/history.md <LINE>
python3 chat_analyze.py grep data/history.md "<pattern>"
The analyze command produces a comprehensive report:
# Chat History Analysis: [filename]
## Summary
- Sessions: N
- Messages: N
- Tool calls: N
- Estimated tokens: Nk
- Dominant tool mix: tool1 N, tool2 N, tool3 N
- High-risk indicators: secret exposure, scope drift, restart loops
## Primary Findings
### 1. Secret Exposure In Chat
Severity: high
Evidence: [specific line numbers with credentials]
Pattern: [what went wrong]
Impact: [consequences]
Recommended fix: [concrete actions]
### 2. Scope Drift Across Major Sessions
...
### 3. Environment Churn And Restart Loops
...
## Session-By-Session Breakdown
### Session at line N: [title]
- Shape: N messages, N tool calls.
- Issue: [problems detected]
- Pattern: [behavioral pattern]
- Better split: [recommendation]
## Recommended Conversation Policy Changes
1. [Specific policy recommendation]
2. [Specific policy recommendation]
...
The analyzer detects these high-value patterns:
| Pattern | Detection | Impact | |---------|-----------|--------| | Secret exposure | Database URLs, API keys, passwords, tokens in chat | Credentials compromised, export file becomes sensitive | | Scope drift | Session topic changes significantly from original request | Acceptance criteria unclear, test results unreliable | | Infrastructure failure | API errors, model config errors, network failures | Sessions blocked entirely, no deliverable output |
| Pattern | Detection | Impact | |---------|-----------|--------| | Buggy code | Multiple debugging iterations, "still broken", visual bugs | Extended session time, user has to report and wait for fixes | | User frustration | User says "no", "wrong", "try again", "not what I wanted" | Wasted effort, unclear requirements |
| Pattern | Detection | Impact | |---------|-----------|--------| | Restart loops | Repeated startup/restart commands across sessions | Slow feedback, unclear baseline, stale processes | | Skill config issues | Missing SKILL.md, Python environment problems, skill format errors | Skills unusable until fixed, added friction |
| Pattern | Detection | Impact | |---------|-----------|--------| | Session bloat | >25 messages in single session | Context accumulation, hard to track progress | | Incomplete session | Session ends with TODO/FIXME/WIP | Work not finished, unclear completion |
The analyzer detects:
Sessions are analyzed for topic changes:
When the first quarter of a session focuses on one topic but the last quarter focuses on a different topic, scope drift is flagged.
Detects patterns like:
Detects iterative debugging patterns:
When 2+ debugging patterns appear in a session, it indicates buggy initial implementation.
Detects technical failures that block progress:
These failures often block sessions entirely with no deliverable output.
Detects problems with skills and tools:
python3 chat_analyze.py <command> [FILE] [OPTIONS]
| Command | What it returns |
|---------|-----------------|
| analyze [FILE] | Full analysis report with session breakdown |
| problems [FILE] | Checklist of problems with fixes |
| stats [FILE] | Counts: sessions, messages, tools, tokens |
| toc [FILE] | Table of contents with line numbers |
| show [FILE] LINE | ±15 lines around LINE |
| grep [FILE] PAT | Regex search with line numbers |
| tools [FILE] | All tool calls with line numbers |
| think [FILE] | All think blocks with line numbers |
| const [DIR] | Find AGENTS.md, CLAUDE.md, etc. |
analyze first - get the comprehensive reportshow with line numbers from outputconst to find AGENTS.md# Chat History Analysis: history.md
## Summary
- Sessions: 22
- Messages: 132
- Tool calls: 920
- Estimated tokens: 266k
- Dominant tool mix: write 292, read 288, shell 186
- High-risk indicators: secret exposure, repeated restart loops, scope drift
The chat is not mainly failing because of one bad answer. It is failing because
analysis, implementation, debugging, environment repair, deployment, and
configuration handling were allowed to accumulate in the same long-running thread.
## Primary Findings
### 1. Secret Exposure In Chat
Severity: high
Evidence:
- `mysql+pymysql://...` appears at source lines 19179, 19938, 20066.
- API secret material appears at source lines 22934, 22945.
Pattern:
The conversation used the chat log itself as a transport for runtime credentials.
Impact:
- anyone with the export can recover live credentials,
- analysis outputs become unsafe to share.
Recommended fix:
- redact all credentials in conversation,
- rotate the leaked credentials,
- add a hard rule that the agent must never repeat pasted secrets back verbatim.
### 2. Scope Drift Across Major Sessions
Severity: high
Evidence:
- The session starting at source line 9587 begins as requirement decomposition.
- That same thread later shifts into frontend implementation at source line 14691.
Pattern:
The thread keeps carrying forward prior context instead of re-establishing a clean goal.
Recommended fix:
- enforce one major objective per thread,
- require explicit re-scoping when the task changes domain.
## Session-By-Session Breakdown
### Session at line 5: Project scaffold initialization
- Shape: 8 messages, 132 tool calls.
- Issue: heavy write volume early suggests large scaffold generation.
- Pattern: session focused on setup.
- Better split: consider breaking into smaller initialization steps.
### Session at line 9585: System module decomposition
- Shape: 24 messages, 223 tool calls.
- Issue: scope drift from requirements to implementation.
- Pattern: session started with requirements, drifted to frontend work.
- Better split: separate requirements analysis from implementation.
## Recommended Conversation Policy Changes
1. Do not allow secrets in chat. Redirect them to a secure local env file immediately.
2. Cap major sessions by objective, not by elapsed time.
3. Require a scope-reset sentence when the request switches domain.
4. Replace repeated startup replies with one canonical runbook.
tools
Agent-first graph-backed knowledge wiki builder with a self-contained CLI. Use for Graphwiki init/build/ingest/update, source indexing, semantic entity and relationship extraction, generated wiki pages, graph JSON/HTML explorer, evidence line ranges, query/explain question answering, synthesis pages, HTML reports, adding confirmed entity types, applying patches, cleanup, validation, tasks, and SQLite cache generation.
development
Use when the user asks to export a local HTML file, web page, or invitation page to a single-page PDF, a no-pagination PDF, a long PDF with auto-calculated height, or a PDF without headers and footers. Trigger on phrases like 单页 PDF, 不分页, 自动计算长度, 长图 PDF, 去掉页眉页脚, export HTML to single-page PDF, or print page to one PDF page.
development
Build and expand an insight-ready raw-material layer by discovering page-level sources, deduplicating them with an internal pre-crawl link index, capturing raw Markdown, verifying metadata in place, and keeping ingest/register state aligned. Use for additive source harvesting, raw webpage capture, source registry maintenance, source/ingest tracking, source/raw downloads, and in-place verification rather than final synthesis.
development
Generate a structured, illustrated Q&A HTML document from the current conversation. Scans the conversation for conceptual questions the user asked and Claude's answers, then produces a self-contained HTML file with styled cards and SVG diagrams for technical/architectural topics. If a Q&A HTML file already exists in the current project directory, appends the new Q&As to it instead of creating a new file. Trigger this skill whenever the user asks to "generate Q&A", "create Q&A from conversation", "save Q&A", "document our Q&A", "turn this chat into Q&A", or anything suggesting they want the conversation's questions and answers captured as a document — even if they don't use the exact phrase "Q&A skill".