compact-agent 1.1.0

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 (324) hide show
  1. package/README.md +394 -0
  2. package/bin/anycode.js +2 -0
  3. package/bin/crowcoder.js +19 -0
  4. package/bin/ecc-hooks.cjs +138 -0
  5. package/dist/agents.d.ts +17 -0
  6. package/dist/agents.js +1603 -0
  7. package/dist/agents.js.map +1 -0
  8. package/dist/api.d.ts +16 -0
  9. package/dist/api.js +115 -0
  10. package/dist/api.js.map +1 -0
  11. package/dist/autonomous-loops.d.ts +108 -0
  12. package/dist/autonomous-loops.js +526 -0
  13. package/dist/autonomous-loops.js.map +1 -0
  14. package/dist/codemaps.d.ts +53 -0
  15. package/dist/codemaps.js +325 -0
  16. package/dist/codemaps.js.map +1 -0
  17. package/dist/compaction.d.ts +30 -0
  18. package/dist/compaction.js +125 -0
  19. package/dist/compaction.js.map +1 -0
  20. package/dist/config.d.ts +5 -0
  21. package/dist/config.js +79 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/content-engine.d.ts +97 -0
  24. package/dist/content-engine.js +721 -0
  25. package/dist/content-engine.js.map +1 -0
  26. package/dist/cost-tracker.d.ts +49 -0
  27. package/dist/cost-tracker.js +150 -0
  28. package/dist/cost-tracker.js.map +1 -0
  29. package/dist/counter-button.d.ts +35 -0
  30. package/dist/counter-button.js +48 -0
  31. package/dist/counter-button.js.map +1 -0
  32. package/dist/counter.d.ts +21 -0
  33. package/dist/counter.js +31 -0
  34. package/dist/counter.js.map +1 -0
  35. package/dist/coverage.d.ts +23 -0
  36. package/dist/coverage.js +215 -0
  37. package/dist/coverage.js.map +1 -0
  38. package/dist/docs-sync.d.ts +23 -0
  39. package/dist/docs-sync.js +266 -0
  40. package/dist/docs-sync.js.map +1 -0
  41. package/dist/ecc.d.ts +41 -0
  42. package/dist/ecc.js +644 -0
  43. package/dist/ecc.js.map +1 -0
  44. package/dist/evaluation.d.ts +24 -0
  45. package/dist/evaluation.js +412 -0
  46. package/dist/evaluation.js.map +1 -0
  47. package/dist/export.d.ts +22 -0
  48. package/dist/export.js +109 -0
  49. package/dist/export.js.map +1 -0
  50. package/dist/git-workflow.d.ts +22 -0
  51. package/dist/git-workflow.js +197 -0
  52. package/dist/git-workflow.js.map +1 -0
  53. package/dist/hook-controls.d.ts +34 -0
  54. package/dist/hook-controls.js +90 -0
  55. package/dist/hook-controls.js.map +1 -0
  56. package/dist/hooks.d.ts +30 -0
  57. package/dist/hooks.js +130 -0
  58. package/dist/hooks.js.map +1 -0
  59. package/dist/html-parser.d.ts +18 -0
  60. package/dist/html-parser.js +101 -0
  61. package/dist/html-parser.js.map +1 -0
  62. package/dist/index.d.ts +12 -0
  63. package/dist/index.js +1230 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/learning.d.ts +35 -0
  66. package/dist/learning.js +238 -0
  67. package/dist/learning.js.map +1 -0
  68. package/dist/login.d.ts +37 -0
  69. package/dist/login.js +191 -0
  70. package/dist/login.js.map +1 -0
  71. package/dist/memory.d.ts +39 -0
  72. package/dist/memory.js +183 -0
  73. package/dist/memory.js.map +1 -0
  74. package/dist/model-router.d.ts +23 -0
  75. package/dist/model-router.js +145 -0
  76. package/dist/model-router.js.map +1 -0
  77. package/dist/modes.d.ts +17 -0
  78. package/dist/modes.js +217 -0
  79. package/dist/modes.js.map +1 -0
  80. package/dist/orchestration.d.ts +37 -0
  81. package/dist/orchestration.js +139 -0
  82. package/dist/orchestration.js.map +1 -0
  83. package/dist/package-detect.d.ts +36 -0
  84. package/dist/package-detect.js +529 -0
  85. package/dist/package-detect.js.map +1 -0
  86. package/dist/permissions.d.ts +25 -0
  87. package/dist/permissions.js +50 -0
  88. package/dist/permissions.js.map +1 -0
  89. package/dist/pm2-manager.d.ts +40 -0
  90. package/dist/pm2-manager.js +127 -0
  91. package/dist/pm2-manager.js.map +1 -0
  92. package/dist/query.d.ts +15 -0
  93. package/dist/query.js +278 -0
  94. package/dist/query.js.map +1 -0
  95. package/dist/refactor.d.ts +22 -0
  96. package/dist/refactor.js +226 -0
  97. package/dist/refactor.js.map +1 -0
  98. package/dist/retry.d.ts +20 -0
  99. package/dist/retry.js +88 -0
  100. package/dist/retry.js.map +1 -0
  101. package/dist/rules.d.ts +34 -0
  102. package/dist/rules.js +942 -0
  103. package/dist/rules.js.map +1 -0
  104. package/dist/schema.d.ts +23 -0
  105. package/dist/schema.js +12 -0
  106. package/dist/schema.js.map +1 -0
  107. package/dist/search-first.d.ts +17 -0
  108. package/dist/search-first.js +301 -0
  109. package/dist/search-first.js.map +1 -0
  110. package/dist/security.d.ts +10 -0
  111. package/dist/security.js +145 -0
  112. package/dist/security.js.map +1 -0
  113. package/dist/sessions.d.ts +21 -0
  114. package/dist/sessions.js +112 -0
  115. package/dist/sessions.js.map +1 -0
  116. package/dist/skill-create.d.ts +38 -0
  117. package/dist/skill-create.js +389 -0
  118. package/dist/skill-create.js.map +1 -0
  119. package/dist/skills.d.ts +34 -0
  120. package/dist/skills.js +161 -0
  121. package/dist/skills.js.map +1 -0
  122. package/dist/strategic-compaction.d.ts +24 -0
  123. package/dist/strategic-compaction.js +144 -0
  124. package/dist/strategic-compaction.js.map +1 -0
  125. package/dist/system-prompt.d.ts +3 -0
  126. package/dist/system-prompt.js +101 -0
  127. package/dist/system-prompt.js.map +1 -0
  128. package/dist/theme.d.ts +60 -0
  129. package/dist/theme.js +220 -0
  130. package/dist/theme.js.map +1 -0
  131. package/dist/tools/bash.d.ts +2 -0
  132. package/dist/tools/bash.js +49 -0
  133. package/dist/tools/bash.js.map +1 -0
  134. package/dist/tools/edit.d.ts +2 -0
  135. package/dist/tools/edit.js +76 -0
  136. package/dist/tools/edit.js.map +1 -0
  137. package/dist/tools/glob.d.ts +2 -0
  138. package/dist/tools/glob.js +54 -0
  139. package/dist/tools/glob.js.map +1 -0
  140. package/dist/tools/grep.d.ts +2 -0
  141. package/dist/tools/grep.js +64 -0
  142. package/dist/tools/grep.js.map +1 -0
  143. package/dist/tools/index.d.ts +5 -0
  144. package/dist/tools/index.js +27 -0
  145. package/dist/tools/index.js.map +1 -0
  146. package/dist/tools/list-dir.d.ts +2 -0
  147. package/dist/tools/list-dir.js +51 -0
  148. package/dist/tools/list-dir.js.map +1 -0
  149. package/dist/tools/read.d.ts +2 -0
  150. package/dist/tools/read.js +56 -0
  151. package/dist/tools/read.js.map +1 -0
  152. package/dist/tools/types.d.ts +45 -0
  153. package/dist/tools/types.js +2 -0
  154. package/dist/tools/types.js.map +1 -0
  155. package/dist/tools/web-fetch.d.ts +2 -0
  156. package/dist/tools/web-fetch.js +41 -0
  157. package/dist/tools/web-fetch.js.map +1 -0
  158. package/dist/tools/web-search.d.ts +27 -0
  159. package/dist/tools/web-search.js +139 -0
  160. package/dist/tools/web-search.js.map +1 -0
  161. package/dist/tools/write.d.ts +2 -0
  162. package/dist/tools/write.js +36 -0
  163. package/dist/tools/write.js.map +1 -0
  164. package/dist/types.d.ts +28 -0
  165. package/dist/types.js +57 -0
  166. package/dist/types.js.map +1 -0
  167. package/dist/users.d.ts +51 -0
  168. package/dist/users.js +193 -0
  169. package/dist/users.js.map +1 -0
  170. package/dist/verification.d.ts +73 -0
  171. package/dist/verification.js +269 -0
  172. package/dist/verification.js.map +1 -0
  173. package/dist/walkthrough.d.ts +10 -0
  174. package/dist/walkthrough.js +121 -0
  175. package/dist/walkthrough.js.map +1 -0
  176. package/package.json +58 -0
  177. package/resources/ecc/agents/architect.json +16 -0
  178. package/resources/ecc/agents/architect.md +212 -0
  179. package/resources/ecc/agents/build-error-resolver.json +17 -0
  180. package/resources/ecc/agents/build-error-resolver.md +116 -0
  181. package/resources/ecc/agents/chief-of-staff.json +17 -0
  182. package/resources/ecc/agents/chief-of-staff.md +153 -0
  183. package/resources/ecc/agents/code-reviewer.json +16 -0
  184. package/resources/ecc/agents/code-reviewer.md +238 -0
  185. package/resources/ecc/agents/database-reviewer.json +16 -0
  186. package/resources/ecc/agents/database-reviewer.md +92 -0
  187. package/resources/ecc/agents/doc-updater.json +16 -0
  188. package/resources/ecc/agents/doc-updater.md +108 -0
  189. package/resources/ecc/agents/e2e-runner.json +17 -0
  190. package/resources/ecc/agents/e2e-runner.md +109 -0
  191. package/resources/ecc/agents/go-build-resolver.json +17 -0
  192. package/resources/ecc/agents/go-build-resolver.md +96 -0
  193. package/resources/ecc/agents/go-reviewer.json +16 -0
  194. package/resources/ecc/agents/go-reviewer.md +77 -0
  195. package/resources/ecc/agents/harness-optimizer.json +15 -0
  196. package/resources/ecc/agents/harness-optimizer.md +34 -0
  197. package/resources/ecc/agents/loop-operator.json +16 -0
  198. package/resources/ecc/agents/loop-operator.md +36 -0
  199. package/resources/ecc/agents/planner.json +15 -0
  200. package/resources/ecc/agents/planner.md +212 -0
  201. package/resources/ecc/agents/python-reviewer.json +16 -0
  202. package/resources/ecc/agents/python-reviewer.md +99 -0
  203. package/resources/ecc/agents/refactor-cleaner.json +17 -0
  204. package/resources/ecc/agents/refactor-cleaner.md +87 -0
  205. package/resources/ecc/agents/security-reviewer.json +16 -0
  206. package/resources/ecc/agents/security-reviewer.md +109 -0
  207. package/resources/ecc/agents/tdd-guide.json +17 -0
  208. package/resources/ecc/agents/tdd-guide.md +93 -0
  209. package/resources/ecc/commands/add-language-rules.md +39 -0
  210. package/resources/ecc/commands/database-migration.md +36 -0
  211. package/resources/ecc/commands/feature-development.md +38 -0
  212. package/resources/ecc/prompts/build-fix.prompt.md +47 -0
  213. package/resources/ecc/prompts/code-review.prompt.md +56 -0
  214. package/resources/ecc/prompts/plan.prompt.md +52 -0
  215. package/resources/ecc/prompts/refactor.prompt.md +50 -0
  216. package/resources/ecc/prompts/security-review.prompt.md +70 -0
  217. package/resources/ecc/prompts/tdd.prompt.md +47 -0
  218. package/resources/ecc/rules/common-agents.md +53 -0
  219. package/resources/ecc/rules/common-coding-style.md +52 -0
  220. package/resources/ecc/rules/common-development-workflow.md +33 -0
  221. package/resources/ecc/rules/common-git-workflow.md +28 -0
  222. package/resources/ecc/rules/common-hooks.md +34 -0
  223. package/resources/ecc/rules/common-patterns.md +35 -0
  224. package/resources/ecc/rules/common-performance.md +59 -0
  225. package/resources/ecc/rules/common-security.md +33 -0
  226. package/resources/ecc/rules/common-testing.md +33 -0
  227. package/resources/ecc/rules/golang-coding-style.md +31 -0
  228. package/resources/ecc/rules/golang-hooks.md +16 -0
  229. package/resources/ecc/rules/golang-patterns.md +44 -0
  230. package/resources/ecc/rules/golang-security.md +33 -0
  231. package/resources/ecc/rules/golang-testing.md +30 -0
  232. package/resources/ecc/rules/kotlin-coding-style.md +39 -0
  233. package/resources/ecc/rules/kotlin-hooks.md +16 -0
  234. package/resources/ecc/rules/kotlin-patterns.md +50 -0
  235. package/resources/ecc/rules/kotlin-security.md +58 -0
  236. package/resources/ecc/rules/kotlin-testing.md +38 -0
  237. package/resources/ecc/rules/php-coding-style.md +25 -0
  238. package/resources/ecc/rules/php-hooks.md +21 -0
  239. package/resources/ecc/rules/php-patterns.md +23 -0
  240. package/resources/ecc/rules/php-security.md +24 -0
  241. package/resources/ecc/rules/php-testing.md +26 -0
  242. package/resources/ecc/rules/python-coding-style.md +42 -0
  243. package/resources/ecc/rules/python-hooks.md +19 -0
  244. package/resources/ecc/rules/python-patterns.md +39 -0
  245. package/resources/ecc/rules/python-security.md +30 -0
  246. package/resources/ecc/rules/python-testing.md +38 -0
  247. package/resources/ecc/rules/swift-coding-style.md +47 -0
  248. package/resources/ecc/rules/swift-hooks.md +20 -0
  249. package/resources/ecc/rules/swift-patterns.md +66 -0
  250. package/resources/ecc/rules/swift-security.md +33 -0
  251. package/resources/ecc/rules/swift-testing.md +45 -0
  252. package/resources/ecc/rules/typescript-coding-style.md +63 -0
  253. package/resources/ecc/rules/typescript-hooks.md +20 -0
  254. package/resources/ecc/rules/typescript-patterns.md +50 -0
  255. package/resources/ecc/rules/typescript-security.md +26 -0
  256. package/resources/ecc/rules/typescript-testing.md +16 -0
  257. package/resources/ecc/skills/agent-introspection-debugging/SKILL.md +152 -0
  258. package/resources/ecc/skills/agent-introspection-debugging/agents/openai.yaml +7 -0
  259. package/resources/ecc/skills/agent-sort/SKILL.md +214 -0
  260. package/resources/ecc/skills/agent-sort/agents/openai.yaml +7 -0
  261. package/resources/ecc/skills/api-design/SKILL.md +522 -0
  262. package/resources/ecc/skills/api-design/agents/openai.yaml +7 -0
  263. package/resources/ecc/skills/article-writing/SKILL.md +78 -0
  264. package/resources/ecc/skills/article-writing/agents/openai.yaml +7 -0
  265. package/resources/ecc/skills/backend-patterns/SKILL.md +597 -0
  266. package/resources/ecc/skills/backend-patterns/agents/openai.yaml +7 -0
  267. package/resources/ecc/skills/brand-voice/SKILL.md +96 -0
  268. package/resources/ecc/skills/brand-voice/agents/openai.yaml +7 -0
  269. package/resources/ecc/skills/brand-voice/references/voice-profile-schema.md +55 -0
  270. package/resources/ecc/skills/bun-runtime/SKILL.md +83 -0
  271. package/resources/ecc/skills/bun-runtime/agents/openai.yaml +7 -0
  272. package/resources/ecc/skills/coding-standards/SKILL.md +548 -0
  273. package/resources/ecc/skills/coding-standards/agents/openai.yaml +7 -0
  274. package/resources/ecc/skills/content-engine/SKILL.md +130 -0
  275. package/resources/ecc/skills/content-engine/agents/openai.yaml +7 -0
  276. package/resources/ecc/skills/crosspost/SKILL.md +110 -0
  277. package/resources/ecc/skills/crosspost/agents/openai.yaml +7 -0
  278. package/resources/ecc/skills/deep-research/SKILL.md +154 -0
  279. package/resources/ecc/skills/deep-research/agents/openai.yaml +7 -0
  280. package/resources/ecc/skills/dmux-workflows/SKILL.md +143 -0
  281. package/resources/ecc/skills/dmux-workflows/agents/openai.yaml +7 -0
  282. package/resources/ecc/skills/documentation-lookup/SKILL.md +89 -0
  283. package/resources/ecc/skills/documentation-lookup/agents/openai.yaml +7 -0
  284. package/resources/ecc/skills/e2e-testing/SKILL.md +325 -0
  285. package/resources/ecc/skills/e2e-testing/agents/openai.yaml +7 -0
  286. package/resources/ecc/skills/eval-harness/SKILL.md +235 -0
  287. package/resources/ecc/skills/eval-harness/agents/openai.yaml +7 -0
  288. package/resources/ecc/skills/everything-claude-code/SKILL.md +442 -0
  289. package/resources/ecc/skills/everything-claude-code/agents/openai.yaml +7 -0
  290. package/resources/ecc/skills/exa-search/SKILL.md +169 -0
  291. package/resources/ecc/skills/exa-search/agents/openai.yaml +7 -0
  292. package/resources/ecc/skills/fal-ai-media/SKILL.md +276 -0
  293. package/resources/ecc/skills/fal-ai-media/agents/openai.yaml +7 -0
  294. package/resources/ecc/skills/frontend-patterns/SKILL.md +647 -0
  295. package/resources/ecc/skills/frontend-patterns/agents/openai.yaml +7 -0
  296. package/resources/ecc/skills/frontend-slides/SKILL.md +183 -0
  297. package/resources/ecc/skills/frontend-slides/STYLE_PRESETS.md +330 -0
  298. package/resources/ecc/skills/frontend-slides/agents/openai.yaml +7 -0
  299. package/resources/ecc/skills/investor-materials/SKILL.md +95 -0
  300. package/resources/ecc/skills/investor-materials/agents/openai.yaml +7 -0
  301. package/resources/ecc/skills/investor-outreach/SKILL.md +90 -0
  302. package/resources/ecc/skills/investor-outreach/agents/openai.yaml +7 -0
  303. package/resources/ecc/skills/market-research/SKILL.md +74 -0
  304. package/resources/ecc/skills/market-research/agents/openai.yaml +7 -0
  305. package/resources/ecc/skills/mcp-server-patterns/SKILL.md +66 -0
  306. package/resources/ecc/skills/mcp-server-patterns/agents/openai.yaml +7 -0
  307. package/resources/ecc/skills/mle-workflow/SKILL.md +346 -0
  308. package/resources/ecc/skills/mle-workflow/agents/openai.yaml +7 -0
  309. package/resources/ecc/skills/nextjs-turbopack/SKILL.md +43 -0
  310. package/resources/ecc/skills/nextjs-turbopack/agents/openai.yaml +7 -0
  311. package/resources/ecc/skills/product-capability/SKILL.md +140 -0
  312. package/resources/ecc/skills/product-capability/agents/openai.yaml +7 -0
  313. package/resources/ecc/skills/security-review/SKILL.md +494 -0
  314. package/resources/ecc/skills/security-review/agents/openai.yaml +7 -0
  315. package/resources/ecc/skills/strategic-compact/SKILL.md +102 -0
  316. package/resources/ecc/skills/strategic-compact/agents/openai.yaml +7 -0
  317. package/resources/ecc/skills/tdd-workflow/SKILL.md +409 -0
  318. package/resources/ecc/skills/tdd-workflow/agents/openai.yaml +7 -0
  319. package/resources/ecc/skills/verification-loop/SKILL.md +125 -0
  320. package/resources/ecc/skills/verification-loop/agents/openai.yaml +7 -0
  321. package/resources/ecc/skills/video-editing/SKILL.md +307 -0
  322. package/resources/ecc/skills/video-editing/agents/openai.yaml +7 -0
  323. package/resources/ecc/skills/x-api/SKILL.md +229 -0
  324. package/resources/ecc/skills/x-api/agents/openai.yaml +7 -0
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: agent-introspection-debugging
3
+ description: Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
4
+ ---
5
+
6
+ # Agent Introspection Debugging
7
+
8
+ Use this skill when an agent run is failing repeatedly, consuming tokens without progress, looping on the same tools, or drifting away from the intended task.
9
+
10
+ This is a workflow skill, not a hidden runtime. It teaches the agent to debug itself systematically before escalating to a human.
11
+
12
+ ## When to Activate
13
+
14
+ - Maximum tool call / loop-limit failures
15
+ - Repeated retries with no forward progress
16
+ - Context growth or prompt drift that starts degrading output quality
17
+ - File-system or environment state mismatch between expectation and reality
18
+ - Tool failures that are likely recoverable with diagnosis and a smaller corrective action
19
+
20
+ ## Scope Boundaries
21
+
22
+ Activate this skill for:
23
+ - capturing failure state before retrying blindly
24
+ - diagnosing common agent-specific failure patterns
25
+ - applying contained recovery actions
26
+ - producing a structured human-readable debug report
27
+
28
+ Do not use this skill as the primary source for:
29
+ - feature verification after code changes; use `verification-loop`
30
+ - framework-specific debugging when a narrower ECC skill already exists
31
+ - runtime promises the current harness cannot enforce automatically
32
+
33
+ ## Four-Phase Loop
34
+
35
+ ### Phase 1: Failure Capture
36
+
37
+ Before trying to recover, record the failure precisely.
38
+
39
+ Capture:
40
+ - error type, message, and stack trace when available
41
+ - last meaningful tool call sequence
42
+ - what the agent was trying to do
43
+ - current context pressure: repeated prompts, oversized pasted logs, duplicated plans, or runaway notes
44
+ - current environment assumptions: cwd, branch, relevant service state, expected files
45
+
46
+ Minimum capture template:
47
+
48
+ ```markdown
49
+ ## Failure Capture
50
+ - Session / task:
51
+ - Goal in progress:
52
+ - Error:
53
+ - Last successful step:
54
+ - Last failed tool / command:
55
+ - Repeated pattern seen:
56
+ - Environment assumptions to verify:
57
+ ```
58
+
59
+ ### Phase 2: Root-Cause Diagnosis
60
+
61
+ Match the failure to a known pattern before changing anything.
62
+
63
+ | Pattern | Likely Cause | Check |
64
+ | --- | --- | --- |
65
+ | Maximum tool calls / repeated same command | loop or no-exit observer path | inspect the last N tool calls for repetition |
66
+ | Context overflow / degraded reasoning | unbounded notes, repeated plans, oversized logs | inspect recent context for duplication and low-signal bulk |
67
+ | `ECONNREFUSED` / timeout | service unavailable or wrong port | verify service health, URL, and port assumptions |
68
+ | `429` / quota exhaustion | retry storm or missing backoff | count repeated calls and inspect retry spacing |
69
+ | file missing after write / stale diff | race, wrong cwd, or branch drift | re-check path, cwd, git status, and actual file existence |
70
+ | tests still failing after “fix” | wrong hypothesis | isolate the exact failing test and re-derive the bug |
71
+
72
+ Diagnosis questions:
73
+ - is this a logic failure, state failure, environment failure, or policy failure?
74
+ - did the agent lose the real objective and start optimizing the wrong subtask?
75
+ - is the failure deterministic or transient?
76
+ - what is the smallest reversible action that would validate the diagnosis?
77
+
78
+ ### Phase 3: Contained Recovery
79
+
80
+ Recover with the smallest action that changes the diagnosis surface.
81
+
82
+ Safe recovery actions:
83
+ - stop repeated retries and restate the hypothesis
84
+ - trim low-signal context and keep only the active goal, blockers, and evidence
85
+ - re-check the actual filesystem / branch / process state
86
+ - narrow the task to one failing command, one file, or one test
87
+ - switch from speculative reasoning to direct observation
88
+ - escalate to a human when the failure is high-risk or externally blocked
89
+
90
+ Do not claim unsupported auto-healing actions like “reset agent state” or “update harness config” unless you are actually doing them through real tools in the current environment.
91
+
92
+ Contained recovery checklist:
93
+
94
+ ```markdown
95
+ ## Recovery Action
96
+ - Diagnosis chosen:
97
+ - Smallest action taken:
98
+ - Why this is safe:
99
+ - What evidence would prove the fix worked:
100
+ ```
101
+
102
+ ### Phase 4: Introspection Report
103
+
104
+ End with a report that makes the recovery legible to the next agent or human.
105
+
106
+ ```markdown
107
+ ## Agent Self-Debug Report
108
+ - Session / task:
109
+ - Failure:
110
+ - Root cause:
111
+ - Recovery action:
112
+ - Result: success | partial | blocked
113
+ - Token / time burn risk:
114
+ - Follow-up needed:
115
+ - Preventive change to encode later:
116
+ ```
117
+
118
+ ## Recovery Heuristics
119
+
120
+ Prefer these interventions in order:
121
+
122
+ 1. Restate the real objective in one sentence.
123
+ 2. Verify the world state instead of trusting memory.
124
+ 3. Shrink the failing scope.
125
+ 4. Run one discriminating check.
126
+ 5. Only then retry.
127
+
128
+ Bad pattern:
129
+ - retrying the same action three times with slightly different wording
130
+
131
+ Good pattern:
132
+ - capture failure
133
+ - classify the pattern
134
+ - run one direct check
135
+ - change the plan only if the check supports it
136
+
137
+ ## Integration with ECC
138
+
139
+ - Use `verification-loop` after recovery if code was changed.
140
+ - Use `continuous-learning-v2` when the failure pattern is worth turning into an instinct or later skill.
141
+ - Use `council` when the issue is not technical failure but decision ambiguity.
142
+ - Use `workspace-surface-audit` if the failure came from conflicting local state or repo drift.
143
+
144
+ ## Output Standard
145
+
146
+ When this skill is active, do not end with “I fixed it” alone.
147
+
148
+ Always provide:
149
+ - the failure pattern
150
+ - the root-cause hypothesis
151
+ - the recovery action
152
+ - the evidence that the situation is now better or still blocked
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Agent Introspection Debugging"
3
+ short_description: "Structured self-debugging for AI agent failures"
4
+ brand_color: "#0EA5E9"
5
+ default_prompt: "Use $agent-introspection-debugging to diagnose and recover from an AI agent failure."
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: agent-sort
3
+ description: Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.
4
+ ---
5
+
6
+ # Agent Sort
7
+
8
+ Use this skill when a repo needs a project-specific ECC surface instead of the default full install.
9
+
10
+ The goal is not to guess what "feels useful." The goal is to classify ECC components with evidence from the actual codebase.
11
+
12
+ ## When to Use
13
+
14
+ - A project only needs a subset of ECC and full installs are too noisy
15
+ - The repo stack is clear, but nobody wants to hand-curate skills one by one
16
+ - A team wants a repeatable install decision backed by grep evidence instead of opinion
17
+ - You need to separate always-loaded daily workflow surfaces from searchable library/reference surfaces
18
+ - A repo has drifted into the wrong language, rule, or hook set and needs cleanup
19
+
20
+ ## Non-Negotiable Rules
21
+
22
+ - Use the current repository as the source of truth, not generic preferences
23
+ - Every DAILY decision must cite concrete repo evidence
24
+ - LIBRARY does not mean "delete"; it means "keep accessible without loading by default"
25
+ - Do not install hooks, rules, or scripts that the current repo cannot use
26
+ - Prefer ECC-native surfaces; do not introduce a second install system
27
+
28
+ ## Outputs
29
+
30
+ Produce these artifacts in order:
31
+
32
+ 1. DAILY inventory
33
+ 2. LIBRARY inventory
34
+ 3. install plan
35
+ 4. verification report
36
+ 5. optional `skill-library` router if the project wants one
37
+
38
+ ## Classification Model
39
+
40
+ Use two buckets only:
41
+
42
+ - `DAILY`
43
+ - should load every session for this repo
44
+ - strongly matched to the repo's language, framework, workflow, or operator surface
45
+ - `LIBRARY`
46
+ - useful to retain, but not worth loading by default
47
+ - should remain reachable through search, router skill, or selective manual use
48
+
49
+ ## Evidence Sources
50
+
51
+ Use repo-local evidence before making any classification:
52
+
53
+ - file extensions
54
+ - package managers and lockfiles
55
+ - framework configs
56
+ - CI and hook configs
57
+ - build/test scripts
58
+ - imports and dependency manifests
59
+ - repo docs that explicitly describe the stack
60
+
61
+ Useful commands include:
62
+
63
+ ```bash
64
+ rg --files
65
+ rg -n "typescript|react|next|supabase|django|spring|flutter|swift"
66
+ cat package.json
67
+ cat pyproject.toml
68
+ cat Cargo.toml
69
+ cat pubspec.yaml
70
+ cat go.mod
71
+ ```
72
+
73
+ ## Parallel Review Passes
74
+
75
+ If parallel subagents are available, split the review into these passes:
76
+
77
+ 1. Agents
78
+ - classify `agents/*`
79
+ 2. Skills
80
+ - classify `skills/*`
81
+ 3. Commands
82
+ - classify `commands/*`
83
+ 4. Rules
84
+ - classify `rules/*`
85
+ 5. Hooks and scripts
86
+ - classify hook surfaces, MCP health checks, helper scripts, and OS compatibility
87
+ 6. Extras
88
+ - classify contexts, examples, MCP configs, templates, and guidance docs
89
+
90
+ If subagents are not available, run the same passes sequentially.
91
+
92
+ ## Core Workflow
93
+
94
+ ### 1. Read the repo
95
+
96
+ Establish the real stack before classifying anything:
97
+
98
+ - languages in use
99
+ - frameworks in use
100
+ - primary package manager
101
+ - test stack
102
+ - lint/format stack
103
+ - deployment/runtime surface
104
+ - operator integrations already present
105
+
106
+ ### 2. Build the evidence table
107
+
108
+ For every candidate surface, record:
109
+
110
+ - component path
111
+ - component type
112
+ - proposed bucket
113
+ - repo evidence
114
+ - short justification
115
+
116
+ Use this format:
117
+
118
+ ```text
119
+ skills/frontend-patterns | skill | DAILY | 84 .tsx files, next.config.ts present | core frontend stack
120
+ skills/django-patterns | skill | LIBRARY | no .py files, no pyproject.toml | not active in this repo
121
+ rules/typescript/* | rules | DAILY | package.json + tsconfig.json | active TS repo
122
+ rules/python/* | rules | LIBRARY | zero Python source files | keep accessible only
123
+ ```
124
+
125
+ ### 3. Decide DAILY vs LIBRARY
126
+
127
+ Promote to `DAILY` when:
128
+
129
+ - the repo clearly uses the matching stack
130
+ - the component is general enough to help every session
131
+ - the repo already depends on the corresponding runtime or workflow
132
+
133
+ Demote to `LIBRARY` when:
134
+
135
+ - the component is off-stack
136
+ - the repo might need it later, but not every day
137
+ - it adds context overhead without immediate relevance
138
+
139
+ ### 4. Build the install plan
140
+
141
+ Translate the classification into action:
142
+
143
+ - DAILY skills -> install or keep in `.claude/skills/`
144
+ - DAILY commands -> keep as explicit shims only if still useful
145
+ - DAILY rules -> install only matching language sets
146
+ - DAILY hooks/scripts -> keep only compatible ones
147
+ - LIBRARY surfaces -> keep accessible through search or `skill-library`
148
+
149
+ If the repo already uses selective installs, update that plan instead of creating another system.
150
+
151
+ ### 5. Create the optional library router
152
+
153
+ If the project wants a searchable library surface, create:
154
+
155
+ - `.claude/skills/skill-library/SKILL.md`
156
+
157
+ That router should contain:
158
+
159
+ - a short explanation of DAILY vs LIBRARY
160
+ - grouped trigger keywords
161
+ - where the library references live
162
+
163
+ Do not duplicate every skill body inside the router.
164
+
165
+ ### 6. Verify the result
166
+
167
+ After the plan is applied, verify:
168
+
169
+ - every DAILY file exists where expected
170
+ - stale language rules were not left active
171
+ - incompatible hooks were not installed
172
+ - the resulting install actually matches the repo stack
173
+
174
+ Return a compact report with:
175
+
176
+ - DAILY count
177
+ - LIBRARY count
178
+ - removed stale surfaces
179
+ - open questions
180
+
181
+ ## Handoffs
182
+
183
+ If the next step is interactive installation or repair, hand off to:
184
+
185
+ - `configure-ecc`
186
+
187
+ If the next step is overlap cleanup or catalog review, hand off to:
188
+
189
+ - `skill-stocktake`
190
+
191
+ If the next step is broader context trimming, hand off to:
192
+
193
+ - `strategic-compact`
194
+
195
+ ## Output Format
196
+
197
+ Return the result in this order:
198
+
199
+ ```text
200
+ STACK
201
+ - language/framework/runtime summary
202
+
203
+ DAILY
204
+ - always-loaded items with evidence
205
+
206
+ LIBRARY
207
+ - searchable/reference items with evidence
208
+
209
+ INSTALL PLAN
210
+ - what should be installed, removed, or routed
211
+
212
+ VERIFICATION
213
+ - checks run and remaining gaps
214
+ ```
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Agent Sort"
3
+ short_description: "Evidence-backed ECC install planning"
4
+ brand_color: "#0EA5E9"
5
+ default_prompt: "Use $agent-sort to build an evidence-backed ECC install plan."
6
+ policy:
7
+ allow_implicit_invocation: true