agent-toolkit-cli 1.11.0__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (438) hide show
  1. agent_toolkit/__init__.py +4 -0
  2. agent_toolkit/__main__.py +5 -0
  3. agent_toolkit/_paths.py +145 -0
  4. agent_toolkit/bin/.gitkeep +0 -0
  5. agent_toolkit/bin/agent-toolkit.exe +0 -0
  6. agent_toolkit/cli/__init__.py +0 -0
  7. agent_toolkit/cli/__main__.py +5 -0
  8. agent_toolkit/cli/build.py +278 -0
  9. agent_toolkit/cli/completion.py +297 -0
  10. agent_toolkit/cli/context_budget.py +455 -0
  11. agent_toolkit/cli/devcompanion.py +923 -0
  12. agent_toolkit/cli/devcompanion_queue.py +235 -0
  13. agent_toolkit/cli/diff.py +176 -0
  14. agent_toolkit/cli/doctor.py +1052 -0
  15. agent_toolkit/cli/insights.py +771 -0
  16. agent_toolkit/cli/install.py +706 -0
  17. agent_toolkit/cli/main.py +171 -0
  18. agent_toolkit/cli/mcp.py +537 -0
  19. agent_toolkit/cli/memory.py +739 -0
  20. agent_toolkit/cli/plugin.py +224 -0
  21. agent_toolkit/cli/project.py +459 -0
  22. agent_toolkit/cli/release.py +178 -0
  23. agent_toolkit/cli/skills.py +461 -0
  24. agent_toolkit/cli/uninstall.py +166 -0
  25. agent_toolkit/cli/update.py +298 -0
  26. agent_toolkit/cli/workspace.py +1713 -0
  27. agent_toolkit/compiler/hook_registry.py +110 -0
  28. agent_toolkit/compiler/loader.py +338 -0
  29. agent_toolkit/compiler/mcp_registry.py +87 -0
  30. agent_toolkit/compiler/model.py +182 -0
  31. agent_toolkit/compiler/provenance.py +140 -0
  32. agent_toolkit/compiler/registry_emit.py +263 -0
  33. agent_toolkit/compiler/target_registry.py +122 -0
  34. agent_toolkit/compiler/targets/__init__.py +1 -0
  35. agent_toolkit/compiler/targets/agent_plugins.py +160 -0
  36. agent_toolkit/compiler/targets/base.py +229 -0
  37. agent_toolkit/compiler/targets/claude_code.py +241 -0
  38. agent_toolkit/compiler/targets/codex.py +261 -0
  39. agent_toolkit/compiler/targets/copilot.py +275 -0
  40. agent_toolkit/compiler/targets/cursor.py +207 -0
  41. agent_toolkit/compiler/targets/gemini_cli.py +213 -0
  42. agent_toolkit/compiler/targets/muse_code.py +113 -0
  43. agent_toolkit/compiler/targets/opencode.py +204 -0
  44. agent_toolkit/compiler/targets/pi.py +263 -0
  45. agent_toolkit/compiler/targets/windsurf.py +267 -0
  46. agent_toolkit/compiler/tool_mapping.py +83 -0
  47. agent_toolkit/data/.gitignore +4 -0
  48. agent_toolkit/data/__init__.py +1 -0
  49. agent_toolkit/data/agents/agentic-security-reviewer/AGENT.md +60 -0
  50. agent_toolkit/data/agents/architect/AGENT.md +30 -0
  51. agent_toolkit/data/agents/assistant/AGENT.md +59 -0
  52. agent_toolkit/data/agents/build-error-resolver/AGENT.md +30 -0
  53. agent_toolkit/data/agents/client-workflow-bootstrap/AGENT.md +60 -0
  54. agent_toolkit/data/agents/code-reviewer/AGENT.md +49 -0
  55. agent_toolkit/data/agents/database-reviewer/AGENT.md +44 -0
  56. agent_toolkit/data/agents/docs-lookup/AGENT.md +28 -0
  57. agent_toolkit/data/agents/e2e-runner/AGENT.md +38 -0
  58. agent_toolkit/data/agents/performance-optimizer/AGENT.md +52 -0
  59. agent_toolkit/data/agents/planner/AGENT.md +41 -0
  60. agent_toolkit/data/agents/refactor-cleaner/AGENT.md +43 -0
  61. agent_toolkit/data/agents/reference-lookup/AGENT.md +33 -0
  62. agent_toolkit/data/agents/security-reviewer/AGENT.md +47 -0
  63. agent_toolkit/data/agents/tdd-guide/AGENT.md +58 -0
  64. agent_toolkit/data/agents/tech-assistant/AGENT.md +11 -0
  65. agent_toolkit/data/agents/typescript-reviewer/AGENT.md +61 -0
  66. agent_toolkit/data/capabilities/hooks/README.md +6 -0
  67. agent_toolkit/data/capabilities/hooks/pre-commit-validate.yaml +26 -0
  68. agent_toolkit/data/capabilities/hooks/scripts/pre-commit-validate.sh +41 -0
  69. agent_toolkit/data/capabilities/hooks/scripts/session-start-context.sh +11 -0
  70. agent_toolkit/data/capabilities/hooks/session-start-context.yaml +23 -0
  71. agent_toolkit/data/capabilities/targets/registry.yaml +90 -0
  72. agent_toolkit/data/capabilities/upstream.lock +118 -0
  73. agent_toolkit/data/catalogs/agent-catalog.yaml +81 -0
  74. agent_toolkit/data/catalogs/loop-catalog.yaml +55 -0
  75. agent_toolkit/data/catalogs/skill-catalog.yaml +520 -0
  76. agent_toolkit/data/catalogs/skills-layout.json +391 -0
  77. agent_toolkit/data/distributions/products.yaml +190 -0
  78. agent_toolkit/data/distributions/targets/claude-code.yaml +47 -0
  79. agent_toolkit/data/distributions/targets/cursor.yaml +42 -0
  80. agent_toolkit/data/distributions/targets/opencode.yaml +55 -0
  81. agent_toolkit/data/loops/changelog-drafter/loop.yaml +40 -0
  82. agent_toolkit/data/loops/ci-sweeper/loop.yaml +53 -0
  83. agent_toolkit/data/loops/daily-triage/loop.yaml +47 -0
  84. agent_toolkit/data/loops/dep-sweeper/loop.yaml +46 -0
  85. agent_toolkit/data/loops/issue-triage/loop.yaml +40 -0
  86. agent_toolkit/data/loops/oss-daily-briefing/loop.yaml +65 -0
  87. agent_toolkit/data/loops/oss-pr-monitor/loop.yaml +86 -0
  88. agent_toolkit/data/loops/oss-triage/loop.yaml +67 -0
  89. agent_toolkit/data/loops/post-merge-cleanup/loop.yaml +44 -0
  90. agent_toolkit/data/loops/pr-babysitter/loop.yaml +46 -0
  91. agent_toolkit/data/mcp/registry/chrome-devtools.yaml +61 -0
  92. agent_toolkit/data/mcp/registry/clickup.yaml +48 -0
  93. agent_toolkit/data/mcp/registry/figma.yaml +44 -0
  94. agent_toolkit/data/mcp/registry/github.yaml +52 -0
  95. agent_toolkit/data/mcp/registry/linear.yaml +47 -0
  96. agent_toolkit/data/mcp/registry/notion.yaml +48 -0
  97. agent_toolkit/data/mcp/registry/slack.yaml +46 -0
  98. agent_toolkit/data/mcp/templates/chrome-devtools/README.md +57 -0
  99. agent_toolkit/data/mcp/templates/chrome-devtools/config.template.json +6 -0
  100. agent_toolkit/data/mcp/templates/clickup/README.md +45 -0
  101. agent_toolkit/data/mcp/templates/clickup/config.template.json +8 -0
  102. agent_toolkit/data/mcp/templates/clickup/wrapper.sh +23 -0
  103. agent_toolkit/data/mcp/templates/figma/README.md +54 -0
  104. agent_toolkit/data/mcp/templates/figma/config.template.json +9 -0
  105. agent_toolkit/data/mcp/templates/github/README.md +16 -0
  106. agent_toolkit/data/mcp/templates/github/config.template.json +15 -0
  107. agent_toolkit/data/mcp/templates/github/wrapper.sh +6 -0
  108. agent_toolkit/data/mcp/templates/linear/README.md +49 -0
  109. agent_toolkit/data/mcp/templates/linear/config.template.json +10 -0
  110. agent_toolkit/data/mcp/templates/notion/README.md +7 -0
  111. agent_toolkit/data/mcp/templates/notion/config.template.json +8 -0
  112. agent_toolkit/data/mcp/templates/notion/wrapper.sh +23 -0
  113. agent_toolkit/data/mcp/templates/slack/README.md +8 -0
  114. agent_toolkit/data/mcp/templates/slack/config.template.json +9 -0
  115. agent_toolkit/data/mcp/templates/slack/wrapper.sh +23 -0
  116. agent_toolkit/data/packs/README.md +66 -0
  117. agent_toolkit/data/packs/agentic-security/README.md +19 -0
  118. agent_toolkit/data/packs/agentic-security/config.yaml +25 -0
  119. agent_toolkit/data/packs/architecture/README.md +22 -0
  120. agent_toolkit/data/packs/architecture/config.yaml +27 -0
  121. agent_toolkit/data/packs/code-quality/README.md +19 -0
  122. agent_toolkit/data/packs/code-quality/config.yaml +21 -0
  123. agent_toolkit/data/packs/delivery-discipline/README.md +19 -0
  124. agent_toolkit/data/packs/delivery-discipline/config.yaml +42 -0
  125. agent_toolkit/data/packs/design-engineering/README.md +19 -0
  126. agent_toolkit/data/packs/design-engineering/config.yaml +41 -0
  127. agent_toolkit/data/packs/engineering-workflow/README.md +21 -0
  128. agent_toolkit/data/packs/engineering-workflow/config.yaml +57 -0
  129. agent_toolkit/data/packs/oss-maintenance/README.md +245 -0
  130. agent_toolkit/data/packs/oss-maintenance/config.yaml +75 -0
  131. agent_toolkit/data/profiles/claude-code/CLAUDE.md +110 -0
  132. agent_toolkit/data/profiles/claude-code/agents/assistant.md +59 -0
  133. agent_toolkit/data/profiles/claude-code/agents/build-error-resolver.md +30 -0
  134. agent_toolkit/data/profiles/claude-code/agents/client-workflow-bootstrap.md +60 -0
  135. agent_toolkit/data/profiles/claude-code/agents/contribution-planner.md +39 -0
  136. agent_toolkit/data/profiles/claude-code/agents/database-reviewer.md +44 -0
  137. agent_toolkit/data/profiles/claude-code/agents/docs-lookup.md +28 -0
  138. agent_toolkit/data/profiles/claude-code/agents/e2e-runner.md +38 -0
  139. agent_toolkit/data/profiles/claude-code/agents/performance-optimizer.md +52 -0
  140. agent_toolkit/data/profiles/claude-code/agents/planner.md +41 -0
  141. agent_toolkit/data/profiles/claude-code/agents/refactor-cleaner.md +43 -0
  142. agent_toolkit/data/profiles/claude-code/agents/reference-lookup.md +33 -0
  143. agent_toolkit/data/profiles/claude-code/agents/security-reviewer.md +47 -0
  144. agent_toolkit/data/profiles/claude-code/agents/tdd-guide.md +58 -0
  145. agent_toolkit/data/profiles/claude-code/agents/typescript-reviewer.md +61 -0
  146. agent_toolkit/data/profiles/claude-code/settings.json +86 -0
  147. agent_toolkit/data/profiles/copilot/copilot-instructions.md +15 -0
  148. agent_toolkit/data/profiles/cursor/README.md +33 -0
  149. agent_toolkit/data/profiles/cursor/rules/architect.mdc +23 -0
  150. agent_toolkit/data/profiles/cursor/rules/assistant.mdc +61 -0
  151. agent_toolkit/data/profiles/cursor/rules/build-error-resolver.mdc +20 -0
  152. agent_toolkit/data/profiles/cursor/rules/code-reviewer.mdc +21 -0
  153. agent_toolkit/data/profiles/cursor/rules/database-reviewer.mdc +29 -0
  154. agent_toolkit/data/profiles/cursor/rules/docs-lookup.mdc +15 -0
  155. agent_toolkit/data/profiles/cursor/rules/e2e-runner.mdc +30 -0
  156. agent_toolkit/data/profiles/cursor/rules/performance-optimizer.mdc +27 -0
  157. agent_toolkit/data/profiles/cursor/rules/planner.mdc +28 -0
  158. agent_toolkit/data/profiles/cursor/rules/refactor-cleaner.mdc +26 -0
  159. agent_toolkit/data/profiles/cursor/rules/reference-lookup.mdc +20 -0
  160. agent_toolkit/data/profiles/cursor/rules/security-reviewer.mdc +20 -0
  161. agent_toolkit/data/profiles/cursor/rules/tdd-guide.mdc +26 -0
  162. agent_toolkit/data/profiles/cursor/rules/typescript-reviewer.mdc +28 -0
  163. agent_toolkit/data/profiles/muse-code/README.md +35 -0
  164. agent_toolkit/data/profiles/opencode/README.md +44 -0
  165. agent_toolkit/data/profiles/opencode/agents/architect.md +30 -0
  166. agent_toolkit/data/profiles/opencode/agents/assistant.md +96 -0
  167. agent_toolkit/data/profiles/opencode/agents/build-error-resolver.md +31 -0
  168. agent_toolkit/data/profiles/opencode/agents/client-workflow-bootstrap.md +66 -0
  169. agent_toolkit/data/profiles/opencode/agents/code-reviewer.md +47 -0
  170. agent_toolkit/data/profiles/opencode/agents/contribution-planner.md +44 -0
  171. agent_toolkit/data/profiles/opencode/agents/database-reviewer.md +43 -0
  172. agent_toolkit/data/profiles/opencode/agents/docs-lookup.md +28 -0
  173. agent_toolkit/data/profiles/opencode/agents/e2e-runner.md +33 -0
  174. agent_toolkit/data/profiles/opencode/agents/performance-optimizer.md +34 -0
  175. agent_toolkit/data/profiles/opencode/agents/planner.md +27 -0
  176. agent_toolkit/data/profiles/opencode/agents/refactor-cleaner.md +27 -0
  177. agent_toolkit/data/profiles/opencode/agents/reference-lookup.md +27 -0
  178. agent_toolkit/data/profiles/opencode/agents/security-reviewer.md +27 -0
  179. agent_toolkit/data/profiles/opencode/agents/tdd-guide.md +27 -0
  180. agent_toolkit/data/profiles/opencode/agents/typescript-reviewer.md +30 -0
  181. agent_toolkit/data/profiles/opencode/opencode.json +3 -0
  182. agent_toolkit/data/profiles/pi/skills/architect/skill.md +5 -0
  183. agent_toolkit/data/profiles/pi/skills/assistant/skill.md +3 -0
  184. agent_toolkit/data/profiles/pi/skills/code-reviewer/skill.md +5 -0
  185. agent_toolkit/data/profiles/pi/skills/planner/skill.md +3 -0
  186. agent_toolkit/data/profiles/pi/skills/security-reviewer/skill.md +3 -0
  187. agent_toolkit/data/profiles/windsurf/memories/global_rules.md +114 -0
  188. agent_toolkit/data/profiles/windsurf/rules/architect.mdc +23 -0
  189. agent_toolkit/data/profiles/windsurf/rules/assistant.mdc +61 -0
  190. agent_toolkit/data/profiles/windsurf/rules/build-error-resolver.mdc +20 -0
  191. agent_toolkit/data/profiles/windsurf/rules/code-reviewer.mdc +21 -0
  192. agent_toolkit/data/profiles/windsurf/rules/database-reviewer.mdc +29 -0
  193. agent_toolkit/data/profiles/windsurf/rules/docs-lookup.mdc +15 -0
  194. agent_toolkit/data/profiles/windsurf/rules/e2e-runner.mdc +30 -0
  195. agent_toolkit/data/profiles/windsurf/rules/performance-optimizer.mdc +27 -0
  196. agent_toolkit/data/profiles/windsurf/rules/planner.mdc +28 -0
  197. agent_toolkit/data/profiles/windsurf/rules/refactor-cleaner.mdc +26 -0
  198. agent_toolkit/data/profiles/windsurf/rules/reference-lookup.mdc +20 -0
  199. agent_toolkit/data/profiles/windsurf/rules/security-reviewer.mdc +20 -0
  200. agent_toolkit/data/profiles/windsurf/rules/tdd-guide.mdc +26 -0
  201. agent_toolkit/data/profiles/windsurf/rules/typescript-reviewer.mdc +28 -0
  202. agent_toolkit/data/skills/accessibility/review/SKILL.md +116 -0
  203. agent_toolkit/data/skills/accessibility/review/references/a11y-checklist.md +25 -0
  204. agent_toolkit/data/skills/accessibility/review/references/a11y-findings-template.md +56 -0
  205. agent_toolkit/data/skills/accessibility/review/references/research.md +47 -0
  206. agent_toolkit/data/skills/agentic-security/mcp-audit/SKILL.md +116 -0
  207. agent_toolkit/data/skills/agentic-security/mcp-audit/references/mcp-audit-template.md +51 -0
  208. agent_toolkit/data/skills/agentic-security/owasp-agentic-review/SKILL.md +73 -0
  209. agent_toolkit/data/skills/agentic-security/owasp-agentic-review/references/owasp-agentic-template.md +32 -0
  210. agent_toolkit/data/skills/agentic-security/supply-chain-audit/SKILL.md +142 -0
  211. agent_toolkit/data/skills/agentic-security/threat-modeling/SKILL.md +100 -0
  212. agent_toolkit/data/skills/agentic-security/threat-modeling/references/threat-model-template.md +55 -0
  213. agent_toolkit/data/skills/architecture/c4-model/SKILL.md +49 -0
  214. agent_toolkit/data/skills/cloud/aws-well-architected-review/SKILL.md +37 -0
  215. agent_toolkit/data/skills/cloud/cloud-design-patterns/SKILL.md +38 -0
  216. agent_toolkit/data/skills/core/assistant/SKILL.md +216 -0
  217. agent_toolkit/data/skills/core/assistant/references/AGENTS_TEMPLATE.md +0 -0
  218. agent_toolkit/data/skills/core/assistant/references/ORCHESTRATION.md +0 -0
  219. agent_toolkit/data/skills/core/assistant/references/REPO_INSPECTION.md +0 -0
  220. agent_toolkit/data/skills/core/dev-companion/SKILL.md +65 -0
  221. agent_toolkit/data/skills/core/dev-companion/references/LOOP_GUARDRAILS.md +0 -0
  222. agent_toolkit/data/skills/core/onboarding/SKILL.md +122 -0
  223. agent_toolkit/data/skills/core/output-handshake/SKILL.md +26 -0
  224. agent_toolkit/data/skills/core/pr-fallback/SKILL.md +35 -0
  225. agent_toolkit/data/skills/core/pr-fallback/references/pr-body-default.md +0 -0
  226. agent_toolkit/data/skills/core/project/SKILL.md +89 -0
  227. agent_toolkit/data/skills/core/workspace/SKILL.md +103 -0
  228. agent_toolkit/data/skills/core/workspace-knowledge-sync/SKILL.md +140 -0
  229. agent_toolkit/data/skills/data/dbt-validation/SKILL.md +41 -0
  230. agent_toolkit/data/skills/data/snowflake-validation/SKILL.md +38 -0
  231. agent_toolkit/data/skills/delivery/adr/SKILL.md +56 -0
  232. agent_toolkit/data/skills/delivery/adr/references/default-template.md +35 -0
  233. agent_toolkit/data/skills/delivery/adr/references/example-001-graphql-adoption.md +66 -0
  234. agent_toolkit/data/skills/delivery/agreement/SKILL.md +24 -0
  235. agent_toolkit/data/skills/delivery/agreement/references/default-template.md +17 -0
  236. agent_toolkit/data/skills/delivery/agreement/references/example-api-versioning.md +29 -0
  237. agent_toolkit/data/skills/delivery/bug/SKILL.md +26 -0
  238. agent_toolkit/data/skills/delivery/bug/references/default-template.md +26 -0
  239. agent_toolkit/data/skills/delivery/bug/references/example-search-filter-bug.md +58 -0
  240. agent_toolkit/data/skills/delivery/decision-log/SKILL.md +28 -0
  241. agent_toolkit/data/skills/delivery/decision-log/references/default-template.md +17 -0
  242. agent_toolkit/data/skills/delivery/decision-log/references/example-repository-pattern.md +27 -0
  243. agent_toolkit/data/skills/delivery/development-workflow/SKILL.md +34 -0
  244. agent_toolkit/data/skills/delivery/development-workflow/references/default-workflow-checklist.md +44 -0
  245. agent_toolkit/data/skills/delivery/epic/SKILL.md +22 -0
  246. agent_toolkit/data/skills/delivery/epic/references/default-template.md +26 -0
  247. agent_toolkit/data/skills/delivery/epic/references/example-unified-dashboard.md +40 -0
  248. agent_toolkit/data/skills/delivery/incident/SKILL.md +24 -0
  249. agent_toolkit/data/skills/delivery/incident/references/default-template.md +29 -0
  250. agent_toolkit/data/skills/delivery/incident/references/example-payment-outage.md +62 -0
  251. agent_toolkit/data/skills/delivery/management-unit-assessment/SKILL.md +104 -0
  252. agent_toolkit/data/skills/delivery/management-unit-assessment/references/default-template.md +24 -0
  253. agent_toolkit/data/skills/delivery/management-unit-assessment/references/example-team-assessment.md +126 -0
  254. agent_toolkit/data/skills/delivery/meeting-minutes/SKILL.md +25 -0
  255. agent_toolkit/data/skills/delivery/meeting-minutes/references/default-template.md +22 -0
  256. agent_toolkit/data/skills/delivery/meeting-minutes/references/example-weekly-sync.md +72 -0
  257. agent_toolkit/data/skills/delivery/planning/SKILL.md +31 -0
  258. agent_toolkit/data/skills/delivery/planning/references/default-template.md +25 -0
  259. agent_toolkit/data/skills/delivery/planning/references/example-sprint-planning.md +62 -0
  260. agent_toolkit/data/skills/delivery/prd/SKILL.md +46 -0
  261. agent_toolkit/data/skills/delivery/prd/references/default-template.md +31 -0
  262. agent_toolkit/data/skills/delivery/prd/references/example-unified-api.md +71 -0
  263. agent_toolkit/data/skills/delivery/project-assessment/SKILL.md +90 -0
  264. agent_toolkit/data/skills/delivery/project-assessment/references/default-template.md +26 -0
  265. agent_toolkit/data/skills/delivery/project-assessment/references/example-platform-assessment.md +122 -0
  266. agent_toolkit/data/skills/delivery/project-assessment-evidence/SKILL.md +88 -0
  267. agent_toolkit/data/skills/delivery/project-assessment-evidence/references/default-template.md +24 -0
  268. agent_toolkit/data/skills/delivery/project-assessment-evidence/references/example-evidence-map.md +46 -0
  269. agent_toolkit/data/skills/delivery/spike/SKILL.md +24 -0
  270. agent_toolkit/data/skills/delivery/spike/references/default-template.md +29 -0
  271. agent_toolkit/data/skills/delivery/spike/references/example-graphql-federation.md +79 -0
  272. agent_toolkit/data/skills/delivery/task/SKILL.md +21 -0
  273. agent_toolkit/data/skills/delivery/task/references/default-template.md +21 -0
  274. agent_toolkit/data/skills/delivery/task/references/example-nav-system.md +33 -0
  275. agent_toolkit/data/skills/delivery/technical-unit-assessment/SKILL.md +58 -0
  276. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/default-template.md +26 -0
  277. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/example-frontend-assessment.md +112 -0
  278. agent_toolkit/data/skills/delivery/technical-unit-assessment/references/indicator-groups.md +65 -0
  279. agent_toolkit/data/skills/delivery/trd/SKILL.md +49 -0
  280. agent_toolkit/data/skills/delivery/trd/references/default-template.md +31 -0
  281. agent_toolkit/data/skills/delivery/trd/references/example-api-migration.md +122 -0
  282. agent_toolkit/data/skills/delivery/user-story/SKILL.md +21 -0
  283. agent_toolkit/data/skills/delivery/user-story/references/default-template.md +21 -0
  284. agent_toolkit/data/skills/delivery/user-story/references/example-advanced-filtering.md +37 -0
  285. agent_toolkit/data/skills/delivery/work-item/SKILL.md +31 -0
  286. agent_toolkit/data/skills/delivery/work-item/references/default-template.md +21 -0
  287. agent_toolkit/data/skills/delivery/work-item/references/example-routing-dashboard.md +23 -0
  288. agent_toolkit/data/skills/delivery/workflow-client-bootstrap/SKILL.md +148 -0
  289. agent_toolkit/data/skills/delivery/workflow-client-bootstrap/questions.yaml +165 -0
  290. agent_toolkit/data/skills/delivery/workflow-generic-project/SKILL.md +79 -0
  291. agent_toolkit/data/skills/design/design-assessment/SKILL.md +150 -0
  292. agent_toolkit/data/skills/design/design-assessment/references/design-scorecard-template.md +78 -0
  293. agent_toolkit/data/skills/design/design-improvement/SKILL.md +167 -0
  294. agent_toolkit/data/skills/design/design-improvement/references/improvement-plan-template.md +113 -0
  295. agent_toolkit/data/skills/design/figma/LICENSE.txt +2 -0
  296. agent_toolkit/data/skills/design/figma/NOTICE.txt +25 -0
  297. agent_toolkit/data/skills/design/figma/SKILL.md +98 -0
  298. agent_toolkit/data/skills/design/figma/references/figma-mcp-config.md +82 -0
  299. agent_toolkit/data/skills/design/figma/references/figma-tools-and-prompts.md +34 -0
  300. agent_toolkit/data/skills/design/figma-code-connect-components/LICENSE.txt +2 -0
  301. agent_toolkit/data/skills/design/figma-code-connect-components/NOTICE.txt +18 -0
  302. agent_toolkit/data/skills/design/figma-code-connect-components/SKILL.md +354 -0
  303. agent_toolkit/data/skills/design/figma-code-connect-components/references/mapping-checklist.md +7 -0
  304. agent_toolkit/data/skills/design/figma-code-connect-components/scripts/normalize_node_id.py +25 -0
  305. agent_toolkit/data/skills/design/figma-create-design-system-rules/LICENSE.txt +2 -0
  306. agent_toolkit/data/skills/design/figma-create-design-system-rules/NOTICE.txt +19 -0
  307. agent_toolkit/data/skills/design/figma-create-design-system-rules/SKILL.md +554 -0
  308. agent_toolkit/data/skills/design/figma-create-design-system-rules/references/rule-template.md +15 -0
  309. agent_toolkit/data/skills/design/figma-create-design-system-rules/scripts/check_agents_md.sh +9 -0
  310. agent_toolkit/data/skills/design/figma-create-new-file/LICENSE.txt +2 -0
  311. agent_toolkit/data/skills/design/figma-create-new-file/NOTICE.txt +17 -0
  312. agent_toolkit/data/skills/design/figma-create-new-file/SKILL.md +72 -0
  313. agent_toolkit/data/skills/design/figma-implement-design/LICENSE.txt +2 -0
  314. agent_toolkit/data/skills/design/figma-implement-design/NOTICE.txt +19 -0
  315. agent_toolkit/data/skills/design/figma-implement-design/SKILL.md +268 -0
  316. agent_toolkit/data/skills/design/frontend-design/LICENSE.txt +177 -0
  317. agent_toolkit/data/skills/design/frontend-design/SKILL.md +82 -0
  318. agent_toolkit/data/skills/design/frontend-design/UPSTREAM.md +14 -0
  319. agent_toolkit/data/skills/design/frontend-design-review/LICENSE +21 -0
  320. agent_toolkit/data/skills/design/frontend-design-review/SKILL.md +194 -0
  321. agent_toolkit/data/skills/design/frontend-design-review/references/pattern-examples.md +21 -0
  322. agent_toolkit/data/skills/design/frontend-design-review/references/quick-checklist.md +38 -0
  323. agent_toolkit/data/skills/design/frontend-design-review/references/review-output-format.md +68 -0
  324. agent_toolkit/data/skills/design/frontend-design-review/references/review-type-modifiers.md +31 -0
  325. agent_toolkit/data/skills/design/web-design-guidelines/SKILL.md +78 -0
  326. agent_toolkit/data/skills/design/web-design-guidelines/references/LICENSE +21 -0
  327. agent_toolkit/data/skills/design/web-design-guidelines/references/web-interface-guidelines.md +180 -0
  328. agent_toolkit/data/skills/forge/gh-address-comments/LICENSE.txt +202 -0
  329. agent_toolkit/data/skills/forge/gh-address-comments/NOTICE.txt +20 -0
  330. agent_toolkit/data/skills/forge/gh-address-comments/SKILL.md +72 -0
  331. agent_toolkit/data/skills/forge/gh-address-comments/scripts/fetch_comments.py +239 -0
  332. agent_toolkit/data/skills/forge/gh-contribution-planner/SKILL.md +160 -0
  333. agent_toolkit/data/skills/forge/gh-contribution-planner/scripts/inspect_contributions.py +818 -0
  334. agent_toolkit/data/skills/forge/gh-fix-ci/LICENSE.txt +201 -0
  335. agent_toolkit/data/skills/forge/gh-fix-ci/NOTICE.txt +20 -0
  336. agent_toolkit/data/skills/forge/gh-fix-ci/SKILL.md +74 -0
  337. agent_toolkit/data/skills/forge/gh-fix-ci/scripts/inspect_pr_checks.py +509 -0
  338. agent_toolkit/data/skills/forge/github-cli-workflow/SKILL.md +49 -0
  339. agent_toolkit/data/skills/forge/gitlab-cli-workflow/SKILL.md +44 -0
  340. agent_toolkit/data/skills/forge/workflow-client-bootstrap/SKILL.md +14 -0
  341. agent_toolkit/data/skills/forge/workflow-generic-project/SKILL.md +14 -0
  342. agent_toolkit/data/skills/forge/worktree/SKILL.md +113 -0
  343. agent_toolkit/data/skills/integrations/clickup-cli/SKILL.md +78 -0
  344. agent_toolkit/data/skills/integrations/clickup-cli/references/docs-management.md +57 -0
  345. agent_toolkit/data/skills/integrations/clickup-cli/references/task-management.md +131 -0
  346. agent_toolkit/data/skills/integrations/clickup-cli/references/time-tracking.md +38 -0
  347. agent_toolkit/data/skills/integrations/linear/LICENSE.txt +202 -0
  348. agent_toolkit/data/skills/integrations/linear/NOTICE.txt +23 -0
  349. agent_toolkit/data/skills/integrations/linear/SKILL.md +134 -0
  350. agent_toolkit/data/skills/integrations/mcp/SKILL.md +88 -0
  351. agent_toolkit/data/skills/integrations/slack-assistant/SKILL.md +138 -0
  352. agent_toolkit/data/skills/integrations/slack-cli/SKILL.md +109 -0
  353. agent_toolkit/data/skills/integrations/slack-cli/references/INSTALLATION.md +42 -0
  354. agent_toolkit/data/skills/loops/loop-runner/SKILL.md +92 -0
  355. agent_toolkit/data/skills/ops/docs-generator/SKILL.md +120 -0
  356. agent_toolkit/data/skills/ops/llm-cost-advisor/SKILL.md +87 -0
  357. agent_toolkit/data/skills/ops/swarm/SKILL.md +108 -0
  358. agent_toolkit/data/skills/ops/swarm-handoff/SKILL.md +112 -0
  359. agent_toolkit/data/skills/ops/swarm-observer/SKILL.md +102 -0
  360. agent_toolkit/data/skills/ops/triage/SKILL.md +119 -0
  361. agent_toolkit/data/skills/quality/codeql/SKILL.md +106 -0
  362. agent_toolkit/data/skills/quality/codeql/references/codeql-queries.md +43 -0
  363. agent_toolkit/data/skills/quality/megalinter/SKILL.md +162 -0
  364. agent_toolkit/data/skills/quality/megalinter/references/megalinter-images.md +36 -0
  365. agent_toolkit/data/skills/quality/megalinter/references/megalinter-license.md +41 -0
  366. agent_toolkit/data/skills/quality/megalinter/references/megalinter-targets.md +66 -0
  367. agent_toolkit/data/skills/tooling/chrome-devtools/SKILL.md +146 -0
  368. agent_toolkit/data/skills/tooling/herdr/SKILL.md +109 -0
  369. agent_toolkit/data/skills/tooling/inventory/SKILL.md +81 -0
  370. agent_toolkit/data/skills/tooling/jupyter-notebook/LICENSE.txt +201 -0
  371. agent_toolkit/data/skills/tooling/jupyter-notebook/NOTICE.txt +27 -0
  372. agent_toolkit/data/skills/tooling/jupyter-notebook/SKILL.md +145 -0
  373. agent_toolkit/data/skills/tooling/jupyter-notebook/assets/experiment-template.ipynb +117 -0
  374. agent_toolkit/data/skills/tooling/jupyter-notebook/assets/tutorial-template.ipynb +115 -0
  375. agent_toolkit/data/skills/tooling/jupyter-notebook/references/experiment-patterns.md +10 -0
  376. agent_toolkit/data/skills/tooling/jupyter-notebook/references/notebook-structure.md +17 -0
  377. agent_toolkit/data/skills/tooling/jupyter-notebook/references/quality-checklist.md +11 -0
  378. agent_toolkit/data/skills/tooling/jupyter-notebook/references/tutorial-patterns.md +9 -0
  379. agent_toolkit/data/skills/tooling/jupyter-notebook/scripts/new_notebook.py +132 -0
  380. agent_toolkit/data/skills/tooling/mermaid/SKILL.md +36 -0
  381. agent_toolkit/data/skills/tooling/playwright-cli/LICENSE.txt +201 -0
  382. agent_toolkit/data/skills/tooling/playwright-cli/NOTICE.txt +29 -0
  383. agent_toolkit/data/skills/tooling/playwright-cli/SKILL.md +154 -0
  384. agent_toolkit/data/skills/tooling/playwright-cli/references/cli.md +116 -0
  385. agent_toolkit/data/skills/tooling/playwright-cli/references/workflows.md +98 -0
  386. agent_toolkit/data/skills/tooling/playwright-cli/scripts/executable_playwright_cli.sh +25 -0
  387. agent_toolkit/data_cache.py +79 -0
  388. agent_toolkit/data_sync.py +144 -0
  389. agent_toolkit/installer/__init__.py +0 -0
  390. agent_toolkit/installer/merge.py +59 -0
  391. agent_toolkit/installer/receipt.py +89 -0
  392. agent_toolkit/installer/sources.py +92 -0
  393. agent_toolkit/installer/tracking.py +63 -0
  394. agent_toolkit/launcher.py +69 -0
  395. agent_toolkit/loop/__init__.py +0 -0
  396. agent_toolkit/loop/budget.py +107 -0
  397. agent_toolkit/loop/gh_gate.py +923 -0
  398. agent_toolkit/loop/loop-gh-gate +923 -0
  399. agent_toolkit/loop/pack.py +65 -0
  400. agent_toolkit/loop/runner.py +2722 -0
  401. agent_toolkit/runner/__init__.py +0 -0
  402. agent_toolkit/runner/dispatcher.py +163 -0
  403. agent_toolkit/runner/policy.py +356 -0
  404. agent_toolkit/runner/providers/__init__.py +21 -0
  405. agent_toolkit/runner/providers/anthropic_provider.py +109 -0
  406. agent_toolkit/runner/providers/base.py +53 -0
  407. agent_toolkit/runner/providers/ollama_provider.py +108 -0
  408. agent_toolkit/runner/providers/openai_provider.py +103 -0
  409. agent_toolkit/runner/providers/opencode_provider.py +127 -0
  410. agent_toolkit/swarm/__init__.py +5 -0
  411. agent_toolkit/swarm/approvals.py +121 -0
  412. agent_toolkit/swarm/backends/__init__.py +596 -0
  413. agent_toolkit/swarm/budget.py +83 -0
  414. agent_toolkit/swarm/cli.py +2448 -0
  415. agent_toolkit/swarm/config.py +351 -0
  416. agent_toolkit/swarm/handoff.py +174 -0
  417. agent_toolkit/swarm/models.py +230 -0
  418. agent_toolkit/swarm/prompts.py +177 -0
  419. agent_toolkit/swarm/recipes.py +304 -0
  420. agent_toolkit/swarm/runner.py +267 -0
  421. agent_toolkit/swarm/state.py +93 -0
  422. agent_toolkit/swarm/store.py +148 -0
  423. agent_toolkit/swarm/worktree.py +105 -0
  424. agent_toolkit/templates/workspace/.gitignore +19 -0
  425. agent_toolkit/templates/workspace/AGENTS.md +82 -0
  426. agent_toolkit/templates/workspace/knowledge/README.md +22 -0
  427. agent_toolkit/templates/workspace/knowledge/learnings/general.md +3 -0
  428. agent_toolkit/templates/workspace/knowledge/todos/pending.md +7 -0
  429. agent_toolkit/templates/workspace/packs/README.md +24 -0
  430. agent_toolkit/templates/workspace/personas/architect.md +12 -0
  431. agent_toolkit/templates/workspace/personas/implementer.md +12 -0
  432. agent_toolkit/templates/workspace/personas/researcher.md +12 -0
  433. agent_toolkit/templates/workspace/personas/reviewer.md +12 -0
  434. agent_toolkit_cli-1.11.0.dist-info/METADATA +363 -0
  435. agent_toolkit_cli-1.11.0.dist-info/RECORD +438 -0
  436. agent_toolkit_cli-1.11.0.dist-info/WHEEL +4 -0
  437. agent_toolkit_cli-1.11.0.dist-info/entry_points.txt +4 -0
  438. agent_toolkit_cli-1.11.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,771 @@
1
+ """
2
+ insights — AI tool usage insights for agent-toolkit.
3
+
4
+ Usage:
5
+ agent-toolkit insights opencode [--days N] [--output PATH]
6
+ agent-toolkit insights cursor [--output PATH]
7
+ agent-toolkit insights claude [--days N] [--output PATH]
8
+
9
+ Subcommands:
10
+ opencode Analyse OpenCode sessions from ~/.local/share/opencode/opencode.db
11
+ cursor Analyse Cursor agent transcripts from ~/.cursor/projects/
12
+ claude Analyse Claude Code usage from ~/.claude/usage-data/ JSONL files
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import os
19
+ import re
20
+ import sqlite3
21
+ import sys
22
+ import sys as _sys
23
+ from datetime import datetime, timedelta, timezone
24
+ from pathlib import Path
25
+
26
+ if _sys.platform == "win32":
27
+ try:
28
+ _sys.stdout.reconfigure(encoding="utf-8", errors="replace")
29
+ _sys.stderr.reconfigure(encoding="utf-8", errors="replace")
30
+ except Exception:
31
+ pass
32
+
33
+ OPENCODE_DB = Path.home() / ".local" / "share" / "opencode" / "opencode.db"
34
+ CURSOR_PROJECTS = Path.home() / ".cursor" / "projects"
35
+ CLAUDE_USAGE = Path.home() / ".claude" / "usage-data"
36
+
37
+
38
+ # ── colors ────────────────────────────────────────────────────────────────────
39
+
40
+ _USE_COLOR = sys.stdout.isatty() and not os.environ.get("NO_COLOR")
41
+
42
+
43
+ def _c(code: str, text: str) -> str:
44
+ return f"\033[{code}m{text}\033[0m" if _USE_COLOR else text
45
+
46
+
47
+ def _blue(t: str) -> str:
48
+ return _c("1;34", t)
49
+
50
+
51
+ def _cyan(t: str) -> str:
52
+ return _c("0;36", t)
53
+
54
+
55
+ def _green(t: str) -> str:
56
+ return _c("1;32", t)
57
+
58
+
59
+ # ── OpenCode ──────────────────────────────────────────────────────────────────
60
+
61
+
62
+ def _opencode_stats(db_path: Path, days: int | None = None) -> dict:
63
+ con = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True)
64
+ con.row_factory = sqlite3.Row
65
+ cur = con.cursor()
66
+
67
+ where = ""
68
+ if days:
69
+ cutoff = (datetime.now(timezone.utc) - timedelta(days=days)).strftime("%Y-%m-%d")
70
+ where = f"AND datetime(time_created/1000,'unixepoch') >= '{cutoff}'"
71
+
72
+ cur.execute(f"""
73
+ SELECT
74
+ COUNT(*) total_sessions,
75
+ COALESCE(SUM(cost), 0) total_cost,
76
+ COALESCE(SUM(tokens_input), 0) total_tokens_in,
77
+ COALESCE(SUM(tokens_output), 0) total_tokens_out,
78
+ MIN(datetime(time_created/1000,'unixepoch')) first_session,
79
+ MAX(datetime(time_updated/1000,'unixepoch')) last_session
80
+ FROM session
81
+ WHERE time_archived IS NULL {where}
82
+ """)
83
+ agg = dict(cur.fetchone())
84
+
85
+ cur.execute(f"""
86
+ SELECT
87
+ COALESCE(json_extract(model,'$.id'), 'unknown') model_id,
88
+ COALESCE(json_extract(model,'$.providerID'), 'unknown') provider,
89
+ COUNT(*) sessions,
90
+ COALESCE(SUM(cost), 0) cost,
91
+ COALESCE(SUM(tokens_input) + SUM(tokens_output), 0) tokens
92
+ FROM session
93
+ WHERE time_archived IS NULL {where}
94
+ GROUP BY model_id
95
+ ORDER BY sessions DESC
96
+ LIMIT 10
97
+ """)
98
+ agg["by_model"] = [dict(r) for r in cur.fetchall()]
99
+
100
+ # Home dir replacement for directory paths
101
+ home = str(Path.home())
102
+ cur.execute(f"""
103
+ SELECT
104
+ REPLACE(directory, '{home}', '~') as dir,
105
+ COUNT(*) sessions,
106
+ COALESCE(SUM(cost), 0) cost,
107
+ COALESCE(SUM(tokens_input) + SUM(tokens_output), 0) tokens
108
+ FROM session
109
+ WHERE time_archived IS NULL {where}
110
+ GROUP BY directory
111
+ ORDER BY sessions DESC
112
+ LIMIT 10
113
+ """)
114
+ agg["by_directory"] = [dict(r) for r in cur.fetchall()]
115
+
116
+ # Recent sessions (last 10 titles)
117
+ cur.execute(f"""
118
+ SELECT title, datetime(time_created/1000,'unixepoch') created
119
+ FROM session
120
+ WHERE time_archived IS NULL {where}
121
+ ORDER BY time_created DESC
122
+ LIMIT 10
123
+ """)
124
+ agg["recent_sessions"] = [dict(r) for r in cur.fetchall()]
125
+
126
+ con.close()
127
+ return agg
128
+
129
+
130
+ def _opencode_markdown(stats: dict, days: int | None) -> str:
131
+ period = f"last {days} days" if days else "all time"
132
+ total_tokens = (stats.get("total_tokens_in") or 0) + (stats.get("total_tokens_out") or 0)
133
+ lines = [
134
+ f"# OpenCode Usage Insights ({period})",
135
+ "",
136
+ "## Stats",
137
+ "",
138
+ "| Metric | Value |",
139
+ "|--------|-------|",
140
+ f"| Sessions | {stats.get('total_sessions', 0):,} |",
141
+ f"| Total Cost | ${stats.get('total_cost', 0):,.4f} |",
142
+ f"| Total Tokens | {total_tokens:,} |",
143
+ f"| Tokens In | {stats.get('total_tokens_in', 0):,} |",
144
+ f"| Tokens Out | {stats.get('total_tokens_out', 0):,} |",
145
+ f"| Date Range | {stats.get('first_session', 'N/A')[:10]} → {stats.get('last_session', 'N/A')[:10]} |",
146
+ "",
147
+ ]
148
+
149
+ by_dir = stats.get("by_directory", [])
150
+ if by_dir:
151
+ lines += [
152
+ "## Top 5 Directories by Session Count",
153
+ "",
154
+ "| Directory | Sessions | Cost |",
155
+ "|-----------|----------|------|",
156
+ ]
157
+ for row in by_dir[:5]:
158
+ lines.append(f"| `{row['dir']}` | {row['sessions']} | ${row.get('cost', 0):,.4f} |")
159
+ lines.append("")
160
+
161
+ by_model = stats.get("by_model", [])
162
+ if by_model:
163
+ lines += [
164
+ "## Top 5 Models by Usage",
165
+ "",
166
+ "| Model | Provider | Sessions | Tokens |",
167
+ "|-------|----------|----------|--------|",
168
+ ]
169
+ for row in by_model[:5]:
170
+ lines.append(
171
+ f"| `{row['model_id']}` | {row['provider']} | {row['sessions']} | {row.get('tokens', 0):,} |"
172
+ )
173
+ lines.append("")
174
+
175
+ recent = stats.get("recent_sessions", [])
176
+ if recent:
177
+ lines += ["## Recent Sessions (last 10)", ""]
178
+ for s in recent:
179
+ title = (s.get("title") or "(untitled)")[:80]
180
+ created = (s.get("created") or "")[:10]
181
+ lines.append(f"- {created} {title}")
182
+ lines.append("")
183
+
184
+ return "\n".join(lines)
185
+
186
+
187
+ def _opencode_html(stats: dict, days: int | None) -> str:
188
+ period = f"last {days} days" if days else "all time"
189
+ total_tokens = (stats.get("total_tokens_in") or 0) + (stats.get("total_tokens_out") or 0)
190
+ generated_at = datetime.now().strftime("%Y-%m-%d %H:%M")
191
+
192
+ def _th(*cols: str) -> str:
193
+ return "<tr>" + "".join(f"<th>{c}</th>" for c in cols) + "</tr>"
194
+
195
+ def _tr(*cols: str) -> str:
196
+ return "<tr>" + "".join(f"<td>{c}</td>" for c in cols) + "</tr>"
197
+
198
+ stats_rows = "".join(
199
+ [
200
+ _tr("Sessions", f"{stats.get('total_sessions', 0):,}"),
201
+ _tr("Total Cost", f"${stats.get('total_cost', 0):,.4f}"),
202
+ _tr("Total Tokens", f"{total_tokens:,}"),
203
+ _tr("Tokens In", f"{stats.get('total_tokens_in', 0):,}"),
204
+ _tr("Tokens Out", f"{stats.get('total_tokens_out', 0):,}"),
205
+ _tr(
206
+ "Date Range",
207
+ f"{stats.get('first_session', 'N/A')[:10]} &rarr; {stats.get('last_session', 'N/A')[:10]}",
208
+ ),
209
+ ]
210
+ )
211
+
212
+ dir_rows = ""
213
+ for row in (stats.get("by_directory") or [])[:5]:
214
+ dir_rows += _tr(
215
+ f"<code>{row['dir']}</code>", str(row["sessions"]), f"${row.get('cost', 0):,.4f}"
216
+ )
217
+
218
+ model_rows = ""
219
+ for row in (stats.get("by_model") or [])[:5]:
220
+ model_rows += _tr(
221
+ f"<code>{row['model_id']}</code>",
222
+ row["provider"],
223
+ str(row["sessions"]),
224
+ f"{row.get('tokens', 0):,}",
225
+ )
226
+
227
+ recent_items = ""
228
+ for s in stats.get("recent_sessions") or []:
229
+ title = (s.get("title") or "(untitled)")[:80]
230
+ created = (s.get("created") or "")[:10]
231
+ recent_items += f"<li><span class='date'>{created}</span> {title}</li>"
232
+
233
+ return f"""<!DOCTYPE html>
234
+ <html lang="en">
235
+ <head>
236
+ <meta charset="UTF-8">
237
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
238
+ <title>OpenCode Usage Insights</title>
239
+ <style>
240
+ :root {{
241
+ --bg: #0d1117; --surface: #161b22; --border: #30363d;
242
+ --text: #e6edf3; --muted: #8b949e; --accent: #58a6ff; --green: #3fb950;
243
+ }}
244
+ * {{ box-sizing: border-box; margin: 0; padding: 0; }}
245
+ body {{ background: var(--bg); color: var(--text);
246
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
247
+ line-height: 1.6; padding: 2rem 1rem; }}
248
+ .container {{ max-width: 860px; margin: 0 auto; }}
249
+ h1 {{ font-size: 1.8rem; margin-bottom: 0.25rem; }}
250
+ h2 {{ font-size: 1.2rem; color: var(--accent); margin: 2rem 0 1rem;
251
+ border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }}
252
+ .subtitle {{ color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }}
253
+ table {{ width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }}
254
+ th {{ text-align: left; padding: 0.5rem 0.75rem; color: var(--muted);
255
+ font-size: 0.85rem; border-bottom: 1px solid var(--border); }}
256
+ td {{ padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
257
+ font-size: 0.9rem; }}
258
+ code {{ background: #1f2937; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.82rem; }}
259
+ ul {{ list-style: none; padding: 0; }}
260
+ li {{ padding: 0.35rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }}
261
+ .date {{ color: var(--muted); margin-right: 0.75rem; font-size: 0.82rem; }}
262
+ </style>
263
+ </head>
264
+ <body>
265
+ <div class="container">
266
+ <h1>OpenCode Usage Insights</h1>
267
+ <p class="subtitle">Period: {period} &mdash; Generated {generated_at}</p>
268
+
269
+ <h2>Stats</h2>
270
+ <table><thead>{_th("Metric", "Value")}</thead><tbody>{stats_rows}</tbody></table>
271
+
272
+ <h2>Top 5 Directories</h2>
273
+ <table><thead>{_th("Directory", "Sessions", "Cost")}</thead><tbody>{dir_rows or "<tr><td colspan='3'>No data</td></tr>"}</tbody></table>
274
+
275
+ <h2>Top 5 Models</h2>
276
+ <table><thead>{_th("Model", "Provider", "Sessions", "Tokens")}</thead><tbody>{model_rows or "<tr><td colspan='4'>No data</td></tr>"}</tbody></table>
277
+
278
+ <h2>Recent Sessions</h2>
279
+ <ul>{recent_items or "<li>No recent sessions</li>"}</ul>
280
+ </div>
281
+ </body>
282
+ </html>"""
283
+
284
+
285
+ def _sub_opencode(argv: list[str]) -> int:
286
+ import argparse
287
+
288
+ p = argparse.ArgumentParser(prog="agent-toolkit insights opencode", add_help=True)
289
+ p.add_argument("--days", type=int, default=None, help="Limit to last N days")
290
+ p.add_argument("--output", metavar="PATH", help="Save HTML report to PATH")
291
+ args = p.parse_args(argv)
292
+
293
+ if not OPENCODE_DB.exists():
294
+ print(f"OpenCode database not found: {OPENCODE_DB}", file=sys.stderr)
295
+ return 1
296
+
297
+ try:
298
+ stats = _opencode_stats(OPENCODE_DB, args.days)
299
+ except Exception as exc:
300
+ print(f"Error reading OpenCode database: {exc}", file=sys.stderr)
301
+ return 1
302
+
303
+ if args.output:
304
+ html = _opencode_html(stats, args.days)
305
+ out_path = Path(args.output)
306
+ out_path.write_text(html, encoding="utf-8")
307
+ print(f"HTML report saved to: {out_path}")
308
+ else:
309
+ print(_opencode_markdown(stats, args.days))
310
+
311
+ return 0
312
+
313
+
314
+ # ── Cursor ────────────────────────────────────────────────────────────────────
315
+
316
+
317
+ def _cursor_stats(projects_dir: Path) -> dict:
318
+ project_counts: dict[str, int] = {}
319
+ sample_tasks: list[dict] = []
320
+
321
+ if not projects_dir.is_dir():
322
+ return {"total_transcripts": 0, "total_projects": 0, "by_project": {}, "recent_tasks": []}
323
+
324
+ for project_dir in sorted(projects_dir.iterdir()):
325
+ transcripts_dir = project_dir / "agent-transcripts"
326
+ if not transcripts_dir.exists():
327
+ continue
328
+ project_name = project_dir.name
329
+ jsonl_files = sorted(
330
+ transcripts_dir.rglob("*.jsonl"),
331
+ key=lambda f: f.stat().st_mtime,
332
+ reverse=True,
333
+ )
334
+ project_counts[project_name] = len(jsonl_files)
335
+
336
+ # Sample task descriptions from recent files
337
+ for jf in jsonl_files[:3]:
338
+ try:
339
+ lines = jf.read_text(errors="replace").splitlines()
340
+ descriptions: list[str] = []
341
+ for line in lines:
342
+ try:
343
+ obj = json.loads(line)
344
+ role = obj.get("role") or (obj.get("message") or {}).get("role")
345
+ if role == "user":
346
+ content = obj.get("message", {}).get("content", [])
347
+ for part in content:
348
+ if isinstance(part, dict) and part.get("type") == "text":
349
+ txt = part.get("text", "")
350
+ txt = re.sub(r"<timestamp>[^<]*</timestamp>", "", txt).strip()
351
+ uq = re.search(
352
+ r"<user_query>(.*?)</user_query>", txt, re.DOTALL
353
+ )
354
+ if uq:
355
+ txt = uq.group(1).strip()
356
+ if txt:
357
+ descriptions.append(txt[:120])
358
+ break
359
+ except Exception:
360
+ continue
361
+ if descriptions:
362
+ break
363
+ if descriptions:
364
+ sample_tasks.append(
365
+ {
366
+ "project": project_name,
367
+ "description": descriptions[0],
368
+ "mtime": datetime.fromtimestamp(jf.stat().st_mtime).strftime(
369
+ "%Y-%m-%d"
370
+ ),
371
+ }
372
+ )
373
+ except Exception:
374
+ continue
375
+
376
+ # Sort by count desc
377
+ by_project = dict(sorted(project_counts.items(), key=lambda x: -x[1]))
378
+ total = sum(project_counts.values())
379
+
380
+ # Sort tasks by recency (approximate via project order)
381
+ sample_tasks.sort(key=lambda t: t["mtime"], reverse=True)
382
+
383
+ return {
384
+ "total_transcripts": total,
385
+ "total_projects": len(project_counts),
386
+ "by_project": by_project,
387
+ "recent_tasks": sample_tasks[:20],
388
+ }
389
+
390
+
391
+ def _cursor_markdown(stats: dict) -> str:
392
+ lines = [
393
+ "# Cursor Usage Insights",
394
+ "",
395
+ "## Stats",
396
+ "",
397
+ "| Metric | Value |",
398
+ "|--------|-------|",
399
+ f"| Total Transcripts | {stats.get('total_transcripts', 0):,} |",
400
+ f"| Projects | {stats.get('total_projects', 0):,} |",
401
+ "",
402
+ ]
403
+
404
+ by_project = stats.get("by_project", {})
405
+ if by_project:
406
+ lines += [
407
+ "## Top Projects by Transcript Count",
408
+ "",
409
+ "| Project | Transcripts |",
410
+ "|---------|-------------|",
411
+ ]
412
+ for name, count in list(by_project.items())[:10]:
413
+ lines.append(f"| `{name}` | {count} |")
414
+ lines.append("")
415
+
416
+ recent = stats.get("recent_tasks", [])
417
+ if recent:
418
+ lines += ["## Recent Tasks (sampled)", ""]
419
+ for t in recent[:10]:
420
+ lines.append(f"- {t['mtime']} [{t['project']}] {t['description']}")
421
+ lines.append("")
422
+
423
+ return "\n".join(lines)
424
+
425
+
426
+ def _cursor_html(stats: dict) -> str:
427
+ generated_at = datetime.now().strftime("%Y-%m-%d %H:%M")
428
+
429
+ def _tr(*cols: str) -> str:
430
+ return "<tr>" + "".join(f"<td>{c}</td>" for c in cols) + "</tr>"
431
+
432
+ def _th(*cols: str) -> str:
433
+ return "<tr>" + "".join(f"<th>{c}</th>" for c in cols) + "</tr>"
434
+
435
+ stats_rows = "".join(
436
+ [
437
+ _tr("Total Transcripts", f"{stats.get('total_transcripts', 0):,}"),
438
+ _tr("Projects", f"{stats.get('total_projects', 0):,}"),
439
+ ]
440
+ )
441
+
442
+ project_rows = ""
443
+ for name, count in list((stats.get("by_project") or {}).items())[:10]:
444
+ project_rows += _tr(f"<code>{name}</code>", str(count))
445
+
446
+ task_items = ""
447
+ for t in (stats.get("recent_tasks") or [])[:10]:
448
+ task_items += f"<li><span class='date'>{t['mtime']}</span> <span class='proj'>[{t['project']}]</span> {t['description']}</li>"
449
+
450
+ return f"""<!DOCTYPE html>
451
+ <html lang="en">
452
+ <head>
453
+ <meta charset="UTF-8">
454
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
455
+ <title>Cursor Usage Insights</title>
456
+ <style>
457
+ :root {{
458
+ --bg: #0d1117; --surface: #161b22; --border: #30363d;
459
+ --text: #e6edf3; --muted: #8b949e; --accent: #58a6ff;
460
+ }}
461
+ * {{ box-sizing: border-box; margin: 0; padding: 0; }}
462
+ body {{ background: var(--bg); color: var(--text);
463
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
464
+ line-height: 1.6; padding: 2rem 1rem; }}
465
+ .container {{ max-width: 860px; margin: 0 auto; }}
466
+ h1 {{ font-size: 1.8rem; margin-bottom: 0.25rem; }}
467
+ h2 {{ font-size: 1.2rem; color: var(--accent); margin: 2rem 0 1rem;
468
+ border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }}
469
+ .subtitle {{ color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }}
470
+ table {{ width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }}
471
+ th {{ text-align: left; padding: 0.5rem 0.75rem; color: var(--muted);
472
+ font-size: 0.85rem; border-bottom: 1px solid var(--border); }}
473
+ td {{ padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }}
474
+ code {{ background: #1f2937; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.82rem; }}
475
+ ul {{ list-style: none; padding: 0; }}
476
+ li {{ padding: 0.35rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }}
477
+ .date {{ color: var(--muted); margin-right: 0.5rem; font-size: 0.82rem; }}
478
+ .proj {{ color: var(--accent); margin-right: 0.5rem; font-size: 0.82rem; }}
479
+ </style>
480
+ </head>
481
+ <body>
482
+ <div class="container">
483
+ <h1>Cursor Usage Insights</h1>
484
+ <p class="subtitle">Generated {generated_at}</p>
485
+
486
+ <h2>Stats</h2>
487
+ <table><thead>{_th("Metric", "Value")}</thead><tbody>{stats_rows}</tbody></table>
488
+
489
+ <h2>Top Projects</h2>
490
+ <table><thead>{_th("Project", "Transcripts")}</thead><tbody>{project_rows or "<tr><td colspan='2'>No data</td></tr>"}</tbody></table>
491
+
492
+ <h2>Recent Tasks</h2>
493
+ <ul>{task_items or "<li>No tasks found</li>"}</ul>
494
+ </div>
495
+ </body>
496
+ </html>"""
497
+
498
+
499
+ def _sub_cursor(argv: list[str]) -> int:
500
+ import argparse
501
+
502
+ p = argparse.ArgumentParser(prog="agent-toolkit insights cursor", add_help=True)
503
+ p.add_argument("--output", metavar="PATH", help="Save HTML report to PATH")
504
+ args = p.parse_args(argv)
505
+
506
+ if not CURSOR_PROJECTS.exists():
507
+ print(f"Cursor projects directory not found: {CURSOR_PROJECTS}", file=sys.stderr)
508
+ print("No Cursor data available.", file=sys.stderr)
509
+ return 1
510
+
511
+ stats = _cursor_stats(CURSOR_PROJECTS)
512
+
513
+ if args.output:
514
+ html = _cursor_html(stats)
515
+ out_path = Path(args.output)
516
+ out_path.write_text(html, encoding="utf-8")
517
+ print(f"HTML report saved to: {out_path}")
518
+ else:
519
+ print(_cursor_markdown(stats))
520
+
521
+ return 0
522
+
523
+
524
+ # ── Claude Code ───────────────────────────────────────────────────────────────
525
+
526
+
527
+ def _claude_stats(usage_dir: Path, days: int | None = None) -> dict:
528
+ if not usage_dir.is_dir():
529
+ return {}
530
+
531
+ cutoff: datetime | None = None
532
+ if days:
533
+ cutoff = datetime.now(timezone.utc) - timedelta(days=days)
534
+
535
+ total_sessions = 0
536
+ total_messages = 0
537
+ total_tool_calls = 0
538
+ first_ts: str | None = None
539
+ last_ts: str | None = None
540
+ jsonl_files = sorted(usage_dir.rglob("*.jsonl"), key=lambda f: f.stat().st_mtime)
541
+
542
+ for jf in jsonl_files:
543
+ try:
544
+ for line in jf.read_text(errors="replace").splitlines():
545
+ if not line.strip():
546
+ continue
547
+ try:
548
+ obj = json.loads(line)
549
+ except Exception:
550
+ continue
551
+
552
+ ts = obj.get("timestamp") or obj.get("created_at") or obj.get("time")
553
+ if ts and cutoff:
554
+ try:
555
+ # Parse ISO timestamp
556
+ ts_dt = datetime.fromisoformat(ts.replace("Z", "+00:00"))
557
+ if ts_dt < cutoff:
558
+ continue
559
+ except Exception:
560
+ pass
561
+
562
+ # Count events
563
+ event_type = obj.get("type") or obj.get("event")
564
+ if event_type in ("session_start", "session"):
565
+ total_sessions += 1
566
+ if ts:
567
+ if first_ts is None or ts < first_ts:
568
+ first_ts = ts
569
+ if last_ts is None or ts > last_ts:
570
+ last_ts = ts
571
+
572
+ if event_type in ("message", "assistant_message", "human_message"):
573
+ total_messages += 1
574
+
575
+ # Tool calls are often nested
576
+ tool_uses = obj.get("tool_uses") or []
577
+ if isinstance(tool_uses, list):
578
+ total_tool_calls += len(tool_uses)
579
+
580
+ content = obj.get("content") or []
581
+ if isinstance(content, list):
582
+ total_tool_calls += sum(
583
+ 1 for c in content if isinstance(c, dict) and c.get("type") == "tool_use"
584
+ )
585
+
586
+ except Exception:
587
+ continue
588
+
589
+ return {
590
+ "total_sessions": total_sessions,
591
+ "total_messages": total_messages,
592
+ "total_tool_calls": total_tool_calls,
593
+ "first_session": (first_ts or "")[:10],
594
+ "last_session": (last_ts or "")[:10],
595
+ "files_scanned": len(jsonl_files),
596
+ "note": (
597
+ "Claude Code usage data is limited without the /insights skill. "
598
+ "Counts reflect what is available in JSONL files."
599
+ ),
600
+ }
601
+
602
+
603
+ def _claude_markdown(stats: dict, days: int | None) -> str:
604
+ period = f"last {days} days" if days else "all time"
605
+ lines = [
606
+ f"# Claude Code Usage Insights ({period})",
607
+ "",
608
+ "## Stats",
609
+ "",
610
+ "| Metric | Value |",
611
+ "|--------|-------|",
612
+ f"| Sessions | {stats.get('total_sessions', 0):,} |",
613
+ f"| Messages | {stats.get('total_messages', 0):,} |",
614
+ f"| Tool Calls | {stats.get('total_tool_calls', 0):,} |",
615
+ f"| Date Range | {stats.get('first_session', 'N/A')} → {stats.get('last_session', 'N/A')} |",
616
+ f"| JSONL Files Scanned | {stats.get('files_scanned', 0)} |",
617
+ "",
618
+ f"> **Note:** {stats.get('note', '')}",
619
+ "",
620
+ ]
621
+ return "\n".join(lines)
622
+
623
+
624
+ def _claude_html(stats: dict, days: int | None) -> str:
625
+ period = f"last {days} days" if days else "all time"
626
+ generated_at = datetime.now().strftime("%Y-%m-%d %H:%M")
627
+
628
+ def _tr(*cols: str) -> str:
629
+ return "<tr>" + "".join(f"<td>{c}</td>" for c in cols) + "</tr>"
630
+
631
+ def _th(*cols: str) -> str:
632
+ return "<tr>" + "".join(f"<th>{c}</th>" for c in cols) + "</tr>"
633
+
634
+ rows = "".join(
635
+ [
636
+ _tr("Sessions", f"{stats.get('total_sessions', 0):,}"),
637
+ _tr("Messages", f"{stats.get('total_messages', 0):,}"),
638
+ _tr("Tool Calls", f"{stats.get('total_tool_calls', 0):,}"),
639
+ _tr(
640
+ "Date Range",
641
+ f"{stats.get('first_session', 'N/A')} &rarr; {stats.get('last_session', 'N/A')}",
642
+ ),
643
+ _tr("JSONL Files Scanned", str(stats.get("files_scanned", 0))),
644
+ ]
645
+ )
646
+
647
+ return f"""<!DOCTYPE html>
648
+ <html lang="en">
649
+ <head>
650
+ <meta charset="UTF-8">
651
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
652
+ <title>Claude Code Usage Insights</title>
653
+ <style>
654
+ :root {{
655
+ --bg: #0d1117; --surface: #161b22; --border: #30363d;
656
+ --text: #e6edf3; --muted: #8b949e; --accent: #58a6ff;
657
+ }}
658
+ * {{ box-sizing: border-box; margin: 0; padding: 0; }}
659
+ body {{ background: var(--bg); color: var(--text);
660
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
661
+ line-height: 1.6; padding: 2rem 1rem; }}
662
+ .container {{ max-width: 860px; margin: 0 auto; }}
663
+ h1 {{ font-size: 1.8rem; margin-bottom: 0.25rem; }}
664
+ h2 {{ font-size: 1.2rem; color: var(--accent); margin: 2rem 0 1rem;
665
+ border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }}
666
+ .subtitle {{ color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }}
667
+ .note {{ background: #1c2128; border-left: 3px solid var(--accent);
668
+ padding: 0.75rem 1rem; margin-top: 1rem; color: var(--muted);
669
+ font-size: 0.88rem; border-radius: 0 4px 4px 0; }}
670
+ table {{ width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }}
671
+ th {{ text-align: left; padding: 0.5rem 0.75rem; color: var(--muted);
672
+ font-size: 0.85rem; border-bottom: 1px solid var(--border); }}
673
+ td {{ padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }}
674
+ </style>
675
+ </head>
676
+ <body>
677
+ <div class="container">
678
+ <h1>Claude Code Usage Insights</h1>
679
+ <p class="subtitle">Period: {period} &mdash; Generated {generated_at}</p>
680
+
681
+ <h2>Stats</h2>
682
+ <table><thead>{_th("Metric", "Value")}</thead><tbody>{rows}</tbody></table>
683
+
684
+ <div class="note">{stats.get("note", "")}</div>
685
+ </div>
686
+ </body>
687
+ </html>"""
688
+
689
+
690
+ def _sub_claude(argv: list[str]) -> int:
691
+ import argparse
692
+
693
+ p = argparse.ArgumentParser(prog="agent-toolkit insights claude", add_help=True)
694
+ p.add_argument("--days", type=int, default=None, help="Limit to last N days")
695
+ p.add_argument("--output", metavar="PATH", help="Save HTML report to PATH")
696
+ args = p.parse_args(argv)
697
+
698
+ if not CLAUDE_USAGE.exists():
699
+ print(f"Claude usage data not found: {CLAUDE_USAGE}", file=sys.stderr)
700
+ print("Limited data available without the /insights skill.", file=sys.stderr)
701
+ return 1
702
+
703
+ stats = _claude_stats(CLAUDE_USAGE, args.days)
704
+
705
+ if args.output:
706
+ html = _claude_html(stats, args.days)
707
+ out_path = Path(args.output)
708
+ out_path.write_text(html, encoding="utf-8")
709
+ print(f"HTML report saved to: {out_path}")
710
+ else:
711
+ print(_claude_markdown(stats, args.days))
712
+
713
+ return 0
714
+
715
+
716
+ # ── help ─────────────────────────────────────────────────────────────────────
717
+
718
+
719
+ def _sub_help(_argv: list[str]) -> int:
720
+ print(f"""
721
+ {_blue("agent-toolkit insights")} — AI tool usage insights
722
+
723
+ {_cyan("Usage:")}
724
+ agent-toolkit insights opencode [--days N] [--output PATH]
725
+ agent-toolkit insights cursor [--output PATH]
726
+ agent-toolkit insights claude [--days N] [--output PATH]
727
+
728
+ {_cyan("Subcommands:")}
729
+ opencode Analyse OpenCode sessions from ~/.local/share/opencode/opencode.db
730
+ cursor Analyse Cursor agent transcripts from ~/.cursor/projects/
731
+ claude Analyse Claude Code usage from ~/.claude/usage-data/ JSONL files
732
+
733
+ {_cyan("Options:")}
734
+ --days N Limit analysis to last N days (opencode, claude)
735
+ --output PATH Save HTML report to PATH (all subcommands)
736
+ Without --output: prints Markdown to stdout
737
+
738
+ {_cyan("Examples:")}
739
+ agent-toolkit insights opencode
740
+ agent-toolkit insights opencode --days 30
741
+ agent-toolkit insights opencode --output ~/opencode-report.html
742
+ agent-toolkit insights cursor --output ~/cursor-report.html
743
+ agent-toolkit insights claude --days 7
744
+ """)
745
+ return 0
746
+
747
+
748
+ # ── entry point ───────────────────────────────────────────────────────────────
749
+
750
+
751
+ def cmd_insights(argv: list[str]) -> int:
752
+ if not argv or argv[0] in ("-h", "--help", "help"):
753
+ return _sub_help([])
754
+
755
+ subcommand = argv[0]
756
+ rest = argv[1:]
757
+
758
+ dispatch = {
759
+ "opencode": _sub_opencode,
760
+ "cursor": _sub_cursor,
761
+ "claude": _sub_claude,
762
+ "help": _sub_help,
763
+ }
764
+
765
+ fn = dispatch.get(subcommand)
766
+ if fn is None:
767
+ print(f"Unknown subcommand: {subcommand}", file=sys.stderr)
768
+ print("Run 'agent-toolkit insights help' for usage.", file=sys.stderr)
769
+ return 1
770
+
771
+ return fn(rest)