{"id":49191653,"url":"https://github.com/abhinavag-svg/ai-coding-sessionprompt-analyzer","last_synced_at":"2026-04-23T07:02:28.988Z","repository":{"id":342884936,"uuid":"1172111388","full_name":"abhinavag-svg/ai-coding-sessionprompt-analyzer","owner":"abhinavag-svg","description":"Analyze Claude Code session logs and generate efficiency reports, cost diagnostics, and actionable recommendations.  This project reads local JSONL session logs, computes deterministic efficiency signals, and can optionally add local LLM recommendations using Ollama.","archived":false,"fork":false,"pushed_at":"2026-03-10T03:22:45.000Z","size":4848,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-10T05:26:59.357Z","etag":null,"topics":["ai-code-review","analyzer","claude-code","composite-scoring","efficiency-analysis","ollama","python3","rubric-based-evaluation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abhinavag-svg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-04T00:33:39.000Z","updated_at":"2026-03-10T01:59:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/abhinavag-svg/ai-coding-sessionprompt-analyzer","commit_stats":null,"previous_names":["abhinavag-svg/ai-coding-prompt-optimizer","abhinavag-svg/ai-coding-sessionprompt-analyzer"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/abhinavag-svg/ai-coding-sessionprompt-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhinavag-svg%2Fai-coding-sessionprompt-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhinavag-svg%2Fai-coding-sessionprompt-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhinavag-svg%2Fai-coding-sessionprompt-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhinavag-svg%2Fai-coding-sessionprompt-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhinavag-svg","download_url":"https://codeload.github.com/abhinavag-svg/ai-coding-sessionprompt-analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhinavag-svg%2Fai-coding-sessionprompt-analyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32169657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-code-review","analyzer","claude-code","composite-scoring","efficiency-analysis","ollama","python3","rubric-based-evaluation"],"created_at":"2026-04-23T07:02:28.008Z","updated_at":"2026-04-23T07:02:28.914Z","avatar_url":"https://github.com/abhinavag-svg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Coding Prompt Optimizer\n\nAnalyze Claude Code session logs to measure prompt efficiency, identify token waste, and get cost recovery recommendations.\n\n**Core insight**: 80% of token costs come from tool outputs (file reads, bash results, repeated corrections), not your prompts. This tool makes that visible.\n\n## Installation\n\n```bash\n# 1. Clone and create venv\npython3 -m venv .venv\nsource .venv/bin/activate\n\n# 2. Install\npip install -e .\n```\n\n## Get Started (HTML Report)\n\nThe best way to view results is **injected into Claude Code's Insights report**.\n\n### Step 1: Generate Insights HTML\n\nIn Claude Code, run:\n```\n/insights\n```\nThis generates `~/.claude/usage-data/report.html` (it shows your work activity, projects, sessions, etc.)\n\n### Step 2: Inject ai-dev Token Economics\n\n```bash\nai-dev analyze ~/.claude/projects --insights-html ~/.claude/usage-data/report.html\n```\n\nThis adds three sections to your Insights HTML:\n- **Project Cost Summary** – total spend, waste %, recoverable cost per project\n- **Session Efficiency** – top sessions ranked by cost with efficiency scores\n- **Token Cost by Anti-Pattern** – where waste comes from (full errors pasted, repeated constraints, etc.)\n\n\u003e **📌 Note**: After running the command above, open `~/.claude/usage-data/report.html` in your browser to see the injected sections alongside your original Insights data.\n\n### Example: What You'll See\n\n**Project Cost Summary:**\n| Project | Sessions | Total Cost | Recoverable | Waste % |\n|---------|----------|-----------|-----------|---------|\n| app-bloat-auditor | 9 | $28.59 | $10.10 | 35.3% |\n| ai-coding-sessionprompt-analyzer | 20 | $10.15 | $9.09 | 89.6% |\n| ragchatbot-codebase | 16 | $3.18 | $0.11 | 3.4% |\n\n**Session Efficiency** (ranked by cost):\n| Session | Project | Score | Shape | Cost | Recoverable | Sample Prompt |\n|---------|---------|-------|-------|------|-----------|---|\n| 251a6385 | app-bloat-auditor | 85 | Clean | $9.66 | $1.74 | we are not testing if the app... |\n| 46068018 | app-bloat-auditor | 86 | Clean | $7.18 | $1.39 | Refer to PRD.md Section 6... |\n| 24b119ea | ai-coding-sessionprompt-analyzer | 50 | Correction-Heavy | $6.01 | $6.01 | @docs/specs/product-spec.md... |\n\n**Token Cost by Anti-Pattern:**\n- **Prompt Sent Twice** (Pipeline Bug) – 105 occurrences, $8.74 recoverable\n- **Full Error Pasted** (Not Trimmed) – 16 occurrences, $7.12 recoverable\n\n## Other Commands\n\n### Markdown Report\n```bash\nai-dev analyze ~/.claude/projects --export report.md\n```\n\n### Cost Range Estimates\n```bash\nai-dev cost-range ~/.claude/projects\n```\nShows min/max cost estimates across conservative and aggressive pricing.\n\n### With LLM Recommendations (requires Ollama)\n```bash\nai-dev analyze ~/.claude/projects --llm-recommendations\n```\n\n## What Gets Measured\n\n- **Prompt Clarity** – Are file paths and function names included?\n- **Context Efficiency** – Are you reading the same file repeatedly?\n- **Rework Rate** – How many corrections did the session need?\n- **AI Consistency** – Did model errors cause rework?\n- **Task Completion** – Did the session converge successfully?\n\nEach dimension scores 0–100. Composite score is clamped to [0, 100].\n\n## Anti-Patterns Detected\n\n- Duplicate prompts (pipeline bug)\n- Full error messages pasted instead of trimmed\n- Repeated file reads\n- Correction spirals (Claude stuck in a loop)\n- Vague prompts without file paths\n- Scope creep (session sprawl)\n\n## Pricing \u0026 Cost Modes\n\nThree cost modes:\n- **AUTO** (default): Use reported costs, fall back to split/blended pricing\n- **REPORTED_ONLY**: Only provider-reported costs\n- **DERIVED_ONLY**: Calculate from token counts\n\nCustom pricing: `--pricing-file pricing.json`\n\n## Development\n\n```bash\npip install -r requirements-dev.txt\npython -m pytest tests/ -v\n```\n\nSee `CLAUDE.md` for project architecture and `docs/specs/product-spec.md` for detailed spec.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhinavag-svg%2Fai-coding-sessionprompt-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhinavag-svg%2Fai-coding-sessionprompt-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhinavag-svg%2Fai-coding-sessionprompt-analyzer/lists"}