octocode-cli 1.2.6 → 1.2.7

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 (303) hide show
  1. package/LICENSE +21 -63
  2. package/README.md +85 -142
  3. package/out/octocode-cli.js +7026 -6945
  4. package/package.json +8 -6
  5. package/skills/README.md +97 -120
  6. package/skills/octocode-code-engineer/.claude/settings.local.json +18 -0
  7. package/skills/octocode-code-engineer/.octocode/rfc/RFC-code-engineer-weakness-fixes.md +255 -0
  8. package/skills/octocode-code-engineer/.plan/VALIDATED_PLAN.md +223 -0
  9. package/skills/octocode-code-engineer/README.md +178 -0
  10. package/skills/octocode-code-engineer/SKILL.md +418 -0
  11. package/skills/octocode-code-engineer/coverage/architecture.ts.html +7828 -0
  12. package/skills/octocode-code-engineer/coverage/ast-helpers.ts.html +211 -0
  13. package/skills/octocode-code-engineer/coverage/ast-search.ts.html +1795 -0
  14. package/skills/octocode-code-engineer/coverage/base.css +224 -0
  15. package/skills/octocode-code-engineer/coverage/block-navigation.js +87 -0
  16. package/skills/octocode-code-engineer/coverage/cache.ts.html +376 -0
  17. package/skills/octocode-code-engineer/coverage/cli.ts.html +982 -0
  18. package/skills/octocode-code-engineer/coverage/clover.xml +3217 -0
  19. package/skills/octocode-code-engineer/coverage/collect-effects.ts.html +664 -0
  20. package/skills/octocode-code-engineer/coverage/collect-input-sources.ts.html +577 -0
  21. package/skills/octocode-code-engineer/coverage/collect-performance.ts.html +331 -0
  22. package/skills/octocode-code-engineer/coverage/collect-prototype-pollution.ts.html +421 -0
  23. package/skills/octocode-code-engineer/coverage/collect-security.ts.html +604 -0
  24. package/skills/octocode-code-engineer/coverage/collect-test-profile.ts.html +589 -0
  25. package/skills/octocode-code-engineer/coverage/coverage-final.json +30 -0
  26. package/skills/octocode-code-engineer/coverage/dependencies.ts.html +997 -0
  27. package/skills/octocode-code-engineer/coverage/dependency-summary.ts.html +688 -0
  28. package/skills/octocode-code-engineer/coverage/discovery.ts.html +322 -0
  29. package/skills/octocode-code-engineer/coverage/favicon.png +0 -0
  30. package/skills/octocode-code-engineer/coverage/graph-analytics.ts.html +1510 -0
  31. package/skills/octocode-code-engineer/coverage/index.html +536 -0
  32. package/skills/octocode-code-engineer/coverage/index.ts.html +826 -0
  33. package/skills/octocode-code-engineer/coverage/metrics.ts.html +553 -0
  34. package/skills/octocode-code-engineer/coverage/pipeline.ts.html +2044 -0
  35. package/skills/octocode-code-engineer/coverage/prettify.css +1 -0
  36. package/skills/octocode-code-engineer/coverage/prettify.js +2 -0
  37. package/skills/octocode-code-engineer/coverage/report-analysis.ts.html +1570 -0
  38. package/skills/octocode-code-engineer/coverage/report-writer.ts.html +1102 -0
  39. package/skills/octocode-code-engineer/coverage/security-detectors.ts.html +1747 -0
  40. package/skills/octocode-code-engineer/coverage/semantic-detectors.ts.html +2152 -0
  41. package/skills/octocode-code-engineer/coverage/semantic.ts.html +1897 -0
  42. package/skills/octocode-code-engineer/coverage/sort-arrow-sprite.png +0 -0
  43. package/skills/octocode-code-engineer/coverage/sorter.js +210 -0
  44. package/skills/octocode-code-engineer/coverage/summary-md.ts.html +1222 -0
  45. package/skills/octocode-code-engineer/coverage/test-quality-detectors.ts.html +1039 -0
  46. package/skills/octocode-code-engineer/coverage/tree-sitter-analyzer.ts.html +955 -0
  47. package/skills/octocode-code-engineer/coverage/ts-analyzer.ts.html +1213 -0
  48. package/skills/octocode-code-engineer/coverage/types.ts.html +2473 -0
  49. package/skills/octocode-code-engineer/coverage/utils.ts.html +820 -0
  50. package/skills/octocode-code-engineer/eslint.config.mjs +54 -0
  51. package/skills/octocode-code-engineer/minify-scripts.mjs +32 -0
  52. package/skills/octocode-code-engineer/package.json +54 -0
  53. package/skills/octocode-code-engineer/references/agent-ast-reading-rfc.md +95 -0
  54. package/skills/octocode-code-engineer/references/architecture-techniques.md +121 -0
  55. package/skills/octocode-code-engineer/references/ast-search.md +210 -0
  56. package/skills/octocode-code-engineer/references/ast-tree-search.md +151 -0
  57. package/skills/octocode-code-engineer/references/cli-reference.md +167 -0
  58. package/skills/octocode-code-engineer/references/concepts.md +107 -0
  59. package/skills/octocode-code-engineer/references/finding-categories.md +128 -0
  60. package/skills/octocode-code-engineer/references/improvement-roadmap.md +304 -0
  61. package/skills/octocode-code-engineer/references/output-files.md +144 -0
  62. package/skills/octocode-code-engineer/references/playbooks.md +204 -0
  63. package/skills/octocode-code-engineer/references/present-results.md +136 -0
  64. package/skills/octocode-code-engineer/references/tool-workflows.md +566 -0
  65. package/skills/octocode-code-engineer/references/validate-investigate.md +225 -0
  66. package/skills/octocode-code-engineer/scripts/analysis/dependencies.js +1 -0
  67. package/skills/octocode-code-engineer/scripts/analysis/dependency-summary.js +1 -0
  68. package/skills/octocode-code-engineer/scripts/analysis/discovery.js +1 -0
  69. package/skills/octocode-code-engineer/scripts/analysis/graph-analytics.js +1 -0
  70. package/skills/octocode-code-engineer/scripts/analysis/semantic.js +1 -0
  71. package/skills/octocode-code-engineer/scripts/ast/helpers.js +1 -0
  72. package/skills/octocode-code-engineer/scripts/ast/metrics.js +1 -0
  73. package/skills/octocode-code-engineer/scripts/ast/search.js +2 -0
  74. package/skills/octocode-code-engineer/scripts/ast/tree-search.js +2 -0
  75. package/skills/octocode-code-engineer/scripts/ast/tree-sitter.js +1 -0
  76. package/skills/octocode-code-engineer/scripts/ast/ts-analyzer.js +1 -0
  77. package/skills/octocode-code-engineer/scripts/collectors/chains.js +1 -0
  78. package/skills/octocode-code-engineer/scripts/collectors/effects.js +1 -0
  79. package/skills/octocode-code-engineer/scripts/collectors/input-sources.js +1 -0
  80. package/skills/octocode-code-engineer/scripts/collectors/performance.js +1 -0
  81. package/skills/octocode-code-engineer/scripts/collectors/prototype-pollution.js +1 -0
  82. package/skills/octocode-code-engineer/scripts/collectors/security.js +1 -0
  83. package/skills/octocode-code-engineer/scripts/collectors/test-profile.js +1 -0
  84. package/skills/octocode-code-engineer/scripts/common/is-direct-run.js +1 -0
  85. package/skills/octocode-code-engineer/scripts/common/utils.js +1 -0
  86. package/skills/octocode-code-engineer/scripts/detectors/code-quality.js +1 -0
  87. package/skills/octocode-code-engineer/scripts/detectors/cohesion.js +1 -0
  88. package/skills/octocode-code-engineer/scripts/detectors/coupling.js +1 -0
  89. package/skills/octocode-code-engineer/scripts/detectors/cycle.js +1 -0
  90. package/skills/octocode-code-engineer/scripts/detectors/dead-code.js +1 -0
  91. package/skills/octocode-code-engineer/scripts/detectors/import-style.js +1 -0
  92. package/skills/octocode-code-engineer/scripts/detectors/index.js +1 -0
  93. package/skills/octocode-code-engineer/scripts/detectors/security.js +1 -0
  94. package/skills/octocode-code-engineer/scripts/detectors/semantic.js +1 -0
  95. package/skills/octocode-code-engineer/scripts/detectors/shared.js +1 -0
  96. package/skills/octocode-code-engineer/scripts/detectors/test-quality.js +1 -0
  97. package/skills/octocode-code-engineer/scripts/index.js +1 -0
  98. package/skills/octocode-code-engineer/scripts/pipeline/cache.js +1 -0
  99. package/skills/octocode-code-engineer/scripts/pipeline/cli.js +1 -0
  100. package/skills/octocode-code-engineer/scripts/pipeline/main.js +2 -0
  101. package/skills/octocode-code-engineer/scripts/reporting/analysis.js +1 -0
  102. package/skills/octocode-code-engineer/scripts/reporting/summary-md.js +1 -0
  103. package/skills/octocode-code-engineer/scripts/reporting/writer.js +1 -0
  104. package/skills/octocode-code-engineer/scripts/types/constants.js +1 -0
  105. package/skills/octocode-code-engineer/scripts/types/index.js +1 -0
  106. package/skills/octocode-code-engineer/scripts/types/interfaces.js +1 -0
  107. package/skills/octocode-code-engineer/src/analysis/dependencies.test.ts +545 -0
  108. package/skills/octocode-code-engineer/src/analysis/dependencies.ts +406 -0
  109. package/skills/octocode-code-engineer/src/analysis/dependency-summary.test.ts +566 -0
  110. package/skills/octocode-code-engineer/src/analysis/dependency-summary.ts +257 -0
  111. package/skills/octocode-code-engineer/src/analysis/discovery.test.ts +420 -0
  112. package/skills/octocode-code-engineer/src/analysis/discovery.ts +87 -0
  113. package/skills/octocode-code-engineer/src/analysis/graph-analytics.test.ts +449 -0
  114. package/skills/octocode-code-engineer/src/analysis/graph-analytics.ts +534 -0
  115. package/skills/octocode-code-engineer/src/analysis/semantic.test.ts +1533 -0
  116. package/skills/octocode-code-engineer/src/analysis/semantic.ts +830 -0
  117. package/skills/octocode-code-engineer/src/ast/helpers.test.ts +185 -0
  118. package/skills/octocode-code-engineer/src/ast/helpers.ts +62 -0
  119. package/skills/octocode-code-engineer/src/ast/metrics.test.ts +304 -0
  120. package/skills/octocode-code-engineer/src/ast/metrics.ts +204 -0
  121. package/skills/octocode-code-engineer/src/ast/search.test.ts +647 -0
  122. package/skills/octocode-code-engineer/src/ast/search.ts +648 -0
  123. package/skills/octocode-code-engineer/src/ast/tree-search.test.ts +199 -0
  124. package/skills/octocode-code-engineer/src/ast/tree-search.ts +392 -0
  125. package/skills/octocode-code-engineer/src/ast/tree-sitter.test.ts +407 -0
  126. package/skills/octocode-code-engineer/src/ast/tree-sitter.ts +402 -0
  127. package/skills/octocode-code-engineer/src/ast/ts-analyzer.test.ts +1864 -0
  128. package/skills/octocode-code-engineer/src/ast/ts-analyzer.ts +509 -0
  129. package/skills/octocode-code-engineer/src/collectors/chains.ts +74 -0
  130. package/skills/octocode-code-engineer/src/collectors/effects.test.ts +490 -0
  131. package/skills/octocode-code-engineer/src/collectors/effects.ts +332 -0
  132. package/skills/octocode-code-engineer/src/collectors/input-sources.test.ts +144 -0
  133. package/skills/octocode-code-engineer/src/collectors/input-sources.ts +196 -0
  134. package/skills/octocode-code-engineer/src/collectors/performance.test.ts +82 -0
  135. package/skills/octocode-code-engineer/src/collectors/performance.ts +141 -0
  136. package/skills/octocode-code-engineer/src/collectors/prototype-pollution.test.ts +55 -0
  137. package/skills/octocode-code-engineer/src/collectors/prototype-pollution.ts +162 -0
  138. package/skills/octocode-code-engineer/src/collectors/security.test.ts +124 -0
  139. package/skills/octocode-code-engineer/src/collectors/security.ts +309 -0
  140. package/skills/octocode-code-engineer/src/collectors/test-profile.test.ts +97 -0
  141. package/skills/octocode-code-engineer/src/collectors/test-profile.ts +269 -0
  142. package/skills/octocode-code-engineer/src/common/is-direct-run.test.ts +32 -0
  143. package/skills/octocode-code-engineer/src/common/is-direct-run.ts +13 -0
  144. package/skills/octocode-code-engineer/src/common/utils.test.ts +463 -0
  145. package/skills/octocode-code-engineer/src/common/utils.ts +304 -0
  146. package/skills/octocode-code-engineer/src/detectors/code-quality.ts +966 -0
  147. package/skills/octocode-code-engineer/src/detectors/cohesion.ts +539 -0
  148. package/skills/octocode-code-engineer/src/detectors/coupling.ts +323 -0
  149. package/skills/octocode-code-engineer/src/detectors/cycle.ts +349 -0
  150. package/skills/octocode-code-engineer/src/detectors/dead-code.ts +320 -0
  151. package/skills/octocode-code-engineer/src/detectors/import-style.ts +376 -0
  152. package/skills/octocode-code-engineer/src/detectors/index.test.ts +3061 -0
  153. package/skills/octocode-code-engineer/src/detectors/index.ts +88 -0
  154. package/skills/octocode-code-engineer/src/detectors/security.test.ts +882 -0
  155. package/skills/octocode-code-engineer/src/detectors/security.ts +821 -0
  156. package/skills/octocode-code-engineer/src/detectors/semantic.ts +758 -0
  157. package/skills/octocode-code-engineer/src/detectors/shared.ts +49 -0
  158. package/skills/octocode-code-engineer/src/detectors/test-quality.test.ts +388 -0
  159. package/skills/octocode-code-engineer/src/detectors/test-quality.ts +367 -0
  160. package/skills/octocode-code-engineer/src/index.test.ts +4425 -0
  161. package/skills/octocode-code-engineer/src/index.ts +403 -0
  162. package/skills/octocode-code-engineer/src/pipeline/cache.test.ts +199 -0
  163. package/skills/octocode-code-engineer/src/pipeline/cache.ts +130 -0
  164. package/skills/octocode-code-engineer/src/pipeline/cli.test.ts +493 -0
  165. package/skills/octocode-code-engineer/src/pipeline/cli.ts +344 -0
  166. package/skills/octocode-code-engineer/src/pipeline/main.test.ts +174 -0
  167. package/skills/octocode-code-engineer/src/pipeline/main.ts +1074 -0
  168. package/skills/octocode-code-engineer/src/pipeline.test.ts +84 -0
  169. package/skills/octocode-code-engineer/src/reporting/analysis.test.ts +782 -0
  170. package/skills/octocode-code-engineer/src/reporting/analysis.ts +688 -0
  171. package/skills/octocode-code-engineer/src/reporting/output-contract.test.ts +463 -0
  172. package/skills/octocode-code-engineer/src/reporting/summary-md.test.ts +421 -0
  173. package/skills/octocode-code-engineer/src/reporting/summary-md.ts +714 -0
  174. package/skills/octocode-code-engineer/src/reporting/writer.ts +430 -0
  175. package/skills/octocode-code-engineer/src/sanity.test.ts +47 -0
  176. package/skills/octocode-code-engineer/src/types/constants.ts +248 -0
  177. package/skills/octocode-code-engineer/src/types/index.ts +80 -0
  178. package/skills/octocode-code-engineer/src/types/interfaces.ts +682 -0
  179. package/skills/octocode-code-engineer/tsconfig.json +17 -0
  180. package/skills/octocode-code-engineer/vitest.config.ts +8 -0
  181. package/skills/octocode-documentation-writer/README.md +113 -0
  182. package/skills/octocode-documentation-writer/SKILL.md +886 -0
  183. package/skills/octocode-documentation-writer/references/agent-discovery-analysis.md +453 -0
  184. package/skills/octocode-documentation-writer/references/agent-documentation-writer.md +255 -0
  185. package/skills/octocode-documentation-writer/references/agent-engineer-questions.md +247 -0
  186. package/skills/octocode-documentation-writer/references/agent-orchestrator.md +370 -0
  187. package/skills/octocode-documentation-writer/references/agent-qa-validator.md +227 -0
  188. package/skills/octocode-documentation-writer/references/agent-researcher.md +250 -0
  189. package/skills/octocode-documentation-writer/schemas/analysis-schema.json +886 -0
  190. package/skills/octocode-documentation-writer/schemas/discovery-tasks.json +96 -0
  191. package/skills/octocode-documentation-writer/schemas/documentation-structure.json +373 -0
  192. package/skills/octocode-documentation-writer/schemas/partial-discovery-schema.json +102 -0
  193. package/skills/octocode-documentation-writer/schemas/partial-research-schema.json +98 -0
  194. package/skills/octocode-documentation-writer/schemas/qa-results-schema.json +113 -0
  195. package/skills/octocode-documentation-writer/schemas/questions-schema.json +228 -0
  196. package/skills/octocode-documentation-writer/schemas/research-schema.json +104 -0
  197. package/skills/octocode-documentation-writer/schemas/state-schema.json +222 -0
  198. package/skills/octocode-documentation-writer/schemas/work-assignments-schema.json +74 -0
  199. package/skills/octocode-plan/SKILL.md +122 -116
  200. package/skills/octocode-prompt-optimizer/SKILL.md +617 -0
  201. package/skills/octocode-pull-request-reviewer/README.md +249 -0
  202. package/skills/octocode-pull-request-reviewer/SKILL.md +479 -0
  203. package/skills/octocode-pull-request-reviewer/references/dependency-check.md +74 -0
  204. package/skills/octocode-pull-request-reviewer/references/domain-reviewers.md +24 -0
  205. package/skills/octocode-pull-request-reviewer/references/execution-lifecycle.md +441 -0
  206. package/skills/octocode-pull-request-reviewer/references/flow-analysis-protocol.md +64 -0
  207. package/skills/octocode-pull-request-reviewer/references/output-template.md +174 -0
  208. package/skills/octocode-pull-request-reviewer/references/parallel-agent-protocol.md +182 -0
  209. package/skills/octocode-pull-request-reviewer/references/review-guidelines.md +26 -0
  210. package/skills/octocode-pull-request-reviewer/references/verification-checklist.md +40 -0
  211. package/skills/octocode-research/.claude/settings.local.json +46 -0
  212. package/skills/octocode-research/.octocode/plan/code-review-fixes/plan.md +312 -0
  213. package/skills/octocode-research/.octocode/plan/code-review-fixes/research.md +212 -0
  214. package/skills/octocode-research/.octocode/plans/NODE_SERVER_START_PLAN.md +755 -0
  215. package/skills/octocode-research/.octocode/research/code-review/research.md +371 -0
  216. package/skills/octocode-research/.octocode/review/IMPROVEMENTS.md +391 -0
  217. package/skills/octocode-research/.octocode/review/REVIEW_PLAN.md +289 -0
  218. package/skills/octocode-research/.octocode/review/REVIEW_REPORT.md +356 -0
  219. package/skills/octocode-research/AGENTS.md +349 -0
  220. package/skills/octocode-research/README.md +494 -0
  221. package/skills/octocode-research/SKILL.md +652 -274
  222. package/skills/octocode-research/docs/API_REFERENCE.md +562 -0
  223. package/skills/octocode-research/docs/ARCHITECTURE.md +554 -0
  224. package/skills/octocode-research/docs/FLOWS.md +577 -0
  225. package/skills/octocode-research/docs/OVERVIEW.md +564 -0
  226. package/skills/octocode-research/docs/SERVER_FLOWS.md +631 -0
  227. package/skills/octocode-research/ecosystem.config.cjs +88 -0
  228. package/skills/octocode-research/eslint.config.mjs +27 -0
  229. package/skills/octocode-research/package.json +84 -0
  230. package/skills/octocode-research/references/GUARDRAILS.md +40 -0
  231. package/skills/octocode-research/references/PARALLEL_AGENT_PROTOCOL.md +178 -0
  232. package/skills/octocode-research/references/roast-prompt.md +149 -0
  233. package/skills/octocode-research/scripts/server-init.d.ts +2 -0
  234. package/skills/octocode-research/scripts/server-init.js +2 -0
  235. package/skills/octocode-research/scripts/server.d.ts +8 -0
  236. package/skills/octocode-research/scripts/server.js +445 -0
  237. package/skills/octocode-research/src/__tests__/integration/circuitBreaker.test.ts +205 -0
  238. package/skills/octocode-research/src/__tests__/integration/routes.test.ts +374 -0
  239. package/skills/octocode-research/src/__tests__/unit/circuitBreaker.test.ts +245 -0
  240. package/skills/octocode-research/src/__tests__/unit/errorHandler.test.ts +183 -0
  241. package/skills/octocode-research/src/__tests__/unit/httpPreprocess.test.ts +157 -0
  242. package/skills/octocode-research/src/__tests__/unit/logger.test.ts +143 -0
  243. package/skills/octocode-research/src/__tests__/unit/queryParser.test.ts +130 -0
  244. package/skills/octocode-research/src/__tests__/unit/responseBuilder.test.ts +469 -0
  245. package/skills/octocode-research/src/__tests__/unit/retry.test.ts +205 -0
  246. package/skills/octocode-research/src/index.ts +186 -0
  247. package/skills/octocode-research/src/mcpCache.ts +49 -0
  248. package/skills/octocode-research/src/middleware/errorHandler.ts +65 -0
  249. package/skills/octocode-research/src/middleware/logger.ts +61 -0
  250. package/skills/octocode-research/src/middleware/queryParser.ts +115 -0
  251. package/skills/octocode-research/src/middleware/readiness.ts +17 -0
  252. package/skills/octocode-research/src/routes/github.ts +197 -0
  253. package/skills/octocode-research/src/routes/local.ts +175 -0
  254. package/skills/octocode-research/src/routes/lsp.ts +177 -0
  255. package/skills/octocode-research/src/routes/package.ts +127 -0
  256. package/skills/octocode-research/src/routes/prompts.ts +138 -0
  257. package/skills/octocode-research/src/routes/tools.ts +677 -0
  258. package/skills/octocode-research/src/server-init.ts +363 -0
  259. package/skills/octocode-research/src/server.ts +285 -0
  260. package/skills/octocode-research/src/types/errorGuards.ts +151 -0
  261. package/skills/octocode-research/src/types/express.d.ts +76 -0
  262. package/skills/octocode-research/src/types/guards.ts +98 -0
  263. package/skills/octocode-research/src/types/mcp.ts +119 -0
  264. package/skills/octocode-research/src/types/responses.ts +199 -0
  265. package/skills/octocode-research/src/types/toolTypes.ts +33 -0
  266. package/skills/octocode-research/src/utils/asyncTimeout.ts +116 -0
  267. package/skills/octocode-research/src/utils/circuitBreaker.ts +492 -0
  268. package/skills/octocode-research/src/utils/colors.ts +53 -0
  269. package/skills/octocode-research/src/utils/errorQueue.ts +71 -0
  270. package/skills/octocode-research/src/utils/logEmoji.ts +103 -0
  271. package/skills/octocode-research/src/utils/logger.ts +413 -0
  272. package/skills/octocode-research/src/utils/resilience.ts +169 -0
  273. package/skills/octocode-research/src/utils/responseBuilder.ts +495 -0
  274. package/skills/octocode-research/src/utils/responseFactory.ts +100 -0
  275. package/skills/octocode-research/src/utils/responseParser.ts +272 -0
  276. package/skills/octocode-research/src/utils/retry.ts +280 -0
  277. package/skills/octocode-research/src/utils/routeFactory.ts +117 -0
  278. package/skills/octocode-research/src/utils/url.ts +20 -0
  279. package/skills/octocode-research/src/validation/httpPreprocess.ts +155 -0
  280. package/skills/octocode-research/src/validation/index.ts +2 -0
  281. package/skills/octocode-research/src/validation/schemas.ts +578 -0
  282. package/skills/octocode-research/src/validation/toolCallSchema.ts +132 -0
  283. package/skills/octocode-research/tsconfig.json +21 -0
  284. package/skills/octocode-research/tsdown.config.ts +42 -0
  285. package/skills/octocode-research/vitest.config.ts +20 -0
  286. package/skills/octocode-researcher/SKILL.md +461 -0
  287. package/skills/octocode-researcher/references/fallbacks.md +120 -0
  288. package/skills/{octocode-local-search → octocode-researcher}/references/tool-reference.md +132 -49
  289. package/skills/{octocode-local-search → octocode-researcher}/references/workflow-patterns.md +204 -4
  290. package/skills/octocode-rfc-generator/SKILL.md +223 -0
  291. package/skills/octocode-rfc-generator/references/rfc-template.md +193 -0
  292. package/skills/octocode-roast/SKILL.md +63 -21
  293. package/skills/octocode-implement/SKILL.md +0 -293
  294. package/skills/octocode-implement/references/execution-phases.md +0 -317
  295. package/skills/octocode-implement/references/tool-reference.md +0 -403
  296. package/skills/octocode-implement/references/workflow-patterns.md +0 -385
  297. package/skills/octocode-local-search/SKILL.md +0 -449
  298. package/skills/octocode-pr-review/SKILL.md +0 -391
  299. package/skills/octocode-pr-review/references/domain-reviewers.md +0 -105
  300. package/skills/octocode-pr-review/references/execution-lifecycle.md +0 -116
  301. package/skills/octocode-pr-review/references/research-flows.md +0 -75
  302. package/skills/octocode-research/references/tool-reference.md +0 -304
  303. package/skills/octocode-research/references/workflow-patterns.md +0 -325
@@ -0,0 +1,617 @@
1
+ ---
2
+ name: octocode-prompt-optimizer
3
+ description: This skill should be used when the user asks to "optimize this prompt", "improve this SKILL.md", "make this prompt more reliable", "fix my agent instructions", "review this AGENTS.md", "strengthen this prompt", "my agent keeps skipping steps", "add enforcement to instructions", or needs to transform weak prompts into reliable, enforceable agent protocols. Uses a 6-step gated flow (with Fast/Full modes), command strengthening, gate injection, and failure mode analysis.
4
+ ---
5
+
6
+ # Prompt Optimizer Skill
7
+
8
+ <what>
9
+ Analyzes and improves instructional prompts, documentation, and agent instructions using prompt engineering best practices while preserving original intent.
10
+ </what>
11
+
12
+ <when_to_use>
13
+ - Creating or improving prompts
14
+ - Agents skip steps or ignore instructions
15
+ - Instructions lack enforcement
16
+ - Output format is inconsistent
17
+ - Reviewing any instruction document or prompt
18
+ - Strengthening agent-operational text without changing business/domain logic
19
+ </when_to_use>
20
+
21
+ <global_forbidden priority="maximum">
22
+ **CRITICAL - FORBIDDEN at ALL times:**
23
+ 1. Changing good parts that already work
24
+ 2. Changing the existing logic/intent of prompts
25
+ 3. Making changes before understanding the prompt
26
+ 4. Leaving weak words in critical sections
27
+ 5. Outputting without validation
28
+ 6. Over-strengthening soft guidance
29
+ 7. Skipping gates or checkboxes
30
+ 8. Bloating prompts - target line count increase <10%; if >10%, MUST document a one-line justification in VALIDATE
31
+
32
+ **Triple Lock:**
33
+ - **STATE:** You MUST preserve working logic AND follow all gates in order
34
+ - **FORBID:** FORBIDDEN: Altering intent without user approval
35
+ - **FORBID:** FORBIDDEN: Skipping steps or gates
36
+ - **REQUIRE:** REQUIRED: Validate all changes before output AND complete all checkboxes
37
+
38
+ **Violation invalidates optimization. Start over if violated.**
39
+ </global_forbidden>
40
+
41
+ <tool_control priority="high">
42
+ **FORBIDDEN tools during optimization:**
43
+ - Direct file/system modification that bypasses quality gates
44
+ - Any tool usage that executes code or commands unrelated to prompt optimization
45
+ - Tools that skip the READ→UNDERSTAND→RATE→FIX→VALIDATE flow
46
+
47
+ **ALLOWED tools:**
48
+ - Read-only file access (to read prompt files)
49
+ - Safe file edit/write capability (ONLY after VALIDATE step passes)
50
+ - Clarification question capability (for user clarification)
51
+ - Text output (all phases)
52
+
53
+ **Compatibility note (REQUIRED):**
54
+ - Map capability names to the active runtime's tool names.
55
+ - Example aliases: read-only file access = Read/ReadFile/localGetFileContent; safe file edit/write = Write/StrReplace/ApplyPatch.
56
+ - **IF** the runtime is read-only or lacks a safe write tool → **THEN** output the optimized text or delta without attempting file edits.
57
+ </tool_control>
58
+
59
+ <write_policy priority="high">
60
+ **Write policy (REQUIRED):**
61
+ - **IF** the user asked for review/advice only → **THEN** do not modify files; return the optimized content in chat.
62
+ - **IF** the user asked to update a specific file and a safe write tool exists → **THEN** write only after VALIDATE passes.
63
+ - **IF** the path is missing, not writable, or unsafe to edit → **THEN** return the optimized content or patch-style delta and state that no file changes were made.
64
+ </write_policy>
65
+
66
+ ---
67
+
68
+ ## Execution Flow
69
+
70
+ <execution_flow>
71
+ ```
72
+ READ → UNDERSTAND → RATE → FIX → VALIDATE → OUTPUT
73
+ ↓ ↓ ↓ ↓ ↓ ↓
74
+ GATE GATE GATE GATE GATE GATE
75
+ ```
76
+
77
+ | Step | Action | Gate Requirement | FORBIDDEN Until Gate Passes |
78
+ |------|--------|------------------|----------------------------|
79
+ | 1 | **READ** the prompt completely | All checkboxes checked | Analysis, changes |
80
+ | 2 | **UNDERSTAND** what the prompt does | Understanding output produced | Rating, fixes |
81
+ | 3 | **RATE** each part for issues | Issues table produced | Fixing issues |
82
+ | 4 | **FIX** issues by severity | All Critical/High fixed | Validation |
83
+ | 5 | **VALIDATE** against checklist | All REQUIRED checks pass | Output |
84
+ | 6 | **OUTPUT** optimized document | Format followed exactly | N/A |
85
+
86
+ **CRITICAL:** You MUST complete each gate before proceeding. DO NOT skip steps.
87
+
88
+ ### Adaptive Mode Selector (REQUIRED)
89
+ | Mode | Use When | Allowed Compression | Non-negotiables |
90
+ |------|----------|---------------------|-----------------|
91
+ | **Fast Path** | Short/single-purpose prompt, low ambiguity, <=3 logical parts, no unresolved unknowns | READ+UNDERSTAND may be combined; RATE+FIX may be compacted into one section if issues table is still produced | VALIDATE and intent-preservation checks are ALWAYS required |
92
+ | **Full Path** | Multi-section prompt, high ambiguity, >=4 logical parts, conflicting constraints, or Critical/High risk | No compression. Execute each gate separately | All gates and templates required |
93
+
94
+ **Mode selection rules (REQUIRED):**
95
+ - **IF** any unknown blocks progress, conflicting instructions exist, or Critical/High issues are likely → **THEN** use Full Path.
96
+ - **IF** prompt is simple and unambiguous with low risk → **THEN** Fast Path is allowed.
97
+ - **IF** uncertain which mode applies → **THEN** default to Full Path.
98
+
99
+ ### Minimum Execution Profile (Very Small Tasks)
100
+ - **IF** task is very small and unambiguous → **THEN** use Fast Path with concise outputs.
101
+ - **MUST:** preserve intent, perform a minimal issue scan, and pass VALIDATE before output.
102
+ - **MUST:** follow selected output variant format.
103
+ - **IF** ambiguity, conflict, or High/Critical risk appears → **THEN** escalate to Full Path immediately.
104
+
105
+ **Global enforcement baseline:** `global_forbidden` and VALIDATE are source-of-truth constraints for every gate; gate sections focus on step-specific requirements.
106
+ </execution_flow>
107
+
108
+ ---
109
+
110
+ ## Step 1: READ
111
+
112
+ <read_gate>
113
+ **STOP. DO NOT proceed to analysis.**
114
+
115
+ ### Pre-Conditions
116
+ - [ ] User provided prompt/file to optimize
117
+ - [ ] Path is valid and readable
118
+
119
+ ### Actions (REQUIRED)
120
+ 1. MUST read the input file completely
121
+ 2. MUST note the document type and purpose
122
+ 3. MUST count approximate line count
123
+
124
+ ### Gate Check
125
+ **Verify before proceeding:**
126
+ - [ ] File read completely (no skipped sections)
127
+ - [ ] Document type identified
128
+ - [ ] Line count noted
129
+
130
+ ### FORBIDDEN
131
+ - Making ANY changes before reading
132
+ - Skipping sections
133
+
134
+ ### ALLOWED
135
+ - Read-only file access only
136
+ - Text output to confirm reading
137
+
138
+ ### On Failure
139
+ - **IF** file unreadable and inline content exists → **THEN** continue using the provided content
140
+ - **IF** file unreadable and no content exists → **THEN** ask user for correct path
141
+ - **IF** file empty → **THEN** ask user to provide content
142
+ </read_gate>
143
+
144
+ ---
145
+
146
+ ## Step 2: UNDERSTAND
147
+
148
+ <understand_gate>
149
+ **STOP. DO NOT proceed to rating. Understand what this prompt does first.**
150
+
151
+ ### Pre-Conditions
152
+ - [ ] Step 1 (READ) completed
153
+ - [ ] File content in context
154
+
155
+ ### Actions (REQUIRED)
156
+ 1. MUST identify the **goal** - what is this prompt supposed to achieve?
157
+ 2. MUST identify **logical parts** - break down into sections/phases/steps
158
+ 3. MUST identify **flow** - how do the parts connect?
159
+ 4. MUST document understanding in output format below
160
+
161
+ ### Output Format (REQUIRED)
162
+ ```markdown
163
+ ## Understanding
164
+
165
+ **Goal:** [What the prompt achieves]
166
+
167
+ **Logical Parts:**
168
+ 1. [Part name] - [purpose]
169
+ 2. [Part name] - [purpose]
170
+ ...
171
+
172
+ **Flow:** [How parts connect]
173
+ ```
174
+
175
+ ### Assumptions & Unknowns (REQUIRED if prompt is underspecified)
176
+ ```markdown
177
+ ## Assumptions & Unknowns
178
+
179
+ **Assumptions (temporary - proceeding with these):**
180
+ - [Assumption 1] - Impact if wrong: [consequence]
181
+
182
+ **Unknowns (MUST ask before proceeding):**
183
+ - [Unknown 1] - Why critical: [reason]
184
+
185
+ **Clarification needed:** Yes/No
186
+ ```
187
+ **IF** Unknowns exist → **THEN** STOP and ask user before proceeding to RATE.
188
+
189
+ ### Gate Check
190
+ **Verify before proceeding:**
191
+ - [ ] Goal clearly stated
192
+ - [ ] All logical parts identified
193
+ - [ ] Flow documented
194
+ - [ ] Understanding output produced
195
+
196
+ ### Reflection
197
+ - Did I understand the intent correctly?
198
+ - Did I identify all logical parts?
199
+ **IF** you are uncertain about your understanding → **THEN** re-read before proceeding. DO NOT guess.
200
+
201
+ ### FORBIDDEN
202
+ - Proceeding without understanding the goal
203
+ - Making changes based on assumptions
204
+
205
+ ### ALLOWED
206
+ - Text output (understanding summary)
207
+ - Re-reading file if needed
208
+
209
+ ### On Failure
210
+ - **IF** intent unclear → **THEN** ask user for clarification
211
+ - **IF** multiple interpretations → **THEN** present options and WAIT for user choice
212
+ </understand_gate>
213
+
214
+ ---
215
+
216
+ ## Step 3: RATE
217
+
218
+ <rate_gate>
219
+ **STOP. DO NOT fix anything yet. Rate each logical part for issues first.**
220
+
221
+ ### Pre-Conditions
222
+ - [ ] Step 2 (UNDERSTAND) completed
223
+ - [ ] Understanding output produced
224
+
225
+ ### Issue Categories (MUST check all)
226
+
227
+ | Category | What to Look For | Severity |
228
+ |----------|------------------|----------|
229
+ | **Weak Words** | "consider", "might", "could", "may", "should" in critical sections | Critical |
230
+ | **Missing Enforcement** | Rules without FORBIDDEN/ALLOWED | High |
231
+ | **Ambiguous Instructions** | "do some", "handle", "process" without specifics | High |
232
+ | **Referential Ambiguity** | "it", "this", "that", "above", "below" without clear antecedent | High |
233
+ | **Missing Output Format** | Expected outputs without templates | Medium |
234
+ | **Missing Gates** | Phase transitions without checkpoints | Medium |
235
+ | **Duplication** | Same logic/rule repeated in multiple places (not just examples) | Medium |
236
+ | **Verbose/Bloat** | Sections >20 lines that could be tables; prose without constraints | Medium |
237
+ | **Emoji as Instructions** | Emojis used as commands instead of strong words | Medium |
238
+ | **Redundancy** | Same example repeated, unnecessary variations | Low |
239
+ | **Low Density** | Explanations that don't constrain behavior | Low |
240
+
241
+ ### Rating Output (REQUIRED)
242
+ ```markdown
243
+ ## Issues Found
244
+
245
+ | Part | Issue | Severity | Fix Needed |
246
+ |------|-------|----------|------------|
247
+ | [Part name] | [Description] | Critical/High/Medium/Low | [What to do] |
248
+ ```
249
+
250
+ ### Gate Check
251
+ **Verify before proceeding:**
252
+ - [ ] All logical parts rated
253
+ - [ ] Weak word scan completed
254
+ - [ ] Issues table produced
255
+ - [ ] Severity assigned to each issue
256
+
257
+ ### FORBIDDEN
258
+ - Fixing issues before completing rating
259
+ - Ignoring critical issues
260
+ - Skipping weak word scan
261
+
262
+ ### ALLOWED
263
+ - Text output (issues table)
264
+ - Re-reading parts for rating
265
+
266
+ ### On Failure
267
+ - **IF** no issues found → **THEN** MUST double-check with weak word scan
268
+ - **IF** scan still clean → **THEN** document "No issues found" and proceed
269
+ </rate_gate>
270
+
271
+ ### Weak Word Reference
272
+
273
+ | Weak Word | Context | Replacement |
274
+ |-----------|---------|-------------|
275
+ | consider, might, could, may | Critical section | **MUST**, **REQUIRED** |
276
+ | consider, might, could, may | Optional guidance | Remove or keep with "optionally" |
277
+ | should, prefer | Critical section | **MUST** |
278
+ | should, prefer | Soft guidance | Keep as-is |
279
+ | do some, handle, process | Any | Specify exact action: "Run X", "Call Y" |
280
+ | as needed, if necessary | Any | **IF** [condition] → **THEN** [action] |
281
+ | feel free to, you can | Required action | Remove entirely, use **MUST** |
282
+ | feel free to, you can | Optional action | "Optionally, you may..." |
283
+
284
+ **CRITICAL:** Weak words in FORBIDDEN/MUST/NEVER sections MUST be replaced.
285
+
286
+ ---
287
+
288
+ ## Step 4: FIX
289
+
290
+ <fix_gate>
291
+ **STOP. Fix issues in priority order: Critical → High → Medium → Low.**
292
+
293
+ ### Pre-Conditions
294
+ - [ ] Step 3 (RATE) completed
295
+ - [ ] Issues table produced
296
+
297
+ ### Fix Priority (MUST follow order)
298
+ 1. **Critical first** - Weak words in MUST/FORBIDDEN contexts
299
+ 2. **High next** - Missing enforcement, ambiguous instructions
300
+ 3. **Medium** - Missing output formats, missing gates
301
+ 4. **Low last** - Redundancy, density (only if value added)
302
+
303
+ ### Command Strength Hierarchy
304
+
305
+ | Strength | Keywords | Use For |
306
+ |----------|----------|---------|
307
+ | Absolute | NEVER, ALWAYS, MUST, FORBIDDEN, CRITICAL | Non-negotiable rules |
308
+ | Stop | STOP, HALT, DO NOT proceed, WAIT | Gates/checkpoints |
309
+ | Required | REQUIRED, MANDATORY | Essential steps |
310
+ | Soft | should, prefer | Optional guidance only |
311
+
312
+ ### Triple Lock Pattern (REQUIRED for Critical Rules)
313
+ ```
314
+ 1. STATE: "You MUST X"
315
+ 2. FORBID: "FORBIDDEN: Not doing X"
316
+ 3. REQUIRE: "REQUIRED: Verify X complete"
317
+ ```
318
+
319
+ ### Reasoning Block (CONDITIONAL REQUIRED Before Changes)
320
+ **REQUIRED when:**
321
+ - Full Path is active, OR
322
+ - Fast Path has any Critical/High issue.
323
+
324
+ **Optional when:**
325
+ - Fast Path has only Medium/Low issues; include one-line rationale instead.
326
+
327
+ Before making changes (when required), produce a `<reasoning>` block:
328
+ ```markdown
329
+ <reasoning>
330
+ 1. **Current state:** [What exists now]
331
+ 2. **Goal:** [What we are trying to achieve]
332
+ 3. **Approach:** [Why this specific change]
333
+ 4. **Risk:** [What could go wrong]
334
+ </reasoning>
335
+ ```
336
+
337
+ ### Gate Template (When Adding Gates)
338
+ ```markdown
339
+ <[name]_gate>
340
+ **STOP. DO NOT proceed. [What to verify]**
341
+
342
+ ### Pre-Conditions
343
+ - [ ] [Previous step completed]
344
+
345
+ ### Actions (REQUIRED)
346
+ 1. [Action]
347
+
348
+ ### Gate Check
349
+ **Verify before proceeding:**
350
+ - [ ] [Condition]
351
+
352
+ ### FORBIDDEN
353
+ - [What not to do]
354
+
355
+ ### ALLOWED
356
+ - [What is permitted]
357
+
358
+ ### On Failure
359
+ - **IF** [condition] → **THEN** [recovery]
360
+ </[name]_gate>
361
+ ```
362
+
363
+ ### Gate Check
364
+ **Verify before proceeding:**
365
+ - [ ] All Critical issues fixed
366
+ - [ ] All High issues fixed
367
+ - [ ] Medium/Low addressed or documented as skipped
368
+ - [ ] Reasoning requirement satisfied (block produced OR Fast Path low-risk rationale documented)
369
+
370
+ ### FORBIDDEN
371
+ - Over-strengthening soft guidance (keep "should" for optional items)
372
+ - Changing logic that already works
373
+ - Adding unnecessary complexity
374
+ - Skipping Critical/High issues
375
+ - Bloating: >10% line increase without explicit justification in VALIDATE
376
+
377
+ ### ALLOWED
378
+ - Text output (draft fixes)
379
+ - Iterating on fixes
380
+
381
+ ### On Failure
382
+ - **IF** over-strengthening detected → **THEN** revert and re-assess using RATE step criteria
383
+ - **IF** unsure if logic changed → **THEN** compare before/after intent
384
+ </fix_gate>
385
+
386
+ ---
387
+
388
+ ## Step 5: VALIDATE
389
+
390
+ <validate_gate>
391
+ **STOP. DO NOT output yet. Validate all fixes against checklist.**
392
+
393
+ ### Pre-Conditions
394
+ - [ ] Step 4 (FIX) completed
395
+ - [ ] All Critical/High issues addressed
396
+
397
+ ### Validation Checklist (MUST complete all)
398
+
399
+ **REQUIRED checks:**
400
+ - [ ] No weak words in critical sections
401
+ - [ ] Critical rules use MUST/NEVER/FORBIDDEN
402
+ - [ ] No conversational filler
403
+ - [ ] No conflicting instructions
404
+ - [ ] Logical flow preserved
405
+ - [ ] Original intent preserved
406
+ - [ ] Triple Lock applied to critical rules
407
+ - [ ] Line count target met (<10%) OR justified exception documented
408
+ - [ ] Any >10% increase includes one-line reason linked to required gate/clarity fixes
409
+
410
+ **Additional checks (if applicable):**
411
+ - [ ] Gates have Pre-Conditions, Gate Check, FORBIDDEN, ALLOWED, On Failure
412
+ - [ ] Outputs have format specifications
413
+ - [ ] IF/THEN rules for decision points
414
+
415
+ **Referential Clarity (MUST check):**
416
+ - [ ] No ambiguous pronouns or positional references without explicit antecedent
417
+ - [ ] All entities have stable names (same term throughout)
418
+ - [ ] Steps/outputs referenced by name, not position
419
+ - [ ] All cross-references are unambiguous
420
+ - [ ] No implicit "the" references without clear antecedent
421
+ - [ ] XML tags are optional; use only for attention-control needs (Markdown remains default)
422
+
423
+ ### Reflection (REQUIRED)
424
+ MUST answer these questions:
425
+ 1. Would I trust this prompt to execute reliably?
426
+ 2. What's the weakest remaining section?
427
+ 3. Did I change any original intent? (MUST be NO)
428
+
429
+ **IF** weakness identified → **THEN** fix or document as limitation
430
+ **IF** intent changed → **THEN** STOP and revert. Return to UNDERSTAND step.
431
+
432
+ ### Definition of Done (DoD) - Fast Final Gate
433
+ **ALL must be true before OUTPUT:**
434
+ - [ ] Single execution path (no ambiguous branches)
435
+ - [ ] All inputs/outputs explicitly defined
436
+ - [ ] All decision points use IF/THEN
437
+ - [ ] No orphan references (every "it/this" resolved)
438
+
439
+ ### Gate Check
440
+ **Verify before proceeding:**
441
+ - [ ] All REQUIRED checks pass
442
+ - [ ] Reflection questions answered
443
+ - [ ] No intent changes
444
+
445
+ ### FORBIDDEN
446
+ - Outputting without completing validation
447
+ - Skipping checklist items
448
+ - Proceeding with failed checks
449
+ - Using XML tags outside attention-control needs (Markdown remains default)
450
+
451
+ ### ALLOWED
452
+ - Text output (validation results)
453
+ - Returning to FIX step
454
+
455
+ ### On Failure
456
+ - **IF** validation fails → **THEN** return to FIX step
457
+ - **IF** intent changed → **THEN** return to UNDERSTAND step
458
+ </validate_gate>
459
+
460
+ ---
461
+
462
+ ## Step 6: OUTPUT
463
+
464
+ <output_gate>
465
+ **STOP. Verify VALIDATE step passed before outputting.**
466
+
467
+ ### Pre-Conditions
468
+ - [ ] Step 5 (VALIDATE) completed
469
+ - [ ] All REQUIRED checks passed
470
+ - [ ] No intent changes confirmed
471
+
472
+ ### Output Format (REQUIRED - select variant by user intent)
473
+
474
+ **Selection rule (REQUIRED):**
475
+ - **IF** user requests complete rewritten document → **THEN** use Variant A.
476
+ - **IF** user requests minimal edits/delta only → **THEN** use Variant B.
477
+ - **IF** user requests review-only or the runtime cannot write safely → **THEN** use Variant B unless the user explicitly asks for a full rewrite.
478
+ - **IF** user does not specify → **THEN** default to Variant A.
479
+
480
+ **Common report header (REQUIRED for both variants):**
481
+ ```markdown
482
+ # Optimization Complete
483
+
484
+ ## Summary
485
+ - **Issues Found:** [N]
486
+ - **Fixes Applied:** [N]
487
+ - **Intent Preserved:** Yes
488
+
489
+ ## Changes Made
490
+ | Category | Count | Examples |
491
+ |----------|-------|----------|
492
+ | Command Strengthening | [N] | [Brief example] |
493
+ | Gates Added/Fixed | [N] | [Brief example] |
494
+ | Redundancy Removed | [N] | [Brief example] |
495
+ ```
496
+
497
+ **Variant A - Full Document (default):**
498
+ ```markdown
499
+ ## Optimized Document
500
+ [Full optimized content]
501
+ ```
502
+
503
+ **Variant B - Patch-Style Delta (minimal edits):**
504
+ ```markdown
505
+ ## Patch-Style Delta
506
+ | Section | Before | After | Why |
507
+ |---------|--------|-------|-----|
508
+ | [Section name] | [Old text] | [New text] | [Reason] |
509
+ ```
510
+
511
+ ### FORBIDDEN
512
+ - Deviating from selected output variant
513
+ - Outputting without validation pass
514
+ - Omitting required deliverable (full document for Variant A, patch-style delta for Variant B)
515
+ - Claiming a file was updated when the write policy prevented edits
516
+
517
+ ### ALLOWED
518
+ - Safe file edit/write capability to save optimized content
519
+ - Text output (summary + document)
520
+
521
+ ### On Failure
522
+ - **IF** format deviates → **THEN** regenerate output
523
+ - **IF** user requests changes → **THEN** return to FIX step
524
+ </output_gate>
525
+
526
+ ---
527
+
528
+
529
+ ## Reference: Instruction Precedence
530
+
531
+ <precedence_table>
532
+ **When rules conflict, follow this precedence (highest wins):**
533
+
534
+ | Priority | Category | Examples | Notes |
535
+ |----------|----------|----------|-------|
536
+ | 1 (highest) | Safety/Tool Restrictions | FORBIDDEN tools, NEVER actions | Always wins |
537
+ | 2 | User explicit request | "I want X", "Do Y" | Overrides defaults |
538
+ | 3 | FORBIDDEN/MUST rules | "FORBIDDEN: changing logic" | Overrides preferences |
539
+ | 4 | Skill defaults | Default behaviors, templates | Baseline |
540
+ | 5 (lowest) | Soft guidance | "prefer", "consider" | Yields to all above |
541
+
542
+ **Resolution rule:** When two rules conflict, the higher priority wins. Document the conflict and resolution.
543
+ </precedence_table>
544
+
545
+ ---
546
+
547
+ ## Reference: Conflict Resolution Micro-Protocol
548
+
549
+ <conflict_protocol>
550
+ Use this protocol when instructions conflict:
551
+
552
+ 1. **Detect** - Name the two conflicting instructions explicitly.
553
+ 2. **Resolve** - Apply precedence table (highest priority wins).
554
+ 3. **Document** - Add one-line note: "Conflict: [A] vs [B] -> Resolved by [priority N rule]".
555
+ 4. **Continue** - Proceed using the resolved instruction only.
556
+
557
+ **FORBIDDEN:** Proceeding while both conflicting instructions remain active.
558
+ </conflict_protocol>
559
+
560
+ ---
561
+
562
+ ## Reference: Context Patterns
563
+
564
+ <reasoning_patterns>
565
+ ### State Summaries (Context Retention)
566
+ Use concise summaries only when needed to preserve context:
567
+ - Goal
568
+ - Progress
569
+ - Next step
570
+ - Blockers (if any)
571
+
572
+ **Conditional requirement:**
573
+ - Full Path: produce a state summary at each phase transition or context shift.
574
+ - Fast Path: produce a state summary only when context shifts materially.
575
+ </reasoning_patterns>
576
+
577
+ ---
578
+ ## Reference: High-Value vs Low-Value Content
579
+
580
+ <content_guide>
581
+ | Keep (High Value) | Remove/Reduce (Low Value) |
582
+ |-------------------|---------------------------|
583
+ | Tables with explicit actions | Explanatory prose without constraints |
584
+ | Imperative verbs (STOP, VERIFY, EXECUTE) | Repeated examples (keep 1-2) |
585
+ | FORBIDDEN/ALLOWED lists | Long paragraphs that can be tables |
586
+ | IF/THEN decision rules | Hedging language in critical rules |
587
+ | Markdown default + optional XML for attention control | Emoji used as instructions (unless required by output) |
588
+ </content_guide>
589
+
590
+ ---
591
+
592
+ ## Quick Reference
593
+
594
+ Use this only as a mnemonic; gate sections are source of truth.
595
+
596
+ | Need | Pattern |
597
+ |------|---------|
598
+ | Stop/Checkpoint | `**STOP. DO NOT proceed.**` + `### Gate Check` |
599
+ | Mandatory action | `**REQUIRED:** You MUST [action]` |
600
+ | Prohibited action | `**FORBIDDEN:** [action]` |
601
+ | Decision logic | `**IF** [condition] → **THEN** [action]` |
602
+ | Critical rule hardening | Triple Lock: STATE + FORBID + REQUIRE |
603
+
604
+ ---
605
+
606
+ ## Common Mistakes
607
+
608
+ <common_mistakes>
609
+ | Mistake | Why It Fails | Fix |
610
+ |---------|--------------|-----|
611
+ | Over-strengthening soft guidance | "prefer" → "MUST" breaks optional flexibility | Keep "should/prefer" for truly optional items |
612
+ | Using "it/this/that" | Agent loses context, applies fix to wrong element | Name every entity explicitly |
613
+ | Changing working logic | User trusted original behavior | FORBIDDEN: If the logic works, don't touch it |
614
+ | Overusing XML tags | Noise and style drift without reliability gain | Keep Markdown default; use XML only for attention control |
615
+ </common_mistakes>
616
+
617
+ ---